From c418300de4510ea758eb03711068076243d9f87f Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Mon, 15 Sep 2003 10:36:04 +0000 Subject: [PATCH] Fix warnings reported by Turbo C git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@684 6ac86273-5f31-0410-b378-82cca8765d1b --- utils/exeflat.c | 12 ++++++------ utils/patchobj.c | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/utils/exeflat.c b/utils/exeflat.c index f20c1c6..f19fd41 100644 --- a/utils/exeflat.c +++ b/utils/exeflat.c @@ -166,7 +166,7 @@ int main(int argc, char **argv) /* first read file into memory chunks */ fseek(src, header.exHeaderSize * 16UL, SEEK_SET); - buffers = malloc((size + BUFSIZE - 1) / BUFSIZE * sizeof(char *)); + buffers = malloc((size_t)((size + BUFSIZE - 1) / BUFSIZE) * sizeof(char *)); if (buffers == NULL) { printf("Allocation error\n"); @@ -177,7 +177,7 @@ int main(int argc, char **argv) to_xfer -= bufsize, curbuf++) { if (to_xfer < BUFSIZE) - bufsize = to_xfer; + bufsize = (size_t)to_xfer; *curbuf = malloc(bufsize); if (*curbuf == NULL) { @@ -208,10 +208,10 @@ int main(int argc, char **argv) for (i = 0; i < header.exRelocItems; i++) { ULONG spot = ((ULONG) reloc[i].seg << 4) + reloc[i].off; - UBYTE *spot0 = &buffers[spot / BUFSIZE][spot % BUFSIZE]; - UBYTE *spot1 = &buffers[(spot + 1) / BUFSIZE][(spot + 1) % BUFSIZE]; + UBYTE *spot0 = &buffers[(size_t)(spot / BUFSIZE)][(size_t)(spot % BUFSIZE)]; + UBYTE *spot1 = &buffers[(size_t)((spot + 1) / BUFSIZE)][(size_t)((spot + 1) % BUFSIZE)]; UWORD segment = ((UWORD) * spot1 << 8) + *spot0; - + for (j = 0; j < silentcount; j++) if (segment == silentSegments[j]) { @@ -270,7 +270,7 @@ int main(int argc, char **argv) to_xfer -= bufsize, curbuf++) { if (to_xfer < BUFSIZE) - bufsize = to_xfer; + bufsize = (size_t)to_xfer; if (fwrite(*curbuf, sizeof(char), bufsize, dest) != bufsize) { diff --git a/utils/patchobj.c b/utils/patchobj.c index 9d0eb6c..72d9870 100644 --- a/utils/patchobj.c +++ b/utils/patchobj.c @@ -123,7 +123,7 @@ int main(int argc, char *argv[]) struct record { unsigned char rectyp; unsigned short datalen; - unsigned char buffer[0x2000]; + char buffer[0x2000]; } Record, Outrecord; #include "algndflt.h" @@ -132,7 +132,7 @@ struct verify_pack1 { char x[ sizeof(struct record) == 0x2003 ? 1 : -1];}; void go_records(FILE * fdin, FILE * fdo) { unsigned char stringlen; - unsigned char *string, *s; + char *string, *s; int i, j; unsigned char chksum; @@ -165,7 +165,7 @@ void go_records(FILE * fdin, FILE * fdo) for (i = 0; i < Record.datalen - 1;) { - stringlen = Record.buffer[i]; + stringlen = (unsigned char)Record.buffer[i]; i++; string = &Record.buffer[i]; @@ -188,9 +188,9 @@ void go_records(FILE * fdin, FILE * fdo) } chksum = 0; - for (s = (unsigned char *)&Outrecord; + for (s = (char *)&Outrecord; s < &Outrecord.buffer[Outrecord.datalen]; s++) - chksum += *s; + chksum += (unsigned char)*s; Outrecord.buffer[Outrecord.datalen] = ~chksum; Outrecord.datalen++;