changeset 8719:0d671904d407

Verify that off_t is the same size as long when we assume it.
author Bruno Haible <bruno@clisp.org>
date Thu, 26 Apr 2007 09:42:29 +0000
parents c541fe12ef9e
children 367787d55c9c
files ChangeLog lib/stdio_.h
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-04-26  Bruno Haible  <bruno@clisp.org>
+
+	* lib/stdio_.h (fseeko, ftello): Check that off_t has the same size as
+	'long' when we assume it.
+	Suggested by Eric Blake.
+
 2007-04-26  Bruno Haible  <bruno@clisp.org>
 
 	Ensure fseeko, ftello are declared on glibc systems.
--- a/lib/stdio_.h
+++ b/lib/stdio_.h
@@ -38,7 +38,7 @@
 #include <stdarg.h>
 #include <stddef.h>
 
-#if @GNULIB_FFLUSH@ && @REPLACE_FFLUSH@
+#if (@GNULIB_FFLUSH@ && @REPLACE_FFLUSH@) || (@GNULIB_FSEEKO@ && !@HAVE_FSEEKO@) || (@GNULIB_FTELLO@ && !@HAVE_FTELLO@)
 /* Get off_t.  */
 # include <sys/types.h>
 #endif
@@ -220,6 +220,7 @@
 #elif @GNULIB_FSEEKO@
 # if !@HAVE_FSEEKO@
 /* Assume 'off_t' is the same type as 'long'.  */
+typedef int verify_fseeko_types[2 * (sizeof (off_t) == sizeof (long)) - 1];
 #  define fseeko fseek
 # endif
 #else
@@ -233,6 +234,7 @@
 #if @GNULIB_FTELLO@
 # if !@HAVE_FTELLO@
 /* Assume 'off_t' is the same type as 'long'.  */
+typedef int verify_ftello_types[2 * (sizeof (off_t) == sizeof (long)) - 1];
 #  define ftello ftell
 # endif
 #else