diff -up g2clib-1.2.1/g2_addfield.c.64bit g2clib-1.2.1/g2_addfield.c --- g2clib-1.2.1/g2_addfield.c.64bit 2009-01-16 12:25:50.000000000 -0700 +++ g2clib-1.2.1/g2_addfield.c 2011-02-17 11:18:36.539587343 -0700 @@ -1,3 +1,4 @@ +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include "grib2.h" @@ -190,8 +191,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 = %"PRIg2int"\n",len); + printf("g2_addfield: Total byte count in Section 0 = %"PRIg2int"\n",lencurr); ierr=-3; return(ierr); } @@ -392,7 +393,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.%"PRIg2int" not yet implemented.\n",idrsnum); ierr=-7; return(ierr); } diff -up g2clib-1.2.1/g2_addgrid.c.64bit g2clib-1.2.1/g2_addgrid.c --- g2clib-1.2.1/g2_addgrid.c.64bit 2009-01-16 12:25:50.000000000 -0700 +++ g2clib-1.2.1/g2_addgrid.c 2011-02-17 11:18:36.540587226 -0700 @@ -1,3 +1,4 @@ +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include "grib2.h" @@ -125,8 +126,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 = %"PRIg2int"\n",len); + printf("g2_addgrid: Total byte count in Section 0 = %"PRIg2int"\n",lencurr); ierr=-3; return(ierr); } diff -up g2clib-1.2.1/g2_addlocal.c.64bit g2clib-1.2.1/g2_addlocal.c --- g2clib-1.2.1/g2_addlocal.c.64bit 2003-03-18 15:46:03.000000000 -0700 +++ g2clib-1.2.1/g2_addlocal.c 2011-02-17 11:18:36.540587226 -0700 @@ -1,3 +1,4 @@ +#include <inttypes.h> #include <stdio.h> #include "grib2.h" @@ -102,8 +103,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 = %"PRIg2int"\n",len); + printf("g2_addlocal: Total byte count in Section 0 = %"PRIg2int"\n",lencurr); ierr=-3; return(ierr); } @@ -113,7 +114,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 %"PRIg2int" was the last found in given GRIB message.\n",isecnum); ierr=-4; return(ierr); } diff -up g2clib-1.2.1/g2_getfld.c.64bit g2clib-1.2.1/g2_getfld.c --- g2clib-1.2.1/g2_getfld.c.64bit 2004-12-28 07:35:22.000000000 -0700 +++ g2clib-1.2.1/g2_getfld.c 2011-02-17 11:21:10.724568213 -0700 @@ -1,3 +1,4 @@ +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include "grib2.h" @@ -344,12 +345,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= %"PRIg2int" secnum= %"PRIg2int" \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=%"PRIg2int"\n",isecnum); ierr=8; return(ierr); } @@ -541,8 +542,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 %"PRIg2int" different fields.\n",numfld); + printf("g2_getfld: The request was for field %"PRIg2int".\n",ifldnum); ierr=6; return(ierr); diff -up g2clib-1.2.1/g2_gribend.c.64bit g2clib-1.2.1/g2_gribend.c --- g2clib-1.2.1/g2_gribend.c.64bit 2004-05-13 13:43:26.000000000 -0600 +++ g2clib-1.2.1/g2_gribend.c 2011-02-17 11:18:36.551585938 -0700 @@ -1,3 +1,4 @@ +#include <inttypes.h> #include <stdio.h> #include "grib2.h" @@ -97,7 +98,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 %"PRIg2int" was the last found in given GRIB message.\n",isecnum); ierr=-4; return (ierr); } diff -up g2clib-1.2.1/g2_info.c.64bit g2clib-1.2.1/g2_info.c --- g2clib-1.2.1/g2_info.c.64bit 2003-03-18 15:46:03.000000000 -0700 +++ g2clib-1.2.1/g2_info.c 2011-02-17 11:18:36.552585820 -0700 @@ -1,3 +1,4 @@ +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include "grib2.h" @@ -178,7 +179,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: %"PRIg2int"\n" ,isecnum); ierr=6; return(ierr); } diff -up g2clib-1.2.1/grib2.h.64bit g2clib-1.2.1/grib2.h --- g2clib-1.2.1/grib2.h.64bit 2010-08-11 12:03:15.000000000 -0600 +++ g2clib-1.2.1/grib2.h 2011-02-17 11:18:36.553585703 -0700 @@ -154,9 +154,11 @@ #ifdef __64BIT__ typedef int g2int; typedef unsigned int g2intu; +#define PRIg2int "d" #else typedef long g2int; typedef unsigned long g2intu; +#define PRIg2int "ld" #endif typedef float g2float;