ref: 05f5d7ecfe446cb145d82ecd01360e0769ca642e
parent: 08c3f83f958d081cdebe170fc5d7cec648d347aa
author: Sebastian Rasmussen <sebras@gmail.com>
date: Mon Mar 16 18:56:06 EDT 2020
jbig2dec: Use unsigned suffix when defining UINT32_MAX. Also move UINT32_MAX/INT32_MAX to internal header so they are defined (the same) in every jbig2 source code file.
--- a/jbig2_arith_int.c
+++ b/jbig2_arith_int.c
@@ -32,13 +32,6 @@
#include "jbig2_arith.h"
#include "jbig2_arith_int.h"
-#if !defined (INT32_MIN)
-#define INT32_MIN (-0x7fffffff - 1)
-#endif
-#if !defined (INT32_MAX)
-#define INT32_MAX 0x7fffffff
-#endif
-
struct _Jbig2ArithIntCtx {
Jbig2ArithCx IAx[512];
};
--- a/jbig2_generic.c
+++ b/jbig2_generic.c
@@ -42,10 +42,6 @@
#include "jbig2_page.h"
#include "jbig2_segment.h"
-#if !defined (UINT32_MAX)
-#define UINT32_MAX 0xffffffff
-#endif
-
/*
This is an explanation of the unoptimized and optimized generic
region decoder implementations below, wherein we try to explain
--- a/jbig2_image.c
+++ b/jbig2_image.c
@@ -30,13 +30,6 @@
#include "jbig2_priv.h"
#include "jbig2_image.h"
-#if !defined (INT32_MAX)
-#define INT32_MAX 0x7fffffff
-#endif
-#if !defined (UINT32_MAX)
-#define UINT32_MAX 0xffffffffu
-#endif
-
/* allocate a Jbig2Image structure and its associated bitmap */
Jbig2Image *
jbig2_image_new(Jbig2Ctx *ctx, uint32_t width, uint32_t height)
--- a/jbig2_mmr.c
+++ b/jbig2_mmr.c
@@ -40,10 +40,6 @@
#include "jbig2_mmr.h"
#include "jbig2_segment.h"
-#if !defined (UINT32_MAX)
-#define UINT32_MAX 0xffffffff
-#endif
-
typedef struct {
uint32_t width;
uint32_t height;
--- a/jbig2_page.c
+++ b/jbig2_page.c
@@ -34,13 +34,6 @@
#include "jbig2_page.h"
#include "jbig2_segment.h"
-#if !defined (INT32_MAX)
-#define INT32_MAX 0x7fffffff
-#endif
-#if !defined (UINT32_MAX)
-#define UINT32_MAX 0xffffffff
-#endif
-
/* dump the page struct info */
static void
dump_page_info(Jbig2Ctx *ctx, Jbig2Segment *segment, Jbig2Page *page)
--- a/jbig2_priv.h
+++ b/jbig2_priv.h
@@ -55,6 +55,16 @@
#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;
--- a/jbig2_segment.c
+++ b/jbig2_segment.c
@@ -39,10 +39,6 @@
#include "jbig2_symbol_dict.h"
#include "jbig2_text.h"
-#if !defined (UINT32_MAX)
-#define UINT32_MAX 0xffffffff
-#endif
-
Jbig2Segment *
jbig2_parse_segment_header(Jbig2Ctx *ctx, uint8_t *buf, size_t buf_size, size_t *p_header_size)
{