2 * Copyright (c) 2005, Herve Drolon, FreeImage Team
3 * Copyright (c) 2008;2011-2012, Centre National d'Etudes Spatiales (CNES), France
4 * Copyright (c) 2012, CS Systemes d'Information, France
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
28 #ifndef OPJ_INCLUDES_H
29 #define OPJ_INCLUDES_H
32 * This must be included before any system headers,
33 * since they can react to macro defined there
35 #include "opj_config_private.h"
38 ==========================================================
39 Standard includes used by the library
40 ==========================================================
54 Use fseeko() and ftello() if they are available since they use
55 'off_t' rather than 'long'. It is wrong to use fseeko() and
56 ftello() only on systems with special LFS support since some systems
57 (e.g. FreeBSD) support a 64-bit off_t by default.
59 #if !defined(OPENJPIP_H_) && defined(SERVER) /* server implementation uses fcgi/fseek*/
60 #if defined(OPJ_HAVE_FSEEKO)
67 #if defined(WIN32) && !defined(Windows95) && !defined(__BORLANDC__) && \
68 !(defined(_MSC_VER) && _MSC_VER < 1400) && \
69 !(defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x800)
71 Windows '95 and Borland C do not support _lseeki64
72 Visual Studio does not support _fseeki64 and _ftelli64 until the 2005 release.
73 Without these interfaces, files over 2GB in size are not supported for Windows.
75 # define OPJ_FSEEK(stream,offset,whence) _fseeki64(stream,/* __int64 */ offset,whence)
76 # define OPJ_FSTAT(fildes,stat_buff) _fstati64(fildes,/* struct _stati64 */ stat_buff)
77 # define OPJ_FTELL(stream) /* __int64 */ _ftelli64(stream)
78 # define OPJ_STAT_STRUCT_T struct _stati64
79 # define OPJ_STAT(path,stat_buff) _stati64(path,/* struct _stati64 */ stat_buff)
81 # define OPJ_FSEEK(stream,offset,whence) fseek(stream,offset,whence)
82 # define OPJ_FSTAT(fildes,stat_buff) fstat(fildes,stat_buff)
83 # define OPJ_FTELL(stream) ftell(stream)
84 # define OPJ_STAT_STRUCT_T struct stat
85 # define OPJ_STAT(path,stat_buff) stat(path,stat_buff)
90 ==========================================================
92 ==========================================================
97 ==========================================================
99 ==========================================================
102 /* Ignore GCC attributes if this is not GCC */
104 #define __attribute__(x) /* __attribute__(x) */
108 The inline keyword is supported by C99 but not by C90.
109 Most compilers implement their own version of this keyword ...
112 #if defined(_MSC_VER)
113 #define INLINE __forceinline
114 #elif defined(__GNUC__)
115 #define INLINE __inline__
116 #elif defined(__MWERKS__)
117 #define INLINE inline
119 /* add other compilers here ... */
121 #endif /* defined(<Compiler>) */
124 /* Are restricted pointers available? (C99) */
125 #if (__STDC_VERSION__ != 199901L)
126 /* Not a C99 compiler */
128 #define restrict __restrict__
130 #define restrict /* restrict */
134 /* MSVC before 2013 and Borland C do not have lrintf */
135 #if defined(_MSC_VER) && (_MSC_VER < 1800) || defined(__BORLANDC__)
136 static INLINE long lrintf(float f){
138 return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f));
152 #include "opj_inttypes.h"
153 #include "opj_clock.h"
154 #include "opj_malloc.h"
155 #include "function_list.h"
176 #include "opj_intmath.h"
179 #include "cidx_manager.h"
180 #include "indexbox_manager.h"
185 #include "openjpwl/jpwl.h"
186 #endif /* USE_JPWL */
190 #include "opj_codec.h"
193 #endif /* OPJ_INCLUDES_H */