From 8ca8c23b5aab2b7b6ba8d0bcb196f64c2f253b6e Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 6 Nov 2003 08:45:39 -0500 Subject: [svn-r7822] Purpose: Bug fix & code cleanup Description: Propagate error value out of function, so that failures can be detected by testing scripts. Clean up a few compiler warnings while I'm here. Platforms tested: FreeBSD 4.9 (sleipnir) too minor to require h5committest --- tools/h5repack/h5repack_list.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/h5repack/h5repack_list.c b/tools/h5repack/h5repack_list.c index 8358221..81b56ce 100644 --- a/tools/h5repack/h5repack_list.c +++ b/tools/h5repack/h5repack_list.c @@ -200,7 +200,10 @@ int copy_file(char* fnamein, *------------------------------------------------------------------------- */ - do_copy_file(fidin,fidout,nobjects,info,options); + if(do_copy_file(fidin,fidout,nobjects,info,options)<0) { + printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, fnameout); + return -1; + } /*------------------------------------------------------------------------- * free @@ -361,7 +364,7 @@ int do_copy_file(hid_t fidin, nelmts*=dims[j]; if ((mtype_id=H5Tget_native_type(ftype_id,H5T_DIR_DEFAULT))<0) goto error; - if ((msize=H5Tget_size(mtype_id))<0) + if ((msize=H5Tget_size(mtype_id))==0) goto error; buf=(void *) HDmalloc((unsigned)(nelmts*msize)); if ( buf==NULL){ @@ -540,19 +543,20 @@ int copy_attr(hid_t loc_in, int rank; /* rank of dataset */ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ char name[255]; - int n, i, j; + int n, j; + unsigned u; if ((n = H5Aget_num_attrs(loc_in))<0) goto error; - for ( i = 0; i < n; i++) + for ( u = 0; u < (unsigned)n; u++) { /*------------------------------------------------------------------------- * open *------------------------------------------------------------------------- */ /* open attribute */ - if ((attr_id = H5Aopen_idx(loc_in, i))<0) + if ((attr_id = H5Aopen_idx(loc_in, u))<0) goto error; /* get name */ @@ -580,7 +584,7 @@ int copy_attr(hid_t loc_in, nelmts*=dims[j]; if ((mtype_id=H5Tget_native_type(ftype_id,H5T_DIR_DEFAULT))<0) goto error; - if ((msize=H5Tget_size(mtype_id))<0) + if ((msize=H5Tget_size(mtype_id))==0) goto error; buf=(void *) HDmalloc((unsigned)(nelmts*msize)); if ( buf==NULL){ @@ -616,7 +620,7 @@ int copy_attr(hid_t loc_in, if (H5Aclose(attr_out)<0) goto error; if (buf) free(buf); - } /* i */ + } /* u */ return 0; -- cgit v0.12