summaryrefslogtreecommitdiff
path: root/libopenjpeg
diff options
context:
space:
mode:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>2012-03-19 10:15:46 +0000
committerMathieu Malaterre <mathieu.malaterre@gmail.com>2012-03-19 10:15:46 +0000
commite07b265009ce2f4ca4c425e2acd9d3d111ef8172 (patch)
tree03944cbf6118a0b9451876a6fc55cdc86a3f4a01 /libopenjpeg
parent8d0e5899b95a0613f0e60884c303fc70a0c4f15f (diff)
[trunk] move functionalities of stdint/inttype into opj_stdint/opj_inttypes
Diffstat (limited to 'libopenjpeg')
-rw-r--r--libopenjpeg/j2k.c5
-rw-r--r--libopenjpeg/jpwl/crc.c4
-rw-r--r--libopenjpeg/openjpeg.h19
-rw-r--r--libopenjpeg/opj_includes.h1
-rw-r--r--libopenjpeg/opj_inttypes.h40
-rw-r--r--libopenjpeg/opj_stdint.h47
6 files changed, 92 insertions, 24 deletions
diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c
index aa866346..40b1f4ee 100644
--- a/libopenjpeg/j2k.c
+++ b/libopenjpeg/j2k.c
@@ -34,11 +34,6 @@
*/
#include "opj_includes.h"
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h> /* PRIi64 */
-#else
-#define PRIi64 "I64i"
-#endif
/** @defgroup J2K J2K - JPEG-2000 codestream reader/writer */
/*@{*/
diff --git a/libopenjpeg/jpwl/crc.c b/libopenjpeg/jpwl/crc.c
index 9cc57d7b..6a4a7d8f 100644
--- a/libopenjpeg/jpwl/crc.c
+++ b/libopenjpeg/jpwl/crc.c
@@ -90,7 +90,7 @@ const unsigned short CRC16_table[256] = {
void updateCRC16(unsigned short *crc, unsigned char data) {
*crc = CRC16_table[(*crc >> 8) & 0xFF] ^ (*crc << 8) ^ data;
-};
+}
/** file: CRC32.CPP
@@ -155,6 +155,6 @@ const unsigned long CRC32_table[256] = {
void updateCRC32(unsigned long *crc, unsigned char data) {
*crc = CRC32_table[(unsigned char) *crc ^ data] ^ ((*crc >> 8) & 0x00FFFFFF);
-};
+}
#endif /* USE_JPWL */
diff --git a/libopenjpeg/openjpeg.h b/libopenjpeg/openjpeg.h
index 7a420d8b..59634c16 100644
--- a/libopenjpeg/openjpeg.h
+++ b/libopenjpeg/openjpeg.h
@@ -82,9 +82,8 @@ typedef double OPJ_FLOAT64;
typedef unsigned char OPJ_BYTE;
typedef size_t OPJ_SIZE_T;
-#include "opj_config.h"
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
+#include "opj_stdint.h"
+
typedef int8_t OPJ_INT8;
typedef uint8_t OPJ_UINT8;
typedef int16_t OPJ_INT16;
@@ -93,20 +92,6 @@ typedef int32_t OPJ_INT32;
typedef uint32_t OPJ_UINT32;
typedef int64_t OPJ_INT64;
typedef uint64_t OPJ_UINT64;
-#else
-#if defined(_WIN32)
-typedef signed __int8 OPJ_INT8;
-typedef unsigned __int8 OPJ_UINT8;
-typedef signed __int16 OPJ_INT16;
-typedef unsigned __int16 OPJ_UINT16;
-typedef signed __int32 OPJ_INT32;
-typedef unsigned __int32 OPJ_UINT32;
-typedef signed __int64 OPJ_INT64;
-typedef unsigned __int64 OPJ_UINT64;
-#else
-#error unsupported platform
-#endif
-#endif
/* 64-bit file offset type */
typedef OPJ_INT64 OPJ_OFF_T;
diff --git a/libopenjpeg/opj_includes.h b/libopenjpeg/opj_includes.h
index cc0d4f36..ebc946ac 100644
--- a/libopenjpeg/opj_includes.h
+++ b/libopenjpeg/opj_includes.h
@@ -145,6 +145,7 @@ static INLINE long lrintf(float f){
}
#endif
+#include "opj_inttypes.h"
#include "j2k_lib.h"
#include "opj_malloc.h"
#include "event.h"
diff --git a/libopenjpeg/opj_inttypes.h b/libopenjpeg/opj_inttypes.h
new file mode 100644
index 00000000..eb58156b
--- /dev/null
+++ b/libopenjpeg/opj_inttypes.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2012, Mathieu Malaterre <mathieu.malaterre@gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef OPJ_INTTYPES_H
+#define OPJ_INTTYPES_H
+
+#include "opj_config.h"
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#else
+#if defined(_WIN32)
+#define PRIi64 "I64i"
+#else
+#error unsupported platform
+#endif
+#endif
+
+#endif /* OPJ_INTTYPES_H */
diff --git a/libopenjpeg/opj_stdint.h b/libopenjpeg/opj_stdint.h
new file mode 100644
index 00000000..dfbdec47
--- /dev/null
+++ b/libopenjpeg/opj_stdint.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012, Mathieu Malaterre <mathieu.malaterre@gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef OPJ_STDINT_H
+#define OPJ_STDINT_H
+
+#include "opj_config.h"
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#else
+#if defined(_WIN32)
+typedef signed __int8 int8_t;
+typedef unsigned __int8 uint8_t;
+typedef signed __int16 int16_t;
+typedef unsigned __int16 uint16_t;
+typedef signed __int32 int32_t;
+typedef unsigned __int32 uint32_t;
+typedef signed __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+#else
+#error unsupported platform
+#endif
+#endif
+
+#endif /* OPJ_STDINT_H */