[trunk] move functionalities of stdint/inttype into opj_stdint/opj_inttypes

This commit is contained in:
Mathieu Malaterre 2012-03-19 10:15:46 +00:00
parent 8d0e5899b9
commit e07b265009
6 changed files with 92 additions and 24 deletions

View File

@ -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 */
/*@{*/

View File

@ -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 */

View File

@ -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;

View File

@ -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"

View File

@ -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 */

47
libopenjpeg/opj_stdint.h Normal file
View File

@ -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 */