Added const qualifiers
String literals in C++ are implicitly typed as 'const char *', and with this change, their const-ness is maintained when assigning them to variables or passing them as arguments. This significantly cuts down the number of warnings generated by the compiler.
This commit is contained in:
parent
affbeafc6c
commit
02776ea535
@ -9,7 +9,7 @@
|
|||||||
char *Constraint::DescriptionString(void) {
|
char *Constraint::DescriptionString(void) {
|
||||||
static char ret[1024];
|
static char ret[1024];
|
||||||
|
|
||||||
char *s;
|
const char *s;
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case POINTS_COINCIDENT: s = "pts-coincident"; break;
|
case POINTS_COINCIDENT: s = "pts-coincident"; break;
|
||||||
case PT_PT_DISTANCE: s = "pt-pt-distance"; break;
|
case PT_PT_DISTANCE: s = "pt-pt-distance"; break;
|
||||||
|
@ -980,9 +980,9 @@ s:
|
|||||||
if(type == AT_MIDPOINT) offset = offset.ScaledBy(-1);
|
if(type == AT_MIDPOINT) offset = offset.ScaledBy(-1);
|
||||||
|
|
||||||
if(dogd.drawing) {
|
if(dogd.drawing) {
|
||||||
char *s = (type == HORIZONTAL) ? "H" : (
|
const char *s = (type == HORIZONTAL) ? "H" : (
|
||||||
(type == VERTICAL) ? "V" : (
|
(type == VERTICAL) ? "V" : (
|
||||||
(type == AT_MIDPOINT) ? "M" : NULL));
|
(type == AT_MIDPOINT) ? "M" : NULL));
|
||||||
|
|
||||||
glxWriteTextRefCenter(s, DEFAULT_TEXT_HEIGHT,
|
glxWriteTextRefCenter(s, DEFAULT_TEXT_HEIGHT,
|
||||||
m.Plus(offset), r, u, LineCallback, this);
|
m.Plus(offset), r, u, LineCallback, this);
|
||||||
|
2
dsc.h
2
dsc.h
@ -373,7 +373,7 @@ class NameStr {
|
|||||||
public:
|
public:
|
||||||
char str[64];
|
char str[64];
|
||||||
|
|
||||||
inline void strcpy(char *in) {
|
inline void strcpy(const char *in) {
|
||||||
memcpy(str, in, min(strlen(in)+1, sizeof(str)));
|
memcpy(str, in, min(strlen(in)+1, sizeof(str)));
|
||||||
str[sizeof(str)-1] = '\0';
|
str[sizeof(str)-1] = '\0';
|
||||||
}
|
}
|
||||||
|
4
expr.cpp
4
expr.cpp
@ -519,12 +519,12 @@ hParam Expr::ReferencedParams(ParamList *pl) {
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static char StringBuffer[4096];
|
static char StringBuffer[4096];
|
||||||
void Expr::App(char *s, ...) {
|
void Expr::App(const char *s, ...) {
|
||||||
va_list f;
|
va_list f;
|
||||||
va_start(f, s);
|
va_start(f, s);
|
||||||
vsprintf(StringBuffer+strlen(StringBuffer), s, f);
|
vsprintf(StringBuffer+strlen(StringBuffer), s, f);
|
||||||
}
|
}
|
||||||
char *Expr::Print(void) {
|
const char *Expr::Print(void) {
|
||||||
if(!this) return "0";
|
if(!this) return "0";
|
||||||
|
|
||||||
StringBuffer[0] = '\0';
|
StringBuffer[0] = '\0';
|
||||||
|
4
expr.h
4
expr.h
@ -94,8 +94,8 @@ public:
|
|||||||
|
|
||||||
void ParamsToPointers(void);
|
void ParamsToPointers(void);
|
||||||
|
|
||||||
void App(char *str, ...);
|
void App(const char *str, ...);
|
||||||
char *Print(void);
|
const char *Print(void);
|
||||||
void PrintW(void); // worker
|
void PrintW(void); // worker
|
||||||
|
|
||||||
// number of child nodes: 0 (e.g. constant), 1 (sqrt), or 2 (+)
|
// number of child nodes: 0 (e.g. constant), 1 (sqrt), or 2 (+)
|
||||||
|
2
file.cpp
2
file.cpp
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#define VERSION_STRING "±²³SolveSpaceREVa"
|
#define VERSION_STRING "±²³SolveSpaceREVa"
|
||||||
|
|
||||||
static int StrStartsWith(char *str, char *start) {
|
static int StrStartsWith(const char *str, const char *start) {
|
||||||
return memcmp(str, start, strlen(start)) == 0;
|
return memcmp(str, start, strlen(start)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
glhelper.cpp
12
glhelper.cpp
@ -15,7 +15,7 @@ static bool ColorLocked;
|
|||||||
static bool DepthOffsetLocked;
|
static bool DepthOffsetLocked;
|
||||||
|
|
||||||
#define FONT_SCALE(h) ((h)/22.0)
|
#define FONT_SCALE(h) ((h)/22.0)
|
||||||
double glxStrWidth(char *str, double h)
|
double glxStrWidth(const char *str, double h)
|
||||||
{
|
{
|
||||||
int w = 0;
|
int w = 0;
|
||||||
for(; *str; str++) {
|
for(; *str; str++) {
|
||||||
@ -32,8 +32,8 @@ double glxStrHeight(double h)
|
|||||||
// The characters have height ~22, as they appear in the table.
|
// The characters have height ~22, as they appear in the table.
|
||||||
return 22.0*FONT_SCALE(h)/SS.GW.scale;
|
return 22.0*FONT_SCALE(h)/SS.GW.scale;
|
||||||
}
|
}
|
||||||
void glxWriteTextRefCenter(char *str, double h, Vector t, Vector u, Vector v,
|
void glxWriteTextRefCenter(const char *str, double h, Vector t, Vector u, Vector v,
|
||||||
glxLineFn *fn, void *fndata)
|
glxLineFn *fn, void *fndata)
|
||||||
{
|
{
|
||||||
u = u.WithMagnitude(1);
|
u = u.WithMagnitude(1);
|
||||||
v = v.WithMagnitude(1);
|
v = v.WithMagnitude(1);
|
||||||
@ -61,8 +61,8 @@ static void LineDrawCallback(void *fndata, Vector a, Vector b)
|
|||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
void glxWriteText(char *str, double h, Vector t, Vector u, Vector v,
|
void glxWriteText(const char *str, double h, Vector t, Vector u, Vector v,
|
||||||
glxLineFn *fn, void *fndata)
|
glxLineFn *fn, void *fndata)
|
||||||
{
|
{
|
||||||
if(!fn) fn = LineDrawCallback;
|
if(!fn) fn = LineDrawCallback;
|
||||||
u = u.WithMagnitude(1);
|
u = u.WithMagnitude(1);
|
||||||
@ -549,7 +549,7 @@ void glxBitmapCharQuad(char c, double x, double y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void glxBitmapText(char *str, Vector p)
|
void glxBitmapText(const char *str, Vector p)
|
||||||
{
|
{
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
@ -816,7 +816,7 @@ void GraphicsWindow::MenuEdit(int id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsWindow::MenuRequest(int id) {
|
void GraphicsWindow::MenuRequest(int id) {
|
||||||
char *s;
|
const char *s;
|
||||||
switch(id) {
|
switch(id) {
|
||||||
case MNU_SEL_WORKPLANE: {
|
case MNU_SEL_WORKPLANE: {
|
||||||
SS.GW.GroupSelection();
|
SS.GW.GroupSelection();
|
||||||
|
@ -509,7 +509,7 @@ void Group::Draw(void) {
|
|||||||
if(type == DRAWING_WORKPLANE) {
|
if(type == DRAWING_WORKPLANE) {
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glxColorRGB(Style::Color(Style::DRAW_ERROR));
|
glxColorRGB(Style::Color(Style::DRAW_ERROR));
|
||||||
char *msg;
|
const char *msg;
|
||||||
if(polyError.how == POLY_NOT_COPLANAR) {
|
if(polyError.how == POLY_NOT_COPLANAR) {
|
||||||
msg = "points not all coplanar!";
|
msg = "points not all coplanar!";
|
||||||
} else if(polyError.how == POLY_SELF_INTERSECTING) {
|
} else if(polyError.how == POLY_SELF_INTERSECTING) {
|
||||||
|
@ -25,7 +25,7 @@ const EntReqTable::TableEntry EntReqTable::Table[] = {
|
|||||||
{ 0 },
|
{ 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
char *EntReqTable::DescriptionForRequest(int req) {
|
const char *EntReqTable::DescriptionForRequest(int req) {
|
||||||
for(int i = 0; Table[i].reqType; i++) {
|
for(int i = 0; Table[i].reqType; i++) {
|
||||||
if(req == Table[i].reqType) {
|
if(req == Table[i].reqType) {
|
||||||
return Table[i].description;
|
return Table[i].description;
|
||||||
@ -174,7 +174,7 @@ void Request::Generate(IdList<Entity,hEntity> *entity,
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *Request::DescriptionString(void) {
|
char *Request::DescriptionString(void) {
|
||||||
char *s;
|
const char *s;
|
||||||
if(h.v == Request::HREQUEST_REFERENCE_XY.v) {
|
if(h.v == Request::HREQUEST_REFERENCE_XY.v) {
|
||||||
s = "#XY";
|
s = "#XY";
|
||||||
} else if(h.v == Request::HREQUEST_REFERENCE_YZ.v) {
|
} else if(h.v == Request::HREQUEST_REFERENCE_YZ.v) {
|
||||||
|
30
sketch.h
30
sketch.h
@ -466,18 +466,18 @@ public:
|
|||||||
class EntReqTable {
|
class EntReqTable {
|
||||||
public:
|
public:
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int reqType;
|
int reqType;
|
||||||
int entType;
|
int entType;
|
||||||
int points;
|
int points;
|
||||||
bool useExtraPoints;
|
bool useExtraPoints;
|
||||||
bool hasNormal;
|
bool hasNormal;
|
||||||
bool hasDistance;
|
bool hasDistance;
|
||||||
char *description;
|
const char *description;
|
||||||
} TableEntry;
|
} TableEntry;
|
||||||
|
|
||||||
static const TableEntry Table[];
|
static const TableEntry Table[];
|
||||||
|
|
||||||
static char *DescriptionForRequest(int req);
|
static const char *DescriptionForRequest(int req);
|
||||||
static void CopyEntityInfo(const TableEntry *te, int extraPoints,
|
static void CopyEntityInfo(const TableEntry *te, int extraPoints,
|
||||||
int *ent, int *req, int *pts, bool *hasNormal, bool *hasDistance);
|
int *ent, int *req, int *pts, bool *hasNormal, bool *hasDistance);
|
||||||
static bool GetRequestInfo(int req, int extraPoints,
|
static bool GetRequestInfo(int req, int extraPoints,
|
||||||
@ -704,16 +704,16 @@ public:
|
|||||||
// The default styles, for entities that don't have a style assigned yet,
|
// The default styles, for entities that don't have a style assigned yet,
|
||||||
// and for datums and such.
|
// and for datums and such.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
hStyle h;
|
hStyle h;
|
||||||
char *cnfPrefix;
|
const char *cnfPrefix;
|
||||||
DWORD color;
|
DWORD color;
|
||||||
double width;
|
double width;
|
||||||
} Default;
|
} Default;
|
||||||
static const Default Defaults[];
|
static const Default Defaults[];
|
||||||
|
|
||||||
static char *CnfColor(char *prefix);
|
static char *CnfColor(const char *prefix);
|
||||||
static char *CnfWidth(char *prefix);
|
static char *CnfWidth(const char *prefix);
|
||||||
static char *CnfPrefixToName(char *prefix);
|
static char *CnfPrefixToName(const char *prefix);
|
||||||
|
|
||||||
static void CreateAllDefaultStyles(void);
|
static void CreateAllDefaultStyles(void);
|
||||||
static void CreateDefaultStyle(hStyle h);
|
static void CreateDefaultStyle(hStyle h);
|
||||||
|
@ -200,7 +200,7 @@ double SolveSpace::MmPerUnit(void) {
|
|||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
char *SolveSpace::UnitName(void) {
|
const char *SolveSpace::UnitName(void) {
|
||||||
if(viewUnits == UNIT_INCHES) {
|
if(viewUnits == UNIT_INCHES) {
|
||||||
return "inch";
|
return "inch";
|
||||||
} else {
|
} else {
|
||||||
@ -228,7 +228,7 @@ char *SolveSpace::MmToString(double v) {
|
|||||||
double SolveSpace::ExprToMm(Expr *e) {
|
double SolveSpace::ExprToMm(Expr *e) {
|
||||||
return (e->Eval()) * MmPerUnit();
|
return (e->Eval()) * MmPerUnit();
|
||||||
}
|
}
|
||||||
double SolveSpace::StringToMm(char *str) {
|
double SolveSpace::StringToMm(const char *str) {
|
||||||
return atof(str) * MmPerUnit();
|
return atof(str) * MmPerUnit();
|
||||||
}
|
}
|
||||||
double SolveSpace::ChordTolMm(void) {
|
double SolveSpace::ChordTolMm(void) {
|
||||||
@ -530,10 +530,10 @@ void SolveSpace::MenuAnalyze(int id) {
|
|||||||
|
|
||||||
InvalidateGraphics();
|
InvalidateGraphics();
|
||||||
|
|
||||||
char *intersMsg = inters ?
|
const char *intersMsg = inters ?
|
||||||
"The mesh is self-intersecting (NOT okay, invalid)." :
|
"The mesh is self-intersecting (NOT okay, invalid)." :
|
||||||
"The mesh is not self-intersecting (okay, valid).";
|
"The mesh is not self-intersecting (okay, valid).";
|
||||||
char *leaksMsg = leaks ?
|
const char *leaksMsg = leaks ?
|
||||||
"The mesh has naked edges (NOT okay, invalid)." :
|
"The mesh has naked edges (NOT okay, invalid)." :
|
||||||
"The mesh is watertight (okay, valid).";
|
"The mesh is watertight (okay, valid).";
|
||||||
|
|
||||||
|
60
solvespace.h
60
solvespace.h
@ -116,12 +116,12 @@ int SaveFileYesNoCancel(void);
|
|||||||
// Comma-separated value, like a spreadsheet would use
|
// Comma-separated value, like a spreadsheet would use
|
||||||
#define CSV_PATTERN "CSV File (*.csv)\0*.csv\0All Files (*)\0*\0\0"
|
#define CSV_PATTERN "CSV File (*.csv)\0*.csv\0All Files (*)\0*\0\0"
|
||||||
#define CSV_EXT "csv"
|
#define CSV_EXT "csv"
|
||||||
BOOL GetSaveFile(char *file, char *defExtension, char *selPattern);
|
BOOL GetSaveFile(char *file, const char *defExtension, const char *selPattern);
|
||||||
BOOL GetOpenFile(char *file, char *defExtension, char *selPattern);
|
BOOL GetOpenFile(char *file, const char *defExtension, const char *selPattern);
|
||||||
void GetAbsoluteFilename(char *file);
|
void GetAbsoluteFilename(char *file);
|
||||||
void LoadAllFontFiles(void);
|
void LoadAllFontFiles(void);
|
||||||
|
|
||||||
void OpenWebsite(char *url);
|
void OpenWebsite(const char *url);
|
||||||
|
|
||||||
void CheckMenuById(int id, BOOL checked);
|
void CheckMenuById(int id, BOOL checked);
|
||||||
void EnableMenuById(int id, BOOL checked);
|
void EnableMenuById(int id, BOOL checked);
|
||||||
@ -136,7 +136,7 @@ void MoveTextScrollbarTo(int pos, int maxPos, int page);
|
|||||||
|
|
||||||
#define CONTEXT_SUBMENU (-1)
|
#define CONTEXT_SUBMENU (-1)
|
||||||
#define CONTEXT_SEPARATOR (-2)
|
#define CONTEXT_SEPARATOR (-2)
|
||||||
void AddContextMenuItem(char *legend, int id);
|
void AddContextMenuItem(const char *legend, int id);
|
||||||
void CreateContextSubmenu(void);
|
void CreateContextSubmenu(void);
|
||||||
int ShowContextMenu(void);
|
int ShowContextMenu(void);
|
||||||
|
|
||||||
@ -149,23 +149,23 @@ void GetTextWindowSize(int *w, int *h);
|
|||||||
SDWORD GetMilliseconds(void);
|
SDWORD GetMilliseconds(void);
|
||||||
SQWORD GetUnixTime(void);
|
SQWORD GetUnixTime(void);
|
||||||
|
|
||||||
void dbp(char *str, ...);
|
void dbp(const char *str, ...);
|
||||||
#define DBPTRI(tri) \
|
#define DBPTRI(tri) \
|
||||||
dbp("tri: (%.3f %.3f %.3f) (%.3f %.3f %.3f) (%.3f %.3f %.3f)", \
|
dbp("tri: (%.3f %.3f %.3f) (%.3f %.3f %.3f) (%.3f %.3f %.3f)", \
|
||||||
CO((tri).a), CO((tri).b), CO((tri).c))
|
CO((tri).a), CO((tri).b), CO((tri).c))
|
||||||
|
|
||||||
void SetWindowTitle(char *str);
|
void SetWindowTitle(const char *str);
|
||||||
void SetMousePointerToHand(bool yes);
|
void SetMousePointerToHand(bool yes);
|
||||||
void DoMessageBox(char *str, int rows, int cols, BOOL error);
|
void DoMessageBox(const char *str, int rows, int cols, BOOL error);
|
||||||
void SetTimerFor(int milliseconds);
|
void SetTimerFor(int milliseconds);
|
||||||
void ExitNow(void);
|
void ExitNow(void);
|
||||||
|
|
||||||
void CnfFreezeString(char *str, char *name);
|
void CnfFreezeString(const char *str, const char *name);
|
||||||
void CnfFreezeDWORD(DWORD v, char *name);
|
void CnfFreezeDWORD(DWORD v, const char *name);
|
||||||
void CnfFreezeFloat(float v, char *name);
|
void CnfFreezeFloat(float v, const char *name);
|
||||||
void CnfThawString(char *str, int maxLen, char *name);
|
void CnfThawString(char *str, int maxLen, const char *name);
|
||||||
DWORD CnfThawDWORD(DWORD v, char *name);
|
DWORD CnfThawDWORD(DWORD v, const char *name);
|
||||||
float CnfThawFloat(float v, char *name);
|
float CnfThawFloat(float v, const char *name);
|
||||||
|
|
||||||
void *AllocTemporary(int n);
|
void *AllocTemporary(int n);
|
||||||
void FreeTemporary(void *p);
|
void FreeTemporary(void *p);
|
||||||
@ -212,11 +212,11 @@ void glxDrawEdges(SEdgeList *l, bool endpointsToo);
|
|||||||
void glxDebugMesh(SMesh *m);
|
void glxDebugMesh(SMesh *m);
|
||||||
void glxMarkPolygonNormal(SPolygon *p);
|
void glxMarkPolygonNormal(SPolygon *p);
|
||||||
typedef void glxLineFn(void *data, Vector a, Vector b);
|
typedef void glxLineFn(void *data, Vector a, Vector b);
|
||||||
void glxWriteText(char *str, double h, Vector t, Vector u, Vector v,
|
void glxWriteText(const char *str, double h, Vector t, Vector u, Vector v,
|
||||||
glxLineFn *fn, void *fndata);
|
glxLineFn *fn, void *fndata);
|
||||||
void glxWriteTextRefCenter(char *str, double h, Vector t, Vector u, Vector v,
|
void glxWriteTextRefCenter(const char *str, double h, Vector t, Vector u, Vector v,
|
||||||
glxLineFn *fn, void *fndata);
|
glxLineFn *fn, void *fndata);
|
||||||
double glxStrWidth(char *str, double h);
|
double glxStrWidth(const char *str, double h);
|
||||||
double glxStrHeight(double h);
|
double glxStrHeight(double h);
|
||||||
void glxLockColorTo(DWORD rgb);
|
void glxLockColorTo(DWORD rgb);
|
||||||
void glxFatLine(Vector a, Vector b, double width);
|
void glxFatLine(Vector a, Vector b, double width);
|
||||||
@ -227,7 +227,7 @@ void glxDepthRangeOffset(int units);
|
|||||||
void glxDepthRangeLockToFront(bool yes);
|
void glxDepthRangeLockToFront(bool yes);
|
||||||
void glxDrawPixelsWithTexture(BYTE *data, int w, int h);
|
void glxDrawPixelsWithTexture(BYTE *data, int w, int h);
|
||||||
void glxCreateBitmapFont(void);
|
void glxCreateBitmapFont(void);
|
||||||
void glxBitmapText(char *str, Vector p);
|
void glxBitmapText(const char *str, Vector p);
|
||||||
void glxBitmapCharQuad(char c, double x, double y);
|
void glxBitmapCharQuad(char c, double x, double y);
|
||||||
#define TEXTURE_BACKGROUND_IMG 10
|
#define TEXTURE_BACKGROUND_IMG 10
|
||||||
#define TEXTURE_BITMAP_FONT 20
|
#define TEXTURE_BITMAP_FONT 20
|
||||||
@ -242,12 +242,12 @@ void MakeMatrix(double *mat, double a11, double a12, double a13, double a14,
|
|||||||
double a21, double a22, double a23, double a24,
|
double a21, double a22, double a23, double a24,
|
||||||
double a31, double a32, double a33, double a34,
|
double a31, double a32, double a33, double a34,
|
||||||
double a41, double a42, double a43, double a44);
|
double a41, double a42, double a43, double a44);
|
||||||
void MakePathRelative(char *base, char *path);
|
void MakePathRelative(const char *base, char *path);
|
||||||
void MakePathAbsolute(char *base, char *path);
|
void MakePathAbsolute(const char *base, char *path);
|
||||||
bool StringAllPrintable(char *str);
|
bool StringAllPrintable(const char *str);
|
||||||
bool StringEndsIn(char *str, char *ending);
|
bool StringEndsIn(const char *str, const char *ending);
|
||||||
void Message(char *str, ...);
|
void Message(const char *str, ...);
|
||||||
void Error(char *str, ...);
|
void Error(const char *str, ...);
|
||||||
|
|
||||||
class System {
|
class System {
|
||||||
public:
|
public:
|
||||||
@ -379,7 +379,7 @@ public:
|
|||||||
|
|
||||||
void LoadGlyph(int index);
|
void LoadGlyph(int index);
|
||||||
bool LoadFontFromFile(bool nameOnly);
|
bool LoadFontFromFile(bool nameOnly);
|
||||||
char *FontFileBaseName(void);
|
const char *FontFileBaseName(void);
|
||||||
|
|
||||||
void Flush(void);
|
void Flush(void);
|
||||||
void Handle(int *dx, int x, int y, bool onCurve);
|
void Handle(int *dx, int x, int y, bool onCurve);
|
||||||
@ -651,8 +651,8 @@ public:
|
|||||||
|
|
||||||
char *MmToString(double v);
|
char *MmToString(double v);
|
||||||
double ExprToMm(Expr *e);
|
double ExprToMm(Expr *e);
|
||||||
double StringToMm(char *s);
|
double StringToMm(const char *s);
|
||||||
char *UnitName(void);
|
const char *UnitName(void);
|
||||||
double MmPerUnit(void);
|
double MmPerUnit(void);
|
||||||
int UnitDigitsAfterDecimal(void);
|
int UnitDigitsAfterDecimal(void);
|
||||||
void SetUnitDigitsAfterDecimal(int v);
|
void SetUnitDigitsAfterDecimal(int v);
|
||||||
@ -680,10 +680,10 @@ public:
|
|||||||
bool fileLoadError;
|
bool fileLoadError;
|
||||||
bool unsaved;
|
bool unsaved;
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char type;
|
char type;
|
||||||
char *desc;
|
const char *desc;
|
||||||
char fmt;
|
char fmt;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
} SaveTable;
|
} SaveTable;
|
||||||
static const SaveTable SAVED[];
|
static const SaveTable SAVED[];
|
||||||
void SaveUsingTable(int type);
|
void SaveUsingTable(int type);
|
||||||
|
@ -291,7 +291,7 @@ void DEBUGEDGELIST(SEdgeList *sel, SSurface *surf) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *REGION(int d) {
|
static const char *REGION(int d) {
|
||||||
switch(d) {
|
switch(d) {
|
||||||
case SShell::INSIDE: return "inside";
|
case SShell::INSIDE: return "inside";
|
||||||
case SShell::OUTSIDE: return "outside";
|
case SShell::OUTSIDE: return "outside";
|
||||||
|
@ -25,18 +25,18 @@ const Style::Default Style::Defaults[] = {
|
|||||||
{ 0, NULL, 0, 0.0, },
|
{ 0, NULL, 0, 0.0, },
|
||||||
};
|
};
|
||||||
|
|
||||||
char *Style::CnfColor(char *prefix) {
|
char *Style::CnfColor(const char *prefix) {
|
||||||
static char name[100];
|
static char name[100];
|
||||||
sprintf(name, "Style_%s_Color", prefix);
|
sprintf(name, "Style_%s_Color", prefix);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
char *Style::CnfWidth(char *prefix) {
|
char *Style::CnfWidth(const char *prefix) {
|
||||||
static char name[100];
|
static char name[100];
|
||||||
sprintf(name, "Style_%s_Width", prefix);
|
sprintf(name, "Style_%s_Width", prefix);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *Style::CnfPrefixToName(char *prefix) {
|
char *Style::CnfPrefixToName(const char *prefix) {
|
||||||
static char name[100];
|
static char name[100];
|
||||||
int i = 0, j;
|
int i = 0, j;
|
||||||
strcpy(name, "#def-");
|
strcpy(name, "#def-");
|
||||||
@ -789,7 +789,7 @@ void TextWindow::ShowStyleInfo(void) {
|
|||||||
Printf(false, "");
|
Printf(false, "");
|
||||||
Printf(false, "%Ft text comment style%E");
|
Printf(false, "%Ft text comment style%E");
|
||||||
|
|
||||||
char *chng = (s->h.v < Style::FIRST_CUSTOM) ? "" : "[change]";
|
const char *chng = (s->h.v < Style::FIRST_CUSTOM) ? "" : "[change]";
|
||||||
if(s->textHeightAs == Style::UNITS_AS_PIXELS) {
|
if(s->textHeightAs == Style::UNITS_AS_PIXELS) {
|
||||||
Printf(false, "%Ba %Ftheight %E%@ %D%f%Lt%Fl%s%E",
|
Printf(false, "%Ba %Ftheight %E%@ %D%f%Lt%Fl%s%E",
|
||||||
s->textHeight,
|
s->textHeight,
|
||||||
|
@ -269,7 +269,7 @@ void TextWindow::ScreenDeleteGroup(int link, DWORD v) {
|
|||||||
}
|
}
|
||||||
void TextWindow::ShowGroupInfo(void) {
|
void TextWindow::ShowGroupInfo(void) {
|
||||||
Group *g = SK.group.FindById(shown.group);
|
Group *g = SK.group.FindById(shown.group);
|
||||||
char *s = "???";
|
const char *s = "???";
|
||||||
|
|
||||||
if(shown.group.v == Group::HGROUP_REFERENCES.v) {
|
if(shown.group.v == Group::HGROUP_REFERENCES.v) {
|
||||||
Printf(true, "%FtGROUP %E%s", g->DescriptionString());
|
Printf(true, "%FtGROUP %E%s", g->DescriptionString());
|
||||||
|
@ -115,7 +115,7 @@ void TextWindow::ClearScreen(void) {
|
|||||||
rows = 0;
|
rows = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextWindow::Printf(bool halfLine, char *fmt, ...) {
|
void TextWindow::Printf(bool halfLine, const char *fmt, ...) {
|
||||||
va_list vl;
|
va_list vl;
|
||||||
va_start(vl, fmt);
|
va_start(vl, fmt);
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ BYTE SPACER[1];
|
|||||||
static const struct {
|
static const struct {
|
||||||
BYTE *image;
|
BYTE *image;
|
||||||
int menu;
|
int menu;
|
||||||
char *tip;
|
const char *tip;
|
||||||
} Toolbar[] = {
|
} Toolbar[] = {
|
||||||
{ Icon_line, GraphicsWindow::MNU_LINE_SEGMENT, "Sketch line segment" },
|
{ Icon_line, GraphicsWindow::MNU_LINE_SEGMENT, "Sketch line segment" },
|
||||||
{ Icon_rectangle, GraphicsWindow::MNU_RECTANGLE, "Sketch rectangle" },
|
{ Icon_rectangle, GraphicsWindow::MNU_RECTANGLE, "Sketch rectangle" },
|
||||||
@ -136,7 +136,7 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my,
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool show;
|
bool show;
|
||||||
char *str;
|
const char *str;
|
||||||
} toolTip = { false, NULL };
|
} toolTip = { false, NULL };
|
||||||
|
|
||||||
bool leftpos = true;
|
bool leftpos = true;
|
||||||
|
2
ttf.cpp
2
ttf.cpp
@ -223,7 +223,7 @@ void TtfFont::LoadGlyph(int index) {
|
|||||||
// Return the basename of our font filename; that's how the requests and
|
// Return the basename of our font filename; that's how the requests and
|
||||||
// entities that reference us will store it.
|
// entities that reference us will store it.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
char *TtfFont::FontFileBaseName(void) {
|
const char *TtfFont::FontFileBaseName(void) {
|
||||||
char *sb = strrchr(fontFile, '\\');
|
char *sb = strrchr(fontFile, '\\');
|
||||||
char *sf = strrchr(fontFile, '/');
|
char *sf = strrchr(fontFile, '/');
|
||||||
char *s = sf ? sf : sb;
|
char *s = sf ? sf : sb;
|
||||||
|
12
ui.h
12
ui.h
@ -66,9 +66,9 @@ public:
|
|||||||
|
|
||||||
// The row of icons at the top of the text window, to hide/show things
|
// The row of icons at the top of the text window, to hide/show things
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool *var;
|
bool *var;
|
||||||
BYTE *icon;
|
BYTE *icon;
|
||||||
char *tip;
|
const char *tip;
|
||||||
} HideShowIcon;
|
} HideShowIcon;
|
||||||
static HideShowIcon hideShowIcons[];
|
static HideShowIcon hideShowIcons[];
|
||||||
static bool SPACER;
|
static bool SPACER;
|
||||||
@ -96,7 +96,7 @@ public:
|
|||||||
|
|
||||||
void Init(void);
|
void Init(void);
|
||||||
void MakeColorTable(const Color *in, float *out);
|
void MakeColorTable(const Color *in, float *out);
|
||||||
void Printf(bool half, char *fmt, ...);
|
void Printf(bool half, const char *fmt, ...);
|
||||||
void ClearScreen(void);
|
void ClearScreen(void);
|
||||||
|
|
||||||
void Show(void);
|
void Show(void);
|
||||||
@ -417,7 +417,7 @@ public:
|
|||||||
typedef void MenuHandler(int id);
|
typedef void MenuHandler(int id);
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int level; // 0 == on menu bar, 1 == one level down
|
int level; // 0 == on menu bar, 1 == one level down
|
||||||
char *label; // or NULL for a separator
|
const char *label; // or NULL for a separator
|
||||||
int id; // unique ID
|
int id; // unique ID
|
||||||
int accel; // keyboard accelerator
|
int accel; // keyboard accelerator
|
||||||
MenuHandler *fn;
|
MenuHandler *fn;
|
||||||
@ -507,7 +507,7 @@ public:
|
|||||||
hEntity normal;
|
hEntity normal;
|
||||||
hConstraint constraint;
|
hConstraint constraint;
|
||||||
|
|
||||||
char *description;
|
const char *description;
|
||||||
} pending;
|
} pending;
|
||||||
void ClearPending(void);
|
void ClearPending(void);
|
||||||
// The constraint that is being edited with the on-screen textbox.
|
// The constraint that is being edited with the on-screen textbox.
|
||||||
|
18
util.cpp
18
util.cpp
@ -6,10 +6,10 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#include "solvespace.h"
|
#include "solvespace.h"
|
||||||
|
|
||||||
void MakePathRelative(char *basep, char *pathp)
|
void MakePathRelative(const char *basep, char *pathp)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *p;
|
const char *p;
|
||||||
char base[MAX_PATH], path[MAX_PATH], out[MAX_PATH];
|
char base[MAX_PATH], path[MAX_PATH], out[MAX_PATH];
|
||||||
|
|
||||||
// Convert everything to lowercase
|
// Convert everything to lowercase
|
||||||
@ -65,7 +65,7 @@ void MakePathRelative(char *basep, char *pathp)
|
|||||||
strcpy(pathp, out);
|
strcpy(pathp, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakePathAbsolute(char *basep, char *pathp) {
|
void MakePathAbsolute(const char *basep, char *pathp) {
|
||||||
char out[MAX_PATH];
|
char out[MAX_PATH];
|
||||||
strcpy(out, basep);
|
strcpy(out, basep);
|
||||||
|
|
||||||
@ -83,9 +83,9 @@ void MakePathAbsolute(char *basep, char *pathp) {
|
|||||||
strcpy(pathp, out);
|
strcpy(pathp, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StringAllPrintable(char *str)
|
bool StringAllPrintable(const char *str)
|
||||||
{
|
{
|
||||||
char *t;
|
const char *t;
|
||||||
for(t = str; *t; t++) {
|
for(t = str; *t; t++) {
|
||||||
if(!(isalnum(*t) || *t == '-' || *t == '_')) {
|
if(!(isalnum(*t) || *t == '-' || *t == '_')) {
|
||||||
return false;
|
return false;
|
||||||
@ -94,7 +94,7 @@ bool StringAllPrintable(char *str)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StringEndsIn(char *str, char *ending)
|
bool StringEndsIn(const char *str, const char *ending)
|
||||||
{
|
{
|
||||||
int i, ls = strlen(str), le = strlen(ending);
|
int i, ls = strlen(str), le = strlen(ending);
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ void MakeMatrix(double *mat, double a11, double a12, double a13, double a14,
|
|||||||
// Word-wrap the string for our message box appropriately, and then display
|
// Word-wrap the string for our message box appropriately, and then display
|
||||||
// that string.
|
// that string.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
static void DoStringForMessageBox(char *str, va_list f, bool error)
|
static void DoStringForMessageBox(const char *str, va_list f, bool error)
|
||||||
{
|
{
|
||||||
char inBuf[1024*50];
|
char inBuf[1024*50];
|
||||||
vsprintf(inBuf, str, f);
|
vsprintf(inBuf, str, f);
|
||||||
@ -190,14 +190,14 @@ static void DoStringForMessageBox(char *str, va_list f, bool error)
|
|||||||
// And then display the text with our actual longest line length.
|
// And then display the text with our actual longest line length.
|
||||||
DoMessageBox(outBuf, rows, cols, error);
|
DoMessageBox(outBuf, rows, cols, error);
|
||||||
}
|
}
|
||||||
void Error(char *str, ...)
|
void Error(const char *str, ...)
|
||||||
{
|
{
|
||||||
va_list f;
|
va_list f;
|
||||||
va_start(f, str);
|
va_start(f, str);
|
||||||
DoStringForMessageBox(str, f, true);
|
DoStringForMessageBox(str, f, true);
|
||||||
va_end(f);
|
va_end(f);
|
||||||
}
|
}
|
||||||
void Message(char *str, ...)
|
void Message(const char *str, ...)
|
||||||
{
|
{
|
||||||
va_list f;
|
va_list f;
|
||||||
va_start(f, str);
|
va_start(f, str);
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
/*
|
/*
|
||||||
* store a window's position in the registry, or fail silently if the registry calls don't work
|
* store a window's position in the registry, or fail silently if the registry calls don't work
|
||||||
*/
|
*/
|
||||||
void FreezeWindowPosF(HWND hwnd, char *subKey, char *name)
|
void FreezeWindowPosF(HWND hwnd, const char *subKey, const char *name)
|
||||||
{
|
{
|
||||||
RECT r;
|
RECT r;
|
||||||
GetWindowRect(hwnd, &r);
|
GetWindowRect(hwnd, &r);
|
||||||
@ -60,7 +60,7 @@ static void Clamp(LONG *v, LONG min, LONG max)
|
|||||||
/*
|
/*
|
||||||
* retrieve a window's position from the registry, or do nothing if there is no info saved
|
* retrieve a window's position from the registry, or do nothing if there is no info saved
|
||||||
*/
|
*/
|
||||||
void ThawWindowPosF(HWND hwnd, char *subKey, char *name)
|
void ThawWindowPosF(HWND hwnd, const char *subKey, const char *name)
|
||||||
{
|
{
|
||||||
HKEY software;
|
HKEY software;
|
||||||
if(RegOpenKeyEx(HKEY_CURRENT_USER, "Software", 0, KEY_ALL_ACCESS, &software) != ERROR_SUCCESS)
|
if(RegOpenKeyEx(HKEY_CURRENT_USER, "Software", 0, KEY_ALL_ACCESS, &software) != ERROR_SUCCESS)
|
||||||
@ -132,7 +132,7 @@ void ThawWindowPosF(HWND hwnd, char *subKey, char *name)
|
|||||||
/*
|
/*
|
||||||
* store a DWORD setting in the registry
|
* store a DWORD setting in the registry
|
||||||
*/
|
*/
|
||||||
void FreezeDWORDF(DWORD val, char *subKey, char *name)
|
void FreezeDWORDF(DWORD val, const char *subKey, const char *name)
|
||||||
{
|
{
|
||||||
HKEY software;
|
HKEY software;
|
||||||
if(RegOpenKeyEx(HKEY_CURRENT_USER, "Software", 0, KEY_ALL_ACCESS, &software) != ERROR_SUCCESS)
|
if(RegOpenKeyEx(HKEY_CURRENT_USER, "Software", 0, KEY_ALL_ACCESS, &software) != ERROR_SUCCESS)
|
||||||
@ -149,7 +149,7 @@ void FreezeDWORDF(DWORD val, char *subKey, char *name)
|
|||||||
/*
|
/*
|
||||||
* retrieve a DWORD setting, or return the default if that setting is unavailable
|
* retrieve a DWORD setting, or return the default if that setting is unavailable
|
||||||
*/
|
*/
|
||||||
DWORD ThawDWORDF(DWORD val, char *subKey, char *name)
|
DWORD ThawDWORDF(DWORD val, const char *subKey, const char *name)
|
||||||
{
|
{
|
||||||
HKEY software;
|
HKEY software;
|
||||||
if(RegOpenKeyEx(HKEY_CURRENT_USER, "Software", 0, KEY_ALL_ACCESS, &software) != ERROR_SUCCESS)
|
if(RegOpenKeyEx(HKEY_CURRENT_USER, "Software", 0, KEY_ALL_ACCESS, &software) != ERROR_SUCCESS)
|
||||||
@ -170,7 +170,7 @@ DWORD ThawDWORDF(DWORD val, char *subKey, char *name)
|
|||||||
/*
|
/*
|
||||||
* store a string setting in the registry
|
* store a string setting in the registry
|
||||||
*/
|
*/
|
||||||
void FreezeStringF(char *val, char *subKey, char *name)
|
void FreezeStringF(const char *val, const char *subKey, const char *name)
|
||||||
{
|
{
|
||||||
HKEY software;
|
HKEY software;
|
||||||
if(RegOpenKeyEx(HKEY_CURRENT_USER, "Software", 0, KEY_ALL_ACCESS, &software) != ERROR_SUCCESS)
|
if(RegOpenKeyEx(HKEY_CURRENT_USER, "Software", 0, KEY_ALL_ACCESS, &software) != ERROR_SUCCESS)
|
||||||
@ -180,14 +180,14 @@ void FreezeStringF(char *val, char *subKey, char *name)
|
|||||||
if(RegCreateKeyEx(software, subKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &sub, NULL) != ERROR_SUCCESS)
|
if(RegCreateKeyEx(software, subKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &sub, NULL) != ERROR_SUCCESS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(RegSetValueEx(sub, name, 0, REG_SZ, (BYTE *)val, strlen(val)+1) != ERROR_SUCCESS)
|
if(RegSetValueEx(sub, name, 0, REG_SZ, (const BYTE *)val, strlen(val)+1) != ERROR_SUCCESS)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* retrieve a string setting, or return the default if that setting is unavailable
|
* retrieve a string setting, or return the default if that setting is unavailable
|
||||||
*/
|
*/
|
||||||
void ThawStringF(char *val, int max, char *subKey, char *name)
|
void ThawStringF(char *val, int max, const char *subKey, const char *name)
|
||||||
{
|
{
|
||||||
HKEY software;
|
HKEY software;
|
||||||
if(RegOpenKeyEx(HKEY_CURRENT_USER, "Software", 0, KEY_ALL_ACCESS, &software) != ERROR_SUCCESS)
|
if(RegOpenKeyEx(HKEY_CURRENT_USER, "Software", 0, KEY_ALL_ACCESS, &software) != ERROR_SUCCESS)
|
||||||
|
@ -12,22 +12,22 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FreezeWindowPos(hwnd) FreezeWindowPosF(hwnd, FREEZE_SUBKEY, #hwnd)
|
#define FreezeWindowPos(hwnd) FreezeWindowPosF(hwnd, FREEZE_SUBKEY, #hwnd)
|
||||||
void FreezeWindowPosF(HWND hWnd, char *subKey, char *name);
|
void FreezeWindowPosF(HWND hWnd, const char *subKey, const char *name);
|
||||||
|
|
||||||
#define ThawWindowPos(hwnd) ThawWindowPosF(hwnd, FREEZE_SUBKEY, #hwnd)
|
#define ThawWindowPos(hwnd) ThawWindowPosF(hwnd, FREEZE_SUBKEY, #hwnd)
|
||||||
void ThawWindowPosF(HWND hWnd, char *subKey, char *name);
|
void ThawWindowPosF(HWND hWnd, const char *subKey, const char *name);
|
||||||
|
|
||||||
#define FreezeDWORD(val) FreezeDWORDF(val, FREEZE_SUBKEY, #val)
|
#define FreezeDWORD(val) FreezeDWORDF(val, FREEZE_SUBKEY, #val)
|
||||||
void FreezeDWORDF(DWORD val, char *subKey, char *name);
|
void FreezeDWORDF(DWORD val, const char *subKey, const char *name);
|
||||||
|
|
||||||
#define ThawDWORD(val) val = ThawDWORDF(val, FREEZE_SUBKEY, #val)
|
#define ThawDWORD(val) val = ThawDWORDF(val, FREEZE_SUBKEY, #val)
|
||||||
DWORD ThawDWORDF(DWORD val, char *subKey, char *name);
|
DWORD ThawDWORDF(DWORD val, const char *subKey, const char *name);
|
||||||
|
|
||||||
#define FreezeString(val) FreezeStringF(val, FREEZE_SUBKEY, #val)
|
#define FreezeString(val) FreezeStringF(val, FREEZE_SUBKEY, #val)
|
||||||
void FreezeStringF(char *val, char *subKey, char *name);
|
void FreezeStringF(const char *val, const char *subKey, const char *name);
|
||||||
|
|
||||||
#define ThawString(val, max) ThawStringF(val, max, FREEZE_SUBKEY, #val)
|
#define ThawString(val, max) ThawStringF(val, max, FREEZE_SUBKEY, #val)
|
||||||
void ThawStringF(char *val, int max, char *subKey, char *name);
|
void ThawStringF(char *val, int max, const char *subKey, const char *name);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,7 +63,7 @@ SiHdl SpaceNavigator = SI_NO_HANDLE;
|
|||||||
|
|
||||||
HWND MessageWnd, OkButton;
|
HWND MessageWnd, OkButton;
|
||||||
BOOL MessageDone;
|
BOOL MessageDone;
|
||||||
char *MessageString;
|
const char *MessageString;
|
||||||
|
|
||||||
static LRESULT CALLBACK MessageProc(HWND hwnd, UINT msg, WPARAM wParam,
|
static LRESULT CALLBACK MessageProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
@ -126,7 +126,7 @@ HWND CreateWindowClient(DWORD exStyle, char *className, char *windowName,
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoMessageBox(char *str, int rows, int cols, BOOL error)
|
void DoMessageBox(const char *str, int rows, int cols, BOOL error)
|
||||||
{
|
{
|
||||||
EnableWindow(GraphicsWnd, FALSE);
|
EnableWindow(GraphicsWnd, FALSE);
|
||||||
EnableWindow(TextWnd, FALSE);
|
EnableWindow(TextWnd, FALSE);
|
||||||
@ -194,7 +194,7 @@ void DoMessageBox(char *str, int rows, int cols, BOOL error)
|
|||||||
DestroyWindow(MessageWnd);
|
DestroyWindow(MessageWnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddContextMenuItem(char *label, int id)
|
void AddContextMenuItem(const char *label, int id)
|
||||||
{
|
{
|
||||||
if(!ContextMenu) ContextMenu = CreatePopupMenu();
|
if(!ContextMenu) ContextMenu = CreatePopupMenu();
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ void GetTextWindowSize(int *w, int *h)
|
|||||||
GetWindowSize(TextWnd, w, h);
|
GetWindowSize(TextWnd, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenWebsite(char *url) {
|
void OpenWebsite(const char *url) {
|
||||||
ShellExecute(GraphicsWnd, "open", url, NULL, NULL, SW_SHOWNORMAL);
|
ShellExecute(GraphicsWnd, "open", url, NULL, NULL, SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,27 +270,27 @@ void ExitNow(void) {
|
|||||||
// Helpers so that we can read/write registry keys from the platform-
|
// Helpers so that we can read/write registry keys from the platform-
|
||||||
// independent code.
|
// independent code.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CnfFreezeString(char *str, char *name)
|
void CnfFreezeString(const char *str, const char *name)
|
||||||
{ FreezeStringF(str, FREEZE_SUBKEY, name); }
|
{ FreezeStringF(str, FREEZE_SUBKEY, name); }
|
||||||
|
|
||||||
void CnfFreezeDWORD(DWORD v, char *name)
|
void CnfFreezeDWORD(DWORD v, const char *name)
|
||||||
{ FreezeDWORDF(v, FREEZE_SUBKEY, name); }
|
{ FreezeDWORDF(v, FREEZE_SUBKEY, name); }
|
||||||
|
|
||||||
void CnfFreezeFloat(float v, char *name)
|
void CnfFreezeFloat(float v, const char *name)
|
||||||
{ FreezeDWORDF(*((DWORD *)&v), FREEZE_SUBKEY, name); }
|
{ FreezeDWORDF(*((DWORD *)&v), FREEZE_SUBKEY, name); }
|
||||||
|
|
||||||
void CnfThawString(char *str, int maxLen, char *name)
|
void CnfThawString(char *str, int maxLen, const char *name)
|
||||||
{ ThawStringF(str, maxLen, FREEZE_SUBKEY, name); }
|
{ ThawStringF(str, maxLen, FREEZE_SUBKEY, name); }
|
||||||
|
|
||||||
DWORD CnfThawDWORD(DWORD v, char *name)
|
DWORD CnfThawDWORD(DWORD v, const char *name)
|
||||||
{ return ThawDWORDF(v, FREEZE_SUBKEY, name); }
|
{ return ThawDWORDF(v, FREEZE_SUBKEY, name); }
|
||||||
|
|
||||||
float CnfThawFloat(float v, char *name) {
|
float CnfThawFloat(float v, const char *name) {
|
||||||
DWORD d = ThawDWORDF(*((DWORD *)&v), FREEZE_SUBKEY, name);
|
DWORD d = ThawDWORDF(*((DWORD *)&v), FREEZE_SUBKEY, name);
|
||||||
return *((float *)&d);
|
return *((float *)&d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetWindowTitle(char *str) {
|
void SetWindowTitle(const char *str) {
|
||||||
SetWindowText(GraphicsWnd, str);
|
SetWindowText(GraphicsWnd, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -809,7 +809,7 @@ LRESULT CALLBACK GraphicsWndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Common dialog routines, to open or save a file.
|
// Common dialog routines, to open or save a file.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
BOOL GetOpenFile(char *file, char *defExtension, char *selPattern)
|
BOOL GetOpenFile(char *file, const char *defExtension, const char *selPattern)
|
||||||
{
|
{
|
||||||
OPENFILENAME ofn;
|
OPENFILENAME ofn;
|
||||||
|
|
||||||
@ -834,7 +834,7 @@ BOOL GetOpenFile(char *file, char *defExtension, char *selPattern)
|
|||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
BOOL GetSaveFile(char *file, char *defExtension, char *selPattern)
|
BOOL GetSaveFile(char *file, const char *defExtension, const char *selPattern)
|
||||||
{
|
{
|
||||||
OPENFILENAME ofn;
|
OPENFILENAME ofn;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
static HANDLE PermHeap, TempHeap;
|
static HANDLE PermHeap, TempHeap;
|
||||||
|
|
||||||
void dbp(char *str, ...)
|
void dbp(const char *str, ...)
|
||||||
{
|
{
|
||||||
va_list f;
|
va_list f;
|
||||||
static char buf[1024*50];
|
static char buf[1024*50];
|
||||||
|
Loading…
Reference in New Issue
Block a user