Miscellaneous adjustments for warnings and code quality
This commit contains a grab bag of minor changes not worth committing individually: * Replaced raw Latin-1 characters with octal escapes to avoid source-file encoding issues * Undefined some convenience macros after they've served their purpose * Rewrote SEdge::From() to avoid confusing less-capable C++ compilers * Have oops() print a newline at the end of its message * Removed "static" keyword from the Bernstein() function definition, as it has a non-static prototype in srf/surface.h * Added casts (and changed a variable type) to quell warnings about integer size and signedness * Simplified an expression with our handy arraylen() macro
This commit is contained in:
parent
07b128b877
commit
66758b9595
2
file.cpp
2
file.cpp
@ -5,7 +5,7 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#include "solvespace.h"
|
#include "solvespace.h"
|
||||||
|
|
||||||
#define VERSION_STRING "±²³SolveSpaceREVa"
|
#define VERSION_STRING "\261\262\263" "SolveSpaceREVa"
|
||||||
|
|
||||||
static int StrStartsWith(const char *str, const 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;
|
||||||
|
@ -513,6 +513,8 @@ void Group::GenerateEquations(IdList<Equation,hEquation> *l) {
|
|||||||
AddEq(l, (EC(axis.x))->Minus(EP(4)), 3);
|
AddEq(l, (EC(axis.x))->Minus(EP(4)), 3);
|
||||||
AddEq(l, (EC(axis.y))->Minus(EP(5)), 4);
|
AddEq(l, (EC(axis.y))->Minus(EP(5)), 4);
|
||||||
AddEq(l, (EC(axis.z))->Minus(EP(6)), 5);
|
AddEq(l, (EC(axis.z))->Minus(EP(6)), 5);
|
||||||
|
#undef EC
|
||||||
|
#undef EP
|
||||||
} else if(type == EXTRUDE) {
|
} else if(type == EXTRUDE) {
|
||||||
if(predef.entityB.v != Entity::FREE_IN_3D.v) {
|
if(predef.entityB.v != Entity::FREE_IN_3D.v) {
|
||||||
// The extrusion path is locked along a line, normal to the
|
// The extrusion path is locked along a line, normal to the
|
||||||
|
@ -58,7 +58,10 @@ STriangle STriangle::From(STriMeta meta, Vector a, Vector b, Vector c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SEdge SEdge::From(Vector a, Vector b) {
|
SEdge SEdge::From(Vector a, Vector b) {
|
||||||
SEdge se = { 0, 0, 0, a, b };
|
SEdge se;
|
||||||
|
ZERO(&se);
|
||||||
|
se.a = a;
|
||||||
|
se.b = b;
|
||||||
return se;
|
return se;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#define __SOLVESPACE_H
|
#define __SOLVESPACE_H
|
||||||
|
|
||||||
// Debugging functions
|
// Debugging functions
|
||||||
#define oops() do { dbp("oops at line %d, file %s", __LINE__, __FILE__); \
|
#define oops() do { dbp("oops at line %d, file %s\n", __LINE__, __FILE__); \
|
||||||
if(0) *(char *)0 = 1; exit(-1); } while(0)
|
if(0) *(char *)0 = 1; exit(-1); } while(0)
|
||||||
#ifndef min
|
#ifndef min
|
||||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
#define min(x, y) ((x) < (y) ? (x) : (y))
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
// and convergence should be fast by now.
|
// and convergence should be fast by now.
|
||||||
#define RATPOLY_EPS (LENGTH_EPS/(1e2))
|
#define RATPOLY_EPS (LENGTH_EPS/(1e2))
|
||||||
|
|
||||||
static double Bernstein(int k, int deg, double t)
|
double Bernstein(int k, int deg, double t)
|
||||||
{
|
{
|
||||||
if(k > deg || k < 0) return 0;
|
if(k > deg || k < 0) return 0;
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ void Style::FreezeDefaultStyles(void) {
|
|||||||
|
|
||||||
DWORD Style::CreateCustomStyle(void) {
|
DWORD Style::CreateCustomStyle(void) {
|
||||||
SS.UndoRemember();
|
SS.UndoRemember();
|
||||||
DWORD vs = max(Style::FIRST_CUSTOM, SK.style.MaximumId() + 1);
|
DWORD vs = max((DWORD)Style::FIRST_CUSTOM, SK.style.MaximumId() + 1);
|
||||||
hStyle hs = { vs };
|
hStyle hs = { vs };
|
||||||
(void)Style::Get(hs);
|
(void)Style::Get(hs);
|
||||||
return hs.v;
|
return hs.v;
|
||||||
|
@ -130,7 +130,8 @@ void TextWindow::Printf(bool halfLine, const char *fmt, ...) {
|
|||||||
meta[r][c].link = NOT_A_LINK;
|
meta[r][c].link = NOT_A_LINK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fg = 'd', bg = 'd';
|
char fg = 'd';
|
||||||
|
int bg = 'd';
|
||||||
int link = NOT_A_LINK;
|
int link = NOT_A_LINK;
|
||||||
DWORD data = 0;
|
DWORD data = 0;
|
||||||
LinkFunction *f = NULL, *h = NULL;
|
LinkFunction *f = NULL, *h = NULL;
|
||||||
@ -211,7 +212,7 @@ void TextWindow::Printf(bool halfLine, const char *fmt, ...) {
|
|||||||
color = 0;
|
color = 0;
|
||||||
}
|
}
|
||||||
if(*fmt == 'F') {
|
if(*fmt == 'F') {
|
||||||
fg = color;
|
fg = (char)color;
|
||||||
} else {
|
} else {
|
||||||
bg = color;
|
bg = color;
|
||||||
}
|
}
|
||||||
@ -1002,6 +1003,7 @@ void TextWindow::MouseEvent(bool leftClick, bool leftDown, double x, double y) {
|
|||||||
SetMousePointerToHand(false);
|
SetMousePointerToHand(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#undef META
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if((!ps.Equals(&(SS.GW.hover))) ||
|
if((!ps.Equals(&(SS.GW.hover))) ||
|
||||||
|
@ -918,7 +918,7 @@ static void MenuById(int id, BOOL yes, BOOL check)
|
|||||||
|
|
||||||
if(SS.GW.menu[i].id == id) {
|
if(SS.GW.menu[i].id == id) {
|
||||||
if(subMenu < 0) oops();
|
if(subMenu < 0) oops();
|
||||||
if(subMenu >= (sizeof(SubMenus)/sizeof(SubMenus[0]))) oops();
|
if(subMenu >= arraylen(SubMenus)) oops();
|
||||||
|
|
||||||
if(check) {
|
if(check) {
|
||||||
CheckMenuItem(SubMenus[subMenu], id,
|
CheckMenuItem(SubMenus[subMenu], id,
|
||||||
|
Loading…
Reference in New Issue
Block a user