From 274cd0ba1d83fa515df43bbd50284bc6c36e4061 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 29 Sep 2020 10:24:49 -0500 Subject: Pre-format fixes for warnings as errors --- java/src/jni/h5util.c | 2 ++ test/external.c | 42 ++++++++++++++++--------------------- test/external_env.c | 3 --- tools/libtest/h5tools_test_utils.c | 2 ++ tools/test/perform/pio_standalone.h | 2 +- 5 files changed, 23 insertions(+), 28 deletions(-) diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index f45902f..eccf7ef 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -784,8 +784,10 @@ h5str_sprintf if (NULL == (this_str = (char *) HDmalloc(27))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_GCC_DIAG_OFF("format-overflow") if (HDsprintf(this_str, "%Lf", tmp_ldouble) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); + H5_GCC_DIAG_ON("format-overflow") break; } diff --git a/test/external.c b/test/external.c index c98c228..227eecf 100644 --- a/test/external.c +++ b/test/external.c @@ -23,7 +23,7 @@ #define AEF_EXNAME_MAX_LEN 12 /* string buffer size for external file name */ /* used in __add_external_files() */ - + /*------------------------------------------------------------------------- * Function: files_have_same_contents * @@ -86,7 +86,7 @@ out: return ret; } /* end files_have_same_contents() */ - + /*------------------------------------------------------------------------- * Function: test_non_extendible * @@ -185,7 +185,7 @@ test_non_extendible(hid_t file) return 1; } /* end test_non_extendible() */ - + /*------------------------------------------------------------------------- * Function: test_too_small * @@ -240,7 +240,7 @@ test_too_small(hid_t file) return 1; } /* end test_too_small() */ - + /*------------------------------------------------------------------------- * Function: test_large_enough_current_eventual * @@ -292,7 +292,7 @@ error: return 1; } /* end test_large_enough_current_eventual() */ - + /*------------------------------------------------------------------------- * Function: test_large_enough_current_not_eventual * @@ -346,7 +346,7 @@ test_large_enough_current_not_eventual(hid_t file) return 1; } /* end test_large_enough_current_not_eventual() */ - + /*------------------------------------------------------------------------- * Function: test_unlimited * @@ -433,7 +433,7 @@ test_unlimited(hid_t file) return 1; } /* end test_unlimited() */ - + /*------------------------------------------------------------------------- * Function: __add_external_files * @@ -483,7 +483,7 @@ __add_external_files( return 0; } /* end __add_external_files() */ - + /*------------------------------------------------------------------------- * Function: test_multiple_files * @@ -562,7 +562,7 @@ error: return 1; } /* end test_multiple_files() */ - + /*------------------------------------------------------------------------- * Function: test_add_to_unlimited * @@ -613,7 +613,7 @@ test_add_to_unlimited(void) return 1; } /* end test_add_to_unlimited() */ - + /*------------------------------------------------------------------------- * Function: test_overflow * @@ -659,7 +659,7 @@ test_overflow(void) return 1; } /* end test_overflow() */ - + /*------------------------------------------------------------------------- * Function: test_read_file_set * @@ -777,7 +777,7 @@ test_read_file_set(hid_t fapl) return 1; } /* end test_read_file_set() */ - + /*------------------------------------------------------------------------- * Function: test_write_file_set * @@ -898,7 +898,7 @@ test_write_file_set(hid_t fapl) return 1; } /* end test_write_file_set() */ - + /*------------------------------------------------------------------------- * Function: test_path_absolute * @@ -925,7 +925,7 @@ test_path_absolute(hid_t fapl) hid_t dset = -1; /* dataset */ size_t i = 0; /* miscellaneous counter */ char cwdpath[1024]; /* working directory */ - char filename[1024]; /* file name */ + char filename[1088]; /* file name */ int part[PART_SIZE]; /* raw data buffer (partial) */ int whole[TOTAL_SIZE]; /* raw data buffer (total) */ hsize_t cur_size; /* current data space size */ @@ -990,7 +990,7 @@ error: return 1; } /* end test_path_absolute() */ - + /*------------------------------------------------------------------------- * Function: test_path_relative * @@ -1014,7 +1014,6 @@ test_path_relative(hid_t fapl) hid_t space = -1; /* data space */ hid_t dset = -1; /* dataset */ size_t i = 0; /* miscellaneous counters */ - char cwdpath[1024]; /* working directory */ char filename[1024]; /* file name */ int part[PART_SIZE]; /* raw data buffer (partial) */ int whole[TOTAL_SIZE]; /* raw data buffer (total) */ @@ -1039,8 +1038,6 @@ test_path_relative(hid_t fapl) /* Create the dataset */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath))) - TEST_ERROR for (i = 0; i < N_EXT_FILES; i++) { HDsnprintf(filename, sizeof(filename), "extern_%dr.raw", (int)i + 1); if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0) @@ -1078,7 +1075,7 @@ error: return 1; } /* end test_path_relative() */ - + /*------------------------------------------------------------------------- * Function: test_path_relative_cwd * @@ -1108,7 +1105,6 @@ test_path_relative_cwd(hid_t fapl) hid_t dset2 = -1; /* dataset, opened a second time */ hid_t dset3 = -1; /* dataset, opened with different prefix */ size_t i = 0; /* miscellaneous counters */ - char cwdpath[1024]; /* working directory */ char filename[1024]; /* file name */ int part[PART_SIZE]; /* raw data buffer (partial) */ int whole[TOTAL_SIZE]; /* raw data buffer (total) */ @@ -1134,8 +1130,6 @@ test_path_relative_cwd(hid_t fapl) /* Create the dataset */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath))) - TEST_ERROR for(i = 0; i < N_EXT_FILES; i++) { HDsnprintf(filename, sizeof(filename), "..%sextern_%dr.raw", H5_DIR_SEPS, (int)i + 1); if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0) @@ -1238,7 +1232,7 @@ error: return 1; } /* end test_path_relative_cwd() */ - + /*------------------------------------------------------------------------- * Function: test_h5d_get_access_plist * @@ -1337,7 +1331,7 @@ test_h5d_get_access_plist(hid_t fapl_id) return 1; } /* end test_h5d_get_access_plist() */ - + /*------------------------------------------------------------------------- * Function: main * diff --git a/test/external_env.c b/test/external_env.c index e9c7635..262cde2 100644 --- a/test/external_env.c +++ b/test/external_env.c @@ -52,7 +52,6 @@ test_path_env(hid_t fapl) hid_t dapl = -1; /* dataset access property list */ hid_t dset = -1; /* dataset */ size_t i; /* miscellaneous counters */ - char cwdpath[1024]; /* working directory */ char filename[1024]; /* file name */ int part[PART_SIZE]; /* raw data buffer (partial) */ int whole[TOTAL_SIZE]; /* raw data buffer (total) */ @@ -75,8 +74,6 @@ test_path_env(hid_t fapl) /* Create the dataset */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath))) - TEST_ERROR for(i = 0; i < N_EXT_FILES; i++) { HDsnprintf(filename, sizeof(filename), "..%sextern_env_%dr.raw", H5_DIR_SEPS, (int) i + 1); if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0) diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index 244fd43..95eaf9c 100644 --- a/tools/libtest/h5tools_test_utils.c +++ b/tools/libtest/h5tools_test_utils.c @@ -69,6 +69,7 @@ * *****************************************************************************/ +H5_GCC_DIAG_OFF("format") /*---------------------------------------------------------------------------- * @@ -1225,6 +1226,7 @@ error : #undef UTIL_TEST_DEFAULT #undef UTIL_TEST_CREATE } /* test_set_configured_fapl */ +H5_GCC_DIAG_ON("format") /*---------------------------------------------------------------------------- diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h index f2cda4f..55880e3 100644 --- a/tools/test/perform/pio_standalone.h +++ b/tools/test/perform/pio_standalone.h @@ -136,7 +136,7 @@ #define HDfopen(S,M) fopen(S,M) #define HDfork() fork() #define HDfpathconf(F,N) fpathconf(F,N) -H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); +#define HDfprintf fprintf #define HDfputc(C,F) fputc(C,F) #define HDfputs(S,F) fputs(S,F) #define HDfread(M,Z,N,F) fread(M,Z,N,F) -- cgit v0.12