ref: 2048089ff9b99ac20bcfcb4dad4b2238e796db68
parent: 6515f25ce92cb589a7ed16217dffcc012e08a4ea
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Thu Jul 4 09:34:29 EDT 2002
Clean up some warnings from MSVC. Thanks to Russell Lang for the report. git-svn-id: http://svn.ghostscript.com/jbig2dec/trunk@105 ded80894-8fb9-0310-811b-c03f3676ab4d
--- a/jbig2.c
+++ b/jbig2.c
@@ -8,7 +8,7 @@
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
- $Id: jbig2.c,v 1.10 2002/06/24 23:28:13 giles Exp $
+ $Id: jbig2.c,v 1.11 2002/07/04 13:34:29 giles Exp $
*/
#include <stdint.h>
@@ -157,7 +157,7 @@
int
jbig2_write (Jbig2Ctx *ctx, const unsigned char *data, size_t size)
{
- const int initial_buf_size = 1024;
+ const size_t initial_buf_size = 1024;
if (ctx->buf == NULL)
{
@@ -182,7 +182,7 @@
else
{
byte *buf;
- int buf_size = initial_buf_size;
+ size_t buf_size = initial_buf_size;
do
buf_size <<= 1;
@@ -310,7 +310,6 @@
{
Jbig2Allocator *ca = ctx->allocator;
int i;
- uint32_t seg_ix;
jbig2_free(ca, ctx->buf);
if (ctx->segments != NULL)
--- a/jbig2_arith_iaid.c
+++ b/jbig2_arith_iaid.c
@@ -6,6 +6,8 @@
#include <stddef.h>
#include <stdint.h>
+#include <string.h> /* memset() */
+
#include "jbig2.h"
#include "jbig2_priv.h"
#include "jbig2_arith.h"
--- a/jbig2_arith_int.c
+++ b/jbig2_arith_int.c
@@ -2,6 +2,8 @@
#include <stddef.h>
#include <stdint.h>
+#include <string.h> /* memset() */
+
#include "jbig2.h"
#include "jbig2_priv.h"
#include "jbig2_arith.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.9 2002/06/24 15:51:57 giles Exp $
+ $Id: jbig2_generic.c,v 1.10 2002/07/04 13:34:29 giles Exp $
*/
/**
@@ -17,6 +17,8 @@
#include <stdint.h>
#include <stddef.h>
+#include <string.h> /* memcpy(), memset() */
+
#ifdef OUTPUT_PBM
#include <stdio.h>
#endif
@@ -346,7 +348,8 @@
{
int i;
for (i = 0; i < 8; i++)
- printf ("gbat[%d] = %d\n", i, params->gbat[i]);
+ jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number,
+ "gbat[%d] = %d", i, params->gbat[i]);
}
jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number,
"decode_generic_region: MMR=%d, GBTEMPLATE=%d NYI",
--- a/jbig2_generic.h
+++ b/jbig2_generic.h
@@ -8,7 +8,7 @@
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
- $Id: jbig2_generic.h,v 1.6 2002/06/22 16:05:45 giles Exp $
+ $Id: jbig2_generic.h,v 1.7 2002/07/04 13:34:29 giles Exp $
*/
/* Table 2 */
@@ -32,8 +32,4 @@
Jbig2Image *image,
Jbig2ArithCx *GB_stats);
-/* 7.4 */
-int
-jbig2_immediate_generic_region(Jbig2Ctx *ctx, Jbig2Segment *segment,
- const uint8_t *segment_data);
--- a/jbig2_image.c
+++ b/jbig2_image.c
@@ -8,12 +8,13 @@
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
- $Id: jbig2_image.c,v 1.15 2002/07/04 12:08:02 giles Exp $
+ $Id: jbig2_image.c,v 1.16 2002/07/04 13:34:29 giles Exp $
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
+#include <string.h> /* memcpy() */
#include "jbig2.h"
#include "jbig2_priv.h"
--- a/jbig2_image_pbm.c
+++ b/jbig2_image_pbm.c
@@ -8,10 +8,11 @@
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
- $Id: jbig2_image_pbm.c,v 1.6 2002/07/03 19:43:21 giles Exp $
+ $Id: jbig2_image_pbm.c,v 1.7 2002/07/04 13:34:29 giles Exp $
*/
#include <stdio.h>
+#include <ctype.h>
#include "jbig2.h"
#include "jbig2_image.h"
@@ -38,9 +39,6 @@
int jbig2_image_write_pbm(Jbig2Image *image, FILE *out)
{
- int i;
- char *p = (char *)image->data;
-
// pbm header
fprintf(out, "P4\n%d %d\n", image->width, image->height);
@@ -73,11 +71,10 @@
Jbig2Image *jbig2_image_read_pbm(Jbig2Ctx *ctx, FILE *in)
{
int i, dim[2];
- int stride, pbm_stride;
int done;
Jbig2Image *image;
- char c,buf[32];
- char *data;
+ int c;
+ char buf[32];
// look for 'P4' magic
while ((c = fgetc(in)) != 'P') {
--- a/jbig2_mmr.c
+++ b/jbig2_mmr.c
@@ -4,9 +4,8 @@
#include <stdint.h>
#include <stddef.h>
-#ifdef OUTPUT_PBM
#include <stdio.h>
-#endif
+
#include "jbig2.h"
#include "jbig2_priv.h"
#include "jbig2_arith.h"
--- a/jbig2_page.c
+++ b/jbig2_page.c
@@ -8,10 +8,9 @@
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
- $Id: jbig2_page.c,v 1.6 2002/06/22 16:05:45 giles Exp $
+ $Id: jbig2_page.c,v 1.7 2002/07/04 13:34:29 giles Exp $
*/
-#include <stdio.h>
#include <stdlib.h>
#include "jbig2.h"
@@ -93,9 +92,8 @@
// FIXME: would be nice if we tried to work around this
if (segment->data_length < 19) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
"segment too short");
- return NULL;
}
/* 7.4.8.x */
@@ -138,10 +136,9 @@
page->image = jbig2_image_new(ctx, page->width, page->height);
}
if (page->image == NULL) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
- "failed to allocate buffer for page image");
jbig2_free(ctx->allocator, page);
- return NULL;
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
+ "failed to allocate buffer for page image");
} else {
jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number,
"allocated %dx%d page image (%d bytes)",
@@ -196,7 +193,6 @@
Jbig2Image *jbig2_get_page(Jbig2Ctx *ctx)
{
int index;
- Jbig2Image *image;
/* search for a completed page */
for (index=0; index < ctx->max_page_index; index++) {
--- a/jbig2_priv.h
+++ b/jbig2_priv.h
@@ -8,7 +8,7 @@
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
- $Id: jbig2_priv.h,v 1.10 2002/06/24 23:28:13 giles Exp $
+ $Id: jbig2_priv.h,v 1.11 2002/07/04 13:34:29 giles Exp $
shared library internals
*/
@@ -19,6 +19,10 @@
#define TRUE 1
#define FALSE 0
+#ifndef NULL
+#define NULL ((void*)0)
+#endif
+
typedef enum {
JBIG2_FILE_HEADER,
JBIG2_FILE_SEQUENTIAL_HEADER,
@@ -36,7 +40,7 @@
void *error_callback_data;
byte *buf;
- int buf_size;
+ size_t buf_size;
int buf_rd_ix;
int buf_wr_ix;
@@ -131,6 +135,10 @@
void jbig2_get_region_segment_info(Jbig2RegionSegmentInfo *info, const byte *segment_data);
int jbig2_read_text_info(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data);
+/* 7.4 */
+int jbig2_immediate_generic_region(Jbig2Ctx *ctx, Jbig2Segment *segment,
+ const uint8_t *segment_data);
+
/* The word stream design is a compromise between simplicity and
trying to amortize the number of method calls. Each ::get_next_word
invocation pulls 4 bytes from the stream, packed big-endian into a
--- a/jbig2_segment.c
+++ b/jbig2_segment.c
@@ -8,11 +8,10 @@
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
- $Id: jbig2_segment.c,v 1.9 2002/06/24 23:28:13 giles Exp $
+ $Id: jbig2_segment.c,v 1.10 2002/07/04 13:34:29 giles Exp $
*/
-#include <stdio.h>
-#include <stdlib.h>
+#include <stdlib.h> /* size_t */
#include <stdint.h>
#include "jbig2.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.13 2002/06/24 19:09:47 giles Exp $
+ $Id: jbig2_symbol_dict.c,v 1.14 2002/07/04 13:34:29 giles Exp $
symbol dictionary segment decode and support
*/
@@ -15,6 +15,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <string.h> /* memset() */
#ifdef HAVE_CONFIG_H
#include "config.h"