From 138a65d6c143427755d49ec32fe43f17a3e6c8b6 Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Fri, 14 Mar 2014 12:02:05 +0000 Subject: [PATCH] [trunk] Move INLINE definition within openjpeg.h header since application may use it --- src/bin/jp2/convert.c | 10 ++-------- src/lib/openjp2/openjpeg.h | 17 +++++++++++++++++ src/lib/openjp2/opj_includes.h | 16 ---------------- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/src/bin/jp2/convert.c b/src/bin/jp2/convert.c index 90684a2c..5dd09da7 100644 --- a/src/bin/jp2/convert.c +++ b/src/bin/jp2/convert.c @@ -183,7 +183,7 @@ static int tga_readheader(FILE *fp, unsigned int *bits_per_pixel, #if WORDS_BIGENDIAN == 1 -static inline int16_t swap16(int16_t x) +static INLINE int16_t swap16(int16_t x) { return((((u_int16_t)x & 0x00ffU) << 8) | (((u_int16_t)x & 0xff00U) >> 8)); @@ -1421,13 +1421,7 @@ opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters) { #define CLAMP(x,a,b) x < a ? a : (x > b ? b : x) -#ifdef _MSC_VER -#define STIN static __inline -#else -#define STIN static inline -#endif - -STIN int clamp( const int value, const int prec, const int sgnd ) +static INLINE int clamp( const int value, const int prec, const int sgnd ) { if( sgnd ) { diff --git a/src/lib/openjp2/openjpeg.h b/src/lib/openjp2/openjpeg.h index d3339954..59a1cdc4 100644 --- a/src/lib/openjp2/openjpeg.h +++ b/src/lib/openjp2/openjpeg.h @@ -43,6 +43,23 @@ ========================================================== */ +/* +The inline keyword is supported by C99 but not by C90. +Most compilers implement their own version of this keyword ... +*/ +#ifndef INLINE + #if defined(_MSC_VER) + #define INLINE __forceinline + #elif defined(__GNUC__) + #define INLINE __inline__ + #elif defined(__MWERKS__) + #define INLINE inline + #else + /* add other compilers here ... */ + #define INLINE + #endif /* defined() */ +#endif /* INLINE */ + /* deprecated attribute */ #ifdef __GNUC__ #define OPJ_DEPRECATED(func) func __attribute__ ((deprecated)) diff --git a/src/lib/openjp2/opj_includes.h b/src/lib/openjp2/opj_includes.h index 8b072c58..76380962 100644 --- a/src/lib/openjp2/opj_includes.h +++ b/src/lib/openjp2/opj_includes.h @@ -102,22 +102,6 @@ #define __attribute__(x) /* __attribute__(x) */ #endif -/* -The inline keyword is supported by C99 but not by C90. -Most compilers implement their own version of this keyword ... -*/ -#ifndef INLINE - #if defined(_MSC_VER) - #define INLINE __forceinline - #elif defined(__GNUC__) - #define INLINE __inline__ - #elif defined(__MWERKS__) - #define INLINE inline - #else - /* add other compilers here ... */ - #define INLINE - #endif /* defined() */ -#endif /* INLINE */ /* Are restricted pointers available? (C99) */ #if (__STDC_VERSION__ != 199901L) -- 2.30.2