summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt221
-rw-r--r--test/big.c9
-rw-r--r--test/cache_common.c2
-rw-r--r--test/cache_tagging.c2
-rw-r--r--test/cmpd_dset.c64
-rw-r--r--test/dsets.c454
-rw-r--r--test/dt_arith.c415
-rw-r--r--test/dtransform.c2
-rw-r--r--test/dtypes.c314
-rw-r--r--test/earray.c8
-rw-r--r--test/enum.c2
-rw-r--r--test/fillval.c2
-rw-r--r--test/freespace.c63
-rw-r--r--test/getname.c108
-rw-r--r--test/gheap.c69
-rw-r--r--test/h5test.h8
-rw-r--r--test/hyperslab.c30
-rw-r--r--test/links.c200
-rw-r--r--test/mtime.c12
-rwxr-xr-xtest/objcopy.c33
-rw-r--r--test/pool.c4
-rw-r--r--test/set_extent.c4
-rw-r--r--test/stab.c2
-rw-r--r--test/tattr.c16
-rw-r--r--test/testframe.c18
-rw-r--r--test/th5s.c4
-rw-r--r--test/trefer.c48
-rw-r--r--test/tselect.c2
-rw-r--r--test/tsohm.c198
-rw-r--r--test/tvlstr.c75
30 files changed, 1636 insertions, 753 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 772466a..6d9dee7 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 2.8)
-PROJECT (H5_TEST)
+PROJECT (HDF5_TEST)
#-----------------------------------------------------------------------------
# Define Sources
@@ -31,6 +31,90 @@ TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TEST_LIB_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} ${LIB_TYPE})
+# --------------------------------------------------------------------
+# Copy all the HDF5 files from the test directory into the source directory
+# --------------------------------------------------------------------
+SET (HDF5_TEST_FILES
+ tnullspace.h5
+)
+
+FOREACH (h5_tfile ${HDF5_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/${h5_tfile}")
+ #MESSAGE (STATUS " Copying ${h5_tfile}")
+ ADD_CUSTOM_COMMAND (
+ TARGET ${HDF5_TEST_LIB_TARGET}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_tfile} ${dest}
+ )
+ENDFOREACH (h5_tfile ${HDF5_TEST_FILES})
+
+# --------------------------------------------------------------------
+# Copy all the HDF5 files from the test directory into the source directory
+# --------------------------------------------------------------------
+SET (HDF5_REFERENCE_FILES
+ err_compat_1
+ err_compat_2
+ error_test_1
+ error_test_2
+)
+
+FOREACH (ref_file ${HDF5_REFERENCE_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/testfiles/${ref_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET ${HDF5_TEST_LIB_TARGET}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest}
+ )
+ENDFOREACH (ref_file ${HDF5_REFERENCE_FILES})
+
+# --------------------------------------------------------------------
+#-- Copy all the HDF5 files from the test directory into the source directory
+# --------------------------------------------------------------------
+SET (HDF5_REFERENCE_TEST_FILES
+ be_data.h5
+ be_extlink1.h5
+ be_extlink2.h5
+ corrupt_stab_msg.h5
+ deflate.h5
+ family_v16_00000.h5
+ family_v16_00001.h5
+ family_v16_00002.h5
+ family_v16_00003.h5
+ fill_old.h5
+ fixed_idx.h5
+ group_old.h5
+ le_data.h5
+ le_extlink1.h5
+ le_extlink2.h5
+ mergemsg.h5
+ noencoder.h5
+ specmetaread.h5
+ tarrold.h5
+ tbad_msg_count.h5
+ tbogus.h5
+ test_filters_be.hdf5
+ test_filters_le.hdf5
+ th5s.h5
+ tlayouto.h5
+ tmtimen.h5
+ tmtimeo.h5
+ vms_data.h5
+)
+
+FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ SET (dest "${HDF5_TEST_BINARY_DIR}/${h5_file}")
+ #MESSAGE (STATUS " Copying ${h5_file} to ${dest}")
+ ADD_CUSTOM_COMMAND (
+ TARGET ${HDF5_TEST_LIB_TARGET}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/${h5_file} ${dest}
+ )
+ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
SET (testhdf5_SRCS
${HDF5_TEST_SOURCE_DIR}/testhdf5.c
${HDF5_TEST_SOURCE_DIR}/tarray.c
@@ -75,6 +159,12 @@ ENDIF (WIN32)
TARGET_LINK_LIBRARIES (testhdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
ADD_TEST (NAME testhdf5 COMMAND $<TARGET_FILE:testhdf5>)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
MACRO (ADD_H5_TEST file)
ADD_EXECUTABLE (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c)
@@ -137,24 +227,28 @@ SET (H5_TESTS
earray
btree2
fheap
+ error_test
+ err_compat
+ tcheck_version
+ testmeta
)
FOREACH (test ${H5_TESTS})
ADD_H5_TEST(${test})
ENDFOREACH (test ${H5_TESTS})
-SET (H5_CHECK_TESTS
-)
-
-FOREACH (chktest ${H5_CHECK_TESTS})
- ADD_H5_TEST(${chktest})
-ENDFOREACH (chktest ${H5_CHECK_TESTS})
-
#-- Allow extra time for fheap to complete 30min
IF (WIN32)
SET_TESTS_PROPERTIES (fheap PROPERTIES TIMEOUT 2500)
ENDIF (WIN32)
+
+##############################################################################
+##############################################################################
+### A D D I T I O N A L T E S T S ###
+##############################################################################
+##############################################################################
+
#-- Adding test for cache
ADD_EXECUTABLE (cache ${HDF5_TEST_SOURCE_DIR}/cache.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
H5_NAMING (cache)
@@ -205,85 +299,53 @@ ENDIF (WIN32)
TARGET_LINK_LIBRARIES (cache_tagging ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
ADD_TEST (NAME cache_tagging COMMAND $<TARGET_FILE:cache_tagging>)
-
#-- Adding test for ttsafe
-SET (ttsafe_SRCS
- ttsafe.c
- ttsafe_dcreate.c
- ttsafe_error.c
- ttsafe_cancel.c
- ttsafe_acreate.c
+ADD_EXECUTABLE (ttsafe
+ ${HDF5_TEST_SOURCE_DIR}/ttsafe.c
+ ${HDF5_TEST_SOURCE_DIR}/ttsafe_dcreate.c
+ ${HDF5_TEST_SOURCE_DIR}/ttsafe_error.c
+ ${HDF5_TEST_SOURCE_DIR}/ttsafe_cancel.c
+ ${HDF5_TEST_SOURCE_DIR}/ttsafe_acreate.c
)
-
-ADD_EXECUTABLE (ttsafe ${ttsafe_SRCS})
H5_NAMING (ttsafe)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (ttsafe
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
TARGET_LINK_LIBRARIES (ttsafe ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
ADD_TEST (NAME ttsafe COMMAND $<TARGET_FILE:ttsafe>)
-#-- Copy all the HDF5 files from the test directory into the source directory
-SET (HDF5_REFERENCE_TEST_FILES
- tnullspace.h5
-)
-
-FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
- SET (dest "${PROJECT_BINARY_DIR}/${h5_file}")
- #MESSAGE (STATUS " Copying ${h5_file}")
- ADD_CUSTOM_COMMAND (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest}
- )
-ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
-
-
-#-- Copy all the HDF5 files from the test directory into the source directory
-SET (HDF5_REFERENCE_TEST_FILES
- be_data.h5
- be_extlink1.h5
- be_extlink2.h5
- corrupt_stab_msg.h5
- deflate.h5
- family_v16_00000.h5
- family_v16_00001.h5
- family_v16_00002.h5
- family_v16_00003.h5
- filespace_1_6.h5
- filespace_1_8.h5
- fill_old.h5
- group_old.h5
- le_data.h5
- le_extlink1.h5
- le_extlink2.h5
- mergemsg.h5
- noencoder.h5
- specmetaread.h5
- tarrold.h5
- tbad_msg_count.h5
- tbogus.h5
- test_filters_be.hdf5
- test_filters_le.hdf5
- th5s.h5
- tlayouto.h5
- tmtimen.h5
- tmtimeo.h5
- vms_data.h5
-)
+##############################################################################
+##############################################################################
+### T H E G E N E R A T O R S ###
+##############################################################################
+##############################################################################
-FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
- SET (dest "${H5_TEST_BINARY_DIR}/${h5_file}")
- #MESSAGE (STATUS " Copying ${h5_file} to ${dest}")
- ADD_CUSTOM_COMMAND (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${H5_TEST_SOURCE_DIR}/${h5_file} ${dest}
- )
-ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
+ MACRO (ADD_H5_GENERATOR genfile)
+ ADD_EXECUTABLE (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c)
+ H5_NAMING (${genfile})
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (${genfile}
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (${genfile} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
+ ENDMACRO (ADD_H5_GENERATOR genfile)
-# generator executables
-IF (CREATE_GENERATORS)
+ # generator executables
SET (H5_GENERATORS
gen_bad_ohdr
gen_bogus
@@ -310,4 +372,5 @@ IF (CREATE_GENERATORS)
TARGET_LINK_LIBRARIES (${gen} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
ENDFOREACH (gen ${H5_GENERATORS})
-ENDIF (CREATE_GENERATORS)
+ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
+
diff --git a/test/big.c b/test/big.c
index dde9d7a..8d65559 100644
--- a/test/big.c
+++ b/test/big.c
@@ -32,8 +32,7 @@ const char *FILENAME[] = {
#define WRT_SIZE 4*1024
#define FAMILY_SIZE 1024*1024*1024
-/* Define big file as 2GB */
-#define BIG_FILE (off_t)0x80000000UL
+#define GB (HDoff_t)0x40000000L
#define MAX_TRIES 100
@@ -165,15 +164,15 @@ supports_big(void)
if ((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) return 0;
/* Write a few bytes at 2GB */
- if (HDlseek(fd, BIG_FILE, SEEK_SET)!=BIG_FILE) return 0;
+ if (HDlseek(fd, 2*GB, SEEK_SET)!=2*GB) return 0;
if (5!=HDwrite(fd, "hello", (size_t)5)) return 0;
/* Write a few bytes at 4GB */
- if (HDlseek(fd, 2*BIG_FILE, SEEK_SET) != 2*BIG_FILE) return 0;
+ if (HDlseek(fd, 4*GB, SEEK_SET) != 4*GB) return 0;
if (5!=HDwrite(fd, "hello", (size_t)5)) return 0;
if (HDclose(fd) < 0) return 0;
- if (HDunlink("y.h5") < 0) return 0;
+ if (HDremove("y.h5") < 0) return 0;
return (1);
}
diff --git a/test/cache_common.c b/test/cache_common.c
index 312de3d..e6dd020 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -2694,8 +2694,6 @@ setup_cache(size_t max_cache_size,
H5C_stats__reset(cache_ptr);
- H5C_set_skip_flags(cache_ptr, TRUE, TRUE);
-
ret_val = file_ptr;
}
diff --git a/test/cache_tagging.c b/test/cache_tagging.c
index cc1b37c..9aef651 100644
--- a/test/cache_tagging.c
+++ b/test/cache_tagging.c
@@ -3836,7 +3836,7 @@ check_invalid_tag_application(void)
/* Create dxpl */
if ( (dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR;
- /* Call H5HL_create, an internal function that calls H5AC_set without setting up a tag */
+ /* Call H5HL_create, an internal function that calls H5AC_insert_entry without setting up a tag */
/* Ensure this returns FAILURE, as a tag has not been set up. */
if ( H5HL_create(f, H5AC_ind_dxpl_id, (size_t)1024, &addr) >= 0) TEST_ERROR;
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index d565e82..08890a8 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -1811,18 +1811,18 @@ test_pack_ooo(void)
TESTING("random member insertion with empty compound subtype");
/* Create inner compound type. It will be empty for the first run */
- if((sub_cmpd = H5Tcreate(H5T_COMPOUND, 4)) < 0) PACK_OOO_ERROR
+ if((sub_cmpd = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0) PACK_OOO_ERROR
/* Create main compound type, with extra space at the end */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in the random order previously generated */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == sub_cmpd_order) {
- if(H5Tinsert(cmpd, name, 4 * order[i], sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * order[i], H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is not packed */
@@ -1837,18 +1837,18 @@ test_pack_ooo(void)
TESTING("random member insertion with full compound subtype");
/* Complete the inner compound type */
- if(H5Tinsert(sub_cmpd, "int", 0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(sub_cmpd, "int", (size_t)0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
/* Recreate main compound type */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in the random order previously generated */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == sub_cmpd_order) {
- if(H5Tinsert(cmpd, name, 4 * order[i], sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * order[i], H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is not packed */
@@ -1864,18 +1864,18 @@ test_pack_ooo(void)
TESTING("reverse member insertion with empty compound subtype");
/* Create inner compound type. It will be empty for the first run */
- if((sub_cmpd = H5Tcreate(H5T_COMPOUND, 4)) < 0) PACK_OOO_ERROR
+ if((sub_cmpd = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0) PACK_OOO_ERROR
/* Create main compound type, with extra space at the end */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in reverse order, with compound last */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == PACK_NMEMBS - 1) {
- if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is not packed */
@@ -1890,18 +1890,18 @@ test_pack_ooo(void)
TESTING("reverse member insertion with full compound subtype");
/* Complete the inner compound type */
- if(H5Tinsert(sub_cmpd, "int", 0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(sub_cmpd, "int", (size_t)0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
/* Recreate main compound type */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in reverse order, with compound last */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == PACK_NMEMBS - 1) {
- if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is packed */
@@ -1917,18 +1917,18 @@ test_pack_ooo(void)
TESTING("forward member insertion with empty compound subtype");
/* Create inner compound type. It will be empty for the first run */
- if((sub_cmpd = H5Tcreate(H5T_COMPOUND, 4)) < 0) PACK_OOO_ERROR
+ if((sub_cmpd = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0) PACK_OOO_ERROR
/* Create main compound type, with extra space at the end */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in forward order, with compound first */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == 0) {
- if(H5Tinsert(cmpd, name, 4 * i, sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * i), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * i, H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * i), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is not packed */
@@ -1943,18 +1943,18 @@ test_pack_ooo(void)
TESTING("forward member insertion with full compound subtype");
/* Complete the inner compound type */
- if(H5Tinsert(sub_cmpd, "int", 0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(sub_cmpd, "int", (size_t)0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
/* Recreate main compound type */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in forward order */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == 0) {
- if(H5Tinsert(cmpd, name, 4 * i, sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * i), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * i, H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * i), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is packed */
@@ -2010,11 +2010,11 @@ test_ooo_order(char *filename)
TEST_ERROR
/* Create the compound */
- if((dtype = H5Tcreate(H5T_COMPOUND, 20)) < 0) TEST_ERROR
- if(H5Tinsert(dtype, "A", 8, H5T_STD_I32LE) < 0) TEST_ERROR
- if(H5Tinsert(dtype, "B", 12, H5T_STD_I32LE) < 0) TEST_ERROR
- if(H5Tinsert(dtype, "C", 0, H5T_STD_I32LE) < 0) TEST_ERROR
- if(H5Tinsert(dtype, "D", 16, H5T_STD_I32LE) < 0) TEST_ERROR
+ if((dtype = H5Tcreate(H5T_COMPOUND, (size_t)20)) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "A", (size_t)8, H5T_STD_I32LE) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "B", (size_t)12, H5T_STD_I32LE) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "C", (size_t)0, H5T_STD_I32LE) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "D", (size_t)16, H5T_STD_I32LE) < 0) TEST_ERROR
/* Verify that the compound is not packed */
if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
@@ -2065,7 +2065,7 @@ test_ooo_order(char *filename)
if(H5Tget_member_offset(dtype, 3) != 16) TEST_ERROR
/* Insert the last member */
- if(H5Tinsert(dtype, "E", 4, H5T_STD_I32LE) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "E", (size_t)4, H5T_STD_I32LE) < 0) TEST_ERROR
/* Verify that the compound is packed */
if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
@@ -2112,7 +2112,7 @@ test_ooo_order(char *filename)
if(H5Tget_member_offset(dtype, 4) != 4) TEST_ERROR
/* Expand the type, and verify that it became unpacked */
- if(H5Tset_size(dtype, 21) < 0) TEST_ERROR
+ if(H5Tset_size(dtype, (size_t)21) < 0) TEST_ERROR
if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
TEST_ERROR
if(dt->shared->u.compnd.packed) TEST_ERROR
@@ -2123,7 +2123,7 @@ test_ooo_order(char *filename)
if(H5Tget_member_offset(dtype, 4) != 4) TEST_ERROR
/* Shrink the type, and verify that it became packed */
- if(H5Tset_size(dtype, 20) < 0) TEST_ERROR
+ if(H5Tset_size(dtype, (size_t)20) < 0) TEST_ERROR
if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
TEST_ERROR
if(!dt->shared->u.compnd.packed) TEST_ERROR
diff --git a/test/dsets.c b/test/dsets.c
index a0a1f39..3d42efc 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -60,6 +60,7 @@ const char *FILENAME[] = {
"chunk_fixed", /* 12 */
"copy_dcpl_newfile",/* 13 */
"partial_chunks", /* 14 */
+ "layout_extend",
NULL
};
#define FILENAME_BUF_SIZE 1024
@@ -78,20 +79,27 @@ const char *FILENAME[] = {
#define DSET_CONV_BUF_NAME "conv_buf"
#define DSET_TCONV_NAME "tconv"
#define DSET_DEFLATE_NAME "deflate"
+#ifdef H5_HAVE_FILTER_SZIP
#define DSET_SZIP_NAME "szip"
+#endif /* H5_HAVE_FILTER_SZIP */
#define DSET_SHUFFLE_NAME "shuffle"
#define DSET_FLETCHER32_NAME "fletcher32"
#define DSET_FLETCHER32_NAME_2 "fletcher32_2"
#define DSET_FLETCHER32_NAME_3 "fletcher32_3"
#define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32"
#define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2"
+#if defined H5_HAVE_FILTER_SZIP && defined H5_HAVE_FILTER_SHUFFLE && defined H5_HAVE_FILTER_FLETCHER32
#define DSET_SHUF_SZIP_FLET_NAME "shuffle+szip+fletcher32"
#define DSET_SHUF_SZIP_FLET_NAME_2 "shuffle+szip+fletcher32_2"
+#endif /* defined H5_HAVE_FILTER_SZIP && defined H5_HAVE_FILTER_SHUFFLE && defined H5_HAVE_FILTER_FLETCHER32 */
#define DSET_BOGUS_NAME "bogus"
#define DSET_MISSING_NAME "missing"
#define DSET_CAN_APPLY_NAME "can_apply"
+#define DSET_CAN_APPLY_NAME2 "can_apply2"
+#ifdef H5_HAVE_FILTER_SZIP
#define DSET_CAN_APPLY_SZIP_NAME "can_apply_szip"
+#endif /* H5_HAVE_FILTER_SZIP */
#define DSET_SET_LOCAL_NAME "set_local"
#define DSET_SET_LOCAL_NAME_2 "set_local_2"
#define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle"
@@ -136,7 +144,8 @@ const char *FILENAME[] = {
#define H5Z_FILTER_SET_LOCAL_TEST 308
#define H5Z_FILTER_DEPREC 309
#define H5Z_FILTER_EXPAND 310
-#define H5Z_FILTER_COUNT 311
+#define H5Z_FILTER_CAN_APPLY_TEST2 311
+#define H5Z_FILTER_COUNT 312
/* Flags for testing filters */
#define DISABLE_FLETCHER32 0
@@ -232,10 +241,12 @@ const char *OLD_FILENAME[] = { /* Files created under 1.6 branch and 1.8 branch
/* Local prototypes for filter functions */
static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
-static herr_t can_apply_bogus(hid_t dcpl_id, hid_t type_id, hid_t space_id);
+static htri_t can_apply_bogus(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static herr_t set_local_bogus2(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t filter_bogus3(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
static size_t filter_corrupt(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
static size_t filter_expand(unsigned int flags, size_t cd_nelmts,
@@ -921,6 +932,132 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_layout_extend
+ *
+ * Purpose: Verify that the creation of extendible dataset with dataspace:
+ * cur_dims < max_dims (max_dims can be fixed size or H5S_UNLIMITED)
+ * will behave as follows:
+ * H5D_COMPACT layout: fail
+ * H5D_CONTIGUOUS layout: fail
+ * H5D_CHUNKED layout: succeed
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Vailin Choi; August 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_layout_extend(hid_t fapl)
+{
+ char filename[FILENAME_BUF_SIZE]; /* File name */
+ hid_t fid; /* File id */
+ hid_t sid_fix, sid_unlim; /* Dataspace id */
+ hid_t dcpl_compact, dcpl_contig, dcpl_chunked; /* Dataset creation property list id */
+ hid_t did_fixed, did_unlim; /* Dataset id */
+ hsize_t cur_size[1] = {10}; /* Current size of dataspace */
+ hsize_t max_unlim[1] = {H5S_UNLIMITED}; /* Maximum size of dataspace (unlimited) */
+ hsize_t max_fix[1] = {100}; /* Maximum size of dataspace (fixed) */
+ hsize_t chunk_dim[1] = {10}; /* Chunk size */
+
+ TESTING("extendible dataset with various layout");
+
+ /* Create a file */
+ h5_fixname(FILENAME[12], fapl, filename, sizeof filename);
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create dataspace */
+ if((sid_fix = H5Screate_simple(1, cur_size, max_fix)) < 0)
+ FAIL_STACK_ERROR
+ if((sid_unlim = H5Screate_simple(1, cur_size, max_unlim)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create property list for compact dataset creation */
+ if((dcpl_compact = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_layout(dcpl_compact, H5D_COMPACT) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create dataset with extendible dataspace (fixed max_dims) should fail */
+ H5E_BEGIN_TRY {
+ if(H5Dcreate2(fid, "compact", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT) != FAIL)
+ TEST_ERROR
+ } H5E_END_TRY;
+
+ /* Create dataset with extendible dataspace (unlimited max_dims) should fail */
+ H5E_BEGIN_TRY {
+ if(H5Dcreate2(fid, "compact", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT) != FAIL)
+ TEST_ERROR
+ } H5E_END_TRY;
+
+ /* Create property list for contiguous dataset creation */
+ if((dcpl_contig = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_layout(dcpl_contig, H5D_CONTIGUOUS)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create dataset with extendible dataspace (fixed max_dims) should fail */
+ H5E_BEGIN_TRY {
+ if(H5Dcreate2(fid, "contig", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT) != FAIL)
+ TEST_ERROR
+ } H5E_END_TRY;
+
+ /* Create dataset with extendible dataspace (unlimited max_dims) should fail*/
+ H5E_BEGIN_TRY {
+ if(H5Dcreate2(fid, "contig", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT) != FAIL)
+ TEST_ERROR
+ } H5E_END_TRY;
+
+ /* Create property list for chunked dataset creation */
+ if((dcpl_chunked = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_layout(dcpl_chunked, H5D_CHUNKED) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dcpl_chunked, 1, chunk_dim) < 0) FAIL_STACK_ERROR
+
+ /* Create dataset with extendible dataspace (fixed max_dims) should succeed */
+ if((did_fixed = H5Dcreate2(fid, "chunked_fixed", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_chunked, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create dataset with extendible dataspace (unlimited max_dims) should succeed */
+ if((did_unlim = H5Dcreate2(fid, "chunked_unlim", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_chunked, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Closing */
+ if(H5Sclose(sid_fix) < 0) FAIL_STACK_ERROR
+ if(H5Sclose(sid_unlim) < 0) FAIL_STACK_ERROR
+
+ if(H5Pclose(dcpl_compact) < 0) FAIL_STACK_ERROR
+ if(H5Pclose(dcpl_contig) < 0) FAIL_STACK_ERROR
+ if(H5Pclose(dcpl_chunked) < 0) FAIL_STACK_ERROR
+
+ if(H5Dclose(did_fixed) < 0) FAIL_STACK_ERROR
+ if(H5Dclose(did_unlim) < 0) FAIL_STACK_ERROR
+
+ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Sclose(sid_fix);
+ H5Sclose(sid_unlim);
+ H5Pclose(dcpl_compact);
+ H5Pclose(dcpl_contig);
+ H5Pclose(dcpl_chunked);
+ H5Dclose(did_fixed);
+ H5Dclose(did_unlim);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ return -1;
+} /* end test_layout_extend() */
+
+
+/*-------------------------------------------------------------------------
* Function: test_conv_buffer
*
* Purpose: Test size of data type conversion buffer.
@@ -1003,8 +1140,8 @@ test_conv_buffer(hid_t fid)
if((arr_type3 = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, dimsc)) < 0) goto error;
if(H5Tinsert(ctype1, "A", HOFFSET(CmpField, a), arr_type1) < 0) goto error;
- if(H5Tinsert (ctype1, "B", HOFFSET(CmpField, b), arr_type2) < 0) goto error;
- if(H5Tinsert (ctype1, "C", HOFFSET(CmpField, c), arr_type3) < 0) goto error;
+ if(H5Tinsert(ctype1, "B", HOFFSET(CmpField, b), arr_type2) < 0) goto error;
+ if(H5Tinsert(ctype1, "C", HOFFSET(CmpField, c), arr_type3) < 0) goto error;
/* Create the dataset */
if((dataset = H5Dcreate2(fid, DSET_CONV_BUF_NAME, ctype1, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
@@ -1015,18 +1152,18 @@ test_conv_buffer(hid_t fid)
if((arr_type4 = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, dimsb)) < 0) goto error;
if((arr_type5 = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, dimsc)) < 0) goto error;
- if(H5Tinsert (ctype2, "B", HOFFSET(CmpFieldR, b), arr_type4) < 0) goto error;
- if(H5Tinsert (ctype2, "C", HOFFSET(CmpFieldR, c), arr_type5) < 0) goto error;
+ if(H5Tinsert(ctype2, "B", HOFFSET(CmpFieldR, b), arr_type4) < 0) goto error;
+ if(H5Tinsert(ctype2, "C", HOFFSET(CmpFieldR, c), arr_type5) < 0) goto error;
/* Read should succeed since library will set conversion buffer big enough */
cfrR = (CmpFieldR *)HDcalloc((size_t)1, sizeof(CmpFieldR));
if(H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, H5P_DEFAULT, cfrR) < 0) goto error;
/* Read should fail since conversion buffer isn't big enough */
- xfer_list = H5Pcreate (H5P_DATASET_XFER);
- size = (DIM2*DIM3*(sizeof(int))+ DIM2*(sizeof(float))+
- DIM3*(sizeof(double)));
- if(H5Pset_buffer (xfer_list, size, NULL, NULL) < 0) goto error;
+ xfer_list = H5Pcreate(H5P_DATASET_XFER);
+ size = (DIM2 * DIM3 * (sizeof(int))+ DIM2 * (sizeof(float))+
+ DIM3 * (sizeof(double)));
+ if(H5Pset_buffer(xfer_list, size, NULL, NULL) < 0) goto error;
H5E_BEGIN_TRY {
status = H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, xfer_list, cfrR);
@@ -1038,9 +1175,9 @@ test_conv_buffer(hid_t fid)
}
/* Read will succeed since conversion buffer is big enough */
- size = (DIM1*DIM2*DIM3*(sizeof(int))+ DIM2*(sizeof(float))+
- DIM3*(sizeof(double)));
- if(H5Pset_buffer (xfer_list, size, NULL, NULL) < 0) goto error;
+ size = (DIM1 * DIM2 * DIM3 * (sizeof(int))+ DIM2 * (sizeof(float))+
+ DIM3 * (sizeof(double)));
+ if(H5Pset_buffer(xfer_list, size, NULL, NULL) < 0) goto error;
if(H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, xfer_list, cfrR) < 0) goto error;
@@ -1186,13 +1323,15 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{
*
*-------------------------------------------------------------------------
*/
-static herr_t
+static htri_t
can_apply_bogus(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id)
{
if(H5Tequal(type_id,H5T_NATIVE_DOUBLE))
return 0;
- else
+ else if(H5Tequal(type_id,H5T_NATIVE_INT))
return 1;
+ else
+ return -1;
}
@@ -1332,6 +1471,31 @@ filter_bogus2(unsigned int flags, size_t cd_nelmts,
return(nbytes);
}
+
+/*-------------------------------------------------------------------------
+ * Function: filter_bogus3
+ *
+ * Purpose: A bogus compression method that returns a failure.
+ *
+ * Return: Success: Data chunk size
+ *
+ * Failure: 0
+ *
+ * Programmer: Raymond Lu
+ * 4 August 2010
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+filter_bogus3(unsigned int UNUSED flags, size_t UNUSED cd_nelmts,
+ const unsigned int UNUSED *cd_values, size_t UNUSED nbytes,
+ size_t UNUSED *buf_size, void UNUSED **buf)
+{
+ return 0;
+}
+
/* This message derives from H5Z */
const H5Z_class2_t H5Z_CORRUPT[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
@@ -2426,7 +2590,7 @@ test_missing_filter(hid_t file)
} /* end if */
/* Query the dataset's size on disk */
- if((dset_size=H5Dget_storage_size(dsid))==0) {
+ if(0 == (dset_size = H5Dget_storage_size(dsid))) {
H5_FAILED();
printf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size);
goto error;
@@ -2434,7 +2598,7 @@ test_missing_filter(hid_t file)
/* Verify that the size indicates data is uncompressed */
/* (i.e. the deflation filter we asked for was silently ignored) */
- if((H5Tget_size(H5T_NATIVE_INT)*DSET_DIM1*DSET_DIM2)!=dset_size) {
+ if((H5Tget_size(H5T_NATIVE_INT) * DSET_DIM1 * DSET_DIM2) != dset_size) {
H5_FAILED();
printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size);
goto error;
@@ -3305,11 +3469,6 @@ test_nbit_compound(hid_t file)
if(H5Tinsert(mem_cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
if(H5Tinsert(mem_cmpd_tid, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0) goto error;
- /* Set order of dataset compound member datatype */
- if(H5Tset_order(i_tid, H5T_ORDER_BE) < 0) goto error;
- if(H5Tset_order(c_tid, H5T_ORDER_BE) < 0) goto error;
- if(H5Tset_order(s_tid, H5T_ORDER_BE) < 0) goto error;
-
/* Create a dataset compound datatype and insert some atomic types */
cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
if(H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
@@ -3317,6 +3476,9 @@ test_nbit_compound(hid_t file)
if(H5Tinsert(cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
if(H5Tinsert(cmpd_tid, "f", HOFFSET(atomic, f), f_tid) < 0) goto error;
+ /* Set order of dataset compound datatype */
+ if(H5Tset_order(cmpd_tid, H5T_ORDER_BE) < 0) goto error;
+
/* Create the data space */
if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
@@ -3521,11 +3683,6 @@ test_nbit_compound_2(hid_t file)
if(H5Tinsert(mem_cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
if(H5Tinsert(mem_cmpd_tid1, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0) goto error;
- /* Set order of dataset atomic compound member datatype */
- if(H5Tset_order(i_tid, H5T_ORDER_BE) < 0) goto error;
- if(H5Tset_order(c_tid, H5T_ORDER_BE) < 0) goto error;
- if(H5Tset_order(s_tid, H5T_ORDER_BE) < 0) goto error;
-
/* Create a dataset atomic compound datatype and insert some atomic types */
cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
if(H5Tinsert(cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
@@ -3533,6 +3690,9 @@ test_nbit_compound_2(hid_t file)
if(H5Tinsert(cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
if(H5Tinsert(cmpd_tid1, "f", HOFFSET(atomic, f), f_tid) < 0) goto error;
+ /* Set order of dataset compound datatype */
+ if(H5Tset_order(cmpd_tid1, H5T_ORDER_BE) < 0) goto error;
+
/* Set precision and offset of the other data member */
if(H5Tset_precision(v_tid,precision[3]) < 0) goto error;
if(H5Tset_offset(v_tid,offset[3]) < 0) goto error;
@@ -3806,6 +3966,7 @@ test_nbit_compound_3(hid_t file)
/* Initialize data */
for(i = 0; i < (size_t)size[0]; i++) {
+ HDmemset(&orig_data[i], 0, sizeof(orig_data[i]));
orig_data[i].i = HDrandom() % (long)HDpow(2.0, 17.0 - 1.0);
HDstrcpy(orig_data[i].str, "fixed-length C string");
orig_data[i].vl_str = HDstrdup("variable-length C string");
@@ -4938,7 +5099,9 @@ const H5Z_class2_t H5Z_CAN_APPLY_TEST[1] = {{
* Function: test_can_apply
*
* Purpose: Tests library behavior when filter indicates it can't
- * apply to certain combinations of creation parameters
+ * apply to certain combinations of creation parameters.
+ * The filter is mandate. If the CAN_APPLY callback function
+ * indicates wrong datatype, the dataset creation should fail.
*
* Return: Success: 0
* Failure: -1
@@ -4977,6 +5140,7 @@ test_can_apply(hid_t file)
printf(" Line %d: Can't register 'can apply' filter\n",__LINE__);
goto error;
}
+ /* The filter is mandate. */
if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST, 0, (size_t)0, NULL) < 0) {
H5_FAILED();
printf(" Line %d: Can't set bogus filter\n",__LINE__);
@@ -4991,7 +5155,8 @@ test_can_apply(hid_t file)
} /* end if */
/* Create new dataset */
- /* (Should fail because the 'can apply' filter should indicate inappropriate combination) */
+ /* (Should fail because the 'can apply' function should indicate inappropriate
+ * combination. And the filter is mandate.) */
H5E_BEGIN_TRY {
dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
} H5E_END_TRY;
@@ -5002,6 +5167,17 @@ test_can_apply(hid_t file)
goto error;
} /* end if */
+ /* (Should fail because the 'can apply' function should fail) */
+ H5E_BEGIN_TRY {
+ dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(dsid >=0) {
+ H5_FAILED();
+ printf(" Line %d: Shouldn't have created dataset!\n",__LINE__);
+ H5Dclose(dsid);
+ goto error;
+ } /* end if */
+
/* Create new dataset */
if((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
H5_FAILED();
@@ -5088,6 +5264,166 @@ error:
return -1;
} /* end test_can_apply() */
+/* This message derives from H5Z */
+const H5Z_class2_t H5Z_CAN_APPLY_TEST2[1] = {{
+ H5Z_CLASS_T_VERS,
+ H5Z_FILTER_CAN_APPLY_TEST2, /* Filter id number */
+ 1, 1,
+ "can_apply_test", /* Filter name for debugging */
+ can_apply_bogus, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ filter_bogus3, /* The actual filter function */
+}};
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_can_apply2
+ *
+ * Purpose: Tests library behavior when an optional filter indicates
+ * it can't apply to certain combinations of creation
+ * parameters. The filter function FILTER_BOGUS3 does nothing
+ * than returning a failure. Because the filter is optional,
+ * the library skips the filter even though the CAN_APPLY_BOGUS
+ * indicates the datatype DOUBLE can't apply to the dataset.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * 4 August 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_can_apply2(hid_t file)
+{
+ hid_t dsid; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t dcpl; /* Dataspace creation property list ID */
+ const hsize_t dims[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
+ const hsize_t chunk_dims[2] = {2, 25}; /* Chunk dimensions */
+ hsize_t dset_size; /* Dataset size */
+ size_t i,j; /* Local index variables */
+
+ TESTING("dataset filter 'can apply' callback second");
+
+ /* Create dcpl with special filter */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't create dcpl\n",__LINE__);
+ goto error;
+ } /* end if */
+ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't set chunk sizes\n",__LINE__);
+ goto error;
+ } /* end if */
+ if(H5Zregister (H5Z_CAN_APPLY_TEST2) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't register 'can apply' filter\n",__LINE__);
+ goto error;
+ }
+ /* The filter is optional. */
+ if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST2, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't set bogus filter\n",__LINE__);
+ goto error;
+ }
+
+ /* Create the data space */
+ if((sid = H5Screate_simple(2, dims, NULL)) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't open dataspace\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Create new dataset */
+ if((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME2, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't create dataset\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Write data */
+ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Error writing dataset data\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Flush the file (to clear the cache) */
+ if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Error flushing file\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Query the dataset's size on disk */
+ if((dset_size=H5Dget_storage_size(dsid))==0) {
+ H5_FAILED();
+ printf(" Line %d: Error querying dataset size\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Verify that the size indicates data is uncompressed */
+ if((H5Tget_size(H5T_NATIVE_DOUBLE)*dims[0]*dims[1])!=dset_size) {
+ H5_FAILED();
+ printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size);
+ goto error;
+ } /* end if */
+
+ /* Read data */
+ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Error reading dataset data\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Compare data */
+ /* Check that the values read are the same as the values written */
+ for(i=0; i<(size_t)dims[0]; i++) {
+ for(j=0; j<(size_t)dims[1]; j++) {
+ if(points[i][j] != check[i][j]) {
+ H5_FAILED();
+ printf(" Line %d: Read different values than written.\n",__LINE__);
+ printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
+ printf(" At original: %d\n",points[i][j]);
+ printf(" At returned: %d\n",check[i][j]);
+ goto error;
+ } /* end if */
+ } /* end for */
+ } /* end for */
+
+ /* Close dataset */
+ if(H5Dclose(dsid) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't close dataset\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Close dataspace */
+ if(H5Sclose(sid) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't close dataspace\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Close dataset creation property list */
+ if(H5Pclose(dcpl) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't close dcpl\n",__LINE__);
+ goto error;
+ } /* end if */
+
+
+ PASSED();
+ return 0;
+
+error:
+ return -1;
+} /* end test_can_apply2() */
+
+
/*-------------------------------------------------------------------------
* Function: test_can_apply_szip
@@ -5707,7 +6043,7 @@ test_copy_dcpl(hid_t file, hid_t fapl)
* until the data is written to it. */
if(H5Pset_layout(dcpl, H5D_CONTIGUOUS) < 0) TEST_ERROR
if(H5Premove_filter(dcpl, H5Z_FILTER_FLETCHER32) < 0) TEST_ERROR
- if(H5Pset_external(dcpl, COPY_DCPL_EXTFILE_NAME, 0, 500*4096*sizeof(int)) < 0) TEST_ERROR
+ if(H5Pset_external(dcpl, COPY_DCPL_EXTFILE_NAME, (off_t)0, (hsize_t)(500 * 4096 * sizeof(int))) < 0) TEST_ERROR
/* Create second dataset of contiguous layout with external storage */
if((dsid2 = H5Dcreate2(file, DSET_COPY_DCPL_NAME_2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl,
@@ -5845,7 +6181,7 @@ test_filter_delete(hid_t file)
/* try to get the info for the deflate filter */
H5E_BEGIN_TRY {
- ret=H5Pget_filter_by_id2(dcpl1,H5Z_FILTER_DEFLATE,&flags,NULL,NULL,0,NULL,NULL);
+ ret = H5Pget_filter_by_id2(dcpl1, H5Z_FILTER_DEFLATE, &flags, NULL, NULL, (size_t)0, NULL, NULL);
} H5E_END_TRY;
if(ret >=0) {
H5_FAILED();
@@ -6075,8 +6411,6 @@ error:
* Programmer: Quincey Koziol
* Tuesday, July 27, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -6084,19 +6418,41 @@ test_zero_dims(hid_t file)
{
hid_t s=-1, d=-1, dcpl=-1;
hsize_t dsize=0, dmax=H5S_UNLIMITED, csize=5;
+ herr_t ret;
TESTING("I/O on datasets with zero-sized dims");
- if((s = H5Screate_simple(1, &dsize, &dmax)) < 0) TEST_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if(H5Pset_chunk(dcpl, 1, &csize) < 0) TEST_ERROR;
- if((d = H5Dcreate2(file, ZERODIM_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if((s = H5Screate_simple(1, &dsize, &dmax)) < 0) FAIL_STACK_ERROR
+
+ /* Try creating chunked dataset with zero-sized chunk dimensions */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if(H5Pset_layout(dcpl, H5D_CHUNKED) < 0) FAIL_STACK_ERROR
+ H5E_BEGIN_TRY {
+ d = H5Dcreate2(file, ZERODIM_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(d > 0) {
+ H5Dclose(d);
+ FAIL_PUTS_ERROR("created dataset with undefined chunk dimensions")
+ } /* end if */
- if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911) < 0) TEST_ERROR;
+ H5E_BEGIN_TRY {
+ ret = H5Pset_chunk(dcpl, 1, &dsize);
+ } H5E_END_TRY;
+ if(ret > 0)
+ FAIL_PUTS_ERROR("set zero-sized chunk dimensions")
- if(H5Pclose(dcpl) < 0) TEST_ERROR;
- if(H5Sclose(s) < 0) TEST_ERROR;
- if(H5Dclose(d) < 0) TEST_ERROR;
+ if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if(H5Pset_chunk(dcpl, 1, &csize) < 0) FAIL_STACK_ERROR
+ if((d = H5Dcreate2(file, ZERODIM_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR
+
+ if(H5Dclose(d) < 0) FAIL_STACK_ERROR
+ if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+
+ if(H5Sclose(s) < 0) FAIL_STACK_ERROR
PASSED();
return 0;
@@ -6209,7 +6565,7 @@ error:
H5Sclose(s);
} H5E_END_TRY;
return -1;
-} /* end test_zero_dims() */
+} /* end test_missing_chunk() */
/*-------------------------------------------------------------------------
@@ -6291,7 +6647,7 @@ test_random_chunks(hid_t fapl)
if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for writing */
- if(H5Sselect_elements(s, H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if(H5Sselect_elements(s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
/* Write into dataset */
if(H5Dwrite(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
@@ -6316,7 +6672,7 @@ test_random_chunks(hid_t fapl)
if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for reading */
- if(H5Sselect_elements (s, H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if(H5Sselect_elements (s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
/* Read from dataset */
if(H5Dread(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
@@ -6381,7 +6737,7 @@ test_random_chunks(hid_t fapl)
if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for writing */
- if(H5Sselect_elements(s, H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if(H5Sselect_elements(s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
/* Write into dataset */
if(H5Dwrite(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
@@ -6406,7 +6762,7 @@ test_random_chunks(hid_t fapl)
if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for reading */
- if(H5Sselect_elements (s, H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if(H5Sselect_elements (s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
/* Read from dataset */
if(H5Dread(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
@@ -6440,7 +6796,7 @@ error:
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Empty can_apply and set_local callbacks */
-static herr_t
+static htri_t
can_apply_deprec(hid_t UNUSED dcpl_id, hid_t UNUSED type_id, hid_t UNUSED space_id)
{
return 1;
@@ -6812,7 +7168,7 @@ test_chunk_cache(hid_t fapl)
FAIL_PUTS_ERROR(" Cache values from default dapl do not match those from fapl.")
/* Set a lapl property on dapl1 (to verify inheritance) */
- if (H5Pset_nlinks(dapl1, 134) < 0) FAIL_STACK_ERROR
+ if (H5Pset_nlinks(dapl1, (size_t)134) < 0) FAIL_STACK_ERROR
if (H5Pget_nlinks(dapl1, &nlinks) < 0) FAIL_STACK_ERROR
if (nlinks != 134)
FAIL_PUTS_ERROR(" nlinks parameter not set properly on dapl.")
@@ -8677,6 +9033,7 @@ main(void)
nerrors += (test_userblock_offset(envval, my_fapl) < 0 ? 1 : 0);
nerrors += (test_missing_filter(file) < 0 ? 1 : 0);
nerrors += (test_can_apply(file) < 0 ? 1 : 0);
+ nerrors += (test_can_apply2(file) < 0 ? 1 : 0);
nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0);
nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0);
nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0);
@@ -8695,6 +9052,7 @@ main(void)
nerrors += (test_chunk_fast(my_fapl) < 0 ? 1 : 0);
nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0);
nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0);
nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0);
nerrors += (test_idx_compatible() < 0 ? 1 : 0);
nerrors += (test_unfiltered_edge_chunks(my_fapl) < 0 ? 1 : 0);
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 78a05be..8d4b65b 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -290,8 +290,8 @@ static int without_hardware_g = 0;
HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
\
- tmp1 = (unsigned char*)calloc(1, SRC_SIZE); \
- tmp2 = (unsigned char*)calloc(1, SRC_SIZE); \
+ tmp1 = (unsigned char*)calloc((size_t)1, (size_t)SRC_SIZE); \
+ tmp2 = (unsigned char*)calloc((size_t)1, (size_t)SRC_SIZE); \
\
buf_p = BUF; \
saved_p = SAVED; \
@@ -300,9 +300,9 @@ static int without_hardware_g = 0;
*00000111,..., until 11111111.*/ \
memset(tmp1, 0, SRC_SIZE); \
memset(tmp2, 0, SRC_SIZE); \
- H5T_bit_set (tmp2, SRC_PREC-1, 1, TRUE); /*the negative value*/ \
+ H5T_bit_set (tmp2, SRC_PREC-1, (size_t)1, TRUE); /*the negative value*/ \
for(n=0; n<SRC_MANT_DIG-1; n++) { \
- H5T_bit_set (tmp1, n, 1, TRUE); /*turn on 1 bit each time*/ \
+ H5T_bit_set (tmp1, n, (size_t)1, TRUE); /*turn on 1 bit each time*/ \
CHANGE_ORDER(tmp1, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
memcpy(buf_p, tmp1, SRC_SIZE); \
memcpy(saved_p, tmp1, SRC_SIZE); \
@@ -311,7 +311,7 @@ static int without_hardware_g = 0;
saved_p += SRC_SIZE; \
\
/*negative values*/ \
- H5T_bit_set (tmp2, n, 1, TRUE); \
+ H5T_bit_set (tmp2, n, (size_t)1, TRUE); \
CHANGE_ORDER(tmp2, SRC_ORDR, SRC_SIZE); \
memcpy(buf_p, tmp2, SRC_SIZE); \
memcpy(saved_p, tmp2, SRC_SIZE); \
@@ -347,7 +347,7 @@ static int without_hardware_g = 0;
buf_p = BUF; \
\
/* +0 */ \
- H5T_bit_set(value, 0, SRC_PREC, FALSE); \
+ H5T_bit_set(value, (size_t)0, SRC_PREC, FALSE); \
memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
buf_p += SRC_SIZE; \
\
@@ -355,36 +355,36 @@ static int without_hardware_g = 0;
if(n==1) { \
memset(value, 0, SRC_SIZE*sizeof(unsigned char)); \
/* -0 */ \
- H5T_bit_set(value, SRC_PREC-1, 1, TRUE); \
+ H5T_bit_set(value, (size_t)(SRC_PREC - 1), (size_t)1, TRUE); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE);/*change order for big endian*/ \
- memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
+ HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE);/*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
} \
\
/* +/-infinity */ \
- H5T_bit_set(value, SRC_MANT_DIG-1, SRC_PREC-SRC_MANT_DIG, TRUE); \
+ H5T_bit_set(value, (size_t)(SRC_MANT_DIG - 1), SRC_PREC-SRC_MANT_DIG, TRUE); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
+ HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
\
/* +/-SNaN */ \
- H5T_bit_set(value, 0, 1, TRUE); \
+ H5T_bit_set(value, (size_t)0, (size_t)1, TRUE); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
+ HDmemcpy(buf_p, value, SRC_SIZE * sizeof(unsigned char)); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
\
/* +/-QNaN */ \
- H5T_bit_set(value, SRC_MANT_DIG-2, 1, TRUE); \
+ H5T_bit_set(value, (size_t)(SRC_MANT_DIG - 2), (size_t)1, TRUE); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
+ HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
} \
\
- memcpy(SAVED, BUF, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
+ HDmemcpy(SAVED, BUF, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
free(value); \
}
@@ -565,7 +565,7 @@ generates_sigfpe(void)
HDfflush(stdout);
HDfflush(stderr);
- if ((pid=fork())<0) {
+ if ((pid=fork()) < 0) {
HDperror("fork");
HDexit(1);
} else if (0==pid) {
@@ -735,7 +735,7 @@ static int test_particular_fp_integer(void)
TESTING("hard particular floating number -> integer conversions");
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
printf("Can't create data transfer property list\n");
goto error;
@@ -745,22 +745,22 @@ static int test_particular_fp_integer(void)
endian = H5Tget_order(H5T_NATIVE_DOUBLE);
src_size1 = H5Tget_size(H5T_NATIVE_DOUBLE);
dst_size1 = H5Tget_size(H5T_NATIVE_SCHAR);
- buf1 = (unsigned char*)calloc(1, MAX(src_size1, dst_size1));
- saved_buf1 = (unsigned char*)calloc(1, MAX(src_size1, dst_size1));
+ buf1 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
+ saved_buf1 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
memcpy(buf1, &src_d, src_size1);
memcpy(saved_buf1, &src_d, src_size1);
/* Register exception handling function and signal the destination is "signed char". */
flag = 1;
- if(H5Pset_type_conv_cb(dxpl_id, expt_handle, &flag)<0) {
+ if(H5Pset_type_conv_cb(dxpl_id, expt_handle, &flag) < 0) {
H5_FAILED();
printf("Can't register conversion callback\n");
goto error;
}
/* Do conversion */
- if(H5Tconvert(H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR, 1, buf1, NULL, dxpl_id)<0) {
+ if(H5Tconvert(H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR, (size_t)1, buf1, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
@@ -795,16 +795,16 @@ static int test_particular_fp_integer(void)
/* Test conversion from float (the value is INT_MAX) to int. */
src_size2 = H5Tget_size(H5T_NATIVE_FLOAT);
dst_size2 = H5Tget_size(H5T_NATIVE_INT);
- buf2 = (unsigned char*)calloc(1, MAX(src_size2, dst_size2));
- saved_buf2 = (unsigned char*)calloc(1, MAX(src_size2, dst_size2));
- memcpy(buf2, &src_f, src_size2);
- memcpy(saved_buf2, &src_f, src_size2);
+ buf2 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size2, dst_size2));
+ saved_buf2 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size2, dst_size2));
+ HDmemcpy(buf2, &src_f, src_size2);
+ HDmemcpy(saved_buf2, &src_f, src_size2);
/* signal exception handling function that the destination is "int". */
flag = 0;
/* Do conversion */
- if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, 1, buf2, NULL, dxpl_id)<0) {
+ if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)1, buf2, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
@@ -839,7 +839,7 @@ static int test_particular_fp_integer(void)
if(fails_this_test)
goto error;
- if(H5Pclose(dxpl_id)<0) {
+ if(H5Pclose(dxpl_id) < 0) {
H5_FAILED();
printf("Can't close property list\n");
goto error;
@@ -913,25 +913,25 @@ test_derived_flt(void)
/* Create File */
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) {
+ if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
printf("Can't create file\n");
goto error;
}
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
printf("Can't create data transfer property list\n");
goto error;
}
- if((tid1 = H5Tcopy(H5T_IEEE_F64LE))<0) {
+ if((tid1 = H5Tcopy(H5T_IEEE_F64LE)) < 0) {
H5_FAILED();
printf("Can't copy data type\n");
goto error;
}
- if((tid2 = H5Tcopy(H5T_IEEE_F32LE))<0) {
+ if((tid2 = H5Tcopy(H5T_IEEE_F32LE)) < 0) {
H5_FAILED();
printf("Can't copy data type\n");
goto error;
@@ -955,28 +955,28 @@ test_derived_flt(void)
* holes among the significant bits. Exponent bias usually is set
* 2^(n-1)-1, where n is the exponent size.
*-----------------------------------------------------------------------*/
- if(H5Tset_fields(tid1, 44, 34, 10, 3, 31)<0) {
+ if(H5Tset_fields(tid1, (size_t)44, (size_t)34, (size_t)10, (size_t)3, (size_t)31) < 0) {
H5_FAILED();
printf("Can't set fields\n");
goto error;
}
- if(H5Tset_offset(tid1, 3)<0) {
+ if(H5Tset_offset(tid1, (size_t)3) < 0) {
H5_FAILED();
printf("Can't set offset\n");
goto error;
}
- if(H5Tset_precision(tid1, 42)<0) {
+ if(H5Tset_precision(tid1, (size_t)42) < 0) {
H5_FAILED();
printf("Can't set precision 1\n");
goto error;
}
- if(H5Tset_size(tid1, 7)<0) {
+ if(H5Tset_size(tid1, (size_t)7) < 0) {
H5_FAILED();
printf("Can't set size\n");
goto error;
}
- if(H5Tset_ebias(tid1, 511) < 0) {
+ if(H5Tset_ebias(tid1, (size_t)511) < 0) {
H5_FAILED();
printf("Can't set exponent bias\n");
goto error;
@@ -1038,24 +1038,24 @@ test_derived_flt(void)
*/
src_size = H5Tget_size(H5T_NATIVE_INT);
endian = H5Tget_order(H5T_NATIVE_INT);
- buf = (unsigned char*)malloc(nelmts*(MAX(src_size, size)));
- saved_buf = (unsigned char*)malloc(nelmts*src_size);
- HDmemset(buf, 0, nelmts*MAX(src_size, size));
- HDmemset(saved_buf, 0, nelmts*src_size);
- aligned = (int*)calloc(1, src_size);
+ buf = (unsigned char*)malloc(nelmts * (MAX(src_size, size)));
+ saved_buf = (unsigned char*)malloc(nelmts * src_size);
+ HDmemset(buf, 0, nelmts * MAX(src_size, size));
+ HDmemset(saved_buf, 0, nelmts * src_size);
+ aligned = (int*)calloc((size_t)1, src_size);
- for(i=0; i<nelmts*src_size; i++)
+ for(i = 0; i < nelmts * src_size; i++)
buf[i] = saved_buf[i] = HDrand();
/* Convert data from native integer to derived floating-point type.
* The mantissa is big enough to retain the integer's precision. */
- if(H5Tconvert(H5T_NATIVE_INT, tid1, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(H5T_NATIVE_INT, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
}
/* Convert data from the derived floating-point type back to native integer. */
- if(H5Tconvert(tid1, H5T_NATIVE_INT, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(tid1, H5T_NATIVE_INT, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
@@ -1115,27 +1115,27 @@ test_derived_flt(void)
* 2 1 0
* SEEEEEEE MMMMMMMM MMMMMMMM
*--------------------------------------------------------------------------*/
- if(H5Tset_fields(tid2, 23, 16, 7, 0, 16)<0) {
+ if(H5Tset_fields(tid2, (size_t)23, (size_t)16, (size_t)7, (size_t)0, (size_t)16) < 0) {
H5_FAILED();
printf("Can't set fields\n");
goto error;
}
- if(H5Tset_offset(tid2, 0)<0) {
+ if(H5Tset_offset(tid2, (size_t)0) < 0) {
H5_FAILED();
printf("Can't set offset\n");
goto error;
}
- if(H5Tset_precision(tid2, 24)<0) {
+ if(H5Tset_precision(tid2, (size_t)24) < 0) {
H5_FAILED();
printf("Can't set precision 2\n");
goto error;
}
- if(H5Tset_size(tid2, 3)<0) {
+ if(H5Tset_size(tid2, (size_t)3) < 0) {
H5_FAILED();
printf("Can't set size\n");
goto error;
}
- if(H5Tset_ebias(tid2, 63) < 0) {
+ if(H5Tset_ebias(tid2, (size_t)63) < 0) {
H5_FAILED();
printf("Can't set size\n");
goto error;
@@ -1209,13 +1209,13 @@ test_derived_flt(void)
/* Convert data from the 2nd to the 1st derived floating-point type.
* The mantissa and exponent of the 2nd type are big enough to retain
* the precision and exponent power. */
- if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
}
/* Convert data from the 1st back to the 2nd derived floating-point type. */
- if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
@@ -1265,25 +1265,25 @@ test_derived_flt(void)
if (buf) free(buf);
if (saved_buf) free(saved_buf);
- if(H5Tclose(tid1)<0) {
+ if(H5Tclose(tid1) < 0) {
H5_FAILED();
printf("Can't close datatype\n");
goto error;
}
- if(H5Tclose(tid2)<0) {
+ if(H5Tclose(tid2) < 0) {
H5_FAILED();
printf("Can't close datatype\n");
goto error;
}
- if(H5Pclose(dxpl_id)<0) {
+ if(H5Pclose(dxpl_id) < 0) {
H5_FAILED();
printf("Can't close property list\n");
goto error;
}
- if(H5Fclose(file)<0) {
+ if(H5Fclose(file) < 0) {
H5_FAILED();
printf("Can't close file\n");
goto error;
@@ -1345,25 +1345,25 @@ test_derived_integer(void)
/* Create File */
h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) {
+ if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
printf("Can't create file\n");
goto error;
}
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
printf("Can't create data transfer property list\n");
goto error;
}
- if((tid1 = H5Tcopy(H5T_STD_I32LE))<0) {
+ if((tid1 = H5Tcopy(H5T_STD_I32LE)) < 0) {
H5_FAILED();
printf("Can't copy data type\n");
goto error;
}
- if((tid2 = H5Tcopy(H5T_STD_U64LE))<0) {
+ if((tid2 = H5Tcopy(H5T_STD_U64LE)) < 0) {
H5_FAILED();
printf("Can't copy data type\n");
goto error;
@@ -1381,19 +1381,19 @@ test_derived_integer(void)
* of a new integer type, H5Tset_precision, H5Tset_offset, H5Tset_size,
* H5Tset_order, H5Tset_pad, H5Tset_sign.
*--------------------------------------------------------------------------*/
- if(H5Tset_offset(tid1,0)<0) {
+ if(H5Tset_offset(tid1, (size_t)0) < 0) {
H5_FAILED();
printf("Can't set offset\n");
goto error;
}
- if(H5Tset_size(tid1, 3)<0) {
+ if(H5Tset_size(tid1, (size_t)3) < 0) {
H5_FAILED();
printf("Can't set size\n");
goto error;
}
- if(H5Tset_precision(tid1, 24) < 0) {
+ if(H5Tset_precision(tid1, (size_t)24) < 0) {
H5_FAILED();
printf("Can't set precision\n");
goto error;
@@ -1448,13 +1448,13 @@ test_derived_integer(void)
* 7 6 5 4 3 2 1 0
* ??????SI IIIIIIII IIIIIIII IIIIIIII IIIIIIII IIIIIIII IIIIII?? ????????
*--------------------------------------------------------------------------*/
- if(H5Tset_precision(tid2,48)<0) {
+ if(H5Tset_precision(tid2, (size_t)48) < 0) {
H5_FAILED();
printf("Can't set precision\n");
goto error;
}
- if(H5Tset_offset(tid2, 10) < 0) {
+ if(H5Tset_offset(tid2, (size_t)10) < 0) {
H5_FAILED();
printf("Can't set offset\n");
goto error;
@@ -1519,13 +1519,13 @@ test_derived_integer(void)
/* Convert data from the 1st to the 2nd derived integer type.
* The precision of the 2nd type are big enough to retain
* the 1st type's precision. */
- if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
}
/* Convert data from the 2nd back to the 1st derived integer type. */
- if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
@@ -1564,30 +1564,33 @@ test_derived_integer(void)
}
}
- if(H5Tclose(tid1)<0) {
+ if(H5Tclose(tid1) < 0) {
H5_FAILED();
printf("Can't close datatype\n");
goto error;
}
- if(H5Tclose(tid2)<0) {
+ if(H5Tclose(tid2) < 0) {
H5_FAILED();
printf("Can't close datatype\n");
goto error;
}
- if(H5Pclose(dxpl_id)<0) {
+ if(H5Pclose(dxpl_id) < 0) {
H5_FAILED();
printf("Can't close property list\n");
goto error;
}
- if(H5Fclose(file)<0) {
+ if(H5Fclose(file) < 0) {
H5_FAILED();
printf("Can't close file\n");
goto error;
} /* end if */
+ free(buf);
+ free(saved_buf);
+
PASSED();
reset_hdf5(); /*print statistics*/
@@ -1761,7 +1764,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
dst_nbits = H5Tget_precision(dst); /* not 8*dst_size, esp on J90 - QAK */
src_sign = H5Tget_sign(src);
dst_sign = H5Tget_sign(dst);
- aligned = HDcalloc(1, sizeof(long long));
+ aligned = HDcalloc((size_t)1, sizeof(long long));
/* Allocate and initialize the source buffer through macro INIT_INTEGER. The BUF
* will be used for the conversion while the SAVED buffer will be
@@ -1791,7 +1794,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
goto error;
/* Perform the conversion */
- if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT)<0)
+ if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT) < 0)
goto error;
/* Check the results from the library against hardware */
@@ -1839,6 +1842,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_char = (signed char)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -1885,6 +1892,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_uchar = (unsigned char)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -1932,6 +1943,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw_short = (short)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -1978,6 +1993,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_ushort = (unsigned short)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2024,6 +2043,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_int = (int)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2070,6 +2093,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_uint = (unsigned int)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2116,6 +2143,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_long = (long int)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2162,6 +2193,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_ulong = (unsigned long)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2208,6 +2243,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_llong = (long long)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2254,6 +2293,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_ullong = (unsigned long long)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2288,7 +2331,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
*/
if (H5T_SGN_2==src_sign && H5T_SGN_2==dst_sign) {
if (src_nbits>dst_nbits) {
- if(0==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
+ if(0==H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1) &&
H5T_bit_find(src_bits, dst_nbits-1, (src_nbits-dst_nbits),
H5T_BIT_MSB, 1)>=0) {
/*
@@ -2296,49 +2339,49 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
* the destination. The destination should be set to the
* maximum possible value: 0x7f...f
*/
- if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
- H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB, 0)<0)
+ if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
- } else if (1==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
- H5T_bit_find(src_bits, 0, src_nbits-1, H5T_BIT_MSB,
+ } else if (1==H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1) &&
+ H5T_bit_find(src_bits, (size_t)0, src_nbits-1, H5T_BIT_MSB,
0)+1>=(ssize_t)dst_nbits) {
/*
* Source is negative but the magnitude is too large for
* the destination. The destination should be set to the
* smallest possible value: 0x80...0
*/
- if (1==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
- H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB, 1)<0)
+ if (1==H5T_bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
}
} else if(src_nbits<dst_nbits) {
/* Source is smaller than the destination */
- if(0==H5T_bit_get_d(src_bits, src_nbits-1, 1)) {
+ if(0==H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1)) {
/*
* Source is positive, so the excess bits in the
* destination should be set to 0's.
*/
- if (0==H5T_bit_get_d(dst_bits, src_nbits-1, 1) &&
- H5T_bit_find(dst_bits, src_nbits, dst_nbits-src_nbits, H5T_BIT_LSB, 1)<0)
+ if (0==H5T_bit_get_d(dst_bits, src_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, src_nbits, dst_nbits-src_nbits, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
} else {
/*
* Source is negative, so the excess bits in the
* destination should be set to 1's.
*/
- if (1==H5T_bit_get_d(dst_bits, src_nbits-1, 1) &&
- H5T_bit_find(dst_bits, src_nbits, dst_nbits-src_nbits, H5T_BIT_LSB, 0)<0)
+ if (1==H5T_bit_get_d(dst_bits, src_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, src_nbits, dst_nbits-src_nbits, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
}
}
} else if (H5T_SGN_2==src_sign && H5T_SGN_NONE==dst_sign) {
- if (H5T_bit_get_d(src_bits, src_nbits-1, 1)) {
+ if (H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1)) {
/*
* The source is negative so the result should be zero.
* The source is negative if the most significant bit is
* set. The destination is zero if all bits are zero.
*/
- if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 1)<0)
+ if (H5T_bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
} else if (src_nbits>dst_nbits &&
H5T_bit_find(src_bits, dst_nbits-1,
@@ -2348,7 +2391,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
* the destination. The destination should be the
* largest possible value: 0xff...f
*/
- if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 0)<0)
+ if (H5T_bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
}
} else if (H5T_SGN_NONE==src_sign && H5T_SGN_2==dst_sign) {
@@ -2360,8 +2403,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
* the destination can handle. The destination should be
* set to the largest possible positive value: 0x7f...f
*/
- if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
- H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB, 0)<0)
+ if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
}
} else {
@@ -2373,7 +2416,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
* the unsigned destination. The destination should be
* set to the largest possible value: 0xff...f
*/
- if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 0)<0)
+ if (H5T_bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
}
}
@@ -2428,6 +2471,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2477,6 +2524,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, buf+j*sizeof(long long), sizeof(unsigned long long));
HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2516,6 +2567,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
case INT_ULLONG:
HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)hw));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2589,7 +2644,7 @@ test_conv_int_2(void)
* Conversion. If overlap calculations aren't right then an
* assertion will fail in H5T_conv_i_i()
*/
- H5Tconvert(src_type, dst_type, 100, buf, NULL, H5P_DEFAULT);
+ H5Tconvert(src_type, dst_type, (size_t)100, buf, NULL, H5P_DEFAULT);
H5Tclose(src_type);
H5Tclose(dst_type);
}
@@ -2707,7 +2762,7 @@ my_isinf(int endian, unsigned char *val, size_t size,
int retval = 0;
size_t i;
- bits = (unsigned char*)calloc(1, size);
+ bits = (unsigned char*)calloc((size_t)1, size);
#ifdef H5_VMS
if(H5T_ORDER_VAX==endian) {
@@ -2812,7 +2867,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
*/
HDfflush(stdout);
HDfflush(stderr);
- if ((child_pid=fork())<0) {
+ if ((child_pid=fork()) < 0) {
HDperror("fork");
return 1;
} else if (child_pid>0) {
@@ -2925,7 +2980,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
dendian = H5Tget_order(dst);
/* Allocate buffers */
- aligned = HDcalloc(1, MAX(sizeof(long double), sizeof(double)));
+ aligned = HDcalloc((size_t)1, MAX(sizeof(long double), sizeof(double)));
/* Allocate and initialize the source buffer through macro INIT_FP_NORM or INIT_FP_SPECIAL.
* The BUF will be used for the conversion while the SAVED buffer will be used for
@@ -3017,7 +3072,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
}
/* Perform the conversion in software */
- if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT)<0)
+ if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT) < 0)
goto error;
/* Check the software results against the hardware */
@@ -3647,7 +3702,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
dst_size = H5Tget_size(dst);
src_nbits = H5Tget_precision(src); /* not 8*src_size, esp on J90 - QAK */
dst_nbits = H5Tget_precision(dst); /* not 8*dst_size, esp on J90 - QAK */
- aligned = HDcalloc(1, MAX(sizeof(long double), sizeof(long long)));
+ aligned = HDcalloc((size_t)1, MAX(sizeof(long double), sizeof(long long)));
#ifdef SHOW_OVERFLOWS
noverflows_g = 0;
#endif
@@ -3664,19 +3719,19 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* conversion exception happens. We only test (unsigned) int - float
* and float - (unsigned) int conversions, which should cover more cases.
*/
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0)
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
if((src_type == INT_INT && dst_type == FLT_FLOAT) ||
(src_type == INT_UINT && dst_type == FLT_FLOAT) ||
(src_type == FLT_FLOAT && dst_type == INT_UINT) ||
(src_type == FLT_FLOAT && dst_type == INT_INT)) {
- if(H5Pset_type_conv_cb(dxpl_id, except_func, &fill_value)<0)
+ if(H5Pset_type_conv_cb(dxpl_id, except_func, &fill_value) < 0)
goto error;
else
except_set = TRUE;
- if(H5Pget_type_conv_cb(dxpl_id, &op, &user_data)<0)
+ if(H5Pget_type_conv_cb(dxpl_id, &op, &user_data) < 0)
goto error;
if(op != except_func || *(int*)user_data != fill_value)
@@ -3743,7 +3798,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
goto error;
/* Perform the conversion */
- if (H5Tconvert(src, dst, nelmts, buf, NULL, dxpl_id)<0)
+ if(H5Tconvert(src, dst, nelmts, buf, NULL, dxpl_id) < 0)
goto error;
/* Check the results from the library against hardware */
@@ -3801,6 +3856,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_float = (float)(*((unsigned long long*)aligned));
break;
#endif /* H5_ULLONG_TO_FP_CAST_WORKS */
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -3849,6 +3908,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_double = (double)(*((unsigned long long*)aligned));
break;
#endif /* H5_ULLONG_TO_FP_CAST_WORKS */
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -3898,6 +3961,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_ldouble = (long double)(*((unsigned long long*)aligned));
break;
#endif /* H5_ULLONG_TO_FP_CAST_WORKS */
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -3919,6 +3986,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_schar = (signed char)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -3939,6 +4017,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_uchar = (unsigned char)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -3959,6 +4048,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_short = (short)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -3979,6 +4079,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_ushort = (unsigned short)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -3999,6 +4110,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_int = (int)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4019,6 +4141,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_uint = (unsigned int)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4039,6 +4172,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_long = (long)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4059,6 +4203,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_ulong = (unsigned long)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4079,6 +4234,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_llong = (long long)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4099,6 +4265,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_ullong = (unsigned long long)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4165,7 +4342,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
)
&& (INT_SCHAR==dst_type || INT_SHORT==dst_type || INT_INT==dst_type
|| INT_LONG==dst_type || INT_LLONG==dst_type)) {
- if(0==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
+ if(0==H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1) &&
overflows(src_bits, src, dst_nbits-1)) {
/*
* Source is positive and the magnitude is too large for
@@ -4173,15 +4350,15 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* maximum possible value: 0x7f...f
*/
if(!except_set) {
- if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
- H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB, 0)<0)
+ if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
} else {
/* fill_value is small so we know only the 1st byte is set */
if (dst_bits[0] == fill_value)
continue; /*no error*/
}
- } else if (1==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
+ } else if (1==H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1) &&
overflows(src_bits, src, dst_nbits-1)) {
/*
* Source is negative but the magnitude is too large for
@@ -4189,8 +4366,8 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* smallest possible value: 0x80...0
*/
if(!except_set) {
- if (1==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
- H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB, 1)<0)
+ if (1==H5T_bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
} else {
if (dst_bits[0] == fill_value)
@@ -4206,14 +4383,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
)
&& (INT_UCHAR==dst_type || INT_USHORT==dst_type || INT_UINT==dst_type
|| INT_ULONG==dst_type || INT_ULLONG==dst_type)) {
- if (H5T_bit_get_d(src_bits, src_nbits-1, 1)) {
+ if (H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1)) {
/*
* The source is negative so the result should be zero.
* The source is negative if the most significant bit is
* set. The destination is zero if all bits are zero.
*/
if(!except_set) {
- if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 1)<0)
+ if (H5T_bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
} else {
if (dst_bits[0] == fill_value)
@@ -4226,7 +4403,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* largest possible value: 0xff...f
*/
if(!except_set) {
- if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 0)<0)
+ if (H5T_bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
} else {
if (dst_bits[0] == fill_value)
@@ -4558,8 +4735,8 @@ overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits)
ssize_t indx;
unsigned char bits[32], mant_bits[32];
- HDmemset(bits, 0, 32);
- HDmemset(mant_bits, 0, 32);
+ HDmemset(bits, 0, (size_t)32);
+ HDmemset(mant_bits, 0, (size_t)32);
/*
* Sometimes, type size isn't equal to the precision like Linux's "long
@@ -4574,14 +4751,14 @@ overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits)
HDmemcpy(bits, origin_bits, src_prec/8+1);
/*Check for special cases: +Inf, -Inf*/
- if (H5T_bit_find (bits, mpos, mant_digits, H5T_BIT_LSB, TRUE)<0) {
- if (H5T_bit_find (bits, epos, expt_digits, H5T_BIT_LSB, FALSE)<0) {
+ if (H5T_bit_find (bits, mpos, mant_digits, H5T_BIT_LSB, TRUE) < 0) {
+ if (H5T_bit_find (bits, epos, expt_digits, H5T_BIT_LSB, FALSE) < 0) {
ret_value=TRUE;
goto done;
}
} else if (H5T_NORM_NONE==norm && H5T_bit_find (bits, mpos, mant_digits-1,
- H5T_BIT_LSB, TRUE)<0 && H5T_bit_find (bits, epos, expt_digits,
- H5T_BIT_LSB, FALSE)<0) {
+ H5T_BIT_LSB, TRUE) < 0 && H5T_bit_find (bits, epos, expt_digits,
+ H5T_BIT_LSB, FALSE) < 0) {
/*This is a special case for the source of no implied mantissa bit.
*If the exponent bits are all 1s and only the 1st bit of mantissa
*is set to 1. It's infinity. The Intel-Linux "long double" is this case.*/
@@ -4598,19 +4775,19 @@ overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits)
}
/* get significand */
- H5T_bit_copy (mant_bits, 0, bits, 0, mant_digits);
+ H5T_bit_copy (mant_bits, (size_t)0, bits, (size_t)0, mant_digits);
/* restore implicit bit if normalization is implied*/
if(norm == H5T_NORM_IMPLIED) {
- H5T_bit_inc(mant_bits, mant_digits, 1);
+ H5T_bit_inc(mant_bits, mant_digits, (size_t)1);
mant_digits++;
}
/* shift significand */
- H5T_bit_shift (mant_bits, (ssize_t)(expt-expt_digits), 0, 32*8);
+ H5T_bit_shift (mant_bits, (ssize_t)(expt-expt_digits), (size_t)0, (size_t)(32 * 8));
- indx = H5T_bit_find(mant_bits, 0, 32*8, H5T_BIT_MSB, 1);
+ indx = H5T_bit_find(mant_bits, (size_t)0, (size_t)(32 * 8), H5T_BIT_MSB, 1);
if((size_t)indx>=dst_num_bits)
ret_value=TRUE;
diff --git a/test/dtransform.c b/test/dtransform.c
index 9af1dfb..5d5cefe 100644
--- a/test/dtransform.c
+++ b/test/dtransform.c
@@ -616,7 +616,7 @@ test_getset(const hid_t dxpl_id_c_to_f)
TESTING("H5Pget_data_transform, after resetting transform property")
- if(NULL == (ptrgetTest = (char *)HDcalloc(1, HDstrlen(simple) + 1)))
+ if(NULL == (ptrgetTest = (char *)HDcalloc((size_t)1, HDstrlen(simple) + 1)))
TEST_ERROR
if(H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, HDstrlen(simple) + 1) < 0)
TEST_ERROR
diff --git a/test/dtypes.c b/test/dtypes.c
index 3af2b8a..0a3b6e4 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -25,9 +25,6 @@
#include "h5test.h"
#include "H5Iprivate.h" /* For checking that datatype id's don't leak */
-/* Number of times to run each test */
-#define NTESTS 1
-
/* Number of elements in each test */
#define NTESTELEM 100000
@@ -184,64 +181,64 @@ test_classes(void)
hid_t memb_id; /* Compound member datatype */
H5T_class_t memb_cls;
H5T_class_t tcls;
- unsigned int nmembs, i;
+ int nmembs;
+ unsigned u;
TESTING("H5Tget_class()");
/*-------------------------------------------------------------
* Check class of some atomic types.
*-----------------------------------------------------------*/
- if ((tcls=H5Tget_class(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if (H5T_INTEGER!=tcls) TEST_ERROR
+ if((tcls = H5Tget_class(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if(H5T_INTEGER != tcls) TEST_ERROR
- if ((tcls=H5Tget_class(H5T_NATIVE_DOUBLE)) < 0) TEST_ERROR
- if (H5T_FLOAT!=tcls) TEST_ERROR
+ if((tcls = H5Tget_class(H5T_NATIVE_DOUBLE)) < 0) TEST_ERROR
+ if(H5T_FLOAT != tcls) TEST_ERROR
/* Create a VL datatype of char. It should be a VL, not a string class. */
- if((vlc_id=H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) TEST_ERROR
+ if((vlc_id = H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) TEST_ERROR
/* Make certain that the correct classes can be detected */
- if ((tcls=H5Tget_class(vlc_id)) < 0) TEST_ERROR
- if (H5T_VLEN!=tcls) TEST_ERROR
+ if((tcls = H5Tget_class(vlc_id)) < 0) TEST_ERROR
+ if(H5T_VLEN != tcls) TEST_ERROR
/* Make certain that an incorrect class is not detected */
- if (H5T_STRING==tcls) TEST_ERROR
+ if(H5T_STRING == tcls) TEST_ERROR
/* Create a VL string. It should be a string, not a VL class. */
- if((vls_id=H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
+ if((vls_id = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
if(H5Tset_size(vls_id, H5T_VARIABLE) < 0) TEST_ERROR;
/* Make certain that the correct classes can be detected */
- if ((tcls=H5Tget_class(vls_id)) < 0) TEST_ERROR
- if (H5T_STRING!=tcls) TEST_ERROR
+ if((tcls = H5Tget_class(vls_id)) < 0) TEST_ERROR
+ if(H5T_STRING != tcls) TEST_ERROR
/* Make certain that an incorrect class is not detected */
- if (H5T_VLEN==tcls) TEST_ERROR
+ if(H5T_VLEN == tcls) TEST_ERROR
/*-------------------------------------------------------------
* Check class for member types of compound type.
*-----------------------------------------------------------*/
/* Create a compound datatype and insert some complex types */
- if ((cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct complex))) < 0) TEST_ERROR
- if (H5Tinsert(cmpd_id, "vl_c", HOFFSET(struct complex, vl_c), vlc_id) < 0) TEST_ERROR
- if (H5Tinsert(cmpd_id, "vl_s", HOFFSET(struct complex, vl_s), vls_id) < 0) TEST_ERROR
+ if((cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct complex))) < 0) TEST_ERROR
+ if(H5Tinsert(cmpd_id, "vl_c", HOFFSET(struct complex, vl_c), vlc_id) < 0) TEST_ERROR
+ if(H5Tinsert(cmpd_id, "vl_s", HOFFSET(struct complex, vl_s), vls_id) < 0) TEST_ERROR
- nmembs = H5Tget_nmembers(cmpd_id);
+ if((nmembs = H5Tget_nmembers(cmpd_id)) < 0) TEST_ERROR
- for (i=0;i<nmembs;i++)
- {
+ for(u = 0; u < (unsigned)nmembs; u++) {
/* Get member type ID */
- if((memb_id = H5Tget_member_type(cmpd_id, i)) < 0) TEST_ERROR
+ if((memb_id = H5Tget_member_type(cmpd_id, u)) < 0) TEST_ERROR
/* Get member type class */
- if((memb_cls = H5Tget_member_class (cmpd_id, i)) < 0) TEST_ERROR
+ if((memb_cls = H5Tget_member_class (cmpd_id, u)) < 0) TEST_ERROR
/* Verify member class */
- if(H5Tdetect_class (memb_id, memb_cls) < 0) TEST_ERROR
+ if(H5Tdetect_class(memb_id, memb_cls) < 0) TEST_ERROR
/* Close member type ID */
if(H5Tclose(memb_id) < 0) TEST_ERROR
- }
+ } /* end for */
/* Close datatypes */
if(H5Tclose(cmpd_id) < 0) TEST_ERROR
@@ -588,12 +585,11 @@ test_compound_1(void)
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY {
- order = H5Tget_order(complex_id);
- } H5E_END_TRY;
- if (order>-1) {
- FAIL_PUTS_ERROR("Operation not allowed for this type.");
- } /* end if */
+ /* We started to support this function for compound type in 1.8.6 release. */
+ if((order = H5Tget_order(complex_id)) == H5T_ORDER_ERROR)
+ FAIL_PUTS_ERROR("Can't get order for compound type.");
+ if(order != H5T_ORDER_LE && order != H5T_ORDER_BE)
+ FAIL_PUTS_ERROR("Wrong order for this type.");
H5E_BEGIN_TRY {
sign = H5Tget_sign(complex_id);
@@ -2315,7 +2311,7 @@ test_compound_13(void)
float y;
};
struct s1 data_out, data_in;
- hid_t fileid, grpid, typeid, array1_tid, spaceid, attid;
+ hid_t fileid, grpid, dtypeid, array1_tid, spaceid, attid;
hid_t fapl_id;
hsize_t dims[1] = {COMPOUND13_ARRAY_SIZE + 1};
char filename[1024];
@@ -2324,6 +2320,7 @@ test_compound_13(void)
TESTING("compound datatypes of boundary size with latest format");
/* Create some phony data. */
+ HDmemset(&data_out, 0, sizeof(data_out));
for(u = 0; u < COMPOUND13_ARRAY_SIZE + 1; u++)
data_out.x[u] = u;
data_out.y = 99.99;
@@ -2340,24 +2337,24 @@ test_compound_13(void)
if((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Create a compound type. */
- if((typeid = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) FAIL_STACK_ERROR
+ if((dtypeid = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) FAIL_STACK_ERROR
if((array1_tid = H5Tarray_create2(H5T_NATIVE_UCHAR, 1, dims)) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(typeid, "x", HOFFSET(struct s1, x), array1_tid) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(typeid, "y", HOFFSET(struct s1, y), H5T_NATIVE_FLOAT) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(dtypeid, "x", HOFFSET(struct s1, x), array1_tid) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(dtypeid, "y", HOFFSET(struct s1, y), H5T_NATIVE_FLOAT) < 0) FAIL_STACK_ERROR
/* Create a space. */
if((spaceid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR
/* Create an attribute of this compound type. */
- if((attid = H5Acreate2(grpid, COMPOUND13_ATTR_NAME, typeid, spaceid, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((attid = H5Acreate2(grpid, COMPOUND13_ATTR_NAME, dtypeid, spaceid, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Write some data. */
- if(H5Awrite(attid, typeid, &data_out) < 0) FAIL_STACK_ERROR
+ if(H5Awrite(attid, dtypeid, &data_out) < 0) FAIL_STACK_ERROR
/* Release all resources. */
if(H5Aclose(attid) < 0) FAIL_STACK_ERROR
if(H5Tclose(array1_tid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(typeid) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(dtypeid) < 0) FAIL_STACK_ERROR
if(H5Sclose(spaceid) < 0) FAIL_STACK_ERROR
if(H5Gclose(grpid) < 0) FAIL_STACK_ERROR
if(H5Fclose(fileid) < 0) FAIL_STACK_ERROR
@@ -2367,11 +2364,11 @@ test_compound_13(void)
if((fileid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if((attid = H5Aopen(grpid, COMPOUND13_ATTR_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((typeid = H5Aget_type(attid)) < 0) FAIL_STACK_ERROR
- if(H5Tget_class(typeid) != H5T_COMPOUND) FAIL_STACK_ERROR
- if(HOFFSET(struct s1, x) != H5Tget_member_offset(typeid, 0)) TEST_ERROR
- if(HOFFSET(struct s1, y) != H5Tget_member_offset(typeid, 1)) TEST_ERROR
- if(H5Aread(attid, typeid, &data_in) < 0) FAIL_STACK_ERROR
+ if((dtypeid = H5Aget_type(attid)) < 0) FAIL_STACK_ERROR
+ if(H5Tget_class(dtypeid) != H5T_COMPOUND) FAIL_STACK_ERROR
+ if(HOFFSET(struct s1, x) != H5Tget_member_offset(dtypeid, 0)) TEST_ERROR
+ if(HOFFSET(struct s1, y) != H5Tget_member_offset(dtypeid, 1)) TEST_ERROR
+ if(H5Aread(attid, dtypeid, &data_in) < 0) FAIL_STACK_ERROR
/* Check the data. */
for (u = 0; u < COMPOUND13_ARRAY_SIZE + 1; u++)
@@ -2380,7 +2377,7 @@ test_compound_13(void)
/* Release all resources. */
if(H5Aclose(attid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(typeid) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(dtypeid) < 0) FAIL_STACK_ERROR
if(H5Gclose(grpid) < 0) FAIL_STACK_ERROR
if(H5Fclose(fileid) < 0) FAIL_STACK_ERROR
@@ -4049,7 +4046,7 @@ test_conv_str_2(void)
char *buf = NULL, s[80];
hid_t c_type = -1;
hid_t f_type = -1;
- const size_t nelmts = NTESTELEM, ntests=NTESTS;
+ const size_t nelmts = NTESTELEM;
size_t i, j, nchars;
int ret_value = 1;
@@ -4068,19 +4065,14 @@ test_conv_str_2(void)
} /* end for */
/* Do the conversions */
- for(i = 0; i < ntests; i++) {
- if(ntests > 1)
- sprintf(s, "Testing random string conversion speed (test %d/%d)", (int)(i + 1), (int)ntests);
- else
- sprintf(s, "Testing random string conversion speed");
- printf("%-70s", s);
- HDfflush(stdout);
- if(H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
- goto error;
- if(H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
- goto error;
- PASSED();
- } /* end for */
+ sprintf(s, "Testing random string conversion speed");
+ printf("%-70s", s);
+ HDfflush(stdout);
+ if(H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
+ if(H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
+ PASSED();
ret_value = 0;
@@ -4232,7 +4224,6 @@ static int
test_conv_enum_1(void)
{
const size_t nelmts=NTESTELEM;
- const int ntests=NTESTS;
int i, val, *buf=NULL;
hid_t t1 = -1;
hid_t t2 = -1;
@@ -4257,27 +4248,17 @@ test_conv_enum_1(void)
buf[u] = HDrand() % 26;
/* Conversions */
- for(i = 0; i < ntests; i++) {
- if(ntests > 1)
- sprintf(s, "Testing random enum conversion O(N) (test %d/%d)", i + 1, ntests);
- else
- sprintf(s, "Testing random enum conversion O(N)");
- printf("%-70s", s);
- HDfflush(stdout);
- if(H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
- PASSED();
- } /* end for */
+ sprintf(s, "Testing random enum conversion O(N)");
+ printf("%-70s", s);
+ HDfflush(stdout);
+ if(H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ PASSED();
- for(i = 0; i < ntests; i++) {
- if(ntests > 1)
- sprintf(s, "Testing random enum conversion O(N log N) (test %d/%d)", i + 1, ntests);
- else
- sprintf(s, "Testing random enum conversion O(N log N)");
- printf("%-70s", s);
- HDfflush(stdout);
- if(H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
- PASSED();
- }
+ sprintf(s, "Testing random enum conversion O(N log N)");
+ printf("%-70s", s);
+ HDfflush(stdout);
+ if(H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ PASSED();
ret_value = 0;
@@ -4879,14 +4860,6 @@ opaque_funcs(void)
} /* end if */
H5E_BEGIN_TRY {
- ret=H5Tset_order(type, H5T_ORDER_BE);
- } H5E_END_TRY;
- if (ret>=0) {
- printf("Operation not allowed for this type.\n");
- TEST_ERROR
- } /* end if */
-
- H5E_BEGIN_TRY {
sign = H5Tget_sign(type);
} H5E_END_TRY;
if (sign>-1) {
@@ -5325,7 +5298,7 @@ test_encode(void)
goto error;
} /* end if */
- if(vlstr_buf_size>0)
+ if(vlstr_buf_size > 0)
vlstr_buf = (unsigned char*)HDcalloc((size_t)1, vlstr_buf_size);
if(H5Tencode(tid3, vlstr_buf, &vlstr_buf_size) < 0) {
@@ -5340,6 +5313,7 @@ test_encode(void)
printf("Can't decode VL string type\n");
goto error;
} /* end if */
+ free(vlstr_buf);
/* Verify that the datatype was copied exactly */
if(H5Tequal(decoded_tid3, tid3)<=0) {
@@ -5784,14 +5758,11 @@ error:
* H5T_ORDER_NONE cannot be set.
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Neil Fortner
* January 23, 2009
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -5865,24 +5836,22 @@ test_set_order(void)
if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR;
if (H5Tclose(dtype) < 0) TEST_ERROR
- /* Opaque - functions should fail */
+ /* Opaque - No effect on the order */
if ((dtype = H5Tcreate(H5T_OPAQUE, (size_t)96)) < 0) TEST_ERROR
- H5E_BEGIN_TRY
- ret = H5Tset_order(dtype, H5T_ORDER_LE);
- order = H5Tget_order(dtype);
- H5E_END_TRY
- if (ret >= 0) TEST_ERROR
- if (order >= 0) TEST_ERROR
+ if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR;
+ if (H5Tset_order(dtype, H5T_ORDER_NONE) < 0) TEST_ERROR
+ if (H5Tset_order(dtype, H5T_ORDER_BE) < 0) TEST_ERROR
+ if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR;
if (H5Tclose(dtype) < 0) TEST_ERROR
- /* Compound - functions should fail */
+ /* Compound */
if ((dtype = H5Tcreate(H5T_COMPOUND, (size_t)48)) < 0) TEST_ERROR
H5E_BEGIN_TRY
- ret = H5Tset_order(dtype, H5T_ORDER_LE);
- order = H5Tget_order(dtype);
+ ret = H5Tset_order(dtype, H5T_ORDER_BE);
H5E_END_TRY
if (ret >= 0) TEST_ERROR
- if (order >= 0) TEST_ERROR
+ if ((order = H5Tget_order(dtype)) == H5T_ORDER_ERROR) TEST_ERROR
+ if (order != H5T_ORDER_NONE) TEST_ERROR
if (H5Tclose(dtype) < 0) TEST_ERROR
/* Object reference */
@@ -5944,6 +5913,144 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_set_order_compound
+ *
+ * Purpose: Tests H5Tset_order/H5Tget_order for complicated compound
+ * type.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer: Raymond Lu
+ * 18 August 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_set_order_compound(hid_t fapl)
+{
+ typedef struct { /* Struct with atomic fields */
+ int i;
+ char c;
+ short s;
+ float f;
+ } atomic_cmpd;
+
+ typedef struct { /* Struct with complex fields */
+ atomic_cmpd a;
+ hvl_t vl;
+ double b[3][4];
+ atomic_cmpd d[3][4];
+ } complex_cmpd;
+
+ hid_t file = -1;
+ hid_t cmpd = -1, memb_cmpd = -1, memb_array1 = -1, memb_array2 = -1, cmpd_array = -1;
+ hid_t vl_id = -1;
+ hsize_t dims[2] = {3, 4}; /* Array dimenstions */
+ char filename[1024];
+ herr_t ret; /* Generic return value */
+
+ TESTING("H5Tset/get_order for compound type");
+
+ if((memb_cmpd = H5Tcreate(H5T_COMPOUND, sizeof(atomic_cmpd))) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(memb_cmpd, "i", HOFFSET(atomic_cmpd, i), H5T_NATIVE_INT) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(memb_cmpd, "c", HOFFSET(atomic_cmpd, c), H5T_NATIVE_CHAR) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(memb_cmpd, "s", HOFFSET(atomic_cmpd, s), H5T_NATIVE_SHORT) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(memb_cmpd, "f", HOFFSET(atomic_cmpd, f), H5T_NATIVE_FLOAT) < 0) FAIL_STACK_ERROR
+
+ /* Set the order to little-endian. */
+ if(H5Tset_order(memb_cmpd, H5T_ORDER_BE) < 0) FAIL_STACK_ERROR
+
+ /* Create the array datatypes */
+ memb_array1 = H5Tarray_create2(H5T_NATIVE_DOUBLE, 2, dims);
+ memb_array2 = H5Tarray_create2(memb_cmpd, 2, dims);
+
+ /* Set the order to big-endian. */
+ if(H5Tset_order(memb_array1, H5T_ORDER_LE) < 0) FAIL_STACK_ERROR
+
+ /* Create a variable-length datatype */
+ if((vl_id = H5Tvlen_create(H5T_NATIVE_UINT)) < 0) FAIL_STACK_ERROR
+
+ /* Create a compound type using the types above. */
+ if((cmpd = H5Tcreate(H5T_COMPOUND, sizeof(complex_cmpd))) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd, "a", HOFFSET(complex_cmpd, a), memb_cmpd) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd, "vl_type", HOFFSET(complex_cmpd, vl), vl_id) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd, "b", HOFFSET(complex_cmpd, b), memb_array1) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd, "d", HOFFSET(complex_cmpd, d), memb_array2) < 0) FAIL_STACK_ERROR
+
+ /* The order should be mixed now. */
+ if(H5Tget_order(cmpd) != H5T_ORDER_MIXED) FAIL_STACK_ERROR
+
+ /* Create an array of the compound type above */
+ cmpd_array = H5Tarray_create2(cmpd, 2, dims);
+
+ /* The order of the array type should be the same as the compound type */
+ if(H5Tget_order(cmpd_array) != H5T_ORDER_MIXED) FAIL_STACK_ERROR
+
+ /* Verify that the order can't be 'none'. */
+ H5E_BEGIN_TRY
+ ret = H5Tset_order(cmpd, H5T_ORDER_NONE);
+ H5E_END_TRY
+ if(ret >= 0) TEST_ERROR
+
+ /* Verify that the order can't be 'mixed'. */
+ H5E_BEGIN_TRY
+ ret = H5Tset_order(cmpd, H5T_ORDER_MIXED);
+ H5E_END_TRY
+ if(ret >= 0) TEST_ERROR
+
+ /* Change the order of the compound type to big-endian*/
+ if(H5Tset_order(cmpd, H5T_ORDER_BE) < 0) FAIL_STACK_ERROR
+
+ /* Verify that the order of the compound type is big-endian */
+ if(H5Tget_order(cmpd) != H5T_ORDER_BE) FAIL_STACK_ERROR
+
+ /* Change the order of the array type to little-endian*/
+ if(H5Tset_order(cmpd_array, H5T_ORDER_LE) < 0) FAIL_STACK_ERROR
+
+ /* Verify that the order of the array type is little-endian */
+ if(H5Tget_order(cmpd_array) != H5T_ORDER_LE) FAIL_STACK_ERROR
+
+ /* Create file */
+ h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
+
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* Commit the data type */
+ if(H5Tcommit2(file, "compound", cmpd, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that committed type can't change order */
+ H5E_BEGIN_TRY
+ ret = H5Tset_order(cmpd, H5T_ORDER_LE);
+ H5E_END_TRY
+ if(ret >= 0) TEST_ERROR
+
+ if(H5Tclose(memb_cmpd) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(memb_array1) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(memb_array2) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(vl_id) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(cmpd) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(cmpd_array) < 0) FAIL_STACK_ERROR
+ if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY
+ H5Tclose(memb_cmpd);
+ H5Tclose(memb_array1);
+ H5Tclose(memb_array2);
+ H5Tclose(vl_id);
+ H5Tclose(cmpd);
+ H5Tclose(cmpd_array);
+ H5Fclose(file);
+ H5E_END_TRY;
+ return 1;
+} /* end test_set_order_compound() */
+
+
+/*-------------------------------------------------------------------------
* Function: test_named_indirect_reopen
*
* Purpose: Tests that open named datatypes can be reopened indirectly
@@ -6339,6 +6446,7 @@ main(void)
nerrors += test_latest();
nerrors += test_int_float_except();
nerrors += test_named_indirect_reopen(fapl);
+ nerrors += test_set_order_compound(fapl);
#ifndef H5_NO_DEPRECATED_SYMBOLS
nerrors += test_deprec(fapl);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/test/earray.c b/test/earray.c
index 3a29948..d3b51a4 100644
--- a/test/earray.c
+++ b/test/earray.c
@@ -1443,7 +1443,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
/* Insert test entry into cache */
base_addr = HADDR_MAX;
- if(H5AC_set(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, base_addr, base_entry, H5AC__PIN_ENTRY_FLAG) < 0)
+ if(H5AC_insert_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, base_addr, base_entry, H5AC__PIN_ENTRY_FLAG) < 0)
TEST_ERROR
/* Set the base entry as a flush dependency for the array */
@@ -1458,7 +1458,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
/* Insert test entry into cache */
addr1 = HADDR_MAX - 1;
- if(H5AC_set(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr1, entry1, H5AC__PIN_ENTRY_FLAG) < 0)
+ if(H5AC_insert_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr1, entry1, H5AC__PIN_ENTRY_FLAG) < 0)
TEST_ERROR
/* Set the test entry as a flush dependency for 0th index in the array */
@@ -1480,7 +1480,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
/* Insert test entry into cache */
addr2 = HADDR_MAX - 2;
- if(H5AC_set(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr2, entry2, H5AC__PIN_ENTRY_FLAG) < 0)
+ if(H5AC_insert_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr2, entry2, H5AC__PIN_ENTRY_FLAG) < 0)
TEST_ERROR
/* Set the test entry as a flush dependency for 1st index in the array */
@@ -1502,7 +1502,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
/* Insert test entry into cache */
addr3 = HADDR_MAX - 3;
- if(H5AC_set(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr3, entry3, H5AC__PIN_ENTRY_FLAG) < 0)
+ if(H5AC_insert_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr3, entry3, H5AC__PIN_ENTRY_FLAG) < 0)
TEST_ERROR
/* Set the test entry as a flush dependency for 10,000th index in the array */
diff --git a/test/enum.c b/test/enum.c
index 4599a7c..c627af1 100644
--- a/test/enum.c
+++ b/test/enum.c
@@ -71,7 +71,7 @@ test_named(hid_t file)
if(H5Tclose(type) < 0) FAIL_STACK_ERROR
/* A smaller type */
- if((type = H5Tcreate(H5T_ENUM, 1)) < 0) FAIL_STACK_ERROR
+ if((type = H5Tcreate(H5T_ENUM, (size_t)1)) < 0) FAIL_STACK_ERROR
if(H5Tenum_insert(type, "RED", CPTR(val8, E1_RED )) < 0) FAIL_STACK_ERROR
if(H5Tenum_insert(type, "GREEN", CPTR(val8, E1_GREEN)) < 0) FAIL_STACK_ERROR
if(H5Tenum_insert(type, "BLUE", CPTR(val8, E1_BLUE )) < 0) FAIL_STACK_ERROR
diff --git a/test/fillval.c b/test/fillval.c
index 81856de..cd12b98 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -1142,6 +1142,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout)
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined
* as compound type */
if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
+ HDmemset(&fill_ctype, 0, sizeof(fill_ctype));
fill_ctype.y = 4444.4444;
if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error;
nerrors += test_rdwr_cases(file, dcpl, "dset11", &fill_ctype, H5D_FILL_TIME_ALLOC,
@@ -1194,6 +1195,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout)
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined
* as compound type */
if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
+ HDmemset(&fill_ctype, 0, sizeof(fill_ctype));
fill_ctype.y = 4444.4444;
if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error;
nerrors += test_rdwr_cases(file, dcpl, "dset12", &fill_ctype, H5D_FILL_TIME_ALLOC,
diff --git a/test/freespace.c b/test/freespace.c
index 0f6514c..b4a774f 100644
--- a/test/freespace.c
+++ b/test/freespace.c
@@ -593,7 +593,7 @@ test_fs_sect_add(hid_t fapl)
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
- TEST_free_section_t *sect_node;
+ TEST_free_section_t *sect_node = NULL;
unsigned init_flags=0;
h5_stat_size_t file_size=0, tmp_file_size=0, fr_meta_size=0;
unsigned can_shrink=FALSE;
@@ -858,6 +858,11 @@ test_fs_sect_add(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node) < 0)
+ TEST_ERROR
+ sect_node = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -878,6 +883,8 @@ test_fs_sect_add(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(sect_node)
+ TEST_sect_free((H5FS_section_info_t *)sect_node);
if(frsp)
H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
H5Fclose(file);
@@ -918,7 +925,7 @@ test_fs_sect_find(hid_t fapl)
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
- TEST_free_section_t *sect_node1, *sect_node2, *sect_node3, *sect_node4;
+ TEST_free_section_t *sect_node1 = NULL, *sect_node2, *sect_node3 = NULL, *sect_node4 = NULL;
TEST_free_section_t *node;
htri_t node_found = FALSE;
unsigned init_flags=0;
@@ -1077,6 +1084,17 @@ test_fs_sect_find(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node4) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
+ sect_node1 = NULL;
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node3) < 0)
+ TEST_ERROR
+ sect_node3 = NULL;
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node4) < 0)
+ TEST_ERROR
+ sect_node4 = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -1145,11 +1163,17 @@ test_fs_sect_find(hid_t fapl)
if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
TEST_ERROR
+ node = NULL;
/* remove sections A */
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
+ sect_node1 = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -1199,6 +1223,11 @@ test_fs_sect_find(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
+ sect_node1 = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -1219,6 +1248,12 @@ test_fs_sect_find(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(sect_node1)
+ TEST_sect_free((H5FS_section_info_t *)sect_node1);
+ if(sect_node3)
+ TEST_sect_free((H5FS_section_info_t *)sect_node3);
+ if(sect_node4)
+ TEST_sect_free((H5FS_section_info_t *)sect_node4);
if(frsp)
H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
H5Fclose(file);
@@ -1484,6 +1519,12 @@ test_fs_sect_merge(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node2) < 0)
+ TEST_ERROR
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -1672,6 +1713,10 @@ test_fs_sect_merge(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(sect_node1)
+ TEST_sect_free((H5FS_section_info_t *)sect_node1);
+ if(sect_node2)
+ TEST_sect_free((H5FS_section_info_t *)sect_node2);
if(frsp)
H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
H5Fclose(file);
@@ -2152,6 +2197,11 @@ test_fs_sect_change_class(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node2) < 0)
+ TEST_ERROR
+ sect_node2 = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -2269,6 +2319,11 @@ test_fs_sect_change_class(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
+ sect_node1 = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -2289,6 +2344,10 @@ test_fs_sect_change_class(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(sect_node1)
+ TEST_sect_free((H5FS_section_info_t *)sect_node1);
+ if(sect_node2)
+ TEST_sect_free((H5FS_section_info_t *)sect_node2);
if(frsp)
H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
H5Fclose(file);
diff --git a/test/getname.c b/test/getname.c
index 0dc623e..bef4756 100644
--- a/test/getname.c
+++ b/test/getname.c
@@ -21,12 +21,15 @@
*/
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
+#define H5I_PACKAGE /*suppress error about including H5Ipkg */
-/* Define this macro to indicate that the testing APIs should be available */
+/* Define these macros to indicate that the testing APIs should be available */
#define H5G_TESTING
+#define H5I_TESTING
#include "h5test.h"
#include "H5Gpkg.h" /* Groups */
+#include "H5Ipkg.h" /* IDs */
/* Compound datatype */
@@ -1145,7 +1148,7 @@ test_main(hid_t file_id, hid_t fapl)
/* Get name */
*name2 = '\0';
- name_len=H5Iget_name(group_id, name2, SMALL_NAME_BUF_SIZE);
+ name_len=(size_t)H5Iget_name(group_id, name2, SMALL_NAME_BUF_SIZE);
/* Check that name is longer */
if(name_len <= SMALL_NAME_BUF_SIZE) TEST_ERROR
@@ -1172,14 +1175,14 @@ test_main(hid_t file_id, hid_t fapl)
if((group_id = H5Gopen2(file_id, "/g17", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Get name */
- name_len = H5Iget_name(group_id, NULL, NAME_BUF_SIZE);
+ name_len = (size_t)H5Iget_name(group_id, NULL, NAME_BUF_SIZE);
{
/* dynamic buffer to hold name */
char *name3;
/* Include the extra null character */
- name3 = HDmalloc(name_len + 1);
+ name3 = (char *)HDmalloc(name_len + 1);
if(!name3) TEST_ERROR
/* Get name with dynamic buffer */
@@ -2679,7 +2682,7 @@ test_reg_ref(hid_t fapl)
hsize_t count[2];
hsize_t coord[2][3] = {{0, 0, 1}, {6, 0, 8}};
unsigned num_points = 3;
- size_t name_size1, name_size2;
+ ssize_t name_size1, name_size2;
char buf1[NAME_BUF_SIZE], buf2[NAME_BUF_SIZE];
/* Initialize the file name */
@@ -2808,6 +2811,100 @@ error:
return 1;
}
+
+/*-------------------------------------------------------------------------
+ * Function: test_elinks
+ *
+ * Purpose: Verify that querying names of objects reached via external
+ * links uses cached path/name information for object and doesn't
+ * search the file.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, July 27, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_elinks(hid_t fapl)
+{
+ char filename1[1024], filename2[1024]; /* Filenames */
+ hid_t fid1, fid2; /* HDF5 File IDs */
+ hid_t group, group2; /* Group IDs */
+ char name[NAME_BUF_SIZE]; /* Buffer for storing object's name */
+ ssize_t namelen; /* Length of object's name */
+ hbool_t name_cached; /* Indicate if name is cached */
+
+ /* Initialize the file names */
+ h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[2], fapl, filename2, sizeof filename2);
+
+ /* Create files */
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create a group in the second file */
+ if((group2 = H5Gcreate2(fid2, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close Group */
+ if(H5Gclose(group2) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create an external link in first file to the group in the second file */
+ if(H5Lcreate_external(filename2, "Group2", fid1, "Link_to_Group2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create an external link in second file to the external link in the first file */
+ if(H5Lcreate_external(filename1, "Link_to_Group2", fid2, "Link_to_Link_to_Group2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+ /* Open the group in thesecond file through the external link */
+ if((group = H5Gopen2(fid1, "Link_to_Group2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Query the external link object's name */
+ *name = '\0';
+ name_cached = FALSE;
+ namelen = H5I_get_name_test(group, (char*)name, sizeof(name), &name_cached);
+ if(!((HDstrcmp(name, "/Group2") == 0) && (namelen == 7) && name_cached))
+ TEST_ERROR
+
+ /* Close Group */
+ if(H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
+
+ /* Open the group in the second file through the external link to the external link */
+ if((group = H5Gopen2(fid2, "Link_to_Link_to_Group2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Query the external link to external link object's name */
+ *name = '\0';
+ name_cached = FALSE;
+ namelen = H5I_get_name_test(group, (char*)name, sizeof(name), &name_cached);
+ if(!((HDstrcmp(name, "/Group2") == 0) && (namelen == 7) && name_cached))
+ TEST_ERROR
+
+ /* Close Group */
+ if(H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close files */
+ if(H5Fclose(fid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(fid2) < 0)
+ FAIL_STACK_ERROR
+
+ return 0;
+
+error:
+ return 1;
+}
+
int
main(void)
{
@@ -2830,6 +2927,7 @@ main(void)
nerrors += test_main(file_id, fapl);
nerrors += test_obj_ref(fapl);
nerrors += test_reg_ref(fapl);
+ nerrors += test_elinks(fapl);
/* Close file */
H5Fclose(file_id);
diff --git a/test/gheap.c b/test/gheap.c
index b2c9090..2829e34 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -75,24 +75,24 @@ const char *FILENAME[] = {
static int
test_1 (hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f=NULL;
+ hid_t file = -1;
+ H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
uint8_t in[1024];
int i;
size_t size;
herr_t status;
- int nerrors=0;
+ int nerrors = 0;
char filename[1024];
TESTING("monotonically increasing lengths");
/* Open a clean file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if (NULL==(f=H5I_object(file))) {
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
puts(" Unable to create file");
goto error;
@@ -103,16 +103,16 @@ test_1 (hid_t fapl)
* a clean file, the addresses allocated for the collections should also
* be monotonically increasing.
*/
- for (i=0; i<1024; i++) {
- size = i+1;
- memset (out, 'A'+i%26, size);
+ for(i = 0; i < 1024; i++) {
+ size = i + 1;
+ HDmemset(out, 'A' + i % 26, size);
H5Eclear2(H5E_DEFAULT);
- status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i);
- if (status<0) {
+ status = H5HG_insert(f, H5P_DATASET_XFER_DEFAULT, size, out, obj + i);
+ if(status < 0) {
H5_FAILED();
puts(" Unable to insert object into global heap");
nerrors++;
- } else if (i && H5F_addr_gt (obj[i-1].addr, obj[i].addr)) {
+ } else if(i && H5F_addr_gt(obj[i - 1].addr, obj[i].addr)) {
H5_FAILED();
puts(" Collection addresses are not monotonically increasing");
nerrors++;
@@ -122,27 +122,28 @@ test_1 (hid_t fapl)
/*
* Now try to read each object back.
*/
- for (i=0; i<1024; i++) {
- size = i+1;
- memset (out, 'A'+i%26, size);
+ for(i = 0; i < 1024; i++) {
+ size = i + 1;
+ HDmemset(out, 'A' + i % 26, size);
H5Eclear2(H5E_DEFAULT);
- if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in, NULL)) {
+ if(NULL == H5HG_read(f, H5P_DATASET_XFER_DEFAULT, obj + i, in, NULL)) {
H5_FAILED();
puts(" Unable to read object");
nerrors++;
- } else if (memcmp (in, out, size)) {
+ } else if(HDmemcmp(in, out, size)) {
H5_FAILED();
puts(" Value read doesn't match value written");
nerrors++;
}
}
- if (H5Fclose(file)<0) goto error;
- if (nerrors) goto error;
+ if(H5Fclose(file) < 0) goto error;
+ if(nerrors) goto error;
+
PASSED();
return 0;
- error:
+error:
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
@@ -170,23 +171,23 @@ test_1 (hid_t fapl)
static int
test_2 (hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f=NULL;
+ hid_t file = -1;
+ H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
uint8_t in[1024];
int i;
size_t size;
- int nerrors=0;
+ int nerrors = 0;
char filename[1024];
TESTING("monotonically decreasing lengths");
/* Open a clean file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if (NULL==(f=H5I_object(file))) {
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
puts(" Unable to create file");
goto error;
@@ -257,23 +258,23 @@ test_2 (hid_t fapl)
static int
test_3 (hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f=NULL;
+ hid_t file = -1;
+ H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
int i;
size_t size;
herr_t status;
- int nerrors=0;
+ int nerrors = 0;
char filename[1024];
TESTING("complete object removal");
/* Open a clean file */
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if (NULL==(f=H5I_object(file))) {
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
puts(" Unable to create file");
goto error;
@@ -336,23 +337,23 @@ test_3 (hid_t fapl)
static int
test_4 (hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f=NULL;
+ hid_t file = -1;
+ H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
int i;
size_t size;
herr_t status;
- int nerrors=0;
+ int nerrors = 0;
char filename[1024];
TESTING("partial object removal");
/* Open a clean file */
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if (NULL==(f=H5I_object(file))) {
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
puts(" Unable to create file");
goto error;
diff --git a/test/h5test.h b/test/h5test.h
index 722d850..70408d9 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -118,11 +118,9 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
/*
* Alarm definitions to wait up (terminate) a test that runs too long.
*/
-#define alarm_seconds 1800 /* default is 30 minutes */
-#define ALARM_ON HDalarm(alarm_seconds)
+#define H5_ALARM_SEC 1200 /* default is 20 minutes */
+#define ALARM_ON TestAlarmOn()
#define ALARM_OFF HDalarm(0)
-/* set alarms to N seconds if N > 0, else use default alarm_seconds. */
-#define ALARM_SET(N) HDalarm((N)>0 ? N : alarm_seconds)
/*
* The methods to compare the equality of floating-point values:
@@ -183,6 +181,8 @@ H5TEST_DLL void IncTestNumErrs(void);
H5TEST_DLL const void *GetTestParameters(void);
H5TEST_DLL int TestErrPrintf(const char *format, ...);
H5TEST_DLL void SetTest(const char *testname, int action);
+H5TEST_DLL void TestAlarmOn(void);
+H5TEST_DLL void TestAlarmOff(void);
#ifdef H5_HAVE_FILTER_SZIP
H5TEST_DLL int h5_szip_can_encode(void);
diff --git a/test/hyperslab.c b/test/hyperslab.c
index e216b95..fdeaffd 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -125,7 +125,7 @@ print_ref(size_t nx, size_t ny, size_t nz)
{
uint8_t *array;
- if(NULL != (array = HDmalloc(nx * ny * nz))) {
+ if(NULL != (array = (uint8_t *)HDmalloc(nx * ny * nz))) {
printf("Reference array:\n");
init_full(array, nx, ny, nz);
print_array(array, nx, ny, nz);
@@ -190,7 +190,7 @@ test_fill(size_t nx, size_t ny, size_t nz,
fflush(stdout);
/* Allocate array */
- if(NULL == (dst = HDcalloc((size_t)1, nx * ny * nz)))
+ if(NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
TEST_ERROR
init_full(dst, nx, ny, nz);
@@ -387,9 +387,9 @@ test_copy(int mode,
/*
* Allocate arrays
*/
- if(NULL == (src = HDcalloc((size_t)1, nx * ny * nz)))
+ if(NULL == (src = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
TEST_ERROR
- if(NULL == (dst = HDcalloc((size_t)1, nx * ny * nz)))
+ if(NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
TEST_ERROR
init_full(src, nx, ny, nz);
@@ -602,9 +602,9 @@ test_multifill(size_t nx)
fflush(stdout);
/* Initialize the source and destination */
- if(NULL == (src = HDmalloc(nx * sizeof(*src))))
+ if(NULL == (src = (struct a_struct *)HDmalloc(nx * sizeof(*src))))
TEST_ERROR
- if(NULL == (dst = HDmalloc(nx * sizeof(*dst))))
+ if(NULL == (dst = (struct a_struct *)HDmalloc(nx * sizeof(*dst))))
TEST_ERROR
for(i = 0; i < nx; i++) {
@@ -717,9 +717,9 @@ test_endian(size_t nx)
fflush(stdout);
/* Initialize arrays */
- if(NULL == (src = HDmalloc(nx * 4)))
+ if(NULL == (src = (uint8_t *)HDmalloc(nx * 4)))
TEST_ERROR
- if(NULL == (dst = HDcalloc(nx , (size_t)4)))
+ if(NULL == (dst = (uint8_t *)HDcalloc(nx , (size_t)4)))
TEST_ERROR
init_full(src, nx, (size_t)4,(size_t)1);
@@ -805,9 +805,9 @@ test_transpose(size_t nx, size_t ny)
fflush(stdout);
/* Initialize */
- if(NULL == (src = HDmalloc(nx * ny * sizeof(*src))))
+ if(NULL == (src = (int *)HDmalloc(nx * ny * sizeof(*src))))
TEST_ERROR
- if(NULL == (dst = HDcalloc(nx * ny, sizeof(*dst))))
+ if(NULL == (dst = (int *)HDcalloc(nx * ny, sizeof(*dst))))
TEST_ERROR
for(i = 0; i < nx; i++)
@@ -911,11 +911,11 @@ test_sub_super(size_t nx, size_t ny)
fflush(stdout);
/* Initialize */
- if(NULL == (full = HDmalloc(4 * nx * ny)))
+ if(NULL == (full = (uint8_t *)HDmalloc(4 * nx * ny)))
TEST_ERROR
- if(NULL == (half = HDcalloc((size_t)1, nx * ny)))
+ if(NULL == (half = (uint8_t *)HDcalloc((size_t)1, nx * ny)))
TEST_ERROR
- if(NULL == (twice = HDcalloc((size_t)4, nx * ny)))
+ if(NULL == (twice = (uint8_t *)HDcalloc((size_t)4, nx * ny)))
TEST_ERROR
init_full(full, 2 * nx, 2 * ny, (size_t)1);
@@ -1063,7 +1063,7 @@ test_array_fill(size_t lo, size_t hi)
TESTING(s);
/* Initialize */
- if(NULL == (dst = HDcalloc(sizeof(int),ARRAY_FILL_SIZE * hi)))
+ if(NULL == (dst = (int *)HDcalloc(sizeof(int),ARRAY_FILL_SIZE * hi)))
TEST_ERROR
/* Setup */
@@ -1128,7 +1128,7 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
TESTING(s);
/* Initialize */
- if(NULL == (a = HDmalloc(sizeof(hsize_t) * x * y *z)))
+ if(NULL == (a = (hsize_t *)HDmalloc(sizeof(hsize_t) * x * y *z)))
TEST_ERROR
dims[0] = z;
diff --git a/test/links.c b/test/links.c
index f23a566..12b8ba4 100644
--- a/test/links.c
+++ b/test/links.c
@@ -2944,7 +2944,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[19], fapl, filename3, sizeof filename3);
/* create tmp directory and get current working directory path */
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -2957,8 +2957,8 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -2966,7 +2966,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -2977,7 +2977,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file from absolute path set for main file */
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in tmp directory.");
goto error;
@@ -3123,7 +3123,7 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
/* set up name for target file: "extlinks5" */
h5_fixname(FILENAME[22], fapl, filename2, sizeof filename2);
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -3135,8 +3135,8 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
/* Create the target file */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -3144,7 +3144,7 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -3155,7 +3155,7 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file from the current working directory */
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in current working directory");
goto error;
@@ -3216,7 +3216,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
/* create tmp directory and get current working directory path */
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -3231,8 +3231,8 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[23], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -3240,7 +3240,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -3251,7 +3251,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file with abolute path */
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in tmp directory.");
goto error;
@@ -3313,7 +3313,7 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[24], fapl, filename3, sizeof filename3);
/* create tmp directory and get current working directory path */
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -3325,8 +3325,8 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -3334,7 +3334,7 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -3595,8 +3595,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
else
TESTING("H5Pset/get_elink_fapl() with different physical layouts")
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) ||
- (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -3623,10 +3622,10 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
HDmemset(memb_addr, 0, sizeof memb_addr);
HDmemset(sv, 0, sizeof sv);
- for (mt = 0; mt < H5FD_MEM_NTYPES; mt++) {
+ for(mt = 0; mt < H5FD_MEM_NTYPES; mt++) {
memb_map[mt] = H5FD_MEM_SUPER;
memb_fapl[mt] = H5P_DEFAULT;
- }
+ } /* end for */
memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE;
@@ -3637,7 +3636,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER];
memb_addr[H5FD_MEM_SUPER] = 0;
- sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b');
+ sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b');
memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE];
memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/6;
@@ -3795,8 +3794,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
else
TESTING("H5Pset/get_elink_fapl() with same physical layout")
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) ||
- (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -4393,7 +4391,7 @@ external_link_win1(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* set up name for target link: "/CWD/tmp/extlinks10" */
@@ -4406,8 +4404,8 @@ external_link_win1(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[29], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -4415,7 +4413,7 @@ external_link_win1(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -4426,7 +4424,7 @@ external_link_win1(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file via main file's CWD*/
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in CWD.");
goto error;
@@ -4487,7 +4485,7 @@ external_link_win2(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
/* create tmp directory and get current working directory path */
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/* set up name for target link: "/CWD/tmp/extlinks11" */
@@ -4500,8 +4498,8 @@ external_link_win2(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[31], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -4509,7 +4507,7 @@ external_link_win2(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -4520,7 +4518,7 @@ external_link_win2(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file directly */
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in tmp.");
goto error;
@@ -4760,7 +4758,7 @@ external_link_win5(hid_t fapl, hbool_t new_format)
else
TESTING("external links via main file's rel drive/abs path (windows)")
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
drive = HDgetdrive();
@@ -4778,8 +4776,8 @@ external_link_win5(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[35], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -4787,7 +4785,7 @@ external_link_win5(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -4798,7 +4796,7 @@ external_link_win5(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file via main file's rel drive/abs path */
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in CWD.");
goto error;
@@ -4945,7 +4943,7 @@ external_link_win7(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* set up name for target link: "\\127.0.0.1\c$/tmp/extlinks10" */
@@ -4958,8 +4956,8 @@ external_link_win7(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[29], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -4967,7 +4965,7 @@ external_link_win7(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -4978,10 +4976,10 @@ external_link_win7(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file via main file's local host/main drive*/
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in local host/main drive.");
- goto error;
+ if(gid < 0) {
+ H5_FAILED();
+ puts(" Should have found the file in local host/main drive.");
+ goto error;
}
/* closing for main file */
@@ -5034,11 +5032,11 @@ external_link_win8(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* create tmp directory */
- if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
+ if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
/* set up name for target link: "<drive-letter>:\CWD\extlinks10" */
@@ -5050,8 +5048,8 @@ external_link_win8(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[30], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -5059,7 +5057,7 @@ external_link_win8(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -5070,10 +5068,10 @@ external_link_win8(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file directly */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in tmp.");
- goto error;
+ if(gid < 0) {
+ H5_FAILED();
+ puts(" Should have found the file in tmp.");
+ goto error;
}
/* closing for main file */
@@ -5124,7 +5122,7 @@ external_link_win9(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp/extlinks10" */
@@ -5137,8 +5135,8 @@ external_link_win9(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[29], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -5146,7 +5144,7 @@ external_link_win9(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -5157,10 +5155,10 @@ external_link_win9(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file via main file's local host/main drive*/
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in local host/main drive.");
- goto error;
+ if(gid < 0) {
+ H5_FAILED();
+ puts(" Should have found the file in local host/main drive.");
+ goto error;
}
/* closing for main file */
@@ -6434,7 +6432,7 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
TEST_ERROR
if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
- if(NULL == HDgetcwd(cwdpath, NAME_BUF_SIZE))
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* Set up names for files in the subdirectories */
@@ -6784,14 +6782,30 @@ done:
if(H5Gclose(target_obj) < 0)
ret_value = -1;
break;
+
case H5I_DATASET:
if(H5Dclose(target_obj) < 0)
ret_value = -1;
break;
+
case H5I_DATATYPE:
if(H5Tclose(target_obj) < 0)
ret_value = -1;
break;
+
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_DATASPACE:
+ case H5I_ATTR:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
default:
return -1;
} /* end switch */
@@ -6855,14 +6869,30 @@ done:
if(H5Gclose(target_obj) < 0)
ret_value = -1;
break;
+
case H5I_DATASET:
if(H5Dclose(target_obj) < 0)
ret_value = -1;
break;
+
case H5I_DATATYPE:
if(H5Tclose(target_obj) < 0)
ret_value = -1;
break;
+
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_DATASPACE:
+ case H5I_ATTR:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
default:
return -1;
} /* end switch */
@@ -6928,7 +6958,7 @@ ud_hard_links(hid_t fapl)
/* Create a user-defined "hard link" to the group using the address we got
* from H5Lget_info */
- if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close and re-open file to ensure that data is written to disk */
if(H5Fclose(fid) < 0) TEST_ERROR
@@ -7829,9 +7859,9 @@ ud_link_errors(hid_t fapl, hbool_t new_format)
/* Try to create internally defined links with H5Lcreate_ud */
H5E_BEGIN_TRY {
- if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, 0, H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0)
TEST_ERROR
- if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", 4, H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0)
TEST_ERROR
} H5E_END_TRY
@@ -8853,7 +8883,7 @@ static enum {
LFS_DECODED
} link_filter_state;
-static herr_t link_filter_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id)
+static htri_t link_filter_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id)
{
if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0)
return -1;
@@ -9064,7 +9094,7 @@ link_filters(hid_t fapl, hbool_t new_format)
|| filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED
| H5Z_FILTER_CONFIG_DECODE_ENABLED))
TEST_ERROR
- if(H5Pget_filter2(gcpl2, nfilters - 1, &flags_out, &cd_nelmts,
+ if(H5Pget_filter2(gcpl2, (unsigned)(nfilters - 1), &flags_out, &cd_nelmts,
&cd_value_out, (size_t)24, name_out, &filter_config_out) < 0)
TEST_ERROR
if(flags_out != 0 || cd_value_out != cd_value
@@ -12163,15 +12193,10 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id,
/* Work through main & soft link groups */
for(v = 0; v < 2; v++) {
/* Choose appropriate group to open links within */
- switch(v) {
- case 0:
- group_id = main_group_id;
- break;
-
- case 1:
- group_id = soft_group_id;
- break;
- } /* end switch */
+ if(0 == v)
+ group_id = main_group_id;
+ else
+ group_id = soft_group_id;
/* Open each object in main group by index and check that it's the correct one */
for(u = 0; u < max_links; u++) {
@@ -12628,15 +12653,10 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type,
/* Work through main & soft link groups */
for(v = 0; v < 2; v++) {
/* Choose appropriate group to open links within */
- switch(v) {
- case 0:
- group_id = main_group_id;
- break;
-
- case 1:
- group_id = soft_group_id;
- break;
- } /* end switch */
+ if(0 == v)
+ group_id = main_group_id;
+ else
+ group_id = soft_group_id;
/* Open each object in group by name and check that it's the correct one */
for(u = 0; u < max_links; u++) {
diff --git a/test/mtime.c b/test/mtime.c
index cc04e42..83e8354 100644
--- a/test/mtime.c
+++ b/test/mtime.c
@@ -99,7 +99,7 @@ main(void)
if(H5Fclose(file) < 0) TEST_ERROR;
/* Compare addresses & times from the two ways of calling H5Oget_info() */
- if(oi1.addr != oi2.addr || oi1.mtime != oi2.mtime) {
+ if(oi1.addr != oi2.addr || oi1.ctime != oi2.ctime) {
H5_FAILED();
puts(" Calling H5Oget_info() with the dataset ID returned");
puts(" different values than calling it with a file and dataset");
@@ -108,15 +108,15 @@ main(void)
}
/* Compare times -- they must be within 60 seconds of one another */
- if(0 == oi1.mtime) {
+ if(0 == oi1.ctime) {
SKIPPED();
puts(" The modification time could not be decoded on this OS.");
puts(" Modification times will be mantained in the file but");
puts(" cannot be queried on this system. See H5O_mtime_decode().");
return 0;
- } else if(HDfabs(HDdifftime(now, oi1.mtime)) > 60.0) {
+ } else if(HDfabs(HDdifftime(now, oi1.ctime)) > 60.0) {
H5_FAILED();
- tm = HDlocaltime(&(oi1.mtime));
+ tm = HDlocaltime(&(oi1.ctime));
HDstrftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm);
tm = HDlocaltime(&now);
HDstrftime((char*)buf2, sizeof buf2, "%Y-%m-%d %H:%M:%S", tm);
@@ -138,7 +138,7 @@ main(void)
if(file >= 0){
if(H5Oget_info_by_name(file, "/Dataset1", &oi1, H5P_DEFAULT) < 0)
TEST_ERROR;
- if(oi1.mtime != MTIME1) {
+ if(oi1.ctime != MTIME1) {
H5_FAILED();
/* If this fails, examine H5Omtime.c. Modification time is very
* system dependant (e.g., on Windows DST must be hardcoded). */
@@ -168,7 +168,7 @@ main(void)
if(file >= 0){
if(H5Oget_info_by_name(file, "/Dataset1", &oi2, H5P_DEFAULT) < 0)
TEST_ERROR;
- if(oi2.mtime != MTIME2) {
+ if(oi2.ctime != MTIME2) {
H5_FAILED();
puts(" Modification time incorrect.");
goto error;
diff --git a/test/objcopy.c b/test/objcopy.c
index 4736af1..edeca09 100755
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -811,7 +811,7 @@ compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid)
/* Check the attributes are equal */
for(i = 0; i < (unsigned)oinfo1.num_attrs; i++) {
if((aid = H5Aopen_by_idx(oid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Aget_name(aid, ATTR_NAME_LEN, attr_name) < 0) TEST_ERROR
+ if(H5Aget_name(aid, (size_t)ATTR_NAME_LEN, attr_name) < 0) TEST_ERROR
if((aid2 = H5Aopen(oid2, attr_name, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -996,8 +996,7 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
}
/* Check for types of objects handled */
- switch(obj1_type)
- {
+ switch(obj1_type) {
case H5O_TYPE_DATASET:
if(compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE) TEST_ERROR
break;
@@ -1010,6 +1009,8 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR
break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
default:
TEST_ERROR
} /* end switch */
@@ -1053,8 +1054,7 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
}
/* Check for types of objects handled */
- switch(obj1_type)
- {
+ switch(obj1_type) {
case H5O_TYPE_DATASET:
if(compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE) TEST_ERROR
break;
@@ -1067,6 +1067,8 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR
break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
default:
TEST_ERROR
} /* end switch */
@@ -1196,8 +1198,8 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
/* Ensure that all external file information is the same */
for(x=0; x < (unsigned) ext_count; ++x)
{
- if(H5Pget_external(dcpl, x, NAME_BUF_SIZE, name1, &offset1, &size1) < 0) TEST_ERROR
- if(H5Pget_external(dcpl2, x, NAME_BUF_SIZE, name2, &offset2, &size2) < 0) TEST_ERROR
+ if(H5Pget_external(dcpl, x, (size_t)NAME_BUF_SIZE, name1, &offset1, &size1) < 0) TEST_ERROR
+ if(H5Pget_external(dcpl2, x, (size_t)NAME_BUF_SIZE, name2, &offset2, &size2) < 0) TEST_ERROR
if(offset1 != offset2) TEST_ERROR
if(size1 != size2) TEST_ERROR
@@ -1421,6 +1423,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
if(H5Tequal(oid, oid2) != TRUE) TEST_ERROR
break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
default:
HDassert(0 && "Unknown type of object");
break;
@@ -2161,10 +2165,13 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl)
TESTING("H5Ocopy(): compound dataset");
- for (i=0; i<DIM_SIZE_1; i++) {
+#ifdef H5_CLEAR_MEMORY
+ HDmemset(buf, 0, sizeof(buf));
+#endif /* H5_CLEAR_MEMORY */
+ for(i = 0; i < DIM_SIZE_1; i++) {
buf[i].a = i;
- buf[i].d = 1./(i+1);
- }
+ buf[i].d = 1. / (i + 1);
+ } /* end for */
/* Initialize the filenames */
h5_fixname(FILENAME[0], fapl, src_filename, sizeof src_filename);
@@ -2183,7 +2190,7 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl)
if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if((tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_t))) < 0) TEST_ERROR
+ if((tid = H5Tcreate(H5T_COMPOUND, sizeof(comp_t))) < 0) TEST_ERROR
if(H5Tinsert(tid, "int_name", HOFFSET(comp_t, a), H5T_NATIVE_INT) < 0) TEST_ERROR
if(H5Tinsert(tid, "double_name", HOFFSET(comp_t, d), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
@@ -8489,7 +8496,7 @@ main(void)
/* Create an FCPL with sharing enabled */
if((fcpl_shared = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
if(H5Pset_shared_mesg_nindexes(fcpl_shared, 1) < 0) TEST_ERROR
- if(H5Pset_shared_mesg_index(fcpl_shared, 0, H5O_SHMESG_ALL_FLAG, (size_t) 10) < 0) TEST_ERROR
+ if(H5Pset_shared_mesg_index(fcpl_shared, 0, H5O_SHMESG_ALL_FLAG, 10) < 0) TEST_ERROR
/* Obtain the default attribute storage phase change values */
if((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0) TEST_ERROR
@@ -8625,7 +8632,7 @@ main(void)
nerrors += test_copy_same_file_named_datatype(fcpl_src, my_fapl);
nerrors += test_copy_old_layout(fcpl_dst, my_fapl);
nerrors += test_copy_null_ref(fcpl_src, fcpl_dst, my_fapl);
- }
+ }
/* TODO: not implemented
nerrors += test_copy_mount(my_fapl);
diff --git a/test/pool.c b/test/pool.c
index 9b2e8b9..916d45e 100644
--- a/test/pool.c
+++ b/test/pool.c
@@ -649,11 +649,11 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
TEST_ERROR
/* Allocate space for the block sizes */
- if(NULL == (blk_size = HDmalloc(sizeof(size_t) * MPOOL_NUM_RANDOM)))
+ if(NULL == (blk_size = (size_t *)HDmalloc(sizeof(size_t) * MPOOL_NUM_RANDOM)))
TEST_ERROR
/* Allocate space for the block pointers */
- if(NULL == (spc = HDmalloc(sizeof(void *) * MPOOL_NUM_RANDOM)))
+ if(NULL == (spc = (void **)HDmalloc(sizeof(void *) * MPOOL_NUM_RANDOM)))
TEST_ERROR
/* Initialize the block sizes with random values */
diff --git a/test/set_extent.c b/test/set_extent.c
index 39cc446..4351635 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -153,10 +153,10 @@ int main( void )
if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
/* Set chunk cache so only part of the chunks can be cached on fapl */
- if(H5Pset_cache(fapl, 0, 8, 256 * sizeof(int), 0.75) < 0) TEST_ERROR
+ if(H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75) < 0) TEST_ERROR
/* Disable chunk caching on fapl2 */
- if(H5Pset_cache(fapl2, 0, 0, 0, 0.) < 0) TEST_ERROR
+ if(H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.) < 0) TEST_ERROR
/* Set the "use the latest version of the format" bounds for creating objects in the file */
if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR
diff --git a/test/stab.c b/test/stab.c
index cab0b1b..e8ffec3 100644
--- a/test/stab.c
+++ b/test/stab.c
@@ -53,7 +53,6 @@ const char *FILENAME[] = {
/* Definitions for 'read_old' test */
#define READ_OLD_NGROUPS 100
-#define READ_OLD_BUFSIZE 1024
/* The group_old.h5 is generated from gen_old_fill.c in HDF5 'test' directory
* for version 1.6. To get this data file, simply compile gen_old_group.c with
@@ -79,7 +78,6 @@ const char *FILENAME[] = {
/* Definitions for 'corrupt_stab_msg' test */
#define CORRUPT_STAB_FILE "corrupt_stab_msg.h5"
#define CORRUPT_STAB_TMP_FILE "corrupt_stab_msg_tmp.h5"
-#define CORRUPT_STAB_COPY_BUF_SIZE 4096
#define CORRUPT_STAB_DSET "DS1"
diff --git a/test/tattr.c b/test/tattr.c
index 828b8a8..60d4ddb 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -9802,6 +9802,7 @@ test_attr_bug3(hid_t fcpl, hid_t fapl)
dims2[2] = {3, 3}; /* Dimensions */
int wdata1[2][2];
unsigned wdata2[3][3]; /* Write buffers */
+ unsigned u, v; /* Local index variables */
herr_t ret; /* Generic return status */
/* Output message about test being performed */
@@ -9849,11 +9850,18 @@ test_attr_bug3(hid_t fcpl, hid_t fapl)
aid2 = H5Aopen(did, "attr", H5P_DEFAULT);
CHECK(aid2, FAIL, "H5Aopen");
- /* Write data to the attributes (the data is uninitialized, we only care
- * that H5Awrite succeeds for now) */
- ret = H5Awrite(aid1, H5T_NATIVE_INT, wdata1[0]);
+ /* Initialize the write buffers */
+ for(u = 0; u < dims1[0]; u++)
+ for(v = 0; v < dims1[1]; v++)
+ wdata1[u][v] = (int)((u * dims1[1]) + v);
+ for(u = 0; u < dims2[0]; u++)
+ for(v = 0; v < dims2[1]; v++)
+ wdata2[u][v] = (int)((u * dims2[1]) + v);
+
+ /* Write data to the attributes */
+ ret = H5Awrite(aid1, H5T_NATIVE_INT, wdata1);
CHECK(ret, FAIL, "H5Awrite");
- ret = H5Awrite(aid2, H5T_NATIVE_UINT, wdata2[0]);
+ ret = H5Awrite(aid2, H5T_NATIVE_UINT, wdata2);
CHECK(ret, FAIL, "H5Awrite");
/* Close attributes */
diff --git a/test/testframe.c b/test/testframe.c
index 201f569..082a27f 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -588,3 +588,21 @@ void SetTest(const char *testname, int action)
break;
}
}
+
+
+/*
+ * Enable alarm on test execution, configurable by environment variable
+ */
+void TestAlarmOn(void)
+{
+ char * env_val = HDgetenv("HDF5_ALARM_SECONDS"); /* Alarm environment */
+ unsigned long alarm_sec = H5_ALARM_SEC; /* Number of seconds before alarm goes off */
+
+ /* Get the alarm value from the environment variable, if set */
+ if(env_val != NULL)
+ alarm_sec = (unsigned)HDstrtoul(env_val, (char **)NULL, 10);
+
+ /* Set the number of seconds before alarm goes off */
+ HDalarm((unsigned)alarm_sec);
+}
+
diff --git a/test/th5s.c b/test/th5s.c
index 2de867b..ddd61e3 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -889,6 +889,10 @@ test_h5s_compound_scalar_write(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
+ /* Close compound datatype */
+ ret = H5Tclose(tid1);
+ CHECK(ret, FAIL, "H5Tclose");
+
/* Close scalar dataspace */
ret = H5Sclose(sid1);
CHECK(ret, FAIL, "H5Sclose");
diff --git a/test/trefer.c b/test/trefer.c
index 6ee298f..4ab3fba 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -79,23 +79,19 @@ test_reference_params(void)
hobj_ref_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf; /* temp. buffer read from disk */
- hobj_ref_t nvrbuf[3]={0,101,1000000000}; /* buffer with non-valid refs */
unsigned *tu32; /* Temporary pointer to uint32 data */
- int i, j; /* counting variables */
- const char *write_comment="Foo!"; /* Comments for group */
- char read_comment[10];
- H5O_type_t obj_type; /* Object type */
+ int i; /* counting variables */
+ const char *write_comment = "Foo!"; /* Comments for group */
herr_t ret; /* Generic return value */
- char *ref_name; /* Buffer for ref name */
size_t name_size; /* Size of reference name */
/* Output message about test being performed */
MESSAGE(5, ("Testing Reference Parameters\n"));
/* Allocate write & read buffers */
- wbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
- rbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
- tbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ wbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ rbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ tbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
/* Create file */
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -263,9 +259,9 @@ test_reference_obj(void)
MESSAGE(5, ("Testing Object Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
- rbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
- tbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ wbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ rbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ tbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
/* Create file */
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -509,10 +505,10 @@ test_reference_region(void)
MESSAGE(5, ("Testing Dataset Region Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
- rbuf = HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
- dwbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- drbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
/* Create file */
fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -781,10 +777,10 @@ test_reference_region_1D(void)
MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
- rbuf = HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
- dwbuf = HDmalloc(sizeof(uint8_t) * SPACE3_DIM1);
- drbuf = HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1);
+ drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
/* Create file */
fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -922,7 +918,7 @@ test_reference_region_1D(void)
VERIFY(ret, 30, "H5Sget_select_npoints");
ret = (int)H5Sget_select_hyper_nblocks(sid3);
VERIFY(ret, 15, "H5Sget_select_hyper_nblocks");
- coords = HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
+ coords = (hsize_t *)HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
ret = H5Sget_select_hyper_blocklist(sid3, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
VERIFY(coords[0], 2, "Hyperslab Coordinates");
@@ -974,7 +970,7 @@ test_reference_region_1D(void)
VERIFY(ret, 10, "H5Sget_select_npoints");
ret = (int)H5Sget_select_elem_npoints(sid3);
VERIFY(ret, 10, "H5Sget_select_elem_npoints");
- coords = HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */
+ coords = (hsize_t *)HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */
ret = H5Sget_select_elem_pointlist(sid3, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
VERIFY(coords[0], coord1[0][0], "Element Coordinates");
@@ -1313,10 +1309,10 @@ test_reference_compat(void)
MESSAGE(5, ("Testing Deprecated Object Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf_obj = HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1);
- rbuf_obj = HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
- wbuf_reg = HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
- rbuf_reg = HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ wbuf_obj = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1);
+ rbuf_obj = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+ wbuf_reg = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ rbuf_reg = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
/* Create file */
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
diff --git a/test/tselect.c b/test/tselect.c
index 89cd9e5..1fa98bf 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -2795,7 +2795,7 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
* hence the following assertion. Delete it if we convert
* to 32 bit values.
*/
- HDassert(large_cube_size < (size_t)(UINT16_MAX));
+ HDassert(large_cube_size < (size_t)(64 * 1024));
/* Allocate & initialize buffers */
diff --git a/test/tsohm.c b/test/tsohm.c
index 8782a6d..62154b1 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -74,6 +74,7 @@ typedef struct dtype1_struct {
int i8;
float f1;
} dtype1_struct;
+
#define DTYPE2_SIZE 1024
const char *DSETNAME[] = {
"dataset0", "dataset1",
@@ -167,7 +168,9 @@ static hid_t make_dtype_1(void);
static hid_t make_dtype_2(void);
static hid_t close_reopen_file(hid_t file, const char* filename, hid_t fapl_id);
static void test_sohm_attrs(void);
+#ifdef NOT_NOW
static void size2_dump_struct(const char *name, size2_helper_struct *sizes);
+#endif /* NOT_NOW */
static void size2_verify(void);
static void test_sohm_delete(void);
static void test_sohm_delete_revert(void);
@@ -280,11 +283,10 @@ static void test_sohm_fcpl(void)
/* Set up index values */
ret = H5Pset_shared_mesg_nindexes(fcpl_id, TEST_NUM_INDEXES);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- for(x=0; x<TEST_NUM_INDEXES; ++x)
- {
+ for(x = 0; x < TEST_NUM_INDEXES; ++x) {
ret = H5Pset_shared_mesg_index(fcpl_id, x, test_type_flags[x], test_minsizes[x]);
CHECK_I(ret, "H5Pset_shared_mesg_index");
- }
+ } /* end for */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, TEST_L2B, TEST_B2L);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
@@ -419,8 +421,6 @@ static void test_sohm_fcpl(void)
* Programmer: James Laird
* Saturday, August 26, 2006
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hid_t
@@ -429,23 +429,23 @@ make_dtype_1(void)
hid_t dtype1_id = -1;
hid_t str_id = -1;
- /* Create compound datatype. */
- if((dtype1_id = H5Tcreate( H5T_COMPOUND, sizeof(struct dtype1_struct))) < 0) TEST_ERROR
+ /* Create compound datatype. */
+ if((dtype1_id = H5Tcreate(H5T_COMPOUND, sizeof(struct dtype1_struct))) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i1",HOFFSET(struct dtype1_struct,i1),H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i1", HOFFSET(dtype1_struct, i1), H5T_NATIVE_INT) < 0) TEST_ERROR
str_id = H5Tcopy(H5T_C_S1);
- if(H5Tset_size(str_id,(size_t) 10) < 0) TEST_ERROR
-
- if(H5Tinsert(dtype1_id,"vl_string",HOFFSET(dtype1_struct,str),str_id) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i2",HOFFSET(struct dtype1_struct,i2),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i3",HOFFSET(struct dtype1_struct,i3),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i4",HOFFSET(struct dtype1_struct,i4),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i5",HOFFSET(struct dtype1_struct,i5),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i6",HOFFSET(struct dtype1_struct,i6),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i7",HOFFSET(struct dtype1_struct,i7),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i8",HOFFSET(struct dtype1_struct,i8),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"f1",HOFFSET(struct dtype1_struct,f1),H5T_NATIVE_FLOAT) < 0) TEST_ERROR
+ if(H5Tset_size(str_id, (size_t)10) < 0) TEST_ERROR
+
+ if(H5Tinsert(dtype1_id, "string", HOFFSET(dtype1_struct, str), str_id) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i2", HOFFSET(dtype1_struct, i2), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i3", HOFFSET(dtype1_struct, i3), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i4", HOFFSET(dtype1_struct, i4), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i5", HOFFSET(dtype1_struct, i5), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i6", HOFFSET(dtype1_struct, i6), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i7", HOFFSET(dtype1_struct, i7), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i8", HOFFSET(dtype1_struct, i8), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "f1", HOFFSET(dtype1_struct, f1), H5T_NATIVE_FLOAT) < 0) TEST_ERROR
if(H5Tclose(str_id) < 0) TEST_ERROR
@@ -488,15 +488,13 @@ make_dtype_2(void)
/* Create an int with a strange precision */
if((int_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tset_precision(int_id, 24) < 0) TEST_ERROR
+ if(H5Tset_precision(int_id, (size_t)24) < 0) TEST_ERROR
/* Create an enumeration using that int */
if((enum_id = H5Tenum_create(int_id)) < 0) TEST_ERROR
- for(x=0; x<ENUM_NUM_MEMBS; x++)
- {
+ for(x = 0; x < ENUM_NUM_MEMBS; x++)
if(H5Tenum_insert(enum_id, ENUM_NAME[x], &ENUM_VAL[x]) < 0) TEST_ERROR
- }
/* Create arrays of arrays of arrays of enums */
if((dtype2_id = H5Tarray_create2(enum_id, 3, dims)) < 0) TEST_ERROR
@@ -572,14 +570,12 @@ error:
* Programmer: James Laird
* Monday, April 10, 2006
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hid_t
size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_closing)
{
- dtype1_struct wdata = {11, "string", 22, 33, 44, 55, 66, 77, 88, 0.0};
+ dtype1_struct wdata;
dtype1_struct rdata;
hid_t dtype1_id = -1;
hid_t space_id = -1;
@@ -593,23 +589,36 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos
if(GetTestExpress() > 1)
test_file_closing = 0;
+ /* Intialize wdata */
+ HDmemset(&wdata, 0, sizeof(wdata));
+ wdata.i1 = 11;
+ HDstrcpy(wdata.str, "string");
+ wdata.i2 = 22;
+ wdata.i3 = 33;
+ wdata.i4 = 44;
+ wdata.i5 = 55;
+ wdata.i6 = 66;
+ wdata.i7 = 77;
+ wdata.i8 = 88;
+ wdata.f1 = 0.0;
+
/* Intialize rdata */
- strcpy(rdata.str, "\0");
+ HDmemset(&rdata, 0, sizeof(rdata));
if((dtype1_id = make_dtype_1()) < 0) TEST_ERROR
/* Create the dataspace and dataset */
dim1[0] = 1;
- if((space_id=H5Screate_simple(1,dim1,NULL)) < 0) TEST_ERROR
+ if((space_id = H5Screate_simple(1, dim1, NULL)) < 0) TEST_ERROR
- if((dset_id = H5Dcreate2(file,DSETNAME[0],dtype1_id,space_id,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((dset_id = H5Dcreate2(file, DSETNAME[0], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Test writing and reading */
- if(H5Dwrite(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&wdata) < 0) FAIL_STACK_ERROR
+ if(H5Dwrite(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) FAIL_STACK_ERROR
- if(H5Dread(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata) < 0) FAIL_STACK_ERROR
+ if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) FAIL_STACK_ERROR
- if(rdata.i1!=wdata.i1 || rdata.i2!=wdata.i2 || HDstrcmp(rdata.str, wdata.str)) {
+ if(rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) {
H5_FAILED(); AT();
printf("incorrect read data\n");
goto error;
@@ -617,26 +626,23 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos
if(H5Dclose(dset_id) < 0) FAIL_STACK_ERROR
/* Close and re-open the file if requested*/
- if(test_file_closing) {
+ if(test_file_closing)
if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
- }
/* Create more datasets with the same datatype */
- if((dset_id = H5Dcreate2(file,DSETNAME[1],dtype1_id,space_id,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((dset_id = H5Dcreate2(file, DSETNAME[1], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if(H5Dclose(dset_id) < 0) FAIL_STACK_ERROR
/* Close and re-open the file if requested*/
- if(test_file_closing) {
+ if(test_file_closing)
if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
- }
- if((dset_id = H5Dcreate2(file,DSETNAME[2],dtype1_id,space_id,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dset_id = H5Dcreate2(file, DSETNAME[2], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(dset_id) < 0) TEST_ERROR
/* Close and re-open the file if requested*/
- if(test_file_closing) {
+ if(test_file_closing)
if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
- }
if((dset_id = H5Dcreate2(file,DSETNAME[3],dtype1_id,space_id,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -654,10 +660,8 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos
if((dset_id = H5Dopen2(file, DSETNAME[0], H5P_DEFAULT)) < 0) TEST_ERROR
if((dtype1_id = H5Dget_type(dset_id)) < 0) TEST_ERROR
- rdata.i1 = rdata.i2 = 0;
- HDstrcpy(rdata.str, "\0");
-
/* Read data back again */
+ HDmemset(&rdata, 0, sizeof(rdata));
if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
H5_FAILED(); AT();
printf("Can't read data\n");
@@ -689,9 +693,8 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos
if((dset_id = H5Dopen2(file, DSETNAME[3], H5P_DEFAULT)) < 0) TEST_ERROR
if((dtype1_id = H5Dget_type(dset_id)) < 0) TEST_ERROR
- rdata.i1 = rdata.i2 = 0;
-
/* Read data back again */
+ HDmemset(&rdata, 0, sizeof(rdata));
if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
H5_FAILED(); AT();
printf("Can't read data\n");
@@ -1016,12 +1019,11 @@ static void sohm_attr_helper(hid_t fcpl_id)
CHECK_I(ret, "H5Fflush");
/* Verify */
- memset(rdata, 0, sizeof(rdata));
+ HDmemset(rdata, 0, sizeof(rdata));
ret = H5Aread(attr_id, H5T_NATIVE_INT, rdata);
CHECK_I(ret, "H5Aread");
- for(x=0; x<(size_t)dims; ++x) {
+ for(x = 0; x < (size_t)dims; ++x)
VERIFY(rdata[x], wdata[x], "H5Aread");
- }
/* Cleanup */
ret = H5Aclose(attr_id);
@@ -1055,12 +1057,11 @@ static void sohm_attr_helper(hid_t fcpl_id)
CHECK_I(ret, "H5Fflush");
/* Verify */
- memset(rdata, 0, sizeof(rdata));
+ HDmemset(rdata, 0, sizeof(rdata));
ret = H5Aread(attr_id, H5T_NATIVE_INT, rdata);
CHECK_I(ret, "H5Aread");
- for(x=0; x<(size_t)dims; ++x) {
+ for(x = 0; x < (size_t)dims; ++x)
VERIFY(rdata[x], wdata[x], "H5Aread");
- }
/* Cleanup */
ret = H5Aclose(attr_id);
@@ -1092,13 +1093,12 @@ static void sohm_attr_helper(hid_t fcpl_id)
CHECK_I(ret, "H5Fflush");
/* Verify the data with another ID handle */
- memset(rdata, 0, sizeof(rdata));
+ HDmemset(rdata, 0, sizeof(rdata));
ret = H5Aread(attr_id2, H5T_NATIVE_INT, rdata);
CHECK_I(ret, "H5Aread");
- for(x=0; x<(size_t)dims; ++x) {
+ for(x = 0; x < (size_t)dims; ++x)
VERIFY(rdata[x], wdata[x], "H5Aread");
- }
/* Cleanup */
ret = H5Aclose(attr_id);
@@ -1249,23 +1249,23 @@ static void size2_verify_plist1(hid_t plist)
/* Hardcoded to correspond to dcpl1_id created in size2_helper */
/* Check filters */
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_SHUFFLE, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 1, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_SHUFFLE, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_FLETCHER32, "H5Pget_filter2");
@@ -1273,7 +1273,7 @@ static void size2_verify_plist1(hid_t plist)
/* Check fill value */
dtype1_id=make_dtype_1();
CHECK_I(dtype1_id, "make_dtype_1");
- memset(&fill1_correct, '1', sizeof(fill1_correct));
+ HDmemset(&fill1_correct, '1', sizeof(fill1_correct));
ret = H5Pget_fill_value(plist, dtype1_id, &fill1);
CHECK_I(ret, "H5Pget_fill_value");
@@ -1308,48 +1308,49 @@ static void size2_verify_plist2(hid_t plist)
/* Hardcoded to correspond to dcpl1_id created in size2_helper */
/* Check filters */
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 1, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 2, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 2, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 1, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 4, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 4, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 5, "H5Pget_filter2");
/* Check fill value */
- dtype2_id=make_dtype_2();
+ dtype2_id = make_dtype_2();
CHECK_I(dtype2_id, "make_dtype_2");
- memset(&fill2_correct, '2', DTYPE2_SIZE);
+ HDmemset(&fill2_correct, '2', (size_t)DTYPE2_SIZE);
ret = H5Pget_fill_value(plist, dtype2_id, &fill2);
CHECK_I(ret, "H5Pget_fill_value");
- ret = memcmp(&fill2, &fill2_correct, DTYPE2_SIZE);
+ ret = HDmemcmp(&fill2, &fill2_correct, (size_t)DTYPE2_SIZE);
VERIFY(ret, 0, memcmp);
}
+#ifdef NOT_NOW
/*-------------------------------------------------------------------------
* Function: size2_dump_struct
@@ -1378,6 +1379,7 @@ size2_dump_struct(const char *name, size2_helper_struct *sizes)
printf(" attributes: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs1, (unsigned long long)(sizes->attrs1 - sizes->interleaved));
printf(" attributes 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs2, (unsigned long long)(sizes->attrs2 - sizes->attrs1));
}
+#endif /* NOT_NOW */
/*-------------------------------------------------------------------------
@@ -1466,7 +1468,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
* We'll set them in the DCPL.
*/
HDmemset(&fill1, '1', sizeof(dtype1_struct));
- HDmemset(&fill2, '2', DTYPE2_SIZE);
+ HDmemset(&fill2, '2', (size_t)DTYPE2_SIZE);
dcpl1_id = H5Pcreate(H5P_DATASET_CREATE);
CHECK_I(dcpl1_id, "H5Pcreate");
@@ -1509,8 +1511,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
size2_verify_plist2(dcpl2_id);
/* Set up attribute data */
- HDmemset(attr_string1, 0, NAME_BUF_SIZE);
- HDmemset(attr_string2, 0, NAME_BUF_SIZE);
+ HDmemset(attr_string1, 0, (size_t)NAME_BUF_SIZE);
+ HDmemset(attr_string2, 0, (size_t)NAME_BUF_SIZE);
HDstrcpy(attr_string1, LONG_STRING);
HDstrcpy(attr_string2, LONG_STRING);
attr_string2[1] = '1'; /* The second string starts "01 index..." */
@@ -1518,7 +1520,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
/* Set up attribute metadata */
attr_type_id = H5Tcopy(H5T_C_S1);
CHECK_I(attr_type_id, "H5Tcopy");
- ret = H5Tset_size(attr_type_id ,NAME_BUF_SIZE);
+ ret = H5Tset_size(attr_type_id, (size_t)NAME_BUF_SIZE);
CHECK_I(ret, "H5Tset_size");
attr_space_id = H5Screate_simple(1, dims, dims);
CHECK_I(attr_space_id, "H5Screate_simple");
@@ -1669,10 +1671,9 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
group_id = H5Gopen2(file_id, "group", H5P_DEFAULT);
CHECK_I(group_id, "H5Gopen2");
- strcpy(attr_name, "00 index");
+ HDstrcpy(attr_name, "00 index");
- for(x=0; x<NUM_ATTRIBUTES; ++x)
- {
+ for(x = 0; x < NUM_ATTRIBUTES; ++x) {
/* Create a unique name and value for each attribute */
attr_string1[0] = attr_name[0] = (x / 10) + '0';
attr_string1[1] = attr_name[1] = (x % 10) + '0';
@@ -1917,7 +1918,7 @@ static void size2_verify(void)
/* Create attribute data type */
attr_type_id = H5Tcopy(H5T_C_S1);
CHECK_I(attr_type_id, "H5Tcopy");
- ret = H5Tset_size(attr_type_id ,NAME_BUF_SIZE);
+ ret = H5Tset_size(attr_type_id, (size_t)NAME_BUF_SIZE);
CHECK_I(ret, "H5Tset_size");
/* Read attributes on both groups and verify that they are correct */
@@ -1926,8 +1927,8 @@ static void size2_verify(void)
group2_id = H5Gopen2(file_id, "interleaved group", H5P_DEFAULT);
CHECK_I(group2_id, "H5Gopen2");
- HDmemset(attr_string, 0, NAME_BUF_SIZE);
- HDmemset(attr_correct_string, 0, NAME_BUF_SIZE);
+ HDmemset(attr_string, 0, (size_t)NAME_BUF_SIZE);
+ HDmemset(attr_correct_string, 0, (size_t)NAME_BUF_SIZE);
HDstrcpy(attr_correct_string, LONG_STRING);
HDstrcpy(attr_name, "00 index");
@@ -2785,11 +2786,12 @@ static void
test_sohm_delete(void)
{
hid_t fcpl_id;
- /* We'll use dataspaces, filter pipelines, and attributes for this
- * test. Create a number of distinct messages of each type.
+ /* We'll use dataspaces and filter pipelines for this test.
+ * Create a number of distinct messages of each type.
*/
hid_t dspace_id[DELETE_NUM_MESGS] = {0};
hid_t dcpl_id[DELETE_NUM_MESGS] = {0};
+ unsigned u;
int x;
hsize_t dims[] = DELETE_DIMS;
herr_t ret;
@@ -2797,10 +2799,10 @@ test_sohm_delete(void)
/* Create a number of different dataspaces.
* For simplicity, each dataspace has only one element.
*/
- for(x=0; x<DELETE_NUM_MESGS; ++x) {
- dspace_id[x] = H5Screate_simple(x + 1, dims, dims);
- CHECK_I(dspace_id[x], "H5Screate_simple");
- }
+ for(u = 0; u < DELETE_NUM_MESGS; ++u) {
+ dspace_id[u] = H5Screate_simple((int)(u + 1), dims, dims);
+ CHECK_I(dspace_id[u], "H5Screate_simple");
+ } /* end for */
/* Create a number of different filter pipelines. */
dcpl_id[0] = H5Pcreate(H5P_DATASET_CREATE);
@@ -2811,21 +2813,21 @@ test_sohm_delete(void)
ret = H5Pset_shuffle(dcpl_id[0]);
CHECK_I(ret, "H5Pset_shuffle");
- for(x=1; x<DELETE_NUM_MESGS; x+=2) {
- dcpl_id[x] = H5Pcopy(dcpl_id[x-1]);
- CHECK_I(dcpl_id[x], "H5Pcopy");
- ret = H5Pset_chunk(dcpl_id[x], x+1, dims);
+ for(u = 1; u < DELETE_NUM_MESGS; u += 2) {
+ dcpl_id[u] = H5Pcopy(dcpl_id[u - 1]);
+ CHECK_I(dcpl_id[u], "H5Pcopy");
+ ret = H5Pset_chunk(dcpl_id[u], (int)(u + 1), dims);
CHECK_I(ret, "H5Pset_chunk");
- ret = H5Pset_deflate(dcpl_id[x], 1);
+ ret = H5Pset_deflate(dcpl_id[u], 1);
CHECK_I(ret, "H5Pset_deflate");
- dcpl_id[x+1] = H5Pcopy(dcpl_id[x]);
- CHECK_I(dcpl_id[x+1], "H5Pcopy");
- ret = H5Pset_chunk(dcpl_id[x+1], x+2, dims);
+ dcpl_id[u + 1] = H5Pcopy(dcpl_id[u]);
+ CHECK_I(dcpl_id[u + 1], "H5Pcopy");
+ ret = H5Pset_chunk(dcpl_id[u + 1], (int)(u + 2), dims);
CHECK_I(ret, "H5Pset_chunk");
- ret = H5Pset_shuffle(dcpl_id[x+1]);
+ ret = H5Pset_shuffle(dcpl_id[u + 1]);
CHECK_I(ret, "H5Pset_shuffle");
- }
+ } /* end for */
/* Create an fcpl where all messages are shared in the same index */
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
@@ -2889,22 +2891,22 @@ test_sohm_delete(void)
*/
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- for(x=DELETE_MIN_MESG_SIZE; x<=DELETE_MAX_MESG_SIZE; x += 10) {
- ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, (size_t) x);
+ for(u = DELETE_MIN_MESG_SIZE; u <= DELETE_MAX_MESG_SIZE; u += 10) {
+ ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, u);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
delete_helper(fcpl_id, dspace_id, dcpl_id);
- }
+ } /* end for */
/* Cleanup */
ret = H5Pclose(fcpl_id);
CHECK_I(ret, "H5Pclose");
- for(x=DELETE_NUM_MESGS - 1; x>=0; --x) {
+ for(x = DELETE_NUM_MESGS - 1; x >= 0; --x) {
ret = H5Sclose(dspace_id[x]);
CHECK_I(ret, "H5Sclose");
ret = H5Pclose(dcpl_id[x]);
CHECK_I(ret, "H5Pclose");
- }
+ } /* end for */
} /* end test_sohm_delete() */
diff --git a/test/tvlstr.c b/test/tvlstr.c
index fbced5f..87008aa 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -29,16 +29,9 @@
#define DATAFILE2 "tvlstr2.h5"
/* 1-D dataset with fixed dimensions */
-#define SPACE1_NAME "Space1"
#define SPACE1_RANK 1
#define SPACE1_DIM1 4
-/* 2-D dataset with fixed dimensions */
-#define SPACE2_NAME "Space2"
-#define SPACE2_RANK 2
-#define SPACE2_DIM1 10
-#define SPACE2_DIM2 10
-
#define VLSTR_TYPE "vl_string_type"
/* Definitions for the VL re-writing test */
@@ -599,21 +592,14 @@ static void test_write_vl_string_attribute(void)
ret = H5Awrite(att, type, &string_att);
CHECK(ret, FAIL, "H5Awrite");
- /* Allocate memory for read buffer */
- if(string_att)
- string_att_check = (char*)HDmalloc((strlen(string_att) + 1) * sizeof(char));
- CHECK(string_att_check, NULL, "HDmalloc");
-
- if(string_att_check) {
- ret = H5Aread(att, type, &string_att_check);
- CHECK(ret, FAIL, "H5Aread");
+ ret = H5Aread(att, type, &string_att_check);
+ CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
+ if(HDstrcmp(string_att_check,string_att) != 0)
+ TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
- HDfree(string_att_check);
- string_att_check = NULL;
- }
+ HDfree(string_att_check);
+ string_att_check = NULL;
ret = H5Aclose(att);
CHECK(ret, FAIL, "HAclose");
@@ -628,22 +614,14 @@ static void test_write_vl_string_attribute(void)
ret = H5Awrite(att, type, &string_att_write);
CHECK(ret, FAIL, "H5Awrite");
- /* Allocate memory for read buffer */
- if(string_att_write)
- string_att_check = (char*)HDmalloc((strlen(string_att_write) + 1) * sizeof(char));
- CHECK(string_att_check, NULL, "HDmalloc");
+ ret = H5Aread(att, type, &string_att_check);
+ CHECK(ret, FAIL, "H5Aread");
- if(string_att_check) {
- ret = H5Aread(att, type, &string_att_check);
- CHECK(ret, FAIL, "H5Aread");
+ if(HDstrcmp(string_att_check,string_att_write) != 0)
+ TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
- if(HDstrcmp(string_att_check,string_att_write)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
-
- /* The attribute string written is freed below, in the
- *test_read_vl_string_attribute() test */
- HDfree(string_att_check);
- }
+ HDfree(string_att_check);
+ string_att_check = NULL;
/* The attribute string written is freed below, in the test_read_vl_string_attribute() test */
/* HDfree(string_att_write); */
@@ -697,21 +675,14 @@ static void test_read_vl_string_attribute(void)
att = H5Aopen(root, "test_scalar", H5P_DEFAULT);
CHECK(att, FAIL, "H5Aopen");
- /* Allocate memory for read buffer */
- if(string_att)
- string_att_check = (char*)HDmalloc((strlen(string_att) + 1) * sizeof(char));
- CHECK(string_att_check, NULL, "HDmalloc");
+ ret = H5Aread(att, type, &string_att_check);
+ CHECK(ret, FAIL, "H5Aread");
- if(string_att_check) {
- ret = H5Aread(att, type, &string_att_check);
- CHECK(ret, FAIL, "H5Aread");
+ if(HDstrcmp(string_att_check,string_att) != 0)
+ TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
- if(HDstrcmp(string_att_check,string_att)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
-
- HDfree(string_att_check);
- string_att_check = NULL;
- }
+ HDfree(string_att_check);
+ string_att_check = NULL;
ret = H5Aclose(att);
CHECK(ret, FAIL, "HAclose");
@@ -720,19 +691,15 @@ static void test_read_vl_string_attribute(void)
att = H5Aopen(root, "test_scalar_large", H5P_DEFAULT);
CHECK(att, FAIL, "H5Aopen");
- /* Allocate memory for read buffer */
- if(string_att_write)
- string_att_check = (char*)HDmalloc((strlen(string_att_write) + 1) * sizeof(char));
- CHECK(string_att_check, NULL, "HDmalloc");
-
- if(string_att_check) {
+ if(string_att_write) {
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att_write)!=0)
+ if(HDstrcmp(string_att_check,string_att_write) != 0)
TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
HDfree(string_att_check);
+ string_att_check = NULL;
}
/* Free string allocated in test_write_vl_string_attribute */