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
This commit is contained in:
Bart Oldeman 2003-09-15 10:36:04 +00:00
parent b0e54ff704
commit c418300de4
2 changed files with 11 additions and 11 deletions

View File

@ -166,7 +166,7 @@ int main(int argc, char **argv)
/* first read file into memory chunks */ /* first read file into memory chunks */
fseek(src, header.exHeaderSize * 16UL, SEEK_SET); 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) if (buffers == NULL)
{ {
printf("Allocation error\n"); printf("Allocation error\n");
@ -177,7 +177,7 @@ int main(int argc, char **argv)
to_xfer -= bufsize, curbuf++) to_xfer -= bufsize, curbuf++)
{ {
if (to_xfer < BUFSIZE) if (to_xfer < BUFSIZE)
bufsize = to_xfer; bufsize = (size_t)to_xfer;
*curbuf = malloc(bufsize); *curbuf = malloc(bufsize);
if (*curbuf == NULL) if (*curbuf == NULL)
{ {
@ -208,8 +208,8 @@ int main(int argc, char **argv)
for (i = 0; i < header.exRelocItems; i++) for (i = 0; i < header.exRelocItems; i++)
{ {
ULONG spot = ((ULONG) reloc[i].seg << 4) + reloc[i].off; ULONG spot = ((ULONG) reloc[i].seg << 4) + reloc[i].off;
UBYTE *spot0 = &buffers[spot / BUFSIZE][spot % BUFSIZE]; UBYTE *spot0 = &buffers[(size_t)(spot / BUFSIZE)][(size_t)(spot % BUFSIZE)];
UBYTE *spot1 = &buffers[(spot + 1) / BUFSIZE][(spot + 1) % BUFSIZE]; UBYTE *spot1 = &buffers[(size_t)((spot + 1) / BUFSIZE)][(size_t)((spot + 1) % BUFSIZE)];
UWORD segment = ((UWORD) * spot1 << 8) + *spot0; UWORD segment = ((UWORD) * spot1 << 8) + *spot0;
for (j = 0; j < silentcount; j++) for (j = 0; j < silentcount; j++)
@ -270,7 +270,7 @@ int main(int argc, char **argv)
to_xfer -= bufsize, curbuf++) to_xfer -= bufsize, curbuf++)
{ {
if (to_xfer < BUFSIZE) if (to_xfer < BUFSIZE)
bufsize = to_xfer; bufsize = (size_t)to_xfer;
if (fwrite(*curbuf, sizeof(char), bufsize, dest) != bufsize) if (fwrite(*curbuf, sizeof(char), bufsize, dest) != bufsize)
{ {

View File

@ -123,7 +123,7 @@ int main(int argc, char *argv[])
struct record { struct record {
unsigned char rectyp; unsigned char rectyp;
unsigned short datalen; unsigned short datalen;
unsigned char buffer[0x2000]; char buffer[0x2000];
} Record, Outrecord; } Record, Outrecord;
#include "algndflt.h" #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) void go_records(FILE * fdin, FILE * fdo)
{ {
unsigned char stringlen; unsigned char stringlen;
unsigned char *string, *s; char *string, *s;
int i, j; int i, j;
unsigned char chksum; unsigned char chksum;
@ -165,7 +165,7 @@ void go_records(FILE * fdin, FILE * fdo)
for (i = 0; i < Record.datalen - 1;) for (i = 0; i < Record.datalen - 1;)
{ {
stringlen = Record.buffer[i]; stringlen = (unsigned char)Record.buffer[i];
i++; i++;
string = &Record.buffer[i]; string = &Record.buffer[i];
@ -188,9 +188,9 @@ void go_records(FILE * fdin, FILE * fdo)
} }
chksum = 0; chksum = 0;
for (s = (unsigned char *)&Outrecord; for (s = (char *)&Outrecord;
s < &Outrecord.buffer[Outrecord.datalen]; s++) s < &Outrecord.buffer[Outrecord.datalen]; s++)
chksum += *s; chksum += (unsigned char)*s;
Outrecord.buffer[Outrecord.datalen] = ~chksum; Outrecord.buffer[Outrecord.datalen] = ~chksum;
Outrecord.datalen++; Outrecord.datalen++;