summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'jbig2dec/jbig2_priv.h')
-rw-r--r--jbig2dec/jbig2_priv.h30
1 files changed, 20 insertions, 10 deletions
diff --git a/jbig2dec/jbig2_priv.h b/jbig2dec/jbig2_priv.h
index cf117e6c..f8db24ee 100644
--- a/jbig2dec/jbig2_priv.h
+++ b/jbig2dec/jbig2_priv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2019 Artifex Software, Inc.
+/* Copyright (C) 2001-2020 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -55,6 +55,16 @@ typedef uint8_t byte;
#define NULL ((void*)0)
#endif
+#if !defined (INT32_MIN)
+#define INT32_MIN (-0x7fffffff - 1)
+#endif
+#if !defined (INT32_MAX)
+#define INT32_MAX 0x7fffffff
+#endif
+#if !defined (UINT32_MAX)
+#define UINT32_MAX 0xffffffffu
+#endif
+
typedef struct _Jbig2Page Jbig2Page;
typedef struct _Jbig2Segment Jbig2Segment;
@@ -76,23 +86,23 @@ struct _Jbig2Ctx {
byte *buf;
size_t buf_size;
- unsigned int buf_rd_ix;
- unsigned int buf_wr_ix;
+ size_t buf_rd_ix;
+ size_t buf_wr_ix;
Jbig2FileState state;
uint8_t file_header_flags;
uint32_t n_pages;
- int n_segments_max;
+ uint32_t n_segments_max;
Jbig2Segment **segments;
- int n_segments; /* index of last segment header parsed */
- int segment_index; /* index of last segment body parsed */
+ uint32_t n_segments; /* index of last segment header parsed */
+ uint32_t segment_index; /* index of last segment body parsed */
/* list of decoded pages, including the one in progress,
currently stored as a contiguous, 0-indexed array. */
- int current_page;
- int max_page_index;
+ uint32_t current_page;
+ uint32_t max_page_index;
Jbig2Page *pages;
};
@@ -115,7 +125,7 @@ void *jbig2_realloc(Jbig2Allocator *allocator, void *p, size_t size, size_t num)
#define jbig2_renew(ctx, p, t, size) ((t *)jbig2_realloc(ctx->allocator, (p), size, sizeof(t)))
-int jbig2_error(Jbig2Ctx *ctx, Jbig2Severity severity, int32_t seg_idx, const char *fmt, ...)
+int jbig2_error(Jbig2Ctx *ctx, Jbig2Severity severity, uint32_t seg_idx, const char *fmt, ...)
#ifdef __GNUC__
__attribute__ ((format (__printf__, 4, 5)))
#endif
@@ -129,7 +139,7 @@ int jbig2_error(Jbig2Ctx *ctx, Jbig2Severity severity, int32_t seg_idx, const ch
typedef struct _Jbig2WordStream Jbig2WordStream;
struct _Jbig2WordStream {
- int (*get_next_word)(Jbig2WordStream *self, size_t offset, uint32_t *word);
+ int (*get_next_word)(Jbig2Ctx *ctx, Jbig2WordStream *self, size_t offset, uint32_t *word);
};
Jbig2WordStream *jbig2_word_stream_buf_new(Jbig2Ctx *ctx, const byte *data, size_t size);