From 1ae81a8edeecd7ed38371fe6c0ffdbf13c74362b Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 12 Jun 2002 13:24:25 -0500 Subject: [svn-r5605] Purpose: Code cleanup Description: Clean up some compiler warnings... Platforms tested: FreeBSD 4.5 (sleipnir) --- perform/zip_perf.c | 2 ++ src/H5T.c | 20 ++++++++++++-------- test/enum.c | 3 +-- test/h5test.h | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/perform/zip_perf.c b/perform/zip_perf.c index 26b0ea4..ae84304 100644 --- a/perform/zip_perf.c +++ b/perform/zip_perf.c @@ -23,6 +23,8 @@ #include #include #include +#include +#include /* our header files */ #include "hdf5.h" 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 (ltu.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