summaryrefslogtreecommitdiffstats
path: root/src/H5Ztrans.c
diff options
context:
space:
mode:
authorLeon Arber <larber@ncsa.uiuc.edu>2004-11-12 02:40:14 (GMT)
committerLeon Arber <larber@ncsa.uiuc.edu>2004-11-12 02:40:14 (GMT)
commit5d7425c68641e5ac0a2f75d8fbfe512582582395 (patch)
tree84fd294d954695d400256559ab278e8d6014e690 /src/H5Ztrans.c
parent73a495e7ac5af18c3ad695da8eb2ead79c1a218c (diff)
downloadhdf5-5d7425c68641e5ac0a2f75d8fbfe512582582395.zip
hdf5-5d7425c68641e5ac0a2f75d8fbfe512582582395.tar.gz
hdf5-5d7425c68641e5ac0a2f75d8fbfe512582582395.tar.bz2
[svn-r9524] Purpose:
Bug Fix Description: Fixed off by one error in H5Pget_data_transform Solution: H5Pget_data_transform, when queried for the size of the property, should return strlen() + 1 so that the user can allocate memory for the terminating \0 in the string. Also fixed a typo in a comment in H5Ztrans.c Platforms tested: eirene, too minor to require further testing. Misc. update:
Diffstat (limited to 'src/H5Ztrans.c')
-rw-r--r--src/H5Ztrans.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index d14af45..c1feb7a 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -1391,6 +1391,11 @@ H5Z_xform_create(const char *expr)
if((data_xform_prop->parse_root = H5Z_xform_parse(expr, data_xform_prop->dat_val_pointers))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to generate parse tree from expression")
+ /* Sanity check
+ * count should be the same num_ptrs */
+ if(count != data_xform_prop->dat_val_pointers->num_ptrs)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "error copying the parse tree, did not find correct number of \"variables\"")
+
/* Assign return value */
ret_value=data_xform_prop;
@@ -1513,10 +1518,16 @@ H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop)
/* Zero out num_pointers prior to H5Z_xform_cop_tree call; that call will increment it to the right amount */
new_data_xform_prop->dat_val_pointers->num_ptrs = 0;
-
+
+
/* Copy parse tree */
if((new_data_xform_prop->parse_root = (H5Z_node*)H5Z_xform_copy_tree((*data_xform_prop)->parse_root, (*data_xform_prop)->dat_val_pointers, new_data_xform_prop->dat_val_pointers)) == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "error copying the parse tree")
+
+ /* Sanity check
+ * count should be the same num_ptrs */
+ if(count != new_data_xform_prop->dat_val_pointers->num_ptrs)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "error copying the parse tree, did not find correct number of \"variables\"")
/* Copy new information on top of old information */
*data_xform_prop=new_data_xform_prop;
@@ -1591,8 +1602,8 @@ H5Z_xform_extract_xform_str(const H5Z_data_xform_t *data_xform_prop)
FUNC_ENTER_NOAPI_NOFUNC(H5Z_xform_extract_xform_str)
- /* There should be no way that these can be NULL since the function
- * that calls this one checks to make sure they aren't before
+ /* There should be no way that this can be NULL since the function
+ * that calls this one checks to make sure it isn't before
* pasing them */
assert(data_xform_prop);