Commit bd35c78d authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Changed type of recsize to size_t.

parent 819811b8
...@@ -327,7 +327,7 @@ void cgribexGetGrid(stream_t *streamptr, int *isec2, int *isec4, grid_t *grid, i ...@@ -327,7 +327,7 @@ void cgribexGetGrid(stream_t *streamptr, int *isec2, int *isec4, grid_t *grid, i
static static
void cgribexAddRecord(stream_t * streamptr, int param, int *isec1, int *isec2, double *fsec2, double *fsec3, void cgribexAddRecord(stream_t * streamptr, int param, int *isec1, int *isec2, double *fsec2, double *fsec3,
int *isec4, long recsize, off_t position, int datatype, int comptype, int lmv, int iret) int *isec4, size_t recsize, off_t position, int datatype, int comptype, int lmv, int iret)
{ {
int varID; int varID;
int levelID = 0; int levelID = 0;
...@@ -345,7 +345,7 @@ void cgribexAddRecord(stream_t * streamptr, int param, int *isec1, int *isec2, d ...@@ -345,7 +345,7 @@ void cgribexAddRecord(stream_t * streamptr, int param, int *isec1, int *isec2, d
/* fprintf(stderr, "param %d %d %d %d\n", param, level1, level2, ISEC1_LevelType); */ /* fprintf(stderr, "param %d %d %d %d\n", param, level1, level2, ISEC1_LevelType); */
record->size = (size_t)recsize; record->size = recsize;
record->position = position; record->position = position;
record->param = param; record->param = param;
record->ilevel = level1; record->ilevel = level1;
...@@ -579,7 +579,7 @@ int cgribexScanTimestep1(stream_t * streamptr) ...@@ -579,7 +579,7 @@ int cgribexScanTimestep1(stream_t * streamptr)
unsigned nrecords, recID; unsigned nrecords, recID;
int nrecs_scanned = 0; int nrecs_scanned = 0;
int datatype; int datatype;
long recsize = 0; size_t recsize = 0;
bool warn_time = true; bool warn_time = true;
bool warn_numavg = true; bool warn_numavg = true;
int taxisID = -1; int taxisID = -1;
...@@ -631,13 +631,13 @@ int cgribexScanTimestep1(stream_t * streamptr) ...@@ -631,13 +631,13 @@ int cgribexScanTimestep1(stream_t * streamptr)
streamptr->ntsteps = 1; streamptr->ntsteps = 1;
break; break;
} }
if ( (size_t)recsize > buffersize ) if ( recsize > buffersize )
{ {
buffersize = (size_t)recsize; buffersize = recsize;
gribbuffer = Realloc(gribbuffer, buffersize); gribbuffer = Realloc(gribbuffer, buffersize);
} }
readsize = (size_t)recsize; readsize = recsize;
rstatus = gribRead(fileID, (unsigned char *)gribbuffer, &readsize); rstatus = gribRead(fileID, (unsigned char *)gribbuffer, &readsize);
if ( rstatus ) break; if ( rstatus ) break;
...@@ -797,7 +797,7 @@ int cgribexScanTimestep2(stream_t * streamptr) ...@@ -797,7 +797,7 @@ int cgribexScanTimestep2(stream_t * streamptr)
int varID, gridID; int varID, gridID;
size_t readsize; size_t readsize;
int nrecs, recID; int nrecs, recID;
long recsize = 0; size_t recsize = 0;
bool warn_numavg = true; bool warn_numavg = true;
int tsteptype; int tsteptype;
long unzipsize; long unzipsize;
...@@ -854,13 +854,13 @@ int cgribexScanTimestep2(stream_t * streamptr) ...@@ -854,13 +854,13 @@ int cgribexScanTimestep2(stream_t * streamptr)
streamptr->ntsteps = 2; streamptr->ntsteps = 2;
break; break;
} }
if ( (size_t)recsize > buffersize ) if ( recsize > buffersize )
{ {
buffersize = (size_t)recsize; buffersize = recsize;
gribbuffer = Realloc(gribbuffer, buffersize); gribbuffer = Realloc(gribbuffer, buffersize);
} }
readsize = (size_t)recsize; readsize = recsize;
rstatus = gribRead(fileID, (unsigned char *)gribbuffer, &readsize); rstatus = gribRead(fileID, (unsigned char *)gribbuffer, &readsize);
if ( rstatus ) break; if ( rstatus ) break;
...@@ -974,7 +974,7 @@ int cgribexScanTimestep2(stream_t * streamptr) ...@@ -974,7 +974,7 @@ int cgribexScanTimestep2(stream_t * streamptr)
if ( CDI_Debug ) if ( CDI_Debug )
Message("Read record %2d (id=%s lev1=%d lev2=%d) %8d %6d", nrecs_scanned, paramstr, level1, level2, vdate, vtime); Message("Read record %2d (id=%s lev1=%d lev2=%d) %8d %6d", nrecs_scanned, paramstr, level1, level2, vdate, vtime);
streamptr->tsteps[tsID].records[recID].size = (size_t)recsize; streamptr->tsteps[tsID].records[recID].size = recsize;
if ( cgribexVarCompare(compVar, streamptr->tsteps[tsID].records[recID], 0) != 0 ) if ( cgribexVarCompare(compVar, streamptr->tsteps[tsID].records[recID], 0) != 0 )
{ {
...@@ -1034,7 +1034,7 @@ int cgribexScanTimestep(stream_t * streamptr) ...@@ -1034,7 +1034,7 @@ int cgribexScanTimestep(stream_t * streamptr)
int rstatus = 0; int rstatus = 0;
double fsec2[512], fsec3[2], *fsec4 = NULL; double fsec2[512], fsec3[2], *fsec4 = NULL;
int lmv = 0, iret = 0; int lmv = 0, iret = 0;
long recsize = 0; size_t recsize = 0;
off_t recpos = 0; off_t recpos = 0;
void *gribbuffer; void *gribbuffer;
size_t buffersize = 0; size_t buffersize = 0;
...@@ -1100,15 +1100,15 @@ int cgribexScanTimestep(stream_t * streamptr) ...@@ -1100,15 +1100,15 @@ int cgribexScanTimestep(stream_t * streamptr)
streamptr->ntsteps = streamptr->rtsteps + 1; streamptr->ntsteps = streamptr->rtsteps + 1;
break; break;
} }
if ( recsize > 0 && (size_t)recsize > buffersize ) if ( recsize > 0 && recsize > buffersize )
{ {
buffersize = (size_t)recsize; buffersize = recsize;
gribbuffer = Realloc(gribbuffer, buffersize); gribbuffer = Realloc(gribbuffer, buffersize);
} }
if ( rindex >= nrecs ) break; if ( rindex >= nrecs ) break;
readsize = (size_t)recsize; readsize = recsize;
rstatus = gribRead(fileID, (unsigned char *)gribbuffer, &readsize); rstatus = gribRead(fileID, (unsigned char *)gribbuffer, &readsize);
if ( rstatus ) if ( rstatus )
{ {
...@@ -1242,7 +1242,7 @@ int cgribexScanTimestep(stream_t * streamptr) ...@@ -1242,7 +1242,7 @@ int cgribexScanTimestep(stream_t * streamptr)
} }
streamptr->tsteps[tsID].records[recID].position = recpos; streamptr->tsteps[tsID].records[recID].position = recpos;
streamptr->tsteps[tsID].records[recID].size = (size_t)recsize; streamptr->tsteps[tsID].records[recID].size = recsize;
rindex++; rindex++;
} }
......
...@@ -804,8 +804,8 @@ int gribapiScanTimestep1(stream_t * streamptr) ...@@ -804,8 +804,8 @@ int gribapiScanTimestep1(stream_t * streamptr)
while ( TRUE ) while ( TRUE )
{ {
int level1 = 0, level2 = 0; int level1 = 0, level2 = 0;
size_t recsize = (size_t)gribGetSize(fileID); size_t recsize = gribGetSize(fileID);
recpos = fileGetPos(fileID); recpos = fileGetPos(fileID);
if ( recsize == 0 ) if ( recsize == 0 )
{ {
...@@ -1027,8 +1027,8 @@ int gribapiScanTimestep2(stream_t * streamptr) ...@@ -1027,8 +1027,8 @@ int gribapiScanTimestep2(stream_t * streamptr)
{ {
if ( rindex > nrecords ) break; if ( rindex > nrecords ) break;
size_t recsize = (size_t)gribGetSize(fileID); size_t recsize = gribGetSize(fileID);
recpos = fileGetPos(fileID); recpos = fileGetPos(fileID);
if ( recsize == 0 ) if ( recsize == 0 )
{ {
streamptr->ntsteps = 2; streamptr->ntsteps = 2;
...@@ -1248,8 +1248,8 @@ int gribapiScanTimestep(stream_t * streamptr) ...@@ -1248,8 +1248,8 @@ int gribapiScanTimestep(stream_t * streamptr)
{ {
if ( rindex > nrecs ) break; if ( rindex > nrecs ) break;
size_t recsize = (size_t)gribGetSize(fileID); size_t recsize = gribGetSize(fileID);
recpos = fileGetPos(fileID); recpos = fileGetPos(fileID);
if ( recsize == 0 ) if ( recsize == 0 )
{ {
streamptr->ntsteps = streamptr->rtsteps + 1; streamptr->ntsteps = streamptr->rtsteps + 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment