summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2024-01-18 17:03:59 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2024-02-14 21:22:42 (GMT)
commit0eb5d91d55d8683b24fc6c9cde233aa4a170b828 (patch)
tree94ca5bd6ff0ad96b7393cd12eed245d45cb5e3f0 /src
parentc9f56a36b8f0b6af790853007e1dae51b1411fa4 (diff)
downloadhdf5-0eb5d91d55d8683b24fc6c9cde233aa4a170b828.zip
hdf5-0eb5d91d55d8683b24fc6c9cde233aa4a170b828.tar.gz
hdf5-0eb5d91d55d8683b24fc6c9cde233aa4a170b828.tar.bz2
Replace off_t with HDoff_t internally (#3944)
off_t is a 32-bit signed value on Windows, so we should use HDoff_t (which is __int64 on Windows) internally instead. Also defines HDftell on Windows to be _ftelli64().
Diffstat (limited to 'src')
-rw-r--r--src/H5Pdcpl.c2
-rw-r--r--src/H5Ppublic.h3
-rw-r--r--src/H5win32defs.h3
3 files changed, 6 insertions, 2 deletions
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index cdee942..ae426ee 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -1550,7 +1550,7 @@ H5P__dcrt_ext_file_list_dec(const void **_pp, void *_value)
enc_size = *(*pp)++;
assert(enc_size < 256);
UINT64DECODE_VAR(*pp, enc_value, enc_size);
- efl->slot[u].offset = (off_t)enc_value;
+ efl->slot[u].offset = (HDoff_t)enc_value;
/* decode size */
enc_size = *(*pp)++;
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index f9840d0..18e96ee 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -6392,6 +6392,9 @@ H5_DLL herr_t H5Pset_dset_no_attrs_hint(hid_t dcpl_id, hbool_t minimize);
* when H5Dwrite() is called to write data to it, the library
* will create the file.
*
+ * \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.
+ *
* \since 1.0.0
*
*/
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index ba6028a..a9a4628 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -22,7 +22,7 @@
/* off_t exists on Windows, but is always a 32-bit long, even on 64-bit Windows,
* so we define HDoff_t to be __int64, which is the type of the st_size field
- * of the _stati64 struct.
+ * of the _stati64 struct and what is returned by _ftelli64().
*/
#define HDoff_t __int64
@@ -42,6 +42,7 @@ struct timezone {
#define HDcreat(S, M) Wopen_utf8(S, O_CREAT | O_TRUNC | O_RDWR, M)
#define HDflock(F, L) Wflock(F, L)
#define HDfstat(F, B) _fstati64(F, B)
+#define HDftell(F) _ftelli64(F)
#define HDgetdcwd(D, S, Z) _getdcwd(D, S, Z)
#define HDgetdrive() _getdrive()
#define HDgettimeofday(V, Z) Wgettimeofday(V, Z)