[LOG2LINES] translate_line(): Let 'offset' be an 'unsigned int', instead of a 'size_t' (#624)

Avoids half-uninitialized value on, i.e., Linux 64-bit (with ReactOS 32-bit).
CORE-14737
This commit is contained in:
Serge Gautherie 2018-06-21 14:05:35 +02:00 committed by Hermès BÉLUSCA - MAÏTO
parent d303b70b7a
commit 4f1a29e1b1

View file

@ -322,7 +322,7 @@ remove_mark(char *Line)
static void static void
translate_line(FILE *outFile, char *Line, char *path, char *LineOut) translate_line(FILE *outFile, char *Line, char *path, char *LineOut)
{ {
size_t offset; unsigned int offset;
int cnt, res; int cnt, res;
char *sep, *tail, *mark, *s; char *sep, *tail, *mark, *s;
unsigned char ch; unsigned char ch;
@ -346,7 +346,7 @@ translate_line(FILE *outFile, char *Line, char *path, char *LineOut)
if (sep) if (sep)
{ {
*sep = ' '; *sep = ' ';
cnt = sscanf(s, "<%s %x%c", path, (unsigned int *)(&offset), &ch); cnt = sscanf(s, "<%s %x%c", path, &offset, &ch);
if (opt_undo) if (opt_undo)
{ {
if (cnt == 3 && ch == ' ') if (cnt == 3 && ch == ' ')
@ -360,12 +360,12 @@ translate_line(FILE *outFile, char *Line, char *path, char *LineOut)
mark = opt_mark ? "* " : ""; mark = opt_mark ? "* " : "";
if (opt_redo && !(res = translate_file(path, offset, LineOut))) if (opt_redo && !(res = translate_file(path, offset, LineOut)))
{ {
log(outFile, "%s<%s:%x (%s)>%s", mark, path, (unsigned int)offset, LineOut, tail); log(outFile, "%s<%s:%x (%s)>%s", mark, path, offset, LineOut, tail);
summ.redo++; summ.redo++;
} }
else else
{ {
log(outFile, "%s<%s:%x>%s", mark, path, (unsigned int)offset, tail); log(outFile, "%s<%s:%x>%s", mark, path, offset, tail);
summ.undo++; summ.undo++;
} }
} }
@ -386,7 +386,7 @@ translate_line(FILE *outFile, char *Line, char *path, char *LineOut)
if (!(res = translate_file(path, offset, LineOut))) if (!(res = translate_file(path, offset, LineOut)))
{ {
mark = opt_mark ? "* " : ""; mark = opt_mark ? "* " : "";
log(outFile, "%s<%s:%x (%s)>%s", mark, path, (unsigned int)offset, LineOut, tail); log(outFile, "%s<%s:%x (%s)>%s", mark, path, offset, LineOut, tail);
summ.translated++; summ.translated++;
} }
else else