From: Martin Str|mberg Message-Id: <200106192111.XAA18883@father.ludd.luth.se> Subject: More signed/unsigned issues To: djgpp-workers AT delorie DOT com (DJGPP-WORKERS) Date: Tue, 19 Jun 2001 23:11:45 +0200 (MET DST) X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Some more corrections. This is the mail I referred to in my other mail. Note the less than pretty cast with long signed int. (Hand pasted so won't probably apply cleanly.) Right, MartinS Index: src/libc/ansi/stdio/fwrite.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/fwrite.c,v retrieving revision 1.6 diff -p -u -r1.6 fwrite.c --- src/libc/ansi/stdio/fwrite.c 2001/06/09 10:57:08 1.6 +++ src/libc/ansi/stdio/fwrite.c 2001/06/19 21:06:34 @@ -12,7 +12,7 @@ size_t fwrite(const void *vptr, size_t size, size_t count, FILE *f) { const char *ptr = (const char *)vptr; - size_t s; + ssize_t s; if (__libc_write_termios_hook && (f->_flag & (_IOTERM | _IONTERM)) == 0) @@ -29,7 +29,7 @@ fwrite(const void *vptr, size_t size, si { if (f->_flag & _IOLBF) while (s > 0) { - if (--f->_cnt > -f->_bufsiz && *(const char *)ptr != '\n') + if (--f->_cnt > -(long signed int)f->_bufsiz && *(const char *)ptr != 'n') *f->_ptr++ = *(const char *)ptr++; else if (_flsbuf(*(const char *)ptr++, f) == EOF) break; @@ -62,13 +62,13 @@ fwrite(const void *vptr, size_t size, si while (s > 0) { if (*ptr=='\n') { - if (--f->_cnt > -f->_bufsiz) + if (--f->_cnt > -(long signed int)f->_bufsiz) *f->_ptr++ = '\r'; else if (_flsbuf('\r', f) == EOF) break; } - if (--f->_cnt > -f->_bufsiz && *ptr != '\n') + if (--f->_cnt > -(long signed int)f->_bufsiz && *ptr != '\n') *f->_ptr++ = *ptr++; else if (_flsbuf(*(const unsigned char *)ptr++, f) == EOF) break; Index: src/libc/compat/ioctl/ioctl.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/compat/ioctl/ioctl.c,v retrieving revision 1.2 diff -p -u -r1.2 ioctl.c --- src/libc/compat/ioctl/ioctl.c 1998/06/28 17:25:20 1.2 +++ src/libc/compat/ioctl/ioctl.c 2001/06/19 21:06:40 @@ -157,7 +157,7 @@ static int _dos_ioctl(int fd, int cmd, i ** I _do_ like clear APIs. */ if(cmd & DOS_XFER){ - if(argcx <= __tb_size){ /* Can we use transfer buffer ? */ + if(argcx <= (int)__tb_size){ /* Can we use transfer buffer ? */ dosmemput((void *)argdx,argcx, __tb); r.x.ds = (__tb>>4) &0xffff; r.x.dx = __tb &0xf; @@ -183,7 +183,7 @@ static int _dos_ioctl(int fd, int cmd, i ** parameter after all the registers and the buffer pointer. */ if( cmd & DOS_BRAINDEAD ){ - if(xarg <= __tb_size){ /* Can we use transfer buffer ? */ + if(xarg <= (int)__tb_size){ /* Can we use transfer buffer ? */ dosmemput((void *)argdx,xarg, __tb); r.x.ds = (__tb>>4) &0xffff; r.x.dx = __tb &0xf;