summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-09-05 18:22:38 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-09-05 18:22:38 (GMT)
commit43a90946ef4a66861c169d29dcae91836c38c5a5 (patch)
tree4b58ca429fc54058c2db30057ff13fde99f5172e
parent56f532b1c6263035e38fc9b4845a0b312f9b0f9a (diff)
parentf4bc89003916b013cf90ef84726aa68864b15a9d (diff)
downloadhdf5-43a90946ef4a66861c169d29dcae91836c38c5a5.zip
hdf5-43a90946ef4a66861c169d29dcae91836c38c5a5.tar.gz
hdf5-43a90946ef4a66861c169d29dcae91836c38c5a5.tar.bz2
Merge pull request #647 in HDFFV/hdf5 from ~BYRN/hdf5_adb:hdf5_1_10 to hdf5_1_10
* commit 'f4bc89003916b013cf90ef84726aa68864b15a9d': HDFFV-10284 Add VS2017 merged from develop Fix function call args HDFFV-10282 merge from develop
-rwxr-xr-xconfig/cmake/scripts/HDF5config.cmake102
-rw-r--r--release_docs/INSTALL_CMake.txt46
-rw-r--r--tools/lib/h5diff_dset.c12
-rw-r--r--tools/lib/h5diff_util.c7
-rw-r--r--tools/lib/h5tools.c33
-rw-r--r--tools/lib/h5tools_ref.c43
-rw-r--r--tools/lib/h5tools_type.c2
-rw-r--r--tools/lib/h5tools_utils.c8
-rw-r--r--tools/lib/h5trav.c32
-rw-r--r--tools/src/h5copy/h5copy.c96
-rw-r--r--tools/src/h5dump/h5dump.c182
-rw-r--r--tools/src/h5dump/h5dump_ddl.c210
-rw-r--r--tools/src/h5dump/h5dump_xml.c457
-rw-r--r--tools/src/h5jam/h5jam.c13
-rw-r--r--tools/src/h5jam/h5unjam.c54
-rw-r--r--tools/src/h5ls/h5ls.c33
-rw-r--r--tools/src/h5repack/h5repack.c1
-rw-r--r--tools/src/h5repack/h5repack_copy.c2
-rw-r--r--tools/src/h5repack/h5repack_filters.c368
-rw-r--r--tools/src/h5repack/h5repack_refs.c8
20 files changed, 827 insertions, 882 deletions
diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake
index 646917c..52f081f 100755
--- a/config/cmake/scripts/HDF5config.cmake
+++ b/config/cmake/scripts/HDF5config.cmake
@@ -11,7 +11,7 @@
#
#############################################################################################
### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ###
-### BUILD_GENERATOR required [Unix, VS2015, VS201564, VS2013, VS201364, VS2012, VS201264] ###
+### BUILD_GENERATOR required [Unix, VS2017, VS201764, VS2015, VS201564, VS2013, VS201364] ###
### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201264 -C Release -VV -O hdf5.log ###
#############################################################################################
@@ -22,12 +22,12 @@ cmake_minimum_required (VERSION 3.2.2 FATAL_ERROR)
# where valid options for OPTION are:
# BUILD_GENERATOR - The cmake build generator:
# Unix * Unix Makefiles
-# VS2015 * Visual Studio 14 2015
-# VS201564 * Visual Studio 14 2015 Win64
-# VS2013 * Visual Studio 12 2013
-# VS201364 * Visual Studio 12 2013 Win64
-# VS2012 * Visual Studio 11 2012
-# VS201264 * Visual Studio 11 2012 Win64
+# VS2017 * Visual Studio 15 2017
+# VS201764 * Visual Studio 15 2017 Win64
+# VS2015 * Visual Studio 14 2015
+# VS201564 * Visual Studio 14 2015 Win64
+# VS2013 * Visual Studio 12 2013
+# VS201364 * Visual Studio 12 2013 Win64
#
# INSTALLDIR - root folder where hdf5 is installed
# CTEST_CONFIGURATION_TYPE - Release, Debug, etc
@@ -65,25 +65,7 @@ endif ()
# build generator must be defined
if (NOT DEFINED BUILD_GENERATOR)
- message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264")
-else ()
- if (${BUILD_GENERATOR} STREQUAL "Unix")
- set (CTEST_CMAKE_GENERATOR "Unix Makefiles")
- elseif (${BUILD_GENERATOR} STREQUAL "VS2015")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 14 2015")
- elseif (${BUILD_GENERATOR} STREQUAL "VS201564")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 14 2015 Win64")
- elseif (${BUILD_GENERATOR} STREQUAL "VS2013")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 12 2013")
- elseif (${BUILD_GENERATOR} STREQUAL "VS201364")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 12 2013 Win64")
- elseif (${BUILD_GENERATOR} STREQUAL "VS2012")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 11 2012")
- elseif (${BUILD_GENERATOR} STREQUAL "VS201264")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 11 2012 Win64")
- else ()
- message (FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264")
- endif ()
+ message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364")
endif ()
###################################################################
@@ -135,31 +117,49 @@ endif ()
if (WIN32)
set (SITE_OS_NAME "Windows")
set (SITE_OS_VERSION "WIN7")
- if (${BUILD_GENERATOR} STREQUAL "VS201564")
- set (SITE_OS_BITS "64")
- set (SITE_COMPILER_NAME "vs2015")
- set (SITE_COMPILER_VERSION "14")
- elseif (${BUILD_GENERATOR} STREQUAL "VS2015")
- set (SITE_OS_BITS "32")
- set (SITE_COMPILER_NAME "vs2015")
- set (SITE_COMPILER_VERSION "14")
- elseif (${BUILD_GENERATOR} STREQUAL "VS201364")
- set (SITE_OS_BITS "64")
- set (SITE_COMPILER_NAME "vs2013")
- set (SITE_COMPILER_VERSION "12")
- elseif (${BUILD_GENERATOR} STREQUAL "VS2013")
- set (SITE_OS_BITS "32")
- set (SITE_COMPILER_NAME "vs2013")
- set (SITE_COMPILER_VERSION "12")
- elseif (${BUILD_GENERATOR} STREQUAL "VS201264")
- set (SITE_OS_BITS "64")
- set (SITE_COMPILER_NAME "vs2012")
- set (SITE_COMPILER_VERSION "11")
- elseif (${BUILD_GENERATOR} STREQUAL "VS2012")
- set (SITE_OS_BITS "32")
- set (SITE_COMPILER_NAME "vs2012")
- set (SITE_COMPILER_VERSION "11")
- endif ()
+ if (${BUILD_GENERATOR} STREQUAL "VS201764")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 15 2017 Win64")
+ set (SITE_OS_BITS "64")
+ set (SITE_COMPILER_NAME "vs2017")
+ set (SITE_COMPILER_VERSION "15")
+ elseif (${BUILD_GENERATOR} STREQUAL "VS2017")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 15 2017")
+ set (SITE_OS_BITS "32")
+ set (SITE_COMPILER_NAME "vs2017")
+ set (SITE_COMPILER_VERSION "15")
+ elseif (${BUILD_GENERATOR} STREQUAL "VS201564")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 14 2015 Win64")
+ set (SITE_OS_BITS "64")
+ set (SITE_COMPILER_NAME "vs2015")
+ set (SITE_COMPILER_VERSION "14")
+ elseif (${BUILD_GENERATOR} STREQUAL "VS2015")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 14 2015")
+ set (SITE_OS_BITS "32")
+ set (SITE_COMPILER_NAME "vs2015")
+ set (SITE_COMPILER_VERSION "14")
+ elseif (${BUILD_GENERATOR} STREQUAL "VS201364")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 12 2013 Win64")
+ set (SITE_OS_BITS "64")
+ set (SITE_COMPILER_NAME "vs2013")
+ set (SITE_COMPILER_VERSION "12")
+ elseif (${BUILD_GENERATOR} STREQUAL "VS2013")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 12 2013")
+ set (SITE_OS_BITS "32")
+ set (SITE_COMPILER_NAME "vs2013")
+ set (SITE_COMPILER_VERSION "12")
+ elseif (${BUILD_GENERATOR} STREQUAL "VS201264")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 11 2012 Win64")
+ set (SITE_OS_BITS "64")
+ set (SITE_COMPILER_NAME "vs2012")
+ set (SITE_COMPILER_VERSION "11")
+ elseif (${BUILD_GENERATOR} STREQUAL "VS2012")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 11 2012")
+ set (SITE_OS_BITS "32")
+ set (SITE_COMPILER_NAME "vs2012")
+ set (SITE_COMPILER_VERSION "11")
+ else ()
+ message (FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364")
+ endif ()
## Set the following to unique id your computer ##
set (CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX")
else ()
diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt
index 7cb0225..85f7962 100644
--- a/release_docs/INSTALL_CMake.txt
+++ b/release_docs/INSTALL_CMake.txt
@@ -658,7 +658,7 @@ adding an option (${CTEST_SCRIPT_ARG}) to the platform configuration script.
#############################################################################################
### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ###
-### BUILD_GENERATOR required [Unix, VS2015, VS201564, VS2013, VS201364, VS2012, VS201264] ###
+### BUILD_GENERATOR required [Unix, VS2017, VS201764, VS2015, VS201564, VS2013, VS201364] ###
### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201264 -C Release -VV -O hdf5.log ###
#############################################################################################
@@ -669,12 +669,12 @@ cmake_minimum_required (VERSION 3.2.2 FATAL_ERROR)
# where valid options for OPTION are:
# BUILD_GENERATOR - The cmake build generator:
# Unix * Unix Makefiles
+# VS2017 * Visual Studio 15 2017
+# VS201764 * Visual Studio 15 2017 Win64
# VS2015 * Visual Studio 14 2015
# VS201564 * Visual Studio 14 2015 Win64
# VS2013 * Visual Studio 12 2013
# VS201364 * Visual Studio 12 2013 Win64
-# VS2012 * Visual Studio 11 2012
-# VS201264 * Visual Studio 11 2012 Win64
#
# INSTALLDIR - root folder where hdf5 is installed
# CTEST_CONFIGURATION_TYPE - Release, Debug, etc
@@ -712,25 +712,7 @@ endif ()
# build generator must be defined
if (NOT DEFINED BUILD_GENERATOR)
- message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264")
-else ()
- if (${BUILD_GENERATOR} STREQUAL "Unix")
- set (CTEST_CMAKE_GENERATOR "Unix Makefiles")
- elseif (${BUILD_GENERATOR} STREQUAL "VS2015")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 14 2015")
- elseif (${BUILD_GENERATOR} STREQUAL "VS201564")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 14 2015 Win64")
- elseif (${BUILD_GENERATOR} STREQUAL "VS2013")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 12 2013")
- elseif (${BUILD_GENERATOR} STREQUAL "VS201364")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 12 2013 Win64")
- elseif (${BUILD_GENERATOR} STREQUAL "VS2012")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 11 2012")
- elseif (${BUILD_GENERATOR} STREQUAL "VS201264")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 11 2012 Win64")
- else ()
- message (FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264")
- endif ()
+ message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364")
endif ()
###################################################################
@@ -782,30 +764,48 @@ endif ()
if (WIN32)
set (SITE_OS_NAME "Windows")
set (SITE_OS_VERSION "WIN7")
- if (${BUILD_GENERATOR} STREQUAL "VS201564")
+ if (${BUILD_GENERATOR} STREQUAL "VS201764")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 15 2017 Win64")
+ set (SITE_OS_BITS "64")
+ set (SITE_COMPILER_NAME "vs2017")
+ set (SITE_COMPILER_VERSION "15")
+ elseif (${BUILD_GENERATOR} STREQUAL "VS2017")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 15 2017")
+ set (SITE_OS_BITS "32")
+ set (SITE_COMPILER_NAME "vs2017")
+ set (SITE_COMPILER_VERSION "15")
+ elseif (${BUILD_GENERATOR} STREQUAL "VS201564")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 14 2015 Win64")
set (SITE_OS_BITS "64")
set (SITE_COMPILER_NAME "vs2015")
set (SITE_COMPILER_VERSION "14")
elseif (${BUILD_GENERATOR} STREQUAL "VS2015")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 14 2015")
set (SITE_OS_BITS "32")
set (SITE_COMPILER_NAME "vs2015")
set (SITE_COMPILER_VERSION "14")
elseif (${BUILD_GENERATOR} STREQUAL "VS201364")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 12 2013 Win64")
set (SITE_OS_BITS "64")
set (SITE_COMPILER_NAME "vs2013")
set (SITE_COMPILER_VERSION "12")
elseif (${BUILD_GENERATOR} STREQUAL "VS2013")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 12 2013")
set (SITE_OS_BITS "32")
set (SITE_COMPILER_NAME "vs2013")
set (SITE_COMPILER_VERSION "12")
elseif (${BUILD_GENERATOR} STREQUAL "VS201264")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 11 2012 Win64")
set (SITE_OS_BITS "64")
set (SITE_COMPILER_NAME "vs2012")
set (SITE_COMPILER_VERSION "11")
elseif (${BUILD_GENERATOR} STREQUAL "VS2012")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 11 2012")
set (SITE_OS_BITS "32")
set (SITE_COMPILER_NAME "vs2012")
set (SITE_COMPILER_VERSION "11")
+ else ()
+ message (FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364")
endif ()
## Set the following to unique id your computer ##
set (CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX")
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index 991ef48..ea79c6c 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -358,7 +358,6 @@ hsize_t diff_datasetid( hid_t did1,
nelmts2 *= dims2[i];
h5diffdebug3("nelmts: %ld - %ld\n", nelmts1, nelmts2);
- HDassert(nelmts1 == nelmts2);
if(tclass != H5T_ARRAY) {
/*-----------------------------------------------------------------
@@ -459,7 +458,6 @@ hsize_t diff_datasetid( hid_t did1,
size = 1;
sm_size[i - 1] = MIN(dadims[i - 1], size);
sm_nbytes *= sm_size[i - 1];
- HDassert(sm_nbytes > 0);
} /* end for */
/* malloc return code should be verified.
@@ -469,10 +467,10 @@ hsize_t diff_datasetid( hid_t did1,
* that fails to address freeing other objects created here.
* E.g., sm_space.
*/
- sm_buf1 = HDmalloc((size_t)sm_nbytes);
- HDassert(sm_buf1);
- sm_buf2 = HDmalloc((size_t)sm_nbytes);
- HDassert(sm_buf2);
+ if((sm_buf1 = HDmalloc((size_t)sm_nbytes)) == NULL)
+ goto error;
+ if((sm_buf2 = HDmalloc((size_t)sm_nbytes)) == NULL)
+ goto error;
sm_nelmts = sm_nbytes / p_type_nbytes;
sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
@@ -682,7 +680,6 @@ int diff_can_type( hid_t f_tid1, /* file data type */
* check for non supported classes
*-------------------------------------------------------------------------
*/
- HDassert(tclass1 == tclass2);
switch (tclass1) {
case H5T_TIME:
if((options->m_verbose || options->m_list_not_cmp) && obj1_name && obj2_name) {
@@ -754,7 +751,6 @@ int diff_can_type( hid_t f_tid1, /* file data type */
* check for different dimensions
*-------------------------------------------------------------------------
*/
- HDassert(rank1 == rank2);
for(i = 0; i<rank1; i++) {
if(maxdim1 && maxdim2) {
if(maxdim1[i] != maxdim2[i])
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index 454f993..ad23ccf 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -283,7 +283,6 @@ get_sign(H5T_sign_t sign)
return "H5T_NSGN";
default:
- HDassert(0);
return "unknown sign value";
} /* end switch */
}
@@ -340,7 +339,6 @@ get_class(H5T_class_t tclass)
case H5T_NO_CLASS:
case H5T_NCLASSES:
default:
- HDassert(0);
return("Invalid class");
} /* end switch */
} /* end get_class() */
@@ -395,7 +393,10 @@ herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
*m_size2 = H5Tget_size(*m_tid2);
} /* end else */
} /* end if */
- HDassert((*m_size1) == (*m_size2));
+ if((*m_size1) != (*m_size2)) {
+ ret = FAIL;
+ goto out;
+ }
out:
return ret;
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 5031e44..344913a 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -1283,13 +1283,13 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
int i;
unsigned j;
- HDassert(ctx->ndims);
-
- ctx->acc[ctx->ndims - 1] = 1;
- for (i = ((int)ctx->ndims - 2); i >= 0; i--)
- ctx->acc[i] = ctx->acc[i + 1] * dims[i + 1];
- for (j = 0; j < ctx->ndims; j++)
- ctx->pos[j] = 0;
+ if(ctx->ndims > 0) {
+ ctx->acc[ctx->ndims - 1] = 1;
+ for (i = ((int)ctx->ndims - 2); i >= 0; i--)
+ ctx->acc[i] = ctx->acc[i + 1] * dims[i + 1];
+ for (j = 0; j < ctx->ndims; j++)
+ ctx->pos[j] = 0;
+ }
}
/*-------------------------------------------------------------------------
@@ -1410,13 +1410,17 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
memb = H5Tget_super(tid);
ndims = H5Tget_array_ndims(tid);
H5Tget_array_dims2(tid, dims);
- HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK);
-
- /* calculate the number of array elements */
- for (k = 0, nelmts = 1; k < ndims; k++) {
- temp_nelmts = nelmts;
- temp_nelmts *= dims[k];
- nelmts = (size_t) temp_nelmts;
+ if(ndims >= 1 && ndims <= H5S_MAX_RANK) {
+ /* calculate the number of array elements */
+ for (k = 0, nelmts = 1; k < ndims; k++) {
+ temp_nelmts = nelmts;
+ temp_nelmts *= dims[k];
+ nelmts = (size_t) temp_nelmts;
+ }
+ }
+ else {
+ H5Tclose(memb);
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "calculate the number of array elements failed");
}
for (block_index = 0; block_index < block_nelmts; block_index++) {
@@ -1641,7 +1645,6 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
ndims = (unsigned)sndims;
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
- HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL)
HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index 16a949d..6153f0c 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -107,19 +107,21 @@ static int
init_ref_path_table(void)
{
/* Sanity check */
- HDassert(thefile > 0);
-
- /* Create skip list to store reference path information */
- if((ref_path_table = H5SL_create(H5SL_TYPE_HADDR, NULL))==NULL)
+ if(thefile > 0) {
+ /* Create skip list to store reference path information */
+ if((ref_path_table = H5SL_create(H5SL_TYPE_HADDR, NULL))==NULL)
+ return (-1);
+
+ /* Iterate over objects in this file */
+ if(h5trav_visit(thefile, "/", TRUE, TRUE, init_ref_path_cb, NULL, NULL) < 0) {
+ error_msg("unable to construct reference path table\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ } /* end if */
+
+ return(0);
+ }
+ else
return (-1);
-
- /* Iterate over objects in this file */
- if(h5trav_visit(thefile, "/", TRUE, TRUE, init_ref_path_cb, NULL, NULL) < 0) {
- error_msg("unable to construct reference path table\n");
- h5tools_setstatus(EXIT_FAILURE);
- } /* end if */
-
- return(0);
}
/*-------------------------------------------------------------------------
@@ -212,16 +214,17 @@ ref_path_table_put(const char *path, haddr_t objno)
{
ref_path_node_t *new_node;
- HDassert(ref_path_table);
- HDassert(path);
-
- if((new_node = (ref_path_node_t *)HDmalloc(sizeof(ref_path_node_t))) == NULL)
- return(-1);
+ if(ref_path_table && path) {
+ if((new_node = (ref_path_node_t *)HDmalloc(sizeof(ref_path_node_t))) == NULL)
+ return(-1);
- new_node->objno = objno;
- new_node->path = HDstrdup(path);
+ new_node->objno = objno;
+ new_node->path = HDstrdup(path);
- return(H5SL_insert(ref_path_table, new_node, &(new_node->objno)));
+ return(H5SL_insert(ref_path_table, new_node, &(new_node->objno)));
+ }
+ else
+ return (-1);
}
/*
diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c
index ae7160b..ee58ccb 100644
--- a/tools/lib/h5tools_type.c
+++ b/tools/lib/h5tools_type.c
@@ -92,7 +92,6 @@ h5tools_get_little_endian_type(hid_t tid)
case H5T_NO_CLASS:
case H5T_NCLASSES:
default:
- HDassert(0);
break;
} /* end switch */
@@ -179,7 +178,6 @@ h5tools_get_big_endian_type(hid_t tid)
case H5T_NO_CLASS:
case H5T_NCLASSES:
default:
- HDassert(0);
break;
} /* end switch */
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 08213df..8c435b2 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -608,7 +608,6 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
- HDassert(0);
break;
} /* end switch */
@@ -777,8 +776,11 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_
} /* end if */
/* trg_path must be freed out of this function when finished using */
- link_info->trg_path = (char*)HDcalloc(link_info->linfo.u.val_size, sizeof(char));
- HDassert(link_info->trg_path);
+ if((link_info->trg_path = (char*)HDcalloc(link_info->linfo.u.val_size, sizeof(char))) == NULL) {
+ if(link_info->opt.msg_mode == 1)
+ parallel_print("Warning: unable to allocate buffer for <%s>\n",linkpath);
+ goto out;
+ } /* end if */
/* get link value */
if(H5Lget_val(file_id, linkpath, (void *)link_info->trg_path, link_info->linfo.u.val_size, H5P_DEFAULT) < 0) {
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 3d55f2d..ddc0109 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -557,7 +557,7 @@ trav_info_free(trav_info_t *info)
if(info) {
/* Free visited symbolic links path and file (if alloc) */
- for(u=0; u < info->symlink_visited.nused; u++)
+ for(u=0; u < info->symlink_visited.nused; u++)
{
if (info->symlink_visited.objs[u].file)
HDfree(info->symlink_visited.objs[u].file);
@@ -789,8 +789,6 @@ trav_table_addlink(trav_table_t *table, haddr_t objno, const char *path)
return;
} /* end for */
} /* end for */
-
- HDassert(0 && "object not in table?!?");
}
@@ -1017,7 +1015,7 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo,
/* Finish printing line about object */
printf("\n");
if(trav_verbosity > 0)
- H5Aiterate_by_name(print_udata->fid, path, trav_index_by, trav_index_order,
+ H5Aiterate_by_name(print_udata->fid, path, trav_index_by, trav_index_order,
NULL, trav_attr, &op_data, H5P_DEFAULT);
}
else
@@ -1051,12 +1049,12 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
case H5L_TYPE_SOFT:
if(linfo->u.val_size > 0) {
char *targbuf = (char*)HDmalloc(linfo->u.val_size + 1);
- HDassert(targbuf);
-
- if(H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT) < 0)
- targbuf[0] = 0;
- printf(" %-10s %s -> %s\n", "link", path, targbuf);
- HDfree(targbuf);
+ if(targbuf) {
+ if(H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT) < 0)
+ targbuf[0] = 0;
+ printf(" %-10s %s -> %s\n", "link", path, targbuf);
+ HDfree(targbuf);
+ }
} /* end if */
else
printf(" %-10s %s ->\n", "link", path);
@@ -1069,13 +1067,13 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
const char *objname = NULL;
targbuf = (char*)HDmalloc(linfo->u.val_size + 1);
- HDassert(targbuf);
-
- if(H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT) < 0)
- targbuf[0] = 0;
- if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &objname) >= 0)
- printf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname);
- HDfree(targbuf);
+ if(targbuf) {
+ if(H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT) < 0)
+ targbuf[0] = 0;
+ if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &objname) >= 0)
+ printf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname);
+ HDfree(targbuf);
+ }
} /* end if */
else
printf(" %-10s %s ->\n", "ext link", path);
diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c
index 3f91fce..be84b26 100644
--- a/tools/src/h5copy/h5copy.c
+++ b/tools/src/h5copy/h5copy.c
@@ -159,36 +159,28 @@ static int parse_flag(const char* s_flag, unsigned *flag)
{
unsigned fla=0;
- if (HDstrcmp(s_flag,"shallow")==0)
- {
+ if (HDstrcmp(s_flag, "shallow") == 0) {
fla = H5O_COPY_SHALLOW_HIERARCHY_FLAG;
}
- else if (HDstrcmp(s_flag,"soft")==0)
- {
+ else if (HDstrcmp(s_flag, "soft") == 0) {
fla = H5O_COPY_EXPAND_SOFT_LINK_FLAG;
}
- else if (HDstrcmp(s_flag,"ext")==0)
- {
+ else if (HDstrcmp(s_flag, "ext") == 0) {
fla = H5O_COPY_EXPAND_EXT_LINK_FLAG;
}
- else if (HDstrcmp(s_flag,"ref")==0)
- {
+ else if (HDstrcmp(s_flag, "ref") == 0) {
fla = H5O_COPY_EXPAND_REFERENCE_FLAG;
}
- else if (HDstrcmp(s_flag,"noattr")==0)
- {
+ else if (HDstrcmp(s_flag, "noattr") == 0) {
fla = H5O_COPY_WITHOUT_ATTR_FLAG;
}
- else if (HDstrcmp(s_flag,"allflags")==0)
- {
+ else if (HDstrcmp(s_flag, "allflags") == 0) {
fla = H5O_COPY_ALL;
}
- else if (HDstrcmp(s_flag,"nullmsg")==0)
- {
+ else if (HDstrcmp(s_flag, "nullmsg") == 0) {
fla = H5O_COPY_PRESERVE_NULL_FLAG;
}
- else
- {
+ else {
error_msg("Error in input flag\n");
return -1;
}
@@ -247,25 +239,21 @@ main (int argc, const char *argv[])
HDmemset(&linkinfo, 0, sizeof(h5tool_link_info_t));
/* Check for no command line parameters */
- if(argc == 1)
- {
+ if(argc == 1) {
usage();
leave(EXIT_FAILURE);
} /* end if */
/* parse command line options */
- while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF)
- {
- switch ((char)opt)
- {
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
case 'd':
oname_dst = HDstrdup(opt_arg);
break;
case 'f':
/* validate flag */
- if (parse_flag(opt_arg,&flag)<0)
- {
+ if (parse_flag(opt_arg, &flag) < 0) {
usage();
leave(EXIT_FAILURE);
}
@@ -316,29 +304,25 @@ main (int argc, const char *argv[])
* check for missing file/object names
*-------------------------------------------------------------------------*/
- if (fname_src==NULL)
- {
+ if (fname_src==NULL) {
error_msg("Input file name missing\n");
usage();
leave(EXIT_FAILURE);
}
- if (fname_dst==NULL)
- {
+ if (fname_dst==NULL) {
error_msg("Output file name missing\n");
usage();
leave(EXIT_FAILURE);
}
- if (oname_src==NULL)
- {
+ if (oname_src==NULL) {
error_msg("Source object name missing\n");
usage();
leave(EXIT_FAILURE);
}
- if (oname_dst==NULL)
- {
+ if (oname_dst==NULL) {
error_msg("Destination object name missing\n");
usage();
leave(EXIT_FAILURE);
@@ -367,8 +351,7 @@ main (int argc, const char *argv[])
/*-------------------------------------------------------------------------
* test for error in opening input file
*-------------------------------------------------------------------------*/
- if (fid_src==-1)
- {
+ if (fid_src==-1) {
error_msg("Could not open input file <%s>...Exiting\n", fname_src);
leave(EXIT_FAILURE);
}
@@ -386,8 +369,7 @@ main (int argc, const char *argv[])
/*-------------------------------------------------------------------------
* test for error in opening output file
*-------------------------------------------------------------------------*/
- if (fid_dst==-1)
- {
+ if (fid_dst==-1) {
error_msg("Could not open output file <%s>...Exiting\n", fname_dst);
leave(EXIT_FAILURE);
}
@@ -396,12 +378,10 @@ main (int argc, const char *argv[])
* print some info
*-------------------------------------------------------------------------*/
- if (verbose)
- {
+ if (verbose) {
printf("Copying file <%s> and object <%s> to file <%s> and object <%s>\n",
fname_src, oname_src, fname_dst, oname_dst);
if (flag) {
- HDassert(str_flag);
printf("Using %s flag\n", str_flag);
}
}
@@ -416,8 +396,7 @@ main (int argc, const char *argv[])
HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pcreate failed");
/* set options for object copy */
- if (flag)
- {
+ if (flag) {
if ( H5Pset_copy_object(ocpl_id, flag) < 0)
HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pset_copy_object failed");
}
@@ -440,24 +419,21 @@ main (int argc, const char *argv[])
if(verbose)
printf("%s: Creating parent groups\n", h5tools_getprogname());
} /* end if */
- else /* error, if parent groups doesn't already exist in destination file */
- {
+ else {
+ /* error, if parent groups doesn't already exist in destination file */
size_t i, len;
len = HDstrlen(oname_dst);
/* check if all the parents groups exist. skip root group */
- for (i = 1; i < len; i++)
- {
- if ('/'==oname_dst[i])
- {
+ for (i = 1; i < len; i++) {
+ if ('/'==oname_dst[i]) {
char *str_ptr;
str_ptr = (char *)HDcalloc(i + 1, sizeof(char));
HDstrncpy(str_ptr, oname_dst, i);
str_ptr[i]='\0';
- if (H5Lexists(fid_dst, str_ptr, H5P_DEFAULT) <= 0)
- {
+ if (H5Lexists(fid_dst, str_ptr, H5P_DEFAULT) <= 0) {
error_msg("group <%s> doesn't exist. Use -p to create parent groups.\n", str_ptr);
HDfree(str_ptr);
HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Lexists failed");
@@ -475,15 +451,15 @@ main (int argc, const char *argv[])
linkinfo.opt.msg_mode = 1;
li_ret = H5tools_get_symlink_info(fid_src, oname_src, &linkinfo, 1);
- if (li_ret == 0) /* dangling link */
- {
+ if (li_ret == 0) {
+ /* dangling link */
if(H5Lcopy(fid_src, oname_src,
fid_dst, oname_dst,
H5P_DEFAULT, H5P_DEFAULT) < 0)
HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Lcopy failed");
}
- else /* valid link */
- {
+ else {
+ /* valid link */
if (H5Ocopy(fid_src, /* Source file or group identifier */
oname_src, /* Name of the source object to be copied */
fid_dst, /* Destination file or group identifier */
@@ -518,13 +494,13 @@ done:
if (linkinfo.trg_path)
HDfree(linkinfo.trg_path);
- H5E_BEGIN_TRY {
- H5Pclose(ocpl_id);
- H5Pclose(lcpl_id);
- H5Fclose(fid_src);
- H5Fclose(fid_dst);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY {
+ H5Pclose(ocpl_id);
+ H5Pclose(lcpl_id);
+ H5Fclose(fid_src);
+ H5Fclose(fid_dst);
+ } H5E_END_TRY;
- leave(ret_value);
+ leave(ret_value);
}
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index bf2e127..b90d60f 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -721,93 +721,100 @@ parse_mask_list(const char *h_list)
const char *ptr = NULL;
/* sanity check */
- HDassert(h_list);
+ if(h_list) {
+ HDmemset(packed_mask,0,sizeof(packed_mask));
+
+ packed_bits_num = 0;
+ /* scan in pair of offset,length separated by commas. */
+ ptr = h_list;
+ while (*ptr) {
+ /* scan for an offset which is an unsigned int */
+ if (!HDisdigit(*ptr)) {
+ error_msg("Bad mask list(%s)\n", h_list);
+ return FAIL;
+ }
+ soffset_value = HDatoi(ptr);
+ offset_value = (unsigned)soffset_value;
+ if (soffset_value < 0 || offset_value >= PACKED_BITS_SIZE_MAX) {
+ error_msg("Packed Bit offset value(%d) must be between 0 and %u\n",
+ soffset_value, (unsigned)(PACKED_BITS_SIZE_MAX - 1));
+ return FAIL;
+ }
- HDmemset(packed_mask,0,sizeof(packed_mask));
+ /* skip to end of integer */
+ while (HDisdigit(*++ptr))
+ ;
+ /* Look for the common separator */
+ if (*ptr++ != ',') {
+ error_msg("Bad mask list(%s), missing expected comma separator.\n", h_list);
+ return FAIL;
+ }
- packed_bits_num = 0;
- /* scan in pair of offset,length separated by commas. */
- ptr = h_list;
- while (*ptr) {
- /* scan for an offset which is an unsigned int */
- if (!HDisdigit(*ptr)) {
- error_msg("Bad mask list(%s)\n", h_list);
- return FAIL;
- }
- soffset_value = HDatoi(ptr);
- offset_value = (unsigned)soffset_value;
- if (soffset_value < 0 || offset_value >= PACKED_BITS_SIZE_MAX) {
- error_msg("Packed Bit offset value(%d) must be between 0 and %u\n",
- soffset_value, (unsigned)(PACKED_BITS_SIZE_MAX - 1));
- return FAIL;
- }
+ /* scan for a length which is a positive int */
+ if (!HDisdigit(*ptr)) {
+ error_msg("Bad mask list(%s)\n", h_list);
+ return FAIL;
+ }
+ slength_value = HDatoi(ptr);
+ if (slength_value <= 0) {
+ error_msg("Packed Bit length value(%d) must be positive.\n", slength_value);
+ return FAIL;
+ }
+ length_value = (unsigned)slength_value;
+ if ((offset_value + length_value) > PACKED_BITS_SIZE_MAX) {
+ error_msg("Packed Bit offset+length value(%u) too large. Max is %u\n",
+ offset_value+length_value, (unsigned)PACKED_BITS_SIZE_MAX);
+ return FAIL;
+ }
- /* skip to end of integer */
- while (HDisdigit(*++ptr))
- ;
- /* Look for the common separator */
- if (*ptr++ != ',') {
- error_msg("Bad mask list(%s), missing expected comma separator.\n", h_list);
- return FAIL;
- }
+ /* skip to end of int */
+ while (HDisdigit(*++ptr))
+ ;
- /* scan for a length which is a positive int */
- if (!HDisdigit(*ptr)) {
- error_msg("Bad mask list(%s)\n", h_list);
- return FAIL;
- }
- slength_value = HDatoi(ptr);
- if (slength_value <= 0) {
- error_msg("Packed Bit length value(%d) must be positive.\n", slength_value);
- return FAIL;
+ /* store the offset,length pair */
+ if (packed_bits_num >= PACKED_BITS_MAX) {
+ /* too many requests */
+ error_msg("Too many masks requested (max. %d). Mask list(%s)\n", PACKED_BITS_MAX, h_list);
+ return FAIL;
+ }
+ packed_offset[packed_bits_num] = offset_value;
+ packed_length[packed_bits_num] = length_value;
+ /* create the bit mask by left shift 1's by length, then negate it. */
+ /* After packed_mask is calculated, packed_length is not needed but */
+ /* keep it for debug purpose. */
+ temp_mask = ~0ULL;
+ if(length_value < (int)(8 *sizeof(unsigned long long))) {
+ temp_mask = temp_mask << length_value;
+ packed_mask[packed_bits_num] = ~temp_mask;
+ }
+ else
+ packed_mask[packed_bits_num] = temp_mask;
+ packed_bits_num++;
+
+ /* skip a possible comma separator */
+ if (*ptr == ',') {
+ if (!(*++ptr)) {
+ /* unexpected end of string */
+ error_msg("Bad mask list(%s), unexpected end of string.\n", h_list);
+ return FAIL;
+ }
+ }
}
- length_value = (unsigned)slength_value;
- if ((offset_value + length_value) > PACKED_BITS_SIZE_MAX) {
- error_msg("Packed Bit offset+length value(%u) too large. Max is %u\n",
- offset_value+length_value, (unsigned)PACKED_BITS_SIZE_MAX);
+ if(packed_bits_num > PACKED_BITS_MAX) {
+ error_msg("Maximum number of packed bits exceeded\n");
return FAIL;
}
-
- /* skip to end of int */
- while (HDisdigit(*++ptr))
- ;
-
- /* store the offset,length pair */
- if (packed_bits_num >= PACKED_BITS_MAX) {
- /* too many requests */
- error_msg("Too many masks requested (max. %d). Mask list(%s)\n", PACKED_BITS_MAX, h_list);
+ if (packed_bits_num == 0) {
+ /* got no masks! */
+ error_msg("Bad mask list(%s)\n", h_list);
return FAIL;
}
- packed_offset[packed_bits_num] = offset_value;
- packed_length[packed_bits_num] = length_value;
- /* create the bit mask by left shift 1's by length, then negate it. */
- /* After packed_mask is calculated, packed_length is not needed but */
- /* keep it for debug purpose. */
- temp_mask = ~0ULL;
- if(length_value < (int)(8 *sizeof(unsigned long long))) {
- temp_mask = temp_mask << length_value;
- packed_mask[packed_bits_num] = ~temp_mask;
- }
- else
- packed_mask[packed_bits_num] = temp_mask;
- packed_bits_num++;
-
- /* skip a possible comma separator */
- if (*ptr == ',') {
- if (!(*++ptr)) {
- /* unexpected end of string */
- error_msg("Bad mask list(%s), unexpected end of string.\n", h_list);
- return FAIL;
- }
- }
+ return SUCCEED;
}
- HDassert(packed_bits_num <= PACKED_BITS_MAX);
- if (packed_bits_num == 0) {
- /* got no masks! */
- error_msg("Bad mask list(%s)\n", h_list);
+ else {
+ error_msg("Bad mask list argument\n");
return FAIL;
}
- return SUCCEED;
}
@@ -1708,13 +1715,18 @@ h5_fileaccess(void)
HDmemset(memb_name, 0, sizeof memb_name);
HDmemset(memb_addr, 0, sizeof memb_addr);
- HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
- for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
- memb_fapl[mt] = H5P_DEFAULT;
- memb_map[mt] = mt;
- sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
- memb_name[mt] = sv[mt];
- memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10);
+ if(HDstrlen(multi_letters)==H5FD_MEM_NTYPES) {
+ for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
+ memb_fapl[mt] = H5P_DEFAULT;
+ memb_map[mt] = mt;
+ sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
+ memb_name[mt] = sv[mt];
+ memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10);
+ }
+ }
+ else {
+ error_msg("Bad multi_letters list\n");
+ return FAIL;
}
if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0)
@@ -1767,8 +1779,10 @@ h5_fileaccess(void)
static void
init_prefix(char **prfx, size_t prfx_len)
{
- HDassert(prfx_len > 0);
- *prfx = (char *)HDcalloc(prfx_len, 1);
+ if(prfx_len > 0)
+ *prfx = (char *)HDcalloc(prfx_len, 1);
+ else
+ error_msg("unable to allocate prefix buffer\n");
}
diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c
index 0a45840..eecd113 100644
--- a/tools/src/h5dump/h5dump_ddl.c
+++ b/tools/src/h5dump/h5dump_ddl.c
@@ -248,17 +248,19 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
/* Keep copy of prefix before iterating into group */
old_prefix = HDstrdup(prefix);
- HDassert(old_prefix);
+ if (old_prefix) {
+ /* Append group name to prefix */
+ add_prefix(&prefix, &prefix_len, name);
- /* Append group name to prefix */
- add_prefix(&prefix, &prefix_len, name);
+ /* Iterate into group */
+ dump_function_table->dump_group_function(obj, name);
- /* Iterate into group */
- dump_function_table->dump_group_function(obj, name);
-
- /* Restore old prefix name */
- HDstrcpy(prefix, old_prefix);
- HDfree(old_prefix);
+ /* Restore old prefix name */
+ HDstrcpy(prefix, old_prefix);
+ HDfree(old_prefix);
+ }
+ else
+ error_msg("warning: null prefix\n");
/* Close group */
H5Gclose(obj);
@@ -408,131 +410,137 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
switch(linfo->type) {
case H5L_TYPE_SOFT:
- targbuf = (char *)HDmalloc(linfo->u.val_size);
- HDassert(targbuf);
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->softlinkbegin, name,
- h5tools_dump_header_format->softlinkblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.indent_level++;
-
- if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- error_msg("unable to get link value\n");
+ if((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
+ error_msg("unable to allocate buffer\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else {
- /* print the value of a soft link */
- /* Standard DDL: no modification */
ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "LINKTARGET \"%s\"", targbuf);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->softlinkbegin, name,
+ h5tools_dump_header_format->softlinkblockbegin);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- ctx.indent_level--;
+ ctx.indent_level++;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ error_msg("unable to get link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ /* print the value of a soft link */
+ /* Standard DDL: no modification */
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->softlinkblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkblockend);
- if(HDstrlen(h5tools_dump_header_format->softlinkend))
- h5tools_str_append(&buffer, " ");
- }
- if(HDstrlen(h5tools_dump_header_format->softlinkend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "LINKTARGET \"%s\"", targbuf);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
- HDfree(targbuf);
- break;
+ ctx.indent_level--;
- case H5L_TYPE_EXTERNAL:
- targbuf = (char *)HDmalloc(linfo->u.val_size);
- HDassert(targbuf);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if(HDstrlen(h5tools_dump_header_format->softlinkblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkblockend);
+ if(HDstrlen(h5tools_dump_header_format->softlinkend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if(HDstrlen(h5tools_dump_header_format->softlinkend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->extlinkbegin, name,
- h5tools_dump_header_format->extlinkblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ HDfree(targbuf);
+ }
+ break;
- if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- indentation(dump_indent);
- error_msg("unable to get external link value\n");
+ case H5L_TYPE_EXTERNAL:
+ if((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
+ error_msg("unable to allocate buffer\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- } /* end if */
+ }
else {
- const char *filename;
- const char *targname;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->extlinkbegin, name,
+ h5tools_dump_header_format->extlinkblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
indentation(dump_indent);
- error_msg("unable to unpack external link value\n");
+ error_msg("unable to get external link value\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
} /* end if */
else {
- ctx.indent_level++;
+ const char *filename;
+ const char *targname;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
+ indentation(dump_indent);
+ error_msg("unable to unpack external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ ctx.indent_level++;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "TARGETFILE \"%s\"", filename);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "TARGETFILE \"%s\"", filename);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "TARGETPATH \"%s\"", targname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* dump the external link */
- dump_extlink(group, name, targname);
- ctx.indent_level--;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "TARGETPATH \"%s\"", targname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* dump the external link */
+ dump_extlink(group, name, targname);
+ ctx.indent_level--;
+ } /* end else */
} /* end else */
- } /* end else */
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->extlinkblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkblockend);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if(HDstrlen(h5tools_dump_header_format->extlinkblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkblockend);
+ if(HDstrlen(h5tools_dump_header_format->extlinkend))
+ h5tools_str_append(&buffer, " ");
+ }
if(HDstrlen(h5tools_dump_header_format->extlinkend))
- h5tools_str_append(&buffer, " ");
- }
- if(HDstrlen(h5tools_dump_header_format->extlinkend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- HDfree(targbuf);
+ HDfree(targbuf);
+ }
break;
case H5L_TYPE_ERROR:
case H5L_TYPE_MAX:
- HDassert(0);
- /* fall through */
case H5L_TYPE_HARD:
default:
ctx.need_prefix = TRUE;
@@ -1082,7 +1090,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
case H5T_NO_CLASS:
case H5T_NCLASSES:
default:
- HDassert(0);
+ error_msg("invalid H5TCLASS type\n");
break;
} /* end switch */
} /* for(u=0; u<data_loop; u++) */
@@ -1183,10 +1191,10 @@ dump_fcpl(hid_t fid)
size_t off_size; /* size of offsets in the file */
size_t len_size; /* size of lengths in the file */
H5F_fspace_strategy_t fs_strategy; /* file space strategy */
- hbool_t fs_persist; /* Persisting free-space or not */
- hsize_t fs_threshold; /* free-space section threshold */
- hsize_t fsp_size; /* file space page size */
- H5F_info2_t finfo; /* file information */
+ hbool_t fs_persist; /* Persisting free-space or not */
+ hsize_t fs_threshold; /* free-space section threshold */
+ hsize_t fsp_size; /* file space page size */
+ H5F_info2_t finfo; /* file information */
#ifdef SHOW_FILE_DRIVER
hid_t fapl; /* file access property list ID */
hid_t fdriver; /* file driver */
@@ -1980,8 +1988,6 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT
case H5L_TYPE_ERROR:
case H5L_TYPE_MAX:
- HDassert(0);
- /* fall through */
case H5L_TYPE_HARD:
default:
begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin);
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index d731013..a83ec08 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -198,18 +198,22 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
char *old_prefix; /* Pointer to previous prefix */
/* Keep copy of prefix before iterating into group */
- old_prefix = HDstrdup(prefix);
- HDassert(old_prefix);
-
- /* Append group name to prefix */
- add_prefix(&prefix, &prefix_len, name);
+ if((old_prefix = HDstrdup(prefix)) == NULL) {
+ error_msg("unable to allocate buffer\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ /* Append group name to prefix */
+ add_prefix(&prefix, &prefix_len, name);
- /* Iterate into group */
- dump_function_table->dump_group_function(obj, name);
+ /* Iterate into group */
+ dump_function_table->dump_group_function(obj, name);
- /* Restore old prefix name */
- HDstrcpy(prefix, old_prefix);
- HDfree(old_prefix);
+ /* Restore old prefix name */
+ HDstrcpy(prefix, old_prefix);
+ HDfree(old_prefix);
+ }
/* Close group */
H5Gclose(obj);
@@ -360,161 +364,167 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
switch(linfo->type) {
case H5L_TYPE_SOFT:
- targbuf = (char *)HDmalloc(linfo->u.val_size);
- HDassert(targbuf);
-
- if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- error_msg("unable to get link value\n");
+ if((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
+ error_msg("unable to allocate buffer\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else {
- /* print the value of a soft link */
- /* XML */
- char linkxid[100];
- char parentxid[100];
- char targetxid[100];
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
- char *t_name = xml_escape_the_name(name);
- char *t_targbuf = xml_escape_the_name(targbuf);
- char *t_obj_path = xml_escape_the_name(obj_path);
- char *t_link_path;
- int res;
-
- t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1);
- if(targbuf[0] == '/')
- HDstrcpy(t_link_path, targbuf);
+ if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ error_msg("unable to get link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
else {
- HDstrcpy(t_link_path, prefix);
- HDstrcat(HDstrcat(t_link_path, "/"), targbuf);
- } /* end else */
+ /* print the value of a soft link */
+ /* XML */
+ char linkxid[100];
+ char parentxid[100];
+ char targetxid[100];
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ char *t_name = xml_escape_the_name(name);
+ char *t_targbuf = xml_escape_the_name(targbuf);
+ char *t_obj_path = xml_escape_the_name(obj_path);
+ char *t_link_path;
+ int res;
- /* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+ t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1);
+ if(targbuf[0] == '/')
+ HDstrcpy(t_link_path, targbuf);
+ else {
+ HDstrcpy(t_link_path, prefix);
+ HDstrcat(HDstrcat(t_link_path, "/"), targbuf);
+ } /* end else */
- /* Try to create an OBJ-XID for the object pointed to */
- res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0);
- if (res == 0) {
- /* target obj found */
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "TargetPath=\"%s\" TargetObj=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- t_targbuf, /* TargetPath */
- targetxid, /* TargetObj */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- else {
- /* dangling link -- omit from xml attributes */
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Try to create an OBJ-XID for the object pointed to */
+ res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0);
+ if (res == 0) {
+ /* target obj found */
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "TargetPath=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- t_targbuf, /* TargetPath */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetPath=\"%s\" TargetObj=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix,
+ t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ t_targbuf, /* TargetPath */
+ targetxid, /* TargetObj */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ /* dangling link -- omit from xml attributes */
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetPath=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix,
+ t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ t_targbuf, /* TargetPath */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+
+ HDfree(t_prefix);
+ HDfree(t_name);
+ HDfree(t_targbuf);
+ HDfree(t_obj_path);
+ HDfree(t_link_path);
}
- HDfree(t_prefix);
- HDfree(t_name);
- HDfree(t_targbuf);
- HDfree(t_obj_path);
- HDfree(t_link_path);
+ HDfree(targbuf);
}
-
- HDfree(targbuf);
break;
case H5L_TYPE_EXTERNAL:
- targbuf = (char *)HDmalloc(linfo->u.val_size);
- HDassert(targbuf);
-
- if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- error_msg("unable to get external link value\n");
+ if((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
+ error_msg("unable to allocate buffer\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- } /* end if */
+ }
else {
- const char *filename;
- const char *targname;
-
- if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
- error_msg("unable to unpack external link value\n");
+ if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ error_msg("unable to get external link value\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
} /* end if */
else {
- char linkxid[100];
- char parentxid[100];
- char *t_name = xml_escape_the_name(name);
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
- char *t_obj_path = xml_escape_the_name(obj_path);
- char *t_filename = xml_escape_the_name(filename);
- char *t_targname = xml_escape_the_name(targname);
+ const char *filename;
+ const char *targname;
- /* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+ if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
+ error_msg("unable to unpack external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ char linkxid[100];
+ char parentxid[100];
+ char *t_name = xml_escape_the_name(name);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ char *t_obj_path = xml_escape_the_name(obj_path);
+ char *t_filename = xml_escape_the_name(filename);
+ char *t_targname = xml_escape_the_name(targname);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sExternalLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "TargetFilename=\"%s\" "
- "TargetPath=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- filename, /* TargetFilename */
- targname, /* TargetPath*/
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- HDfree(t_prefix);
- HDfree(t_name);
- HDfree(t_filename);
- HDfree(t_targname);
- HDfree(t_obj_path);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sExternalLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetFilename=\"%s\" "
+ "TargetPath=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix,
+ t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ filename, /* TargetFilename */
+ targname, /* TargetPath*/
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ HDfree(t_prefix);
+ HDfree(t_name);
+ HDfree(t_filename);
+ HDfree(t_targname);
+ HDfree(t_obj_path);
+ } /* end else */
} /* end else */
- } /* end else */
- HDfree(targbuf);
+ HDfree(targbuf);
+ }
break;
case H5L_TYPE_ERROR:
case H5L_TYPE_MAX:
- HDassert(0);
- /* fall through */
case H5L_TYPE_HARD:
default:
{
@@ -674,7 +684,6 @@ xml_escape_the_name(const char *str)
for (i = 0; i < len; i++) {
size_t esc_len;
- HDassert(ncp_len);
if (*cp == '\'') {
HDstrncpy(ncp, apos, ncp_len);
esc_len = HDstrlen(apos);
@@ -768,7 +777,6 @@ xml_escape_the_string(const char *str, int slen)
for (i = 0; i < len; i++) {
size_t esc_len;
- HDassert(ncp_len);
if (*cp == '\\') {
*ncp++ = '\\';
*ncp = *cp;
@@ -1514,8 +1522,6 @@ xml_print_datatype(hid_t type, unsigned in_group)
case H5T_NO_CLASS:
case H5T_NCLASSES:
- HDassert(0);
- /* fall through */
default:
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
@@ -1968,22 +1974,26 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
for (i = 0; i < ndims; i++)
nelmts *= size[i];
- buf = HDmalloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type))));
- HDassert(buf);
-
- if (H5Aread(obj_id, p_type, buf) >= 0) {
- h5tools_context_t datactx;
- HDmemset(&datactx, 0, sizeof(datactx));
- datactx.need_prefix = TRUE;
- datactx.indent_level = ctx.indent_level;
- datactx.cur_column = ctx.cur_column;
- status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id, p_type, space, buf);
+ if((buf = HDmalloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type))))) == NULL) {
+ error_msg("unable to allocate buffer\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ status = FAIL;
}
- /* Reclaim any VL memory, if necessary */
- if (vl_data)
- H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
+ else {
+ if (H5Aread(obj_id, p_type, buf) >= 0) {
+ h5tools_context_t datactx;
+ HDmemset(&datactx, 0, sizeof(datactx));
+ datactx.need_prefix = TRUE;
+ datactx.indent_level = ctx.indent_level;
+ datactx.cur_column = ctx.cur_column;
+ status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id, p_type, space, buf);
+ }
+ /* Reclaim any VL memory, if necessary */
+ if (vl_data)
+ H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
- HDfree(buf);
+ HDfree(buf);
+ }
}
H5Tclose(p_type);
H5Sclose(space);
@@ -2239,8 +2249,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
break;
case H5T_NO_CLASS:
case H5T_NCLASSES:
- HDassert(0);
- /* fall through */
default:
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
@@ -3672,8 +3680,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
break;
case H5T_NO_CLASS:
case H5T_NCLASSES:
- HDassert(0);
- /* fall through */
case H5T_STRING:
case H5T_REFERENCE:
default:
@@ -3812,91 +3818,95 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s
/* Print information about storage layout */
if (H5D_CHUNKED == H5Pget_layout(dcpl)) {
- maxdims = H5Sget_simple_extent_ndims(space);
- HDassert(maxdims >= 0);
- chsize = (hsize_t *)HDmalloc((size_t)maxdims * sizeof(hsize_t));
- ctx.indent_level++;
- dump_indent += COL;
+ if((maxdims = H5Sget_simple_extent_ndims(space)) < 0) {
+ error_msg("unable to get maxdims\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ else {
+ chsize = (hsize_t *)HDmalloc((size_t)maxdims * sizeof(hsize_t));
+ ctx.indent_level++;
+ dump_indent += COL;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level++;
- dump_indent += COL;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+ dump_indent += COL;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sChunkedLayout ", xmlnsprefix);
- ndims = H5Pget_chunk(dcpl, maxdims, chsize);
- h5tools_str_append(&buffer, "Ndims=\"%d\">", ndims);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sChunkedLayout ", xmlnsprefix);
+ ndims = H5Pget_chunk(dcpl, maxdims, chsize);
+ h5tools_str_append(&buffer, "Ndims=\"%d\">", ndims);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level++;
- dump_indent += COL;
+ ctx.indent_level++;
+ dump_indent += COL;
- for (i = 0; i < ndims; i++) {
+ for (i = 0; i < ndims; i++) {
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" />", xmlnsprefix, chsize[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" />", xmlnsprefix, chsize[i]);
+ h5tools_str_append(&buffer, "<%sRequiredFilter>", xmlnsprefix);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
-
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sRequiredFilter>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level++;
- dump_indent += COL;
- check_filters(dcpl);
- ctx.indent_level--;
- dump_indent -= COL;
+ ctx.indent_level++;
+ dump_indent += COL;
+ check_filters(dcpl);
+ ctx.indent_level--;
+ dump_indent -= COL;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sRequiredFilter>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sRequiredFilter>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
- dump_indent -= COL;
+ ctx.indent_level--;
+ dump_indent -= COL;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sChunkedLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
- dump_indent -= COL;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sChunkedLayout>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+ dump_indent -= COL;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
- dump_indent -= COL;
- HDfree(chsize);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ HDfree(chsize);
+ }
}
else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl)) {
ctx.indent_level++;
@@ -3984,8 +3994,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s
h5tools_str_append(&buffer, "FillIfSet");
break;
case H5D_FILL_TIME_ERROR:
- HDassert(0);
- /* fall through */
default:
h5tools_str_append(&buffer, "?");
break;
@@ -4005,8 +4013,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s
break;
case H5D_ALLOC_TIME_DEFAULT:
case H5D_ALLOC_TIME_ERROR:
- HDassert(0);
- /* fall through */
default:
h5tools_str_append(&buffer, "?");
break;
@@ -4233,9 +4239,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s
break;
case H5T_NO_CLASS:
case H5T_NCLASSES:
- HDassert(0);
- /* fall through */
-
default:
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c
index 61de604..e668f2a 100644
--- a/tools/src/h5jam/h5jam.c
+++ b/tools/src/h5jam/h5jam.c
@@ -73,13 +73,13 @@ usage (const char *prog)
HDfprintf (stdout,
"Adds user block to front of an HDF5 file and creates a new concatenated file.\n");
HDfprintf (stdout, "\n");
- HDfprintf (stdout,
+ HDfprintf (stdout,
"OPTIONS\n");
- HDfprintf (stdout,
+ HDfprintf (stdout,
" -i in_file.h5 Specifies the input HDF5 file.\n");
- HDfprintf (stdout,
+ HDfprintf (stdout,
" -u in_user_file Specifies the file to be inserted into the user block.\n");
- HDfprintf (stdout,
+ HDfprintf (stdout,
" Can be any file format except an HDF5 format.\n");
HDfprintf (stdout,
" -o out_file.h5 Specifies the output HDF5 file.\n");
@@ -392,7 +392,7 @@ main (int argc, const char *argv[])
HDfree (input_file);
if(output_file)
HDfree (output_file);
-
+
if(ufid >= 0)
HDclose (ufid);
if(h5fid >= 0)
@@ -548,7 +548,8 @@ write_pad(int ofile, hsize_t old_where, hsize_t *new_where)
char buf[1];
hsize_t psize;
- HDassert(new_where);
+ if(new_where == NULL)
+ return FAIL;
buf[0] = '\0';
diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c
index 1cc8cb3..4e9798e 100644
--- a/tools/src/h5jam/h5unjam.c
+++ b/tools/src/h5jam/h5unjam.c
@@ -133,28 +133,28 @@ static int
parse_command_line(int argc, const char *argv[])
{
int opt = FALSE;
-
+
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch((char)opt) {
case 'o':
output_file = HDstrdup(opt_arg);
- if (output_file)
- h5tools_set_data_output_file(output_file, 1);
- break;
+ if (output_file)
+ h5tools_set_data_output_file(output_file, 1);
+ break;
case 'i':
input_file = HDstrdup(opt_arg);
- if (input_file)
- h5tools_set_input_file(input_file, 1);
- break;;
+ if (input_file)
+ h5tools_set_input_file(input_file, 1);
+ break;;
case 'u':
ub_file = HDstrdup(opt_arg);
- if (ub_file)
- h5tools_set_output_file(ub_file, 1);
- else
- rawoutstream = stdout;
+ if (ub_file)
+ h5tools_set_output_file(ub_file, 1);
+ else
+ rawoutstream = stdout;
break;
case 'd':
@@ -180,7 +180,7 @@ parse_command_line(int argc, const char *argv[])
}
return EXIT_SUCCESS;
-
+
done:
if(input_file)
HDfree(input_file);
@@ -240,7 +240,7 @@ main(int argc, const char *argv[])
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
-
+
testval = H5Fis_hdf5(input_file);
if (testval <= 0) {
@@ -272,10 +272,8 @@ main(int argc, const char *argv[])
goto done;
}
- status = H5Pclose(plist);
- HDassert(status >= 0);
- status = H5Fclose(ifile);
- HDassert(status >= 0);
+ H5Pclose(plist);
+ H5Fclose(ifile);
if (usize == 0) {
/* no user block to remove: message? */
@@ -303,7 +301,7 @@ main(int argc, const char *argv[])
error_msg("unable to open output HDF5 file \"%s\"\n", input_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
/* copy from 0 to 'usize - 1' into ufid */
if (!do_delete) {
@@ -321,18 +319,18 @@ main(int argc, const char *argv[])
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
-
+
done:
if(input_file)
HDfree(input_file);
-
+
if(output_file)
HDfree(output_file);
-
+
if(ub_file) {
HDfree(ub_file);
}
-
+
h5tools_close();
return h5tools_getstatus();
@@ -374,7 +372,7 @@ copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t show_much )
else
bytes_in = how_much;
- /* Seek to correct position in input file */
+ /* Seek to correct position in input file */
HDfseek(infid, from, SEEK_SET);
/* Read data to buffer */
@@ -396,11 +394,11 @@ copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t show_much )
to += (off_t)bytes_read;
/* Write nchars bytes to output file */
- bytes_wrote = HDfwrite(buf, (size_t)1, bytes_read, ofid);
- if(bytes_wrote != bytes_read || (0 == bytes_wrote && HDferror(ofid))) { /* error */
- ret_value = -1;
- goto done;
- } /* end if */
+ bytes_wrote = HDfwrite(buf, (size_t)1, bytes_read, ofid);
+ if(bytes_wrote != bytes_read || (0 == bytes_wrote && HDferror(ofid))) { /* error */
+ ret_value = -1;
+ goto done;
+ } /* end if */
} /* end while */
done:
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index a181186..d397067 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -1619,9 +1619,9 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
if(space_type != H5S_NULL && space_type != H5S_NO_CLASS) {
if(hexdump_g)
- p_type = H5Tcopy(type);
+ p_type = H5Tcopy(type);
else
- p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
+ p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
if(p_type >= 0) {
/* VL data special information */
@@ -1631,23 +1631,22 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
if (h5tools_detect_vlen(p_type) == TRUE)
vl_data = TRUE;
- temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));
- HDassert(temp_need == (hsize_t)((size_t)temp_need));
+ temp_need = nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));
need = (size_t)temp_need;
- buf = HDmalloc(need);
- HDassert(buf);
- if(H5Aread(attr, p_type, buf) >= 0) {
- ctx.need_prefix = TRUE;
- ctx.indent_level = 2;
- ctx.cur_column = (size_t)curr_pos;
- h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf);
- }
+ if((buf = HDmalloc(need)) != NULL) {
+ if(H5Aread(attr, p_type, buf) >= 0) {
+ ctx.need_prefix = TRUE;
+ ctx.indent_level = 2;
+ ctx.cur_column = (size_t)curr_pos;
+ h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf);
+ }
- /* Reclaim any VL memory, if necessary */
- if (vl_data)
- H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
+ /* Reclaim any VL memory, if necessary */
+ if (vl_data)
+ H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
- HDfree(buf);
+ HDfree(buf);
+ }
H5Tclose(p_type);
} /* end if */
}
@@ -1875,7 +1874,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
default:
- HDassert(0);
+ h5tools_str_append(&buffer, "layout information not available");
break;
}
/* Print total raw storage size */
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 4860d9e..76ca117 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -262,7 +262,6 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
/* Check if this type is the one requested */
if (oinfo.addr == dt->addr_in) {
- HDassert(!dt_ret);
dt_ret = dt;
} /* end if */
} /* end if */
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 42fedbc..8e82b11 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -782,7 +782,6 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
switch (travt->objs[i].type) {
case H5TRAV_TYPE_UNKNOWN:
- HDassert(0);
break;
/*-------------------------------------------------------------------------
@@ -1486,7 +1485,6 @@ static int copy_user_block(const char *infile, const char *outfile, hsize_t size
int infid = -1, outfid = -1; /* File descriptors */
/* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */
- HDassert(size > 0);
/* Open files */
if ((infid = HDopen(infile, O_RDONLY, 0)) < 0)
diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c
index 804727b..c48158c 100644
--- a/tools/src/h5repack/h5repack_filters.c
+++ b/tools/src/h5repack/h5repack_filters.c
@@ -32,37 +32,32 @@
*
*-------------------------------------------------------------------------
*/
-static int
-aux_find_obj(const char* name, /* object name from traverse list */
- pack_opt_t *options, /* repack options */
- pack_info_t *obj /*OUT*/) /* info about object to filter */
+static int aux_find_obj(const char* name, /* object name from traverse list */
+ pack_opt_t *options, /* repack options */
+ pack_info_t *obj /*OUT*/) /* info about object to filter */
{
- char *pdest;
- int result;
- unsigned int i;
-
- for ( i=0; i<options->op_tbl->nelems; i++)
- {
- if (HDstrcmp(options->op_tbl->objs[i].path,name)==0)
- {
- *obj = options->op_tbl->objs[i];
- return (int)i;
- }
-
- pdest = HDstrstr(name,options->op_tbl->objs[i].path);
- result = (int)(pdest - name);
-
- /* found at position 1, meaning without '/' */
- if( pdest != NULL && result==1 )
- {
- *obj = options->op_tbl->objs[i];
- return (int)i;
- }
- }/*i*/
-
- return -1;
-}
+ char *pdest;
+ int result;
+ unsigned int i;
+
+ for (i = 0; i < options->op_tbl->nelems; i++) {
+ if (HDstrcmp(options->op_tbl->objs[i].path,name) == 0) {
+ *obj = options->op_tbl->objs[i];
+ return (int) i;
+ }
+ pdest = HDstrstr(name, options->op_tbl->objs[i].path);
+ result = (int) (pdest - name);
+
+ /* found at position 1, meaning without '/' */
+ if (pdest != NULL && result == 1) {
+ *obj = options->op_tbl->objs[i];
+ return (int) i;
+ }
+ }/*i*/
+
+ return -1;
+}
/*-------------------------------------------------------------------------
* Function: aux_assign_obj
@@ -74,35 +69,31 @@ aux_find_obj(const char* name, /* object name from traverse list */
*
*-------------------------------------------------------------------------
*/
-static int
-aux_assign_obj(const char* name, /* object name from traverse list */
- pack_opt_t *options, /* repack options */
- pack_info_t *obj /*OUT*/) /* info about object to filter */
+static int aux_assign_obj(const char* name, /* object name from traverse list */
+ pack_opt_t *options, /* repack options */
+ pack_info_t *obj /*OUT*/) /* info about object to filter */
{
- int idx, i;
+ int idx, i;
pack_info_t tmp;
init_packobject(&tmp);
- idx = aux_find_obj(name,options,&tmp);
+ idx = aux_find_obj(name, options, &tmp);
/* name was on input */
- if (idx>=0)
- {
-
+ if (idx >= 0) {
/* applying to all objects */
- if (options->all_layout)
- {
+ if (options->all_layout) {
/* assign the global layout info to the OBJ info */
- tmp.layout=options->layout_g;
- switch (options->layout_g)
- {
+ tmp.layout = options->layout_g;
+ switch (options->layout_g) {
case H5D_CHUNKED:
- tmp.chunk.rank=options->chunk_g.rank;
- for ( i=0; i<tmp.chunk.rank; i++)
- tmp.chunk.chunk_lengths[i]=options->chunk_g.chunk_lengths[i];
+ tmp.chunk.rank = options->chunk_g.rank;
+ for (i = 0; i < tmp.chunk.rank; i++)
+ tmp.chunk.chunk_lengths[i] =
+ options->chunk_g.chunk_lengths[i];
break;
case H5D_LAYOUT_ERROR:
case H5D_COMPACT:
@@ -114,15 +105,14 @@ aux_assign_obj(const char* name, /* object name from traverse list */
break;
}/*switch*/
}
- else
- {
+ else {
tmp.layout = options->op_tbl->objs[idx].layout;
- switch (tmp.layout)
- {
+ switch (tmp.layout) {
case H5D_CHUNKED:
tmp.chunk.rank = options->op_tbl->objs[idx].chunk.rank;
- for ( i=0; i<tmp.chunk.rank; i++)
- tmp.chunk.chunk_lengths[i]=options->op_tbl->objs[idx].chunk.chunk_lengths[i];
+ for (i = 0; i < tmp.chunk.rank; i++)
+ tmp.chunk.chunk_lengths[i] =
+ options->op_tbl->objs[idx].chunk.chunk_lengths[i];
break;
case H5D_LAYOUT_ERROR:
case H5D_COMPACT:
@@ -137,49 +127,37 @@ aux_assign_obj(const char* name, /* object name from traverse list */
}
/* applying to all objects */
- if (options->all_filter)
- {
+ if (options->all_filter) {
/* assign the global filter */
- tmp.nfilters=1;
- tmp.filter[0]=options->filter_g[0];
+ tmp.nfilters = 1;
+ tmp.filter[0] = options->filter_g[0];
} /* if all */
- else
- {
- tmp.nfilters=options->op_tbl->objs[idx].nfilters;
- for ( i=0; i<tmp.nfilters; i++)
- {
+ else {
+ tmp.nfilters = options->op_tbl->objs[idx].nfilters;
+ for (i = 0; i < tmp.nfilters; i++) {
tmp.filter[i] = options->op_tbl->objs[idx].filter[i];
}
}
-
-
} /* if idx */
-
-
/* no input name */
-
- else
- {
-
- if (options->all_filter)
- {
+ else {
+ if (options->all_filter) {
int k;
/* assign the global filters */
- tmp.nfilters=options->n_filter_g;
- for ( k = 0; k < options->n_filter_g; k++)
- tmp.filter[k]=options->filter_g[k];
+ tmp.nfilters = options->n_filter_g;
+ for (k = 0; k < options->n_filter_g; k++)
+ tmp.filter[k] = options->filter_g[k];
}
- if (options->all_layout)
- {
+ if (options->all_layout) {
/* assign the global layout info to the OBJ info */
- tmp.layout=options->layout_g;
- switch (options->layout_g)
- {
+ tmp.layout = options->layout_g;
+ switch (options->layout_g) {
case H5D_CHUNKED:
- tmp.chunk.rank=options->chunk_g.rank;
- for ( i=0; i<tmp.chunk.rank; i++)
- tmp.chunk.chunk_lengths[i]=options->chunk_g.chunk_lengths[i];
+ tmp.chunk.rank = options->chunk_g.rank;
+ for (i = 0; i < tmp.chunk.rank; i++)
+ tmp.chunk.chunk_lengths[i] =
+ options->chunk_g.chunk_lengths[i];
break;
case H5D_LAYOUT_ERROR:
case H5D_COMPACT:
@@ -195,10 +173,8 @@ aux_assign_obj(const char* name, /* object name from traverse list */
*obj = tmp;
return 1;
-
}
-
/*-------------------------------------------------------------------------
* Function: apply_filters
*
@@ -215,74 +191,69 @@ aux_assign_obj(const char* name, /* object name from traverse list */
*-------------------------------------------------------------------------
*/
-int apply_filters(const char* name, /* object name from traverse list */
- int rank, /* rank of dataset */
- hsize_t *dims, /* dimensions of dataset */
- size_t msize, /* size of type */
- hid_t dcpl_id, /* dataset creation property list */
- pack_opt_t *options, /* repack options */
- int *has_filter) /* (OUT) object NAME has a filter */
-
-
+int apply_filters(const char* name, /* object name from traverse list */
+ int rank, /* rank of dataset */
+ hsize_t *dims, /* dimensions of dataset */
+ size_t msize, /* size of type */
+ hid_t dcpl_id, /* dataset creation property list */
+ pack_opt_t *options, /* repack options */
+ int *has_filter) /* (OUT) object NAME has a filter */
{
- int nfilters; /* number of filters in DCPL */
- hsize_t chsize[64]; /* chunk size in elements */
+ int nfilters; /* number of filters in DCPL */
+ hsize_t chsize[64]; /* chunk size in elements */
H5D_layout_t layout;
- int i;
- pack_info_t obj;
+ int i;
+ pack_info_t obj;
*has_filter = 0;
- if (rank==0) /* scalar dataset, do not apply */
+ if (rank == 0) /* scalar dataset, do not apply */
return 0;
- /*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
* initialize the assigment object
*-------------------------------------------------------------------------
*/
init_packobject(&obj);
- /*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
* find options
*-------------------------------------------------------------------------
*/
- if (aux_assign_obj(name,options,&obj)==0)
+ if (aux_assign_obj(name, options, &obj) == 0)
return 0;
/* get information about input filters */
- if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
+ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
return -1;
- /*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
* check if we have filters in the pipeline
* we want to replace them with the input filters
* only remove if we are inserting new ones
*-------------------------------------------------------------------------
*/
- if (nfilters && obj.nfilters )
- {
+ if (nfilters && obj.nfilters) {
*has_filter = 1;
- if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0)
+ if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0)
return -1;
}
- /*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
* check if there is an existent chunk
* read it only if there is not a requested layout
*-------------------------------------------------------------------------
*/
- if (obj.layout == -1 )
- {
- if ((layout = H5Pget_layout(dcpl_id))<0)
+ if (obj.layout == -1) {
+ if ((layout = H5Pget_layout(dcpl_id)) < 0)
return -1;
- if (layout == H5D_CHUNKED)
- {
- if ((rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize/*out*/))<0)
+ if (layout == H5D_CHUNKED) {
+ if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0)
return -1;
obj.layout = H5D_CHUNKED;
obj.chunk.rank = rank;
- for ( i = 0; i < rank; i++)
+ for (i = 0; i < rank; i++)
obj.chunk.chunk_lengths[i] = chsize[i];
}
}
@@ -300,19 +271,15 @@ int apply_filters(const char* name, /* object name from traverse list */
*-------------------------------------------------------------------------
*/
- if (obj.nfilters)
- {
-
- /*-------------------------------------------------------------------------
- * filters require CHUNK layout; if we do not have one define a default
- *-------------------------------------------------------------------------
- */
- if (obj.layout==-1)
- {
-
+ if (obj.nfilters) {
+ /*-------------------------------------------------------------------------
+ * filters require CHUNK layout; if we do not have one define a default
+ *-------------------------------------------------------------------------
+ */
+ if (obj.layout == -1) {
/* stripmine info */
hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */
- hsize_t sm_nbytes; /*bytes per stripmine */
+ hsize_t sm_nbytes; /*bytes per stripmine */
obj.chunk.rank = rank;
@@ -321,138 +288,129 @@ int apply_filters(const char* name, /* object name from traverse list */
* a hyperslab whose size is manageable.
*/
-
-
sm_nbytes = msize;
- for ( i = rank; i > 0; --i)
- {
+ for (i = rank; i > 0; --i) {
hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
- if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */
+ if (size == 0) /* datum size > H5TOOLS_BUFSIZE */
size = 1;
sm_size[i - 1] = MIN(dims[i - 1], size);
sm_nbytes *= sm_size[i - 1];
HDassert(sm_nbytes > 0);
-
}
- for ( i = 0; i < rank; i++)
- {
+ for (i = 0; i < rank; i++) {
obj.chunk.chunk_lengths[i] = sm_size[i];
}
-
}
- for ( i=0; i<obj.nfilters; i++)
- {
- switch (obj.filter[i].filtn)
- {
-
+ for (i = 0; i < obj.nfilters; i++) {
+ switch (obj.filter[i].filtn) {
/*-------------------------------------------------------------------------
- * H5Z_FILTER_NONE 0 , uncompress if compressed
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_NONE:
- break;
-
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ * H5Z_FILTER_NONE 0 , uncompress if compressed
*-------------------------------------------------------------------------
*/
+ case H5Z_FILTER_NONE:
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ *-------------------------------------------------------------------------
+ */
case H5Z_FILTER_DEFLATE:
{
- unsigned aggression; /* the deflate level */
+ unsigned aggression; /* the deflate level */
aggression = obj.filter[i].cd_values[0];
/* set up for deflated data */
- if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
return -1;
- if(H5Pset_deflate(dcpl_id,aggression)<0)
+ if (H5Pset_deflate(dcpl_id, aggression) < 0)
return -1;
}
break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_SZIP 4 , szip compression
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SZIP 4 , szip compression
+ *-------------------------------------------------------------------------
+ */
case H5Z_FILTER_SZIP:
{
- unsigned options_mask;
- unsigned pixels_per_block;
+ unsigned options_mask;
+ unsigned pixels_per_block;
- options_mask = obj.filter[i].cd_values[0];
+ options_mask = obj.filter[i].cd_values[0];
pixels_per_block = obj.filter[i].cd_values[1];
/* set up for szip data */
- if(H5Pset_chunk(dcpl_id,obj.chunk.rank,obj.chunk.chunk_lengths)<0)
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
return -1;
- if (H5Pset_szip(dcpl_id,options_mask,pixels_per_block)<0)
+ if (H5Pset_szip(dcpl_id, options_mask, pixels_per_block) < 0)
return -1;
-
}
break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_SHUFFLE 2 , shuffle the data
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SHUFFLE 2 , shuffle the data
+ *-------------------------------------------------------------------------
+ */
case H5Z_FILTER_SHUFFLE:
- if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
return -1;
- if (H5Pset_shuffle(dcpl_id)<0)
+ if (H5Pset_shuffle(dcpl_id) < 0)
return -1;
break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
+ *-------------------------------------------------------------------------
+ */
case H5Z_FILTER_FLETCHER32:
- if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
return -1;
- if (H5Pset_fletcher32(dcpl_id)<0)
+ if (H5Pset_fletcher32(dcpl_id) < 0)
return -1;
break;
- /*----------- -------------------------------------------------------------
- * H5Z_FILTER_NBIT , NBIT compression
- *-------------------------------------------------------------------------
- */
+ /*----------- -------------------------------------------------------------
+ * H5Z_FILTER_NBIT , NBIT compression
+ *-------------------------------------------------------------------------
+ */
case H5Z_FILTER_NBIT:
- if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
return -1;
- if (H5Pset_nbit(dcpl_id)<0)
+ if (H5Pset_nbit(dcpl_id) < 0)
return -1;
break;
- /*----------- -------------------------------------------------------------
- * H5Z_FILTER_SCALEOFFSET , scale+offset compression
- *-------------------------------------------------------------------------
- */
+ /*----------- -------------------------------------------------------------
+ * H5Z_FILTER_SCALEOFFSET , scale+offset compression
+ *-------------------------------------------------------------------------
+ */
case H5Z_FILTER_SCALEOFFSET:
{
H5Z_SO_scale_type_t scale_type;
- int scale_factor;
+ int scale_factor;
- scale_type = (H5Z_SO_scale_type_t)obj.filter[i].cd_values[0];
- scale_factor = (int)obj.filter[i].cd_values[1];
+ scale_type = (H5Z_SO_scale_type_t) obj.filter[i].cd_values[0];
+ scale_factor = (int) obj.filter[i].cd_values[1];
- if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
return -1;
- if (H5Pset_scaleoffset(dcpl_id,scale_type,scale_factor)<0)
+ if (H5Pset_scaleoffset(dcpl_id, scale_type, scale_factor) < 0)
return -1;
}
break;
default:
- {
- if (H5Pset_filter (dcpl_id, obj.filter[i].filtn, H5Z_FLAG_MANDATORY, obj.filter[i].cd_nelmts, obj.filter[i].cd_values)<0)
- return -1;
- if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
- return -1;
- }
+ {
+ if (H5Pset_filter(dcpl_id, obj.filter[i].filtn,
+ H5Z_FLAG_MANDATORY, obj.filter[i].cd_nelmts,
+ obj.filter[i].cd_values) < 0)
+ return -1;
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
+ return -1;
+ }
break;
} /* switch */
}/*i*/
-
}
/*obj.nfilters*/
@@ -461,31 +419,27 @@ int apply_filters(const char* name, /* object name from traverse list */
*-------------------------------------------------------------------------
*/
- if (obj.layout>=0)
- {
+ if (obj.layout >= 0) {
/* a layout was defined */
- if (H5Pset_layout(dcpl_id, obj.layout)<0)
+ if (H5Pset_layout(dcpl_id, obj.layout) < 0)
return -1;
- if (H5D_CHUNKED == obj.layout)
- {
- if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ if (H5D_CHUNKED == obj.layout) {
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
return -1;
}
- else if (H5D_COMPACT == obj.layout)
- {
- if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY)<0)
+ else if (H5D_COMPACT == obj.layout) {
+ if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY) < 0)
return -1;
}
/* remove filters for the H5D_CONTIGUOUS case */
- else if (H5D_CONTIGUOUS == obj.layout)
- {
- if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0)
+ else if (H5D_CONTIGUOUS == obj.layout) {
+ if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0)
return -1;
}
}
- return 0;
+ return 0;
}
diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c
index 408142c..36038b5 100644
--- a/tools/src/h5repack/h5repack_refs.c
+++ b/tools/src/h5repack/h5repack_refs.c
@@ -189,8 +189,7 @@ int do_copy_refobjs(hid_t fidin,
/* create the reference, -1 parameter for objects */
if(H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, (hid_t)-1) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed");
- if(options->verbose)
- {
+ if(options->verbose) {
printf(FORMAT_OBJ,"dset",travt->objs[i].name );
printf("object <%s> object reference created to <%s>\n",
travt->objs[i].name,
@@ -278,8 +277,7 @@ int do_copy_refobjs(hid_t fidin,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed");
if(H5Sclose(region_id) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
- if(options->verbose)
- {
+ if(options->verbose) {
printf(FORMAT_OBJ,"dset",travt->objs[i].name );
printf("object <%s> region reference created to <%s>\n",
travt->objs[i].name,
@@ -320,8 +318,6 @@ int do_copy_refobjs(hid_t fidin,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
} /* end else */
- HDassert(dset_out != FAIL);
-
/*-------------------------------------------------------------------------
* copy referenced objects in attributes
*-------------------------------------------------------------------------