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 /test | |
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 'test')
-rw-r--r-- | test/atomic_reader.c | 2 | ||||
-rw-r--r-- | test/atomic_writer.c | 2 | ||||
-rw-r--r-- | test/big.c | 4 | ||||
-rw-r--r-- | test/dsets.c | 4 | ||||
-rw-r--r-- | test/file_image.c | 2 | ||||
-rw-r--r-- | test/istore.c | 2 |
6 files changed, 8 insertions, 8 deletions
diff --git a/test/atomic_reader.c b/test/atomic_reader.c index c8bbbae..12e2d5c 100644 --- a/test/atomic_reader.c +++ b/test/atomic_reader.c @@ -114,7 +114,7 @@ verify(int fd, unsigned int k) } /* end if */ /* Position the file at the beginning */ - if (lseek(fd, (off_t)0, SEEK_SET) < 0) { + if (lseek(fd, 0, SEEK_SET) < 0) { printf("READER: error from lseek\n"); goto error; } /* end if */ diff --git a/test/atomic_writer.c b/test/atomic_writer.c index 33252f1..89edfe7 100644 --- a/test/atomic_writer.c +++ b/test/atomic_writer.c @@ -190,7 +190,7 @@ main(int argc, char *argv[]) buf[u] = n; /* Position the file to the proper location */ - if (lseek(fd, (off_t)(n * sizeof(unsigned int)), SEEK_SET) < 0) { + if (lseek(fd, (n * sizeof(unsigned int)), SEEK_SET) < 0) { printf("WRITER: error from lseek\n"); goto error; } /* end if */ @@ -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, (off_t)(1024 * 1024), SEEK_SET) != 1024 * 1024) + if (HDlseek(fd, (HDoff_t)(1024 * 1024), SEEK_SET) != 1024 * 1024) return 0; if (5 != HDwrite(fd, "hello", (size_t)5)) return 0; @@ -267,7 +267,7 @@ enough_room(hid_t fapl) if ((fd[i] = HDopen(name, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) { goto done; } - if ((off_t)size != HDlseek(fd[i], (off_t)size, SEEK_SET)) { + if ((HDoff_t)size != HDlseek(fd[i], (HDoff_t)size, SEEK_SET)) { goto done; } if (1 != HDwrite(fd[i], "X", (size_t)1)) { diff --git a/test/dsets.c b/test/dsets.c index ecf6db0..33cb6bf 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -626,7 +626,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) file = -1; f = HDopen(filename, O_RDONLY); - HDlseek(f, (off_t)offset, SEEK_SET); + HDlseek(f, (HDoff_t)offset, SEEK_SET); if (HDread(f, rdata_bytes, sizeof(int) * DSET_DIM1 * DSET_DIM2) < 0) goto error; @@ -763,7 +763,7 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, bool new_format) file = -1; f = HDopen(filename, O_RDONLY); - HDlseek(f, (off_t)offset, SEEK_SET); + HDlseek(f, (HDoff_t)offset, SEEK_SET); if (HDread(f, rdata_bytes, sizeof(int) * DSET_DIM1 * DSET_DIM2) < 0) goto error; diff --git a/test/file_image.c b/test/file_image.c index b7d3c27..81b49d6 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, (off_t)USERBLOCK_SIZE, SEEK_SET); + off = HDlseek(fd, (HDoff_t)USERBLOCK_SIZE, SEEK_SET); VERIFY(off >= 0, "HDlseek() failed."); } diff --git a/test/istore.c b/test/istore.c index 921d200..33032d1 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, (off_t)(1024 * 1024), SEEK_SET) != 1024 * 1024) + if (HDlseek(fd, (HDoff_t)(1024 * 1024), SEEK_SET) != 1024 * 1024) return 0; if (5 != HDwrite(fd, "hello", (size_t)5)) return 0; |