From 5c0d4bf3aa8ebb1acae578751514b8db823ff1b0 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 8 Mar 2024 22:25:08 -0800 Subject: [PATCH] Clean up off_t usage * Add comments to C++ and Fortran API calls that use off_t * Remove noise casts for small integers --- HDF5Examples/FORTRAN/H5D/h5ex_d_extern.F90 | 2 +- c++/src/H5DcreatProp.cpp | 4 ++++ fortran/src/H5Pff.F90 | 8 +++++++- src/H5FDcore.c | 8 ++++---- src/H5FDdirect.c | 4 ++-- src/H5FDlog.c | 4 ++-- src/H5FDsec2.c | 4 ++-- test/big.c | 2 +- test/enc_dec_plist.c | 8 ++++---- test/enc_dec_plist_cross_platform.c | 8 ++++---- test/external.c | 22 ++++++++++------------ test/file_image.c | 2 +- test/fillval.c | 2 +- test/gen_bad_offset.c | 12 ++++++------ test/gen_plist.c | 8 ++++---- test/istore.c | 2 +- test/objcopy.c | 2 +- test/set_extent.c | 4 ++-- test/th5s.c | 2 +- test/twriteorder.c | 4 ++-- testpar/t_2Gio.c | 2 +- testpar/t_dset.c | 2 +- testpar/t_prop.c | 8 ++++---- tools/src/h5import/h5import.c | 3 +-- tools/test/h5dump/h5dumpgentest.c | 4 ++-- tools/test/h5repack/h5repacktst.c | 2 +- 26 files changed, 70 insertions(+), 63 deletions(-) diff --git a/HDF5Examples/FORTRAN/H5D/h5ex_d_extern.F90 b/HDF5Examples/FORTRAN/H5D/h5ex_d_extern.F90 index faef397871f..e44fdf0c2a9 100644 --- a/HDF5Examples/FORTRAN/H5D/h5ex_d_extern.F90 +++ b/HDF5Examples/FORTRAN/H5D/h5ex_d_extern.F90 @@ -40,7 +40,7 @@ PROGRAM main INTEGER :: i, j ! This change was introduced in the 1.8.12 release #if H5_VERSION_GE(1,8,12) - INTEGER(OFF_T) :: offset = 0 ! Offset, in bytes, from thebeginning of the file to the + INTEGER(OFF_T) :: offset = 0 ! Offset, in bytes, from the beginning of the file to the ! location in the file where the data starts. #else INTEGER :: offset = 0 diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index 8f4ee7e490c..f45b54e8dde 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -645,6 +645,8 @@ DSetCreatPropList::setFletcher32() const /// the total size is larger than the size of a dataset then the /// dataset can be extended (provided the data space also allows /// the extending). +///\note On Windows, off_t is typically a 32-bit signed long value, which +/// limits the valid offset that can be set to 2 GiB. //-------------------------------------------------------------------------- void DSetCreatPropList::setExternal(const char *name, off_t offset, hsize_t size) const @@ -693,6 +695,8 @@ DSetCreatPropList::getExternalCount() const /// external file name will not be returned. If \a offset or /// \a size are null pointers then the corresponding information /// will not be returned. +///\note On Windows, off_t is typically a 32-bit signed long value, which +/// limits the valid offset that can be returned to 2 GiB. //-------------------------------------------------------------------------- void DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char *name, off_t &offset, hsize_t &size) const diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 516c34b99f1..ab6765a8874 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -1615,6 +1615,9 @@ END SUBROUTINE h5pget_filter_f !! \param bytes Size of the external file data. !! \param hdferr \fortran_error !! +!! \note On Windows, off_t is typically a 32-bit signed long value, which +!! limits the valid offset that can be set to 2 GiB. +!! !! See C API: @ref H5Pset_external() !! SUBROUTINE h5pset_external_f(prp_id, name, offset, bytes, hdferr) @@ -1686,9 +1689,12 @@ END SUBROUTINE h5pget_external_count_f !! \param bytes Size of the external file data. !! \param hdferr \fortran_error !! +!! \note On Windows, off_t is typically a 32-bit signed long value, which +!! limits the valid offset that can be returned to 2 GiB. +!! !! See C API: @ref H5Pget_external() !! - SUBROUTINE h5pget_external_f(prp_id, idx, name_size, name, offset,bytes, hdferr) + SUBROUTINE h5pget_external_f(prp_id, idx, name_size, name, offset, bytes, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id INTEGER, INTENT(IN) :: idx diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 37674202839..7c4846975f7 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -393,7 +393,7 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) int myerrno = errno; time_t mytime = HDtime(NULL); - offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); + offset = HDlseek(file->fd, 0, SEEK_CUR); HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write to backing store failed: time = %s, filename = '%s', file descriptor = %d, " @@ -871,8 +871,8 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr * partial results, and the end of the file. */ - uint8_t *mem = file->mem; /* memory pointer for writes */ - HDoff_t offset = (HDoff_t)0; /* offset for reading */ + uint8_t *mem = file->mem; /* memory pointer for writes */ + HDoff_t offset = 0; /* offset for reading */ while (size > 0) { h5_posix_io_t bytes_in = 0; /* # of bytes to read */ @@ -900,7 +900,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr int myerrno = errno; time_t mytime = HDtime(NULL); - offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); + offset = HDlseek(file->fd, 0, SEEK_CUR); HGOTO_ERROR( H5E_IO, H5E_READERROR, NULL, diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 08c4a839799..49f80d4f8bc 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -541,7 +541,7 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad } else { file->fa.must_align = false; - if (-1 == HDftruncate(file->fd, (HDoff_t)0)) + if (-1 == HDftruncate(file->fd, 0)) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, NULL, "unable to truncate file") } } @@ -554,7 +554,7 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad } else { if (o_flags & O_RDWR) { - if (HDlseek(file->fd, (HDoff_t)0, SEEK_SET) < 0) + if (HDlseek(file->fd, 0, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, NULL, "unable to seek to proper position") if (HDwrite(file->fd, buf1, sizeof(int)) < 0) file->fa.must_align = true; diff --git a/src/H5FDlog.c b/src/H5FDlog.c index e35a6a65c4a..64d3662bd36 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -1229,7 +1229,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had int myerrno = errno; time_t mytime = HDtime(NULL); - offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); + offset = HDlseek(file->fd, 0, SEEK_CUR); if (file->fa.flags & H5FD_LOG_LOC_READ) fprintf(file->logfp, "Error! Reading: %10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes)\n", @@ -1448,7 +1448,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha int myerrno = errno; time_t mytime = HDtime(NULL); - offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); + offset = HDlseek(file->fd, 0, SEEK_CUR); if (file->fa.flags & H5FD_LOG_LOC_WRITE) fprintf(file->logfp, "Error! Writing: %10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes)\n", diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 15accf76d33..c4bfbff24c8 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -697,7 +697,7 @@ H5FD__sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU int myerrno = errno; time_t mytime = HDtime(NULL); - offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); + offset = HDlseek(file->fd, 0, SEEK_CUR); HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, " @@ -803,7 +803,7 @@ H5FD__sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN int myerrno = errno; time_t mytime = HDtime(NULL); - offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); + offset = HDlseek(file->fd, 0, SEEK_CUR); HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, " diff --git a/test/big.c b/test/big.c index 428da0aed11..ed38251aab9 100644 --- a/test/big.c +++ b/test/big.c @@ -143,7 +143,7 @@ is_sparse(void) if ((fd = HDopen("x.h5", O_RDWR | O_TRUNC | O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0) return 0; - if (HDlseek(fd, (HDoff_t)(1024 * 1024), SEEK_SET) != 1024 * 1024) + if (HDlseek(fd, (1024 * 1024), SEEK_SET) != 1024 * 1024) return 0; if (5 != HDwrite(fd, "hello", (size_t)5)) return 0; diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index e643b1bd5ff..878fe86449b 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -220,13 +220,13 @@ main(void) FAIL_STACK_ERROR; max_size[0] = 100; - if ((H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0) + if ((H5Pset_external(dcpl, "ext1.data", 0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0) FAIL_STACK_ERROR; - if ((H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0) + if ((H5Pset_external(dcpl, "ext2.data", 0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0) FAIL_STACK_ERROR; - if ((H5Pset_external(dcpl, "ext3.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0) + if ((H5Pset_external(dcpl, "ext3.data", 0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0) FAIL_STACK_ERROR; - if ((H5Pset_external(dcpl, "ext4.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0) + if ((H5Pset_external(dcpl, "ext4.data", 0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0) FAIL_STACK_ERROR; /* Test encoding & decoding property list */ diff --git a/test/enc_dec_plist_cross_platform.c b/test/enc_dec_plist_cross_platform.c index a3682147843..d2d68105986 100644 --- a/test/enc_dec_plist_cross_platform.c +++ b/test/enc_dec_plist_cross_platform.c @@ -178,8 +178,8 @@ test_plists(const char *filename_prefix) testfile = H5_get_srcdir_filename(filename); if ((fd_1 = HDopen(testfile, O_RDONLY)) < 0) TEST_ERROR; - size_1 = (size_t)HDlseek(fd_1, (HDoff_t)0, SEEK_END); - HDlseek(fd_1, (HDoff_t)0, SEEK_SET); + size_1 = (size_t)HDlseek(fd_1, 0, SEEK_END); + HDlseek(fd_1, 0, SEEK_SET); buf_1 = (void *)malloc(size_1); if (HDread(fd_1, buf_1, size_1) < 0) TEST_ERROR; @@ -194,8 +194,8 @@ test_plists(const char *filename_prefix) testfile = H5_get_srcdir_filename(filename); if ((fd_2 = HDopen(testfile, O_RDONLY)) < 0) TEST_ERROR; - size_2 = (size_t)HDlseek(fd_2, (HDoff_t)0, SEEK_END); - HDlseek(fd_2, (HDoff_t)0, SEEK_SET); + size_2 = (size_t)HDlseek(fd_2, 0, SEEK_END); + HDlseek(fd_2, 0, SEEK_SET); buf_2 = (void *)malloc(size_2); if (HDread(fd_2, buf_2, size_2) < 0) TEST_ERROR; diff --git a/test/external.c b/test/external.c index bf3c5bdf8e0..efd24fa225b 100644 --- a/test/external.c +++ b/test/external.c @@ -106,7 +106,7 @@ test_non_extendible(hid_t file) /* Create the dataset and close */ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; - if (H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) + if (H5Pset_external(dcpl, "ext1.data", 0, (hsize_t)(max_size[0] * sizeof(int))) < 0) FAIL_STACK_ERROR; if ((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR; @@ -203,8 +203,7 @@ test_too_small(hid_t file) if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; - if (H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < - 0) /* note -1 */ + if (H5Pset_external(dcpl, "ext1.data", 0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) /* note -1 */ FAIL_STACK_ERROR; if ((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR; @@ -260,7 +259,7 @@ test_large_enough_current_eventual(hid_t file) if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; - if (H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) + if (H5Pset_external(dcpl, "ext1.data", 0, (hsize_t)(max_size[0] * sizeof(int))) < 0) FAIL_STACK_ERROR; if ((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR; @@ -312,8 +311,7 @@ test_large_enough_current_not_eventual(hid_t file) if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; - if (H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < - 0) /* note -1 */ + if (H5Pset_external(dcpl, "ext1.data", 0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) /* note -1 */ FAIL_STACK_ERROR; if ((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR; @@ -373,7 +371,7 @@ test_unlimited(hid_t file) /* Create dataset */ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; - if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) + if (H5Pset_external(dcpl, "ext1.data", 0, H5F_UNLIMITED) < 0) FAIL_STACK_ERROR; if ((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR; @@ -576,12 +574,12 @@ test_add_to_unlimited(void) if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; - if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) + if (H5Pset_external(dcpl, "ext1.data", 0, H5F_UNLIMITED) < 0) FAIL_STACK_ERROR; H5E_BEGIN_TRY { - status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); + status = H5Pset_external(dcpl, "ext2.data", 0, 100); } H5E_END_TRY if (status >= 0) @@ -627,12 +625,12 @@ test_overflow(void) if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; - if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED - 1) < 0) + if (H5Pset_external(dcpl, "ext1.data", 0, H5F_UNLIMITED - 1) < 0) FAIL_STACK_ERROR; H5E_BEGIN_TRY { - status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); + status = H5Pset_external(dcpl, "ext2.data", 0, 100); } H5E_END_TRY if (status >= 0) @@ -1286,7 +1284,7 @@ test_h5d_get_access_plist(hid_t fapl_id) /* Create the dcpl and set external storage */ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; - if (H5Pset_external(dcpl_id, "extern_1r.raw", (off_t)0, (hsize_t)0) < 0) + if (H5Pset_external(dcpl_id, "extern_1r.raw", 0, 0) < 0) FAIL_STACK_ERROR; /* Create the dapl and set the prefix */ diff --git a/test/file_image.c b/test/file_image.c index 81b49d6bd4e..66881c4c129 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -871,7 +871,7 @@ test_get_file_image(const char *test_banner, const int file_name_num, hid_t fapl HDoff_t off; /* Position at userblock */ - off = HDlseek(fd, (HDoff_t)USERBLOCK_SIZE, SEEK_SET); + off = HDlseek(fd, USERBLOCK_SIZE, SEEK_SET); VERIFY(off >= 0, "HDlseek() failed."); } diff --git a/test/fillval.c b/test/fillval.c index 2e8cb4767df..c8f46387b74 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -2098,7 +2098,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) if ((fd = HDopen(FILE_NAME_RAW, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0 || HDclose(fd) < 0) goto error; - if (H5Pset_external(dcpl, FILE_NAME_RAW, (off_t)0, (hsize_t)nelmts * sizeof(int)) < 0) + if (H5Pset_external(dcpl, FILE_NAME_RAW, 0, (hsize_t)nelmts * sizeof(int)) < 0) goto error; } #endif diff --git a/test/gen_bad_offset.c b/test/gen_bad_offset.c index 4f7b95997d8..9c52195a94f 100644 --- a/test/gen_bad_offset.c +++ b/test/gen_bad_offset.c @@ -31,11 +31,11 @@ * (A) Open the file: * fd = HDopen(TESTFILE, O_RDWR, 0663); * (B) Position the file at: - * (1) HDlseek(fd, (HDoff_t)880, SEEK_SET); + * (1) HDlseek(fd, 880, SEEK_SET); * "/group1/group2": replace heap offset "8" by bad offset - * (2) HDlseek(fd, (HDoff_t)1512, SEEK_SET); + * (2) HDlseek(fd, 1512, SEEK_SET); * "/dsetA": replace name offset into private heap "72" by bad offset - * (3) HDlseek(fd, (HDoff_t)1616, SEEK_SET); + * (3) HDlseek(fd, 1616, SEEK_SET); * /soft_one: replace link value offset in the scratch pad "32" by bad offset * (C) Write the bad offset value to the file for (1), (2) and (3): * write(fd, &val, sizeof(val)); @@ -104,21 +104,21 @@ main(void) FAIL_STACK_ERROR; /* Position the file for /group1/group2: replace heap offset "8" by bad offset */ - if (HDlseek(fd, (HDoff_t)880, SEEK_SET) < 0) + if (HDlseek(fd, 880, SEEK_SET) < 0) FAIL_STACK_ERROR; /* Write the bad offset value to the file */ if (HDwrite(fd, &val, sizeof(val)) < 0) FAIL_STACK_ERROR; /* Position the file for /dsetA: replace name offset into private heap "72" by bad offset */ - if (HDlseek(fd, (HDoff_t)1512, SEEK_SET) < 0) + if (HDlseek(fd, 1512, SEEK_SET) < 0) FAIL_STACK_ERROR; /* Write the bad offset value to the file */ if (HDwrite(fd, &val, sizeof(val)) < 0) FAIL_STACK_ERROR; /* Position the file for /soft_one: replace link value offset in the scratch pad "32" by bad offset */ - if (HDlseek(fd, (HDoff_t)1616, SEEK_SET) < 0) + if (HDlseek(fd, 1616, SEEK_SET) < 0) FAIL_STACK_ERROR; /* Write the bad offset value to the file */ if (HDwrite(fd, &val, sizeof(val)) < 0) diff --git a/test/gen_plist.c b/test/gen_plist.c index 6d40ae707f5..1400b4095a6 100644 --- a/test/gen_plist.c +++ b/test/gen_plist.c @@ -123,13 +123,13 @@ main(void) assert(ret > 0); max_size[0] = 100; - if ((ret = H5Pset_external(dcpl1, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0) + if ((ret = H5Pset_external(dcpl1, "ext1.data", 0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0) assert(ret > 0); - if ((ret = H5Pset_external(dcpl1, "ext2.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0) + if ((ret = H5Pset_external(dcpl1, "ext2.data", 0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0) assert(ret > 0); - if ((ret = H5Pset_external(dcpl1, "ext3.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0) + if ((ret = H5Pset_external(dcpl1, "ext3.data", 0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0) assert(ret > 0); - if ((ret = H5Pset_external(dcpl1, "ext4.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0) + if ((ret = H5Pset_external(dcpl1, "ext4.data", 0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0) assert(ret > 0); if ((ret = encode_plist(dcpl1, little_endian, word_length, "plist_files/dcpl_")) < 0) diff --git a/test/istore.c b/test/istore.c index 33032d1a22f..8da9961cbfd 100644 --- a/test/istore.c +++ b/test/istore.c @@ -62,7 +62,7 @@ is_sparse(void) if ((fd = HDopen("x.h5", O_RDWR | O_TRUNC | O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0) return 0; - if (HDlseek(fd, (HDoff_t)(1024 * 1024), SEEK_SET) != 1024 * 1024) + if (HDlseek(fd, (1024 * 1024), SEEK_SET) != 1024 * 1024) return 0; if (5 != HDwrite(fd, "hello", (size_t)5)) return 0; diff --git a/test/objcopy.c b/test/objcopy.c index d604c540b83..08e7b07fbe5 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -5200,7 +5200,7 @@ test_copy_dataset_external(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t size = DIM_SIZE_1 * sizeof(int); if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; - if (H5Pset_external(pid, FILE_EXT, (off_t)0, size) < 0) + if (H5Pset_external(pid, FILE_EXT, 0, size) < 0) TEST_ERROR; /* create dataset at SRC file */ diff --git a/test/set_extent.c b/test/set_extent.c index d418f2edc71..6e2b7c5d1bd 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -1831,10 +1831,10 @@ test_external(hid_t fapl, bool use_select_io) if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; - if (H5Pset_external(dcpl, EXT_FILE_NAME1, (off_t)0, size) < 0) + if (H5Pset_external(dcpl, EXT_FILE_NAME1, 0, size) < 0) FAIL_STACK_ERROR; - if (H5Pset_external(dcpl, EXT_FILE_NAME2, (off_t)0, size) < 0) + if (H5Pset_external(dcpl, EXT_FILE_NAME2, 0, size) < 0) FAIL_STACK_ERROR; { diff --git a/test/th5s.c b/test/th5s.c index f0e4959a54f..4c46c400116 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -933,7 +933,7 @@ test_h5s_zero_dim(void) * space in the external file is the size of the dataset (zero because one dimension size is zero). * There's no need to clean up the external file since the library doesn't create it * until the data is written to it. */ - ret = H5Pset_external(plist_id, EXTFILE_NAME, (off_t)0, (hsize_t)0); + ret = H5Pset_external(plist_id, EXTFILE_NAME, 0, (hsize_t)0); CHECK(ret, FAIL, "H5Pset_external"); ret = H5Pset_alloc_time(plist_id, alloc_time); diff --git a/test/twriteorder.c b/test/twriteorder.c index 9bfe87bb2cc..41841b59672 100644 --- a/test/twriteorder.c +++ b/test/twriteorder.c @@ -283,7 +283,7 @@ write_wo_file(void) } /* end for */ /* write the last blkaddr in partition 0 */ - HDlseek(write_fd_g, (HDoff_t)0, SEEK_SET); + HDlseek(write_fd_g, 0, SEEK_SET); if ((bytes_wrote = HDwrite(write_fd_g, &blkaddr_old, (size_t)sizeof(blkaddr_old))) != sizeof(blkaddr_old)) { printf("blkaddr write failed in partition %d\n", 0); @@ -310,7 +310,7 @@ read_wo_file(void) /* keep reading the initial block address until it is non-zero before proceeding. */ while (blkaddr == 0) { - HDlseek(read_fd, (HDoff_t)0, SEEK_SET); + HDlseek(read_fd, 0, SEEK_SET); if ((bytes_read = HDread(read_fd, &blkaddr, (size_t)sizeof(blkaddr))) != sizeof(blkaddr)) { printf("blkaddr read failed in partition %d\n", 0); return -1; diff --git a/testpar/t_2Gio.c b/testpar/t_2Gio.c index 48abf8ed9dd..b6c3988604d 100644 --- a/testpar/t_2Gio.c +++ b/testpar/t_2Gio.c @@ -3906,7 +3906,7 @@ test_no_collective_cause_mode(int selection_mode) } if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL) { - ret = H5Pset_external(dcpl, FILE_EXTERNAL, (off_t)0, H5F_UNLIMITED); + ret = H5Pset_external(dcpl, FILE_EXTERNAL, 0, H5F_UNLIMITED); VRFY((ret >= 0), "set EXTERNAL file layout succeeded"); is_chunked = 0; } diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 67d11d21513..bf4fcfda1a7 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -3655,7 +3655,7 @@ test_no_collective_cause_mode(int selection_mode) } if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL) { - ret = H5Pset_external(dcpl, FILE_EXTERNAL, (off_t)0, H5F_UNLIMITED); + ret = H5Pset_external(dcpl, FILE_EXTERNAL, 0, H5F_UNLIMITED); VRFY((ret >= 0), "set EXTERNAL file layout succeeded"); is_chunked = 0; } diff --git a/testpar/t_prop.c b/testpar/t_prop.c index 23710d76fca..af7b9a891f8 100644 --- a/testpar/t_prop.c +++ b/testpar/t_prop.c @@ -172,13 +172,13 @@ test_plist_ed(void) VRFY((ret >= 0), "set fill-value succeeded"); max_size[0] = 100; - ret = H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4)); + ret = H5Pset_external(dcpl, "ext1.data", 0, (hsize_t)(max_size[0] * sizeof(int) / 4)); VRFY((ret >= 0), "set external succeeded"); - ret = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4)); + ret = H5Pset_external(dcpl, "ext2.data", 0, (hsize_t)(max_size[0] * sizeof(int) / 4)); VRFY((ret >= 0), "set external succeeded"); - ret = H5Pset_external(dcpl, "ext3.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4)); + ret = H5Pset_external(dcpl, "ext3.data", 0, (hsize_t)(max_size[0] * sizeof(int) / 4)); VRFY((ret >= 0), "set external succeeded"); - ret = H5Pset_external(dcpl, "ext4.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4)); + ret = H5Pset_external(dcpl, "ext4.data", 0, (hsize_t)(max_size[0] * sizeof(int) / 4)); VRFY((ret >= 0), "set external succeeded"); ret = test_encode_decode(dcpl, mpi_rank, recv_proc); diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 663f68a7479..828cb6aa690 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -4702,8 +4702,7 @@ process(struct Options *opt) return (-1); } fclose(extfile); - H5Pset_external(proplist, in->externFilename, (off_t)0, - numOfElements * (hsize_t)in->inputSize / 8); + H5Pset_external(proplist, in->externFilename, 0, numOfElements * (hsize_t)in->inputSize / 8); } /* create dataspace */ diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index e12690c5d45..9c42a0e3512 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -5400,10 +5400,10 @@ make_external(hid_t fid) size = (max_size[0] * sizeof(int) / 2); dcpl = H5Pcreate(H5P_DATASET_CREATE); - ret = H5Pset_external(dcpl, "ext1.bin", (off_t)0, size); + ret = H5Pset_external(dcpl, "ext1.bin", 0, size); assert(ret >= 0); - ret = H5Pset_external(dcpl, "ext2.bin", (off_t)0, size); + ret = H5Pset_external(dcpl, "ext2.bin", 0, size); assert(ret >= 0); sid = H5Screate_simple(1, cur_size, max_size); diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index 98d5362e7fe..b414f644281 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -3714,7 +3714,7 @@ make_external(hid_t loc_id) /* create */ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; - if (H5Pset_external(dcpl, H5REPACK_EXTFILE, (off_t)0, size) < 0) + if (H5Pset_external(dcpl, H5REPACK_EXTFILE, 0, size) < 0) goto out; if ((sid = H5Screate_simple(1, cur_size, max_size)) < 0) goto out;