Commit 04d11388 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

vlistDefVarXXXKey: check validity of vlist object [Feature #4720]

parent b6f9756e
......@@ -5,6 +5,7 @@
2014-10-21 Uwe Schulzweida
* vlistDefVarXXXKey: check validity of vlist object [Feature #4720]
* lock CDI internal vlist objects
2014-10-13 Uwe Schulzweida
......
......@@ -1704,6 +1704,10 @@ void vlistDefVarIntKey(int vlistID, int varID, const char *name, int value)
vlist_t *vlistptr = vlist_to_pointer(vlistID);
int idx;
if ( !vlistptr->locked )
Error("User defined vlist object (vlistID=%d) isn't allowed!\n"
"Need a CDI internal vlist object from streamInqVlist(streamID).", vlistID);
for ( idx=0; idx<vlistptr->vars[varID].opt_grib_int_nentries; idx++)
if ( strcmp(name, vlistptr->vars[varID].opt_grib_int_keyword[idx]) == 0 ) break;
......@@ -1724,6 +1728,7 @@ void vlistDefVarIntKey(int vlistID, int varID, const char *name, int value)
else
Error("Internal error, name undefined!");
}
reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
#endif
}
......@@ -1735,6 +1740,10 @@ void vlistDefVarDblKey(int vlistID, int varID, const char *name, double value)
vlist_t *vlistptr = vlist_to_pointer(vlistID);
int idx;
if ( !vlistptr->locked )
Error("User defined vlist object (vlistID=%d) isn't allowed!\n"
"Need a CDI internal vlist object from streamInqVlist(streamID).", vlistID);
for ( idx=0; idx<vlistptr->vars[varID].opt_grib_dbl_nentries; idx++)
if ( strcmp(name, vlistptr->vars[varID].opt_grib_dbl_keyword[idx]) == 0 ) break;
......@@ -1755,6 +1764,7 @@ void vlistDefVarDblKey(int vlistID, int varID, const char *name, double value)
else
Error("Internal error, name undefined!");
}
reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
#endif
}
......
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