diff --git a/clipboard.cpp b/clipboard.cpp index 4af2399..4cfe1f2 100644 --- a/clipboard.cpp +++ b/clipboard.cpp @@ -90,12 +90,12 @@ void GraphicsWindow::CopySelection(void) { cr.str.strcpy( e->str.str); cr.font.strcpy( e->font.str); cr.construction = e->construction; - for(int i = 0; i < pts; i++) { + {for(int i = 0; i < pts; i++) { Vector pt = SK.GetEntity(e->point[i])->PointGetNum(); pt = pt.Minus(p); pt = pt.DotInToCsys(u, v, n); cr.point[i] = pt; - } + }} if(hasDistance) { cr.distance = SK.GetEntity(e->distance)->DistanceGetNum(); } diff --git a/drawconstraint.cpp b/drawconstraint.cpp index 7c01a0a..a3b80e7 100644 --- a/drawconstraint.cpp +++ b/drawconstraint.cpp @@ -914,8 +914,8 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) { } { - Vector n; case SYMMETRIC: + Vector n; n = SK.GetEntity(entityA)->Normal()->NormalN(); goto s; case SYMMETRIC_HORIZ: n = SK.GetEntity(workplane)->Normal()->NormalU(); goto s; diff --git a/dsc.h b/dsc.h index 7f3bafb..ed0fe19 100644 --- a/dsc.h +++ b/dsc.h @@ -150,7 +150,7 @@ public: void AllocForOneMore(void) { if(n >= elemsAllocated) { elemsAllocated = (elemsAllocated + 32)*2; - elem = (T *)MemRealloc(elem, elemsAllocated*sizeof(elem[0])); + elem = (T *)MemRealloc(elem, (size_t)elemsAllocated*sizeof(elem[0])); } } @@ -249,7 +249,7 @@ public: void Add(T *t) { if(n >= elemsAllocated) { elemsAllocated = (elemsAllocated + 32)*2; - elem = (T *)MemRealloc(elem, elemsAllocated*sizeof(elem[0])); + elem = (T *)MemRealloc(elem, (size_t)elemsAllocated*sizeof(elem[0])); } int first = 0, last = n; @@ -268,7 +268,7 @@ public: } int i = first; - memmove(elem+i+1, elem+i, (n-i)*sizeof(elem[0])); + memmove(elem+i+1, elem+i, (size_t)(n-i)*sizeof(elem[0])); elem[i] = *t; n++; } diff --git a/exportvector.cpp b/exportvector.cpp index 1e4790b..2864a3b 100644 --- a/exportvector.cpp +++ b/exportvector.cpp @@ -5,6 +5,13 @@ //----------------------------------------------------------------------------- #include "solvespace.h" +void VectorFileWriter::Dummy(void) { + // This out-of-line virtual method definition quells the following warning + // from Clang++: "'VectorFileWriter' has no out-of-line virtual method + // definitions; its vtable will be emitted in every translation unit + // [-Wweak-vtables]" +} + //----------------------------------------------------------------------------- // Routines for DXF export //----------------------------------------------------------------------------- diff --git a/expr.h b/expr.h index 4447e3c..30f7b26 100644 --- a/expr.h +++ b/expr.h @@ -70,10 +70,10 @@ public: static Expr *From(double v); Expr *AnyOp(int op, Expr *b); - inline Expr *Plus (Expr *b) { return AnyOp(PLUS, b); } - inline Expr *Minus(Expr *b) { return AnyOp(MINUS, b); } - inline Expr *Times(Expr *b) { return AnyOp(TIMES, b); } - inline Expr *Div (Expr *b) { return AnyOp(DIV, b); } + inline Expr *Plus (Expr *b_) { return AnyOp(PLUS, b_); } + inline Expr *Minus(Expr *b_) { return AnyOp(MINUS, b_); } + inline Expr *Times(Expr *b_) { return AnyOp(TIMES, b_); } + inline Expr *Div (Expr *b_) { return AnyOp(DIV, b_); } inline Expr *Negate(void) { return AnyOp(NEGATE, NULL); } inline Expr *Sqrt (void) { return AnyOp(SQRT, NULL); } diff --git a/glhelper.cpp b/glhelper.cpp index d0ba662..0dcc350 100644 --- a/glhelper.cpp +++ b/glhelper.cpp @@ -274,7 +274,7 @@ void glxFillMesh(RgbColor specColor, SMesh *m, uint32_t h, uint32_t s1, uint32_t glBegin(GL_TRIANGLES); } - if(0 || tr->an.EqualsExactly(Vector::From(0, 0, 0))) { + if(tr->an.EqualsExactly(Vector::From(0, 0, 0))) { // Compute the normal from the vertices Vector n = tr->Normal(); glNormal3d(n.x, n.y, n.z); diff --git a/graphicswin.cpp b/graphicswin.cpp index 62b1ed7..52e9f85 100644 --- a/graphicswin.cpp +++ b/graphicswin.cpp @@ -144,7 +144,8 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = { { 0, "&Help", 0, 0, NULL }, { 1, "&Website / Manual", MNU_WEBSITE, 0, mHelp }, { 1, "&About", MNU_ABOUT, 0, mHelp }, -{ -1 } + +{ -1, 0, 0, 0, 0 } }; #undef DEL diff --git a/groupmesh.cpp b/groupmesh.cpp index 5fd810a..a91f0d9 100644 --- a/groupmesh.cpp +++ b/groupmesh.cpp @@ -443,7 +443,7 @@ void Group::DrawDisplayItems(int t) { } // The back faces are drawn in red; should never seem them, since we // draw closed shells, so that's a debugging aid. - GLfloat mpb[] = { 1.0f, 0.1f, 0.1f, 1.0 }; + GLfloat mpb[] = { 1.0f, 0.1f, 0.1f, 1.0f }; glMaterialfv(GL_BACK, GL_AMBIENT_AND_DIFFUSE, mpb); // When we fill the mesh, we need to know which triangles are selected diff --git a/polygon.cpp b/polygon.cpp index 8816331..45357af 100644 --- a/polygon.cpp +++ b/polygon.cpp @@ -822,7 +822,7 @@ void SContour::OffsetInto(SContour *dest, double r) { } if(fabs(thetan - thetap) < (1*PI)/180) { - Vector p = { b.x - r*sin(thetap), b.y + r*cos(thetap) }; + Vector p = { b.x - r*sin(thetap), b.y + r*cos(thetap), 0 }; dest->AddPoint(p); } else if(thetan < thetap) { // This is an inside corner. We have two edges, Ep and En. Move diff --git a/request.cpp b/request.cpp index a6d8c09..e2062a0 100644 --- a/request.cpp +++ b/request.cpp @@ -22,7 +22,7 @@ const EntReqTable::TableEntry EntReqTable::Table[] = { { Request::CIRCLE, Entity::CIRCLE, 1, false, true, true, "circle" }, { Request::ARC_OF_CIRCLE, Entity::ARC_OF_CIRCLE, 3, false, true, false, "arc-of-circle" }, { Request::TTF_TEXT, Entity::TTF_TEXT, 2, false, true, false, "ttf-text" }, -{ 0 }, +{ 0, 0, 0, false, false, false, 0 }, }; const char *EntReqTable::DescriptionForRequest(int req) { diff --git a/sketch.h b/sketch.h index a53957a..79f093e 100644 --- a/sketch.h +++ b/sketch.h @@ -777,11 +777,11 @@ public: inline hEntity hGroup::entity(int i) - { hEntity r; r.v = 0x80000000 | (v << 16) | i; return r; } + { hEntity r; r.v = 0x80000000 | (v << 16) | (uint32_t)i; return r; } inline hParam hGroup::param(int i) - { hParam r; r.v = 0x80000000 | (v << 16) | i; return r; } + { hParam r; r.v = 0x80000000 | (v << 16) | (uint32_t)i; return r; } inline hEquation hGroup::equation(int i) - { hEquation r; r.v = (v << 16) | 0x80000000 | i; return r; } + { hEquation r; r.v = (v << 16) | 0x80000000 | (uint32_t)i; return r; } inline bool hRequest::IsFromReferences(void) { if(v == Request::HREQUEST_REFERENCE_XY.v) return true; @@ -790,9 +790,9 @@ inline bool hRequest::IsFromReferences(void) { return false; } inline hEntity hRequest::entity(int i) - { hEntity r; r.v = (v << 16) | i; return r; } + { hEntity r; r.v = (v << 16) | (uint32_t)i; return r; } inline hParam hRequest::param(int i) - { hParam r; r.v = (v << 16) | i; return r; } + { hParam r; r.v = (v << 16) | (uint32_t)i; return r; } inline bool hEntity::isFromRequest(void) { if(v & 0x80000000) return false; else return true; } @@ -808,7 +808,7 @@ inline hRequest hParam::request(void) inline hEquation hConstraint::equation(int i) - { hEquation r; r.v = (v << 16) | i; return r; } + { hEquation r; r.v = (v << 16) | (uint32_t)i; return r; } inline bool hEquation::isFromConstraint(void) { if(v & 0xc0000000) return false; else return true; } diff --git a/solvespace.cpp b/solvespace.cpp index c4fc96e..fc8fea3 100644 --- a/solvespace.cpp +++ b/solvespace.cpp @@ -735,7 +735,7 @@ void SolveSpace::MenuHelp(int id) { "There is NO WARRANTY, to the extent permitted by\n" "law. For details, visit http://gnu.org/licenses/\n" "\n" -"\xa9 2008-2013 Jonathan Westhues and subsequent authors.\n" +"\xa9 2008-2013 Jonathan Westhues and other authors.\n" ); break; diff --git a/solvespace.h b/solvespace.h index 1760e0c..9686b63 100644 --- a/solvespace.h +++ b/solvespace.h @@ -11,13 +11,15 @@ #define oops() do { dbp("oops at line %d, file %s\n", __LINE__, __FILE__); \ if(0) *(char *)0 = 1; exit(-1); } while(0) #ifndef min -#define min(x, y) ((x) < (y) ? (x) : (y)) +# define min(x, y) ((x) < (y) ? (x) : (y)) #endif #ifndef max -#define max(x, y) ((x) > (y) ? (x) : (y)) +# define max(x, y) ((x) > (y) ? (x) : (y)) #endif -#define isnan(x) (((x) != (x)) || (x > 1e11) || (x < -1e11)) +#ifndef isnan +# define isnan(x) (((x) != (x)) || (x > 1e11) || (x < -1e11)) +#endif inline int WRAP(int v, int n) { // Clamp it to the range [0, n) @@ -471,6 +473,8 @@ public: virtual void StartFile(void) = 0; virtual void FinishAndCloseFile(void) = 0; virtual bool HasCanvasSize(void) = 0; + + virtual void Dummy(void); }; class DxfFileWriter : public VectorFileWriter { public: diff --git a/srf/boolean.cpp b/srf/boolean.cpp index 30c0242..a7f91f5 100644 --- a/srf/boolean.cpp +++ b/srf/boolean.cpp @@ -6,7 +6,7 @@ //----------------------------------------------------------------------------- #include "solvespace.h" -int I, N, FLAG; +static int I, N, FLAG; void SShell::MakeFromUnionOf(SShell *a, SShell *b) { MakeFromBoolean(a, b, AS_UNION); @@ -216,7 +216,6 @@ static bool KeepRegion(int type, bool opA, int shell, int orig) } else { return (!inShell && !inFace) || inSame; } - break; case SShell::AS_DIFFERENCE: if(opA) { @@ -224,7 +223,6 @@ static bool KeepRegion(int type, bool opA, int shell, int orig) } else { return (inShell && !inFace) || inSame; } - break; default: oops(); } @@ -273,7 +271,7 @@ static void TagByClassifiedEdge(int bspclass, int *indir, int *outdir) } } -void DEBUGEDGELIST(SEdgeList *sel, SSurface *surf) { +static void DEBUGEDGELIST(SEdgeList *sel, SSurface *surf) { dbp("print %d edges", sel->l.n); SEdge *se; for(se = sel->l.First(); se; se = sel->l.NextAfter(se)) { diff --git a/srf/ratpoly.cpp b/srf/ratpoly.cpp index bdc5882..547e370 100644 --- a/srf/ratpoly.cpp +++ b/srf/ratpoly.cpp @@ -20,7 +20,6 @@ double Bernstein(int k, int deg, double t) switch(deg) { case 0: return 1; - break; case 1: if(k == 0) { @@ -60,7 +59,6 @@ double BernsteinDerivative(int k, int deg, double t) switch(deg) { case 0: return 0; - break; case 1: if(k == 0) { diff --git a/srf/surfinter.cpp b/srf/surfinter.cpp index 687e4c0..c086113 100644 --- a/srf/surfinter.cpp +++ b/srf/surfinter.cpp @@ -84,7 +84,8 @@ void SSurface::AddExactIntersectionCurve(SBezier *sb, SSurface *srfB, return; } - if(sb->deg == 2 && 0) { +#if 0 + if(sb->deg == 2) { dbp(" "); SCurvePt *prev = NULL, *v; dbp("split.pts.n = %d", split.pts.n); @@ -96,6 +97,7 @@ void SSurface::AddExactIntersectionCurve(SBezier *sb, SSurface *srfB, prev = v; } } +#endif // 0 // Nothing should be generating zero-len edges. if((sb->Start()).Equals(sb->Finish())) oops(); diff --git a/style.cpp b/style.cpp index d5e2bee..d091fac 100644 --- a/style.cpp +++ b/style.cpp @@ -410,9 +410,9 @@ void TextWindow::ScreenBackgroundImage(int link, uint32_t v) { int rh; rh = max(4, RoundUpToPowerOfTwo(h)); SS.bgImage.fromFile = (uint8_t *)MemAlloc(rw*rh*3); - for(int i = 0; i < h; i++) { + {for(int i = 0; i < h; i++) { memcpy(SS.bgImage.fromFile + ((h - 1) - i)*(rw*3), rows[i], w*3); - } + }} SS.bgImage.w = w; SS.bgImage.h = h; SS.bgImage.rw = rw; diff --git a/textwin.cpp b/textwin.cpp index 6625da7..4b05142 100644 --- a/textwin.cpp +++ b/textwin.cpp @@ -35,13 +35,13 @@ TextWindow::HideShowIcon TextWindow::hideShowIcons[] = { { &(SS.GW.showPoints), Icon_point, "points" }, { &(SS.GW.showConstraints), Icon_constraint, "constraints and dimensions" }, { &(SS.GW.showFaces), Icon_faces, "XXX - special cased" }, - { &SPACER, 0 }, + { &SPACER, 0, 0 }, { &(SS.GW.showShaded), Icon_shaded, "shaded view of solid model" }, { &(SS.GW.showEdges), Icon_edges, "edges of solid model" }, { &(SS.GW.showMesh), Icon_mesh, "triangle mesh of solid model" }, - { &SPACER, 0 }, + { &SPACER, 0, 0 }, { &(SS.GW.showHdnLines), Icon_hidden_lines, "hidden lines" }, - { 0, 0 }, + { 0, 0, 0 } }; void TextWindow::MakeColorTable(const Color *in, float *out) { diff --git a/toolbar.cpp b/toolbar.cpp index 1ca0c5b..0d65e9b 100644 --- a/toolbar.cpp +++ b/toolbar.cpp @@ -6,9 +6,10 @@ // Copyright 2008-2013 Jonathan Westhues. //----------------------------------------------------------------------------- #include "solvespace.h" +#include #include -uint8_t SPACER[1]; +static uint8_t SPACER[1]; static const struct { uint8_t *image; int menu; @@ -24,7 +25,7 @@ static const struct { { Icon_point, GraphicsWindow::MNU_DATUM_POINT, "Sketch datum point" }, { Icon_construction, GraphicsWindow::MNU_CONSTRUCTION, "Toggle construction" }, { Icon_trim, GraphicsWindow::MNU_SPLIT_CURVES, "Split lines / curves where they intersect" }, - { SPACER }, + { SPACER, 0, 0 }, { Icon_length, GraphicsWindow::MNU_DISTANCE_DIA, "Constrain distance / diameter / length" }, { Icon_angle, GraphicsWindow::MNU_ANGLE, "Constrain angle" }, @@ -38,7 +39,7 @@ static const struct { { Icon_same_orientation,GraphicsWindow::MNU_ORIENTED_SAME, "Constrain normals in same orientation" }, { Icon_other_supp, GraphicsWindow::MNU_OTHER_ANGLE, "Other supplementary angle" }, { Icon_ref, GraphicsWindow::MNU_REFERENCE, "Toggle reference dimension" }, - { SPACER }, + { SPACER, 0, 0 }, { Icon_extrude, GraphicsWindow::MNU_GROUP_EXTRUDE, "New group extruding active sketch" }, { Icon_sketch_in_plane, GraphicsWindow::MNU_GROUP_WRKPL, "New group in new workplane (thru given entities)" }, @@ -46,11 +47,11 @@ static const struct { { Icon_step_translate, GraphicsWindow::MNU_GROUP_TRANS, "New group step and repeat translating" }, { Icon_sketch_in_3d, GraphicsWindow::MNU_GROUP_3D, "New group in 3d" }, { Icon_assemble, GraphicsWindow::MNU_GROUP_IMPORT, "New group importing / assembling file" }, - { SPACER }, + { SPACER, 0, 0 }, { Icon_in3d, GraphicsWindow::MNU_NEAREST_ISO, "Nearest isometric view" }, { Icon_ontoworkplane, GraphicsWindow::MNU_ONTO_WORKPLANE, "Align view to active workplane" }, - { NULL }, + { NULL, 0, 0 } }; void GraphicsWindow::ToolbarDraw(void) { @@ -103,7 +104,7 @@ bool GraphicsWindow::ToolbarMouseDown(int x, int y) { } bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, - bool paint, int *menu) + bool paint, int *menuHit) { int i; int x = 17, y = (int)(height - 52); @@ -186,7 +187,7 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, if(mx < (x+boxhw) && mx > (x - boxhw) && my < (y+boxhw) && my > (y - boxhw)) { - if(menu) *menu = Toolbar[i].menu; + if(menuHit) *menuHit = Toolbar[i].menu; } } diff --git a/ttf.cpp b/ttf.cpp index 699e44d..21f5643 100644 --- a/ttf.cpp +++ b/ttf.cpp @@ -77,7 +77,7 @@ uint16_t TtfFont::GetUSHORT(void) { b1 = (uint8_t)Getc(); b0 = (uint8_t)Getc(); - return (b1 << 8) | b0; + return (uint16_t)(b1 << 8) | b0; } uint32_t TtfFont::GetULONG(void) { uint8_t b0, b1, b2, b3; @@ -86,7 +86,11 @@ uint32_t TtfFont::GetULONG(void) { b1 = (uint8_t)Getc(); b0 = (uint8_t)Getc(); - return (b3 << 24) | (b2 << 16) | (b1 << 8) | b0; + return + (uint32_t)(b3 << 24) | + (uint32_t)(b2 << 16) | + (uint32_t)(b1 << 8) | + b0; } //----------------------------------------------------------------------------- diff --git a/ui.h b/ui.h index 47e426a..502108b 100644 --- a/ui.h +++ b/ui.h @@ -637,7 +637,7 @@ public: int32_t contextMenuCancelTime; // The toolbar, in toolbar.cpp - bool ToolbarDrawOrHitTest(int x, int y, bool paint, int *menu); + bool ToolbarDrawOrHitTest(int x, int y, bool paint, int *menuHit); void ToolbarDraw(void); bool ToolbarMouseMoved(int x, int y); bool ToolbarMouseDown(int x, int y); diff --git a/win32/freeze.cpp b/win32/freeze.cpp index b60c574..af278a8 100644 --- a/win32/freeze.cpp +++ b/win32/freeze.cpp @@ -7,6 +7,9 @@ #include #include +#define FREEZE_SUBKEY ---- +#include "freeze.h" + /* * store a window's position in the registry, or fail silently if the registry calls don't work */ @@ -24,7 +27,7 @@ void FreezeWindowPosF(HWND hwnd, const char *subKey, const char *name) return; HKEY sub; - if(RegCreateKeyEx(software, subKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &sub, NULL) != ERROR_SUCCESS) + if(RegCreateKeyEx(software, subKey, 0, (LPTSTR)"", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &sub, NULL) != ERROR_SUCCESS) return; sprintf(keyName, "%s_left", name); @@ -139,7 +142,7 @@ void FreezeDWORDF(DWORD val, const char *subKey, const char *name) return; HKEY sub; - if(RegCreateKeyEx(software, subKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &sub, NULL) != ERROR_SUCCESS) + if(RegCreateKeyEx(software, subKey, 0, (LPTSTR)"", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &sub, NULL) != ERROR_SUCCESS) return; if(RegSetValueEx(sub, name, 0, REG_DWORD, (BYTE *)&val, sizeof(DWORD)) != ERROR_SUCCESS) @@ -177,7 +180,7 @@ void FreezeStringF(const char *val, const char *subKey, const char *name) return; HKEY sub; - if(RegCreateKeyEx(software, subKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &sub, NULL) != ERROR_SUCCESS) + if(RegCreateKeyEx(software, subKey, 0, (LPTSTR)"", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &sub, NULL) != ERROR_SUCCESS) return; if(RegSetValueEx(sub, name, 0, REG_SZ, (const BYTE *)val, (DWORD)strlen(val)+1) != ERROR_SUCCESS) diff --git a/win32/w32main.cpp b/win32/w32main.cpp index b1a9535..acb0aa7 100644 --- a/win32/w32main.cpp +++ b/win32/w32main.cpp @@ -36,7 +36,7 @@ HGLRC TextGl; HWND GraphicsWnd; HGLRC GraphicsGl; HWND GraphicsEditControl; -struct { +static struct { int x, y; } LastMousePos; @@ -109,7 +109,7 @@ static LRESULT CALLBACK MessageProc(HWND hwnd, UINT msg, WPARAM wParam, return 1; } -HWND CreateWindowClient(DWORD exStyle, char *className, char *windowName, +HWND CreateWindowClient(DWORD exStyle, const char *className, const char *windowName, DWORD style, int x, int y, int width, int height, HWND parent, HMENU menu, HINSTANCE instance, void *param) { @@ -130,7 +130,7 @@ void DoMessageBox(const char *str, int rows, int cols, bool error) { EnableWindow(GraphicsWnd, false); EnableWindow(TextWnd, false); - HWND h = GetForegroundWindow(); + //HWND h = GetForegroundWindow(); // Register the window class for our dialog. WNDCLASSEX wc; @@ -153,7 +153,7 @@ void DoMessageBox(const char *str, int rows, int cols, bool error) MessageString = str; RECT r; GetWindowRect(GraphicsWnd, &r); - char *title = error ? "SolveSpace - Error" : "SolveSpace - Message"; + const char *title = error ? "SolveSpace - Error" : "SolveSpace - Message"; int width = cols*SS.TW.CHAR_WIDTH + 20, height = rows*SS.TW.LINE_HEIGHT + 60; MessageWnd = CreateWindowClient(0, "MessageWnd", title, @@ -276,8 +276,17 @@ void CnfFreezeString(const char *str, const char *name) void CnfFreezeInt(uint32_t v, const char *name) { FreezeDWORDF((DWORD)v, FREEZE_SUBKEY, name); } -void CnfFreezeFloat(float v, const char *name) - { FreezeDWORDF(*((DWORD *)&v), FREEZE_SUBKEY, name); } +union floatDWORD { + float f; + DWORD d; +}; + +void CnfFreezeFloat(float v, const char *name) { + if(sizeof(float) != sizeof(DWORD)) oops(); + floatDWORD u; + u.f = v; + FreezeDWORDF(u.d, FREEZE_SUBKEY, name); +} void CnfThawString(char *str, int maxLen, const char *name) { ThawStringF(str, maxLen, FREEZE_SUBKEY, name); } @@ -286,8 +295,10 @@ uint32_t CnfThawInt(uint32_t v, const char *name) { return (uint32_t)ThawDWORDF((DWORD)v, FREEZE_SUBKEY, name); } float CnfThawFloat(float v, const char *name) { - DWORD d = ThawDWORDF(*((DWORD *)&v), FREEZE_SUBKEY, name); - return *((float *)&d); + floatDWORD u; + u.f = v; + u.d = ThawDWORDF(u.d, FREEZE_SUBKEY, name); + return u.f; } void SetWindowTitle(const char *str) { @@ -922,7 +933,7 @@ static void MenuById(int id, bool yes, bool check) if(SS.GW.menu[i].id == id) { if(subMenu < 0) oops(); - if(subMenu >= arraylen(SubMenus)) oops(); + if(subMenu >= (int)arraylen(SubMenus)) oops(); if(check) { CheckMenuItem(SubMenus[subMenu], id, @@ -990,7 +1001,7 @@ HMENU CreateGraphicsWindowMenus(void) if(SS.GW.menu[i].level == 0) { m = CreateMenu(); AppendMenu(top, MF_STRING | MF_POPUP, (UINT_PTR)m, label); - if(subMenu >= arraylen(SubMenus)) oops(); + if(subMenu >= (int)arraylen(SubMenus)) oops(); SubMenus[subMenu] = m; subMenu++; } else if(SS.GW.menu[i].level == 1) { diff --git a/win32/w32util.cpp b/win32/w32util.cpp index 894c941..4a83ba5 100644 --- a/win32/w32util.cpp +++ b/win32/w32util.cpp @@ -6,11 +6,6 @@ // // Copyright 2008-2013 Jonathan Westhues. //----------------------------------------------------------------------------- -#include -#include -#include -#include - #include "solvespace.h" static HANDLE PermHeap, TempHeap;