Skip to content

Commit

Permalink
Fix some minor warnings (HDFGroup#4165)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhendersonHDF authored and lrknox committed Mar 21, 2024
1 parent bbeb43b commit 76608b2
Show file tree
Hide file tree
Showing 18 changed files with 44 additions and 22 deletions.
2 changes: 1 addition & 1 deletion HDF5Examples/C/H5T/h5ex_t_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down
2 changes: 1 addition & 1 deletion HDF5Examples/C/H5T/h5ex_t_arrayatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down
2 changes: 1 addition & 1 deletion HDF5Examples/C/H5T/h5ex_t_cmpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion HDF5Examples/C/H5T/h5ex_t_cmpdatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion HDF5Examples/C/H5T/h5ex_t_cpxcmpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down
2 changes: 1 addition & 1 deletion HDF5Examples/C/H5T/h5ex_t_cpxcmpdatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down
5 changes: 4 additions & 1 deletion HDF5Examples/C/H5T/h5ex_t_objref.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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");
Expand Down
5 changes: 4 additions & 1 deletion HDF5Examples/C/H5T/h5ex_t_objrefatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion HDF5Examples/C/H5T/h5ex_t_opaqueatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion HDF5Examples/C/H5T/h5ex_t_regref.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion HDF5Examples/C/H5T/h5ex_t_regrefatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion HDF5Examples/C/H5T/h5ex_t_vlen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion HDF5Examples/C/H5T/h5ex_t_vlenatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
4 changes: 2 additions & 2 deletions java/src/jni/h5pImp.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,8 @@ Java_hdf_hdf5lib_H5_H5Pisa_1class(JNIEnv *env, jclass clss, jlong plid, jlong pc
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);
Expand Down
3 changes: 0 additions & 3 deletions src/H5FDsubfiling/H5FDsubfiling.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/H5Fint.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 17 additions & 1 deletion test/atomic_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>

#if !defined(WIN32) && !defined(__MINGW32__)
Expand Down Expand Up @@ -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 */
Expand Down
6 changes: 4 additions & 2 deletions test/dsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)");

Expand Down

0 comments on commit 76608b2

Please sign in to comment.