summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/h5_dtransform.c4
-rw-r--r--src/H5Pdxpl.c4
-rw-r--r--test/dtransform.c2
3 files changed, 4 insertions, 6 deletions
diff --git a/examples/h5_dtransform.c b/examples/h5_dtransform.c
index d013ecf..153778a 100644
--- a/examples/h5_dtransform.c
+++ b/examples/h5_dtransform.c
@@ -167,8 +167,8 @@ main (void)
/************** PART 4 **************/
transform_size = H5Pget_data_transform(dxpl_id_f_to_c, NULL, 0);
- transform = (char*) malloc(transform_size);
- H5Pget_data_transform(dxpl_id_f_to_c, transform, transform_size);
+ transform = (char*) malloc(transform_size+1);
+ H5Pget_data_transform(dxpl_id_f_to_c, transform, transform_size+1);
printf("\nTransform string (from dxpl_id_f_to_c) is: %s\n", transform);
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index 37db704..db1a45b 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -133,8 +133,6 @@ ssize_t H5Pget_data_transform(hid_t plist_id, char* expression /*out*/, size_t s
if(!pexp)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Failed to retrieve transform expression");
-
-
len = HDstrlen(pexp);
if(expression)
{
@@ -143,7 +141,7 @@ ssize_t H5Pget_data_transform(hid_t plist_id, char* expression /*out*/, size_t s
expression[size-1]='\0';
}
- ret_value = (ssize_t)len + 1;
+ ret_value = (ssize_t)len;
done:
if(ret_value<0) {
diff --git a/test/dtransform.c b/test/dtransform.c
index 38d35a2..ebe90bb 100644
--- a/test/dtransform.c
+++ b/test/dtransform.c
@@ -556,7 +556,7 @@ int test_set(void)
H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL);
TESTING("H5Pget_data_transform (get before set)")
- if(H5Pget_data_transform(dxpl_id, ptrgetTest, strlen(str)) < 0)
+ if(H5Pget_data_transform(dxpl_id, ptrgetTest, strlen(str)+1) < 0)
{
PASSED();
}