diff --git a/bsp.cpp b/bsp.cpp index b6e3d473..72eb4f0a 100644 --- a/bsp.cpp +++ b/bsp.cpp @@ -169,7 +169,7 @@ SBsp3 *SBsp3::InsertConvex(STriMeta meta, Vector *vertex, int cnt, bool isPos[MAX_VERTICES]; bool isNeg[MAX_VERTICES]; bool isOn[MAX_VERTICES]; - int posc = 0, negc = 0, onc = 0; + int posc, negc, onc; posc = negc = onc = 0; for(i = 0; i < cnt; i++) { double dt = n.Dot(vertex[i]); isPos[i] = isNeg[i] = isOn[i] = false; @@ -207,10 +207,10 @@ SBsp3 *SBsp3::InsertConvex(STriMeta meta, Vector *vertex, int cnt, Vector vpos[MAX_VERTICES]; Vector vneg[MAX_VERTICES]; - int npos = 0, nneg = 0; + int npos, nneg; npos = nneg = 0; Vector inter[2]; - int inters = 0; + int inters; inters = 0; for(i = 0; i < cnt; i++) { int ip = WRAP((i + 1), cnt); diff --git a/export.cpp b/export.cpp index 974190de..6a414223 100644 --- a/export.cpp +++ b/export.cpp @@ -685,11 +685,11 @@ void SolveSpace::ExportAsPngTo(char *filename) { FILE *f = fopen(filename, "wb"); if(!f) goto err; - png_struct *png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, + png_struct *png_ptr; png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if(!png_ptr) goto err; - png_info *info_ptr = png_create_info_struct(png_ptr); + png_info *info_ptr; info_ptr = png_create_info_struct(png_ptr); if(!png_ptr) goto err; if(setjmp(png_jmpbuf(png_ptr))) goto err; @@ -708,8 +708,8 @@ void SolveSpace::ExportAsPngTo(char *filename) { png_write_info(png_ptr, info_ptr); // Get the pixel data from the framebuffer - BYTE *pixels = (BYTE *)AllocTemporary(3*w*h); - BYTE **rowptrs = (BYTE **)AllocTemporary(h*sizeof(BYTE *)); + BYTE *pixels; pixels = (BYTE *)AllocTemporary(3*w*h); + BYTE **rowptrs; rowptrs = (BYTE **)AllocTemporary(h*sizeof(BYTE *)); glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, pixels); int y; diff --git a/mesh.cpp b/mesh.cpp index d8450fce..967bd380 100644 --- a/mesh.cpp +++ b/mesh.cpp @@ -389,14 +389,15 @@ SKdNode *SKdNode::From(STriangleLl *tll) { int which = 0; SKdNode *ret = Alloc(); - if(!tll) { - goto leaf; - } - int i; int gtc[3] = { 0, 0, 0 }, ltc[3] = { 0, 0, 0 }, allc = 0; double badness[3] = { 0, 0, 0 }; double split[3] = { 0, 0, 0 }; + + if(!tll) { + goto leaf; + } + for(i = 0; i < 3; i++) { int tcnt = 0; STriangleLl *ll; @@ -445,7 +446,7 @@ SKdNode *SKdNode::From(STriangleLl *tll) { } STriangleLl *ll; - STriangleLl *lgt = NULL, *llt = NULL; + STriangleLl *lgt, *llt; lgt = llt = NULL; for(ll = tll; ll; ll = ll->next) { STriangle *tr = ll->tri; diff --git a/style.cpp b/style.cpp index 243110c7..27033e51 100644 --- a/style.cpp +++ b/style.cpp @@ -399,14 +399,14 @@ void TextWindow::ScreenBackgroundImage(int link, DWORD v) { png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_EXPAND | PNG_TRANSFORM_STRIP_ALPHA, NULL); - int w = info_ptr->width, - h = info_ptr->height; - BYTE **rows = png_get_rows(png_ptr, info_ptr); + int w; w = (int)info_ptr->width; + int h; h = (int)info_ptr->height; + BYTE **rows; rows = png_get_rows(png_ptr, info_ptr); // Round to next-highest powers of two, since the textures require // that. And round up to 4, to guarantee DWORD alignment. - int rw = max(4, RoundUpToPowerOfTwo(w)), - rh = max(4, RoundUpToPowerOfTwo(h)); + int rw; rw = max(4, RoundUpToPowerOfTwo(w)); + int rh; rh = max(4, RoundUpToPowerOfTwo(h)); SS.bgImage.fromFile = (BYTE *)MemAlloc(rw*rh*3); for(int i = 0; i < h; i++) { diff --git a/system.cpp b/system.cpp index 8b38f665..f23c5a48 100644 --- a/system.cpp +++ b/system.cpp @@ -449,7 +449,7 @@ int System::Solve(Group *g, int *dof, List *bad, EvalJacobian(); - int rank = CalculateRank(); + int rank; rank = CalculateRank(); if(rank != mat.m) { if(andFindBad) { FindWhichToRemoveToFixJacobian(g, bad); diff --git a/textscreens.cpp b/textscreens.cpp index 7ba3278d..a4cd7605 100644 --- a/textscreens.cpp +++ b/textscreens.cpp @@ -383,7 +383,7 @@ void TextWindow::ShowGroupInfo(void) { &TextWindow::ScreenChangeGroupOption, g->visible ? CHECK_TRUE : CHECK_FALSE); - Group *pg = g->PreviousGroup(); + Group *pg; pg = g->PreviousGroup(); if(pg && pg->runningMesh.IsEmpty() && g->thisMesh.IsEmpty()) { Printf(false, " %f%Lf%Fd%c force NURBS surfaces to triangle mesh", &TextWindow::ScreenChangeGroupOption,