summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-09-22 00:21:18 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-09-22 00:21:18 (GMT)
commitd3c6b4ad7244f46c863d47f630e1c9b0427abed5 (patch)
treebf76f37066c26a76422483f3088f4dbcb6ced5be
parentfd90a6f5c4c7733027c711e70e2df1b18e8e5286 (diff)
downloadhdf5-d3c6b4ad7244f46c863d47f630e1c9b0427abed5.zip
hdf5-d3c6b4ad7244f46c863d47f630e1c9b0427abed5.tar.gz
hdf5-d3c6b4ad7244f46c863d47f630e1c9b0427abed5.tar.bz2
[svn-r27848] Description:
Clean up warnings and some normalization against trunk. Tested: McaOSX/64 10.10.5 (amazon) w/serial & parallel (h5committest not required on this branch)
-rw-r--r--src/H5Shyper.c1
-rw-r--r--src/H5Sselect.c2
-rw-r--r--test/h5test.c4
-rw-r--r--tools/h5diff/testh5diff.sh.in72
-rw-r--r--tools/h5ls/h5ls.c2
-rw-r--r--tools/h5repack/h5repack.sh.in26
-rw-r--r--tools/lib/h5tools_dump.c45
-rw-r--r--tools/lib/h5tools_error.h2
-rw-r--r--tools/lib/h5tools_str.c29
9 files changed, 89 insertions, 94 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index f0ec40d..1a4e4f5 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -1893,7 +1893,6 @@ H5S_get_select_hyper_nblocks(H5S_t *space)
else
ret_value = H5S_hyper_span_nblocks(space->select.sel_info.hslab->span_lst);
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_get_select_hyper_nblocks() */
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index cf82af1..11267b6 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -457,7 +457,7 @@ H5S_select_deserialize(H5S_t **space, const uint8_t **p)
uint32_t sel_type; /* Pointer to the selection type */
uint32_t version; /* Version number */
uint8_t flags = 0; /* Flags */
- herr_t ret_value = FAIL; /* return value */
+ herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
diff --git a/test/h5test.c b/test/h5test.c
index f16b98f..843ec35 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -123,7 +123,7 @@ h5_errors(hid_t estack, void H5_ATTR_UNUSED *client_data)
return 0;
}
-
+
/*-------------------------------------------------------------------------
* Function: h5_clean_files
*
@@ -191,7 +191,7 @@ h5_clean_files(const char *base_name[], hid_t fapl)
return;
} /* end h5_clean_files() */
-
+
/*-------------------------------------------------------------------------
* Function: h5_cleanup
*
diff --git a/tools/h5diff/testh5diff.sh.in b/tools/h5diff/testh5diff.sh.in
index 07fa7ba..fec6035 100644
--- a/tools/h5diff/testh5diff.sh.in
+++ b/tools/h5diff/testh5diff.sh.in
@@ -385,23 +385,23 @@ CLEAN_TESTFILES_AND_TESTDIR()
while [ $# -gt 0 ]; do
case "$1" in
-p) # reset the tool name and bin to run ph5diff tests
- TESTNAME=ph5diff
- H5DIFF=ph5diff # The tool name
- H5DIFF_BIN=`pwd`/$H5DIFF
- pmode=yes
- shift
- ;;
+ TESTNAME=ph5diff
+ H5DIFF=ph5diff # The tool name
+ H5DIFF_BIN=`pwd`/$H5DIFF
+ pmode=yes
+ shift
+ ;;
-h) # print help page
- echo "$0 [-p] [-h]"
- echo " -p run ph5diff tests"
- echo " -h print help page"
- shift
- exit 0
- ;;
+ echo "$0 [-p] [-h]"
+ echo " -p run ph5diff tests"
+ echo " -h print help page"
+ shift
+ exit 0
+ ;;
*) # unknown option
echo "$0: Unknown option ($1)"
- exit 1
- ;;
+ exit 1
+ ;;
esac
done
@@ -452,11 +452,11 @@ TOOLTEST() {
# Run test.
TESTING $H5DIFF $@
(
- #echo "#############################"
- #echo "Expected output for '$H5DIFF $@'"
- #echo "#############################"
- cd $TESTDIR
- eval $RUNCMD $H5DIFF_BIN "$@"
+ #echo "#############################"
+ #echo "Expected output for '$H5DIFF $@'"
+ #echo "#############################"
+ cd $TESTDIR
+ eval $RUNCMD $H5DIFF_BIN "$@"
) >$actual 2>$actual_err
EXIT_CODE=$?
# save actual and actual_err in case they are needed later.
@@ -485,7 +485,7 @@ TOOLTEST() {
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
else
- # parallel mode output are often of different ordering from serial
+ # parallel mode output are often of different ordering from serial
# output. If the sorted expected and actual files compare the same,
# it is safe to assume the actual output match the expected file.
expect_sorted=expect_sorted
@@ -496,22 +496,22 @@ TOOLTEST() {
# is done by serial mode.
grep -v "EXIT CODE:" $expect_sorted > $expect_sorted.noexit
mv $expect_sorted.noexit $expect_sorted
- if $CMP $expect_sorted $actual_sorted; then
- echo " PASSED"
- else
- echo "*FAILED*"
- nerrors="`expr $nerrors + 1`"
- if test yes = "$verbose"; then
- echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)"
- $DIFF $expect_sorted $actual_sorted |sed 's/^/ /'
- echo "====The actual output ($actual_sav)"
- sed 's/^/ /' < $actual_sav
- echo "====The actual stderr ($actual_err_sav)"
- sed 's/^/ /' < $actual_err_sav
- echo "====End of actual stderr ($actual_err_sav)"
- echo ""
- fi
- fi
+ if $CMP $expect_sorted $actual_sorted; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ if test yes = "$verbose"; then
+ echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)"
+ $DIFF $expect_sorted $actual_sorted |sed 's/^/ /'
+ echo "====The actual output ($actual_sav)"
+ sed 's/^/ /' < $actual_sav
+ echo "====The actual stderr ($actual_err_sav)"
+ sed 's/^/ /' < $actual_err_sav
+ echo "====End of actual stderr ($actual_err_sav)"
+ echo ""
+ fi
+ fi
fi
# Clean up output file
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index f291958..cce5f3d 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1759,7 +1759,6 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
size_t cd_nelmts; /* filter client number of values */
size_t cd_num; /* filter client data counter */
char f_name[256]; /* filter/file name */
- char dset_name[256]; /* filter/file name */
char s[64]; /* temporary string buffer */
off_t f_offset; /* offset in external file */
hsize_t f_size; /* bytes used in external file */
@@ -1850,6 +1849,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
case H5D_VIRTUAL:
{
+ char dset_name[256]; /* Dataset name */
size_t vmaps;
H5Pget_virtual_count(dcpl, &vmaps);
diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in
index 478ca36..24298d0 100644
--- a/tools/h5repack/h5repack.sh.in
+++ b/tools/h5repack/h5repack.sh.in
@@ -171,7 +171,7 @@ COPY_TESTFILES_TO_TESTDIR()
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $CP -f $tstfile $TESTDIR
+ $CP -f $tstfile $TESTDIR
if [ $? -ne 0 ]; then
echo "Error: FAILED to copy $tstfile ."
@@ -469,11 +469,11 @@ TOOLTEST1()
)
RET=$?
if [ $RET != 0 ] ; then
- echo "*FAILED*"
- nerrors="`expr $nerrors + 1`"
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
else
- echo " PASSED"
- DIFFTEST $infile $outfile
+ echo " PASSED"
+ DIFFTEST $infile $outfile
fi
rm -f $outfile
}
@@ -500,11 +500,11 @@ TOOLTESTV()
) >$actual 2>$actual_err
RET=$?
if [ $RET != 0 ] ; then
- echo "*FAILED*"
- nerrors="`expr $nerrors + 1`"
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
else
- echo " PASSED"
- DIFFTEST $infile $outfile
+ echo " PASSED"
+ DIFFTEST $infile $outfile
fi
# display output compare
@@ -634,11 +634,11 @@ TOOLTEST_META()
# verify sizes.
MESSAGE "Verify the sizes of both output files ($size1 vs $size2)"
if [ $size1 -lt $size2 ]; then
- # pass
- echo " PASSED"
+ # pass
+ echo " PASSED"
else
- #fail
- echo "*FAILED*"
+ #fail
+ echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
fi
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index 7928dfb..0d39981 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -225,13 +225,12 @@ void h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims);
void h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info,
h5tools_context_t *ctx, struct subset_t *sset, int dims);
-void h5tools_print_virtual_selection(hid_t vspace, hid_t dcpl_id, size_t index,
+static void h5tools_print_virtual_selection(hid_t vspace,
FILE *stream, const h5tool_format_t *info,
h5tools_context_t *ctx/*in,out*/,
h5tools_str_t *buffer/*string into which to render */,
hsize_t *curr_pos/*total data element position*/,
- size_t ncols, hsize_t region_elmt_counter/*element counter*/,
- hsize_t elmt_counter);
+ size_t ncols);
void
h5tools_dump_init(void)
@@ -820,10 +819,11 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
HDassert(cur_ctx);
HDassert(buffer);
HDassert(ptdata);
+ HDassert(ndims > 0);
HDmemset(&ctx, 0, sizeof(ctx));
/* Allocate space for the dimension array */
- if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims)) == NULL)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims");
dims1[0] = npoints;
@@ -2871,19 +2871,18 @@ h5tools_dump_oid(FILE *stream, const h5tool_format_t *info,
* Return: void
*-------------------------------------------------------------------------
*/
-void
-h5tools_print_virtual_selection(hid_t vspace, hid_t dcpl_id, size_t index,
+static void
+h5tools_print_virtual_selection(hid_t vspace,
FILE *stream, const h5tool_format_t *info,
h5tools_context_t *ctx/*in,out*/,
h5tools_str_t *buffer/*string into which to render */,
hsize_t *curr_pos/*total data element position*/,
- size_t ncols, hsize_t region_elmt_counter/*element counter*/,
- hsize_t elmt_counter)
+ size_t ncols)
{
switch(H5Sget_select_type(vspace)) {
case H5S_SEL_NONE: /* Nothing selected */
ctx->need_prefix = TRUE;
- h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
+ h5tools_simple_prefix(stream, info, ctx, *curr_pos, 0);
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "%s", VDS_NONE);
@@ -2896,7 +2895,7 @@ h5tools_print_virtual_selection(hid_t vspace, hid_t dcpl_id, size_t index,
break;
case H5S_SEL_HYPERSLABS: /* "New-style" hyperslab selection defined */
ctx->need_prefix = TRUE;
- h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
+ h5tools_simple_prefix(stream, info, ctx, *curr_pos, 0);
h5tools_str_reset(buffer);
if (H5Sis_regular_hyperslab(vspace)) {
@@ -2911,7 +2910,7 @@ h5tools_print_virtual_selection(hid_t vspace, hid_t dcpl_id, size_t index,
h5tools_render_element(stream, info, ctx, buffer, curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
ctx->indent_level++;
ctx->need_prefix = TRUE;
- h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
+ h5tools_simple_prefix(stream, info, ctx, *curr_pos, 0);
h5tools_str_reset(buffer);
h5tools_str_dump_space_blocks(buffer, vspace, info);
@@ -2919,14 +2918,14 @@ h5tools_print_virtual_selection(hid_t vspace, hid_t dcpl_id, size_t index,
}
h5tools_render_element(stream, info, ctx, buffer, curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
ctx->need_prefix = TRUE;
- h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
+ h5tools_simple_prefix(stream, info, ctx, *curr_pos, 0);
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->virtualselectionblockend);
break;
case H5S_SEL_ALL: /* Entire extent selected */
ctx->need_prefix = TRUE;
- h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
+ h5tools_simple_prefix(stream, info, ctx, *curr_pos, 0);
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "%s", VDS_ALL);
@@ -2997,7 +2996,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
off_t offset; /* offset of external file */
char f_name[256]; /* filter name */
char name[256]; /* external or virtual file name */
- char dsetname[256]; /* virtual datset name */
hsize_t chsize[64]; /* chunk size in elements */
hsize_t size; /* size of external file */
hsize_t storage_size;
@@ -3190,6 +3188,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
case H5D_VIRTUAL:
{
+ char dsetname[256]; /* virtual datset name */
size_t vmaps;
H5Pget_virtual_count(dcpl_id, &vmaps);
@@ -3221,7 +3220,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
ctx->indent_level++;
- h5tools_print_virtual_selection(virtual_vspace, dcpl_id, next, stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ h5tools_print_virtual_selection(virtual_vspace, stream, info, ctx, &buffer, &curr_pos, (size_t) ncols);
ctx->indent_level--;
@@ -3242,8 +3241,12 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
ctx->indent_level++;
ssize_out = H5Pget_virtual_filename(dcpl_id, next, NULL, 0);
+ HDassert(ssize_out > 0);
+ HDassert((size_t)ssize_out < sizeof(name));
H5Pget_virtual_filename(dcpl_id, next, name, sizeof(name));
ssize_out = H5Pget_virtual_dsetname(dcpl_id, next, NULL, 0);
+ HDassert(ssize_out > 0);
+ HDassert((size_t)ssize_out < sizeof(name));
H5Pget_virtual_dsetname(dcpl_id, next, dsetname, sizeof(dsetname));
ctx->need_prefix = TRUE;
@@ -3264,7 +3267,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->virtualdatasetnameend);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
- h5tools_print_virtual_selection(virtual_srcspace, dcpl_id, next, stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ h5tools_print_virtual_selection(virtual_srcspace, stream, info, ctx, &buffer, &curr_pos, (size_t) ncols);
ctx->indent_level--;
@@ -3324,8 +3327,8 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
cd_values, sizeof(f_name), f_name, NULL);
- if (filtn < 0)
- continue; /* nothing to print for invalid filter */
+ if(filtn < 0)
+ continue; /* nothing to print for invalid filter */
ctx->need_prefix = TRUE;
h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
@@ -3417,12 +3420,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
break;
default:
- /* filters do not have to be available for showing registered filter info.
- see HDFFV-8346 for details. --xcao@hdfgroup.org
- if(H5Zfilter_avail(filtn))
- h5tools_str_append(&buffer, "%s %s", "USER_REGISTERED_FILTER", BEGIN);
- else
- */
h5tools_str_append(&buffer, "%s %s", "USER_DEFINED_FILTER", BEGIN);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h
index ae549fd..749157e 100644
--- a/tools/lib/h5tools_error.h
+++ b/tools/lib/h5tools_error.h
@@ -98,7 +98,7 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g;
* to the `catch_except' label, if we're not already past it.
*/
#define H5E_THROW(fail_value, min_id, str) { \
- HERROR(H5E_tools_g, min_id, str); \
+ H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, str); \
H5_LEAVE(fail_value) \
}
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index c10f33b..bdb82a4 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -1456,23 +1456,22 @@ h5tools_str_is_zero(const void *_mem, size_t size)
char *
h5tools_str_replace ( const char *string, const char *substr, const char *replacement )
{
- char *tok = NULL;
- char *newstr = NULL;
- char *oldstr = NULL;
- char *head = NULL;
-
- if ( substr == NULL || replacement == NULL )
- return HDstrdup (string);
-
- newstr = HDstrdup (string);
- head = newstr;
- while ( (tok = HDstrstr ( head, substr ))){
- oldstr = newstr;
- newstr = (char *)HDmalloc( HDstrlen( oldstr ) - HDstrlen( substr ) + HDstrlen( replacement ) + 1 );
+ char *tok = NULL;
+ char *newstr = NULL;
+ char *oldstr = NULL;
+ char *head = NULL;
+
+ if ( substr == NULL || replacement == NULL )
+ return HDstrdup (string);
+ newstr = HDstrdup (string);
+ head = newstr;
+ while ( (tok = HDstrstr ( head, substr ))){
+ oldstr = newstr;
+ newstr = (char *)HDmalloc( HDstrlen( oldstr ) - HDstrlen( substr ) + HDstrlen( replacement ) + 1 );
if ( newstr == NULL ){
- HDfree (oldstr);
- return NULL;
+ HDfree (oldstr);
+ return NULL;
}
HDmemcpy ( newstr, oldstr, tok - oldstr );
HDmemcpy ( newstr + (tok - oldstr), replacement, HDstrlen ( replacement ) );