GDAL
cpl_port.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id$
3  *
4  * Project: CPL - Common Portability Library
5  * Author: Frank Warmerdam, warmerdam@pobox.com
6  * Purpose: Include file providing low level portability services for CPL.
7  * This should be the first include file for any CPL based code.
8  *
9  ******************************************************************************
10  * Copyright (c) 1998, 2005, Frank Warmerdam <warmerdam@pobox.com>
11  * Copyright (c) 2008-2013, Even Rouault <even dot rouault at mines-paris dot org>
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included
21  * in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  ****************************************************************************/
31 
32 #ifndef CPL_BASE_H_INCLUDED
33 #define CPL_BASE_H_INCLUDED
34 
42 /* ==================================================================== */
43 /* We will use WIN32 as a standard windows define. */
44 /* ==================================================================== */
45 #if defined(_WIN32) && !defined(WIN32)
46 # define WIN32
47 #endif
48 
49 #if defined(_WINDOWS) && !defined(WIN32)
50 # define WIN32
51 #endif
52 
53 /* -------------------------------------------------------------------- */
54 /* The following apparently allow you to use strcpy() and other */
55 /* functions judged "unsafe" by microsoft in VS 8 (2005). */
56 /* -------------------------------------------------------------------- */
57 #ifdef _MSC_VER
58 # ifndef _CRT_SECURE_NO_DEPRECATE
59 # define _CRT_SECURE_NO_DEPRECATE
60 # endif
61 # ifndef _CRT_NONSTDC_NO_DEPRECATE
62 # define _CRT_NONSTDC_NO_DEPRECATE
63 # endif
64 #endif
65 
66 #include "cpl_config.h"
67 
68 /* ==================================================================== */
69 /* A few sanity checks, mainly to detect problems that sometimes */
70 /* arise with bad configured cross-compilation. */
71 /* ==================================================================== */
72 
73 #if !defined(SIZEOF_INT) || SIZEOF_INT != 4
74 #error "Unexpected value for SIZEOF_INT"
75 #endif
76 
77 #if !defined(SIZEOF_UNSIGNED_LONG) || (SIZEOF_UNSIGNED_LONG != 4 && SIZEOF_UNSIGNED_LONG != 8)
78 #error "Unexpected value for SIZEOF_UNSIGNED_LONG"
79 #endif
80 
81 #if !defined(SIZEOF_VOIDP) || (SIZEOF_VOIDP != 4 && SIZEOF_VOIDP != 8)
82 #error "Unexpected value for SIZEOF_VOIDP"
83 #endif
84 
85 /* ==================================================================== */
86 /* This will disable most WIN32 stuff in a Cygnus build which */
87 /* defines unix to 1. */
88 /* ==================================================================== */
89 
90 #ifdef unix
91 # undef WIN32
92 #endif
93 
95 #if defined(VSI_NEED_LARGEFILE64_SOURCE) && !defined(_LARGEFILE64_SOURCE)
96 # define _LARGEFILE64_SOURCE 1
97 #endif
98 
99 /* ==================================================================== */
100 /* If iconv() is available use extended recoding module. */
101 /* Stub implementation is always compiled in, because it works */
102 /* faster than iconv() for encodings it supports. */
103 /* ==================================================================== */
104 
105 #if defined(HAVE_ICONV)
106 # define CPL_RECODE_ICONV
107 #endif
108 
109 #define CPL_RECODE_STUB
110 
112 /* ==================================================================== */
113 /* MinGW stuff */
114 /* ==================================================================== */
115 
116 /* We need __MSVCRT_VERSION__ >= 0x0700 to have "_aligned_malloc" */
117 /* Latest versions of mingw32 define it, but with older ones, */
118 /* we need to define it manually */
119 #if defined(__MINGW32__)
120 #ifndef __MSVCRT_VERSION__
121 #define __MSVCRT_VERSION__ 0x0700
122 #endif
123 #endif
124 
125 /* Needed for std=c11 on Solaris to have strcasecmp() */
126 #if defined(GDAL_COMPILATION) && defined(__sun__) && __STDC_VERSION__ >= 201112L && _XOPEN_SOURCE < 600
127 #ifdef _XOPEN_SOURCE
128 #undef _XOPEN_SOURCE
129 #endif
130 #define _XOPEN_SOURCE 600
131 #endif
132 
133 /* ==================================================================== */
134 /* Standard include files. */
135 /* ==================================================================== */
136 
137 #include <stdio.h>
138 #include <stdlib.h>
139 #include <math.h>
140 #include <stdarg.h>
141 #include <string.h>
142 #include <ctype.h>
143 #include <limits.h>
144 
145 #include <time.h>
146 
147 #if defined(HAVE_ERRNO_H)
148 # include <errno.h>
149 #endif
150 
151 #ifdef HAVE_LOCALE_H
152 # include <locale.h>
153 #endif
154 
155 #ifdef HAVE_DIRECT_H
156 # include <direct.h>
157 #endif
158 
159 #if !defined(WIN32)
160 # include <strings.h>
161 #endif
162 
163 #if defined(HAVE_LIBDBMALLOC) && defined(HAVE_DBMALLOC_H) && defined(DEBUG)
164 # define DBMALLOC
165 # include <dbmalloc.h>
166 #endif
167 
168 #if !defined(DBMALLOC) && defined(HAVE_DMALLOC_H)
169 # define USE_DMALLOC
170 # include <dmalloc.h>
171 #endif
172 
173 /* ==================================================================== */
174 /* Base portability stuff ... this stuff may need to be */
175 /* modified for new platforms. */
176 /* ==================================================================== */
177 
178 /* -------------------------------------------------------------------- */
179 /* Which versions of C++ are available. */
180 /* -------------------------------------------------------------------- */
181 
182 /* MSVC fails to define a decent value of __cplusplus. Try to target VS2015*/
183 /* as a minimum */
184 
185 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
186 # if !(__cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900))
187 # error Must have C++11 or newer.
188 # endif
189 # if __cplusplus >= 201402L
190 # define HAVE_CXX14 1
191 # endif
192 /* TODO(schwehr): What is the correct test for C++ 17? */
193 #endif /* __cplusplus */
194 
195 /*---------------------------------------------------------------------
196  * types for 16 and 32 bits integers, etc...
197  *--------------------------------------------------------------------*/
198 #if UINT_MAX == 65535
199 typedef long GInt32;
200 typedef unsigned long GUInt32;
201 #else
202 
203 typedef int GInt32;
205 typedef unsigned int GUInt32;
206 #endif
207 
209 typedef short GInt16;
211 typedef unsigned short GUInt16;
213 typedef unsigned char GByte;
214 /* hack for PDF driver and poppler >= 0.15.0 that defines incompatible "typedef bool GBool" */
215 /* in include/poppler/goo/gtypes.h */
216 #ifndef CPL_GBOOL_DEFINED
217 
218 #define CPL_GBOOL_DEFINED
219 
221 typedef int GBool;
222 #endif
223 
225 #ifdef __cplusplus
226 #define CPL_STATIC_CAST(type, expr) static_cast<type>(expr)
227 #define CPL_REINTERPRET_CAST(type, expr) reinterpret_cast<type>(expr)
228 #else
229 #define CPL_STATIC_CAST(type, expr) ((type)(expr))
230 #define CPL_REINTERPRET_CAST(type, expr) ((type)(expr))
231 #endif
232 
234 /* -------------------------------------------------------------------- */
235 /* 64bit support */
236 /* -------------------------------------------------------------------- */
237 
238 #if defined(WIN32) && defined(_MSC_VER)
239 #define VSI_LARGE_API_SUPPORTED
240 #endif
241 
242 #if HAVE_LONG_LONG
243 
246 typedef long long GIntBig;
249 typedef unsigned long long GUIntBig;
250 
252 #define GINTBIG_MIN (CPL_STATIC_CAST(GIntBig, 0x80000000) << 32)
253 
254 #define GINTBIG_MAX ((CPL_STATIC_CAST(GIntBig, 0x7FFFFFFF) << 32) | 0xFFFFFFFFU)
255 
256 #define GUINTBIG_MAX ((CPL_STATIC_CAST(GUIntBig, 0xFFFFFFFFU) << 32) | 0xFFFFFFFFU)
257 
259 #define CPL_HAS_GINT64 1
260 
262 /* Note: we might want to use instead int64_t / uint64_t if they are available */
263 
265 typedef GIntBig GInt64;
268 
270 #define GINT64_MIN GINTBIG_MIN
271 
272 #define GINT64_MAX GINTBIG_MAX
273 
274 #define GUINT64_MAX GUINTBIG_MAX
275 
276 #else
277 
278 // NOTE: we don't really support such platforms ! Many things might break
279 
280 typedef long GIntBig;
281 typedef unsigned long GUIntBig;
282 
283 #define GINTBIG_MIN INT_MIN
284 #define GINTBIG_MAX INT_MAX
285 #define GUINTBIG_MAX UINT_MAX
286 #endif
287 
288 #if SIZEOF_VOIDP == 8
289 
291 #else
292 
293 typedef int GPtrDiff_t;
294 #endif
295 
296 #ifdef GDAL_COMPILATION
297 #if HAVE_UINTPTR_T
298 #include <stdint.h>
299 typedef uintptr_t GUIntptr_t;
300 #elif SIZEOF_VOIDP == 8
301 typedef GUIntBig GUIntptr_t;
302 #else
303 typedef unsigned int GUIntptr_t;
304 #endif
305 
306 #define CPL_IS_ALIGNED(ptr, quant) ((CPL_REINTERPRET_CAST(GUIntptr_t, CPL_STATIC_CAST(const void*, ptr)) % (quant)) == 0)
307 
308 #endif
309 
310 #if defined(__MSVCRT__) || (defined(WIN32) && defined(_MSC_VER))
311  #define CPL_FRMT_GB_WITHOUT_PREFIX "I64"
312 #elif HAVE_LONG_LONG
313 
314  #define CPL_FRMT_GB_WITHOUT_PREFIX "ll"
315 #else
316  #define CPL_FRMT_GB_WITHOUT_PREFIX "l"
317 #endif
318 
320 #define CPL_FRMT_GIB "%" CPL_FRMT_GB_WITHOUT_PREFIX "d"
321 
322 #define CPL_FRMT_GUIB "%" CPL_FRMT_GB_WITHOUT_PREFIX "u"
323 
325 #define GUINTBIG_TO_DOUBLE(x) CPL_STATIC_CAST(double, x)
326 
329 #ifdef COMPAT_WITH_ICC_CONVERSION_CHECK
330 #define CPL_INT64_FITS_ON_INT32(x) ((x) >= INT_MIN && (x) <= INT_MAX)
331 #else
332 #define CPL_INT64_FITS_ON_INT32(x) (CPL_STATIC_CAST(GIntBig, CPL_STATIC_CAST(int, x)) == (x))
333 #endif
334 
336 /* ==================================================================== */
337 /* Other standard services. */
338 /* ==================================================================== */
339 #ifdef __cplusplus
340 
341 # define CPL_C_START extern "C" {
342 
343 # define CPL_C_END }
344 #else
345 # define CPL_C_START
346 # define CPL_C_END
347 #endif
348 
349 #ifndef CPL_DLL
350 #if defined(_MSC_VER) && !defined(CPL_DISABLE_DLL)
351 # define CPL_DLL __declspec(dllexport)
352 #else
353 # if defined(USE_GCC_VISIBILITY_FLAG)
354 # define CPL_DLL __attribute__ ((visibility("default")))
355 # else
356 # define CPL_DLL
357 # endif
358 #endif
359 #endif
360 
362 /* Should optional (normally private) interfaces be exported? */
363 #ifdef CPL_OPTIONAL_APIS
364 # define CPL_ODLL CPL_DLL
365 #else
366 # define CPL_ODLL
367 #endif
368 
370 #ifndef CPL_STDCALL
371 #if defined(_MSC_VER) && !defined(CPL_DISABLE_STDCALL)
372 # define CPL_STDCALL __stdcall
373 #else
374 # define CPL_STDCALL
375 #endif
376 #endif
377 
379 #ifdef _MSC_VER
380 # define FORCE_CDECL __cdecl
381 #else
382 # define FORCE_CDECL
383 #endif
384 
387 /* TODO : support for other compilers needed */
388 #if (defined(__GNUC__) && !defined(__NO_INLINE__)) || defined(_MSC_VER)
389 #define HAS_CPL_INLINE 1
390 #define CPL_INLINE __inline
391 #elif defined(__SUNPRO_CC)
392 #define HAS_CPL_INLINE 1
393 #define CPL_INLINE inline
394 #else
395 #define CPL_INLINE
396 #endif
397 
399 #ifndef MAX
400 
401 # define MIN(a,b) (((a)<(b)) ? (a) : (b))
402 
403 # define MAX(a,b) (((a)>(b)) ? (a) : (b))
404 #endif
405 
406 #ifndef ABS
407 
408 # define ABS(x) (((x)<0) ? (-1*(x)) : (x))
409 #endif
410 
411 #ifndef M_PI
412 
413 # define M_PI 3.14159265358979323846
414 /* 3.1415926535897932384626433832795 */
415 #endif
416 
417 /* -------------------------------------------------------------------- */
418 /* Macro to test equality of two floating point values. */
419 /* We use fabs() function instead of ABS() macro to avoid side */
420 /* effects. */
421 /* -------------------------------------------------------------------- */
423 #ifndef CPLIsEqual
424 # define CPLIsEqual(x,y) (fabs((x) - (y)) < 0.0000000000001)
425 #endif
426 
428 /* -------------------------------------------------------------------- */
429 /* Provide macros for case insensitive string comparisons. */
430 /* -------------------------------------------------------------------- */
431 #ifndef EQUAL
432 
433 #if defined(AFL_FRIENDLY) && defined(__GNUC__)
434 
435 static inline int CPL_afl_friendly_memcmp(const void* ptr1, const void* ptr2, size_t len)
436  __attribute__((always_inline));
437 
438 static inline int CPL_afl_friendly_memcmp(const void* ptr1, const void* ptr2, size_t len)
439 {
440  const unsigned char* bptr1 = (const unsigned char*)ptr1;
441  const unsigned char* bptr2 = (const unsigned char*)ptr2;
442  while( len-- )
443  {
444  unsigned char b1 = *(bptr1++);
445  unsigned char b2 = *(bptr2++);
446  if( b1 != b2 ) return b1 - b2;
447  }
448  return 0;
449 }
450 
451 static inline int CPL_afl_friendly_strcmp(const char* ptr1, const char* ptr2)
452  __attribute__((always_inline));
453 
454 static inline int CPL_afl_friendly_strcmp(const char* ptr1, const char* ptr2)
455 {
456  const unsigned char* usptr1 = (const unsigned char*)ptr1;
457  const unsigned char* usptr2 = (const unsigned char*)ptr2;
458  while( 1 )
459  {
460  unsigned char ch1 = *(usptr1++);
461  unsigned char ch2 = *(usptr2++);
462  if( ch1 == 0 || ch1 != ch2 ) return ch1 - ch2;
463  }
464 }
465 
466 static inline int CPL_afl_friendly_strncmp(const char* ptr1, const char* ptr2, size_t len)
467  __attribute__((always_inline));
468 
469 static inline int CPL_afl_friendly_strncmp(const char* ptr1, const char* ptr2, size_t len)
470 {
471  const unsigned char* usptr1 = (const unsigned char*)ptr1;
472  const unsigned char* usptr2 = (const unsigned char*)ptr2;
473  while( len -- )
474  {
475  unsigned char ch1 = *(usptr1++);
476  unsigned char ch2 = *(usptr2++);
477  if( ch1 == 0 || ch1 != ch2 ) return ch1 - ch2;
478  }
479  return 0;
480 }
481 
482 static inline int CPL_afl_friendly_strcasecmp(const char* ptr1, const char* ptr2)
483  __attribute__((always_inline));
484 
485 static inline int CPL_afl_friendly_strcasecmp(const char* ptr1, const char* ptr2)
486 {
487  const unsigned char* usptr1 = (const unsigned char*)ptr1;
488  const unsigned char* usptr2 = (const unsigned char*)ptr2;
489  while( 1 )
490  {
491  unsigned char ch1 = *(usptr1++);
492  unsigned char ch2 = *(usptr2++);
493  ch1 = (unsigned char)toupper(ch1);
494  ch2 = (unsigned char)toupper(ch2);
495  if( ch1 == 0 || ch1 != ch2 ) return ch1 - ch2;
496  }
497 }
498 
499 static inline int CPL_afl_friendly_strncasecmp(const char* ptr1, const char* ptr2, size_t len)
500  __attribute__((always_inline));
501 
502 static inline int CPL_afl_friendly_strncasecmp(const char* ptr1, const char* ptr2, size_t len)
503 {
504  const unsigned char* usptr1 = (const unsigned char*)ptr1;
505  const unsigned char* usptr2 = (const unsigned char*)ptr2;
506  while( len-- )
507  {
508  unsigned char ch1 = *(usptr1++);
509  unsigned char ch2 = *(usptr2++);
510  ch1 = (unsigned char)toupper(ch1);
511  ch2 = (unsigned char)toupper(ch2);
512  if( ch1 == 0 || ch1 != ch2 ) return ch1 - ch2;
513  }
514  return 0;
515 }
516 
517 static inline char* CPL_afl_friendly_strstr(const char* haystack, const char* needle)
518  __attribute__((always_inline));
519 
520 static inline char* CPL_afl_friendly_strstr(const char* haystack, const char* needle)
521 {
522  const char* ptr_haystack = haystack;
523  while( 1 )
524  {
525  const char* ptr_haystack2 = ptr_haystack;
526  const char* ptr_needle = needle;
527  while( 1 )
528  {
529  char ch1 = *(ptr_haystack2++);
530  char ch2 = *(ptr_needle++);
531  if( ch2 == 0 )
532  return (char*)ptr_haystack;
533  if( ch1 != ch2 )
534  break;
535  }
536  if( *ptr_haystack == 0 )
537  return NULL;
538  ptr_haystack ++;
539  }
540 }
541 
542 #undef strcmp
543 #undef strncmp
544 #define memcmp CPL_afl_friendly_memcmp
545 #define strcmp CPL_afl_friendly_strcmp
546 #define strncmp CPL_afl_friendly_strncmp
547 #define strcasecmp CPL_afl_friendly_strcasecmp
548 #define strncasecmp CPL_afl_friendly_strncasecmp
549 #define strstr CPL_afl_friendly_strstr
550 
551 #endif /* defined(AFL_FRIENDLY) && defined(__GNUC__) */
552 
553 # if defined(WIN32)
554 # define STRCASECMP(a,b) (stricmp(a,b))
555 # define STRNCASECMP(a,b,n) (strnicmp(a,b,n))
556 # else
557 
558 # define STRCASECMP(a,b) (strcasecmp(a,b))
559 
560 # define STRNCASECMP(a,b,n) (strncasecmp(a,b,n))
561 # endif
562 
563 # define EQUALN(a,b,n) (STRNCASECMP(a,b,n)==0)
564 
565 # define EQUAL(a,b) (STRCASECMP(a,b)==0)
566 #endif
567 
568 /*---------------------------------------------------------------------
569  * Does a string "a" start with string "b". Search is case-sensitive or,
570  * with CI, it is a case-insensitive comparison.
571  *--------------------------------------------------------------------- */
572 #ifndef STARTS_WITH_CI
573 
574 #define STARTS_WITH(a,b) (strncmp(a,b,strlen(b)) == 0)
575 
576 #define STARTS_WITH_CI(a,b) EQUALN(a,b,strlen(b))
577 #endif
578 
580 #ifndef CPL_THREADLOCAL
581 # define CPL_THREADLOCAL
582 #endif
583 
585 /* -------------------------------------------------------------------- */
586 /* Handle isnan() and isinf(). Note that isinf() and isnan() */
587 /* are supposed to be macros according to C99, defined in math.h */
588 /* Some systems (i.e. Tru64) don't have isinf() at all, so if */
589 /* the macro is not defined we just assume nothing is infinite. */
590 /* This may mean we have no real CPLIsInf() on systems with isinf()*/
591 /* function but no corresponding macro, but I can live with */
592 /* that since it isn't that important a test. */
593 /* -------------------------------------------------------------------- */
594 #ifdef _MSC_VER
595 # include <float.h>
596 # define CPLIsNan(x) _isnan(x)
597 # define CPLIsInf(x) (!_isnan(x) && !_finite(x))
598 # define CPLIsFinite(x) _finite(x)
599 #elif defined(__GNUC__) && ( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 4 ) )
600 /* When including <cmath> in C++11 the isnan() macro is undefined, so that */
601 /* std::isnan() can work (#6489). This is a GCC specific workaround for now. */
602 # define CPLIsNan(x) __builtin_isnan(x)
603 # define CPLIsInf(x) __builtin_isinf(x)
604 # define CPLIsFinite(x) __builtin_isfinite(x)
605 #elif defined(__cplusplus) && defined(HAVE_STD_IS_NAN) && HAVE_STD_IS_NAN
606 extern "C++" {
607 #ifndef DOXYGEN_SKIP
608 #include <cmath>
609 #endif
610 static inline int CPLIsNan(float f) { return std::isnan(f); }
611 static inline int CPLIsNan(double f) { return std::isnan(f); }
612 static inline int CPLIsInf(float f) { return std::isinf(f); }
613 static inline int CPLIsInf(double f) { return std::isinf(f); }
614 static inline int CPLIsFinite(float f) { return std::isfinite(f); }
615 static inline int CPLIsFinite(double f) { return std::isfinite(f); }
616 }
617 #else
618 
619 #if defined(__cplusplus) && defined(__GNUC__) && defined(__linux) && !defined(__ANDROID__) && !defined(CPL_SUPRESS_CPLUSPLUS)
620 /* so to not get warning about conversion from double to float with */
621 /* gcc -Wfloat-conversion when using isnan()/isinf() macros */
622 extern "C++" {
623 static inline int CPLIsNan(float f) { return __isnanf(f); }
624 static inline int CPLIsNan(double f) { return __isnan(f); }
625 static inline int CPLIsInf(float f) { return __isinff(f); }
626 static inline int CPLIsInf(double f) { return __isinf(f); }
627 static inline int CPLIsFinite(float f) { return !__isnanf(f) && !__isinff(f); }
628 static inline int CPLIsFinite(double f) { return !__isnan(f) && !__isinf(f); }
629 }
630 #else
631 # define CPLIsNan(x) isnan(x)
632 # if defined(isinf) || defined(__FreeBSD__)
633 
634 # define CPLIsInf(x) isinf(x)
635 
636 # define CPLIsFinite(x) (!isnan(x) && !isinf(x))
637 # elif defined(__sun__)
638 # include <ieeefp.h>
639 # define CPLIsInf(x) (!finite(x) && !isnan(x))
640 # define CPLIsFinite(x) finite(x)
641 # else
642 # define CPLIsInf(x) (0)
643 # define CPLIsFinite(x) (!isnan(x))
644 # endif
645 #endif
646 #endif
647 
649 /*---------------------------------------------------------------------
650  * CPL_LSB and CPL_MSB
651  * Only one of these 2 macros should be defined and specifies the byte
652  * ordering for the current platform.
653  * This should be defined in the Makefile, but if it is not then
654  * the default is CPL_LSB (Intel ordering, LSB first).
655  *--------------------------------------------------------------------*/
656 #if defined(WORDS_BIGENDIAN) && !defined(CPL_MSB) && !defined(CPL_LSB)
657 # define CPL_MSB
658 #endif
659 
660 #if ! ( defined(CPL_LSB) || defined(CPL_MSB) )
661 #define CPL_LSB
662 #endif
663 
664 #if defined(CPL_LSB)
665 # define CPL_IS_LSB 1
666 #else
667 # define CPL_IS_LSB 0
668 #endif
669 
671 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
672 
674 extern "C++" {
675 
676 template <bool b> struct CPLStaticAssert {};
677 template<> struct CPLStaticAssert<true>
678 {
679  static void my_function() {}
680 };
681 
682 } /* extern "C++" */
683 
684 #define CPL_STATIC_ASSERT(x) CPLStaticAssert<x>::my_function()
685 #define CPL_STATIC_ASSERT_IF_AVAILABLE(x) CPL_STATIC_ASSERT(x)
686 
687 #else /* __cplusplus */
688 
689 #define CPL_STATIC_ASSERT_IF_AVAILABLE(x)
690 
691 #endif /* __cplusplus */
692 
694 /*---------------------------------------------------------------------
695  * Little endian <==> big endian byte swap macros.
696  *--------------------------------------------------------------------*/
697 
699 #define CPL_SWAP16(x) CPL_STATIC_CAST(GUInt16, (CPL_STATIC_CAST(GUInt16, x) << 8) | (CPL_STATIC_CAST(GUInt16, x) >> 8) )
700 
701 #if defined(HAVE_GCC_BSWAP) && (defined(__i386__) || defined(__x86_64__))
702 /* Could potentially be extended to other architectures but must be checked */
703 /* that the intrinsic is indeed efficient */
704 /* GCC (at least 4.6 or above) need that include */
705 #include <x86intrin.h>
707 #define CPL_SWAP32(x) CPL_STATIC_CAST(GUInt32, __builtin_bswap32(CPL_STATIC_CAST(GUInt32, x)))
708 
709 #define CPL_SWAP64(x) CPL_STATIC_CAST(GUInt64, __builtin_bswap64(CPL_STATIC_CAST(GUInt64, x)))
710 #elif defined(_MSC_VER)
711 #define CPL_SWAP32(x) CPL_STATIC_CAST(GUInt32, _byteswap_ulong(CPL_STATIC_CAST(GUInt32, x)))
712 #define CPL_SWAP64(x) CPL_STATIC_CAST(GUInt64, _byteswap_uint64(CPL_STATIC_CAST(GUInt64, x)))
713 #else
714 
715 #define CPL_SWAP32(x) \
716  CPL_STATIC_CAST(GUInt32, \
717  ((CPL_STATIC_CAST(GUInt32, x) & 0x000000ffU) << 24) | \
718  ((CPL_STATIC_CAST(GUInt32, x) & 0x0000ff00U) << 8) | \
719  ((CPL_STATIC_CAST(GUInt32, x) & 0x00ff0000U) >> 8) | \
720  ((CPL_STATIC_CAST(GUInt32, x) & 0xff000000U) >> 24) )
721 
723 #define CPL_SWAP64(x) \
724  ((CPL_STATIC_CAST(GUInt64, CPL_SWAP32(CPL_STATIC_CAST(GUInt32, x))) << 32) | \
725  (CPL_STATIC_CAST(GUInt64, CPL_SWAP32(CPL_STATIC_CAST(GUInt32, CPL_STATIC_CAST(GUInt64, x) >> 32)))))
726 
727 #endif
728 
730 #define CPL_SWAP16PTR(x) \
731 { \
732  GByte byTemp, *_pabyDataT = CPL_REINTERPRET_CAST(GByte*, x); \
733  CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2); \
734  \
735  byTemp = _pabyDataT[0]; \
736  _pabyDataT[0] = _pabyDataT[1]; \
737  _pabyDataT[1] = byTemp; \
738 }
739 
740 #if defined(MAKE_SANITIZE_HAPPY) || !(defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64))
741 
743 #define CPL_SWAP32PTR(x) \
744 { \
745  GByte byTemp, *_pabyDataT = CPL_REINTERPRET_CAST(GByte*, x); \
746  CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4); \
747  \
748  byTemp = _pabyDataT[0]; \
749  _pabyDataT[0] = _pabyDataT[3]; \
750  _pabyDataT[3] = byTemp; \
751  byTemp = _pabyDataT[1]; \
752  _pabyDataT[1] = _pabyDataT[2]; \
753  _pabyDataT[2] = byTemp; \
754 }
755 
757 #define CPL_SWAP64PTR(x) \
758 { \
759  GByte byTemp, *_pabyDataT = CPL_REINTERPRET_CAST(GByte*, x); \
760  CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8); \
761  \
762  byTemp = _pabyDataT[0]; \
763  _pabyDataT[0] = _pabyDataT[7]; \
764  _pabyDataT[7] = byTemp; \
765  byTemp = _pabyDataT[1]; \
766  _pabyDataT[1] = _pabyDataT[6]; \
767  _pabyDataT[6] = byTemp; \
768  byTemp = _pabyDataT[2]; \
769  _pabyDataT[2] = _pabyDataT[5]; \
770  _pabyDataT[5] = byTemp; \
771  byTemp = _pabyDataT[3]; \
772  _pabyDataT[3] = _pabyDataT[4]; \
773  _pabyDataT[4] = byTemp; \
774 }
775 
776 #else
777 
779 #define CPL_SWAP32PTR(x) \
780 { \
781  GUInt32 _n32; \
782  void* _lx = x; \
783  memcpy(&_n32, _lx, 4); \
784  CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4); \
785  _n32 = CPL_SWAP32(_n32); \
786  memcpy(_lx, &_n32, 4); \
787 }
788 
790 #define CPL_SWAP64PTR(x) \
791 { \
792  GUInt64 _n64; \
793  void* _lx = x; \
794  memcpy(&_n64, _lx, 8); \
795  CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8); \
796  _n64 = CPL_SWAP64(_n64); \
797  memcpy(_lx, &_n64, 8); \
798 }
799 
800 #endif
801 
803 #define CPL_SWAPDOUBLE(p) CPL_SWAP64PTR(p)
804 
805 #ifdef CPL_MSB
806 # define CPL_MSBWORD16(x) (x)
807 # define CPL_LSBWORD16(x) CPL_SWAP16(x)
808 # define CPL_MSBWORD32(x) (x)
809 # define CPL_LSBWORD32(x) CPL_SWAP32(x)
810 # define CPL_MSBPTR16(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2)
811 # define CPL_LSBPTR16(x) CPL_SWAP16PTR(x)
812 # define CPL_MSBPTR32(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4)
813 # define CPL_LSBPTR32(x) CPL_SWAP32PTR(x)
814 # define CPL_MSBPTR64(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8)
815 # define CPL_LSBPTR64(x) CPL_SWAP64PTR(x)
816 #else
817 
818 # define CPL_LSBWORD16(x) (x)
819 
820 # define CPL_MSBWORD16(x) CPL_SWAP16(x)
821 
822 # define CPL_LSBWORD32(x) (x)
823 
824 # define CPL_MSBWORD32(x) CPL_SWAP32(x)
825 
826 # define CPL_LSBPTR16(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2)
827 
828 # define CPL_MSBPTR16(x) CPL_SWAP16PTR(x)
829 
830 # define CPL_LSBPTR32(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4)
831 
832 # define CPL_MSBPTR32(x) CPL_SWAP32PTR(x)
833 
834 # define CPL_LSBPTR64(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8)
835 
836 # define CPL_MSBPTR64(x) CPL_SWAP64PTR(x)
837 #endif
838 
842 #define CPL_LSBINT16PTR(x) ((*CPL_REINTERPRET_CAST(const GByte*, x)) | (*((CPL_REINTERPRET_CAST(const GByte*, x))+1) << 8))
843 
847 #define CPL_LSBINT32PTR(x) ((*CPL_REINTERPRET_CAST(const GByte*, x)) | (*((CPL_REINTERPRET_CAST(const GByte*, x))+1) << 8) | \
848  (*((CPL_REINTERPRET_CAST(const GByte*, x))+2) << 16) | (*((CPL_REINTERPRET_CAST(const GByte*, x))+3) << 24))
849 
851 #define CPL_LSBSINT16PTR(x) CPL_STATIC_CAST(GInt16,CPL_LSBINT16PTR(x))
852 
854 #define CPL_LSBUINT16PTR(x) CPL_STATIC_CAST(GUInt16, CPL_LSBINT16PTR(x))
855 
857 #define CPL_LSBSINT32PTR(x) CPL_STATIC_CAST(GInt32, CPL_LSBINT32PTR(x))
858 
860 #define CPL_LSBUINT32PTR(x) CPL_STATIC_CAST(GUInt32, CPL_LSBINT32PTR(x))
861 
863 /* Utility macro to explicitly mark intentionally unreferenced parameters. */
864 #ifndef UNREFERENCED_PARAM
865 # ifdef UNREFERENCED_PARAMETER /* May be defined by Windows API */
866 # define UNREFERENCED_PARAM(param) UNREFERENCED_PARAMETER(param)
867 # else
868 # define UNREFERENCED_PARAM(param) ((void)param)
869 # endif /* UNREFERENCED_PARAMETER */
870 #endif /* UNREFERENCED_PARAM */
871 
873 /***********************************************************************
874  * Define CPL_CVSID() macro. It can be disabled during a build by
875  * defining DISABLE_CVSID in the compiler options.
876  *
877  * The cvsid_aw() function is just there to prevent reports of cpl_cvsid()
878  * being unused.
879  */
880 
882 #ifndef DISABLE_CVSID
883 #if defined(__GNUC__) && __GNUC__ >= 4
884 # define CPL_CVSID(string) static const char cpl_cvsid[] __attribute__((used)) = string;
885 #else
886 # define CPL_CVSID(string) static const char cpl_cvsid[] = string; \
887 static const char *cvsid_aw() { return( cvsid_aw() ? NULL : cpl_cvsid ); }
888 #endif
889 #else
890 # define CPL_CVSID(string)
891 #endif
892 
894 /* We exclude mingw64 4.6 which seems to be broken regarding this */
895 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP) && !(defined(__MINGW64__) && __GNUC__ == 4 && __GNUC_MINOR__ == 6)
896 
897 # define CPL_NULL_TERMINATED __attribute__((__sentinel__))
898 #else
899 
900 # define CPL_NULL_TERMINATED
901 #endif
902 
903 #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(DOXYGEN_SKIP)
904 
905 #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx ) __attribute__((__format__ (__printf__, format_idx, arg_idx)))
906 
907 #define CPL_SCAN_FUNC_FORMAT( format_idx, arg_idx ) __attribute__((__format__ (__scanf__, format_idx, arg_idx)))
908 #else
909 
910 #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx )
911 
912 #define CPL_SCAN_FUNC_FORMAT( format_idx, arg_idx )
913 #endif
914 
915 #if defined(_MSC_VER) && (defined(GDAL_COMPILATION) || defined(CPL_ENABLE_MSVC_ANNOTATIONS))
916 #include <sal.h>
919 # define CPL_FORMAT_STRING(arg) _Printf_format_string_ arg
920 
922 # define CPL_SCANF_FORMAT_STRING(arg) _Scanf_format_string_ arg
923 #else
924 
925 # define CPL_FORMAT_STRING(arg) arg
926 
927 # define CPL_SCANF_FORMAT_STRING(arg) arg
928 #endif /* defined(_MSC_VER) && defined(GDAL_COMPILATION) */
929 
930 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP)
931 
932 #define CPL_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
933 #else
934 
935 #define CPL_WARN_UNUSED_RESULT
936 #endif
937 
938 #if defined(__GNUC__) && __GNUC__ >= 4
939 
940 # define CPL_UNUSED __attribute((__unused__))
941 #else
942 /* TODO: add cases for other compilers */
944 # define CPL_UNUSED
945 #endif
946 
947 #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(DOXYGEN_SKIP)
948 
949 #define CPL_NO_RETURN __attribute__((noreturn))
950 #else
951 
952 #define CPL_NO_RETURN
953 #endif
954 
956 /* Clang __has_attribute */
957 #ifndef __has_attribute
958  #define __has_attribute(x) 0 // Compatibility with non-clang compilers.
959 #endif
960 
963 #if ((defined(__GNUC__) && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9))) || __has_attribute(returns_nonnull)) && !defined(DOXYGEN_SKIP) && !defined(__INTEL_COMPILER)
964 
965 # define CPL_RETURNS_NONNULL __attribute__((returns_nonnull))
966 #else
967 
968 # define CPL_RETURNS_NONNULL
969 #endif
970 
971 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP)
972 
973 #define CPL_RESTRICT __restrict__
974 #else
975 
976 #define CPL_RESTRICT
977 #endif
978 
979 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
980 
983 # define CPL_OVERRIDE override
984 
986 # define CPL_FINAL final
987 
993 # define CPL_DISALLOW_COPY_ASSIGN(ClassName) \
994  ClassName( const ClassName & ) = delete; \
995  ClassName &operator=( const ClassName & ) = delete;
996 
997 #endif /* __cplusplus */
998 
999 #if !defined(DOXYGEN_SKIP)
1000 #if defined(__has_extension)
1001  #if __has_extension(attribute_deprecated_with_message)
1002  /* Clang extension */
1003  #define CPL_WARN_DEPRECATED(x) __attribute__ ((deprecated(x)))
1004  #else
1005  #define CPL_WARN_DEPRECATED(x)
1006  #endif
1007 #elif defined(__GNUC__)
1008  #define CPL_WARN_DEPRECATED(x) __attribute__ ((deprecated))
1009 #else
1010  #define CPL_WARN_DEPRECATED(x)
1011 #endif
1012 #endif
1013 
1014 #if !defined(_MSC_VER) && !defined(__APPLE__) && !defined(_FORTIFY_SOURCE)
1016 # if defined(GDAL_COMPILATION) && defined(WARN_STANDARD_PRINTF)
1017 int vsnprintf(char *str, size_t size, const char* fmt, va_list args)
1018  CPL_WARN_DEPRECATED("Use CPLvsnprintf() instead");
1019 int snprintf(char *str, size_t size, const char* fmt, ...)
1021  CPL_WARN_DEPRECATED("Use CPLsnprintf() instead");
1022 int sprintf(char *str, const char* fmt, ...)
1023  CPL_PRINT_FUNC_FORMAT(2, 3)
1024  CPL_WARN_DEPRECATED("Use CPLsnprintf() instead");
1025 # elif defined(GDAL_COMPILATION) && !defined(DONT_DEPRECATE_SPRINTF)
1026 int sprintf(char *str, const char* fmt, ...)
1027  CPL_PRINT_FUNC_FORMAT(2, 3)
1028  CPL_WARN_DEPRECATED("Use snprintf() or CPLsnprintf() instead");
1029 # endif /* defined(GDAL_COMPILATION) && defined(WARN_STANDARD_PRINTF) */
1030 CPL_C_END
1031 #endif /* !defined(_MSC_VER) && !defined(__APPLE__) */
1032 
1033 #if defined(MAKE_SANITIZE_HAPPY) || !(defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64))
1034 
1035 #define CPL_CPU_REQUIRES_ALIGNED_ACCESS
1036 
1037 #endif
1038 
1039 #if defined(__cplusplus)
1040 
1041 #define CPL_ARRAYSIZE(array) \
1042  ((sizeof(array) / sizeof(*(array))) / \
1043  static_cast<size_t>(!(sizeof(array) % sizeof(*(array)))))
1044 
1045 extern "C++" {
1046 template<class T> static void CPL_IGNORE_RET_VAL(T) {}
1047 inline static bool CPL_TO_BOOL(int x) { return x != 0; }
1048 } /* extern "C++" */
1049 
1050 #endif /* __cplusplus */
1051 
1052 #if (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) || (defined(__clang__) && __clang_major__ >= 3)) && !defined(_MSC_VER))
1053 #define HAVE_GCC_DIAGNOSTIC_PUSH
1054 #endif
1055 
1056 #if ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) && !defined(_MSC_VER))
1057 #define HAVE_GCC_SYSTEM_HEADER
1058 #endif
1059 
1060 #if ((defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >=7))) || __GNUC__ >= 7)
1061 
1062 # define CPL_FALLTHROUGH [[clang::fallthrough]];
1063 #else
1064 
1065 # define CPL_FALLTHROUGH
1066 #endif
1067 
1069 // Define DEBUG_BOOL to compile in "MSVC mode", ie error out when
1070 // a integer is assigned to a bool
1071 // WARNING: use only at compilation time, since it is know to not work
1072 // at runtime for unknown reasons (crash in MongoDB driver for example)
1073 #if defined(__cplusplus) && defined(DEBUG_BOOL) && !defined(DO_NOT_USE_DEBUG_BOOL) && !defined(CPL_SUPRESS_CPLUSPLUS)
1074 extern "C++" {
1075 class MSVCPedanticBool
1076 {
1077 
1078  friend bool operator== (const bool& one, const MSVCPedanticBool& other);
1079  friend bool operator!= (const bool& one, const MSVCPedanticBool& other);
1080 
1081  bool b;
1082  MSVCPedanticBool(int bIn);
1083 
1084  public:
1085  /* b not initialized on purpose in default ctor to flag use. */
1086  /* cppcheck-suppress uninitMemberVar */
1087  MSVCPedanticBool() {}
1088  MSVCPedanticBool(bool bIn) : b(bIn) {}
1089  MSVCPedanticBool(const MSVCPedanticBool& other) : b(other.b) {}
1090 
1091  MSVCPedanticBool& operator= (const MSVCPedanticBool& other) { b = other.b; return *this; }
1092  MSVCPedanticBool& operator&= (const MSVCPedanticBool& other) { b &= other.b; return *this; }
1093  MSVCPedanticBool& operator|= (const MSVCPedanticBool& other) { b |= other.b; return *this; }
1094 
1095  bool operator== (const bool& other) const { return b == other; }
1096  bool operator!= (const bool& other) const { return b != other; }
1097  bool operator< (const bool& other) const { return b < other; }
1098  bool operator== (const MSVCPedanticBool& other) const { return b == other.b; }
1099  bool operator!= (const MSVCPedanticBool& other) const { return b != other.b; }
1100  bool operator< (const MSVCPedanticBool& other) const { return b < other.b; }
1101 
1102  bool operator! () const { return !b; }
1103  operator bool() const { return b; }
1104  operator int() const { return b; }
1105  operator GIntBig() const { return b; }
1106 };
1107 
1108 inline bool operator== (const bool& one, const MSVCPedanticBool& other) { return one == other.b; }
1109 inline bool operator!= (const bool& one, const MSVCPedanticBool& other) { return one != other.b; }
1110 
1111 /* We must include all C++ stuff before to avoid issues with templates that use bool */
1112 #include <vector>
1113 #include <map>
1114 #include <set>
1115 #include <string>
1116 #include <cstddef>
1117 #include <limits>
1118 #include <sstream>
1119 #include <fstream>
1120 #include <algorithm>
1121 #include <functional>
1122 #include <memory>
1123 #include <queue>
1124 #include <mutex>
1125 #include <unordered_map>
1126 #include <thread>
1127 #include <unordered_set>
1128 #include <complex>
1129 #include <iomanip>
1130 
1131 } /* extern C++ */
1132 
1133 #undef FALSE
1134 #define FALSE false
1135 #undef TRUE
1136 #define TRUE true
1137 
1138 /* In the very few cases we really need a "simple" type, fallback to bool */
1139 #define EMULATED_BOOL int
1140 
1141 /* Use our class instead of bool */
1142 #define bool MSVCPedanticBool
1143 
1144 /* "volatile bool" with the below substitution doesn't really work. */
1145 /* Just for the sake of the debug, we don't really need volatile */
1146 #define VOLATILE_BOOL bool
1147 
1148 #else /* defined(__cplusplus) && defined(DEBUG_BOOL) */
1149 
1150 #ifndef FALSE
1151 # define FALSE 0
1152 #endif
1153 
1154 #ifndef TRUE
1155 # define TRUE 1
1156 #endif
1157 
1158 #define EMULATED_BOOL bool
1159 #define VOLATILE_BOOL volatile bool
1160 
1161 #endif /* defined(__cplusplus) && defined(DEBUG_BOOL) */
1162 
1163 #if __clang_major__ >= 4 || (__clang_major__ == 3 && __clang_minor__ >= 8)
1164 #define CPL_NOSANITIZE_UNSIGNED_INT_OVERFLOW __attribute__((no_sanitize("unsigned-integer-overflow")))
1165 #else
1166 #define CPL_NOSANITIZE_UNSIGNED_INT_OVERFLOW
1167 #endif
1168 
1171 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
1172 #define CPL_NULLPTR nullptr
1173 #else
1174 #define CPL_NULLPTR NULL
1175 #endif
1176 
1178 /* This typedef is for C functions that take char** as argument, but */
1179 /* with the semantics of a const list. In C, char** is not implicitly cast to */
1180 /* const char* const*, contrary to C++. So when seen for C++, it is OK */
1181 /* to expose the prototyes as const char* const*, but for C we keep the */
1182 /* historical definition to avoid warnings. */
1183 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS) && !defined(DOXYGEN_SKIP)
1184 
1186 typedef const char* const* CSLConstList;
1187 #else
1188 
1190 typedef char** CSLConstList;
1191 #endif
1192 
1193 #endif /* ndef CPL_BASE_H_INCLUDED */
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:341
int GBool
Type for boolean values (alias to int)
Definition: cpl_port.h:221
int GInt32
Int32 type.
Definition: cpl_port.h:203
unsigned int GUInt32
Unsigned int32 type.
Definition: cpl_port.h:205
short GInt16
Int16 type.
Definition: cpl_port.h:209
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:213
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition: cpl_port.h:910
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:267
GIntBig GPtrDiff_t
Integer type large enough to hold the difference between 2 addresses.
Definition: cpl_port.h:290
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1190
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:249
unsigned short GUInt16
Unsigned int16 type.
Definition: cpl_port.h:211
int CPLsnprintf(char *str, size_t size, const char *fmt,...)
snprintf() wrapper that is not sensitive to LC_NUMERIC settings.
Definition: cpl_string.cpp:1337
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:343
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:246
GIntBig GInt64
Signed 64 bit integer type.
Definition: cpl_port.h:265

Generated for GDAL by doxygen 1.8.8.