diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-09-26 18:38:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-26 18:38:07 (GMT) |
commit | 58f3d6664e7a2af8d6b1813374ab02d72795a5e1 (patch) | |
tree | 6ea0aa75925b343d756583d3ec746610739e01fd /tools | |
parent | d26d674e676446dd2f785ba2895fa72b78025b6e (diff) | |
download | hdf5-58f3d6664e7a2af8d6b1813374ab02d72795a5e1.zip hdf5-58f3d6664e7a2af8d6b1813374ab02d72795a5e1.tar.gz hdf5-58f3d6664e7a2af8d6b1813374ab02d72795a5e1.tar.bz2 |
Use HDoff_t with lseek consistently (#3600)
lseek on Windows uses __int64 for both the offset and return type
instead of off_t like most POSIX systems. This changes ensures we
use HDoff_t (which is typdef'd correctly on Windows) w/ lseek.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/src/h5jam/h5jam.c | 6 | ||||
-rw-r--r-- | tools/test/misc/h5clear_gentest.c | 4 | ||||
-rw-r--r-- | tools/test/perform/iopipe.c | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c index 9fea8b8..d97d339 100644 --- a/tools/src/h5jam/h5jam.c +++ b/tools/src/h5jam/h5jam.c @@ -420,8 +420,8 @@ copy_some_to_file(int infid, int outfid, hsize_t starting, hsize_t startout, ssi } /* end if */ while (howmuch > 0) { - HDlseek(outfid, (off_t)to, SEEK_SET); - HDlseek(infid, (off_t)from, SEEK_SET); + HDlseek(outfid, (HDoff_t)to, SEEK_SET); + HDlseek(infid, (HDoff_t)from, SEEK_SET); if (howmuch > 512) { nchars = HDread(infid, buf, (unsigned)512); @@ -499,7 +499,7 @@ write_pad(int ofile, hsize_t old_where, hsize_t *new_where) buf[0] = '\0'; - HDlseek(ofile, (off_t)old_where, SEEK_SET); + HDlseek(ofile, (HDoff_t)old_where, SEEK_SET); psize = compute_user_block_size(old_where); psize -= old_where; diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c index dd4c88d..892e974 100644 --- a/tools/test/misc/h5clear_gentest.c +++ b/tools/test/misc/h5clear_gentest.c @@ -274,7 +274,7 @@ gen_enhance_files(bool user) } /* location of "end of file address" */ - if (lseek(fd, (off_t)(28 + (user ? USERBLOCK : 0)), SEEK_SET) < 0) + if (lseek(fd, (HDoff_t)(28 + (user ? USERBLOCK : 0)), SEEK_SET) < 0) goto error; /* Write the bad eoa value to the file */ @@ -282,7 +282,7 @@ gen_enhance_files(bool user) goto error; /* location of "superblock checksum" */ - if (lseek(fd, (off_t)(44 + (user ? USERBLOCK : 0)), SEEK_SET) < 0) + if (lseek(fd, (HDoff_t)(44 + (user ? USERBLOCK : 0)), SEEK_SET) < 0) goto error; /* Write the chksum value to the file */ diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c index a0dd294..b5190fa 100644 --- a/tools/test/perform/iopipe.c +++ b/tools/test/perform/iopipe.c @@ -123,7 +123,7 @@ main(void) unsigned u; herr_t H5_ATTR_NDEBUG_UNUSED status; hssize_t H5_ATTR_NDEBUG_UNUSED n; - off_t H5_ATTR_NDEBUG_UNUSED offset; + HDoff_t H5_ATTR_NDEBUG_UNUSED offset; hsize_t start[2]; hsize_t count[2]; @@ -207,7 +207,7 @@ main(void) for (u = 0; u < nwrite; u++) { putc(PROGRESS, stderr); fflush(stderr); - offset = HDlseek(fd, (off_t)0, SEEK_SET); + offset = HDlseek(fd, 0, SEEK_SET); assert(0 == offset); n = HDwrite(fd, the_data, (size_t)(size[0] * size[1])); assert(n >= 0 && (size_t)n == (size[0] * size[1])); @@ -257,7 +257,7 @@ main(void) for (u = 0; u < nread; u++) { putc(PROGRESS, stderr); fflush(stderr); - offset = HDlseek(fd, (off_t)0, SEEK_SET); + offset = HDlseek(fd, 0, SEEK_SET); assert(0 == offset); n = HDread(fd, the_data, (size_t)(size[0] * size[1])); assert(n >= 0 && (size_t)n == (size[0] * size[1])); |