diff --git a/bsp.cpp b/bsp.cpp index 72eb4f0a..ae509c49 100644 --- a/bsp.cpp +++ b/bsp.cpp @@ -49,7 +49,7 @@ void SBsp3::InsertInPlane(bool pos2, STriangle *tr, SMesh *m) { Vector tc = ((tr->a).Plus(tr->b).Plus(tr->c)).ScaledBy(1.0/3); bool onFace = false; - bool sameNormal; + bool sameNormal = false; double maxNormalMag = -1; Vector lln, trn = tr->Normal(); diff --git a/draw.cpp b/draw.cpp index c9f4e05b..46597497 100644 --- a/draw.cpp +++ b/draw.cpp @@ -40,7 +40,7 @@ void GraphicsWindow::Selection::Clear(void) { } void GraphicsWindow::Selection::Draw(void) { - Vector refp; + Vector refp = Vector::From(0, 0, 0); if(entity.v) { Entity *e = SK.GetEntity(entity); e->Draw(); diff --git a/drawconstraint.cpp b/drawconstraint.cpp index 3e7bf33a..7a42653e 100644 --- a/drawconstraint.cpp +++ b/drawconstraint.cpp @@ -695,7 +695,7 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) { } case PERPENDICULAR: { - Vector u, v; + Vector u = Vector::From(0, 0, 0), v = Vector::From(0, 0, 0); Vector rn, ru; if(workplane.v == Entity::FREE_IN_3D.v) { rn = gn; @@ -845,7 +845,7 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) { case LENGTH_RATIO: case EQUAL_LENGTH_LINES: { - Vector a, b; + Vector a, b = Vector::From(0, 0, 0); for(int i = 0; i < 2; i++) { Entity *e = SK.GetEntity(i == 0 ? entityA : entityB); a = SK.GetEntity(e->point[0])->PointGetNum(); diff --git a/drawentity.cpp b/drawentity.cpp index 800a4919..b9afcd4c 100644 --- a/drawentity.cpp +++ b/drawentity.cpp @@ -239,7 +239,9 @@ void Entity::ComputeInterpolatingSpline(SBezierList *sbl, bool periodic) { // The starting and finishing control points that define our end tangents // (if the spline isn't periodic), and the on-curve points. - Vector ctrl_s, ctrl_f, pt[MAX_N+4]; + Vector ctrl_s = Vector::From(0, 0, 0); + Vector ctrl_f = Vector::From(0, 0, 0); + Vector pt[MAX_N+4]; if(periodic) { for(i = 0; i < ep + 3; i++) { pt[i] = SK.GetEntity(point[i])->PointGetNum(); diff --git a/mesh.cpp b/mesh.cpp index 967bd380..72ac223b 100644 --- a/mesh.cpp +++ b/mesh.cpp @@ -113,7 +113,8 @@ void SMesh::Simplify(int start) { STriangle *tout = (STriangle *)AllocTemporary(maxTriangles*sizeof(*tout)); int toutc = 0; - Vector n, *conv = (Vector *)AllocTemporary(maxTriangles*3*sizeof(*conv)); + Vector n = Vector::From(0, 0, 0); + Vector *conv = (Vector *)AllocTemporary(maxTriangles*3*sizeof(*conv)); int convc = 0; int start0 = start; diff --git a/modify.cpp b/modify.cpp index 0e8fcf67..86c709d1 100644 --- a/modify.cpp +++ b/modify.cpp @@ -286,7 +286,7 @@ void GraphicsWindow::MakeTangentArc(void) { memset(req, 0, sizeof(req)); Vector pinter; - double r, vv; + double r = 0.0, vv = 0.0; // We now do Newton iterations to find the tangent arc, and its positions // t back along the two curves, starting from shared point of the curves // at t = 0. Lots of iterations helps convergence, and this is still @@ -616,7 +616,7 @@ void GraphicsWindow::SplitLinesOrCurves(void) { sbla.AllIntersectionsWith(&sblb, &inters); if(inters.l.n > 0) { - Vector pi; + Vector pi = Vector::From(0, 0, 0); // If there's multiple points, then take the one closest to the // mouse pointer. double dmin = VERY_POSITIVE; diff --git a/polygon.cpp b/polygon.cpp index 46727f00..f146d729 100644 --- a/polygon.cpp +++ b/polygon.cpp @@ -203,7 +203,8 @@ bool SEdgeList::AssemblePolygon(SPolygon *dest, SEdge *errorAt, bool keepDir) { bool allClosed = true; for(;;) { - Vector first, last; + Vector first = Vector::From(0, 0, 0); + Vector last = Vector::From(0, 0, 0); int i; for(i = 0; i < l.n; i++) { if(!l.elem[i].tag) { @@ -826,7 +827,7 @@ void SContour::OffsetInto(SContour *dest, double r) { // material as we can without removing any that we shouldn't. double px0, py0, pdx, pdy; double nx0, ny0, ndx, ndy; - double x, y; + double x = 0.0, y = 0.0; px0 = b.x - r*sin(thetap); py0 = b.y + r*cos(thetap); diff --git a/request.cpp b/request.cpp index 168020a0..a6d8c097 100644 --- a/request.cpp +++ b/request.cpp @@ -76,7 +76,7 @@ bool EntReqTable::GetEntityInfo(int ent, int extraPoints, } int EntReqTable::GetRequestForEntity(int ent) { - int req; + int req = 0; GetEntityInfo(ent, 0, &req, NULL, NULL, NULL); return req; } diff --git a/srf/ratpoly.cpp b/srf/ratpoly.cpp index 578b2059..4bc4d04c 100644 --- a/srf/ratpoly.cpp +++ b/srf/ratpoly.cpp @@ -441,7 +441,7 @@ void SSurface::ClosestPointTo(Vector p, double *u, double *v, bool converge) { bool SSurface::ClosestPointNewton(Vector p, double *u, double *v, bool converge) { // Initial guess is in u, v; refine by Newton iteration. - Vector p0; + Vector p0 = Vector::From(0, 0, 0); for(int i = 0; i < (converge ? 25 : 5); i++) { p0 = PointAt(*u, *v); if(converge) { diff --git a/srf/raycast.cpp b/srf/raycast.cpp index aa85b198..11d8af3e 100644 --- a/srf/raycast.cpp +++ b/srf/raycast.cpp @@ -18,7 +18,7 @@ extern int FLAG; double SSurface::DepartureFromCoplanar(void) { int i, j; - int ia, ja, ib, jb, ic, jc; + int ia, ja, ib = 0, jb = 0, ic = 0, jc = 0; double best; // Grab three points to define a plane; first choose (0, 0) arbitrarily. diff --git a/srf/surface.cpp b/srf/surface.cpp index 92bbe9dd..71162380 100644 --- a/srf/surface.cpp +++ b/srf/surface.cpp @@ -211,7 +211,7 @@ bool SSurface::LineEntirelyOutsideBbox(Vector a, Vector b, bool segment) { void SSurface::MakeTrimEdgesInto(SEdgeList *sel, int flags, SCurve *sc, STrimBy *stb) { - Vector prev; + Vector prev = Vector::From(0, 0, 0); bool inCurve = false, empty = true; double u = 0, v = 0; diff --git a/srf/surfinter.cpp b/srf/surfinter.cpp index 171b7ec9..0c0a4c0c 100644 --- a/srf/surfinter.cpp +++ b/srf/surfinter.cpp @@ -392,8 +392,8 @@ void SSurface::IntersectAgainst(SSurface *b, SShell *agnstA, SShell *agnstB, sc.pts.Add(&padd); Point2d pa, pb; - Vector np, npc; - bool fwd; + Vector np, npc = Vector::From(0, 0, 0); + bool fwd = false; // Better to start with a too-small step, so that we don't miss // features of the curve entirely. double tol, step = maxtol; diff --git a/system.cpp b/system.cpp index f23c5a48..6d63fb5f 100644 --- a/system.cpp +++ b/system.cpp @@ -179,7 +179,7 @@ bool System::SolveLinearSystem(double X[], double A[][MAX_UNKNOWNS], // Gaussian elimination, with partial pivoting. It's an error if the // matrix is singular, because that means two constraints are // equivalent. - int i, j, ip, jp, imax; + int i, j, ip, jp, imax = 0; double max, temp; for(i = 0; i < n; i++) { diff --git a/ttf.cpp b/ttf.cpp index 96439270..6f52afc2 100644 --- a/ttf.cpp +++ b/ttf.cpp @@ -318,7 +318,7 @@ bool TtfFont::LoadFontFromFile(bool nameOnly) { WORD nameStringOffset = GetWORD(); // And now we're at the name records. Go through those till we find // one that we want. - int displayNameOffset, displayNameLength; + int displayNameOffset = 0, displayNameLength = 0; for(i = 0; i < nameCount; i++) { WORD platformID = GetWORD(); WORD encodingID = GetWORD(); @@ -430,8 +430,8 @@ bool TtfFont::LoadFontFromFile(bool nameOnly) { // and advance width) of the font. fseek(fh, hmtxAddr, SEEK_SET); - WORD hmtxAdvanceWidth; - SWORD hmtxLsb; + WORD hmtxAdvanceWidth = 0; + SWORD hmtxLsb = 0; for(i = 0; i < min(glyphs, hheaNumberOfMetrics); i++) { hmtxAdvanceWidth = GetWORD(); hmtxLsb = (SWORD)GetWORD(); diff --git a/win32/w32main.cpp b/win32/w32main.cpp index 5159cc14..6b5e597d 100644 --- a/win32/w32main.cpp +++ b/win32/w32main.cpp @@ -956,7 +956,7 @@ void RefreshRecentMenus(void) HMENU CreateGraphicsWindowMenus(void) { HMENU top = CreateMenu(); - HMENU m; + HMENU m = 0; int i; int subMenu = 0;