dvipng 1.1 in teTeX 2.96.4

Harald Koenig <[email protected]>
Newsgroups gmane.emacs.latex.preview.devel,gmane.comp.tex.tetex.beta,gmane.emacs.latex.preview.bugs
Message-ID <[email protected]>
Hi again, 

that's hopefully the last report to dvipng, summing up my earlier mails
to teTeX-pretest.  below you find a patch for the following problems:


1)
OSF1 v4.0 and SunOS 5.5.1 don't have neither stdint.h nor inttypes.h.

I've added tests in configure for stdint.h and inttypes.h
and some fallback code if neither file is available.


2)
OSF1 v4.0 doesn't really have snprintf() (it's hidden in libdb.a), 
SunOS 5.5.1 doesn't have snprintf() at all.

snprintf is _only_ used in special.c for format strings "-r%dx%d" and "-g%dx%d".
those strings never can exceed STRSIZE (256), so I have changed those calls 
back to sprintf() for portability reasons. 


-------------------------------------------------------------------------------
diff -u orig/tetex-src-beta-2.96.4.20040627/texk/dvipng/config.h.in tetex-src-beta-2.96.4.20040627/texk/dvipng/config.h.in
--- orig/tetex-src-beta-2.96.4.20040627/texk/dvipng/config.h.in	Mon May 10 20:43:52 2004
+++ tetex-src-beta-2.96.4.20040627/texk/dvipng/config.h.in	Mon Jun 28 15:16:46 2004
@@ -88,6 +88,12 @@
 /* Define if you have the <fcntl.h> header file.  */
 #undef HAVE_FCNTL_H
 
+/* Define if you have the <stdint.h> header file.  */
+#undef HAVE_STDINT_H
+
+/* Define if you have the <inttypes.h> header file.  */
+#undef HAVE_INTTYPES_H
+
 /* Define if you have the <gd.h> header file.  */
 #undef HAVE_GD_H
 
diff -u orig/tetex-src-beta-2.96.4.20040627/texk/dvipng/configure tetex-src-beta-2.96.4.20040627/texk/dvipng/configure
--- orig/tetex-src-beta-2.96.4.20040627/texk/dvipng/configure	Sun Jun 27 14:19:42 2004
+++ tetex-src-beta-2.96.4.20040627/texk/dvipng/configure	Mon Jun 28 15:09:49 2004
@@ -1163,7 +1163,7 @@
 fi
 echo "$ac_t""$CPP" 1>&6
 
-for ac_hdr in fcntl.h sys/time.h
+for ac_hdr in fcntl.h sys/time.h stdint.h inttypes.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
diff -u orig/tetex-src-beta-2.96.4.20040627/texk/dvipng/configure.in tetex-src-beta-2.96.4.20040627/texk/dvipng/configure.in
--- orig/tetex-src-beta-2.96.4.20040627/texk/dvipng/configure.in	Sun Jun  6 10:07:01 2004
+++ tetex-src-beta-2.96.4.20040627/texk/dvipng/configure.in	Mon Jun 28 15:10:12 2004
@@ -36,7 +36,7 @@
   PSFONTS_O="$PSFONTS_O enc.o fontmap.o tfm.o"
 fi
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS([fcntl.h sys/time.h])
+AC_CHECK_HEADERS([fcntl.h sys/time.h stdint.h inttypes.h])
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
diff -u orig/tetex-src-beta-2.96.4.20040627/texk/dvipng/dvipng.h tetex-src-beta-2.96.4.20040627/texk/dvipng/dvipng.h
--- orig/tetex-src-beta-2.96.4.20040627/texk/dvipng/dvipng.h	Mon May 24 08:11:00 2004
+++ tetex-src-beta-2.96.4.20040627/texk/dvipng/dvipng.h	Mon Jun 28 15:19:39 2004
@@ -16,7 +16,16 @@
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
 #else
+#ifdef HAVE_INTTYPES_H
 #include <inttypes.h>
+#else
+  typedef signed char               int8_t;
+  typedef unsigned char            uint8_t;
+  typedef short                    int16_t;
+  typedef unsigned short          uint16_t;
+  typedef int                      int32_t;
+  typedef unsigned int            uint32_t;
+#endif
 #endif
 
 /* For some reason FreeBSD does not follow the C standard */
diff -u orig/tetex-src-beta-2.96.4.20040627/texk/dvipng/special.c tetex-src-beta-2.96.4.20040627/texk/dvipng/special.c
--- orig/tetex-src-beta-2.96.4.20040627/texk/dvipng/special.c	Wed May 26 13:04:00 2004
+++ tetex-src-beta-2.96.4.20040627/texk/dvipng/special.c	Mon Jun 28 14:59:47 2004
@@ -17,8 +17,8 @@
   gdImagePtr psimage=NULL;
   static bool showpage;
 
-  status=snprintf(resolution, STRSIZE, "-r%dx%d",hresolution,vresolution);
-  status=snprintf(devicesize, STRSIZE, "-g%dx%d",
+  status=sprintf(resolution, "-r%dx%d",hresolution,vresolution);
+  status=sprintf(devicesize, "-g%dx%d",
 		  //(int)((sin(atan(1.0))+1)*
 		  (urx - llx)*hresolution/72,//), 
 		  //(int)((sin(atan(1.0))+1)*
-------------------------------------------------------------------------------

Harald Koenig
-- 
"I hope to die                                      ___       _____
before I *have* to use Microsoft Word.",           0--,|    /OOOOOOO\
Donald E. Knuth, 02-Oct-2001 in Tuebingen.        <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig                                          \/\/\/\/\/\/\/\/\/
science+computing ag                                    //  /     \\  \
[email protected]                            ^^^^^       ^^^^^


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Preview-latex-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/preview-latex-bugs


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.