about summary refs log tree commit diff
path: root/libio
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-03-19 21:04:10 +0000
committerJakub Jelinek <jakub@redhat.com>2005-03-19 21:04:10 +0000
commit8f8ebbc438fcb4b22fba8beb3ef3d1aa59d9d7bf (patch)
treeb7091affa76bbaf47e78a59dfc72b2102554eaf9 /libio
parentf5c3480e830e94e0e51a0bdb1053944daed8bc58 (diff)
downloadglibc-8f8ebbc438fcb4b22fba8beb3ef3d1aa59d9d7bf.tar.gz
glibc-8f8ebbc438fcb4b22fba8beb3ef3d1aa59d9d7bf.tar.xz
glibc-8f8ebbc438fcb4b22fba8beb3ef3d1aa59d9d7bf.zip
Updated to fedora-glibc-20050319T1907 cvs/fedora-glibc-2_3_4-15
Diffstat (limited to 'libio')
-rw-r--r--libio/bits/stdio2.h56
-rw-r--r--libio/iofwide.c32
2 files changed, 54 insertions, 34 deletions
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index 6ab6841c53..a462c1d8cf 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -83,22 +83,40 @@ extern int __vprintf_chk (int __flag, __const char *__restrict __format,
 
 #endif
 
-extern char *__gets_chk (char *__str, size_t);
-#define gets(__str) \
-  ((__bos (__str) == (size_t) -1)					      \
-   ? gets (__str) : __gets_chk (__str, __bos (__str)))
-
-extern void __chk_fail (void) __attribute__((noreturn));
-#define fgets(__str, __n, __fp) \
-  (__extension__							      \
-    ({ size_t __n_val = (__n);				  		      \
-       if (__bos (__str) != (size_t) -1 && __bos (__str) < __n_val)	      \
-         __chk_fail ();							      \
-       fgets (__str, __n_val, __fp); }))
-
-#define fgets_unlocked(__str, __n, __fp) \
-  (__extension__							      \
-    ({ size_t __n_val = (__n);				  		      \
-       if (__bos (__str) != (size_t) -1 && __bos (__str) < __n_val)	      \
-         __chk_fail ();							      \
-       fgets_unlocked (__str, __n_val, __fp); }))
+extern char *__gets_chk (char *__str, size_t) __wur;
+extern char *__REDIRECT (__gets_alias, (char *__str), gets) __wur;
+
+extern __always_inline __wur char *
+gets (char *__str)
+{
+  if (__bos (__str) != (size_t) -1)
+    return __gets_chk (__str, __bos (__str));
+  return __gets_alias (__str);
+}
+
+extern void __chk_fail (void) __attribute__((__noreturn__));
+extern char *__REDIRECT (__fgets_alias,
+			 (char *__restrict __s, int __n,
+			  FILE *__restrict __stream), fgets) __wur;
+
+extern __always_inline __wur char *
+fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
+{
+  if (__bos (__s) != (size_t) -1 && (size_t) __n > __bos (__s))
+    __chk_fail ();
+  return __fgets_alias (__s, __n, __stream);
+}
+
+#ifdef __USE_GNU
+extern char *__REDIRECT (__fgets_unlocked_alias,
+			 (char *__restrict __s, int __n,
+			  FILE *__restrict __stream), fgets_unlocked) __wur;
+
+extern __always_inline __wur char *
+fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream)
+{
+  if (__bos (__s) != (size_t) -1 && (size_t) __n > __bos (__s))
+    __chk_fail ();
+  return __fgets_unlocked_alias (__s, __n, __stream);
+}
+#endif
diff --git a/libio/iofwide.c b/libio/iofwide.c
index 03124219ad..7af9a633f8 100644
--- a/libio/iofwide.c
+++ b/libio/iofwide.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -228,8 +228,8 @@ do_out (struct _IO_codecvt *codecvt, __mbstate_t *statep,
   size_t dummy;
   const unsigned char *from_start_copy = (unsigned char *) from_start;
 
-  codecvt->__cd_out.__cd.__data[0].__outbuf = to_start;
-  codecvt->__cd_out.__cd.__data[0].__outbufend = to_end;
+  codecvt->__cd_out.__cd.__data[0].__outbuf = (unsigned char *) to_start;
+  codecvt->__cd_out.__cd.__data[0].__outbufend = (unsigned char *) to_end;
   codecvt->__cd_out.__cd.__data[0].__statep = statep;
 
   status = DL_CALL_FCT (gs->__fct,
@@ -238,7 +238,7 @@ do_out (struct _IO_codecvt *codecvt, __mbstate_t *statep,
 			 &dummy, 0, 0));
 
   *from_stop = (wchar_t *) from_start_copy;
-  *to_stop = codecvt->__cd_out.__cd.__data[0].__outbuf;
+  *to_stop = (char *) codecvt->__cd_out.__cd.__data[0].__outbuf;
 
   switch (status)
     {
@@ -294,15 +294,15 @@ do_unshift (struct _IO_codecvt *codecvt, __mbstate_t *statep,
   int status;
   size_t dummy;
 
-  codecvt->__cd_out.__cd.__data[0].__outbuf = to_start;
-  codecvt->__cd_out.__cd.__data[0].__outbufend = to_end;
+  codecvt->__cd_out.__cd.__data[0].__outbuf = (unsigned char *) to_start;
+  codecvt->__cd_out.__cd.__data[0].__outbufend = (unsigned char *) to_end;
   codecvt->__cd_out.__cd.__data[0].__statep = statep;
 
   status = DL_CALL_FCT (gs->__fct,
 			(gs, codecvt->__cd_out.__cd.__data, NULL, NULL,
 			 NULL, &dummy, 1, 0));
 
-  *to_stop = codecvt->__cd_out.__cd.__data[0].__outbuf;
+  *to_stop = (char *) codecvt->__cd_out.__cd.__data[0].__outbuf;
 
   switch (status)
     {
@@ -357,15 +357,16 @@ do_in (struct _IO_codecvt *codecvt, __mbstate_t *statep,
   size_t dummy;
   const unsigned char *from_start_copy = (unsigned char *) from_start;
 
-  codecvt->__cd_in.__cd.__data[0].__outbuf = (char *) to_start;
-  codecvt->__cd_in.__cd.__data[0].__outbufend = (char *) to_end;
+  codecvt->__cd_in.__cd.__data[0].__outbuf = (unsigned char *) to_start;
+  codecvt->__cd_in.__cd.__data[0].__outbufend = (unsigned char *) to_end;
   codecvt->__cd_in.__cd.__data[0].__statep = statep;
 
   status = DL_CALL_FCT (gs->__fct,
 			(gs, codecvt->__cd_in.__cd.__data, &from_start_copy,
-			 from_end, NULL, &dummy, 0, 0));
+			 (const unsigned char *) from_end, NULL,
+			 &dummy, 0, 0));
 
-  *from_stop = from_start_copy;
+  *from_stop = (const char *) from_start_copy;
   *to_stop = (wchar_t *) codecvt->__cd_in.__cd.__data[0].__outbuf;
 
   switch (status)
@@ -454,13 +455,14 @@ do_length (struct _IO_codecvt *codecvt, __mbstate_t *statep,
   int status;
   size_t dummy;
 
-  codecvt->__cd_in.__cd.__data[0].__outbuf = (char *) to_buf;
-  codecvt->__cd_in.__cd.__data[0].__outbufend = (char *) &to_buf[max];
+  codecvt->__cd_in.__cd.__data[0].__outbuf = (unsigned char *) to_buf;
+  codecvt->__cd_in.__cd.__data[0].__outbufend = (unsigned char *) &to_buf[max];
   codecvt->__cd_in.__cd.__data[0].__statep = statep;
 
   status = DL_CALL_FCT (gs->__fct,
-			(gs, codecvt->__cd_in.__cd.__data, &cp, from_end,
-			 NULL, &dummy, 0, 0));
+			(gs, codecvt->__cd_in.__cd.__data, &cp,
+			 (const unsigned char *) from_end, NULL,
+			 &dummy, 0, 0));
 
   result = cp - (const unsigned char *) from_start;
 #else