(svn r23587) -Fix-ish: MSVC warnings in case strgen would be in the main project file

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
rubidium 13 years ago
parent 1bb9639862
commit 88f1acd26b

@ -380,7 +380,7 @@ static int TranslateArgumentIdx(int arg, int offset = 0);
static void EmitWordList(Buffer *buffer, const char * const *words, uint nw) static void EmitWordList(Buffer *buffer, const char * const *words, uint nw)
{ {
buffer->AppendByte(nw); buffer->AppendByte(nw);
for (uint i = 0; i < nw; i++) buffer->AppendByte(strlen(words[i]) + 1); for (uint i = 0; i < nw; i++) buffer->AppendByte((uint)strlen(words[i]) + 1);
for (uint i = 0; i < nw; i++) { for (uint i = 0; i < nw; i++) {
for (uint j = 0; words[i][j] != '\0'; j++) buffer->AppendByte(words[i][j]); for (uint j = 0; words[i][j] != '\0'; j++) buffer->AppendByte(words[i][j]);
buffer->AppendByte(0); buffer->AppendByte(0);
@ -479,7 +479,7 @@ static const CmdStruct *FindCmd(const char *s, int len)
return NULL; return NULL;
} }
static uint ResolveCaseName(const char *str, uint len) static uint ResolveCaseName(const char *str, size_t len)
{ {
/* First get a clean copy of only the case name, then resolve it. */ /* First get a clean copy of only the case name, then resolve it. */
char case_str[CASE_GENDER_LEN]; char case_str[CASE_GENDER_LEN];
@ -788,7 +788,7 @@ void StringReader::HandleString(char *str)
static void rstrip(char *buf) static void rstrip(char *buf)
{ {
int i = strlen(buf); size_t i = strlen(buf);
while (i > 0 && (buf[i - 1] == '\r' || buf[i - 1] == '\n' || buf[i - 1] == ' ')) i--; while (i > 0 && (buf[i - 1] == '\r' || buf[i - 1] == '\n' || buf[i - 1] == ' ')) i--;
buf[i] = '\0'; buf[i] = '\0';
} }
@ -824,8 +824,8 @@ void HeaderWriter::WriteHeader(const StringData &data)
int last = 0; int last = 0;
for (size_t i = 0; i < data.max_strings; i++) { for (size_t i = 0; i < data.max_strings; i++) {
if (data.strings[i] != NULL) { if (data.strings[i] != NULL) {
this->WriteStringID(data.strings[i]->name, i); this->WriteStringID(data.strings[i]->name, (int)i);
last = i; last = (int)i;
} }
} }
@ -932,7 +932,7 @@ void LanguageWriter::WriteLang(const StringData &data)
{ {
uint *in_use = AllocaM(uint, data.tabs); uint *in_use = AllocaM(uint, data.tabs);
for (size_t tab = 0; tab < data.tabs; tab++) { for (size_t tab = 0; tab < data.tabs; tab++) {
uint n = data.CountInUse(tab); uint n = data.CountInUse((uint)tab);
in_use[tab] = n; in_use[tab] = n;
_lang.offsets[tab] = TO_LE16(n); _lang.offsets[tab] = TO_LE16(n);
@ -1007,14 +1007,14 @@ void LanguageWriter::WriteLang(const StringData &data)
for (c = casep; c != NULL; c = c->next) { for (c = casep; c != NULL; c = c->next) {
buffer.AppendByte(c->caseidx); buffer.AppendByte(c->caseidx);
/* Make some space for the 16-bit length */ /* Make some space for the 16-bit length */
size_t pos = buffer.Length(); uint pos = buffer.Length();
buffer.AppendByte(0); buffer.AppendByte(0);
buffer.AppendByte(0); buffer.AppendByte(0);
/* Write string */ /* Write string */
PutCommandString(&buffer, c->string); PutCommandString(&buffer, c->string);
buffer.AppendByte(0); // terminate with a zero buffer.AppendByte(0); // terminate with a zero
/* Fill in the length */ /* Fill in the length */
size_t size = buffer.Length() - (pos + 2); uint size = buffer.Length() - (pos + 2);
buffer[pos + 0] = GB(size, 8, 8); buffer[pos + 0] = GB(size, 8, 8);
buffer[pos + 1] = GB(size, 0, 8); buffer[pos + 1] = GB(size, 0, 8);
} }

Loading…
Cancel
Save