Commit 4e89825a authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Change type of vlist_t.ntsteps to long as it is for stream_t already.

parent 037f8085
......@@ -113,6 +113,7 @@ extern "C" {
#define DATATYPE_TXT 253
#define DATATYPE_CPX 254
#define DATATYPE_UCHAR 255
#define DATATYPE_LONG 256
/* Chunks */
......
......@@ -30,7 +30,8 @@ static struct
{ DATATYPE_INT, MPI_INT },
{ DATATYPE_FLT64, MPI_DOUBLE },
{ DATATYPE_TXT, MPI_CHAR },
{ DATATYPE_UCHAR, MPI_UNSIGNED_CHAR }
{ DATATYPE_UCHAR, MPI_UNSIGNED_CHAR },
{ DATATYPE_LONG, MPI_LONG },
};
static inline size_t
......
......@@ -65,6 +65,9 @@ serializeGetSizeInCore(int count, int datatype, void *context)
case DATATYPE_UCHAR:
elemSize = 1;
break;
case DATATYPE_LONG:
elemSize = sizeof (long);
break;
default:
xabort("Unexpected datatype");
}
......
......@@ -1594,8 +1594,8 @@ taxisPack(void * voidP, void * packBuffer, int packBufferSize, int * packBufferP
intBuffer[idx++] = taxisP->vtime_lb;
intBuffer[idx++] = taxisP->vdate_ub;
intBuffer[idx++] = taxisP->vtime_ub;
intBuffer[idx++] = taxisP->name ? strlen(taxisP->name) : 0;
intBuffer[idx++] = taxisP->longname ? strlen(taxisP->longname) : 0;
intBuffer[idx++] = taxisP->name ? (int)strlen(taxisP->name) : 0;
intBuffer[idx++] = taxisP->longname ? (int)strlen(taxisP->longname) : 0;
serializePack(intBuffer, taxisNint, DATATYPE_INT,
packBuffer, packBufferSize, packBufferPos, context);
......
......@@ -1061,7 +1061,7 @@ int vlistNtsteps(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
return (vlistptr->ntsteps);
return (int)vlistptr->ntsteps;
}
static void
......@@ -1485,7 +1485,7 @@ int vlistHasTime(int vlistID)
}
enum {
vlist_nints=7,
vlist_nints=6,
};
static int
......@@ -1501,6 +1501,7 @@ int vlistGetSizeP ( void * vlistptr, void *context)
int txsize, varID;
vlist_t *p = (vlist_t*) vlistptr;
txsize = serializeGetSize(vlist_nints, DATATYPE_INT, context);
txsize += serializeGetSize(1, DATATYPE_LONG, context);
txsize += vlistAttsGetSize(p, CDI_GLOBAL, context);
for ( varID = 0; varID < p->nvars; varID++ )
txsize += vlistVarGetPackSize(p, varID, context);
......@@ -1516,12 +1517,13 @@ void vlistPackP ( void * vlistptr, void * buf, int size, int *position,
vlist_t *p = (vlist_t*) vlistptr;
tempbuf[0] = p->self;
tempbuf[1] = p->nvars;
tempbuf[2] = p->ntsteps;
tempbuf[3] = p->taxisID;
tempbuf[4] = p->tableID;
tempbuf[5] = p->instID;
tempbuf[6] = p->modelID;
tempbuf[2] = p->taxisID;
tempbuf[3] = p->tableID;
tempbuf[4] = p->instID;
tempbuf[5] = p->modelID;
serializePack(tempbuf, vlist_nints, DATATYPE_INT, buf, size, position, context);
serializePack(&p->ntsteps, 1, DATATYPE_LONG, buf, size, position, context);
vlistAttsPack(p, CDI_GLOBAL, buf, size, position, context);
for ( varID = 0; varID < p->nvars; varID++ )
{
......@@ -1534,17 +1536,19 @@ void vlistUnpack(char * buf, int size, int *position, int originNamespace,
{
int tempbuf[vlist_nints];
serializeUnpack(buf, size, position, tempbuf, vlist_nints, DATATYPE_INT, context);
int nvars = tempbuf[1];
int targetID = namespaceAdaptKey(tempbuf[0], originNamespace);
vlist_t *p = vlist_new_entry(force_id?targetID:CDI_UNDEFID);
xassert(!force_id || p->self == targetID);
if (!force_id)
targetID = p->self;
p->taxisID = namespaceAdaptKey(tempbuf[3], originNamespace);
p->tableID = tempbuf[4];
p->instID = namespaceAdaptKey(tempbuf[5], originNamespace);
p->modelID = namespaceAdaptKey(tempbuf[6], originNamespace);
p->taxisID = namespaceAdaptKey(tempbuf[2], originNamespace);
p->tableID = tempbuf[3];
p->instID = namespaceAdaptKey(tempbuf[4], originNamespace);
p->modelID = namespaceAdaptKey(tempbuf[5], originNamespace);
serializeUnpack(buf, size, position, &p->ntsteps, 1, DATATYPE_LONG, context);
vlistAttsUnpack(targetID, CDI_GLOBAL, buf, size, position, context);
for (int varID = 0; varID < tempbuf[1]; varID++ )
for (int varID = 0; varID < nvars; varID++ )
vlistVarUnpack(targetID, buf, size, position, originNamespace, context);
}
......
......@@ -133,7 +133,7 @@ typedef struct
int nvars; /* number of variables */
int ngrids;
int nzaxis;
int ntsteps;
long ntsteps;
int taxisID;
int tableID;
int instID;
......
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