summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
Diffstat (limited to 'hl')
-rw-r--r--hl/CMakeLists.txt4
-rw-r--r--hl/c++/examples/CMakeLists.txt2
-rw-r--r--hl/c++/examples/Makefile.am1
-rw-r--r--hl/c++/examples/run-hlc++-ex.sh.in2
-rw-r--r--hl/c++/src/CMakeLists.txt2
-rw-r--r--hl/c++/test/CMakeLists.txt2
-rw-r--r--hl/examples/CMakeLists.txt2
-rw-r--r--hl/examples/run-hlc-ex.sh.in2
-rw-r--r--hl/fortran/examples/CMakeLists.txt4
-rw-r--r--hl/fortran/examples/Makefile.am1
-rw-r--r--hl/fortran/examples/run-hlfortran-ex.sh.in2
-rw-r--r--hl/fortran/src/CMakeLists.txt48
-rw-r--r--hl/fortran/test/CMakeLists.txt12
-rw-r--r--hl/src/CMakeLists.txt2
-rw-r--r--hl/src/H5DS.c64
-rw-r--r--hl/test/CMakeLists.txt6
-rw-r--r--hl/tools/CMakeLists.txt8
-rw-r--r--hl/tools/CMakeTests.cmake20
-rw-r--r--hl/tools/gif2h5/decompress.c2
-rw-r--r--hl/tools/gif2h5/gif2mem.c10
-rw-r--r--hl/tools/gif2h5/h52gifgentst.c8
-rw-r--r--hl/tools/gif2h5/h52giftest.sh.in75
-rw-r--r--hl/tools/gif2h5/hdf2gif.c21
-rw-r--r--hl/tools/gif2h5/hdfgifwr.c8
-rw-r--r--hl/tools/gif2h5/testfiles/REAMDE6
-rw-r--r--hl/tools/gif2h5/testfiles/ex_image2.h5bin0 -> 224533 bytes
26 files changed, 189 insertions, 125 deletions
diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt
index 031b7d6..b5d4308 100644
--- a/hl/CMakeLists.txt
+++ b/hl/CMakeLists.txt
@@ -38,7 +38,3 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED)
add_subdirectory (${HDF5_HL_SOURCE_DIR}/test ${HDF5_HL_BINARY_DIR}/test)
endif (BUILD_TESTING)
endif (NOT HDF5_EXTERNALLY_CONFIGURED)
-
-if (HDF5_BUILD_CPP_LIB)
- add_subdirectory (${HDF5_HL_SOURCE_DIR}/c++ ${HDF5_HL_BINARY_DIR}/c++)
-endif (HDF5_BUILD_CPP_LIB)
diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt
index 12c1d50..e3fc3ae 100644
--- a/hl/c++/examples/CMakeLists.txt
+++ b/hl/c++/examples/CMakeLists.txt
@@ -12,7 +12,7 @@ INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SRC_DIR}/src)
# --------------------------------------------------------------------
add_executable (ptExampleFL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleFL.cpp)
TARGET_NAMING (ptExampleFL ${LIB_TYPE})
-TARGET_C_PROPERTIES (ptExampleFL " " " ")
+TARGET_C_PROPERTIES (ptExampleFL ${LIB_TYPE} " " " ")
target_link_libraries (
ptExampleFL
${HDF5_HL_CPP_LIB_TARGET}
diff --git a/hl/c++/examples/Makefile.am b/hl/c++/examples/Makefile.am
index c8f0305..7202a96 100644
--- a/hl/c++/examples/Makefile.am
+++ b/hl/c++/examples/Makefile.am
@@ -36,6 +36,7 @@ CXX_API=yes
# Where to install examples
# Note: no '/' after DESTDIR. Explanation in commence.am
EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl/c++
+EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl
# How to build programs using h5c++
$(EXTRA_PROG): $(H5CPP)
diff --git a/hl/c++/examples/run-hlc++-ex.sh.in b/hl/c++/examples/run-hlc++-ex.sh.in
index 103dd76..5aa1032 100644
--- a/hl/c++/examples/run-hlc++-ex.sh.in
+++ b/hl/c++/examples/run-hlc++-ex.sh.in
@@ -33,7 +33,7 @@ EXIT_SUCCESS=0
EXIT_FAILURE=1
# Where the tool is installed.
# default is relative path to installed location of the tools
-prefix="${prefix:-../../../../}"
+prefix="${prefix:-@prefix@}"
AR="@AR@"
RANLIB="@RANLIB@"
H5TOOL="h5c++" # The tool name
diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt
index 0dee06f..640cb2d 100644
--- a/hl/c++/src/CMakeLists.txt
+++ b/hl/c++/src/CMakeLists.txt
@@ -11,7 +11,7 @@ set (HDF5_HL_CPP_SRCS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.cpp)
set (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h)
add_library (${HDF5_HL_CPP_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_CPP_SRCS})
-TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} " " " ")
+TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} ${LIB_TYPE} " " " ")
target_link_libraries (
${HDF5_HL_CPP_LIB_TARGET}
${HDF5_HL_LIB_TARGET}
diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt
index d4e1157..ff06b22 100644
--- a/hl/c++/test/CMakeLists.txt
+++ b/hl/c++/test/CMakeLists.txt
@@ -16,7 +16,7 @@ INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/test)
INCLUDE_DIRECTORIES (${HDF5_CPP_SRC_DIR}/src)
add_executable (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp)
-TARGET_C_PROPERTIES (hl_ptableTest " " " ")
+TARGET_C_PROPERTIES (hl_ptableTest ${LIB_TYPE} " " " ")
TARGET_NAMING (hl_ptableTest ${LIB_TYPE})
target_link_libraries (
hl_ptableTest
diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt
index edcb920..e264f75 100644
--- a/hl/examples/CMakeLists.txt
+++ b/hl/examples/CMakeLists.txt
@@ -29,7 +29,7 @@ set (examples
foreach (example ${examples})
add_executable (hl_ex_${example} ${HDF5_HL_EXAMPLES_SOURCE_DIR}/${example}.c)
TARGET_NAMING (hl_ex_${example} ${LIB_TYPE})
- TARGET_C_PROPERTIES (hl_ex_${example} " " " ")
+ TARGET_C_PROPERTIES (hl_ex_${example} ${LIB_TYPE} " " " ")
target_link_libraries (hl_ex_${example} ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (hl_ex_${example} PROPERTIES FOLDER examples/hl)
endforeach (example ${examples})
diff --git a/hl/examples/run-hlc-ex.sh.in b/hl/examples/run-hlc-ex.sh.in
index a79f67a..d897a02 100644
--- a/hl/examples/run-hlc-ex.sh.in
+++ b/hl/examples/run-hlc-ex.sh.in
@@ -33,7 +33,7 @@ EXIT_FAILURE=1
# Where the tool is installed.
# default is relative path to installed location of the tools
-prefix="${prefix:-../../../../}"
+prefix="${prefix:-@prefix@}"
PARALLEL=@PARALLEL@ # Am I in parallel mode?
AR="@AR@"
RANLIB="@RANLIB@"
diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt
index bf6a0ca..bded2d9 100644
--- a/hl/fortran/examples/CMakeLists.txt
+++ b/hl/fortran/examples/CMakeLists.txt
@@ -5,7 +5,6 @@ PROJECT (HDF5_HL_F90_EXAMPLES C CXX Fortran)
# Setup include Directories
#-----------------------------------------------------------------------------
INCLUDE_DIRECTORIES (
- ${CMAKE_Fortran_MODULE_DIRECTORY}
${HDF5_F90_BINARY_DIR}
${HDF5_F90_SRC_DIR}/src
)
@@ -18,12 +17,13 @@ set (examples
foreach (example ${examples})
add_executable (hl_f90_ex_${example} ${HDF5_HL_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
TARGET_NAMING (hl_f90_ex_${example} ${LIB_TYPE})
- TARGET_FORTRAN_PROPERTIES (hl_f90_ex_${example} " " " ")
+ TARGET_FORTRAN_PROPERTIES (hl_f90_ex_${example} ${LIB_TYPE} " " " ")
target_link_libraries (hl_f90_ex_${example}
${HDF5_HL_F90_LIB_TARGET}
${HDF5_F90_LIB_TARGET}
${HDF5_LIB_TARGET}
)
+ target_include_directories (hl_f90_ex_${example} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY})
set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran)
set_target_properties (hl_f90_ex_${example} PROPERTIES FOLDER examples/hl/fortran)
diff --git a/hl/fortran/examples/Makefile.am b/hl/fortran/examples/Makefile.am
index 91cb7c5..6a5032b 100644
--- a/hl/fortran/examples/Makefile.am
+++ b/hl/fortran/examples/Makefile.am
@@ -54,6 +54,7 @@ endif
# Tell automake how to install examples
# Note: no '/' after DESTDIR. Explanation in commence.am
EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl/fortran
+EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl
# List dependencies for each example. Normally, automake would take
# care of this for us, but if we tell automake about the programs it
diff --git a/hl/fortran/examples/run-hlfortran-ex.sh.in b/hl/fortran/examples/run-hlfortran-ex.sh.in
index 2780bff..12f9fec 100644
--- a/hl/fortran/examples/run-hlfortran-ex.sh.in
+++ b/hl/fortran/examples/run-hlfortran-ex.sh.in
@@ -34,7 +34,7 @@ EXIT_FAILURE=1
# Where the tool is installed.
# default is relative path to installed location of the tools
-prefix="${prefix:-../../../../}"
+prefix="${prefix:-@prefix@}"
PARALLEL=@PARALLEL@ # Am I in parallel mode?
AR="@AR@"
RANLIB="@RANLIB@"
diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt
index f188a53..6e6e44a 100644
--- a/hl/fortran/src/CMakeLists.txt
+++ b/hl/fortran/src/CMakeLists.txt
@@ -8,7 +8,6 @@ INCLUDE_DIRECTORIES (
${HDF5_HL_SRC_DIR}/src
${HDF5_F90_SRC_DIR}/src
${HDF5_F90_BINARY_DIR}
- ${CMAKE_Fortran_MODULE_DIRECTORY}
)
#-----------------------------------------------------------------------------
@@ -26,7 +25,7 @@ set_source_files_properties (${HDF5_HL_F90_C_SRCS} PROPERTIES LANGUAGE C)
set (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h)
add_library (${HDF5_HL_F90_C_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_F90_C_SRCS} ${HDF5_HL_F90_HEADERS})
-TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} " " " ")
+TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} ${LIB_TYPE} " " " ")
target_link_libraries (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET} ${HDF5_HL_LIB_TARGET})
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_F90_C_LIB_NAME} ${LIB_TYPE})
@@ -66,8 +65,7 @@ if (WIN32)
HDF5F90_WINDOWS
)
endif (WIN32)
-TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} " " ${SHARED_LINK_FLAGS})
-set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran)
+TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} ${LIB_TYPE} " " ${SHARED_LINK_FLAGS})
target_link_libraries (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET})
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} ${LIB_TYPE})
@@ -75,37 +73,35 @@ set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES
FOLDER libraries/hl/fortran
LINKER_LANGUAGE Fortran
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
)
#-----------------------------------------------------------------------------
# Add file(s) to CMake Install
#-----------------------------------------------------------------------------
+
if (WIN32)
- install (
- FILES
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5ds.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5tb.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5lt.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5im.mod
- DESTINATION
- ${HDF5_INSTALL_INCLUDE_DIR}
- COMPONENT
- fortheaders
- )
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE})
else (WIN32)
- install (
- FILES
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5ds.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5tb.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5lt.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5im.mod
- DESTINATION
- ${HDF5_INSTALL_INCLUDE_DIR}
- COMPONENT
- fortheaders
- )
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY})
endif (WIN32)
+set (mod_files
+ ${MOD_BUILD_DIR}/h5ds.mod
+ ${MOD_BUILD_DIR}/h5tb.mod
+ ${MOD_BUILD_DIR}/h5lt.mod
+ ${MOD_BUILD_DIR}/h5im.mod
+)
+
+install (
+ FILES
+ ${mod_files}
+ DESTINATION
+ ${HDF5_INSTALL_INCLUDE_DIR}
+ COMPONENT
+ fortheaders
+)
+
#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install for import into other projects
#-----------------------------------------------------------------------------
diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt
index fcb0b8c..55fb987 100644
--- a/hl/fortran/test/CMakeLists.txt
+++ b/hl/fortran/test/CMakeLists.txt
@@ -9,32 +9,36 @@ INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${
#-- Adding test for hl_f90_tstds
add_executable (hl_f90_tstds tstds.f90)
TARGET_NAMING (hl_f90_tstds ${LIB_TYPE})
-TARGET_FORTRAN_PROPERTIES (hl_f90_tstds " " " ")
+TARGET_FORTRAN_PROPERTIES (hl_f90_tstds ${LIB_TYPE} " " " ")
target_link_libraries (hl_f90_tstds ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET})
+target_include_directories (hl_f90_tstds PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY})
set_target_properties (hl_f90_tstds PROPERTIES LINKER_LANGUAGE Fortran)
set_target_properties (hl_f90_tstds PROPERTIES FOLDER test/hl/fortran)
#-- Adding test for hl_f90_tstlite
add_executable (hl_f90_tstlite tstlite.f90)
TARGET_NAMING (hl_f90_tstlite ${LIB_TYPE})
-TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite " " " ")
+TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite ${LIB_TYPE} " " " ")
target_link_libraries (hl_f90_tstlite ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET})
+target_include_directories (hl_f90_tstlite PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY})
set_target_properties (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran)
set_target_properties (hl_f90_tstlite PROPERTIES FOLDER test/hl/fortran)
#-- Adding test for hl_f90_tstimage
add_executable (hl_f90_tstimage tstimage.f90)
TARGET_NAMING (hl_f90_tstimage ${LIB_TYPE})
-TARGET_FORTRAN_PROPERTIES (hl_f90_tstimage " " " ")
+TARGET_FORTRAN_PROPERTIES (hl_f90_tstimage ${LIB_TYPE} " " " ")
target_link_libraries (hl_f90_tstimage ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET})
+target_include_directories (hl_f90_tstimage PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY})
set_target_properties (hl_f90_tstimage PROPERTIES LINKER_LANGUAGE Fortran)
set_target_properties (hl_f90_tstimage PROPERTIES FOLDER test/hl/fortran)
#-- Adding test for hl_f90_tsttable
add_executable (hl_f90_tsttable tsttable.f90)
TARGET_NAMING (hl_f90_tsttable ${LIB_TYPE})
-TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable " " " ")
+TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable ${LIB_TYPE} " " " ")
target_link_libraries (hl_f90_tsttable ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET})
+target_include_directories (hl_f90_tsttable PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY})
set_target_properties (hl_f90_tsttable PROPERTIES LINKER_LANGUAGE Fortran)
set_target_properties (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran)
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt
index f4d5a96..3c24e40 100644
--- a/hl/src/CMakeLists.txt
+++ b/hl/src/CMakeLists.txt
@@ -34,7 +34,7 @@ set (HL_HEADERS
)
add_library (${HDF5_HL_LIB_TARGET} ${LIB_TYPE} ${HL_SRCS} ${HL_HEADERS})
-TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} " " " ")
+TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} ${LIB_TYPE} " " " ")
target_link_libraries (${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} ${LIB_TYPE})
set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c
index 939a99f..de6e66c 100644
--- a/hl/src/H5DS.c
+++ b/hl/src/H5DS.c
@@ -1430,10 +1430,12 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
hid_t aid = -1; /* attribute ID */
int rank; /* rank of dataset */
hsize_t dims[1]; /* dimensions of dataset */
- const char **buf = NULL; /* buffer to store in the attribute */
H5I_type_t it; /* ID type */
unsigned int i;
-
+ union { /* union is needed to eliminate compiler warnings about */
+ char ** buf; /* discarding the 'const' qualifier in the free */
+ char const ** const_buf; /* buf calls */
+ } u;
/*-------------------------------------------------------------------------
* parameter checking
*-------------------------------------------------------------------------
@@ -1496,19 +1498,19 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
goto out;
/* allocate and initialize */
- buf = (const char **) HDmalloc((size_t) rank * sizeof(char *));
+ u.const_buf = (char const **) HDmalloc((size_t) rank * sizeof(char *));
- if (buf == NULL)
+ if (u.const_buf == NULL)
goto out;
for (i = 0; i < (unsigned int) rank; i++)
- buf[i] = NULL;
+ u.const_buf[i] = NULL;
/* store the label information in the required index */
- buf[idx] = label;
+ u.const_buf[idx] = label;
/* write the attribute with the label */
- if (H5Awrite(aid, tid, buf) < 0)
+ if (H5Awrite(aid, tid, u.const_buf) < 0)
goto out;
/* close */
@@ -1518,10 +1520,10 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
goto out;
if (H5Aclose(aid) < 0)
goto out;
- if (buf)
+ if (u.const_buf)
{
- HDfree(buf);
- buf = NULL;
+ HDfree(u.const_buf);
+ u.const_buf = NULL;
}
}
@@ -1532,6 +1534,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
else
{
+
if ((aid = H5Aopen(did, DIMENSION_LABELS, H5P_DEFAULT)) < 0)
goto out;
@@ -1539,34 +1542,34 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
goto out;
/* allocate and initialize */
- buf = (const char **) HDmalloc((size_t) rank * sizeof(char *));
-
- if (buf == NULL)
+ u.buf = (char **) HDmalloc((size_t) rank * sizeof(char *));
+
+ if (u.buf == NULL)
goto out;
/* read */
- if (H5Aread(aid, tid, (void *) buf) < 0)
+ if (H5Aread(aid, tid, (void *)u.buf) < 0)
goto out;
/* free the ptr that will be replaced by label */
- if (buf[idx])
- HDfree(buf[idx]);
+ if (u.buf[idx])
+ HDfree(u.buf[idx]);
/* store the label information in the required index */
- buf[idx] = label;
+ u.const_buf[idx] = label;
/* write the attribute with the new references */
- if (H5Awrite(aid, tid, buf) < 0)
+ if (H5Awrite(aid, tid, u.buf) < 0)
goto out;
/* label was brought in, so don't free */
- buf[idx] = NULL;
+ u.buf[idx] = NULL;
/* free all the ptr's from the H5Aread() */
for (i = 0; i < (unsigned int) rank; i++)
{
- if (buf[i])
- HDfree(buf[i]);
+ if (u.buf[i])
+ HDfree(u.buf[i]);
}
/* close */
@@ -1574,28 +1577,29 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
goto out;
if (H5Aclose(aid) < 0)
goto out;
- if (buf)
+ if (u.buf)
{
- HDfree(buf);
- buf = NULL;
+ HDfree(u.buf);
+ u.buf = NULL;
}
}
return SUCCEED;
/* error zone */
+
out:
- if (buf)
+ if (u.buf)
{
- if (buf[idx]) /* check if we errored during H5Awrite */
- buf[idx] = NULL; /* don't free label */
+ if (u.buf[idx]) /* check if we errored during H5Awrite */
+ u.buf[idx] = NULL; /* don't free label */
/* free all the ptr's from the H5Aread() */
for (i = 0; i < (unsigned int) rank; i++)
{
- if (buf[i])
- HDfree(buf[i]);
+ if (u.buf[i])
+ HDfree(u.buf[i]);
}
- HDfree(buf);
+ HDfree(u.buf);
}
H5E_BEGIN_TRY
{
diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt
index 28c716c..47383ce 100644
--- a/hl/test/CMakeLists.txt
+++ b/hl/test/CMakeLists.txt
@@ -23,7 +23,7 @@ INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR})
MACRO (HL_ADD_EXE hl_name)
add_executable (hl_${hl_name} ${hl_name}.c)
TARGET_NAMING (hl_${hl_name} ${LIB_TYPE})
- TARGET_C_PROPERTIES (hl_${hl_name} " " " ")
+ TARGET_C_PROPERTIES (hl_${hl_name} ${LIB_TYPE} " " " ")
target_link_libraries (hl_${hl_name}
${HDF5_HL_LIB_TARGET}
${HDF5_LIB_TARGET}
@@ -45,8 +45,8 @@ HL_ADD_EXE (test_table)
# --------------------------------------------------------------------
if (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
add_executable (hl_gen_test_ds gen_test_ds.c)
- TARGET_NAMING (hl_gen_test_ds ${LIB_TYPE})
- TARGET_C_PROPERTIES (hl_gen_test_ds " " " ")
+ TARGET_NAMING (hl_gen_test_ds STATIC)
+ TARGET_C_PROPERTIES (hl_gen_test_ds STATIC " " " ")
target_link_libraries (hl_gen_test_ds
${HDF5_HL_LIB_TARGET}
${HDF5_LIB_TARGET}
diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt
index 567b3da..f58a513 100644
--- a/hl/tools/CMakeLists.txt
+++ b/hl/tools/CMakeLists.txt
@@ -19,7 +19,7 @@ INCLUDE_DIRECTORIES (${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5)
add_executable (gif2h5 ${GIF2H5_SRCS})
TARGET_NAMING (gif2h5 ${LIB_TYPE})
-TARGET_C_PROPERTIES (gif2h5 " " " ")
+TARGET_C_PROPERTIES (gif2h5 ${LIB_TYPE} " " " ")
target_link_libraries (gif2h5 ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
set_target_properties (gif2h5 PROPERTIES FOLDER tools/hl)
@@ -30,7 +30,7 @@ set (hdf2gif_SRCS
)
add_executable (h52gif ${hdf2gif_SRCS})
TARGET_NAMING (h52gif ${LIB_TYPE})
-TARGET_C_PROPERTIES (h52gif " " " ")
+TARGET_C_PROPERTIES (h52gif ${LIB_TYPE} " " " ")
target_link_libraries (h52gif ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
set_target_properties (h52gif PROPERTIES FOLDER tools/hl)
@@ -42,8 +42,8 @@ if (BUILD_TESTING)
# --------------------------------------------------------------------
if (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
add_executable (hl_h52gifgentest ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/h52gifgentst.c)
- TARGET_NAMING (hl_h52gifgentest ${LIB_TYPE})
- TARGET_C_PROPERTIES (hl_h52gifgentest " " " ")
+ TARGET_NAMING (hl_h52gifgentest STATIC)
+ TARGET_C_PROPERTIES (hl_h52gifgentest STATIC " " " ")
target_link_libraries (hl_h52gifgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl)
diff --git a/hl/tools/CMakeTests.cmake b/hl/tools/CMakeTests.cmake
index a340c2d..4ebd7a2 100644
--- a/hl/tools/CMakeTests.cmake
+++ b/hl/tools/CMakeTests.cmake
@@ -26,6 +26,13 @@ add_custom_command (
ARGS -E copy_if_different ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/testfiles/h52giftst.h5 ${PROJECT_BINARY_DIR}/testfiles/h52giftst.h5
)
+add_custom_command (
+ TARGET h52gif
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/testfiles/ex_image2.h5 ${PROJECT_BINARY_DIR}/testfiles/ex_image2.h5
+)
+
# Remove any output file left over from previous test run
add_test (
NAME HL_TOOLS-clear-objects
@@ -33,8 +40,19 @@ add_test (
-E remove
image1.gif
image1.h5
+ image.gif
+ image24.gif
)
+add_test (NAME HL_TOOLS_gif2h5 COMMAND $<TARGET_FILE:gif2h5> testfiles/image1.gif image1.h5)
+
add_test (NAME HL_TOOLS_h52gif COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image1.gif -i image)
-add_test (NAME HL_TOOLS_gif2h5 COMMAND $<TARGET_FILE:gif2h5> testfiles/image1.gif image1.h5)
+add_test (NAME HL_TOOLS_h52gif_none COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image.gif -i nosuch_image)
+set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES WILL_FAIL "true")
+
+#add_test (NAME HL_TOOLS_h52gifpal COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image.gif -i palette)
+#set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES WILL_FAIL "true")
+
+add_test (NAME HL_TOOLS_h52gif24bits COMMAND $<TARGET_FILE:h52gif> testfiles/ex_image2.h5 image24.gif -i image24bitpixel)
+set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES WILL_FAIL "true")
diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c
index d4e4cdc..ef2d78a 100644
--- a/hl/tools/gif2h5/decompress.c
+++ b/hl/tools/gif2h5/decompress.c
@@ -90,7 +90,7 @@ ReadCode(void)
RawCode += (0x10000 * Raster[ByteOffset + 2]);
RawCode >>= (BitOffset % 8);
- BitOffset += CodeSize;
+ BitOffset += (int)CodeSize;
return (RawCode & ReadMask);
}
diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c
index a2e4893..456a32d 100644
--- a/hl/tools/gif2h5/gif2mem.c
+++ b/hl/tools/gif2h5/gif2mem.c
@@ -153,7 +153,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
if (ImageCount > ImageArray) {
aTemp = ImageArray;
- ImageArray = (ImageArray << 1) + 1;
+ ImageArray = (BYTE)((ImageArray << 1) + 1);
if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(gifImageDesc,
sizeof(GIFIMAGEDESC *) * ImageArray))) {
printf("Out of memory!");
@@ -220,7 +220,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
PlainTextCount++;
if (PlainTextCount > PlainTextArray)
- PlainTextArray = (PlainTextArray << 1) + 1;
+ PlainTextArray = (BYTE)((PlainTextArray << 1) + 1);
if (!(gifPlainText = (GIFPLAINTEXT **)realloc(gifPlainText , sizeof(GIFPLAINTEXT *) * PlainTextArray))) {
printf("Out of memory!");
@@ -242,7 +242,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
CommentCount++;
if (CommentCount > CommentArray)
- CommentArray = (CommentArray << 1) + 1;
+ CommentArray = (BYTE)((CommentArray << 1) + 1);
if (!(gifComment = (GIFCOMMENT **)realloc(gifComment , sizeof(GIFCOMMENT *) * CommentArray))) {
printf("Out of memory!");
@@ -269,7 +269,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
if (ImageCount > ImageArray) {
aTemp = ImageArray;
- ImageArray = (ImageArray << 1) + 1;
+ ImageArray = (BYTE)((ImageArray << 1) + 1);
if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc(gifGraphicControl , sizeof(GIFGRAPHICCONTROL *) * ImageArray))) {
printf("Out of memory!");
@@ -307,7 +307,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
ApplicationCount++;
if (ApplicationCount > ApplicationArray)
- ApplicationArray = (ApplicationArray << 1) + 1;
+ ApplicationArray = (BYTE)((ApplicationArray << 1) + 1);
if (!(gifApplication = (GIFAPPLICATION **)realloc(gifApplication , sizeof(GIFAPPLICATION *) * ApplicationArray))) {
printf("Out of memory!");
diff --git a/hl/tools/gif2h5/h52gifgentst.c b/hl/tools/gif2h5/h52gifgentst.c
index ef38c3b..3433d0a 100644
--- a/hl/tools/gif2h5/h52gifgentst.c
+++ b/hl/tools/gif2h5/h52gifgentst.c
@@ -64,7 +64,7 @@ int main(void)
space = WIDTH*HEIGHT / PAL_ENTRIES;
for (i=0, j=0, n=0; i < WIDTH*HEIGHT; i++, j++ )
{
- buf[i] = n;
+ buf[i] = (unsigned char)n;
if ( j > space )
{
n++;
@@ -83,9 +83,9 @@ int main(void)
*/
for ( i=0, n=0; i<PAL_ENTRIES*3; i+=3, n++)
{
- pal[i] =n; /* red */
- pal[i+1]=0; /* green */
- pal[i+2]=255-n; /* blue */
+ pal[i] = (unsigned char)n; /* red */
+ pal[i+1] = (unsigned char)0; /* green */
+ pal[i+2] = (unsigned char)(255-n); /* blue */
}
/* make a palette */
diff --git a/hl/tools/gif2h5/h52giftest.sh.in b/hl/tools/gif2h5/h52giftest.sh.in
index 186b369..7aec219 100644
--- a/hl/tools/gif2h5/h52giftest.sh.in
+++ b/hl/tools/gif2h5/h52giftest.sh.in
@@ -18,6 +18,7 @@
TESTFILE1="$srcdir/testfiles/h52giftst.h5"
TESTFILE2="$srcdir/testfiles/image1.gif"
+TESTFILE3="$srcdir/testfiles/ex_image2.h5"
# initialize errors variable
errors=0
@@ -29,45 +30,69 @@ TESTING() {
-TOOLTEST1()
+# Verify the test runs with success (return code is 0)
+TOOLTEST()
{
- $RUNSERIAL ./h52gif $*
-
- RET=$?
- if [ $RET != 0 ] ; then
- echo "*FAILED*"
- errors="` expr $errors + 1 `";
- else
- echo " PASSED"
- fi
+ # for now, discard any error messages generated.
+ $RUNSERIAL $* > /dev/null 2>&1
+
+ RET=$?
+ if [ $RET = 0 ] ; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ errors="` expr $errors + 1 `";
+ fi
}
-TOOLTEST2()
+# Verify the test runs with failure (return code is not 0)
+# Use for testing if tool can handle error conditions like
+# illegal input, bad arguments, exeeding limits, ...
+TOOLTESTFAIL()
{
- $RUNSERIAL ./gif2h5 $*
-
- RET=$?
- if [ $RET != 0 ] ; then
- echo "*FAILED*"
- errors="` expr $errors + 1 `";
- else
- echo " PASSED"
- fi
+ # for now, discard any error messages generated.
+ $RUNSERIAL $* > /dev/null 2>&1
+
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ errors="` expr $errors + 1 `";
+ fi
}
+# Positive tests for gif2h5
+echo "**validate the gif2h5 tool processes input correctly..."
+TESTING "./gif2h5 image1.gif image1.h5"
+TOOLTEST ./gif2h5 $TESTFILE2 image1.h5
+echo ""
+# Positive tests for h52gif
+echo "**validate the h52gif tool processes input correctly..."
TESTING "./h52gif h52giftst.h5 image1.gif -i image"
-TOOLTEST1 $TESTFILE1 image1.gif -i image
-TESTING "./gif2h5 image1.gif image1.h5"
-TOOLTEST2 $TESTFILE2 image1.h5
+TOOLTEST ./h52gif $TESTFILE1 image1.gif -i image
+echo ""
+# Negative tests.
+echo "**verify the the h52gif tool handle error conditions correctly..."
+# nonexisting dataset name
+TESTING "./h52gif h52giftst.h5 image.gif -i nosuch_image"
+TOOLTESTFAIL "./h52gif $TESTFILE1 image.gif -i nosuch_image"
+# this test should have failed but it did not. Comment it out for now.
+#TESTING "./h52gif h52giftst.h5 image.gif -i palette"
+#TOOLTESTFAIL "./h52gif $TESTFILE1 image.gif -i palette"
+TESTING "./h52gif h52giftst.h5 image24.gif -i image24bitpixel"
+TOOLTESTFAIL "./h52gif $TESTFILE3 image24.gif -i image24bitpixel"
+echo ""
+# all done. summarize results.
if test $errors -eq 0 ; then
- echo "All h52gif tests passed."
+ echo "All gif2h5 and h52gif tests passed."
exit 0
else
- echo "h52gif tests failed with $errors errors."
+ echo "Some gif2h5 or h52gif tests failed with $errors errors."
exit 1
fi
diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c
index 090d657..5c342ba 100644
--- a/hl/tools/gif2h5/hdf2gif.c
+++ b/hl/tools/gif2h5/hdf2gif.c
@@ -20,6 +20,8 @@
#include "h5tools.h"
#include "h5tools_utils.h"
+#define IMAGE_WIDTH_MAX 65535 /* unsigned 16bits integer */
+#define IMAGE_HEIGHT_MAX 65535 /* unsigned 16bits integer */
int EndianOrder;
@@ -147,6 +149,17 @@ int main(int argc , char **argv)
if ( H5IMget_image_info( fid, image_name, &width, &height, &planes, interlace, &npals ) < 0 )
goto out;
+ if (width > IMAGE_WIDTH_MAX || height > IMAGE_HEIGHT_MAX){
+ fprintf(stderr, "HDF5 image is too large. Limit is %d by %d.\n", IMAGE_WIDTH_MAX, IMAGE_HEIGHT_MAX);
+ goto out;
+ }
+
+ /* tool can handle single plane images only. */
+ if (planes > 1){
+ fprintf(stderr, "Cannot handle multiple planes image\n");
+ goto out;
+ }
+
Image = (BYTE*) malloc( (size_t) width * (size_t) height );
if ( H5IMread_image( fid, image_name, Image ) < 0 )
@@ -194,9 +207,9 @@ int main(int argc , char **argv)
numcols = 256;
for (i = 0 ; i < numcols ; i++)
{
- Red[i] = 255 - i;
- Green[i] = 255 - i;
- Blue[i] = 255 - i;
+ Red[i] = (BYTE)(255 - i);
+ Green[i] = (BYTE)(255 - i);
+ Blue[i] = (BYTE)(255 - i);
}
}
else
@@ -229,7 +242,7 @@ int main(int argc , char **argv)
if (j==i)
{
/* wasn't found */
- pc2nc[i] = nc;
+ pc2nc[i] = (BYTE)nc;
r1[nc] = Red[i];
g1[nc] = Green[i];
b1[nc] = Blue[i];
diff --git a/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c
index d828226..4c52f4c 100644
--- a/hl/tools/gif2h5/hdfgifwr.c
+++ b/hl/tools/gif2h5/hdfgifwr.c
@@ -270,7 +270,7 @@ nomatch:
ent = c;
if (free_ent < maxmaxcode) {
- CodeTabOf (i) = free_ent++; /* code -> hashtable */
+ CodeTabOf (i) = (unsigned short)free_ent++; /* code -> hashtable */
HashTabOf (i) = fcode;
} else {
cl_block();
@@ -313,9 +313,9 @@ output(int code)
cur_accum &= masks[cur_bits];
if (cur_bits > 0)
- cur_accum |= ((long)code << cur_bits);
+ cur_accum |= (unsigned long)((long)code << cur_bits);
else
- cur_accum = code;
+ cur_accum = (unsigned long)code;
cur_bits += n_bits;
@@ -437,7 +437,7 @@ static char accum[ 256 ];
static void
char_out(int c)
{
- accum[ a_count++ ] = c;
+ accum[ a_count++ ] = (char)c;
if (a_count >= 254)
flush_char();
diff --git a/hl/tools/gif2h5/testfiles/REAMDE b/hl/tools/gif2h5/testfiles/REAMDE
new file mode 100644
index 0000000..a428d47
--- /dev/null
+++ b/hl/tools/gif2h5/testfiles/REAMDE
@@ -0,0 +1,6 @@
+ex_image2.h5
+ Generated by hl/examples/ex_image2.c
+5giftst.h5:
+ Generated by ../h52gifgentst.c
+image1.gif:
+ To be determined.
diff --git a/hl/tools/gif2h5/testfiles/ex_image2.h5 b/hl/tools/gif2h5/testfiles/ex_image2.h5
new file mode 100644
index 0000000..a36df1b
--- /dev/null
+++ b/hl/tools/gif2h5/testfiles/ex_image2.h5
Binary files differ