diff options
| author | Aaron Puchert <aaron.puchert@sap.com> | 2017-10-20 12:58:10 +0200 |
|---|---|---|
| committer | Aaron Puchert <aaron.puchert@sap.com> | 2017-11-27 14:57:42 +0100 |
| commit | 3175dce5fcec54fef6299cc8b595d84db5b29cf4 (patch) | |
| tree | 0c82ae4f4afa9eb44893e1bd7d1f9a884459e2d9 /src/projects.h | |
| parent | 1f48f4c333bfe135296d3be643ef4981dc401c38 (diff) | |
| download | PROJ-3175dce5fcec54fef6299cc8b595d84db5b29cf4.tar.gz PROJ-3175dce5fcec54fef6299cc8b595d84db5b29cf4.zip | |
Replace some asserts by compile-time assertions
Decisions regarding the size of certain types are always made at
compile time, hence this is where the assertion should take place.
If the assertions fail, there is now a compiler error.
Diffstat (limited to 'src/projects.h')
| -rw-r--r-- | src/projects.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/projects.h b/src/projects.h index 99df0e3e..8c0f81fa 100644 --- a/src/projects.h +++ b/src/projects.h @@ -43,6 +43,7 @@ #endif /* standard inclusions */ +#include <limits.h> #include <math.h> #include <stdio.h> #include <stdlib.h> @@ -78,6 +79,14 @@ extern "C" { # define ABS(x) ((x<0) ? (-1*(x)) : x) #endif +#if INT_MAX == 2147483647 +typedef int pj_int32; +#elif LONG_MAX == 2147483647 +typedef long pj_int32; +#else +#warning It seems no 32-bit integer type is available +#endif + /* maximum path/filename */ #ifndef MAX_PATH_FILENAME #define MAX_PATH_FILENAME 1024 @@ -618,7 +627,7 @@ PJ *pj_projection_specific_setup_##name (PJ *P) #define MAX_TAB_ID 80 typedef struct { float lam, phi; } FLP; -typedef struct { int lam, phi; } ILP; +typedef struct { pj_int32 lam, phi; } ILP; struct CTABLE { char id[MAX_TAB_ID]; /* ascii info */ |
