[gs-cvs] rev 8232 - trunk/gs/src
alexcher at ghostscript.com
alexcher at ghostscript.com
Sat Sep 8 15:31:20 PDT 2007
Author: alexcher
Date: 2007-09-08 15:31:20 -0700 (Sat, 08 Sep 2007)
New Revision: 8232
Modified:
trunk/gs/src/Makefile.in
trunk/gs/src/configure.ac
trunk/gs/src/gp_unifs.c
trunk/gs/src/stdpre.h
Log:
Declare Ghostscript as _LARGEFILE64_SOURCE program, i.e. request transitional
interface to large file support. Check for mkstemp64() availability specially.
Modified: trunk/gs/src/Makefile.in
===================================================================
--- trunk/gs/src/Makefile.in 2007-09-08 21:59:54 UTC (rev 8231)
+++ trunk/gs/src/Makefile.in 2007-09-08 22:31:20 UTC (rev 8232)
@@ -120,8 +120,11 @@
#
# -DHAVE_FILE64
# use marked versions of the stdio FILE calls, fopen64() et al.
+#
+# -DHAVE_MKSTEMP64
+# use non-standard function mkstemp64()
-CAPOPT= @HAVE_MKSTEMP@ @HAVE_HYPOT@ @HAVE_FILE64@ @HAVE_FONTCONFIG@
+CAPOPT= @HAVE_MKSTEMP@ @HAVE_HYPOT@ @HAVE_FILE64@ @HAVE_MKSTEMP64@ @HAVE_FONTCONFIG@
# Define the name of the executable file.
Modified: trunk/gs/src/configure.ac
===================================================================
--- trunk/gs/src/configure.ac 2007-09-08 21:59:54 UTC (rev 8231)
+++ trunk/gs/src/configure.ac 2007-09-08 22:31:20 UTC (rev 8232)
@@ -924,6 +924,9 @@
AC_CHECK_FUNCS([fopen64], [HAVE_FILE64=-DHAVE_FILE64])
AC_SUBST(HAVE_FILE64)
+AC_CHECK_FUNCS([mkstemp64], [HAVE_MKSTEMP64=-DHAVE_MKSTEMP64])
+AC_SUBST(HAVE_MKSTEMP64)
+
AC_PROG_GCC_TRADITIONAL
dnl NB: We don't actually provide autoconf-switched fallbacks for any
Modified: trunk/gs/src/gp_unifs.c
===================================================================
--- trunk/gs/src/gp_unifs.c 2007-09-08 21:59:54 UTC (rev 8231)
+++ trunk/gs/src/gp_unifs.c 2007-09-08 22:31:20 UTC (rev 8232)
@@ -88,18 +88,22 @@
/* save the old filename template in case mkstemp fails */
memcpy(ofname, fname, gp_file_name_sizeof);
-#if defined(HAVE_FILE64) && !defined(_LARGEFILE64_SOURCE)
- if (b64)
- file = mkstemp64(fname);
- else
+#ifdef HAVE_MKSTEMP64
+ file = (b64 ? mkstemp64 : mkstemp)(fname);
+#else
+ file = mkstemp(fname);
#endif
- file = mkstemp(fname);
-
- /* 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;
}
+#if defined(O_LARGEFILE) && defined(__hpux)
+ if (b64)
+ fcntl(file, F_SETFD, fcntl(file, F_GETFD) | O_LARGEFILE);
+#else
+ /* Fixme : what to do with b64 and 32-bit mkstemp? Unimplemented. */
+#endif
+
fp = fdopen(file, mode);
if (fp == NULL)
close(file);
@@ -479,10 +483,10 @@
FILE *gp_fopen_64(const char *filename, const char *mode)
{
-#if defined(_LARGEFILE64_SOURCE) || !defined(HAVE_FILE64)
+#if defined(HAVE_FILE64)
+ return fopen64(filename, mode);
+#else
return fopen(filename, mode);
-#else
- return fopen64(filename, mode);
#endif
}
@@ -497,22 +501,22 @@
int64_t gp_ftell_64(FILE *strm)
{
-#if defined(_LARGEFILE64_SOURCE) || !defined(HAVE_FILE64)
+#if defined(HAVE_FILE64)
+ return ftello64(strm);
+#else
return ftello(strm);
-#else
- return ftello64(strm);
#endif
}
int gp_fseek_64(FILE *strm, int64_t offset, int origin)
{
-#if defined(_LARGEFILE64_SOURCE) || !defined(HAVE_FILE64)
+#if defined(HAVE_FILE64)
+ return fseeko64(strm, offset, origin);
+#else
off_t offset1 = (off_t)offset;
if (offset != offset1)
return -1;
return fseeko(strm, offset1, origin);
-#else
- return fseeko64(strm, offset, origin);
#endif
}
Modified: trunk/gs/src/stdpre.h
===================================================================
--- trunk/gs/src/stdpre.h 2007-09-08 21:59:54 UTC (rev 8231)
+++ trunk/gs/src/stdpre.h 2007-09-08 22:31:20 UTC (rev 8232)
@@ -17,6 +17,9 @@
#ifndef stdpre_INCLUDED
# define stdpre_INCLUDED
+/* Ghostscript uses transitional LFS functions. */
+#define _LARGEFILE64_SOURCE 1
+
/*
* Here we deal with the vagaries of various C compilers. We assume that:
* ANSI-standard Unix compilers define __STDC__.
More information about the gs-cvs
mailing list