Changeset 13834

Show
Ignore:
Timestamp:
02/21/08 15:59:54 (4 months ago)
Author:
warmerdam
Message:

lots of cleanup - warning clean with -Wall and gcc now

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • spike/grib/degrib18/degrib/clock.c

    r10748 r13834  
    518518         return; 
    519519      case 'Y': 
    520          sprintf (buffer, "%04ld", year); 
     520         sprintf (buffer, "%04d", year); 
    521521         return; 
    522522      case 'H': 
     
    18611861   Clock_PrintDate (clock, &year, &month, &day, &hour, &min, &d_sec); 
    18621862   sec = (int) d_sec; 
    1863    sprintf (buffer, "%04ld%02d%02d%02d%02d%02d", year, month, day, hour, min, 
     1863   sprintf (buffer, "%04d%02d%02d%02d%02d%02d", year, month, day, hour, min, 
    18641864            sec); 
    18651865} 
  • spike/grib/degrib18/degrib/datasource.h

    r10749 r13834  
    77{ 
    88public: 
     9        virtual ~DataSource() {} 
    910        virtual size_t DataSourceFread(void* lpBuf, size_t size, size_t count) = 0; 
    1011        virtual int DataSourceFgetc() = 0; 
  • spike/grib/degrib18/degrib/degrib1.cpp

    r12078 r13834  
    588588         if ((sectLen < 100) && (sectLen != 86)) { 
    589589            printf ("Warning! Problems with Ensemble Clustering section\n"); 
    590             printf ("Section length == %ld\n", sectLen); 
     590            printf ("Section length == %d\n", sectLen); 
    591591            return 0; 
    592592         } 
     
    625625      pds += 12; 
    626626      i_temp = GRIB_SIGN_INT2 (pds[3], pds[4]); 
    627       printf ("ID %d Class %d Type %d Stream %ld", pds[0], pds[1], pds[2], 
     627      printf ("ID %d Class %d Type %d Stream %d", pds[0], pds[1], pds[2], 
    628628              i_temp); 
    629629      pds += 5; 
    630630      printf (" Ver %c%c%c%c, ", pds[0], pds[1], pds[2], pds[3]); 
    631631      pds += 4; 
    632       printf ("Octet-50 %d, Octet-51 %d SectLen %ld\n", pds[0], pds[1], 
     632      printf ("Octet-50 %d, Octet-51 %d SectLen %d\n", pds[0], pds[1], 
    633633              sectLen); 
    634634   } else { 
     
    12881288      for (i = 0; i < P2; i++) { 
    12891289         memBitRead (&uli_temp, sizeof (sInt4), bds, 1, &bufLoc, &numUsed); 
    1290          printf ("(%d %ld) ", i, uli_temp); 
     1290         printf ("(%d %d) ", i, uli_temp); 
    12911291         if (numUsed != 0) { 
    12921292            printf ("\n"); 
     
    12991299         secLen++; 
    13001300      } 
    1301       printf ("Observed Sec Len %ld\n", secLen); 
     1301      printf ("Observed Sec Len %d\n", secLen); 
    13021302   } else { 
    13031303      /* Jump over widths and secondary bitmap */ 
     
    13091309   for (i = 0; i < P1; i++) { 
    13101310      memBitRead (&uli_temp, sizeof (sInt4), bds, numBits, &bufLoc, &numUsed); 
    1311       printf ("(%d %ld) (numUsed %d numBits %d)", i, uli_temp, numUsed, 
    1312               numBits); 
     1311      printf ("(%d %d) (numUsed %ld numBits %d)", i, uli_temp,  
     1312              (long) numUsed, numBits); 
    13131313      if (numUsed != 0) { 
    13141314         printf ("\n"); 
     
    13221322   } 
    13231323 
    1324    printf ("Observed Sec Len %ld\n", secLen); 
     1324   printf ("Observed Sec Len %d\n", secLen); 
    13251325   printf ("N2 = %d\n", N2); 
    13261326 
     
    14781478   if (!f_bms && (meta->gds.numPts * numBits + numUnusedBit) != 
    14791479       (sectLen - 11) * 8) { 
    1480       printf ("numPts * (numBits in a Group) + # of unused bits %ld != " 
    1481               "# of available bits %ld\n", 
     1480      printf ("numPts * (numBits in a Group) + # of unused bits %d != " 
     1481              "# of available bits %d\n", 
    14821482              (sInt4) (meta->gds.numPts * numBits + numUnusedBit), 
    14831483              (sInt4) ((sectLen - 11) * 8)); 
     
    17241724   /* nd5 needs to be gribLen in (sInt4) units rounded up. */ 
    17251725#ifdef DEBUG 
    1726    printf ("GribLen == %ld\n", gribLen); 
     1726   printf ("GribLen == %d\n", gribLen); 
    17271727#endif 
    17281728   nd5 = (gribLen + 3) / 4; 
  • spike/grib/degrib18/degrib/degrib2.cpp

    r10749 r13834  
    859859   int version;         /* Which version of GRIB is in this message. */ 
    860860   sInt4 cnt;           /* Used to help compact the weather table. */ 
    861    gdsType newGds;      /* The GDS of the subgrid if needed. */ 
    862861   int x1, y1;          /* The original grid coordinates of the lower left 
    863862                         * corner of the subgrid. */ 
     
    10481047            /* Warning. */ 
    10491048#ifdef DEBUG 
    1050             printf ("Warning: Unpack library warning code (%ld %ld)\n", 
     1049            printf ("Warning: Unpack library warning code (%d %d)\n", 
    10511050                    jer[i], jer[ndjer + i]); 
    10521051#endif 
     
    10701069      if ((fp = fopen ("dump.is0", "wt")) != NULL) { 
    10711070         for (i = 0; i < 8; i++) { 
    1072             fprintf (fp, "---Section %d---\n", i); 
     1071            fprintf (fp, "---Section %d---\n", (int) i); 
    10731072            for (j = 1; j <= IS->ns[i]; j++) { 
    1074                fprintf (fp, "IS%d Item %d = %ld\n", i, j, IS->is[i][j - 1]); 
     1073               fprintf (fp, "IS%d Item %d = %d\n", (int) i, (int) j, IS->is[i][j - 1]); 
    10751074            } 
    10761075         } 
  • spike/grib/degrib18/degrib/grib2api.c

    r13832 r13834  
    369369   if (nd2x3 < ngrdpts) { 
    370370#ifdef DEBUG 
    371       printf ("nd2x3(%ld) is < ngrdpts(%ld)\n", nd2x3, ngrdpts); 
     371      printf ("nd2x3(%d) is < ngrdpts(%d)\n", nd2x3, ngrdpts); 
    372372#endif 
    373373      return 1; 
     
    392392      if (nx * ny != ngrdpts) { 
    393393#ifdef DEBUG 
    394          printf ("nx * ny (%ld) != ngrdpts(%ld)\n", nx * ny, ngrdpts); 
     394         printf ("nx * ny (%d) != ngrdpts(%d)\n", nx * ny, ngrdpts); 
    395395#endif 
    396396         return 2; 
     
    474474   if (nd2x3 < ngrdpts) { 
    475475#ifdef DEBUG 
    476       printf ("nd2x3(%ld) is < ngrdpts(%ld)\n", nd2x3, ngrdpts); 
     476      printf ("nd2x3(%d) is < ngrdpts(%d)\n", nd2x3, ngrdpts); 
    477477#endif 
    478478      return 1; 
     
    497497      if (nx * ny != ngrdpts) { 
    498498#ifdef DEBUG 
    499          printf ("nx * ny (%ld) != ngrdpts(%ld)\n", nx * ny, ngrdpts); 
     499         printf ("nx * ny (%d) != ngrdpts(%d)\n", nx * ny, ngrdpts); 
    500500#endif 
    501501         return 2; 
     
    11911191 ***************************************************************************** 
    11921192 */ 
     1193#ifdef notdef 
    11931194static int validate (char *filename, float * ain, sInt4 * iain, 
    11941195                     sInt4 * nd2x3, sInt4 * idat, sInt4 * nidat, 
     
    12111212   } 
    12121213   for (i = 0; i < *ns0; i++) { 
    1213       fprintf (fp, "Sect 0 : %d of %ld : %ld\n", i, *ns0, is0[i]); 
     1214      fprintf (fp, "Sect 0 : %d of %d : %d\n", i, *ns0, is0[i]); 
    12141215   } 
    12151216   for (i = 0; i < *ns1; i++) { 
    1216       fprintf (fp, "Sect 1 : %d of %ld : %ld\n", i, *ns1, is1[i]); 
     1217      fprintf (fp, "Sect 1 : %d of %d : %d\n", i, *ns1, is1[i]); 
    12171218   } 
    12181219   for (i = 0; i < *ns2; i++) { 
    1219       fprintf (fp, "Sect 2 : %d of %ld : %ld\n", i, *ns2, is2[i]); 
     1220      fprintf (fp, "Sect 2 : %d of %d : %d\n", i, *ns2, is2[i]); 
    12201221   } 
    12211222   for (i = 0; i < idat[0]; i++) { 
    1222       fprintf (fp, "idat : %d of %ld : %ld\n", i, idat[0], idat[i]); 
     1223      fprintf (fp, "idat : %d of %d : %d\n", i, idat[0], idat[i]); 
    12231224   } 
    12241225   for (i = 0; i < rdat[0]; i++) { 
     
    12261227   } 
    12271228   for (i = 0; i < *ns3; i++) { 
    1228       fprintf (fp, "Sect 3 : %d of %ld : %ld\n", i, *ns3, is3[i]); 
     1229      fprintf (fp, "Sect 3 : %d of %d : %d\n", i, *ns3, is3[i]); 
    12291230   } 
    12301231   for (i = 0; i < *ns4; i++) { 
    1231       fprintf (fp, "Sect 4 : %d of %ld : %ld\n", i, *ns4, is4[i]); 
     1232      fprintf (fp, "Sect 4 : %d of %d : %d\n", i, *ns4, is4[i]); 
    12321233   } 
    12331234   for (i = 0; i < *ns5; i++) { 
    1234       fprintf (fp, "Sect 5 : %d of %ld : %ld\n", i, *ns5, is5[i]); 
     1235      fprintf (fp, "Sect 5 : %d of %d : %d\n", i, *ns5, is5[i]); 
    12351236   } 
    12361237   for (i = 0; i < *ns6; i++) { 
    1237       fprintf (fp, "Sect 6 : %d of %ld : %ld\n", i, *ns6, is6[i]); 
     1238      fprintf (fp, "Sect 6 : %d of %d : %d\n", i, *ns6, is6[i]); 
    12381239   } 
    12391240   for (i = 0; i < *ns7; i++) { 
    1240       fprintf (fp, "Sect 7 : %d of %ld : %ld\n", i, *ns7, is7[i]); 
     1241      fprintf (fp, "Sect 7 : %d of %d : %d\n", i, *ns7, is7[i]); 
    12411242   } 
    12421243   fprintf (fp, "Xmissp = %f\n", *xmissp); 
     
    12451246      if (is5[20] == 1) { 
    12461247         for (i = 0; i < *nd2x3; i++) { 
    1247             fprintf (fp, "Int Data : %d of %ld : %ld\n", i, *nd2x3, iain[i]); 
     1248            fprintf (fp, "Int Data : %d of %d : %d\n", i, *nd2x3, iain[i]); 
    12481249         } 
    12491250      } 
    12501251   } else { 
    12511252      for (i = 0; i < *nd2x3; i++) { 
    1252          fprintf (fp, "Float Data : %d of %ld : %f\n", i, *nd2x3, ain[i]); 
    1253       } 
    1254    } 
    1255    fprintf (fp, "ibitmap = %ld\n", *ibitmap); 
     1253         fprintf (fp, "Float Data : %d of %d : %f\n", i, *nd2x3, ain[i]); 
     1254      } 
     1255   } 
     1256   fprintf (fp, "ibitmap = %d\n", *ibitmap); 
    12561257   if (*ibitmap) { 
    12571258      for (i = 0; i < *nd2x3; i++) { 
    1258          fprintf (fp, "Bitmap Data : %d of %ld : %ld\n", i, *nd2x3, ib[i]); 
     1259         fprintf (fp, "Bitmap Data : %d of %d : %d\n", i, *nd2x3, ib[i]); 
    12591260      } 
    12601261   } 
    12611262   for (i = 0; i < *ndjer; i++) { 
    1262       fprintf (fp, "jer(i,1) %ld jer(i,2) %ld\n", jer[i], jer[i + *ndjer]); 
    1263    } 
    1264    fprintf (fp, "kjer = %ld\n", *kjer); 
    1265    fprintf (fp, "iendpk = %ld\n", *iendpk); 
     1263      fprintf (fp, "jer(i,1) %d jer(i,2) %d\n", jer[i], jer[i + *ndjer]); 
     1264   } 
     1265   fprintf (fp, "kjer = %d\n", *kjer); 
     1266   fprintf (fp, "iendpk = %d\n", *iendpk); 
    12661267   fclose (fp); 
    12671268   return 0; 
    12681269} 
     1270#endif /* def notdef */ 
    12691271 
    12701272/***************************************************************************** 
     
    13141316 ***************************************************************************** 
    13151317 */ 
     1318/* 
    13161319static void clear (float * ain, sInt4 * iain, sInt4 * nd2x3, sInt4 * idat, 
    13171320                   sInt4 * nidat, float * rdat, sInt4 * nrdat, sInt4 * is0, 
     
    13451348   *kjer = 0; 
    13461349} 
     1350*/ 
    13471351 
    13481352/***************************************************************************** 
     
    15051509         default: 
    15061510#ifdef DEBUG 
    1507             printf ("Invalid section id %ld.\n", sectId); 
     1511            printf ("Invalid section id %d.\n", sectId); 
    15081512#endif 
    15091513            return 2; 
     
    16271631   sInt4 drsTmpl; 
    16281632   sInt4 numGrps; 
    1629    sInt4 *jmin; 
    1630    sInt4 *lbit; 
    1631    sInt4 *nov; 
    1632    sInt4 *iwork; 
    1633    char f_useMDL = 0;   /* Instructed 3/8/2005 10:30 to not use MDL. */ 
     1633      char f_useMDL = 0;   /* Instructed 3/8/2005 10:30 to not use MDL. */ 
    16341634   uChar f_noBitmap;    /* 0 if bitmap, else no bitmap. */ 
    16351635   sInt4 orderDiff; 
    1636  
    1637 #ifdef DEBUG 
    1638    f_useMDL = 0;   /* Experiment with smoke data 12/16/2005 */ 
    1639 #endif 
    16401636 
    16411637   if (FindTemplateIDs (ipack, *nd5, 0, &gdsTmpl, &pdsTmpl, &drsTmpl, 
     
    16451641      *kjer = 1; 
    16461642   } 
    1647 #ifdef DEBUG 
    1648    printf ("gdsTemplate number = %ld\n", gdsTmpl); 
    1649    printf ("pdsTemplate number = %ld\n", pdsTmpl); 
    1650    printf ("drsTemplate number = %ld\n", drsTmpl); 
    1651    printf ("f_noBitmap = %d\n", f_noBitmap); 
    1652 #endif 
    16531643   if ((gdsTmpl != 0) && (gdsTmpl != 10) && (gdsTmpl != 20) && 
    16541644       (gdsTmpl != 30) && (gdsTmpl != 90) && (gdsTmpl != 110) && 
     
    16611651      f_useMDL = 0; 
    16621652   } 
    1663 #ifdef DEBUG 
    1664    printf ("UseMDL? 1=yes 0=no : ans %d\n", f_useMDL); 
    1665 #endif 
    16661653   if ((drsTmpl != 0) && (drsTmpl != 2) && (drsTmpl != 3)) { 
    16671654      f_useMDL = 0; 
    16681655   } 
    1669 #ifdef DEBUG 
    1670    printf ("UseMDL? 1=yes 0=no : ans %d\n", f_useMDL); 
    1671 #endif 
    16721656   /* MDL GRIB2 lib does not support drsTmpl 2 or 3 if there is a bitmap. */ 
    16731657   if ((!f_noBitmap) && ((drsTmpl == 2) || (drsTmpl == 3))) { 
    16741658      f_useMDL = 0; 
    16751659   } 
    1676 #ifdef DEBUG 
    1677    printf ("UseMDL? 1=yes 0=no : ans %d\n", f_useMDL); 
    1678 #endif 
    16791660   /* MDL GRIB2 lib does not support anything but second order differencing. */ 
    16801661   if ((drsTmpl == 3) && (orderDiff != 2) && (orderDiff != 0)) { 
    16811662      f_useMDL = 0; 
    16821663   } 
    1683 #ifdef DEBUG 
    1684    printf ("orderDiff = %d, drsTmpl = %d\n", orderDiff, drsTmpl),  
    1685    printf ("UseMDL? 1=yes 0=no : ans %d\n", f_useMDL); 
    1686 #endif 
    16871664 
    16881665#ifdef _FORTRAN 
     
    20352012   sInt4 *newboxp; 
    20362013   sInt4 *ia; 
    2037    unsigned char *c_ipack; 
    20382014/*   float *a;*/ 
    20392015   char f_useMDL = 1; 
     
    21372113 
    21382114      printf ("Unable to use MDL Pack library?\n"); 
    2139       printf ("gdsTmpl : %ld , pdsTmpl %ld : drsTmpl %ld\n", gdsTmpl, 
     2115      printf ("gdsTmpl : %d , pdsTmpl %d : drsTmpl %d\n", gdsTmpl, 
    21402116              pdsTmpl, drsTmpl); 
    21412117      jer[0 + *ndjer] = 31415926; 
  • spike/grib/degrib18/degrib/inventory.cpp

    r12066 r13834  
    124124      delta = myRound (delta, 2); 
    125125      if (Inv[i].comment == NULL) { 
    126          printf ("%d.%d, %ld, %d, %s, %s, %s, %s, %.2f\n", 
     126         printf ("%d.%d, %d, %d, %s, %s, %s, %s, %.2f\n", 
    127127                 Inv[i].msgNum, Inv[i].subgNum, Inv[i].start, 
    128128                 Inv[i].GribVersion, Inv[i].element, Inv[i].shortFstLevel, 
     
    130130         fflush (stdout); 
    131131      } else { 
    132          printf ("%d.%d, %ld, %d, %s=\"%s\", %s, %s, %s, %.2f\n", 
     132         printf ("%d.%d, %d, %d, %s=\"%s\", %s, %s, %s, %.2f\n", 
    133133                 Inv[i].msgNum, Inv[i].subgNum, Inv[i].start, 
    134134                 Inv[i].GribVersion, Inv[i].element, Inv[i].comment, 
     
    627627   /* Try to convert lenTime to hourly. */ 
    628628   if (timeRangeUnit == 0) { 
    629       lenTime = lenTime / 60.
     629      lenTime = (sInt4) (lenTime / 60.)
    630630      timeRangeUnit = 1; 
    631631   } else if (timeRangeUnit == 1) { 
     
    643643      timeRangeUnit = 1; 
    644644   } else if (timeRangeUnit == 13) { 
    645       lenTime = lenTime / 3600.
     645      lenTime = (sInt4) (lenTime / 3600.)
    646646      timeRangeUnit = 1; 
    647647   } else { 
     
    895895            /* Handle case where there are trailing bytes. */ 
    896896            msg = errSprintf (NULL); 
    897             printf ("Warning: Inside GRIB2Inventory, Message # %ld\n", 
     897            printf ("Warning: Inside GRIB2Inventory, Message # %d\n", 
    898898                    msgNum); 
    899899            printf ("%s", msg); 
     
    903903            fileLen = fp.DataSourceFtell(); 
    904904            /* fseek (fp, 0L, SEEK_SET); */ 
    905             printf ("There were %ld trailing bytes in the file.\n", 
     905            printf ("There were %d trailing bytes in the file.\n", 
    906906                    fileLen - offset); 
    907907            free (buffer); 
     
    11281128            /* Handle case where there are trailing bytes. */ 
    11291129            msg = errSprintf (NULL); 
    1130             printf ("Warning: Inside GRIB2RefTime, Message # %ld\n", msgNum); 
     1130            printf ("Warning: Inside GRIB2RefTime, Message # %d\n", msgNum); 
    11311131            printf ("%s", msg); 
    11321132            free (msg); 
     
    11351135            fileLen = fp.DataSourceFtell(); 
    11361136            /* fseek (fp, 0L, SEEK_SET); */ 
    1137             printf ("There were %ld trailing bytes in the file.\n", 
     1137            printf ("There were %d trailing bytes in the file.\n", 
    11381138                    fileLen - offset); 
    11391139            free (buffer); 
  • spike/grib/degrib18/degrib/memorydatasource.cpp

    r10749 r13834  
    44MemoryDataSource::MemoryDataSource(unsigned char * block, long length) 
    55: seekPos(0) 
    6 , memoryBlock(block) 
    76, blockLength(length) 
    87, eof(false) 
     8, memoryBlock(block) 
    99{ 
    1010} 
     
    1616size_t MemoryDataSource::DataSourceFread(void* lpBuf, size_t size, size_t count) 
    1717{ 
    18        if (seekPos + size * count > blockLength) 
     18        if (seekPos + size * count > (size_t) blockLength) 
    1919        { 
    2020                count = (blockLength - seekPos) / size; 
  • spike/grib/degrib18/degrib/metaparse.cpp

    r12066 r13834  
    11501150   if (is4[4] != 4) { 
    11511151#ifdef DEBUG 
    1152       printf ("ERROR IS4 not labeled correctly. %ld\n", is4[4]); 
     1152      printf ("ERROR IS4 not labeled correctly. %d\n", is4[4]); 
    11531153#endif 
    1154       errSprintf ("ERROR IS4 not labeled correctly. %ld\n", is4[4]); 
     1154      errSprintf ("ERROR IS4 not labeled correctly. %d\n", is4[4]); 
    11551155      return -2; 
    11561156   } 
     
    11701170       (is4[7] != GS4_SATELLITE) && (is4[7] != GS4_DERIVED_INTERVAL)) { 
    11711171#ifdef DEBUG 
    1172       printf ("Un-supported Template. %ld\n", is4[7]); 
     1172      printf ("Un-supported Template. %d\n", is4[7]); 
    11731173#endif 
    1174       errSprintf ("Un-supported Template. %ld\n", is4[7]); 
     1174      errSprintf ("Un-supported Template. %d\n", is4[7]); 
    11751175      return -4; 
    11761176   } 
     
    17901790                             meta->pds2.refTime) / 3600); 
    17911791      } else if (meta->pds2.sect4.Interval[0].timeRangeUnit == 0) { 
    1792          lenTime = meta->pds2.sect4.Interval[0].lenTime / 60.
     1792          lenTime = (sInt4) (meta->pds2.sect4.Interval[0].lenTime / 60.)
    17931793      } else if (meta->pds2.sect4.Interval[0].timeRangeUnit == 1) { 
    17941794         lenTime = meta->pds2.sect4.Interval[0].lenTime; 
     
    18021802         lenTime = meta->pds2.sect4.Interval[0].lenTime * 12; 
    18031803      } else if (meta->pds2.sect4.Interval[0].timeRangeUnit == 13) { 
    1804          lenTime = meta->pds2.sect4.Interval[0].lenTime / 3600.
     1804         lenTime = (sInt4) (meta->pds2.sect4.Interval[0].lenTime / 3600.)
    18051805      } else { 
    18061806         lenTime = 0; 
  • spike/grib/degrib18/degrib/metaprint.cpp

    r10748 r13834  
    306306         for (i = 0; i < sect2->wx.dataLen; i++) { 
    307307            if (sect2->wx.ugly[i].validIndex != -1) { 
    308                sprintf (buffer, "Elem %3d  Is Used", i); 
     308                sprintf (buffer, "Elem %3d  Is Used", (int) i); 
    309309            } else { 
    310                sprintf (buffer, "Elem %3d NOT Used", i); 
     310                sprintf (buffer, "Elem %3d NOT Used", (int) i); 
    311311            } 
    312312            Print ("PDS-S2", buffer, Prt_S, sect2->wx.data[i]); 
     
    317317                sect2->unknown.dataLen); 
    318318         for (i = 0; i < sect2->unknown.dataLen; i++) { 
    319             sprintf (buffer, "Element %d", i); 
     319            sprintf (buffer, "Element %d", (int) i); 
    320320            Print ("PDS-S2", buffer, Prt_F, sect2->unknown.data[i]); 
    321321         } 
     
    701701                           sect4->Interval[i].incrType)); 
    702702            /* Following is so we get "# str" not "# (str)" */ 
    703             sprintf (buffer, "%ld %s", sect4->Interval[i].lenTime, 
     703            sprintf (buffer, "%d %s", sect4->Interval[i].lenTime, 
    704704                     Lookup (tbl44, sizeof (tbl44), 
    705705                             sect4->Interval[i].timeRangeUnit)); 
    706706            Print ("PDS-S4", "Time range for processing", Prt_S, buffer); 
    707707            /* Following is so we get "# str" not "# (str)" */ 
    708             sprintf (buffer, "%ld %s", sect4->Interval[i].timeIncr, 
     708            sprintf (buffer, "%d %s", sect4->Interval[i].timeIncr, 
    709709                     Lookup (tbl44, sizeof (tbl44), 
    710710                             sect4->Interval[i].incrUnit)); 
     
    742742                           sect4->Interval[i].incrType)); 
    743743            /* Following is so we get "# str" not "# (str)" */ 
    744             sprintf (buffer, "%ld %s", sect4->Interval[i].lenTime, 
     744            sprintf (buffer, "%d %s", sect4->Interval[i].lenTime, 
    745745                     Lookup (tbl44, sizeof (tbl44), 
    746746                             sect4->Interval[i].timeRangeUnit)); 
    747747            Print ("PDS-S4", "Time range for processing", Prt_S, buffer); 
    748748            /* Following is so we get "# str" not "# (str)" */ 
    749             sprintf (buffer, "%ld %s", sect4->Interval[i].timeIncr, 
     749            sprintf (buffer, "%d %s", sect4->Interval[i].timeIncr, 
    750750                     Lookup (tbl44, sizeof (tbl44), 
    751751                             sect4->Interval[i].incrUnit)); 
     
    760760         Print ("PDS-S4", "Probability type", Prt_DS, sect4->probType, 
    761761                Lookup (tbl49, sizeof (tbl49), sect4->probType)); 
    762          sprintf (buffer, "%ld, %d", sect4->lowerLimit.value, 
     762         sprintf (buffer, "%d, %d", sect4->lowerLimit.value, 
    763763                  sect4->lowerLimit.factor); 
    764764         Print ("PDS-S4", "Lower limit (scale value, scale factor)", Prt_GS, 
    765765                sect4->lowerLimit.value * 
    766766                pow (10, -1 * sect4->lowerLimit.factor), buffer); 
    767          sprintf (buffer, "%ld, %d", sect4->upperLimit.value, 
     767         sprintf (buffer, "%d, %d", sect4->upperLimit.value, 
    768768                  sect4->upperLimit.factor); 
    769769         Print ("PDS-S4", "Upper limit (scale value, scale factor)", Prt_GS, 
     
    795795                           sect4->Interval[i].incrType)); 
    796796            /* Following is so we get "# str" not "# (str)" */ 
    797             sprintf (buffer, "%ld %s", sect4->Interval[i].lenTime, 
     797            sprintf (buffer, "%d %s", sect4->Interval[i].lenTime, 
    798798                     Lookup (tbl44, sizeof (tbl44), 
    799799                             sect4->Interval[i].timeRangeUnit)); 
    800800            Print ("PDS-S4", "Time range for processing", Prt_S, buffer); 
    801801            /* Following is so we get "# str" not "# (str)" */ 
    802             sprintf (buffer, "%ld %s", sect4->Interval[i].timeIncr, 
     802            sprintf (buffer, "%d %s", sect4->Interval[i].timeIncr, 
    803803                     Lookup (tbl44, sizeof (tbl44), 
    804804                             sect4->Interval[i].incrUnit)); 
     
    813813         Print ("PDS-S4", "Probability type", Prt_DS, sect4->probType, 
    814814                Lookup (tbl49, sizeof (tbl49), sect4->probType)); 
    815          sprintf (buffer, "%ld, %d", sect4->lowerLimit.value, 
     815         sprintf (buffer, "%d, %d", sect4->lowerLimit.value, 
    816816                  sect4->lowerLimit.factor); 
    817817         Print ("PDS-S4", "Lower limit (scale value, scale factor)", Prt_GS, 
    818818                sect4->lowerLimit.value * 
    819819                pow (10, -1 * sect4->lowerLimit.factor), buffer); 
    820          sprintf (buffer, "%ld, %d", sect4->upperLimit.value, 
     820         sprintf (buffer, "%d, %d", sect4->upperLimit.value, 
    821821                  sect4->upperLimit.factor); 
    822822         Print ("PDS-S4", "Upper limit (scale value, scale factor)", Prt_GS, 
     
    846846                           sect4->Interval[i].incrType)); 
    847847            /* Following is so we get "# str" not "# (str)" */ 
    848             sprintf (buffer, "%ld %s", sect4->Interval[i].lenTime, 
     848            sprintf (buffer, "%d %s", sect4->Interval[i].lenTime, 
    849849                     Lookup (tbl44, sizeof (tbl44), 
    850850                             sect4->Interval[i].timeRangeUnit)); 
    851851            Print ("PDS-S4", "Time range for processing", Prt_S, buffer); 
    852852            /* Following is so we get "# str" not "# (str)" */ 
    853             sprintf (buffer, "%ld %s", sect4->Interval[i].timeIncr, 
     853            sprintf (buffer, "%d %s", sect4->Interval[i].timeIncr, 
    854854                     Lookup (tbl44, sizeof (tbl44), 
    855855                             sect4->Interval[i].incrUnit)); 
     
    860860         /* This case should have been handled in first switch statement of 
    861861          * this procedure, but just in case... */ 
    862          errSprintf ("Un-supported Sect4 template %ld\n", sect4->templat); 
     862         errSprintf ("Un-supported Sect4 template %d\n", sect4->templat); 
    863863         return -2; 
    864864   } 
     
    11511151      default: 
    11521152         Print ("GDS", "Projection Type", Prt_D, gds->projType); 
    1153          errSprintf ("Un-supported Map Projection %ld\n", gds->projType); 
     1153         errSprintf ("Un-supported Map Projection %d\n", gds->projType); 
    11541154         return -1; 
    11551155   } 
  • spike/grib/degrib18/degrib/myutil.c

    r10749 r13834  
    407407} 
    408408 
     409/**  
    409410static int FileMatch (const char *filename, const char *filter) 
    410411{ 
     
    437438   return (*ptr2 == '\0'); 
    438439} 
     440**/ 
    439441 
    440442int myGlob (const char *dirName, const char *filter, size_t *Argc, 
  • spike/grib/degrib18/degrib/tdlpack.cpp

    r12066 r13834  
    236236   if (tau != project_hr) { 
    237237      printf ("Warning: Inconsistant Projections in hours in " 
    238               "ReadTDLPSect1 (%ld vs %d)\n", tau, project_hr); 
     238              "ReadTDLPSect1 (%d vs %d)\n", tau, project_hr); 
    239239/* 
    240240      errSprintf ("Warning: Inconsistant Projections in hours in " 
     
    339339   Print ("PDS-TDLP", "Reference Time", Prt_S, buffer); 
    340340   Print ("PDS-TDLP", "Plain Language", Prt_S, pds->Descriptor); 
    341    sprintf (buffer, "%09ld", pds->ID1); 
     341   sprintf (buffer, "%09d", pds->ID1); 
    342342   Print ("PDS-TDLP", "ID 1", Prt_S, buffer); 
    343    sprintf (buffer, "%09ld", pds->ID2); 
     343   sprintf (buffer, "%09d", pds->ID2); 
    344344   Print ("PDS-TDLP", "ID 2", Prt_S, buffer); 
    345    sprintf (buffer, "%09ld", pds->ID3); 
     345   sprintf (buffer, "%09d", pds->ID3); 
    346346   Print ("PDS-TDLP", "ID 3", Prt_S, buffer); 
    347347   Print ("PDS-TDLP", "ID 4", Prt_D, pds->ID4); 
     
    10661066   printf ("nbit %d, ibit %d, jbit %d, kbit %d\n", nbit, ibit, jbit, kbit); 
    10671067   if ((t_numBytes + ceil (t_numBits / 8.)) != sectLen) { 
    1068       printf ("Caution: # bytes in groups %ld (%ld + %ld / 8) != " 
    1069               "sectLen %ld\n", (sInt4) (t_numBytes + ceil (t_numBits / 8.)), 
     1068      printf ("Caution: # bytes in groups %d (%d + %d / 8) != " 
     1069              "sectLen %d\n", (sInt4) (t_numBytes + ceil (t_numBits / 8.)), 
    10701070              t_numBytes, t_numBits, sectLen); 
    10711071   } 
     
    11751175#ifdef DEBUG 
    11761176                     printf ("This doesn't happen often.\n"); 
    1177                      printf ("%d %d %ld\n", i, grp[i].bit, grp[i].min); 
     1177                     printf ("%d %d %d\n", (int) i, grp[i].bit, grp[i].min); 
    11781178#endif 
    11791179                     myAssert (1 == 2); 
     
    13741374#ifdef DEBUG 
    13751375                     printf ("This doesn't happen often.\n"); 
    1376                      printf ("%d %d %ld\n", i, grp[i].bit, grp[i].min); 
     1376                     printf ("%d %d %d\n", (int) i, grp[i].bit, grp[i].min); 
    13771377                     myAssert (1 == 2); 
    13781378#endif 
     
    43824382   /* Sanity check ! */ 
    43834383   if (li_temp != DataLen) { 
    4384       printf ("Total packed in groups %ld != DataLen %ld\n", li_temp, 
     4384      printf ("Total packed in groups %d != DataLen %d\n", li_temp, 
    43854385              DataLen); 
    43864386   } 
  • spike/grib/degrib18/g2clib-1.0.4/g2_addfield.c

    r13666 r13834  
    190190        if ( len > lencurr ) { 
    191191          printf("g2_addfield: Section byte counts don''t add to total.\n"); 
    192           printf("g2_addfield: Sum of section byte counts = %ld\n",len); 
    193           printf("g2_addfield: Total byte count in Section 0 = %ld\n",lencurr); 
     192          printf("g2_addfield: Sum of section byte counts = %d\n",len); 
     193          printf("g2_addfield: Total byte count in Section 0 = %d\n",lencurr); 
    194194          ierr=-3; 
    195195          return(ierr); 
     
    392392#endif  /* USE_PNG */ 
    393393      else { 
    394         printf("g2_addfield: Data Representation Template 5.%ld not yet implemented.\n",idrsnum); 
     394        printf("g2_addfield: Data Representation Template 5.%d not yet implemented.\n",idrsnum); 
    395395        ierr=-7; 
    396396        return(ierr); 
  • spike/grib/degrib18/g2clib-1.0.4/g2_addgrid.c

    r13666 r13834  
    125125        if ( len > lencurr ) { 
    126126          printf("g2_addgrid: Section byte counts don''t add to total.\n"); 
    127           printf("g2_addgrid: Sum of section byte counts = %ld\n",len); 
    128           printf("g2_addgrid: Total byte count in Section 0 = %ld\n",lencurr); 
     127          printf("g2_addgrid: Sum of section byte counts = %d\n",len); 
     128          printf("g2_addgrid: Total byte count in Section 0 = %d\n",lencurr); 
    129129          ierr=-3; 
    130130          return(ierr); 
  • spike/grib/degrib18/g2clib-1.0.4/g2_addlocal.c

    r10748 r13834  
    103103        if ( len > lencurr ) { 
    104104          printf("g2_addlocal: Section byte counts don't add to total.\n"); 
    105           printf("g2_addlocal: Sum of section byte counts = %ld\n",len); 
    106           printf("g2_addlocal: Total byte count in Section 0 = %ld\n",lencurr); 
     105          printf("g2_addlocal: Sum of section byte counts = %d\n",len); 
     106          printf("g2_addlocal: Total byte count in Section 0 = %d\n",lencurr); 
    107107          ierr=-3; 
    108108          return(ierr); 
     
    114114      if ( (isecnum!=1) && (isecnum!=7) ) { 
    115115        printf("g2_addlocal: Section 2 can only be added after Section 1 or Section 7.\n"); 
    116         printf("g2_addlocal: Section %ld was the last found in given GRIB message.\n",isecnum); 
     116        printf("g2_addlocal: Section %d was the last found in given GRIB message.\n",isecnum); 
    117117        ierr=-4; 
    118118        return(ierr); 
  • spike/grib/degrib18/g2clib-1.0.4/g2_getfld.c

    r10748 r13834  
    350350        // 
    351351        if ( isecnum<1 || isecnum>7 ) { 
    352           printf("g2_getfld: Unrecognized Section Encountered=%ld\n",isecnum); 
     352          printf("g2_getfld: Unrecognized Section Encountered=%d\n",isecnum); 
    353353          ierr=8; 
    354354          return(ierr); 
     
    542542//  before the requested field was found. 
    543543// 
    544       printf("g2_getfld: GRIB message contained %ld different fields.\n",numfld); 
    545       printf("g2_getfld: The request was for field %ld.\n",ifldnum); 
     544      printf("g2_getfld: GRIB message contained %d different fields.\n",numfld); 
     545      printf("g2_getfld: The request was for field %d.\n",ifldnum); 
    546546      ierr=6; 
    547547 
  • spike/grib/degrib18/g2clib-1.0.4/g2_gribend.c

    r10748 r13834  
    9898      if ( isecnum != 7 ) { 
    9999        printf("g2_gribend: Section 8 can only be added after Section 7.\n"); 
    100         printf("g2_gribend: Section %ld was the last found in given GRIB message.\n",isecnum); 
     100        printf("g2_gribend: Section %d was the last found in given GRIB message.\n",isecnum); 
    101101        ierr=-4; 
    102102        return (ierr); 
  • spike/grib/degrib18/g2clib-1.0.4/g2_info.c

    r10748 r13834  
    179179        } 
    180180        else { 
    181            printf("g2_info: Invalid section number found in GRIB message: %ld\n"                   ,isecnum); 
     181           printf("g2_info: Invalid section number found in GRIB message: %d\n"                   ,isecnum); 
    182182           ierr=6; 
    183183           return(ierr); 
  • spike/grib/degrib18/g2clib-1.0.4/jpcunpack.c

    r12077 r13834  
    5959            return(1); 
    6060         } 
    61          iret=(g2int)dec_jpeg2000(cpack,len,ifld); 
     61         iret=(g2int)dec_jpeg2000((char *) cpack,len,ifld); 
    6262         for (j=0;j<ndpts;j++) { 
    6363           fld[j]=(((g2float)ifld[j]*bscale)+ref)*dscale; 
  • spike/grib/gribdataset.cpp

    r13830 r13834  
    208208 
    209209    char * errMsg = errSprintf(NULL); // no intention to show errors, just swallow it and free the memory 
    210     CPLDebug( "GRIB", "%s", errMsg ); 
     210    if( errMsg != NULL ) 
     211        CPLDebug( "GRIB", "%s", errMsg ); 
    211212    free(errMsg); 
    212213    IS_Free(&is); 
     
    302303        free (buff); 
    303304        char * errMsg = errSprintf(NULL); 
    304         CPLDebug( "GRIB", "%s", errMsg ); 
     305        if( errMsg != NULL ) 
     306            CPLDebug( "GRIB", "%s", errMsg ); 
    305307        free(errMsg); 
    306308        return NULL;