[gs-cvs] rev 7059 - trunk/gs/src

giles at ghostscript.com giles at ghostscript.com
Tue Sep 19 16:45:44 PDT 2006


Author: giles
Date: 2006-09-19 16:45:43 -0700 (Tue, 19 Sep 2006)
New Revision: 7059

Modified:
   trunk/gs/src/lib.mak
   trunk/gs/src/sjpx.c
Log:
Propagate error messages from the jasper library.

Modified: trunk/gs/src/lib.mak
===================================================================
--- trunk/gs/src/lib.mak	2006-09-19 19:40:20 UTC (rev 7058)
+++ trunk/gs/src/lib.mak	2006-09-19 23:45:43 UTC (rev 7059)
@@ -1431,7 +1431,7 @@
 # jasper.dev is created in jasper.mak
 
 $(GLOBJ)sjpx.$(OBJ) : $(GLSRC)sjpx.c $(AK) \
- $(memory__h) $(stdio__h) $(gsmalloc_h) $(gserror_h) $(gserrors_h) \
+ $(memory__h) $(gsmalloc_h) $(gserror_h) $(gserrors_h) \
  $(gdebug_h) $(strimpl_h) $(sjpx_h)
 	$(GLJASCC) $(GLO_)sjpx.$(OBJ) $(C_) $(GLSRC)sjpx.c
 

Modified: trunk/gs/src/sjpx.c
===================================================================
--- trunk/gs/src/sjpx.c	2006-09-19 19:40:20 UTC (rev 7058)
+++ trunk/gs/src/sjpx.c	2006-09-19 23:45:43 UTC (rev 7059)
@@ -15,10 +15,6 @@
 /* JPXDecode filter implementation -- hooks in libjasper */
 
 #include "memory_.h"
-#ifdef JPX_DEBUG
-#include "stdio_.h"
-#endif
-
 #include "gserrors.h"
 #include "gserror.h"
 #include "gdebug.h"
@@ -36,6 +32,14 @@
 private_st_jpxd_state(); /* creates a gc object for our state,
 			    defined in sjpx.h */
 
+/* error reporting callback for the jpx library */
+private void
+s_jpx_jas_error_cb(jas_error_t err, char *msg)
+{
+  dprintf2("jasper (code %d) %s", (int)err, msg);
+}
+
+
 /* initialize the steam.
    this involves allocating the stream and image structures, and
    initializing the decoder.
@@ -55,6 +59,11 @@
     state->jpx_memory = ss->memory ? ss->memory->non_gc_memory : gs_lib_ctx_get_non_gc_memory_t();
             
     status = jas_init();
+    jas_set_error_cb(s_jpx_jas_error_cb);
+#ifdef JPX_DEBUG
+    /* raise the error reporting threshold from the default (0) */
+    jas_setdbglevel(1);
+#endif
 
     if (!status) {
 	state->buffer = gs_malloc(state->jpx_memory, 4096, 1, "JPXDecode temp buffer");



More information about the gs-cvs mailing list