From: Martin Str|mberg Message-Id: <200106090935.LAA26549@mother.ludd.luth.se> Subject: Re: Compiler options for djdev build To: djgpp-workers AT delorie DOT com Date: Sat, 9 Jun 2001 11:35:57 +0200 (MEST) In-Reply-To: <7263-Sat09Jun2001094842+0300-eliz@is.elta.co.il> from "Eli Zaretskii" at Jun 09, 2001 09:48:42 AM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Now I've read about the -W flags. I'm not going to test with -Wconversion which seems like a very backwards warning. Prototypes are good. Use prototypes. Don't complain when prototypes are used. Some more changes (some might already have been reported in my earlier mail; again hand pasted so might not apply cleanly): Index: include/stdio.h =================================================================== RCS file: /cvs/djgpp/djgpp/include/stdio.h,v retrieving revision 1.4 diff -p -u -r1.4 stdio.h --- include/stdio.h 2001/05/22 21:24:42 1.4 +++ include/stdio.h 2001/06/09 09:20:51 @@ -51,11 +51,11 @@ typedef struct { int _cnt; char *_ptr; char *_base; - int _bufsiz; + size_t _bufsiz; int _flag; int _file; char *_name_to_remove; - int _fillsize; + size_t _fillsize; } FILE; typedef unsigned long fpos_t; Index: src/libc/ansi/stdio/doprnt.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/doprnt.c,v retrieving revision 1.8 diff -p -u -r1.8 doprnt.c --- src/libc/ansi/stdio/doprnt.c 1999/07/04 14:18:04 1.8 +++ src/libc/ansi/stdio/doprnt.c 2001/06/09 09:20:55 @@ -327,7 +327,7 @@ _doprnt(const char *fmt0, va_list argp, */ char *p /*, *memchr() */; - if ((p = memchr(t, 0, prec))) + if ((p = memchr(t, 0, (size_t)prec))) { size = p - t; if (size > prec) Index: src/libc/ansi/stdio/doscan.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/doscan.c,v retrieving revision 1.9 diff -p -u -r1.9 doscan.c --- src/libc/ansi/stdio/doscan.c 1999/08/03 08:49:23 1.9 +++ src/libc/ansi/stdio/doscan.c 2001/06/09 09:20:56 @@ -366,7 +366,8 @@ _instr(char *ptr, int type, int len, FIL static const char * _getccl(const unsigned char *s) { - register int c, t; + register int t; + size_t c; t = 0; if (*s == '^') { Index: src/libc/ansi/stdio/fflush.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/fflush.c,v retrieving revision 1.8 diff -p -u -r1.8 fflush.c --- src/libc/ansi/stdio/fflush.c 2001/06/06 21:11:48 1.8 +++ src/libc/ansi/stdio/fflush.c 2001/06/09 09:20:56 @@ -17,7 +17,8 @@ int fflush(FILE *f) { char *base; - int n, rn; + int n; + size_t rn; if (f == NULL) { @@ -35,7 +36,7 @@ fflush(FILE *f) { int save_errno = errno; /* We don't want llseek()'s setting errno to remain. */ - if( llseek(fileno(f), 0, SEEK_END) == -1 ) + if( llseek(fileno(f), 0LL, SEEK_END) == -1 ) { errno = save_errno; return -1; @@ -45,8 +46,9 @@ fflush(FILE *f) f->_flag &= ~_IOUNGETC; if ((f->_flag&(_IONBF|_IOWRT))==_IOWRT && (base = f->_base) != NULL - && (rn = n = f->_ptr - base) > 0) + && (n = f->_ptr - base) > 0) { + rn = n; f->_ptr = base; f->_cnt = (f->_flag&(_IOLBF|_IONBF)) ? 0 : f->_bufsiz; do { Index: src/libc/ansi/stdio/filbuf.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/filbuf.c,v retrieving revision 1.5 diff -p -u -r1.5 filbuf.c --- src/libc/ansi/stdio/filbuf.c 1999/06/03 17:27:33 1.5 +++ src/libc/ansi/stdio/filbuf.c 2001/06/09 09:20:57 @@ -27,7 +27,8 @@ int _filbuf(FILE *f) { - int size, fillsize; + int fillsize; + size_t size; char c; if (f->_flag & _IORW) @@ -91,7 +92,7 @@ _filbuf(FILE *f) if(__is_text_file(f) && f->_cnt>0) { /* truncate text file at Ctrl-Z */ - char *cz=memchr(f->_base, 0x1A, f->_cnt); + char *cz=memchr(f->_base, 0x1A, (size_t)f->_cnt); if(cz) { int newcnt = cz - f->_base; Index: src/libc/ansi/stdio/flsbuf.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/flsbuf.c,v retrieving revision 1.8 diff -p -u -r1.8 flsbuf.c --- src/libc/ansi/stdio/flsbuf.c 2001/06/06 21:12:12 1.8 +++ src/libc/ansi/stdio/flsbuf.c 2001/06/09 09:20:57 @@ -19,7 +19,7 @@ _flsbuf(int c, FILE *f) char *base; int n, rn; char c1; - int size; + size_t size; if (f->_flag & _IORW) { Index: src/libc/ansi/stdio/fopen.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/fopen.c,v retrieving revision 1.3 diff -p -u -r1.3 fopen.c --- src/libc/ansi/stdio/fopen.c 2001/06/06 04:26:11 1.3 +++ src/libc/ansi/stdio/fopen.c 2001/06/09 09:20:57 @@ -68,7 +68,7 @@ fopen(const char *file, const char *mode if (*mode == 'a') { - llseek(fd, 0, SEEK_END); + llseek(fd, 0LL, SEEK_END); } f->_base = f->_ptr = NULL; Index: src/libc/ansi/stdio/fread.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/fread.c,v retrieving revision 1.5 diff -p -u -r1.5 fread.c --- src/libc/ansi/stdio/fread.c 1999/06/03 17:27:33 1.5 +++ src/libc/ansi/stdio/fread.c 2001/06/09 09:20:57 @@ -43,7 +43,7 @@ fread(void *vptr, size_t size, size_t co while (s > 0) { if (iop->_cnt < s) { if (iop->_cnt > 0) { - memcpy(ptr, iop->_ptr, iop->_cnt); + memcpy(ptr, iop->_ptr, (size_t)iop->_cnt); ptr += iop->_cnt; s -= iop->_cnt; } @@ -57,7 +57,7 @@ fread(void *vptr, size_t size, size_t co s--; } if (iop->_cnt >= s) { - memcpy(ptr, iop->_ptr, s); + memcpy(ptr, iop->_ptr, (size_t)s); iop->_ptr += s; iop->_cnt -= s; return count; Index: src/libc/ansi/stdio/freopen.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/freopen.c,v retrieving revision 1.5 diff -p -u -r1.5 freopen.c --- src/libc/ansi/stdio/freopen.c 2001/06/06 04:26:35 1.5 +++ src/libc/ansi/stdio/freopen.c 2001/06/09 09:20:57 @@ -62,7 +62,7 @@ freopen(const char *file, const char *mo if (*mode == 'a') { - llseek(fd, 0, SEEK_END); + llseek(fd, 0LL, SEEK_END); } f->_base = f->_ptr = NULL; Index: src/libc/ansi/stdio/fwrite.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/fwrite.c,v retrieving revision 1.5 diff -p -u -r1.5 fwrite.c --- src/libc/ansi/stdio/fwrite.c 2000/06/28 08:20:55 1.5 +++ src/libc/ansi/stdio/fwrite.c 2001/06/09 09:20:57 @@ -12,7 +12,7 @@ size_t fwrite(const void *vptr, size_t size, size_t count, FILE *f) { const char *ptr = (const char *)vptr; - register int s; + size_t s; if (__libc_write_termios_hook && (f->_flag & (_IOTERM | _IONTERM)) == 0)