From 66f46b7b67701e09bbb315fa6d19599d69f3e938 Mon Sep 17 00:00:00 2001 From: Daniel Richard G Date: Mon, 26 Aug 2013 16:54:04 -0400 Subject: [PATCH] General compiler warning/error fixes This addresses a grab bag of compiler grievances relating to C++ syntax, type, and scope, as observed on Linux with g++ and Solaris with Sun WorkShop 6. --- file.cpp | 2 +- polygon.cpp | 2 +- solvespace.h | 2 +- srf/surface.cpp | 18 +++++++++--------- srf/surface.h | 2 +- style.cpp | 28 ++++++++++++++-------------- ui.h | 2 +- win32/w32main.cpp | 4 ++-- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/file.cpp b/file.cpp index 1e6ace5e..c25b083a 100644 --- a/file.cpp +++ b/file.cpp @@ -198,7 +198,7 @@ const SolveSpace::SaveTable SolveSpace::SAVED[] = { { 's', "Style.visible", 'b', &(SS.sv.s.visible) }, { 's', "Style.exportable", 'b', &(SS.sv.s.exportable) }, - { 0, NULL, NULL, NULL }, + { 0, NULL, 0, NULL } }; void SolveSpace::SaveUsingTable(int type) { diff --git a/polygon.cpp b/polygon.cpp index f146d729..841233ac 100644 --- a/polygon.cpp +++ b/polygon.cpp @@ -684,7 +684,7 @@ void SPolygon::FixContourDirections(void) { } bool clockwise = sc->IsClockwiseProjdToNormal(normal); - if(clockwise && outer || (!clockwise && !outer)) { + if((clockwise && outer) || (!clockwise && !outer)) { sc->Reverse(); sc->tag = 1; } diff --git a/solvespace.h b/solvespace.h index f8eb6174..cc87ec21 100644 --- a/solvespace.h +++ b/solvespace.h @@ -643,7 +643,7 @@ public: typedef enum { UNIT_MM = 0, - UNIT_INCHES, + UNIT_INCHES } Unit; Unit viewUnits; int afterDecimalMm; diff --git a/srf/surface.cpp b/srf/surface.cpp index 71162380..70de69f1 100644 --- a/srf/surface.cpp +++ b/srf/surface.cpp @@ -484,6 +484,11 @@ void SSurface::Clear(void) { trim.Clear(); } +typedef struct { + hSCurve hc; + hSSurface hs; +} TrimLine; + void SShell::MakeFromExtrusionOf(SBezierLoopSet *sbls, Vector t0, Vector t1, int color) { @@ -524,11 +529,6 @@ void SShell::MakeFromExtrusionOf(SBezierLoopSet *sbls, Vector t0, Vector t1, SBezierLoop *sbl; for(sbl = sbls->l.First(); sbl; sbl = sbls->l.NextAfter(sbl)) { SBezier *sb; - - typedef struct { - hSCurve hc; - hSSurface hs; - } TrimLine; List trimLines; ZERO(&trimLines); @@ -605,6 +605,10 @@ void SShell::MakeFromExtrusionOf(SBezierLoopSet *sbls, Vector t0, Vector t1, } +typedef struct { + hSSurface d[4]; +} Revolved; + void SShell::MakeFromRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis, int color) { @@ -643,10 +647,6 @@ void SShell::MakeFromRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis, for(sbl = sbls->l.First(); sbl; sbl = sbls->l.NextAfter(sbl)) { int i, j; SBezier *sb, *prev; - - typedef struct { - hSSurface d[4]; - } Revolved; List hsl; ZERO(&hsl); diff --git a/srf/surface.h b/srf/surface.h index f2854d5a..df51b4a4 100644 --- a/srf/surface.h +++ b/srf/surface.h @@ -222,7 +222,7 @@ public: Vector start; Vector finish; - static STrimBy STrimBy::EntireCurve(SShell *shell, hSCurve hsc, bool bkwds); + static STrimBy EntireCurve(SShell *shell, hSCurve hsc, bool bkwds); }; // An intersection point between a line and a surface diff --git a/style.cpp b/style.cpp index 047c0f8a..f1d33c3e 100644 --- a/style.cpp +++ b/style.cpp @@ -9,20 +9,20 @@ #include const Style::Default Style::Defaults[] = { - { ACTIVE_GRP, "ActiveGrp", RGBf(1.0, 1.0, 1.0), 1.5, }, - { CONSTRUCTION, "Construction", RGBf(0.1, 0.7, 0.1), 1.5, }, - { INACTIVE_GRP, "InactiveGrp", RGBf(0.5, 0.3, 0.0), 1.5, }, - { DATUM, "Datum", RGBf(0.0, 0.8, 0.0), 1.5, }, - { SOLID_EDGE, "SolidEdge", RGBf(0.8, 0.8, 0.8), 1.0, }, - { CONSTRAINT, "Constraint", RGBf(1.0, 0.1, 1.0), 1.0, }, - { SELECTED, "Selected", RGBf(1.0, 0.0, 0.0), 1.5, }, - { HOVERED, "Hovered", RGBf(1.0, 1.0, 0.0), 1.5, }, - { CONTOUR_FILL, "ContourFill", RGBf(0.0, 0.1, 0.1), 1.0, }, - { NORMALS, "Normals", RGBf(0.0, 0.4, 0.4), 1.0, }, - { ANALYZE, "Analyze", RGBf(0.0, 1.0, 1.0), 1.0, }, - { DRAW_ERROR, "DrawError", RGBf(1.0, 0.0, 0.0), 8.0, }, - { DIM_SOLID, "DimSolid", RGBf(0.1, 0.1, 0.1), 1.0, }, - { 0, NULL, 0, 0.0, }, + { { ACTIVE_GRP }, "ActiveGrp", RGBf(1.0, 1.0, 1.0), 1.5, }, + { { CONSTRUCTION }, "Construction", RGBf(0.1, 0.7, 0.1), 1.5, }, + { { INACTIVE_GRP }, "InactiveGrp", RGBf(0.5, 0.3, 0.0), 1.5, }, + { { DATUM }, "Datum", RGBf(0.0, 0.8, 0.0), 1.5, }, + { { SOLID_EDGE }, "SolidEdge", RGBf(0.8, 0.8, 0.8), 1.0, }, + { { CONSTRAINT }, "Constraint", RGBf(1.0, 0.1, 1.0), 1.0, }, + { { SELECTED }, "Selected", RGBf(1.0, 0.0, 0.0), 1.5, }, + { { HOVERED }, "Hovered", RGBf(1.0, 1.0, 0.0), 1.5, }, + { { CONTOUR_FILL }, "ContourFill", RGBf(0.0, 0.1, 0.1), 1.0, }, + { { NORMALS }, "Normals", RGBf(0.0, 0.4, 0.4), 1.0, }, + { { ANALYZE }, "Analyze", RGBf(0.0, 1.0, 1.0), 1.0, }, + { { DRAW_ERROR }, "DrawError", RGBf(1.0, 0.0, 0.0), 8.0, }, + { { DIM_SOLID }, "DimSolid", RGBf(0.1, 0.1, 0.1), 1.0, }, + { { 0 }, NULL, 0, 0.0, } }; char *Style::CnfColor(const char *prefix) { diff --git a/ui.h b/ui.h index b8e29faf..10b778b8 100644 --- a/ui.h +++ b/ui.h @@ -412,7 +412,7 @@ public: MNU_STEP_DIM, // Help, MNU_WEBSITE, - MNU_ABOUT, + MNU_ABOUT } MenuId; typedef void MenuHandler(int id); typedef struct { diff --git a/win32/w32main.cpp b/win32/w32main.cpp index 1097a2a2..d00cc392 100644 --- a/win32/w32main.cpp +++ b/win32/w32main.cpp @@ -172,7 +172,7 @@ void DoMessageBox(const char *str, int rows, int cols, BOOL error) MSG msg; DWORD ret; MessageDone = FALSE; - while((ret = GetMessage(&msg, NULL, 0, 0)) && !MessageDone) { + while((ret = GetMessage(&msg, NULL, 0, 0)) != 0 && !MessageDone) { if((msg.message == WM_KEYDOWN && (msg.wParam == VK_RETURN || msg.wParam == VK_ESCAPE)) || @@ -1169,7 +1169,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, // will be from the wndprocs. MSG msg; DWORD ret; - while(ret = GetMessage(&msg, NULL, 0, 0)) { + while((ret = GetMessage(&msg, NULL, 0, 0)) != 0) { // Is it a message from the six degree of freedom input device? if(ProcessSpaceNavigatorMsg(&msg)) goto done;