-
-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix h5py testing failure due to invalid datatype IDs #4321
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3394,6 +3394,7 @@ H5T__create(H5T_class_t type, size_t size) | |
/* Copy the default string datatype */ | ||
if (NULL == (dt = H5T_copy(origin_dt, H5T_COPY_TRANSIENT))) | ||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy"); | ||
dt->shared->type = type; | ||
|
||
/* Modify the datatype */ | ||
if (H5T__set_size(dt, size) < 0) | ||
|
@@ -4578,6 +4579,8 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, bool superset) | |
/* | ||
* Compound data types... | ||
*/ | ||
if (dt1->shared->u.compnd.nmembs == 0 && dt2->shared->u.compnd.nmembs == 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shortcut for comparing two compounds with 0 members. Also avoids a segfault in the debugging code below, but I added a check there to be safe. |
||
HGOTO_DONE(0); | ||
if (dt1->shared->u.compnd.nmembs < dt2->shared->u.compnd.nmembs) | ||
HGOTO_DONE(-1); | ||
if (dt1->shared->u.compnd.nmembs > dt2->shared->u.compnd.nmembs) | ||
|
@@ -4620,11 +4623,13 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, bool superset) | |
|
||
#ifdef H5T_DEBUG | ||
/* I don't quite trust the code above yet :-) --RPM */ | ||
for (u = 0; u < dt1->shared->u.compnd.nmembs - 1; u++) { | ||
assert(strcmp(dt1->shared->u.compnd.memb[idx1[u]].name, | ||
dt1->shared->u.compnd.memb[idx1[u + 1]].name)); | ||
assert(strcmp(dt2->shared->u.compnd.memb[idx2[u]].name, | ||
dt2->shared->u.compnd.memb[idx2[u + 1]].name)); | ||
if (dt1->shared->u.compnd.nmembs > 0) { | ||
for (u = 0; u < dt1->shared->u.compnd.nmembs - 1; u++) { | ||
assert(strcmp(dt1->shared->u.compnd.memb[idx1[u]].name, | ||
dt1->shared->u.compnd.memb[idx1[u + 1]].name)); | ||
assert(strcmp(dt2->shared->u.compnd.memb[idx2[u]].name, | ||
dt2->shared->u.compnd.memb[idx2[u + 1]].name)); | ||
} | ||
} | ||
#endif | ||
|
||
|
@@ -4660,6 +4665,8 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, bool superset) | |
/* | ||
* Enumeration data types... | ||
*/ | ||
if (dt1->shared->u.enumer.nmembs == 0 && dt2->shared->u.enumer.nmembs == 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shortcut for comparing two enums with 0 members. Also avoids a segfault in the debugging code below, but I added a check there to be safe. |
||
HGOTO_DONE(0); | ||
|
||
/* If we are doing a "superset" comparison, dt2 is allowed to have | ||
* more members than dt1 | ||
|
@@ -4717,9 +4724,13 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, bool superset) | |
|
||
#ifdef H5T_DEBUG | ||
/* I don't quite trust the code above yet :-) --RPM */ | ||
for (u = 0; u < dt1->shared->u.enumer.nmembs - 1; u++) { | ||
assert(strcmp(dt1->shared->u.enumer.name[idx1[u]], dt1->shared->u.enumer.name[idx1[u + 1]])); | ||
assert(strcmp(dt2->shared->u.enumer.name[idx2[u]], dt2->shared->u.enumer.name[idx2[u + 1]])); | ||
if (dt1->shared->u.enumer.nmembs > 0) { | ||
for (u = 0; u < dt1->shared->u.enumer.nmembs - 1; u++) { | ||
assert( | ||
strcmp(dt1->shared->u.enumer.name[idx1[u]], dt1->shared->u.enumer.name[idx1[u + 1]])); | ||
assert( | ||
strcmp(dt2->shared->u.enumer.name[idx2[u]], dt2->shared->u.enumer.name[idx2[u + 1]])); | ||
} | ||
} | ||
#endif | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for
H5Tcreate
withH5T_INTEGER
,H5T_FLOAT
,H5T_TIME
andH5T_STRING
weren't setting the new datatype's type to the given type, like the other cases below. This meant that newly-created types in any combination of these four categories could compare equal to each other if their sizes are the same.