Quash "variable may be used uninitialized" warnings

Whether or not there is any actual danger of these variables being used
without initialization, the warnings are noise, and getting rid of them is
trivial.
pull/3/head
Daniel Richard G 2013-08-26 15:36:00 -04:00
parent df6125efee
commit 8913d11fa5
15 changed files with 25 additions and 21 deletions

View File

@ -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); Vector tc = ((tr->a).Plus(tr->b).Plus(tr->c)).ScaledBy(1.0/3);
bool onFace = false; bool onFace = false;
bool sameNormal; bool sameNormal = false;
double maxNormalMag = -1; double maxNormalMag = -1;
Vector lln, trn = tr->Normal(); Vector lln, trn = tr->Normal();

View File

@ -40,7 +40,7 @@ void GraphicsWindow::Selection::Clear(void) {
} }
void GraphicsWindow::Selection::Draw(void) { void GraphicsWindow::Selection::Draw(void) {
Vector refp; Vector refp = Vector::From(0, 0, 0);
if(entity.v) { if(entity.v) {
Entity *e = SK.GetEntity(entity); Entity *e = SK.GetEntity(entity);
e->Draw(); e->Draw();

View File

@ -695,7 +695,7 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) {
} }
case PERPENDICULAR: { case PERPENDICULAR: {
Vector u, v; Vector u = Vector::From(0, 0, 0), v = Vector::From(0, 0, 0);
Vector rn, ru; Vector rn, ru;
if(workplane.v == Entity::FREE_IN_3D.v) { if(workplane.v == Entity::FREE_IN_3D.v) {
rn = gn; rn = gn;
@ -845,7 +845,7 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) {
case LENGTH_RATIO: case LENGTH_RATIO:
case EQUAL_LENGTH_LINES: { case EQUAL_LENGTH_LINES: {
Vector a, b; Vector a, b = Vector::From(0, 0, 0);
for(int i = 0; i < 2; i++) { for(int i = 0; i < 2; i++) {
Entity *e = SK.GetEntity(i == 0 ? entityA : entityB); Entity *e = SK.GetEntity(i == 0 ? entityA : entityB);
a = SK.GetEntity(e->point[0])->PointGetNum(); a = SK.GetEntity(e->point[0])->PointGetNum();

View File

@ -239,7 +239,9 @@ void Entity::ComputeInterpolatingSpline(SBezierList *sbl, bool periodic) {
// The starting and finishing control points that define our end tangents // The starting and finishing control points that define our end tangents
// (if the spline isn't periodic), and the on-curve points. // (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) { if(periodic) {
for(i = 0; i < ep + 3; i++) { for(i = 0; i < ep + 3; i++) {
pt[i] = SK.GetEntity(point[i])->PointGetNum(); pt[i] = SK.GetEntity(point[i])->PointGetNum();

View File

@ -113,7 +113,8 @@ void SMesh::Simplify(int start) {
STriangle *tout = (STriangle *)AllocTemporary(maxTriangles*sizeof(*tout)); STriangle *tout = (STriangle *)AllocTemporary(maxTriangles*sizeof(*tout));
int toutc = 0; 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 convc = 0;
int start0 = start; int start0 = start;

View File

@ -286,7 +286,7 @@ void GraphicsWindow::MakeTangentArc(void) {
memset(req, 0, sizeof(req)); memset(req, 0, sizeof(req));
Vector pinter; 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 // 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 // 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 // at t = 0. Lots of iterations helps convergence, and this is still
@ -616,7 +616,7 @@ void GraphicsWindow::SplitLinesOrCurves(void) {
sbla.AllIntersectionsWith(&sblb, &inters); sbla.AllIntersectionsWith(&sblb, &inters);
if(inters.l.n > 0) { 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 // If there's multiple points, then take the one closest to the
// mouse pointer. // mouse pointer.
double dmin = VERY_POSITIVE; double dmin = VERY_POSITIVE;

View File

@ -203,7 +203,8 @@ bool SEdgeList::AssemblePolygon(SPolygon *dest, SEdge *errorAt, bool keepDir) {
bool allClosed = true; bool allClosed = true;
for(;;) { for(;;) {
Vector first, last; Vector first = Vector::From(0, 0, 0);
Vector last = Vector::From(0, 0, 0);
int i; int i;
for(i = 0; i < l.n; i++) { for(i = 0; i < l.n; i++) {
if(!l.elem[i].tag) { 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. // material as we can without removing any that we shouldn't.
double px0, py0, pdx, pdy; double px0, py0, pdx, pdy;
double nx0, ny0, ndx, ndy; double nx0, ny0, ndx, ndy;
double x, y; double x = 0.0, y = 0.0;
px0 = b.x - r*sin(thetap); px0 = b.x - r*sin(thetap);
py0 = b.y + r*cos(thetap); py0 = b.y + r*cos(thetap);

View File

@ -76,7 +76,7 @@ bool EntReqTable::GetEntityInfo(int ent, int extraPoints,
} }
int EntReqTable::GetRequestForEntity(int ent) { int EntReqTable::GetRequestForEntity(int ent) {
int req; int req = 0;
GetEntityInfo(ent, 0, &req, NULL, NULL, NULL); GetEntityInfo(ent, 0, &req, NULL, NULL, NULL);
return req; return req;
} }

View File

@ -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) bool SSurface::ClosestPointNewton(Vector p, double *u, double *v, bool converge)
{ {
// Initial guess is in u, v; refine by Newton iteration. // 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++) { for(int i = 0; i < (converge ? 25 : 5); i++) {
p0 = PointAt(*u, *v); p0 = PointAt(*u, *v);
if(converge) { if(converge) {

View File

@ -18,7 +18,7 @@ extern int FLAG;
double SSurface::DepartureFromCoplanar(void) { double SSurface::DepartureFromCoplanar(void) {
int i, j; int i, j;
int ia, ja, ib, jb, ic, jc; int ia, ja, ib = 0, jb = 0, ic = 0, jc = 0;
double best; double best;
// Grab three points to define a plane; first choose (0, 0) arbitrarily. // Grab three points to define a plane; first choose (0, 0) arbitrarily.

View File

@ -211,7 +211,7 @@ bool SSurface::LineEntirelyOutsideBbox(Vector a, Vector b, bool segment) {
void SSurface::MakeTrimEdgesInto(SEdgeList *sel, int flags, void SSurface::MakeTrimEdgesInto(SEdgeList *sel, int flags,
SCurve *sc, STrimBy *stb) SCurve *sc, STrimBy *stb)
{ {
Vector prev; Vector prev = Vector::From(0, 0, 0);
bool inCurve = false, empty = true; bool inCurve = false, empty = true;
double u = 0, v = 0; double u = 0, v = 0;

View File

@ -392,8 +392,8 @@ void SSurface::IntersectAgainst(SSurface *b, SShell *agnstA, SShell *agnstB,
sc.pts.Add(&padd); sc.pts.Add(&padd);
Point2d pa, pb; Point2d pa, pb;
Vector np, npc; Vector np, npc = Vector::From(0, 0, 0);
bool fwd; bool fwd = false;
// Better to start with a too-small step, so that we don't miss // Better to start with a too-small step, so that we don't miss
// features of the curve entirely. // features of the curve entirely.
double tol, step = maxtol; double tol, step = maxtol;

View File

@ -179,7 +179,7 @@ bool System::SolveLinearSystem(double X[], double A[][MAX_UNKNOWNS],
// Gaussian elimination, with partial pivoting. It's an error if the // Gaussian elimination, with partial pivoting. It's an error if the
// matrix is singular, because that means two constraints are // matrix is singular, because that means two constraints are
// equivalent. // equivalent.
int i, j, ip, jp, imax; int i, j, ip, jp, imax = 0;
double max, temp; double max, temp;
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {

View File

@ -318,7 +318,7 @@ bool TtfFont::LoadFontFromFile(bool nameOnly) {
WORD nameStringOffset = GetWORD(); WORD nameStringOffset = GetWORD();
// And now we're at the name records. Go through those till we find // And now we're at the name records. Go through those till we find
// one that we want. // one that we want.
int displayNameOffset, displayNameLength; int displayNameOffset = 0, displayNameLength = 0;
for(i = 0; i < nameCount; i++) { for(i = 0; i < nameCount; i++) {
WORD platformID = GetWORD(); WORD platformID = GetWORD();
WORD encodingID = GetWORD(); WORD encodingID = GetWORD();
@ -430,8 +430,8 @@ bool TtfFont::LoadFontFromFile(bool nameOnly) {
// and advance width) of the font. // and advance width) of the font.
fseek(fh, hmtxAddr, SEEK_SET); fseek(fh, hmtxAddr, SEEK_SET);
WORD hmtxAdvanceWidth; WORD hmtxAdvanceWidth = 0;
SWORD hmtxLsb; SWORD hmtxLsb = 0;
for(i = 0; i < min(glyphs, hheaNumberOfMetrics); i++) { for(i = 0; i < min(glyphs, hheaNumberOfMetrics); i++) {
hmtxAdvanceWidth = GetWORD(); hmtxAdvanceWidth = GetWORD();
hmtxLsb = (SWORD)GetWORD(); hmtxLsb = (SWORD)GetWORD();

View File

@ -956,7 +956,7 @@ void RefreshRecentMenus(void)
HMENU CreateGraphicsWindowMenus(void) HMENU CreateGraphicsWindowMenus(void)
{ {
HMENU top = CreateMenu(); HMENU top = CreateMenu();
HMENU m; HMENU m = 0;
int i; int i;
int subMenu = 0; int subMenu = 0;