GDAL

- Main Page
- Related Pages
- Classes
- Files
- Download
- Issue Tracker

- File List
- File Members

cpl_port.h
Go to the documentation of this file.
1 /******************************************************************************
2 * $Id: cpl_port.h 38142 2017-04-26 11:31:46Z rouault $
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;
271 typedef GUIntBig GUInt64;
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
294 typedef GIntBig GPtrDiff_t;
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(HAVE_STD_IS_NAN) && HAVE_STD_IS_NAN
657 extern "C++" {
658 #ifndef DOXYGEN_SKIP
659 #include <cmath>
660 #endif
661 static inline int CPLIsNan(float f) { return std::isnan(f); }
662 static inline int CPLIsNan(double f) { return std::isnan(f); }
663 static inline int CPLIsInf(float f) { return std::isinf(f); }
664 static inline int CPLIsInf(double f) { return std::isinf(f); }
665 static inline int CPLIsFinite(float f) { return std::isfinite(f); }
666 static inline int CPLIsFinite(double f) { return std::isfinite(f); }
667 }
668 #elif defined(__GNUC__) && ( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 4 ) )
669 /* When including <cmath> in C++11 the isnan() macro is undefined, so that */
670 /* std::isnan() can work (#6489). This is a GCC specific workaround for now. */
671 # define CPLIsNan(x) __builtin_isnan(x)
672 # define CPLIsInf(x) __builtin_isinf(x)
673 # define CPLIsFinite(x) __builtin_isfinite(x)
674 #else
675
676 #if defined(__cplusplus) && defined(__GNUC__) && defined(__linux) && !defined(__ANDROID__)
677 /* so to not get warning about conversion from double to float with */
678 /* gcc -Wfloat-conversion when using isnan()/isinf() macros */
679 extern "C++" {
680 static inline int CPLIsNan(float f) { return __isnanf(f); }
681 static inline int CPLIsNan(double f) { return __isnan(f); }
682 static inline int CPLIsInf(float f) { return __isinff(f); }
683 static inline int CPLIsInf(double f) { return __isinf(f); }
684 static inline int CPLIsFinite(float f) { return !__isnanf(f) && !__isinff(f); }
685 static inline int CPLIsFinite(double f) { return !__isnan(f) && !__isinf(f); }
686 }
687 #else
688 # define CPLIsNan(x) isnan(x)
689 # if defined(isinf) || defined(__FreeBSD__)
690
691 # define CPLIsInf(x) isinf(x)
692
693 # define CPLIsFinite(x) (!isnan(x) && !isinf(x))
694 # elif defined(__sun__)
695 # include <ieeefp.h>
696 # define CPLIsInf(x) (!finite(x) && !isnan(x))
697 # define CPLIsFinite(x) finite(x)
698 # else
699 # define CPLIsInf(x) (0)
700 # define CPLIsFinite(x) (!isnan(x))
701 # endif
702 #endif
703 #endif
704
706 /*---------------------------------------------------------------------
707 * CPL_LSB and CPL_MSB
708 * Only one of these 2 macros should be defined and specifies the byte
709 * ordering for the current platform.
710 * This should be defined in the Makefile, but if it is not then
711 * the default is CPL_LSB (Intel ordering, LSB first).
712 *--------------------------------------------------------------------*/
713 #if defined(WORDS_BIGENDIAN) && !defined(CPL_MSB) && !defined(CPL_LSB)
714 # define CPL_MSB
715 #endif
716
717 #if ! ( defined(CPL_LSB) || defined(CPL_MSB) )
718 #define CPL_LSB
719 #endif
720
721 #if defined(CPL_LSB)
722 # define CPL_IS_LSB 1
723 #else
724 # define CPL_IS_LSB 0
725 #endif
726
728 #ifdef __cplusplus
729
731 extern "C++" {
732
733 template <bool b> struct CPLStaticAssert {};
734 template<> struct CPLStaticAssert<true>
735 {
736 static void my_function() {}
737 };
738
739 } /* extern "C++" */
740
741 #define CPL_STATIC_ASSERT(x) CPLStaticAssert<x>::my_function()
742 #define CPL_STATIC_ASSERT_IF_AVAILABLE(x) CPL_STATIC_ASSERT(x)
743
744 #else /* __cplusplus */
745
746 #define CPL_STATIC_ASSERT_IF_AVAILABLE(x)
747
748 #endif /* __cplusplus */
749
751 /*---------------------------------------------------------------------
752 * Little endian <==> big endian byte swap macros.
753 *--------------------------------------------------------------------*/
754
756 #define CPL_SWAP16(x) ((GUInt16)( ((GUInt16)(x) << 8) | ((GUInt16)(x) >> 8) ))
757
758 #if defined(HAVE_GCC_BSWAP) && (defined(__i386__) || defined(__x86_64__))
759 /* Could potentially be extended to other architectures but must be checked */
760 /* that the intrinsic is indeed efficient */
761 /* GCC (at least 4.6 or above) need that include */
762 #include <x86intrin.h>
764 #define CPL_SWAP32(x) ((GUInt32)(__builtin_bswap32((GUInt32)(x))))
765
766 #define CPL_SWAP64(x) ((GUInt64)(__builtin_bswap64((GUInt64)(x))))
767 #elif defined(_MSC_VER)
768 #define CPL_SWAP32(x) ((GUInt32)(_byteswap_ulong((GUInt32)(x))))
769 #define CPL_SWAP64(x) ((GUInt64)(_byteswap_uint64((GUInt64)(x))))
770 #else
771
772 #define CPL_SWAP32(x) \
773 ((GUInt32)( \
774 (((GUInt32)(x) & (GUInt32)0x000000ffUL) << 24) | \
775 (((GUInt32)(x) & (GUInt32)0x0000ff00UL) << 8) | \
776 (((GUInt32)(x) & (GUInt32)0x00ff0000UL) >> 8) | \
777 (((GUInt32)(x) & (GUInt32)0xff000000UL) >> 24) ))
778
780 #define CPL_SWAP64(x) \
781 (((GUInt64)(CPL_SWAP32((GUInt32)(x))) << 32) | \
782 (GUInt64)(CPL_SWAP32((GUInt32)((GUInt64)(x) >> 32))))
783
784 #endif
785
787 #define CPL_SWAP16PTR(x) \
788 { \
789 GByte byTemp, *_pabyDataT = (GByte *) (x); \
790 CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2); \
791 \
792 byTemp = _pabyDataT[0]; \
793 _pabyDataT[0] = _pabyDataT[1]; \
794 _pabyDataT[1] = byTemp; \
795 }
796
797 #if defined(MAKE_SANITIZE_HAPPY) || !(defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64))
798
800 #define CPL_SWAP32PTR(x) \
801 { \
802 GByte byTemp, *_pabyDataT = (GByte *) (x); \
803 CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4); \
804 \
805 byTemp = _pabyDataT[0]; \
806 _pabyDataT[0] = _pabyDataT[3]; \
807 _pabyDataT[3] = byTemp; \
808 byTemp = _pabyDataT[1]; \
809 _pabyDataT[1] = _pabyDataT[2]; \
810 _pabyDataT[2] = byTemp; \
811 }
812
814 #define CPL_SWAP64PTR(x) \
815 { \
816 GByte byTemp, *_pabyDataT = (GByte *) (x); \
817 CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8); \
818 \
819 byTemp = _pabyDataT[0]; \
820 _pabyDataT[0] = _pabyDataT[7]; \
821 _pabyDataT[7] = byTemp; \
822 byTemp = _pabyDataT[1]; \
823 _pabyDataT[1] = _pabyDataT[6]; \
824 _pabyDataT[6] = byTemp; \
825 byTemp = _pabyDataT[2]; \
826 _pabyDataT[2] = _pabyDataT[5]; \
827 _pabyDataT[5] = byTemp; \
828 byTemp = _pabyDataT[3]; \
829 _pabyDataT[3] = _pabyDataT[4]; \
830 _pabyDataT[4] = byTemp; \
831 }
832
833 #else
834
836 #define CPL_SWAP32PTR(x) \
837 { \
838 GUInt32 _n32; \
839 void* _lx = x; \
840 memcpy(&_n32, _lx, 4); \
841 CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4); \
842 _n32 = CPL_SWAP32(_n32); \
843 memcpy(_lx, &_n32, 4); \
844 }
845
847 #define CPL_SWAP64PTR(x) \
848 { \
849 GUInt64 _n64; \
850 void* _lx = x; \
851 memcpy(&_n64, _lx, 8); \
852 CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8); \
853 _n64 = CPL_SWAP64(_n64); \
854 memcpy(_lx, &_n64, 8); \
855 }
856
857 #endif
858
860 #define CPL_SWAPDOUBLE(p) CPL_SWAP64PTR(p)
861
862 #ifdef CPL_MSB
863 # define CPL_MSBWORD16(x) (x)
864 # define CPL_LSBWORD16(x) CPL_SWAP16(x)
865 # define CPL_MSBWORD32(x) (x)
866 # define CPL_LSBWORD32(x) CPL_SWAP32(x)
867 # define CPL_MSBPTR16(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2)
868 # define CPL_LSBPTR16(x) CPL_SWAP16PTR(x)
869 # define CPL_MSBPTR32(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4)
870 # define CPL_LSBPTR32(x) CPL_SWAP32PTR(x)
871 # define CPL_MSBPTR64(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8)
872 # define CPL_LSBPTR64(x) CPL_SWAP64PTR(x)
873 #else
874
875 # define CPL_LSBWORD16(x) (x)
876
877 # define CPL_MSBWORD16(x) CPL_SWAP16(x)
878
879 # define CPL_LSBWORD32(x) (x)
880
881 # define CPL_MSBWORD32(x) CPL_SWAP32(x)
882
883 # define CPL_LSBPTR16(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2)
884
885 # define CPL_MSBPTR16(x) CPL_SWAP16PTR(x)
886
887 # define CPL_LSBPTR32(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4)
888
889 # define CPL_MSBPTR32(x) CPL_SWAP32PTR(x)
890
891 # define CPL_LSBPTR64(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8)
892
893 # define CPL_MSBPTR64(x) CPL_SWAP64PTR(x)
894 #endif
895
899 #define CPL_LSBINT16PTR(x) ((*(GByte*)(x)) | (*(((GByte*)(x))+1) << 8))
900
904 #define CPL_LSBINT32PTR(x) ((*(GByte*)(x)) | (*(((GByte*)(x))+1) << 8) | \
905 (*(((GByte*)(x))+2) << 16) | (*(((GByte*)(x))+3) << 24))
906
908 #define CPL_LSBSINT16PTR(x) ((GInt16) CPL_LSBINT16PTR(x))
909
911 #define CPL_LSBUINT16PTR(x) ((GUInt16)CPL_LSBINT16PTR(x))
912
914 #define CPL_LSBSINT32PTR(x) ((GInt32) CPL_LSBINT32PTR(x))
915
917 #define CPL_LSBUINT32PTR(x) ((GUInt32)CPL_LSBINT32PTR(x))
918
920 /* Utility macro to explicitly mark intentionally unreferenced parameters. */
921 #ifndef UNREFERENCED_PARAM
922 # ifdef UNREFERENCED_PARAMETER /* May be defined by Windows API */
923 # define UNREFERENCED_PARAM(param) UNREFERENCED_PARAMETER(param)
924 # else
925 # define UNREFERENCED_PARAM(param) ((void)param)
926 # endif /* UNREFERENCED_PARAMETER */
927 #endif /* UNREFERENCED_PARAM */
928
930 /***********************************************************************
931 * Define CPL_CVSID() macro. It can be disabled during a build by
932 * defining DISABLE_CVSID in the compiler options.
933 *
934 * The cvsid_aw() function is just there to prevent reports of cpl_cvsid()
935 * being unused.
936 */
937
939 #ifndef DISABLE_CVSID
940 #if defined(__GNUC__) && __GNUC__ >= 4
941 # define CPL_CVSID(string) static const char cpl_cvsid[] __attribute__((used)) = string;
942 #else
943 # define CPL_CVSID(string) static const char cpl_cvsid[] = string; \
944 static const char *cvsid_aw() { return( cvsid_aw() ? NULL : cpl_cvsid ); }
945 #endif
946 #else
947 # define CPL_CVSID(string)
948 #endif
949
951 /* We exclude mingw64 4.6 which seems to be broken regarding this */
952 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP) && !(defined(__MINGW64__) && __GNUC__ == 4 && __GNUC_MINOR__ == 6)
953
954 # define CPL_NULL_TERMINATED __attribute__((__sentinel__))
955 #else
956
957 # define CPL_NULL_TERMINATED
958 #endif
959
960 #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(DOXYGEN_SKIP)
961
962 #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx ) __attribute__((__format__ (__printf__, format_idx, arg_idx)))
963
964 #define CPL_SCAN_FUNC_FORMAT( format_idx, arg_idx ) __attribute__((__format__ (__scanf__, format_idx, arg_idx)))
965 #else
966
967 #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx )
968
969 #define CPL_SCAN_FUNC_FORMAT( format_idx, arg_idx )
970 #endif
971
972 #if defined(_MSC_VER) && _MSC_VER >= 1400 && (defined(GDAL_COMPILATION) || defined(CPL_ENABLE_MSVC_ANNOTATIONS))
973 #include <sal.h>
974 # if _MSC_VER > 1400
975
977 # define CPL_FORMAT_STRING(arg) _Printf_format_string_ arg
978
980 # define CPL_SCANF_FORMAT_STRING(arg) _Scanf_format_string_ arg
981 # else
982
983 # define CPL_FORMAT_STRING(arg) __format_string arg
984
985 # define CPL_SCANF_FORMAT_STRING(arg) arg
986 # endif
987 #else
988
989 # define CPL_FORMAT_STRING(arg) arg
990
991 # define CPL_SCANF_FORMAT_STRING(arg) arg
992 #endif /* defined(_MSC_VER) && _MSC_VER >= 1400 && defined(GDAL_COMPILATION) */
993
994 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP)
995
996 #define CPL_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
997 #else
998
999 #define CPL_WARN_UNUSED_RESULT
1000 #endif
1001
1002 #if defined(__GNUC__) && __GNUC__ >= 4
1003
1004 # define CPL_UNUSED __attribute((__unused__))
1005 #else
1006 /* TODO: add cases for other compilers */
1008 # define CPL_UNUSED
1009 #endif
1010
1011 #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(DOXYGEN_SKIP)
1012
1013 #define CPL_NO_RETURN __attribute__((noreturn))
1014 #else
1015
1016 #define CPL_NO_RETURN
1017 #endif
1018
1020 /* Clang __has_attribute */
1021 #ifndef __has_attribute
1022 #define __has_attribute(x) 0 // Compatibility with non-clang compilers.
1023 #endif
1024
1027 #if ((defined(__GNUC__) && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9))) || __has_attribute(returns_nonnull)) && !defined(DOXYGEN_SKIP) && !defined(__INTEL_COMPILER)
1028
1029 # define CPL_RETURNS_NONNULL __attribute__((returns_nonnull))
1030 #else
1031
1032 # define CPL_RETURNS_NONNULL
1033 #endif
1034
1035 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP)
1036
1037 #define CPL_RESTRICT __restrict__
1038 #else
1039
1040 #define CPL_RESTRICT
1041 #endif
1042
1043 #ifdef __cplusplus
1044
1045 #if HAVE_CXX11 || _MSC_VER >= 1500
1046
1049 # define CPL_OVERRIDE override
1050
1051 #else
1052
1055 # define CPL_OVERRIDE
1056
1057 /* For GDAL source compilation only, ignore override if non C++11 compiler */
1058 #ifdef GDAL_COMPILATION
1059 # define override
1060 #endif
1061
1062 #endif /* HAVE_CXX11 || _MSC_VER >= 1500 */
1063
1064 #if HAVE_CXX11
1065
1066 # define CPL_FINAL final
1067
1073 # define CPL_DISALLOW_COPY_ASSIGN(ClassName) \
1074 ClassName( const ClassName & ) = delete; \
1075 ClassName &operator=( const ClassName & ) = delete;
1076 #else
1077
1078 # define CPL_FINAL
1079
1085 # define CPL_DISALLOW_COPY_ASSIGN(ClassName) \
1086 ClassName( const ClassName & ); \
1087 ClassName &operator=( const ClassName & );
1088 #endif /* HAVE_CXX11 */
1089
1090 #endif /* __cplusplus */
1091
1092 #if !defined(DOXYGEN_SKIP)
1093 #if defined(__has_extension)
1094 #if __has_extension(attribute_deprecated_with_message)
1095 /* Clang extension */
1096 #define CPL_WARN_DEPRECATED(x) __attribute__ ((deprecated(x)))
1097 #else
1098 #define CPL_WARN_DEPRECATED(x)
1099 #endif
1100 #elif defined(__GNUC__)
1101 #define CPL_WARN_DEPRECATED(x) __attribute__ ((deprecated))
1102 #else
1103 #define CPL_WARN_DEPRECATED(x)
1104 #endif
1105 #endif
1106
1107 #if !defined(_MSC_VER) && !defined(__APPLE__) && !defined(_FORTIFY_SOURCE)
1108 CPL_C_START
1109 # if defined(GDAL_COMPILATION) && defined(WARN_STANDARD_PRINTF)
1110 int vsnprintf(char *str, size_t size, const char* fmt, va_list args)
1111 CPL_WARN_DEPRECATED("Use CPLvsnprintf() instead");
1112 int snprintf(char *str, size_t size, const char* fmt, ...)
1113 CPL_PRINT_FUNC_FORMAT(3,4)
1114 CPL_WARN_DEPRECATED("Use CPLsnprintf() instead");
1115 int sprintf(char *str, const char* fmt, ...)
1116 CPL_PRINT_FUNC_FORMAT(2, 3)
1117 CPL_WARN_DEPRECATED("Use CPLsnprintf() instead");
1118 # elif defined(GDAL_COMPILATION) && !defined(DONT_DEPRECATE_SPRINTF)
1119 int sprintf(char *str, const char* fmt, ...)
1120 CPL_PRINT_FUNC_FORMAT(2, 3)
1121 CPL_WARN_DEPRECATED("Use snprintf() or CPLsnprintf() instead");
1122 # endif /* defined(GDAL_COMPILATION) && defined(WARN_STANDARD_PRINTF) */
1123 CPL_C_END
1124 #endif /* !defined(_MSC_VER) && !defined(__APPLE__) */
1125
1126 #if defined(MAKE_SANITIZE_HAPPY) || !(defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64))
1127
1128 #define CPL_CPU_REQUIRES_ALIGNED_ACCESS
1129
1130 #endif
1131
1132 #ifdef __cplusplus
1133
1134 #define CPL_ARRAYSIZE(array) \
1135 ((sizeof(array) / sizeof(*(array))) / \
1136 static_cast<size_t>(!(sizeof(array) % sizeof(*(array)))))
1137
1138 extern "C++" {
1139 template<class T> static void CPL_IGNORE_RET_VAL(T) {}
1140 inline static bool CPL_TO_BOOL(int x) { return x != 0; }
1141 } /* extern "C++" */
1142
1143 #endif /* __cplusplus */
1144
1145 #if (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) || (defined(__clang__) && __clang_major__ >= 3)) && !defined(_MSC_VER))
1146 #define HAVE_GCC_DIAGNOSTIC_PUSH
1147 #endif
1148
1149 #if ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) && !defined(_MSC_VER))
1150 #define HAVE_GCC_SYSTEM_HEADER
1151 #endif
1152
1153 #if ((defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >=7))) || __GNUC__ >= 7) && HAVE_CXX11
1154
1155 # define CPL_FALLTHROUGH [[clang::fallthrough]];
1156 #else
1157
1158 # define CPL_FALLTHROUGH
1159 #endif
1160
1162 // Define DEBUG_BOOL to compile in "MSVC mode", ie error out when
1163 // a integer is assigned to a bool
1164 // WARNING: use only at compilation time, since it is know to not work
1165 // at runtime for unknown reasons (crash in MongoDB driver for example)
1166 #if defined(__cplusplus) && defined(DEBUG_BOOL) && !defined(DO_NOT_USE_DEBUG_BOOL)
1167 extern "C++" {
1168 class MSVCPedanticBool
1169 {
1170
1171 friend bool operator== (const bool& one, const MSVCPedanticBool& other);
1172 friend bool operator!= (const bool& one, const MSVCPedanticBool& other);
1173
1174 bool b;
1175 MSVCPedanticBool(int bIn);
1176
1177 public:
1178 /* b not initialized on purpose in default ctor to flag use. */
1179 /* cppcheck-suppress uninitMemberVar */
1180 MSVCPedanticBool() {}
1181 MSVCPedanticBool(bool bIn) : b(bIn) {}
1182 MSVCPedanticBool(const MSVCPedanticBool& other) : b(other.b) {}
1183
1184 MSVCPedanticBool& operator= (const MSVCPedanticBool& other) { b = other.b; return *this; }
1185 MSVCPedanticBool& operator&= (const MSVCPedanticBool& other) { b &= other.b; return *this; }
1186 MSVCPedanticBool& operator|= (const MSVCPedanticBool& other) { b |= other.b; return *this; }
1187
1188 bool operator== (const bool& other) const { return b == other; }
1189 bool operator!= (const bool& other) const { return b != other; }
1190 bool operator== (const MSVCPedanticBool& other) const { return b == other.b; }
1191 bool operator!= (const MSVCPedanticBool& other) const { return b != other.b; }
1192
1193 bool operator! () const { return !b; }
1194 operator bool() const { return b; }
1195 operator int() const { return b; }
1196 };
1197
1198 inline bool operator== (const bool& one, const MSVCPedanticBool& other) { return one == other.b; }
1199 inline bool operator!= (const bool& one, const MSVCPedanticBool& other) { return one != other.b; }
1200
1201 /* We must include all C++ stuff before to avoid issues with templates that use bool */
1202 #include <vector>
1203 #include <map>
1204 #include <set>
1205 #include <string>
1206 #include <cstddef>
1207 #include <limits>
1208 #include <sstream>
1209 #include <fstream>
1210 #include <algorithm>
1211
1212 } /* extern C++ */
1213
1214 #undef FALSE
1215 #define FALSE false
1216 #undef TRUE
1217 #define TRUE true
1218
1219 /* In the very few cases we really need a "simple" type, fallback to bool */
1220 #define EMULATED_BOOL int
1221
1222 /* Use our class instead of bool */
1223 #define bool MSVCPedanticBool
1224
1225 /* "volatile bool" with the below substitution doesn't really work. */
1226 /* Just for the sake of the debug, we don't really need volatile */
1227 #define VOLATILE_BOOL bool
1228
1229 #else /* defined(__cplusplus) && defined(DEBUG_BOOL) */
1230
1231 #ifndef FALSE
1232 # define FALSE 0
1233 #endif
1234
1235 #ifndef TRUE
1236 # define TRUE 1
1237 #endif
1238
1239 #define EMULATED_BOOL bool
1240 #define VOLATILE_BOOL volatile bool
1241
1242 #endif /* defined(__cplusplus) && defined(DEBUG_BOOL) */
1243
1245 #endif /* ndef CPL_BASE_H_INCLUDED */
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:352
GBool
int GBool
Type for boolean values (alias to int)
Definition: cpl_port.h:215
GInt32
int GInt32
Int32 type.
Definition: cpl_port.h:197
GUInt32
unsigned int GUInt32
Unsigned int32 type.
Definition: cpl_port.h:199
GInt16
short GInt16
Int16 type.
Definition: cpl_port.h:203
GByte
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:207
CPL_PRINT_FUNC_FORMAT
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition: cpl_port.h:967
CPLIsNan
#define CPLIsNan(x)
Return whether a floating-pointer number is NaN.
Definition: cpl_port.h:688
GUInt64
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:271
GPtrDiff_t
GIntBig GPtrDiff_t
Integer type large enough to hold the difference between 2 addresses.
Definition: cpl_port.h:294
GUIntBig
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:253
GUInt16
unsigned short GUInt16
Unsigned int16 type.
Definition: cpl_port.h:205
CPLIsInf
#define CPLIsInf(x)
Return whether a floating-pointer number is +/- infinty.
Definition: cpl_port.h:691
CPLsnprintf
int CPLsnprintf(char *str, size_t size, const char *fmt,...)
snprintf() wrapper that is not sensitive to LC_NUMERIC settings.
Definition: cpl_string.cpp:1329
CPLIsFinite
#define CPLIsFinite(x)
Return whether a floating-pointer number is finite.
Definition: cpl_port.h:693
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:354
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:250
GInt64
GIntBig GInt64
Signed 64 bit integer type.
Definition: cpl_port.h:269

Generated for GDAL by 1.8.8.