From 52115036dd798a59aa89efefe65b74fb679b527c Mon Sep 17 00:00:00 2001 From: kmu Date: Tue, 28 Jan 2020 14:25:40 -0600 Subject: fix unused function warning --- test/H5srcdir.h | 49 +++++++++------------------------------------- test/h5test.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 40 deletions(-) diff --git a/test/H5srcdir.h b/test/H5srcdir.h index 32fe8c9..b02d432 100644 --- a/test/H5srcdir.h +++ b/test/H5srcdir.h @@ -21,50 +21,19 @@ #define _H5SRCDIR_H /* Include the header file with the correct relative path for the srcdir string */ -#include "H5srcdir_str.h" - -/* Buffer to construct path in and return pointer to */ -static char srcdir_path[1024] = ""; - -/* Buffer to construct file in and return pointer to */ -static char srcdir_testpath[1024] = ""; +#ifdef __cplusplus +extern "C" { +#endif /* Just return the srcdir path */ -static const char * -H5_get_srcdir(void) -{ - const char *srcdir = HDgetenv("srcdir"); - - /* Check for using the srcdir from configure time */ - if(NULL == srcdir) - srcdir = config_srcdir; - - /* Build path to all test files */ - if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) { - HDsnprintf(srcdir_path, sizeof(srcdir_path), "%s/", srcdir); - return(srcdir_path); - } /* end if */ - else - return(NULL); -} /* end H5_get_srcdir() */ +H5TEST_DLL const char *H5_get_srcdir(void); /* Append the test file name to the srcdir path and return the whole string */ -static const char *H5_get_srcdir_filename(const char *filename) -{ - const char *srcdir = H5_get_srcdir(); +H5TEST_DLL const char *H5_get_srcdir_filename(const char *filename); + +#ifdef __cplusplus +} +#endif - /* Check for error */ - if(NULL == srcdir) - return(NULL); - else { - /* Build path to test file */ - if((HDstrlen(srcdir) + HDstrlen(filename) + 1) < sizeof(srcdir_testpath)) { - HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s%s", srcdir, filename); - return(srcdir_testpath); - } /* end if */ - else - return(NULL); - } /* end else */ -} /* end H5_get_srcdir_filename() */ #endif /* _H5SRCDIR_H */ diff --git a/test/h5test.c b/test/h5test.c index ab859a5..d8c0205 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -23,6 +23,7 @@ #include "h5test.h" #include "H5srcdir.h" +#include "H5srcdir_str.h" /* Necessary for h5_verify_cached_stabs() */ #define H5G_FRIEND /*suppress error about including H5Gpkg */ @@ -100,6 +101,12 @@ static const char *multi_letters = "msbrglo"; /* The # of seconds to wait for the message file--used by h5_wait_message() */ #define MESSAGE_TIMEOUT 300 /* Timeout in seconds */ +/* Buffer to construct path in and return pointer to */ +static char srcdir_path[1024] = ""; + +/* Buffer to construct file in and return pointer to */ +static char srcdir_testpath[1024] = ""; + /* The strings that correspond to library version bounds H5F_libver_t in H5Fpublic.h */ /* This is used by h5_get_version_string() */ const char *LIBVER_NAMES[] = { @@ -2038,3 +2045,56 @@ h5_get_version_string(H5F_libver_t libver) { return(LIBVER_NAMES[libver]); } /* end of h5_get_version_string */ + +/*------------------------------------------------------------------------- + * Function: H5_get_srcdir_filename + * + * Purpose: Append the test file name to the srcdir path and return the whole string + * + * Return: The string + * + *------------------------------------------------------------------------- + */ +const char *H5_get_srcdir_filename(const char *filename) +{ + const char *srcdir = H5_get_srcdir(); + + /* Check for error */ + if(NULL == srcdir) + return(NULL); + else { + /* Build path to test file */ + if((HDstrlen(srcdir) + HDstrlen(filename) + 1) < sizeof(srcdir_testpath)) { + HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s%s", srcdir, filename); + return(srcdir_testpath); + } /* end if */ + else + return(NULL); + } /* end else */ +} /* end H5_get_srcdir_filename() */ + +/*------------------------------------------------------------------------- + * Function: H5_get_srcdir + * + * Purpose: Just return the srcdir path + * + * Return: The string + * + *------------------------------------------------------------------------- + */ +const char *H5_get_srcdir(void) +{ + const char *srcdir = HDgetenv("srcdir"); + + /* Check for using the srcdir from configure time */ + if(NULL == srcdir) + srcdir = config_srcdir; + + /* Build path to all test files */ + if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) { + HDsnprintf(srcdir_path, sizeof(srcdir_path), "%s/", srcdir); + return(srcdir_path); + } /* end if */ + else + return(NULL); +} /* end H5_get_srcdir() */ -- cgit v0.12 From 0443c582d8b2be29b3c39e8084628822711987ab Mon Sep 17 00:00:00 2001 From: kmu Date: Wed, 29 Jan 2020 13:31:14 -0600 Subject: initialization discards const warning --- test/tvltypes.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/tvltypes.c b/test/tvltypes.c index a6ed60e..e8c69b4 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -2398,17 +2398,17 @@ test_vltypes_fill_value(void) typedef struct dtype1_struct { unsigned int gui; unsigned int pgui; - char *str_id; - char *str_name; - char *str_desc; - char *str_orig; - char *str_stat; + const char *str_id; + const char *str_name; + const char *str_desc; + const char *str_orig; + const char *str_stat; unsigned int ver; double val; double ma; double mi; - char *str_form; - char *str_unit; + const char *str_form; + const char *str_unit; } dtype1_struct; herr_t ret; -- cgit v0.12 From 4453dc2998f9e053896a0d2da6484c3884ce0c6a Mon Sep 17 00:00:00 2001 From: kmu Date: Wed, 29 Jan 2020 13:43:31 -0600 Subject: fix bad function cast warning --- tools/src/h5repack/h5repack_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index c0c8a2a..947cb06 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -492,7 +492,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) break; case 'j': - options->low_bound = (H5F_libver_t)HDatoi(opt_arg); + options->low_bound = HDatoi(opt_arg); if (options->low_bound < H5F_LIBVER_EARLIEST || options->low_bound > H5F_LIBVER_LATEST) { error_msg("in parsing low bound\n"); goto done; @@ -500,7 +500,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) break; case 'k': - options->high_bound = (H5F_libver_t)HDatoi(opt_arg); + options->high_bound = HDatoi(opt_arg); if (options->high_bound < H5F_LIBVER_EARLIEST || options->high_bound > H5F_LIBVER_LATEST) { error_msg("in parsing high bound\n"); goto done; -- cgit v0.12