Use casts to bridge mismatches in integer-type sizes and signedness
The compiler gets nervous when we (for example) pass in a size_t as an int parameter, or assign an int to a char, or assign -1 to an unsigned type. By adding appropriate casts, we inform the compiler that, yes, we know what we're doing. This change also upgrades a va_arg() type from char to int, as char is always promoted to int when passed through '...'.pull/3/head
parent
8913d11fa5
commit
a72575d04e
|
@ -503,7 +503,7 @@ void VectorFileWriter::Output(SBezierLoopSetSet *sblss, SMesh *sm) {
|
||||||
b = sbl->l.First();
|
b = sbl->l.First();
|
||||||
if(!b || !Style::Exportable(b->auxA)) continue;
|
if(!b || !Style::Exportable(b->auxA)) continue;
|
||||||
|
|
||||||
hStyle hs = { b->auxA };
|
hStyle hs = { (DWORD)b->auxA };
|
||||||
Style *stl = Style::Get(hs);
|
Style *stl = Style::Get(hs);
|
||||||
double lineWidth = Style::WidthMm(b->auxA)*s;
|
double lineWidth = Style::WidthMm(b->auxA)*s;
|
||||||
DWORD strokeRgb = Style::Color(hs, true);
|
DWORD strokeRgb = Style::Color(hs, true);
|
||||||
|
|
|
@ -277,7 +277,7 @@ void PdfFileWriter::StartFile(void) {
|
||||||
"%%%c%c%c%c\r\n",
|
"%%%c%c%c%c\r\n",
|
||||||
0xe2, 0xe3, 0xcf, 0xd3);
|
0xe2, 0xe3, 0xcf, 0xd3);
|
||||||
|
|
||||||
xref[1] = ftell(f);
|
xref[1] = (DWORD)ftell(f);
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"1 0 obj\r\n"
|
"1 0 obj\r\n"
|
||||||
" << /Type /Catalog\r\n"
|
" << /Type /Catalog\r\n"
|
||||||
|
@ -286,7 +286,7 @@ void PdfFileWriter::StartFile(void) {
|
||||||
" >>\r\n"
|
" >>\r\n"
|
||||||
"endobj\r\n");
|
"endobj\r\n");
|
||||||
|
|
||||||
xref[2] = ftell(f);
|
xref[2] = (DWORD)ftell(f);
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"2 0 obj\r\n"
|
"2 0 obj\r\n"
|
||||||
" << /Type /Outlines\r\n"
|
" << /Type /Outlines\r\n"
|
||||||
|
@ -294,7 +294,7 @@ void PdfFileWriter::StartFile(void) {
|
||||||
" >>\r\n"
|
" >>\r\n"
|
||||||
"endobj\r\n");
|
"endobj\r\n");
|
||||||
|
|
||||||
xref[3] = ftell(f);
|
xref[3] = (DWORD)ftell(f);
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"3 0 obj\r\n"
|
"3 0 obj\r\n"
|
||||||
" << /Type /Pages\r\n"
|
" << /Type /Pages\r\n"
|
||||||
|
@ -303,7 +303,7 @@ void PdfFileWriter::StartFile(void) {
|
||||||
" >>\r\n"
|
" >>\r\n"
|
||||||
"endobj\r\n");
|
"endobj\r\n");
|
||||||
|
|
||||||
xref[4] = ftell(f);
|
xref[4] = (DWORD)ftell(f);
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"4 0 obj\r\n"
|
"4 0 obj\r\n"
|
||||||
" << /Type /Page\r\n"
|
" << /Type /Page\r\n"
|
||||||
|
@ -318,35 +318,35 @@ void PdfFileWriter::StartFile(void) {
|
||||||
MmToPts(ptMax.x - ptMin.x),
|
MmToPts(ptMax.x - ptMin.x),
|
||||||
MmToPts(ptMax.y - ptMin.y));
|
MmToPts(ptMax.y - ptMin.y));
|
||||||
|
|
||||||
xref[5] = ftell(f);
|
xref[5] = (DWORD)ftell(f);
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"5 0 obj\r\n"
|
"5 0 obj\r\n"
|
||||||
" << /Length 6 0 R >>\r\n"
|
" << /Length 6 0 R >>\r\n"
|
||||||
"stream\r\n");
|
"stream\r\n");
|
||||||
bodyStart = ftell(f);
|
bodyStart = (DWORD)ftell(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdfFileWriter::FinishAndCloseFile(void) {
|
void PdfFileWriter::FinishAndCloseFile(void) {
|
||||||
DWORD bodyEnd = ftell(f);
|
DWORD bodyEnd = (DWORD)ftell(f);
|
||||||
|
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"endstream\r\n"
|
"endstream\r\n"
|
||||||
"endobj\r\n");
|
"endobj\r\n");
|
||||||
|
|
||||||
xref[6] = ftell(f);
|
xref[6] = (DWORD)ftell(f);
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"6 0 obj\r\n"
|
"6 0 obj\r\n"
|
||||||
" %d\r\n"
|
" %d\r\n"
|
||||||
"endobj\r\n",
|
"endobj\r\n",
|
||||||
bodyEnd - bodyStart);
|
bodyEnd - bodyStart);
|
||||||
|
|
||||||
xref[7] = ftell(f);
|
xref[7] = (DWORD)ftell(f);
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"7 0 obj\r\n"
|
"7 0 obj\r\n"
|
||||||
" [/PDF /Text]\r\n"
|
" [/PDF /Text]\r\n"
|
||||||
"endobj\r\n");
|
"endobj\r\n");
|
||||||
|
|
||||||
xref[8] = ftell(f);
|
xref[8] = (DWORD)ftell(f);
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"8 0 obj\r\n"
|
"8 0 obj\r\n"
|
||||||
" << /Type /Font\r\n"
|
" << /Type /Font\r\n"
|
||||||
|
@ -357,13 +357,13 @@ void PdfFileWriter::FinishAndCloseFile(void) {
|
||||||
" >>\r\n"
|
" >>\r\n"
|
||||||
"endobj\r\n");
|
"endobj\r\n");
|
||||||
|
|
||||||
xref[9] = ftell(f);
|
xref[9] = (DWORD)ftell(f);
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"9 0 obj\r\n"
|
"9 0 obj\r\n"
|
||||||
" << /Creator (SolveSpace)\r\n"
|
" << /Creator (SolveSpace)\r\n"
|
||||||
" >>\r\n");
|
" >>\r\n");
|
||||||
|
|
||||||
DWORD xrefStart = ftell(f);
|
DWORD xrefStart = (DWORD)ftell(f);
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"xref\r\n"
|
"xref\r\n"
|
||||||
"0 10\r\n"
|
"0 10\r\n"
|
||||||
|
|
6
file.cpp
6
file.cpp
|
@ -382,7 +382,7 @@ void SolveSpace::LoadUsingTable(char *key, char *val) {
|
||||||
for(;;) {
|
for(;;) {
|
||||||
EntityMap em;
|
EntityMap em;
|
||||||
char line2[1024];
|
char line2[1024];
|
||||||
fgets(line2, sizeof(line2), fh);
|
fgets(line2, (int)sizeof(line2), fh);
|
||||||
if(sscanf(line2, "%d %x %d", &(em.h.v), &(em.input.v),
|
if(sscanf(line2, "%d %x %d", &(em.h.v), &(em.input.v),
|
||||||
&(em.copyNumber)) == 3)
|
&(em.copyNumber)) == 3)
|
||||||
{
|
{
|
||||||
|
@ -420,7 +420,7 @@ bool SolveSpace::LoadFromFile(char *filename) {
|
||||||
sv.g.scale = 1; // default is 1, not 0; so legacy files need this
|
sv.g.scale = 1; // default is 1, not 0; so legacy files need this
|
||||||
|
|
||||||
char line[1024];
|
char line[1024];
|
||||||
while(fgets(line, sizeof(line), fh)) {
|
while(fgets(line, (int)sizeof(line), fh)) {
|
||||||
char *s = strchr(line, '\n');
|
char *s = strchr(line, '\n');
|
||||||
if(s) *s = '\0';
|
if(s) *s = '\0';
|
||||||
// We should never get files with \r characters in them, but mailers
|
// We should never get files with \r characters in them, but mailers
|
||||||
|
@ -502,7 +502,7 @@ bool SolveSpace::LoadEntitiesFromFile(char *file, EntityList *le,
|
||||||
memset(&sv, 0, sizeof(sv));
|
memset(&sv, 0, sizeof(sv));
|
||||||
|
|
||||||
char line[1024];
|
char line[1024];
|
||||||
while(fgets(line, sizeof(line), fh)) {
|
while(fgets(line, (int)sizeof(line), fh)) {
|
||||||
char *s = strchr(line, '\n');
|
char *s = strchr(line, '\n');
|
||||||
if(s) *s = '\0';
|
if(s) *s = '\0';
|
||||||
// We should never get files with \r characters in them, but mailers
|
// We should never get files with \r characters in them, but mailers
|
||||||
|
|
|
@ -545,7 +545,7 @@ void Group::DrawFilledPaths(void) {
|
||||||
// In an assembled loop, all the styles should be the same; so doesn't
|
// In an assembled loop, all the styles should be the same; so doesn't
|
||||||
// matter which one we grab.
|
// matter which one we grab.
|
||||||
SBezier *sb = &(sbls->l.elem[0].l.elem[0]);
|
SBezier *sb = &(sbls->l.elem[0].l.elem[0]);
|
||||||
hStyle hs = { sb->auxA };
|
hStyle hs = { (DWORD)sb->auxA };
|
||||||
Style *s = Style::Get(hs);
|
Style *s = Style::Get(hs);
|
||||||
if(s->filled) {
|
if(s->filled) {
|
||||||
// This is a filled loop, where the user specified a fill color.
|
// This is a filled loop, where the user specified a fill color.
|
||||||
|
|
|
@ -990,7 +990,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity e;
|
Entity e;
|
||||||
if(r->extraPoints >= arraylen(e.point) - 4) {
|
if(r->extraPoints >= (int)arraylen(e.point) - 4) {
|
||||||
ClearPending();
|
ClearPending();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,7 @@ void SSurface::TrimFromEdgeList(SEdgeList *el, bool asUv) {
|
||||||
merged = false;
|
merged = false;
|
||||||
for(se = el->l.First(); se; se = el->l.NextAfter(se)) {
|
for(se = el->l.First(); se; se = el->l.NextAfter(se)) {
|
||||||
if(se->tag) continue;
|
if(se->tag) continue;
|
||||||
if(se->auxA != stb.curve.v) continue;
|
if(se->auxA != (int)stb.curve.v) continue;
|
||||||
if(( se->auxB && !stb.backwards) ||
|
if(( se->auxB && !stb.backwards) ||
|
||||||
(!se->auxB && stb.backwards)) continue;
|
(!se->auxB && stb.backwards)) continue;
|
||||||
|
|
||||||
|
|
|
@ -334,7 +334,7 @@ void SSurface::IntersectAgainst(SSurface *b, SShell *agnstA, SShell *agnstB,
|
||||||
if(lsi.n == 0) continue;
|
if(lsi.n == 0) continue;
|
||||||
|
|
||||||
// Find the other surface that this curve trims.
|
// Find the other surface that this curve trims.
|
||||||
hSCurve hsc = { se->auxA };
|
hSCurve hsc = { (DWORD)se->auxA };
|
||||||
SCurve *sc = shA->curve.FindById(hsc);
|
SCurve *sc = shA->curve.FindById(hsc);
|
||||||
hSSurface hother = (sc->surfA.v == srfA->h.v) ?
|
hSSurface hother = (sc->surfA.v == srfA->h.v) ?
|
||||||
sc->surfB : sc->surfA;
|
sc->surfB : sc->surfA;
|
||||||
|
|
|
@ -45,7 +45,7 @@ char *Style::CnfPrefixToName(const char *prefix) {
|
||||||
if(isupper(prefix[i]) && i != 0) {
|
if(isupper(prefix[i]) && i != 0) {
|
||||||
name[j++] = '-';
|
name[j++] = '-';
|
||||||
}
|
}
|
||||||
name[j++] = tolower(prefix[i]);
|
name[j++] = (char)tolower(prefix[i]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
name[j++] = '\0';
|
name[j++] = '\0';
|
||||||
|
@ -198,11 +198,11 @@ Style *Style::Get(hStyle h) {
|
||||||
// hStyle or with the integer corresponding to that hStyle.v.
|
// hStyle or with the integer corresponding to that hStyle.v.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
DWORD Style::Color(int s, bool forExport) {
|
DWORD Style::Color(int s, bool forExport) {
|
||||||
hStyle hs = { s };
|
hStyle hs = { (DWORD)s };
|
||||||
return Color(hs, forExport);
|
return Color(hs, forExport);
|
||||||
}
|
}
|
||||||
float Style::Width(int s) {
|
float Style::Width(int s) {
|
||||||
hStyle hs = { s };
|
hStyle hs = { (DWORD)s };
|
||||||
return Width(hs);
|
return Width(hs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ double Style::TextHeight(hStyle hs) {
|
||||||
// if it's both shown and exportable.
|
// if it's both shown and exportable.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool Style::Exportable(int si) {
|
bool Style::Exportable(int si) {
|
||||||
hStyle hs = { si };
|
hStyle hs = { (DWORD)si };
|
||||||
Style *s = Get(hs);
|
Style *s = Get(hs);
|
||||||
return (s->exportable) && (s->visible);
|
return (s->exportable) && (s->visible);
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,8 @@ void TextWindow::Printf(bool halfLine, const char *fmt, ...) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'c': {
|
case 'c': {
|
||||||
char v = va_arg(vl, char);
|
// 'char' is promoted to 'int' when passed through '...'
|
||||||
|
int v = va_arg(vl, int);
|
||||||
if(v == 0) {
|
if(v == 0) {
|
||||||
strcpy(buf, "");
|
strcpy(buf, "");
|
||||||
} else {
|
} else {
|
||||||
|
@ -436,7 +437,7 @@ void TextWindow::DrawOrHitTestIcons(int how, double mx, double my)
|
||||||
double ox = oldMousePos.x, oy = oldMousePos.y - LINE_HEIGHT;
|
double ox = oldMousePos.x, oy = oldMousePos.y - LINE_HEIGHT;
|
||||||
ox += 3;
|
ox += 3;
|
||||||
oy -= 3;
|
oy -= 3;
|
||||||
int tw = (strlen(str) + 1)*CHAR_WIDTH;
|
int tw = ((int)strlen(str) + 1)*CHAR_WIDTH;
|
||||||
ox = min(ox, (width - 25) - tw);
|
ox = min(ox, (width - 25) - tw);
|
||||||
oy = max(oy, 5);
|
oy = max(oy, 5);
|
||||||
|
|
||||||
|
|
|
@ -227,7 +227,7 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int tw = strlen(str)*SS.TW.CHAR_WIDTH + 10,
|
int tw = (int)strlen(str)*SS.TW.CHAR_WIDTH + 10,
|
||||||
th = SS.TW.LINE_HEIGHT + 2;
|
th = SS.TW.LINE_HEIGHT + 2;
|
||||||
|
|
||||||
double ox = toolbarMouseX + 3, oy = toolbarMouseY + 3;
|
double ox = toolbarMouseX + 3, oy = toolbarMouseY + 3;
|
||||||
|
|
36
ttf.cpp
36
ttf.cpp
|
@ -256,14 +256,14 @@ bool TtfFont::LoadFontFromFile(bool nameOnly) {
|
||||||
|
|
||||||
// Now load the Table Directory; our goal in doing this will be to
|
// Now load the Table Directory; our goal in doing this will be to
|
||||||
// find the addresses of the tables that we will need.
|
// find the addresses of the tables that we will need.
|
||||||
DWORD glyfAddr = -1, glyfLen;
|
DWORD glyfAddr = (DWORD)-1, glyfLen;
|
||||||
DWORD cmapAddr = -1, cmapLen;
|
DWORD cmapAddr = (DWORD)-1, cmapLen;
|
||||||
DWORD headAddr = -1, headLen;
|
DWORD headAddr = (DWORD)-1, headLen;
|
||||||
DWORD locaAddr = -1, locaLen;
|
DWORD locaAddr = (DWORD)-1, locaLen;
|
||||||
DWORD maxpAddr = -1, maxpLen;
|
DWORD maxpAddr = (DWORD)-1, maxpLen;
|
||||||
DWORD nameAddr = -1, nameLen;
|
DWORD nameAddr = (DWORD)-1, nameLen;
|
||||||
DWORD hmtxAddr = -1, hmtxLen;
|
DWORD hmtxAddr = (DWORD)-1, hmtxLen;
|
||||||
DWORD hheaAddr = -1, hheaLen;
|
DWORD hheaAddr = (DWORD)-1, hheaLen;
|
||||||
|
|
||||||
for(i = 0; i < numTables; i++) {
|
for(i = 0; i < numTables; i++) {
|
||||||
char tag[5] = "xxxx";
|
char tag[5] = "xxxx";
|
||||||
|
@ -302,9 +302,9 @@ bool TtfFont::LoadFontFromFile(bool nameOnly) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(glyfAddr == -1 || cmapAddr == -1 || headAddr == -1 ||
|
if(glyfAddr == (DWORD)-1 || cmapAddr == (DWORD)-1 || headAddr == (DWORD)-1 ||
|
||||||
locaAddr == -1 || maxpAddr == -1 || hmtxAddr == -1 ||
|
locaAddr == (DWORD)-1 || maxpAddr == (DWORD)-1 || hmtxAddr == (DWORD)-1 ||
|
||||||
nameAddr == -1 || hheaAddr == -1)
|
nameAddr == (DWORD)-1 || hheaAddr == (DWORD)-1)
|
||||||
{
|
{
|
||||||
throw "missing table addr";
|
throw "missing table addr";
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ bool TtfFont::LoadFontFromFile(bool nameOnly) {
|
||||||
int c = 0;
|
int c = 0;
|
||||||
for(i = 0; i < displayNameLength; i++) {
|
for(i = 0; i < displayNameLength; i++) {
|
||||||
BYTE b = GetBYTE();
|
BYTE b = GetBYTE();
|
||||||
if(b && c < (sizeof(name.str) - 2)) {
|
if(b && c < ((int)sizeof(name.str) - 2)) {
|
||||||
name.str[c++] = b;
|
name.str[c++] = b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -449,7 +449,7 @@ bool TtfFont::LoadFontFromFile(bool nameOnly) {
|
||||||
// glyphs.
|
// glyphs.
|
||||||
fseek(fh, cmapAddr, SEEK_SET);
|
fseek(fh, cmapAddr, SEEK_SET);
|
||||||
|
|
||||||
DWORD usedTableAddr = -1;
|
DWORD usedTableAddr = (DWORD)-1;
|
||||||
|
|
||||||
WORD cmapVersion = GetWORD();
|
WORD cmapVersion = GetWORD();
|
||||||
WORD cmapTableCount = GetWORD();
|
WORD cmapTableCount = GetWORD();
|
||||||
|
@ -464,7 +464,7 @@ bool TtfFont::LoadFontFromFile(bool nameOnly) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(usedTableAddr == -1) {
|
if(usedTableAddr == (DWORD)-1) {
|
||||||
throw "no used table addr";
|
throw "no used table addr";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,14 +504,14 @@ bool TtfFont::LoadFontFromFile(bool nameOnly) {
|
||||||
idDelta[i] = GetWORD();
|
idDelta[i] = GetWORD();
|
||||||
}
|
}
|
||||||
for(i = 0; i < segCount; i++) {
|
for(i = 0; i < segCount; i++) {
|
||||||
filePos[i] = ftell(fh);
|
filePos[i] = (DWORD)ftell(fh);
|
||||||
idRangeOffset[i] = GetWORD();
|
idRangeOffset[i] = GetWORD();
|
||||||
}
|
}
|
||||||
|
|
||||||
// So first, null out the glyph table in our in-memory representation
|
// So first, null out the glyph table in our in-memory representation
|
||||||
// of the font; any character for which cmap does not provide a glyph
|
// of the font; any character for which cmap does not provide a glyph
|
||||||
// corresponds to -1
|
// corresponds to -1
|
||||||
for(i = 0; i < arraylen(useGlyph); i++) {
|
for(i = 0; i < (int)arraylen(useGlyph); i++) {
|
||||||
useGlyph[i] = 0;
|
useGlyph[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -520,7 +520,7 @@ bool TtfFont::LoadFontFromFile(bool nameOnly) {
|
||||||
if(idRangeOffset[i] == 0) {
|
if(idRangeOffset[i] == 0) {
|
||||||
int j;
|
int j;
|
||||||
for(j = startChar[i]; j <= endChar[i]; j++) {
|
for(j = startChar[i]; j <= endChar[i]; j++) {
|
||||||
if(j > 0 && j < arraylen(useGlyph)) {
|
if(j > 0 && j < (int)arraylen(useGlyph)) {
|
||||||
// Don't create a reference to a glyph that we won't
|
// Don't create a reference to a glyph that we won't
|
||||||
// store because it's bigger than the table.
|
// store because it's bigger than the table.
|
||||||
if((WORD)(j + v) < glyphs) {
|
if((WORD)(j + v) < glyphs) {
|
||||||
|
@ -532,7 +532,7 @@ bool TtfFont::LoadFontFromFile(bool nameOnly) {
|
||||||
} else {
|
} else {
|
||||||
int j;
|
int j;
|
||||||
for(j = startChar[i]; j <= endChar[i]; j++) {
|
for(j = startChar[i]; j <= endChar[i]; j++) {
|
||||||
if(j > 0 && j < arraylen(useGlyph)) {
|
if(j > 0 && j < (int)arraylen(useGlyph)) {
|
||||||
int fp = filePos[i];
|
int fp = filePos[i];
|
||||||
fp += (j - startChar[i])*sizeof(WORD);
|
fp += (j - startChar[i])*sizeof(WORD);
|
||||||
fp += idRangeOffset[i];
|
fp += idRangeOffset[i];
|
||||||
|
|
8
util.cpp
8
util.cpp
|
@ -15,12 +15,12 @@ void MakePathRelative(const char *basep, char *pathp)
|
||||||
// Convert everything to lowercase
|
// Convert everything to lowercase
|
||||||
p = basep;
|
p = basep;
|
||||||
for(i = 0; *p; p++) {
|
for(i = 0; *p; p++) {
|
||||||
base[i++] = tolower(*p);
|
base[i++] = (char)tolower(*p);
|
||||||
}
|
}
|
||||||
base[i++] = '\0';
|
base[i++] = '\0';
|
||||||
p = pathp;
|
p = pathp;
|
||||||
for(i = 0; *p; p++) {
|
for(i = 0; *p; p++) {
|
||||||
path[i++] = tolower(*p);
|
path[i++] = (char)tolower(*p);
|
||||||
}
|
}
|
||||||
path[i++] = '\0';
|
path[i++] = '\0';
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ void MakePathAbsolute(const char *basep, char *pathp) {
|
||||||
|
|
||||||
// Chop off the filename
|
// Chop off the filename
|
||||||
int i;
|
int i;
|
||||||
for(i = strlen(out) - 1; i >= 0; i--) {
|
for(i = (int)strlen(out) - 1; i >= 0; i--) {
|
||||||
if(out[i] == '\\' || out[i] == '/') break;
|
if(out[i] == '\\' || out[i] == '/') break;
|
||||||
}
|
}
|
||||||
if(i < 0) return; // base is not an absolute path, or something?
|
if(i < 0) return; // base is not an absolute path, or something?
|
||||||
|
@ -96,7 +96,7 @@ bool StringAllPrintable(const char *str)
|
||||||
|
|
||||||
bool StringEndsIn(const char *str, const char *ending)
|
bool StringEndsIn(const char *str, const char *ending)
|
||||||
{
|
{
|
||||||
int i, ls = strlen(str), le = strlen(ending);
|
int i, ls = (int)strlen(str), le = (int)strlen(ending);
|
||||||
|
|
||||||
if(ls < le) return false;
|
if(ls < le) return false;
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ void FreezeStringF(const char *val, const char *subKey, const 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, (const BYTE *)val, strlen(val)+1) != ERROR_SUCCESS)
|
if(RegSetValueEx(sub, name, 0, REG_SZ, (const BYTE *)val, (DWORD)strlen(val)+1) != ERROR_SUCCESS)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -478,7 +478,7 @@ LRESULT CALLBACK TextWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
(r.bottom - r.top), TRUE);
|
(r.bottom - r.top), TRUE);
|
||||||
// If the window is growing, then the scrollbar position may
|
// If the window is growing, then the scrollbar position may
|
||||||
// be moving, so it's as if we're dragging the scrollbar.
|
// be moving, so it's as if we're dragging the scrollbar.
|
||||||
HandleTextWindowScrollBar(-1, -1);
|
HandleTextWindowScrollBar((WPARAM)-1, -1);
|
||||||
InvalidateRect(TextWnd, NULL, FALSE);
|
InvalidateRect(TextWnd, NULL, FALSE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -551,7 +551,7 @@ static BOOL ProcessKeyDown(WPARAM wParam)
|
||||||
case VK_F9:
|
case VK_F9:
|
||||||
case VK_F10:
|
case VK_F10:
|
||||||
case VK_F11:
|
case VK_F11:
|
||||||
case VK_F12: c = (wParam - VK_F1) + 0xf1; break;
|
case VK_F12: c = ((int)wParam - VK_F1) + 0xf1; break;
|
||||||
|
|
||||||
// These overlap with some character codes that I'm using, so
|
// These overlap with some character codes that I'm using, so
|
||||||
// don't let them trigger by accident.
|
// don't let them trigger by accident.
|
||||||
|
@ -563,7 +563,7 @@ static BOOL ProcessKeyDown(WPARAM wParam)
|
||||||
case VK_RWIN: return FALSE;
|
case VK_RWIN: return FALSE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
c = wParam;
|
c = (int)wParam;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(GetAsyncKeyState(VK_SHIFT) & 0x8000) c |= 0x100;
|
if(GetAsyncKeyState(VK_SHIFT) & 0x8000) c |= 0x100;
|
||||||
|
@ -890,7 +890,7 @@ void LoadAllFontFiles(void)
|
||||||
ZERO(&tf);
|
ZERO(&tf);
|
||||||
|
|
||||||
char fullPath[MAX_PATH];
|
char fullPath[MAX_PATH];
|
||||||
GetWindowsDirectory(fullPath, MAX_PATH - (30 + strlen(wfd.cFileName)));
|
GetWindowsDirectory(fullPath, MAX_PATH - (30 + (UINT)strlen(wfd.cFileName)));
|
||||||
strcat(fullPath, "\\fonts\\");
|
strcat(fullPath, "\\fonts\\");
|
||||||
strcat(fullPath, wfd.cFileName);
|
strcat(fullPath, wfd.cFileName);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue