diff --git a/src/cdi_int.h b/src/cdi_int.h index c06e34979633aadf4aa53a58dd5dc19412dd15f2..d8f73f5b16a65b716a3d15434851d446ed00f713 100644 --- a/src/cdi_int.h +++ b/src/cdi_int.h @@ -180,11 +180,11 @@ typedef struct int param; int ilevel; int ilevel2; - int ltype; + short ltype; short tsteptype; short varID; - int levelID; short used; + int levelID; char varname[32]; // needed for grib decoding with GRIB_API VarScanKeys scanKeys; var_tile_t tiles; // tile-related meta-data, currently for GRIB-API only. diff --git a/src/stream_cgribex.c b/src/stream_cgribex.c index a2c73b7f0c104ce5fc2657e94d659287bcd380b2..ec012fbb9877386befba333fc651cabfdfa67743 100644 --- a/src/stream_cgribex.c +++ b/src/stream_cgribex.c @@ -32,12 +32,12 @@ typedef struct typedef struct { + size_t gridsize; int param; int level1; int level2; - int ltype; - int tsteptype; - size_t gridsize; + short ltype; + short tsteptype; } compvar_t; typedef struct @@ -562,7 +562,7 @@ cgribexAddRecord(stream_t *streamptr, cgribexrec_t *cgribexp, int param, size_t record->param = param; record->ilevel = level1; record->ilevel2 = level2; - record->ltype = leveltype; + record->ltype = (short) leveltype; record->tsteptype = (short) tsteptype; record->gridsize = cgribexGetGridsize(cgribexp->sec4); @@ -717,8 +717,8 @@ cgribexVarSet(int param, int level1, int level2, int leveltype, int trange, size compVar.param = param; compVar.level1 = level1; compVar.level2 = level2; - compVar.ltype = leveltype; - compVar.tsteptype = tsteptype; + compVar.ltype = (short) leveltype; + compVar.tsteptype = (short) tsteptype; compVar.gridsize = gridsize; return compVar; diff --git a/src/stream_grb.c b/src/stream_grb.c index 9441a53e3876091937dc1881c924dd5b05afde71..7e3e70891f689110d0564888eeac54d3d8f6c8a5 100644 --- a/src/stream_grb.c +++ b/src/stream_grb.c @@ -407,9 +407,7 @@ streamInqGRIBinfo(int streamID, int *intnum, float *fltnum, off_t *bignum) { stream_t *streamptr = stream_to_pointer(streamID); - int filetype = streamptr->filetype; - - if (filetype == CDI_FILETYPE_GRB) + if (streamptr->filetype == CDI_FILETYPE_GRB) { int tsID = streamptr->curTsID; int vrecID = streamptr->tsteps[tsID].curRecID; diff --git a/src/stream_gribapi.c b/src/stream_gribapi.c index 30c14eba1bfd748fa5a7910663f93bc2ba17ec2d..7d895bb9118ddc41d1162b4af005aacb24a0a6eb 100644 --- a/src/stream_gribapi.c +++ b/src/stream_gribapi.c @@ -28,12 +28,12 @@ static const var_tile_t dummy_tiles = { 0, -1, -1, -1, -1, -1 }; typedef struct { + size_t gridsize; int param; int level1; int level2; - int ltype; - int tsteptype; - size_t gridsize; + short ltype; + short tsteptype; char name[32]; VarScanKeys scanKeys; var_tile_t tiles; @@ -721,7 +721,7 @@ gribapiAddRecord(stream_t *streamptr, int param, grib_handle *gh, size_t recsize record->param = param; record->ilevel = level1; record->ilevel2 = level2; - record->ltype = leveltype1; + record->ltype = (short) leveltype1; record->tsteptype = (short) tsteptype; record->gridsize = gribapiGetGridsize(gh); record->scanKeys = *scanKeys; @@ -910,8 +910,8 @@ gribapiVarCompare(const compvar2_t *compVar, const record_t *record, int flag) compVar0.param = record->param; compVar0.level1 = record->ilevel; compVar0.level2 = record->ilevel2; - compVar0.ltype = record->ltype; - compVar0.tsteptype = record->tsteptype; + compVar0.ltype = (short) record->ltype; + compVar0.tsteptype = (short) record->tsteptype; compVar0.gridsize = record->gridsize; memcpy(compVar0.name, record->varname, sizeof(compVar->name)); @@ -2749,7 +2749,7 @@ gribapiDefLevel(int editionNumber, grib_handle *gh, int zaxisID, int levelID, in } long grib_ltype2 = (ltype != ltype2 && ltype2 != -1) ? ltype2 : grib_ltype; - void (*defLevel)(grib_handle * gh, int gcinit, long leveltype1, long leveltype2, bool hasBounds, double level, double dlevel1, + void (*defLevel)(grib_handle *gh, int gcinit, long leveltype1, long leveltype2, bool hasBounds, double level, double dlevel1, double dlevel2) = (editionNumber <= 1) ? grib1DefLevel : grib2DefLevel; @@ -3176,7 +3176,7 @@ convertDataScanningMode(int scanModeIN, int scanModeOUT, double *data, size_t gr // printf(".\n"); } } // end if (scanModeOUT==96) - } // end if (scanModeIN==64) + } // end if (scanModeIN==64) if (scanModeIN == 00) // Scanning Mode (00 dec) +i, -j; i direction consecutive (row-major order West->East & South->North ) @@ -3206,7 +3206,7 @@ convertDataScanningMode(int scanModeIN, int scanModeOUT, double *data, size_t gr for (size_t i = 0; i < iDim; i++) data[j + i * jDim] = dataCopy[i + jInv * iDim]; // source data has -j } } // end if (scanModeOUT==96) - } // end if (scanModeIN==00) + } // end if (scanModeIN==00) if (scanModeIN == 96) // Scanning Mode (00 dec) +i, -j; i direction consecutive (row-major order West->East & South->North ) @@ -3239,7 +3239,7 @@ convertDataScanningMode(int scanModeIN, int scanModeOUT, double *data, size_t gr data[i + jXiDim] = dataCopy[jInv + i * jDim]; // target data has -j } } // end if (scanModeOUT==00) - } // end if (scanModeIN==96) + } // end if (scanModeIN==96) if (cdiDebugExt >= 100) { diff --git a/src/stream_ieg.c b/src/stream_ieg.c index 4194ed0373cba5a384ee4cbfc4515d54dbee1aa6..072544bfb3f870deb9cabe6e5a42f644b68c25c8 100644 --- a/src/stream_ieg.c +++ b/src/stream_ieg.c @@ -541,7 +541,7 @@ iegAddRecord(stream_t *streamptr, int param, int *pdb, int *gdb, double *vct, si record->param = param; record->ilevel = level1; record->ilevel2 = level2; - record->ltype = IEG_P_LevelType(pdb); + record->ltype = (short) IEG_P_LevelType(pdb); int gridtype = (IEG_G_GridType(gdb) == 0) ? GRID_LONLAT : (IEG_G_GridType(gdb) == 10) ? GRID_PROJECTION