[gs-cvs] rev 7070 - trunk/gs/src
giles at ghostscript.com
giles at ghostscript.com
Mon Sep 25 14:45:35 PDT 2006
Author: giles
Date: 2006-09-25 14:45:34 -0700 (Mon, 25 Sep 2006)
New Revision: 7070
Modified:
trunk/gs/src/Makefile.in
trunk/gs/src/configure.ac
trunk/gs/src/gp_unifs.c
Log:
Have the configure script check for fopen64 before using it.
Bug 688394.
DETAILS:
We use this as a shorthand to check for the marked *64() stdio
calls, and based on that define HAVE_FILE64, which is used in
the unix platform code to select whether to call the marked
or normal FILE code when _LARGEFILE64_SOURCE is not defined.
This is required on MacOS X which does not provide fopen64()
and friends (or O_LARGEFILE) but nevertheless implements
reasonable large file support with the normal routines on
32-bit architectures without defining _LARGEFILE*_SOURCE.
The result should be the same with the autoconf build on
architectures where the previous code worked, including
linux and cygwin. When building manually without passing
-DHAVE_FILE64, or on platforms that don't provide the
marked 64-bit versions, we will now fall back to the
vanilla functions, and so the bug may re-occur there. This
is better than failing to link on such platforms, which
was the previous behavior.
Modified: trunk/gs/src/Makefile.in
===================================================================
--- trunk/gs/src/Makefile.in 2006-09-24 23:50:46 UTC (rev 7069)
+++ trunk/gs/src/Makefile.in 2006-09-25 21:45:34 UTC (rev 7070)
@@ -109,8 +109,11 @@
# Enable this if it is available on your platform.
# -DHAVE_HYPOT
# use the system hypot() call
+#
+# -DHAVE_FILE64
+# use marked versions of the stdio FILE calls, fopen64() et al.
-CAPOPT= @HAVE_MKSTEMP@ @HAVE_HYPOT@
+CAPOPT= @HAVE_MKSTEMP@ @HAVE_HYPOT@ @HAVE_FILE64@
# Define the name of the executable file.
Modified: trunk/gs/src/configure.ac
===================================================================
--- trunk/gs/src/configure.ac 2006-09-24 23:50:46 UTC (rev 7069)
+++ trunk/gs/src/configure.ac 2006-09-25 21:45:34 UTC (rev 7070)
@@ -415,6 +415,9 @@
AC_CHECK_FUNCS([hypot], [HAVE_HYPOT=-DHAVE_HYPOT])
AC_SUBST(HAVE_HYPOT)
+AC_CHECK_FUNCS([fopen64], [HAVE_FILE64])
+AC_SUBST(HAVE_FILE64)
+
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
Modified: trunk/gs/src/gp_unifs.c
===================================================================
--- trunk/gs/src/gp_unifs.c 2006-09-24 23:50:46 UTC (rev 7069)
+++ trunk/gs/src/gp_unifs.c 2006-09-25 21:45:34 UTC (rev 7070)
@@ -88,15 +88,14 @@
/* save the old filename template in case mkstemp fails */
memcpy(ofname, fname, gp_file_name_sizeof);
-
-#ifndef _LARGEFILE64_SOURCE
+#if defined(HAVE_FILE64) && !defined(_LARGEFILE64_SOURCE)
if (b64)
file = mkstemp64(fname);
else
#endif
file = mkstemp(fname);
- /* Fixme : what top do with b64 ? Unimplemented. */
+ /* Fixme : what to do with b64 and 32-bit mkstemp? Unimplemented. */
if (file < -1) {
eprintf1("**** Could not open temporary file %s\n", ofname);
return NULL;
@@ -480,7 +479,7 @@
FILE *gp_fopen_64(const char *filename, const char *mode)
{
-#ifdef _LARGEFILE64_SOURCE
+#if defined(_LARGEFILE64_SOURCE) || !defined(HAVE_FILE64)
return fopen(filename, mode);
#else
return fopen64(filename, mode);
@@ -498,7 +497,7 @@
int64_t gp_ftell_64(FILE *strm)
{
-#ifdef _LARGEFILE64_SOURCE
+#if defined(_LARGEFILE64_SOURCE) || !defined(HAVE_FILE64)
return ftello(strm);
#else
return ftello64(strm);
@@ -507,8 +506,8 @@
int gp_fseek_64(FILE *strm, int64_t offset, int origin)
{
-#ifdef _LARGEFILE64_SOURCE
- long offset1 = (long)offset;
+#if defined(_LARGEFILE64_SOURCE) || !defined(HAVE_FILE64)
+ off_t offset1 = (off_t)offset;
if (offset != offset1)
return -1;
More information about the gs-cvs
mailing list