summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-01-28 13:11:38 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-01-28 13:11:38 (GMT)
commit3360c3af0c100ac4d3a2fe2865f34661da862ec5 (patch)
tree9caf7dba62679504aa39ec02ebb72d8b8b5a848d /hl
parent5b4d3279099e7e4fad6e0092c77aa93dfd35d616 (diff)
downloadhdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.zip
hdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.tar.gz
hdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.tar.bz2
[svn-r18175] Description:
Bring r17986:18172 from trunk to revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'hl')
-rwxr-xr-xhl/Makefile.in8
-rw-r--r--hl/c++/Makefile.in8
-rw-r--r--hl/c++/examples/Makefile.in8
-rw-r--r--hl/c++/src/Makefile.in10
-rw-r--r--hl/c++/test/Makefile.in8
-rw-r--r--hl/examples/Makefile.in8
-rw-r--r--hl/fortran/Makefile.in8
-rw-r--r--hl/fortran/examples/Makefile.in8
-rwxr-xr-xhl/fortran/src/H5IMfc.c39
-rwxr-xr-xhl/fortran/src/H5TBfc.c639
-rw-r--r--hl/fortran/src/Makefile.in10
-rw-r--r--hl/fortran/test/Makefile.in8
-rw-r--r--hl/src/H5LT.c27
-rw-r--r--hl/src/H5PT.c11
-rw-r--r--hl/src/H5TB.c63
-rw-r--r--hl/src/Makefile.in10
-rw-r--r--hl/test/Makefile.in8
-rw-r--r--hl/test/test_ds.c1
-rw-r--r--hl/test/test_lite.c19
-rw-r--r--hl/tools/Makefile.in8
-rw-r--r--hl/tools/gif2h5/Makefile.in8
-rw-r--r--hl/tools/gif2h5/decompress.c2
-rw-r--r--hl/tools/gif2h5/gif2hdf.c12
-rw-r--r--hl/tools/gif2h5/gif2mem.c28
-rw-r--r--hl/tools/gif2h5/gifread.c4
-rw-r--r--hl/tools/gif2h5/h52gifgentst.c12
-rw-r--r--hl/tools/gif2h5/h52giftest.sh8
-rw-r--r--hl/tools/gif2h5/hdf2gif.c6
28 files changed, 409 insertions, 580 deletions
diff --git a/hl/Makefile.in b/hl/Makefile.in
index addfd5a..8fd29b4 100755
--- a/hl/Makefile.in
+++ b/hl/Makefile.in
@@ -333,12 +333,12 @@ CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
-# We use RUNTESTS instead of RUNSERIAL directly because it may be that
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
-RUNTESTS = $(RUNSERIAL)
+RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
@@ -867,7 +867,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
- $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
@@ -938,7 +938,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS)
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
- RUNTESTS="$(RUNPARALLEL)" || exit 1; \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \
diff --git a/hl/c++/Makefile.in b/hl/c++/Makefile.in
index 87a582c..d83f520 100644
--- a/hl/c++/Makefile.in
+++ b/hl/c++/Makefile.in
@@ -329,12 +329,12 @@ CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
-# We use RUNTESTS instead of RUNSERIAL directly because it may be that
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
-RUNTESTS = $(RUNSERIAL)
+RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
@@ -859,7 +859,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
- $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
@@ -930,7 +930,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS)
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
- RUNTESTS="$(RUNPARALLEL)" || exit 1; \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \
diff --git a/hl/c++/examples/Makefile.in b/hl/c++/examples/Makefile.in
index 4b11346..9fad167 100644
--- a/hl/c++/examples/Makefile.in
+++ b/hl/c++/examples/Makefile.in
@@ -295,12 +295,12 @@ CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
-# We use RUNTESTS instead of RUNSERIAL directly because it may be that
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
-RUNTESTS = $(RUNSERIAL)
+RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
@@ -715,7 +715,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
- $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
@@ -786,7 +786,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS)
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
- RUNTESTS="$(RUNPARALLEL)" || exit 1; \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \
diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in
index cf49155..72f1843 100644
--- a/hl/c++/src/Makefile.in
+++ b/hl/c++/src/Makefile.in
@@ -341,12 +341,12 @@ CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
-# We use RUNTESTS instead of RUNSERIAL directly because it may be that
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
-RUNTESTS = $(RUNSERIAL)
+RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
@@ -380,7 +380,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 44
+LT_VERS_REVISION = 49
LT_VERS_AGE = 0
# Include src directory
@@ -866,7 +866,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
- $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
@@ -937,7 +937,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS)
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
- RUNTESTS="$(RUNPARALLEL)" || exit 1; \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \
diff --git a/hl/c++/test/Makefile.in b/hl/c++/test/Makefile.in
index 6bb1a99..7266306 100644
--- a/hl/c++/test/Makefile.in
+++ b/hl/c++/test/Makefile.in
@@ -315,12 +315,12 @@ CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
-# We use RUNTESTS instead of RUNSERIAL directly because it may be that
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
-RUNTESTS = $(RUNSERIAL)
+RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
@@ -774,7 +774,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
- $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
@@ -845,7 +845,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS)
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
- RUNTESTS="$(RUNPARALLEL)" || exit 1; \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \
diff --git a/hl/examples/Makefile.in b/hl/examples/Makefile.in
index 0380eaf..44333b5 100644
--- a/hl/examples/Makefile.in
+++ b/hl/examples/Makefile.in
@@ -295,12 +295,12 @@ CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
-# We use RUNTESTS instead of RUNSERIAL directly because it may be that
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
-RUNTESTS = $(RUNSERIAL)
+RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
@@ -748,7 +748,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
- $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
@@ -819,7 +819,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS)
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
- RUNTESTS="$(RUNPARALLEL)" || exit 1; \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \
diff --git a/hl/fortran/Makefile.in b/hl/fortran/Makefile.in
index 79e0ce5..4a91756 100644
--- a/hl/fortran/Makefile.in
+++ b/hl/fortran/Makefile.in
@@ -333,12 +333,12 @@ CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
-# We use RUNTESTS instead of RUNSERIAL directly because it may be that
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
-RUNTESTS = $(RUNSERIAL)
+RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
@@ -863,7 +863,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
- $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
@@ -934,7 +934,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS)
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
- RUNTESTS="$(RUNPARALLEL)" || exit 1; \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \
diff --git a/hl/fortran/examples/Makefile.in b/hl/fortran/examples/Makefile.in
index 698ffbf..ef5d165 100644
--- a/hl/fortran/examples/Makefile.in
+++ b/hl/fortran/examples/Makefile.in
@@ -295,12 +295,12 @@ CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
-# We use RUNTESTS instead of RUNSERIAL directly because it may be that
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
-RUNTESTS = $(RUNSERIAL)
+RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
@@ -717,7 +717,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
- $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
@@ -788,7 +788,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS)
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
- RUNTESTS="$(RUNPARALLEL)" || exit 1; \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \
diff --git a/hl/fortran/src/H5IMfc.c b/hl/fortran/src/H5IMfc.c
index bbf98cf..7a54437 100755
--- a/hl/fortran/src/H5IMfc.c
+++ b/hl/fortran/src/H5IMfc.c
@@ -17,7 +17,7 @@
#include "H5IMcc.h"
#include "H5LTf90proto.h"
-
+#include "H5Eprivate.h"
/*-------------------------------------------------------------------------
* Function: h5immake_image_8bit_c
@@ -377,49 +377,30 @@ nh5immake_palette_c (hid_t_f *loc_id,
hsize_t_f *dims,
void *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
char *c_name = NULL;
- int c_namelen;
- hsize_t *c_dims;
+ hsize_t c_dims[H5S_MAX_RANK];
int i;
int rank=2;
+ int_f ret_value = 0;
/*
* convert FORTRAN name to C name
*/
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL)
- goto done;
-
- c_dims = malloc(sizeof(hsize_t) * (rank ));
- if (c_dims == NULL)
- goto done;
+ if(NULL == (c_name = (char *)HD5f2cstring(name, (int)*namelen)))
+ HGOTO_DONE(FAIL)
- for (i = 0; i < rank ; i++)
- {
+ for(i = 0; i < rank ; i++)
c_dims[i] = dims[i];
- }
/*
* call H5IMmake_palette function.
*/
- c_loc_id = (hid_t)*loc_id;
-
- ret = H5IMmake_palettef(c_loc_id,c_name,c_dims,buf);
-
- if (ret < 0)
- goto done;
-
- ret_value = 0;
+ if(H5IMmake_palettef((hid_t)*loc_id, c_name, c_dims, buf) < 0)
+ HGOTO_DONE(FAIL)
done:
- if(c_name!=NULL)
- free(c_name);
- if(c_dims!=NULL)
- free(c_dims);
+ if(c_name)
+ HDfree(c_name);
return ret_value;
}
diff --git a/hl/fortran/src/H5TBfc.c b/hl/fortran/src/H5TBfc.c
index 38af99c..a09d73b 100755
--- a/hl/fortran/src/H5TBfc.c
+++ b/hl/fortran/src/H5TBfc.c
@@ -17,6 +17,7 @@
#include "H5TBprivate.h"
#include "H5LTf90proto.h"
+#include "H5Eprivate.h"
/*-------------------------------------------------------------------------
* Function: h5tbmake_table_c
@@ -52,134 +53,99 @@ nh5tbmake_table_c(int_f *namelen1,
int_f *namelen2, /* field_names lenghts */
_fcd field_names) /* field_names */
{
- int ret_value = -1;
- herr_t ret;
- char *c_name = NULL;
- int c_namelen;
- char *c_name1 = NULL;
- int c_namelen1;
+ char *c_name = NULL;
+ char *c_name1 = NULL;
hsize_t num_elem;
hsize_t i;
- int max_len=1;
- hid_t c_loc_id = *loc_id;
- hsize_t c_nfields = *nfields;
- hsize_t c_nrecords = *nrecords;
+ int max_len = 1;
+ hid_t c_loc_id = *loc_id;
+ hsize_t c_nfields = *nfields;
+ hsize_t c_nrecords = *nrecords;
hsize_t c_chunk_size = *chunk_size;
- size_t c_type_size = *type_size;
- size_t *c_field_offset = NULL;
- hid_t *c_field_types = NULL;
- char **c_field_names = NULL;
- char *tmp = NULL, *tmp_p = NULL;
+ size_t c_type_size = *type_size;
+ size_t *c_field_offset = NULL;
+ hid_t *c_field_types = NULL;
+ char **c_field_names = NULL;
+ char *tmp = NULL, *tmp_p;
+ int_f ret_value = 0;
num_elem = *nfields;
-
- for ( i = 0; i < num_elem; i++)
- {
- if (namelen2[i] > max_len) max_len = namelen2[i];
+ for(i = 0; i < num_elem; i++) {
+ if(namelen2[i] > max_len)
+ max_len = namelen2[i];
}
/*
- * convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL)
- goto done;
-
- c_namelen1 = *namelen1;
- c_name1 = (char *)HD5f2cstring(name1, c_namelen1);
- if (c_name1 == NULL)
- goto done;
-
- c_field_offset = (size_t*)malloc(sizeof(size_t) * (size_t)c_nfields);
- if (!c_field_offset)
- goto done;
-
- c_field_types = (hid_t*)malloc(sizeof(hid_t) * (size_t)c_nfields);
- if (!c_field_types)
- goto done;
-
- for ( i = 0; i < num_elem; i++)
- {
+ * convert FORTRAN name to C name
+ */
+ if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ HGOTO_DONE(FAIL)
+ if(NULL == (c_name1 = (char *)HD5f2cstring(name1, (size_t)*namelen1)))
+ HGOTO_DONE(FAIL)
+ if(NULL == (c_field_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
+ HGOTO_DONE(FAIL)
+ if(NULL == (c_field_types = (hid_t *)HDmalloc(sizeof(hid_t) * (size_t)c_nfields)))
+ HGOTO_DONE(FAIL)
+
+ for (i = 0; i < num_elem; i++) {
c_field_offset[i] = field_offset[i];
- c_field_types[i] = field_types[i];
+ c_field_types[i] = field_types[i];
}
/*
- * allocate array of character pointers
- */
- c_field_names = (char **)malloc((size_t)num_elem * sizeof(char *));
- if (c_field_names == NULL)
- goto done;
+ * allocate array of character pointers
+ */
+ if(NULL == (c_field_names = (char **)HDcalloc((size_t)num_elem, sizeof(char *))))
+ HGOTO_DONE(FAIL)
/* copy data to long C string */
- tmp = (char *)HD5f2cstring(field_names, (int)(max_len*num_elem));
- if (tmp == NULL)
- {
- goto done;
- }
+ if(NULL == (tmp = (char *)HD5f2cstring(field_names, (size_t)(max_len * num_elem))))
+ HGOTO_DONE(FAIL)
/*
- * move data from temorary buffer
- */
+ * move data from temorary buffer
+ */
tmp_p = tmp;
- for (i=0; i < num_elem; i++)
- {
- c_field_names[i] = (char *) malloc((size_t)namelen2[i]+1);
- memcpy(c_field_names[i], tmp_p, (size_t)namelen2[i]);
+ for(i = 0; i < num_elem; i++) {
+ if(NULL == (c_field_names[i] = (char *)HDmalloc((size_t)namelen2[i] + 1)))
+ HGOTO_DONE(FAIL)
+
+ HDmemcpy(c_field_names[i], tmp_p, (size_t)namelen2[i]);
c_field_names[i][namelen2[i]] = '\0';
tmp_p = tmp_p + max_len;
- }
+ } /* end for */
/*
- * call H5TBmake_table function.
- */
-
- ret = H5TBmake_table(c_name1,
- c_loc_id,
- c_name,
- c_nfields,
- c_nrecords,
- c_type_size,
- c_field_names,
- c_field_offset,
- c_field_types,
- c_chunk_size,
- NULL,
- *compress,
- NULL);
-
- if (ret < 0)
- goto done;
-
- ret_value = 0;
-
-done:
- if(c_name != NULL)
- free(c_name);
- if(c_name1 != NULL)
- free(c_name1);
-
- for ( i = 0; i < num_elem; i++)
- {
- if ( c_field_names[i] )
- free (c_field_names[i]);
- }
- if ( c_field_names )
- free(c_field_names);
- if ( tmp )
- free(tmp);
- if ( c_field_offset )
- free(c_field_offset);
- if ( c_field_types )
- free(c_field_types);
+ * call H5TBmake_table function.
+ */
+ if(H5TBmake_table(c_name1, c_loc_id, c_name, c_nfields, c_nrecords,
+ c_type_size, c_field_names, c_field_offset, c_field_types,
+ c_chunk_size, NULL, *compress, NULL) < 0)
+ HGOTO_DONE(FAIL)
+
+done:
+ if(c_name)
+ HDfree(c_name);
+ if(c_name1)
+ HDfree(c_name1);
+ if(c_field_names) {
+ for(i = 0; i < num_elem; i++) {
+ if(c_field_names[i])
+ HDfree(c_field_names[i]);
+ }
+ HDfree(c_field_names);
+ } /* end if */
+ if(tmp)
+ HDfree(tmp);
+ if(c_field_offset)
+ HDfree(c_field_offset);
+ if(c_field_types)
+ HDfree(c_field_types);
return ret_value;
}
-
-
/*-------------------------------------------------------------------------
* Function: h5tbwrite_field_name_c
*
@@ -210,59 +176,34 @@ nh5tbwrite_field_name_c(hid_t_f *loc_id,
size_t_f *type_size,
void *buf)
{
- int ret_value = -1;
- herr_t ret;
- char *c_name = NULL;
- int c_namelen;
- char *c_name1 = NULL;
- int c_namelen1;
+ char *c_name = NULL;
+ char *c_name1 = NULL;
hid_t c_loc_id = *loc_id;
hsize_t c_start = *start;
hsize_t c_nrecords = *nrecords;
size_t c_type_size = *type_size;
- size_t c_type_sizes[1];
-
- c_type_sizes[0] = c_type_size;
-
+ int_f ret_value = 0;
/*
* convert FORTRAN name to C name
*/
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL)
- goto done;
-
- c_namelen1 = *namelen1;
- c_name1 = (char *)HD5f2cstring(field_name, c_namelen1);
- if (c_name1 == NULL)
- goto done;
+ if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ HGOTO_DONE(FAIL)
+ if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1)))
+ HGOTO_DONE(FAIL)
/*
* call H5TBwrite_fields_name function.
*/
-
- ret = H5TBwrite_fields_name(c_loc_id,
- c_name,
- c_name1,
- c_start,
- c_nrecords,
- c_type_size,
- 0,
- c_type_sizes,
- buf);
-
- if (ret < 0)
- goto done;
-
- ret_value = 0;
-
+ if(H5TBwrite_fields_name(c_loc_id, c_name, c_name1, c_start, c_nrecords,
+ c_type_size, 0, &c_type_size, buf) < 0)
+ HGOTO_DONE(FAIL)
done:
- if(c_name != NULL)
- free(c_name);
- if(c_name1 != NULL)
- free(c_name1);
+ if(c_name)
+ HDfree(c_name);
+ if(c_name1)
+ HDfree(c_name1);
return ret_value;
}
@@ -293,6 +234,7 @@ nh5tbwrite_field_name_fl_c(hid_t_f *loc_id,
{
return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf);
}
+
int_f
nh5tbwrite_field_name_dl_c(hid_t_f *loc_id,
int_f *namelen,
@@ -306,6 +248,7 @@ nh5tbwrite_field_name_dl_c(hid_t_f *loc_id,
{
return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf);
}
+
int_f
nh5tbwrite_field_name_st_c(hid_t_f *loc_id,
int_f *namelen,
@@ -319,6 +262,7 @@ nh5tbwrite_field_name_st_c(hid_t_f *loc_id,
{
return nh5tbwrite_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf);
}
+
/*-------------------------------------------------------------------------
* Function: h5tbread_field_name_c
*
@@ -349,57 +293,34 @@ nh5tbread_field_name_c(hid_t_f *loc_id,
size_t_f *type_size,
void *buf)
{
- int ret_value = -1;
- herr_t ret;
- char *c_name = NULL;
- int c_namelen;
- char *c_name1 = NULL;
- int c_namelen1;
+ char *c_name = NULL;
+ char *c_name1 = NULL;
hid_t c_loc_id = *loc_id;
hsize_t c_start = *start;
hsize_t c_nrecords = *nrecords;
size_t c_type_size = *type_size;
- size_t c_type_sizes[1];
-
- c_type_sizes[0] = c_type_size;
-
+ int_f ret_value = 0;
/*
* convert FORTRAN name to C name
*/
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL)
- goto done;
-
- c_namelen1 = *namelen1;
- c_name1 = (char *)HD5f2cstring(field_name, c_namelen1);
- if (c_name1 == NULL)
- goto done;
+ if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ HGOTO_DONE(FAIL)
+ if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1)))
+ HGOTO_DONE(FAIL)
/*
* call H5TBread_fields_name function.
*/
-
- ret = H5TBread_fields_name(c_loc_id,
- c_name,
- c_name1,
- c_start,
- c_nrecords,
- c_type_size,
- 0,
- c_type_sizes,
- buf);
-
- if (ret < 0)
- goto done;
-
- ret_value = 0;
-
+ if(H5TBread_fields_name(c_loc_id, c_name, c_name1, c_start, c_nrecords,
+ c_type_size, 0, &c_type_size, buf) < 0)
+ HGOTO_DONE(FAIL)
done:
- if(c_name != NULL)
- free(c_name);
+ if(c_name)
+ HDfree(c_name);
+ if(c_name1)
+ HDfree(c_name1);
return ret_value;
}
@@ -417,6 +338,7 @@ nh5tbread_field_name_int_c(hid_t_f *loc_id,
{
return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf);
}
+
int_f
nh5tbread_field_name_fl_c(hid_t_f *loc_id,
int_f *namelen,
@@ -430,6 +352,7 @@ nh5tbread_field_name_fl_c(hid_t_f *loc_id,
{
return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf);
}
+
int_f
nh5tbread_field_name_dl_c(hid_t_f *loc_id,
int_f *namelen,
@@ -443,6 +366,7 @@ nh5tbread_field_name_dl_c(hid_t_f *loc_id,
{
return nh5tbread_field_name_c(loc_id,namelen,name,namelen1,field_name,start,nrecords,type_size,buf);
}
+
int_f
nh5tbread_field_name_st_c(hid_t_f *loc_id,
int_f *namelen,
@@ -486,45 +410,31 @@ nh5tbwrite_field_index_c(hid_t_f *loc_id,
size_t_f *type_size,
void *buf)
{
- int ret_value = -1;
- herr_t ret;
- char *c_name = NULL;
- int c_namelen;
+ char *c_name = NULL;
hid_t c_loc_id = *loc_id;
hsize_t c_start = *start;
hsize_t c_nrecords = *nrecords;
size_t c_type_size = *type_size;
- size_t c_type_sizes[1];
- int c_field_index[1];
-
- c_type_sizes[0] = c_type_size;
- c_field_index[0] = *field_index - 1; /* C zero based index */
-
+ int c_field_index = *field_index - 1; /* C zero based index */
+ int_f ret_value = 0;
/*
* convert FORTRAN name to C name
*/
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL)
- goto done;
+ if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ HGOTO_DONE(FAIL)
/*
* call H5TBwrite_fields_name function.
*/
-
- ret = H5TBwrite_fields_index(c_loc_id,c_name,(hsize_t)1,c_field_index,c_start,c_nrecords,c_type_size,
- 0,c_type_sizes,buf);
-
- if (ret < 0)
- goto done;
-
- ret_value = 0;
+ if(H5TBwrite_fields_index(c_loc_id, c_name, (hsize_t)1, &c_field_index,
+ c_start, c_nrecords, c_type_size, 0, &c_type_size, buf) < 0)
+ HGOTO_DONE(FAIL)
done:
- if(c_name != NULL)
- free(c_name);
+ if(c_name)
+ HDfree(c_name);
return ret_value;
}
@@ -541,6 +451,7 @@ nh5tbwrite_field_index_int_c(hid_t_f *loc_id,
{
return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf);
}
+
int_f
nh5tbwrite_field_index_fl_c(hid_t_f *loc_id,
int_f *namelen,
@@ -553,6 +464,7 @@ nh5tbwrite_field_index_fl_c(hid_t_f *loc_id,
{
return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf);
}
+
int_f
nh5tbwrite_field_index_dl_c(hid_t_f *loc_id,
int_f *namelen,
@@ -565,6 +477,7 @@ nh5tbwrite_field_index_dl_c(hid_t_f *loc_id,
{
return nh5tbwrite_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf);
}
+
int_f
nh5tbwrite_field_index_st_c(hid_t_f *loc_id,
int_f *namelen,
@@ -607,51 +520,30 @@ nh5tbread_field_index_c(hid_t_f *loc_id,
size_t_f *type_size,
void *buf)
{
- int ret_value = -1;
- herr_t ret;
- char *c_name = NULL;
- int c_namelen;
+ char *c_name = NULL;
hid_t c_loc_id = *loc_id;
hsize_t c_start = *start;
hsize_t c_nrecords = *nrecords;
size_t c_type_size = *type_size;
- size_t c_type_sizes[1];
- int c_field_index[1];
-
- c_type_sizes[0] = c_type_size;
- c_field_index[0] = *field_index - 1; /* C zero based index */
-
+ int c_field_index = *field_index - 1; /* C zero based index */
+ int_f ret_value = 0;
/*
- * convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL)
- goto done;
+ * convert FORTRAN name to C name
+ */
+ if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ HGOTO_DONE(FAIL)
/*
- * call H5TBread_fields_index function.
- */
-
- ret = H5TBread_fields_index(c_loc_id,
- c_name,(hsize_t)1,
- c_field_index,
- c_start,
- c_nrecords,
- c_type_size,
- 0,
- c_type_sizes,
- buf);
-
- if (ret < 0)
- goto done;
-
- ret_value = 0;
+ * call H5TBread_fields_index function.
+ */
+ if(H5TBread_fields_index(c_loc_id, c_name,(hsize_t)1, &c_field_index,
+ c_start, c_nrecords, c_type_size, 0, &c_type_size, buf) < 0)
+ HGOTO_DONE(FAIL)
done:
- if(c_name != NULL)
- free(c_name);
+ if(c_name)
+ HDfree(c_name);
return ret_value;
}
@@ -668,6 +560,7 @@ nh5tbread_field_index_int_c(hid_t_f *loc_id,
{
return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf);
}
+
int_f
nh5tbread_field_index_fl_c(hid_t_f *loc_id,
int_f *namelen,
@@ -680,6 +573,7 @@ nh5tbread_field_index_fl_c(hid_t_f *loc_id,
{
return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf);
}
+
int_f
nh5tbread_field_index_dl_c(hid_t_f *loc_id,
int_f *namelen,
@@ -692,6 +586,7 @@ nh5tbread_field_index_dl_c(hid_t_f *loc_id,
{
return nh5tbread_field_index_c(loc_id,namelen,name,field_index,start,nrecords,type_size,buf);
}
+
int_f
nh5tbread_field_index_st_c(hid_t_f *loc_id,
int_f *namelen,
@@ -734,51 +629,34 @@ nh5tbinsert_field_c(hid_t_f *loc_id,
int_f *position,
void *buf)
{
- int ret_value = -1;
- herr_t ret;
- char *c_name = NULL;
- int c_namelen;
- char *c_name1 = NULL;
- int c_namelen1;
+ char *c_name = NULL;
+ char *c_name1 = NULL;
hid_t c_loc_id = *loc_id;
hid_t c_field_type = *field_type;
hsize_t c_position = *position;
+ int_f ret_value = 0;
/*
* convert FORTRAN name to C name
*/
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL)
- goto done;
-
- c_namelen1 = *namelen1;
- c_name1 = (char *)HD5f2cstring(field_name, c_namelen1);
- if (c_name1 == NULL)
- goto done;
+ if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ HGOTO_DONE(FAIL)
+ if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1)))
+ HGOTO_DONE(FAIL)
/*
* call H5TBinsert_field function.
*/
- ret = H5TBinsert_field(c_loc_id,
- c_name,
- c_name1,
- c_field_type,
- c_position,
- NULL,
- buf);
-
- if (ret < 0)
- goto done;
-
- ret_value = 0;
+ if(H5TBinsert_field(c_loc_id, c_name, c_name1, c_field_type, c_position,
+ NULL, buf) < 0)
+ HGOTO_DONE(FAIL)
done:
- if(c_name != NULL)
- free(c_name);
- if(c_name1 != NULL)
- free(c_name1);
+ if(c_name )
+ HDfree(c_name);
+ if(c_name1)
+ HDfree(c_name1);
return ret_value;
}
@@ -795,6 +673,7 @@ nh5tbinsert_field_int_c(hid_t_f *loc_id,
{
return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf);
}
+
int_f
nh5tbinsert_field_fl_c(hid_t_f *loc_id,
int_f *namelen,
@@ -807,6 +686,7 @@ nh5tbinsert_field_fl_c(hid_t_f *loc_id,
{
return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf);
}
+
int_f
nh5tbinsert_field_dl_c(hid_t_f *loc_id,
int_f *namelen,
@@ -819,6 +699,7 @@ nh5tbinsert_field_dl_c(hid_t_f *loc_id,
{
return nh5tbinsert_field_c(loc_id,namelen,name,namelen1,field_name,field_type,position,buf);
}
+
int_f
nh5tbinsert_field_st_c(hid_t_f *loc_id,
int_f *namelen,
@@ -858,49 +739,32 @@ nh5tbdelete_field_c(hid_t_f *loc_id,
int_f *namelen1,
_fcd field_name)
{
- int ret_value = -1;
- herr_t ret;
- char *c_name = NULL;
- int c_namelen;
- char *c_name1 = NULL;
- int c_namelen1;
+ char *c_name = NULL;
+ char *c_name1 = NULL;
hid_t c_loc_id = *loc_id;
+ int_f ret_value = 0;
/*
- * convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL)
- goto done;
-
- c_namelen1 = *namelen1;
- c_name1 = (char *)HD5f2cstring(field_name, c_namelen1);
- if (c_name1 == NULL)
- goto done;
+ * convert FORTRAN name to C name
+ */
+ if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ HGOTO_DONE(FAIL)
+ if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1)))
+ HGOTO_DONE(FAIL)
/*
- * call H5TBinsert_field function.
- */
-
- ret = H5TBdelete_field(c_loc_id,
- c_name,
- c_name1);
-
- if (ret < 0)
- goto done;
-
- ret_value = 0;
+ * call H5TBinsert_field function.
+ */
+ if(H5TBdelete_field(c_loc_id, c_name, c_name1) < 0)
+ HGOTO_DONE(FAIL)
done:
- if(c_name != NULL)
- free(c_name);
+ if(c_name)
+ HDfree(c_name);
return ret_value;
}
-
-
/*-------------------------------------------------------------------------
* Function: h5tbget_table_info_c
*
@@ -927,42 +791,30 @@ nh5tbget_table_info_c(hid_t_f *loc_id,
hsize_t_f *nfields,
hsize_t_f *nrecords)
{
- int ret_value = -1;
- herr_t ret;
- char *c_name = NULL;
- int c_namelen;
+ char *c_name = NULL;
hid_t c_loc_id = *loc_id;
hsize_t c_nfields;
hsize_t c_nrecords;
+ int_f ret_value = 0;
/*
- * convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL)
- goto done;
+ * convert FORTRAN name to C name
+ */
+ if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ HGOTO_DONE(FAIL)
/*
- * call H5TBread_fields_index function.
- */
-
- ret = H5TBget_table_info(c_loc_id,
- c_name,
- &c_nfields,
- &c_nrecords);
-
- if (ret < 0)
- goto done;
+ * call H5TBread_fields_index function.
+ */
+ if(H5TBget_table_info(c_loc_id, c_name, &c_nfields, &c_nrecords) < 0)
+ HGOTO_DONE(FAIL)
*nfields = (hsize_t_f) c_nfields;;
*nrecords = (hsize_t_f) c_nrecords;
- ret_value = 0;
-
done:
- if(c_name != NULL)
- free(c_name);
+ if(c_name)
+ HDfree(c_name);
return ret_value;
}
@@ -999,113 +851,88 @@ nh5tbget_field_info_c(hid_t_f *loc_id,
_fcd field_names) /* field_names */
{
- int ret_value = -1;
- herr_t ret;
- char *c_name = NULL;
- int c_namelen;
+ char *c_name = NULL;
hsize_t num_elem;
hsize_t i;
- int max_len=1;
+ int max_len = 1;
hid_t c_loc_id = *loc_id;
hsize_t c_nfields = *nfields;
- size_t *c_field_sizes = NULL;
- size_t *c_field_offsets = NULL;
+ size_t *c_field_sizes = NULL;
+ size_t *c_field_offsets = NULL;
size_t c_type_size;
- char **c_field_names = NULL;
- char *tmp = NULL, *tmp_p = NULL;
- int c_lenmax=HLTB_MAX_FIELD_LEN;
- size_t length = 0;
+ char **c_field_names = NULL;
+ char *tmp = NULL, *tmp_p;
+ int c_lenmax = HLTB_MAX_FIELD_LEN;
+ int_f ret_value = 0;
num_elem = c_nfields;
-
- for (i=0; i < num_elem; i++)
- {
- if (namelen2[i] > max_len) max_len = namelen2[i];
+ for(i = 0; i < num_elem; i++) {
+ if(namelen2[i] > max_len)
+ max_len = namelen2[i];
}
/*
- * convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL)
- goto done;
-
-
- c_field_offsets = (size_t*)malloc(sizeof(size_t) * (size_t)c_nfields);
- if (!c_field_offsets)
- goto done;
-
- c_field_sizes = (size_t*)malloc(sizeof(size_t) * (size_t)c_nfields);
- if (!c_field_sizes)
- goto done;
-
- c_field_names = malloc( sizeof(char*) * (size_t)c_nfields );
- if (!c_field_names) return ret_value;
- for ( i = 0; i < c_nfields; i++)
- {
- c_field_names[i] = malloc( sizeof(char) * HLTB_MAX_FIELD_LEN );
- }
+ * convert FORTRAN name to C name
+ */
+ if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ HGOTO_DONE(FAIL)
+ if(NULL == (c_field_offsets = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
+ HGOTO_DONE(FAIL)
+ if(NULL == (c_field_sizes = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
+ HGOTO_DONE(FAIL)
+ if(NULL == (c_field_names = (char **)HDcalloc((size_t)c_nfields, sizeof(char *))))
+ HGOTO_DONE(FAIL)
+
+ for(i = 0; i < c_nfields; i++)
+ if(NULL == (c_field_names[i] = (char *)HDmalloc(sizeof(char) * HLTB_MAX_FIELD_LEN)))
+ HGOTO_DONE(FAIL)
/*
- * call H5TBget_field_info function.
- */
-
- ret = H5TBget_field_info(c_loc_id,
- c_name,
- c_field_names,
- c_field_sizes,
- c_field_offsets,
- &c_type_size);
+ * call H5TBget_field_info function.
+ */
+ if(H5TBget_field_info(c_loc_id, c_name, c_field_names, c_field_sizes,
+ c_field_offsets, &c_type_size) < 0)
+ HGOTO_DONE(FAIL)
/* return values*/
/* names array */
- tmp = (char *)malloc(c_lenmax* (size_t) c_nfields + 1);
+ if(NULL == (tmp = (char *)HDmalloc((c_lenmax * (size_t)c_nfields) + 1)))
+ HGOTO_DONE(FAIL)
+
tmp_p = tmp;
- memset(tmp,' ', c_lenmax* (size_t) c_nfields);
- tmp[c_lenmax*c_nfields] = '\0';
- for (i=0; i < c_nfields; i++)
- {
- memcpy(tmp_p, c_field_names[i], strlen(c_field_names[i]));
- namelen2[i] = (int_f)strlen(c_field_names[i]);
- length = MAX(length, strlen(c_field_names[i]));
- tmp_p = tmp_p + c_lenmax;
+ HDmemset(tmp, ' ', c_lenmax * (size_t)c_nfields);
+ tmp[c_lenmax * c_nfields] = '\0';
+ for(i = 0; i < c_nfields; i++) {
+ size_t field_name_len = HDstrlen(c_field_names[i]);
+
+ HDmemcpy(tmp_p, c_field_names[i], field_name_len);
+ namelen2[i] = (int_f)field_name_len;
+ tmp_p += c_lenmax;
}
- HD5packFstring(tmp, _fcdtocp(field_names), (int)(c_lenmax*c_nfields));
-
+ HD5packFstring(tmp, _fcdtocp(field_names), (int)(c_lenmax * c_nfields));
*type_size = (size_t_f)c_type_size;
- for (i=0; i < num_elem; i++)
- {
+ for(i = 0; i < num_elem; i++) {
field_sizes[i] = (size_t_f)c_field_sizes[i];
field_offsets[i] = (size_t_f)c_field_offsets[i];
}
-
- if (ret < 0)
- goto done;
-
- ret_value = 0;
-
-
done:
- if(c_name != NULL)
- free(c_name);
-
- for ( i = 0; i < num_elem; i++)
- {
- if ( c_field_names[i] )
- free (c_field_names[i]);
- }
- if ( c_field_names )
- free(c_field_names);
- if ( tmp )
- free(tmp);
- if ( c_field_offsets )
- free(c_field_offsets);
- if ( c_field_sizes )
- free(c_field_sizes);
+ if(c_name)
+ HDfree(c_name);
+ if(c_field_names) {
+ for(i = 0; i < num_elem; i++)
+ if(c_field_names[i])
+ HDfree(c_field_names[i]);
+ HDfree(c_field_names);
+ } /* end if */
+ if(tmp)
+ HDfree(tmp);
+ if(c_field_offsets)
+ HDfree(c_field_offsets);
+ if(c_field_sizes)
+ HDfree(c_field_sizes);
return ret_value;
}
diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in
index afe8ed4..5359be0 100644
--- a/hl/fortran/src/Makefile.in
+++ b/hl/fortran/src/Makefile.in
@@ -350,12 +350,12 @@ CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
-# We use RUNTESTS instead of RUNSERIAL directly because it may be that
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
-RUNTESTS = $(RUNSERIAL)
+RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
@@ -389,7 +389,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 44
+LT_VERS_REVISION = 49
LT_VERS_AGE = 0
INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src \
-I$(top_srcdir)/fortran/src -I$(top_builddir)/fortran/src
@@ -900,7 +900,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
- $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
@@ -971,7 +971,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS)
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
- RUNTESTS="$(RUNPARALLEL)" || exit 1; \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \
diff --git a/hl/fortran/test/Makefile.in b/hl/fortran/test/Makefile.in
index f395240..c6d1c35 100644
--- a/hl/fortran/test/Makefile.in
+++ b/hl/fortran/test/Makefile.in
@@ -324,12 +324,12 @@ CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
-# We use RUNTESTS instead of RUNSERIAL directly because it may be that
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
-RUNTESTS = $(RUNSERIAL)
+RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
@@ -775,7 +775,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
- $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
@@ -846,7 +846,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS)
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
- RUNTESTS="$(RUNPARALLEL)" || exit 1; \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index e797d14..d118942 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -1668,7 +1668,7 @@ print_enum(hid_t type, char* str, int indt)
int nmembs; /*number of members */
char tmp_str[256];
int nchars; /*number of output characters */
- hid_t super; /*enum base integer type */
+ hid_t super = -1; /*enum base integer type */
hid_t native = -1; /*native integer data type */
size_t super_size; /*enum base type size */
size_t dst_size; /*destination value type size */
@@ -1742,21 +1742,36 @@ print_enum(hid_t type, char* str, int indt)
}
/* Release resources */
- for (i = 0; i < nmembs; i++)
+ for(i = 0; i < nmembs; i++)
free(name[i]);
free(name);
free(value);
H5Tclose(super);
- if (0 == nmembs) {
+ return ret;
+
+out:
+
+ if(0 == nmembs) {
sprintf(tmp_str, "\n%*s <empty>", indt + 4, "");
strcat(str, tmp_str);
- }
+ } /* end if */
+
+ /* Release resources */
+ if(name) {
+ for(i = 0; i < nmembs; i++)
+ if(name[i])
+ free(name[i]);
+ free(name);
+ } /* end if */
- return ret;
+ if(value)
+ free(value);
+
+ if(super >= 0)
+ H5Tclose(super);
-out:
return FAIL;
}
diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c
index 10d2637..3d16db5 100644
--- a/hl/src/H5PT.c
+++ b/hl/src/H5PT.c
@@ -214,6 +214,11 @@ out:
*
* Modifications:
*
+ * John Mainzer -- 4/23/08
+ * Added error check on malloc of table, initialized fields
+ * in table to keep lower level code from choking on bogus
+ * data in error cases.
+ *
*-------------------------------------------------------------------------
*/
hid_t H5PTopen( hid_t loc_id,
@@ -232,6 +237,12 @@ hid_t H5PTopen( hid_t loc_id,
table = (htbl_t *)malloc(sizeof(htbl_t));
+ if ( table == NULL ) {
+ goto out;
+ }
+ table->dset_id = H5I_BADID;
+ table->type_id = H5I_BADID;
+
/* Open the dataset */
if((table->dset_id = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c
index a035319..b9cb73c 100644
--- a/hl/src/H5TB.c
+++ b/hl/src/H5TB.c
@@ -3213,16 +3213,12 @@ herr_t H5TBget_field_info( hid_t loc_id,
size_t *field_offsets,
size_t *type_size )
{
- hid_t did; /* dataset ID */
- hid_t tid; /* file type ID */
- hid_t n_tid; /* native type ID */
- hid_t m_tid; /* member type ID */
- hid_t nm_tid; /* native member ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t tid = -1; /* file type ID */
+ hid_t n_tid = -1; /* native type ID */
+ hid_t m_tid = -1; /* member type ID */
+ hid_t nm_tid = -1; /* native member ID */
hssize_t nfields;
- char *member_name;
- size_t member_size;
- size_t member_offset;
- size_t size;
hssize_t i;
/* open the dataset. */
@@ -3233,62 +3229,47 @@ herr_t H5TBget_field_info( hid_t loc_id,
if (( tid = H5Dget_type( did )) < 0)
goto out;
- if ((n_tid = H5Tget_native_type(tid,H5T_DIR_DEFAULT)) < 0)
+ if ((n_tid = H5Tget_native_type(tid, H5T_DIR_DEFAULT)) < 0)
goto out;
/* get the type size */
- size = H5Tget_size( n_tid );
-
- if ( type_size )
- {
- *type_size = size;
- }
+ if(type_size)
+ *type_size = H5Tget_size(n_tid);
/* get the number of members */
if (( nfields = H5Tget_nmembers( tid )) < 0)
goto out;
/* iterate tru the members */
- for ( i = 0; i < nfields; i++)
- {
+ for ( i = 0; i < nfields; i++) {
/* get the member name */
- member_name = H5Tget_member_name( tid, (unsigned)i );
+ if(field_names) {
+ char *member_name;
- if (field_names )
- {
- strcpy( field_names[i], member_name );
- }
+ member_name = H5Tget_member_name(tid, (unsigned)i);
+ strcpy(field_names[i], member_name);
+ free(member_name);
+ } /* end if */
/* get the member type */
- if (( m_tid = H5Tget_member_type( tid,(unsigned) i )) < 0)
+ if(( m_tid = H5Tget_member_type( tid,(unsigned) i )) < 0)
goto out;
- if ((nm_tid = H5Tget_native_type(m_tid,H5T_DIR_DEFAULT)) < 0)
+ if((nm_tid = H5Tget_native_type(m_tid,H5T_DIR_DEFAULT)) < 0)
goto out;
/* get the member size */
- member_size = H5Tget_size( nm_tid );
-
- if(field_sizes )
- {
- field_sizes[i] = member_size;
- }
+ if(field_sizes)
+ field_sizes[i] = H5Tget_size(nm_tid);
/* get the member offset */
- member_offset = H5Tget_member_offset( n_tid,(unsigned) i );
-
- if(field_offsets )
- {
- field_offsets[i] = member_offset;
- }
+ if(field_offsets)
+ field_offsets[i] = H5Tget_member_offset(n_tid, (unsigned) i);
/* close the member types */
if (H5Tclose( m_tid ) < 0)
goto out;
if (H5Tclose( nm_tid ) < 0)
goto out;
-
- free( member_name );
-
} /* i */
/* close */
@@ -3308,6 +3289,8 @@ out:
H5Dclose(did);
H5Tclose(tid);
H5Tclose(n_tid);
+ H5Tclose(m_tid);
+ H5Tclose(nm_tid);
} H5E_END_TRY;
return -1;
diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in
index 0e3bd46..36ebcf9 100644
--- a/hl/src/Makefile.in
+++ b/hl/src/Makefile.in
@@ -341,12 +341,12 @@ CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
-# We use RUNTESTS instead of RUNSERIAL directly because it may be that
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
-RUNTESTS = $(RUNSERIAL)
+RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
@@ -380,7 +380,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 44
+LT_VERS_REVISION = 49
LT_VERS_AGE = 0
# This library is our main target.
@@ -866,7 +866,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
- $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
@@ -937,7 +937,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS)
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
- RUNTESTS="$(RUNPARALLEL)" || exit 1; \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \
diff --git a/hl/test/Makefile.in b/hl/test/Makefile.in
index 4a5aa5b..a364c75 100644
--- a/hl/test/Makefile.in
+++ b/hl/test/Makefile.in
@@ -345,12 +345,12 @@ CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
-# We use RUNTESTS instead of RUNSERIAL directly because it may be that
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
-RUNTESTS = $(RUNSERIAL)
+RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
@@ -837,7 +837,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
- $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
@@ -908,7 +908,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS)
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
- RUNTESTS="$(RUNPARALLEL)" || exit 1; \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c
index 7e0f20e..32622ed 100644
--- a/hl/test/test_ds.c
+++ b/hl/test/test_ds.c
@@ -4889,6 +4889,7 @@ static int read_data( const char* fname,
if ( *buf == NULL )
{
printf( "memory allocation failed\n" );
+ fclose(f);
return -1;
}
diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c
index 21afc54..95869af 100644
--- a/hl/test/test_lite.c
+++ b/hl/test/test_lite.c
@@ -1534,17 +1534,16 @@ static int test_complicated_compound(void)
hid_t dtype;
int nmembs;
H5T_class_t type_class;
- char* line=NULL;
- FILE *fp;
+ char *line = NULL;
+ FILE *fp = NULL;
size_t size = 1024;
- char *srcdir = getenv("srcdir"); /* the source directory */
+ char *srcdir = getenv("srcdir"); /* the source directory */
char filename[1024]="";
TESTING3(" text for complicated compound types");
/* compose the name of the file to open, using the srcdir, if appropriate */
- if(srcdir)
- {
+ if(srcdir) {
strcpy(filename, srcdir);
strcat(filename, "/");
}
@@ -1552,8 +1551,7 @@ static int test_complicated_compound(void)
/* Open input file */
fp = fopen(filename, "r");
- if(fp == NULL)
- {
+ if(fp == NULL) {
printf( "Could not find file %s. Try set $srcdir \n", filename);
goto out;
}
@@ -1579,6 +1577,7 @@ static int test_complicated_compound(void)
}
fclose(fp);
+ fp = NULL;
if((dtype = H5LTtext_to_dtype(line, H5LT_DDL))<0)
goto out;
@@ -1601,6 +1600,12 @@ static int test_complicated_compound(void)
return 0;
out:
+
+ if(line)
+ free(line);
+ if(fp)
+ fclose(fp);
+
H5_FAILED();
return -1;
}
diff --git a/hl/tools/Makefile.in b/hl/tools/Makefile.in
index 2738d84..cb80338 100644
--- a/hl/tools/Makefile.in
+++ b/hl/tools/Makefile.in
@@ -330,12 +330,12 @@ CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
-# We use RUNTESTS instead of RUNSERIAL directly because it may be that
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
-RUNTESTS = $(RUNSERIAL)
+RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
@@ -844,7 +844,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
- $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
@@ -915,7 +915,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS)
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
- RUNTESTS="$(RUNPARALLEL)" || exit 1; \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \
diff --git a/hl/tools/gif2h5/Makefile.in b/hl/tools/gif2h5/Makefile.in
index e43dd07..b4cf901 100644
--- a/hl/tools/gif2h5/Makefile.in
+++ b/hl/tools/gif2h5/Makefile.in
@@ -330,12 +330,12 @@ CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
-# We use RUNTESTS instead of RUNSERIAL directly because it may be that
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
-RUNTESTS = $(RUNSERIAL)
+RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
@@ -853,7 +853,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
- $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
@@ -924,7 +924,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS)
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
- RUNTESTS="$(RUNPARALLEL)" || exit 1; \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \
diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c
index 435e272..2e44f1c 100644
--- a/hl/tools/gif2h5/decompress.c
+++ b/hl/tools/gif2h5/decompress.c
@@ -222,7 +222,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
if (!(Image = (BYTE *)malloc((size_t)IWidth*(size_t)IHeight))) {
printf("Out of memory");
- exit(-1);
+ exit(EXIT_FAILURE);
}
BytesPerScanline = IWidth;
diff --git a/hl/tools/gif2h5/gif2hdf.c b/hl/tools/gif2h5/gif2hdf.c
index c7e4ab6..39c71cf 100644
--- a/hl/tools/gif2h5/gif2hdf.c
+++ b/hl/tools/gif2h5/gif2hdf.c
@@ -60,7 +60,7 @@ main(int argv , char *argc[])
printf("Usage: gif2h5 <GIFFILE> <HDFFILE>\n");
fprintf(stdout, " gif2h5 -V \n");
fprintf(stdout, " Print HDF5 library version and exit\n");
- return(-1);
+ exit(EXIT_FAILURE);
}
GIFFileName = argc[1];
@@ -68,7 +68,7 @@ main(int argv , char *argc[])
if (!(fpGif = fopen(GIFFileName,"rb"))) {
printf("Unable to open GIF file for reading.\n");
- exit(-1);
+ exit(EXIT_FAILURE);
}
/* Get the whole file into memory. Mem's much faster than I/O */
@@ -81,12 +81,12 @@ main(int argv , char *argc[])
if (!(MemGif = StartPos = (BYTE *)malloc((size_t)filesize))) {
printf("Out of memory");
- exit (-1);
+ exit(EXIT_FAILURE);
}
if (fread(MemGif,(size_t)filesize,1,fpGif) != 1) {
printf("Corrupted Input File");
- exit(-1);
+ exit(EXIT_FAILURE);
}
fseek(fpGif,0L,0);
@@ -99,7 +99,7 @@ main(int argv , char *argc[])
if (ferror(fpGif)) {
printf("File Stream Error\n\n");
- exit(-1);
+ exit(EXIT_FAILURE);
}
fclose(fpGif);
@@ -157,5 +157,5 @@ main(int argv , char *argc[])
}
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c
index 6274b9a..907fb80 100644
--- a/hl/tools/gif2h5/gif2mem.c
+++ b/hl/tools/gif2h5/gif2mem.c
@@ -77,7 +77,7 @@ Gif2Mem(BYTE *MemGif)
/****************************************************/
if (!(gifHead = (GIFHEAD *)malloc(sizeof(GIFHEAD)))) {
printf("Could not allocate memory for gifHead\n");
- exit(-1);
+ exit(EXIT_FAILURE);
}
/*
@@ -107,7 +107,7 @@ Gif2Mem(BYTE *MemGif)
if (ferror(fpGif))
{
fputs("GIFHEAD: Error reading header information!\n", stderr);
- exit(-3);
+ exit(EXIT_FAILURE);
}
#endif /* 0 */
@@ -161,14 +161,14 @@ Gif2Mem(BYTE *MemGif)
if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(gifImageDesc,
sizeof(GIFIMAGEDESC *) * ImageArray))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc(
gifGraphicControl,
sizeof(GIFGRAPHICCONTROL *) * ImageArray))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
for (j = aTemp ; j < ImageArray ; j++) {
@@ -179,7 +179,7 @@ Gif2Mem(BYTE *MemGif)
if(!(gifImageDesc[ImageCount-1] = (GIFIMAGEDESC*)malloc(sizeof(GIFIMAGEDESC)))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
@@ -228,12 +228,12 @@ Gif2Mem(BYTE *MemGif)
if (!(gifPlainText = (GIFPLAINTEXT **)realloc(gifPlainText , sizeof(GIFPLAINTEXT *) * PlainTextArray))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
if(!(gifPlainText[PlainTextCount - 1] = (GIFPLAINTEXT*)malloc(sizeof(GIFPLAINTEXT)))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
if (ReadGifPlainText(gifPlainText[PlainTextCount - 1], &MemGif))
@@ -250,12 +250,12 @@ Gif2Mem(BYTE *MemGif)
if (!(gifComment = (GIFCOMMENT **)realloc(gifComment , sizeof(GIFCOMMENT *) * CommentArray))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
if(!(gifComment[CommentCount - 1] = (GIFCOMMENT *)malloc(sizeof(GIFCOMMENT)))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
@@ -277,12 +277,12 @@ Gif2Mem(BYTE *MemGif)
if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc(gifGraphicControl , sizeof(GIFGRAPHICCONTROL *) * ImageArray))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(gifImageDesc , sizeof(GIFIMAGEDESC *) * ImageArray))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
for (j = aTemp ; j < ImageArray ; j++) {
@@ -293,7 +293,7 @@ Gif2Mem(BYTE *MemGif)
if(!(gifGraphicControl[ImageCount-1] = (GIFGRAPHICCONTROL*)malloc(sizeof(GIFGRAPHICCONTROL)))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
@@ -315,12 +315,12 @@ Gif2Mem(BYTE *MemGif)
if (!(gifApplication = (GIFAPPLICATION **)realloc(gifApplication , sizeof(GIFAPPLICATION *) * ApplicationArray))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
if(!(gifApplication[ApplicationCount - 1] = (GIFAPPLICATION *)malloc(sizeof(GIFAPPLICATION)))) {
printf("Out of memory!");
- exit(-1);
+ exit(EXIT_FAILURE);
}
diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c
index a08564a..2b4c129 100644
--- a/hl/tools/gif2h5/gifread.c
+++ b/hl/tools/gif2h5/gifread.c
@@ -68,7 +68,7 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */
if (strncmp((const char *)GifHead->HeaderDump , "GIF" , (size_t)3)) {
printf("The file does not appear to be a valid GIF file.\n");
- exit(-1);
+ exit(EXIT_FAILURE);
}
for (i = 0 ; i < 7 ; i++) {
@@ -192,7 +192,7 @@ ReadGifImageDesc(
/*GifImageDesc->GIFImage = ReadDataSubBlocks(FpGif);*/
if (!(GifImageDesc->GIFImage = (BYTE *)malloc((GifImageDesc->ImageWidth) * (GifImageDesc->ImageHeight)))) {
printf("Out of memory");
- exit(-1);
+ exit(EXIT_FAILURE);
}
diff --git a/hl/tools/gif2h5/h52gifgentst.c b/hl/tools/gif2h5/h52gifgentst.c
index eb83335..ef38c3b 100644
--- a/hl/tools/gif2h5/h52gifgentst.c
+++ b/hl/tools/gif2h5/h52gifgentst.c
@@ -58,7 +58,7 @@ int main(void)
/* create a file */
if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0)
- return 1;
+ return EXIT_FAILURE;
/* create an image */
space = WIDTH*HEIGHT / PAL_ENTRIES;
@@ -75,7 +75,7 @@ int main(void)
/* make the image */
if (H5IMmake_image_8bit( fid, IMAGE1_NAME, width, height, buf )<0)
- return 1;
+ return EXIT_FAILURE;
/*-------------------------------------------------------------------------
* define a palette, blue to red tones
@@ -90,15 +90,15 @@ int main(void)
/* make a palette */
if (H5IMmake_palette( fid, PAL_NAME, pal_dims, pal )<0)
- return 1;
+ return EXIT_FAILURE;
/* attach the palette to the image */
if (H5IMlink_palette( fid, IMAGE1_NAME, PAL_NAME )<0)
- return 1;
+ return EXIT_FAILURE;
if(H5Fclose(fid)<0)
- return 1;
+ return EXIT_FAILURE;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/hl/tools/gif2h5/h52giftest.sh b/hl/tools/gif2h5/h52giftest.sh
index 7874bca..186b369 100644
--- a/hl/tools/gif2h5/h52giftest.sh
+++ b/hl/tools/gif2h5/h52giftest.sh
@@ -64,4 +64,10 @@ TESTING "./gif2h5 image1.gif image1.h5"
TOOLTEST2 $TESTFILE2 image1.h5
-exit $errors
+if test $errors -eq 0 ; then
+ echo "All h52gif tests passed."
+ exit 0
+else
+ echo "h52gif tests failed with $errors errors."
+ exit 1
+fi
diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c
index 9c252e1..cc8e864 100644
--- a/hl/tools/gif2h5/hdf2gif.c
+++ b/hl/tools/gif2h5/hdf2gif.c
@@ -82,7 +82,7 @@ int main(int argc , char **argv)
{
/* they didn't supply at least one image -- bail */
usage();
- return 1;
+ return EXIT_FAILURE;
}
HDFName = argv[1];
@@ -313,7 +313,7 @@ int main(int argc , char **argv)
if (image_name != NULL)
free(image_name);
- return 0;
+ return EXIT_SUCCESS;
out:
@@ -323,5 +323,5 @@ out:
if (image_name != NULL)
free(image_name);
- return 1;
+ return EXIT_FAILURE;
}