fix misc. errors reported by clang static analyzer
This commit is contained in:
parent
9b954c7ed5
commit
ce054bfc3f
@ -59,7 +59,7 @@ void DownloadManager::Start()
|
|||||||
|
|
||||||
void DownloadManager::Update()
|
void DownloadManager::Update()
|
||||||
{
|
{
|
||||||
unsigned int numActiveDownloads;
|
unsigned int numActiveDownloads = 0;
|
||||||
while (!managerShutdown)
|
while (!managerShutdown)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&downloadAddLock);
|
pthread_mutex_lock(&downloadAddLock);
|
||||||
|
@ -734,33 +734,6 @@ int Graphics::CharIndexAtPosition(char *s, int positionX, int positionY)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Graphics::textposxy(char *s, int width, int w, int h)
|
|
||||||
{
|
|
||||||
int x=0,y=0,n=0,cw, wordlen, charspace;
|
|
||||||
while (*s)
|
|
||||||
{
|
|
||||||
wordlen = strcspn(s," .,!?\n");
|
|
||||||
charspace = textwidthx(s, width-x);
|
|
||||||
if (charspace<wordlen && wordlen && width-x<width/3)
|
|
||||||
{
|
|
||||||
x = 0;
|
|
||||||
y += FONT_H+2;
|
|
||||||
}
|
|
||||||
for (; *s && --wordlen>=-1; s++)
|
|
||||||
{
|
|
||||||
cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]];
|
|
||||||
if ((x+(cw/2) >= w && y+6 >= h)||(y+6 >= h+FONT_H+2))
|
|
||||||
return n++;
|
|
||||||
x += cw;
|
|
||||||
if (x>=width) {
|
|
||||||
x = 0;
|
|
||||||
y += FONT_H+2;
|
|
||||||
}
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
int Graphics::textwrapheight(char *s, int width)
|
int Graphics::textwrapheight(char *s, int width)
|
||||||
{
|
{
|
||||||
int x=0, height=FONT_H+2, cw;
|
int x=0, height=FONT_H+2, cw;
|
||||||
|
@ -211,7 +211,6 @@ public:
|
|||||||
static int textnwidth(char *s, int n);
|
static int textnwidth(char *s, int n);
|
||||||
static void textnpos(char *s, int n, int w, int *cx, int *cy);
|
static void textnpos(char *s, int n, int w, int *cx, int *cy);
|
||||||
static int textwidthx(char *s, int w);
|
static int textwidthx(char *s, int w);
|
||||||
static int textposxy(char *s, int width, int w, int h);
|
|
||||||
static int textwrapheight(char *s, int width);
|
static int textwrapheight(char *s, int width);
|
||||||
static int textwidth(const char *s);
|
static int textwidth(const char *s);
|
||||||
static void textsize(const char * s, int & width, int & height);
|
static void textsize(const char * s, int & width, int & height);
|
||||||
|
@ -95,7 +95,7 @@ void Renderer::RenderBegin()
|
|||||||
{
|
{
|
||||||
std::copy(persistentVid, persistentVid+(VIDXRES*YRES), vid);
|
std::copy(persistentVid, persistentVid+(VIDXRES*YRES), vid);
|
||||||
}
|
}
|
||||||
pixel * oldVid;
|
pixel * oldVid = NULL;
|
||||||
if(display_mode & DISPLAY_WARP)
|
if(display_mode & DISPLAY_WARP)
|
||||||
{
|
{
|
||||||
oldVid = vid;
|
oldVid = vid;
|
||||||
@ -1028,6 +1028,8 @@ void Renderer::render_gravlensing(pixel * source)
|
|||||||
pixel t;
|
pixel t;
|
||||||
pixel *src = source;
|
pixel *src = source;
|
||||||
pixel *dst = vid;
|
pixel *dst = vid;
|
||||||
|
if (!dst)
|
||||||
|
return;
|
||||||
for(nx = 0; nx < XRES; nx++)
|
for(nx = 0; nx < XRES; nx++)
|
||||||
{
|
{
|
||||||
for(ny = 0; ny < YRES; ny++)
|
for(ny = 0; ny < YRES; ny++)
|
||||||
@ -2361,7 +2363,7 @@ void Renderer::draw_air()
|
|||||||
float (*hv)[XRES/CELL] = sim->air->hv;
|
float (*hv)[XRES/CELL] = sim->air->hv;
|
||||||
float (*vx)[XRES/CELL] = sim->air->vx;
|
float (*vx)[XRES/CELL] = sim->air->vx;
|
||||||
float (*vy)[XRES/CELL] = sim->air->vy;
|
float (*vy)[XRES/CELL] = sim->air->vy;
|
||||||
pixel c;
|
pixel c = 0;
|
||||||
for (y=0; y<YRES/CELL; y++)
|
for (y=0; y<YRES/CELL; y++)
|
||||||
for (x=0; x<XRES/CELL; x++)
|
for (x=0; x<XRES/CELL; x++)
|
||||||
{
|
{
|
||||||
|
@ -140,7 +140,7 @@ void ColourPickerActivity::OnMouseMove(int x, int y, int dx, int dy)
|
|||||||
if(valueMouseDown)
|
if(valueMouseDown)
|
||||||
{
|
{
|
||||||
x -= Position.X+5;
|
x -= Position.X+5;
|
||||||
y -= Position.Y+5;
|
//y -= Position.Y+5;
|
||||||
|
|
||||||
currentValue = x;
|
currentValue = x;
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ void ColourPickerActivity::OnMouseUp(int x, int y, unsigned button)
|
|||||||
valueMouseDown = false;
|
valueMouseDown = false;
|
||||||
|
|
||||||
x -= Position.X+5;
|
x -= Position.X+5;
|
||||||
y -= Position.Y+5;
|
//y -= Position.Y+5;
|
||||||
|
|
||||||
currentValue = x;
|
currentValue = x;
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ GameView::GameView():
|
|||||||
tagSimulationButton = new ui::Button(ui::Point(currentX, Size.Y-16), ui::Point(227, 15), "[no tags set]", "Add simulation tags");
|
tagSimulationButton = new ui::Button(ui::Point(currentX, Size.Y-16), ui::Point(227, 15), "[no tags set]", "Add simulation tags");
|
||||||
tagSimulationButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
tagSimulationButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
tagSimulationButton->SetIcon(IconTag);
|
tagSimulationButton->SetIcon(IconTag);
|
||||||
currentX+=252;
|
//currentX+=252;
|
||||||
tagSimulationButton->SetActionCallback(new TagSimulationAction(this));
|
tagSimulationButton->SetActionCallback(new TagSimulationAction(this));
|
||||||
AddComponent(tagSimulationButton);
|
AddComponent(tagSimulationButton);
|
||||||
|
|
||||||
@ -2433,9 +2433,9 @@ void GameView::OnDraw()
|
|||||||
fpsInfo << " [REPLACE MODE]";
|
fpsInfo << " [REPLACE MODE]";
|
||||||
if (c->GetReplaceModeFlags()&SPECIFIC_DELETE)
|
if (c->GetReplaceModeFlags()&SPECIFIC_DELETE)
|
||||||
fpsInfo << " [SPECIFIC DELETE]";
|
fpsInfo << " [SPECIFIC DELETE]";
|
||||||
if (ren->GetGridSize())
|
if (ren && ren->GetGridSize())
|
||||||
fpsInfo << " [GRID: " << ren->GetGridSize() << "]";
|
fpsInfo << " [GRID: " << ren->GetGridSize() << "]";
|
||||||
if (ren->findingElement)
|
if (ren && ren->findingElement)
|
||||||
fpsInfo << " [FIND]";
|
fpsInfo << " [FIND]";
|
||||||
|
|
||||||
int textWidth = Graphics::textwidth((char*)fpsInfo.str().c_str());
|
int textWidth = Graphics::textwidth((char*)fpsInfo.str().c_str());
|
||||||
|
@ -466,8 +466,8 @@ void SearchView::NotifyTagListChanged(SearchModel * sender)
|
|||||||
int savesY = 4, buttonPadding = 1;
|
int savesY = 4, buttonPadding = 1;
|
||||||
int buttonAreaHeight, buttonYOffset;
|
int buttonAreaHeight, buttonYOffset;
|
||||||
|
|
||||||
int tagWidth, tagHeight, tagX = 0, tagY = 0, tagsX = 6, tagsY = 4, tagPadding = 1;
|
int tagWidth = 0, tagHeight = 0, tagX = 0, tagY = 0, tagsX = 6, tagsY = 4, tagPadding = 1;
|
||||||
int tagAreaWidth, tagAreaHeight, tagXOffset, tagYOffset;
|
int tagAreaWidth, tagAreaHeight, tagXOffset = 0, tagYOffset = 0;
|
||||||
|
|
||||||
vector<pair<string, int> > tags = sender->GetTagList();
|
vector<pair<string, int> > tags = sender->GetTagList();
|
||||||
|
|
||||||
|
@ -272,8 +272,8 @@ AnyType TPTScriptInterface::tptS_set(std::deque<std::string> * words)
|
|||||||
throw GeneralException("Invalid property");
|
throw GeneralException("Invalid property");
|
||||||
|
|
||||||
//Selector
|
//Selector
|
||||||
int newValue;
|
int newValue = 0;
|
||||||
float newValuef;
|
float newValuef = 0.0f;
|
||||||
if (value.GetType() == TypeNumber)
|
if (value.GetType() == TypeNumber)
|
||||||
{
|
{
|
||||||
newValuef = newValue = ((NumberType)value).Value();
|
newValuef = newValue = ((NumberType)value).Value();
|
||||||
|
@ -185,7 +185,7 @@ int Element_PIPE::update(UPDATE_FUNC_ARGS)
|
|||||||
{
|
{
|
||||||
rndstore = rand();
|
rndstore = rand();
|
||||||
rnd = rndstore&7;
|
rnd = rndstore&7;
|
||||||
rndstore = rndstore>>3;
|
//rndstore = rndstore>>3;
|
||||||
rx = pos_1_rx[rnd];
|
rx = pos_1_rx[rnd];
|
||||||
ry = pos_1_ry[rnd];
|
ry = pos_1_ry[rnd];
|
||||||
if (BOUNDS_CHECK)
|
if (BOUNDS_CHECK)
|
||||||
|
@ -143,6 +143,7 @@ int Element_STKM::run_stickman(playerst *playerp, UPDATE_FUNC_ARGS) {
|
|||||||
rby = 1.0f;
|
rby = 1.0f;
|
||||||
tmp = 1.0f;
|
tmp = 1.0f;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
tmp = 1.0f/sqrtf(rbx*rbx+rby*rby);
|
tmp = 1.0f/sqrtf(rbx*rbx+rby*rby);
|
||||||
rbx *= tmp;// scale to a unit vector
|
rbx *= tmp;// scale to a unit vector
|
||||||
rby *= tmp;
|
rby *= tmp;
|
||||||
|
Reference in New Issue
Block a user