Commit 9a973a00 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

timecache_t: changed type of variable from int to size_t.

parent 5b5eb7b9
......@@ -7,9 +7,9 @@
#define MAX_TIMECACHE_SIZE 1024
typedef struct {
int size;
int startid;
int maxvals;
size_t size;
size_t startid;
size_t maxvals;
double cache[MAX_TIMECACHE_SIZE];
}
timecache_t;
......
......@@ -4128,13 +4128,14 @@ double get_timevalue(int fileID, int nctimevarid, int tsID, timecache_t *tcache)
{
if ( tcache->size == 0 || (tsID < tcache->startid || tsID > (tcache->startid+tcache->size-1)) )
{
int maxvals = MAX_TIMECACHE_SIZE;
size_t maxvals = MAX_TIMECACHE_SIZE;
tcache->startid = (tsID/MAX_TIMECACHE_SIZE)*MAX_TIMECACHE_SIZE;
if ( (tcache->startid + maxvals) > tcache->maxvals ) maxvals = (tcache->maxvals)%MAX_TIMECACHE_SIZE;
tcache->size = maxvals;
size_t index = (size_t) tcache->startid;
// fprintf(stderr, "fill time cache: %d %d %d %d %d\n", tcache->maxvals, tsID, tcache->startid, tcache->startid+maxvals-1, maxvals);
for ( int ival = 0; ival < maxvals; ++ival )
//fprintf(stderr, "fill time cache: %d %d %d %d %d\n", tcache->maxvals, tsID, tcache->startid, tcache->startid+maxvals-1, maxvals);
//cdf_get_vara_double(fileID, nctimevarid, &tcache->startid, &maxvals, tcache->cache);
size_t index = tcache->startid;
for ( size_t ival = 0; ival < maxvals; ++ival )
{
cdf_get_var1_double(fileID, nctimevarid, &index, &timevalue);
tcache->cache[ival] = timevalue;
......
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