summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-06-12 18:24:25 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-06-12 18:24:25 (GMT)
commit1ae81a8edeecd7ed38371fe6c0ffdbf13c74362b (patch)
tree93fda3ac4b5af5dc5fa0ba7c5a7f4521d69b1703 /src/H5T.c
parentbdefbb5cba63402c819819545c3d45e862540ee6 (diff)
downloadhdf5-1ae81a8edeecd7ed38371fe6c0ffdbf13c74362b.zip
hdf5-1ae81a8edeecd7ed38371fe6c0ffdbf13c74362b.tar.gz
hdf5-1ae81a8edeecd7ed38371fe6c0ffdbf13c74362b.tar.bz2
[svn-r5605] Purpose:
Code cleanup Description: Clean up some compiler warnings... Platforms tested: FreeBSD 4.5 (sleipnir)
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/H5T.c b/src/H5T.c
index edb5aaa..12832e5 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -6912,14 +6912,16 @@ H5T_enum_nameof(H5T_t *dt, void *value, char *name/*out*/, size_t size)
assert(name || 0==size);
if (name && size>0) *name = '\0';
+ /* Sanity check */
+ if (dt->u.enumer.nmembs == 0) {
+ HRETURN_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL,
+ "datatype has no members");
+ }
+
/* Do a binary search over the values to find the correct one */
H5T_sort_value(dt, NULL);
lt = 0;
rt = dt->u.enumer.nmembs;
- if (rt == 0) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL,
- "datatype has no members");
- }
md = -1;
while (lt<rt) {
@@ -6985,14 +6987,16 @@ H5T_enum_valueof(H5T_t *dt, const char *name, void *value/*out*/)
assert(name && *name);
assert(value);
+ /* Sanity check */
+ if (dt->u.enumer.nmembs == 0) {
+ HRETURN_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL,
+ "datatype has no members");
+ }
+
/* Do a binary search over the names to find the correct one */
H5T_sort_name(dt, NULL);
lt = 0;
rt = dt->u.enumer.nmembs;
- if (rt == 0) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL,
- "datatype has no members");
- }
md = -1;
while (lt<rt) {