GDAL
cpl_port.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id: cpl_port.h c55171b249f96a1cfa0e54f83dfa872c722e493c 2018-05-12 13:46:40 -0700 Lucian Plesea $
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__ + 0) >= 201112L && (_XOPEN_SOURCE + 0) < 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 || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
190 # define HAVE_CXX14 1
191 # endif
192 # if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
193 # define HAVE_CXX17 1
194 # endif
195 #endif /* __cplusplus */
196 
197 /*---------------------------------------------------------------------
198  * types for 16 and 32 bits integers, etc...
199  *--------------------------------------------------------------------*/
200 #if UINT_MAX == 65535
201 typedef long GInt32;
202 typedef unsigned long GUInt32;
203 #else
204 
205 typedef int GInt32;
207 typedef unsigned int GUInt32;
208 #endif
209 
211 typedef short GInt16;
213 typedef unsigned short GUInt16;
215 typedef unsigned char GByte;
217 typedef int GBool;
218 
220 #ifdef __cplusplus
221 #define CPL_STATIC_CAST(type, expr) static_cast<type>(expr)
222 #define CPL_REINTERPRET_CAST(type, expr) reinterpret_cast<type>(expr)
223 #else
224 #define CPL_STATIC_CAST(type, expr) ((type)(expr))
225 #define CPL_REINTERPRET_CAST(type, expr) ((type)(expr))
226 #endif
227 
229 /* -------------------------------------------------------------------- */
230 /* 64bit support */
231 /* -------------------------------------------------------------------- */
232 
233 #if defined(WIN32) && defined(_MSC_VER)
234 #define VSI_LARGE_API_SUPPORTED
235 #endif
236 
237 #if HAVE_LONG_LONG
238 
241 typedef long long GIntBig;
244 typedef unsigned long long GUIntBig;
245 
247 #define GINTBIG_MIN (CPL_STATIC_CAST(GIntBig, 0x80000000) << 32)
248 
249 #define GINTBIG_MAX ((CPL_STATIC_CAST(GIntBig, 0x7FFFFFFF) << 32) | 0xFFFFFFFFU)
250 
251 #define GUINTBIG_MAX ((CPL_STATIC_CAST(GUIntBig, 0xFFFFFFFFU) << 32) | 0xFFFFFFFFU)
252 
254 #define CPL_HAS_GINT64 1
255 
257 /* Note: we might want to use instead int64_t / uint64_t if they are available */
258 
260 typedef GIntBig GInt64;
263 
265 #define GINT64_MIN GINTBIG_MIN
266 
267 #define GINT64_MAX GINTBIG_MAX
268 
269 #define GUINT64_MAX GUINTBIG_MAX
270 
271 #else
272 
273 #error "64bit integer support required"
274 
275 #endif
276 
277 #if SIZEOF_VOIDP == 8
278 
280 #else
281 
282 typedef int GPtrDiff_t;
283 #endif
284 
285 #ifdef GDAL_COMPILATION
286 #if HAVE_UINTPTR_T
287 #include <stdint.h>
288 typedef uintptr_t GUIntptr_t;
289 #elif SIZEOF_VOIDP == 8
290 typedef GUIntBig GUIntptr_t;
291 #else
292 typedef unsigned int GUIntptr_t;
293 #endif
294 
295 #define CPL_IS_ALIGNED(ptr, quant) ((CPL_REINTERPRET_CAST(GUIntptr_t, CPL_STATIC_CAST(const void*, ptr)) % (quant)) == 0)
296 
297 #endif
298 
299 #if defined(__MSVCRT__) || (defined(WIN32) && defined(_MSC_VER))
300  #define CPL_FRMT_GB_WITHOUT_PREFIX "I64"
301 #elif HAVE_LONG_LONG
302 
303  #define CPL_FRMT_GB_WITHOUT_PREFIX "ll"
304 #else
305  #define CPL_FRMT_GB_WITHOUT_PREFIX "l"
306 #endif
307 
309 #define CPL_FRMT_GIB "%" CPL_FRMT_GB_WITHOUT_PREFIX "d"
310 
311 #define CPL_FRMT_GUIB "%" CPL_FRMT_GB_WITHOUT_PREFIX "u"
312 
314 #define GUINTBIG_TO_DOUBLE(x) CPL_STATIC_CAST(double, x)
315 
318 #ifdef COMPAT_WITH_ICC_CONVERSION_CHECK
319 #define CPL_INT64_FITS_ON_INT32(x) ((x) >= INT_MIN && (x) <= INT_MAX)
320 #else
321 #define CPL_INT64_FITS_ON_INT32(x) (CPL_STATIC_CAST(GIntBig, CPL_STATIC_CAST(int, x)) == (x))
322 #endif
323 
325 /* ==================================================================== */
326 /* Other standard services. */
327 /* ==================================================================== */
328 #ifdef __cplusplus
329 
330 # define CPL_C_START extern "C" {
331 
332 # define CPL_C_END }
333 #else
334 # define CPL_C_START
335 # define CPL_C_END
336 #endif
337 
338 #ifndef CPL_DLL
339 #if defined(_MSC_VER) && !defined(CPL_DISABLE_DLL)
340 # define CPL_DLL __declspec(dllexport)
341 #else
342 # if defined(USE_GCC_VISIBILITY_FLAG)
343 # define CPL_DLL __attribute__ ((visibility("default")))
344 # else
345 # define CPL_DLL
346 # endif
347 #endif
348 #endif
349 
351 /* Should optional (normally private) interfaces be exported? */
352 #ifdef CPL_OPTIONAL_APIS
353 # define CPL_ODLL CPL_DLL
354 #else
355 # define CPL_ODLL
356 #endif
357 
359 #ifndef CPL_STDCALL
360 #if defined(_MSC_VER) && !defined(CPL_DISABLE_STDCALL)
361 # define CPL_STDCALL __stdcall
362 #else
363 # define CPL_STDCALL
364 #endif
365 #endif
366 
368 #ifdef _MSC_VER
369 # define FORCE_CDECL __cdecl
370 #else
371 # define FORCE_CDECL
372 #endif
373 
376 /* TODO : support for other compilers needed */
377 #if (defined(__GNUC__) && !defined(__NO_INLINE__)) || defined(_MSC_VER)
378 #define HAS_CPL_INLINE 1
379 #define CPL_INLINE __inline
380 #elif defined(__SUNPRO_CC)
381 #define HAS_CPL_INLINE 1
382 #define CPL_INLINE inline
383 #else
384 #define CPL_INLINE
385 #endif
386 
388 #ifndef MAX
389 
390 # define MIN(a,b) (((a)<(b)) ? (a) : (b))
391 
392 # define MAX(a,b) (((a)>(b)) ? (a) : (b))
393 #endif
394 
395 #ifndef ABS
396 
397 # define ABS(x) (((x)<0) ? (-1*(x)) : (x))
398 #endif
399 
400 #ifndef M_PI
401 
402 # define M_PI 3.14159265358979323846
403 /* 3.1415926535897932384626433832795 */
404 #endif
405 
406 /* -------------------------------------------------------------------- */
407 /* Macro to test equality of two floating point values. */
408 /* We use fabs() function instead of ABS() macro to avoid side */
409 /* effects. */
410 /* -------------------------------------------------------------------- */
412 #ifndef CPLIsEqual
413 # define CPLIsEqual(x,y) (fabs((x) - (y)) < 0.0000000000001)
414 #endif
415 
417 /* -------------------------------------------------------------------- */
418 /* Provide macros for case insensitive string comparisons. */
419 /* -------------------------------------------------------------------- */
420 #ifndef EQUAL
421 
422 #if defined(AFL_FRIENDLY) && defined(__GNUC__)
423 
424 static inline int CPL_afl_friendly_memcmp(const void* ptr1, const void* ptr2, size_t len)
425  __attribute__((always_inline));
426 
427 static inline int CPL_afl_friendly_memcmp(const void* ptr1, const void* ptr2, size_t len)
428 {
429  const unsigned char* bptr1 = (const unsigned char*)ptr1;
430  const unsigned char* bptr2 = (const unsigned char*)ptr2;
431  while( len-- )
432  {
433  unsigned char b1 = *(bptr1++);
434  unsigned char b2 = *(bptr2++);
435  if( b1 != b2 ) return b1 - b2;
436  }
437  return 0;
438 }
439 
440 static inline int CPL_afl_friendly_strcmp(const char* ptr1, const char* ptr2)
441  __attribute__((always_inline));
442 
443 static inline int CPL_afl_friendly_strcmp(const char* ptr1, const char* ptr2)
444 {
445  const unsigned char* usptr1 = (const unsigned char*)ptr1;
446  const unsigned char* usptr2 = (const unsigned char*)ptr2;
447  while( 1 )
448  {
449  unsigned char ch1 = *(usptr1++);
450  unsigned char ch2 = *(usptr2++);
451  if( ch1 == 0 || ch1 != ch2 ) return ch1 - ch2;
452  }
453 }
454 
455 static inline int CPL_afl_friendly_strncmp(const char* ptr1, const char* ptr2, size_t len)
456  __attribute__((always_inline));
457 
458 static inline int CPL_afl_friendly_strncmp(const char* ptr1, const char* ptr2, size_t len)
459 {
460  const unsigned char* usptr1 = (const unsigned char*)ptr1;
461  const unsigned char* usptr2 = (const unsigned char*)ptr2;
462  while( len -- )
463  {
464  unsigned char ch1 = *(usptr1++);
465  unsigned char ch2 = *(usptr2++);
466  if( ch1 == 0 || ch1 != ch2 ) return ch1 - ch2;
467  }
468  return 0;
469 }
470 
471 static inline int CPL_afl_friendly_strcasecmp(const char* ptr1, const char* ptr2)
472  __attribute__((always_inline));
473 
474 static inline int CPL_afl_friendly_strcasecmp(const char* ptr1, const char* ptr2)
475 {
476  const unsigned char* usptr1 = (const unsigned char*)ptr1;
477  const unsigned char* usptr2 = (const unsigned char*)ptr2;
478  while( 1 )
479  {
480  unsigned char ch1 = *(usptr1++);
481  unsigned char ch2 = *(usptr2++);
482  ch1 = (unsigned char)toupper(ch1);
483  ch2 = (unsigned char)toupper(ch2);
484  if( ch1 == 0 || ch1 != ch2 ) return ch1 - ch2;
485  }
486 }
487 
488 static inline int CPL_afl_friendly_strncasecmp(const char* ptr1, const char* ptr2, size_t len)
489  __attribute__((always_inline));
490 
491 static inline int CPL_afl_friendly_strncasecmp(const char* ptr1, const char* ptr2, size_t len)
492 {
493  const unsigned char* usptr1 = (const unsigned char*)ptr1;
494  const unsigned char* usptr2 = (const unsigned char*)ptr2;
495  while( len-- )
496  {
497  unsigned char ch1 = *(usptr1++);
498  unsigned char ch2 = *(usptr2++);
499  ch1 = (unsigned char)toupper(ch1);
500  ch2 = (unsigned char)toupper(ch2);
501  if( ch1 == 0 || ch1 != ch2 ) return ch1 - ch2;
502  }
503  return 0;
504 }
505 
506 static inline char* CPL_afl_friendly_strstr(const char* haystack, const char* needle)
507  __attribute__((always_inline));
508 
509 static inline char* CPL_afl_friendly_strstr(const char* haystack, const char* needle)
510 {
511  const char* ptr_haystack = haystack;
512  while( 1 )
513  {
514  const char* ptr_haystack2 = ptr_haystack;
515  const char* ptr_needle = needle;
516  while( 1 )
517  {
518  char ch1 = *(ptr_haystack2++);
519  char ch2 = *(ptr_needle++);
520  if( ch2 == 0 )
521  return (char*)ptr_haystack;
522  if( ch1 != ch2 )
523  break;
524  }
525  if( *ptr_haystack == 0 )
526  return NULL;
527  ptr_haystack ++;
528  }
529 }
530 
531 #undef strcmp
532 #undef strncmp
533 #define memcmp CPL_afl_friendly_memcmp
534 #define strcmp CPL_afl_friendly_strcmp
535 #define strncmp CPL_afl_friendly_strncmp
536 #define strcasecmp CPL_afl_friendly_strcasecmp
537 #define strncasecmp CPL_afl_friendly_strncasecmp
538 #define strstr CPL_afl_friendly_strstr
539 
540 #endif /* defined(AFL_FRIENDLY) && defined(__GNUC__) */
541 
542 # if defined(WIN32)
543 # define STRCASECMP(a,b) (stricmp(a,b))
544 # define STRNCASECMP(a,b,n) (strnicmp(a,b,n))
545 # else
546 
547 # define STRCASECMP(a,b) (strcasecmp(a,b))
548 
549 # define STRNCASECMP(a,b,n) (strncasecmp(a,b,n))
550 # endif
551 
552 # define EQUALN(a,b,n) (STRNCASECMP(a,b,n)==0)
553 
554 # define EQUAL(a,b) (STRCASECMP(a,b)==0)
555 #endif
556 
557 /*---------------------------------------------------------------------
558  * Does a string "a" start with string "b". Search is case-sensitive or,
559  * with CI, it is a case-insensitive comparison.
560  *--------------------------------------------------------------------- */
561 #ifndef STARTS_WITH_CI
562 
563 #define STARTS_WITH(a,b) (strncmp(a,b,strlen(b)) == 0)
564 
565 #define STARTS_WITH_CI(a,b) EQUALN(a,b,strlen(b))
566 #endif
567 
569 #ifndef CPL_THREADLOCAL
570 # define CPL_THREADLOCAL
571 #endif
572 
574 /* -------------------------------------------------------------------- */
575 /* Handle isnan() and isinf(). Note that isinf() and isnan() */
576 /* are supposed to be macros according to C99, defined in math.h */
577 /* Some systems (i.e. Tru64) don't have isinf() at all, so if */
578 /* the macro is not defined we just assume nothing is infinite. */
579 /* This may mean we have no real CPLIsInf() on systems with isinf()*/
580 /* function but no corresponding macro, but I can live with */
581 /* that since it isn't that important a test. */
582 /* -------------------------------------------------------------------- */
583 #ifdef _MSC_VER
584 # include <float.h>
585 # define CPLIsNan(x) _isnan(x)
586 # define CPLIsInf(x) (!_isnan(x) && !_finite(x))
587 # define CPLIsFinite(x) _finite(x)
588 #elif defined(__GNUC__) && ( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 4 ) )
589 /* When including <cmath> in C++11 the isnan() macro is undefined, so that */
590 /* std::isnan() can work (#6489). This is a GCC specific workaround for now. */
591 # define CPLIsNan(x) __builtin_isnan(x)
592 # define CPLIsInf(x) __builtin_isinf(x)
593 # define CPLIsFinite(x) __builtin_isfinite(x)
594 #elif defined(__cplusplus) && defined(HAVE_STD_IS_NAN) && HAVE_STD_IS_NAN
595 extern "C++" {
596 #ifndef DOXYGEN_SKIP
597 #include <cmath>
598 #endif
599 static inline int CPLIsNan(float f) { return std::isnan(f); }
600 static inline int CPLIsNan(double f) { return std::isnan(f); }
601 static inline int CPLIsInf(float f) { return std::isinf(f); }
602 static inline int CPLIsInf(double f) { return std::isinf(f); }
603 static inline int CPLIsFinite(float f) { return std::isfinite(f); }
604 static inline int CPLIsFinite(double f) { return std::isfinite(f); }
605 }
606 #else
607 
608 #if defined(__cplusplus) && defined(__GNUC__) && defined(__linux) && !defined(__ANDROID__) && !defined(CPL_SUPRESS_CPLUSPLUS)
609 /* so to not get warning about conversion from double to float with */
610 /* gcc -Wfloat-conversion when using isnan()/isinf() macros */
611 extern "C++" {
612 static inline int CPLIsNan(float f) { return __isnanf(f); }
613 static inline int CPLIsNan(double f) { return __isnan(f); }
614 static inline int CPLIsInf(float f) { return __isinff(f); }
615 static inline int CPLIsInf(double f) { return __isinf(f); }
616 static inline int CPLIsFinite(float f) { return !__isnanf(f) && !__isinff(f); }
617 static inline int CPLIsFinite(double f) { return !__isnan(f) && !__isinf(f); }
618 }
619 #else
620 # define CPLIsNan(x) isnan(x)
621 # if defined(isinf) || defined(__FreeBSD__)
622 
623 # define CPLIsInf(x) isinf(x)
624 
625 # define CPLIsFinite(x) (!isnan(x) && !isinf(x))
626 # elif defined(__sun__)
627 # include <ieeefp.h>
628 # define CPLIsInf(x) (!finite(x) && !isnan(x))
629 # define CPLIsFinite(x) finite(x)
630 # else
631 # define CPLIsInf(x) (0)
632 # define CPLIsFinite(x) (!isnan(x))
633 # endif
634 #endif
635 #endif
636 
638 /*---------------------------------------------------------------------
639  * CPL_LSB and CPL_MSB
640  * Only one of these 2 macros should be defined and specifies the byte
641  * ordering for the current platform.
642  * This should be defined in the Makefile, but if it is not then
643  * the default is CPL_LSB (Intel ordering, LSB first).
644  *--------------------------------------------------------------------*/
645 #if defined(WORDS_BIGENDIAN) && !defined(CPL_MSB) && !defined(CPL_LSB)
646 # define CPL_MSB
647 #endif
648 
649 #if ! ( defined(CPL_LSB) || defined(CPL_MSB) )
650 #define CPL_LSB
651 #endif
652 
653 #if defined(CPL_LSB)
654 # define CPL_IS_LSB 1
655 #else
656 # define CPL_IS_LSB 0
657 #endif
658 
660 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
661 
663 extern "C++" {
664 
665 template <bool b> struct CPLStaticAssert {};
666 template<> struct CPLStaticAssert<true>
667 {
668  static void my_function() {}
669 };
670 
671 } /* extern "C++" */
672 
673 #define CPL_STATIC_ASSERT(x) CPLStaticAssert<x>::my_function()
674 #define CPL_STATIC_ASSERT_IF_AVAILABLE(x) CPL_STATIC_ASSERT(x)
675 
676 #else /* __cplusplus */
677 
678 #define CPL_STATIC_ASSERT_IF_AVAILABLE(x)
679 
680 #endif /* __cplusplus */
681 
683 /*---------------------------------------------------------------------
684  * Little endian <==> big endian byte swap macros.
685  *--------------------------------------------------------------------*/
686 
688 #define CPL_SWAP16(x) CPL_STATIC_CAST(GUInt16, (CPL_STATIC_CAST(GUInt16, x) << 8) | (CPL_STATIC_CAST(GUInt16, x) >> 8) )
689 
690 #if defined(HAVE_GCC_BSWAP) && (defined(__i386__) || defined(__x86_64__))
691 /* Could potentially be extended to other architectures but must be checked */
692 /* that the intrinsic is indeed efficient */
693 /* GCC (at least 4.6 or above) need that include */
694 #include <x86intrin.h>
696 #define CPL_SWAP32(x) CPL_STATIC_CAST(GUInt32, __builtin_bswap32(CPL_STATIC_CAST(GUInt32, x)))
697 
698 #define CPL_SWAP64(x) CPL_STATIC_CAST(GUInt64, __builtin_bswap64(CPL_STATIC_CAST(GUInt64, x)))
699 #elif defined(_MSC_VER)
700 #define CPL_SWAP32(x) CPL_STATIC_CAST(GUInt32, _byteswap_ulong(CPL_STATIC_CAST(GUInt32, x)))
701 #define CPL_SWAP64(x) CPL_STATIC_CAST(GUInt64, _byteswap_uint64(CPL_STATIC_CAST(GUInt64, x)))
702 #else
703 
704 #define CPL_SWAP32(x) \
705  CPL_STATIC_CAST(GUInt32, \
706  ((CPL_STATIC_CAST(GUInt32, x) & 0x000000ffU) << 24) | \
707  ((CPL_STATIC_CAST(GUInt32, x) & 0x0000ff00U) << 8) | \
708  ((CPL_STATIC_CAST(GUInt32, x) & 0x00ff0000U) >> 8) | \
709  ((CPL_STATIC_CAST(GUInt32, x) & 0xff000000U) >> 24) )
710 
712 #define CPL_SWAP64(x) \
713  ((CPL_STATIC_CAST(GUInt64, CPL_SWAP32(CPL_STATIC_CAST(GUInt32, x))) << 32) | \
714  (CPL_STATIC_CAST(GUInt64, CPL_SWAP32(CPL_STATIC_CAST(GUInt32, CPL_STATIC_CAST(GUInt64, x) >> 32)))))
715 
716 #endif
717 
719 #define CPL_SWAP16PTR(x) \
720 { \
721  GByte byTemp, *_pabyDataT = CPL_REINTERPRET_CAST(GByte*, x); \
722  CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2); \
723  \
724  byTemp = _pabyDataT[0]; \
725  _pabyDataT[0] = _pabyDataT[1]; \
726  _pabyDataT[1] = byTemp; \
727 }
728 
729 #if defined(MAKE_SANITIZE_HAPPY) || !(defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64))
730 
732 #define CPL_SWAP32PTR(x) \
733 { \
734  GByte byTemp, *_pabyDataT = CPL_REINTERPRET_CAST(GByte*, x); \
735  CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4); \
736  \
737  byTemp = _pabyDataT[0]; \
738  _pabyDataT[0] = _pabyDataT[3]; \
739  _pabyDataT[3] = byTemp; \
740  byTemp = _pabyDataT[1]; \
741  _pabyDataT[1] = _pabyDataT[2]; \
742  _pabyDataT[2] = byTemp; \
743 }
744 
746 #define CPL_SWAP64PTR(x) \
747 { \
748  GByte byTemp, *_pabyDataT = CPL_REINTERPRET_CAST(GByte*, x); \
749  CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8); \
750  \
751  byTemp = _pabyDataT[0]; \
752  _pabyDataT[0] = _pabyDataT[7]; \
753  _pabyDataT[7] = byTemp; \
754  byTemp = _pabyDataT[1]; \
755  _pabyDataT[1] = _pabyDataT[6]; \
756  _pabyDataT[6] = byTemp; \
757  byTemp = _pabyDataT[2]; \
758  _pabyDataT[2] = _pabyDataT[5]; \
759  _pabyDataT[5] = byTemp; \
760  byTemp = _pabyDataT[3]; \
761  _pabyDataT[3] = _pabyDataT[4]; \
762  _pabyDataT[4] = byTemp; \
763 }
764 
765 #else
766 
768 #define CPL_SWAP32PTR(x) \
769 { \
770  GUInt32 _n32; \
771  void* _lx = x; \
772  memcpy(&_n32, _lx, 4); \
773  CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4); \
774  _n32 = CPL_SWAP32(_n32); \
775  memcpy(_lx, &_n32, 4); \
776 }
777 
779 #define CPL_SWAP64PTR(x) \
780 { \
781  GUInt64 _n64; \
782  void* _lx = x; \
783  memcpy(&_n64, _lx, 8); \
784  CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8); \
785  _n64 = CPL_SWAP64(_n64); \
786  memcpy(_lx, &_n64, 8); \
787 }
788 
789 #endif
790 
792 #define CPL_SWAPDOUBLE(p) CPL_SWAP64PTR(p)
793 
794 #ifdef CPL_MSB
795 # define CPL_MSBWORD16(x) (x)
796 # define CPL_LSBWORD16(x) CPL_SWAP16(x)
797 # define CPL_MSBWORD32(x) (x)
798 # define CPL_LSBWORD32(x) CPL_SWAP32(x)
799 # define CPL_MSBPTR16(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2)
800 # define CPL_LSBPTR16(x) CPL_SWAP16PTR(x)
801 # define CPL_MSBPTR32(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4)
802 # define CPL_LSBPTR32(x) CPL_SWAP32PTR(x)
803 # define CPL_MSBPTR64(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8)
804 # define CPL_LSBPTR64(x) CPL_SWAP64PTR(x)
805 #else
806 
807 # define CPL_LSBWORD16(x) (x)
808 
809 # define CPL_MSBWORD16(x) CPL_SWAP16(x)
810 
811 # define CPL_LSBWORD32(x) (x)
812 
813 # define CPL_MSBWORD32(x) CPL_SWAP32(x)
814 
815 # define CPL_LSBPTR16(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2)
816 
817 # define CPL_MSBPTR16(x) CPL_SWAP16PTR(x)
818 
819 # define CPL_LSBPTR32(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4)
820 
821 # define CPL_MSBPTR32(x) CPL_SWAP32PTR(x)
822 
823 # define CPL_LSBPTR64(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8)
824 
825 # define CPL_MSBPTR64(x) CPL_SWAP64PTR(x)
826 #endif
827 
831 #define CPL_LSBINT16PTR(x) ((*CPL_REINTERPRET_CAST(const GByte*, x)) | (*((CPL_REINTERPRET_CAST(const GByte*, x))+1) << 8))
832 
836 #define CPL_LSBINT32PTR(x) ((*CPL_REINTERPRET_CAST(const GByte*, x)) | (*((CPL_REINTERPRET_CAST(const GByte*, x))+1) << 8) | \
837  (*((CPL_REINTERPRET_CAST(const GByte*, x))+2) << 16) | (*((CPL_REINTERPRET_CAST(const GByte*, x))+3) << 24))
838 
840 #define CPL_LSBSINT16PTR(x) CPL_STATIC_CAST(GInt16,CPL_LSBINT16PTR(x))
841 
843 #define CPL_LSBUINT16PTR(x) CPL_STATIC_CAST(GUInt16, CPL_LSBINT16PTR(x))
844 
846 #define CPL_LSBSINT32PTR(x) CPL_STATIC_CAST(GInt32, CPL_LSBINT32PTR(x))
847 
849 #define CPL_LSBUINT32PTR(x) CPL_STATIC_CAST(GUInt32, CPL_LSBINT32PTR(x))
850 
852 /* Utility macro to explicitly mark intentionally unreferenced parameters. */
853 #ifndef UNREFERENCED_PARAM
854 # ifdef UNREFERENCED_PARAMETER /* May be defined by Windows API */
855 # define UNREFERENCED_PARAM(param) UNREFERENCED_PARAMETER(param)
856 # else
857 # define UNREFERENCED_PARAM(param) ((void)param)
858 # endif /* UNREFERENCED_PARAMETER */
859 #endif /* UNREFERENCED_PARAM */
860 
862 /***********************************************************************
863  * Define CPL_CVSID() macro. It can be disabled during a build by
864  * defining DISABLE_CVSID in the compiler options.
865  *
866  * The cvsid_aw() function is just there to prevent reports of cpl_cvsid()
867  * being unused.
868  */
869 
871 #ifndef DISABLE_CVSID
872 #if defined(__GNUC__) && __GNUC__ >= 4
873 # define CPL_CVSID(string) static const char cpl_cvsid[] __attribute__((used)) = string;
874 #else
875 # define CPL_CVSID(string) static const char cpl_cvsid[] = string; \
876 static const char *cvsid_aw() { return( cvsid_aw() ? NULL : cpl_cvsid ); }
877 #endif
878 #else
879 # define CPL_CVSID(string)
880 #endif
881 
883 /* We exclude mingw64 4.6 which seems to be broken regarding this */
884 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP) && !(defined(__MINGW64__) && __GNUC__ == 4 && __GNUC_MINOR__ == 6)
885 
886 # define CPL_NULL_TERMINATED __attribute__((__sentinel__))
887 #else
888 
889 # define CPL_NULL_TERMINATED
890 #endif
891 
892 #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(DOXYGEN_SKIP)
893 
894 #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx ) __attribute__((__format__ (__printf__, format_idx, arg_idx)))
895 
896 #define CPL_SCAN_FUNC_FORMAT( format_idx, arg_idx ) __attribute__((__format__ (__scanf__, format_idx, arg_idx)))
897 #else
898 
899 #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx )
900 
901 #define CPL_SCAN_FUNC_FORMAT( format_idx, arg_idx )
902 #endif
903 
904 #if defined(_MSC_VER) && (defined(GDAL_COMPILATION) || defined(CPL_ENABLE_MSVC_ANNOTATIONS))
905 #include <sal.h>
908 # define CPL_FORMAT_STRING(arg) _Printf_format_string_ arg
909 
911 # define CPL_SCANF_FORMAT_STRING(arg) _Scanf_format_string_ arg
912 #else
913 
914 # define CPL_FORMAT_STRING(arg) arg
915 
916 # define CPL_SCANF_FORMAT_STRING(arg) arg
917 #endif /* defined(_MSC_VER) && defined(GDAL_COMPILATION) */
918 
919 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP)
920 
921 #define CPL_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
922 #else
923 
924 #define CPL_WARN_UNUSED_RESULT
925 #endif
926 
927 #if defined(__GNUC__) && __GNUC__ >= 4
928 
929 # define CPL_UNUSED __attribute((__unused__))
930 #else
931 /* TODO: add cases for other compilers */
933 # define CPL_UNUSED
934 #endif
935 
936 #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(DOXYGEN_SKIP)
937 
938 #define CPL_NO_RETURN __attribute__((noreturn))
939 #else
940 
941 #define CPL_NO_RETURN
942 #endif
943 
945 /* Clang __has_attribute */
946 #ifndef __has_attribute
947  #define __has_attribute(x) 0 // Compatibility with non-clang compilers.
948 #endif
949 
952 #if ((defined(__GNUC__) && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9))) || __has_attribute(returns_nonnull)) && !defined(DOXYGEN_SKIP) && !defined(__INTEL_COMPILER)
953 
954 # define CPL_RETURNS_NONNULL __attribute__((returns_nonnull))
955 #else
956 
957 # define CPL_RETURNS_NONNULL
958 #endif
959 
960 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP)
961 
962 #define CPL_RESTRICT __restrict__
963 #else
964 
965 #define CPL_RESTRICT
966 #endif
967 
968 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
969 
972 # define CPL_OVERRIDE override
973 
975 # define CPL_FINAL final
976 
982 # define CPL_DISALLOW_COPY_ASSIGN(ClassName) \
983  ClassName( const ClassName & ) = delete; \
984  ClassName &operator=( const ClassName & ) = delete;
985 
986 #endif /* __cplusplus */
987 
988 #if !defined(DOXYGEN_SKIP)
989 #if defined(__has_extension)
990  #if __has_extension(attribute_deprecated_with_message)
991  /* Clang extension */
992  #define CPL_WARN_DEPRECATED(x) __attribute__ ((deprecated(x)))
993  #else
994  #define CPL_WARN_DEPRECATED(x)
995  #endif
996 #elif defined(__GNUC__)
997  #define CPL_WARN_DEPRECATED(x) __attribute__ ((deprecated))
998 #else
999  #define CPL_WARN_DEPRECATED(x)
1000 #endif
1001 #endif
1002 
1003 #if !defined(_MSC_VER) && !defined(__APPLE__) && !defined(_FORTIFY_SOURCE)
1005 # if defined(GDAL_COMPILATION) && defined(WARN_STANDARD_PRINTF)
1006 int vsnprintf(char *str, size_t size, const char* fmt, va_list args)
1007  CPL_WARN_DEPRECATED("Use CPLvsnprintf() instead");
1008 int snprintf(char *str, size_t size, const char* fmt, ...)
1010  CPL_WARN_DEPRECATED("Use CPLsnprintf() instead");
1011 int sprintf(char *str, const char* fmt, ...)
1012  CPL_PRINT_FUNC_FORMAT(2, 3)
1013  CPL_WARN_DEPRECATED("Use CPLsnprintf() instead");
1014 # elif defined(GDAL_COMPILATION) && !defined(DONT_DEPRECATE_SPRINTF)
1015 int sprintf(char *str, const char* fmt, ...)
1016  CPL_PRINT_FUNC_FORMAT(2, 3)
1017  CPL_WARN_DEPRECATED("Use snprintf() or CPLsnprintf() instead");
1018 # endif /* defined(GDAL_COMPILATION) && defined(WARN_STANDARD_PRINTF) */
1019 CPL_C_END
1020 #endif /* !defined(_MSC_VER) && !defined(__APPLE__) */
1021 
1022 #if defined(MAKE_SANITIZE_HAPPY) || !(defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64))
1023 
1024 #define CPL_CPU_REQUIRES_ALIGNED_ACCESS
1025 
1026 #endif
1027 
1028 #if defined(__cplusplus)
1029 
1030 #define CPL_ARRAYSIZE(array) \
1031  ((sizeof(array) / sizeof(*(array))) / \
1032  static_cast<size_t>(!(sizeof(array) % sizeof(*(array)))))
1033 
1034 extern "C++" {
1035 template<class T> static void CPL_IGNORE_RET_VAL(T) {}
1036 inline static bool CPL_TO_BOOL(int x) { return x != 0; }
1037 } /* extern "C++" */
1038 
1039 #endif /* __cplusplus */
1040 
1041 #if (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) || (defined(__clang__) && __clang_major__ >= 3)) && !defined(_MSC_VER))
1042 #define HAVE_GCC_DIAGNOSTIC_PUSH
1043 #endif
1044 
1045 #if ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) && !defined(_MSC_VER))
1046 #define HAVE_GCC_SYSTEM_HEADER
1047 #endif
1048 
1049 #if ((defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >=7))) || __GNUC__ >= 7)
1050 
1051 # define CPL_FALLTHROUGH [[clang::fallthrough]];
1052 #else
1053 
1054 # define CPL_FALLTHROUGH
1055 #endif
1056 
1058 // Define DEBUG_BOOL to compile in "MSVC mode", ie error out when
1059 // a integer is assigned to a bool
1060 // WARNING: use only at compilation time, since it is know to not work
1061 // at runtime for unknown reasons (crash in MongoDB driver for example)
1062 #if defined(__cplusplus) && defined(DEBUG_BOOL) && !defined(DO_NOT_USE_DEBUG_BOOL) && !defined(CPL_SUPRESS_CPLUSPLUS)
1063 extern "C++" {
1064 class MSVCPedanticBool
1065 {
1066 
1067  friend bool operator== (const bool& one, const MSVCPedanticBool& other);
1068  friend bool operator!= (const bool& one, const MSVCPedanticBool& other);
1069 
1070  bool b;
1071  MSVCPedanticBool(int bIn);
1072 
1073  public:
1074  /* b not initialized on purpose in default ctor to flag use. */
1075  /* cppcheck-suppress uninitMemberVar */
1076  MSVCPedanticBool() {}
1077  MSVCPedanticBool(bool bIn) : b(bIn) {}
1078  MSVCPedanticBool(const MSVCPedanticBool& other) : b(other.b) {}
1079 
1080  MSVCPedanticBool& operator= (const MSVCPedanticBool& other) { b = other.b; return *this; }
1081  MSVCPedanticBool& operator&= (const MSVCPedanticBool& other) { b &= other.b; return *this; }
1082  MSVCPedanticBool& operator|= (const MSVCPedanticBool& other) { b |= other.b; return *this; }
1083 
1084  bool operator== (const bool& other) const { return b == other; }
1085  bool operator!= (const bool& other) const { return b != other; }
1086  bool operator< (const bool& other) const { return b < other; }
1087  bool operator== (const MSVCPedanticBool& other) const { return b == other.b; }
1088  bool operator!= (const MSVCPedanticBool& other) const { return b != other.b; }
1089  bool operator< (const MSVCPedanticBool& other) const { return b < other.b; }
1090 
1091  bool operator! () const { return !b; }
1092  operator bool() const { return b; }
1093  operator int() const { return b; }
1094  operator GIntBig() const { return b; }
1095 };
1096 
1097 inline bool operator== (const bool& one, const MSVCPedanticBool& other) { return one == other.b; }
1098 inline bool operator!= (const bool& one, const MSVCPedanticBool& other) { return one != other.b; }
1099 
1100 /* We must include all C++ stuff before to avoid issues with templates that use bool */
1101 #include <vector>
1102 #include <map>
1103 #include <set>
1104 #include <string>
1105 #include <cstddef>
1106 #include <limits>
1107 #include <sstream>
1108 #include <fstream>
1109 #include <algorithm>
1110 #include <functional>
1111 #include <memory>
1112 #include <queue>
1113 #include <mutex>
1114 #include <unordered_map>
1115 #include <thread>
1116 #include <unordered_set>
1117 #include <complex>
1118 #include <iomanip>
1119 
1120 } /* extern C++ */
1121 
1122 #undef FALSE
1123 #define FALSE false
1124 #undef TRUE
1125 #define TRUE true
1126 
1127 /* In the very few cases we really need a "simple" type, fallback to bool */
1128 #define EMULATED_BOOL int
1129 
1130 /* Use our class instead of bool */
1131 #define bool MSVCPedanticBool
1132 
1133 /* "volatile bool" with the below substitution doesn't really work. */
1134 /* Just for the sake of the debug, we don't really need volatile */
1135 #define VOLATILE_BOOL bool
1136 
1137 #else /* defined(__cplusplus) && defined(DEBUG_BOOL) */
1138 
1139 #ifndef FALSE
1140 # define FALSE 0
1141 #endif
1142 
1143 #ifndef TRUE
1144 # define TRUE 1
1145 #endif
1146 
1147 #define EMULATED_BOOL bool
1148 #define VOLATILE_BOOL volatile bool
1149 
1150 #endif /* defined(__cplusplus) && defined(DEBUG_BOOL) */
1151 
1152 #if __clang_major__ >= 4 || (__clang_major__ == 3 && __clang_minor__ >= 8)
1153 #define CPL_NOSANITIZE_UNSIGNED_INT_OVERFLOW __attribute__((no_sanitize("unsigned-integer-overflow")))
1154 #else
1155 #define CPL_NOSANITIZE_UNSIGNED_INT_OVERFLOW
1156 #endif
1157 
1160 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
1161 #define CPL_NULLPTR nullptr
1162 #else
1163 #define CPL_NULLPTR NULL
1164 #endif
1165 
1167 /* This typedef is for C functions that take char** as argument, but */
1168 /* with the semantics of a const list. In C, char** is not implicitly cast to */
1169 /* const char* const*, contrary to C++. So when seen for C++, it is OK */
1170 /* to expose the prototyes as const char* const*, but for C we keep the */
1171 /* historical definition to avoid warnings. */
1172 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS) && !defined(DOXYGEN_SKIP)
1173 
1175 typedef const char* const* CSLConstList;
1176 #else
1177 
1179 typedef char** CSLConstList;
1180 #endif
1181 
1182 #endif /* ndef CPL_BASE_H_INCLUDED */
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:330
int GBool
Type for boolean values (alias to int)
Definition: cpl_port.h:217
int GInt32
Int32 type.
Definition: cpl_port.h:205
unsigned int GUInt32
Unsigned int32 type.
Definition: cpl_port.h:207
short GInt16
Int16 type.
Definition: cpl_port.h:211
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:215
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition: cpl_port.h:899
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:262
GIntBig GPtrDiff_t
Integer type large enough to hold the difference between 2 addresses.
Definition: cpl_port.h:279
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1179
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:244
unsigned short GUInt16
Unsigned int16 type.
Definition: cpl_port.h:213
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:332
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:241
GIntBig GInt64
Signed 64 bit integer type.
Definition: cpl_port.h:260

Generated for GDAL by doxygen 1.8.13.