GDAL
cpl_port.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id: cpl_port.h 36949 2016-12-18 16:10:12Z goatbar $
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 #ifdef __cplusplus
183 # if __cplusplus >= 201103L
184 # define HAVE_CXX11 1
185 # endif
186 /* TODO(schwehr): What are the correct tests for C++ 14 and 17? */
187 #endif /* __cplusplus */
188 
189 /*---------------------------------------------------------------------
190  * types for 16 and 32 bits integers, etc...
191  *--------------------------------------------------------------------*/
192 #if UINT_MAX == 65535
193 typedef long GInt32;
194 typedef unsigned long GUInt32;
195 #else
196 
197 typedef int GInt32;
199 typedef unsigned int GUInt32;
200 #endif
201 
203 typedef short GInt16;
205 typedef unsigned short GUInt16;
207 typedef unsigned char GByte;
208 /* hack for PDF driver and poppler >= 0.15.0 that defines incompatible "typedef bool GBool" */
209 /* in include/poppler/goo/gtypes.h */
210 #ifndef CPL_GBOOL_DEFINED
211 
212 #define CPL_GBOOL_DEFINED
213 
215 typedef int GBool;
216 #endif
217 
218 /* -------------------------------------------------------------------- */
219 /* 64bit support */
220 /* -------------------------------------------------------------------- */
221 
222 #if defined(WIN32) && defined(_MSC_VER)
223 
224 #define VSI_LARGE_API_SUPPORTED
225 typedef __int64 GIntBig;
226 typedef unsigned __int64 GUIntBig;
227 
229 #define GINTBIG_MIN ((GIntBig)(0x80000000) << 32)
230 
231 #define GINTBIG_MAX (((GIntBig)(0x7FFFFFFF) << 32) | 0xFFFFFFFFU)
232 
233 #define GUINTBIG_MAX (((GUIntBig)(0xFFFFFFFFU) << 32) | 0xFFFFFFFFU)
234 
235 #define CPL_HAS_GINT64 1
236 
238 typedef GIntBig GInt64;
240 typedef GUIntBig GUInt64;
241 
242 #define GINT64_MIN GINTBIG_MIN
243 #define GINT64_MAX GINTBIG_MAX
244 #define GUINT64_MAX GUINTBIG_MAX
245 
246 #elif HAVE_LONG_LONG
247 
250 typedef long long GIntBig;
253 typedef unsigned long long GUIntBig;
254 
256 #define GINTBIG_MIN ((GIntBig)(0x80000000) << 32)
257 
258 #define GINTBIG_MAX (((GIntBig)(0x7FFFFFFF) << 32) | 0xFFFFFFFFU)
259 
260 #define GUINTBIG_MAX (((GUIntBig)(0xFFFFFFFFU) << 32) | 0xFFFFFFFFU)
261 
263 #define CPL_HAS_GINT64 1
264 
266 /* Note: we might want to use instead int64_t / uint64_t if they are available */
267 
269 typedef GIntBig GInt64;
272 
274 #define GINT64_MIN GINTBIG_MIN
275 
276 #define GINT64_MAX GINTBIG_MAX
277 
278 #define GUINT64_MAX GUINTBIG_MAX
279 
280 #else
281 
282 // NOTE: we don't really support such platforms ! Many things might break
283 
284 typedef long GIntBig;
285 typedef unsigned long GUIntBig;
286 
287 #define GINTBIG_MIN INT_MIN
288 #define GINTBIG_MAX INT_MAX
289 #define GUINTBIG_MAX UINT_MAX
290 #endif
291 
292 #if SIZEOF_VOIDP == 8
293 
295 #else
296 
297 typedef int GPtrDiff_t;
298 #endif
299 
300 #ifdef GDAL_COMPILATION
301 #if HAVE_UINTPTR_T
302 #if !defined(_MSC_VER) || _MSC_VER > 1500
303 #include <stdint.h>
304 #endif
305 typedef uintptr_t GUIntptr_t;
306 #elif SIZEOF_VOIDP == 8
307 typedef GUIntBig GUIntptr_t;
308 #else
309 typedef unsigned int GUIntptr_t;
310 #endif
311 
312 #define CPL_IS_ALIGNED(ptr, quant) (((GUIntptr_t)(ptr) % (quant)) == 0)
313 
314 #endif
315 
316 #if defined(__MSVCRT__) || (defined(WIN32) && defined(_MSC_VER))
317  #define CPL_FRMT_GB_WITHOUT_PREFIX "I64"
318 #elif HAVE_LONG_LONG
319 
320  #define CPL_FRMT_GB_WITHOUT_PREFIX "ll"
321 #else
322  #define CPL_FRMT_GB_WITHOUT_PREFIX "l"
323 #endif
324 
326 #define CPL_FRMT_GIB "%" CPL_FRMT_GB_WITHOUT_PREFIX "d"
327 
328 #define CPL_FRMT_GUIB "%" CPL_FRMT_GB_WITHOUT_PREFIX "u"
329 
331 /* Workaround VC6 bug */
332 #if defined(_MSC_VER) && (_MSC_VER <= 1200)
333 #define GUINTBIG_TO_DOUBLE(x) (double)(GIntBig)(x)
334 #else
335 #define GUINTBIG_TO_DOUBLE(x) (double)(x)
336 #endif
337 
340 #ifdef COMPAT_WITH_ICC_CONVERSION_CHECK
341 #define CPL_INT64_FITS_ON_INT32(x) ((x) >= INT_MIN && (x) <= INT_MAX)
342 #else
343 #define CPL_INT64_FITS_ON_INT32(x) (((GIntBig)(int)(x)) == (x))
344 #endif
345 
347 /* ==================================================================== */
348 /* Other standard services. */
349 /* ==================================================================== */
350 #ifdef __cplusplus
351 
352 # define CPL_C_START extern "C" {
353 
354 # define CPL_C_END }
355 #else
356 # define CPL_C_START
357 # define CPL_C_END
358 #endif
359 
360 #ifndef CPL_DLL
361 #if defined(_MSC_VER) && !defined(CPL_DISABLE_DLL)
362 # define CPL_DLL __declspec(dllexport)
363 #else
364 # if defined(USE_GCC_VISIBILITY_FLAG)
365 # define CPL_DLL __attribute__ ((visibility("default")))
366 # else
367 # define CPL_DLL
368 # endif
369 #endif
370 #endif
371 
373 /* Should optional (normally private) interfaces be exported? */
374 #ifdef CPL_OPTIONAL_APIS
375 # define CPL_ODLL CPL_DLL
376 #else
377 # define CPL_ODLL
378 #endif
379 
381 #ifndef CPL_STDCALL
382 #if defined(_MSC_VER) && !defined(CPL_DISABLE_STDCALL)
383 # define CPL_STDCALL __stdcall
384 #else
385 # define CPL_STDCALL
386 #endif
387 #endif
388 
390 #ifdef _MSC_VER
391 # define FORCE_CDECL __cdecl
392 #else
393 # define FORCE_CDECL
394 #endif
395 
398 /* TODO : support for other compilers needed */
399 #if (defined(__GNUC__) && !defined(__NO_INLINE__)) || defined(_MSC_VER)
400 #define HAS_CPL_INLINE 1
401 #define CPL_INLINE __inline
402 #elif defined(__SUNPRO_CC)
403 #define HAS_CPL_INLINE 1
404 #define CPL_INLINE inline
405 #else
406 #define CPL_INLINE
407 #endif
408 
411 // Define NULL_AS_NULLPTR together with -std=c++11 -Wzero-as-null-pointer-constant with GCC
412 // to detect misuses of NULL
413 #if defined(NULL_AS_NULLPTR) && HAVE_CXX11
414 
415 #ifdef __GNUC__
416 // We need to include all that bunch of system headers, otherwise
417 // as they include <stddef.h> with __need_NULL, this overrides our #define NULL nullptr
418 // with #define NULL __null
419 #include <locale.h>
420 #include <unistd.h>
421 #include <sys/types.h>
422 #ifdef HAVE_ICONV
423 #include <iconv.h>
424 #endif
425 #ifdef HAVE_MMAP
426 #include <sys/mman.h>
427 #endif
428 #include <signal.h>
429 #ifndef _WIN32
430 #include <dlfcn.h>
431 #include <netdb.h>
432 #include <fcntl.h>
433 #endif
434 
435 extern "C++" {
436 #include <string>
437 #include <cstdio>
438 #include <cstdlib>
439 #include <cstring>
440 #include <cstddef>
441 #include <ostream>
442 #include <iostream>
443 #include <sstream>
444 }
445 #endif /* __GNUC__ */
446 
447 #undef NULL
448 #define NULL nullptr
449 #else /* defined(NULL_AS_NULLPTR) && HAVE_CXX11 */
450 #ifndef NULL
451 # define NULL 0
452 #endif
453 #endif /* defined(NULL_AS_NULLPTR) && HAVE_CXX11 */
454 
456 #ifndef MAX
457 
458 # define MIN(a,b) (((a)<(b)) ? (a) : (b))
459 
460 # define MAX(a,b) (((a)>(b)) ? (a) : (b))
461 #endif
462 
463 #ifndef ABS
464 
465 # define ABS(x) (((x)<0) ? (-1*(x)) : (x))
466 #endif
467 
468 #ifndef M_PI
469 
470 # define M_PI 3.14159265358979323846
471 /* 3.1415926535897932384626433832795 */
472 #endif
473 
474 /* -------------------------------------------------------------------- */
475 /* Macro to test equality of two floating point values. */
476 /* We use fabs() function instead of ABS() macro to avoid side */
477 /* effects. */
478 /* -------------------------------------------------------------------- */
480 #ifndef CPLIsEqual
481 # define CPLIsEqual(x,y) (fabs((x) - (y)) < 0.0000000000001)
482 #endif
483 
485 /* -------------------------------------------------------------------- */
486 /* Provide macros for case insensitive string comparisons. */
487 /* -------------------------------------------------------------------- */
488 #ifndef EQUAL
489 
490 #if defined(AFL_FRIENDLY) && defined(__GNUC__)
491 
492 static inline int CPL_afl_friendly_memcmp(const void* ptr1, const void* ptr2, size_t len)
493  __attribute__((always_inline));
494 
495 static inline int CPL_afl_friendly_memcmp(const void* ptr1, const void* ptr2, size_t len)
496 {
497  const unsigned char* bptr1 = (const unsigned char*)ptr1;
498  const unsigned char* bptr2 = (const unsigned char*)ptr2;
499  while( len-- )
500  {
501  unsigned char b1 = *(bptr1++);
502  unsigned char b2 = *(bptr2++);
503  if( b1 != b2 ) return b1 - b2;
504  }
505  return 0;
506 }
507 
508 static inline int CPL_afl_friendly_strcmp(const char* ptr1, const char* ptr2)
509  __attribute__((always_inline));
510 
511 static inline int CPL_afl_friendly_strcmp(const char* ptr1, const char* ptr2)
512 {
513  const unsigned char* usptr1 = (const unsigned char*)ptr1;
514  const unsigned char* usptr2 = (const unsigned char*)ptr2;
515  while( 1 )
516  {
517  unsigned char ch1 = *(usptr1++);
518  unsigned char ch2 = *(usptr2++);
519  if( ch1 == 0 || ch1 != ch2 ) return ch1 - ch2;
520  }
521 }
522 
523 static inline int CPL_afl_friendly_strncmp(const char* ptr1, const char* ptr2, size_t len)
524  __attribute__((always_inline));
525 
526 static inline int CPL_afl_friendly_strncmp(const char* ptr1, const char* ptr2, size_t len)
527 {
528  const unsigned char* usptr1 = (const unsigned char*)ptr1;
529  const unsigned char* usptr2 = (const unsigned char*)ptr2;
530  while( len -- )
531  {
532  unsigned char ch1 = *(usptr1++);
533  unsigned char ch2 = *(usptr2++);
534  if( ch1 == 0 || ch1 != ch2 ) return ch1 - ch2;
535  }
536  return 0;
537 }
538 
539 static inline int CPL_afl_friendly_strcasecmp(const char* ptr1, const char* ptr2)
540  __attribute__((always_inline));
541 
542 static inline int CPL_afl_friendly_strcasecmp(const char* ptr1, const char* ptr2)
543 {
544  const unsigned char* usptr1 = (const unsigned char*)ptr1;
545  const unsigned char* usptr2 = (const unsigned char*)ptr2;
546  while( 1 )
547  {
548  unsigned char ch1 = *(usptr1++);
549  unsigned char ch2 = *(usptr2++);
550  ch1 = (unsigned char)toupper(ch1);
551  ch2 = (unsigned char)toupper(ch2);
552  if( ch1 == 0 || ch1 != ch2 ) return ch1 - ch2;
553  }
554 }
555 
556 static inline int CPL_afl_friendly_strncasecmp(const char* ptr1, const char* ptr2, size_t len)
557  __attribute__((always_inline));
558 
559 static inline int CPL_afl_friendly_strncasecmp(const char* ptr1, const char* ptr2, size_t len)
560 {
561  const unsigned char* usptr1 = (const unsigned char*)ptr1;
562  const unsigned char* usptr2 = (const unsigned char*)ptr2;
563  while( len-- )
564  {
565  unsigned char ch1 = *(usptr1++);
566  unsigned char ch2 = *(usptr2++);
567  ch1 = (unsigned char)toupper(ch1);
568  ch2 = (unsigned char)toupper(ch2);
569  if( ch1 == 0 || ch1 != ch2 ) return ch1 - ch2;
570  }
571  return 0;
572 }
573 
574 static inline char* CPL_afl_friendly_strstr(const char* haystack, const char* needle)
575  __attribute__((always_inline));
576 
577 static inline char* CPL_afl_friendly_strstr(const char* haystack, const char* needle)
578 {
579  const char* ptr_haystack = haystack;
580  while( 1 )
581  {
582  const char* ptr_haystack2 = ptr_haystack;
583  const char* ptr_needle = needle;
584  while( 1 )
585  {
586  char ch1 = *(ptr_haystack2++);
587  char ch2 = *(ptr_needle++);
588  if( ch2 == 0 )
589  return (char*)ptr_haystack;
590  if( ch1 != ch2 )
591  break;
592  }
593  if( *ptr_haystack == 0 )
594  return NULL;
595  ptr_haystack ++;
596  }
597 }
598 
599 #undef strcmp
600 #undef strncmp
601 #define memcmp CPL_afl_friendly_memcmp
602 #define strcmp CPL_afl_friendly_strcmp
603 #define strncmp CPL_afl_friendly_strncmp
604 #define strcasecmp CPL_afl_friendly_strcasecmp
605 #define strncasecmp CPL_afl_friendly_strncasecmp
606 #define strstr CPL_afl_friendly_strstr
607 
608 #endif /* defined(AFL_FRIENDLY) && defined(__GNUC__) */
609 
610 # if defined(WIN32)
611 # define STRCASECMP(a,b) (stricmp(a,b))
612 # define STRNCASECMP(a,b,n) (strnicmp(a,b,n))
613 # else
614 
615 # define STRCASECMP(a,b) (strcasecmp(a,b))
616 
617 # define STRNCASECMP(a,b,n) (strncasecmp(a,b,n))
618 # endif
619 
620 # define EQUALN(a,b,n) (STRNCASECMP(a,b,n)==0)
621 
622 # define EQUAL(a,b) (STRCASECMP(a,b)==0)
623 #endif
624 
625 /*---------------------------------------------------------------------
626  * Does a string "a" start with string "b". Search is case-sensitive or,
627  * with CI, it is a case-insensitive comparison.
628  *--------------------------------------------------------------------- */
629 #ifndef STARTS_WITH_CI
630 
631 #define STARTS_WITH(a,b) (strncmp(a,b,strlen(b)) == 0)
632 
633 #define STARTS_WITH_CI(a,b) EQUALN(a,b,strlen(b))
634 #endif
635 
637 #ifndef CPL_THREADLOCAL
638 # define CPL_THREADLOCAL
639 #endif
640 
642 /* -------------------------------------------------------------------- */
643 /* Handle isnan() and isinf(). Note that isinf() and isnan() */
644 /* are supposed to be macros according to C99, defined in math.h */
645 /* Some systems (i.e. Tru64) don't have isinf() at all, so if */
646 /* the macro is not defined we just assume nothing is infinite. */
647 /* This may mean we have no real CPLIsInf() on systems with isinf()*/
648 /* function but no corresponding macro, but I can live with */
649 /* that since it isn't that important a test. */
650 /* -------------------------------------------------------------------- */
651 #ifdef _MSC_VER
652 # include <float.h>
653 # define CPLIsNan(x) _isnan(x)
654 # define CPLIsInf(x) (!_isnan(x) && !_finite(x))
655 # define CPLIsFinite(x) _finite(x)
656 #elif defined(__cplusplus) && defined(__MINGW32__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2
657 /* Hack for compatibility with ancient i586-mingw32msvc toolchain */
658 extern "C++" {
659 #include <cmath>
660 static inline int CPLIsNan(float f) { return std::isnan(f); }
661 static inline int CPLIsNan(double f) { return std::isnan(f); }
662 static inline int CPLIsInf(float f) { return std::isinf(f); }
663 static inline int CPLIsInf(double f) { return std::isinf(f); }
664 static inline int CPLIsFinite(float f) { return std::isfinite(f); }
665 static inline int CPLIsFinite(double f) { return std::isfinite(f); }
666 }
667 #elif defined(__GNUC__) && ( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 4 ) )
668 /* When including <cmath> in C++11 the isnan() macro is undefined, so that */
669 /* std::isnan() can work (#6489). This is a GCC specific workaround for now. */
670 # define CPLIsNan(x) __builtin_isnan(x)
671 # define CPLIsInf(x) __builtin_isinf(x)
672 # define CPLIsFinite(x) __builtin_isfinite(x)
673 #else
674 
675 #if defined(__cplusplus) && defined(__GNUC__) && defined(__linux) && !defined(__ANDROID__)
676 /* so to not get warning about conversion from double to float with */
677 /* gcc -Wfloat-conversion when using isnan()/isinf() macros */
678 extern "C++" {
679 static inline int CPLIsNan(float f) { return __isnanf(f); }
680 static inline int CPLIsNan(double f) { return __isnan(f); }
681 static inline int CPLIsInf(float f) { return __isinff(f); }
682 static inline int CPLIsInf(double f) { return __isinf(f); }
683 static inline int CPLIsFinite(float f) { return !__isnanf(f) && !__isinff(f); }
684 static inline int CPLIsFinite(double f) { return !__isnan(f) && !__isinf(f); }
685 }
686 #else
687 # define CPLIsNan(x) isnan(x)
688 # if defined(isinf) || defined(__FreeBSD__)
689 
690 # define CPLIsInf(x) isinf(x)
691 
692 # define CPLIsFinite(x) (!isnan(x) && !isinf(x))
693 # elif defined(__sun__)
694 # include <ieeefp.h>
695 # define CPLIsInf(x) (!finite(x) && !isnan(x))
696 # define CPLIsFinite(x) finite(x)
697 # else
698 # define CPLIsInf(x) (0)
699 # define CPLIsFinite(x) (!isnan(x))
700 # endif
701 #endif
702 #endif
703 
705 /*---------------------------------------------------------------------
706  * CPL_LSB and CPL_MSB
707  * Only one of these 2 macros should be defined and specifies the byte
708  * ordering for the current platform.
709  * This should be defined in the Makefile, but if it is not then
710  * the default is CPL_LSB (Intel ordering, LSB first).
711  *--------------------------------------------------------------------*/
712 #if defined(WORDS_BIGENDIAN) && !defined(CPL_MSB) && !defined(CPL_LSB)
713 # define CPL_MSB
714 #endif
715 
716 #if ! ( defined(CPL_LSB) || defined(CPL_MSB) )
717 #define CPL_LSB
718 #endif
719 
720 #if defined(CPL_LSB)
721 # define CPL_IS_LSB 1
722 #else
723 # define CPL_IS_LSB 0
724 #endif
725 
727 #ifdef __cplusplus
728 
730 extern "C++" {
731 
732 template <bool b> struct CPLStaticAssert {};
733 template<> struct CPLStaticAssert<true>
734 {
735  static void my_function() {}
736 };
737 
738 } /* extern "C++" */
739 
740 #define CPL_STATIC_ASSERT(x) CPLStaticAssert<x>::my_function()
741 #define CPL_STATIC_ASSERT_IF_AVAILABLE(x) CPL_STATIC_ASSERT(x)
742 
743 #else /* __cplusplus */
744 
745 #define CPL_STATIC_ASSERT_IF_AVAILABLE(x)
746 
747 #endif /* __cplusplus */
748 
750 /*---------------------------------------------------------------------
751  * Little endian <==> big endian byte swap macros.
752  *--------------------------------------------------------------------*/
753 
755 #define CPL_SWAP16(x) ((GUInt16)( ((GUInt16)(x) << 8) | ((GUInt16)(x) >> 8) ))
756 
757 #if defined(HAVE_GCC_BSWAP) && (defined(__i386__) || defined(__x86_64__))
758 /* Could potentially be extended to other architectures but must be checked */
759 /* that the intrinsic is indeed efficient */
760 /* GCC (at least 4.6 or above) need that include */
761 #include <x86intrin.h>
763 #define CPL_SWAP32(x) ((GUInt32)(__builtin_bswap32((GUInt32)(x))))
764 
765 #define CPL_SWAP64(x) ((GUInt64)(__builtin_bswap64((GUInt64)(x))))
766 #elif defined(_MSC_VER)
767 #define CPL_SWAP32(x) ((GUInt32)(_byteswap_ulong((GUInt32)(x))))
768 #define CPL_SWAP64(x) ((GUInt64)(_byteswap_uint64((GUInt64)(x))))
769 #else
770 
771 #define CPL_SWAP32(x) \
772  ((GUInt32)( \
773  (((GUInt32)(x) & (GUInt32)0x000000ffUL) << 24) | \
774  (((GUInt32)(x) & (GUInt32)0x0000ff00UL) << 8) | \
775  (((GUInt32)(x) & (GUInt32)0x00ff0000UL) >> 8) | \
776  (((GUInt32)(x) & (GUInt32)0xff000000UL) >> 24) ))
777 
779 #define CPL_SWAP64(x) \
780  (((GUInt64)(CPL_SWAP32((GUInt32)(x))) << 32) | \
781  (GUInt64)(CPL_SWAP32((GUInt32)((GUInt64)(x) >> 32))))
782 
783 #endif
784 
786 #define CPL_SWAP16PTR(x) \
787 { \
788  GByte byTemp, *_pabyDataT = (GByte *) (x); \
789  CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2); \
790  \
791  byTemp = _pabyDataT[0]; \
792  _pabyDataT[0] = _pabyDataT[1]; \
793  _pabyDataT[1] = byTemp; \
794 }
795 
796 #if defined(MAKE_SANITIZE_HAPPY) || !(defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64))
797 
799 #define CPL_SWAP32PTR(x) \
800 { \
801  GByte byTemp, *_pabyDataT = (GByte *) (x); \
802  CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4); \
803  \
804  byTemp = _pabyDataT[0]; \
805  _pabyDataT[0] = _pabyDataT[3]; \
806  _pabyDataT[3] = byTemp; \
807  byTemp = _pabyDataT[1]; \
808  _pabyDataT[1] = _pabyDataT[2]; \
809  _pabyDataT[2] = byTemp; \
810 }
811 
813 #define CPL_SWAP64PTR(x) \
814 { \
815  GByte byTemp, *_pabyDataT = (GByte *) (x); \
816  CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8); \
817  \
818  byTemp = _pabyDataT[0]; \
819  _pabyDataT[0] = _pabyDataT[7]; \
820  _pabyDataT[7] = byTemp; \
821  byTemp = _pabyDataT[1]; \
822  _pabyDataT[1] = _pabyDataT[6]; \
823  _pabyDataT[6] = byTemp; \
824  byTemp = _pabyDataT[2]; \
825  _pabyDataT[2] = _pabyDataT[5]; \
826  _pabyDataT[5] = byTemp; \
827  byTemp = _pabyDataT[3]; \
828  _pabyDataT[3] = _pabyDataT[4]; \
829  _pabyDataT[4] = byTemp; \
830 }
831 
832 #else
833 
835 #define CPL_SWAP32PTR(x) \
836 { \
837  GUInt32 *_pn32ptr = (GUInt32 *) (x); \
838  CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4); \
839  *_pn32ptr = CPL_SWAP32(*_pn32ptr); \
840 }
841 
843 #define CPL_SWAP64PTR(x) \
844 { \
845  GUInt64 *_pn64ptr = (GUInt64 *) (x); \
846  CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8); \
847  *_pn64ptr = CPL_SWAP64(*_pn64ptr); \
848 }
849 
850 #endif
851 
853 #define CPL_SWAPDOUBLE(p) CPL_SWAP64PTR(p)
854 
855 #ifdef CPL_MSB
856 # define CPL_MSBWORD16(x) (x)
857 # define CPL_LSBWORD16(x) CPL_SWAP16(x)
858 # define CPL_MSBWORD32(x) (x)
859 # define CPL_LSBWORD32(x) CPL_SWAP32(x)
860 # define CPL_MSBPTR16(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2)
861 # define CPL_LSBPTR16(x) CPL_SWAP16PTR(x)
862 # define CPL_MSBPTR32(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4)
863 # define CPL_LSBPTR32(x) CPL_SWAP32PTR(x)
864 # define CPL_MSBPTR64(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8)
865 # define CPL_LSBPTR64(x) CPL_SWAP64PTR(x)
866 #else
867 
868 # define CPL_LSBWORD16(x) (x)
869 
870 # define CPL_MSBWORD16(x) CPL_SWAP16(x)
871 
872 # define CPL_LSBWORD32(x) (x)
873 
874 # define CPL_MSBWORD32(x) CPL_SWAP32(x)
875 
876 # define CPL_LSBPTR16(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2)
877 
878 # define CPL_MSBPTR16(x) CPL_SWAP16PTR(x)
879 
880 # define CPL_LSBPTR32(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4)
881 
882 # define CPL_MSBPTR32(x) CPL_SWAP32PTR(x)
883 
884 # define CPL_LSBPTR64(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8)
885 
886 # define CPL_MSBPTR64(x) CPL_SWAP64PTR(x)
887 #endif
888 
892 #define CPL_LSBINT16PTR(x) ((*(GByte*)(x)) | (*(((GByte*)(x))+1) << 8))
893 
897 #define CPL_LSBINT32PTR(x) ((*(GByte*)(x)) | (*(((GByte*)(x))+1) << 8) | \
898  (*(((GByte*)(x))+2) << 16) | (*(((GByte*)(x))+3) << 24))
899 
901 #define CPL_LSBSINT16PTR(x) ((GInt16) CPL_LSBINT16PTR(x))
902 
904 #define CPL_LSBUINT16PTR(x) ((GUInt16)CPL_LSBINT16PTR(x))
905 
907 #define CPL_LSBSINT32PTR(x) ((GInt32) CPL_LSBINT32PTR(x))
908 
910 #define CPL_LSBUINT32PTR(x) ((GUInt32)CPL_LSBINT32PTR(x))
911 
913 /* Utility macro to explicitly mark intentionally unreferenced parameters. */
914 #ifndef UNREFERENCED_PARAM
915 # ifdef UNREFERENCED_PARAMETER /* May be defined by Windows API */
916 # define UNREFERENCED_PARAM(param) UNREFERENCED_PARAMETER(param)
917 # else
918 # define UNREFERENCED_PARAM(param) ((void)param)
919 # endif /* UNREFERENCED_PARAMETER */
920 #endif /* UNREFERENCED_PARAM */
921 
923 /***********************************************************************
924  * Define CPL_CVSID() macro. It can be disabled during a build by
925  * defining DISABLE_CVSID in the compiler options.
926  *
927  * The cvsid_aw() function is just there to prevent reports of cpl_cvsid()
928  * being unused.
929  */
930 
932 #ifndef DISABLE_CVSID
933 #if defined(__GNUC__) && __GNUC__ >= 4
934 # define CPL_CVSID(string) static const char cpl_cvsid[] __attribute__((used)) = string;
935 #else
936 # define CPL_CVSID(string) static const char cpl_cvsid[] = string; \
937 static const char *cvsid_aw() { return( cvsid_aw() ? NULL : cpl_cvsid ); }
938 #endif
939 #else
940 # define CPL_CVSID(string)
941 #endif
942 
944 /* We exclude mingw64 4.6 which seems to be broken regarding this */
945 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP) && !(defined(__MINGW64__) && __GNUC__ == 4 && __GNUC_MINOR__ == 6)
946 
947 # define CPL_NULL_TERMINATED __attribute__((__sentinel__))
948 #else
949 
950 # define CPL_NULL_TERMINATED
951 #endif
952 
953 #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(DOXYGEN_SKIP)
954 
955 #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx ) __attribute__((__format__ (__printf__, format_idx, arg_idx)))
956 
957 #define CPL_SCAN_FUNC_FORMAT( format_idx, arg_idx ) __attribute__((__format__ (__scanf__, format_idx, arg_idx)))
958 #else
959 
960 #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx )
961 
962 #define CPL_SCAN_FUNC_FORMAT( format_idx, arg_idx )
963 #endif
964 
965 #if defined(_MSC_VER) && _MSC_VER >= 1400 && (defined(GDAL_COMPILATION) || defined(CPL_ENABLE_MSVC_ANNOTATIONS))
966 #include <sal.h>
967 # if _MSC_VER > 1400
968 
970 # define CPL_FORMAT_STRING(arg) _Printf_format_string_ arg
971 
973 # define CPL_SCANF_FORMAT_STRING(arg) _Scanf_format_string_ arg
974 # else
975 
976 # define CPL_FORMAT_STRING(arg) __format_string arg
977 
978 # define CPL_SCANF_FORMAT_STRING(arg) arg
979 # endif
980 #else
981 
982 # define CPL_FORMAT_STRING(arg) arg
983 
984 # define CPL_SCANF_FORMAT_STRING(arg) arg
985 #endif /* defined(_MSC_VER) && _MSC_VER >= 1400 && defined(GDAL_COMPILATION) */
986 
987 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP)
988 
989 #define CPL_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
990 #else
991 
992 #define CPL_WARN_UNUSED_RESULT
993 #endif
994 
995 #if defined(__GNUC__) && __GNUC__ >= 4
996 
997 # define CPL_UNUSED __attribute((__unused__))
998 #else
999 /* TODO: add cases for other compilers */
1001 # define CPL_UNUSED
1002 #endif
1003 
1004 #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(DOXYGEN_SKIP)
1005 
1006 #define CPL_NO_RETURN __attribute__((noreturn))
1007 #else
1008 
1009 #define CPL_NO_RETURN
1010 #endif
1011 
1013 /* Clang __has_attribute */
1014 #ifndef __has_attribute
1015  #define __has_attribute(x) 0 // Compatibility with non-clang compilers.
1016 #endif
1017 
1020 #if ((defined(__GNUC__) && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9))) || __has_attribute(returns_nonnull)) && !defined(DOXYGEN_SKIP) && !defined(__INTEL_COMPILER)
1021 
1022 # define CPL_RETURNS_NONNULL __attribute__((returns_nonnull))
1023 #else
1024 
1025 # define CPL_RETURNS_NONNULL
1026 #endif
1027 
1028 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP)
1029 
1030 #define CPL_RESTRICT __restrict__
1031 #else
1032 
1033 #define CPL_RESTRICT
1034 #endif
1035 
1036 #ifdef __cplusplus
1037 
1038 #if HAVE_CXX11 || _MSC_VER >= 1500
1039 
1042 # define CPL_OVERRIDE override
1043 
1044 #else
1045 
1048 # define CPL_OVERRIDE
1049 
1050 /* For GDAL source compilation only, ignore override if non C++11 compiler */
1051 #ifdef GDAL_COMPILATION
1052 # define override
1053 #endif
1054 
1055 #endif /* HAVE_CXX11 || _MSC_VER >= 1500 */
1056 
1057 #if HAVE_CXX11
1058 
1059 # define CPL_FINAL final
1060 
1066 # define CPL_DISALLOW_COPY_ASSIGN(ClassName) \
1067  ClassName( const ClassName & ) = delete; \
1068  ClassName &operator=( const ClassName & ) = delete;
1069 #else
1070 
1071 # define CPL_FINAL
1072 
1078 # define CPL_DISALLOW_COPY_ASSIGN(ClassName) \
1079  ClassName( const ClassName & ); \
1080  ClassName &operator=( const ClassName & );
1081 #endif /* HAVE_CXX11 */
1082 
1083 #endif /* __cplusplus */
1084 
1085 #if !defined(DOXYGEN_SKIP)
1086 #if defined(__has_extension)
1087  #if __has_extension(attribute_deprecated_with_message)
1088  /* Clang extension */
1089  #define CPL_WARN_DEPRECATED(x) __attribute__ ((deprecated(x)))
1090  #else
1091  #define CPL_WARN_DEPRECATED(x)
1092  #endif
1093 #elif defined(__GNUC__)
1094  #define CPL_WARN_DEPRECATED(x) __attribute__ ((deprecated))
1095 #else
1096  #define CPL_WARN_DEPRECATED(x)
1097 #endif
1098 #endif
1099 
1100 #if !defined(_MSC_VER) && !defined(__APPLE__) && !defined(_FORTIFY_SOURCE)
1102 # if defined(GDAL_COMPILATION) && defined(WARN_STANDARD_PRINTF)
1103 int vsnprintf(char *str, size_t size, const char* fmt, va_list args)
1104  CPL_WARN_DEPRECATED("Use CPLvsnprintf() instead");
1105 int snprintf(char *str, size_t size, const char* fmt, ...)
1107  CPL_WARN_DEPRECATED("Use CPLsnprintf() instead");
1108 int sprintf(char *str, const char* fmt, ...)
1109  CPL_PRINT_FUNC_FORMAT(2, 3)
1110  CPL_WARN_DEPRECATED("Use CPLsnprintf() instead");
1111 # elif defined(GDAL_COMPILATION) && !defined(DONT_DEPRECATE_SPRINTF)
1112 int sprintf(char *str, const char* fmt, ...)
1113  CPL_PRINT_FUNC_FORMAT(2, 3)
1114  CPL_WARN_DEPRECATED("Use snprintf() or CPLsnprintf() instead");
1115 # endif /* defined(GDAL_COMPILATION) && defined(WARN_STANDARD_PRINTF) */
1116 CPL_C_END
1117 #endif /* !defined(_MSC_VER) && !defined(__APPLE__) */
1118 
1119 #if defined(MAKE_SANITIZE_HAPPY) || !(defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64))
1120 
1121 #define CPL_CPU_REQUIRES_ALIGNED_ACCESS
1122 
1124 #define CPL_IS_DOUBLE_A_INT(d) ( (d) >= INT_MIN && (d) <= INT_MAX && (double)(int)(d) == (d) )
1125 #else
1126 /* This is technically unspecified behaviour if the double is out of range, but works OK on x86 */
1128 #define CPL_IS_DOUBLE_A_INT(d) ( (double)(int)(d) == (d) )
1129 #endif
1130 
1131 #ifdef __cplusplus
1132 
1133 #define CPL_ARRAYSIZE(array) \
1134  ((sizeof(array) / sizeof(*(array))) / \
1135  static_cast<size_t>(!(sizeof(array) % sizeof(*(array)))))
1136 
1137 extern "C++" {
1138 template<class T> static void CPL_IGNORE_RET_VAL(T) {}
1139 inline static bool CPL_TO_BOOL(int x) { return x != 0; }
1140 } /* extern "C++" */
1141 
1142 #endif /* __cplusplus */
1143 
1144 #if (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) || (defined(__clang__) && __clang_major__ >= 3)) && !defined(_MSC_VER))
1145 #define HAVE_GCC_DIAGNOSTIC_PUSH
1146 #endif
1147 
1148 #if ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) && !defined(_MSC_VER))
1149 #define HAVE_GCC_SYSTEM_HEADER
1150 #endif
1151 
1152 #if ((defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >=7))) || __GNUC__ >= 7) && HAVE_CXX11
1153 
1154 # define CPL_FALLTHROUGH [[clang::fallthrough]];
1155 #else
1156 
1157 # define CPL_FALLTHROUGH
1158 #endif
1159 
1161 // Define DEBUG_BOOL to compile in "MSVC mode", ie error out when
1162 // a integer is assigned to a bool
1163 // WARNING: use only at compilation time, since it is know to not work
1164 // at runtime for unknown reasons (crash in MongoDB driver for example)
1165 #if defined(__cplusplus) && defined(DEBUG_BOOL) && !defined(DO_NOT_USE_DEBUG_BOOL)
1166 extern "C++" {
1167 class MSVCPedanticBool
1168 {
1169 
1170  friend bool operator== (const bool& one, const MSVCPedanticBool& other);
1171  friend bool operator!= (const bool& one, const MSVCPedanticBool& other);
1172 
1173  bool b;
1174  MSVCPedanticBool(int bIn);
1175 
1176  public:
1177  /* b not initialized on purpose in default ctor to flag use. */
1178  /* cppcheck-suppress uninitMemberVar */
1179  MSVCPedanticBool() {}
1180  MSVCPedanticBool(bool bIn) : b(bIn) {}
1181  MSVCPedanticBool(const MSVCPedanticBool& other) : b(other.b) {}
1182 
1183  MSVCPedanticBool& operator= (const MSVCPedanticBool& other) { b = other.b; return *this; }
1184  MSVCPedanticBool& operator&= (const MSVCPedanticBool& other) { b &= other.b; return *this; }
1185  MSVCPedanticBool& operator|= (const MSVCPedanticBool& other) { b |= other.b; return *this; }
1186 
1187  bool operator== (const bool& other) const { return b == other; }
1188  bool operator!= (const bool& other) const { return b != other; }
1189  bool operator== (const MSVCPedanticBool& other) const { return b == other.b; }
1190  bool operator!= (const MSVCPedanticBool& other) const { return b != other.b; }
1191 
1192  bool operator! () const { return !b; }
1193  operator bool() const { return b; }
1194  operator int() const { return b; }
1195 };
1196 
1197 inline bool operator== (const bool& one, const MSVCPedanticBool& other) { return one == other.b; }
1198 inline bool operator!= (const bool& one, const MSVCPedanticBool& other) { return one != other.b; }
1199 
1200 /* We must include all C++ stuff before to avoid issues with templates that use bool */
1201 #include <vector>
1202 #include <map>
1203 #include <set>
1204 #include <string>
1205 #include <cstddef>
1206 #include <limits>
1207 #include <sstream>
1208 #include <fstream>
1209 #include <algorithm>
1210 
1211 } /* extern C++ */
1212 
1213 #undef FALSE
1214 #define FALSE false
1215 #undef TRUE
1216 #define TRUE true
1217 
1218 /* In the very few cases we really need a "simple" type, fallback to bool */
1219 #define EMULATED_BOOL int
1220 
1221 /* Use our class instead of bool */
1222 #define bool MSVCPedanticBool
1223 
1224 /* "volatile bool" with the below substitution doesn't really work. */
1225 /* Just for the sake of the debug, we don't really need volatile */
1226 #define VOLATILE_BOOL bool
1227 
1228 #else /* defined(__cplusplus) && defined(DEBUG_BOOL) */
1229 
1230 #ifndef FALSE
1231 # define FALSE 0
1232 #endif
1233 
1234 #ifndef TRUE
1235 # define TRUE 1
1236 #endif
1237 
1238 #define EMULATED_BOOL bool
1239 #define VOLATILE_BOOL volatile bool
1240 
1241 #endif /* defined(__cplusplus) && defined(DEBUG_BOOL) */
1242 
1244 #endif /* ndef CPL_BASE_H_INCLUDED */
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:352
int GBool
Type for boolean values (alias to int)
Definition: cpl_port.h:215
int GInt32
Int32 type.
Definition: cpl_port.h:197
unsigned int GUInt32
Unsigned int32 type.
Definition: cpl_port.h:199
short GInt16
Int16 type.
Definition: cpl_port.h:203
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:207
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition: cpl_port.h:960
#define CPLIsNan(x)
Return whether a floating-pointer number is NaN.
Definition: cpl_port.h:687
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:271
GIntBig GPtrDiff_t
Integer type large enough to hold the difference between 2 addresses.
Definition: cpl_port.h:294
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:253
unsigned short GUInt16
Unsigned int16 type.
Definition: cpl_port.h:205
#define CPLIsInf(x)
Return whether a floating-pointer number is +/- infinty.
Definition: cpl_port.h:690
int CPLsnprintf(char *str, size_t size, const char *fmt,...)
snprintf() wrapper that is not sensitive to LC_NUMERIC settings.
Definition: cpl_string.cpp:1327
#define CPLIsFinite(x)
Return whether a floating-pointer number is finite.
Definition: cpl_port.h:692
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:354
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:250
GIntBig GInt64
Signed 64 bit integer type.
Definition: cpl_port.h:269

Generated for GDAL by doxygen 1.8.8.