diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2012-03-21 15:10:17 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2012-03-21 15:10:17 (GMT) |
commit | eb89d7b53ab95623ab454186a602e1cafc7391f0 (patch) | |
tree | ceafe458b3011e38853e765352d3c7e59bbecce1 /hl/src/H5DS.c | |
parent | 3e468e6ff65d540a439e99ea568a6bff7add7cea (diff) | |
download | hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.zip hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.tar.gz hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.tar.bz2 |
[svn-r22105] Description:
Bring r20557:22085 from trunk to this branch, also fixing some other
issues/failures in the branch simultaneously. The h5repack tests are still
failing, but Neil will be checking into those, so the branch can be fully
functional again.
Tested on:
Mac OSX/64 10.7.3 (amazon) w/debug
Diffstat (limited to 'hl/src/H5DS.c')
-rw-r--r-- | hl/src/H5DS.c | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 432a725..e9ea9cf 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -318,7 +318,7 @@ herr_t H5DSattach_scale(hid_t did, ref_j = ((hobj_ref_t *)buf[idx].p)[i]; /* get the scale id for this REF */ - if((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref_j)) < 0) + if((dsid_j = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &ref_j)) < 0) goto out; /* get info for DS in the parameter list */ @@ -690,7 +690,7 @@ herr_t H5DSdetach_scale(hid_t did, ref = ((hobj_ref_t *)buf[idx].p)[j]; /* get the DS id */ - if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref)) < 0) + if ((dsid_j = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) goto out; /* get info for this DS */ @@ -800,7 +800,7 @@ herr_t H5DSdetach_scale(hid_t did, ref = dsbuf[ii].ref; /* get the dataset id */ - if ((did_i = H5Rdereference(did,H5R_OBJECT,&ref)) < 0) + if ((did_i = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) goto out; /* get info for this dataset */ @@ -813,10 +813,8 @@ herr_t H5DSdetach_scale(hid_t did, /* same object, reset. we want to detach only for this DIM */ if(did_oi.fileno == tmp_oi.fileno && did_oi.addr == tmp_oi.addr) { - /* if we found not the last one, copy the last one to replace - the one which is found */ - if(i < nelmts-1) - dsbuf[ii] = dsbuf[nelmts-1]; + /* copy the last one to replace the one which is found */ + dsbuf[ii] = dsbuf[nelmts-1]; nelmts--; found_dset=1; break; @@ -1050,7 +1048,7 @@ htri_t H5DSis_attached(hid_t did, ref = ((hobj_ref_t *)buf[idx].p)[i]; /* get the scale id for this REF */ - if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref)) < 0) + if ((dsid_j = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) goto out; /* get info for DS in the parameter list */ @@ -1140,7 +1138,7 @@ htri_t H5DSis_attached(hid_t did, if (ref) { /* get the dataset id */ - if ((did_i = H5Rdereference(did,H5R_OBJECT,&ref)) < 0) + if ((did_i = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) goto out; /* get info for dataset in the parameter list */ @@ -1344,7 +1342,7 @@ herr_t H5DSiterate_scales(hid_t did, /* disable error reporting, the ID might refer to a deleted dataset */ H5E_BEGIN_TRY { /* get the DS id */ - if ((scale_id = H5Rdereference(did,H5R_OBJECT,&ref)) < 0) + if ((scale_id = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) goto out; } H5E_END_TRY; @@ -1619,6 +1617,8 @@ out: * Comments: * * Modifications: +* JIRA HDFFV-7673: Added a check to see if the label name exists, +* if not then returns zero. July 30, 2011. MSB * *------------------------------------------------------------------------- */ @@ -1631,7 +1631,7 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) int rank; /* rank of dataset */ char **buf = NULL; /* buffer to store in the attribute */ H5I_type_t it; /* ID type */ - size_t nbytes; + size_t nbytes = 0; size_t copy_len; int i; @@ -1687,6 +1687,7 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) if ((aid = H5Aopen(did, DIMENSION_LABELS, H5P_DEFAULT)) < 0) goto out; + if ((tid = H5Aget_type(aid)) < 0) goto out; @@ -1700,26 +1701,30 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) if (H5Aread(aid, tid, buf) < 0) goto out; - /* get the real string length */ - nbytes = strlen(buf[idx]); + /* do only if the label name exists for the dimension */ + if (buf[idx] != NULL) + { + /* get the real string length */ + nbytes = strlen(buf[idx]); - /* compute the string length which will fit into the user's buffer */ - copy_len = MIN(size-1, nbytes); + /* compute the string length which will fit into the user's buffer */ + copy_len = MIN(size-1, nbytes); - /* copy all/some of the name */ - if (label) - { - memcpy(label, buf[idx], copy_len); + /* copy all/some of the name */ + if (label) + { + memcpy(label, buf[idx], copy_len); + + /* terminate the string */ + label[copy_len] = '\0'; + } - /* terminate the string */ - label[copy_len] = '\0'; } - /* free all the ptr's from the H5Aread() */ for (i = 0; i < rank; i++) { if (buf[i]) - free(buf[i]); + free(buf[i]); } /* close */ |