shithub: jbig2

Download patch

ref: 0e74e387b2ac9dfb748dc090528bc1debe347afa
parent: 44cbf7cdc4d9c545004218ffc10c41b2fab7c38c
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Mon Jul 8 10:54:02 EDT 2002

Add support for building under Microsoft Visual C++ after a patch from Russell Lang. Please test.


git-svn-id: http://svn.ghostscript.com/jbig2dec/trunk@121 ded80894-8fb9-0310-811b-c03f3676ab4d

--- /dev/null
+++ b/config_win32.h
@@ -1,0 +1,21 @@
+/* configuration header file for compiling under Microsoft Windows */
+
+/* define this iff you are linking to/compiling in libpng */
+#define HAVE_LIBPNG
+
+#ifdef _MSC_VER /* Microsoft Visual C+*/
+
+  typedef signed char             int8_t;
+  typedef short int               int16_t;
+  typedef int                     int32_t;
+  typedef __int64                 int64_t;
+ 
+  typedef unsigned char             uint8_t;
+  typedef unsigned short int        uint16_t;
+  typedef unsigned int              uint32_t;
+  /* no uint64_t */
+
+#  define vsnprintf _vsnprintf
+#  define snprintf _snprintf
+
+#endif /* _MSC_VER */
--- a/jbig2.c
+++ b/jbig2.c
@@ -8,12 +8,14 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
         
-    $Id: jbig2.c,v 1.13 2002/07/08 13:40:15 giles Exp $
+    $Id: jbig2.c,v 1.14 2002/07/08 14:54:01 giles Exp $
 */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "config_types.h"
+#elif _WIN32
+#include "config_win32.h"
 #endif
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
@@ -85,7 +87,7 @@
   n = vsnprintf (buf, sizeof(buf), fmt, ap);
   va_end (ap);
   if (n < 0 || n == sizeof(buf))
-    strcpy (buf, "jbig2_error: error in generating error string");
+    strncpy (buf, "jbig2_error: error in generating error string", sizeof(buf));
   code = ctx->error_callback (ctx->error_callback_data, buf, severity, segment_number);
   if (severity == JBIG2_SEVERITY_FATAL)
     code = -1;
--- a/jbig2_arith.c
+++ b/jbig2_arith.c
@@ -8,12 +8,14 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2_arith.c,v 1.9 2002/07/08 13:40:15 giles Exp $
+    $Id: jbig2_arith.c,v 1.10 2002/07/08 14:54:01 giles Exp $
 */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "config_types.h"
+#elif _WIN32
+#include "config_win32.h"
 #endif
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
--- a/jbig2_arith_iaid.c
+++ b/jbig2_arith_iaid.c
@@ -3,6 +3,8 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "config_types.h"
+#elif _WIN32
+#include "config_win32.h"
 #endif
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
--- a/jbig2_arith_int.c
+++ b/jbig2_arith_int.c
@@ -3,6 +3,8 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "config_types.h"
+#elif _WIN32
+#include "config_win32.h"
 #endif
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
--- a/jbig2_generic.c
+++ b/jbig2_generic.c
@@ -8,7 +8,7 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
         
-    $Id: jbig2_generic.c,v 1.11 2002/07/08 13:40:15 giles Exp $
+    $Id: jbig2_generic.c,v 1.12 2002/07/08 14:54:01 giles Exp $
 */
 
 /**
@@ -18,6 +18,8 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "config_types.h"
+#elif _WIN32
+#include "config_win32.h"
 #endif
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
--- a/jbig2_huffman.c
+++ b/jbig2_huffman.c
@@ -8,7 +8,7 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
     
-    $Id: jbig2_huffman.c,v 1.9 2002/07/08 13:40:15 giles Exp $
+    $Id: jbig2_huffman.c,v 1.10 2002/07/08 14:54:01 giles Exp $
 */
 
 /* Huffman table decoding procedures 
@@ -17,6 +17,8 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "config_types.h"
+#elif _WIN32
+#include "config_win32.h"
 #endif
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
--- a/jbig2_image.c
+++ b/jbig2_image.c
@@ -8,12 +8,14 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2_image.c,v 1.17 2002/07/08 13:40:15 giles Exp $
+    $Id: jbig2_image.c,v 1.18 2002/07/08 14:54:01 giles Exp $
 */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "config_types.h"
+#elif _WIN32
+#include "config_win32.h"
 #endif
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
--- a/jbig2_image_pbm.c
+++ b/jbig2_image_pbm.c
@@ -8,12 +8,14 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2_image_pbm.c,v 1.8 2002/07/08 14:26:03 giles Exp $
+    $Id: jbig2_image_pbm.c,v 1.9 2002/07/08 14:54:01 giles Exp $
 */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "config_types.h"
+#elif _WIN32
+#include "config_win32.h"
 #endif
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
--- a/jbig2_image_png.c
+++ b/jbig2_image_png.c
@@ -8,12 +8,14 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2_image_png.c,v 1.4 2002/07/08 13:40:15 giles Exp $
+    $Id: jbig2_image_png.c,v 1.5 2002/07/08 14:54:01 giles Exp $
 */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "config_types.h"
+#elif _WIN32
+#include "config_win32.h"
 #endif
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
--- a/jbig2_mmr.c
+++ b/jbig2_mmr.c
@@ -5,6 +5,8 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "config_types.h"
+#elif _WIN32
+#include "config_win32.h"
 #endif
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
--- a/jbig2_page.c
+++ b/jbig2_page.c
@@ -8,12 +8,14 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2_page.c,v 1.10 2002/07/08 13:40:15 giles Exp $
+    $Id: jbig2_page.c,v 1.11 2002/07/08 14:54:01 giles Exp $
 */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "config_types.h"
+#elif _WIN32
+#include "config_win32.h"
 #endif
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
--- a/jbig2_segment.c
+++ b/jbig2_segment.c
@@ -8,12 +8,14 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2_segment.c,v 1.14 2002/07/08 13:40:15 giles Exp $
+    $Id: jbig2_segment.c,v 1.15 2002/07/08 14:54:01 giles Exp $
 */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "config_types.h"
+#elif _WIN32
+#include "config_win32.h"
 #endif
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -8,7 +8,7 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2_symbol_dict.c,v 1.15 2002/07/08 13:40:15 giles Exp $
+    $Id: jbig2_symbol_dict.c,v 1.16 2002/07/08 14:54:01 giles Exp $
     
     symbol dictionary segment decode and support
 */
@@ -16,6 +16,8 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "config_types.h"
+#elif _WIN32
+#include "config_win32.h"
 #endif
 #if HAVE_STDINT_H
 #include <stdint.h>
--- a/jbig2_text.c
+++ b/jbig2_text.c
@@ -8,12 +8,14 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2_text.c,v 1.12 2002/07/08 13:40:15 giles Exp $
+    $Id: jbig2_text.c,v 1.13 2002/07/08 14:54:02 giles Exp $
 */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "config_types.h"
+#elif _WIN32
+#include "config_win32.h"
 #endif
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
--- a/jbig2dec.c
+++ b/jbig2dec.c
@@ -8,12 +8,14 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2dec.c,v 1.27 2002/07/08 13:40:15 giles Exp $
+    $Id: jbig2dec.c,v 1.28 2002/07/08 14:54:02 giles Exp $
 */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "config_types.h"
+#elif _WIN32
+#include "config_win32.h"
 #endif
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
--- /dev/null
+++ b/msvc.mak
@@ -1,0 +1,95 @@
+# makefile for jbig2dec
+# under Microsoft Visual C++
+
+EXE=.exe
+OBJ=.obj
+NUL=
+CFLAGS=-nologo -W4 -Zi -DHAVE_STRING_H=1 -Ilibpng -Izlib
+CC=cl
+FE=-Fe
+
+OBJS=getopt$(OBJ) getopt1$(OBJ) jbig2$(OBJ) jbig2_arith$(OBJ) \
+ jbig2_arith_iaid$(OBJ) jbig2_arith_int$(OBJ) jbig2_generic$(OBJ) \
+ jbig2_huffman$(OBJ) jbig2_image$(OBJ) jbig2_image_pbm$(OBJ) \
+ jbig2_image_png$(OBJ) jbig2_mmr$(OBJ) jbig2_page$(OBJ) \
+ jbig2_segment$(OBJ) jbig2_symbol_dict$(OBJ) jbig2_text$(OBJ) \
+ jbig2dec$(OBJ)
+
+HDRS=getopt.h jbig2.h jbig2_arith.h jbig2_arith_iaid.h jbig2_arith_int.h \
+ jbig2_generic.h jbig2_huffman.h jbig2_hufftab.h jbig2_image.h \
+ jbig2_mmr.h jbig2_priv.h jbig2_symbol_dict.h stdint_.h
+
+all: jbig2dec$(EXE)
+
+jbig2dec$(EXE): $(OBJS)
+	$(CC) $(CFLAGS) $(FE)jbig2dec$(EXE) $(OBJS) libpng\libpng.lib zlib\zlib.lib
+
+getopt$(OBJ): getopt.c getopt.h
+	$(CC) $(CFLAGS) -c getopt.c
+
+getopt1$(OBJ): getopt1.c getopt.h
+	$(CC) $(CFLAGS) -c getopt1.c
+
+jbig2$(OBJ): jbig2.c $(HDRS)
+	$(CC) $(CFLAGS) -c jbig2.c
+
+jbig2_arith$(OBJ): jbig2_arith.c $(HDRS)
+	$(CC) $(CFLAGS) -c jbig2_arith.c
+
+jbig2_arith_iaid$(OBJ): jbig2_arith_iaid.c $(HDRS)
+	$(CC) $(CFLAGS) -c jbig2_arith_iaid.c
+
+jbig2_arith_int$(OBJ): jbig2_arith_int.c $(HDRS)
+	$(CC) $(CFLAGS) -c jbig2_arith_int.c
+
+jbig2_generic$(OBJ): jbig2_generic.c $(HDRS)
+	$(CC) $(CFLAGS) -c jbig2_generic.c
+
+jbig2_huffman$(OBJ): jbig2_huffman.c $(HDRS)
+	$(CC) $(CFLAGS) -c jbig2_huffman.c
+
+jbig2_image$(OBJ): jbig2_image.c $(HDRS)
+	$(CC) $(CFLAGS) -c jbig2_image.c
+
+jbig2_image_pbm$(OBJ): jbig2_image_pbm.c $(HDRS)
+	$(CC) $(CFLAGS) -c jbig2_image_pbm.c
+
+jbig2_image_png$(OBJ): jbig2_image_png.c $(HDRS)
+	$(CC) $(CFLAGS) -c jbig2_image_png.c
+
+jbig2_mmr$(OBJ): jbig2_mmr.c $(HDRS)
+	$(CC) $(CFLAGS) -c jbig2_mmr.c
+
+jbig2_page$(OBJ): jbig2_page.c $(HDRS)
+	$(CC) $(CFLAGS) -c jbig2_page.c
+
+jbig2_segment$(OBJ): jbig2_segment.c $(HDRS)
+	$(CC) $(CFLAGS) -c jbig2_segment.c
+
+jbig2_symbol_dict$(OBJ): jbig2_symbol_dict.c $(HDRS)
+	$(CC) $(CFLAGS) -c jbig2_symbol_dict.c
+
+jbig2_text$(OBJ): jbig2_text.c $(HDRS)
+	$(CC) $(CFLAGS) -c jbig2_text.c
+
+jbig2dec$(OBJ): jbig2dec.c $(HDRS)
+	$(CC) $(CFLAGS) -c jbig2dec.c
+
+pbm2png$(OBJ): pbm2png.c $(HDRS)
+	$(CC) $(CFLAGS) -c  pbm2png.c
+
+pbm2png$(EXE): pbm2png$(OBJ) jbig2_image$(OBJ)
+	$(CC) $(CFLAGS) $(FE)pbm2png$(EXE) pbm2png$(OBJ) jbig2_image$(OBJ) libpng\libpng.lib
+
+clean:
+	-del $(OBJS)
+	-del jbig2dec$(EXE)
+	-del jbig2dec.ilk
+	-del jbig2dec.pdb
+	-del pbm2png$(EXE)
+	-del pbm2png.ilk
+	-del pbm2png.pdb
+	-del vc70.pdb
+	-del vc60.pdb
+	-del vc50.pdb
+
--- a/pbm2png.c
+++ b/pbm2png.c
@@ -8,12 +8,14 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: pbm2png.c,v 1.2 2002/07/08 14:11:36 giles Exp $
+    $Id: pbm2png.c,v 1.3 2002/07/08 14:54:02 giles Exp $
 */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "config_types.h"
+#elif _WIN32
+#include "config_win32.h"
 #endif
 #ifdef HAVE_STDINT_H
 #include <stdint.h>