Commit 43aab0e4 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Change taxis unpack to force resource IDs.

parent 6898dfe8
...@@ -128,15 +128,19 @@ void taxisDefaultValue(taxis_t* taxisptr) ...@@ -128,15 +128,19 @@ void taxisDefaultValue(taxis_t* taxisptr)
taxisptr->climatology = FALSE; taxisptr->climatology = FALSE;
} }
static static taxis_t *
taxis_t *taxisNewEntry(void) taxisNewEntry(cdiResH resH)
{ {
taxis_t *taxisptr; taxis_t *taxisptr = xmalloc(sizeof (taxis_t));
taxisptr = (taxis_t *) xmalloc ( sizeof ( taxis_t )); taxisDefaultValue(taxisptr);
if (resH == CDI_UNDEFID)
taxisDefaultValue ( taxisptr ); taxisptr->self = reshPut(taxisptr, &taxisOps);
taxisptr->self = reshPut (( void * ) taxisptr, &taxisOps ); else
{
taxisptr->self = resH;
reshReplace(resH, taxisptr, &taxisOps);
}
return (taxisptr); return (taxisptr);
} }
...@@ -149,7 +153,7 @@ void taxisInit (void) ...@@ -149,7 +153,7 @@ void taxisInit (void)
if ( taxisInitialized ) return; if ( taxisInitialized ) return;
taxisInitialized = 1; taxisInitialized = 1;
env = getenv("TAXIS_DEBUG"); env = getenv("TAXIS_DEBUG");
if ( env ) TAXIS_Debug = atoi(env); if ( env ) TAXIS_Debug = atoi(env);
...@@ -216,7 +220,7 @@ int taxisCreate(int taxistype) ...@@ -216,7 +220,7 @@ int taxisCreate(int taxistype)
taxisInit (); taxisInit ();
taxisptr = taxisNewEntry(); taxisptr = taxisNewEntry(CDI_UNDEFID);
taxisID = taxisptr->self; taxisID = taxisptr->self;
taxisptr->type = taxistype; taxisptr->type = taxistype;
...@@ -278,7 +282,7 @@ int taxisDuplicate(int taxisID1) ...@@ -278,7 +282,7 @@ int taxisDuplicate(int taxisID1)
taxisptr1 = ( taxis_t * ) reshGetVal ( taxisID1, &taxisOps ); taxisptr1 = ( taxis_t * ) reshGetVal ( taxisID1, &taxisOps );
taxisptr2 = taxisNewEntry(); taxisptr2 = taxisNewEntry(CDI_UNDEFID);
if ( ! taxisptr2 ) Error("No memory"); if ( ! taxisptr2 ) Error("No memory");
taxisID2 = taxisptr2->self; taxisID2 = taxisptr2->self;
...@@ -1463,7 +1467,7 @@ taxisGetPackSize(void *p, void *context) ...@@ -1463,7 +1467,7 @@ taxisGetPackSize(void *p, void *context)
int int
taxisUnpack(char * unpackBuffer, int unpackBufferSize, int * unpackBufferPos, taxisUnpack(char * unpackBuffer, int unpackBufferSize, int * unpackBufferPos,
int nspTarget, void *context, int checkForSameID) int nspTarget, void *context, int force_id)
{ {
taxis_t * taxisP; taxis_t * taxisP;
int intBuffer[taxisNint]; int intBuffer[taxisNint];
...@@ -1479,11 +1483,10 @@ taxisUnpack(char * unpackBuffer, int unpackBufferSize, int * unpackBufferPos, ...@@ -1479,11 +1483,10 @@ taxisUnpack(char * unpackBuffer, int unpackBufferSize, int * unpackBufferPos,
taxisInit(); taxisInit();
taxisP = taxisNewEntry(); cdiResH targetID = namespaceAdaptKey(intBuffer[idx++], nspTarget);
if ( ! taxisP ) Error("No memory"); taxisP = taxisNewEntry(force_id?targetID:CDI_UNDEFID);
xassert(!checkForSameID xassert(!force_id || targetID == taxisP->self);
|| namespaceAdaptKey(intBuffer[idx++], nspTarget) == taxisP->self);
taxisP->used = intBuffer[idx++]; taxisP->used = intBuffer[idx++];
taxisP->type = intBuffer[idx++]; taxisP->type = intBuffer[idx++];
......
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