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