--- g2clib-1.6.2.unchanged/g2_addfield.c 2020-12-03 20:55:34.000000000 +0100
+++ g2clib-1.6.2.p1/g2_addfield.c 2021-01-07 08:30:01.249992553 +0100
@@ -1,5 +1,6 @@
/** @file
*/
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include "grib2.h"
@@ -192,8 +193,8 @@ g2int g2_addfield(unsigned char *cgrib,g
// total length, then there is a problem.
if ( len > lencurr ) {
printf("g2_addfield: Section byte counts don''t add to total.\n");
- printf("g2_addfield: Sum of section byte counts = %ld\n",len);
- printf("g2_addfield: Total byte count in Section 0 = %ld\n",lencurr);
+ printf("g2_addfield: Sum of section byte counts = %"PRId32"\n",len);
+ printf("g2_addfield: Total byte count in Section 0 = %"PRId32"\n",lencurr);
ierr=-3;
return(ierr);
}
@@ -394,7 +395,7 @@ g2int g2_addfield(unsigned char *cgrib,g
}
#endif /* USE_PNG */
else {
- printf("g2_addfield: Data Representation Template 5.%ld not yet implemented.\n",idrsnum);
+ printf("g2_addfield: Data Representation Template 5.%"PRId32" not yet implemented.\n",idrsnum);
ierr=-7;
return(ierr);
}
--- g2clib-1.6.2.unchanged/g2_addgrid.c 2020-12-03 20:56:01.000000000 +0100
+++ g2clib-1.6.2.p1/g2_addgrid.c 2021-01-07 08:30:01.249992553 +0100
@@ -1,5 +1,6 @@
/** @file
*/
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include "grib2.h"
@@ -127,8 +128,8 @@ g2int g2_addgrid(unsigned char *cgrib,g2
// total length, then there is a problem.
if ( len > lencurr ) {
printf("g2_addgrid: Section byte counts don''t add to total.\n");
- printf("g2_addgrid: Sum of section byte counts = %ld\n",len);
- printf("g2_addgrid: Total byte count in Section 0 = %ld\n",lencurr);
+ printf("g2_addgrid: Sum of section byte counts = %"PRId32"\n",len);
+ printf("g2_addgrid: Total byte count in Section 0 = %"PRId32"\n",lencurr);
ierr=-3;
return(ierr);
}
--- g2clib-1.6.2.unchanged/g2_addlocal.c 2020-12-03 20:56:14.000000000 +0100
+++ g2clib-1.6.2.p1/g2_addlocal.c 2021-01-07 08:30:01.249992553 +0100
@@ -1,5 +1,6 @@
/** @file
*/
+#include <inttypes.h>
#include <stdio.h>
#include "grib2.h"
@@ -104,8 +105,8 @@ g2int g2_addlocal(unsigned char *cgrib,u
// total length, then there is a problem.
if ( len > lencurr ) {
printf("g2_addlocal: Section byte counts don't add to total.\n");
- printf("g2_addlocal: Sum of section byte counts = %ld\n",len);
- printf("g2_addlocal: Total byte count in Section 0 = %ld\n",lencurr);
+ printf("g2_addlocal: Sum of section byte counts = %"PRId32"\n",len);
+ printf("g2_addlocal: Total byte count in Section 0 = %"PRId32"\n",lencurr);
ierr=-3;
return(ierr);
}
@@ -115,7 +116,7 @@ g2int g2_addlocal(unsigned char *cgrib,u
//
if ( (isecnum!=1) && (isecnum!=7) ) {
printf("g2_addlocal: Section 2 can only be added after Section 1 or Section 7.\n");
- printf("g2_addlocal: Section %ld was the last found in given GRIB message.\n",isecnum);
+ printf("g2_addlocal: Section %"PRId32" was the last found in given GRIB message.\n",isecnum);
ierr=-4;
return(ierr);
}
--- g2clib-1.6.2.unchanged/g2_getfld.c 2020-12-03 20:59:10.000000000 +0100
+++ g2clib-1.6.2.p1/g2_getfld.c 2021-01-07 08:30:01.249992553 +0100
@@ -1,5 +1,6 @@
/** @file
*/
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include "grib2.h"
@@ -347,12 +348,12 @@ g2int g2_getfld(unsigned char *cgrib,g2i
iofst=iofst+32;
gbit(cgrib,&isecnum,iofst,8); // Get Section number
iofst=iofst+8;
- //printf(" lensec= %ld secnum= %ld \n",lensec,isecnum);
+ //printf(" lensec= %"PRId32" secnum= %"PRId32" \n",lensec,isecnum);
//
// Check to see if section number is valid
//
if ( isecnum<1 || isecnum>7 ) {
- printf("g2_getfld: Unrecognized Section Encountered=%ld\n",isecnum);
+ printf("g2_getfld: Unrecognized Section Encountered=%"PRId32"\n",isecnum);
ierr=8;
return(ierr);
}
@@ -545,8 +546,8 @@ g2int g2_getfld(unsigned char *cgrib,g2i
// If exited from above loop, the end of the GRIB message was reached
// before the requested field was found.
//
- printf("g2_getfld: GRIB message contained %ld different fields.\n",numfld);
- printf("g2_getfld: The request was for field %ld.\n",ifldnum);
+ printf("g2_getfld: GRIB message contained %"PRId32" different fields.\n",numfld);
+ printf("g2_getfld: The request was for field %"PRId32".\n",ifldnum);
ierr=6;
return(ierr);
--- g2clib-1.6.2.unchanged/g2_gribend.c 2020-12-03 20:59:22.000000000 +0100
+++ g2clib-1.6.2.p1/g2_gribend.c 2021-01-07 08:30:01.249992553 +0100
@@ -1,5 +1,6 @@
/** @file
*/
+#include <inttypes.h>
#include <stdio.h>
#include "grib2.h"
@@ -99,7 +100,7 @@ g2int g2_gribend(unsigned char *cgrib)
//
if ( isecnum != 7 ) {
printf("g2_gribend: Section 8 can only be added after Section 7.\n");
- printf("g2_gribend: Section %ld was the last found in given GRIB message.\n",isecnum);
+ printf("g2_gribend: Section %"PRId32" was the last found in given GRIB message.\n",isecnum);
ierr=-4;
return (ierr);
}
--- g2clib-1.6.2.unchanged/g2_info.c 2020-12-03 20:59:58.000000000 +0100
+++ g2clib-1.6.2.p1/g2_info.c 2021-01-07 08:30:01.250992534 +0100
@@ -1,5 +1,6 @@
/** @file
*/
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include "grib2.h"
@@ -180,7 +181,7 @@ g2int g2_info(unsigned char *cgrib,g2int
(*numfields)++;
}
else {
- printf("g2_info: Invalid section number found in GRIB message: %ld\n" ,isecnum);
+ printf("g2_info: Invalid section number found in GRIB message: %"PRId32"\n" ,isecnum);
ierr=6;
return(ierr);
}
--- g2clib-1.6.2.unchanged/grib2.h 2020-12-03 21:20:51.000000000 +0100
+++ g2clib-1.6.2.p1/grib2.h 2021-01-07 08:30:01.250992534 +0100
@@ -148,17 +148,13 @@
*/
#ifndef _grib2_H
#define _grib2_H
+#include<inttypes.h>
#include<stdio.h>
#define G2_VERSION "g2clib-1.6.2"
-#ifdef __64BIT__
-typedef int g2int;
-typedef unsigned int g2intu;
-#else
-typedef long g2int;
-typedef unsigned long g2intu;
-#endif
+typedef int32_t g2int;
+typedef uint32_t g2intu;
typedef float g2float;
struct gtemplate {