diff options
Diffstat (limited to 'tools')
120 files changed, 5287 insertions, 3780 deletions
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 4b3b3d5..5576f5c 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS) #----------------------------------------------------------------------------- @@ -9,9 +9,7 @@ add_definitions (${HDF_EXTRA_C_FLAGS}) # -------------------------------------------------------------------- # If testing was NOT enabled, then we need to build the tools library # -------------------------------------------------------------------- -if (NOT BUILD_TESTING) - add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/lib) -endif () +add_subdirectory (lib) #----------------------------------------------------------------------------- # Setup include Directories @@ -19,9 +17,9 @@ endif () INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib) #-- Add the test sources -add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/src) +add_subdirectory (src) #-- Add the tests if (BUILD_TESTING) - add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/test) + add_subdirectory (test) endif () diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index ade7671..db06b9a 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_LIB) #----------------------------------------------------------------------------- @@ -39,7 +39,10 @@ set (H5_TOOLS_LIB_HDRS add_library (${HDF5_TOOLS_LIB_TARGET} STATIC ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS}) TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC " " " ") -target_link_libraries (${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_link_libraries (${HDF5_TOOLS_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) +if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) + target_link_libraries (${HDF5_TOOLS_LIB_TARGET} PRIVATE ${MPI_C_LIBRARIES}) +endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_TOOLS_LIB_TARGET} ${HDF5_TOOLS_LIB_NAME} STATIC) set_target_properties (${HDF5_TOOLS_LIB_TARGET} PROPERTIES @@ -52,7 +55,10 @@ set (install_targets ${HDF5_TOOLS_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_library (${HDF5_TOOLS_LIBSH_TARGET} SHARED ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS}) TARGET_C_PROPERTIES (${HDF5_TOOLS_LIBSH_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_link_libraries (${HDF5_TOOLS_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) + if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) + target_link_libraries (${HDF5_TOOLS_LIBSH_TARGET} PRIVATE ${MPI_C_LIBRARIES}) + endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TOOLS_LIB_NAME} SHARED ${HDF5_TOOLS_PACKAGE_SOVERSION}) set_target_properties (${HDF5_TOOLS_LIBSH_TARGET} PROPERTIES diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 6019738..7f08cc7 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -325,8 +325,6 @@ hsize_t diff_attr(hid_t loc1_id, hid_t space2_id = -1; /* space ID */ hid_t ftype1_id = -1; /* file data type ID */ hid_t ftype2_id = -1; /* file data type ID */ - int vstrtype1 = 0; /* ftype1 is a variable string */ - int vstrtype2 = 0; /* ftype2 is a variable string */ hid_t mtype1_id = -1; /* memory data type ID */ hid_t mtype2_id = -1; /* memory data type ID */ size_t msize1; /* memory size of memory type */ @@ -385,28 +383,8 @@ hsize_t diff_attr(hid_t loc1_id, /* get the datatypes */ if((ftype1_id = H5Aget_type(attr1_id)) < 0) HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); - vstrtype1 = H5Tis_variable_str(ftype1_id); if((ftype2_id = H5Aget_type(attr2_id)) < 0) HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); - vstrtype2 = H5Tis_variable_str(ftype2_id); - - /* no compare if either one but not both are variable string type */ - if (vstrtype1 != vstrtype2) { - if((opts->m_verbose || opts->m_list_not_cmp)) - parallel_print("Not comparable: one of attribute <%s/%s> or <%s/%s> is of variable length type\n", - path1, name1, path2, name2); - opts->not_cmp = 1; - if (H5Tclose(ftype1_id) < 0) - HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute ftype failed"); - if (H5Tclose(ftype2_id) < 0) - HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute ftype failed"); - if (H5Aclose(attr1_id) < 0) - HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose first attribute failed"); - if (H5Aclose(attr2_id) < 0) - HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose second attribute failed"); - - continue; - } if((mtype1_id = H5Tget_native_type(ftype1_id, H5T_DIR_DEFAULT)) < 0) HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type first attribute ftype failed"); diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index ee42b99..ff542db 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -192,7 +192,8 @@ hsize_t diff_datasetid(hid_t did1, hid_t sm_space = -1; /*stripmine data space */ size_t need; /* bytes needed for malloc */ int i; - unsigned int vl_data = 0; /*contains VL datatypes */ + unsigned int vl_data1 = 0; /*contains VL datatypes */ + unsigned int vl_data2 = 0; /*contains VL datatypes */ h5difftrace("diff_datasetid start\n"); /* Get the dataspace handle */ @@ -320,7 +321,9 @@ hsize_t diff_datasetid(hid_t did1, * VLEN memory buffer later */ if(TRUE == h5tools_detect_vlen(m_tid1)) - vl_data = TRUE; + vl_data1 = TRUE; + if(TRUE == h5tools_detect_vlen(m_tid2)) + vl_data2 = TRUE; h5diffdebug2("h5tools_detect_vlen - errstat:%d\n", opts->err_stat); /*------------------------------------------------------------------------ @@ -411,11 +414,12 @@ hsize_t diff_datasetid(hid_t did1, h5diffdebug2("diff_array nfound:%d\n", nfound); /* reclaim any VL memory, if necessary */ - if(vl_data) { - h5difftrace("check vl_data\n"); + h5diffdebug2("check vl_data1:%d\n", vl_data1); + if(vl_data1) H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1); + h5diffdebug2("check vl_data2:%d\n", vl_data2); + if(vl_data2) H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2); - } /* end if */ if(buf1 != NULL) { HDfree(buf1); buf1 = NULL; @@ -505,10 +509,10 @@ hsize_t diff_datasetid(hid_t did1, dadims, opts, name1, name2, dam_tid, did1, did2); /* reclaim any VL memory, if necessary */ - if(vl_data) { + if(vl_data1) H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1); - H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2); - } /* end if */ + if(vl_data2) + H5Dvlen_reclaim(m_tid2, sm_space, H5P_DEFAULT, sm_buf2); /* calculate the next hyperslab offset */ for(i = rank1, carry = 1; i > 0 && carry; --i) { @@ -545,29 +549,29 @@ done: /* free */ if(buf1 != NULL) { /* reclaim any VL memory, if necessary */ - if(vl_data) + if(vl_data1) H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1); HDfree(buf1); buf1 = NULL; } if(buf2 != NULL) { /* reclaim any VL memory, if necessary */ - if(vl_data) + if(vl_data2) H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2); HDfree(buf2); buf2 = NULL; } if(sm_buf1 != NULL) { /* reclaim any VL memory, if necessary */ - if(vl_data) + if(vl_data1) H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1); HDfree(sm_buf1); sm_buf1 = NULL; } if(sm_buf2 != NULL) { /* reclaim any VL memory, if necessary */ - if(vl_data) - H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2); + if(vl_data2) + H5Dvlen_reclaim(m_tid2, sm_space, H5P_DEFAULT, sm_buf2); HDfree(sm_buf2); sm_buf2 = NULL; } @@ -576,6 +580,7 @@ done: H5E_BEGIN_TRY { H5Sclose(sid1); H5Sclose(sid2); + H5Sclose(sm_space); H5Tclose(f_tid1); H5Tclose(f_tid2); H5Tclose(m_tid1); @@ -767,12 +772,31 @@ int diff_can_type(hid_t f_tid1, /* file data type */ } } + if(tclass1 == H5T_STRING) { + htri_t vstrtype1 = -1; + htri_t vstrtype2 = -1; + h5difftrace("diff_can_type end - H5T_STRING\n"); + + vstrtype1 = H5Tis_variable_str(f_tid1); + vstrtype2 = H5Tis_variable_str(f_tid2); + + /* no compare if either one but not both are variable string type */ + if (vstrtype1 != vstrtype2) { + if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) + parallel_print("Not comparable: <%s> or <%s> is of mixed string type\n", + obj1_name, obj2_name); + opts->not_cmp = 1; + HGOTO_DONE(0); + } + } + if(tclass1 == H5T_COMPOUND) { int nmembs1; int nmembs2; int j; hid_t memb_type1 = -1; hid_t memb_type2 = -1; + h5difftrace("diff_can_type end - H5T_COMPOUND\n"); nmembs1 = H5Tget_nmembers(f_tid1); nmembs2 = H5Tget_nmembers(f_tid2); diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 89cb524..11888bc 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -43,7 +43,7 @@ unsigned packed_bits_num; /* number of packed bits to display */ unsigned packed_data_offset; /* offset of packed bits to display */ unsigned packed_data_length; /* length of packed bits to display */ unsigned long long packed_data_mask; /* mask in which packed bits to display */ -int enable_error_stack= FALSE; /* re-enable error stack */ +int enable_error_stack = 0; /* re-enable error stack; disable=0 enable=1 */ /* sort parameters */ H5_index_t sort_by = H5_INDEX_NAME; /*sort_by [creation_order | name] */ @@ -548,9 +548,15 @@ h5tools_fopen(const char *fname, unsigned flags, hid_t fapl, const char *driver, if ((my_fapl = h5tools_get_fapl(fapl, driver, &drivernum)) < 0) goto done; - H5E_BEGIN_TRY { + /* allow error stack display if enable-error-stack has optional arg number */ + if (enable_error_stack > 1) { fid = H5Fopen(fname, flags, my_fapl); - } H5E_END_TRY; + } + else { + H5E_BEGIN_TRY { + fid = H5Fopen(fname, flags, my_fapl); + } H5E_END_TRY; + } if (fid == FAIL) goto done; @@ -563,9 +569,15 @@ h5tools_fopen(const char *fname, unsigned flags, hid_t fapl, const char *driver, if((my_fapl = h5tools_get_fapl(fapl, drivernames[drivernum], NULL)) < 0) goto done; - H5E_BEGIN_TRY { + /* allow error stack display if enable-error-stack has optional arg number */ + if (enable_error_stack > 1) { fid = H5Fopen(fname, flags, my_fapl); - } H5E_END_TRY; + } + else { + H5E_BEGIN_TRY { + fid = H5Fopen(fname, flags, my_fapl); + } H5E_END_TRY; + } if (fid != FAIL) break; diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 6383df5..c360230 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -573,7 +573,7 @@ H5TOOLS_DLLVAR H5_index_t sort_by; /*sort_by [creation_order | name] * H5TOOLS_DLLVAR H5_iter_order_t sort_order; /*sort_order [ascending | descending] */ /* things to display or which are set via command line parameters */ -H5TOOLS_DLLVAR int enable_error_stack; /* re-enable error stack */ +H5TOOLS_DLLVAR int enable_error_stack; /* re-enable error stack; disable=0 enable=1 */ /* Strings for output */ #define H5_TOOLS_GROUP "GROUP" diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index ed7d38a..38ace81 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -2080,7 +2080,6 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ ctx->indent_level++; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); @@ -2091,7 +2090,6 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); @@ -2131,7 +2129,6 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); @@ -2170,7 +2167,6 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); @@ -2245,7 +2241,6 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); if(H5Tclose(str_type) < 0) @@ -2288,7 +2283,6 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed"); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";", ttag); @@ -2299,7 +2293,6 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); @@ -2318,7 +2311,6 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ mname = H5Tget_member_name(type, i); if((mtype = H5Tget_member_type(type, i)) >= 0) { ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_print_datatype(stream, buffer, info, ctx, mtype, TRUE); @@ -2335,7 +2327,6 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); @@ -2360,7 +2351,6 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ ctx->indent_level++; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); @@ -2376,7 +2366,6 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s", h5tools_dump_header_format->enumblockend); @@ -2792,7 +2781,6 @@ h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, ncols = info->line_ncols; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s %d %s", OBJID, BEGIN, oid, END); @@ -2820,7 +2808,6 @@ h5tools_print_virtual_selection(hid_t vspace, switch(H5Sget_select_type(vspace)) { case H5S_SEL_NONE: /* Nothing selected */ ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, *curr_pos, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s", VDS_NONE); @@ -2833,7 +2820,6 @@ h5tools_print_virtual_selection(hid_t vspace, break; case H5S_SEL_HYPERSLABS: /* "New-style" hyperslab selection defined */ ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, *curr_pos, 0); h5tools_str_reset(buffer); if (H5Sis_regular_hyperslab(vspace)) { @@ -2856,14 +2842,12 @@ h5tools_print_virtual_selection(hid_t vspace, } h5tools_render_element(stream, info, ctx, buffer, curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, *curr_pos, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s", h5tools_dump_header_format->virtualselectionblockend); break; case H5S_SEL_ALL: /* Entire extent selected */ ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, *curr_pos, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s", VDS_ALL); @@ -2956,7 +2940,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, *------------------------------------------------------------------------- */ ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", STORAGE_LAYOUT, BEGIN); @@ -2967,7 +2950,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, case H5D_CHUNKED: ctx->indent_level++; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s ", CHUNKED); @@ -2980,7 +2962,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); @@ -3036,14 +3017,12 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, case H5D_COMPACT: ctx->indent_level++; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", COMPACT); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size); @@ -3063,14 +3042,12 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ctx->indent_level++; if (next) { ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", CONTIGUOUS); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", EXTERNAL, BEGIN); @@ -3081,7 +3058,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, H5Pget_external(dcpl_id, j, sizeof(name), name, &offset, &size); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "FILENAME %s SIZE " HSIZE_T_FORMAT, name, size); @@ -3091,7 +3067,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", END); @@ -3101,21 +3076,18 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, haddr_t ioffset; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", CONTIGUOUS); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer,"SIZE " HSIZE_T_FORMAT, storage_size); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); ioffset = H5Dget_offset(obj_id); @@ -3143,7 +3115,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, hid_t virtual_srcspace = H5Pget_virtual_srcspace(dcpl_id, next); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %ld %s ", VDS_MAPPING, next, BEGIN); @@ -3152,7 +3123,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ctx->indent_level++; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", VDS_VIRTUAL, BEGIN); @@ -3165,14 +3135,12 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", END); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", VDS_SOURCE, BEGIN); @@ -3190,7 +3158,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, H5Pget_virtual_dsetname(dcpl_id, next, dsetname, sizeof(dsetname)); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", VDS_SRC_FILE, h5tools_dump_header_format->virtualfilenamebegin); @@ -3199,7 +3166,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", VDS_SRC_DATASET, h5tools_dump_header_format->virtualdatasetnamebegin); @@ -3212,7 +3178,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", END); @@ -3221,7 +3186,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", END); @@ -3241,7 +3205,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, }/*switch*/ ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", END); @@ -3253,7 +3216,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, */ if (H5D_VIRTUAL != stl) { ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", FILTERS, BEGIN); @@ -3271,7 +3233,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, continue; /* nothing to print for invalid filter */ ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); switch(filtn) { @@ -3297,14 +3258,12 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ctx->indent_level++; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "PIXELS_PER_BLOCK %d", szip_pixels_per_block); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); if(szip_options_mask & H5_SZIP_CHIP_OPTION_MASK) @@ -3314,7 +3273,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); if(szip_options_mask & H5_SZIP_EC_OPTION_MASK) @@ -3324,7 +3282,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); if(szip_options_mask & H5_SZIP_LSB_OPTION_MASK) @@ -3335,7 +3292,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, if(szip_options_mask & H5_SZIP_RAW_OPTION_MASK) { ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "HEADER %s", "RAW"); @@ -3345,7 +3301,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", END); @@ -3366,7 +3321,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ctx->indent_level++; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "FILTER_ID %d", filtn); @@ -3374,7 +3328,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, if(f_name[0] != '\0') { ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "COMMENT %s", f_name); @@ -3382,7 +3335,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, } if (cd_nelmts) { ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s ","PARAMS", BEGIN); @@ -3394,7 +3346,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s",END); @@ -3406,7 +3357,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, else { ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "NONE"); @@ -3415,7 +3365,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s",END); @@ -3427,7 +3376,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, *------------------------------------------------------------------------- */ ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", FILLVALUE, BEGIN); @@ -3436,7 +3384,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ctx->indent_level++; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "FILL_TIME "); @@ -3460,7 +3407,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s ", "VALUE "); @@ -3486,7 +3432,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", END); @@ -3498,7 +3443,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, */ if (H5D_VIRTUAL != stl) { ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "ALLOCATION_TIME %s", BEGIN); @@ -3507,7 +3451,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ctx->indent_level++; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); H5Pget_alloc_time(dcpl_id, &at); @@ -3532,7 +3475,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", END); @@ -3626,7 +3568,6 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, ncols = info->line_ncols; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", @@ -3663,7 +3604,6 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, } ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); @@ -3782,7 +3722,6 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, ncols = info->line_ncols; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->subsettingbegin, h5tools_dump_header_format->subsettingblockbegin); @@ -3791,7 +3730,6 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, ctx->indent_level++; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->startbegin, h5tools_dump_header_format->startblockbegin); @@ -3800,7 +3738,6 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->stridebegin, h5tools_dump_header_format->strideblockbegin); @@ -3809,7 +3746,6 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->countbegin, h5tools_dump_header_format->countblockbegin); @@ -3823,7 +3759,6 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->blockbegin, h5tools_dump_header_format->blockblockbegin); diff --git a/tools/src/CMakeLists.txt b/tools/src/CMakeLists.txt index 37680dd..9364658 100644 --- a/tools/src/CMakeLists.txt +++ b/tools/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_SRC) #----------------------------------------------------------------------------- @@ -7,31 +7,31 @@ PROJECT (HDF5_TOOLS_SRC) add_definitions (${HDF_EXTRA_C_FLAGS}) #-- Add the h5diff and test executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5diff) +add_subdirectory (h5diff) #-- Add the h5ls executable -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5ls) +add_subdirectory (h5ls) #-- Misc Executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/misc) +add_subdirectory (misc) #-- Add the h5import and test executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5import) +add_subdirectory (h5import) #-- h5Repack executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5repack) +add_subdirectory (h5repack) #-- Add the h5dump and test executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5jam) +add_subdirectory (h5jam) #-- Add the h5copy and test executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5copy) +add_subdirectory (h5copy) #-- Add the h5stat and test executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5stat) +add_subdirectory (h5stat) #-- Add the h5dump and test executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5dump) +add_subdirectory (h5dump) #-- Add the h5format_convert and test executables -add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5format_convert) +add_subdirectory (h5format_convert) diff --git a/tools/src/h5copy/CMakeLists.txt b/tools/src/h5copy/CMakeLists.txt index d1f5f50..8423e5a 100644 --- a/tools/src/h5copy/CMakeLists.txt +++ b/tools/src/h5copy/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_SRC_H5COPY) #----------------------------------------------------------------------------- @@ -10,7 +10,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # Add the h5copy and test executables # -------------------------------------------------------------------- add_executable (h5copy ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) -TARGET_NAMING (h5copy STATIC) TARGET_C_PROPERTIES (h5copy STATIC " " " ") target_link_libraries (h5copy ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5copy PROPERTIES FOLDER tools) @@ -20,7 +19,6 @@ set (H5_DEP_EXECUTABLES h5copy) if (BUILD_SHARED_LIBS) add_executable (h5copy-shared ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) - TARGET_NAMING (h5copy-shared SHARED) TARGET_C_PROPERTIES (h5copy-shared SHARED " " " ") target_link_libraries (h5copy-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5copy-shared PROPERTIES FOLDER tools) @@ -39,10 +37,9 @@ endif () # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_PROGRAM_PDB (h5copy-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) - endif () - INSTALL_PROGRAM_PDB (h5copy ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c index 1d15d12..1800810 100644 --- a/tools/src/h5copy/h5copy.c +++ b/tools/src/h5copy/h5copy.c @@ -293,7 +293,7 @@ main (int argc, const char *argv[]) break; case 'E': - enable_error_stack = TRUE; + enable_error_stack = 1; break; default: @@ -330,7 +330,7 @@ main (int argc, const char *argv[]) leave(EXIT_FAILURE); } - if (enable_error_stack) { + if (enable_error_stack > 0) { H5Eset_auto2(H5E_DEFAULT, func, edata); H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); } diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt index 00d93de..9e9f1ea 100644 --- a/tools/src/h5diff/CMakeLists.txt +++ b/tools/src/h5diff/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_SRC_H5DIFF) #----------------------------------------------------------------------------- @@ -13,7 +13,6 @@ add_executable (h5diff ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c ) -TARGET_NAMING (h5diff STATIC) TARGET_C_PROPERTIES (h5diff STATIC " " " ") target_link_libraries (h5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5diff PROPERTIES FOLDER tools) @@ -26,7 +25,6 @@ if (BUILD_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c ) - TARGET_NAMING (h5diff-shared SHARED) TARGET_C_PROPERTIES (h5diff-shared SHARED " " " ") target_link_libraries (h5diff-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5diff-shared PROPERTIES FOLDER tools) @@ -40,7 +38,6 @@ if (H5_HAVE_PARALLEL) ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c ) - TARGET_NAMING (ph5diff STATIC) TARGET_C_PROPERTIES (ph5diff STATIC " " " ") target_link_libraries (ph5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (ph5diff PROPERTIES FOLDER tools) @@ -57,10 +54,9 @@ endif () # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_PROGRAM_PDB (h5diff-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) - endif () - INSTALL_PROGRAM_PDB (h5diff ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c index ce5df78..8f09c81 100644 --- a/tools/src/h5diff/h5diff_common.c +++ b/tools/src/h5diff/h5diff_common.c @@ -178,7 +178,7 @@ void parse_command_line(int argc, break; case 'S': - enable_error_stack = TRUE; + enable_error_stack = 1; break; case 'E': diff --git a/tools/src/h5diff/h5diff_main.c b/tools/src/h5diff/h5diff_main.c index ad488a4..c5a0cbf 100644 --- a/tools/src/h5diff/h5diff_main.c +++ b/tools/src/h5diff/h5diff_main.c @@ -100,7 +100,7 @@ int main(int argc, const char *argv[]) */ parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts); - if (enable_error_stack) { + if (enable_error_stack > 0) { H5Eset_auto2(H5E_DEFAULT, func, edata); H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); } diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt index 65a7cdd..1133218 100644 --- a/tools/src/h5dump/CMakeLists.txt +++ b/tools/src/h5dump/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_SRC_H5DUMP) #----------------------------------------------------------------------------- @@ -14,7 +14,6 @@ add_executable (h5dump ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c ) -TARGET_NAMING (h5dump STATIC) TARGET_C_PROPERTIES (h5dump STATIC " " " ") target_link_libraries (h5dump ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5dump PROPERTIES FOLDER tools) @@ -28,7 +27,6 @@ if (BUILD_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c ) - TARGET_NAMING (h5dump-shared SHARED) TARGET_C_PROPERTIES (h5dump-shared SHARED " " " ") target_link_libraries (h5dump-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5dump-shared PROPERTIES FOLDER tools) @@ -47,10 +45,9 @@ endif () # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_PROGRAM_PDB (h5dump-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) - endif () - INSTALL_PROGRAM_PDB (h5dump ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index b90d60f..25e4858 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -67,7 +67,7 @@ struct handler_t { */ /* The following initialization makes use of C language cancatenating */ /* "xxx" "yyy" into "xxxyyy". */ -static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RECM:O*N:vG:"; +static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RE*CM:O*N:vG:"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "hel", no_arg, 'h' }, @@ -181,7 +181,7 @@ static struct long_options l_opts[] = { { "sort_order", require_arg, 'z' }, { "format", require_arg, 'm' }, { "region", no_arg, 'R' }, - { "enable-error-stack", no_arg, 'E' }, + { "enable-error-stack", optional_arg, 'E' }, { "packed-bits", require_arg, 'M' }, { "no-compact-subset", no_arg, 'C' }, { "ddl", optional_arg, 'O' }, @@ -191,7 +191,7 @@ static struct long_options l_opts[] = { { NULL, 0, '\0' } }; - + /*------------------------------------------------------------------------- * Function: leave * @@ -214,7 +214,7 @@ leave(int ret) HDexit(ret); } - + /*------------------------------------------------------------------------- * Function: usage * @@ -273,8 +273,8 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " -m T, --format=T Set the floating point output format\n"); PRINTVALSTREAM(rawoutstream, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n"); PRINTVALSTREAM(rawoutstream, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n"); - PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n"); - PRINTVALSTREAM(rawoutstream, " occur.\n"); + PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they occur.\n"); + PRINTVALSTREAM(rawoutstream, " Optional value 2 also prints file open errors.\n"); PRINTVALSTREAM(rawoutstream, " --no-compact-subset Disable compact form of subsetting and allow the use\n"); PRINTVALSTREAM(rawoutstream, " of \"[\" in dataset names.\n"); PRINTVALSTREAM(rawoutstream, " -w N, --width=N Set the number of columns of output. A value of 0 (zero)\n"); @@ -366,7 +366,7 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, "\n"); } - + /*------------------------------------------------------------------------- * Function: table_list_add * @@ -419,7 +419,7 @@ table_list_add(hid_t oid, unsigned long file_no) return((ssize_t) idx); } /* end table_list_add() */ - + /*------------------------------------------------------------------------- * Function: table_list_visited * @@ -449,7 +449,7 @@ table_list_visited(unsigned long file_no) return(-1); } /* end table_list_visited() */ - + /*------------------------------------------------------------------------- * Function: table_list_free * @@ -817,7 +817,7 @@ parse_mask_list(const char *h_list) } } - + /*------------------------------------------------------------------------- * Function: free_handler * @@ -865,7 +865,7 @@ free_handler(struct handler_t *hand, int len) } } - + /*------------------------------------------------------------------------- * Function: parse_command_line * @@ -920,9 +920,8 @@ parse_start: case 'n': display_fi = TRUE; last_was_dset = FALSE; - if ( opt_arg != NULL) { + if (opt_arg != NULL) h5trav_set_verbose(HDatoi(opt_arg)); - } break; case 'p': display_dcpl = TRUE; @@ -939,8 +938,9 @@ parse_start: last_was_dset = FALSE; break; case 'A': - if ( opt_arg != NULL) { - if(0 == HDatoi(opt_arg)) include_attrs = FALSE; + if (opt_arg != NULL) { + if(0 == HDatoi(opt_arg)) + include_attrs = FALSE; } else { display_data = FALSE; @@ -1059,7 +1059,7 @@ parse_start: break; case 'o': - if ( bin_output ) { + if (bin_output) { if (h5tools_set_data_output_file(opt_arg, 1) < 0) { usage(h5tools_getprogname()); goto error; @@ -1086,8 +1086,8 @@ parse_start: break; case 'b': - if ( opt_arg != NULL) { - if ( ( bin_form = set_binary_form(opt_arg)) < 0) { + if (opt_arg != NULL) { + if ((bin_form = set_binary_form(opt_arg)) < 0) { /* failed to set binary form */ usage(h5tools_getprogname()); goto error; @@ -1106,7 +1106,7 @@ parse_start: break; case 'q': - if ( ( sort_by = set_sort_by(opt_arg)) < 0) { + if ((sort_by = set_sort_by(opt_arg)) < 0) { /* failed to set "sort by" form */ usage(h5tools_getprogname()); goto error; @@ -1114,7 +1114,7 @@ parse_start: break; case 'z': - if ( ( sort_order = set_sort_order(opt_arg)) < 0) { + if ((sort_order = set_sort_order(opt_arg)) < 0) { /* failed to set "sort order" form */ usage(h5tools_getprogname()); goto error; @@ -1268,7 +1268,10 @@ end_collect: /** end subsetting parameters **/ case 'E': - enable_error_stack = TRUE; + if (opt_arg != NULL) + enable_error_stack = HDatoi(opt_arg); + else + enable_error_stack = 1; break; case 'C': disable_compact_subset = TRUE; @@ -1306,7 +1309,7 @@ error: return hand; } - + /*------------------------------------------------------------------------- * Function: main * @@ -1388,7 +1391,7 @@ main(int argc, const char *argv[]) goto done; } - if (enable_error_stack) { + if (enable_error_stack > 0) { H5Eset_auto2(H5E_DEFAULT, func, edata); H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); } @@ -1764,7 +1767,7 @@ h5_fileaccess(void) return fapl; } - + /*------------------------------------------------------------------------- * Function: init_prefix * @@ -1785,7 +1788,7 @@ init_prefix(char **prfx, size_t prfx_len) error_msg("unable to allocate prefix buffer\n"); } - + /*------------------------------------------------------------------------- * Function: add_prefix * diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c index eecd113..6646626 100644 --- a/tools/src/h5dump/h5dump_ddl.c +++ b/tools/src/h5dump/h5dump_ddl.c @@ -155,7 +155,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED * return ret; } - + /*------------------------------------------------------------------------- * Function: dump_all_cb * @@ -291,7 +291,6 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -303,7 +302,6 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -327,7 +325,6 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR } else if(found_obj->displayed) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -348,7 +345,6 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -436,7 +432,6 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR /* 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); @@ -447,7 +442,6 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -472,7 +466,6 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -501,7 +494,6 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -509,7 +501,6 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR 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); @@ -522,7 +513,6 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR } /* end else */ } /* end else */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -544,7 +534,6 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR case H5L_TYPE_HARD: default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -556,7 +545,6 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR ctx.indent_level++; 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, "LINKCLASS %d", linfo->type); @@ -565,7 +553,6 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR ctx.indent_level--; 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->udlinkblockend)) { @@ -926,7 +913,6 @@ dump_group(hid_t gid, const char *name) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1169,7 +1155,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index) h5tools_dump_data(rawoutstream, outputformat, &ctx, obj_id, print_dataset, sset, display_index, display_char); } - + /*------------------------------------------------------------------------- * Function: dump_fcpl * @@ -1614,7 +1600,6 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H HDmemset(&buffer, 0, sizeof(h5tools_str_t)); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1626,7 +1611,6 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H error_msg("unable to open object \"%s\"\n", obj_name); 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->attributeblockend)) { @@ -2081,7 +2065,7 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe } } - + /*------------------------------------------------------------------------- * Function: dump_extlink * diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index a83ec08..4e13df3 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -231,7 +231,6 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -243,7 +242,6 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -278,7 +276,6 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -298,7 +295,6 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -310,7 +306,6 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -405,7 +400,6 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ 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); @@ -427,7 +421,6 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ 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); @@ -492,7 +485,6 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -539,7 +531,6 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -905,7 +896,6 @@ xml_print_datatype(hid_t type, unsigned in_group) as it's name. */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -918,7 +908,6 @@ xml_print_datatype(hid_t type, unsigned in_group) char *t_objname = xml_escape_the_name(found_obj->objname); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -931,7 +920,6 @@ xml_print_datatype(hid_t type, unsigned in_group) } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -944,7 +932,6 @@ xml_print_datatype(hid_t type, unsigned in_group) switch (H5Tget_class(type)) { case H5T_INTEGER: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -957,7 +944,6 @@ xml_print_datatype(hid_t type, unsigned in_group) sgn = H5Tget_sign(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1002,7 +988,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1018,7 +1003,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ord = H5Tget_order(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1027,7 +1011,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1061,7 +1044,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1071,7 +1053,6 @@ xml_print_datatype(hid_t type, unsigned in_group) case H5T_TIME: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1080,7 +1061,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1090,7 +1070,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1106,7 +1085,6 @@ xml_print_datatype(hid_t type, unsigned in_group) is_vlstr = H5Tis_variable_str(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1116,7 +1094,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1144,7 +1121,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1157,7 +1133,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ord = H5Tget_order(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1166,7 +1141,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1193,7 +1167,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1205,7 +1178,6 @@ xml_print_datatype(hid_t type, unsigned in_group) /* <hdf5:OpaqueType Tag="tag" Size="bytes" /> */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1215,7 +1187,6 @@ xml_print_datatype(hid_t type, unsigned in_group) mname = H5Tget_tag(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1227,7 +1198,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1242,7 +1212,6 @@ xml_print_datatype(hid_t type, unsigned in_group) nmembers = (unsigned)H5Tget_nmembers(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1262,7 +1231,6 @@ xml_print_datatype(hid_t type, unsigned in_group) t_fname = xml_escape_the_name(mname); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1275,7 +1243,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1288,7 +1255,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1298,7 +1264,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1309,7 +1274,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1319,7 +1283,6 @@ xml_print_datatype(hid_t type, unsigned in_group) case H5T_REFERENCE: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1329,7 +1292,6 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Only Object references supported at this time */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1338,7 +1300,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1347,7 +1308,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1356,7 +1316,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1369,7 +1328,6 @@ xml_print_datatype(hid_t type, unsigned in_group) nmembs = H5Tget_nmembers(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1379,7 +1337,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1388,7 +1345,6 @@ xml_print_datatype(hid_t type, unsigned in_group) xml_print_enum(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1398,7 +1354,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1408,7 +1363,6 @@ xml_print_datatype(hid_t type, unsigned in_group) case H5T_VLEN: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1419,7 +1373,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1432,7 +1385,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1442,7 +1394,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1458,7 +1409,6 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Print lead-in */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1474,7 +1424,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; 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); @@ -1487,7 +1436,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1500,7 +1448,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1510,7 +1457,6 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1524,7 +1470,6 @@ xml_print_datatype(hid_t type, unsigned in_group) case H5T_NCLASSES: default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1606,7 +1551,6 @@ xml_dump_datatype(hid_t type) */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1619,7 +1563,6 @@ xml_dump_datatype(hid_t type) char *t_objname = xml_escape_the_name(found_obj->objname); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1632,7 +1575,6 @@ xml_dump_datatype(hid_t type) } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1642,7 +1584,6 @@ xml_dump_datatype(hid_t type) } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1655,7 +1596,6 @@ xml_dump_datatype(hid_t type) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1720,7 +1660,6 @@ xml_dump_dataspace(hid_t space) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1733,7 +1672,6 @@ xml_dump_dataspace(hid_t space) /* scalar dataspace (just a tag, no XML attrs. defined */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1746,7 +1684,6 @@ xml_dump_dataspace(hid_t space) /* <hdf5:SimpleDataspace Ndims="nd"> */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1758,7 +1695,6 @@ xml_dump_dataspace(hid_t space) for (i = 0; i < ndims; i++) { if (maxsize[i] == H5S_UNLIMITED) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1768,7 +1704,6 @@ xml_dump_dataspace(hid_t space) } else if (maxsize[i] == (hsize_t) 0) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1778,7 +1713,6 @@ xml_dump_dataspace(hid_t space) } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1790,7 +1724,6 @@ xml_dump_dataspace(hid_t space) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1805,7 +1738,6 @@ xml_dump_dataspace(hid_t space) 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, "<%sNullDataspace />",xmlnsprefix); @@ -1817,7 +1749,6 @@ xml_dump_dataspace(hid_t space) case H5S_NO_CLASS: default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1828,7 +1759,6 @@ xml_dump_dataspace(hid_t space) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1899,7 +1829,6 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, outputformat = &string_dataformat; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1909,7 +1838,6 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2005,7 +1933,6 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2031,7 +1958,6 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2092,7 +2018,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED outputformat = &string_dataformat; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2128,7 +2053,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2136,7 +2060,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED 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); @@ -2144,7 +2067,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED 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); @@ -2152,7 +2074,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED 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); @@ -2160,7 +2081,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED 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); @@ -2173,7 +2093,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED case H5T_COMPOUND: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2184,7 +2103,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED case H5T_REFERENCE: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2192,7 +2110,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); if (!H5Tequal(type, H5T_STD_REF_OBJ)) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2200,7 +2117,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED 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); @@ -2209,7 +2125,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2219,7 +2134,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED xml_print_refs(attr_id, ATTRIBUTE_DATA); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2228,7 +2142,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED } ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2238,7 +2151,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED case H5T_VLEN: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2251,7 +2163,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED case H5T_NCLASSES: default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2259,7 +2170,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED 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); @@ -2267,7 +2177,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED 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); @@ -2275,7 +2184,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED 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); @@ -2288,7 +2196,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED /* The case of an attribute never yet written ?? * Or dataspace is H5S_NULL. */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2298,7 +2205,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2308,7 +2214,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2323,7 +2228,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED H5Aclose(attr_id); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2338,7 +2242,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2348,7 +2251,6 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2435,7 +2337,6 @@ xml_dump_named_datatype(hid_t type, const char *name) */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2450,7 +2351,6 @@ xml_dump_named_datatype(hid_t type, const char *name) H5O_info_t oinfo; /* Object info */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2487,7 +2387,6 @@ xml_dump_named_datatype(hid_t type, const char *name) xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2497,7 +2396,6 @@ xml_dump_named_datatype(hid_t type, const char *name) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2515,7 +2413,6 @@ xml_dump_named_datatype(hid_t type, const char *name) dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2529,7 +2426,6 @@ xml_dump_named_datatype(hid_t type, const char *name) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2540,7 +2436,6 @@ xml_dump_named_datatype(hid_t type, const char *name) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2680,7 +2575,6 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID("/", grpxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2695,7 +2589,6 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID(par, parentxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2715,7 +2608,6 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID(par, parentxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2739,7 +2631,6 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID("/", grpxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2755,7 +2646,6 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID(par, parentxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2825,7 +2715,6 @@ xml_dump_group(hid_t gid, const char *name) char *parentxid = (char *)HDmalloc((size_t)100); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2898,7 +2787,6 @@ xml_dump_group(hid_t gid, const char *name) } ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3025,7 +2913,6 @@ xml_print_refs(hid_t did, int source) if (!path) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3036,7 +2923,6 @@ xml_print_refs(hid_t did, int source) char *t_path = xml_escape_the_string(path, -1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3182,7 +3068,6 @@ xml_print_strs(hid_t did, int source) if (!onestring) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3290,7 +3175,6 @@ check_filters(hid_t dcpl) if (filter == H5Z_FILTER_DEFLATE) { ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3309,7 +3193,6 @@ check_filters(hid_t dcpl) else if (filter == H5Z_FILTER_FLETCHER32) { ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3320,7 +3203,6 @@ check_filters(hid_t dcpl) else if (filter == H5Z_FILTER_SHUFFLE) { ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3332,7 +3214,6 @@ check_filters(hid_t dcpl) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3426,7 +3307,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3444,7 +3324,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) const char * path = lookup_ref_path(*(hobj_ref_t *) buf); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3452,7 +3331,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); if (!path) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3463,7 +3341,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) char *t_path = xml_escape_the_string(path, -1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3473,7 +3350,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) } ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3483,7 +3359,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) else if (H5Tget_class(type) == H5T_STRING) { /* ????? */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3491,7 +3366,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) 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); @@ -3503,7 +3377,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) switch (H5Tget_class(type)) { case H5T_INTEGER: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3519,7 +3392,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) 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); @@ -3528,7 +3400,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) break; case H5T_FLOAT: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3544,7 +3415,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) 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); @@ -3554,7 +3424,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) case H5T_BITFIELD: case H5T_OPAQUE: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3576,7 +3445,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) 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); @@ -3585,7 +3453,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) break; case H5T_ENUM: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3603,7 +3470,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) if(name) H5free_memory(name); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3612,7 +3478,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) break; case H5T_ARRAY: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3620,7 +3485,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) 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); @@ -3629,7 +3493,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) break; case H5T_TIME: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3637,7 +3500,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) 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); @@ -3646,7 +3508,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) break; case H5T_COMPOUND: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3654,7 +3515,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) 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); @@ -3663,7 +3523,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) break; case H5T_VLEN: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3671,7 +3530,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) 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); @@ -3684,7 +3542,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) case H5T_REFERENCE: default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3692,7 +3549,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) 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); @@ -3706,7 +3562,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3793,7 +3648,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s xml_name_to_XID(prefix, pstr, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3828,7 +3682,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3838,7 +3691,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3853,7 +3705,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s 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); @@ -3862,7 +3713,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s } ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3876,7 +3726,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3887,7 +3736,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3897,7 +3745,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3912,7 +3759,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3921,7 +3767,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3930,7 +3775,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3942,7 +3786,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3951,7 +3794,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3960,7 +3802,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3976,7 +3817,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4025,7 +3865,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4037,7 +3876,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4050,7 +3888,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s } ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4061,7 +3898,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4114,7 +3950,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4122,7 +3957,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s 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); @@ -4130,7 +3964,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s 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); @@ -4138,7 +3971,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s 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); @@ -4150,7 +3982,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s case H5T_COMPOUND: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4166,7 +3997,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s case H5T_REFERENCE: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4174,7 +4004,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); if (!H5Tequal(type, H5T_STD_REF_OBJ)) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4182,7 +4011,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s 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); @@ -4191,7 +4019,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4201,7 +4028,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s xml_print_refs(did, DATASET_DATA); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4210,7 +4036,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s } ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4222,7 +4047,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s ctx.indent_level--; dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4241,7 +4065,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s case H5T_NCLASSES: default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4249,7 +4072,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s 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); @@ -4257,7 +4079,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s 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); @@ -4265,7 +4086,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s 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); @@ -4279,7 +4099,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4288,7 +4107,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4297,7 +4115,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4311,7 +4128,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s H5Pclose(dcpl); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4377,7 +4193,6 @@ xml_print_enum(hid_t type) super = H5Tget_super(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4387,7 +4202,6 @@ xml_print_enum(hid_t type) xml_print_datatype(super,0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4438,7 +4252,6 @@ xml_print_enum(hid_t type) char *t_name = xml_escape_the_name(name[i]); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4456,7 +4269,6 @@ xml_print_enum(hid_t type) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4464,7 +4276,6 @@ xml_print_enum(hid_t type) 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); @@ -4494,7 +4305,6 @@ xml_print_enum(hid_t type) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt index fa3abc0..4acc999 100644 --- a/tools/src/h5format_convert/CMakeLists.txt +++ b/tools/src/h5format_convert/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_SRC_H5FC) #----------------------------------------------------------------------------- @@ -10,7 +10,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # Add the h5format_convert executables # -------------------------------------------------------------------- add_executable (h5format_convert ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c) -TARGET_NAMING (h5format_convert STATIC) TARGET_C_PROPERTIES (h5format_convert STATIC " " " ") target_link_libraries (h5format_convert ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5format_convert PROPERTIES FOLDER tools) @@ -28,11 +27,13 @@ set (H5_DEP_EXECUTABLES h5format_convert) # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - INSTALL_PROGRAM_PDB (h5format_convert ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS - h5format_convert + ${H5_DEP_EXECUTABLES} EXPORT ${HDF5_EXPORTED_TARGETS} RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications diff --git a/tools/src/h5import/CMakeLists.txt b/tools/src/h5import/CMakeLists.txt index 9a61beb..d628c9b 100644 --- a/tools/src/h5import/CMakeLists.txt +++ b/tools/src/h5import/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_SRC_H5IMPORT) #----------------------------------------------------------------------------- @@ -10,7 +10,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # Add the h5import executables # -------------------------------------------------------------------- add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c) -TARGET_NAMING (h5import STATIC) TARGET_C_PROPERTIES (h5import STATIC " " " ") target_link_libraries (h5import ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) #set_target_properties (h5import PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT) @@ -29,11 +28,13 @@ set (H5_DEP_EXECUTABLES h5import) # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - INSTALL_PROGRAM_PDB (h5import ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS - h5import + ${H5_DEP_EXECUTABLES} EXPORT ${HDF5_EXPORTED_TARGETS} RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 36a8c21..76e78af 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -1405,7 +1405,7 @@ static int processConfigurationFile(char *infile, struct Input *in) const char *err14a = "COMPRESSION-PARAM keyword appears twice in %s.\n"; const char *err14b = "Error in retrieving the compression parameter from %s.\n"; const char *err15a = "EXTERNAL-STORAGE keyword appears twice in %s.\n"; - const char *err15b = "Error in retrieving the external storage paramters from %s.\n"; + const char *err15b = "Error in retrieving the external storage parameters from %s.\n"; const char *err16a = "MAXIMUM-DIMENSIONS keyword appears twice in %s.\n"; const char *err16b = "MAXIMUM-DIMENSIONS cannot appear before DIMENSION-SIZES are provided.\n"; const char *err16c = "Error in retrieving the maximum dimension sizes from %s.\n"; @@ -3690,7 +3690,7 @@ static int getCompressionParameter(struct Input *in, FILE *strm) { /* currently supports only GZIP */ /* can be extended by adding more values to COMPRESSION-TYPE and */ - /* handling the paramters here by adding more cases */ + /* handling the parameters here by adding more cases */ int ival; const char *err1 = "Unable to get integer value.\n"; diff --git a/tools/src/h5jam/CMakeLists.txt b/tools/src/h5jam/CMakeLists.txt index 3cca771..59caf44 100644 --- a/tools/src/h5jam/CMakeLists.txt +++ b/tools/src/h5jam/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_SRC_H5JAM) #----------------------------------------------------------------------------- @@ -10,14 +10,12 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # Add the h5jam executables # -------------------------------------------------------------------- add_executable (h5jam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c) -TARGET_NAMING (h5jam STATIC) TARGET_C_PROPERTIES (h5jam STATIC " " " ") target_link_libraries (h5jam ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5jam PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam") add_executable (h5unjam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c) -TARGET_NAMING (h5unjam STATIC) TARGET_C_PROPERTIES (h5unjam STATIC " " " ") target_link_libraries (h5unjam ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5unjam PROPERTIES FOLDER tools) @@ -38,11 +36,13 @@ set (H5_DEP_EXECUTABLES # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - INSTALL_PROGRAM_PDB (h5jam ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS - h5jam h5unjam + ${H5_DEP_EXECUTABLES} EXPORT ${HDF5_EXPORTED_TARGETS} RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt index 2e23634..e9ecd44 100644 --- a/tools/src/h5ls/CMakeLists.txt +++ b/tools/src/h5ls/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_SRC_H5LS) #----------------------------------------------------------------------------- @@ -10,7 +10,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # Add the h5ls executable #----------------------------------------------------------------------------- add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) -TARGET_NAMING (h5ls STATIC) TARGET_C_PROPERTIES (h5ls STATIC " " " ") target_link_libraries (h5ls ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5ls PROPERTIES FOLDER tools) @@ -20,7 +19,6 @@ set (H5_DEP_EXECUTABLES h5ls) if (BUILD_SHARED_LIBS) add_executable (h5ls-shared ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) - TARGET_NAMING (h5ls-shared SHARED) TARGET_C_PROPERTIES (h5ls-shared SHARED " " " ") target_link_libraries (h5ls-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5ls-shared PROPERTIES FOLDER tools) @@ -39,10 +37,9 @@ endif () # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_PROGRAM_PDB (h5ls-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) - endif () - INSTALL_PROGRAM_PDB (h5ls ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS diff --git a/tools/src/h5repack/CMakeLists.txt b/tools/src/h5repack/CMakeLists.txt index 81e6275..211c947 100644 --- a/tools/src/h5repack/CMakeLists.txt +++ b/tools/src/h5repack/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_SRC_H5REPACK) #----------------------------------------------------------------------------- @@ -21,7 +21,6 @@ set (REPACK_COMMON_SOURCES ) add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) -TARGET_NAMING (h5repack STATIC) TARGET_C_PROPERTIES (h5repack STATIC " " " ") target_link_libraries (h5repack ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5repack PROPERTIES FOLDER tools) @@ -31,7 +30,6 @@ set (H5_DEP_EXECUTABLES h5repack) if (BUILD_SHARED_LIBS) add_executable (h5repack-shared ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) - TARGET_NAMING (h5repack-shared SHARED) TARGET_C_PROPERTIES (h5repack-shared SHARED " " " ") target_link_libraries (h5repack-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5repack-shared PROPERTIES FOLDER tools) @@ -50,10 +48,9 @@ endif () # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_PROGRAM_PDB (h5repack-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) - endif () - INSTALL_PROGRAM_PDB (h5repack ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index c98575c..e7f4aae 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -75,6 +75,8 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest) options->verbose = verbose; options->latest = latest; options->layout_g = H5D_LAYOUT_ERROR; + options->low_bound = H5F_LIBVER_EARLIEST; + options->high_bound = H5F_LIBVER_LATEST; for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) { options->filter_g[n].filtn = -1; diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h index 0252768..a0e0387 100644 --- a/tools/src/h5repack/h5repack.h +++ b/tools/src/h5repack/h5repack.h @@ -101,21 +101,23 @@ typedef struct { /* all the above, ready to go to the hrepack call */ typedef struct { - pack_opttbl_t *op_tbl; /*table with all -c and -f options */ - int all_layout; /*apply the layout to all objects */ - int all_filter; /*apply the filter to all objects */ + pack_opttbl_t *op_tbl; /*table with all -c and -f options */ + int all_layout; /*apply the layout to all objects */ + int all_filter; /*apply the filter to all objects */ filter_info_t filter_g[H5_REPACK_MAX_NFILTERS]; /*global filter array for the ALL case */ - int n_filter_g; /*number of global filters */ - chunk_info_t chunk_g; /*global chunk INFO for the ALL case */ - H5D_layout_t layout_g; /*global layout information for the ALL case */ - int verbose; /*verbose mode */ - hsize_t min_comp; /*minimum size to compress, in bytes */ - int use_native; /*use a native type in write */ - hbool_t latest; /*pack file with the latest file format */ - int grp_compact; /* Set the maximum number of links to store as header messages in the group */ - int grp_indexed; /* Set the minimum number of links to store in the indexed format */ - int msg_size[8]; /* Minimum size of shared messages: dataspace, - datatype, fill value, filter pipleline, attribute */ + int n_filter_g; /*number of global filters */ + chunk_info_t chunk_g; /*global chunk INFO for the ALL case */ + H5D_layout_t layout_g; /*global layout information for the ALL case */ + int verbose; /*verbose mode */ + hsize_t min_comp; /*minimum size to compress, in bytes */ + int use_native; /*use a native type in write */ + hbool_t latest; /*pack file with the latest file format */ + H5F_libver_t low_bound; /* The file's low bound as in H5Fset_libver_bounds() */ + H5F_libver_t high_bound; /* The file's high bound as in H5Fset_libver_bounds() */ + int grp_compact; /* Set the maximum number of links to store as header messages in the group */ + int grp_indexed; /* Set the minimum number of links to store in the indexed format */ + int msg_size[8]; /* Minimum size of shared messages: dataspace, + datatype, fill value, filter pipleline, attribute */ const char *ublock_filename; /* user block file name */ hsize_t ublock_size; /* user block size */ hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */ diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index e205fba..b279cf9 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -142,8 +142,18 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed to close property list"); } + if(options->latest) + options->low_bound = options->high_bound = H5F_LIBVER_LATEST; + /* Create file access property list */ + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list"); + + /* It can be default, latest or other settings by users */ + if(H5Pset_libver_bounds(fapl, options->low_bound, options->high_bound) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_libver_bounds failed to set format version bounds"); + /* Check if we need to create a non-default file creation property list */ - if (options->latest || ub_size > 0) { + if (options->low_bound >= H5F_LIBVER_V18 || ub_size > 0) { /* Create file creation property list */ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list"); @@ -152,7 +162,7 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) if (H5Pset_userblock(fcpl, ub_size) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_userblock failed to set non-default userblock size"); - if (options->latest) { + if (options->low_bound >= H5F_LIBVER_V18) { unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5]; /* Adjust group creation parameters for root group */ @@ -203,12 +213,6 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shared_mesg_index failed to configure the specified shared object header message index"); } /* if (nindex>0) */ - /* Create file access property list */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list"); - - if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_libver_bounds failed to set property for using latest version of the format"); } /* end if */ } /* end if */ #if defined (H5REPACK_DEBUG_USER_BLOCK) diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c index 067ebad..0092abc 100644 --- a/tools/src/h5repack/h5repack_filters.c +++ b/tools/src/h5repack/h5repack_filters.c @@ -84,7 +84,8 @@ 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; + char *pdest = NULL; + char *pname = NULL; int result; unsigned int i; @@ -94,11 +95,12 @@ static int aux_find_obj(const char* name, /* object name from traverse list */ return (int) i; } - pdest = HDstrstr(name, options->op_tbl->objs[i].path); - result = (int) (pdest - name); + pdest = options->op_tbl->objs[i].path; + if (pdest[0] == '/') pdest++; + pname = name; + if (pname[0] == '/') pname++; - /* found at position 1, meaning without '/' */ - if (pdest != NULL && result == 1) { + if (HDstrcmp(pdest, pname) == 0) { *obj = options->op_tbl->objs[i]; return (int) i; } @@ -278,25 +280,6 @@ int apply_filters(const char* name, /* object name from traverse list */ *has_filter = 1; if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Premove_filter failed"); - - /*------------------------------------------------------------------------- - * 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) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed"); - - if (layout == H5D_CHUNKED) { - if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); - obj.layout = H5D_CHUNKED; - obj.chunk.rank = rank; - for (i = 0; i < rank; i++) - obj.chunk.chunk_lengths[i] = chsize[i]; - } - } } else if(nfilters) { *has_filter = 1; @@ -305,6 +288,25 @@ int apply_filters(const char* name, /* object name from traverse list */ } /*------------------------------------------------------------------------- + * 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) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed"); + + if (layout == H5D_CHUNKED) { + if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); + obj.layout = H5D_CHUNKED; + obj.chunk.rank = rank; + for (i = 0; i < rank; i++) + obj.chunk.chunk_lengths[i] = chsize[i]; + } + } + + /*------------------------------------------------------------------------- * the type of filter and additional parameter * type can be one of the filters * H5Z_FILTER_NONE 0 , uncompress if compressed diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index d34c394..8f0178f 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -31,7 +31,7 @@ const char *outfile = NULL; * Command-line options: The user can specify short or long-named * parameters. */ -static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:M:t:a:i:o:S:P:T:G:q:z:E"; +static const char *s_opts = "hVvf:l:m:e:nLj:k:c:d:s:u:b:M:t:a:i:o:S:P:T:G:q:z:E"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "version", no_arg, 'V' }, @@ -42,6 +42,8 @@ static struct long_options l_opts[] = { { "file", require_arg, 'e' }, { "native", no_arg, 'n' }, { "latest", no_arg, 'L' }, + { "low", require_arg, 'j' }, + { "high", require_arg, 'k' }, { "compact", require_arg, 'c' }, { "indexed", require_arg, 'd' }, { "ssize", require_arg, 's' }, @@ -81,7 +83,13 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " -v, --verbose Verbose mode, print object information\n"); PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n"); PRINTVALSTREAM(rawoutstream, " -n, --native Use a native HDF5 type when repacking\n"); + PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n"); PRINTVALSTREAM(rawoutstream, " -L, --latest Use latest version of file format\n"); + PRINTVALSTREAM(rawoutstream, " This option will take precedence over the -j and -k options\n"); + PRINTVALSTREAM(rawoutstream, " --low=BOUND The low bound for library release versions to use when creating\n"); + PRINTVALSTREAM(rawoutstream, " objects in the file (default is H5F_LIBVER_EARLIEST)\n"); + PRINTVALSTREAM(rawoutstream, " --high=BOUND The high bound for library release versions to use when creating\n"); + PRINTVALSTREAM(rawoutstream, " objects in the file (default is H5F_LIBVER_LATEST)\n"); PRINTVALSTREAM(rawoutstream, " -c L1, --compact=L1 Maximum number of links in header messages\n"); PRINTVALSTREAM(rawoutstream, " -d L2, --indexed=L2 Minimum number of links in the indexed format\n"); PRINTVALSTREAM(rawoutstream, " -s S[:F], --ssize=S[:F] Shared object header message minimum size\n"); @@ -114,8 +122,12 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " F - is the shared object header message type, any of <dspace|dtype|fill|\n"); PRINTVALSTREAM(rawoutstream, " pline|attr>. If F is not specified, S applies to all messages\n"); PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n"); - PRINTVALSTREAM(rawoutstream, " occur.\n"); + PRINTVALSTREAM(rawoutstream, " BOUND is an integer indicating the library release versions to use when creating\n"); + PRINTVALSTREAM(rawoutstream, " objects in the file (see H5Pset_libver_bounds()):\n"); + PRINTVALSTREAM(rawoutstream, " 0: This is H5F_LIBVER_EARLIEST in H5F_libver_t struct\n"); + PRINTVALSTREAM(rawoutstream, " 1: This is H5F_LIBVER_V18 in H5F_libver_t struct\n"); + PRINTVALSTREAM(rawoutstream, " 2: This is H5F_LIBVER_V110 in H5F_libver_t struct\n"); + PRINTVALSTREAM(rawoutstream, " (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V110 for this release\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " FS_STRATEGY is a string indicating the file space strategy used:\n"); PRINTVALSTREAM(rawoutstream, " FSM_AGGR:\n"); @@ -205,6 +217,11 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " Using latest file format with maximum compact group size of 10 and\n"); PRINTVALSTREAM(rawoutstream, " and minimum shared datatype size of 20\n"); PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "5) h5repack --low=0 --high=1 file1 file2\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " Set low=H5F_LIBVER_EARLIEST and high=H5F_LIBVER_V18 via H5Pset_libver_bounds() when\n"); + PRINTVALSTREAM(rawoutstream, " creating the repacked file: file2\n"); + PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, "5) h5repack -f SHUF -f GZIP=1 file1 file2\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " Add both filters SHUF and GZIP in this order to all datasets\n"); @@ -500,6 +517,22 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) options->latest = TRUE; break; + case 'j': + options->low_bound = (H5F_libver_t)HDatoi(opt_arg); + if(options->low_bound < H5F_LIBVER_EARLIEST || options->low_bound > H5F_LIBVER_LATEST) { + error_msg("in parsing low bound\n"); + goto done; + } + break; + + case 'k': + options->high_bound = (H5F_libver_t)HDatoi(opt_arg); + if(options->high_bound < H5F_LIBVER_EARLIEST || options->high_bound > H5F_LIBVER_LATEST) { + error_msg("in parsing high bound\n"); + goto done; + } + break; + case 'c': options->grp_compact = HDatoi( opt_arg ); if (options->grp_compact > 0) @@ -634,8 +667,8 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) break; case 'E': - enable_error_stack = TRUE; - break; + enable_error_stack = 1; + break; default: break; @@ -727,7 +760,7 @@ int main(int argc, const char **argv) } } - if (enable_error_stack) { + if (enable_error_stack > 0) { H5Eset_auto2(H5E_DEFAULT, func, edata); H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); } diff --git a/tools/src/h5repack/h5repack_parse.c b/tools/src/h5repack/h5repack_parse.c index 05af197..03fcf0e 100644 --- a/tools/src/h5repack/h5repack_parse.c +++ b/tools/src/h5repack/h5repack_parse.c @@ -45,9 +45,9 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, int f, k, l, p, q, end_obj = -1, no_param = 0; unsigned j, n; char sobj[MAX_NC_NAME]; - char scomp[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - char stype[6] = {0, 0, 0, 0, 0, 0}; - char smask[3] = {0, 0, 0}; + char scomp[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + char stype[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + char smask[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; obj_list_t* obj_list = NULL; unsigned pixels_per_block; @@ -116,7 +116,6 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, if (c == '=' || i == len - 1) { if (c == '=') { /*one more parameter */ scomp[k] = '\0'; /*cut space */ - /*------------------------------------------------------------------------- * H5Z_FILTER_SZIP * szip has the format SZIP=<pixels per block,coding> @@ -236,8 +235,9 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, filt->cd_nelmts = HDstrtoull(stype, NULL, 0); p = 0; } - else + else { filt->cd_values[j++] = (unsigned)HDstrtoul(stype, NULL, 0); + } q = 0; u++; /* skip ',' */ } @@ -462,7 +462,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, return obj_list; } - + /*------------------------------------------------------------------------- * Function: parse_layout * diff --git a/tools/src/h5stat/CMakeLists.txt b/tools/src/h5stat/CMakeLists.txt index 9762dbb..7842aa8 100644 --- a/tools/src/h5stat/CMakeLists.txt +++ b/tools/src/h5stat/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_SRC_H5STAT) #----------------------------------------------------------------------------- @@ -10,7 +10,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # Add the h5stat executables # -------------------------------------------------------------------- add_executable (h5stat ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) -TARGET_NAMING (h5stat STATIC) TARGET_C_PROPERTIES (h5stat STATIC " " " ") target_link_libraries (h5stat ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5stat PROPERTIES FOLDER tools) @@ -20,7 +19,6 @@ set (H5_DEP_EXECUTABLES h5stat) if (BUILD_SHARED_LIBS) add_executable (h5stat-shared ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) - TARGET_NAMING (h5stat-shared SHARED) TARGET_C_PROPERTIES (h5stat-shared SHARED " " " ") target_link_libraries (h5stat-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5stat-shared PROPERTIES FOLDER tools) @@ -39,10 +37,9 @@ endif () # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_PROGRAM_PDB (h5stat-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) - endif () - INSTALL_PROGRAM_PDB (h5stat ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt index 1292628..948c6d4 100644 --- a/tools/src/misc/CMakeLists.txt +++ b/tools/src/misc/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_SRC_MISC) #----------------------------------------------------------------------------- @@ -11,28 +11,24 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # -------------------------------------------------------------------- #-- Misc Executables add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) -TARGET_NAMING (h5debug STATIC) TARGET_C_PROPERTIES (h5debug STATIC " " " ") target_link_libraries (h5debug ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5debug PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug") add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) -TARGET_NAMING (h5repart STATIC) TARGET_C_PROPERTIES (h5repart STATIC " " " ") target_link_libraries (h5repart ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5repart PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart") add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) -TARGET_NAMING (h5mkgrp STATIC) TARGET_C_PROPERTIES (h5mkgrp STATIC " " " ") target_link_libraries (h5mkgrp ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5mkgrp PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp") add_executable (h5clear ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) -TARGET_NAMING (h5clear STATIC) TARGET_C_PROPERTIES (h5clear STATIC " " " ") target_link_libraries (h5clear ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5clear PROPERTIES FOLDER tools) @@ -62,13 +58,13 @@ set (H5_DEP_EXECUTABLES # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - INSTALL_PROGRAM_PDB (h5debug ${HDF5_INSTALL_BIN_DIR} toolsapplications) - INSTALL_PROGRAM_PDB (h5repart ${HDF5_INSTALL_BIN_DIR} toolsapplications) - INSTALL_PROGRAM_PDB (h5mkgrp ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS - h5debug h5repart h5mkgrp + ${H5_DEP_EXECUTABLES} EXPORT ${HDF5_EXPORTED_TARGETS} RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index e3b989d..5724e1b 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -12,9 +12,11 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: A tool to clear the status_flags field from the file's superblock via -s option. - * A tool to remove cache image from the file via -m option. - * + * Purpose: A tool used to do the following: + * (1) -s, --status: clear the status_flags field from the file's superblock + * (2) -m, --image: remove the metadata cache image from the file + * (3) --increment=C: set the file's EOA to the maximum of (EOA, EOF) + C + * (4) --filesize: print the file's EOA and EOF */ #include "hdf5.h" #include "H5private.h" @@ -24,18 +26,25 @@ /* Name of tool */ #define PROGRAMNAME "h5clear" -/* Make this private property (defined in H5Fprivate.h) available to h5clear. */ -#define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags" +/* Make these private properties (defined in H5Fprivate.h) available to h5clear. */ +#define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags" +#define H5F_ACS_NULL_FSM_ADDR_NAME "null_fsm_addr" +#define H5F_ACS_SKIP_EOF_CHECK_NAME "skip_eof_check" + +/* Default increment is 1 megabytes for the --increment option */ +#define DEFAULT_INCREMENT 1024*1024 static char *fname_g = NULL; static hbool_t clear_status_flags = FALSE; static hbool_t remove_cache_image = FALSE; +static hbool_t print_filesize = FALSE; +static hbool_t increment_eoa_eof = FALSE; +static hsize_t increment = DEFAULT_INCREMENT; /* - * Command-line options: The user can specify short or long-named - * parameters. + * Command-line options: only publicize long options */ -static const char *s_opts = "hVsm"; +static const char *s_opts = "hVsmzi*"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "hel", no_arg, 'h'}, @@ -54,6 +63,21 @@ static struct long_options l_opts[] = { { "imag", no_arg, 'm' }, { "ima", no_arg, 'm' }, { "im", no_arg, 'm' }, + { "filesize", no_arg, 'z' }, + { "filesiz", no_arg, 'z' }, + { "filesi", no_arg, 'z' }, + { "files", no_arg, 'z' }, + { "file", no_arg, 'z' }, + { "fil", no_arg, 'z' }, + { "fi", no_arg, 'z' }, + { "increment", optional_arg, 'i' }, + { "incremen", optional_arg, 'i' }, + { "increme", optional_arg, 'i' }, + { "increm", optional_arg, 'i' }, + { "incre", optional_arg, 'i' }, + { "incr", optional_arg, 'i' }, + { "inc", optional_arg, 'i' }, + { "in", optional_arg, 'i' }, { NULL, 0, '\0' } }; @@ -76,6 +100,9 @@ static void usage(const char *prog) HDfprintf(stdout, " -V, --version Print version number and exit\n"); HDfprintf(stdout, " -s, --status Clear the status_flags field in the file's superblock\n"); HDfprintf(stdout, " -m, --image Remove the metadata cache image from the file\n"); + HDfprintf(stdout, " --filesize Print the file's EOA and EOF\n"); + HDfprintf(stdout, " --increment=C Set the file's EOA to the maximum of (EOA, EOF) + C for the file <file_name>\n"); + HDfprintf(stdout, " C is >= 0; C is optional and will default to 1M when not set"); HDfprintf(stdout, "\n"); HDfprintf(stdout, "Examples of use:\n"); HDfprintf(stdout, "\n"); @@ -84,6 +111,12 @@ static void usage(const char *prog) HDfprintf(stdout, "\n"); HDfprintf(stdout, "h5clear -m file_name\n"); HDfprintf(stdout, " Remove the metadata cache image from the HDF5 file <file_name>.\n"); + HDfprintf(stdout, "\n"); + HDfprintf(stdout, "h5clear --increment file_name\n"); + HDfprintf(stdout, " Set the EOA to the maximum of (EOA, EOF) + 1M for the file <file_name>.\n"); + HDfprintf(stdout, "\n"); + HDfprintf(stdout, "h5clear --increment=512 file_name\n"); + HDfprintf(stdout, " Set the EOA to the maximum of (EOA, EOF) + 512 for the file <file_name>.\n"); } /* usage() */ @@ -131,6 +164,18 @@ parse_command_line(int argc, const char **argv) remove_cache_image = TRUE; break; + case 'z': + print_filesize = TRUE; + break; + + case 'i': + increment_eoa_eof = TRUE; + if(opt_arg != NULL && (increment = HDatoi(opt_arg)) < 0) { + usage(h5tools_getprogname()); + goto done; + } + break; + default: usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); @@ -176,8 +221,24 @@ leave(int ret) /*------------------------------------------------------------------------- * Function: main * - * Purpose: To clear the status_flags field in the file's superblock (-s option). - * To remove the cache image from the file (-m option). + * Purpose: The options are: + * (1) -s, --status: clear the status_flags field from the file's superblock + * (2) -m, --image: remove the metadata cache image from the file + * (3) --increment=C: set the file's EOA to the maximum of (EOA, EOF) + C + * (4) --filesize: print the file's EOA and EOF + * + * The three options: -s, -m, and --increment will modify the file + * so the file is opened with write access. + * The --filesize option just prints the EOA and EOF, so the file + * is opened with read access. + * + * The -s option will activate the private property: + * --H5F_ACS_CLEAR_STATUS_FLAGS_NAME + * The --increment option will active these two private properties: + * --H5F_ACS_NULL_FSM_ADDR_NAME + * --H5F_ACS_SKIP_EOF_CHECK_NAME + * The --filesize will activate the private property: + * --H5F_ACS_SKIP_EOF_CHECK_NAME * * Return: Success: 0 * Failure: 1 @@ -187,11 +248,12 @@ leave(int ret) int main (int argc, const char *argv[]) { - char *fname = NULL; /* File name */ - hid_t fapl = -1; /* File access property list */ - hid_t fid = -1; /* File ID */ + char *fname = NULL; /* File name */ + hid_t fapl = -1; /* File access property list */ + hid_t fid = -1; /* File ID */ haddr_t image_addr; hsize_t image_len; + unsigned flags = H5F_ACC_RDWR; /* file access flags */ h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); @@ -209,12 +271,22 @@ main (int argc, const char *argv[]) if(fname_g == NULL) goto done; - if(!clear_status_flags && !remove_cache_image) { + /* Print usage/exit if not using at least one of the options */ + if(!clear_status_flags && !remove_cache_image && + !increment_eoa_eof && !print_filesize) { usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); goto done; } + /* Cannot combine the --filesize option with other options */ + if(print_filesize && + (clear_status_flags || remove_cache_image || increment_eoa_eof)) { + error_msg("Cannot combine --filesize with other options\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + /* Duplicate the file name */ fname = HDstrdup(fname_g); @@ -228,7 +300,7 @@ main (int argc, const char *argv[]) /* -s option */ if(clear_status_flags) { /* Set to clear the status_flags in the file's superblock */ - /* This is a private property used by h5clear only */ + /* Activate this private property */ if(H5Pset(fapl, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear_status_flags) < 0) { error_msg("H5Pset\n"); h5tools_setstatus(EXIT_FAILURE); @@ -236,12 +308,64 @@ main (int argc, const char *argv[]) } } - if((fid = h5tools_fopen(fname, H5F_ACC_RDWR, fapl, NULL, NULL, (size_t)0)) < 0) { + /* --increment option */ + if(increment_eoa_eof) { + /* Activate this private property */ + if(H5Pset(fapl, H5F_ACS_SKIP_EOF_CHECK_NAME, &increment_eoa_eof) < 0) { + error_msg("H5Pset\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + /* Activate this private property */ + if(H5Pset(fapl, H5F_ACS_NULL_FSM_ADDR_NAME, &increment_eoa_eof) < 0) { + error_msg("H5Pset\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + } + + /* --filesize option; open the file read-only */ + if(print_filesize) { + /* Activate this private property */ + if(H5Pset(fapl, H5F_ACS_SKIP_EOF_CHECK_NAME, &print_filesize) < 0) { + error_msg("H5Pset\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + flags = H5F_ACC_RDONLY; + } + + /* Open the file */ + if((fid = h5tools_fopen(fname, flags, fapl, NULL, NULL, (size_t)0)) < 0) { error_msg("h5tools_fopen\n"); h5tools_setstatus(EXIT_FAILURE); goto done; } + /* --filesize option */ + if(print_filesize) { + h5_stat_t st; /* Stat info call */ + haddr_t eoa; /* The EOA value */ + + /* Get the file's EOA and EOF */ + if(H5Fget_eoa(fid, &eoa) < 0 || HDstat(fname, &st) < 0) { + error_msg("H5Fget_eoa or HDstat\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + HDfprintf(stdout, "EOA is %a; EOF is %a \n", eoa, st.st_size); + } + + /* --increment option */ + if(increment_eoa_eof) { + /* Set the file's EOA to the maximum of (EOA, EOF) + increment */ + if(H5Fincrement_filesize(fid, increment) < 0) { + error_msg("H5Fset_eoa\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + } + /* -m option */ if(remove_cache_image) { if(H5Fget_mdc_image_info(fid, &image_addr, &image_len) < 0) { @@ -253,7 +377,9 @@ main (int argc, const char *argv[]) warn_msg("No cache image in the file\n"); } + h5tools_setstatus(EXIT_SUCCESS); + done: if(fname) HDfree(fname); diff --git a/tools/test/CMakeLists.txt b/tools/test/CMakeLists.txt index a7dd11f..f194d7a 100644 --- a/tools/test/CMakeLists.txt +++ b/tools/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_TEST) #----------------------------------------------------------------------------- @@ -7,34 +7,34 @@ PROJECT (HDF5_TOOLS_TEST) add_definitions (${HDF_EXTRA_C_FLAGS}) #-- Add the h5diff tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5diff) +add_subdirectory (h5diff) #-- Add the h5ls tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5ls) +add_subdirectory (h5ls) #-- Misc tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/misc) +add_subdirectory (misc) #-- Add the h5import tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5import) +add_subdirectory (h5import) #-- h5Repack tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5repack) +add_subdirectory (h5repack) #-- Add the h5jam tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5jam) +add_subdirectory (h5jam) #-- Add the h5copy tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5copy) +add_subdirectory (h5copy) #-- Add the h5stat tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5stat) +add_subdirectory (h5stat) #-- Add the h5dump tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5dump) +add_subdirectory (h5dump) #-- Add the h5format_convert and test executables -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5format_convert) +add_subdirectory (h5format_convert) #-- Add the perform tests -add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/perform) +add_subdirectory (perform) diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt index c57cd5e..1f817fb 100644 --- a/tools/test/h5copy/CMakeLists.txt +++ b/tools/test/h5copy/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_TEST_H5COPY) #----------------------------------------------------------------------------- @@ -12,7 +12,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) if (HDF5_BUILD_GENERATORS) add_executable (h5copygentest ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/h5copygentest.c) - TARGET_NAMING (h5copygentest STATIC) TARGET_C_PROPERTIES (h5copygentest STATIC " " " ") target_link_libraries (h5copygentest ${HDF5_LIB_TARGET}) set_target_properties (h5copygentest PROPERTIES FOLDER generator/tools) diff --git a/tools/test/h5copy/h5copygentest.c b/tools/test/h5copy/h5copygentest.c index 35f9132..9f5d916 100644 --- a/tools/test/h5copy/h5copygentest.c +++ b/tools/test/h5copy/h5copygentest.c @@ -225,7 +225,7 @@ static void gent_compressed(hid_t loc_id) /*------------------------------------------------------------------------- * Function: gent_named_vl * - * Purpose: Generate a variable lenght named datatype for a dataset in + * Purpose: Generate a variable length named datatype for a dataset in LOC_ID * *------------------------------------------------------------------------- diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt index 9a41fb3..aae6327 100644 --- a/tools/test/h5diff/CMakeLists.txt +++ b/tools/test/h5diff/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_TEST_H5DIFF) #----------------------------------------------------------------------------- @@ -11,7 +11,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (h5diffgentest ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/h5diffgentest.c) - TARGET_NAMING (h5diffgentest STATIC) TARGET_C_PROPERTIES (h5diffgentest STATIC " " " ") target_link_libraries (h5diffgentest ${HDF5_LIB_TARGET}) set_target_properties (h5diffgentest PROPERTIES FOLDER generator/tools) diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index bbc39d8..e06f069 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -26,6 +26,7 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dtypes.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr1.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr2.h5 + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr3.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dset1.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dset2.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dset3.h5 @@ -63,10 +64,6 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/compounds_array_vlen2.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/non_comparables1.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/non_comparables2.h5 - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tmptest.he5 - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tmptest2.he5 - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tmpSingleSiteBethe.reference.h5 - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tmpSingleSiteBethe.output.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tudfilter.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tudfilter2.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/diff_strings1.h5 @@ -293,8 +290,8 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_800.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_801.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_90.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_tmp1.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_tmp2.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8625.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8639.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_ud.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v1.txt @@ -1021,6 +1018,10 @@ h5diff_800.out.err h5diff_801.out h5diff_801.out.err + h5diff_8625.out + h5diff_8625.out.err + h5diff_8639.out + h5diff_8639.out.err h5diff_90.out h5diff_90.out.err h5diff_v1.out @@ -1281,10 +1282,6 @@ ADD_H5_TEST (h5diff_631 0 -v --use-system-epsilon ${FILE1} ${FILE1} g1/fp18 g1/f # 7. attributes # ############################################################################## ADD_H5_TEST (h5diff_70 1 -v ${FILE5} ${FILE6}) -# temporary test to verify HDF5-8625 -ADD_H5_TEST (h5diff_tmp1 0 tmptest2.he5 tmptest.he5) -# temporary test to verify HDF5-8639 -ADD_H5_TEST (h5diff_tmp2 1 tmpSingleSiteBethe.output.h5 tmpSingleSiteBethe.reference.h5) # ################################################## # attrs with verbose option level @@ -1613,7 +1610,11 @@ ADD_H5_TEST (h5diff_487 1 -v --exclude-path "/group1/dset" h5diff_exclude3-1.h5 # ############################################################################## # # diff various multiple vlen and fixed strings in a compound type dataset # ############################################################################## -ADD_H5_TEST (h5diff_530 0 -v ${COMP_VL_STRS_FILE} ${COMP_VL_STRS_FILE} /group /group_copy) +ADD_H5_TEST (h5diff_530 0 -v ${COMP_VL_STRS_FILE} ${COMP_VL_STRS_FILE} /group /group_copy) +# test to verify HDFFV-8625 +ADD_H5_TEST (h5diff_8625 0 -v --enable-error-stack ${COMP_VL_STRS_FILE} ${COMP_VL_STRS_FILE} /group/Compound_dset1 /group_copy/Compound_dset3) +# test to verify HDFFV-8639 +ADD_H5_TEST (h5diff_8639 0 -v h5diff_attr3.h5 h5diff_attr2.h5 /g1) ADD_H5_TEST (h5diff_vlstr 0 -v tvlstr.h5 tvlstr2.h5) # ############################################################################## diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index 163d4e1..7321c66 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -1,15 +1,15 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright by The HDF Group. * -* Copyright by the Board of Trustees of the University of Illinois. * -* All rights reserved. * -* * -* This file is part of HDF5. The full HDF5 copyright notice, including * -* terms governing use, modification, and redistribution, is contained in * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include <stdio.h> #include <stdlib.h> @@ -29,16 +29,16 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); /*------------------------------------------------------------------------- -* Program: h5diffgentest -* -* Purpose: generate files for h5diff testing -* -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu -* -* Date: November 12, 2003 -* -*------------------------------------------------------------------------- -*/ + * Program: h5diffgentest + * + * Purpose: generate files for h5diff testing + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: November 12, 2003 + * + *------------------------------------------------------------------------- + */ #define FILE1 "h5diff_basic1.h5" #define FILE2 "h5diff_basic2.h5" @@ -46,6 +46,7 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); #define FILE4 "h5diff_dtypes.h5" #define FILE5 "h5diff_attr1.h5" #define FILE6 "h5diff_attr2.h5" +#define FILE6a "h5diff_attr3.h5" #define FILE7 "h5diff_dset1.h5" #define FILE8 "h5diff_dset2.h5" #define FILE8A "h5diff_dset3.h5" @@ -132,18 +133,18 @@ const H5L_class_t UD_link_class[1] = {{ /*------------------------------------------------------------------------- -* prototypes -*------------------------------------------------------------------------- -*/ + * prototypes + *------------------------------------------------------------------------- + */ /* tests called in main() */ static int test_basic(const char *fname1, const char *fname2, const char *fname3); static int test_types(const char *fname); static int test_datatypes(const char *fname); -static int test_attributes(const char *fname,int make_diffs); -static int test_datasets(const char *fname,int make_diffs); -static int test_special_datasets(const char *fname,int make_diffs); -static int test_hyperslab(const char *fname,int make_diffs); +static int test_attributes(const char *fname, int make_diffs); +static int test_datasets(const char *fname, int make_diffs); +static int test_special_datasets(const char *fname, int make_diffs); +static int test_hyperslab(const char *fname, int make_diffs); static int test_link_name(const char *fname1); static int test_soft_links(const char *fname1); static int test_linked_softlinks(const char *fname1); @@ -158,54 +159,60 @@ static int test_exclude_obj3(const char *fname1, const char *fname2); static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new); static int test_attributes_verbose_level(const char *fname1, const char *fname2); static int test_enums(const char *fname); -static void test_comps_array (const char *fname, const char *dset, const char *attr,int diff, int is_file_new); -static void test_comps_vlen (const char *fname, const char *dset,const char *attr, int diff, int is_file_new); -static void test_comps_array_vlen (const char *fname, const char *dset, const char *attr, int diff, int is_file_new); -static void test_comps_vlen_arry (const char *fname, const char *dset,const char *attr, int diff, int is_file_new); -static void test_data_nocomparables (const char *fname, int diff); -static void test_objs_nocomparables (const char *fname1, const char *fname2); -static void test_objs_strings (const char *fname, const char *fname2); +static void test_comps_array(const char *fname, const char *dset, + const char *attr, int diff, int is_file_new); +static void test_comps_vlen(const char *fname, const char *dset, + const char *attr, int diff, int is_file_new); +static void test_comps_array_vlen(const char *fname, const char *dset, + const char *attr, int diff, int is_file_new); +static void test_comps_vlen_arry(const char *fname, const char *dset, + const char *attr, int diff, int is_file_new); +static void test_data_nocomparables(const char *fname, int diff); +static void test_objs_nocomparables(const char *fname1, const char *fname2); +static void test_objs_strings(const char *fname, const char *fname2); /* called by test_attributes() and test_datasets() */ -static void write_attr_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs); -static void write_dset_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs); -static void gen_datareg(hid_t fid,int make_diffs); +static void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs); +static void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs); +static void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs); +static void gen_datareg(hid_t fid, int make_diffs); /* utilities */ -static int write_attr(hid_t loc_id,int rank,hsize_t *dims,const char *name,hid_t tid,void *buf); -static int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *name,hid_t tid,void *buf); +static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); +static int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); static int gen_dataset_idx(const char *file, int format); - /*------------------------------------------------------------------------- -* Function: main -* -* Purpose: main program -* -*------------------------------------------------------------------------- -*/ + * Function: main + * + * Purpose: main program + * + *------------------------------------------------------------------------- + */ int main(void) { test_basic(FILE1, FILE2, FILE11); - test_types (FILE3); + test_types(FILE3); test_datatypes(FILE4); /* generate 2 files, the second call creates a similar file with differences */ - test_attributes(FILE5,0); - test_attributes(FILE6,1); + test_attributes(FILE5, 0); + test_attributes(FILE6, 1); + /* generate file with string datatypes swapped */ + test_attributes(FILE6a, 2); /* test attributes with verbose level */ test_attributes_verbose_level(ATTR_VERBOSE_LEVEL_FILE1, ATTR_VERBOSE_LEVEL_FILE2); /* generate 2 files, the second call creates a similar file with differences */ - test_datasets(FILE7,0); - test_datasets(FILE8,1); - test_datasets(FILE8A,2); + test_datasets(FILE7, 0); + test_datasets(FILE8, 1); + test_datasets(FILE8A, 2); /* generate 2 files, the second call creates a similar file with differences */ - test_hyperslab(FILE9,0); - test_hyperslab(FILE10,1); + test_hyperslab(FILE9, 0); + test_hyperslab(FILE10, 1); test_link_name(FILE12); @@ -218,15 +225,15 @@ int main(void) test_ext2soft_links(FILE17, FILE18); /* generate 2 files, the second call creates a similar file with differences */ - test_special_datasets(FILE19,0); - test_special_datasets(FILE20,1); + test_special_datasets(FILE19, 0); + test_special_datasets(FILE20, 1); /* - * Generate 2 files: FILE21 with old format; FILE22 with new format - * Create 2 datasets in each file: - * One dataset: chunked layout, w/o filters, fixed dimension - * One dataset: chunked layout, w/ filters, fixed dimension - */ + * Generate 2 files: FILE21 with old format; FILE22 with new format + * Create 2 datasets in each file: + * One dataset: chunked layout, w/o filters, fixed dimension + * One dataset: chunked layout, w/ filters, fixed dimension + */ gen_dataset_idx(FILE21, 0); gen_dataset_idx(FILE22, 1); @@ -244,34 +251,34 @@ int main(void) test_comp_vlen_strings(COMP_VL_STRS_FILE, "group_copy", 0); /* diff when invalid enum values are present. - * This will probably grow to involve more extensive testing of - * enums so it has been given its own test file and test (apart - * from the basic type testing). - */ + * This will probably grow to involve more extensive testing of + * enums so it has been given its own test file and test (apart + * from the basic type testing). + */ test_enums(ENUM_INVALID_VALUES); /* ------------------------------------------------- - * Create test files with dataset and attribute with container types - * (array, vlen) with multiple nested compound types. - */ + * Create test files with dataset and attribute with container types + * (array, vlen) with multiple nested compound types. + */ /* file1 */ - test_comps_array(COMPS_COMPLEX1,"dset1", "attr1", 0, 1); - test_comps_vlen(COMPS_COMPLEX1,"dset2", "attr2", 0, 0); - test_comps_array_vlen(COMPS_COMPLEX1,"dset3", "attr3", 0, 0); - test_comps_vlen_arry(COMPS_COMPLEX1,"dset4", "attr4", 0, 0); + test_comps_array(COMPS_COMPLEX1, "dset1", "attr1", 0, 1); + test_comps_vlen(COMPS_COMPLEX1, "dset2", "attr2", 0, 0); + test_comps_array_vlen(COMPS_COMPLEX1, "dset3", "attr3", 0, 0); + test_comps_vlen_arry(COMPS_COMPLEX1, "dset4", "attr4", 0, 0); /* file2 */ - test_comps_array(COMPS_COMPLEX2,"dset1", "attr1", 5, 1); - test_comps_vlen(COMPS_COMPLEX2,"dset2", "attr2",5, 0); - test_comps_array_vlen(COMPS_COMPLEX2,"dset3", "attr3", 5, 0); - test_comps_vlen_arry(COMPS_COMPLEX2,"dset4", "attr4", 5, 0); + test_comps_array(COMPS_COMPLEX2, "dset1", "attr1", 5, 1); + test_comps_vlen(COMPS_COMPLEX2, "dset2", "attr2", 5, 0); + test_comps_array_vlen(COMPS_COMPLEX2, "dset3", "attr3", 5, 0); + test_comps_vlen_arry(COMPS_COMPLEX2, "dset4", "attr4", 5, 0); /*------------------------------------------------- - * Create test files with non-comparable dataset and attributes with - * comparable datasets and attributes. All the comparables should display - * differences. - */ - test_data_nocomparables(NON_COMPARBLES1,0); - test_data_nocomparables(NON_COMPARBLES2,5); + * Create test files with non-comparable dataset and attributes with + * comparable datasets and attributes. All the comparables should display + * differences. + */ + test_data_nocomparables(NON_COMPARBLES1, 0); + test_data_nocomparables(NON_COMPARBLES2, 5); /* common objects (same name) with different object types. HDFFV-7644 */ test_objs_nocomparables(NON_COMPARBLES1, NON_COMPARBLES2); @@ -283,28 +290,28 @@ int main(void) } /*------------------------------------------------------------------------- -* Function: test_basic -* -* Purpose: Create basic test files, first two contains different data, the -* third one is just an empty file. -* -*------------------------------------------------------------------------- -*/ + * Function: test_basic + * + * Purpose: Create basic test files, first two contains different data, the + * third one is just an empty file. + * + *------------------------------------------------------------------------- + */ static int test_basic(const char *fname1, const char *fname2, const char *fname3) { - hid_t fid1, fid2; - hid_t gid1, gid2, gid3; + hid_t fid1 = -1, fid2 = -1; + hid_t gid1 = -1, gid2 = -1, gid3 = -1; hsize_t dims1[1] = { 6 }; - hsize_t dims2[2] = { 3,2 }; + hsize_t dims2[2] = { 3, 2 }; /* create the empty file */ - if ((fid1=H5Fcreate(fname3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0){ + if ((fid1 = H5Fcreate(fname3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { fprintf(stderr, "empty file (%s) creation failed.\n", fname3); goto out; } - if (H5Fclose(fid1) < 0){ + if (H5Fclose(fid1) < 0) { fprintf(stderr, "empty file (%s) close failed.\n", fname3); goto out; } @@ -314,9 +321,9 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) *------------------------------------------------------------------------- */ - if (( fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) + if ((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if (( fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) + if ((fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; /*------------------------------------------------------------------------- @@ -339,16 +346,20 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) */ { - double data1[3][2] = {{ 1.0F, 1.0F}, { 1.00F, 1.000F}, { 0.0F, 0.0F}}; - double data2[3][2] = {{ 0.0F, 1.1F}, { 1.01F, 1.001F}, { 0.0F, 1.0F}}; - double data3[3][2] = {{100.0F, 100.0F}, {100.00F, 100.000F}, {100.0F, 100.0F}}; - double data4[3][2] = {{105.0F, 120.0F}, {160.00F, 95.000F}, { 80.0F, 40.0F}}; + double data1[3][2] = + { { 1.0F, 1.0F }, { 1.00F, 1.000F }, { 0.0F, 0.0F } }; + double data2[3][2] = + { { 0.0F, 1.1F }, { 1.01F, 1.001F }, { 0.0F, 1.0F } }; + double data3[3][2] = { { 100.0F, 100.0F }, { 100.00F, 100.000F }, { + 100.0F, 100.0F } }; + double data4[3][2] = { { 105.0F, 120.0F }, { 160.00F, 95.000F }, { + 80.0F, 40.0F } }; - write_dset(gid1,2,dims2,"dset1",H5T_NATIVE_DOUBLE,data1); - write_dset(gid2,2,dims2,"dset2",H5T_NATIVE_DOUBLE,data2); - write_dset(gid1,2,dims2,"dset3",H5T_NATIVE_DOUBLE,data3); - write_dset(gid2,2,dims2,"dset4",H5T_NATIVE_DOUBLE,data4); - write_dset(gid2,2,dims2,"dset1",H5T_NATIVE_DOUBLE,data2); + write_dset(gid1, 2, dims2, "dset1", H5T_NATIVE_DOUBLE, data1); + write_dset(gid2, 2, dims2, "dset2", H5T_NATIVE_DOUBLE, data2); + write_dset(gid1, 2, dims2, "dset3", H5T_NATIVE_DOUBLE, data3); + write_dset(gid2, 2, dims2, "dset4", H5T_NATIVE_DOUBLE, data4); + write_dset(gid2, 2, dims2, "dset1", H5T_NATIVE_DOUBLE, data2); } /*------------------------------------------------------------------------- @@ -357,11 +368,11 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) *------------------------------------------------------------------------- */ { - int data5[3][2] = {{100,100},{100,0},{0,100}}; - int data6[3][2] = {{120,80}, {0,100},{0,50}}; + int data5[3][2] = { { 100, 100 }, { 100, 0 }, { 0, 100 } }; + int data6[3][2] = { { 120, 80 }, { 0, 100 }, { 0, 50 } }; - write_dset(gid1,2,dims2,"dset5",H5T_NATIVE_INT,data5); - write_dset(gid1,2,dims2,"dset6",H5T_NATIVE_INT,data6); + write_dset(gid1, 2, dims2, "dset5", H5T_NATIVE_INT, data5); + write_dset(gid1, 2, dims2, "dset6", H5T_NATIVE_INT, data6); } @@ -371,11 +382,12 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) *------------------------------------------------------------------------- */ { - unsigned long long data7[3][2] = {{100,100},{100,0},{0,100}}; - unsigned long long data8[3][2] = {{120,80}, {0,100},{0,50}}; + unsigned long long data7[3][2] = + { { 100, 100 }, { 100, 0 }, { 0, 100 } }; + unsigned long long data8[3][2] = { { 120, 80 }, { 0, 100 }, { 0, 50 } }; - write_dset(gid1,2,dims2,"dset7",H5T_NATIVE_ULLONG,data7); - write_dset(gid1,2,dims2,"dset8",H5T_NATIVE_ULLONG,data8); + write_dset(gid1, 2, dims2, "dset7", H5T_NATIVE_ULLONG, data7); + write_dset(gid1, 2, dims2, "dset8", H5T_NATIVE_ULLONG, data8); } @@ -393,45 +405,47 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) *------------------------------------------------------------------------- */ { - double data9[3][2] = {{100.0F, 100.0F}, {100.0F, 0.0F}, {0.0F, 100.0F}}; - double data10[3][2] ={{120.0F, 80.0F}, { 0.0F, 100.0F}, {0.0F, 50.0F}}; + double data9[3][2] = { { 100.0F, 100.0F }, { 100.0F, 0.0F }, { 0.0F, + 100.0F } }; + double data10[3][2] = { { 120.0F, 80.0F }, { 0.0F, 100.0F }, { 0.0F, + 50.0F } }; - write_dset(gid1,2,dims2,"dset9",H5T_NATIVE_DOUBLE,data9); - write_dset(gid1,2,dims2,"dset10",H5T_NATIVE_DOUBLE,data10); + write_dset(gid1, 2, dims2, "dset9", H5T_NATIVE_DOUBLE, data9); + write_dset(gid1, 2, dims2, "dset10", H5T_NATIVE_DOUBLE, data10); } - /*------------------------------------------------------------------------- * test floating point comparison *------------------------------------------------------------------------- */ { /* epsilon = 0.0000001 = 1e-7 - * system epsilon for float : FLT_EPSILON = 1.19209E-07 - */ - float data11[3][2] ={{0.000000f,0.0000001f},{0.0000001f, 0.00000022f},{0.0000001f,0.0000001f}}; - float data12[3][2] ={{0.000000f,0.0000002f},{0.0000003f,0.0000001f},{0.000000f,0.0000001f}}; + * system epsilon for float : FLT_EPSILON = 1.19209E-07 + */ + float data11[3][2] = { { 0.000000f, 0.0000001f }, { 0.0000001f, + 0.00000022f }, { 0.0000001f, 0.0000001f } }; + float data12[3][2] = { { 0.000000f, 0.0000002f }, { 0.0000003f, + 0.0000001f }, { 0.000000f, 0.0000001f } }; /* epsilon = 0.0000000000000001 = 1e-16 - * system epsilon for double : DBL_EPSILON = 2.22045E-16 - */ - double data13[3][2] ={ - {H5_DOUBLE(0.0000000000000000), H5_DOUBLE(0.0000000000000001)}, - {H5_DOUBLE(0.0000000000000001), H5_DOUBLE(0.0000000000000000)}, - {H5_DOUBLE(0.00000000000000033), H5_DOUBLE(0.0000000000000001)}}; - double data14[3][2] ={ - {H5_DOUBLE(0.0000000000000000), H5_DOUBLE(0.0000000000000004)}, - {H5_DOUBLE(0.0000000000000002), H5_DOUBLE(0.0000000000000001)}, - {H5_DOUBLE(0.0000000000000001), H5_DOUBLE(0.00000000000000000)}}; + * system epsilon for double : DBL_EPSILON = 2.22045E-16 + */ + double data13[3][2] = { { H5_DOUBLE(0.0000000000000000), H5_DOUBLE( + 0.0000000000000001) }, { H5_DOUBLE(0.0000000000000001), + H5_DOUBLE(0.0000000000000000) }, { H5_DOUBLE( + 0.00000000000000033), H5_DOUBLE(0.0000000000000001) } }; + double data14[3][2] = { { H5_DOUBLE(0.0000000000000000), H5_DOUBLE( + 0.0000000000000004) }, { H5_DOUBLE(0.0000000000000002), + H5_DOUBLE(0.0000000000000001) }, { H5_DOUBLE( + 0.0000000000000001), H5_DOUBLE(0.00000000000000000) } }; - write_dset(gid1,2,dims2,"fp1",H5T_NATIVE_FLOAT,data11); - write_dset(gid1,2,dims2,"fp2",H5T_NATIVE_FLOAT,data12); - write_dset(gid1,2,dims2,"d1",H5T_NATIVE_DOUBLE,data13); - write_dset(gid1,2,dims2,"d2",H5T_NATIVE_DOUBLE,data14); + write_dset(gid1, 2, dims2, "fp1", H5T_NATIVE_FLOAT, data11); + write_dset(gid1, 2, dims2, "fp2", H5T_NATIVE_FLOAT, data12); + write_dset(gid1, 2, dims2, "d1", H5T_NATIVE_DOUBLE, data13); + write_dset(gid1, 2, dims2, "d2", H5T_NATIVE_DOUBLE, data14); } - #if H5_SIZEOF_LONG_DOUBLE !=0 { @@ -440,15 +454,13 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) *------------------------------------------------------------------------- */ - long double data15[3][2] ={{1.0L,1.0L},{1.0L,1.0L},{1.0L,1.0L}}; + long double data15[3][2] = { {1.0L,1.0L}, {1.0L,1.0L}, {1.0L,1.0L}}; write_dset(gid1,2,dims2,"ld",H5T_NATIVE_LDOUBLE,data15); } #endif - - /*------------------------------------------------------------------------- * NaNs in H5T_NATIVE_FLOAT *------------------------------------------------------------------------- @@ -458,22 +470,22 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) float data15[6]; float data16[6]; - data15[0] = (float)HDsqrt(-1.0F); + data15[0] = (float) HDsqrt(-1.0F); data15[1] = 1.0F; - data15[2] = (float)HDsqrt(-1.0F); + data15[2] = (float) HDsqrt(-1.0F); data15[3] = 1.0F; data15[4] = 1.0F; data15[5] = 1.0F; - data16[0] = (float)HDsqrt(-1.0F); - data16[1] = (float)HDsqrt(-1.0F); + data16[0] = (float) HDsqrt(-1.0F); + data16[1] = (float) HDsqrt(-1.0F); data16[2] = 1.0F; data16[3] = 1.0F; data16[4] = 1.0F; data16[5] = 1.0F; - write_dset(gid1,1,dims1,"fp15",H5T_NATIVE_FLOAT,data15); - write_dset(gid1,1,dims1,"fp16",H5T_NATIVE_FLOAT,data16); + write_dset(gid1, 1, dims1, "fp15", H5T_NATIVE_FLOAT, data15); + write_dset(gid1, 1, dims1, "fp16", H5T_NATIVE_FLOAT, data16); } @@ -500,29 +512,29 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) data18[4] = 1.0F; data18[5] = 1.0F; - write_dset(gid1,1,dims1,"fp17",H5T_NATIVE_DOUBLE,data17); - write_dset(gid1,1,dims1,"fp18",H5T_NATIVE_DOUBLE,data18); - write_dset(gid1,1,dims1,"fp18_COPY",H5T_NATIVE_DOUBLE,data18); + write_dset(gid1, 1, dims1, "fp17", H5T_NATIVE_DOUBLE, data17); + write_dset(gid1, 1, dims1, "fp18", H5T_NATIVE_DOUBLE, data18); + write_dset(gid1, 1, dims1, "fp18_COPY", H5T_NATIVE_DOUBLE, data18); } /*------------------------------------------------------------------------ - * INFINITY values - *------------------------------------------------------------------------ - */ + * INFINITY values + *------------------------------------------------------------------------ + */ { - float data19[6]; + float data19[6]; double data20[6]; - data19[0] = data19[1] = data19[2] = (float)HDlog(0.0F); - data19[3] = data19[4] = data19[5] = (float)-HDlog(0.0F); + data19[0] = data19[1] = data19[2] = (float) HDlog(0.0F); + data19[3] = data19[4] = data19[5] = (float) -HDlog(0.0F); data20[0] = data20[1] = data20[2] = HDlog(0.0F); data20[3] = data20[4] = data20[5] = -HDlog(0.0F); - write_dset(gid1,1,dims1,"fp19",H5T_NATIVE_FLOAT,data19); - write_dset(gid1,1,dims1,"fp19_COPY",H5T_NATIVE_FLOAT,data19); - write_dset(gid1,1,dims1,"fp20",H5T_NATIVE_DOUBLE,data20); - write_dset(gid1,1,dims1,"fp20_COPY",H5T_NATIVE_DOUBLE,data20); + write_dset(gid1, 1, dims1, "fp19", H5T_NATIVE_FLOAT, data19); + write_dset(gid1, 1, dims1, "fp19_COPY", H5T_NATIVE_FLOAT, data19); + write_dset(gid1, 1, dims1, "fp20", H5T_NATIVE_DOUBLE, data20); + write_dset(gid1, 1, dims1, "fp20_COPY", H5T_NATIVE_DOUBLE, data20); } /*------------------------------------------------------------------------- @@ -530,105 +542,97 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) *------------------------------------------------------------------------- */ { - typedef struct cmp1_t - { + typedef struct cmp1_t { double d; - float f; + float f; } cmp1_t; - cmp1_t buf1[2]; - cmp1_t buf2[2]; - hsize_t dims[1] = {2}; - size_t type_size; - hid_t tid; + cmp1_t buf1[2]; + cmp1_t buf2[2]; + hsize_t dims[1] = { 2 }; + size_t type_size; + hid_t tid; buf1[0].d = HDsqrt(-1.0F); - buf1[0].f = (float)HDsqrt(-1.0F); + buf1[0].f = (float) HDsqrt(-1.0F); buf2[0].d = HDsqrt(-1.0F); - buf2[0].f = (float)HDsqrt(-1.0F); + buf2[0].f = (float) HDsqrt(-1.0F); buf1[1].d = HDsqrt(-1.0F); - buf1[1].f = (float)HDsqrt(-1.0F); + buf1[1].f = (float) HDsqrt(-1.0F); buf2[1].d = 0.0F; buf2[1].f = 0.0F; - type_size = sizeof( cmp1_t ); - tid = H5Tcreate (H5T_COMPOUND, type_size ); - H5Tinsert(tid, "d", HOFFSET( cmp1_t, d ), H5T_NATIVE_DOUBLE ); - H5Tinsert(tid, "f", HOFFSET( cmp1_t, f ), H5T_NATIVE_FLOAT ); - write_dset(gid1,1,dims,"dset11",tid,buf1); - write_dset(gid1,1,dims,"dset12",tid,buf2); + type_size = sizeof(cmp1_t); + tid = H5Tcreate(H5T_COMPOUND, type_size); + H5Tinsert(tid, "d", HOFFSET(cmp1_t, d), H5T_NATIVE_DOUBLE); + H5Tinsert(tid, "f", HOFFSET(cmp1_t, f), H5T_NATIVE_FLOAT); + write_dset(gid1, 1, dims, "dset11", tid, buf1); + write_dset(gid1, 1, dims, "dset12", tid, buf2); H5Tclose(tid); - } /* not comparable objects */ { - typedef struct cmp1_t - { + typedef struct cmp1_t { double d; - int i; + int i; } cmp1_t; - typedef struct cmp2_t - { - int i; + typedef struct cmp2_t { + int i; double d; } cmp2_t; - typedef struct cmp3_t - { + typedef struct cmp3_t { int i; } cmp3_t; - double data2[6] = {0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F}; - int data3[6] = {0,0,0,0,0,0}; - int data4[3][2] = {{0,0},{0,0},{0,0}}; - int data5[2][2] = {{0,0},{0,0}}; - unsigned int data6[3][2] = {{0,0},{0,0},{0,0}}; - cmp1_t data7[1] = {{1.0f, 2}}; - cmp2_t data8[1] = {{1, 2.0f}}; - hsize_t dims3[2] = {2, 2}; - hsize_t dims4[1] = {1}; - size_t type_size; - hid_t tid; - - - - write_dset(gid3,1,dims1,"dset1",H5T_NATIVE_DOUBLE,NULL); - write_dset(gid3,1,dims1,"dset2",H5T_NATIVE_DOUBLE,data2); - write_dset(gid3,1,dims1,"dset3",H5T_NATIVE_INT,data3); - write_dset(gid3,2,dims2,"dset4",H5T_NATIVE_INT,data4); - write_dset(gid3,2,dims3,"dset5",H5T_NATIVE_INT,data5); - write_dset(gid3,2,dims2,"dset6",H5T_NATIVE_UINT,data6); + double data2[6] = { 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }; + int data3[6] = { 0, 0, 0, 0, 0, 0 }; + int data4[3][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 } }; + int data5[2][2] = { { 0, 0 }, { 0, 0 } }; + unsigned int data6[3][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 } }; + cmp1_t data7[1] = { { 1.0f, 2 } }; + cmp2_t data8[1] = { { 1, 2.0f } }; + hsize_t dims3[2] = { 2, 2 }; + hsize_t dims4[1] = { 1 }; + size_t type_size; + hid_t tid; + + write_dset(gid3, 1, dims1, "dset1", H5T_NATIVE_DOUBLE, NULL); + write_dset(gid3, 1, dims1, "dset2", H5T_NATIVE_DOUBLE, data2); + write_dset(gid3, 1, dims1, "dset3", H5T_NATIVE_INT, data3); + write_dset(gid3, 2, dims2, "dset4", H5T_NATIVE_INT, data4); + write_dset(gid3, 2, dims3, "dset5", H5T_NATIVE_INT, data5); + write_dset(gid3, 2, dims2, "dset6", H5T_NATIVE_UINT, data6); /* case of compound with different type members */ - type_size = sizeof( cmp1_t ); - tid = H5Tcreate (H5T_COMPOUND, type_size ); - H5Tinsert(tid, "d", HOFFSET( cmp1_t, d ), H5T_NATIVE_DOUBLE ); - H5Tinsert(tid, "i", HOFFSET( cmp1_t, i ), H5T_NATIVE_INT ); - write_dset(gid3,1,dims4,"dset7",tid,data7); + type_size = sizeof(cmp1_t); + tid = H5Tcreate(H5T_COMPOUND, type_size); + H5Tinsert(tid, "d", HOFFSET(cmp1_t, d), H5T_NATIVE_DOUBLE); + H5Tinsert(tid, "i", HOFFSET(cmp1_t, i), H5T_NATIVE_INT); + write_dset(gid3, 1, dims4, "dset7", tid, data7); H5Tclose(tid); - type_size = sizeof( cmp2_t ); - tid = H5Tcreate (H5T_COMPOUND, type_size ); - H5Tinsert(tid, "i", HOFFSET( cmp2_t, i ), H5T_NATIVE_INT ); - H5Tinsert(tid, "d", HOFFSET( cmp2_t, d ), H5T_NATIVE_DOUBLE ); - write_dset(gid3,1,dims4,"dset8",tid,data8); + type_size = sizeof(cmp2_t); + tid = H5Tcreate(H5T_COMPOUND, type_size); + H5Tinsert(tid, "i", HOFFSET(cmp2_t, i), H5T_NATIVE_INT); + H5Tinsert(tid, "d", HOFFSET(cmp2_t, d), H5T_NATIVE_DOUBLE); + write_dset(gid3, 1, dims4, "dset8", tid, data8); H5Tclose(tid); /* case of compound with different number of members */ - type_size = sizeof( cmp3_t ); - tid = H5Tcreate (H5T_COMPOUND, type_size ); - H5Tinsert(tid, "i", HOFFSET( cmp2_t, i ), H5T_NATIVE_INT ); - write_dset(gid3,1,dims4,"dset9",tid,NULL); + type_size = sizeof(cmp3_t); + tid = H5Tcreate(H5T_COMPOUND, type_size); + H5Tinsert(tid, "i", HOFFSET(cmp2_t, i), H5T_NATIVE_INT); + write_dset(gid3, 1, dims4, "dset9", tid, NULL); H5Tclose(tid); } - /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- @@ -645,46 +649,43 @@ out: return FAIL; } - /*------------------------------------------------------------------------- -* Function: test_types -* -* Purpose: Compare different HDF5 object & link types: -* H5G_DATASET, H5G_TYPE, H5G_GROUP, H5G_LINK, H5G_UDLINK -* -*------------------------------------------------------------------------- -*/ + * Function: test_types + * + * Purpose: Compare different HDF5 object & link types: + * H5G_DATASET, H5G_TYPE, H5G_GROUP, H5G_LINK, H5G_UDLINK + * + *------------------------------------------------------------------------- + */ static int test_types(const char *fname) { - hid_t fid1; - hid_t gid1; - hid_t gid2; - hid_t tid1; - hid_t tid2; - herr_t status; - hsize_t dims[1]={1}; - typedef struct s1_t - { - int a; - float b; + hid_t fid1 = -1; + hid_t gid1 = -1; + hid_t gid2 = -1; + hid_t tid1 = -1; + hid_t tid2 = -1; + herr_t status; + hsize_t dims[1] = { 1 }; + typedef struct s1_t { + int a; + float b; } s1_t; - typedef struct s2_t - { - int a; + typedef struct s2_t { + int a; } s2_t; /*------------------------------------------------------------------------- * Create one file *------------------------------------------------------------------------- */ - fid1 = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid1 = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- * H5G_DATASET *------------------------------------------------------------------------- */ - write_dset(fid1,1,dims,"dset",H5T_NATIVE_INT,0); + write_dset(fid1, 1, dims, "dset", H5T_NATIVE_INT, 0); /*------------------------------------------------------------------------- * H5G_GROUP @@ -726,7 +727,7 @@ int test_types(const char *fname) */ H5Lcreate_external("filename", "objname", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT); H5Lregister(UD_link_class); - H5Lcreate_ud(fid1, "ud_link", (H5L_type_t)MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT); + H5Lcreate_ud(fid1, "ud_link", (H5L_type_t) MY_LINKCLASS, NULL, (size_t) 0, H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- * Close @@ -736,195 +737,192 @@ int test_types(const char *fname) return status; } - /* -# ############################################################################## -# # not comparable types -# ############################################################################## + # ############################################################################## + # # not comparable types + # ############################################################################## -# 2.0 -TOOLTEST h5diff_20.txt file3.h5 file3.h5 -v dset g1 + # 2.0 + TOOLTEST h5diff_20.txt file3.h5 file3.h5 -v dset g1 -# 2.1 -TOOLTEST h5diff_21.txt file3.h5 file3.h5 -v dset l1 + # 2.1 + TOOLTEST h5diff_21.txt file3.h5 file3.h5 -v dset l1 -# 2.2 -TOOLTEST h5diff_22.txt file3.h5 file3.h5 -v dset t1 + # 2.2 + TOOLTEST h5diff_22.txt file3.h5 file3.h5 -v dset t1 -# ############################################################################## -# # compare groups, types, links (no differences and differences) -# ############################################################################## + # ############################################################################## + # # compare groups, types, links (no differences and differences) + # ############################################################################## -# 2.3 -TOOLTEST h5diff_23.txt file3.h5 file3.h5 -v g1 g1 + # 2.3 + TOOLTEST h5diff_23.txt file3.h5 file3.h5 -v g1 g1 -# 2.4 -TOOLTEST h5diff_24.txt file3.h5 file3.h5 -v t1 t1 + # 2.4 + TOOLTEST h5diff_24.txt file3.h5 file3.h5 -v t1 t1 -# 2.5 -TOOLTEST h5diff_25.txt file3.h5 file3.h5 -v l1 l1 + # 2.5 + TOOLTEST h5diff_25.txt file3.h5 file3.h5 -v l1 l1 -# 2.6 -TOOLTEST h5diff_26.txt file3.h5 file3.h5 -v g1 g2 + # 2.6 + TOOLTEST h5diff_26.txt file3.h5 file3.h5 -v g1 g2 -# 2.7 -TOOLTEST h5diff_27.txt file3.h5 file3.h5 -v t1 t2 + # 2.7 + TOOLTEST h5diff_27.txt file3.h5 file3.h5 -v t1 t2 -# 2.8 -TOOLTEST h5diff_28.txt file3.h5 file3.h5 -v l1 l2 -*/ + # 2.8 + TOOLTEST h5diff_28.txt file3.h5 file3.h5 -v l1 l2 + */ /*------------------------------------------------------------------------- -* Function: test_datatypes -* -* Purpose: test dataset datatypes -* -*------------------------------------------------------------------------- -*/ + * Function: test_datatypes + * + * Purpose: test dataset datatypes + * + *------------------------------------------------------------------------- + */ static int test_datatypes(const char *fname) { - - hid_t fid1; - hid_t dset; - hsize_t dims[2]={3,2}; - herr_t status; - char buf1a[3][2] = {{1,1},{1,1},{1,1}}; - char buf1b[3][2] = {{1,1},{3,4},{5,6}}; - short buf2a[3][2] = {{1,1},{1,1},{1,1}}; - short buf2b[3][2] = {{1,1},{3,4},{5,6}}; - int buf3a[3][2] = {{1,1},{1,1},{1,1}}; - int buf3b[3][2] = {{1,1},{3,4},{5,6}}; - long buf4a[3][2] = {{1,1},{1,1},{1,1}}; - long buf4b[3][2] = {{1,1},{3,4},{5,6}}; - float buf5a[3][2] = {{1.0F, 1.0F}, {1.0F, 1.0F}, {1.0F, 1.0F}}; - float buf5b[3][2] = {{1.0F, 1.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; - double buf6a[3][2] = {{1.0F, 1.0F}, {1.0F, 1.0F}, {1.0F, 1.0F}}; - double buf6b[3][2] = {{1.0F, 1.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; + hid_t fid1 = -1; + hid_t dset = -1; + hsize_t dims[2] = { 3, 2 }; + herr_t status; + char buf1a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; + char buf1b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; + short buf2a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; + short buf2b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; + int buf3a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; + int buf3b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; + long buf4a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; + long buf4b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; + float buf5a[3][2] = { { 1.0F, 1.0F }, { 1.0F, 1.0F }, { 1.0F, 1.0F } }; + float buf5b[3][2] = { { 1.0F, 1.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; + double buf6a[3][2] = { { 1.0F, 1.0F }, { 1.0F, 1.0F }, { 1.0F, 1.0F } }; + double buf6b[3][2] = { { 1.0F, 1.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /*unsigned/signed test signed char -128 to 127 unsigned char 0 to 255 */ - char buf7a[3][2] = {{-1,-128},{-1,-1},{-1,-1}}; - unsigned char buf7b[3][2] = {{1,128},{1,1},{1,1}}; + char buf7a[3][2] = { { -1, -128 }, { -1, -1 }, { -1, -1 } }; + unsigned char buf7b[3][2] = { { 1, 128 }, { 1, 1 }, { 1, 1 } }; /* long long test */ - long long buf8a[3][2] = {{1,1},{1,1},{1,1}}; - long long buf8b[3][2] = {{1,1},{3,4},{5,6}}; - unsigned long long buf9a[3][2] = {{1,1},{1,1},{1,1}}; - unsigned long long buf9b[3][2] = {{1,1},{3,4},{5,6}}; + long long buf8a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; + long long buf8b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; + unsigned long long buf9a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; + unsigned long long buf9b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; - unsigned int buf10a[3][2] = {{UIMAX,1},{1,1},{1,1}}; - unsigned int buf10b[3][2] = {{UIMAX-1,1},{3,4},{5,6}}; - - unsigned short buf11a[3][2] = {{204,205},{2,3},{1,1}}; - unsigned int buf11b[3][2] = {{204,205},{2,3},{1,1}}; + unsigned int buf10a[3][2] = { { UIMAX, 1 }, { 1, 1 }, { 1, 1 } }; + unsigned int buf10b[3][2] = { { UIMAX - 1, 1 }, { 3, 4 }, { 5, 6 } }; + unsigned short buf11a[3][2] = { { 204, 205 }, { 2, 3 }, { 1, 1 } }; + unsigned int buf11b[3][2] = { { 204, 205 }, { 2, 3 }, { 1, 1 } }; /*------------------------------------------------------------------------- * Create a file *------------------------------------------------------------------------- */ - fid1 = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid1 = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- * Check for different storage order. Give a warning if they are different *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset0a",H5T_STD_I16LE,buf2a); - write_dset(fid1,2,dims,"dset0b",H5T_STD_I32LE,buf3b); + write_dset(fid1, 2, dims, "dset0a", H5T_STD_I16LE, buf2a); + write_dset(fid1, 2, dims, "dset0b", H5T_STD_I32LE, buf3b); /*------------------------------------------------------------------------- * H5T_NATIVE_CHAR *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset1a",H5T_NATIVE_CHAR,buf1a); - write_dset(fid1,2,dims,"dset1b",H5T_NATIVE_CHAR,buf1b); + write_dset(fid1, 2, dims, "dset1a", H5T_NATIVE_CHAR, buf1a); + write_dset(fid1, 2, dims, "dset1b", H5T_NATIVE_CHAR, buf1b); /*------------------------------------------------------------------------- * H5T_NATIVE_SHORT *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset2a",H5T_NATIVE_SHORT,buf2a); - write_dset(fid1,2,dims,"dset2b",H5T_NATIVE_SHORT,buf2b); + write_dset(fid1, 2, dims, "dset2a", H5T_NATIVE_SHORT, buf2a); + write_dset(fid1, 2, dims, "dset2b", H5T_NATIVE_SHORT, buf2b); /*------------------------------------------------------------------------- * H5T_NATIVE_INT *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset3a",H5T_NATIVE_INT,buf3a); - write_dset(fid1,2,dims,"dset3b",H5T_NATIVE_INT,buf3b); + write_dset(fid1, 2, dims, "dset3a", H5T_NATIVE_INT, buf3a); + write_dset(fid1, 2, dims, "dset3b", H5T_NATIVE_INT, buf3b); /*------------------------------------------------------------------------- * H5T_NATIVE_LONG *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset4a",H5T_NATIVE_LONG,buf4a); - write_dset(fid1,2,dims,"dset4b",H5T_NATIVE_LONG,buf4b); + write_dset(fid1, 2, dims, "dset4a", H5T_NATIVE_LONG, buf4a); + write_dset(fid1, 2, dims, "dset4b", H5T_NATIVE_LONG, buf4b); /*------------------------------------------------------------------------- * H5T_NATIVE_FLOAT *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset5a",H5T_NATIVE_FLOAT,buf5a); - write_dset(fid1,2,dims,"dset5b",H5T_NATIVE_FLOAT,buf5b); + write_dset(fid1, 2, dims, "dset5a", H5T_NATIVE_FLOAT, buf5a); + write_dset(fid1, 2, dims, "dset5b", H5T_NATIVE_FLOAT, buf5b); /*------------------------------------------------------------------------- * H5T_NATIVE_DOUBLE *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset6a",H5T_NATIVE_DOUBLE,buf6a); - write_dset(fid1,2,dims,"dset6b",H5T_NATIVE_DOUBLE,buf6b); + write_dset(fid1, 2, dims, "dset6a", H5T_NATIVE_DOUBLE, buf6a); + write_dset(fid1, 2, dims, "dset6b", H5T_NATIVE_DOUBLE, buf6b); /*------------------------------------------------------------------------- * H5T_NATIVE_CHAR and H5T_NATIVE_UCHAR *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset7a",H5T_NATIVE_CHAR,buf7a); - write_dset(fid1,2,dims,"dset7b",H5T_NATIVE_UCHAR,buf7b); + write_dset(fid1, 2, dims, "dset7a", H5T_NATIVE_CHAR, buf7a); + write_dset(fid1, 2, dims, "dset7b", H5T_NATIVE_UCHAR, buf7b); /*------------------------------------------------------------------------- * H5T_NATIVE_LLONG *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset8a",H5T_NATIVE_LLONG,buf8a); - write_dset(fid1,2,dims,"dset8b",H5T_NATIVE_LLONG,buf8b); + write_dset(fid1, 2, dims, "dset8a", H5T_NATIVE_LLONG, buf8a); + write_dset(fid1, 2, dims, "dset8b", H5T_NATIVE_LLONG, buf8b); /*------------------------------------------------------------------------- * H5T_NATIVE_ULLONG *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset9a",H5T_NATIVE_ULLONG,buf9a); - write_dset(fid1,2,dims,"dset9b",H5T_NATIVE_ULLONG,buf9b); + write_dset(fid1, 2, dims, "dset9a", H5T_NATIVE_ULLONG, buf9a); + write_dset(fid1, 2, dims, "dset9b", H5T_NATIVE_ULLONG, buf9b); /*------------------------------------------------------------------------- * H5T_NATIVE_INT *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset10a",H5T_NATIVE_UINT,buf10a); - write_dset(fid1,2,dims,"dset10b",H5T_NATIVE_UINT,buf10b); + write_dset(fid1, 2, dims, "dset10a", H5T_NATIVE_UINT, buf10a); + write_dset(fid1, 2, dims, "dset10b", H5T_NATIVE_UINT, buf10b); /*------------------------------------------------------------------------- * Same type class, different size *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset11a",H5T_STD_U16LE,buf11a); - dset=H5Dopen2 (fid1, "dset11a", H5P_DEFAULT); - write_attr(dset,2,dims,"attr",H5T_STD_U16LE,buf11a); - H5Dclose (dset); + write_dset(fid1, 2, dims, "dset11a", H5T_STD_U16LE, buf11a); + dset = H5Dopen2(fid1, "dset11a", H5P_DEFAULT); + write_attr(dset, 2, dims, "attr", H5T_STD_U16LE, buf11a); + H5Dclose(dset); - write_dset(fid1,2,dims,"dset11b",H5T_STD_U32LE,buf11b); - dset=H5Dopen2 (fid1, "dset11b", H5P_DEFAULT); - write_attr(dset,2,dims,"attr",H5T_STD_U32LE,buf11b); - H5Dclose (dset); + write_dset(fid1, 2, dims, "dset11b", H5T_STD_U32LE, buf11b); + dset = H5Dopen2(fid1, "dset11b", H5P_DEFAULT); + write_attr(dset, 2, dims, "attr", H5T_STD_U32LE, buf11b); + H5Dclose(dset); /*------------------------------------------------------------------------- * Close @@ -935,59 +933,58 @@ int test_datatypes(const char *fname) } /* -# ############################################################################## -# # Dataset datatypes -# ############################################################################## + # ############################################################################## + # # Dataset datatypes + # ############################################################################## -# 5.0 -TOOLTEST h5diff_50.txt file4.h5 file4.h5 -v dset0a dset0b + # 5.0 + TOOLTEST h5diff_50.txt file4.h5 file4.h5 -v dset0a dset0b -# 5.1 -TOOLTEST h5diff_51.txt file4.h5 file4.h5 -v dset1a dset1b + # 5.1 + TOOLTEST h5diff_51.txt file4.h5 file4.h5 -v dset1a dset1b -# 5.2 -TOOLTEST h5diff_52.txt file4.h5 file4.h5 -v dset2a dset2b + # 5.2 + TOOLTEST h5diff_52.txt file4.h5 file4.h5 -v dset2a dset2b -# 5.3 -TOOLTEST h5diff_53.txt file4.h5 file4.h5 -v dset3a dset4b + # 5.3 + TOOLTEST h5diff_53.txt file4.h5 file4.h5 -v dset3a dset4b -# 5.4 -TOOLTEST h5diff_54.txt file4.h5 file4.h5 -v dset4a dset4b + # 5.4 + TOOLTEST h5diff_54.txt file4.h5 file4.h5 -v dset4a dset4b -# 5.5 -TOOLTEST h5diff_55.txt file4.h5 file4.h5 -v dset5a dset5b + # 5.5 + TOOLTEST h5diff_55.txt file4.h5 file4.h5 -v dset5a dset5b -# 5.6 -TOOLTEST h5diff_56.txt file4.h5 file4.h5 -v dset6a dset6b + # 5.6 + TOOLTEST h5diff_56.txt file4.h5 file4.h5 -v dset6a dset6b -# 5.7 -TOOLTEST h5diff_57.txt file4.h5 file4.h5 -v dset7a dset7b + # 5.7 + TOOLTEST h5diff_57.txt file4.h5 file4.h5 -v dset7a dset7b -# 5.8 (region reference) -TOOLTEST h5diff_58.txt file7.h5 file8.h5 -v refreg -*/ + # 5.8 (region reference) + TOOLTEST h5diff_58.txt file7.h5 file8.h5 -v refreg + */ /*------------------------------------------------------------------------- -* Function: test_attributes -* -* Purpose: test attributes -* -*------------------------------------------------------------------------- -*/ + * Function: test_attributes + * + * Purpose: test attributes + * + *------------------------------------------------------------------------- + */ static -int test_attributes(const char *file, - int make_diffs /* flag to modify data buffers */) +int test_attributes(const char *file, int make_diffs /* flag to modify data buffers */) { - hid_t fid; - hid_t did; - hid_t gid; - hid_t root_id; - hid_t sid; - hsize_t dims[1]={2}; - herr_t status; + hid_t fid = -1; + hid_t did = -1; + hid_t gid = -1; + hid_t root_id = -1; + hid_t sid = -1; + hsize_t dims[1] = { 2 }; + herr_t status; /* Create a file */ - if((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; /* Create a 1D dataset */ @@ -997,18 +994,23 @@ int test_attributes(const char *file, assert(status >= 0); /* Create groups */ - gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - root_id = H5Gopen2(fid, "/", H5P_DEFAULT); + gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + root_id = H5Gopen2(fid, "/", H5P_DEFAULT); /*------------------------------------------------------------------------- * write a series of attributes on the dataset, group, and root group *------------------------------------------------------------------------- */ - - write_attr_in(did,"dset",fid,make_diffs); - write_attr_in(gid,NULL,(hid_t)0,make_diffs); - write_attr_in(root_id,NULL,(hid_t)0,make_diffs); - + if (make_diffs > 1) { + write_attr_strings(did, "dset", fid, make_diffs); + write_attr_strings(gid, NULL, (hid_t) 0, make_diffs); + write_attr_strings(root_id, NULL, (hid_t) 0, make_diffs); + } + else { + write_attr_in(did, "dset", fid, make_diffs); + write_attr_in(gid, NULL, (hid_t) 0, make_diffs); + write_attr_in(root_id, NULL, (hid_t) 0, make_diffs); + } /* Close */ status = H5Dclose(did); @@ -1024,338 +1026,313 @@ int test_attributes(const char *file, return status; } - /*------------------------------------------------------------------------- -* Function: test_attributes_verbose_level -* -* Purpose: Cresting test files for testing attributes along with -* levels of verbos option -* -*------------------------------------------------------------------------- -*/ + * Function: test_attributes_verbose_level + * + * Purpose: Cresting test files for testing attributes along with + * levels of verbos option + * + *------------------------------------------------------------------------- + */ static int test_attributes_verbose_level(const char *fname1, const char *fname2) { - herr_t status = SUCCEED; - hid_t fid1 = -1, fid2 = -1; - hid_t f1_gid = -1, f2_gid = -1; - hid_t f1_gid2 = -1, f2_gid2 = -1; - hid_t f1_gid3 = -1, f2_gid3 = -1; - hid_t f1_gid4 = -1, f2_gid4 = -1; - hid_t f1_did = -1, f2_did = -1; - hid_t f1_sid = -1, f2_sid = -1; - hid_t f1_tid = -1, f2_tid = -1; + herr_t status = SUCCEED; + hid_t fid1 = -1, fid2 = -1; + hid_t f1_gid = -1, f2_gid = -1; + hid_t f1_gid2 = -1, f2_gid2 = -1; + hid_t f1_gid3 = -1, f2_gid3 = -1; + hid_t f1_gid4 = -1, f2_gid4 = -1; + hid_t f1_did = -1, f2_did = -1; + hid_t f1_sid = -1, f2_sid = -1; + hid_t f1_tid = -1, f2_tid = -1; /* dset */ - hsize_t dset_dims[1]={3}; - int dset_data[3] = {0,1,2}; + hsize_t dset_dims[1] = { 3 }; + int dset_data[3] = { 0, 1, 2 }; /* common attrs dim */ - hsize_t attr_dims[1]={2}; + hsize_t attr_dims[1] = { 2 }; /* file1 attr */ - int f1_attr_idata[2]= {1,2}; /* integer */ - float f1_attr_fdata[2]= {1.1F,2.2F}; /* float */ + int f1_attr_idata[2] = { 1, 2 }; /* integer */ + float f1_attr_fdata[2] = { 1.1F, 2.2F }; /* float */ /* file2 attr */ - int f2_attr_idata[2]= {2,3}; /* integer */ - float f2_attr_fdata[2]= {2.1F,3.2F}; /* float */ - + int f2_attr_idata[2] = { 2, 3 }; /* integer */ + float f2_attr_fdata[2] = { 2.1F, 3.2F }; /* float */ /*---------------------------------------------------------------------- * Create file1 *-----------------------------------------------------------------------*/ - if((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - { + if ((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } - /*---------------------------------- + /*---------------------------------- * Groups */ f1_gid = H5Gcreate2(fid1, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f1_gid < 0) - { + if (f1_gid < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } f1_gid2 = H5Gcreate2(fid1, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f1_gid2 < 0) - { + if (f1_gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } f1_gid3 = H5Gcreate2(fid1, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f1_gid3 < 0) - { + if (f1_gid3 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } f1_gid4 = H5Gcreate2(fid1, "g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f1_gid4 < 0) - { + if (f1_gid4 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } - /*---------------------------------- + /*---------------------------------- * Datasets */ f1_sid = H5Screate_simple(1, dset_dims, NULL); f1_did = H5Dcreate2(fid1, "dset", H5T_NATIVE_INT, f1_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f1_did == FAIL) - { + if (f1_did == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = H5Dwrite(f1_did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; } - /*---------------------------------- + /*---------------------------------- * Named Datatype */ f1_tid = H5Tcopy(H5T_NATIVE_INT); status = H5Tcommit2(fid1, "ntype", f1_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname1); status = FAIL; goto out; } - - - /*---------------------------------------------------------------------- * Create file2 *-----------------------------------------------------------------------*/ - if((fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - { + if ((fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; } - /*---------------------------------- + /*---------------------------------- * Groups */ f2_gid = H5Gcreate2(fid2, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f2_gid < 0) - { + if (f2_gid < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } f2_gid2 = H5Gcreate2(fid2, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f2_gid2 < 0) - { + if (f2_gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } f2_gid3 = H5Gcreate2(fid2, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f2_gid3 < 0) - { + if (f2_gid3 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } f2_gid4 = H5Gcreate2(fid2, "g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f2_gid4 < 0) - { + if (f2_gid4 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } - /*---------------------------------- + /*---------------------------------- * Datasets */ f2_sid = H5Screate_simple(1, dset_dims, NULL); f2_did = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, f2_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f2_did == FAIL) - { + if (f2_did == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = H5Dwrite(f2_did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname2); status = FAIL; goto out; } - /*---------------------------------- + /*---------------------------------- * Named Datatype */ f2_tid = H5Tcopy(H5T_NATIVE_INT); status = H5Tcommit2(fid2, "ntype", f2_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname2); status = FAIL; goto out; } - /*---------------------------------- + /*---------------------------------- * CASE1 - Same attr number, all Same attr name * add attr to group */ - write_attr(f1_gid,1,attr_dims,"integer1",H5T_NATIVE_INT,f1_attr_idata); - write_attr(f1_gid,1,attr_dims,"float1",H5T_NATIVE_FLOAT,f1_attr_fdata); + write_attr(f1_gid, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata); + write_attr(f1_gid, 1, attr_dims, "float1", H5T_NATIVE_FLOAT, f1_attr_fdata); - write_attr(f2_gid,1,attr_dims,"integer1",H5T_NATIVE_INT,f2_attr_idata); - write_attr(f2_gid,1,attr_dims,"float1",H5T_NATIVE_FLOAT,f2_attr_fdata); + write_attr(f2_gid, 1, attr_dims, "integer1", H5T_NATIVE_INT, f2_attr_idata); + write_attr(f2_gid, 1, attr_dims, "float1", H5T_NATIVE_FLOAT, f2_attr_fdata); - /*---------------------------------- + /*---------------------------------- * CASE2 - Same attr number, some Same attr name * add attr to dset */ - write_attr(f1_did,1,attr_dims,"integer1",H5T_NATIVE_INT,f1_attr_idata); - write_attr(f1_did,1,attr_dims,"float2",H5T_NATIVE_FLOAT,f1_attr_fdata); + write_attr(f1_did, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata); + write_attr(f1_did, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f1_attr_fdata); - write_attr(f2_did,1,attr_dims,"integer1",H5T_NATIVE_INT,f2_attr_idata); - write_attr(f2_did,1,attr_dims,"float3",H5T_NATIVE_FLOAT,f2_attr_fdata); + write_attr(f2_did, 1, attr_dims, "integer1", H5T_NATIVE_INT, f2_attr_idata); + write_attr(f2_did, 1, attr_dims, "float3", H5T_NATIVE_FLOAT, f2_attr_fdata); - /*---------------------------------- + /*---------------------------------- * CASE3 - Same attr number, all different attr name * add attr to ntype */ - write_attr(f1_tid,1,attr_dims,"integer1",H5T_NATIVE_INT,f1_attr_idata); - write_attr(f1_tid,1,attr_dims,"float2",H5T_NATIVE_FLOAT,f1_attr_fdata); - write_attr(f1_tid,1,attr_dims,"float3",H5T_NATIVE_FLOAT,f1_attr_fdata); + write_attr(f1_tid, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata); + write_attr(f1_tid, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f1_attr_fdata); + write_attr(f1_tid, 1, attr_dims, "float3", H5T_NATIVE_FLOAT, f1_attr_fdata); - write_attr(f2_tid,1,attr_dims,"integer4",H5T_NATIVE_INT,f2_attr_idata); - write_attr(f2_tid,1,attr_dims,"float5",H5T_NATIVE_FLOAT,f2_attr_fdata); - write_attr(f2_tid,1,attr_dims,"float6",H5T_NATIVE_FLOAT,f2_attr_fdata); + write_attr(f2_tid, 1, attr_dims, "integer4", H5T_NATIVE_INT, f2_attr_idata); + write_attr(f2_tid, 1, attr_dims, "float5", H5T_NATIVE_FLOAT, f2_attr_fdata); + write_attr(f2_tid, 1, attr_dims, "float6", H5T_NATIVE_FLOAT, f2_attr_fdata); - /*---------------------------------- + /*---------------------------------- * CASE4 - Different attr number, some same attr name (vs file2-g2) * add attr to g2 */ - write_attr(f1_gid2,1,attr_dims,"integer1",H5T_NATIVE_INT,f1_attr_idata); - write_attr(f1_gid2,1,attr_dims,"float2",H5T_NATIVE_FLOAT,f1_attr_fdata); - write_attr(f1_gid2,1,attr_dims,"float3",H5T_NATIVE_FLOAT,f1_attr_fdata); - - write_attr(f2_gid2,1,attr_dims,"integer1",H5T_NATIVE_INT,f2_attr_idata); - write_attr(f2_gid2,1,attr_dims,"float2",H5T_NATIVE_FLOAT,f2_attr_fdata); + write_attr(f1_gid2, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata); + write_attr(f1_gid2, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f1_attr_fdata); + write_attr(f1_gid2, 1, attr_dims, "float3", H5T_NATIVE_FLOAT, f1_attr_fdata); + write_attr(f2_gid2, 1, attr_dims, "integer1", H5T_NATIVE_INT, f2_attr_idata); + write_attr(f2_gid2, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f2_attr_fdata); - /*---------------------------------- + /*---------------------------------- * CASE5 - Different attr number, all different attr name * add attr to g3 */ - write_attr(f1_gid3,1,attr_dims,"integer10",H5T_NATIVE_INT,f1_attr_idata); - write_attr(f1_gid3,1,attr_dims,"float11",H5T_NATIVE_FLOAT,f1_attr_fdata); - write_attr(f1_gid3,1,attr_dims,"float12",H5T_NATIVE_FLOAT,f1_attr_fdata); - - write_attr(f2_gid3,1,attr_dims,"integer3",H5T_NATIVE_INT,f2_attr_idata); - write_attr(f2_gid3,1,attr_dims,"float4",H5T_NATIVE_FLOAT,f2_attr_fdata); + write_attr(f1_gid3, 1, attr_dims, "integer10", H5T_NATIVE_INT, f1_attr_idata); + write_attr(f1_gid3, 1, attr_dims, "float11", H5T_NATIVE_FLOAT, f1_attr_fdata); + write_attr(f1_gid3, 1, attr_dims, "float12", H5T_NATIVE_FLOAT, f1_attr_fdata); + write_attr(f2_gid3, 1, attr_dims, "integer3", H5T_NATIVE_INT, f2_attr_idata); + write_attr(f2_gid3, 1, attr_dims, "float4", H5T_NATIVE_FLOAT, f2_attr_fdata); out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1 > 0) + if (fid1 > 0) H5Fclose(fid1); - if(fid2 > 0) + if (fid2 > 0) H5Fclose(fid2); - if(f1_gid > 0) + if (f1_gid > 0) H5Gclose(f1_gid); - if(f2_gid > 0) + if (f2_gid > 0) H5Gclose(f2_gid); - if(f1_gid2 > 0) + if (f1_gid2 > 0) H5Gclose(f1_gid2); - if(f2_gid2 > 0) + if (f2_gid2 > 0) H5Gclose(f2_gid2); - if(f1_gid3 > 0) + if (f1_gid3 > 0) H5Gclose(f1_gid3); - if(f2_gid3 > 0) + if (f2_gid3 > 0) H5Gclose(f2_gid3); - if(f1_gid4 > 0) + if (f1_gid4 > 0) H5Gclose(f1_gid4); - if(f2_gid4 > 0) + if (f2_gid4 > 0) H5Gclose(f2_gid4); - if(f1_did > 0) + if (f1_did > 0) H5Dclose(f1_did); - if(f2_did > 0) + if (f2_did > 0) H5Dclose(f2_did); - if(f1_sid > 0) + if (f1_sid > 0) H5Sclose(f1_sid); - if(f2_sid > 0) + if (f2_sid > 0) H5Sclose(f2_sid); - if(f1_tid > 0) + if (f1_tid > 0) H5Tclose(f1_tid); - if(f2_tid > 0) + if (f2_tid > 0) H5Tclose(f2_tid); return status; } - /*------------------------------------------------------------------------- -* Function: test_datasets -* -* Purpose: Check all HDF5 classes -* H5T_INTEGER, H5T_FLOAT -* H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE, H5T_COMPOUND, H5T_REFERENCE, -* H5T_ENUM, H5T_VLEN, H5T_ARRAY -* -*------------------------------------------------------------------------- -*/ + * Function: test_datasets + * + * Purpose: Check all HDF5 classes + * H5T_INTEGER, H5T_FLOAT + * H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE, H5T_COMPOUND, H5T_REFERENCE, + * H5T_ENUM, H5T_VLEN, H5T_ARRAY + * + *------------------------------------------------------------------------- + */ static -int test_datasets(const char *file, - int make_diffs /* flag to modify data buffers */) +int test_datasets(const char *file, int make_diffs /* flag to modify data buffers */) { - hid_t fid; - hid_t did; - hid_t gid; - hid_t sid; - hsize_t dims[1]={2}; - herr_t status; - int buf[2]={1,2}; - - if(make_diffs > 0) + hid_t fid = -1; + hid_t did = -1; + hid_t gid = -1; + hid_t sid = -1; + hsize_t dims[1] = { 2 }; + herr_t status; + int buf[2] = { 1, 2 }; + + if (make_diffs > 0) memset(buf, 0, sizeof buf); /* Create a file */ - if((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; /* Create a 1D dataset */ sid = H5Screate_simple(1, dims, NULL); - did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); status = H5Sclose(sid); assert(status >= 0); /* Create a group */ - gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- * write a series of datasets on the group *------------------------------------------------------------------------- */ - write_dset_in(gid,"/dset",fid,make_diffs); + write_dset_in(gid, "/dset", fid, make_diffs); /* close */ status = H5Dclose(did); @@ -1370,29 +1347,29 @@ int test_datasets(const char *file, } /*------------------------------------------------------------------------- -* Function: test_special_datasets -* -* Purpose: Check datasets with datasapce of zero dimension size. -*------------------------------------------------------------------------- -*/ + * Function: test_special_datasets + * + * Purpose: Check datasets with datasapce of zero dimension size. + *------------------------------------------------------------------------- + */ static -int test_special_datasets(const char *file, - int make_diffs /* flag to modify data buffers */) +int test_special_datasets(const char *file, int make_diffs /* flag to modify data buffers */) { - hid_t fid; - hid_t did; - hid_t sid0, sid; - hsize_t dims0[SPACE1_RANK]={SPACE1_DIM1, SPACE1_DIM2}; - hsize_t dims[SPACE1_RANK]={SPACE1_DIM1, SPACE1_DIM2}; - herr_t status; + hid_t fid = -1; + hid_t did = -1; + hid_t sid0 = -1; + hid_t sid = -1; + hsize_t dims0[SPACE1_RANK] = { SPACE1_DIM1, SPACE1_DIM2 }; + hsize_t dims[SPACE1_RANK] = { SPACE1_DIM1, SPACE1_DIM2 }; + herr_t status; /* Create a file */ - if((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; /* Create a dataset with zero dimension size */ sid0 = H5Screate_simple(SPACE1_RANK, dims0, NULL); - did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* close dataset */ status = H5Dclose(did); @@ -1403,12 +1380,12 @@ int test_special_datasets(const char *file, assert(status >= 0); /* Create a dataset with zero dimension size in one file but the other one - * has a dataset with a non-zero dimension size */ - if(make_diffs) + * has a dataset with a non-zero dimension size */ + if (make_diffs) dims[1] = SPACE1_DIM2 + 4; sid = H5Screate_simple(SPACE1_RANK, dims, NULL); - did = H5Dcreate2(fid, "dset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + did = H5Dcreate2(fid, "dset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* close dataspace */ status = H5Sclose(sid); @@ -1425,26 +1402,25 @@ int test_special_datasets(const char *file, } /*------------------------------------------------------------------------- -* -* Purpose: Create test files to compare links, one has longer name than -* the other and short name is subset of long name. -* -* Programmer: Jonathan Kim (Feb 17, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files to compare links, one has longer name than + * the other and short name is subset of long name. + * + * Programmer: Jonathan Kim (Feb 17, 2010) + * + *-------------------------------------------------------------------------*/ static int test_link_name(const char *fname1) { - hid_t fid1=0; - hid_t gid1=0; - hid_t gid2=0; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t gid1 = -1; + hid_t gid2 = -1; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; @@ -1454,16 +1430,15 @@ static int test_link_name(const char *fname1) * Groups *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fid1, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } - gid2 = H5Gcreate2(fid1, "group_longname", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + gid2 = H5Gcreate2(fid1, "group_longname", H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT); - if (gid2 < 0) - { + if (gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -1473,16 +1448,14 @@ static int test_link_name(const char *fname1) * Soft Links *------------------------------------------------------------------------*/ status = H5Lcreate_soft("group", fid1, "link_g1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("group_longname", fid1, "link_g2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; @@ -1492,38 +1465,37 @@ out: /*----------------------------------------------------------------------- * Close *------------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(gid1) + if (gid1) H5Gclose(gid1); - if(gid2) + if (gid2) H5Gclose(gid2); return status; } /*------------------------------------------------------------------------- -* -* Purpose: Create test files to compare soft links in various way -* -* Programmer: Jonathan Kim (Feb 17, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files to compare soft links in various way + * + * Programmer: Jonathan Kim (Feb 17, 2010) + * + *-------------------------------------------------------------------------*/ static int test_soft_links(const char *fname1) { - hid_t fid1=0; - hid_t gid1=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}}; - int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t gid1 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; + int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; @@ -1533,8 +1505,7 @@ static int test_soft_links(const char *fname1) * Groups *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -1544,25 +1515,22 @@ static int test_soft_links(const char *fname1) * Datasets *------------------------------------------------------------------------*/ /* file1 */ - status = write_dset(fid1,2,dims2,"target_dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(fid1,2,dims2,"target_dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "target_dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid1,2,dims2,"dset",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1, 2, dims2, "dset", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; @@ -1573,48 +1541,42 @@ static int test_soft_links(const char *fname1) *------------------------------------------------------------------------*/ /* file 1 */ status = H5Lcreate_soft("/target_dset1", fid1, "softlink_dset1_1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/target_dset1", fid1, "softlink_dset1_2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/target_dset2", fid1, "softlink_dset2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/target_group", fid1, "softlink_group1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/target_group", fid1, "softlink_group2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/no_obj", fid1, "softlink_noexist", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; @@ -1624,38 +1586,37 @@ out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(gid1) + if (gid1) H5Gclose(gid1); return status; } /*------------------------------------------------------------------------- -* -* Purpose: Create test files to compare linked soft links in various way -* -* Programmer: Jonathan Kim (Feb 17, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files to compare linked soft links in various way + * + * Programmer: Jonathan Kim (Feb 17, 2010) + * + *-------------------------------------------------------------------------*/ static int test_linked_softlinks(const char *fname1) { - hid_t fid1=0; - hid_t gid1=0; - hid_t gid2=0; - hid_t gid3=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}}; - int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t gid1 = -1; + hid_t gid2 = -1; + hid_t gid3 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; + int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; @@ -1665,24 +1626,21 @@ static int test_linked_softlinks(const char *fname1) * Groups *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } gid2 = H5Gcreate2(fid1, "target_group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) - { + if (gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } gid3 = H5Gcreate2(fid1, "target_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid3 < 0) - { + if (gid3 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -1692,24 +1650,21 @@ static int test_linked_softlinks(const char *fname1) * Datasets *------------------------------------------------------------------------*/ /* file1 */ - status = write_dset(fid1,2,dims2,"target_dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(fid1,2,dims2,"target_dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "target_dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid1,2,dims2,"dset",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1, 2, dims2, "dset", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; @@ -1719,98 +1674,86 @@ static int test_linked_softlinks(const char *fname1) * Soft Links (Linked) *------------------------------------------------------------------------*/ /*--------- - * file 1 */ + * file 1 */ status = H5Lcreate_soft("/target_dset1", fid1, "softlink1_to_dset1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink1_to_dset1", fid1, "softlink1_to_slink1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink1_to_slink1", fid1, "softlink1_to_slink2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/target_dset2", fid1, "softlink2_to_dset2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink2_to_dset2", fid1, "softlink2_to_slink1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink2_to_slink1", fid1, "softlink2_to_slink2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("target_group1", fid1, "softlink3_to_group1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink3_to_group1", fid1, "softlink3_to_slink1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink3_to_slink1", fid1, "softlink3_to_slink2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("target_group2", fid1, "softlink4_to_group2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink4_to_group2", fid1, "softlink4_to_slink1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink4_to_slink1", fid1, "softlink4_to_slink2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; @@ -1820,52 +1763,50 @@ out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(gid1) + if (gid1) H5Gclose(gid1); - if(gid2) + if (gid2) H5Gclose(gid2); - if(gid3) + if (gid3) H5Gclose(gid3); return status; } /*------------------------------------------------------------------------- -* -* Purpose: Create test files to compare external links in various way -* -* Programmer: Jonathan Kim (Feb 17, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files to compare external links in various way + * + * Programmer: Jonathan Kim (Feb 17, 2010) + * + *-------------------------------------------------------------------------*/ static int test_external_links(const char *fname1, const char *fname2) { - hid_t fid1=0; - hid_t fid2=0; - hid_t gid1=0; - hid_t gid2=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}}; - int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t gid1 = -1; + hid_t gid2 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; + int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ /* source file */ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } /* target file */ - fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid2 < 0) - { + fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; @@ -1875,18 +1816,16 @@ static int test_external_links(const char *fname1, const char *fname2) * Groups *------------------------------------------------------------------------*/ /*-------------- - * target file */ + * target file */ gid1 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } gid2 = H5Gcreate2(fid2, "target_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) - { + if (gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; @@ -1895,26 +1834,23 @@ static int test_external_links(const char *fname1, const char *fname2) * Datasets *------------------------------------------------------------------------*/ /*-------------- - * target file */ - status = write_dset(fid2,2,dims2,"target_dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + * target file */ + status = write_dset(fid2, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid1,2,dims2,"x_dset",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1, 2, dims2, "x_dset", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid2,2,dims2,"x_dset",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(gid2, 2, dims2, "x_dset", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; @@ -1926,48 +1862,42 @@ static int test_external_links(const char *fname1, const char *fname2) /*--------------*/ /* source file */ status = H5Lcreate_external(fname2, "/target_group/x_dset", fid1, "ext_link_dset1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/target_group2/x_dset", fid1, "ext_link_dset2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/target_group", fid1, "/ext_link_grp1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/target_group2", fid1, "/ext_link_grp2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link_noexist1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external("no_file.h5", "no_obj", fid1, "ext_link_noexist2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; @@ -1977,52 +1907,50 @@ out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); - if(gid1) + if (gid1) H5Gclose(gid1); - if(gid2) + if (gid2) H5Gclose(gid2); return status; } /*------------------------------------------------------------------------- -* -* Purpose: Create test files to compare external links which point to -* soft link in various way -* -* Programmer: Jonathan Kim (Feb 17, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files to compare external links which point to + * soft link in various way + * + * Programmer: Jonathan Kim (Feb 17, 2010) + * + *-------------------------------------------------------------------------*/ static int test_ext2soft_links(const char *fname1, const char *fname2) { - hid_t fid1=0; - hid_t fid2=0; - hid_t gid2=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}}; - int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t gid2 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; + int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ /* source file */ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } /* target file */ - fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid2 < 0) - { + fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; @@ -2033,8 +1961,7 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ /* target file */ gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) - { + if (gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; @@ -2044,18 +1971,16 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) * Datasets *------------------------------------------------------------------------*/ /*-------------- - * target file */ - status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + * target file */ + status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(fid2,2,dims2,"dset2",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset2", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; @@ -2065,18 +1990,16 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) * Soft Links (Linked) *------------------------------------------------------------------------*/ /*--------------- - * target file */ + * target file */ status = H5Lcreate_soft("/dset1", fid2, "softlink_to_dset1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("/dset2", fid2, "softlink_to_dset2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; @@ -2086,26 +2009,23 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) * External Links *------------------------------------------------------------------------*/ /*--------------- - * source file */ + * source file */ status = H5Lcreate_external(fname2, "/target_group", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/softlink_to_dset1", fid1, "ext_link_to_slink1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/softlink_to_dset2", fid1, "ext_link_to_slink2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; @@ -2115,56 +2035,57 @@ out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); - if(gid2) + if (gid2) H5Gclose(gid2); return status; } /*------------------------------------------------------------------------- -* Function: gen_dataset_idx -* -* Purpose: Create a file with either the new or old format -* Create two datasets in the file: -* one dataset: fixed dimension, chunked layout, w/o filters -* one dataset: fixed dimension, chunked layout, w/ filters -* -*------------------------------------------------------------------------- -*/ + * Function: gen_dataset_idx + * + * Purpose: Create a file with either the new or old format + * Create two datasets in the file: + * one dataset: fixed dimension, chunked layout, w/o filters + * one dataset: fixed dimension, chunked layout, w/ filters + * + *------------------------------------------------------------------------- + */ static int gen_dataset_idx(const char *file, int format) { - hid_t fid; /* file id */ - hid_t did, did2; /* dataset id */ - hid_t sid; /* space id */ - hid_t fapl; /* file access property id */ - hid_t dcpl; /* dataset creation property id */ - hsize_t dims[1] = {10}; /* dataset dimension */ - hsize_t c_dims[1] = {2}; /* chunk dimension */ - herr_t status; /* return status */ - int buf[10]; /* data buffer */ - int i; /* local index variable */ + hid_t fid = -1; /* file id */ + hid_t did = -1; + hid_t did2 = -1; /* dataset id */ + hid_t sid = -1; /* space id */ + hid_t fapl = -1; /* file access property id */ + hid_t dcpl = -1; /* dataset creation property id */ + hsize_t dims[1] = { 10 }; /* dataset dimension */ + hsize_t c_dims[1] = { 2 }; /* chunk dimension */ + herr_t status; /* return status */ + int buf[10]; /* data buffer */ + int i; /* local index variable */ /* Get a copy of the file aaccess property */ fapl = H5Pcreate(H5P_FILE_ACCESS); /* Set the "use the latest format" bounds for creating objects in the file */ - if(format) { - status = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); - assert(status >= 0); + if (format) { + status = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + assert(status >= 0); } /* Create a file */ - if((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) return -1; /* Create data */ - for(i = 0; i < 10; i++) - buf[i] = i; + for (i = 0; i < 10; i++) + buf[i] = i; /* Set chunk */ dcpl = H5Pcreate(H5P_DATASET_CREATE); @@ -2173,7 +2094,7 @@ int gen_dataset_idx(const char *file, int format) /* Create a 1D dataset */ sid = H5Screate_simple(1, dims, NULL); - did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); /* Write to the dataset */ status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); @@ -2185,7 +2106,7 @@ int gen_dataset_idx(const char *file, int format) assert(status >= 0); /* Create and write the dataset */ - did2 = H5Dcreate2(fid, "dset_filter", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + did2 = H5Dcreate2(fid, "dset_filter", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); status = H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); assert(status >= 0); @@ -2215,35 +2136,33 @@ int gen_dataset_idx(const char *file, int format) } /*------------------------------------------------------------------------- -* -* Purpose: Create test files to compare dangling links in various way -* -* Programmer: Jonathan Kim (Feb 17, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files to compare dangling links in various way + * + * Programmer: Jonathan Kim (Feb 17, 2010) + * + *-------------------------------------------------------------------------*/ static int test_dangle_links(const char *fname1, const char *fname2) { - hid_t fid1=0; - hid_t fid2=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}}; - int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t fid2 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; + int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } - fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid2 < 0) - { + fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; @@ -2253,34 +2172,30 @@ static int test_dangle_links(const char *fname1, const char *fname2) * Datasets *------------------------------------------------------------------------*/ /* file1 */ - status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(fid1,2,dims2,"dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } /* file2 */ - status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(fid2,2,dims2,"dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; @@ -2291,32 +2206,28 @@ static int test_dangle_links(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ /* file 1 */ status = H5Lcreate_soft("no_obj", fid1, "soft_link1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/dset1", fid1, "soft_link2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("no_obj", fid1, "soft_link3", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("no_obj1", fid1, "soft_link4", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; @@ -2324,32 +2235,28 @@ static int test_dangle_links(const char *fname1, const char *fname2) /* file 2 */ status = H5Lcreate_soft("no_obj", fid2, "soft_link1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("no_obj", fid2, "soft_link2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("/dset2", fid2, "soft_link3", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("no_obj2", fid2, "soft_link4", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; @@ -2360,32 +2267,28 @@ static int test_dangle_links(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ /* file1 */ status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/dset1", fid1, "ext_link2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link3", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external("no_file.h5", "no_obj", fid1, "ext_link4", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; @@ -2393,32 +2296,28 @@ static int test_dangle_links(const char *fname1, const char *fname2) /* file2 */ status = H5Lcreate_external(fname1, "no_obj", fid2, "ext_link1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_external(fname1, "no_obj", fid2, "ext_link2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_external(fname1, "/dset2", fid2, "ext_link3", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_external("no_file.h5", "no_obj", fid2, "ext_link4", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; @@ -2428,47 +2327,45 @@ out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); return status; } /*------------------------------------------------------------------------- -* -* Purpose: For testing comparing group member objects recursively -* -* Programmer: Jonathan Kim (Aug 19, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: For testing comparing group member objects recursively + * + * Programmer: Jonathan Kim (Aug 19, 2010) + * + *-------------------------------------------------------------------------*/ static int test_group_recurse(const char *fname1, const char *fname2) { - hid_t fid1=0; - hid_t fid2=0; - hid_t gid1_f1=0, gid2_f1=0, gid3_f1=0, gid10_f1=0; - hid_t gid1_f2=0, gid2_f2=0, gid3_f2=0, gid11_f2=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,1},{0,1},{1,0},{1,0}}; - int data2[4][2] = {{0,2},{0,2},{2,0},{2,0}}; - int data3[4][2] = {{0,3},{0,3},{3,0},{3,0}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t gid1_f1 = -1, gid2_f1 = -1, gid3_f1 = -1, gid10_f1 = -1; + hid_t gid1_f2 = -1, gid2_f2 = -1, gid3_f2 = -1, gid11_f2 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 1 }, { 0, 1 }, { 1, 0 }, { 1, 0 } }; + int data2[4][2] = { { 0, 2 }, { 0, 2 }, { 2, 0 }, { 2, 0 } }; + int data3[4][2] = { { 0, 3 }, { 0, 3 }, { 3, 0 }, { 3, 0 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } - fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid2 < 0) - { + fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; @@ -2479,32 +2376,28 @@ static int test_group_recurse(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ /* file1 */ gid1_f1 = H5Gcreate2(fid1, "/grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1_f1 < 0) - { + if (gid1_f1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } gid2_f1 = H5Gcreate2(fid1, "/grp1/grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2_f1 < 0) - { + if (gid2_f1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } gid3_f1 = H5Gcreate2(fid1, "/grp1/grp2/grp3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid3_f1 < 0) - { + if (gid3_f1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } gid10_f1 = H5Gcreate2(fid1, "/grp10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid10_f1 < 0) - { + if (gid10_f1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -2512,32 +2405,28 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file2 */ gid1_f2 = H5Gcreate2(fid2, "/grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1_f2 < 0) - { + if (gid1_f2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } gid2_f2 = H5Gcreate2(fid2, "/grp1/grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2_f2 < 0) - { + if (gid2_f2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } gid3_f2 = H5Gcreate2(fid2, "/grp1/grp2/grp3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid3_f2 < 0) - { + if (gid3_f2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } gid11_f2 = H5Gcreate2(fid2, "/grp11", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid11_f2 < 0) - { + if (gid11_f2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; @@ -2547,50 +2436,44 @@ static int test_group_recurse(const char *fname1, const char *fname2) * Datasets under root *------------------------------------------------------------------------*/ /* file1 */ - status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(fid1,2,dims2,"dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(fid1,2,dims2,"dset3",H5T_NATIVE_INT,data3); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset3", H5T_NATIVE_INT, data3); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } /* file2 */ - status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(fid2,2,dims2,"dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(fid2,2,dims2,"dset3",H5T_NATIVE_INT,data3); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset3", H5T_NATIVE_INT, data3); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; @@ -2600,163 +2483,142 @@ static int test_group_recurse(const char *fname1, const char *fname2) * Datasets under group *------------------------------------------------------------------------*/ /* file1 */ - status = write_dset(gid1_f1,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1_f1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid2_f1,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid2_f1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid2_f1,2,dims2,"dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(gid2_f1, 2, dims2, "dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid3_f1,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid3_f1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid3_f1,2,dims2,"dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(gid3_f1, 2, dims2, "dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid3_f1,2,dims2,"dset3",H5T_NATIVE_INT,data3); - if (status == FAIL) - { + status = write_dset(gid3_f1, 2, dims2, "dset3", H5T_NATIVE_INT, data3); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid10_f1,2,dims2,"dset4",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid10_f1, 2, dims2, "dset4", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid10_f1,2,dims2,"dset5",H5T_NATIVE_INT,data3); - if (status == FAIL) - { + status = write_dset(gid10_f1, 2, dims2, "dset5", H5T_NATIVE_INT, data3); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } /* file2 */ - status = write_dset(gid1_f2,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1_f2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid2_f2,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid2_f2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid2_f2,2,dims2,"dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(gid2_f2, 2, dims2, "dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid3_f2,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid3_f2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid3_f2,2,dims2,"dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(gid3_f2, 2, dims2, "dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid3_f2,2,dims2,"dset3",H5T_NATIVE_INT,data3); - if (status == FAIL) - { + status = write_dset(gid3_f2, 2, dims2, "dset3", H5T_NATIVE_INT, data3); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid11_f2,2,dims2,"dset4",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid11_f2, 2, dims2, "dset4", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid11_f2,2,dims2,"dset5",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(gid11_f2, 2, dims2, "dset5", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - /*----------------------------------------------------------------------- * Soft Links *------------------------------------------------------------------------*/ /* file 1 */ status = H5Lcreate_soft("/grp1", fid1, "slink_grp1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/grp1/grp2", fid1, "slink_grp2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/grp1/grp2/grp3", fid1, "slink_grp3", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/grp10", fid1, "slink_grp10", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; @@ -2764,32 +2626,28 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file 2 */ status = H5Lcreate_soft("/grp1", fid2, "slink_grp1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("/grp1/grp2", fid2, "slink_grp2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("/grp1/grp2/grp3", fid2, "slink_grp3", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("/grp11", fid2, "slink_grp11", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; @@ -2800,24 +2658,21 @@ static int test_group_recurse(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ /* file1 */ status = H5Lcreate_external(fname2, "/grp1", fid1, "elink_grp1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/grp1/grp2", fid1, "elink_grp2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/grp1/grp2/grp3", fid1, "elink_grp3", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; @@ -2825,225 +2680,210 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file2 */ status = H5Lcreate_external(fname1, "/grp1", fid2, "elink_grp1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_external(fname1, "/grp1/grp2", fid2, "elink_grp2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_external(fname1, "/grp1/grp2/grp3", fid2, "elink_grp3", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } /*------------------------------ - * external circle route test - * file1/grp11 <-> file2/grp10 via elink_grp_circle link - */ + * external circle route test + * file1/grp11 <-> file2/grp10 via elink_grp_circle link + */ /* file1 */ status = H5Lcreate_external(fname2, "/grp11", gid10_f1, "elink_grp_circle", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } /* file2 */ status = H5Lcreate_external(fname1, "/grp10", gid11_f2, "elink_grp_circle", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } - out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); - if(gid1_f1) + if (gid1_f1) H5Gclose(gid1_f1); - if(gid2_f1) + if (gid2_f1) H5Gclose(gid2_f1); - if(gid3_f1) + if (gid3_f1) H5Gclose(gid3_f1); - if(gid1_f2) + if (gid1_f2) H5Gclose(gid1_f2); - if(gid2_f2) + if (gid2_f2) H5Gclose(gid2_f2); - if(gid3_f2) + if (gid3_f2) H5Gclose(gid3_f2); return status; } /*------------------------------------------------------------------------- -* -* Purpose: -* For testing comparing group member objects recursively via multiple -* linked external links -* -* Programmer: Jonathan Kim (Sep 16, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: + * For testing comparing group member objects recursively via multiple + * linked external links + * + * Programmer: Jonathan Kim (Sep 16, 2010) + * + *-------------------------------------------------------------------------*/ #define GRP_R_DSETNAME1 "dset1" #define GRP_R_DSETNAME2 "dset2" static int test_group_recurse2(void) { - hid_t fileid1 = -1; - hid_t grp1 = -1; - hid_t grp2 = -1; - hid_t grp3 = -1; - hid_t grp4 = -1; - hid_t dset1 = -1; - hid_t dset2 = -1; - hid_t datatype = -1; - hid_t dataspace = -1; - hid_t fileid2 = -1; - hid_t fileid3 = -1; - hid_t fileid4 = -1; - hsize_t dimsf[2]; /* dataset dimensions */ - herr_t status=0; - int data1[4][2] = {{0,0},{1,1},{2,2},{3,3}}; - int data2[4][2] = {{0,0},{0,1},{0,2},{3,3}}; - - /*----------------------------------------------------------------------- + hid_t fileid1 = -1; + hid_t grp1 = -1; + hid_t grp2 = -1; + hid_t grp3 = -1; + hid_t grp4 = -1; + hid_t dset1 = -1; + hid_t dset2 = -1; + hid_t datatype = -1; + hid_t dataspace = -1; + hid_t fileid2 = -1; + hid_t fileid3 = -1; + hid_t fileid4 = -1; + hsize_t dimsf[2]; /* dataset dimensions */ + herr_t status = 0; + int data1[4][2] = { { 0, 0 }, { 1, 1 }, { 2, 2 }, { 3, 3 } }; + int data2[4][2] = { { 0, 0 }, { 0, 1 }, { 0, 2 }, { 3, 3 } }; + + /*----------------------------------------------------------------------- * FILE 1 *------------------------------------------------------------------------*/ /* - * Create a new file using H5F_ACC_TRUNC access, - * default file creation properties, and default file - * access properties. - */ + * Create a new file using H5F_ACC_TRUNC access, + * default file creation properties, and default file + * access properties. + */ fileid1 = H5Fcreate(GRP_RECURSE1_EXT, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Groups *------------------------------------------------------------------------*/ grp1 = H5Gcreate2(fileid1, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (grp1 < 0) - { + if (grp1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; } grp2 = H5Gcreate2(grp1, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (grp2 < 0) - { + if (grp2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; } grp3 = H5Gcreate2(grp2, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (grp3 < 0) - { + if (grp3 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; } grp4 = H5Gcreate2(grp3, "g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (grp4 < 0) - { + if (grp4 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; } - - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Datasets *------------------------------------------------------------------------*/ /* - * Describe the size of the array and create the data space for fixed - * size dataset. - */ + * Describe the size of the array and create the data space for fixed + * size dataset. + */ dimsf[0] = 4; dimsf[1] = 2; dataspace = H5Screate_simple(2, dimsf, NULL); /* - * Define datatype for the data in the file. - * We will store little endian INT numbers. - */ + * Define datatype for the data in the file. + * We will store little endian INT numbers. + */ datatype = H5Tcopy(H5T_NATIVE_INT); status = H5Tset_order(datatype, H5T_ORDER_LE); /*--------------- - * dset1 - */ + * dset1 + */ /* - * Create a new dataset within the file using defined dataspace and - * datatype and default dataset creation properties. - */ - dset1 = H5Dcreate2(fileid1, GRP_R_DSETNAME1, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * Create a new dataset within the file using defined dataspace and + * datatype and default dataset creation properties. + */ + dset1 = H5Dcreate2(fileid1, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1); H5Dclose(dset1); /*--------------- - * dset1 - */ + * dset1 + */ /* - * Create a new dataset within the file using defined dataspace and - * datatype and default dataset creation properties. - */ - dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * Create a new dataset within the file using defined dataspace and + * datatype and default dataset creation properties. + */ + dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1); /*--------------- - * dset2 - */ + * dset2 + */ /* - * Create a new dataset within the fileid1 using defined dataspace and - * datatype and default dataset creation properties. - */ - dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * Create a new dataset within the fileid1 using defined dataspace and + * datatype and default dataset creation properties. + */ + dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2); - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Soft links *------------------------------------------------------------------------*/ /* - * under '/' root - */ + * under '/' root + */ /* link to dset1 */ status = H5Lcreate_soft(GRP_R_DSETNAME1, fileid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; @@ -3056,90 +2896,83 @@ static int test_group_recurse2(void) H5Gclose(grp3); H5Gclose(grp4); - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * FILE 2-3 *------------------------------------------------------------------------*/ /* crate target file */ fileid4 = H5Fcreate(GRP_RECURSE2_EXT3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - /*----------------------------------------------- + /*----------------------------------------------- * Groups */ grp4 = H5Gcreate2(fileid4, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (grp4 < 0) - { + if (grp4 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT3); status = FAIL; goto out; } /*--------------- - * dset2 - */ + * dset2 + */ /* - * Create a new dataset within the fileid1 using defined dataspace and - * datatype and default dataset creation properties. - */ - dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * Create a new dataset within the fileid1 using defined dataspace and + * datatype and default dataset creation properties. + */ + dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2); H5Gclose(grp4); H5Dclose(dset2); - - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * FILE 2-2 *------------------------------------------------------------------------*/ /* crate target file */ fileid3 = H5Fcreate(GRP_RECURSE2_EXT2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - /*----------------------------------------------- + /*----------------------------------------------- * Groups */ grp2 = H5Gcreate2(fileid3, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (grp2 < 0) - { + if (grp2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT2); status = FAIL; goto out; } grp3 = H5Gcreate2(grp2, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (grp3 < 0) - { + if (grp3 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT2); status = FAIL; goto out; } /*--------------- - * dset1 - */ + * dset1 + */ /* - * Create a new dataset within the fileid1 using defined dataspace and - * datatype and default dataset creation properties. - */ - dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * Create a new dataset within the fileid1 using defined dataspace and + * datatype and default dataset creation properties. + */ + dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1); - /*----------------------------------------------- + /*----------------------------------------------- * extlink to $GRP_RECURSE2_EXT3/g4 */ status = H5Lcreate_external(GRP_RECURSE2_EXT3, "/g4", fileid3, "/g2/g3/g4", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", GRP_RECURSE2_EXT2); status = FAIL; goto out; @@ -3149,56 +2982,52 @@ static int test_group_recurse2(void) H5Gclose(grp2); H5Gclose(grp3); - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * FILE 2-1 *------------------------------------------------------------------------*/ /* crate target file */ fileid2 = H5Fcreate(GRP_RECURSE2_EXT1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - /*----------------------------------------------- + /*----------------------------------------------- * Groups */ grp1 = H5Gcreate2(fileid2, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (grp1 < 0) - { + if (grp1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; } /*--------------- - * dset1 - */ - dset1 = H5Dcreate2(fileid2, GRP_R_DSETNAME1, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * dset1 + */ + dset1 = H5Dcreate2(fileid2, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1); - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Soft links *------------------------------------------------------------------------*/ /* - * under '/' root - */ + * under '/' root + */ /* link to dset1 */ status = H5Lcreate_soft(GRP_R_DSETNAME1, fileid2, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", GRP_RECURSE2_EXT1); status = FAIL; goto out; } - /*----------------------------------------------- + /*----------------------------------------------- * extlink to $GRP_RECURSE2_EXT2/g2 */ status = H5Lcreate_external(GRP_RECURSE2_EXT2, "/g2", fileid2, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", GRP_RECURSE2_EXT1); status = FAIL; goto out; @@ -3209,72 +3038,67 @@ static int test_group_recurse2(void) out: /* - * Close/release resources. - */ - if(dataspace > 0) + * Close/release resources. + */ + if (dataspace > 0) H5Sclose(dataspace); - if(datatype > 0) + if (datatype > 0) H5Tclose(datatype); - if(fileid1 > 0) + if (fileid1 > 0) H5Fclose(fileid1); - if(fileid2 > 0) + if (fileid2 > 0) H5Fclose(fileid2); - if(fileid3 > 0) + if (fileid3 > 0) H5Fclose(fileid3); - if(fileid4 > 0) + if (fileid4 > 0) H5Fclose(fileid4); return status; } - /*------------------------------------------------------------------------- -* -* Purpose: Create test files for excluding obj. -* Same structure, same obj names -* Test : exclude obj with different value to verify the rest are same -* -* Programmer: Jonathan Kim (July, 21, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files for excluding obj. + * Same structure, same obj names + * Test : exclude obj with different value to verify the rest are same + * + * Programmer: Jonathan Kim (July, 21, 2010) + * + *-------------------------------------------------------------------------*/ static int test_exclude_obj1(const char *fname1, const char *fname2) { - hid_t fid1=0; - hid_t fid2=0; - hid_t gid1=0; - hid_t gid2=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,0},{0,0},{0,0},{0,0}}; - int data2[4][2] = {{0,1},{2,3},{1,2},{3,4}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t gid1 = -1; + hid_t gid2 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + int data2[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } - fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid2 < 0) - { + fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; } - - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Group *------------------------------------------------------------------------*/ /* file1 */ gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -3283,133 +3107,119 @@ static int test_exclude_obj1(const char *fname1, const char *fname2) /* file2 */ gid2 = H5Gcreate2(fid2, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) - { + if (gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } - /*----------------------------------------------------------------------- * Datasets *------------------------------------------------------------------------*/ /* file1 */ - status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid1,2,dims2,"dset2",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1, 2, dims2, "dset2", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid1,2,dims2,"dset3",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1, 2, dims2, "dset3", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - /* file2 */ - status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid2,2,dims2,"dset2",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid2, 2, dims2, "dset2", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid2,2,dims2,"dset3",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(gid2, 2, dims2, "dset3", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); - if(gid1) + if (gid1) H5Gclose(gid1); - if(gid2) + if (gid2) H5Gclose(gid2); return status; } /*------------------------------------------------------------------------- -* -* Purpose: Create test files for excluding obj. -* different structure and name -* Test : exclude different objs to verify the rest are same -* -* Programmer: Jonathan Kim (July, 21, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files for excluding obj. + * different structure and name + * Test : exclude different objs to verify the rest are same + * + * Programmer: Jonathan Kim (July, 21, 2010) + * + *-------------------------------------------------------------------------*/ static int test_exclude_obj2(const char *fname1, const char *fname2) { - hid_t fid1=0; - hid_t fid2=0; - hid_t gid1=0; - hid_t gid2=0; - hid_t gid3=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,0},{0,0},{0,0},{0,0}}; - int data2[4][2] = {{0,1},{2,3},{1,2},{3,4}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t gid1 = -1; + hid_t gid2 = -1; + hid_t gid3 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + int data2[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } - fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid2 < 0) - { + fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; } - - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Group *------------------------------------------------------------------------*/ /* file1 */ gid1 = H5Gcreate2(fid1, "group10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -3417,9 +3227,7 @@ static int test_exclude_obj2(const char *fname1, const char *fname2) /* file2 */ gid2 = H5Gcreate2(fid2, "group10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - - if (gid2 < 0) - { + if (gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; @@ -3428,133 +3236,118 @@ static int test_exclude_obj2(const char *fname1, const char *fname2) /* subset name from group10 */ gid3 = H5Gcreate2(fid2, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid3 < 0) - { + if (gid3 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } - /*----------------------------------------------------------------------- * Datasets *------------------------------------------------------------------------*/ /* file1 */ - status = write_dset(fid1,2,dims2,"dset10",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset10", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid1,2,dims2,"dset2",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1, 2, dims2, "dset2", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - /* file2 */ - status = write_dset(fid2,2,dims2,"dset10",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset10", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid2,2,dims2,"dset2",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid2, 2, dims2, "dset2", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid3,2,dims2,"dset3",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(gid3, 2, dims2, "dset3", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); - if(gid1) + if (gid1) H5Gclose(gid1); - if(gid2) + if (gid2) H5Gclose(gid2); - if(gid3) + if (gid3) H5Gclose(gid3); return status; } /*------------------------------------------------------------------------- -* -* Purpose: Create test files for excluding obj. -* Only one file contains unique objs. Common objs are same. -* Test : exclude unique objs to verify the rest are same -* - HDFFV-7837 -* -* Programmer: Jonathan Kim (Mar, 19, 2012) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files for excluding obj. + * Only one file contains unique objs. Common objs are same. + * Test : exclude unique objs to verify the rest are same - HDFFV-7837 + * + * Programmer: Jonathan Kim (Mar, 19, 2012) + * + *-------------------------------------------------------------------------*/ static int test_exclude_obj3(const char *fname1, const char *fname2) { - hid_t fid1=0; - hid_t fid2=0; - hid_t gid1=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,0},{0,0},{0,0},{0,0}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t gid1 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } - fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid2 < 0) - { + fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; } - - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Group *------------------------------------------------------------------------*/ /* file1 */ gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -3564,26 +3357,23 @@ static int test_exclude_obj3(const char *fname1, const char *fname2) * Datasets *------------------------------------------------------------------------*/ /* file1 */ - status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid1,2,dims2,"dset",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1, 2, dims2, "dset", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } /* file2 */ - status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; @@ -3593,25 +3383,25 @@ out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); - if(gid1) + if (gid1) H5Gclose(gid1); return status; } /*------------------------------------------------------------------------- -* -* Purpose: Create test files for multiple variable length string/string array -* along with fixed length string/string array types in -* a compound type dataset. -* -* Programmer: Jonathan Kim (Oct, 26, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files for multiple variable length string/string array + * along with fixed length string/string array types in + * a compound type dataset. + * + * Programmer: Jonathan Kim (Oct, 26, 2010) + * + *-------------------------------------------------------------------------*/ #define STR_RANK 1 #define VLEN_STR_DIM 1 #define FIXLEN_STR_SIZE 21 @@ -3624,187 +3414,170 @@ out: static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new) { int i; - - hid_t fid1 = -1; /* file id */ - hid_t gid = -1; + hid_t fid1 = -1; /* file id */ + hid_t gid = -1; /* compound1 datatype */ - typedef struct comp1_t - { - char *str_vlen; /* vlen string */ - char *str_vlen_repeat; /* vlen string */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + typedef struct comp1_t { + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ } comp1_t; /* compound2 datatype */ - typedef struct comp2_t - { - char *str_vlen; /* vlen string */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen_repeat; /* vlen string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + typedef struct comp2_t { + char *str_vlen; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ } comp2_t; /* compound3 datatype */ - typedef struct comp3_t - { - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen; /* vlen string */ - char *str_vlen_repeat; /* vlen string */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + typedef struct comp3_t { + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ } comp3_t; /* compound4 datatype */ - typedef struct comp4_t - { - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen; /* vlen string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen_repeat; /* vlen string */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + typedef struct comp4_t { + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ } comp4_t; /* compound5 datatype */ - typedef struct comp5_t - { - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char *str_vlen; /* vlen string */ - char *str_vlen_repeat; /* vlen string */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + typedef struct comp5_t { + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ } comp5_t; /* compound6 datatype */ - typedef struct comp6_t - { - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char *str_vlen; /* vlen string */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen_repeat; /* vlen string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + typedef struct comp6_t { + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ } comp6_t; /* compound7 datatype */ - typedef struct comp7_t - { - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen; /* vlen string */ - char *str_vlen_repeat; /* vlen string */ + typedef struct comp7_t { + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ } comp7_t; /* compound8 datatype */ - typedef struct comp8_t - { - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen; /* vlen string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen_repeat; /* vlen string */ + typedef struct comp8_t { + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ } comp8_t; /* compound9 datatype */ - typedef struct comp9_t - { - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - int int_data1; - hobj_ref_t objref1; /* reference */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - hobj_ref_t objref2; /* reference */ - char *str_vlen; /* vlen string */ - int int_data2; - char *str_vlen_repeat; /* vlen string */ - hobj_ref_t objref3; /* reference */ - int int_data3; + typedef struct comp9_t { + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + int int_data1; + hobj_ref_t objref1; /* reference */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + hobj_ref_t objref2; /* reference */ + char *str_vlen; /* vlen string */ + int int_data2; + char *str_vlen_repeat; /* vlen string */ + hobj_ref_t objref3; /* reference */ + int int_data3; } comp9_t; /* vlen string */ - hid_t sid_vlen_str=0; /* dataspace ID */ - hid_t tid_vlen_str=0; /* datatype ID */ - char vlen_str_buf[]= { - "Variable length string" - }; - hsize_t dims_vlen_str[] = {VLEN_STR_DIM}; + hid_t sid_vlen_str = -1; /* dataspace ID */ + hid_t tid_vlen_str = -1; /* datatype ID */ + char vlen_str_buf[] = { "Variable length string" }; + hsize_t dims_vlen_str[] = { VLEN_STR_DIM }; /* fixlen string */ - hid_t sid_fixlen_str=0; /* dataspace ID */ - hid_t tid_fixlen_str=0; /* datatype ID */ - const char fixlen_str_buf[FIXLEN_STR_SIZE]= { - "Fixed length string" - }; - hsize_t dims_fixlen_str[] = {FIXLEN_STR_DIM}; + hid_t sid_fixlen_str = -1; /* dataspace ID */ + hid_t tid_fixlen_str = -1; /* datatype ID */ + const char fixlen_str_buf[FIXLEN_STR_SIZE] = { "Fixed length string" }; + hsize_t dims_fixlen_str[] = { FIXLEN_STR_DIM }; /* vlen string array */ - hid_t sid_vlen_str_array=0; /* dataspace ID */ - hid_t tid_vlen_str_array_pre=0; /* datatype ID */ - hid_t tid_vlen_str_array=0; /* datatype ID */ - const char *vlen_str_array_buf[VLEN_STR_ARRY_DIM]= { - "1 - Variable length string Array", - "2 - Testing variable length string array in compound type", - "3 - Four score and seven\n years ago our forefathers brought forth on this continent a new nation," - }; - hsize_t dims_vlen_str_array[] = {VLEN_STR_ARRY_DIM}; + hid_t sid_vlen_str_array = -1; /* dataspace ID */ + hid_t tid_vlen_str_array_pre = -1; /* datatype ID */ + hid_t tid_vlen_str_array = -1; /* datatype ID */ + const char *vlen_str_array_buf[VLEN_STR_ARRY_DIM] = + { "1 - Variable length string Array", + "2 - Testing variable length string array in compound type", + "3 - Four score and seven\n years ago our forefathers brought forth on this continent a new nation," }; + hsize_t dims_vlen_str_array[] = { VLEN_STR_ARRY_DIM }; /* fixlen string array */ - hid_t sid_fixlen_str_array=0; /* dataspace ID */ - hid_t tid_fixlen_str_array_pre=0; /* datatype ID */ - hid_t tid_fixlen_str_array=0; /* datatype ID */ - const char *fixlen_str_array_buf[FIXLEN_STR_ARRY_DIM]= { - "1 - Fixed length string Array", - "2 - Fixed length string Array", - "3 - Fixed length string Array" - }; - hsize_t dims_fixlen_str_array[] = {FIXLEN_STR_ARRY_DIM}; + hid_t sid_fixlen_str_array = -1; /* dataspace ID */ + hid_t tid_fixlen_str_array_pre = -1; /* datatype ID */ + hid_t tid_fixlen_str_array = -1; /* datatype ID */ + const char *fixlen_str_array_buf[FIXLEN_STR_ARRY_DIM] = { + "1 - Fixed length string Array", "2 - Fixed length string Array", + "3 - Fixed length string Array" }; + hsize_t dims_fixlen_str_array[] = { FIXLEN_STR_ARRY_DIM }; /*------------------------------------------ - * compound dataset - *------------------------------------------*/ - hid_t sid_comp=0; /* dataspace ID */ - hid_t tid1_comp=0; /* datatype ID */ - hid_t tid2_comp=0; /* datatype ID */ - hid_t tid3_comp=0; /* datatype ID */ - hid_t tid4_comp=0; /* datatype ID */ - hid_t tid5_comp=0; /* datatype ID */ - hid_t tid6_comp=0; /* datatype ID */ - hid_t tid7_comp=0; /* datatype ID */ - hid_t tid8_comp=0; /* datatype ID */ - hid_t tid9_comp=0; /* datatype ID */ - hid_t did_comp=0; /* dataset ID */ - hsize_t dims_comp[] = {COMP_DIM}; - herr_t status = SUCCEED; + * compound dataset + *------------------------------------------*/ + hid_t sid_comp = -1; /* dataspace ID */ + hid_t tid1_comp = -1; /* datatype ID */ + hid_t tid2_comp = -1; /* datatype ID */ + hid_t tid3_comp = -1; /* datatype ID */ + hid_t tid4_comp = -1; /* datatype ID */ + hid_t tid5_comp = -1; /* datatype ID */ + hid_t tid6_comp = -1; /* datatype ID */ + hid_t tid7_comp = -1; /* datatype ID */ + hid_t tid8_comp = -1; /* datatype ID */ + hid_t tid9_comp = -1; /* datatype ID */ + hid_t did_comp = -1; /* dataset ID */ + hsize_t dims_comp[] = { COMP_DIM }; + herr_t status = SUCCEED; /* make compound strings data */ comp1_t comp1_buf; @@ -3860,23 +3633,30 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int HDstrcpy(comp9_buf.str_fixlen_repeat, fixlen_str_buf); /* copy vlen string array data to compound buffers */ - for (i=0; i < VLEN_STR_ARRY_DIM; i++) - { - comp1_buf.str_array_vlen[i] = comp1_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; - comp2_buf.str_array_vlen[i] = comp2_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; - comp3_buf.str_array_vlen[i] = comp3_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; - comp4_buf.str_array_vlen[i] = comp4_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; - comp5_buf.str_array_vlen[i] = comp5_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; - comp6_buf.str_array_vlen[i] = comp6_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; - comp7_buf.str_array_vlen[i] = comp7_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; - comp8_buf.str_array_vlen[i] = comp8_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; - comp9_buf.str_array_vlen[i] = comp9_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + for (i = 0; i < VLEN_STR_ARRY_DIM; i++) { + comp1_buf.str_array_vlen[i] = comp1_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; + comp2_buf.str_array_vlen[i] = comp2_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; + comp3_buf.str_array_vlen[i] = comp3_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; + comp4_buf.str_array_vlen[i] = comp4_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; + comp5_buf.str_array_vlen[i] = comp5_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; + comp6_buf.str_array_vlen[i] = comp6_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; + comp7_buf.str_array_vlen[i] = comp7_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; + comp8_buf.str_array_vlen[i] = comp8_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; + comp9_buf.str_array_vlen[i] = comp9_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; } /* copy fixlen string attay data to compound buffers */ - for (i=0; i < FIXLEN_STR_ARRY_DIM; i++) - { + for (i = 0; i < FIXLEN_STR_ARRY_DIM; i++) { HDstrcpy(comp1_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); HDstrcpy(comp1_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); @@ -3910,25 +3690,20 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int comp9_buf.int_data2 = 20; comp9_buf.int_data3 = 30; - /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - if (is_file_new == 1) - { - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + if (is_file_new == 1) { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } } - else - { - fid1 = H5Fopen (fname1, H5F_ACC_RDWR, H5P_DEFAULT); - if (fid1 < 0) - { + else { + fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname1); status = FAIL; goto out; @@ -3939,8 +3714,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int * Create group *------------------------------------------------------------------------*/ gid = H5Gcreate2(fid1, grp_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid < 0) - { + if (gid < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -3950,8 +3724,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int * Variable length String1 - Create space and type *------------------------------------------------------------------------*/ sid_vlen_str = H5Screate_simple(STR_RANK, dims_vlen_str, NULL); - if (sid_vlen_str < 0) - { + if (sid_vlen_str < 0) { fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; @@ -3959,8 +3732,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int tid_vlen_str = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid_vlen_str, H5T_VARIABLE); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); status = FAIL; goto out; @@ -3970,8 +3742,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int * Fixed length String2 - Create space and type *------------------------------------------------------------------------*/ sid_fixlen_str = H5Screate_simple(STR_RANK, dims_fixlen_str, NULL); - if (sid_fixlen_str < 0) - { + if (sid_fixlen_str < 0) { fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; @@ -3979,8 +3750,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int tid_fixlen_str = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid_fixlen_str, FIXLEN_STR_SIZE); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); status = FAIL; goto out; @@ -3990,8 +3760,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int * Fixed length String3 array - Create space and type *------------------------------------------------------------------------*/ sid_vlen_str_array = H5Screate_simple(STR_RANK, dims_vlen_str_array, NULL); - if (sid_vlen_str_array < 0) - { + if (sid_vlen_str_array < 0) { fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; @@ -3999,17 +3768,15 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int tid_vlen_str_array_pre = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid_vlen_str_array_pre, H5T_VARIABLE); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); status = FAIL; goto out; } - /* Create the array data type for the string array */ + /* Create the array data type for the string array */ tid_vlen_str_array = H5Tarray_create2(tid_vlen_str_array_pre, COMP_RANK, dims_vlen_str_array); - if (tid_vlen_str_array < 0) - { + if (tid_vlen_str_array < 0) { fprintf(stderr, "Error: %s> H5Tarray_create2 failed.\n", fname1); status = FAIL; goto out; @@ -4019,8 +3786,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int * Variable length String4 array - Create space and type *------------------------------------------------------------------------*/ sid_fixlen_str_array = H5Screate_simple(STR_RANK, dims_fixlen_str_array, NULL); - if (sid_fixlen_str_array < 0) - { + if (sid_fixlen_str_array < 0) { fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; @@ -4028,126 +3794,123 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int tid_fixlen_str_array_pre = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid_fixlen_str_array_pre, FIXLEN_STR_ARRY_SIZE); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); status = FAIL; goto out; } - /* Create the array data type for the string array */ + /* Create the array data type for the string array */ tid_fixlen_str_array = H5Tarray_create2(tid_fixlen_str_array_pre, COMP_RANK, dims_fixlen_str_array); - if (tid_fixlen_str_array < 0) - { + if (tid_fixlen_str_array < 0) { fprintf(stderr, "Error: %s> H5Tarray_create2 failed.\n", fname1); status = FAIL; goto out; } - /*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * Compound dataset *------------------------------------------------------------------------*/ sid_comp = H5Screate_simple(COMP_RANK, dims_comp, NULL); - if (sid_comp < 0) - { + if (sid_comp < 0) { fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; } - tid1_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp1_t)); - tid2_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp2_t)); - tid3_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp3_t)); - tid4_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp4_t)); - tid5_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp5_t)); - tid6_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp6_t)); - tid7_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp7_t)); - tid8_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp8_t)); - tid9_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp9_t)); + tid1_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp1_t)); + tid2_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp2_t)); + tid3_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp3_t)); + tid4_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp4_t)); + tid5_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp5_t)); + tid6_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp6_t)); + tid7_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp7_t)); + tid8_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp8_t)); + tid9_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp9_t)); /* compound 1 */ - H5Tinsert(tid1_comp, "VLEN_STR1", HOFFSET(comp1_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid1_comp, "VLEN_STR2", HOFFSET(comp1_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid1_comp, "FIXLEN_STR1", HOFFSET(comp1_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid1_comp, "FIXLEN_STR2", HOFFSET(comp1_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid1_comp, "VLEN_STR1", HOFFSET(comp1_t, str_vlen), tid_vlen_str); + H5Tinsert(tid1_comp, "VLEN_STR2", HOFFSET(comp1_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid1_comp, "FIXLEN_STR1", HOFFSET(comp1_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid1_comp, "FIXLEN_STR2", HOFFSET(comp1_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid1_comp, "VLEN_STR_ARRAY1", HOFFSET(comp1_t, str_array_vlen), tid_vlen_str_array); H5Tinsert(tid1_comp, "VLEN_STR_ARRAY2", HOFFSET(comp1_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid1_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp1_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid1_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp1_t, str_fixlen_array_again), tid_fixlen_str_array); /* compound 2 */ - H5Tinsert(tid2_comp, "VLEN_STR1", HOFFSET(comp2_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid2_comp, "VLEN_STR2", HOFFSET(comp2_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid2_comp, "FIXLEN_STR1", HOFFSET(comp2_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid2_comp, "FIXLEN_STR2", HOFFSET(comp2_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid2_comp, "VLEN_STR1", HOFFSET(comp2_t, str_vlen), tid_vlen_str); + H5Tinsert(tid2_comp, "VLEN_STR2", HOFFSET(comp2_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid2_comp, "FIXLEN_STR1", HOFFSET(comp2_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid2_comp, "FIXLEN_STR2", HOFFSET(comp2_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid2_comp, "VLEN_STR_ARRAY1", HOFFSET(comp2_t, str_array_vlen), tid_vlen_str_array); H5Tinsert(tid2_comp, "VLEN_STR_ARRAY2", HOFFSET(comp2_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid2_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp2_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid2_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp2_t, str_fixlen_array_again), tid_fixlen_str_array); /* compound 3 */ - H5Tinsert(tid3_comp, "VLEN_STR1", HOFFSET(comp3_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid3_comp, "VLEN_STR2", HOFFSET(comp3_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid3_comp, "FIXLEN_STR1", HOFFSET(comp3_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid3_comp, "FIXLEN_STR2", HOFFSET(comp3_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid3_comp, "VLEN_STR1", HOFFSET(comp3_t, str_vlen), tid_vlen_str); + H5Tinsert(tid3_comp, "VLEN_STR2", HOFFSET(comp3_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid3_comp, "FIXLEN_STR1", HOFFSET(comp3_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid3_comp, "FIXLEN_STR2", HOFFSET(comp3_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid3_comp, "VLEN_STR_ARRAY1", HOFFSET(comp3_t, str_array_vlen), tid_vlen_str_array); H5Tinsert(tid3_comp, "VLEN_STR_ARRAY2", HOFFSET(comp3_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid3_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp3_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid3_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp3_t, str_fixlen_array_again), tid_fixlen_str_array); /* compound 4 */ - H5Tinsert(tid4_comp, "VLEN_STR1", HOFFSET(comp4_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid4_comp, "VLEN_STR2", HOFFSET(comp4_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid4_comp, "FIXLEN_STR1", HOFFSET(comp4_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid4_comp, "FIXLEN_STR2", HOFFSET(comp4_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid4_comp, "VLEN_STR1", HOFFSET(comp4_t, str_vlen), tid_vlen_str); + H5Tinsert(tid4_comp, "VLEN_STR2", HOFFSET(comp4_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid4_comp, "FIXLEN_STR1", HOFFSET(comp4_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid4_comp, "FIXLEN_STR2", HOFFSET(comp4_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid4_comp, "VLEN_STR_ARRAY1", HOFFSET(comp4_t, str_array_vlen), tid_vlen_str_array); H5Tinsert(tid4_comp, "VLEN_STR_ARRAY2", HOFFSET(comp4_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid4_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp4_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid4_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp4_t, str_fixlen_array_again), tid_fixlen_str_array); /* compound 5 */ - H5Tinsert(tid5_comp, "VLEN_STR1", HOFFSET(comp5_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid5_comp, "VLEN_STR2", HOFFSET(comp5_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid5_comp, "FIXLEN_STR1", HOFFSET(comp5_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid5_comp, "FIXLEN_STR2", HOFFSET(comp5_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid5_comp, "VLEN_STR1", HOFFSET(comp5_t, str_vlen), tid_vlen_str); + H5Tinsert(tid5_comp, "VLEN_STR2", HOFFSET(comp5_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid5_comp, "FIXLEN_STR1", HOFFSET(comp5_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid5_comp, "FIXLEN_STR2", HOFFSET(comp5_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid5_comp, "VLEN_STR_ARRAY1", HOFFSET(comp5_t, str_array_vlen), tid_vlen_str_array); - H5Tinsert(tid5_comp, "VLEN_STR_ARRAY2", HOFFSET(comp5_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid5_comp, "VLEN_STR_ARRAY2", HOFFSET(comp5_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid5_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp5_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid5_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp5_t, str_fixlen_array_again), tid_fixlen_str_array); /* compound 6 */ - H5Tinsert(tid6_comp, "VLEN_STR1", HOFFSET(comp6_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid6_comp, "VLEN_STR2", HOFFSET(comp6_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid6_comp, "FIXLEN_STR1", HOFFSET(comp6_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid6_comp, "FIXLEN_STR2", HOFFSET(comp6_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid6_comp, "VLEN_STR1", HOFFSET(comp6_t, str_vlen), tid_vlen_str); + H5Tinsert(tid6_comp, "VLEN_STR2", HOFFSET(comp6_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid6_comp, "FIXLEN_STR1", HOFFSET(comp6_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid6_comp, "FIXLEN_STR2", HOFFSET(comp6_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid6_comp, "VLEN_STR_ARRAY1", HOFFSET(comp6_t, str_array_vlen), tid_vlen_str_array); H5Tinsert(tid6_comp, "VLEN_STR_ARRAY2", HOFFSET(comp6_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid6_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp6_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid6_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp6_t, str_fixlen_array_again), tid_fixlen_str_array); /* compound 7 */ - H5Tinsert(tid7_comp, "VLEN_STR1", HOFFSET(comp7_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid7_comp, "VLEN_STR2", HOFFSET(comp7_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid7_comp, "FIXLEN_STR1", HOFFSET(comp7_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid7_comp, "FIXLEN_STR2", HOFFSET(comp7_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid7_comp, "VLEN_STR1", HOFFSET(comp7_t, str_vlen), tid_vlen_str); + H5Tinsert(tid7_comp, "VLEN_STR2", HOFFSET(comp7_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid7_comp, "FIXLEN_STR1", HOFFSET(comp7_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid7_comp, "FIXLEN_STR2", HOFFSET(comp7_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid7_comp, "VLEN_STR_ARRAY1", HOFFSET(comp7_t, str_array_vlen), tid_vlen_str_array); H5Tinsert(tid7_comp, "VLEN_STR_ARRAY2", HOFFSET(comp7_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid7_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp7_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid7_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp7_t, str_fixlen_array_again), tid_fixlen_str_array); /* compound 8 */ - H5Tinsert(tid8_comp, "VLEN_STR1", HOFFSET(comp8_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid8_comp, "VLEN_STR2", HOFFSET(comp8_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid8_comp, "FIXLEN_STR1", HOFFSET(comp8_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid8_comp, "FIXLEN_STR2", HOFFSET(comp8_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid8_comp, "VLEN_STR1", HOFFSET(comp8_t, str_vlen), tid_vlen_str); + H5Tinsert(tid8_comp, "VLEN_STR2", HOFFSET(comp8_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid8_comp, "FIXLEN_STR1", HOFFSET(comp8_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid8_comp, "FIXLEN_STR2", HOFFSET(comp8_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid8_comp, "VLEN_STR_ARRAY1", HOFFSET(comp8_t, str_array_vlen), tid_vlen_str_array); H5Tinsert(tid8_comp, "VLEN_STR_ARRAY2", HOFFSET(comp8_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid8_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp8_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid8_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp8_t, str_fixlen_array_again), tid_fixlen_str_array); /* compound 9 */ - H5Tinsert(tid9_comp, "VLEN_STR1", HOFFSET(comp9_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid9_comp, "VLEN_STR2", HOFFSET(comp9_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid9_comp, "FIXLEN_STR1", HOFFSET(comp9_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid9_comp, "FIXLEN_STR2", HOFFSET(comp9_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid9_comp, "VLEN_STR1", HOFFSET(comp9_t, str_vlen), tid_vlen_str); + H5Tinsert(tid9_comp, "VLEN_STR2", HOFFSET(comp9_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid9_comp, "FIXLEN_STR1", HOFFSET(comp9_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid9_comp, "FIXLEN_STR2", HOFFSET(comp9_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid9_comp, "VLEN_STR_ARRAY1", HOFFSET(comp9_t, str_array_vlen), tid_vlen_str_array); H5Tinsert(tid9_comp, "VLEN_STR_ARRAY2", HOFFSET(comp9_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid9_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp9_t, str_array_fixlen), tid_fixlen_str_array); @@ -4159,12 +3922,10 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int H5Tinsert(tid9_comp, "OBJREF2", HOFFSET(comp9_t, objref2), H5T_STD_REF_OBJ); H5Tinsert(tid9_comp, "OBJREF3", HOFFSET(comp9_t, objref3), H5T_STD_REF_OBJ); - /* Write data to compound 1 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset1", tid1_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid1_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp1_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; @@ -4174,8 +3935,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 2 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset2", tid2_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid2_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp2_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; @@ -4185,8 +3945,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 3 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset3", tid3_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid3_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp3_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; @@ -4196,8 +3955,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 4 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset4", tid4_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid4_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp4_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; @@ -4207,8 +3965,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 5 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset5", tid5_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid5_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp5_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; @@ -4218,8 +3975,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 6 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset6", tid6_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid6_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp6_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; @@ -4229,8 +3985,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 7 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset7", tid7_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid7_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp7_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; @@ -4240,8 +3995,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 8 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset8", tid8_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid8_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp8_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; @@ -4252,166 +4006,158 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int did_comp = H5Dcreate2(gid, "Compound_dset9", tid9_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* obj references */ - status=H5Rcreate(&(comp9_buf.objref1),gid,"Compound_dset2",H5R_OBJECT,(hid_t)-1); - status=H5Rcreate(&(comp9_buf.objref2),gid,"Compound_dset3",H5R_OBJECT,(hid_t)-1); - status=H5Rcreate(&(comp9_buf.objref3),gid,"Compound_dset4",H5R_OBJECT,(hid_t)-1); + status = H5Rcreate(&(comp9_buf.objref1), gid, "Compound_dset2", H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&(comp9_buf.objref2), gid, "Compound_dset3", H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&(comp9_buf.objref3), gid, "Compound_dset4", H5R_OBJECT, (hid_t) -1); status = H5Dwrite(did_comp, tid9_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp9_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; } - H5Dclose(did_comp); + did_comp = -1; - did_comp=0; out: - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1 > 0) + if (fid1 > 0) H5Fclose(fid1); - if(gid > 0) + if (gid > 0) H5Gclose(gid); /* vlen string */ - if(tid_vlen_str > 0) + if (tid_vlen_str > 0) H5Tclose(tid_vlen_str); - if(sid_vlen_str > 0) + if (sid_vlen_str > 0) H5Sclose(sid_vlen_str); /* fixed len string */ - if(tid_fixlen_str > 0) + if (tid_fixlen_str > 0) H5Tclose(tid_fixlen_str); - if(sid_fixlen_str > 0) + if (sid_fixlen_str > 0) H5Sclose(sid_fixlen_str); /* vlen string array */ - if(tid_vlen_str_array_pre > 0) + if (tid_vlen_str_array_pre > 0) H5Tclose(tid_vlen_str_array_pre); - if(tid_vlen_str_array > 0) + if (tid_vlen_str_array > 0) H5Tclose(tid_vlen_str_array); - if(sid_vlen_str_array > 0) + if (sid_vlen_str_array > 0) H5Sclose(sid_vlen_str_array); /* fixed len string array */ - if(tid_fixlen_str_array_pre > 0) + if (tid_fixlen_str_array_pre > 0) H5Tclose(tid_fixlen_str_array_pre); - if(tid_fixlen_str_array > 0) + if (tid_fixlen_str_array > 0) H5Tclose(tid_fixlen_str_array); - if(sid_fixlen_str_array > 0) + if (sid_fixlen_str_array > 0) H5Sclose(sid_fixlen_str_array); /* compound */ - if(tid1_comp > 0) + if (tid1_comp > 0) H5Tclose(tid1_comp); - if(tid2_comp > 0) + if (tid2_comp > 0) H5Tclose(tid2_comp); - if(tid3_comp > 0) + if (tid3_comp > 0) H5Tclose(tid3_comp); - if(tid4_comp > 0) + if (tid4_comp > 0) H5Tclose(tid4_comp); - if(tid5_comp > 0) + if (tid5_comp > 0) H5Tclose(tid5_comp); - if(tid6_comp > 0) + if (tid6_comp > 0) H5Tclose(tid6_comp); - if(tid7_comp > 0) + if (tid7_comp > 0) H5Tclose(tid7_comp); - if(tid8_comp > 0) + if (tid8_comp > 0) H5Tclose(tid8_comp); - if(tid9_comp > 0) + if (tid9_comp > 0) H5Tclose(tid9_comp); - if(did_comp > 0) + if (did_comp > 0) H5Dclose(did_comp); - if(sid_comp > 0) + if (sid_comp > 0) H5Sclose(sid_comp); return status; } /* end test_comp_vlen_strings() */ - /*------------------------------------------------------------------------- -* -* Purpose: Test diffs of enum values which may include invalid values. -* -* Programmer: Dana Robinson -* -*-------------------------------------------------------------------------*/ - -static int -test_enums(const char *fname) + * + * Purpose: Test diffs of enum values which may include invalid values. + * + * Programmer: Dana Robinson + * + *-------------------------------------------------------------------------*/ + +static int test_enums(const char *fname) { - hid_t fid = -1; + hid_t fid = -1; - hid_t tid = -1; - int enum_val = -1; + hid_t tid = -1; + int enum_val = -1; /* The data in the two arrays cover the following cases: - * - * V = valid enum value, I = invalid enum value - * - * 0: I-I (same value) - * 1: V-I - * 2: I-V - * 3: V-V (same value) - * 4: I-I (different values) SKIPPED FOR NOW - * 5: V-V (different values) - */ + * + * V = valid enum value, I = invalid enum value + * + * 0: I-I (same value) + * 1: V-I + * 2: I-V + * 3: V-V (same value) + * 4: I-I (different values) SKIPPED FOR NOW + * 5: V-V (different values) + */ /* *** NOTE *** - * - * There is a bug in H5Dread() where invalid enum values are always - * returned as -1 so two different invalid enum values cannot be - * properly compared. Test 4 has been adjusted to pass here - * while we fix the issue. - */ - int data1[6] = {9, 0, 9, 0, 9, 0}; + * + * There is a bug in H5Dread() where invalid enum values are always + * returned as -1 so two different invalid enum values cannot be + * properly compared. Test 4 has been adjusted to pass here + * while we fix the issue. + */ + int data1[6] = { 9, 0, 9, 0, 9, 0 }; /*int data1[6] = {9, 0, 9, 0, 8, 0}; */ - int data2[6] = {9, 9, 0, 0, 9, 1}; + int data2[6] = { 9, 9, 0, 0, 9, 1 }; - hsize_t dims = 6; + hsize_t dims = 6; - herr_t status = SUCCEED; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- - * Create the file - *---------------------------------------------------------------------*/ + * Create the file + *---------------------------------------------------------------------*/ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /*----------------------------------------------------------------------- - * Create enum types - *---------------------------------------------------------------------*/ + * Create enum types + *---------------------------------------------------------------------*/ tid = H5Tenum_create(H5T_NATIVE_INT); enum_val = 0; status = H5Tenum_insert(tid, "YIN", &enum_val); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tenum_insert failed.\n", fname); status = FAIL; goto out; } enum_val = 1; status = H5Tenum_insert(tid, "YANG", &enum_val); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tenum_insert failed.\n", fname); status = FAIL; goto out; } /*----------------------------------------------------------------------- - * Create datasets containing enum data. - *---------------------------------------------------------------------*/ + * Create datasets containing enum data. + *---------------------------------------------------------------------*/ status = write_dset(fid, 1, &dims, "dset1", tid, data1); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> write_dset failed.\n", fname); status = FAIL; goto out; } status = write_dset(fid, 1, &dims, "dset2", tid, data2); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> write_dset failed.\n", fname); status = FAIL; goto out; @@ -4419,41 +4165,41 @@ test_enums(const char *fname) out: /*----------------------------------------------------------------------- - * Close - *---------------------------------------------------------------------*/ - if(fid) + * Close + *---------------------------------------------------------------------*/ + if (fid) H5Fclose(fid); - if(tid) + if (tid) H5Tclose(tid); return status; } /*------------------------------------------------------------------------- -* -* Purpose: -* Create test files with dataset and attribute with container types -* (array, vlen) with multiple nested compound types. -* -* Function: test_comps_array() -* - type: compound->array->compound -* -* Function: test_comps_vlen() -* - type: compound->vlen->compound -* -* Function: test_comps_array_vlen() -* - type: compound->array->compound->vlen->compound -* -* Function: test_comps_vlen_arry() -* - type: compound->vlen->compound->array->compound -* -* Programmer: Jonathan Kim (Sep, 1, 2011) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: + * Create test files with dataset and attribute with container types + * (array, vlen) with multiple nested compound types. + * + * Function: test_comps_array() + * - type: compound->array->compound + * + * Function: test_comps_vlen() + * - type: compound->vlen->compound + * + * Function: test_comps_array_vlen() + * - type: compound->array->compound->vlen->compound + * + * Function: test_comps_vlen_arry() + * - type: compound->vlen->compound->array->compound + * + * Programmer: Jonathan Kim (Sep, 1, 2011) + * + *-------------------------------------------------------------------------*/ #define SDIM_DSET 2 #define SDIM_CMPD_ARRAY 2 -static void test_comps_array (const char *fname, const char *dset, const char *attr,int diff, int is_file_new) +static void test_comps_array(const char *fname, const char *dset, const char *attr, int diff, int is_file_new) { /* sub compound 2 */ typedef struct { @@ -4467,42 +4213,39 @@ static void test_comps_array (const char *fname, const char *dset, const char *a cmpd2_t cmpd2[SDIM_CMPD_ARRAY]; } cmpd1_t; - cmpd1_t wdata[SDIM_DSET]; /* dataset with compound1 */ + cmpd1_t wdata[SDIM_DSET]; /* dataset with compound1 */ - hid_t fid; /* HDF5 File IDs */ - hid_t did_dset; /* Dataset ID */ - hid_t sid_dset; /* Dataset space ID */ - hid_t tid_cmpd1; /* Compound1 type ID */ - hid_t tid_arry1; /* Array type ID in compound1 */ - hid_t tid_cmpd2; /* Compound2 type ID */ - hid_t tid_attr; - hsize_t sdims_dset[] = {SDIM_DSET}; - hsize_t sdims_cmpd_arry[] = {SDIM_CMPD_ARRAY}; - int i,j; - herr_t ret; /* Generic return value */ + hid_t fid = -1; /* HDF5 File IDs */ + hid_t did_dset = -1; /* Dataset ID */ + hid_t sid_dset = -1; /* Dataset space ID */ + hid_t tid_cmpd1 = -1; /* Compound1 type ID */ + hid_t tid_arry1 = -1; /* Array type ID in compound1 */ + hid_t tid_cmpd2 = -1; /* Compound2 type ID */ + hid_t tid_attr = -1; + hsize_t sdims_dset[] = { SDIM_DSET }; + hsize_t sdims_cmpd_arry[] = { SDIM_CMPD_ARRAY }; + int i, j; + herr_t ret; /* Generic return value */ /* Initialize array data to write */ - for(i=0; i < SDIM_DSET; i++) - { + for (i = 0; i < SDIM_DSET; i++) { wdata[i].i1 = i; - for(j=0; j < SDIM_CMPD_ARRAY; j++) - { + for (j = 0; j < SDIM_CMPD_ARRAY; j++) { wdata[i].cmpd2[j].i2 = i * 10 + diff; - wdata[i].cmpd2[j].f2 = (float)i * 10.5F + (float)diff; + wdata[i].cmpd2[j].f2 = (float) i * 10.5F + (float) diff; } /* end for */ } - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ if (is_file_new == 1) fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); else - fid = H5Fopen (fname, H5F_ACC_RDWR, H5P_DEFAULT); - + fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); /* ------------------------------- - * Create a sub compound2 datatype */ + * Create a sub compound2 datatype */ tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t)); /* Insert integer field */ @@ -4514,9 +4257,9 @@ static void test_comps_array (const char *fname, const char *dset, const char *a assert(ret >= 0); /*----------------------------------- - * Create a top compound1. - */ - tid_cmpd1 = H5Tcreate (H5T_COMPOUND, sizeof(cmpd1_t)); + * Create a top compound1. + */ + tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t)); ret = H5Tinsert(tid_cmpd1, "int1", HOFFSET(cmpd1_t, i1), H5T_NATIVE_INT); assert(ret >= 0); @@ -4527,10 +4270,9 @@ static void test_comps_array (const char *fname, const char *dset, const char *a ret = H5Tinsert(tid_cmpd1, "array_cmpd1", HOFFSET(cmpd1_t, cmpd2), tid_arry1); assert(ret >= 0); - /* ------------------- - * Create a dataset - */ + * Create a dataset + */ /* Create dataspace for datasets */ sid_dset = H5Screate_simple(1, sdims_dset, NULL); @@ -4541,15 +4283,15 @@ static void test_comps_array (const char *fname, const char *dset, const char *a assert(ret >= 0); /*----------------------------------- - * Create an attribute in root group - */ + * Create an attribute in root group + */ tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT); assert(tid_attr > 0); ret = H5Awrite(tid_attr, tid_cmpd1, wdata); assert(ret >= 0); /* ---------------- - * Close Dataset */ + * Close Dataset */ ret = H5Aclose(tid_attr); assert(ret >= 0); ret = H5Tclose(tid_arry1); @@ -4566,9 +4308,7 @@ static void test_comps_array (const char *fname, const char *dset, const char *a assert(ret >= 0); } - - -static void test_comps_vlen (const char * fname, const char *dset, const char *attr, int diff, int is_file_new) +static void test_comps_vlen(const char * fname, const char *dset, const char *attr, int diff, int is_file_new) { /* sub compound 2 */ typedef struct { @@ -4579,44 +4319,46 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a /* top compound 1 */ typedef struct { int i1; - hvl_t vl; /* VL information for compound2 */ + hvl_t vl; /* VL information for compound2 */ } cmpd1_t; - cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */ + cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */ - hid_t fid; /* HDF5 File ID */ - hid_t did_dset; /* dataset ID */ - hid_t sid_dset; /* dataset space ID */ - hid_t tid_attr; - hid_t tid_cmpd2; /* compound2 type ID */ - hid_t tid_cmpd1; /* compound1 type ID */ - hid_t tid_cmpd1_vlen; - hsize_t sdims_dset[] = {SDIM_DSET}; + hid_t fid = -1; /* HDF5 File ID */ + hid_t did_dset = -1; /* dataset ID */ + hid_t sid_dset = -1; /* dataset space ID */ + hid_t tid_attr = -1; + hid_t tid_cmpd2 = -1; /* compound2 type ID */ + hid_t tid_cmpd1 = -1; /* compound1 type ID */ + hid_t tid_cmpd1_vlen = -1; + hsize_t sdims_dset[] = { SDIM_DSET }; - unsigned i,j; /* counting variables */ - herr_t ret; /* Generic return value */ + unsigned i, j; /* counting variables */ + herr_t ret; /* Generic return value */ /* Allocate and initialize VL data to write */ - for(i = 0; i < SDIM_DSET; i++) { - wdata[i].i1 = (int)i; + for (i = 0; i < SDIM_DSET; i++) { + wdata[i].i1 = (int) i; wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t)); wdata[i].vl.len = i + 1; - for(j = 0; j < (i + 1); j++) { - ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)(i * 10 + (unsigned)diff); - ((cmpd2_t *)wdata[i].vl.p)[j].f2 = (float)i * 10.5F + (float)diff; + for (j = 0; j < (i + 1); j++) { + ((cmpd2_t *) wdata[i].vl.p)[j].i2 = + (int) (i * 10 + (unsigned) diff); + ((cmpd2_t *) wdata[i].vl.p)[j].f2 = (float) i * 10.5F + + (float) diff; } /* end for */ } /* end for */ /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ if (is_file_new == 1) fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); else - fid = H5Fopen (fname, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); /* ----------------------------- - * Create sub compound2 type */ + * Create sub compound2 type */ tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t)); /* Insert fields */ @@ -4626,7 +4368,7 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a assert(ret >= 0); /* --------------------------- - * Create top compound1 type */ + * Create top compound1 type */ tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t)); /* Insert fields */ ret = H5Tinsert(tid_cmpd1, "int1", HOFFSET(cmpd1_t, i1), H5T_NATIVE_INT); @@ -4638,8 +4380,8 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a assert(ret >= 0); /* ------------------------------- - * Create dataset with compound1 - */ + * Create dataset with compound1 + */ /* Create dataspace for dataset */ sid_dset = H5Screate_simple(1, sdims_dset, NULL); @@ -4651,8 +4393,8 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a assert(ret >= 0); /*----------------------------------- - * Create an attribute in root group - */ + * Create an attribute in root group + */ tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT); assert(tid_attr > 0); ret = H5Awrite(tid_attr, tid_cmpd1, wdata); @@ -4663,7 +4405,7 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a assert(ret >= 0); /* ---------------- - * Close IDs */ + * Close IDs */ ret = H5Aclose(tid_attr); assert(ret >= 0); ret = H5Dclose(did_dset); @@ -4680,17 +4422,16 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a assert(ret >= 0); } - -static void test_comps_array_vlen (const char * fname, const char *dset,const char *attr, int diff, int is_file_new) +static void test_comps_array_vlen(const char * fname, const char *dset, const char *attr, int diff, int is_file_new) { typedef struct { int i3; float f3; } cmpd3_t; - typedef struct { /* Typedef for compound datatype */ + typedef struct { /* Typedef for compound datatype */ int i2; - hvl_t vl; /* VL information to write */ + hvl_t vl; /* VL information to write */ } cmpd2_t; typedef struct { @@ -4698,53 +4439,53 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch cmpd2_t cmpd2[SDIM_CMPD_ARRAY]; } cmpd1_t; - cmpd1_t wdata[SDIM_DSET]; /* Information to write */ - hid_t fid; /* HDF5 File IDs */ - hid_t did_dset; /* Dataset ID */ - hid_t sid_dset; /* Dataspace ID */ - hid_t tid_attr; - hid_t tid_cmpd1; /* Compound1 Datatype ID */ - hid_t tid_arry1; /* Array Datatype ID */ - hid_t tid_cmpd2; /* Compound2 Datatype ID */ - hid_t tid_cmpd2_vlen; - hid_t tid_cmpd3; /* Compound3 Datatype ID */ - hsize_t sdims_dset[] = {SDIM_DSET}; - hsize_t sdims_arry[] = {SDIM_CMPD_ARRAY}; - unsigned i, j, k; /* counting variables */ - herr_t ret; /* Generic return value */ - - + cmpd1_t wdata[SDIM_DSET]; /* Information to write */ + hid_t fid = -1; /* HDF5 File IDs */ + hid_t did_dset = -1; /* Dataset ID */ + hid_t sid_dset = -1; /* Dataspace ID */ + hid_t tid_attr = -1; + hid_t tid_cmpd1 = -1; /* Compound1 Datatype ID */ + hid_t tid_arry1 = -1; /* Array Datatype ID */ + hid_t tid_cmpd2 = -1; /* Compound2 Datatype ID */ + hid_t tid_cmpd2_vlen = -1; + hid_t tid_cmpd3 = -1; /* Compound3 Datatype ID */ + hsize_t sdims_dset[] = { SDIM_DSET }; + hsize_t sdims_arry[] = { SDIM_CMPD_ARRAY }; + unsigned i, j, k; /* counting variables */ + herr_t ret; /* Generic return value */ /* Initialize array data to write in compound1 */ - for(i = 0; i < SDIM_DSET; i++) { - wdata[i].i1 = (int)i; + for (i = 0; i < SDIM_DSET; i++) { + wdata[i].i1 = (int) i; /* Allocate and initialize VL data to write in compound2 */ - for(j = 0; j < SDIM_CMPD_ARRAY; j++) { - wdata[i].cmpd2[j].i2 = (int)(j * 10); + for (j = 0; j < SDIM_CMPD_ARRAY; j++) { + wdata[i].cmpd2[j].i2 = (int) (j * 10); wdata[i].cmpd2[j].vl.p = HDmalloc((j + 1) * sizeof(cmpd3_t)); wdata[i].cmpd2[j].vl.len = j + 1; - for(k = 0; k < (j + 1); k++) { + for (k = 0; k < (j + 1); k++) { /* Initialize data of compound3 */ - ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].i3 = (int)j * 10 + diff; - ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].f3 = (float)j * 10.5F + (float)diff; + ((cmpd3_t *) wdata[i].cmpd2[j].vl.p)[k].i3 = (int) j * 10 + + diff; + ((cmpd3_t *) wdata[i].cmpd2[j].vl.p)[k].f3 = (float) j * 10.5F + + (float) diff; } /* end for */ } /* end for */ } /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ if (is_file_new == 1) fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); else - fid = H5Fopen (fname, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); /* Create dataspace for datasets */ sid_dset = H5Screate_simple(1, sdims_dset, NULL); /*------------------------------------- - * Create a sub compound3 datatype */ + * Create a sub compound3 datatype */ tid_cmpd3 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd3_t)); /* Insert integer field */ @@ -4755,9 +4496,8 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch ret = H5Tinsert(tid_cmpd3, "float", HOFFSET(cmpd3_t, f3), H5T_NATIVE_FLOAT); assert(ret >= 0); - /*------------------------------------- - * Create a sub compound2 datatype */ + * Create a sub compound2 datatype */ tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t)); /* Insert integer field */ @@ -4768,20 +4508,18 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch ret = H5Tinsert(tid_cmpd2, "vlen", HOFFSET(cmpd2_t, vl), tid_cmpd2_vlen); assert(ret >= 0); - /*----------------------------------- - * Create a top compound1 datatype for dataset. - */ - tid_cmpd1 = H5Tcreate (H5T_COMPOUND, sizeof(cmpd1_t)); + * Create a top compound1 datatype for dataset. + */ + tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t)); /* Create an array datatype */ tid_arry1 = H5Tarray_create2(tid_cmpd2, 1, sdims_arry); /* insert the array */ H5Tinsert(tid_cmpd1, "array_comp", HOFFSET(cmpd1_t, cmpd2), tid_arry1); - /* ---------------------- - * Create a dataset */ + * Create a dataset */ did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write dataset to disk */ @@ -4789,8 +4527,8 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch assert(ret >= 0); /*----------------------------------- - * Create an attribute in root group - */ + * Create an attribute in root group + */ tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT); assert(tid_attr > 0); ret = H5Awrite(tid_attr, tid_cmpd1, wdata); @@ -4801,7 +4539,7 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch assert(ret >= 0); /*------------------- - * Close IDs */ + * Close IDs */ ret = H5Aclose(tid_attr); assert(ret >= 0); ret = H5Tclose(tid_arry1); @@ -4822,8 +4560,7 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch assert(ret >= 0); } - -static void test_comps_vlen_arry (const char * fname, const char *dset, const char *attr, int diff, int is_file_new) +static void test_comps_vlen_arry(const char * fname, const char *dset, const char *attr, int diff, int is_file_new) { /* sub compound 3 */ typedef struct { @@ -4840,53 +4577,53 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch /* top compound 1 */ typedef struct { int i1; - hvl_t vl; /* VL information for compound2 */ + hvl_t vl; /* VL information for compound2 */ } cmpd1_t; - cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */ + cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */ - hid_t fid; /* HDF5 File ID */ - hid_t did_dset; /* dataset ID */ - hid_t sid_dset; /* dataset space ID */ - hid_t tid_attr; - hid_t tid_cmpd3; /* compound3 type ID */ - hid_t tid_cmpd2; /* compound2 type ID */ - hid_t tid_cmpd2_arry; - hid_t tid_cmpd1; /* compound1 type ID */ - hid_t tid_cmpd1_vlen; - hsize_t sdims_dset[] = {SDIM_DSET}; - hsize_t sdims_cmpd_arry[] = {SDIM_CMPD_ARRAY}; + hid_t fid = -1; /* HDF5 File ID */ + hid_t did_dset = -1; /* dataset ID */ + hid_t sid_dset = -1; /* dataset space ID */ + hid_t tid_attr = -1; + hid_t tid_cmpd3 = -1; /* compound3 type ID */ + hid_t tid_cmpd2 = -1; /* compound2 type ID */ + hid_t tid_cmpd2_arry = -1; + hid_t tid_cmpd1 = -1; /* compound1 type ID */ + hid_t tid_cmpd1_vlen = -1; + hsize_t sdims_dset[] = { SDIM_DSET }; + hsize_t sdims_cmpd_arry[] = { SDIM_CMPD_ARRAY }; - unsigned i,j,k; /* counting variables */ - herr_t ret; /* Generic return value */ + unsigned i, j, k; /* counting variables */ + herr_t ret; /* Generic return value */ /* Allocate and initialize VL data to write */ - for(i = 0; i < SDIM_DSET; i++) { + for (i = 0; i < SDIM_DSET; i++) { /* compound 1 data */ - wdata[i].i1 = (int)i; + wdata[i].i1 = (int) i; wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t)); wdata[i].vl.len = i + 1; - for(j = 0; j < (i + 1); j++) { + for (j = 0; j < (i + 1); j++) { /* compound2 data */ - ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)i * 10 + diff; - for(k = 0; k < SDIM_CMPD_ARRAY; k++) { + ((cmpd2_t *) wdata[i].vl.p)[j].i2 = (int) i * 10 + diff; + for (k = 0; k < SDIM_CMPD_ARRAY; k++) { /* compound 3 data */ - ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].i3 = (int)((float)k * 10.5F) + diff; - ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].f3 = (float)k * 10.5F + (float)diff; + ((cmpd2_t *) (wdata[i].vl.p))[j].cmpd3[k].i3 = (int) ((float) k * 10.5F) + diff; + ((cmpd2_t *) (wdata[i].vl.p))[j].cmpd3[k].f3 = (float) k * 10.5F + (float) diff; } /* end for */ } /* end for */ } /* end for */ /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ if (is_file_new == 1) fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); else - fid = H5Fopen (fname, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); /* ----------------------------- - * Create sub compound3 type */ + * Create sub compound3 type */ tid_cmpd3 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd3_t)); /* Insert fields */ @@ -4896,7 +4633,7 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch assert(ret >= 0); /* ----------------------------- - * Create sub compound2 type */ + * Create sub compound2 type */ tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t)); ret = H5Tinsert(tid_cmpd2, "int2", HOFFSET(cmpd2_t, i2), H5T_NATIVE_INT); @@ -4907,8 +4644,8 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch assert(ret >= 0); /* --------------------------- - * Create top compound1 type - */ + * Create top compound1 type + */ /* Create a VL datatype */ tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t)); /* Insert fields */ @@ -4919,21 +4656,22 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch assert(ret >= 0); /* ------------------------------- - * Create dataset with compound1 - */ + * Create dataset with compound1 + */ /* Create dataspace for dataset */ sid_dset = H5Screate_simple(1, sdims_dset, NULL); /* Create a dataset */ - did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); /* Write dataset to disk */ ret = H5Dwrite(did_dset, tid_cmpd1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); assert(ret >= 0); /*----------------------------------- - * Create an attribute in root group - */ + * Create an attribute in root group + */ tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT); assert(tid_attr > 0); ret = H5Awrite(tid_attr, tid_cmpd1, wdata); @@ -4944,7 +4682,7 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch assert(ret >= 0); /* ---------------- - * Close IDs */ + * Close IDs */ ret = H5Aclose(tid_attr); assert(ret >= 0); ret = H5Dclose(did_dset); @@ -4965,99 +4703,95 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch assert(ret >= 0); } - /*------------------------------------------------------------------------- -* Function: test_data_nocomparables -* -* Purpose: -* Create test files with non-comparable dataset and attributes with -* comparable datasets and attributes. All the comparables should display -* differences. -* -*-------------------------------------------------------------------------*/ + * Function: test_data_nocomparables + * + * Purpose: + * Create test files with non-comparable dataset and attributes with + * comparable datasets and attributes. All the comparables should display + * differences. + * + *-------------------------------------------------------------------------*/ #define DIM_ARRY 3 -static void test_data_nocomparables (const char * fname, int make_diffs) +static void test_data_nocomparables(const char * fname, int make_diffs) { - hid_t fid=0; - hid_t gid1=0; - hid_t gid2=0; - hid_t did1=0; - hid_t did2=0; - hid_t sid1=0; - hid_t tid_dset1=0; - hid_t tid_attr1=0; - hsize_t dims1_1[1] = {DIM_ARRY}; - hsize_t dims1_2[1] = {DIM_ARRY+1}; - hsize_t dims2[2] = {DIM_ARRY, 1}; - int data1[DIM_ARRY] = {0,0,0}; - int data2[DIM_ARRY] = {1,1,1}; - int data3[DIM_ARRY+1] = {1,1,1,1}; - int data1_dim2[DIM_ARRY][1] = {{0},{0},{0}}; + hid_t fid = -1; + hid_t gid1 = -1; + hid_t gid2 = -1; + hid_t did1 = -1; + hid_t did2 = -1; + hid_t sid1 = -1; + hid_t tid_dset1 = -1; + hid_t tid_attr1 = -1; + hsize_t dims1_1[1] = { DIM_ARRY }; + hsize_t dims1_2[1] = { DIM_ARRY + 1 }; + hsize_t dims2[2] = { DIM_ARRY, 1 }; + int data1[DIM_ARRY] = { 0, 0, 0 }; + int data2[DIM_ARRY] = { 1, 1, 1 }; + int data3[DIM_ARRY + 1] = { 1, 1, 1, 1 }; + int data1_dim2[DIM_ARRY][1] = { { 0 }, { 0 }, { 0 } }; int rank_attr; - char data1_str[DIM_ARRY][STR_SIZE]= {"ab","cd","ef"}; - herr_t status = SUCCEED; - void *dset_data_ptr1=NULL; - void *dset_data_ptr2=NULL; - void *dset_data_ptr3=NULL; - void *attr_data_ptr1=NULL; - void *attr_data_ptr2=NULL; - void *attr_data_ptr3=NULL; - void *attr_data_ptr4=NULL; - void *attr2_dim_ptr=NULL; - void *attr3_dim_ptr=NULL; + char data1_str[DIM_ARRY][STR_SIZE] = { "ab", "cd", "ef" }; + herr_t status = SUCCEED; + void *dset_data_ptr1 = NULL; + void *dset_data_ptr2 = NULL; + void *dset_data_ptr3 = NULL; + void *attr_data_ptr1 = NULL; + void *attr_data_ptr2 = NULL; + void *attr_data_ptr3 = NULL; + void *attr_data_ptr4 = NULL; + void *attr2_dim_ptr = NULL; + void *attr3_dim_ptr = NULL; /* init */ - tid_dset1=H5Tcopy(H5T_NATIVE_INT); - dset_data_ptr1=(int*)&data1; - dset_data_ptr2=(int*)&data1; - dset_data_ptr3=(int*)&data1; - tid_attr1=H5Tcopy(H5T_NATIVE_INT); - attr_data_ptr1=(int*)&data1; - attr_data_ptr3=(int*)&data1; - attr_data_ptr4=(int*)&data1; - attr2_dim_ptr=(hsize_t*)&dims1_1; - attr3_dim_ptr=(hsize_t*)&dims1_1; - rank_attr=1; - - if (make_diffs) - { + tid_dset1 = H5Tcopy(H5T_NATIVE_INT); + dset_data_ptr1 = (int*) &data1; + dset_data_ptr2 = (int*) &data1; + dset_data_ptr3 = (int*) &data1; + tid_attr1 = H5Tcopy(H5T_NATIVE_INT); + attr_data_ptr1 = (int*) &data1; + attr_data_ptr3 = (int*) &data1; + attr_data_ptr4 = (int*) &data1; + attr2_dim_ptr = (hsize_t*) &dims1_1; + attr3_dim_ptr = (hsize_t*) &dims1_1; + rank_attr = 1; + + if (make_diffs) { /* ------------ - * group1 */ - tid_dset1=H5Tcopy(H5T_C_S1); - H5Tset_size(tid_dset1, (size_t)STR_SIZE); - dset_data_ptr1=(char*)&data1_str; - dset_data_ptr2=(int*)&data2; - attr_data_ptr1=(int*)&data2; + * group1 */ + tid_dset1 = H5Tcopy(H5T_C_S1); + H5Tset_size(tid_dset1, (size_t) STR_SIZE); + dset_data_ptr1 = (char*) &data1_str; + dset_data_ptr2 = (int*) &data2; + attr_data_ptr1 = (int*) &data2; /* ----------- - * group2 - */ - dset_data_ptr3=(int*)&data2; + * group2 + */ + dset_data_ptr3 = (int*) &data2; /* dset1/attr1 */ - tid_attr1=H5Tcopy(H5T_C_S1); - H5Tset_size(tid_attr1, (size_t)STR_SIZE); - attr_data_ptr2=(char*)&data1_str; + tid_attr1 = H5Tcopy(H5T_C_S1); + H5Tset_size(tid_attr1, (size_t) STR_SIZE); + attr_data_ptr2 = (char*) &data1_str; /* dset1/attr2 */ - attr2_dim_ptr=(hsize_t*)&dims1_2; + attr2_dim_ptr = (hsize_t*) &dims1_2; /* dset1/attr3 */ - attr_data_ptr3=(int*)&data1_dim2; - attr3_dim_ptr=(hsize_t*)&dims2; - rank_attr=2; + attr_data_ptr3 = (int*) &data1_dim2; + attr3_dim_ptr = (hsize_t*) &dims2; + rank_attr = 2; /* dset1/attr4 */ - attr_data_ptr4=(int*)&data2; + attr_data_ptr4 = (int*) &data2; } - - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid < 0) - { + fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname); status = FAIL; goto out; @@ -5067,16 +4801,14 @@ static void test_data_nocomparables (const char * fname, int make_diffs) * Groups *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname); status = FAIL; goto out; } gid2 = H5Gcreate2(fid, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) - { + if (gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname); status = FAIL; goto out; @@ -5085,29 +4817,26 @@ static void test_data_nocomparables (const char * fname, int make_diffs) /*----------------------------------------------------------------------- * Datasets in /g1 *------------------------------------------------------------------------*/ - if((sid1 = H5Screate_simple(1, dims1_1, NULL)) < 0) - goto out; + if ((sid1 = H5Screate_simple(1, dims1_1, NULL)) < 0) + goto out; /* dset1 */ - if((did1 = H5Dcreate2(gid1, "dset1", tid_dset1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - { + if ((did1 = H5Dcreate2(gid1, "dset1", tid_dset1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", "dset1"); status = FAIL; goto out; } - if(H5Dwrite(did1, tid_dset1, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data_ptr1) < 0) - { + if (H5Dwrite(did1, tid_dset1, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data_ptr1) < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", "dset1"); status = FAIL; goto out; } - write_attr(did1,1,dims1_1,"attr", H5T_NATIVE_INT, attr_data_ptr1); + write_attr(did1, 1, dims1_1, "attr", H5T_NATIVE_INT, attr_data_ptr1); /* dset2 */ - status = write_dset(gid1, 1, dims1_1,"dset2", H5T_NATIVE_INT, dset_data_ptr2); - if (status == FAIL) - { + status = write_dset(gid1, 1, dims1_1, "dset2", H5T_NATIVE_INT, dset_data_ptr2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname); goto out; } @@ -5116,108 +4845,98 @@ static void test_data_nocomparables (const char * fname, int make_diffs) * Datasets in /g2 *------------------------------------------------------------------------*/ /* --------- - * dset1 */ - if((did2 = H5Dcreate2(gid2, "dset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - { + * dset1 */ + if ((did2 = H5Dcreate2(gid2, "dset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", "dset1"); status = FAIL; goto out; } - if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data_ptr3) < 0) - { + if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data_ptr3) < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", "dset1"); status = FAIL; goto out; } /* attr1 - non-compatible : different type */ - write_attr(did2,1,dims1_1,"attr1", tid_attr1, attr_data_ptr2); - + write_attr(did2, 1, dims1_1, "attr1", tid_attr1, attr_data_ptr2); /* attr2 - non-compatible : same rank, different dimention */ - write_attr(did2,1,(hsize_t *)attr2_dim_ptr,"attr2", H5T_NATIVE_INT, data3); + write_attr(did2, 1, (hsize_t *) attr2_dim_ptr, "attr2", H5T_NATIVE_INT, data3); /* attr3 - non-compatible : different rank */ - write_attr(did2, rank_attr,(hsize_t *)attr3_dim_ptr,"attr3", H5T_NATIVE_INT, attr_data_ptr3); + write_attr(did2, rank_attr, (hsize_t *) attr3_dim_ptr, "attr3", H5T_NATIVE_INT, attr_data_ptr3); /* attr4 - compatible : different data values */ - write_attr(did2,1,dims1_1,"attr4", H5T_NATIVE_INT, attr_data_ptr4); + write_attr(did2, 1, dims1_1, "attr4", H5T_NATIVE_INT, attr_data_ptr4); /*---------- - * dset2 */ - status = write_dset(gid2, 1, dims1_1,"dset2", H5T_NATIVE_INT, dset_data_ptr3); - if (status == FAIL) - { + * dset2 */ + status = write_dset(gid2, 1, dims1_1, "dset2", H5T_NATIVE_INT, dset_data_ptr3); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname); goto out; } - - out: /*----------------------------------------------------------------------- * Close IDs *-----------------------------------------------------------------------*/ - if(fid) + if (fid) H5Fclose(fid); - if(gid1) + if (gid1) H5Gclose(gid1); - if(gid2) + if (gid2) H5Gclose(gid2); - if(did1) + if (did1) H5Dclose(did1); - if(did2) + if (did2) H5Dclose(did2); - if(sid1) + if (sid1) H5Sclose(sid1); - if(tid_dset1) + if (tid_dset1) H5Tclose(tid_dset1); - if(tid_attr1) + if (tid_attr1) H5Tclose(tid_attr1); } /*------------------------------------------------------------------------- -* Function: test_objs_nocomparables -* -* Purpose: -* Create test files with common objects (same name) but different object -* types. -* h5diff should show non-comparable output from these common objects. -*-------------------------------------------------------------------------*/ + * Function: test_objs_nocomparables + * + * Purpose: + * Create test files with common objects (same name) but different object + * types. + * h5diff should show non-comparable output from these common objects. + *-------------------------------------------------------------------------*/ static void test_objs_nocomparables(const char *fname1, const char *fname2) { - herr_t status = SUCCEED; - hid_t fid1=0; - hid_t fid2=0; - hid_t topgid1=0; - hid_t topgid2=0; - hid_t gid1=0; - hid_t did1=0; - hid_t tid1=0; - hid_t gid2=0; - hid_t did2=0; - hid_t tid2=0; - hsize_t dims[1] = {DIM_ARRY}; - int data1[DIM_ARRY] = {1,1,1}; - int data2[DIM_ARRY] = {2,2,2}; - - /*----------------------------------------------------------------------- + herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t topgid1 = -1; + hid_t topgid2 = -1; + hid_t gid1 = -1; + hid_t tid1 = -1; + hid_t gid2 = -1; + hid_t tid2 = -1; + hsize_t dims[1] = { DIM_ARRY }; + int data1[DIM_ARRY] = { 1, 1, 1 }; + int data2[DIM_ARRY] = { 2, 2, 2 }; + + /*----------------------------------------------------------------------- * Open file(s) to add objects *------------------------------------------------------------------------*/ /* file1 */ - fid1 = H5Fopen (fname1, H5F_ACC_RDWR, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname1); status = FAIL; goto out; } /* file2 */ - fid2 = H5Fopen (fname2, H5F_ACC_RDWR, H5P_DEFAULT); - if (fid2 < 0) - { + fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid2 < 0) { fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname2); status = FAIL; goto out; @@ -5228,25 +4947,22 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ /* parent group */ topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (topgid1 < 0) - { + if (topgid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } /* dataset */ - status = write_dset(topgid1, 1, dims,"obj1", H5T_NATIVE_INT, data1); - if (status == FAIL) - { + status = write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); goto out; } /* group */ gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -5255,8 +4971,7 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2) /* committed type */ tid1 = H5Tcopy(H5T_NATIVE_INT); status = H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname1); goto out; } @@ -5266,8 +4981,7 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ /* parent group */ topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (topgid2 < 0) - { + if (topgid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; @@ -5275,8 +4989,7 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2) /* group */ gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) - { + if (gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; @@ -5285,16 +4998,14 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2) /* committed type */ tid2 = H5Tcopy(H5T_NATIVE_INT); status = H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname2); goto out; } /* dataset */ - status = write_dset(topgid2, 1, dims,"obj3", H5T_NATIVE_INT, data2); - if (status == FAIL) - { + status = write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); goto out; } @@ -5303,113 +5014,105 @@ out: /*----------------------------------------------------------------------- * Close IDs *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); - if(topgid1) + if (topgid1) H5Gclose(topgid1); - if(topgid2) + if (topgid2) H5Gclose(topgid2); - if(did1) - H5Dclose(did1); - if(did2) - H5Dclose(did2); - if(gid1) + if (gid1) H5Gclose(gid1); - if(gid2) + if (gid2) H5Gclose(gid2); - if(tid1) + if (tid1) H5Tclose(tid1); - if(tid2) + if (tid2) H5Tclose(tid2); } -static hid_t mkstr(int size, H5T_str_t pad) { +static hid_t mkstr(int size, H5T_str_t pad) +{ hid_t type; - if((type=H5Tcopy(H5T_C_S1)) < 0) return -1; - if(H5Tset_size(type, (size_t)size) < 0) return -1; - if(H5Tset_strpad(type, pad) < 0) return -1; + if ((type = H5Tcopy(H5T_C_S1)) < 0) + return -1; + if (H5Tset_size(type, (size_t) size) < 0) + return -1; + if (H5Tset_strpad(type, pad) < 0) + return -1; return type; } /*------------------------------------------------------------------------- -* Function: test_objs_strings -* -* Purpose: -* Create test files with common objects (same name) but different string -* types. -* h5diff should show differences output from these common objects. -*-------------------------------------------------------------------------*/ + * Function: test_objs_strings + * + * Purpose: + * Create test files with common objects (same name) but different string + * types. + * h5diff should show differences output from these common objects. + *-------------------------------------------------------------------------*/ static void test_objs_strings(const char *fname1, const char *fname2) { - hid_t fid1=0; - hid_t fid2=0; - hid_t dataset=0; - hid_t space=0; - hid_t f_type=0; - hid_t m_type=0; - hsize_t dims1[] = {3, 4}; - char string1A[12][3] = {"s1","s2","s3","s4","s5","s6","s","s","s9", - "s0","s1","s2"}; - char string1B[12][3] = {"s1","s2","s3","s4","s","s","s7","s8","s9", - "s0","s1","s2"}; - - hsize_t dims2[]={20}; - char string2A[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", - "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", - "ab cd 9", "ab cd 0", "ab cd 1", "ab cd 2", - "ab cd ef3", "ab cd ef4", "ab cd ef5", "ab cd ef6", - "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"}; - char string2B[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", - "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", - "ab cd ef9", "ab cd ef0", "ab cd ef1", "ab cd ef2", - "ab cd 3", "ab cd 4", "ab cd 5", "ab cd 6", - "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"}; - - hsize_t dims3[] = {27}; - char string3A[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", - "abcd4", "abcd5", "abcd6", "abcd7", - "abcd8", "abcd9", "abcd0", "abcd1", - "abd2", "abc3", "bcd4", "acd5", - "abcd6", "abcd7", "abcd8", "abcd9", - "abcd0", "abcd1", "abcd2", "abcd3", - "abc4", "abc5", "abc6"}; - char string3B[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", - "abcd4", "abcd5", "abcd6", "abcd7", - "abcd8", "abcd9", "abcd0", "abcd1", - "abcd2", "abcd3", "abcd4", "abcd5", - "abd6", "abc7", "bcd8", "acd9", - "abcd0", "abcd1", "abcd2", "abcd3", - "abd4", "abd5", "abd6"}; - - hsize_t dims4[] = {3}; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t dataset = -1; + hid_t space = -1; + hid_t f_type = -1; + hid_t m_type = -1; + hsize_t dims1[] = { 3, 4 }; + char string1A[12][3] = { "s1", "s2", "s3", "s4", "s5", "s6", "s", "s", "s9", + "s0", "s1", "s2" }; + char string1B[12][3] = { "s1", "s2", "s3", "s4", "s", "s", "s7", "s8", "s9", + "s0", "s1", "s2" }; + + hsize_t dims2[] = { 20 }; + char string2A[20][10] = { "ab cd ef1", "ab cd ef2", "ab cd ef3", + "ab cd ef4", "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", + "ab cd 9", "ab cd 0", "ab cd 1", "ab cd 2", "ab cd ef3", + "ab cd ef4", "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", + "ab cd ef9", "ab cd ef0" }; + char string2B[20][10] = { "ab cd ef1", "ab cd ef2", "ab cd ef3", + "ab cd ef4", "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", + "ab cd ef9", "ab cd ef0", "ab cd ef1", "ab cd ef2", "ab cd 3", + "ab cd 4", "ab cd 5", "ab cd 6", "ab cd ef7", "ab cd ef8", + "ab cd ef9", "ab cd ef0" }; + + hsize_t dims3[] = { 27 }; + char string3A[27][6] = { "abcd0", "abcd1", "abcd2", "abcd3", "abcd4", + "abcd5", "abcd6", "abcd7", "abcd8", "abcd9", "abcd0", "abcd1", + "abd2", "abc3", "bcd4", "acd5", "abcd6", "abcd7", "abcd8", "abcd9", + "abcd0", "abcd1", "abcd2", "abcd3", "abc4", "abc5", "abc6" }; + char string3B[27][6] = { "abcd0", "abcd1", "abcd2", "abcd3", "abcd4", + "abcd5", "abcd6", "abcd7", "abcd8", "abcd9", "abcd0", "abcd1", + "abcd2", "abcd3", "abcd4", "abcd5", "abd6", "abc7", "bcd8", "acd9", + "abcd0", "abcd1", "abcd2", "abcd3", "abd4", "abd5", "abd6" }; + + hsize_t dims4[] = { 3 }; char string4A[3][21] = { "s1234567890123456789", "s1234567890123456789", - "s12345678901234567"}; + "s12345678901234567" }; char string4B[3][21] = { "s1234567890123456789", "s12345678901234567", - "s1234567890123456789"}; + "s1234567890123456789" }; /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ - /* file1 */ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); - goto out; - } - - /* file2 */ - fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid2 < 0) - { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); - goto out; - } + * Create file(s) + *------------------------------------------------------------------------*/ + /* file1 */ + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + goto out; + } + + /* file2 */ + fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); + goto out; + } /* string 1 : nullterm string */ space = H5Screate_simple(2, dims1, NULL); @@ -5499,88 +5202,82 @@ out: /*----------------------------------------------------------------------- * Close IDs *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); } /*------------------------------------------------------------------------- -* Function: write_attr_in -* -* Purpose: write attributes in LOC_ID (dataset, group, named datatype) -* -*------------------------------------------------------------------------- -*/ + * Function: write_attr_strings + * + * Purpose: write attributes in LOC_ID (dataset, group, named datatype) + * swap VL strings + * + *------------------------------------------------------------------------- + */ static -void write_attr_in(hid_t loc_id, - const char* dset_name, /* for saving reference to dataset*/ - hid_t fid, - int make_diffs /* flag to modify data buffers */) +void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs /* flag to modify data buffers */) { /* Compound datatype */ - typedef struct s_t - { - char a; + typedef struct s_t { + char a; double b; } s_t; - typedef enum - { - RED, - GREEN + typedef enum { + RED, GREEN } e_t; - hid_t aid; - hid_t sid; - hid_t tid; - herr_t status; - int val, i, j, k, l, n; - float f; + hid_t aid = -1; + hid_t sid = -1; + hid_t tid = -1; + herr_t status; + int val, i, j, k, l, n; + float f; /* create 1D attributes with dimension [2], 2 elements */ - hsize_t dims[1]={2}; - char buf1[2][STR_SIZE]= {"ab","de"}; /* string */ - char *buf1a[2]; /* VL string */ - char buf2[2]= {1,2}; /* bitfield, opaque */ - s_t buf3[2]= {{1,2.0F},{3,4.0F}}; /* compound */ - hobj_ref_t buf4[2]; /* reference */ - e_t buf45[2]= {RED,RED}; /* enum */ - hvl_t buf5[2]; /* vlen */ - hsize_t dimarray[1]={3}; /* array dimension */ - int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */ - int buf7[2]= {1,2}; /* integer */ - float buf8[2]= {1.0F, 2.0F}; /* float */ + hsize_t dims[1] = { 2 }; + char buf1[2][STR_SIZE] = { "ab", "de" }; /* string */ + char *buf1a[2]; /* VL string */ + char buf2[2] = { 1, 2 }; /* bitfield, opaque */ + s_t buf3[2] = { { 1, 2.0F }, { 3, 4.0F } }; /* compound */ + hobj_ref_t buf4[2]; /* reference */ + e_t buf45[2] = { RED, RED }; /* enum */ + hvl_t buf5[2]; /* vlen */ + hsize_t dimarray[1] = { 3 }; /* array dimension */ + int buf6[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } }; /* array */ + int buf7[2] = { 1, 2 }; /* integer */ + float buf8[2] = { 1.0F, 2.0F }; /* float */ /* create 2D attributes with dimension [3][2], 6 elements */ - hsize_t dims2[2]={3,2}; - char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */ - char *buf12a[3][2]; /* VL string */ - char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ - s_t buf32[6]= {{1,2.0F},{3,4.0F},{5,6.0F},{7,8.0F},{9,10.0F},{11,12.0F}}; /* compound */ - hobj_ref_t buf42[3][2]; /* reference */ - e_t buf452[3][2]; /* enum */ - hvl_t buf52[3][2]; /* vlen */ - int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ - int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ - float buf82[3][2]= {{1.0F,2.0F},{3.0F,4.0F},{5.0F,6.0F}}; /* float */ + hsize_t dims2[2] = { 3, 2 }; + char buf12[3][2][STR_SIZE] = { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }; /* string */ + char *buf12a[3][2]; /* VL string */ + char buf22[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* bitfield, opaque */ + s_t buf32[6] = { { 1, 2.0F }, { 3, 4.0F }, { 5, 6.0F }, { 7, 8.0F }, { 9, 10.0F }, { 11, 12.0F } }; /* compound */ + hobj_ref_t buf42[3][2]; /* reference */ + e_t buf452[3][2]; /* enum */ + hvl_t buf52[3][2]; /* vlen */ + int buf62[6][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }; /* array */ + int buf72[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* integer */ + float buf82[3][2] = { { 1.0F, 2.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /* float */ /* create 3D attributes with dimension [4][3][2], 24 elements */ - hsize_t dims3[3]={4,3,2}; - char buf13[4][3][2][STR_SIZE]= {{{"ab","cd"},{"ef","gh"},{"ij","kl"}}, - {{"mn","pq"},{"rs","tu"},{"vw","xz"}}, - {{"AB","CD"},{"EF","GH"},{"IJ","KL"}}, - {{"MN","PQ"},{"RS","TU"},{"VW","XZ"}}}; /* string */ - char *buf13a[4][3][2]; /* VL string */ - char buf23[4][3][2]; /* bitfield, opaque */ - s_t buf33[4][3][2]; /* compound */ - hobj_ref_t buf43[4][3][2]; /* reference */ - e_t buf453[4][3][2]; /* enum */ - hvl_t buf53[4][3][2]; /* vlen */ - int buf63[24][3]; /* array */ - int buf73[4][3][2]; /* integer */ - float buf83[4][3][2]; /* float */ - + hsize_t dims3[3] = { 4, 3, 2 }; + char buf13[4][3][2][STR_SIZE] = { { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }, + { { "mn", "pq" }, { "rs", "tu" }, { "vw", "xz" } }, + { { "AB", "CD" }, { "EF", "GH" }, { "IJ", "KL" } }, + { { "MN", "PQ" }, { "RS", "TU" }, { "VW", "XZ" } } }; /* string */ + char *buf13a[4][3][2]; /* VL string */ + char buf23[4][3][2]; /* bitfield, opaque */ + s_t buf33[4][3][2]; /* compound */ + hobj_ref_t buf43[4][3][2]; /* reference */ + e_t buf453[4][3][2]; /* enum */ + hvl_t buf53[4][3][2]; /* vlen */ + int buf63[24][3]; /* array */ + int buf73[4][3][2]; /* integer */ + float buf83[4][3][2]; /* float */ /*------------------------------------------------------------------------- * 1D attributes @@ -5593,15 +5290,10 @@ void write_attr_in(hid_t loc_id, */ if (make_diffs) - { - for (i=0; i<2; i++) - { - for (j=0; j<2; j++) - { - buf1[i][j]='z'; - } - } - } + for (i = 0; i < 2; i++) + for (j = 0; j < 2; j++) + buf1[i][j] = 'z'; + /* buf1[2][2]= {"ab","de"}; $h5diff file7.h5 file6.h5 g1 g1 -v @@ -5614,16 +5306,17 @@ void write_attr_in(hid_t loc_id, [ 1 ] d z [ 1 ] e z */ + for (i = 0; i < 2; i++) + buf1a[i] = buf1[i]; + tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, (size_t)STR_SIZE); - write_attr(loc_id,1,dims,"string",tid,buf1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id, 1, dims, "string", tid, buf1a); status = H5Tclose(tid); - for (i=0; i<2; i++) - buf1a[i]=buf1[i]; tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, H5T_VARIABLE); - write_attr(loc_id,1,dims,"VLstring",tid,buf1a); + status = H5Tset_size(tid, (size_t)STR_SIZE); + write_attr(loc_id, 1, dims, "VLstring", tid, buf1); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5632,10 +5325,8 @@ void write_attr_in(hid_t loc_id, */ if (make_diffs) - { - for (i=0; i<2; i++) - buf2[i]=buf2[1]=0; - } + for (i = 0; i < 2; i++) + buf2[i] = buf2[1] = 0; /* buf2[2]= {1,2}; $h5diff file7.h5 file6.h5 g1 g1 -v @@ -5649,7 +5340,7 @@ void write_attr_in(hid_t loc_id, */ tid = H5Tcopy(H5T_STD_B8LE); - write_attr(loc_id,1,dims,"bitfield",tid,buf2); + write_attr(loc_id, 1, dims, "bitfield", tid, buf2); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5669,9 +5360,9 @@ void write_attr_in(hid_t loc_id, [ 1 ] 2 0 2 */ - tid = H5Tcreate(H5T_OPAQUE, (size_t)1); + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_attr(loc_id,1,dims,"opaque",tid,buf2); + write_attr(loc_id, 1, dims, "opaque", tid, buf2); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5680,12 +5371,10 @@ void write_attr_in(hid_t loc_id, */ if (make_diffs) - { - for (i=0; i<2; i++) - { - buf3[i].a=0; buf3[i].b=0; + for (i = 0; i < 2; i++) { + buf3[i].a = 0; + buf3[i].b = 0; } - } /* buf3[2]= {{1,2},{3,4}}; @@ -5700,10 +5389,10 @@ void write_attr_in(hid_t loc_id, [ 1 ] 4 5 1 */ - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_attr(loc_id,1,dims,"compound",tid,buf3); + write_attr(loc_id, 1, dims, "compound", tid, buf3); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5711,38 +5400,1021 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1); - status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1); - write_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); + if (dset_name) { + status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t) -1); + write_attr(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4); } /*------------------------------------------------------------------------- - * H5T_ENUM + * H5T_ENUM + *------------------------------------------------------------------------- + */ + if (make_diffs) + for (i = 0; i < 2; i++) + buf45[i] = GREEN; + /* + buf45[2]= {RED,RED}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: </g1> and </g1> + Attribute: <enum> and <enum> + position enum of </g1> enum of </g1> difference + ------------------------------------------------------------ + [ 0 ] RED GREEN + [ 1 ] RED GREEN + */ + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "GREEN", (val = 1, &val)); + write_attr(loc_id, 1, dims, "enum", tid, buf45); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_VLEN + *------------------------------------------------------------------------- + */ + + /* Allocate and initialize VL dataset to write */ + + buf5[0].len = 1; + buf5[0].p = HDmalloc(1 * sizeof(int)); + ((int *) buf5[0].p)[0] = 1; + buf5[1].len = 2; + buf5[1].p = HDmalloc(2 * sizeof(int)); + ((int *) buf5[1].p)[0] = 2; + ((int *) buf5[1].p)[1] = 3; + + if (make_diffs) { + ((int *) buf5[0].p)[0] = 0; + ((int *) buf5[1].p)[0] = 0; + ((int *) buf5[1].p)[1] = 0; + } + /* + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: </g1> and </g1> + position vlen of </g1> vlen of </g1> difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 1 ] 2 0 2 + [ 1 ] 3 0 3 + */ + + sid = H5Screate_simple(1, dims, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + status = H5Awrite(aid, tid, buf5); + assert(status >= 0); + status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); + assert(status >= 0); + status = H5Aclose(aid); + status = H5Tclose(tid); + status = H5Sclose(sid); + + /*------------------------------------------------------------------------- + * H5T_ARRAY + *------------------------------------------------------------------------- + */ + + if (make_diffs) + for (i = 0; i < 2; i++) + for (j = 0; j < 3; j++) + buf6[i][j] = 0; + /* + buf6[2][3]= {{1,2,3},{4,5,6}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: </g1> and </g1> + Attribute: <array> and <array> + position array of </g1> array of </g1> difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 0 ] 2 0 2 + [ 0 ] 3 0 3 + [ 1 ] 4 0 4 + [ 1 ] 5 0 5 + [ 1 ] 6 0 6 + */ + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_attr(loc_id, 1, dims, "array", tid, buf6); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ + + if (make_diffs) + for (i = 0; i < 2; i++) { + buf7[i] = 0; + buf8[i] = 0; + } + /* + buf7[2]= {1,2}; + buf8[2]= {1,2}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: </g1> and </g1> + position integer of </g1> integer of </g1> difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 1 ] 2 0 2 + position float of </g1> float of </g1> difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 1 ] 2 0 2 + */ + write_attr(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7); + write_attr(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8); + + /*------------------------------------------------------------------------- + * 2D attributes + *------------------------------------------------------------------------- + */ + + /*------------------------------------------------------------------------- + * H5T_STRING + *------------------------------------------------------------------------- + */ + if (make_diffs) + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + for (k = 0; k < 2; k++) + buf12[i][j][k] = 'z'; + + /* + buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Attribute: <string2D> and <string2D> + position string2D of </g1> string2D of </g1> difference + ------------------------------------------------------------ + [ 0 0 ] a z + [ 0 0 ] b z + [ 0 1 ] c z + [ 0 1 ] d z + [ 1 0 ] e z + [ 1 0 ] f z + [ 1 1 ] g z + [ 1 1 ] h z + [ 2 0 ] i z + [ 2 0 ] j z + [ 2 1 ] k z + [ 2 1 ] l z + */ + + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + buf12a[i][j] = buf12[i][j]; + + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id, 2, dims2, "string2D", tid, buf12a); + status = H5Tclose(tid); + + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, (size_t) STR_SIZE); + write_attr(loc_id, 2, dims2, "VLstring2D", tid, buf12); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ + + if (make_diffs) + memset(buf22, 0, sizeof buf22); + /* + buf22[3][2]= {{1,2},{3,4},{5,6}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Attribute: <bitfield2D> and <bitfield2D> + position bitfield2D of </g1> bitfield2D of </g1> difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + */ + + tid = H5Tcopy(H5T_STD_B8LE); + write_attr(loc_id, 2, dims2, "bitfield2D", tid, buf22); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + + /* + buf22[3][2]= {{1,2},{3,4},{5,6}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Attribute: <opaque2D> and <opaque2D> + position opaque2D of </g1> opaque2D of </g1> difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + */ + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); + status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ + write_attr(loc_id, 2, dims2, "opaque2D", tid, buf22); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ + if (make_diffs) + memset(buf32, 0, sizeof buf32); + + /* + buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Attribute: <opaque2D> and <opaque2D> + position opaque2D of </g1> opaque2D of </g1> difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + */ + + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); + H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); + H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + write_attr(loc_id, 2, dims2, "compound2D", tid, buf32); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_REFERENCE (H5R_OBJECT object reference) + *------------------------------------------------------------------------- + */ + /* Create references to dataset */ + if (dset_name) { + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, + (hid_t) -1); + write_attr(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42); + } + + /*------------------------------------------------------------------------- + * H5T_ENUM + *------------------------------------------------------------------------- + */ + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + if (make_diffs) + buf452[i][j] = GREEN; + else + buf452[i][j] = RED; + + /* + Attribute: <enum2D> and <enum2D> + position enum2D of </g1> enum2D of </g1> difference + ------------------------------------------------------------ + [ 0 0 ] RED GREEN + [ 0 1 ] RED GREEN + [ 1 0 ] RED GREEN + [ 1 1 ] RED GREEN + [ 2 0 ] RED GREEN + [ 2 1 ] RED GREEN + */ + + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "GREEN", (val = 1, &val)); + write_attr(loc_id, 2, dims2, "enum2D", tid, buf452); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_VLEN + *------------------------------------------------------------------------- + */ + + /* Allocate and initialize VL dataset to write */ + n = 0; + for (i = 0; i < 3; i++) { + for (j = 0; j < 2; j++) { + buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf52[i][j].len = (size_t)(i + 1); + for (l = 0; l < i + 1; l++) + if (make_diffs) + ((int *) buf52[i][j].p)[l] = 0; + else + ((int *) buf52[i][j].p)[l] = n++; + } + } + + /* + position vlen2D of </g1> vlen2D of </g1> difference + ------------------------------------------------------------ + [ 0 1 ] 1 0 1 + [ 1 0 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 1 1 ] 5 0 5 + [ 2 0 ] 6 0 6 + [ 2 0 ] 7 0 7 + [ 2 0 ] 8 0 8 + [ 2 1 ] 9 0 9 + [ 2 1 ] 10 0 10 + [ 2 1 ] 11 0 11 + */ + + sid = H5Screate_simple(2, dims2, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + status = H5Awrite(aid, tid, buf52); + assert(status >= 0); + status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52); + assert(status >= 0); + status = H5Aclose(aid); + status = H5Tclose(tid); + status = H5Sclose(sid); + + /*------------------------------------------------------------------------- + * H5T_ARRAY + *------------------------------------------------------------------------- + */ + + if (make_diffs) + memset(buf62, 0, sizeof buf62); + /* + buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: </g1> and </g1> + Attribute: <array2D> and <array2D> + position array2D of </g1> array2D of </g1> difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 0 ] 2 0 2 + [ 0 0 ] 3 0 3 + [ 0 1 ] 4 0 4 + [ 0 1 ] 5 0 5 + [ 0 1 ] 6 0 6 + [ 1 0 ] 7 0 7 + [ 1 0 ] 8 0 8 + [ 1 0 ] 9 0 9 + [ 1 1 ] 10 0 10 + [ 1 1 ] 11 0 11 + [ 1 1 ] 12 0 12 + [ 2 0 ] 13 0 13 + [ 2 0 ] 14 0 14 + [ 2 0 ] 15 0 15 + [ 2 1 ] 16 0 16 + [ 2 1 ] 17 0 17 + [ 2 1 ] 18 0 18 + */ + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_attr(loc_id, 2, dims2, "array2D", tid, buf62); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ + + if (make_diffs) { + memset(buf72, 0, sizeof buf72); + memset(buf82, 0, sizeof buf82); + } + /* + Attribute: <integer2D> and <integer2D> + position integer2D of </g1> integer2D of </g1> difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + 6 differences found + Attribute: <float2D> and <float2D> + position float2D of </g1> float2D of </g1> difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + */ + + write_attr(loc_id, 2, dims2, "integer2D", H5T_NATIVE_INT, buf72); + write_attr(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82); + + /*------------------------------------------------------------------------- + * 3D attributes + *------------------------------------------------------------------------- + */ + + /*------------------------------------------------------------------------- + * H5T_STRING + *------------------------------------------------------------------------- + */ + + if (make_diffs) + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + for (l = 0; l < 2; l++) + buf13[i][j][k][l] = 'z'; + + /* + buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", + "rs","tu","vw","xz","AB","CD","EF","GH", + "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; + + Attribute: <string3D> and <string3D> + position string3D of </g1> string3D of </g1> difference + ------------------------------------------------------------ + [ 0 0 0 ] a z + [ 0 0 0 ] b z + [ 0 0 1 ] c z + [ 0 0 1 ] d z + [ 0 1 0 ] e z + [ 0 1 0 ] f z + [ 0 1 1 ] g z + [ 0 1 1 ] h z + [ 0 2 0 ] i z + [ 0 2 0 ] j z + [ 0 2 1 ] k z + [ 0 2 1 ] l z + [ 1 0 0 ] m z + [ 1 0 0 ] n z + [ 1 0 1 ] p z + [ 1 0 1 ] q z + [ 1 1 0 ] r z + [ 1 1 0 ] s z + [ 1 1 1 ] t z + [ 1 1 1 ] u z + [ 1 2 0 ] v z + [ 1 2 0 ] w z + [ 1 2 1 ] x z + [ 2 0 0 ] A z + [ 2 0 0 ] B z + [ 2 0 1 ] C z + [ 2 0 1 ] D z + [ 2 1 0 ] E z + [ 2 1 0 ] F z + [ 2 1 1 ] G z + [ 2 1 1 ] H z + [ 2 2 0 ] I z + [ 2 2 0 ] J z + [ 2 2 1 ] K z + [ 2 2 1 ] L z + [ 3 0 0 ] M z + [ 3 0 0 ] N z + [ 3 0 1 ] P z + [ 3 0 1 ] Q z + [ 3 1 0 ] R z + [ 3 1 0 ] S z + [ 3 1 1 ] T z + [ 3 1 1 ] U z + [ 3 2 0 ] V z + [ 3 2 0 ] W z + [ 3 2 1 ] X z + [ 3 2 1 ] Z z + */ + + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + buf13a[i][j][k] = buf13[i][j][k]; + + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id, 3, dims3, "string3D", tid, buf13a); + status = H5Tclose(tid); + + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, (size_t) STR_SIZE); + write_attr(loc_id, 3, dims3, "VLstring3D", tid, buf13); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ + + n = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + if (make_diffs) + buf23[i][j][k] = 0; + else + buf23[i][j][k] = (char) n++; + + /* + position bitfield3D of </g1> bitfield3D of </g1> difference + ------------------------------------------------------------ + [ 0 0 0 ] 1 0 1 + [ 0 0 1 ] 2 0 2 + [ 0 1 0 ] 3 0 3 + [ 0 1 1 ] 4 0 4 + [ 0 2 0 ] 5 0 5 + [ 0 2 1 ] 6 0 6 + [ 1 0 0 ] 7 0 7 + [ 1 0 1 ] 8 0 8 + [ 1 1 0 ] 9 0 9 + [ 1 1 1 ] 10 0 10 + [ 1 2 0 ] 11 0 11 + [ 1 2 1 ] 12 0 12 + [ 2 0 0 ] 13 0 13 + [ 2 0 1 ] 14 0 14 + [ 2 1 0 ] 15 0 15 + [ 2 1 1 ] 16 0 16 + [ 2 2 0 ] 17 0 17 + [ 2 2 1 ] 18 0 18 + [ 3 0 0 ] 19 0 19 + [ 3 0 1 ] 20 0 20 + [ 3 1 0 ] 21 0 21 + [ 3 1 1 ] 22 0 22 + [ 3 2 0 ] 23 0 23 + [ 3 2 1 ] 24 0 24 + */ + + tid = H5Tcopy(H5T_STD_B8LE); + write_attr(loc_id, 3, dims3, "bitfield3D", tid, buf23); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); + status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ + write_attr(loc_id, 3, dims3, "opaque3D", tid, buf23); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ + + n = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + if (make_diffs) { + buf33[i][j][k].a = 0; + buf33[i][j][k].b = 0.0F; + } else { + buf33[i][j][k].a = (char) n++; + buf33[i][j][k].b = n++; + } + /*position compound3D of </g1> compound3D of </g1> difference + ------------------------------------------------------------ + [ 0 0 0 ] 1 0 1 + [ 0 0 0 ] 2 0 2 + [ 0 0 1 ] 3 0 3 + [ 0 0 1 ] 4 0 4 + [ 0 1 0 ] 5 0 5 + [ 0 1 0 ] 6 0 6 + [ 0 1 1 ] 7 0 7 + [ 0 1 1 ] 8 0 8 + [ 0 2 0 ] 9 0 9 + [ 0 2 0 ] 10 0 10 + [ 0 2 1 ] 11 0 11 + [ 0 2 1 ] 12 0 12 + [ 1 0 0 ] 13 0 13 + [ 1 0 0 ] 14 0 14 + [ 1 0 1 ] 15 0 15 + [ 1 0 1 ] 16 0 16 + [ 1 1 0 ] 17 0 17 + [ 1 1 0 ] 18 0 18 + [ 1 1 1 ] 19 0 19 + [ 1 1 1 ] 20 0 20 + [ 1 2 0 ] 21 0 21 + [ 1 2 0 ] 22 0 22 + [ 1 2 1 ] 23 0 23 + [ 1 2 1 ] 24 0 24 + [ 2 0 0 ] 25 0 25 + [ 2 0 0 ] 26 0 26 + [ 2 0 1 ] 27 0 27 + [ 2 0 1 ] 28 0 28 + [ 2 1 0 ] 29 0 29 + [ 2 1 0 ] 30 0 30 + [ 2 1 1 ] 31 0 31 + [ 2 1 1 ] 32 0 32 + [ 2 2 0 ] 33 0 33 + [ 2 2 0 ] 34 0 34 + [ 2 2 1 ] 35 0 35 + [ 2 2 1 ] 36 0 36 + [ 3 0 0 ] 37 0 37 + [ 3 0 0 ] 38 0 38 + [ 3 0 1 ] 39 0 39 + [ 3 0 1 ] 40 0 40 + [ 3 1 0 ] 41 0 41 + [ 3 1 0 ] 42 0 42 + [ 3 1 1 ] 43 0 43 + [ 3 1 1 ] 44 0 44 + [ 3 2 0 ] 45 0 45 + [ 3 2 0 ] 46 0 46 + [ 3 2 1 ] 47 0 47 + [ 3 2 1 ] 48 0 48 + */ + + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); + H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); + H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + write_attr(loc_id, 3, dims3, "compound3D", tid, buf33); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_REFERENCE (H5R_OBJECT object reference) + *------------------------------------------------------------------------- + */ + /* Create references to dataset */ + if (dset_name) { + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + status = H5Rcreate(&buf43[i][j][k], fid, dset_name, + H5R_OBJECT, (hid_t) -1); + write_attr(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43); + } + + /*------------------------------------------------------------------------- + * H5T_ENUM + *------------------------------------------------------------------------- + */ + + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + if (make_diffs) + buf453[i][j][k] = RED; + else + buf453[i][j][k] = GREEN; + + /* + position enum3D of </g1> enum3D of </g1> difference + ------------------------------------------------------------ + [ 0 0 0 ] GREEN RED + [ 0 0 1 ] GREEN RED + [ 0 1 0 ] GREEN RED + [ 0 1 1 ] GREEN RED + [ 0 2 0 ] GREEN RED + [ 0 2 1 ] GREEN RED + [ 1 0 0 ] GREEN RED + [ 1 0 1 ] GREEN RED + [ 1 1 0 ] GREEN RED + [ 1 1 1 ] GREEN RED + [ 1 2 0 ] GREEN RED + [ 1 2 1 ] GREEN RED + [ 2 0 0 ] GREEN RED + [ 2 0 1 ] GREEN RED + [ 2 1 0 ] GREEN RED + [ 2 1 1 ] GREEN RED + [ 2 2 0 ] GREEN RED + [ 2 2 1 ] GREEN RED + [ 3 0 0 ] GREEN RED + [ 3 0 1 ] GREEN RED + [ 3 1 0 ] GREEN RED + [ 3 1 1 ] GREEN RED + [ 3 2 0 ] GREEN RED + [ 3 2 1 ] GREEN RED + */ + + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "GREEN", (val = 1, &val)); + write_attr(loc_id, 3, dims3, "enum3D", tid, buf453); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_VLEN + *------------------------------------------------------------------------- + */ + + /* Allocate and initialize VL dataset to write */ + n = 0; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) { + buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf53[i][j][k].len = (size_t)(i + 1); + for (l = 0; l < i + 1; l++) + if (make_diffs) + ((int *) buf53[i][j][k].p)[l] = 0; + else + ((int *) buf53[i][j][k].p)[l] = n++; + } + /* + position vlen3D of </g1> vlen3D of </g1> difference + ------------------------------------------------------------ + [ 0 0 1 ] 1 0 1 + [ 0 1 0 ] 2 0 2 + [ 0 1 1 ] 3 0 3 + [ 0 2 0 ] 4 0 4 + [ 0 2 1 ] 5 0 5 + [ 1 0 0 ] 6 0 6 + [ 1 0 0 ] 7 0 7 + [ 1 0 1 ] 8 0 8 + [ 1 0 1 ] 9 0 9 + [ 1 1 0 ] 10 0 10 + etc + */ + sid = H5Screate_simple(3, dims3, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + status = H5Awrite(aid, tid, buf53); + assert(status >= 0); + status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53); + assert(status >= 0); + status = H5Aclose(aid); + status = H5Tclose(tid); + status = H5Sclose(sid); + + /*------------------------------------------------------------------------- + * H5T_ARRAY + *------------------------------------------------------------------------- + */ + n = 1; + for (i = 0; i < 24; i++) { + for (j = 0; j < (int) dimarray[0]; j++) { + if (make_diffs) + buf63[i][j] = 0; + else + buf63[i][j] = n++; + } + } + /* + position array3D of </g1> array3D of </g1> difference + ------------------------------------------------------------ + [ 0 0 0 ] 1 0 1 + [ 0 0 0 ] 2 0 2 + [ 0 0 0 ] 3 0 3 + [ 0 0 1 ] 4 0 4 + [ 0 0 1 ] 5 0 5 + [ 0 0 1 ] 6 0 6 + [ 0 1 0 ] 7 0 7 + etc + */ + + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_attr(loc_id, 3, dims3, "array3D", tid, buf63); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ + n = 1; + f = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) { + if (make_diffs) { + buf73[i][j][k] = 0; + buf83[i][j][k] = 0.0F; + } + else { + buf73[i][j][k] = n++; + buf83[i][j][k] = f++; + } + } + + /* + position integer3D of </g1> integer3D of </g1> difference + ------------------------------------------------------------ + [ 0 0 0 ] 1 0 1 + [ 0 0 1 ] 2 0 2 + [ 0 1 0 ] 3 0 3 + [ 0 1 1 ] 4 0 4 + [ 0 2 0 ] 5 0 5 + [ 0 2 1 ] 6 0 6 + [ 1 0 0 ] 7 0 7 + [ 1 0 1 ] 8 0 8 + [ 1 1 0 ] 9 0 9 + [ 1 1 1 ] 10 0 10 + etc + */ + write_attr(loc_id, 3, dims3, "integer3D", H5T_NATIVE_INT, buf73); + write_attr(loc_id, 3, dims3, "float3D", H5T_NATIVE_FLOAT, buf83); +} + +/*------------------------------------------------------------------------- + * Function: write_attr_in + * + * Purpose: write attributes in LOC_ID (dataset, group, named datatype) + * + *------------------------------------------------------------------------- + */ +static +void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs /* flag to modify data buffers */) +{ + /* Compound datatype */ + typedef struct s_t { + char a; + double b; + } s_t; + + typedef enum { + RED, GREEN + } e_t; + + hid_t aid = -1; + hid_t sid = -1; + hid_t tid = -1; + herr_t status; + int val, i, j, k, l, n; + float f; + + /* create 1D attributes with dimension [2], 2 elements */ + hsize_t dims[1] = { 2 }; + char buf1[2][STR_SIZE] = { "ab", "de" }; /* string */ + char *buf1a[2]; /* VL string */ + char buf2[2] = { 1, 2 }; /* bitfield, opaque */ + s_t buf3[2] = { { 1, 2.0F }, { 3, 4.0F } }; /* compound */ + hobj_ref_t buf4[2]; /* reference */ + e_t buf45[2] = { RED, RED }; /* enum */ + hvl_t buf5[2]; /* vlen */ + hsize_t dimarray[1] = { 3 }; /* array dimension */ + int buf6[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } }; /* array */ + int buf7[2] = { 1, 2 }; /* integer */ + float buf8[2] = { 1.0F, 2.0F }; /* float */ + + /* create 2D attributes with dimension [3][2], 6 elements */ + hsize_t dims2[2] = { 3, 2 }; + char buf12[3][2][STR_SIZE] = { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }; /* string */ + char *buf12a[3][2]; /* VL string */ + char buf22[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* bitfield, opaque */ + s_t buf32[6] = { { 1, 2.0F }, { 3, 4.0F }, { 5, 6.0F }, { 7, 8.0F }, { 9, 10.0F }, { 11, 12.0F } }; /* compound */ + hobj_ref_t buf42[3][2]; /* reference */ + e_t buf452[3][2]; /* enum */ + hvl_t buf52[3][2]; /* vlen */ + int buf62[6][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }; /* array */ + int buf72[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* integer */ + float buf82[3][2] = { { 1.0F, 2.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /* float */ + + /* create 3D attributes with dimension [4][3][2], 24 elements */ + hsize_t dims3[3] = { 4, 3, 2 }; + char buf13[4][3][2][STR_SIZE] = { { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }, + { { "mn", "pq" }, { "rs", "tu" }, { "vw", "xz" } }, + { { "AB", "CD" }, { "EF", "GH" }, { "IJ", "KL" } }, + { { "MN", "PQ" }, { "RS", "TU" }, { "VW", "XZ" } } }; /* string */ + char *buf13a[4][3][2]; /* VL string */ + char buf23[4][3][2]; /* bitfield, opaque */ + s_t buf33[4][3][2]; /* compound */ + hobj_ref_t buf43[4][3][2]; /* reference */ + e_t buf453[4][3][2]; /* enum */ + hvl_t buf53[4][3][2]; /* vlen */ + int buf63[24][3]; /* array */ + int buf73[4][3][2]; /* integer */ + float buf83[4][3][2]; /* float */ + + /*------------------------------------------------------------------------- + * 1D attributes + *------------------------------------------------------------------------- + */ + + /*------------------------------------------------------------------------- + * H5T_STRING *------------------------------------------------------------------------- */ + if (make_diffs) - { - for (i=0; i<2; i++) - { - buf45[i]=GREEN; + for (i = 0; i < 2; i++) + for (j = 0; j < 2; j++) + buf1[i][j] = 'z'; + /* + buf1[2][2]= {"ab","de"}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: </g1> and </g1> + Attribute: <string> and <string> + position string of </g1> string of </g1> difference + ------------------------------------------------------------ + [ 0 ] a z + [ 0 ] b z + [ 1 ] d z + [ 1 ] e z + */ + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, (size_t) STR_SIZE); + write_attr(loc_id, 1, dims, "string", tid, buf1); + status = H5Tclose(tid); + + for (i = 0; i < 2; i++) + buf1a[i] = buf1[i]; + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id, 1, dims, "VLstring", tid, buf1a); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ + + if (make_diffs) + for (i = 0; i < 2; i++) + buf2[i] = buf2[1] = 0; + /* + buf2[2]= {1,2}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: </g1> and </g1> + Attribute: <bitfield> and <bitfield> + position bitfield of </g1> bitfield of </g1> difference + position opaque of </g1> opaque of </g1> difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 1 ] 2 0 2 + */ + + tid = H5Tcopy(H5T_STD_B8LE); + write_attr(loc_id, 1, dims, "bitfield", tid, buf2); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + + /* + buf2[2]= {1,2}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: </g1> and </g1> + Attribute: <opaque> and <opaque> + position opaque of </g1> opaque of </g1> difference + position opaque of </g1> opaque of </g1> difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 1 ] 2 0 2 + */ + + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); + status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ + write_attr(loc_id, 1, dims, "opaque", tid, buf2); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ + + if (make_diffs) + for (i = 0; i < 2; i++) { + buf3[i].a = 0; + buf3[i].b = 0; } + /* + buf3[2]= {{1,2},{3,4}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: </g1> and </g1> + Attribute: <compound> and <compound> + position compound of </g1> compound of </g1> difference + ------------------------------------------------------------ + [ 0 ] 1 5 4 + [ 0 ] 2 5 3 + [ 1 ] 3 5 2 + [ 1 ] 4 5 1 + */ + + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); + H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); + H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + write_attr(loc_id, 1, dims, "compound", tid, buf3); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_REFERENCE (H5R_OBJECT object reference) + *------------------------------------------------------------------------- + */ + /* Create references to dataset */ + if (dset_name) { + status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t) -1); + write_attr(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4); } + + /*------------------------------------------------------------------------- + * H5T_ENUM + *------------------------------------------------------------------------- + */ + if (make_diffs) + for (i = 0; i < 2; i++) + buf45[i] = GREEN; /* - buf45[2]= {RED,RED}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: </g1> and </g1> - Attribute: <enum> and <enum> - position enum of </g1> enum of </g1> difference - ------------------------------------------------------------ - [ 0 ] RED GREEN - [ 1 ] RED GREEN + buf45[2]= {RED,RED}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: </g1> and </g1> + Attribute: <enum> and <enum> + position enum of </g1> enum of </g1> difference + ------------------------------------------------------------ + [ 0 ] RED GREEN + [ 1 ] RED GREEN */ tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_attr(loc_id,1,dims,"enum",tid,buf45); + write_attr(loc_id, 1, dims, "enum", tid, buf45); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5753,27 +6425,26 @@ void write_attr_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = HDmalloc( 1 * sizeof(int)); - ((int *)buf5[0].p)[0]=1; + buf5[0].p = HDmalloc(1 * sizeof(int)); + ((int *) buf5[0].p)[0] = 1; buf5[1].len = 2; - buf5[1].p = HDmalloc( 2 * sizeof(int)); - ((int *)buf5[1].p)[0]=2; - ((int *)buf5[1].p)[1]=3; + buf5[1].p = HDmalloc(2 * sizeof(int)); + ((int *) buf5[1].p)[0] = 2; + ((int *) buf5[1].p)[1] = 3; - if (make_diffs) - { - ((int *)buf5[0].p)[0]=0; - ((int *)buf5[1].p)[0]=0; - ((int *)buf5[1].p)[1]=0; + if (make_diffs) { + ((int *) buf5[0].p)[0] = 0; + ((int *) buf5[1].p)[0] = 0; + ((int *) buf5[1].p)[1] = 0; } /* - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: </g1> and </g1> - position vlen of </g1> vlen of </g1> difference - ------------------------------------------------------------ - [ 0 ] 1 0 1 - [ 1 ] 2 0 2 - [ 1 ] 3 0 3 + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: </g1> and </g1> + position vlen of </g1> vlen of </g1> difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 1 ] 2 0 2 + [ 1 ] 3 0 3 */ sid = H5Screate_simple(1, dims, NULL); @@ -5792,27 +6463,24 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<2; i++) - for (j=0; j<3; j++) - { - buf6[i][j]=0; - } + if (make_diffs) { + for (i = 0; i < 2; i++) + for (j = 0; j < 3; j++) + buf6[i][j] = 0; } /* - buf6[2][3]= {{1,2,3},{4,5,6}}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: </g1> and </g1> - Attribute: <array> and <array> - position array of </g1> array of </g1> difference - ------------------------------------------------------------ - [ 0 ] 1 0 1 - [ 0 ] 2 0 2 - [ 0 ] 3 0 3 - [ 1 ] 4 0 4 - [ 1 ] 5 0 5 - [ 1 ] 6 0 6 + buf6[2][3]= {{1,2,3},{4,5,6}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: </g1> and </g1> + Attribute: <array> and <array> + position array of </g1> array of </g1> difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 0 ] 2 0 2 + [ 0 ] 3 0 3 + [ 1 ] 4 0 4 + [ 1 ] 5 0 5 + [ 1 ] 6 0 6 */ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_attr(loc_id, 1, dims, "array", tid, buf6); @@ -5823,31 +6491,28 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<2; i++) - { - buf7[i]=0; - buf8[i]=0; + if (make_diffs) { + for (i = 0; i < 2; i++) { + buf7[i] = 0; + buf8[i] = 0; } } /* - buf7[2]= {1,2}; - buf8[2]= {1,2}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: </g1> and </g1> - position integer of </g1> integer of </g1> difference - ------------------------------------------------------------ - [ 0 ] 1 0 1 - [ 1 ] 2 0 2 - position float of </g1> float of </g1> difference - ------------------------------------------------------------ - [ 0 ] 1 0 1 - [ 1 ] 2 0 2 - */ - write_attr(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7); - write_attr(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8); - + buf7[2]= {1,2}; + buf8[2]= {1,2}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: </g1> and </g1> + position integer of </g1> integer of </g1> difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 1 ] 2 0 2 + position float of </g1> float of </g1> difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 1 ] 2 0 2 + */ + write_attr(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7); + write_attr(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8); /*------------------------------------------------------------------------- * 2D attributes @@ -5858,50 +6523,45 @@ void write_attr_in(hid_t loc_id, * H5T_STRING *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<3; i++) - for (j=0; j<2; j++) - for (k=0; k<2; k++) - buf12[i][j][k]='z'; + if (make_diffs) { + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + for (k = 0; k < 2; k++) + buf12[i][j][k] = 'z'; } /* - buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Attribute: <string2D> and <string2D> - position string2D of </g1> string2D of </g1> difference - ------------------------------------------------------------ - [ 0 0 ] a z - [ 0 0 ] b z - [ 0 1 ] c z - [ 0 1 ] d z - [ 1 0 ] e z - [ 1 0 ] f z - [ 1 1 ] g z - [ 1 1 ] h z - [ 2 0 ] i z - [ 2 0 ] j z - [ 2 1 ] k z - [ 2 1 ] l z + buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Attribute: <string2D> and <string2D> + position string2D of </g1> string2D of </g1> difference + ------------------------------------------------------------ + [ 0 0 ] a z + [ 0 0 ] b z + [ 0 1 ] c z + [ 0 1 ] d z + [ 1 0 ] e z + [ 1 0 ] f z + [ 1 1 ] g z + [ 1 1 ] h z + [ 2 0 ] i z + [ 2 0 ] j z + [ 2 1 ] k z + [ 2 1 ] l z */ tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, (size_t)STR_SIZE); - write_attr(loc_id,2,dims2,"string2D",tid,buf12); + status = H5Tset_size(tid, (size_t) STR_SIZE); + write_attr(loc_id, 2, dims2, "string2D", tid, buf12); status = H5Tclose(tid); - for (i=0; i<3; i++) - { - for (j=0; j<2; j++) - { + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + buf12a[i][j] = buf12[i][j]; - buf12a[i][j]=buf12[i][j]; - } - } tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, H5T_VARIABLE); - write_attr(loc_id,2,dims2,"VLstring2D",tid,buf12a); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id, 2, dims2, "VLstring2D", tid, buf12a); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5910,27 +6570,23 @@ void write_attr_in(hid_t loc_id, */ if (make_diffs) - { - memset(buf22,0,sizeof buf22); - } - + memset(buf22, 0, sizeof buf22); /* - buf22[3][2]= {{1,2},{3,4},{5,6}}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Attribute: <bitfield2D> and <bitfield2D> - position bitfield2D of </g1> bitfield2D of </g1> difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 1 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 2 0 ] 5 0 5 - [ 2 1 ] 6 0 6 + buf22[3][2]= {{1,2},{3,4},{5,6}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Attribute: <bitfield2D> and <bitfield2D> + position bitfield2D of </g1> bitfield2D of </g1> difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 */ - tid = H5Tcopy(H5T_STD_B8LE); - write_attr(loc_id,2,dims2,"bitfield2D",tid,buf22); + write_attr(loc_id, 2, dims2, "bitfield2D", tid, buf22); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5939,21 +6595,21 @@ void write_attr_in(hid_t loc_id, */ /* - buf22[3][2]= {{1,2},{3,4},{5,6}}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Attribute: <opaque2D> and <opaque2D> - position opaque2D of </g1> opaque2D of </g1> difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 1 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 2 0 ] 5 0 5 - [ 2 1 ] 6 0 6 - */ - tid = H5Tcreate(H5T_OPAQUE, (size_t)1); + buf22[3][2]= {{1,2},{3,4},{5,6}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Attribute: <opaque2D> and <opaque2D> + position opaque2D of </g1> opaque2D of </g1> difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + */ + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_attr(loc_id,2,dims2,"opaque2D",tid,buf22); + write_attr(loc_id, 2, dims2, "opaque2D", tid, buf22); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5961,29 +6617,25 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ if (make_diffs) - { - memset(buf32,0,sizeof buf32); - } - + memset(buf32, 0, sizeof buf32); /* - buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Attribute: <opaque2D> and <opaque2D> - position opaque2D of </g1> opaque2D of </g1> difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 1 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 2 0 ] 5 0 5 - [ 2 1 ] 6 0 6 - */ - - - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Attribute: <opaque2D> and <opaque2D> + position opaque2D of </g1> opaque2D of </g1> difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + */ + + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_attr(loc_id,2,dims2,"compound2D",tid,buf32); + write_attr(loc_id, 2, dims2, "compound2D", tid, buf32); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5991,44 +6643,41 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - for (i = 0; i < 3; i++) { - for (j = 0; j < 2; j++) { - status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1); - } - } - write_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); + if (dset_name) { + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t) -1); + write_attr(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42); } /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- */ - for (i=0; i<3; i++) - { - for (j=0; j<2; j++) - { - if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED; + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) { + if (make_diffs) + buf452[i][j] = GREEN; + else + buf452[i][j] = RED; } - } /* - Attribute: <enum2D> and <enum2D> - position enum2D of </g1> enum2D of </g1> difference - ------------------------------------------------------------ - [ 0 0 ] RED GREEN - [ 0 1 ] RED GREEN - [ 1 0 ] RED GREEN - [ 1 1 ] RED GREEN - [ 2 0 ] RED GREEN - [ 2 1 ] RED GREEN + Attribute: <enum2D> and <enum2D> + position enum2D of </g1> enum2D of </g1> difference + ------------------------------------------------------------ + [ 0 0 ] RED GREEN + [ 0 1 ] RED GREEN + [ 1 0 ] RED GREEN + [ 1 1 ] RED GREEN + [ 2 0 ] RED GREEN + [ 2 1 ] RED GREEN */ tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_attr(loc_id,2,dims2,"enum2D",tid,buf452); + write_attr(loc_id, 2, dims2, "enum2D", tid, buf452); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6037,33 +6686,33 @@ void write_attr_in(hid_t loc_id, */ /* Allocate and initialize VL dataset to write */ - n=0; - for(i = 0; i < 3; i++) { - for(j = 0; j < 2; j++) { + n = 0; + for (i = 0; i < 3; i++) { + for (j = 0; j < 2; j++) { buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); - for(l = 0; l < i + 1; l++) - if(make_diffs) - ((int *)buf52[i][j].p)[l] = 0; + for (l = 0; l < i + 1; l++) + if (make_diffs) + ((int *) buf52[i][j].p)[l] = 0; else - ((int *)buf52[i][j].p)[l] = n++; + ((int *) buf52[i][j].p)[l] = n++; } } /* - position vlen2D of </g1> vlen2D of </g1> difference - ------------------------------------------------------------ - [ 0 1 ] 1 0 1 - [ 1 0 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 1 1 ] 5 0 5 - [ 2 0 ] 6 0 6 - [ 2 0 ] 7 0 7 - [ 2 0 ] 8 0 8 - [ 2 1 ] 9 0 9 - [ 2 1 ] 10 0 10 - [ 2 1 ] 11 0 11 + position vlen2D of </g1> vlen2D of </g1> difference + ------------------------------------------------------------ + [ 0 1 ] 1 0 1 + [ 1 0 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 1 1 ] 5 0 5 + [ 2 0 ] 6 0 6 + [ 2 0 ] 7 0 7 + [ 2 0 ] 8 0 8 + [ 2 1 ] 9 0 9 + [ 2 1 ] 10 0 10 + [ 2 1 ] 11 0 11 */ sid = H5Screate_simple(2, dims2, NULL); @@ -6083,34 +6732,32 @@ void write_attr_in(hid_t loc_id, */ if (make_diffs) - { - memset(buf62,0,sizeof buf62); - } + memset(buf62, 0, sizeof buf62); /* - buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: </g1> and </g1> - Attribute: <array2D> and <array2D> - position array2D of </g1> array2D of </g1> difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 0 ] 2 0 2 - [ 0 0 ] 3 0 3 - [ 0 1 ] 4 0 4 - [ 0 1 ] 5 0 5 - [ 0 1 ] 6 0 6 - [ 1 0 ] 7 0 7 - [ 1 0 ] 8 0 8 - [ 1 0 ] 9 0 9 - [ 1 1 ] 10 0 10 - [ 1 1 ] 11 0 11 - [ 1 1 ] 12 0 12 - [ 2 0 ] 13 0 13 - [ 2 0 ] 14 0 14 - [ 2 0 ] 15 0 15 - [ 2 1 ] 16 0 16 - [ 2 1 ] 17 0 17 - [ 2 1 ] 18 0 18 + buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: </g1> and </g1> + Attribute: <array2D> and <array2D> + position array2D of </g1> array2D of </g1> difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 0 ] 2 0 2 + [ 0 0 ] 3 0 3 + [ 0 1 ] 4 0 4 + [ 0 1 ] 5 0 5 + [ 0 1 ] 6 0 6 + [ 1 0 ] 7 0 7 + [ 1 0 ] 8 0 8 + [ 1 0 ] 9 0 9 + [ 1 1 ] 10 0 10 + [ 1 1 ] 11 0 11 + [ 1 1 ] 12 0 12 + [ 2 0 ] 13 0 13 + [ 2 0 ] 14 0 14 + [ 2 0 ] 15 0 15 + [ 2 1 ] 16 0 16 + [ 2 1 ] 17 0 17 + [ 2 1 ] 18 0 18 */ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_attr(loc_id, 2, dims2, "array2D", tid, buf62); @@ -6121,36 +6768,34 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - memset(buf72,0,sizeof buf72); - memset(buf82,0,sizeof buf82); + if (make_diffs) { + memset(buf72, 0, sizeof buf72); + memset(buf82, 0, sizeof buf82); } /* - Attribute: <integer2D> and <integer2D> - position integer2D of </g1> integer2D of </g1> difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 1 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 2 0 ] 5 0 5 - [ 2 1 ] 6 0 6 - 6 differences found - Attribute: <float2D> and <float2D> - position float2D of </g1> float2D of </g1> difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 1 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 2 0 ] 5 0 5 - [ 2 1 ] 6 0 6 - */ - - write_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72); - write_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); - + Attribute: <integer2D> and <integer2D> + position integer2D of </g1> integer2D of </g1> difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + 6 differences found + Attribute: <float2D> and <float2D> + position float2D of </g1> float2D of </g1> difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + */ + + write_attr(loc_id, 2, dims2, "integer2D", H5T_NATIVE_INT, buf72); + write_attr(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82); /*------------------------------------------------------------------------- * 3D attributes @@ -6162,90 +6807,83 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<4; i++) - for (j=0; j<3; j++) - for (k=0; k<2; k++) - for (l=0; l<2; l++) - buf13[i][j][k][l]='z'; + if (make_diffs) { + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + for (l = 0; l < 2; l++) + buf13[i][j][k][l] = 'z'; } /* - buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", - "rs","tu","vw","xz","AB","CD","EF","GH", - "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; - - Attribute: <string3D> and <string3D> - position string3D of </g1> string3D of </g1> difference - ------------------------------------------------------------ - [ 0 0 0 ] a z - [ 0 0 0 ] b z - [ 0 0 1 ] c z - [ 0 0 1 ] d z - [ 0 1 0 ] e z - [ 0 1 0 ] f z - [ 0 1 1 ] g z - [ 0 1 1 ] h z - [ 0 2 0 ] i z - [ 0 2 0 ] j z - [ 0 2 1 ] k z - [ 0 2 1 ] l z - [ 1 0 0 ] m z - [ 1 0 0 ] n z - [ 1 0 1 ] p z - [ 1 0 1 ] q z - [ 1 1 0 ] r z - [ 1 1 0 ] s z - [ 1 1 1 ] t z - [ 1 1 1 ] u z - [ 1 2 0 ] v z - [ 1 2 0 ] w z - [ 1 2 1 ] x z - [ 2 0 0 ] A z - [ 2 0 0 ] B z - [ 2 0 1 ] C z - [ 2 0 1 ] D z - [ 2 1 0 ] E z - [ 2 1 0 ] F z - [ 2 1 1 ] G z - [ 2 1 1 ] H z - [ 2 2 0 ] I z - [ 2 2 0 ] J z - [ 2 2 1 ] K z - [ 2 2 1 ] L z - [ 3 0 0 ] M z - [ 3 0 0 ] N z - [ 3 0 1 ] P z - [ 3 0 1 ] Q z - [ 3 1 0 ] R z - [ 3 1 0 ] S z - [ 3 1 1 ] T z - [ 3 1 1 ] U z - [ 3 2 0 ] V z - [ 3 2 0 ] W z - [ 3 2 1 ] X z - [ 3 2 1 ] Z z + buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", + "rs","tu","vw","xz","AB","CD","EF","GH", + "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; + + Attribute: <string3D> and <string3D> + position string3D of </g1> string3D of </g1> difference + ------------------------------------------------------------ + [ 0 0 0 ] a z + [ 0 0 0 ] b z + [ 0 0 1 ] c z + [ 0 0 1 ] d z + [ 0 1 0 ] e z + [ 0 1 0 ] f z + [ 0 1 1 ] g z + [ 0 1 1 ] h z + [ 0 2 0 ] i z + [ 0 2 0 ] j z + [ 0 2 1 ] k z + [ 0 2 1 ] l z + [ 1 0 0 ] m z + [ 1 0 0 ] n z + [ 1 0 1 ] p z + [ 1 0 1 ] q z + [ 1 1 0 ] r z + [ 1 1 0 ] s z + [ 1 1 1 ] t z + [ 1 1 1 ] u z + [ 1 2 0 ] v z + [ 1 2 0 ] w z + [ 1 2 1 ] x z + [ 2 0 0 ] A z + [ 2 0 0 ] B z + [ 2 0 1 ] C z + [ 2 0 1 ] D z + [ 2 1 0 ] E z + [ 2 1 0 ] F z + [ 2 1 1 ] G z + [ 2 1 1 ] H z + [ 2 2 0 ] I z + [ 2 2 0 ] J z + [ 2 2 1 ] K z + [ 2 2 1 ] L z + [ 3 0 0 ] M z + [ 3 0 0 ] N z + [ 3 0 1 ] P z + [ 3 0 1 ] Q z + [ 3 1 0 ] R z + [ 3 1 0 ] S z + [ 3 1 1 ] T z + [ 3 1 1 ] U z + [ 3 2 0 ] V z + [ 3 2 0 ] W z + [ 3 2 1 ] X z + [ 3 2 1 ] Z z */ tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, (size_t)STR_SIZE); - write_attr(loc_id,3,dims3,"string3D",tid,buf13); + status = H5Tset_size(tid, (size_t) STR_SIZE); + write_attr(loc_id, 3, dims3, "string3D", tid, buf13); status = H5Tclose(tid); - for (i=0; i<4; i++) - { - for (j=0; j<3; j++) - { - for (k=0; k<2; k++) - { - buf13a[i][j][k]=buf13[i][j][k]; - } - } - } + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + buf13a[i][j][k] = buf13[i][j][k]; tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, H5T_VARIABLE); - write_attr(loc_id,3,dims3,"VLstring3D",tid,buf13a); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id, 3, dims3, "VLstring3D", tid, buf13a); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6253,58 +6891,55 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - n=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + n = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { - if(make_diffs) + if (make_diffs) buf23[i][j][k] = 0; else - buf23[i][j][k] = (char)n++; + buf23[i][j][k] = (char) n++; } - } - } - /* - position bitfield3D of </g1> bitfield3D of </g1> difference - ------------------------------------------------------------ - [ 0 0 0 ] 1 0 1 - [ 0 0 1 ] 2 0 2 - [ 0 1 0 ] 3 0 3 - [ 0 1 1 ] 4 0 4 - [ 0 2 0 ] 5 0 5 - [ 0 2 1 ] 6 0 6 - [ 1 0 0 ] 7 0 7 - [ 1 0 1 ] 8 0 8 - [ 1 1 0 ] 9 0 9 - [ 1 1 1 ] 10 0 10 - [ 1 2 0 ] 11 0 11 - [ 1 2 1 ] 12 0 12 - [ 2 0 0 ] 13 0 13 - [ 2 0 1 ] 14 0 14 - [ 2 1 0 ] 15 0 15 - [ 2 1 1 ] 16 0 16 - [ 2 2 0 ] 17 0 17 - [ 2 2 1 ] 18 0 18 - [ 3 0 0 ] 19 0 19 - [ 3 0 1 ] 20 0 20 - [ 3 1 0 ] 21 0 21 - [ 3 1 1 ] 22 0 22 - [ 3 2 0 ] 23 0 23 - [ 3 2 1 ] 24 0 24 + position bitfield3D of </g1> bitfield3D of </g1> difference + ------------------------------------------------------------ + [ 0 0 0 ] 1 0 1 + [ 0 0 1 ] 2 0 2 + [ 0 1 0 ] 3 0 3 + [ 0 1 1 ] 4 0 4 + [ 0 2 0 ] 5 0 5 + [ 0 2 1 ] 6 0 6 + [ 1 0 0 ] 7 0 7 + [ 1 0 1 ] 8 0 8 + [ 1 1 0 ] 9 0 9 + [ 1 1 1 ] 10 0 10 + [ 1 2 0 ] 11 0 11 + [ 1 2 1 ] 12 0 12 + [ 2 0 0 ] 13 0 13 + [ 2 0 1 ] 14 0 14 + [ 2 1 0 ] 15 0 15 + [ 2 1 1 ] 16 0 16 + [ 2 2 0 ] 17 0 17 + [ 2 2 1 ] 18 0 18 + [ 3 0 0 ] 19 0 19 + [ 3 0 1 ] 20 0 20 + [ 3 1 0 ] 21 0 21 + [ 3 1 1 ] 22 0 22 + [ 3 2 0 ] 23 0 23 + [ 3 2 1 ] 24 0 24 */ tid = H5Tcopy(H5T_STD_B8LE); - write_attr(loc_id,3,dims3,"bitfield3D",tid,buf23); + write_attr(loc_id, 3, dims3, "bitfield3D", tid, buf23); status = H5Tclose(tid); /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- */ - tid = H5Tcreate(H5T_OPAQUE, (size_t)1); + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_attr(loc_id,3,dims3,"opaque3D",tid,buf23); + write_attr(loc_id, 3, dims3, "opaque3D", tid, buf23); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6312,77 +6947,75 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - n=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + n = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { if (make_diffs) { buf33[i][j][k].a = 0; buf33[i][j][k].b = 0.0F; } else { - buf33[i][j][k].a = (char)n++; + buf33[i][j][k].a = (char) n++; buf33[i][j][k].b = n++; } } - } - } /*position compound3D of </g1> compound3D of </g1> difference - ------------------------------------------------------------ - [ 0 0 0 ] 1 0 1 - [ 0 0 0 ] 2 0 2 - [ 0 0 1 ] 3 0 3 - [ 0 0 1 ] 4 0 4 - [ 0 1 0 ] 5 0 5 - [ 0 1 0 ] 6 0 6 - [ 0 1 1 ] 7 0 7 - [ 0 1 1 ] 8 0 8 - [ 0 2 0 ] 9 0 9 - [ 0 2 0 ] 10 0 10 - [ 0 2 1 ] 11 0 11 - [ 0 2 1 ] 12 0 12 - [ 1 0 0 ] 13 0 13 - [ 1 0 0 ] 14 0 14 - [ 1 0 1 ] 15 0 15 - [ 1 0 1 ] 16 0 16 - [ 1 1 0 ] 17 0 17 - [ 1 1 0 ] 18 0 18 - [ 1 1 1 ] 19 0 19 - [ 1 1 1 ] 20 0 20 - [ 1 2 0 ] 21 0 21 - [ 1 2 0 ] 22 0 22 - [ 1 2 1 ] 23 0 23 - [ 1 2 1 ] 24 0 24 - [ 2 0 0 ] 25 0 25 - [ 2 0 0 ] 26 0 26 - [ 2 0 1 ] 27 0 27 - [ 2 0 1 ] 28 0 28 - [ 2 1 0 ] 29 0 29 - [ 2 1 0 ] 30 0 30 - [ 2 1 1 ] 31 0 31 - [ 2 1 1 ] 32 0 32 - [ 2 2 0 ] 33 0 33 - [ 2 2 0 ] 34 0 34 - [ 2 2 1 ] 35 0 35 - [ 2 2 1 ] 36 0 36 - [ 3 0 0 ] 37 0 37 - [ 3 0 0 ] 38 0 38 - [ 3 0 1 ] 39 0 39 - [ 3 0 1 ] 40 0 40 - [ 3 1 0 ] 41 0 41 - [ 3 1 0 ] 42 0 42 - [ 3 1 1 ] 43 0 43 - [ 3 1 1 ] 44 0 44 - [ 3 2 0 ] 45 0 45 - [ 3 2 0 ] 46 0 46 - [ 3 2 1 ] 47 0 47 - [ 3 2 1 ] 48 0 48 - */ - - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + ------------------------------------------------------------ + [ 0 0 0 ] 1 0 1 + [ 0 0 0 ] 2 0 2 + [ 0 0 1 ] 3 0 3 + [ 0 0 1 ] 4 0 4 + [ 0 1 0 ] 5 0 5 + [ 0 1 0 ] 6 0 6 + [ 0 1 1 ] 7 0 7 + [ 0 1 1 ] 8 0 8 + [ 0 2 0 ] 9 0 9 + [ 0 2 0 ] 10 0 10 + [ 0 2 1 ] 11 0 11 + [ 0 2 1 ] 12 0 12 + [ 1 0 0 ] 13 0 13 + [ 1 0 0 ] 14 0 14 + [ 1 0 1 ] 15 0 15 + [ 1 0 1 ] 16 0 16 + [ 1 1 0 ] 17 0 17 + [ 1 1 0 ] 18 0 18 + [ 1 1 1 ] 19 0 19 + [ 1 1 1 ] 20 0 20 + [ 1 2 0 ] 21 0 21 + [ 1 2 0 ] 22 0 22 + [ 1 2 1 ] 23 0 23 + [ 1 2 1 ] 24 0 24 + [ 2 0 0 ] 25 0 25 + [ 2 0 0 ] 26 0 26 + [ 2 0 1 ] 27 0 27 + [ 2 0 1 ] 28 0 28 + [ 2 1 0 ] 29 0 29 + [ 2 1 0 ] 30 0 30 + [ 2 1 1 ] 31 0 31 + [ 2 1 1 ] 32 0 32 + [ 2 2 0 ] 33 0 33 + [ 2 2 0 ] 34 0 34 + [ 2 2 1 ] 35 0 35 + [ 2 2 1 ] 36 0 36 + [ 3 0 0 ] 37 0 37 + [ 3 0 0 ] 38 0 38 + [ 3 0 1 ] 39 0 39 + [ 3 0 1 ] 40 0 40 + [ 3 1 0 ] 41 0 41 + [ 3 1 0 ] 42 0 42 + [ 3 1 1 ] 43 0 43 + [ 3 1 1 ] 44 0 44 + [ 3 2 0 ] 45 0 45 + [ 3 2 0 ] 46 0 46 + [ 3 2 1 ] 47 0 47 + [ 3 2 1 ] 48 0 48 + */ + + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_attr(loc_id,3,dims3,"compound3D",tid,buf33); + write_attr(loc_id, 3, dims3, "compound3D", tid, buf33); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6390,15 +7023,13 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + if (dset_name) { + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) - status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1); - } - } - write_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); + status = H5Rcreate(&buf43[i][j][k], fid, dset_name, + H5R_OBJECT, (hid_t) -1); + write_attr(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43); } /*------------------------------------------------------------------------- @@ -6406,48 +7037,47 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { - if (make_diffs) buf453[i][j][k]=RED; else buf453[i][j][k]=GREEN; + if (make_diffs) + buf453[i][j][k] = RED; + else + buf453[i][j][k] = GREEN; } - } - } - /* - position enum3D of </g1> enum3D of </g1> difference - ------------------------------------------------------------ - [ 0 0 0 ] GREEN RED - [ 0 0 1 ] GREEN RED - [ 0 1 0 ] GREEN RED - [ 0 1 1 ] GREEN RED - [ 0 2 0 ] GREEN RED - [ 0 2 1 ] GREEN RED - [ 1 0 0 ] GREEN RED - [ 1 0 1 ] GREEN RED - [ 1 1 0 ] GREEN RED - [ 1 1 1 ] GREEN RED - [ 1 2 0 ] GREEN RED - [ 1 2 1 ] GREEN RED - [ 2 0 0 ] GREEN RED - [ 2 0 1 ] GREEN RED - [ 2 1 0 ] GREEN RED - [ 2 1 1 ] GREEN RED - [ 2 2 0 ] GREEN RED - [ 2 2 1 ] GREEN RED - [ 3 0 0 ] GREEN RED - [ 3 0 1 ] GREEN RED - [ 3 1 0 ] GREEN RED - [ 3 1 1 ] GREEN RED - [ 3 2 0 ] GREEN RED - [ 3 2 1 ] GREEN RED + position enum3D of </g1> enum3D of </g1> difference + ------------------------------------------------------------ + [ 0 0 0 ] GREEN RED + [ 0 0 1 ] GREEN RED + [ 0 1 0 ] GREEN RED + [ 0 1 1 ] GREEN RED + [ 0 2 0 ] GREEN RED + [ 0 2 1 ] GREEN RED + [ 1 0 0 ] GREEN RED + [ 1 0 1 ] GREEN RED + [ 1 1 0 ] GREEN RED + [ 1 1 1 ] GREEN RED + [ 1 2 0 ] GREEN RED + [ 1 2 1 ] GREEN RED + [ 2 0 0 ] GREEN RED + [ 2 0 1 ] GREEN RED + [ 2 1 0 ] GREEN RED + [ 2 1 1 ] GREEN RED + [ 2 2 0 ] GREEN RED + [ 2 2 1 ] GREEN RED + [ 3 0 0 ] GREEN RED + [ 3 0 1 ] GREEN RED + [ 3 1 0 ] GREEN RED + [ 3 1 1 ] GREEN RED + [ 3 2 0 ] GREEN RED + [ 3 2 1 ] GREEN RED */ - tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_attr(loc_id,3,dims3,"enum3D",tid,buf453); + write_attr(loc_id, 3, dims3, "enum3D", tid, buf453); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6456,34 +7086,32 @@ void write_attr_in(hid_t loc_id, */ /* Allocate and initialize VL dataset to write */ - n=0; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + n = 0; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) - if(make_diffs) - ((int *)buf53[i][j][k].p)[l] = 0; + if (make_diffs) + ((int *) buf53[i][j][k].p)[l] = 0; else - ((int *)buf53[i][j][k].p)[l] = n++; + ((int *) buf53[i][j][k].p)[l] = n++; } - } - } /* - position vlen3D of </g1> vlen3D of </g1> difference - ------------------------------------------------------------ - [ 0 0 1 ] 1 0 1 - [ 0 1 0 ] 2 0 2 - [ 0 1 1 ] 3 0 3 - [ 0 2 0 ] 4 0 4 - [ 0 2 1 ] 5 0 5 - [ 1 0 0 ] 6 0 6 - [ 1 0 0 ] 7 0 7 - [ 1 0 1 ] 8 0 8 - [ 1 0 1 ] 9 0 9 - [ 1 1 0 ] 10 0 10 - etc + position vlen3D of </g1> vlen3D of </g1> difference + ------------------------------------------------------------ + [ 0 0 1 ] 1 0 1 + [ 0 1 0 ] 2 0 2 + [ 0 1 1 ] 3 0 3 + [ 0 2 0 ] 4 0 4 + [ 0 2 1 ] 5 0 5 + [ 1 0 0 ] 6 0 6 + [ 1 0 0 ] 7 0 7 + [ 1 0 1 ] 8 0 8 + [ 1 0 1 ] 9 0 9 + [ 1 1 0 ] 10 0 10 + etc */ sid = H5Screate_simple(3, dims3, NULL); tid = H5Tvlen_create(H5T_NATIVE_INT); @@ -6500,24 +7128,25 @@ void write_attr_in(hid_t loc_id, * H5T_ARRAY *------------------------------------------------------------------------- */ - n=1; - for (i = 0; i < 24; i++) { - for (j = 0; j < (int)dimarray[0]; j++) { - if (make_diffs) buf63[i][j]=0; - else buf63[i][j]=n++; + n = 1; + for (i = 0; i < 24; i++) + for (j = 0; j < (int) dimarray[0]; j++) { + if (make_diffs) + buf63[i][j] = 0; + else + buf63[i][j] = n++; } - } /* - position array3D of </g1> array3D of </g1> difference - ------------------------------------------------------------ - [ 0 0 0 ] 1 0 1 - [ 0 0 0 ] 2 0 2 - [ 0 0 0 ] 3 0 3 - [ 0 0 1 ] 4 0 4 - [ 0 0 1 ] 5 0 5 - [ 0 0 1 ] 6 0 6 - [ 0 1 0 ] 7 0 7 - etc + position array3D of </g1> array3D of </g1> difference + ------------------------------------------------------------ + [ 0 0 0 ] 1 0 1 + [ 0 0 0 ] 2 0 2 + [ 0 0 0 ] 3 0 3 + [ 0 0 1 ] 4 0 4 + [ 0 0 1 ] 5 0 5 + [ 0 0 1 ] 6 0 6 + [ 0 1 0 ] 7 0 7 + etc */ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); @@ -6528,132 +7157,120 @@ void write_attr_in(hid_t loc_id, * H5T_INTEGER and H5T_FLOAT *------------------------------------------------------------------------- */ - n=1; f=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + n = 1; + f = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { if (make_diffs) { - buf73[i][j][k]=0; - buf83[i][j][k]=0.0F; + buf73[i][j][k] = 0; + buf83[i][j][k] = 0.0F; } else { - buf73[i][j][k]=n++; - buf83[i][j][k]=f++; + buf73[i][j][k] = n++; + buf83[i][j][k] = f++; } } - } - } /* - position integer3D of </g1> integer3D of </g1> difference - ------------------------------------------------------------ - [ 0 0 0 ] 1 0 1 - [ 0 0 1 ] 2 0 2 - [ 0 1 0 ] 3 0 3 - [ 0 1 1 ] 4 0 4 - [ 0 2 0 ] 5 0 5 - [ 0 2 1 ] 6 0 6 - [ 1 0 0 ] 7 0 7 - [ 1 0 1 ] 8 0 8 - [ 1 1 0 ] 9 0 9 - [ 1 1 1 ] 10 0 10 - etc - */ - write_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73); - write_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83); + position integer3D of </g1> integer3D of </g1> difference + ------------------------------------------------------------ + [ 0 0 0 ] 1 0 1 + [ 0 0 1 ] 2 0 2 + [ 0 1 0 ] 3 0 3 + [ 0 1 1 ] 4 0 4 + [ 0 2 0 ] 5 0 5 + [ 0 2 1 ] 6 0 6 + [ 1 0 0 ] 7 0 7 + [ 1 0 1 ] 8 0 8 + [ 1 1 0 ] 9 0 9 + [ 1 1 1 ] 10 0 10 + etc + */ + write_attr(loc_id, 3, dims3, "integer3D", H5T_NATIVE_INT, buf73); + write_attr(loc_id, 3, dims3, "float3D", H5T_NATIVE_FLOAT, buf83); } - - /*------------------------------------------------------------------------- -* Function: write_dset_in -* -* Purpose: write datasets in LOC_ID -* -*------------------------------------------------------------------------- -*/ + * Function: write_dset_in + * + * Purpose: write datasets in LOC_ID + * + *------------------------------------------------------------------------- + */ static -void write_dset_in(hid_t loc_id, - const char* dset_name, /* for saving reference to dataset*/ - hid_t fid, - int make_diffs /* flag to modify data buffers */) +void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs /* flag to modify data buffers */) { /* Compound datatype */ - typedef struct s_t - { - char a; + typedef struct s_t { + char a; double b; } s_t; - typedef enum - { - RED, - GREEN + typedef enum { + RED, GREEN } e_t; - hid_t did; - hid_t sid; - hid_t tid; - hid_t dcpl; - herr_t status; - int val, i, j, k, l, n; - float f; - int fillvalue=2; - int scalar_data = 2; + hid_t did = -1; + hid_t sid = -1; + hid_t tid = -1; + hid_t dcpl = -1; + herr_t status; + int val, i, j, k, l, n; + float f; + int fillvalue = 2; + int scalar_data = 2; /* create 1D attributes with dimension [2], 2 elements */ - hsize_t dims[1]={2}; - char buf1[2][STR_SIZE]= {"ab","de"}; /* string */ - char *buf1a[2]; /* VL string */ - char buf2[2]= {1,2}; /* bitfield, opaque */ - s_t buf3[2]= {{1,2.0F},{3,4.0F}}; /* compound */ - hobj_ref_t buf4[2]; /* reference */ - e_t buf45[2]= {RED,GREEN}; /* enum */ - hvl_t buf5[2]; /* vlen */ - hsize_t dimarray[1]={3}; /* array dimension */ - int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */ - int buf7[2]= {1,2}; /* integer */ - float buf8[2]= {1.0F,2.0F}; /* float */ + hsize_t dims[1] = { 2 }; + char buf1[2][STR_SIZE] = { "ab", "de" }; /* string */ + char *buf1a[2]; /* VL string */ + char buf2[2] = { 1, 2 }; /* bitfield, opaque */ + s_t buf3[2] = { { 1, 2.0F }, { 3, 4.0F } }; /* compound */ + hobj_ref_t buf4[2]; /* reference */ + e_t buf45[2] = { RED, GREEN }; /* enum */ + hvl_t buf5[2]; /* vlen */ + hsize_t dimarray[1] = { 3 }; /* array dimension */ + int buf6[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } }; /* array */ + int buf7[2] = { 1, 2 }; /* integer */ + float buf8[2] = { 1.0F, 2.0F }; /* float */ /* create 2D attributes with dimension [3][2], 6 elements */ - hsize_t dims2[2]={3,2}; - char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */ - char *buf12a[3][2]; /* VL string */ - char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ - s_t buf32[6]= {{1,2.0F},{3,4.0F},{5,6.0F},{7,8.0F},{9,10.0F},{11,12.0F}}; /* compound */ - hobj_ref_t buf42[3][2]; /* reference */ - hvl_t buf52[3][2]; /* vlen */ - int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ - int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ - float buf82[3][2]= {{1.0F,2.0F},{3.0F,4.0F},{5.0F,6.0F}}; /* float */ + hsize_t dims2[2] = { 3, 2 }; + char buf12[3][2][STR_SIZE] = { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }; /* string */ + char *buf12a[3][2]; /* VL string */ + char buf22[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* bitfield, opaque */ + s_t buf32[6] = { { 1, 2.0F }, { 3, 4.0F }, { 5, 6.0F }, { 7, 8.0F }, { 9, 10.0F }, { 11, 12.0F } }; /* compound */ + hobj_ref_t buf42[3][2]; /* reference */ + hvl_t buf52[3][2]; /* vlen */ + int buf62[6][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }; /* array */ + int buf72[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* integer */ + float buf82[3][2] = { { 1.0F, 2.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /* float */ /* create 3D attributes with dimension [4][3][2], 24 elements */ - hsize_t dims3[3]={4,3,2}; - char buf13[4][3][2][STR_SIZE]= {{{"ab","cd"},{"ef","gh"},{"ij","kl"}}, - {{"mn","pq"},{"rs","tu"},{"vw","xz"}}, - {{"AB","CD"},{"EF","GH"},{"IJ","KL"}}, - {{"MN","PQ"},{"RS","TU"},{"VW","XZ"}}}; /* string */ - char *buf13a[4][3][2]; /* VL string */ - char buf23[4][3][2]; /* bitfield, opaque */ - s_t buf33[4][3][2]; /* compound */ - hobj_ref_t buf43[4][3][2]; /* reference */ - hvl_t buf53[4][3][2]; /* vlen */ - int buf63[24][3]; /* array */ - int buf73[4][3][2]; /* integer */ - float buf83[4][3][2]; /* float */ - - if(make_diffs == 2) { + hsize_t dims3[3] = { 4, 3, 2 }; + char buf13[4][3][2][STR_SIZE] = { { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }, + { { "mn", "pq" }, { "rs", "tu" }, { "vw", "xz" } }, + { { "AB", "CD" }, { "EF", "GH" }, { "IJ", "KL" } }, + { { "MN", "PQ" }, { "RS", "TU" }, { "VW", "XZ" } } }; /* string */ + char *buf13a[4][3][2]; /* VL string */ + char buf23[4][3][2]; /* bitfield, opaque */ + s_t buf33[4][3][2]; /* compound */ + hobj_ref_t buf43[4][3][2]; /* reference */ + hvl_t buf53[4][3][2]; /* vlen */ + int buf63[24][3]; /* array */ + int buf73[4][3][2]; /* integer */ + float buf83[4][3][2]; /* float */ + + if (make_diffs == 2) dimarray[0] = 4; - } /*------------------------------------------------------------------------- * H5S_SCALAR *------------------------------------------------------------------------- */ - - - if(make_diffs) + if (make_diffs) scalar_data = 1; /* create a space */ @@ -6669,7 +7286,6 @@ void write_dset_in(hid_t loc_id, H5Dclose(did); H5Sclose(sid); - /*------------------------------------------------------------------------- * 1D *------------------------------------------------------------------------- @@ -6680,27 +7296,22 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<2; i++) - for (j=0; j<2; j++) - buf1[i][j]='z'; - } - + for (i = 0; i < 2; i++) + for (j = 0; j < 2; j++) + buf1[i][j] = 'z'; tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid,(size_t)STR_SIZE); - write_dset(loc_id,1,dims,"string",tid,buf1); + status = H5Tset_size(tid, (size_t) STR_SIZE); + write_dset(loc_id, 1, dims, "string", tid, buf1); status = H5Tclose(tid); - for (i=0; i<2; i++) - { - buf1a[i]=buf1[i]; - } + for (i = 0; i < 2; i++) + buf1a[i] = buf1[i]; + tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, H5T_VARIABLE); - write_dset(loc_id,1,dims,"VLstring",tid,buf1a); + status = H5Tset_size(tid, H5T_VARIABLE); + write_dset(loc_id, 1, dims, "VLstring", tid, buf1a); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6709,13 +7320,11 @@ void write_dset_in(hid_t loc_id, */ if (make_diffs) - { - for (i=0; i<2; i++) - buf2[i]=buf2[1]=0; - } + for (i = 0; i < 2; i++) + buf2[i] = buf2[1] = 0; tid = H5Tcopy(H5T_STD_B8LE); - write_dset(loc_id,1,dims,"bitfield",tid,buf2); + write_dset(loc_id, 1, dims, "bitfield", tid, buf2); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6724,16 +7333,14 @@ void write_dset_in(hid_t loc_id, */ if (make_diffs) - { - for (i=0; i<2; i++) - { - buf3[i].a=0; buf3[i].b=0; + for (i = 0; i < 2; i++) { + buf3[i].a = 0; + buf3[i].b = 0; } - } - tid = H5Tcreate(H5T_OPAQUE, (size_t)1); + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_dset(loc_id,1,dims,"opaque",tid,buf2); + write_dset(loc_id, 1, dims, "opaque", tid, buf2); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6741,19 +7348,14 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<2; i++) - { - buf45[i]=GREEN; - } - } + for (i = 0; i < 2; i++) + buf45[i] = GREEN; - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_dset(loc_id,1,dims,"compound",tid,buf3); + write_dset(loc_id, 1, dims, "compound", tid, buf3); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6761,11 +7363,10 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1); - status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1); - write_dset(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); + if (dset_name) { + status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t) -1); + write_dset(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4); } /*------------------------------------------------------------------------- @@ -6773,16 +7374,16 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - gen_datareg(fid,make_diffs); + gen_datareg(fid, make_diffs); /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- */ tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_dset(loc_id,1,dims,"enum",tid,buf45); + write_dset(loc_id, 1, dims, "enum", tid, buf45); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6793,22 +7394,23 @@ void write_dset_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = HDmalloc( 1 * sizeof(int)); - ((int *)buf5[0].p)[0]=1; + buf5[0].p = HDmalloc(1 * sizeof(int)); + ((int *) buf5[0].p)[0] = 1; buf5[1].len = 2; - buf5[1].p = HDmalloc( 2 * sizeof(int)); - ((int *)buf5[1].p)[0]=2; - ((int *)buf5[1].p)[1]=3; + buf5[1].p = HDmalloc(2 * sizeof(int)); + ((int *) buf5[1].p)[0] = 2; + ((int *) buf5[1].p)[1] = 3; - if(make_diffs) { - ((int *)buf5[0].p)[0] = 0; - ((int *)buf5[1].p)[0] = 0; - ((int *)buf5[1].p)[1]=0; + if (make_diffs) { + ((int *) buf5[0].p)[0] = 0; + ((int *) buf5[1].p)[0] = 0; + ((int *) buf5[1].p)[1] = 0; } sid = H5Screate_simple(1, dims, NULL); tid = H5Tvlen_create(H5T_NATIVE_INT); - did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT); status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5); HDassert(status >= 0); status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); @@ -6823,37 +7425,32 @@ void write_dset_in(hid_t loc_id, */ if (make_diffs) - { - for (i=0; i<2; i++) - for (j=0; j<3; j++) - { - buf6[i][j]=0; - } - } + for (i = 0; i < 2; i++) + for (j = 0; j < 3; j++) + buf6[i][j] = 0; tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_dset(loc_id, 1, dims, "array", tid, buf6); status = H5Tclose(tid); { - double *dbuf; /* information to write */ - hid_t ldid; /* dataset ID */ - hid_t lsid; /* dataspace ID */ - hid_t ltid; /* datatype ID */ - size_t size; - hsize_t sdims[] = {1}; - hsize_t tdims[] = {H5TOOLS_MALLOCSIZE / sizeof(double) + 1}; - size_t jj; + double *dbuf; /* information to write */ + hid_t ldid = -1; /* dataset ID */ + hid_t lsid = -1; /* dataspace ID */ + hid_t ltid = -1; /* datatype ID */ + size_t size; + hsize_t sdims[] = { 1 }; + hsize_t tdims[] = { H5TOOLS_MALLOCSIZE / sizeof(double) + 1 }; + size_t jj; /* allocate and initialize array data to write */ - size = ( H5TOOLS_MALLOCSIZE / sizeof(double) + 1 ) * sizeof(double); - dbuf = (double *)HDmalloc(size); + size = (H5TOOLS_MALLOCSIZE / sizeof(double) + 1) * sizeof(double); + dbuf = (double *) HDmalloc(size); - for(jj = 0; jj < (H5TOOLS_MALLOCSIZE / sizeof(double) + 1); jj++) - dbuf[jj] = (double)jj; + for (jj = 0; jj < (H5TOOLS_MALLOCSIZE / sizeof(double) + 1); jj++) + dbuf[jj] = (double) jj; - if (make_diffs) - { + if (make_diffs) { dbuf[5] = 0; dbuf[6] = 0; } @@ -6880,17 +7477,13 @@ void write_dset_in(hid_t loc_id, */ if (make_diffs) - { - for (i=0; i<2; i++) - { - buf7[i]=0; - buf8[i]=0; + for (i = 0; i < 2; i++) { + buf7[i] = 0; + buf8[i] = 0; } - } - - write_dset(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7); - write_dset(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8); + write_dset(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7); + write_dset(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8); /*------------------------------------------------------------------------- * 2D @@ -6902,30 +7495,25 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<3; i++) - for (j=0; j<2; j++) - for (k=0; k<2; k++) - buf12[i][j][k]='z'; + if (make_diffs) { + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + for (k = 0; k < 2; k++) + buf12[i][j][k] = 'z'; } - tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid,(size_t)STR_SIZE); - write_dset(loc_id,2,dims2,"string2D",tid,buf12); + status = H5Tset_size(tid, (size_t) STR_SIZE); + write_dset(loc_id, 2, dims2, "string2D", tid, buf12); status = H5Tclose(tid); - for (i=0; i<3; i++) - { - for (j=0; j<2; j++) - { - buf12a[i][j]=buf12[i][j]; - } - } + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + buf12a[i][j] = buf12[i][j]; + tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, H5T_VARIABLE); - write_dset(loc_id,2,dims2,"VLstring2D",tid,buf12a); + status = H5Tset_size(tid, H5T_VARIABLE); + write_dset(loc_id, 2, dims2, "VLstring2D", tid, buf12a); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6933,23 +7521,20 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - memset(buf22,0,sizeof buf22); - } + memset(buf22, 0, sizeof buf22); tid = H5Tcopy(H5T_STD_B8LE); - write_dset(loc_id,2,dims2,"bitfield2D",tid,buf22); + write_dset(loc_id, 2, dims2, "bitfield2D", tid, buf22); status = H5Tclose(tid); /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- */ - tid = H5Tcreate(H5T_OPAQUE, (size_t)1); + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_dset(loc_id,2,dims2,"opaque2D",tid,buf22); + write_dset(loc_id, 2, dims2, "opaque2D", tid, buf22); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6958,14 +7543,12 @@ void write_dset_in(hid_t loc_id, */ if (make_diffs) - { - memset(buf32,0,sizeof buf32); - } + memset(buf32, 0, sizeof buf32); - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_dset(loc_id,2,dims2,"compound2D",tid,buf32); + write_dset(loc_id, 2, dims2, "compound2D", tid, buf32); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6973,14 +7556,11 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - for (i = 0; i < 3; i++) { - for (j = 0; j < 2; j++) { - status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1); - } - } - write_dset(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); + if (dset_name) { + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t) -1); + write_dset(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42); } /*------------------------------------------------------------------------- @@ -6989,9 +7569,9 @@ void write_dset_in(hid_t loc_id, */ tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_dset(loc_id,2,dims2,"enum2D",tid,0); + write_dset(loc_id, 2, dims2, "enum2D", tid, 0); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -7001,18 +7581,17 @@ void write_dset_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ n = 0; - for(i = 0; i < 3; i++) { - for(j = 0; j < 2; j++) { + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) { buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); - for(l = 0; l < i + 1; l++) { - if(make_diffs) - ((int *)buf52[i][j].p)[l] = 0; + for (l = 0; l < i + 1; l++) { + if (make_diffs) + ((int *) buf52[i][j].p)[l] = 0; else - ((int *)buf52[i][j].p)[l] = n++; + ((int *) buf52[i][j].p)[l] = n++; } } - } sid = H5Screate_simple(2, dims2, NULL); tid = H5Tvlen_create(H5T_NATIVE_INT); @@ -7031,10 +7610,7 @@ void write_dset_in(hid_t loc_id, */ if (make_diffs) - { - memset(buf62,0,sizeof buf62); - } - + memset(buf62, 0, sizeof buf62); tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_dset(loc_id, 2, dims2, "array2D", tid, buf62); @@ -7045,14 +7621,11 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - - if (make_diffs) - { + if (make_diffs) { memset(buf72, 0, sizeof buf72); memset(buf82, 0, sizeof buf82); } - dcpl = H5Pcreate(H5P_DATASET_CREATE); status = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue); sid = H5Screate_simple(2, dims2, NULL); @@ -7067,8 +7640,7 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - write_dset(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); - + write_dset(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82); /*------------------------------------------------------------------------- * 3D @@ -7080,33 +7652,27 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<4; i++) - for (j=0; j<3; j++) - for (k=0; k<2; k++) - for (l=0; l<2; l++) - buf13[i][j][k][l]='z'; + if (make_diffs) { + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + for (l = 0; l < 2; l++) + buf13[i][j][k][l] = 'z'; } tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid,(size_t)STR_SIZE); - write_dset(loc_id,3,dims3,"string3D",tid,buf13); + status = H5Tset_size(tid, (size_t) STR_SIZE); + write_dset(loc_id, 3, dims3, "string3D", tid, buf13); status = H5Tclose(tid); - for (i=0; i<4; i++) - { - for (j=0; j<3; j++) - { - for (k=0; k<2; k++) - { - buf13a[i][j][k]=buf13[i][j][k]; - } - } - } + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + buf13a[i][j][k] = buf13[i][j][k]; + tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, H5T_VARIABLE); - write_dset(loc_id,3,dims3,"VLstring3D",tid,buf13a); + status = H5Tset_size(tid, H5T_VARIABLE); + write_dset(loc_id, 3, dims3, "VLstring3D", tid, buf13a); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -7114,31 +7680,27 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - - n=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + n = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { - if(make_diffs) + if (make_diffs) buf23[i][j][k] = 0; else - buf23[i][j][k] = (char)n++; + buf23[i][j][k] = (char) n++; } - } - } - tid = H5Tcopy(H5T_STD_B8LE); - write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23); + write_dset(loc_id, 3, dims3, "bitfield3D", tid, buf23); status = H5Tclose(tid); /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- */ - tid = H5Tcreate(H5T_OPAQUE, (size_t)1); + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_dset(loc_id,3,dims3,"opaque3D",tid,buf23); + write_dset(loc_id, 3, dims3, "opaque3D", tid, buf23); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -7146,27 +7708,24 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - n=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + n = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { if (make_diffs) { buf33[i][j][k].a = 0; buf33[i][j][k].b = 0.0F; } else { - buf33[i][j][k].a = (char)n++; + buf33[i][j][k].a = (char) n++; buf33[i][j][k].b = n++; } } - } - } - - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_dset(loc_id,3,dims3,"compound3D",tid,buf33); + write_dset(loc_id, 3, dims3, "compound3D", tid, buf33); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -7174,15 +7733,12 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + if (dset_name) { + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) - status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1); - } - } - write_dset(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); + status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t) -1); + write_dset(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43); } /*------------------------------------------------------------------------- @@ -7191,9 +7747,9 @@ void write_dset_in(hid_t loc_id, */ tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_dset(loc_id,3,dims3,"enum3D",tid,0); + write_dset(loc_id, 3, dims3, "enum3D", tid, 0); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -7202,21 +7758,19 @@ void write_dset_in(hid_t loc_id, */ /* Allocate and initialize VL dataset to write */ - n=0; - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) { + n = 0; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) { buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)(i + 1); - for(l = 0; l < i + 1; l++) { - if(make_diffs) - ((int *)buf53[i][j][k].p)[l] = 0; + for (l = 0; l < i + 1; l++) { + if (make_diffs) + ((int *) buf53[i][j][k].p)[l] = 0; else - ((int *)buf53[i][j][k].p)[l] = n++; + ((int *) buf53[i][j][k].p)[l] = n++; } } - } - } sid = H5Screate_simple(3, dims3, NULL); tid = H5Tvlen_create(H5T_NATIVE_INT); @@ -7234,14 +7788,14 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - - n=1; - for (i = 0; i < 24; i++) { + n = 1; + for (i = 0; i < 24; i++) for (j = 0; j < 3; j++) { - if (make_diffs) buf63[i][j]=0; - else buf63[i][j]=n++; + if (make_diffs) + buf63[i][j] = 0; + else + buf63[i][j] = n++; } - } tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_dset(loc_id, 3, dims3, "array3D", tid, buf63); @@ -7251,82 +7805,86 @@ void write_dset_in(hid_t loc_id, * H5T_INTEGER and H5T_FLOAT *------------------------------------------------------------------------- */ - n=1; f=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + n = 1; + f = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { if (make_diffs) { - buf73[i][j][k]=0; - buf83[i][j][k]=0.0F; + buf73[i][j][k] = 0; + buf83[i][j][k] = 0.0F; } else { - buf73[i][j][k]=n++; - buf83[i][j][k]=f++; + buf73[i][j][k] = n++; + buf83[i][j][k] = f++; } } - } - } - write_dset(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73); - write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83); + + write_dset(loc_id, 3, dims3, "integer3D", H5T_NATIVE_INT, buf73); + write_dset(loc_id, 3, dims3, "float3D", H5T_NATIVE_FLOAT, buf83); } /*------------------------------------------------------------------------- -* Function: gen_datareg -* -* Purpose: generate a dataset region and its reference -* -* Date: April 19, 2006 -* -*------------------------------------------------------------------------- -*/ + * Function: gen_datareg + * + * Purpose: generate a dataset region and its reference + * + * Date: April 19, 2006 + * + *------------------------------------------------------------------------- + */ static -void gen_datareg(hid_t fid, - int make_diffs /* flag to modify data buffers */) +void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */) { /* data dataset */ - hid_t did1; /* dataset ID */ - hid_t sid1; /* dataspace ID */ - hsize_t dims1[2] = {10,10};/* dimensions */ - int *buf; /* dataset buffer */ + hid_t did1 = -1; /* dataset ID */ + hid_t sid1 = -1; /* dataspace ID */ + hsize_t dims1[2] = { 10, 10 };/* dimensions */ + int *buf; /* dataset buffer */ /* reference dataset */ - hid_t did2; /* dataset ID */ - hid_t sid2; /* dataspace ID */ - hsize_t dims2[] = {2}; /* 2 references */ - hdset_reg_ref_t *rbuf; /* buffer for write the references */ - hsize_t start[10]; /* starting location of hyperslab */ - hsize_t count[10]; /* element count of hyperslab */ - hsize_t coord[5][2]; /* coordinates for point selection */ - herr_t status; - int i; + hid_t did2 = -1; /* dataset ID */ + hid_t sid2 = -1; /* dataspace ID */ + hsize_t dims2[] = { 2 }; /* 2 references */ + hdset_reg_ref_t *rbuf; /* buffer for write the references */ + hsize_t start[10]; /* starting location of hyperslab */ + hsize_t count[10]; /* element count of hyperslab */ + hsize_t coord[5][2]; /* coordinates for point selection */ + herr_t status; + int i; /* allocate the buffer for write the references */ - rbuf = (hdset_reg_ref_t *)HDcalloc((size_t)2, sizeof(hdset_reg_ref_t)); + rbuf = (hdset_reg_ref_t *) HDcalloc((size_t )2, sizeof(hdset_reg_ref_t)); /* allocate the buffer for write the data dataset */ - buf = (int *)HDmalloc(10 * 10 * sizeof(int)); + buf = (int *) HDmalloc(10 * 10 * sizeof(int)); - for(i = 0; i < 10 * 10; i++) + for (i = 0; i < 10 * 10; i++) buf[i] = i; /* create the data dataset */ - sid1 = H5Screate_simple(2, dims1, NULL); - did1 = H5Dcreate2(fid, "dsetref", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + sid1 = H5Screate_simple(2, dims1, NULL); + did1 = H5Dcreate2(fid, "dsetref", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); HDassert(status >= 0); /* create the reference dataset */ - sid2 = H5Screate_simple(1, dims2, NULL); - did2 = H5Dcreate2(fid, "refreg", H5T_STD_REF_DSETREG, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + sid2 = H5Screate_simple(1, dims2, NULL); + did2 = H5Dcreate2(fid, "refreg", H5T_STD_REF_DSETREG, sid2, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); /* create the references */ /* select hyperslab for first reference */ - start[0] = 2; start[1] = 2; - count[0] = 6; count[1] = 6; - if(make_diffs) { - start[0] = 0; start[1] = 0; - count[0] = 3; count[1] = 3; + start[0] = 2; + start[1] = 2; + count[0] = 6; + count[1] = 6; + if (make_diffs) { + start[0] = 0; + start[1] = 0; + count[0] = 3; + count[1] = 3; } status = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL); @@ -7338,25 +7896,32 @@ void gen_datareg(hid_t fid, HDassert(status >= 0); /* select sequence of five points for second reference */ - coord[0][0]=6; coord[0][1]=9; - coord[1][0]=2; coord[1][1]=2; - coord[2][0]=8; coord[2][1]=4; - coord[3][0]=1; coord[3][1]=6; - coord[4][0]=2; coord[4][1]=8; - if (make_diffs) - { - coord[1][0]=3; coord[1][1]=3; - coord[3][0]=2; coord[3][1]=5; - coord[4][0]=1; coord[4][1]=7; - } - H5Sselect_elements(sid1,H5S_SELECT_SET,(size_t)5,(const hsize_t *)coord); + coord[0][0] = 6; + coord[0][1] = 9; + coord[1][0] = 2; + coord[1][1] = 2; + coord[2][0] = 8; + coord[2][1] = 4; + coord[3][0] = 1; + coord[3][1] = 6; + coord[4][0] = 2; + coord[4][1] = 8; + if (make_diffs) { + coord[1][0] = 3; + coord[1][1] = 3; + coord[3][0] = 2; + coord[3][1] = 5; + coord[4][0] = 1; + coord[4][1] = 7; + } + H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t) 5, (const hsize_t *) coord); H5Sget_select_npoints(sid1); /* store second dataset region */ - H5Rcreate(&rbuf[1],fid,"dsetref",H5R_DATASET_REGION,sid1); + H5Rcreate(&rbuf[1], fid, "dsetref", H5R_DATASET_REGION, sid1); /* write */ - status = H5Dwrite(did2,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf); + status = H5Dwrite(did2, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf); HDassert(status >= 0); /* close, free memory buffers */ @@ -7373,60 +7938,58 @@ void gen_datareg(hid_t fid, HDfree(buf); } - /*------------------------------------------------------------------------- -* Function: test_hyperslab -* -* Purpose: test diff by hyperslabs. create a dataset with 1GB dimensions -* by iterating trough 1KB hyperslabs -* -*------------------------------------------------------------------------- -*/ + * Function: test_hyperslab + * + * Purpose: test diff by hyperslabs. create a dataset with 1GB dimensions + * by iterating trough 1KB hyperslabs + * + *------------------------------------------------------------------------- + */ static -int test_hyperslab(const char *fname, - int make_diffs /* flag to modify data buffers */) +int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buffers */) { - hid_t did=-1; - hid_t fid=-1; - hid_t f_sid=-1; - hid_t m_sid=-1; - hid_t tid=-1; - hid_t dcpl=-1; - hsize_t dims[1]={GBLL}; /* dataset dimensions */ - hsize_t hs_size[1]={GBLL/(1024*1024)}; /* hyperslab dimensions */ - hsize_t chunk_dims[1]={GBLL/1024}; /* chunk dimensions */ + hid_t did = -1; + hid_t fid = -1; + hid_t f_sid = -1; + hid_t m_sid = -1; + hid_t tid = -1; + hid_t dcpl = -1; + hsize_t dims[1] = { GBLL }; /* dataset dimensions */ + hsize_t hs_size[1] = { GBLL / (1024 * 1024) }; /* hyperslab dimensions */ + hsize_t chunk_dims[1] = { GBLL / 1024 }; /* chunk dimensions */ hsize_t hs_start[1]; - size_t size; - size_t nelmts=(size_t)GBLL/(1024*1024); /* elements in each hyperslab */ - char fillvalue=-1; - char *buf=NULL; - int i, j, s; - char c; + size_t size; + size_t nelmts = (size_t)GBLL / (1024 * 1024); /* elements in each hyperslab */ + char fillvalue = -1; + char *buf = NULL; + int i, j, s; + char c; /* create */ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; - if(H5Pset_fill_value(dcpl, H5T_NATIVE_CHAR, &fillvalue) < 0) + if (H5Pset_fill_value(dcpl, H5T_NATIVE_CHAR, &fillvalue) < 0) goto out; - if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0) + if (H5Pset_chunk(dcpl, 1, chunk_dims) < 0) goto out; - if((f_sid = H5Screate_simple(1, dims, NULL)) < 0) + if ((f_sid = H5Screate_simple(1, dims, NULL)) < 0) goto out; - if((did = H5Dcreate2(fid, "big", H5T_NATIVE_CHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, "big", H5T_NATIVE_CHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto out; - if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0) + if ((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0) goto out; - if((tid = H5Dget_type(did)) < 0) + if ((tid = H5Dget_type(did)) < 0) goto out; - if((size = H5Tget_size(tid)) <= 0) + if ((size = H5Tget_size(tid)) <= 0) goto out; /* create a evenly divided buffer from 0 to 127 */ - buf = (char *)HDmalloc((size_t)(nelmts * size)); + buf = (char *) HDmalloc((size_t)(nelmts * size)); s = 1024 * 1024 / 127; - for(i = 0, j = 0, c = 0; i < 1024 * 1024; j++, i++) { - if(j == s) { + for (i = 0, j = 0, c = 0; i < 1024 * 1024; j++, i++) { + if (j == s) { c++; j = 0; } @@ -7435,32 +7998,30 @@ int test_hyperslab(const char *fname, HDmemset(buf, c, nelmts); /* make a different hyperslab at this position */ - if(make_diffs && i == 512 * 512) + if (make_diffs && i == 512 * 512) HDmemset(buf, 0, nelmts); - hs_start[0] = (unsigned long long)i * GBLL / (1024 * 1024); - if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0) + hs_start[0] = (unsigned long long) i * GBLL / (1024 * 1024); + if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, hs_start, NULL, hs_size, NULL) < 0) goto out; /* write only one hyperslab */ - if ( i==512*512) - { - if (H5Dwrite (did,H5T_NATIVE_CHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0) + if (i == 512 * 512) { + if (H5Dwrite(did, H5T_NATIVE_CHAR, m_sid, f_sid, H5P_DEFAULT, buf) < 0) goto out; } - } HDfree(buf); - buf=NULL; + buf = NULL; /* close */ - if(H5Sclose(f_sid) < 0) + if (H5Sclose(f_sid) < 0) goto out; - if(H5Sclose(m_sid) < 0) + if (H5Sclose(m_sid) < 0) goto out; - if(H5Pclose(dcpl) < 0) + if (H5Pclose(dcpl) < 0) goto out; - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) goto out; H5Fclose(fid); @@ -7475,40 +8036,32 @@ out: H5Fclose(fid); } H5E_END_TRY; return -1; - } - /*------------------------------------------------------------------------- -* Function: write_attr -* -* Purpose: utility function to write an attribute in LOC_ID -* -*------------------------------------------------------------------------- -*/ + * Function: write_attr + * + * Purpose: utility function to write an attribute in LOC_ID + * + *------------------------------------------------------------------------- + */ static -int write_attr(hid_t loc_id, - int rank, - hsize_t *dims, - const char *name, - hid_t tid, - void *buf) +int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) { - hid_t aid=-1; - hid_t sid=-1; + hid_t aid = -1; + hid_t sid = -1; /* create a space */ - if((sid = H5Screate_simple(rank, dims, NULL)) < 0) + if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) goto out; /* create the attribute */ - if((aid = H5Acreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((aid = H5Acreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; /* write */ - if(buf) - { - if(H5Awrite(aid, tid, buf) < 0) + if (buf) { + if (H5Awrite(aid, tid, buf) < 0) goto out; } @@ -7526,35 +8079,29 @@ out: } /*------------------------------------------------------------------------- -* Function: write_dset -* -* Purpose: utility function to create and write a dataset in LOC_ID -* -*------------------------------------------------------------------------- -*/ + * Function: write_dset + * + * Purpose: utility function to create and write a dataset in LOC_ID + * + *------------------------------------------------------------------------- + */ static -int write_dset( hid_t loc_id, - int rank, - hsize_t *dims, - const char *name, - hid_t tid, - void *buf ) +int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) { - hid_t did=-1; - hid_t sid=-1; + hid_t did = -1; + hid_t sid = -1; /* create a space */ - if((sid = H5Screate_simple(rank, dims, NULL)) < 0) + if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) goto out; /* create the dataset */ - if((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; /* write */ - if(buf) - { - if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if (buf) { + if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto out; } diff --git a/tools/test/h5diff/testfiles/h5diff_8625.txt b/tools/test/h5diff/testfiles/h5diff_8625.txt new file mode 100644 index 0000000..a7ddb86 --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_8625.txt @@ -0,0 +1,10 @@ +dataset: </group/Compound_dset1> and </group_copy/Compound_dset3> +Warning: different storage datatype +Warning: different storage datatype +Not comparable: </group/Compound_dset1> or </group_copy/Compound_dset3> is of mixed string type +0 differences found +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects without details of differences. +EXIT CODE: 0 diff --git a/tools/test/h5diff/testfiles/h5diff_8639.txt b/tools/test/h5diff/testfiles/h5diff_8639.txt new file mode 100644 index 0000000..4022e06 --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_8639.txt @@ -0,0 +1,72 @@ + +group1 group2 +--------------------------------------- + x x + +group : </g1> and </g1> +0 differences found +Warning: different storage datatype +Not comparable: <VLstring> or <VLstring> is of mixed string type +Warning: different storage datatype +Not comparable: <VLstring2D> or <VLstring2D> is of mixed string type +Warning: different storage datatype +Not comparable: <VLstring3D> or <VLstring3D> is of mixed string type +attribute: <array of </g1>> and <array of </g1>> +0 differences found +attribute: <array2D of </g1>> and <array2D of </g1>> +0 differences found +attribute: <array3D of </g1>> and <array3D of </g1>> +0 differences found +attribute: <bitfield of </g1>> and <bitfield of </g1>> +0 differences found +attribute: <bitfield2D of </g1>> and <bitfield2D of </g1>> +0 differences found +attribute: <bitfield3D of </g1>> and <bitfield3D of </g1>> +0 differences found +attribute: <compound of </g1>> and <compound of </g1>> +0 differences found +attribute: <compound2D of </g1>> and <compound2D of </g1>> +0 differences found +attribute: <compound3D of </g1>> and <compound3D of </g1>> +0 differences found +attribute: <enum of </g1>> and <enum of </g1>> +0 differences found +attribute: <enum2D of </g1>> and <enum2D of </g1>> +0 differences found +attribute: <enum3D of </g1>> and <enum3D of </g1>> +0 differences found +attribute: <float of </g1>> and <float of </g1>> +0 differences found +attribute: <float2D of </g1>> and <float2D of </g1>> +0 differences found +attribute: <float3D of </g1>> and <float3D of </g1>> +0 differences found +attribute: <integer of </g1>> and <integer of </g1>> +0 differences found +attribute: <integer2D of </g1>> and <integer2D of </g1>> +0 differences found +attribute: <integer3D of </g1>> and <integer3D of </g1>> +0 differences found +attribute: <opaque of </g1>> and <opaque of </g1>> +0 differences found +attribute: <opaque2D of </g1>> and <opaque2D of </g1>> +0 differences found +attribute: <opaque3D of </g1>> and <opaque3D of </g1>> +0 differences found +Warning: different storage datatype +Not comparable: <string> or <string> is of mixed string type +Warning: different storage datatype +Not comparable: <string2D> or <string2D> is of mixed string type +Warning: different storage datatype +Not comparable: <string3D> or <string3D> is of mixed string type +attribute: <vlen of </g1>> and <vlen of </g1>> +0 differences found +attribute: <vlen2D of </g1>> and <vlen2D of </g1>> +0 differences found +attribute: <vlen3D of </g1>> and <vlen3D of </g1>> +0 differences found +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects without details of differences. +EXIT CODE: 0 diff --git a/tools/test/h5diff/testfiles/h5diff_attr1.h5 b/tools/test/h5diff/testfiles/h5diff_attr1.h5 Binary files differindex c44066b..4cea743 100644 --- a/tools/test/h5diff/testfiles/h5diff_attr1.h5 +++ b/tools/test/h5diff/testfiles/h5diff_attr1.h5 diff --git a/tools/test/h5diff/testfiles/h5diff_attr2.h5 b/tools/test/h5diff/testfiles/h5diff_attr2.h5 Binary files differindex 5de3303..3ea3302 100644 --- a/tools/test/h5diff/testfiles/h5diff_attr2.h5 +++ b/tools/test/h5diff/testfiles/h5diff_attr2.h5 diff --git a/tools/test/h5diff/testfiles/h5diff_attr3.h5 b/tools/test/h5diff/testfiles/h5diff_attr3.h5 Binary files differnew file mode 100644 index 0000000..631845d --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_attr3.h5 diff --git a/tools/test/h5diff/testfiles/h5diff_tmp1.txt b/tools/test/h5diff/testfiles/h5diff_tmp1.txt deleted file mode 100644 index 40e3fb6..0000000 --- a/tools/test/h5diff/testfiles/h5diff_tmp1.txt +++ /dev/null @@ -1,5 +0,0 @@ --------------------------------- -Some objects are not comparable --------------------------------- -Use -c for a list of objects. -EXIT CODE: 0 diff --git a/tools/test/h5diff/testfiles/h5diff_tmp2.txt b/tools/test/h5diff/testfiles/h5diff_tmp2.txt deleted file mode 100644 index a2d6da6..0000000 --- a/tools/test/h5diff/testfiles/h5diff_tmp2.txt +++ /dev/null @@ -1,13 +0,0 @@ -dataset: </G/down/Data> and </G/down/Data> -1599 differences found -dataset: </G/down/Tail/array> and </G/down/Tail/array> -8 differences found -dataset: </G/up/Data> and </G/up/Data> -1845 differences found -dataset: </G/up/Tail/array> and </G/up/Tail/array> -10 differences found --------------------------------- -Some objects are not comparable --------------------------------- -Use -c for a list of objects. -EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/tmpSingleSiteBethe.output.h5 b/tools/test/h5diff/testfiles/tmpSingleSiteBethe.output.h5 Binary files differdeleted file mode 100644 index bbcfb63..0000000 --- a/tools/test/h5diff/testfiles/tmpSingleSiteBethe.output.h5 +++ /dev/null diff --git a/tools/test/h5diff/testfiles/tmpSingleSiteBethe.reference.h5 b/tools/test/h5diff/testfiles/tmpSingleSiteBethe.reference.h5 Binary files differdeleted file mode 100644 index 6b19ed7..0000000 --- a/tools/test/h5diff/testfiles/tmpSingleSiteBethe.reference.h5 +++ /dev/null diff --git a/tools/test/h5diff/testfiles/tmptest.he5 b/tools/test/h5diff/testfiles/tmptest.he5 Binary files differdeleted file mode 100644 index edcfcd2..0000000 --- a/tools/test/h5diff/testfiles/tmptest.he5 +++ /dev/null diff --git a/tools/test/h5diff/testfiles/tmptest2.he5 b/tools/test/h5diff/testfiles/tmptest2.he5 Binary files differdeleted file mode 100644 index a6ab02b..0000000 --- a/tools/test/h5diff/testfiles/tmptest2.he5 +++ /dev/null diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in index df472d4..c464f94 100644 --- a/tools/test/h5diff/testh5diff.sh.in +++ b/tools/test/h5diff/testh5diff.sh.in @@ -82,6 +82,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_types.h5 $SRC_H5DIFF_TESTFILES/h5diff_dtypes.h5 $SRC_H5DIFF_TESTFILES/h5diff_attr1.h5 $SRC_H5DIFF_TESTFILES/h5diff_attr2.h5 +$SRC_H5DIFF_TESTFILES/h5diff_attr3.h5 $SRC_H5DIFF_TESTFILES/h5diff_dset1.h5 $SRC_H5DIFF_TESTFILES/h5diff_dset2.h5 $SRC_H5DIFF_TESTFILES/h5diff_hyper1.h5 @@ -118,10 +119,6 @@ $SRC_H5DIFF_TESTFILES/h5diff_attr_v_level2.h5 $SRC_H5DIFF_TESTFILES/h5diff_enum_invalid_values.h5 $SRC_H5DIFF_TESTFILES/non_comparables1.h5 $SRC_H5DIFF_TESTFILES/non_comparables2.h5 -$SRC_H5DIFF_TESTFILES/tmptest.he5 -$SRC_H5DIFF_TESTFILES/tmptest2.he5 -$SRC_H5DIFF_TESTFILES/tmpSingleSiteBethe.reference.h5 -$SRC_H5DIFF_TESTFILES/tmpSingleSiteBethe.output.h5 $SRC_H5DIFF_TESTFILES/diff_strings1.h5 $SRC_H5DIFF_TESTFILES/diff_strings2.h5 $SRC_TOOLS_TESTFILES/tvlstr.h5 @@ -337,8 +334,8 @@ $SRC_H5DIFF_TESTFILES/h5diff_709.txt $SRC_H5DIFF_TESTFILES/h5diff_710.txt $SRC_H5DIFF_TESTFILES/h5diff_80.txt $SRC_H5DIFF_TESTFILES/h5diff_90.txt -$SRC_H5DIFF_TESTFILES/h5diff_tmp1.txt -$SRC_H5DIFF_TESTFILES/h5diff_tmp2.txt +$SRC_H5DIFF_TESTFILES/h5diff_8625.txt +$SRC_H5DIFF_TESTFILES/h5diff_8639.txt $SRC_H5DIFF_TESTFILES/h5diff_v1.txt $SRC_H5DIFF_TESTFILES/h5diff_v2.txt $SRC_H5DIFF_TESTFILES/h5diff_v3.txt @@ -820,10 +817,6 @@ TOOLTEST h5diff_631.txt -v --use-system-epsilon h5diff_basic1.h5 h5diff_basic1.h # 7. attributes # ############################################################################## TOOLTEST h5diff_70.txt -v h5diff_attr1.h5 h5diff_attr2.h5 -# temporary test to verify HDF5-8625 -TOOLTEST h5diff_tmp1.txt tmptest2.he5 tmptest.he5 -# temporary test to verify HDF5-8639 -TOOLTEST h5diff_tmp2.txt tmpSingleSiteBethe.output.h5 tmpSingleSiteBethe.reference.h5 # ################################################## # attrs with verbose option level @@ -1145,6 +1138,10 @@ TOOLTEST h5diff_487.txt -v --exclude-path "/group1/dset" h5diff_exclude3-1.h5 h5 # # diff various multiple vlen and fixed strings in a compound type dataset # ############################################################################## TOOLTEST h5diff_530.txt -v h5diff_comp_vl_strs.h5 h5diff_comp_vl_strs.h5 /group /group_copy +# test to verify HDFFV-8625 +TOOLTEST h5diff_8625.txt -v --enable-error-stack h5diff_comp_vl_strs.h5 h5diff_comp_vl_strs.h5 /group/Compound_dset1 /group_copy/Compound_dset3 +# test to verify HDFFV-8639 +TOOLTEST h5diff_8639.txt -v h5diff_attr3.h5 h5diff_attr2.h5 /g1 TOOLTEST h5diff_vlstr.txt -v tvlstr.h5 tvlstr2.h5 # ############################################################################## diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt index 89c7534..6a12f5e 100644 --- a/tools/test/h5dump/CMakeLists.txt +++ b/tools/test/h5dump/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_TEST_H5DUMP) #----------------------------------------------------------------------------- @@ -39,7 +39,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (h5dumpgentest ${HDF5_TOOLS_TEST_H5DUMP_SOURCE_DIR}/h5dumpgentest.c) - TARGET_NAMING (h5dumpgentest STATIC) TARGET_C_PROPERTIES (h5dumpgentest STATIC " " " ") target_link_libraries (h5dumpgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools) diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index 3addecf..922e79e 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -72,6 +72,14 @@ f-3.h5 vds-eiger.h5 ) + set (HDF5_REFERENCE_PREFIX_VDS + 1_vds.h5 + 2_vds.h5 + 4_vds.h5 + 5_vds.h5 + vds-percival-unlim-maxmin.h5 + vds-eiger.h5 + ) set (HDF5_ERROR_REFERENCE_VDS ) @@ -80,12 +88,21 @@ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${vds_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files") endforeach () + foreach (vds_h5_file ${HDF5_REFERENCE_PREFIX_VDS}) + get_filename_component(fname "${vds_h5_file}" NAME) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${vds_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/vds/prefix/${fname}" "h5dump_vds_files") + endforeach () foreach (ddl_vds ${HDF5_REFERENCE_VDS}) get_filename_component(fname "${ddl_vds}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files") endforeach () + foreach (ddl_vds ${HDF5_REFERENCE_VDS}) + get_filename_component(fname "${ddl_vds}" NAME) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/prefix/${fname}" "h5dump_vds_files") + endforeach () + foreach (ddl_vds ${HDF5_ERROR_REFERENCE_VDS}) get_filename_component(fname "${ddl_vds}" NAME) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files") @@ -134,6 +151,47 @@ endif () endmacro () + macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) + # If using memchecker add tests without using scripts + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN}) + set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES + ENVIRONMENT "HDF5_VDS_PREFIX=${PROJECT_BINARY_DIR}/testfiles/vds/" + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix" + ) + if (NOT "${resultcode}" STREQUAL "0") + set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + if (NOT "${last_vds_test}" STREQUAL "") + set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) + endif () + else () + # Remove any output file left over from previous test run + add_test ( + NAME H5DUMP_PREFIX-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${resultfile}.out + ${resultfile}.out.err + ) + set_tests_properties (H5DUMP_PREFIX-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") + add_test ( + NAME H5DUMP_PREFIX-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds/prefix" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.ddl" + -D "TEST_ENV_VAR=HDF5_VDS_PREFIX" + -D "TEST_ENV_VALUE=${PROJECT_BINARY_DIR}/testfiles/vds/" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES DEPENDS H5DUMP_PREFIX-${resultfile}-clear-objects) + endif () + endmacro () + macro (ADD_H5_VDS_LAYOUT resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) @@ -261,3 +319,15 @@ ADD_H5_VDS_LAYOUT (vds_layout-eiger 0 --enable-error-stack vds-eiger.h5) ADD_H5_VDS_LAYOUT (vds_layout-maxmin 0 --enable-error-stack vds-percival-unlim-maxmin.h5) endif () + + # Data read with prefix + if (USE_FILTER_DEFLATE) + ADD_H5_VDS_PREFIX_TEST (tvds-1 0 --enable-error-stack 1_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-2 0 --enable-error-stack 2_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-4 0 --enable-error-stack 4_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-5 0 --enable-error-stack 5_vds.h5) + ADD_H5_VDS_PREFIX_TEST (vds-first 0 --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5) + ADD_H5_VDS_PREFIX_TEST (vds-gap1 0 -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5) + ADD_H5_VDS_PREFIX_TEST (vds-gap2 0 --vds-gap-size=2 --enable-error-stack vds-eiger.h5) + endif () + diff --git a/tools/test/h5dump/errfiles/tall-1.err b/tools/test/h5dump/errfiles/tall-1.err index 2f9ef71..9733453 100644 --- a/tools/test/h5dump/errfiles/tall-1.err +++ b/tools/test/h5dump/errfiles/tall-1.err @@ -23,6 +23,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile', temp_file_name = 'somefile' + #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file + #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + major: File accessibilty + minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A.err b/tools/test/h5dump/errfiles/tall-2A.err index 2f9ef71..9733453 100644 --- a/tools/test/h5dump/errfiles/tall-2A.err +++ b/tools/test/h5dump/errfiles/tall-2A.err @@ -23,6 +23,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile', temp_file_name = 'somefile' + #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file + #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + major: File accessibilty + minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A0.err b/tools/test/h5dump/errfiles/tall-2A0.err index 2f9ef71..9733453 100644 --- a/tools/test/h5dump/errfiles/tall-2A0.err +++ b/tools/test/h5dump/errfiles/tall-2A0.err @@ -23,6 +23,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile', temp_file_name = 'somefile' + #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file + #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + major: File accessibilty + minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2B.err b/tools/test/h5dump/errfiles/tall-2B.err index 2f9ef71..9733453 100644 --- a/tools/test/h5dump/errfiles/tall-2B.err +++ b/tools/test/h5dump/errfiles/tall-2B.err @@ -23,6 +23,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile', temp_file_name = 'somefile' + #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file + #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + major: File accessibilty + minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/textlink.err b/tools/test/h5dump/errfiles/textlink.err index 665517d..99e8530 100644 --- a/tools/test/h5dump/errfiles/textlink.err +++ b/tools/test/h5dump/errfiles/textlink.err @@ -23,9 +23,12 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename', temp_file_name = 'filename' + #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' major: Links minor: Unable to open file + #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' + major: File accessibilty + minor: Unable to open file HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header @@ -51,6 +54,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile', temp_file_name = 'anotherfile' + #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' major: Links minor: Unable to open file + #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' + major: File accessibilty + minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/torderlinks1.err b/tools/test/h5dump/errfiles/torderlinks1.err index fba8822..22b4318 100644 --- a/tools/test/h5dump/errfiles/torderlinks1.err +++ b/tools/test/h5dump/errfiles/torderlinks1.err @@ -23,6 +23,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname', temp_file_name = 'fname' + #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file + #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + major: File accessibilty + minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/torderlinks2.err b/tools/test/h5dump/errfiles/torderlinks2.err index fba8822..22b4318 100644 --- a/tools/test/h5dump/errfiles/torderlinks2.err +++ b/tools/test/h5dump/errfiles/torderlinks2.err @@ -23,6 +23,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname', temp_file_name = 'fname' + #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file + #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + major: File accessibilty + minor: Unable to open file diff --git a/tools/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt index 7e47b13..a27c78a 100644 --- a/tools/test/h5format_convert/CMakeLists.txt +++ b/tools/test/h5format_convert/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_TEST_H5FC) #----------------------------------------------------------------------------- @@ -10,14 +10,12 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # Add the h5format_convert test executables # -------------------------------------------------------------------- add_executable (h5fc_chk_idx ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_chk_idx.c) - TARGET_NAMING (h5fc_chk_idx STATIC) TARGET_C_PROPERTIES (h5fc_chk_idx STATIC " " " ") target_link_libraries (h5fc_chk_idx ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5fc_chk_idx PROPERTIES FOLDER tools) if (HDF5_BUILD_GENERATORS) add_executable (h5fc_gentest ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_gentest.c) - TARGET_NAMING (h5fc_gentest STATIC) TARGET_C_PROPERTIES (h5fc_gentest STATIC " " " ") target_link_libraries (h5fc_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5fc_gentest PROPERTIES FOLDER generator/tools) diff --git a/tools/test/h5import/CMakeLists.txt b/tools/test/h5import/CMakeLists.txt index 0d23e5d..2cb212a 100644 --- a/tools/test/h5import/CMakeLists.txt +++ b/tools/test/h5import/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_TEST_H5IMPORT) #----------------------------------------------------------------------------- @@ -10,7 +10,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # Add the h5import executables # -------------------------------------------------------------------- add_executable (h5importtest ${HDF5_TOOLS_TEST_H5IMPORT_SOURCE_DIR}/h5importtest.c) - TARGET_NAMING (h5importtest STATIC) TARGET_C_PROPERTIES (h5importtest STATIC " " " ") target_link_libraries (h5importtest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5importtest PROPERTIES FOLDER tools) diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt index 562b4f3..b623860 100644 --- a/tools/test/h5jam/CMakeLists.txt +++ b/tools/test/h5jam/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_TEST_H5JAM) #----------------------------------------------------------------------------- @@ -11,7 +11,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (h5jamgentest ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/h5jamgentest.c) - TARGET_NAMING (h5jamgentest STATIC) TARGET_C_PROPERTIES (testhdf5 STATIC " " " ") target_link_libraries (h5jamgentest ${HDF5_LIB_TARGET}) set_target_properties (h5jamgentest PROPERTIES FOLDER generator/tools) @@ -20,13 +19,11 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) endif () add_executable (getub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/getub.c) -TARGET_NAMING (getub STATIC) TARGET_C_PROPERTIES (getub STATIC " " " ") target_link_libraries (getub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (getub PROPERTIES FOLDER tools) add_executable (tellub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/tellub.c) -TARGET_NAMING (tellub STATIC) TARGET_C_PROPERTIES (tellub STATIC " " " ") target_link_libraries (tellub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (tellub PROPERTIES FOLDER tools) diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt index c21ca92..8549046 100644 --- a/tools/test/h5ls/CMakeLists.txt +++ b/tools/test/h5ls/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_TEST_H5LS) #----------------------------------------------------------------------------- diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index 5df61bb..2b6f61e 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -61,6 +61,17 @@ get_filename_component(fname "${listfiles}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5ls_vds_files") endforeach () + + foreach (listfiles ${LIST_HDF5_TEST_FILES}) + get_filename_component(fname "${listfiles}" NAME) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/vds/prefix/${fname}" "h5ls_vds_files") + endforeach () + + foreach (listfiles ${LIST_OTHER_TEST_FILES}) + get_filename_component(fname "${listfiles}" NAME) + HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5LS_SOURCE_DIR}/vds_prefix/${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/vds/prefix/${fname}" "h5ls_vds_files") + endforeach () + add_custom_target(h5ls_vds_files ALL COMMENT "Copying files needed by h5ls_vds tests" DEPENDS ${h5ls_vds_files_list}) ############################################################################## @@ -104,6 +115,46 @@ endif () endmacro () + macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) + # If using memchecker add tests without using scripts + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5LS_PREFIX-${resultfile} COMMAND $<TARGET_FILE:h5ls> ${ARGN}) + set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES + ENVIRONMENT "HDF5_VDS_PREFIX=\${ORIGIN}" + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) + if ("${resultcode}" STREQUAL "1") + set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () + else () + add_test ( + NAME H5LS_PREFIX-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${resultfile}.out + ${resultfile}.out.err + ) + set_tests_properties (H5LS_PREFIX-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") + add_test ( + NAME H5LS_PREFIX-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>" + -D "TEST_ARGS=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=vds/prefix/${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=vds/prefix/${resultfile}.ls" + -D "TEST_ENV_VAR=HDF5_VDS_PREFIX" + -D "TEST_ENV_VALUE=\${ORIGIN}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES DEPENDS H5LS_PREFIX-${resultfile}-clear-objects) + endif () + endmacro () + ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -155,3 +206,10 @@ ADD_H5_VDS_TEST (tvds-4 0 -w80 -v -S 4_vds.h5) ADD_H5_VDS_TEST (tvds-5 0 -w80 -v -S 5_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-1 0 -w80 -v -S vds/prefix/1_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-2 0 -w80 -v -S vds/prefix/2_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-3_1 0 -w80 -v -S vds/prefix/3_1_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-3_2 0 -w80 -v -S vds/prefix/3_2_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-4 0 -w80 -v -S vds/prefix/4_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-5 0 -w80 -v -S vds/prefix/5_vds.h5) + diff --git a/tools/test/h5ls/vds_prefix/tvds-1.ls b/tools/test/h5ls/vds_prefix/tvds-1.ls new file mode 100644 index 0000000..2830d1a --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-1.ls @@ -0,0 +1,14 @@ +Opened "vds/prefix/1_vds.h5" with sec2 driver. +vds_dset Dataset {5/Inf, 18/18, 8/8} + Location: 1:800 + Links: 1 + Maps: {6} Source { + 1_a.h5 /source_dset + 1_b.h5 /source_dset + 1_c.h5 /source_dset + 1_d.h5 /source_dset + 1_e.h5 /source_dset + 1_f.h5 /source_dset + } + Storage: 2880 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-2.ls b/tools/test/h5ls/vds_prefix/tvds-2.ls new file mode 100644 index 0000000..5c6f9d3 --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-2.ls @@ -0,0 +1,13 @@ +Opened "vds/prefix/2_vds.h5" with sec2 driver. +vds_dset Dataset {6/Inf, 8/8, 14/14} + Location: 1:800 + Links: 1 + Maps: {5} Source { + 2_a.h5 /source_dset + 2_b.h5 /source_dset + 2_c.h5 /source_dset + 2_d.h5 /source_dset + 2_e.h5 /source_dset + } + Storage: 2688 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-3_1.ls b/tools/test/h5ls/vds_prefix/tvds-3_1.ls new file mode 100644 index 0000000..f4c8e78 --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-3_1.ls @@ -0,0 +1,14 @@ +Opened "vds/prefix/3_1_vds.h5" with sec2 driver. +vds_dset Dataset {5/Inf, 25/25, 8/8} + Location: 1:800 + Links: 1 + Maps: {6} Source { + 1_a.h5 /source_dset + 1_b.h5 /source_dset + 1_c.h5 /source_dset + 1_d.h5 /source_dset + 1_e.h5 /source_dset + 1_f.h5 /source_dset + } + Storage: 4000 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-3_2.ls b/tools/test/h5ls/vds_prefix/tvds-3_2.ls new file mode 100644 index 0000000..5a7e2d8 --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-3_2.ls @@ -0,0 +1,13 @@ +Opened "vds/prefix/3_2_vds.h5" with sec2 driver. +vds_dset Dataset {6/Inf, 13/13, 19/19} + Location: 1:800 + Links: 1 + Maps: {5} Source { + 2_a.h5 /source_dset + 2_b.h5 /source_dset + 2_c.h5 /source_dset + 2_d.h5 /source_dset + 2_e.h5 /source_dset + } + Storage: 5928 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-4.ls b/tools/test/h5ls/vds_prefix/tvds-4.ls new file mode 100644 index 0000000..c22d3a4 --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-4.ls @@ -0,0 +1,9 @@ +Opened "vds/prefix/4_vds.h5" with sec2 driver. +vds_dset Dataset {9/Inf, 4/4, 4/4} + Location: 1:800 + Links: 1 + Maps: {1} Source { + 4_%b.h5 /source_dset + } + Storage: 576 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-5.ls b/tools/test/h5ls/vds_prefix/tvds-5.ls new file mode 100644 index 0000000..efba8dc --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-5.ls @@ -0,0 +1,11 @@ +Opened "vds/prefix/5_vds.h5" with sec2 driver. +vds_dset Dataset {9/Inf, 4/4, 4/4} + Location: 1:800 + Links: 1 + Maps: {3} Source { + 5_a.h5 /source_dset + 5_b.h5 /source_dset + 5_c.h5 /source_dset + } + Storage: 576 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt index 9d67ec3..50eb0af 100644 --- a/tools/test/h5repack/CMakeLists.txt +++ b/tools/test/h5repack/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_TEST_H5REPACK) #----------------------------------------------------------------------------- @@ -12,7 +12,6 @@ INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR}) # Add h5Repack test executables # -------------------------------------------------------------------- add_executable (testh5repack_detect_szip ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c) -TARGET_NAMING (testh5repack_detect_szip STATIC) TARGET_C_PROPERTIES (testh5repack_detect_szip STATIC " " " ") target_link_libraries (testh5repack_detect_szip ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (testh5repack_detect_szip PROPERTIES FOLDER tools) @@ -27,7 +26,6 @@ set (REPACK_COMMON_SOURCES ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack.c ) add_executable (h5repacktest ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/h5repacktst.c) -TARGET_NAMING (h5repacktest STATIC) TARGET_C_PROPERTIES (h5repacktest STATIC " " " ") target_link_libraries (h5repacktest ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (h5repacktest PROPERTIES FOLDER tools) diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index 13ebd17..f40c0b1 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -53,6 +53,7 @@ # Copy all the HDF5 files from the source directory into the test directory # -------------------------------------------------------------------- set (LIST_HDF5_TEST_FILES + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/bounds_latest_latest.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_attr.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_attr_refs.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_deflate.h5 @@ -582,6 +583,62 @@ endif () endmacro () +# VERIFY_SUPERBLOCK + macro (ADD_H5_VERIFY_SUPERBLOCK testname testfile lowbound highbound superblock) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/out-${testname}.${testfile} + testfiles/${testfile}-${testname}-v.out + testfiles/${testfile}-${testname}-v.out.err + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () + add_test ( + NAME H5REPACK_VERIFY_SUPERBLOCK-${testname} + COMMAND $<TARGET_FILE:h5repack> -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects) + add_test ( + NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>" + -D "TEST_ARGS:STRING=-H;-B;out-${testname}.${testfile}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testfile}-${testname}-v.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_FILTER:STRING=SUPERBLOCK_VERSION ${superblock}" + -D "TEST_REFERENCE=SUPERBLOCK_VERSION ${superblock}" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" + ) + set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}) + endif () + endmacro () + + macro (ADD_H5_VERIFY_INVALIDBOUNDS testname resultcode lowbound highbound) + add_test ( + NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/out-${testname}.${testfile} + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () + add_test ( + NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} + COMMAND $<TARGET_FILE:h5repack> -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties ( + ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} PROPERTIES + DEPENDS ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects + WILL_FAIL "true" + ) + endmacro () + macro (ADD_H5_TEST_META testname testfile) # Remove any output file left over from previous test run add_test ( @@ -1371,6 +1428,18 @@ ADD_H5_VERIFY_VDS (vds_conti ${TESTTYPE} 0 ${FILEV4} vds_dset CONTIGUOUS -l vds_dset:CONTI) ############################################################################## +### V E R S I O N B O U N D S T E S T S +############################################################################## +# -j 0 -k 2, superblock will be 0 +ADD_H5_VERIFY_SUPERBLOCK (SB_IS_0 h5repack_layout.h5 0 2 0) +# -j 1 -k 2, superblock will be 2 +ADD_H5_VERIFY_SUPERBLOCK (SB_IS_2 h5repack_layout.h5 1 2 2) +# -j 2 -k 2, superblock will be 3 +ADD_H5_VERIFY_SUPERBLOCK (SB_IS_3 h5repack_layout.h5 2 2 3) +# -j 0 -k 1, file cannot be opened +ADD_H5_VERIFY_INVALIDBOUNDS (latest_latest_invalid bounds_latest_latest.h5 0 1) + +############################################################################## ### P L U G I N T E S T S ############################################################################## ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,0,4,9,${H5_VERS_MAJOR},${H5_VERS_MINOR},${H5_VERS_RELEASE}) diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index e474bc3..b0a2f99 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -82,6 +82,7 @@ test -d $TESTDIR || mkdir $TESTDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_HDF5_TEST_FILES=" +$SRC_H5REPACK_TESTFILES/bounds_latest_latest.h5 $SRC_H5REPACK_TESTFILES/h5repack_attr.h5 $SRC_H5REPACK_TESTFILES/h5repack_attr_refs.h5 $SRC_H5REPACK_TESTFILES/h5repack_deflate.h5 @@ -340,8 +341,8 @@ VERIFY_LAYOUT_DSET() fi # clean up tmp files - rm -f $outfile - rm -f $layoutfile +# rm -f $outfile +# rm -f $layoutfile } #------------------------------------------ @@ -513,6 +514,87 @@ VERIFY_LAYOUT_ALL() rm -f $layoutfile } +#-------------------------------------------------------------- +# Verifying superblock of a file with different version bounds +VERIFY_SUPERBLOCK() +{ + lowbound=$1 + highbound=$2 + superblock=$3 + infile=$4 + layoutfile=verbounds-low$lowbound-high$highbound.$4 + outfile=out-verbounds-low$lowbound-high$highbound.$infile + expectedsuperblock="SUPERBLOCK_VERSION $superblock" + + shift + shift + shift + shift + + TESTING $H5REPACK $@ + ( + cd $TESTDIR + $RUNSERIAL $H5REPACK_BIN -j $lowbound -k $highbound $infile $outfile + ) + RET=$? + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + DIFFTEST $infile $outfile + fi + + #--------------------------------- + # check the layout from a dataset + VERIFY "superblock" + ( + cd $TESTDIR + $RUNSERIAL $H5DUMP_BIN -H -B $outfile > $layoutfile + ) + $GREP "$expectedsuperblock" $TESTDIR/$layoutfile > /dev/null + if [ $? -eq 0 ]; then + echo " PASSED" + else + echo " FAILED" + nerrors="`expr $nerrors + 1`" + fi + + # clean up tmp files + rm -f $outfile + rm -f $layoutfile + +} # end of VERIFY_SUPERBLOCK + +#------------------------------------------------------------------ +# Verifying that a latest file cannot be opened with earlier bounds +VERIFY_INVALIDBOUNDS() +{ + lowbound=$1 + highbound=$2 + infile=$3 + outfile=out-verbounds-low$lowbound-high$highbound.$infile + + #-------------------------------------- + # check for failure with invalid bounds + TESTING $H5REPACK $@ + ( + cd $TESTDIR + $RUNSERIAL $H5REPACK_BIN -j $lowbound -k $highbound $infile $outfile + ) + RET=$? + if [ $RET != 0 ] ; then + echo " PASSED" + else + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + fi + + # clean up tmp files + rm -f $outfile + +} # end of VERIFY_INVALIDBOUNDS + # same as TOOLTEST, but it uses the old syntax -i input_file -o output_file # TOOLTEST0() @@ -1365,6 +1447,18 @@ else VERIFY_LAYOUT_VDS vds_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI fi +######################################################### +# Testing version bounds +######################################################### +# -j 0 -k 2, superblock will be 0 +VERIFY_SUPERBLOCK 0 2 0 h5repack_layout.h5 -j 0 -k 2 h5repack_layout.h5 +# -j 1 -k 2, superblock will be 2 +VERIFY_SUPERBLOCK 1 2 2 h5repack_layout.h5 -j 1 -k 2 h5repack_layout.h5 +# -j 2 -k 2, superblock will be 3 +VERIFY_SUPERBLOCK 2 2 3 h5repack_layout.h5 -j 2 -k 2 h5repack_layout.h5 +# -j 0 -k 1, file cannot be opened +VERIFY_INVALIDBOUNDS 0 1 bounds_latest_latest.h5 + # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR diff --git a/tools/test/h5repack/testfiles/bounds_latest_latest.h5 b/tools/test/h5repack/testfiles/bounds_latest_latest.h5 Binary files differnew file mode 100644 index 0000000..6e8bcad --- /dev/null +++ b/tools/test/h5repack/testfiles/bounds_latest_latest.h5 diff --git a/tools/test/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl b/tools/test/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl index 1dcc742..75f54fa 100644 --- a/tools/test/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl +++ b/tools/test/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl @@ -76,8 +76,8 @@ GROUP "/" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) + CHUNKED ( 20, 10 ) + SIZE 1283 (2.494:1 COMPRESSION) } FILTERS { COMPRESSION DEFLATE { LEVEL 1 } diff --git a/tools/test/h5repack/testfiles/h5repack-help.txt b/tools/test/h5repack/testfiles/h5repack-help.txt index 1ff5b73..0eef0f5 100644 --- a/tools/test/h5repack/testfiles/h5repack-help.txt +++ b/tools/test/h5repack/testfiles/h5repack-help.txt @@ -6,7 +6,13 @@ usage: h5repack [OPTIONS] file1 file2 -v, --verbose Verbose mode, print object information -V, --version Print version number and exit -n, --native Use a native HDF5 type when repacking + --enable-error-stack Prints messages from the HDF5 error stack as they occur -L, --latest Use latest version of file format + This option will take precedence over the -j and -k options + --low=BOUND The low bound for library release versions to use when creating + objects in the file (default is H5F_LIBVER_EARLIEST) + --high=BOUND The high bound for library release versions to use when creating + objects in the file (default is H5F_LIBVER_LATEST) -c L1, --compact=L1 Maximum number of links in header messages -d L2, --indexed=L2 Minimum number of links in the indexed format -s S[:F], --ssize=S[:F] Shared object header message minimum size @@ -39,8 +45,12 @@ usage: h5repack [OPTIONS] file1 file2 F - is the shared object header message type, any of <dspace|dtype|fill| pline|attr>. If F is not specified, S applies to all messages - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. + BOUND is an integer indicating the library release versions to use when creating + objects in the file (see H5Pset_libver_bounds()): + 0: This is H5F_LIBVER_EARLIEST in H5F_libver_t struct + 1: This is H5F_LIBVER_V18 in H5F_libver_t struct + 2: This is H5F_LIBVER_V110 in H5F_libver_t struct + (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V110 for this release FS_STRATEGY is a string indicating the file space strategy used: FSM_AGGR: @@ -130,6 +140,11 @@ Examples of use: Using latest file format with maximum compact group size of 10 and and minimum shared datatype size of 20 +5) h5repack --low=0 --high=1 file1 file2 + + Set low=H5F_LIBVER_EARLIEST and high=H5F_LIBVER_V18 via H5Pset_libver_bounds() when + creating the repacked file: file2 + 5) h5repack -f SHUF -f GZIP=1 file1 file2 Add both filters SHUF and GZIP in this order to all datasets diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl index 4856f84..a8b4562 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl @@ -92,7 +92,7 @@ GROUP "/" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) + CHUNKED ( 20, 10 ) SIZE 3200 (1.000:1 COMPRESSION) } FILTERS { diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl index 283b44c..a1fc0cb 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl @@ -11,7 +11,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 0 } + PARAMS { 9 1 11 2 } } } FILLVALUE { @@ -33,7 +33,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 0 } + PARAMS { 9 1 11 2 } } } FILLVALUE { @@ -55,7 +55,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 0 } + PARAMS { 9 1 11 2 } } } FILLVALUE { @@ -77,7 +77,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 0 } + PARAMS { 9 1 11 2 } } } FILLVALUE { @@ -92,14 +92,14 @@ GROUP "/" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) + CHUNKED ( 20, 10 ) SIZE 3200 (1.000:1 COMPRESSION) } FILTERS { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 0 } + PARAMS { 9 1 11 2 } } } FILLVALUE { @@ -121,7 +121,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 0 } + PARAMS { 9 1 11 2 } } } FILLVALUE { @@ -143,7 +143,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 0 } + PARAMS { 9 1 11 2 } } } FILLVALUE { diff --git a/tools/test/h5stat/CMakeLists.txt b/tools/test/h5stat/CMakeLists.txt index 10ac5e0..5f645097 100644 --- a/tools/test/h5stat/CMakeLists.txt +++ b/tools/test/h5stat/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_TEST_H5STAT) #----------------------------------------------------------------------------- @@ -11,7 +11,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (h5stat_gentest ${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/h5stat_gentest.c) - TARGET_NAMING (h5stat_gentest STATIC) TARGET_C_PROPERTIES (h5stat_gentest STATIC " " " ") target_link_libraries (h5stat_gentest ${HDF5_LIB_TARGET}) set_target_properties (h5stat_gentest PROPERTIES FOLDER generator/tools) diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt index 5e3c0a2..084751a 100644 --- a/tools/test/misc/CMakeLists.txt +++ b/tools/test/misc/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_TEST_MISC) #----------------------------------------------------------------------------- @@ -11,31 +11,27 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (h5repart_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5repart_gentest.c) - TARGET_NAMING (h5repart_gentest STATIC) TARGET_C_PROPERTIES (h5repart_gentest STATIC " " " ") target_link_libraries (h5repart_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5repart_gentest COMMAND $<TARGET_FILE:h5repart_gentest>) add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c) - TARGET_NAMING (h5clear_gentest STATIC) TARGET_C_PROPERTIES (h5clear_gentest STATIC " " " ") target_link_libraries (h5clear_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5clear_gentest PROPERTIES FOLDER tools) #add_test (NAME H5CLEAR-h5clear_gentest COMMAND $<TARGET_FILE:h5clear_gentest>) - add_subdirectory (${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/vds) + add_subdirectory (vds) endif () add_executable (h5repart_test ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/repart_test.c) - TARGET_NAMING (h5repart_test STATIC) TARGET_C_PROPERTIES (h5repart_test STATIC " " " ") target_link_libraries (h5repart_test ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5repart_test PROPERTIES FOLDER tools) add_executable (clear_open_chk ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/clear_open_chk.c) - TARGET_NAMING (clear_open_chk STATIC) TARGET_C_PROPERTIES (clear_open_chk STATIC " " " ") target_link_libraries (clear_open_chk ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (clear_open_chk PROPERTIES FOLDER tools) diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index 942ae7a..a51d0e9 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -20,11 +20,19 @@ # Copy all the HDF5 files from the source directory into the test directory # -------------------------------------------------------------------- set (HDF5_TEST_FILES + h5clear_fsm_persist_equal.h5 + h5clear_fsm_persist_greater.h5 + h5clear_fsm_persist_less.h5 + h5clear_fsm_persist_noclose.h5 + h5clear_fsm_persist_user_equal.h5 + h5clear_fsm_persist_user_greater.h5 + h5clear_fsm_persist_user_less.h5 h5clear_log_v3.h5 h5clear_mdc_image.h5 - mod_h5clear_mdc_image.h5 + h5clear_status_noclose.h5 latest_h5clear_log_v3.h5 latest_h5clear_sec2_v3.h5 + mod_h5clear_mdc_image.h5 ) set (HDF5_SEC2_TEST_FILES h5clear_sec2_v0.h5 @@ -32,10 +40,25 @@ h5clear_sec2_v3.h5 ) set (HDF5_REFERENCE_TEST_FILES - h5clear_usage.ddl - h5clear_open_fail.ddl + h5clear_equal_after_size.ddl + h5clear_equal_before_size.ddl + h5clear_greater_after_size.ddl + h5clear_greater_before_size.ddl + h5clear_less_after_size.ddl + h5clear_less_before_size.ddl h5clear_missing_file.ddl + h5clear_noclose_after_size.ddl + h5clear_noclose_before_size.ddl h5clear_no_mdc_image.ddl + h5clear_open_fail.ddl + h5clear_status_noclose_after_size.ddl + h5clear_usage.ddl + h5clear_user_equal_after_size.ddl + h5clear_user_equal_before_size.ddl + h5clear_user_greater_after_size.ddl + h5clear_user_greater_before_size.ddl + h5clear_user_less_after_size.ddl + h5clear_user_less_before_size.ddl ) foreach (h5_file ${HDF5_TEST_FILES} ${HDF5_SEC2_TEST_FILES} ${HDF5_REFERENCE_TEST_FILES}) @@ -85,6 +108,42 @@ endif () endmacro () + macro (ADD_H5_CMP_WITH_COPY testname resultcode resultfile testfile) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5CLEAR_CMP-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/${testname}.out + testfiles/${testname}.out.err + testfiles/${testfile} + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () + add_test ( + NAME H5CLEAR_CMP-copy_${testname} + COMMAND ${CMAKE_COMMAND} + -E copy_if_different + "${PROJECT_SOURCE_DIR}/testfiles/${testfile}" "${PROJECT_BINARY_DIR}/testfiles/${testfile}" + ) + set_tests_properties (H5CLEAR_CMP-copy_${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects) + add_test ( + NAME H5CLEAR_CMP-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5clear>" + -D "TEST_ARGS:STRING=${ARGN};${testfile}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.ddl" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-copy_${testname}) + set (last_test "H5CLEAR_CMP-${testname}") + endif () + endmacro () + macro (ADD_H5_RETTEST testname resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -100,6 +159,70 @@ endif () endmacro () + macro (ADD_H5_FILESIZE_TEST testname resultcode resultfile incr_size) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5CLEAR_FILESIZE_TEST-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/${testname}_before_size.out + testfiles/${testname}_before_size.out.err + testfiles/${testname}_after_size.out + testfiles/${testname}_after_size.out.err + testfiles/${testname}.h5 + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5CLEAR_FILESIZE_TEST-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () + add_test ( + NAME H5CLEAR_FILESIZE_TEST-copy_${testname} + COMMAND ${CMAKE_COMMAND} + -E copy_if_different + "${PROJECT_SOURCE_DIR}/testfiles/${testname}.h5" "${PROJECT_BINARY_DIR}/testfiles/${testname}.h5" + ) + set_tests_properties (H5CLEAR_FILESIZE_TEST-copy_${testname} PROPERTIES DEPENDS H5CLEAR_FILESIZE_TEST-${testname}-clear-objects) + add_test ( + NAME H5CLEAR_FILESIZE_CMP-${testname}_before_size + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5clear>" + -D "TEST_ARGS:STRING=--filesize;${testname}.h5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}_before_size.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}_before_size.ddl" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5CLEAR_FILESIZE_CMP-${testname}_before_size PROPERTIES DEPENDS H5CLEAR_FILESIZE_TEST-copy_${testname}) + if (NOT ${incr_size} MATCHES "NONE") + add_test ( + NAME H5CLEAR_FILESIZE_INCR-${testname} + COMMAND $<TARGET_FILE:h5clear> --increment=${incr_size} ${testname}.h5 + ) + else () + add_test ( + NAME H5CLEAR_FILESIZE_INCR-${testname} + COMMAND $<TARGET_FILE:h5clear> --increment ${testname}.h5 + ) + endif () + set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES WILL_FAIL "${resultcode}") + set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES DEPENDS H5CLEAR_FILESIZE_CMP-${testname}_before_size) + add_test ( + NAME H5CLEAR_FILESIZE_CMP-${testname}_after_size + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5clear>" + -D "TEST_ARGS:STRING=--filesize;${testname}.h5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}_after_size.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}_after_size.ddl" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5CLEAR_FILESIZE_CMP-${testname}_after_size PROPERTIES DEPENDS H5CLEAR_FILESIZE_INCR-${testname}) + set (last_test "H5CLEAR_FILESIZE_CMP-${testname}_after_size") + endif () + endmacro () + macro (ADD_H5_TEST testname testfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -160,6 +283,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) latest_h5clear_sec2_v3.h5 mod_h5clear_mdc_image.h5 mod_h5clear_mdc_image2.h5 + ${HDF5_TEST_FILES} ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5CLEAR-clearall-objects PROPERTIES DEPENDS ${last_test}) @@ -270,3 +394,60 @@ endif() ADD_H5_TEST (latest_h5clr_log_v3 latest_h5clear_log_v3 "true") ADD_H5_TEST (h5clr_sec2_v0 h5clear_sec2_v0 "false") ADD_H5_TEST (h5clr_sec2_v2 h5clear_sec2_v2 "false") +# +# +# +# The following tests verify the filesize, increment the filesize, then verify the filesize again. +# +# (1) h5clear_status_noclose.h5 +# "h5clear --filesize h5clear_status_noclose.h5" (unable to open the file because status_flags is enabled) +# "h5clear -s --increment=0 h5clear_status_noclose.h5" (clear status_flag, EOA = MAX(EOA, EOF) + 0) +# (no output, check exit code) +# "h5clear --filesize h5clear_status_noclose.h5" (print EOA/EOF after the last action) + ADD_H5_CMP_WITH_COPY (h5clr_open_fail_nc_s 1 h5clear_open_fail h5clear_status_noclose.h5 "--filesize") + ADD_H5_RETTEST (h5clr_mdc_image_nc "false" "-s" "--increment=0" h5clear_status_noclose.h5) + ADD_H5_CMP (h5clr_no_mdc_image_nc_m h5clear_status_noclose_after_size 0 "--filesize" h5clear_status_noclose.h5) +# +# (2) h5clear_fsm_persist_noclose.h5 +# "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF before the next action) +# "h5clear --increment=0 h5clear_fsm_persist_noclose.h5" (EOA = MAX(EOA, EOF)) (no output, just check exit code) +# "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF after the last action) + ADD_H5_FILESIZE_TEST (h5clear_fsm_persist_noclose 0 h5clear_noclose 0) +# +# (3) h5clear_fsm_persist_equal.h5 +# "h5clear --filesize h5clear_fsm_persist_equal.h5" (print EOA/EOF before the next action) +# "h5clear --increment h5clear_fsm_persist_equal.h5" (EOA = MAX(EOA, EOF) + 1M) (no output, check exit code) +# "h5clear --filesize h5clear_fsm_persist_equal.h5" (print EOA/EOF after the last action) + ADD_H5_FILESIZE_TEST (h5clear_fsm_persist_equal 0 h5clear_equal NONE) +# +# (4) h5clear_fsm_persist_greater.h5 +# "h5clear --filesize h5clear_fsm_persist_greater.h5" (print EOA/EOF before the next action) +# "h5clear --increment=0 h5clear_fsm_persist_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code) +# "h5clear --filesize h5clear_fsm_persist_greater.h5" (print EOA/EOF after the last action) + ADD_H5_FILESIZE_TEST (h5clear_fsm_persist_greater 0 h5clear_greater 0) +# +# (5) h5clear_fsm_persist_less.h5 +# "h5clear --filesize h5clear_fsm_persist_less.h5" (print EOA/EOF before the next action) +# "h5clear --increment=200 h5clear_fsm_persist_less.h5" (EOA = MAX(EOA, EOF) + 200) (no output, check exit code) +# "h5clear --filesize h5clear_fsm_persist_less.h5" (print EOA/EOF after the last action) + ADD_H5_FILESIZE_TEST (h5clear_fsm_persist_less 0 h5clear_less 200) +# +# (6) h5clear_fsm_persist_user_equal.h5 +# "h5clear --filesize h5clear_fsm_persist_user_equal.h5" (print EOA/EOF before the next action) +# "h5clear --increment h5clear_fsm_persist_user_equal.h5" (EOA = MAX(EOA, EOF) + 1M) (no output, check exit code) +# "h5clear --filesize h5clear_fsm_persist_user_equal.h5" (print EOA/EOF after the last action) + ADD_H5_FILESIZE_TEST (h5clear_fsm_persist_user_equal 0 h5clear_user_equal NONE) +# +# (7) h5clear_fsm_persist_user_greater.h5 +# "h5clear --filesize h5clear_fsm_persist_user_greater.h5" (print EOA/EOF before the next action) +# "h5clear --increment=0 h5clear_fsm_persist_user_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code) +# "h5clear --filesize h5clear_fsm_persist_user_greater.h5" (print EOA/EOF after the last action) + ADD_H5_FILESIZE_TEST (h5clear_fsm_persist_user_greater 0 h5clear_user_greater 0) +# +# (8) h5clear_fsm_persist_user_less.h5 +# "h5clear --filesize h5clear_fsm_persist_user_less.h5" (print EOA/EOF before the next action) +# "h5clear --increment=200 h5clear_fsm_persist_user_less.h5" (EOA = MAX(EOA, EOF) + 200) (no output, check exit code) +# "h5clear --filesize h5clear_fsm_persist_user_less.h5" (print EOA/EOF after the last action) + ADD_H5_FILESIZE_TEST (h5clear_fsm_persist_user_less 0 h5clear_user_less 200) +# +# diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c index 326109c..88c8ea5 100644 --- a/tools/test/misc/h5clear_gentest.c +++ b/tools/test/misc/h5clear_gentest.c @@ -21,10 +21,25 @@ const char *FILENAME[] = { "h5clear_sec2_v2.h5" /* 3 -- sec2 file with superblock version 2 */ }; +const char *FILENAME_ENHANCE[] = { + "h5clear_fsm_persist_equal.h5", /* 0: persisting free-space, stored EOA = actual EOF */ + "h5clear_fsm_persist_greater.h5", /* 1: persisting free-space, stored EOA > actual EOF */ + "h5clear_fsm_persist_less.h5", /* 2: persisting free-space, stored EOA < actual EOF */ + "h5clear_fsm_persist_user_equal.h5", /* 3: user block, persisting free-space, stored EOA = actual EOF */ + "h5clear_fsm_persist_user_greater.h5", /* 4: user block, persisting free-space, stored EOA > actual EOF */ + "h5clear_fsm_persist_user_less.h5", /* 5: user block, persisting free-space, stored EOA < actual EOF */ + "h5clear_status_noclose.h5", /* 6 -- v3 superblock, nonzero status_flags, no flush, exit, + stored EOA < actual EOF */ + "h5clear_fsm_persist_noclose.h5" /* 7 -- persisting free-space, no flush, exit, stored EOA < actual EOF */ +}; + #define KB 1024U #define CACHE_IMAGE_FILE "h5clear_mdc_image.h5" #define DSET "DSET" +#define DATASET "dset" +#define NUM_ELMTS 100 +#define USERBLOCK 512 /*------------------------------------------------------------------------- * Function: gen_cache_image_file @@ -118,26 +133,223 @@ error: H5Pclose(dcpl); } H5E_END_TRY; return 1; -} +} /* gen_cache_image_file() */ + +/*------------------------------------------------------------------------- + * Function: gen_enhance_files + * + * Purpose: To create the first 6 files in FILENAME_ENHANCE[]: + * (0) FILENAME_ENHANCE[0]: "h5clear_fsm_persist_equal.h5" + * (1) FILENAME_ENHANCE[1]: "h5clear_fsm_persist_greater.h5" + * (2) FILENAME_ENHANCE[2]: "h5clear_fsm_persist_less.h5" + * (3) FILENAME_ENHANCE[3]: "h5clear_user_fsm_persist_equal.h5" + * (4) FILENAME_ENHANCE[4]: "h5clear_user_fsm_persist_greater.h5" + * (5) FILENAME_ENHANCE[5]: "h5clear_user_fsm_persist_less.h5" + * After creating the files for #1, #2, #4 #5, write invalid EOA + * value to the location where the EOA is stored in the superblock. + * Also modify the chksum in the superblock due to this change. + * + * The first call to this routine (without user block) will generate + * the first 3 files. + * The second call to this routine (with user block) will generate + * the last 3 files. + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Vailin Choi; March 2017 + * + *------------------------------------------------------------------------- + */ +static int +gen_enhance_files(hbool_t user) +{ + hid_t fid = -1; /* File ID */ + hid_t fcpl = -1; /* File creation property list */ + hid_t sid = -1; /* Dataspace ID */ + hid_t did = -1; /* Dataset ID */ + hsize_t dim[1]; /* Dimension sizes */ + int data[NUM_ELMTS]; /* Buffer for data */ + int fd = -1; /* The file descriptor ID */ + int64_t eoa; /* The EOA value */ + int32_t chksum; /* The chksum value */ + int i = 0 , j = 0, u = 0; /* Local index variable */ + + /* Get a copy of the default file creation property */ + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + goto error; + + /* Check to see if user block will be added */ + if(user) { + if(H5Pset_userblock(fcpl, (hsize_t)USERBLOCK) < 0) + goto error; + u = 3; + } + + /* Set file space strategy and persisting free-space */ + if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0) + goto error; + + /* + * Create the file, then write invalid EOA to the file. + */ + for(i = 0+u; i < 3+u; i++) { + + /* Create the file with the file space strategy and persisting free-space */ + if((fid = H5Fcreate(FILENAME_ENHANCE[i], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) + goto error; + + /* Create the dataset */ + dim[0] = NUM_ELMTS; + if((sid = H5Screate_simple(1, dim, NULL)) < 0) + goto error; + if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + for(j = 0; j < NUM_ELMTS; j++) + data[j] = j; + + /* Write the dataset */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + goto error; + + /* Closing */ + if(H5Dclose(did) < 0) + goto error; + if(H5Sclose(sid) < 0) + goto error; + if(H5Fclose(fid) < 0) + goto error; + + /* + * No further action for: + * --FILENAME_ENHANCE[0]: "h5clear_fsm_persist_equal.h5" + * --FILENAME_ENHANCE[3]: "h5clear_fsm_persist_user_equal.h5", + */ + if(!(i % 3)) + continue; + /* + * For the following files: + * --FILENAME_ENHANCE[1]: "h5clear_fsm_persist_greater.h5" + * --FILENAME_ENHANCE[2]: "h5clear_fsm_persist_less.h5" + * --FILENAME_ENHANCE[4]: "h5clear_fsm_persist_greater.h5" + * --FILENAME_ENHANCE[5]: "h5clear_fsm_persist_less.h5" + * + * Write invalid value to the location for stored eoa and + * update the chksum value. + */ + /* Open the file */ + if((fd = open(FILENAME_ENHANCE[i], O_RDWR, 0663)) < 0) + goto error; + + switch(i) { + case 1: /* stored EOA is > EOF */ + eoa = 3048; + chksum = 268376587; + break; + + case 2: /* stored EOA is < EOF */ + eoa = 512; + chksum = 372920305; + break; + + case 4: /* with userblock, stored EOA > EOF */ + eoa = 4000; + chksum = 4168810027; + break; + + case 5: /* with userblock, stored EOA < EOF */ + eoa = 3000; + chksum = 3716054346; + break; + + default: + break; + } + + /* location of "end of file address" */ + if(lseek(fd, (off_t)(28+(user?USERBLOCK:0)), SEEK_SET) < 0) + goto error; + + /* Write the bad eoa value to the file */ + if(write(fd, &eoa, sizeof(eoa)) < 0) + goto error; + + /* location of "superblock checksum" */ + if(lseek(fd, (off_t)(44+(user?USERBLOCK:0)), SEEK_SET) < 0) + goto error; + + /* Write the chksum value to the file */ + if(write(fd, &chksum, sizeof(chksum)) < 0) + goto error; + + /* Close the file */ + if(close(fd) < 0) + goto error; + + } /* end for */ + + /* Close the property list */ + if(H5Pclose(fcpl) < 0) + goto error; + + return 0; + +error: + H5E_BEGIN_TRY { + H5Sclose(sid); + H5Dclose(did); + H5Fclose(fid); + H5Pclose(fcpl); + } H5E_END_TRY; + return 1; +} /* gen_enhance_files() */ /*------------------------------------------------------------------------- * Function: main * - * Purpose: To create HDF5 files with non-zero status_flags in the superblock - * via flushing and exiting without closing the library. + * Purpose: Generate test files used by h5clear. * - * Due to file locking, status_flags in the superblock will be - * nonzero after H5Fcreate. The library will clear status_flags - * on file closing. This program, after "H5Fcreate" the files, - * exits without going through library closing. Thus, status_flags - * for these files are not cleared. - * The library will check consistency of status_flags when opening - * a file with superblock >= v3 and will return error accordingly. - * The library will not check status_flags when opening a file - * with < v3 superblock. + * (A) gen_cache_image_file(): + * --generate a file with cache image feature + * --"h5clear_mdc_image.h5" + * (B) gen_enhance_files(): + * --generate the first 6 files in FILENAME_ENHANCE[]: + * (0) "h5clear_fsm_persist_equal.h5" + * (1) "h5clear_fsm_persist_greater.h5" + * (2) "h5clear_fsm_persist_less.h5" + * (3) "h5clear_fsm_persist_user_equal.h5" + * (4) "h5clear_fsm_persist_user_greater.h5" + * (5) "h5clear_fsm_persist_user_less.h5" * - * These files are used by "h5clear" to see if the tool clears - * status_flags properly so users can open the files afterwards. + * (C) Generate the following FILENAME[] files in main(): + * (0a) "h5clear_sec2_v3.h5" + * (0b) "latest_h5clear_sec2_v3.h5" + * (1a) "h5clear_log_v3.h5", + * (1b) "latest_h5clear_log_v3.h5" + * (2) "h5clear_sec2_v0.h5" + * (3) "h5clear_sec2_v2.h5" + * + * These HDF5 files are created with non-zero status_flags in + * the superblock via flushing and exiting without closing the + * library. + * Due to file locking, status_flags in the superblock will be + * nonzero after H5Fcreate. The library will clear status_flags + * on file closing. + * This program, after "H5Fcreate" the files, exits without + * going through library closing. Thus, status_flags for these + * files are not cleared. + * The library will check consistency of status_flags when + * opening a file with superblock >= v3 and will return error + * accordingly. + * The library will not check status_flags when opening a file + * with < v3 superblock. + * These files are used by "h5clear" to see if the tool clears + * status_flags properly so users can open the files afterwards. + * + * (D) Generate the last two files in FILENAME_ENHANCE[] in main(): + * (6) "h5clear_status_noclose.h5", + * (7) "h5clear_fsm_persist_noclose.h5" * * Return: Success: 0 * Failure: 1 @@ -149,20 +361,30 @@ error: int main(void) { - hid_t fid; /* File ID */ - hid_t fcpl; /* File creation property list */ - hid_t fapl, new_fapl; /* File access property lists */ + hid_t fid = -1; /* File ID */ + hid_t fcpl = -1; /* File creation property list */ + hid_t fapl = -1, new_fapl = -1; /* File access property lists */ char fname[512]; /* File name */ - unsigned new_format; /* To use latest library format or not */ + unsigned new_format; /* To use latest library format or not */ + hid_t sid = -1; /* Dataspace ID */ + hid_t did = -1; /* Dataset ID */ + hsize_t dim[1]; /* Dimension sizes */ + int data[NUM_ELMTS]; /* Buffer for data */ + int i; /* Local index variables */ /* Generate a file with cache image feature enabled */ if(gen_cache_image_file(CACHE_IMAGE_FILE) < 0) goto error; + /* Generate the first 6 files in FILENAME_ENHANCE[] */ + if(gen_enhance_files(FALSE) < 0) + goto error; + if(gen_enhance_files(TRUE) < 0) + goto error; + /* - * Generate files with invalid status_flags + * Generate files in FILENAME[] */ - /* Create a copy of the file access property list */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error; @@ -174,7 +396,11 @@ main(void) if(H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) goto error; - /* Files created within this for loop will have v3 superblock and nonzero status_flags */ + /* + * Files created within this for loop will have v3 superblock and nonzero status_flags + * --FILENAME[0]: "h5clear_sec2_v3.h5", "latest_h5clear_sec2_v3.h5" + * --FILENAME[1]: "h5clear_log_v3.h5", "latest_h5clear_log_v3.h5" + */ for(new_format = FALSE; new_format <= TRUE; new_format++) { hid_t fapl2, my_fapl; /* File access property lists */ @@ -228,7 +454,8 @@ main(void) } /* end for */ /* - * Create a sec2 file with v0 superblock but nonzero status_flags + * Create a sec2 file with v0 superblock but nonzero status_flags: + * FILENAME[2]: "h5clear_sec2_v0.h5" */ if((fid = H5Fcreate(FILENAME[2], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; @@ -239,7 +466,8 @@ main(void) /* - * Create a sec2 file with v2 superblock but nonzero status_flags + * Create a sec2 file with v2 superblock but nonzero status_flags: + * FILENAME[3]: "h5clear_sec2_v2.h5" */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) goto error; @@ -264,6 +492,100 @@ main(void) if(H5Pclose(fcpl) < 0) goto error; + /* + * Create the last two files in FILENAME_ENHANCE[]: + * --FILENAME_ENHANCE[6]: h5clear_status_noclose.h5 + * --FILENAME_ENHANCE[7]: h5clear_fsm_persist_noclose.h5 + */ + /* + * FILENAME_ENHANCE[6]: h5clear_status_noclose.h5 + * --stored EOA < actual EOF + * --version 3 superblock + * --nonzero status_flags + * --does not persist free-space + * --does not flush the file, just exit without closing file: + * --this file is similar to the user-suppplied test file attached with HDFFV-10347 + */ + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; + + /* Set to latest format */ + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + goto error; + + /* Create file with SWMR-write access */ + if((fid = H5Fcreate(FILENAME_ENHANCE[6], H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) + goto error; + + /* Create the dataset */ + dim[0] = NUM_ELMTS; + if((sid = H5Screate_simple(1, dim, NULL)) < 0) + goto error; + if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + for(i = 0; i < NUM_ELMTS; i++) + data[i] = i; + + /* Write the dataset */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + goto error; + + /* Closing */ + if(H5Dclose(did) < 0) + goto error; + if(H5Sclose(sid) < 0) + goto error; + if(H5Pclose(fapl) < 0) + goto error; + + /* Does not flush and does not close the file */ + + + /* + * FILENAME_ENHANCE[7]: h5clear_fsm_persist_noclose.h5 + * --stored EOA < actual EOF + * --persisting free-space + * --undefined fsinfo.eoa_pre_fsm_fsalloc + * --undefined fsinfo.fs_addr + * --does not flush the file, just exit without closing + */ + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + goto error; + + /* Set file space strategy and persisting free-space */ + if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0) + goto error; + + /* Create the file with the set file space info */ + if((fid = H5Fcreate(FILENAME_ENHANCE[7], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) + goto error; + + /* Create the dataset */ + dim[0] = NUM_ELMTS; + if((sid = H5Screate_simple(1, dim, NULL)) < 0) + goto error; + if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + for(i = 0; i < NUM_ELMTS; i++) + data[i] = i; + + /* Write the dataset */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + goto error; + + /* Closing */ + if(H5Dclose(did) < 0) + goto error; + if(H5Sclose(sid) < 0) + goto error; + if(H5Pclose(fcpl) < 0) + goto error; + + /* Does not flush and does not close the file */ + + fflush(stdout); fflush(stderr); diff --git a/tools/test/misc/testfiles/h5clear_equal_after_size.ddl b/tools/test/misc/testfiles/h5clear_equal_after_size.ddl new file mode 100644 index 0000000..1b9a4e4 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_equal_after_size.ddl @@ -0,0 +1 @@ +EOA is 1051141; EOF is 1051141 diff --git a/tools/test/misc/testfiles/h5clear_equal_before_size.ddl b/tools/test/misc/testfiles/h5clear_equal_before_size.ddl new file mode 100644 index 0000000..9beed42 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_equal_before_size.ddl @@ -0,0 +1 @@ +EOA is 2565; EOF is 2565 diff --git a/tools/test/misc/testfiles/h5clear_fsm_persist_equal.h5 b/tools/test/misc/testfiles/h5clear_fsm_persist_equal.h5 Binary files differnew file mode 100644 index 0000000..0577690 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_fsm_persist_equal.h5 diff --git a/tools/test/misc/testfiles/h5clear_fsm_persist_greater.h5 b/tools/test/misc/testfiles/h5clear_fsm_persist_greater.h5 Binary files differnew file mode 100644 index 0000000..6358878 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_fsm_persist_greater.h5 diff --git a/tools/test/misc/testfiles/h5clear_fsm_persist_less.h5 b/tools/test/misc/testfiles/h5clear_fsm_persist_less.h5 Binary files differnew file mode 100644 index 0000000..c1f3221 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_fsm_persist_less.h5 diff --git a/tools/test/misc/testfiles/h5clear_fsm_persist_noclose.h5 b/tools/test/misc/testfiles/h5clear_fsm_persist_noclose.h5 Binary files differnew file mode 100644 index 0000000..57462db --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_fsm_persist_noclose.h5 diff --git a/tools/test/misc/testfiles/h5clear_fsm_persist_user_equal.h5 b/tools/test/misc/testfiles/h5clear_fsm_persist_user_equal.h5 Binary files differnew file mode 100644 index 0000000..5389c41 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_fsm_persist_user_equal.h5 diff --git a/tools/test/misc/testfiles/h5clear_fsm_persist_user_greater.h5 b/tools/test/misc/testfiles/h5clear_fsm_persist_user_greater.h5 Binary files differnew file mode 100644 index 0000000..f40e760 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_fsm_persist_user_greater.h5 diff --git a/tools/test/misc/testfiles/h5clear_fsm_persist_user_less.h5 b/tools/test/misc/testfiles/h5clear_fsm_persist_user_less.h5 Binary files differnew file mode 100644 index 0000000..55d0cc5 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_fsm_persist_user_less.h5 diff --git a/tools/test/misc/testfiles/h5clear_greater_after_size.ddl b/tools/test/misc/testfiles/h5clear_greater_after_size.ddl new file mode 100644 index 0000000..74c8f19 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_greater_after_size.ddl @@ -0,0 +1 @@ +EOA is 3048; EOF is 3048 diff --git a/tools/test/misc/testfiles/h5clear_greater_before_size.ddl b/tools/test/misc/testfiles/h5clear_greater_before_size.ddl new file mode 100644 index 0000000..03b22fb --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_greater_before_size.ddl @@ -0,0 +1 @@ +EOA is 3048; EOF is 2565 diff --git a/tools/test/misc/testfiles/h5clear_less_after_size.ddl b/tools/test/misc/testfiles/h5clear_less_after_size.ddl new file mode 100644 index 0000000..bedf0d2 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_less_after_size.ddl @@ -0,0 +1 @@ +EOA is 2765; EOF is 2765 diff --git a/tools/test/misc/testfiles/h5clear_less_before_size.ddl b/tools/test/misc/testfiles/h5clear_less_before_size.ddl new file mode 100644 index 0000000..50ba4c4 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_less_before_size.ddl @@ -0,0 +1 @@ +EOA is 512; EOF is 2565 diff --git a/tools/test/misc/testfiles/h5clear_missing_file.ddl b/tools/test/misc/testfiles/h5clear_missing_file.ddl index 1e5150c..13eb2c9 100644 --- a/tools/test/misc/testfiles/h5clear_missing_file.ddl +++ b/tools/test/misc/testfiles/h5clear_missing_file.ddl @@ -4,7 +4,9 @@ usage: h5clear [OPTIONS] file_name -V, --version Print version number and exit -s, --status Clear the status_flags field in the file's superblock -m, --image Remove the metadata cache image from the file - + --filesize Print the file's EOA and EOF + --increment=C Set the file's EOA to the maximum of (EOA, EOF) + C for the file <file_name> + C is >= 0; C is optional and will default to 1M when not set Examples of use: h5clear -s file_name @@ -12,4 +14,10 @@ h5clear -s file_name h5clear -m file_name Remove the metadata cache image from the HDF5 file <file_name>. + +h5clear --increment file_name + Set the EOA to the maximum of (EOA, EOF) + 1M for the file <file_name>. + +h5clear --increment=512 file_name + Set the EOA to the maximum of (EOA, EOF) + 512 for the file <file_name>. h5clear error: missing file name diff --git a/tools/test/misc/testfiles/h5clear_noclose_after_size.ddl b/tools/test/misc/testfiles/h5clear_noclose_after_size.ddl new file mode 100644 index 0000000..7846b47 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_noclose_after_size.ddl @@ -0,0 +1 @@ +EOA is 2448; EOF is 2448 diff --git a/tools/test/misc/testfiles/h5clear_noclose_before_size.ddl b/tools/test/misc/testfiles/h5clear_noclose_before_size.ddl new file mode 100644 index 0000000..f294a6d --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_noclose_before_size.ddl @@ -0,0 +1 @@ +EOA is 2048; EOF is 2448 diff --git a/tools/test/misc/testfiles/h5clear_status_noclose.h5 b/tools/test/misc/testfiles/h5clear_status_noclose.h5 Binary files differnew file mode 100644 index 0000000..94a950d --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_status_noclose.h5 diff --git a/tools/test/misc/testfiles/h5clear_status_noclose_after_size.ddl b/tools/test/misc/testfiles/h5clear_status_noclose_after_size.ddl new file mode 100644 index 0000000..7846b47 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_status_noclose_after_size.ddl @@ -0,0 +1 @@ +EOA is 2448; EOF is 2448 diff --git a/tools/test/misc/testfiles/h5clear_usage.ddl b/tools/test/misc/testfiles/h5clear_usage.ddl index a399ae7..32dd549 100644 --- a/tools/test/misc/testfiles/h5clear_usage.ddl +++ b/tools/test/misc/testfiles/h5clear_usage.ddl @@ -4,7 +4,9 @@ usage: h5clear [OPTIONS] file_name -V, --version Print version number and exit -s, --status Clear the status_flags field in the file's superblock -m, --image Remove the metadata cache image from the file - + --filesize Print the file's EOA and EOF + --increment=C Set the file's EOA to the maximum of (EOA, EOF) + C for the file <file_name> + C is >= 0; C is optional and will default to 1M when not set Examples of use: h5clear -s file_name @@ -12,3 +14,9 @@ h5clear -s file_name h5clear -m file_name Remove the metadata cache image from the HDF5 file <file_name>. + +h5clear --increment file_name + Set the EOA to the maximum of (EOA, EOF) + 1M for the file <file_name>. + +h5clear --increment=512 file_name + Set the EOA to the maximum of (EOA, EOF) + 512 for the file <file_name>. diff --git a/tools/test/misc/testfiles/h5clear_user_equal_after_size.ddl b/tools/test/misc/testfiles/h5clear_user_equal_after_size.ddl new file mode 100644 index 0000000..028e134 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_user_equal_after_size.ddl @@ -0,0 +1 @@ +EOA is 1051653; EOF is 1051653 diff --git a/tools/test/misc/testfiles/h5clear_user_equal_before_size.ddl b/tools/test/misc/testfiles/h5clear_user_equal_before_size.ddl new file mode 100644 index 0000000..ef7c391 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_user_equal_before_size.ddl @@ -0,0 +1 @@ +EOA is 3077; EOF is 3077 diff --git a/tools/test/misc/testfiles/h5clear_user_greater_after_size.ddl b/tools/test/misc/testfiles/h5clear_user_greater_after_size.ddl new file mode 100644 index 0000000..9d7de6f --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_user_greater_after_size.ddl @@ -0,0 +1 @@ +EOA is 4000; EOF is 4000 diff --git a/tools/test/misc/testfiles/h5clear_user_greater_before_size.ddl b/tools/test/misc/testfiles/h5clear_user_greater_before_size.ddl new file mode 100644 index 0000000..c3fe625 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_user_greater_before_size.ddl @@ -0,0 +1 @@ +EOA is 4000; EOF is 3077 diff --git a/tools/test/misc/testfiles/h5clear_user_less_after_size.ddl b/tools/test/misc/testfiles/h5clear_user_less_after_size.ddl new file mode 100644 index 0000000..02c0d2a --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_user_less_after_size.ddl @@ -0,0 +1 @@ +EOA is 3277; EOF is 3277 diff --git a/tools/test/misc/testfiles/h5clear_user_less_before_size.ddl b/tools/test/misc/testfiles/h5clear_user_less_before_size.ddl new file mode 100644 index 0000000..0651c2b --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_user_less_before_size.ddl @@ -0,0 +1 @@ +EOA is 3000; EOF is 3077 diff --git a/tools/test/misc/testh5clear.sh.in b/tools/test/misc/testh5clear.sh.in index 2966b2c..11c2ff9 100644 --- a/tools/test/misc/testh5clear.sh.in +++ b/tools/test/misc/testh5clear.sh.in @@ -66,6 +66,21 @@ $SRC_H5CLEAR_TESTFILES/h5clear_usage.ddl $SRC_H5CLEAR_TESTFILES/h5clear_open_fail.ddl $SRC_H5CLEAR_TESTFILES/h5clear_missing_file.ddl $SRC_H5CLEAR_TESTFILES/h5clear_no_mdc_image.ddl +$SRC_H5CLEAR_TESTFILES/h5clear_status_noclose_after_size.ddl +$SRC_H5CLEAR_TESTFILES/h5clear_noclose_before_size.ddl +$SRC_H5CLEAR_TESTFILES/h5clear_noclose_after_size.ddl +$SRC_H5CLEAR_TESTFILES/h5clear_equal_before_size.ddl +$SRC_H5CLEAR_TESTFILES/h5clear_equal_after_size.ddl +$SRC_H5CLEAR_TESTFILES/h5clear_greater_before_size.ddl +$SRC_H5CLEAR_TESTFILES/h5clear_greater_after_size.ddl +$SRC_H5CLEAR_TESTFILES/h5clear_less_before_size.ddl +$SRC_H5CLEAR_TESTFILES/h5clear_less_after_size.ddl +$SRC_H5CLEAR_TESTFILES/h5clear_user_equal_before_size.ddl +$SRC_H5CLEAR_TESTFILES/h5clear_user_equal_after_size.ddl +$SRC_H5CLEAR_TESTFILES/h5clear_user_greater_before_size.ddl +$SRC_H5CLEAR_TESTFILES/h5clear_user_greater_after_size.ddl +$SRC_H5CLEAR_TESTFILES/h5clear_user_less_before_size.ddl +$SRC_H5CLEAR_TESTFILES/h5clear_user_less_after_size.ddl $SRC_H5CLEAR_TESTFILES/h5clear_sec2_v0.h5 $SRC_H5CLEAR_TESTFILES/h5clear_sec2_v2.h5 $SRC_H5CLEAR_TESTFILES/h5clear_sec2_v3.h5 @@ -74,6 +89,14 @@ $SRC_H5CLEAR_TESTFILES/latest_h5clear_log_v3.h5 $SRC_H5CLEAR_TESTFILES/latest_h5clear_sec2_v3.h5 $SRC_H5CLEAR_TESTFILES/h5clear_mdc_image.h5 $SRC_H5CLEAR_TESTFILES/mod_h5clear_mdc_image.h5 +$SRC_H5CLEAR_TESTFILES/h5clear_status_noclose.h5 +$SRC_H5CLEAR_TESTFILES/h5clear_fsm_persist_noclose.h5 +$SRC_H5CLEAR_TESTFILES/h5clear_fsm_persist_equal.h5 +$SRC_H5CLEAR_TESTFILES/h5clear_fsm_persist_greater.h5 +$SRC_H5CLEAR_TESTFILES/h5clear_fsm_persist_less.h5 +$SRC_H5CLEAR_TESTFILES/h5clear_fsm_persist_user_equal.h5 +$SRC_H5CLEAR_TESTFILES/h5clear_fsm_persist_user_greater.h5 +$SRC_H5CLEAR_TESTFILES/h5clear_fsm_persist_user_less.h5 " COPY_TESTFILES_TO_TESTDIR() @@ -152,7 +175,8 @@ TOOLTEST_OUT() { fname=$1 option1=$2 option2=$3 - expected=$4 + option3=$4 + expected=$5 # Prepare expected and actual output expect="$TESTDIR/$expected" actual="$TESTDIR/`basename $expected .ddl`.out" @@ -161,10 +185,10 @@ TOOLTEST_OUT() { actual_err_sav=${actual_err}-sav # Run test. - TESTING $H5CLEAR $option1 $option2 $fname + TESTING $H5CLEAR $option1 $option2 $option3 $option4 $fname ( cd $TESTDIR - $RUNSERIAL $H5CLEAR_BIN $option1 $option2 $fname + $RUNSERIAL $H5CLEAR_BIN $option1 $option2 $option3 $option4 $fname ) >$actual 2>$actual_err cp $actual $actual_sav cp $actual_err $actual_err_sav @@ -245,17 +269,16 @@ $CP -f $TESTDIR/h5clear_sec2_v3.h5 $TESTDIR/orig_h5clear_sec2_v3.h5 # "h5clear -m -s junk.h5" (valid 2 options, nonexisting file) # "h5clear -m orig_h5clear_sec2_v2.h5" (valid 1 option, existing file, no cache image) # "h5clear -s -m orig_h5clear_sec2_v0.h5" (valid 2 options, existing file, no cache image) -TOOLTEST_OUT "" -h "" h5clear_usage.ddl -TOOLTEST_OUT "" "" "" h5clear_usage.ddl -TOOLTEST_OUT junk.h5 "" "" h5clear_usage.ddl -TOOLTEST_OUT orig_h5clear_sec2_v3.h5 "" "" h5clear_usage.ddl -TOOLTEST_OUT "" -m "" h5clear_missing_file.ddl -TOOLTEST_OUT junk.h5 -s "" h5clear_open_fail.ddl -TOOLTEST_OUT "" -m -s h5clear_missing_file.ddl -TOOLTEST_OUT junk.h5 -m -s h5clear_open_fail.ddl -TOOLTEST_OUT orig_h5clear_sec2_v2.h5 -m "" h5clear_no_mdc_image.ddl -TOOLTEST_OUT orig_h5clear_sec2_v0.h5 -s -m h5clear_no_mdc_image.ddl -# +TOOLTEST_OUT "" -h "" "" h5clear_usage.ddl +TOOLTEST_OUT "" "" "" "" h5clear_usage.ddl +TOOLTEST_OUT junk.h5 "" "" "" h5clear_usage.ddl +TOOLTEST_OUT orig_h5clear_sec2_v3.h5 "" "" "" h5clear_usage.ddl +TOOLTEST_OUT "" -m "" "" h5clear_missing_file.ddl +TOOLTEST_OUT junk.h5 -s "" "" h5clear_open_fail.ddl +TOOLTEST_OUT "" -m -s "" h5clear_missing_file.ddl +TOOLTEST_OUT junk.h5 -m -s "" h5clear_open_fail.ddl +TOOLTEST_OUT orig_h5clear_sec2_v2.h5 -m "" "" h5clear_no_mdc_image.ddl +TOOLTEST_OUT orig_h5clear_sec2_v0.h5 -s -m "" h5clear_no_mdc_image.ddl # # # The following are tests to verify the expected exit code from h5clear: @@ -285,8 +308,8 @@ TOOLTEST h5clear_sec2_v0.h5 -l -m $FAIL # # # h5clear_mdc_image.h5 already has cache image removed earlier, verify the expected warning from h5clear: -TOOLTEST_OUT mod_h5clear_mdc_image.h5 -m "" h5clear_no_mdc_image.ddl -TOOLTEST_OUT mod_h5clear_mdc_image.h5 -s -m h5clear_no_mdc_image.ddl +TOOLTEST_OUT mod_h5clear_mdc_image.h5 -m "" "" h5clear_no_mdc_image.ddl +TOOLTEST_OUT mod_h5clear_mdc_image.h5 -s -m "" h5clear_no_mdc_image.ddl # # # @@ -319,6 +342,73 @@ OPEN_CHK h5clear_sec2_v2.h5 $SUCCEED # # # +# (1) h5clear_status_noclose.h5 +# "h5clear --filesize h5clear_status_noclose.h5" (unable to open the file because status_flag is on) +# "h5clear -s --increment=0 h5clear_status_noclose.h5" (clear status_flag, EOA = MAX(EOA, EOF) + 0) +# (no output, check exit code) +# "h5clear --filesize h5clear_status_noclose_user.h5" (print EOA/EOF after the last action) +TOOLTEST_OUT h5clear_status_noclose.h5 --filesize "" "" h5clear_open_fail.ddl +TOOLTEST h5clear_status_noclose.h5 -s --increment=0 $SUCCEED +TOOLTEST_OUT h5clear_status_noclose.h5 --filesize "" "" h5clear_status_noclose_after_size.ddl +# +# (2) h5clear_fsm_persist_noclose.h5 +# "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF before the next action) +# "h5clear --increment=0 h5clear_fsm_persist_noclose.h5" (EOA = MAX(EOA, EOF)) (no output, check exit code) +# "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF after the last action) +TOOLTEST_OUT h5clear_fsm_persist_noclose.h5 --filesize "" "" h5clear_noclose_before_size.ddl +TOOLTEST h5clear_fsm_persist_noclose.h5 --increment=0 "" $SUCCEED +TOOLTEST_OUT h5clear_fsm_persist_noclose.h5 --filesize "" "" h5clear_noclose_after_size.ddl +# +# (3) h5clear_fsm_persist_equal.h5 +# "h5clear --filesize h5clear_fsm_persist_equal.h5" (print EOA/EOF before the next action) +# "h5clear --increment h5clear_fsm_persist_equal.h5" (EOA = MAX(EOA, EOF) + 1M) (no output, check exit code) +# "h5clear --filesize h5clear_fsm_persist_equal.h5" (print EOA/EOF after the last action) +TOOLTEST_OUT h5clear_fsm_persist_equal.h5 --filesize "" "" h5clear_equal_before_size.ddl +TOOLTEST h5clear_fsm_persist_equal.h5 --increment "" $SUCCEED +TOOLTEST_OUT h5clear_fsm_persist_equal.h5 --filesize "" "" h5clear_equal_after_size.ddl +# +# (4) h5clear_fsm_persist_greater.h5 +# "h5clear --filesize h5clear_fsm_persist_greater.h5" (print EOA/EOF before the next action) +# "h5clear --increment=0 h5clear_fsm_persist_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code) +# "h5clear --filesize h5clear_fsm_persist_greater.h5" (print EOA/EOF after the last action) +TOOLTEST_OUT h5clear_fsm_persist_greater.h5 --filesize "" "" h5clear_greater_before_size.ddl +TOOLTEST h5clear_fsm_persist_greater.h5 --increment=0 "" $SUCCEED +TOOLTEST_OUT h5clear_fsm_persist_greater.h5 --filesize "" "" h5clear_greater_after_size.ddl +# +# (5) h5clear_fsm_persist_less.h5 +# "h5clear --filesize h5clear_fsm_persist_less.h5" (print EOA/EOF before the next action) +# "h5clear --increment=200 h5clear_fsm_persist_less.h5" (EOA = MAX(EOA, EOF) + 200) (no output, check exit code) +# "h5clear --filesize h5clear_fsm_persist_less.h5" (print EOA/EOF after the last action) +TOOLTEST_OUT h5clear_fsm_persist_less.h5 --filesize "" "" h5clear_less_before_size.ddl +TOOLTEST h5clear_fsm_persist_less.h5 --increment=200 "" $SUCCEED +TOOLTEST_OUT h5clear_fsm_persist_less.h5 --filesize "" "" h5clear_less_after_size.ddl +# +# (6) h5clear_fsm_persist_user_equal.h5 +# "h5clear --filesize h5clear_fsm_persist_user_equal.h5" (print EOA/EOF before the next action) +# "h5clear --increment h5clear_fsm_persist_user_equal.h5" (EOA = MAX(EOA, EOF) + 1M) (no output, check exit code) +# "h5clear --filesize h5clear_fsm_persist_user_equal.h5" (print EOA/EOF after the last action) +TOOLTEST_OUT h5clear_fsm_persist_user_equal.h5 --filesize "" "" h5clear_user_equal_before_size.ddl +TOOLTEST h5clear_fsm_persist_user_equal.h5 --increment "" $SUCCEED +TOOLTEST_OUT h5clear_fsm_persist_user_equal.h5 --filesize "" "" h5clear_user_equal_after_size.ddl +# +# (7) h5clear_fsm_persist_user_greater.h5 +# "h5clear --filesize h5clear_fsm_persist_user_greater.h5" (print EOA/EOF before the next action) +# "h5clear --increment=0 h5clear_fsm_persist_user_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code) +# "h5clear --filesize h5clear_fsm_persist_user_greater.h5" (print EOA/EOF after the last action) +TOOLTEST_OUT h5clear_fsm_persist_user_greater.h5 --filesize "" "" h5clear_user_greater_before_size.ddl +TOOLTEST h5clear_fsm_persist_user_greater.h5 --increment=0 "" $SUCCEED +TOOLTEST_OUT h5clear_fsm_persist_user_greater.h5 --filesize "" "" h5clear_user_greater_after_size.ddl +# +# (8) h5clear_fsm_persist_user_less.h5 +# "h5clear --filesize h5clear_fsm_persist_user_less.h5" (print EOA/EOF before the next action) +# "h5clear --increment=200 h5clear_fsm_persist_user_less.h5" (EOA = MAX(EOA, EOF) + 200) (no output, check exit code) +# "h5clear --filesize h5clear_fsm_persist_user_less.h5" (print EOA/EOF after the last action) +TOOLTEST_OUT h5clear_fsm_persist_user_less.h5 --filesize "" "" h5clear_user_less_before_size.ddl +TOOLTEST h5clear_fsm_persist_user_less.h5 --increment=200 "" $SUCCEED +TOOLTEST_OUT h5clear_fsm_persist_user_less.h5 --filesize "" "" h5clear_user_less_after_size.ddl +# +# +# # Clean up test files if test -z "$HDF5_NOCLEANUP"; then rm -f h5clear_*.h5 latest_h5clear*.h5 diff --git a/tools/test/misc/vds/CMakeLists.txt b/tools/test/misc/vds/CMakeLists.txt index ec672e5..50aade4 100644 --- a/tools/test/misc/vds/CMakeLists.txt +++ b/tools/test/misc/vds/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_TEST_MISC_VDS) #----------------------------------------------------------------------------- @@ -8,7 +8,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) MACRO (ADD_H5_GENERATOR genfile) add_executable (${genfile} ${HDF5_TOOLS_TEST_MISC_VDS_SOURCE_DIR}/${genfile}.c) - TARGET_NAMING (${genfile} STATIC) TARGET_C_PROPERTIES (${genfile} STATIC " " " ") target_link_libraries (${genfile} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (${genfile} PROPERTIES FOLDER generator/tools) diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index 20250c6..5104b90 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10) PROJECT (HDF5_TOOLS_TEST_PERFORM ) #----------------------------------------------------------------------------- @@ -21,7 +21,6 @@ set (h5perf_serial_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c ) add_executable (h5perf_serial ${h5perf_serial_SOURCES}) -TARGET_NAMING (h5perf_serial STATIC) TARGET_C_PROPERTIES (h5perf_serial STATIC " " " ") target_link_libraries (h5perf_serial ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5perf_serial PROPERTIES FOLDER perform) @@ -33,7 +32,6 @@ if (HDF5_BUILD_PERFORM_STANDALONE) ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c ) add_executable (h5perf_serial_alone ${h5perf_serial_alone_SOURCES}) - TARGET_NAMING (h5perf_serial_alone STATIC) TARGET_C_PROPERTIES (h5perf_serial_alone STATIC " " " ") target_link_libraries (h5perf_serial_alone ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5perf_serial_alone PROPERTIES FOLDER perform) @@ -47,7 +45,6 @@ set (chunk_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk.c ) ADD_EXECUTABLE(chunk ${chunk_SOURCES}) -TARGET_NAMING (chunk STATIC) TARGET_C_PROPERTIES (chunk STATIC " " " ") TARGET_LINK_LIBRARIES(chunk ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (chunk PROPERTIES FOLDER perform) @@ -57,7 +54,6 @@ set (iopipe_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/iopipe.c ) add_executable (iopipe ${iopipe_SOURCES}) -TARGET_NAMING (iopipe STATIC) TARGET_C_PROPERTIES (iopipe STATIC " " " ") target_link_libraries (iopipe ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (iopipe PROPERTIES FOLDER perform) @@ -67,7 +63,6 @@ set (overhead_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/overhead.c ) add_executable (overhead ${overhead_SOURCES}) -TARGET_NAMING (overhead STATIC) TARGET_C_PROPERTIES (overhead STATIC " " " ") target_link_libraries (overhead ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (overhead PROPERTIES FOLDER perform) @@ -77,7 +72,6 @@ set_target_properties (overhead PROPERTIES FOLDER perform) ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf_meta.c ) add_executable (perf_meta ${perf_meta_SOURCES}) - TARGET_NAMING (perf_meta STATIC) TARGET_C_PROPERTIES (perf_meta STATIC " " " ") target_link_libraries (perf_meta ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (perf_meta PROPERTIES FOLDER perform) @@ -87,7 +81,6 @@ set (zip_perf_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/zip_perf.c ) add_executable (zip_perf ${zip_perf_SOURCES}) -TARGET_NAMING (zip_perf STATIC) TARGET_C_PROPERTIES (zip_perf STATIC " " " ") target_link_libraries (zip_perf ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (zip_perf PROPERTIES FOLDER perform) @@ -99,7 +92,6 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING) ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c ) add_executable (h5perf ${h5perf_SOURCES}) - TARGET_NAMING (h5perf STATIC) TARGET_C_PROPERTIES (h5perf STATIC " " " ") target_link_libraries (h5perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (h5perf PROPERTIES FOLDER perform) @@ -111,7 +103,6 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING) ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c ) add_executable (h5perf_alone ${h5perf_alone_SOURCES}) - TARGET_NAMING (h5perf_alone STATIC) TARGET_C_PROPERTIES (h5perf_alone STATIC " " " ") target_link_libraries (h5perf_alone ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (h5perf_alone PROPERTIES FOLDER perform) diff --git a/tools/test/perform/pio_perf.h b/tools/test/perform/pio_perf.h index b595c90..7605f20 100644 --- a/tools/test/perform/pio_perf.h +++ b/tools/test/perform/pio_perf.h @@ -15,7 +15,6 @@ #include "io_timer.h" #ifndef STANDALONE -#include "H5private.h" #include "h5test.h" #include "h5tools.h" #include "h5tools_utils.h" @@ -36,22 +35,22 @@ typedef enum iotype_ { } iotype; typedef struct parameters_ { - iotype io_type; /* The type of IO test to perform */ - int num_procs; /* Maximum number of processes to use */ - long num_files; /* Number of files to create */ - long num_dsets; /* Number of datasets to create */ - off_t num_bytes; /* Number of bytes in each dset */ + iotype io_type; /* The type of IO test to perform */ + int num_procs; /* Maximum number of processes to use */ + long num_files; /* Number of files to create */ + long num_dsets; /* Number of datasets to create */ + off_t num_bytes; /* Number of bytes in each dset */ int num_iters; /* Number of times to loop doing the IO */ - size_t buf_size; /* Buffer size */ - size_t blk_size; /* Block size */ + size_t buf_size; /* Buffer size */ + size_t blk_size; /* Block size */ unsigned interleaved; /* Interleaved vs. contiguous blocks */ unsigned collective; /* Collective vs. independent I/O */ unsigned dim2d; /* 1D vs. 2D */ - hsize_t h5_align; /* HDF5 object alignment */ - hsize_t h5_thresh; /* HDF5 object alignment threshold */ - int h5_use_chunks; /* Make HDF5 dataset chunked */ - int h5_write_only; /* Perform the write tests only */ - int verify; /* Verify data correctness */ + hsize_t h5_align; /* HDF5 object alignment */ + hsize_t h5_thresh; /* HDF5 object alignment threshold */ + int h5_use_chunks; /* Make HDF5 dataset chunked */ + int h5_write_only; /* Perform the write tests only */ + int verify; /* Verify data correctness */ } parameters; typedef struct results_ { diff --git a/tools/test/perform/sio_perf.h b/tools/test/perform/sio_perf.h index 366b791..83caf54 100644 --- a/tools/test/perform/sio_perf.h +++ b/tools/test/perform/sio_perf.h @@ -15,7 +15,6 @@ #include "io_timer.h" #ifndef STANDALONE -#include "H5private.h" #include "h5test.h" #include "h5tools.h" #include "h5tools_utils.h" diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt index fe22a1b..19de76f 100644 --- a/tools/testfiles/h5dump-help.txt +++ b/tools/testfiles/h5dump-help.txt @@ -44,8 +44,8 @@ usage: h5dump [OPTIONS] files -m T, --format=T Set the floating point output format -q Q, --sort_by=Q Sort groups and attributes by index Q -z Z, --sort_order=Z Sort groups and attributes by order Z - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. --no-compact-subset Disable compact form of subsetting and allow the use of "[" in dataset names. -w N, --width=N Set the number of columns of output. A value of 0 (zero) diff --git a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl index 767cbbf..0a3beb0 100644 --- a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl +++ b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl @@ -44,8 +44,8 @@ usage: h5dump [OPTIONS] files -m T, --format=T Set the floating point output format -q Q, --sort_by=Q Sort groups and attributes by index Q -z Z, --sort_order=Z Sort groups and attributes by order Z - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. --no-compact-subset Disable compact form of subsetting and allow the use of "[" in dataset names. -w N, --width=N Set the number of columns of output. A value of 0 (zero) diff --git a/tools/testfiles/pbits/tpbitsIncomplete.ddl b/tools/testfiles/pbits/tpbitsIncomplete.ddl index d791b41..b353065 100644 --- a/tools/testfiles/pbits/tpbitsIncomplete.ddl +++ b/tools/testfiles/pbits/tpbitsIncomplete.ddl @@ -44,8 +44,8 @@ usage: h5dump [OPTIONS] files -m T, --format=T Set the floating point output format -q Q, --sort_by=Q Sort groups and attributes by index Q -z Z, --sort_order=Z Sort groups and attributes by order Z - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. --no-compact-subset Disable compact form of subsetting and allow the use of "[" in dataset names. -w N, --width=N Set the number of columns of output. A value of 0 (zero) diff --git a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl index 5235aa7..ffe0da9 100644 --- a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl @@ -44,8 +44,8 @@ usage: h5dump [OPTIONS] files -m T, --format=T Set the floating point output format -q Q, --sort_by=Q Sort groups and attributes by index Q -z Z, --sort_order=Z Sort groups and attributes by order Z - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. --no-compact-subset Disable compact form of subsetting and allow the use of "[" in dataset names. -w N, --width=N Set the number of columns of output. A value of 0 (zero) diff --git a/tools/testfiles/pbits/tpbitsLengthPositive.ddl b/tools/testfiles/pbits/tpbitsLengthPositive.ddl index 697bff8..4502143 100644 --- a/tools/testfiles/pbits/tpbitsLengthPositive.ddl +++ b/tools/testfiles/pbits/tpbitsLengthPositive.ddl @@ -44,8 +44,8 @@ usage: h5dump [OPTIONS] files -m T, --format=T Set the floating point output format -q Q, --sort_by=Q Sort groups and attributes by index Q -z Z, --sort_order=Z Sort groups and attributes by order Z - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. --no-compact-subset Disable compact form of subsetting and allow the use of "[" in dataset names. -w N, --width=N Set the number of columns of output. A value of 0 (zero) diff --git a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl index 900c0b5..011f6c9 100644 --- a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl @@ -44,8 +44,8 @@ usage: h5dump [OPTIONS] files -m T, --format=T Set the floating point output format -q Q, --sort_by=Q Sort groups and attributes by index Q -z Z, --sort_order=Z Sort groups and attributes by order Z - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. --no-compact-subset Disable compact form of subsetting and allow the use of "[" in dataset names. -w N, --width=N Set the number of columns of output. A value of 0 (zero) diff --git a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl index 65123d0..857fe62 100644 --- a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl @@ -44,8 +44,8 @@ usage: h5dump [OPTIONS] files -m T, --format=T Set the floating point output format -q Q, --sort_by=Q Sort groups and attributes by index Q -z Z, --sort_order=Z Sort groups and attributes by order Z - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. --no-compact-subset Disable compact form of subsetting and allow the use of "[" in dataset names. -w N, --width=N Set the number of columns of output. A value of 0 (zero) diff --git a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl index d352e34..9ac1160 100644 --- a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl @@ -44,8 +44,8 @@ usage: h5dump [OPTIONS] files -m T, --format=T Set the floating point output format -q Q, --sort_by=Q Sort groups and attributes by index Q -z Z, --sort_order=Z Sort groups and attributes by order Z - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. --no-compact-subset Disable compact form of subsetting and allow the use of "[" in dataset names. -w N, --width=N Set the number of columns of output. A value of 0 (zero) |