From a56675e12ad1090eb38d4d3cd8cf08a9af3c9f7f Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Sat, 16 Mar 2024 21:43:47 -0500 Subject: Fix some minor warnings (#4165) --- HDF5Examples/C/H5T/h5ex_t_array.c | 2 +- HDF5Examples/C/H5T/h5ex_t_arrayatt.c | 2 +- HDF5Examples/C/H5T/h5ex_t_cmpd.c | 2 +- HDF5Examples/C/H5T/h5ex_t_cmpdatt.c | 2 +- HDF5Examples/C/H5T/h5ex_t_cpxcmpd.c | 2 +- HDF5Examples/C/H5T/h5ex_t_cpxcmpdatt.c | 2 +- HDF5Examples/C/H5T/h5ex_t_objref.c | 5 ++++- HDF5Examples/C/H5T/h5ex_t_objrefatt.c | 5 ++++- HDF5Examples/C/H5T/h5ex_t_opaqueatt.c | 2 +- HDF5Examples/C/H5T/h5ex_t_regref.c | 2 +- HDF5Examples/C/H5T/h5ex_t_regrefatt.c | 2 +- HDF5Examples/C/H5T/h5ex_t_vlen.c | 2 +- HDF5Examples/C/H5T/h5ex_t_vlenatt.c | 2 +- java/src/jni/h5pImp.c | 4 ++-- src/H5FDsubfiling/H5FDsubfiling.c | 3 --- src/H5Fint.c | 3 ++- test/atomic_writer.c | 18 +++++++++++++++++- test/dsets.c | 6 ++++-- 18 files changed, 44 insertions(+), 22 deletions(-) diff --git a/HDF5Examples/C/H5T/h5ex_t_array.c b/HDF5Examples/C/H5T/h5ex_t_array.c index b63e4e0..a29ac45 100644 --- a/HDF5Examples/C/H5T/h5ex_t_array.c +++ b/HDF5Examples/C/H5T/h5ex_t_array.c @@ -144,7 +144,7 @@ main(void) * Output the data to the screen. */ for (i = 0; i < dims[0]; i++) { - printf("%s[%llu]:\n", DATASET, i); + printf("%s[%" PRIuHSIZE "]:\n", DATASET, i); for (j = 0; j < adims[0]; j++) { printf(" ["); for (k = 0; k < adims[1]; k++) diff --git a/HDF5Examples/C/H5T/h5ex_t_arrayatt.c b/HDF5Examples/C/H5T/h5ex_t_arrayatt.c index a89f2b2..f071128 100644 --- a/HDF5Examples/C/H5T/h5ex_t_arrayatt.c +++ b/HDF5Examples/C/H5T/h5ex_t_arrayatt.c @@ -155,7 +155,7 @@ main(void) * Output the data to the screen. */ for (i = 0; i < dims[0]; i++) { - printf("%s[%llu]:\n", ATTRIBUTE, i); + printf("%s[%" PRIuHSIZE "]:\n", ATTRIBUTE, i); for (j = 0; j < adims[0]; j++) { printf(" ["); for (k = 0; k < adims[1]; k++) diff --git a/HDF5Examples/C/H5T/h5ex_t_cmpd.c b/HDF5Examples/C/H5T/h5ex_t_cmpd.c index 739d061..44f1552 100644 --- a/HDF5Examples/C/H5T/h5ex_t_cmpd.c +++ b/HDF5Examples/C/H5T/h5ex_t_cmpd.c @@ -136,7 +136,7 @@ main(void) * Output the data to the screen. */ for (i = 0; i < dims[0]; i++) { - printf("%s[%llu]:\n", DATASET, i); + printf("%s[%" PRIuHSIZE "]:\n", DATASET, i); printf("Serial number : %d\n", rdata[i].serial_no); printf("Location : %s\n", rdata[i].location); printf("Temperature (F) : %f\n", rdata[i].temperature); diff --git a/HDF5Examples/C/H5T/h5ex_t_cmpdatt.c b/HDF5Examples/C/H5T/h5ex_t_cmpdatt.c index 246537b..04c72a5 100644 --- a/HDF5Examples/C/H5T/h5ex_t_cmpdatt.c +++ b/HDF5Examples/C/H5T/h5ex_t_cmpdatt.c @@ -146,7 +146,7 @@ main(void) * Output the data to the screen. */ for (i = 0; i < dims[0]; i++) { - printf("%s[%llu]:\n", ATTRIBUTE, i); + printf("%s[%" PRIuHSIZE "]:\n", ATTRIBUTE, i); printf("Serial number : %d\n", rdata[i].serial_no); printf("Location : %s\n", rdata[i].location); printf("Temperature (F) : %f\n", rdata[i].temperature); diff --git a/HDF5Examples/C/H5T/h5ex_t_cpxcmpd.c b/HDF5Examples/C/H5T/h5ex_t_cpxcmpd.c index 8506c08..370f781 100644 --- a/HDF5Examples/C/H5T/h5ex_t_cpxcmpd.c +++ b/HDF5Examples/C/H5T/h5ex_t_cpxcmpd.c @@ -293,7 +293,7 @@ main(void) * Output the data to the screen. */ for (i = 0; i < dims[0]; i++) { - printf("%s[%llu]:\n", DATASET, i); + printf("%s[%" PRIuHSIZE "]:\n", DATASET, i); printf(" Vehicle name :\n %s\n", rdata[i].name); printf(" Sensor locations :\n"); for (j = 0; j < rdata[i].sensors.len; j++) diff --git a/HDF5Examples/C/H5T/h5ex_t_cpxcmpdatt.c b/HDF5Examples/C/H5T/h5ex_t_cpxcmpdatt.c index c7efbce..a55fb76 100644 --- a/HDF5Examples/C/H5T/h5ex_t_cpxcmpdatt.c +++ b/HDF5Examples/C/H5T/h5ex_t_cpxcmpdatt.c @@ -304,7 +304,7 @@ main(void) * Output the data to the screen. */ for (i = 0; i < dims[0]; i++) { - printf("%s[%llu]:\n", ATTRIBUTE, i); + printf("%s[%" PRIuHSIZE "]:\n", ATTRIBUTE, i); printf(" Vehicle name :\n %s\n", rdata[i].name); printf(" Sensor locations :\n"); for (j = 0; j < rdata[i].sensors.len; j++) diff --git a/HDF5Examples/C/H5T/h5ex_t_objref.c b/HDF5Examples/C/H5T/h5ex_t_objref.c index 660cc11..e6c2de9 100644 --- a/HDF5Examples/C/H5T/h5ex_t_objref.c +++ b/HDF5Examples/C/H5T/h5ex_t_objref.c @@ -135,7 +135,7 @@ main(void) * Output the data to the screen. */ for (i = 0; i < dims[0]; i++) { - printf("%s[%llu]:\n ->", DATASET, i); + printf("%s[%" PRIuHSIZE "]:\n ->", DATASET, i); /* * Open the referenced object, get its name and type. @@ -174,6 +174,9 @@ main(void) case H5O_TYPE_NAMED_DATATYPE: printf("Named Datatype"); break; + case H5O_TYPE_MAP: + printf("Map Object"); + break; case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: printf("Unknown"); diff --git a/HDF5Examples/C/H5T/h5ex_t_objrefatt.c b/HDF5Examples/C/H5T/h5ex_t_objrefatt.c index 1d9d1fe..562364a 100644 --- a/HDF5Examples/C/H5T/h5ex_t_objrefatt.c +++ b/HDF5Examples/C/H5T/h5ex_t_objrefatt.c @@ -147,7 +147,7 @@ main(void) * Output the data to the screen. */ for (i = 0; i < dims[0]; i++) { - printf("%s[%llu]:\n ->", ATTRIBUTE, i); + printf("%s[%" PRIuHSIZE "]:\n ->", ATTRIBUTE, i); /* * Open the referenced object, get its name and type. @@ -186,6 +186,9 @@ main(void) case H5O_TYPE_NAMED_DATATYPE: printf("Named Datatype"); break; + case H5O_TYPE_MAP: + printf("Map Object"); + break; case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: printf("Unknown"); diff --git a/HDF5Examples/C/H5T/h5ex_t_opaqueatt.c b/HDF5Examples/C/H5T/h5ex_t_opaqueatt.c index e88031a..6729492 100644 --- a/HDF5Examples/C/H5T/h5ex_t_opaqueatt.c +++ b/HDF5Examples/C/H5T/h5ex_t_opaqueatt.c @@ -121,7 +121,7 @@ main(void) */ printf("Datatype tag for %s is: \"%s\"\n", ATTRIBUTE, tag); for (i = 0; i < dims[0]; i++) { - printf("%s[%llu]: ", ATTRIBUTE, i); + printf("%s[%" PRIuHSIZE "]: ", ATTRIBUTE, i); for (j = 0; j < len; j++) printf("%c", rdata[j + i * len]); printf("\n"); diff --git a/HDF5Examples/C/H5T/h5ex_t_regref.c b/HDF5Examples/C/H5T/h5ex_t_regref.c index 3922725..e6d4cef 100644 --- a/HDF5Examples/C/H5T/h5ex_t_regref.c +++ b/HDF5Examples/C/H5T/h5ex_t_regref.c @@ -168,7 +168,7 @@ main(void) * Output the data to the screen. */ for (i = 0; i < dims[0]; i++) { - printf("%s[%llu]:\n ->", DATASET, i); + printf("%s[%" PRIuHSIZE "]:\n ->", DATASET, i); /* * Open the referenced object, retrieve its region as a diff --git a/HDF5Examples/C/H5T/h5ex_t_regrefatt.c b/HDF5Examples/C/H5T/h5ex_t_regrefatt.c index 5ed745d..bb31b70 100644 --- a/HDF5Examples/C/H5T/h5ex_t_regrefatt.c +++ b/HDF5Examples/C/H5T/h5ex_t_regrefatt.c @@ -183,7 +183,7 @@ main(void) * Output the data to the screen. */ for (i = 0; i < dims[0]; i++) { - printf("%s[%llu]:\n ->", ATTRIBUTE, i); + printf("%s[%" PRIuHSIZE "]:\n ->", ATTRIBUTE, i); /* * Open the referenced object, retrieve its region as a diff --git a/HDF5Examples/C/H5T/h5ex_t_vlen.c b/HDF5Examples/C/H5T/h5ex_t_vlen.c index 7111a34..b564972 100644 --- a/HDF5Examples/C/H5T/h5ex_t_vlen.c +++ b/HDF5Examples/C/H5T/h5ex_t_vlen.c @@ -118,7 +118,7 @@ main(void) * Output the variable-length data to the screen. */ for (i = 0; i < dims[0]; i++) { - printf("%s[%llu]:\n {", DATASET, i); + printf("%s[%" PRIuHSIZE "]:\n {", DATASET, i); ptr = rdata[i].p; for (j = 0; j < rdata[i].len; j++) { printf(" %d", ptr[j]); diff --git a/HDF5Examples/C/H5T/h5ex_t_vlenatt.c b/HDF5Examples/C/H5T/h5ex_t_vlenatt.c index db69aea..e173a20 100644 --- a/HDF5Examples/C/H5T/h5ex_t_vlenatt.c +++ b/HDF5Examples/C/H5T/h5ex_t_vlenatt.c @@ -128,7 +128,7 @@ main(void) * Output the variable-length data to the screen. */ for (i = 0; i < dims[0]; i++) { - printf("%s[%llu]:\n {", ATTRIBUTE, i); + printf("%s[%" PRIuHSIZE "]:\n {", ATTRIBUTE, i); ptr = rdata[i].p; for (j = 0; j < rdata[i].len; j++) { printf(" %d", ptr[j]); diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index ce9989d..e38701f 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -563,8 +563,8 @@ done: JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget(JNIEnv *env, jclass clss, jlong plid, jstring name) { - const char *cstr = NULL; - jint val; + const char *cstr = NULL; + jint val = -1; herr_t status = FAIL; UNUSED(clss); diff --git a/src/H5FDsubfiling/H5FDsubfiling.c b/src/H5FDsubfiling/H5FDsubfiling.c index 71dd4ba..4c39f0f 100644 --- a/src/H5FDsubfiling/H5FDsubfiling.c +++ b/src/H5FDsubfiling/H5FDsubfiling.c @@ -2940,7 +2940,6 @@ translate_io_req_to_iovec(subfiling_context_t *sf_context, size_t iovec_idx, siz int64_t row_offset = 0; int64_t row_stripe_idx_start = 0; int64_t row_stripe_idx_final = 0; - int64_t cur_stripe_idx = 0; int64_t max_iovec_depth = 0; int64_t mem_offset = 0; size_t total_bytes = 0; @@ -3100,7 +3099,6 @@ translate_io_req_to_iovec(subfiling_context_t *sf_context, size_t iovec_idx, siz * vector components for each. Subfiles whose data size is * zero will not have I/O requests passed to them. */ - cur_stripe_idx = stripe_idx; for (int i = 0, subfile_idx = (int)first_subfile_idx; i < num_subfiles; i++) { H5_flexible_const_ptr_t *_io_bufs_ptr; H5FD_mem_t *_io_types_ptr; @@ -3295,7 +3293,6 @@ translate_io_req_to_iovec(subfiling_context_t *sf_context, size_t iovec_idx, siz offset_in_block += (int64_t)*_io_sizes_ptr; subfile_idx++; - cur_stripe_idx++; if (subfile_idx == num_subfiles) { subfile_idx = 0; diff --git a/src/H5Fint.c b/src/H5Fint.c index 1aa289d..9cdb9a0 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1300,7 +1300,8 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F if (NULL == (f->shared->mdc_log_location = (char *)H5MM_calloc((len + 1) * sizeof(char)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate memory for mdc log file name"); - strncpy(f->shared->mdc_log_location, mdc_log_location, len); + strncpy(f->shared->mdc_log_location, mdc_log_location, len + 1); + f->shared->mdc_log_location[len] = '\0'; } else f->shared->mdc_log_location = NULL; diff --git a/test/atomic_writer.c b/test/atomic_writer.c index 89edfe7..54aa2f4 100644 --- a/test/atomic_writer.c +++ b/test/atomic_writer.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #if !defined(WIN32) && !defined(__MINGW32__) @@ -184,13 +185,28 @@ main(int argc, char *argv[]) /* Write the series of integers to the file */ for (n = 0; n < num; n++) { + size_t seek_pos; /* Set up data to be written */ for (u = 0; u < num; u++) buf[u] = n; + seek_pos = n * sizeof(unsigned int); + if (sizeof(off_t) < 8) { + if (seek_pos > INT32_MAX) { + printf("WRITER: seek past range for lseek\n"); + goto error; + } + } + else { + if (seek_pos > INT64_MAX) { + printf("WRITER: seek past range for lseek\n"); + goto error; + } + } + /* Position the file to the proper location */ - if (lseek(fd, (n * sizeof(unsigned int)), SEEK_SET) < 0) { + if (lseek(fd, (off_t)seek_pos, SEEK_SET) < 0) { printf("WRITER: error from lseek\n"); goto error; } /* end if */ diff --git a/test/dsets.c b/test/dsets.c index 3203ed0..8f2d2c4 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -5891,8 +5891,10 @@ test_floattypes(hid_t file) (long double)1.0711093225222612990711093225222612, (long double)-9.8971679387636870998971679387636870e-1}}; long double new_data[2][5]; - size_t ld_spos, ld_epos, ld_esize, ld_mpos, ld_msize; - size_t tgt_precision = 128; +#if LDBL_MANT_DIG != 106 + size_t ld_spos, ld_epos, ld_esize, ld_mpos, ld_msize; + size_t tgt_precision = 128; +#endif TESTING(" long double (setup)"); -- cgit v0.12