Various fixes for warnings and minutia
This commit consists of numerous small changes, none significant enough to merit a commit on their own: * Added extra braces to quash for-loop variable scoping issues for older compilers (or "g++ -fno-for-scope") * Appeased "unreachable code" warnings, spurious or otherwise * Added casts to fix integer-variable signedness warnings * Added a dummy virtual method to the VectorFileWriter class to silence the -Wweak-vtables warning from Clang++ * Renamed some parameters in the Expr and GraphicsWindow classes to eliminate "parameter shadows a field" warnings * Removed an inert "0 ||" from a conditional, and changed a "&& 0" into an "#if 0" * Added missing elements to array/struct/class initializers to zap further warnings * Indented some cpp conditionals where appropriate * Qualified some variables and functions as static to quiet "no previous declaration" warnings * toolbar.cpp needed to #include<icons-proto.h> to fix those same "no previous declaration" warnings from icons.h * Added some casts and const qualifiers to the Win32 code to address warnings produced by g++ when compiling under MinGW * Rewrote Cnf{Freeze,Thaw}Float() to use a union rather than pointer aliasing; this makes g++ a lot happier * Removed redundant #includes from win32/w32util.cpp * With Jonathan's blessing, shortened the last line of the About dialog text to better match the preceding linespull/3/head
parent
a5176f4545
commit
8bc322eb47
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
6
dsc.h
6
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++;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
8
expr.h
8
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); }
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
12
sketch.h
12
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; }
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
10
solvespace.h
10
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:
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
15
toolbar.cpp
15
toolbar.cpp
|
@ -6,9 +6,10 @@
|
|||
// Copyright 2008-2013 Jonathan Westhues.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "solvespace.h"
|
||||
#include <icons-proto.h>
|
||||
#include <icons.h>
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
8
ttf.cpp
8
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;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
2
ui.h
2
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);
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -6,11 +6,6 @@
|
|||
//
|
||||
// Copyright 2008-2013 Jonathan Westhues.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include <windows.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "solvespace.h"
|
||||
|
||||
static HANDLE PermHeap, TempHeap;
|
||||
|
|
Loading…
Reference in New Issue