jbig2dec
Ralph Giles <[email protected]> Sat, 22 Jun 2002 03:08:45 -0700
| Newsgroups | gmane.comp.printing.ghostscript.jbig2dec.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/jbig2dec/jbig2dec
In directory usw-pr-cvs1:/tmp/cvs-serv20584
Modified Files:
jbig2dec.c
Log Message:
Treat seg_idx=-1 specially in the error callback, since we're using that for
cases where the segment number is inappropriate or not available.
Index: jbig2dec.c
===================================================================
RCS file: /cvsroot/jbig2dec/jbig2dec/jbig2dec.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- jbig2dec.c 22 Jun 2002 09:58:26 -0000 1.24
+++ jbig2dec.c 22 Jun 2002 10:08:43 -0000 1.25
@@ -119,17 +119,20 @@
error_callback(void *error_callback_data, const char *buf, Jbig2Severity severity,
int32_t seg_idx)
{
- char *string;
+ char *type;
+ char segment[22];
switch (severity) {
- case JBIG2_SEVERITY_DEBUG: string = "DEBUG"; break;;
- case JBIG2_SEVERITY_INFO: string = "info"; break;;
- case JBIG2_SEVERITY_WARNING: string = "WARNING"; break;;
- case JBIG2_SEVERITY_FATAL: string = "FATAL ERROR"; break;;
- default: string = "unknown message"; break;;
+ case JBIG2_SEVERITY_DEBUG: type = "DEBUG"; break;;
+ case JBIG2_SEVERITY_INFO: type = "info"; break;;
+ case JBIG2_SEVERITY_WARNING: type = "WARNING"; break;;
+ case JBIG2_SEVERITY_FATAL: type = "FATAL ERROR"; break;;
+ default: type = "unknown message"; break;;
}
+ if (seg_idx == -1) segment[0] = '\0';
+ else snprintf(segment, sizeof(segment), "(segment 0x%02x)", seg_idx);
- fprintf(stderr, "jbig2dec %s %s (segment 0x%0x)\n", string, buf, seg_idx);
+ fprintf(stderr, "jbig2dec %s %s %s\n", type, buf, segment);
return 0;
}