summary refs log tree commit diff
path: root/stdio
diff options
context:
space:
mode:
Diffstat (limited to 'stdio')
-rw-r--r--stdio/fgets.c4
-rw-r--r--stdio/glue.c7
-rw-r--r--stdio/internals.c4
-rw-r--r--stdio/linewrap.c2
-rw-r--r--stdio/memstream.c2
-rw-r--r--stdio/obstream.c18
-rw-r--r--stdio/stdio.h28
-rw-r--r--stdio/vasprintf.c4
8 files changed, 33 insertions, 36 deletions
diff --git a/stdio/fgets.c b/stdio/fgets.c
index 03246fb30c..3d6833d089 100644
--- a/stdio/fgets.c
+++ b/stdio/fgets.c
@@ -30,7 +30,7 @@ char *
 fgets (s, n, stream)
      char *s;
      int n;
-     register FILE *stream;
+     FILE *stream;
 {
   register char *p = s;
 
@@ -98,7 +98,7 @@ fgets (s, n, stream)
 	  i = stream->__get_limit - stream->__bufp;
 	}
 
-      if (i > n)
+      if (i > (size_t) n)
 	i = n;
 
       found = (char *) __memccpy ((void *) p, stream->__bufp, '\n', i);
diff --git a/stdio/glue.c b/stdio/glue.c
index d3618aef93..b184524c82 100644
--- a/stdio/glue.c
+++ b/stdio/glue.c
@@ -73,8 +73,7 @@ unix_FILE _iob[] =
    In a Unix stdio FILE `_cnt' is the first element.
    In a GNU stdio or glued FILE, the first element is the magic number.  */
 int
-_filbuf (file)
-     unix_FILE *file;
+_filbuf (unix_FILE *file)
 {
   switch (++file->glue.magic)	/* Compensate for Unix getc's decrement.  */
     {
@@ -95,9 +94,7 @@ _filbuf (file)
 
 /* Called by the Unix stdio `putc' macro.  Much like getc, above.  */
 int
-_flsbuf (c, file)
-     int c;
-     unix_FILE *file;
+_flsbuf (int c, unix_FILE *file)
 {
   /* Compensate for putc's decrement.  */
   switch (++file->glue.magic)
diff --git a/stdio/internals.c b/stdio/internals.c
index 290e3fdf87..96151c1f67 100644
--- a/stdio/internals.c
+++ b/stdio/internals.c
@@ -238,7 +238,7 @@ flushbuf (register FILE *fp, int c)
 	      else
 		__clearerr (fp);
 
-	      if (fp->__get_limit - fp->__buffer < o)
+	      if ((size_t) (fp->__get_limit - fp->__buffer) < o)
 		/* Oops.  We didn't read enough (probably because we got EOF).
 		   Forget we even mentioned it.  */
 		fp->__target += o;
@@ -280,7 +280,7 @@ flushbuf (register FILE *fp, int c)
 	    }
 	}
 
-      if (fp->__bufp - fp->__buffer <= buffer_offset && flush_only)
+      if ((size_t) (fp->__bufp - fp->__buffer) <= buffer_offset && flush_only)
 	{
 	  /* There is nothing new in the buffer, only data that
 	     was read back aligned from the file.  */
diff --git a/stdio/linewrap.c b/stdio/linewrap.c
index a5822c4845..d91f3a4bc2 100644
--- a/stdio/linewrap.c
+++ b/stdio/linewrap.c
@@ -169,7 +169,7 @@ lwupdate (FILE *stream, int c, struct line_wrap_data **wrapper_cookie)
 	       the end of the buffer.  */
 	    nl = stream->__bufp;
 	}
-      else if (d->point_col + (nl - buf) < d->rmargin)
+      else if ((size_t) d->point_col + (nl - buf) < d->rmargin)
 	{
 	  /* The buffer contains a full line that fits within the maximum
 	     line width.  Reset point and scan the next line.  */
diff --git a/stdio/memstream.c b/stdio/memstream.c
index cfac39f24d..fe2ce0a572 100644
--- a/stdio/memstream.c
+++ b/stdio/memstream.c
@@ -39,7 +39,7 @@ enlarge_buffer (register FILE *stream, int c)
     *info->bufsize = stream->__bufp - stream->__buffer;
 
   if (stream->__target != -1
-      && stream->__target > *info->bufsize)
+      && (size_t) stream->__target > *info->bufsize)
     /* Our target (where the buffer maps to) is always zero except when
        the user just did a SEEK_END fseek.  If he sought within the
        buffer, we need do nothing and will zero the target below.  If he
diff --git a/stdio/obstream.c b/stdio/obstream.c
index f9384bd597..f61e80909b 100644
--- a/stdio/obstream.c
+++ b/stdio/obstream.c
@@ -24,9 +24,7 @@
 /* Output-room function for obstack streams.  */
 
 static void
-grow (stream, c)
-     FILE *stream;
-     int c;
+grow (FILE *stream, int c)
 {
   struct obstack *const obstack = (struct obstack *) stream->__cookie;
 
@@ -34,7 +32,7 @@ grow (stream, c)
      of the buffer which the user has already written into.  */
   obstack_blank_fast (obstack, - (stream->__put_limit - stream->__bufp));
 
-  if (stream->__target > obstack_object_size (obstack))
+  if ((size_t) stream->__target > obstack_object_size (obstack))
     {
       /* Our target (where the buffer maps to) is always zero except when
 	 the user just did a SEEK_END fseek.  If he sought within the
@@ -83,10 +81,7 @@ grow (stream, c)
    There is no external state to munge.  */
 
 static int
-seek (cookie, pos, whence)
-     void *cookie;
-     fpos_t *pos;
-     int whence;
+seek (void *cookie, fpos_t *pos, int whence)
 {
   switch (whence)
     {
@@ -110,8 +105,7 @@ seek (cookie, pos, whence)
    Only what has been written to the stream can be read back.  */
 
 static int
-input (stream)
-     FILE *stream;
+input (FILE *stream)
 {
   /* Re-sync with the obstack, growing the object if necessary.  */
   grow (stream, EOF);
@@ -126,9 +120,7 @@ input (stream)
 /* Initialize STREAM to talk to OBSTACK.  */
 
 static void
-init_obstream (stream, obstack)
-      FILE *stream;
-      struct obstack *obstack;
+init_obstream (FILE *stream, struct obstack *obstack)
 {
   stream->__mode.__write = 1;
   stream->__mode.__read = 1;
diff --git a/stdio/stdio.h b/stdio/stdio.h
index c443ecd795..80132879de 100644
--- a/stdio/stdio.h
+++ b/stdio/stdio.h
@@ -423,28 +423,38 @@ vprintf (const char *__restrict __fmt, __gnuc_va_list __arg)
 }
 #endif /* Optimizing.  */
 
-#ifdef	__USE_GNU
+#if defined __USE_BSD || defined __USE_ISOC9X
 /* Maximum chars of output to write in MAXLEN.  */
 extern int __snprintf __P ((char *__s, size_t __maxlen,
-			    __const char *__format, ...));
+			    __const char *__format, ...))
+     __attribute__ ((__format__ (__printf__, 3, 4)));
 extern int snprintf __P ((char *__s, size_t __maxlen,
-			  __const char *__format, ...));
+			  __const char *__format, ...))
+     __attribute__ ((__format__ (__printf__, 3, 4)));
 
 extern int __vsnprintf __P ((char *__s, size_t __maxlen,
-			     __const char *__format, __gnuc_va_list __arg));
+			     __const char *__format, __gnuc_va_list __arg))
+     __attribute__ ((__format__ (__printf__, 3, 0)));
 extern int vsnprintf __P ((char *__s, size_t __maxlen,
-			   __const char *__format, __gnuc_va_list __arg));
+			   __const char *__format, __gnuc_va_list __arg))
+     __attribute__ ((__format__ (__printf__, 3, 0)));
+#endif
 
+#ifdef __USE_GNU
 /* Write formatted output to a string dynamically allocated with `malloc'.
    Store the address of the string in *PTR.  */
 extern int vasprintf __P ((char **__ptr, __const char *__f,
-			   __gnuc_va_list __arg));
-extern int asprintf __P ((char **__ptr, __const char *__fmt, ...));
+			   __gnuc_va_list __arg))
+     __attribute__ ((__format__ (__printf__, 2, 0)));
+extern int asprintf __P ((char **__ptr, __const char *__fmt, ...))
+     __attribute__ ((__format__ (__printf__, 2, 0)));
 
 /* Write formatted output to a file descriptor.  */
 extern int vdprintf __P ((int __fd, __const char *__fmt,
-			  __gnuc_va_list __arg));
-extern int dprintf __P ((int __fd, __const char *__fmt, ...));
+			  __gnuc_va_list __arg))
+     __attribute__ ((__format__ (__printf__, 2, 0)));
+extern int dprintf __P ((int __fd, __const char *__fmt, ...))
+     __attribute__ ((__format__ (__printf__, 2, 0)));
 #endif
 
 
diff --git a/stdio/vasprintf.c b/stdio/vasprintf.c
index 47a074e6ca..ffcf3eb972 100644
--- a/stdio/vasprintf.c
+++ b/stdio/vasprintf.c
@@ -26,9 +26,7 @@
 
 /* Enlarge STREAM's buffer.  */
 static void
-enlarge_buffer (stream, c)
-     FILE *stream;
-     int c;
+enlarge_buffer (FILE *stream, int c)
 {
   ptrdiff_t bufp_offset = stream->__bufp - stream->__buffer;
   char *newbuf;