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

stream_srv: bug fix for codes > 999

parent da9edd95
......@@ -4,6 +4,7 @@
* zaxis: mt safe version
* model: mt safe version
* remove H5 test version
* stream_srv: bug fix for codes > 999 [report: Simon Blessing]
* cdi_limits: define MAX_STREAMS, MAX_VLISTS, MAX_GRIDS, MAX_ZAXIS
* Version 1.0.5 released
......
......@@ -108,7 +108,7 @@ static void printInfo(int gridtype, int date, int time, int code, double level,
decodeDate(date, &year, &month, &day);
decodeTime(time, &hour, &minute);
fprintf(stdout, "%6d : %4.4d-%2.2d-%2.2d %2.2d:%2.2d%4d %7g ",
fprintf(stdout, "%6d : %4.4d-%2.2d-%2.2d %2.2d:%2.2d %3d %7g ",
++rec, year, month, day, hour, minute, code, level);
fprintf(stdout, "%7d ", datasize);
......
......@@ -23,9 +23,15 @@
#define SINGLE_PRECISION 4
#define DOUBLE_PRECISION 8
#if defined (HAVE_LIBEXTRA)
typedef struct {
int code;
int level;
} EXTCOMPVAR;
int extInqDatatype(int prec)
{
int datatype;
......@@ -342,7 +348,6 @@ void extScanTimestep1(int streamID)
int rxysize = 0;
int rcode = 0, rlevel = 0, vdate = 0, vtime = 0;
DateTime datetime, datetime0;
long levelcode, levelcode0 = 0;
int tsID;
int varID;
long recsize;
......@@ -351,6 +356,7 @@ void extScanTimestep1(int streamID)
int taxisID = -1;
TAXIS *taxis;
int vlistID;
EXTCOMPVAR compVar, compVar0;
EXTREC *extp;
STREAM *streamptr;
......@@ -399,12 +405,14 @@ void extScanTimestep1(int streamID)
{
datetime.date = vdate;
datetime.time = vtime;
levelcode = rlevel*1000 + rcode;
compVar.code = rcode;
compVar.level = rlevel;
for ( recID = 0; recID < nrecs; recID++ )
{
levelcode0 = streamptr->tsteps[0].records[recID].ilevel*1000 +
streamptr->tsteps[0].records[recID].code;
if ( levelcode == levelcode0 ) break;
compVar0.code = streamptr->tsteps[0].records[recID].code;
compVar0.level = streamptr->tsteps[0].records[recID].ilevel;
if ( memcmp(&compVar0, &compVar, sizeof(EXTCOMPVAR)) == 0 ) break;
}
if ( recID < nrecs ) break;
if ( memcmp(&datetime, &datetime0, sizeof(DateTime)) )
......@@ -478,7 +486,6 @@ int extScanTimestep2(int streamID)
int fileID;
int rxysize = 0;
int rcode = 0, rlevel = 0, vdate = 0, vtime = 0;
long levelcode, levelcode0 = 0;
int tsID;
int varID;
long recsize;
......@@ -487,6 +494,7 @@ int extScanTimestep2(int streamID)
int nextstep;
TAXIS *taxis;
int vlistID;
EXTCOMPVAR compVar, compVar0;
EXTREC *extp;
STREAM *streamptr;
......@@ -551,13 +559,15 @@ int extScanTimestep2(int streamID)
taxis->vtime = vtime;
}
levelcode = rlevel*1000 + rcode;
compVar.code = rcode;
compVar.level = rlevel;
nextstep = FALSE;
for ( recID = 0; recID < nrecords; recID++ )
{
levelcode0 = streamptr->tsteps[tsID].records[recID].ilevel*1000 +
streamptr->tsteps[tsID].records[recID].code;
if ( levelcode == levelcode0 )
compVar0.code = streamptr->tsteps[tsID].records[recID].code;
compVar0.level = streamptr->tsteps[tsID].records[recID].ilevel;
if ( memcmp(&compVar0, &compVar, sizeof(EXTCOMPVAR)) == 0 )
{
if ( streamptr->tsteps[tsID].records[recID].used )
{
......@@ -584,10 +594,10 @@ int extScanTimestep2(int streamID)
streamptr->tsteps[tsID].records[recID].size = recsize;
levelcode0 = streamptr->tsteps[tsID].records[recID].ilevel*1000 +
streamptr->tsteps[tsID].records[recID].code;
compVar0.code = streamptr->tsteps[tsID].records[recID].code;
compVar0.level = streamptr->tsteps[tsID].records[recID].ilevel;
if ( levelcode != levelcode0 )
if ( memcmp(&compVar0, &compVar, sizeof(EXTCOMPVAR)) != 0 )
{
Message(func, "tsID = %d recID = %d code = %3d new %3d level = %3d new %3d",
tsID, recID,
......@@ -664,12 +674,12 @@ int extScanTimestep(int streamID)
int tsID;
int rxysize = 0;
int rcode = 0, rlevel = 0, vdate = 0, vtime = 0;
long levelcode, levelcode0 = 0;
long recsize = 0;
off_t recpos = 0;
int recID;
TAXIS *taxis;
int rindex, nrecs = 0;
EXTCOMPVAR compVar, compVar0;
EXTREC *extp;
STREAM *streamptr;
......@@ -738,11 +748,12 @@ int extScanTimestep(int streamID)
/*
extCmpRecord(streamID, tsID, nrecs, recpos, rcode, rlevel, rxysize);
*/
levelcode = rlevel*1000 + rcode;
levelcode0 = streamptr->tsteps[tsID].records[recID].ilevel*1000 +
streamptr->tsteps[tsID].records[recID].code;
compVar.code = rcode;
compVar.level = rlevel;
compVar0.code = streamptr->tsteps[tsID].records[recID].code;
compVar0.level = streamptr->tsteps[tsID].records[recID].ilevel;
if ( levelcode != levelcode0 )
if ( memcmp(&compVar0, &compVar, sizeof(EXTCOMPVAR)) != 0 )
{
Message(func, "tsID = %d recID = %d code = %3d new %3d level = %3d new %3d",
tsID, recID,
......
......@@ -25,9 +25,15 @@
#define SINGLE_PRECISION 4
#define DOUBLE_PRECISION 8
#if defined (HAVE_LIBIEG)
typedef struct {
int code;
int level;
} IEGCOMPVAR;
int iegInqDatatype(int prec)
{
int datatype;
......@@ -763,7 +769,6 @@ void iegScanTimestep1(int streamID)
int fileID;
int rcode = 0, rlevel = 0, vdate = 0, vtime = 0;
DateTime datetime, datetime0;
long levelcode, levelcode0 = 0;
int tsID;
int varID;
long recsize;
......@@ -772,6 +777,7 @@ void iegScanTimestep1(int streamID)
int taxisID = -1;
TAXIS *taxis;
int vlistID;
IEGCOMPVAR compVar, compVar0;
IEGREC *iegp;
STREAM *streamptr;
......@@ -822,12 +828,14 @@ void iegScanTimestep1(int streamID)
{
datetime.date = vdate;
datetime.time = vtime;
levelcode = rlevel*1000 + rcode;
compVar.code = rcode;
compVar.level = rlevel;
for ( recID = 0; recID < nrecs; recID++ )
{
levelcode0 = streamptr->tsteps[0].records[recID].ilevel*1000 +
streamptr->tsteps[0].records[recID].code;
if ( levelcode == levelcode0 ) break;
compVar0.code = streamptr->tsteps[0].records[recID].code;
compVar0.level = streamptr->tsteps[0].records[recID].ilevel;
if ( memcmp(&compVar0, &compVar, sizeof(IEGCOMPVAR)) == 0 ) break;
}
if ( recID < nrecs ) break;
if ( memcmp(&datetime, &datetime0, sizeof(DateTime)) )
......@@ -899,7 +907,6 @@ int iegScanTimestep2(int streamID)
int status;
int fileID;
int rcode = 0, rlevel = 0, vdate = 0, vtime = 0;
long levelcode, levelcode0 = 0;
int tsID;
int varID;
long recsize;
......@@ -908,6 +915,7 @@ int iegScanTimestep2(int streamID)
int nextstep;
TAXIS *taxis;
int vlistID;
IEGCOMPVAR compVar, compVar0;
IEGREC *iegp;
STREAM *streamptr;
......@@ -974,13 +982,15 @@ int iegScanTimestep2(int streamID)
taxis->vtime = vtime;
}
levelcode = rlevel*1000 + rcode;
compVar.code = rcode;
compVar.level = rlevel;
nextstep = FALSE;
for ( recID = 0; recID < nrecords; recID++ )
{
levelcode0 = streamptr->tsteps[tsID].records[recID].ilevel*1000 +
streamptr->tsteps[tsID].records[recID].code;
if ( levelcode == levelcode0 )
compVar0.code = streamptr->tsteps[tsID].records[recID].code;
compVar0.level = streamptr->tsteps[tsID].records[recID].ilevel;
if ( memcmp(&compVar0, &compVar, sizeof(IEGCOMPVAR)) == 0 )
{
if ( streamptr->tsteps[tsID].records[recID].used )
{
......@@ -1007,10 +1017,10 @@ int iegScanTimestep2(int streamID)
streamptr->tsteps[tsID].records[recID].size = recsize;
levelcode0 = streamptr->tsteps[tsID].records[recID].ilevel*1000 +
streamptr->tsteps[tsID].records[recID].code;
compVar0.code = streamptr->tsteps[tsID].records[recID].code;
compVar0.level = streamptr->tsteps[tsID].records[recID].ilevel;
if ( levelcode != levelcode0 )
if ( memcmp(&compVar0, &compVar, sizeof(IEGCOMPVAR)) != 0 )
{
Message(func, "tsID = %d recID = %d code = %3d new %3d level = %3d new %3d",
tsID, recID,
......@@ -1085,12 +1095,12 @@ int iegScanTimestep(int streamID)
int fileID;
int tsID;
int rcode = 0, rlevel = 0, vdate = 0, vtime = 0;
long levelcode, levelcode0 = 0;
long recsize = 0;
off_t recpos = 0;
int recID;
TAXIS *taxis;
int rindex, nrecs = 0;
IEGCOMPVAR compVar, compVar0;
IEGREC *iegp;
STREAM *streamptr;
......@@ -1159,11 +1169,12 @@ int iegScanTimestep(int streamID)
taxis->vtime = vtime;
}
levelcode = rlevel*1000 + rcode;
levelcode0 = streamptr->tsteps[tsID].records[recID].ilevel*1000 +
streamptr->tsteps[tsID].records[recID].code;
compVar.code = rcode;
compVar.level = rlevel;
compVar0.code = streamptr->tsteps[tsID].records[recID].code;
compVar0.level = streamptr->tsteps[tsID].records[recID].ilevel;
if ( levelcode != levelcode0 )
if ( memcmp(&compVar0, &compVar, sizeof(IEGCOMPVAR)) != 0 )
{
Message(func, "tsID = %d recID = %d code = %3d new %3d level = %3d new %3d",
tsID, recID,
......
......@@ -23,9 +23,15 @@
#define SINGLE_PRECISION 4
#define DOUBLE_PRECISION 8
#if defined (HAVE_LIBSERVICE)
typedef struct {
int code;
int level;
} SRVCOMPVAR;
int srvInqDatatype(int prec)
{
int datatype;
......@@ -355,7 +361,6 @@ void srvScanTimestep1(int streamID)
int rxsize = 0, rysize = 0;
int rcode = 0, rlevel = 0, vdate = 0, vtime = 0;
DateTime datetime, datetime0;
long levelcode, levelcode0 = 0;
int tsID;
int varID;
long recsize;
......@@ -364,6 +369,7 @@ void srvScanTimestep1(int streamID)
int taxisID = -1;
TAXIS *taxis;
int vlistID;
SRVCOMPVAR compVar, compVar0;
SRVREC *srvp;
STREAM *streamptr;
......@@ -413,12 +419,14 @@ void srvScanTimestep1(int streamID)
{
datetime.date = vdate;
datetime.time = vtime;
levelcode = rlevel*1000 + rcode;
compVar.code = rcode;
compVar.level = rlevel;
for ( recID = 0; recID < nrecs; recID++ )
{
levelcode0 = streamptr->tsteps[0].records[recID].ilevel*1000 +
streamptr->tsteps[0].records[recID].code;
if ( levelcode == levelcode0 ) break;
compVar0.code = streamptr->tsteps[0].records[recID].code;
compVar0.level = streamptr->tsteps[0].records[recID].ilevel;
if ( memcmp(&compVar0, &compVar, sizeof(SRVCOMPVAR)) == 0 ) break;
}
if ( recID < nrecs ) break;
if ( memcmp(&datetime, &datetime0, sizeof(DateTime)) )
......@@ -491,7 +499,6 @@ int srvScanTimestep2(int streamID)
int status;
int fileID;
int rcode = 0, rlevel = 0, vdate = 0, vtime = 0;
long levelcode, levelcode0 = 0;
int tsID;
int varID;
long recsize;
......@@ -500,6 +507,7 @@ int srvScanTimestep2(int streamID)
int nextstep;
TAXIS *taxis;
int vlistID;
SRVCOMPVAR compVar, compVar0;
SRVREC *srvp;
STREAM *streamptr;
......@@ -563,13 +571,15 @@ int srvScanTimestep2(int streamID)
taxis->vtime = vtime;
}
levelcode = rlevel*1000 + rcode;
compVar.code = rcode;
compVar.level = rlevel;
nextstep = FALSE;
for ( recID = 0; recID < nrecords; recID++ )
{
levelcode0 = streamptr->tsteps[tsID].records[recID].ilevel*1000 +
streamptr->tsteps[tsID].records[recID].code;
if ( levelcode == levelcode0 )
compVar0.code = streamptr->tsteps[tsID].records[recID].code;
compVar0.level = streamptr->tsteps[tsID].records[recID].ilevel;
if ( memcmp(&compVar0, &compVar, sizeof(SRVCOMPVAR)) == 0 )
{
if ( streamptr->tsteps[tsID].records[recID].used )
{
......@@ -596,10 +606,10 @@ int srvScanTimestep2(int streamID)
streamptr->tsteps[tsID].records[recID].size = recsize;
levelcode0 = streamptr->tsteps[tsID].records[recID].ilevel*1000 +
streamptr->tsteps[tsID].records[recID].code;
compVar0.code = streamptr->tsteps[tsID].records[recID].code;
compVar0.level = streamptr->tsteps[tsID].records[recID].ilevel;
if ( levelcode != levelcode0 )
if ( memcmp(&compVar0, &compVar, sizeof(SRVCOMPVAR)) != 0 )
{
Message(func, "tsID = %d recID = %d code = %3d new %3d level = %3d new %3d",
tsID, recID,
......@@ -676,12 +686,12 @@ int srvScanTimestep(int streamID)
int tsID;
int rxsize = 0, rysize = 0;
int rcode = 0, rlevel = 0, vdate = 0, vtime = 0;
long levelcode, levelcode0 = 0;
long recsize = 0;
off_t recpos = 0;
int recID;
TAXIS *taxis;
int rindex, nrecs = 0;
SRVCOMPVAR compVar, compVar0;
SRVREC *srvp;
STREAM *streamptr;
......@@ -751,11 +761,12 @@ int srvScanTimestep(int streamID)
/*
srvCmpRecord(streamID, tsID, nrecs, recpos, rcode, rlevel, rxsize, rysize);
*/
levelcode = rlevel*1000 + rcode;
levelcode0 = streamptr->tsteps[tsID].records[recID].ilevel*1000 +
streamptr->tsteps[tsID].records[recID].code;
compVar.code = rcode;
compVar.level = rlevel;
compVar0.code = streamptr->tsteps[tsID].records[recID].code;
compVar0.level = streamptr->tsteps[tsID].records[recID].ilevel;
if ( levelcode != levelcode0 )
if ( memcmp(&compVar0, &compVar, sizeof(SRVCOMPVAR)) != 0 )
{
Message(func, "tsID = %d recID = %d code = %3d new %3d level = %3d new %3d",
tsID, recID,
......
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