summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2021-05-03 19:54:30 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2021-05-03 19:54:30 (GMT)
commited31eeacfadb6b0c07e2b46d4c16bcbc1747d2e1 (patch)
tree190433c1113b330aeda39b2505c32070e9a5550a /hl
parenta58881550d74626a38c127bff4a7f6a1be03474d (diff)
downloadhdf5-ed31eeacfadb6b0c07e2b46d4c16bcbc1747d2e1.zip
hdf5-ed31eeacfadb6b0c07e2b46d4c16bcbc1747d2e1.tar.gz
hdf5-ed31eeacfadb6b0c07e2b46d4c16bcbc1747d2e1.tar.bz2
Many small changes from develop. Should allows running VFD SWMR
tests from CMake.
Diffstat (limited to 'hl')
-rw-r--r--hl/c++/src/CMakeLists.txt6
-rw-r--r--hl/c++/src/H5PacketTable.h2
-rw-r--r--hl/fortran/src/CMakeLists.txt18
-rw-r--r--hl/src/CMakeLists.txt6
-rw-r--r--hl/src/H5TB.c342
-rw-r--r--hl/test/test_image.c11
6 files changed, 199 insertions, 186 deletions
diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt
index 1eac9fe..e488656 100644
--- a/hl/c++/src/CMakeLists.txt
+++ b/hl/c++/src/CMakeLists.txt
@@ -120,7 +120,11 @@ install (
)
if (NOT WIN32 AND NOT MINGW)
- set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER})
+ if (HDF5_ENABLE_PARALLEL AND MPI_CXX_FOUND)
+ set (_PKG_CONFIG_COMPILER ${MPI_CXX_COMPILER})
+ else ()
+ set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER})
+ endif ()
configure_file (
${HDF_RESOURCES_DIR}/libh5cc.in
${HDF5_BINARY_DIR}/CMakeFiles/h5hlc++
diff --git a/hl/c++/src/H5PacketTable.h b/hl/c++/src/H5PacketTable.h
index a73b4c9..acd0ccf 100644
--- a/hl/c++/src/H5PacketTable.h
+++ b/hl/c++/src/H5PacketTable.h
@@ -35,7 +35,7 @@ class H5_HLCPPDLL PacketTable {
*/
PacketTable()
{
- table_id = H5I_BADID;
+ table_id = H5I_INVALID_HID;
}
/* "Open" Constructor
diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt
index 0b7795b..4f0b451 100644
--- a/hl/fortran/src/CMakeLists.txt
+++ b/hl/fortran/src/CMakeLists.txt
@@ -114,15 +114,15 @@ set (HDF5_HL_F90_F_BASE_SOURCES
)
if (NOT ONLY_SHARED_LIBS)
- add_custom_command (
- OUTPUT ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90
+ add_custom_command (TARGET H5HL_buildiface POST_BUILD
+ BYPRODUCTS $H5LTff_gen.F90 H5TBff_gen.F90
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5HL_buildiface>
WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/static
DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES}
COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files"
)
add_custom_target (H5HLgen ALL
- DEPENDS ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90
+ DEPENDS H5HL_buildiface ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90
)
set_source_files_properties (
${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90
@@ -131,15 +131,15 @@ if (NOT ONLY_SHARED_LIBS)
)
endif ()
if (BUILD_SHARED_LIBS)
- add_custom_command (
- OUTPUT ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90
+ add_custom_command (TARGET H5HL_buildiface POST_BUILD
+ BYPRODUCTS H5LTff_gen.F90 H5TBff_gen.F90
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5HL_buildiface>
WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/shared
DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES}
COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 shared files"
)
add_custom_target (H5HLgenSH ALL
- DEPENDS ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90
+ DEPENDS H5HL_buildiface ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90
)
set_source_files_properties (
${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90
@@ -353,7 +353,11 @@ install (
)
if (NOT WIN32 AND NOT MINGW)
- set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER})
+ if (HDF5_ENABLE_PARALLEL AND MPI_Fortran_FOUND)
+ set (_PKG_CONFIG_COMPILER ${MPI_Fortran_COMPILER})
+ else ()
+ set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER})
+ endif ()
configure_file (
${HDF_RESOURCES_DIR}/libh5cc.in
${HDF5_BINARY_DIR}/CMakeFiles/h5hlfc
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt
index 785bdcf..427424e 100644
--- a/hl/src/CMakeLists.txt
+++ b/hl/src/CMakeLists.txt
@@ -152,7 +152,11 @@ install (
)
if (NOT WIN32 AND NOT MINGW)
- set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER})
+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND)
+ set (_PKG_CONFIG_COMPILER ${MPI_C_COMPILER})
+ else ()
+ set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER})
+ endif ()
configure_file (
${HDF_RESOURCES_DIR}/libh5cc.in
${HDF5_BINARY_DIR}/CMakeFiles/h5hlcc
diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c
index 1ac162f..efa61a3 100644
--- a/hl/src/H5TB.c
+++ b/hl/src/H5TB.c
@@ -57,11 +57,11 @@ H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsi
hsize_t nrecords, size_t type_size, const char *field_names[], const size_t *field_offset,
const hid_t *field_types, hsize_t chunk_size, void *fill_data, int compress, const void *buf)
{
- hid_t did = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
- hid_t plist_id = H5I_BADID;
- hid_t attr_id = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t mem_type_id = H5I_INVALID_HID;
+ hid_t plist_id = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
hsize_t dims[1];
hsize_t dims_chunk[1];
hsize_t maxdims[1] = {H5S_UNLIMITED};
@@ -129,17 +129,17 @@ H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsi
/* terminate access to the data space. */
if (H5Sclose(sid) < 0)
goto out;
- sid = H5I_BADID;
+ sid = H5I_INVALID_HID;
/* end access to the dataset */
if (H5Dclose(did) < 0)
goto out;
- did = H5I_BADID;
+ did = H5I_INVALID_HID;
/* end access to the property list */
if (H5Pclose(plist_id) < 0)
goto out;
- plist_id = H5I_BADID;
+ plist_id = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* set the conforming table attributes
@@ -196,24 +196,24 @@ H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsi
if (H5Aclose(attr_id) < 0)
goto out;
- attr_id = H5I_BADID;
+ attr_id = H5I_INVALID_HID;
} /* end for */
/* terminate access to the data space. */
if (H5Sclose(sid) < 0)
goto out;
- sid = H5I_BADID;
+ sid = H5I_INVALID_HID;
/* end access to the dataset */
if (H5Dclose(did) < 0)
goto out;
- did = H5I_BADID;
+ did = H5I_INVALID_HID;
} /* end if */
/* release the datatype. */
if (H5Tclose(mem_type_id) < 0)
goto out;
- mem_type_id = H5I_BADID;
+ mem_type_id = H5I_INVALID_HID;
ret_val = 0;
@@ -267,9 +267,9 @@ herr_t
H5TBappend_records(hid_t loc_id, const char *dset_name, hsize_t nrecords, size_t type_size,
const size_t *field_offset, const size_t *field_sizes, const void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t mem_type_id = H5I_INVALID_HID;
hsize_t nrecords_orig;
hsize_t nfields;
herr_t ret_val = -1;
@@ -332,11 +332,11 @@ herr_t
H5TBwrite_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size,
const size_t *field_offset, const size_t *field_sizes, const void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t mem_type_id = H5I_INVALID_HID;
hsize_t count[1];
hsize_t offset[1];
hsize_t mem_size[1];
@@ -425,14 +425,14 @@ H5TBwrite_fields_name(hid_t loc_id, const char *dset_name, const char *field_nam
hsize_t nrecords, size_t type_size, const size_t *field_offset,
const size_t *field_sizes, const void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t write_type_id = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t nmtype_id = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hid_t file_space_id = H5I_BADID;
- hid_t preserve_id = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t write_type_id = H5I_INVALID_HID;
+ hid_t member_type_id = H5I_INVALID_HID;
+ hid_t nmtype_id = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t file_space_id = H5I_INVALID_HID;
+ hid_t preserve_id = H5I_INVALID_HID;
hssize_t nfields;
hssize_t i, j;
hsize_t count[1];
@@ -510,10 +510,10 @@ H5TBwrite_fields_name(hid_t loc_id, const char *dset_name, const char *field_nam
/* close */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
if (H5Tclose(nmtype_id) < 0)
goto out;
- nmtype_id = H5I_BADID;
+ nmtype_id = H5I_INVALID_HID;
} /* end if */
H5free_memory(member_name);
@@ -583,14 +583,14 @@ H5TBwrite_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, con
hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset,
const size_t *field_sizes, const void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t write_type_id = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t nmtype_id = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hid_t file_space_id = H5I_BADID;
- hid_t preserve_id = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t write_type_id = H5I_INVALID_HID;
+ hid_t member_type_id = H5I_INVALID_HID;
+ hid_t nmtype_id = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t file_space_id = H5I_INVALID_HID;
+ hid_t preserve_id = H5I_INVALID_HID;
hsize_t count[1];
hsize_t offset[1];
hsize_t i;
@@ -663,10 +663,10 @@ H5TBwrite_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, con
/* close */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
if (H5Tclose(nmtype_id) < 0)
goto out;
- nmtype_id = H5I_BADID;
+ nmtype_id = H5I_INVALID_HID;
H5free_memory(member_name);
member_name = NULL;
@@ -747,10 +747,10 @@ herr_t
H5TBread_table(hid_t loc_id, const char *dset_name, size_t type_size, const size_t *field_offset,
const size_t *field_sizes, void *dst_buf)
{
- hid_t did = H5I_BADID;
- hid_t ftype_id = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
- hid_t sid = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t ftype_id = H5I_INVALID_HID;
+ hid_t mem_type_id = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
hsize_t dims[1];
herr_t ret_val = -1;
@@ -820,9 +820,9 @@ herr_t
H5TBread_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size,
const size_t *field_offset, const size_t *field_sizes, void *buf)
{
- hid_t did = H5I_BADID;
- hid_t ftype_id = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t ftype_id = H5I_INVALID_HID;
+ hid_t mem_type_id = H5I_INVALID_HID;
hsize_t nrecords_orig;
hsize_t nfields;
herr_t ret_val = -1;
@@ -887,13 +887,13 @@ H5TBread_fields_name(hid_t loc_id, const char *dset_name, const char *field_name
hsize_t nrecords, size_t type_size, const size_t *field_offset,
const size_t *field_sizes, void *buf)
{
- hid_t did = H5I_BADID;
- hid_t ftype_id = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
- hid_t mtype_id = H5I_BADID;
- hid_t nmtype_id = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t ftype_id = H5I_INVALID_HID;
+ hid_t mem_type_id = H5I_INVALID_HID;
+ hid_t mtype_id = H5I_INVALID_HID;
+ hid_t nmtype_id = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
hssize_t nfields;
hsize_t count[1];
hsize_t offset[1];
@@ -960,10 +960,10 @@ H5TBread_fields_name(hid_t loc_id, const char *dset_name, const char *field_name
/* close */
if (H5Tclose(mtype_id) < 0)
goto out;
- mtype_id = H5I_BADID;
+ mtype_id = H5I_INVALID_HID;
if (H5Tclose(nmtype_id) < 0)
goto out;
- nmtype_id = H5I_BADID;
+ nmtype_id = H5I_INVALID_HID;
j++;
} /* end if */
@@ -1044,13 +1044,13 @@ H5TBread_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, cons
hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset,
const size_t *field_sizes, void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t read_type_id = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t nmtype_id = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t read_type_id = H5I_INVALID_HID;
+ hid_t member_type_id = H5I_INVALID_HID;
+ hid_t nmtype_id = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
hsize_t count[1];
hsize_t offset[1];
hsize_t mem_size[1];
@@ -1117,10 +1117,10 @@ H5TBread_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, cons
/* close the member type */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
if (H5Tclose(nmtype_id) < 0)
goto out;
- nmtype_id = H5I_BADID;
+ nmtype_id = H5I_INVALID_HID;
H5free_memory(member_name);
member_name = NULL;
@@ -1198,11 +1198,11 @@ out:
herr_t
H5TBdelete_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t mem_type_id = H5I_INVALID_HID;
hsize_t nfields;
hsize_t ntotal_records;
hsize_t read_start;
@@ -1294,16 +1294,16 @@ H5TBdelete_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nr
/* close */
if (H5Sclose(m_sid) < 0)
goto out;
- m_sid = H5I_BADID;
+ m_sid = H5I_INVALID_HID;
if (H5Tclose(mem_type_id) < 0)
goto out;
- mem_type_id = H5I_BADID;
+ mem_type_id = H5I_INVALID_HID;
if (H5Sclose(sid) < 0)
goto out;
- sid = H5I_BADID;
+ sid = H5I_INVALID_HID;
if (H5Tclose(tid) < 0)
goto out;
- tid = H5I_BADID;
+ tid = H5I_INVALID_HID;
} /* read_nrecords */
/*-------------------------------------------------------------------------
@@ -1361,11 +1361,11 @@ herr_t
H5TBinsert_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size,
const size_t *field_offset, const size_t *field_sizes, void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t mem_type_id = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
hsize_t nfields;
hsize_t ntotal_records;
hsize_t read_nrecords;
@@ -1442,10 +1442,10 @@ H5TBinsert_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nr
/* terminate access to the dataspace */
if (H5Sclose(m_sid) < 0)
goto out;
- m_sid = H5I_BADID;
+ m_sid = H5I_INVALID_HID;
if (H5Sclose(sid) < 0)
goto out;
- sid = H5I_BADID;
+ sid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* write the "pushed down" records
@@ -1513,10 +1513,10 @@ herr_t
H5TBadd_records_from(hid_t loc_id, const char *dset_name1, hsize_t start1, hsize_t nrecords,
const char *dset_name2, hsize_t start2)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
hsize_t count[1];
hsize_t offset[1];
hsize_t mem_size[1];
@@ -1643,24 +1643,24 @@ H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const c
const char *dset_name3)
{
/* identifiers for the 1st dataset. */
- hid_t did_1 = H5I_BADID;
- hid_t tid_1 = H5I_BADID;
- hid_t sid_1 = H5I_BADID;
- hid_t pid_1 = H5I_BADID;
+ hid_t did_1 = H5I_INVALID_HID;
+ hid_t tid_1 = H5I_INVALID_HID;
+ hid_t sid_1 = H5I_INVALID_HID;
+ hid_t pid_1 = H5I_INVALID_HID;
/* identifiers for the 2nd dataset. */
- hid_t did_2 = H5I_BADID;
- hid_t tid_2 = H5I_BADID;
- hid_t sid_2 = H5I_BADID;
- hid_t pid_2 = H5I_BADID;
+ hid_t did_2 = H5I_INVALID_HID;
+ hid_t tid_2 = H5I_INVALID_HID;
+ hid_t sid_2 = H5I_INVALID_HID;
+ hid_t pid_2 = H5I_INVALID_HID;
/* identifiers for the 3rd dataset. */
- hid_t did_3 = H5I_BADID;
- hid_t tid_3 = H5I_BADID;
- hid_t sid_3 = H5I_BADID;
- hid_t pid_3 = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t attr_id = H5I_BADID;
+ hid_t did_3 = H5I_INVALID_HID;
+ hid_t tid_3 = H5I_INVALID_HID;
+ hid_t sid_3 = H5I_INVALID_HID;
+ hid_t pid_3 = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t member_type_id = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
hsize_t count[1];
hsize_t offset[1];
hsize_t mem_size[1];
@@ -1807,17 +1807,17 @@ H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const c
if (H5Aclose(attr_id) < 0)
goto out;
- attr_id = H5I_BADID;
+ attr_id = H5I_INVALID_HID;
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
} /* end for */
/* close data space. */
if (H5Sclose(sid) < 0)
goto out;
- sid = H5I_BADID;
+ sid = H5I_INVALID_HID;
} /* end if */
/*-------------------------------------------------------------------------
@@ -1856,7 +1856,7 @@ H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const c
*/
if (H5Sclose(m_sid) < 0)
goto out;
- m_sid = H5I_BADID;
+ m_sid = H5I_INVALID_HID;
HDfree(tmp_buf);
tmp_buf = NULL;
@@ -1999,25 +1999,25 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi
hsize_t position, const void *fill_data, const void *buf)
{
/* identifiers for the 1st, original dataset */
- hid_t did_1 = H5I_BADID;
- hid_t tid_1 = H5I_BADID;
- hid_t sid_1 = H5I_BADID;
- hid_t pid_1 = H5I_BADID;
- hid_t msid_1 = H5I_BADID;
+ hid_t did_1 = H5I_INVALID_HID;
+ hid_t tid_1 = H5I_INVALID_HID;
+ hid_t sid_1 = H5I_INVALID_HID;
+ hid_t pid_1 = H5I_INVALID_HID;
+ hid_t msid_1 = H5I_INVALID_HID;
/* identifiers for the 2nd, new dataset */
- hid_t did_2 = H5I_BADID;
- hid_t tid_2 = H5I_BADID;
- hid_t sid_2 = H5I_BADID;
- hid_t pid_2 = H5I_BADID;
- hid_t msid_2 = H5I_BADID;
+ hid_t did_2 = H5I_INVALID_HID;
+ hid_t tid_2 = H5I_INVALID_HID;
+ hid_t sid_2 = H5I_INVALID_HID;
+ hid_t pid_2 = H5I_INVALID_HID;
+ hid_t msid_2 = H5I_INVALID_HID;
/* identifiers for the 3rd, final dataset */
- hid_t did_3 = H5I_BADID;
- hid_t tid_3 = H5I_BADID;
- hid_t sid_3 = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t write_type_id = H5I_BADID;
- hid_t preserve_id = H5I_BADID;
- hid_t attr_id = H5I_BADID;
+ hid_t did_3 = H5I_INVALID_HID;
+ hid_t tid_3 = H5I_INVALID_HID;
+ hid_t sid_3 = H5I_INVALID_HID;
+ hid_t member_type_id = H5I_INVALID_HID;
+ hid_t write_type_id = H5I_INVALID_HID;
+ hid_t preserve_id = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
size_t member_size;
size_t new_member_size = 0;
size_t total_size;
@@ -2157,7 +2157,7 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi
/* close the member type */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
} /* end else */
} /* end for */
@@ -2307,12 +2307,12 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi
if (H5Aclose(attr_id) < 0)
goto out;
- attr_id = H5I_BADID;
+ attr_id = H5I_INVALID_HID;
/* close the member type */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
} /* end for */
/*-------------------------------------------------------------------------
@@ -2334,11 +2334,11 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi
if (H5Aclose(attr_id) < 0)
goto out;
- attr_id = H5I_BADID;
+ attr_id = H5I_INVALID_HID;
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
} /* end fill_data */
ret_val = 0;
@@ -2415,23 +2415,23 @@ herr_t
H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
{
/* identifiers for the 1st original dataset */
- hid_t did_1 = H5I_BADID;
- hid_t tid_1 = H5I_BADID;
- hid_t sid_1 = H5I_BADID;
- hid_t pid_1 = H5I_BADID;
+ hid_t did_1 = H5I_INVALID_HID;
+ hid_t tid_1 = H5I_INVALID_HID;
+ hid_t sid_1 = H5I_INVALID_HID;
+ hid_t pid_1 = H5I_INVALID_HID;
/* identifiers for the 2nd new dataset */
- hid_t did_2 = H5I_BADID;
- hid_t tid_2 = H5I_BADID;
- hid_t sid_2 = H5I_BADID;
- hid_t pid_2 = H5I_BADID;
+ hid_t did_2 = H5I_INVALID_HID;
+ hid_t tid_2 = H5I_INVALID_HID;
+ hid_t sid_2 = H5I_INVALID_HID;
+ hid_t pid_2 = H5I_INVALID_HID;
/* identifiers for the 3rd final dataset */
- hid_t did_3 = H5I_BADID;
- hid_t tid_3 = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t preserve_id = H5I_BADID;
- hid_t read_type_id = H5I_BADID;
- hid_t write_type_id = H5I_BADID;
- hid_t attr_id = H5I_BADID;
+ hid_t did_3 = H5I_INVALID_HID;
+ hid_t tid_3 = H5I_INVALID_HID;
+ hid_t member_type_id = H5I_INVALID_HID;
+ hid_t preserve_id = H5I_INVALID_HID;
+ hid_t read_type_id = H5I_INVALID_HID;
+ hid_t write_type_id = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
size_t member_size;
size_t type_size1;
size_t type_size2;
@@ -2515,7 +2515,7 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
/* close the member type */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
H5free_memory(member_name);
member_name = NULL;
@@ -2598,7 +2598,7 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
/* close the member type */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
} /* end if */
H5free_memory(member_name);
@@ -2682,22 +2682,22 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
/* end access to the property list */
if (H5Pclose(preserve_id) < 0)
goto out;
- preserve_id = H5I_BADID;
+ preserve_id = H5I_INVALID_HID;
/* close the member type */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
/* close the read type */
if (H5Tclose(read_type_id) < 0)
goto out;
- read_type_id = H5I_BADID;
+ read_type_id = H5I_INVALID_HID;
/* close the write type */
if (H5Tclose(write_type_id) < 0)
goto out;
- write_type_id = H5I_BADID;
+ write_type_id = H5I_INVALID_HID;
HDfree(tmp_buf);
tmp_buf = NULL;
@@ -2769,18 +2769,18 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
if (H5Aclose(attr_id) < 0)
goto out;
- attr_id = H5I_BADID;
+ attr_id = H5I_INVALID_HID;
/* close the member type */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
} /* end for */
/* close data space. */
if (H5Sclose(sid_1) < 0)
goto out;
- sid_1 = H5I_BADID;
+ sid_1 = H5I_INVALID_HID;
} /* end if */
ret_val = 0;
@@ -2962,9 +2962,9 @@ out:
herr_t
H5TBget_table_info(hid_t loc_id, const char *dset_name, hsize_t *nfields, hsize_t *nrecords)
{
- hid_t tid = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t did = H5I_BADID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
hsize_t dims[1];
int num_members;
herr_t ret_val = -1;
@@ -3008,7 +3008,7 @@ H5TBget_table_info(hid_t loc_id, const char *dset_name, hsize_t *nfields, hsize_
/* terminate access to the dataspace */
if (H5Sclose(sid) < 0)
goto out;
- sid = H5I_BADID;
+ sid = H5I_INVALID_HID;
*nrecords = dims[0];
} /* end if */
@@ -3048,11 +3048,11 @@ herr_t
H5TBget_field_info(hid_t loc_id, const char *dset_name, char *field_names[], size_t *field_sizes,
size_t *field_offsets, size_t *type_size)
{
- hid_t did = H5I_BADID; /* dataset ID */
- hid_t tid = H5I_BADID; /* file type ID */
- hid_t n_tid = H5I_BADID; /* native type ID */
- hid_t m_tid = H5I_BADID; /* member type ID */
- hid_t nm_tid = H5I_BADID; /* native member ID */
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t tid = H5I_INVALID_HID; /* file type ID */
+ hid_t n_tid = H5I_INVALID_HID; /* native type ID */
+ hid_t m_tid = H5I_INVALID_HID; /* member type ID */
+ hid_t nm_tid = H5I_INVALID_HID; /* native member ID */
hssize_t nfields;
hssize_t i;
herr_t ret_val = -1;
@@ -3111,10 +3111,10 @@ H5TBget_field_info(hid_t loc_id, const char *dset_name, char *field_names[], siz
/* close the member types */
if (H5Tclose(m_tid) < 0)
goto out;
- m_tid = H5I_BADID;
+ m_tid = H5I_INVALID_HID;
if (H5Tclose(nm_tid) < 0)
goto out;
- nm_tid = H5I_BADID;
+ nm_tid = H5I_INVALID_HID;
} /* end for */
ret_val = 0;
@@ -3267,9 +3267,9 @@ static hid_t
H5TB_create_type(hid_t loc_id, const char *dset_name, size_t type_size, const size_t *field_offset,
const size_t *field_sizes, hid_t ftype_id)
{
- hid_t mem_type_id = H5I_BADID;
- hid_t mtype_id = H5I_BADID;
- hid_t nmtype_id = H5I_BADID;
+ hid_t mem_type_id = H5I_INVALID_HID;
+ hid_t mtype_id = H5I_INVALID_HID;
+ hid_t nmtype_id = H5I_INVALID_HID;
size_t size_native;
hsize_t nfields = 0;
char ** fnames = NULL;
@@ -3310,10 +3310,10 @@ H5TB_create_type(hid_t loc_id, const char *dset_name, size_t type_size, const si
goto out;
if (H5Tclose(mtype_id) < 0)
goto out;
- mtype_id = H5I_BADID;
+ mtype_id = H5I_INVALID_HID;
if (H5Tclose(nmtype_id) < 0)
goto out;
- nmtype_id = H5I_BADID;
+ nmtype_id = H5I_INVALID_HID;
} /* end for */
ret_val = mem_type_id;
@@ -3364,8 +3364,8 @@ herr_t
H5TB_common_append_records(hid_t dataset_id, hid_t mem_type_id, size_t nrecords, hsize_t orig_table_size,
const void *buf)
{
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
hsize_t count[1];
hsize_t offset[1];
hsize_t dims[1];
@@ -3429,8 +3429,8 @@ herr_t
H5TB_common_read_records(hid_t dataset_id, hid_t mem_type_id, hsize_t start, size_t nrecords,
hsize_t table_size, void *buf)
{
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
hsize_t count[1];
hsize_t offset[1];
hsize_t mem_size[1];
diff --git a/hl/test/test_image.c b/hl/test/test_image.c
index 0c7d511..dc1be96 100644
--- a/hl/test/test_image.c
+++ b/hl/test/test_image.c
@@ -650,10 +650,10 @@ test_generate(void)
HL_TESTING2("make indexed image from land data");
for (i = 0; i < n_elements; i++) {
- if (data[i] < 0)
+ if (data[i] < 0.0f)
image_data[i] = 0;
else
- image_data[i] = (unsigned char)((255 * (data[i])) / xmax);
+ image_data[i] = (unsigned char)((255 * data[i]) / xmax);
}
/* make the image */
@@ -671,10 +671,11 @@ test_generate(void)
HL_TESTING2("make indexed image from sea data");
for (i = 0; i < n_elements; i++) {
- if (data[i] > 0)
+ if (data[i] > 0.0f)
image_data[i] = 0;
- else
- image_data[i] = (unsigned char)((255 * (data[i] - xmin)) / xmin);
+ else {
+ image_data[i] = (unsigned char)((255.0f * (data[i] - xmin)) / (xmax - xmin));
+ }
}
/* make the image */