Skip to content
Snippets Groups Projects

Consolidation with CDI-PIO (develop)

Merged Sergey Kosukhin requested to merge m300488/develop-rebase into develop
1 file
+ 6
6
Compare changes
  • Side-by-side
  • Inline
+ 6
6
@@ -259,14 +259,14 @@ enum
MODEL_PACK_INT_INSTID,
MODEL_PACK_INT_MODELGRIBID,
MODEL_PACK_INT_NAMELEN,
model_nints,
modelNints,
};
static int
modelGetSizeP(void *modelptr, void *context)
{
model_t *p = (model_t *) modelptr;
size_t txsize = (size_t) serializeGetSize(model_nints, CDI_DATATYPE_INT, context)
size_t txsize = (size_t) serializeGetSize(modelNints, CDI_DATATYPE_INT, context)
+ (size_t) serializeGetSize(p->name ? (int) strlen(p->name) : 0, CDI_DATATYPE_TXT, context);
xassert(txsize <= INT_MAX);
return (int) txsize;
@@ -276,12 +276,12 @@ static void
modelPackP(void *modelptr, void *buf, int size, int *position, void *context)
{
model_t *p = (model_t *) modelptr;
int tempbuf[model_nints];
int tempbuf[modelNints];
tempbuf[MODEL_PACK_INT_SELF] = p->self;
tempbuf[MODEL_PACK_INT_INSTID] = p->instID;
tempbuf[MODEL_PACK_INT_MODELGRIBID] = p->modelgribID;
tempbuf[MODEL_PACK_INT_NAMELEN] = p->name ? (int) strlen(p->name) : 0;
serializePack(tempbuf, model_nints, CDI_DATATYPE_INT, buf, size, position, context);
serializePack(tempbuf, modelNints, CDI_DATATYPE_INT, buf, size, position, context);
if (p->name) serializePack(p->name, tempbuf[MODEL_PACK_INT_NAMELEN], CDI_DATATYPE_TXT, buf, size, position, context);
}
@@ -289,9 +289,9 @@ int
modelUnpack(void *buf, int size, int *position, int originNamespace, void *context, int force_id)
{
#define adaptKey(key) (namespaceAdaptKey((key), originNamespace))
int tempbuf[model_nints];
int tempbuf[modelNints];
char *name;
serializeUnpack(buf, size, position, tempbuf, model_nints, CDI_DATATYPE_INT, context);
serializeUnpack(buf, size, position, tempbuf, modelNints, CDI_DATATYPE_INT, context);
if (tempbuf[MODEL_PACK_INT_NAMELEN] != 0)
{
size_t len = (size_t) tempbuf[MODEL_PACK_INT_NAMELEN];
Loading