aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@21a6bef8-4479-4f54-8f8d-0db94a2919ef>2004-01-07 17:04:26 +0000
committertradke <tradke@21a6bef8-4479-4f54-8f8d-0db94a2919ef>2004-01-07 17:04:26 +0000
commit7999bc23a572152e7c6778dd7f532ac3aa115761 (patch)
treee19f49dfeee384c5121807c42380b8d09f71a526
parentad9a1b91b1ef0d1b0405750500b6927fb7ae6c89 (diff)
Need to explicitely set the terminating NUL character when reading in a
string attribute. git-svn-id: http://svn.cactuscode.org/arrangements/CactusExternal/FlexIO/trunk@52 21a6bef8-4479-4f54-8f8d-0db94a2919ef
-rw-r--r--src/H5IO.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/H5IO.cc b/src/H5IO.cc
index d5d8795..d52ac2b 100644
--- a/src/H5IO.cc
+++ b/src/H5IO.cc
@@ -629,6 +629,12 @@ int H5IO::readAttribute(int number,void *data){
hid_t attrib = H5Aopen_idx(dataset,number);
hid_t atype = H5Aget_type(attrib);
H5Aread(attrib,atype /*DataType2H5(H5DataType2DataType(atype))*/ ,data);
+ // need to explicitely set the terminating NUL character in string attributes
+ if (H5Tget_class (atype) == H5T_STRING)
+ {
+ size_t len = H5Tget_size (atype);
+ ((char *) data)[len] = 0;
+ }
H5Tclose(atype);
H5Aclose(attrib);
return 1;