diff -u ghostscript-8.61.dfsg.1~svn8187/debian/patches/00list ghostscript-8.61.dfsg.1~svn8187/debian/patches/00list
--- ghostscript-8.61.dfsg.1~svn8187/debian/patches/00list
+++ ghostscript-8.61.dfsg.1~svn8187/debian/patches/00list
@@ -14,0 +15 @@
+40_implicit_pointer_conversion_fix
diff -u ghostscript-8.61.dfsg.1~svn8187/debian/changelog ghostscript-8.61.dfsg.1~svn8187/debian/changelog
--- ghostscript-8.61.dfsg.1~svn8187/debian/changelog
+++ ghostscript-8.61.dfsg.1~svn8187/debian/changelog
@@ -1,3 +1,17 @@
+ghostscript (8.61.dfsg.1~svn8187-2.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix long-standing implicit pointer conversions by backporting a fix from
+    SVN revision 8232, as pointed by Dann Frazier (Closes: #422723):
+     - 40_implicit_pointer_conversion_fix.dpatch added for this purpose. It
+       also contains an additional tweak for src/gpmisc.c so that no attempt
+       to use fdopen64() is made, fdopen() is the way to go.
+     - DEB_AUTO_UPDATE_AUTOCONF set to “yes” in debian/rules so that the
+       configure script gets updated at build time (the needed build
+       dependencies are already there).
+
+ -- Cyril Brulebois <cyril.brulebois@enst-bretagne.fr>  Sat, 24 Nov 2007 04:41:48 +0100
+
 ghostscript (8.61.dfsg.1~svn8187-2) unstable; urgency=low
 
   * Maintainer upload, acknowledged NMU - closes: #447188
diff -u ghostscript-8.61.dfsg.1~svn8187/debian/rules ghostscript-8.61.dfsg.1~svn8187/debian/rules
--- ghostscript-8.61.dfsg.1~svn8187/debian/rules
+++ ghostscript-8.61.dfsg.1~svn8187/debian/rules
@@ -1,6 +1,8 @@
 #!/usr/bin/make -f
 # -*- makefile -*-
 
+DEB_AUTO_UPDATE_AUTOCONF=yes
+
 include /usr/share/cdbs/1/rules/debhelper.mk
 include /usr/share/cdbs/1/class/autotools.mk
 include /usr/share/cdbs/1/rules/dpatch.mk
only in patch2:
unchanged:
--- ghostscript-8.61.dfsg.1~svn8187.orig/debian/patches/40_implicit_pointer_conversion_fix.dpatch
+++ ghostscript-8.61.dfsg.1~svn8187/debian/patches/40_implicit_pointer_conversion_fix.dpatch
@@ -0,0 +1,134 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 40_implicit_pointer_conversion_fix.dpatch by Cyril Brulebois <cyril.brulebois@enst-bretagne.fr>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix implicit pointer conversion by requesting transitional interface
+## DP: to Large File Support. Fix backported from SVN r8232, thanks to
+## DP: Dann Frazier for the pointer.
+
+@DPATCH@
+--- ghostscript-8.61.dfsg.1~svn8187~/src/gp_unifs.c	(revision 8231)
++++ ghostscript-8.61.dfsg.1~svn8187/src/gp_unifs.c	(revision 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
+ }
+--- ghostscript-8.61.dfsg.1~svn8187~/src/Makefile.in	(revision 8231)
++++ ghostscript-8.61.dfsg.1~svn8187/src/Makefile.in	(revision 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.
+ 
+--- ghostscript-8.61.dfsg.1~svn8187~/src/configure.ac	(revision 8231)
++++ ghostscript-8.61.dfsg.1~svn8187/src/configure.ac	(revision 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
+--- ghostscript-8.61.dfsg.1~svn8187~/src/stdpre.h	(revision 8231)
++++ ghostscript-8.61.dfsg.1~svn8187/src/stdpre.h	(revision 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__.
+--- ghostscript-8.61.dfsg.1~svn8187~/src/gpmisc.c	2007-11-24 05:59:49.000000000 +0100
++++ ghostscript-8.61.dfsg.1~svn8187/src/gpmisc.c	2007-11-24 06:00:21.000000000 +0100
+@@ -93,7 +93,7 @@
+      * fdopen as (char *), rather than following the POSIX.1 standard,
+      * which defines it as (const char *).  Patch this here.
+      */
+-#if defined (O_LARGEFILE)
++#if 0 /* defined (O_LARGEFILE) */
+     file = (b64 ? fdopen64 : fdopen)(fildes, (char *)mode); /* still really const */
+ #else
+     file = fdopen(fildes, (char *)mode); /* still really const */
