summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5Aint.c2
-rw-r--r--src/H5B2.c6
-rw-r--r--src/H5Dchunk.c6
-rw-r--r--src/H5Dcompact.c9
-rw-r--r--src/H5Defl.c64
-rw-r--r--src/H5F.c4
-rw-r--r--src/H5Fsuper.c4
-rw-r--r--src/H5Fsuper_cache.c2
-rw-r--r--src/H5config.h.in6
-rw-r--r--src/H5overflow.h291
-rw-r--r--src/H5overflow.txt1
11 files changed, 352 insertions, 43 deletions
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 613ea77..81b5c60 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -920,7 +920,7 @@ H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_si
*recompute_size = TRUE;
/* Compute the size of the data */
- H5_ASSIGN_OVERFLOW(attr_dst->shared->data_size, H5S_GET_EXTENT_NPOINTS(attr_dst->shared->ds) * H5T_get_size(attr_dst->shared->dt), hsize_t, size_t);
+ H5_ASSIGN_OVERFLOW(attr_dst->shared->data_size, H5S_GET_EXTENT_NPOINTS(attr_dst->shared->ds) * H5T_get_size(attr_dst->shared->dt), hssize_t, size_t);
/* Copy (& convert) the data, if necessary */
if(attr_src->shared->data) {
diff --git a/src/H5B2.c b/src/H5B2.c
index 75ee99e..7e3dd47 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -743,7 +743,8 @@ H5B2_remove(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_remove_t op,
if(H5FL_fac_term(hdr->node_info[hdr->depth].node_ptr_fac) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy node's node pointer block factory")
- hdr->depth -= (uint16_t)depth_decreased;
+ HDassert((uint16_t)(hdr->depth - depth_decreased) < hdr->depth);
+ hdr->depth = (uint16_t)(hdr->depth - depth_decreased);
} /* end for */
} /* end if */
else {
@@ -824,7 +825,8 @@ H5B2_remove_by_idx(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order,
if(H5FL_fac_term(hdr->node_info[hdr->depth].node_ptr_fac) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy node's node pointer block factory")
- hdr->depth -= (uint16_t)depth_decreased;
+ HDassert((uint16_t)(hdr->depth - depth_decreased) < hdr->depth);
+ hdr->depth = (uint16_t)(hdr->depth - depth_decreased);
} /* end for */
} /* end if */
else {
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index aa7b8dc..aad39ee 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -1727,7 +1727,8 @@ H5D_chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
io_info->store->chunk.index = chunk_info->index;
/* Compute # of bytes accessed in chunk */
- src_accessed_bytes = chunk_info->chunk_points * type_info->src_type_size;
+ H5_CHECK_OVERFLOW(type_info->src_type_size, /*From:*/ size_t, /*To:*/ uint32_t);
+ src_accessed_bytes = chunk_info->chunk_points * (uint32_t)type_info->src_type_size;
/* Lock the chunk into the cache */
if(NULL == (chunk = H5D_chunk_lock(io_info, &udata, FALSE, &idx_hint)))
@@ -1859,7 +1860,8 @@ H5D_chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
io_info->store->chunk.index = chunk_info->index;
/* Compute # of bytes accessed in chunk */
- dst_accessed_bytes = chunk_info->chunk_points * type_info->dst_type_size;
+ H5_CHECK_OVERFLOW(type_info->dst_type_size, /*From:*/ size_t, /*To:*/ uint32_t);
+ dst_accessed_bytes = chunk_info->chunk_points * (uint32_t)type_info->dst_type_size;
/* Determine if we will access all the data in the chunk */
if(dst_accessed_bytes != ctg_store.contig.dset_size ||
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index 2c61a6d..128b07e 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -172,7 +172,8 @@ done:
static herr_t
H5D_compact_construct(H5F_t *f, H5D_t *dset)
{
- hssize_t tmp_size; /* Temporary holder for raw data size */
+ hssize_t stmp_size; /* Temporary holder for raw data size */
+ hsize_t tmp_size; /* Temporary holder for raw data size */
hsize_t max_comp_data_size; /* Max. allowed size of compact data */
herr_t ret_value = SUCCEED; /* Return value */
@@ -186,7 +187,11 @@ H5D_compact_construct(H5F_t *f, H5D_t *dset)
* Compact dataset is stored in dataset object header message of
* layout.
*/
- tmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space) * H5T_get_size(dset->shared->type);
+ stmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space);
+ HDassert(stmp_size >= 0);
+ tmp_size = H5T_get_size(dset->shared->type);
+ HDassert(tmp_size > 0);
+ tmp_size = tmp_size * (hsize_t)stmp_size;
H5_ASSIGN_OVERFLOW(dset->shared->layout.storage.u.compact.size, tmp_size, hssize_t, size_t);
/* Verify data size is smaller than maximum header message size
diff --git a/src/H5Defl.c b/src/H5Defl.c
index 18750c8..b0233d4 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -115,7 +115,8 @@ H5D_efl_construct(H5F_t *f, H5D_t *dset)
size_t dt_size; /* Size of datatype */
hsize_t dim[H5O_LAYOUT_NDIMS]; /* Current size of data in elements */
hsize_t max_dim[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */
- hssize_t tmp_size; /* Temporary holder for raw data size */
+ hssize_t stmp_size; /* Temporary holder for raw data size */
+ hsize_t tmp_size; /* Temporary holder for raw data size */
hsize_t max_points; /* Maximum elements */
hsize_t max_storage; /* Maximum storage size */
int ndims; /* Rank of dataspace */
@@ -158,7 +159,9 @@ H5D_efl_construct(H5F_t *f, H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "dataspace size exceeds external storage size")
/* Compute the total size of dataset */
- tmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space) * dt_size;
+ stmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space);
+ HDassert(stmp_size >= 0);
+ tmp_size = (hsize_t)stmp_size * dt_size;
H5_ASSIGN_OVERFLOW(dset->shared->layout.storage.u.contig.size, tmp_size, hssize_t, hsize_t);
/* Get the sieve buffer size for this dataset */
@@ -340,59 +343,58 @@ H5D_efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *bu
FUNC_ENTER_NOAPI_NOINIT(H5D_efl_write)
/* Check args */
- HDassert(efl && efl->nused>0);
+ HDassert(efl && efl->nused > 0);
HDassert(H5F_addr_defined(addr));
HDassert(size < SIZET_MAX);
HDassert(buf || 0 == size);
/* Find the first efl member in which to write */
- for (u=0, cur=0; u<efl->nused; u++) {
- if (H5O_EFL_UNLIMITED==efl->slot[u].size || addr < cur+efl->slot[u].size) {
+ for(u = 0, cur = 0; u < efl->nused; u++) {
+ if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) {
skip = addr - cur;
break;
- }
+ } /* end if */
cur += efl->slot[u].size;
- }
+ } /* end for */
/* Write the data */
- while (size) {
- assert(buf);
- if (u>=efl->nused)
- HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file")
- if (H5F_OVERFLOW_HSIZET2OFFT (efl->slot[u].offset+skip))
- HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed")
- if ((fd=HDopen (efl->slot[u].name, O_CREAT|O_RDWR, 0666))<0) {
- if (HDaccess (efl->slot[u].name, F_OK)<0) {
- HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist")
- } else {
- HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file")
- }
- }
- if (HDlseek (fd, (off_t)(efl->slot[u].offset+skip), SEEK_SET)<0)
- HGOTO_ERROR (H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file")
+ while(size) {
+ HDassert(buf);
+ if(u >= efl->nused)
+ HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file")
+ if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip))
+ HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed")
+ if((fd = HDopen(efl->slot[u].name, O_CREAT|O_RDWR, 0666)) < 0) {
+ if(HDaccess(efl->slot[u].name, F_OK) < 0)
+ HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist")
+ else
+ HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file")
+ } /* end if */
+ if(HDlseek(fd, (off_t)(efl->slot[u].offset + skip), SEEK_SET) < 0)
+ HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file")
#ifndef NDEBUG
- tempto_write = MIN(efl->slot[u].size-skip,(hsize_t)size);
- H5_CHECK_OVERFLOW(tempto_write,hsize_t,size_t);
+ tempto_write = MIN(efl->slot[u].size - skip, (hsize_t)size);
+ H5_CHECK_OVERFLOW(tempto_write, hsize_t, size_t);
to_write = (size_t)tempto_write;
#else /* NDEBUG */
- to_write = MIN((size_t)(efl->slot[u].size-skip), size);
+ to_write = MIN((size_t)(efl->slot[u].size - skip), size);
#endif /* NDEBUG */
- if ((size_t)HDwrite (fd, buf, to_write)!=to_write)
- HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file")
+ if((size_t)HDwrite(fd, buf, to_write)!=to_write)
+ HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file")
HDclose (fd);
fd = -1;
size -= to_write;
buf += to_write;
skip = 0;
u++;
- }
+ } /* end while */
done:
- if (fd>=0)
- HDclose (fd);
+ if(fd >= 0)
+ HDclose(fd);
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5D_efl_write() */
/*-------------------------------------------------------------------------
diff --git a/src/H5F.c b/src/H5F.c
index 52b4113..6fa33aa 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1852,9 +1852,9 @@ H5F_try_close(H5F_t *f)
/* Forced close of all opened objects in this file */
if(f->nopen_objs > 0) {
- unsigned obj_count; /* # of open objects */
+ size_t obj_count; /* # of open objects */
hid_t objs[128]; /* Array of objects to close */
- unsigned u; /* Local index variable */
+ size_t u; /* Local index variable */
/* Get the list of IDs of open dataset, group, & attribute objects */
while((obj_count = H5F_get_obj_ids(f, H5F_OBJ_LOCAL|H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_ATTR, (int)(sizeof(objs)/sizeof(objs[0])), objs, FALSE)) != 0) {
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 7698654..f6aa1ac 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -459,7 +459,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id)
sblock->super_vers = super_vers;
/* Compute the size of the superblock */
- superblock_size = (size_t)H5F_SUPERBLOCK_SIZE(super_vers, f);
+ superblock_size = (hsize_t)H5F_SUPERBLOCK_SIZE(super_vers, f);
/* Compute the size of the driver information block */
H5_ASSIGN_OVERFLOW(driver_size, H5FD_sb_size(f->shared->lf), hsize_t, size_t);
@@ -723,7 +723,7 @@ H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_
/* Set the superblock size */
if(super_size)
- *super_size = (size_t)H5F_SUPERBLOCK_SIZE(f->shared->sblock->super_vers, f);
+ *super_size = (hsize_t)H5F_SUPERBLOCK_SIZE(f->shared->sblock->super_vers, f);
/* Set the superblock extension size */
if(super_ext_size) {
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index d58d1b5..f5e5a75 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -763,7 +763,7 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr,
} /* end else */
/* Retrieve the total size of the superblock info */
- H5_ASSIGN_OVERFLOW(superblock_size, (p - buf), int, size_t);
+ H5_ASSIGN_OVERFLOW(superblock_size, (p - buf), ptrdiff_t, size_t);
/* Double check we didn't overrun the block (unlikely) */
HDassert(superblock_size <= sizeof(buf));
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 90d1361..ef072de 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -548,6 +548,9 @@
/* The size of `off_t', as computed by sizeof. */
#undef SIZEOF_OFF_T
+/* The size of `ptrdiff_t', as computed by sizeof. */
+#undef SIZEOF_PTRDIFF_T
+
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT
@@ -676,6 +679,9 @@
/* Define to `long int' if <sys/types.h> does not define. */
#undef off_t
+/* Define to `long' if <sys/types.h> does not define. */
+#undef ptrdiff_t
+
/* Define to `unsigned long' if <sys/types.h> does not define. */
#undef size_t
diff --git a/src/H5overflow.h b/src/H5overflow.h
index b3b343e..f4064f4 100644
--- a/src/H5overflow.h
+++ b/src/H5overflow.h
@@ -87,6 +87,18 @@
ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
#endif /* src: unsigned dst: uint64_t */
+/* src: unsigned, dst: ptrdiff_t */
+#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_unsigned_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_unsigned_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_PTRDIFF_T */
+ #define ASSIGN_unsigned_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#endif /* src: unsigned dst: ptrdiff_t */
+
/* src: unsigned, dst: size_t */
#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_SIZE_T
#define ASSIGN_unsigned_TO_size_t(dst, dsttype, src, srctype) \
@@ -222,6 +234,18 @@
ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
#endif /* src: int dst: uint64_t */
+/* src: int, dst: ptrdiff_t */
+#if H5_SIZEOF_INT < H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_int_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_INT > H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_int_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_INT == H5_SIZEOF_PTRDIFF_T */
+ #define ASSIGN_int_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
+#endif /* src: int dst: ptrdiff_t */
+
/* src: int, dst: size_t */
#if H5_SIZEOF_INT < H5_SIZEOF_SIZE_T
#define ASSIGN_int_TO_size_t(dst, dsttype, src, srctype) \
@@ -357,6 +381,18 @@
ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
#endif /* src: uint8_t dst: uint64_t */
+/* src: uint8_t, dst: ptrdiff_t */
+#if H5_SIZEOF_UINT8_T < H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_uint8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_uint8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_PTRDIFF_T */
+ #define ASSIGN_uint8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#endif /* src: uint8_t dst: ptrdiff_t */
+
/* src: uint8_t, dst: size_t */
#if H5_SIZEOF_UINT8_T < H5_SIZEOF_SIZE_T
#define ASSIGN_uint8_t_TO_size_t(dst, dsttype, src, srctype) \
@@ -492,6 +528,18 @@
ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
#endif /* src: uint16_t dst: uint64_t */
+/* src: uint16_t, dst: ptrdiff_t */
+#if H5_SIZEOF_UINT16_T < H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_uint16_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_UINT16_T > H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_uint16_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_PTRDIFF_T */
+ #define ASSIGN_uint16_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#endif /* src: uint16_t dst: ptrdiff_t */
+
/* src: uint16_t, dst: size_t */
#if H5_SIZEOF_UINT16_T < H5_SIZEOF_SIZE_T
#define ASSIGN_uint16_t_TO_size_t(dst, dsttype, src, srctype) \
@@ -627,6 +675,18 @@
ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
#endif /* src: uint32_t dst: uint64_t */
+/* src: uint32_t, dst: ptrdiff_t */
+#if H5_SIZEOF_UINT32_T < H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_uint32_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_uint32_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_PTRDIFF_T */
+ #define ASSIGN_uint32_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#endif /* src: uint32_t dst: ptrdiff_t */
+
/* src: uint32_t, dst: size_t */
#if H5_SIZEOF_UINT32_T < H5_SIZEOF_SIZE_T
#define ASSIGN_uint32_t_TO_size_t(dst, dsttype, src, srctype) \
@@ -762,6 +822,18 @@
ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
#endif /* src: uint64_t dst: uint32_t */
+/* src: uint64_t, dst: ptrdiff_t */
+#if H5_SIZEOF_UINT64_T < H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_uint64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_uint64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_PTRDIFF_T */
+ #define ASSIGN_uint64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#endif /* src: uint64_t dst: ptrdiff_t */
+
/* src: uint64_t, dst: size_t */
#if H5_SIZEOF_UINT64_T < H5_SIZEOF_SIZE_T
#define ASSIGN_uint64_t_TO_size_t(dst, dsttype, src, srctype) \
@@ -835,6 +907,153 @@
#endif /* src: uint64_t dst: h5_stat_size_t */
+/* Assignment checks for ptrdiff_t */
+
+/* src: ptrdiff_t, dst: unsigned */
+#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_UNSIGNED
+ #define ASSIGN_ptrdiff_t_TO_unsigned(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_UNSIGNED
+ #define ASSIGN_ptrdiff_t_TO_unsigned(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_UNSIGNED */
+ #define ASSIGN_ptrdiff_t_TO_unsigned(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#endif /* src: ptrdiff_t dst: unsigned */
+
+/* src: ptrdiff_t, dst: int */
+#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_INT
+ #define ASSIGN_ptrdiff_t_TO_int(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_INT
+ #define ASSIGN_ptrdiff_t_TO_int(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_INT */
+ #define ASSIGN_ptrdiff_t_TO_int(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
+#endif /* src: ptrdiff_t dst: int */
+
+/* src: ptrdiff_t, dst: uint8_t */
+#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_UINT8_T
+ #define ASSIGN_ptrdiff_t_TO_uint8_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_UINT8_T
+ #define ASSIGN_ptrdiff_t_TO_uint8_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_UINT8_T */
+ #define ASSIGN_ptrdiff_t_TO_uint8_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#endif /* src: ptrdiff_t dst: uint8_t */
+
+/* src: ptrdiff_t, dst: uint16_t */
+#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_UINT16_T
+ #define ASSIGN_ptrdiff_t_TO_uint16_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_UINT16_T
+ #define ASSIGN_ptrdiff_t_TO_uint16_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_UINT16_T */
+ #define ASSIGN_ptrdiff_t_TO_uint16_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#endif /* src: ptrdiff_t dst: uint16_t */
+
+/* src: ptrdiff_t, dst: uint32_t */
+#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_UINT32_T
+ #define ASSIGN_ptrdiff_t_TO_uint32_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_UINT32_T
+ #define ASSIGN_ptrdiff_t_TO_uint32_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_UINT32_T */
+ #define ASSIGN_ptrdiff_t_TO_uint32_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#endif /* src: ptrdiff_t dst: uint32_t */
+
+/* src: ptrdiff_t, dst: uint64_t */
+#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_UINT64_T
+ #define ASSIGN_ptrdiff_t_TO_uint64_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_UINT64_T
+ #define ASSIGN_ptrdiff_t_TO_uint64_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_UINT64_T */
+ #define ASSIGN_ptrdiff_t_TO_uint64_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#endif /* src: ptrdiff_t dst: uint64_t */
+
+/* src: ptrdiff_t, dst: size_t */
+#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_SIZE_T
+ #define ASSIGN_ptrdiff_t_TO_size_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_SIZE_T
+ #define ASSIGN_ptrdiff_t_TO_size_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_SIZE_T */
+ #define ASSIGN_ptrdiff_t_TO_size_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#endif /* src: ptrdiff_t dst: size_t */
+
+/* src: ptrdiff_t, dst: ssize_t */
+#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_SSIZE_T
+ #define ASSIGN_ptrdiff_t_TO_ssize_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_SSIZE_T
+ #define ASSIGN_ptrdiff_t_TO_ssize_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_SSIZE_T */
+ #define ASSIGN_ptrdiff_t_TO_ssize_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
+#endif /* src: ptrdiff_t dst: ssize_t */
+
+/* src: ptrdiff_t, dst: haddr_t */
+#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_HADDR_T
+ #define ASSIGN_ptrdiff_t_TO_haddr_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_HADDR_T
+ #define ASSIGN_ptrdiff_t_TO_haddr_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_HADDR_T */
+ #define ASSIGN_ptrdiff_t_TO_haddr_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#endif /* src: ptrdiff_t dst: haddr_t */
+
+/* src: ptrdiff_t, dst: hsize_t */
+#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_HSIZE_T
+ #define ASSIGN_ptrdiff_t_TO_hsize_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_HSIZE_T
+ #define ASSIGN_ptrdiff_t_TO_hsize_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_HSIZE_T */
+ #define ASSIGN_ptrdiff_t_TO_hsize_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#endif /* src: ptrdiff_t dst: hsize_t */
+
+/* src: ptrdiff_t, dst: hssize_t */
+#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_HSSIZE_T
+ #define ASSIGN_ptrdiff_t_TO_hssize_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_HSSIZE_T
+ #define ASSIGN_ptrdiff_t_TO_hssize_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_HSSIZE_T */
+ #define ASSIGN_ptrdiff_t_TO_hssize_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
+#endif /* src: ptrdiff_t dst: hssize_t */
+
+/* src: ptrdiff_t, dst: h5_stat_size_t */
+#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_H5_STAT_SIZE_T
+ #define ASSIGN_ptrdiff_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_H5_STAT_SIZE_T
+ #define ASSIGN_ptrdiff_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_H5_STAT_SIZE_T */
+ #define ASSIGN_ptrdiff_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
+#endif /* src: ptrdiff_t dst: h5_stat_size_t */
+
+
/* Assignment checks for size_t */
/* src: size_t, dst: unsigned */
@@ -909,6 +1128,18 @@
ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
#endif /* src: size_t dst: uint64_t */
+/* src: size_t, dst: ptrdiff_t */
+#if H5_SIZEOF_SIZE_T < H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_PTRDIFF_T */
+ #define ASSIGN_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#endif /* src: size_t dst: ptrdiff_t */
+
/* src: size_t, dst: ssize_t */
#if H5_SIZEOF_SIZE_T < H5_SIZEOF_SSIZE_T
#define ASSIGN_size_t_TO_ssize_t(dst, dsttype, src, srctype) \
@@ -1044,6 +1275,18 @@
ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
#endif /* src: ssize_t dst: uint64_t */
+/* src: ssize_t, dst: ptrdiff_t */
+#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_ssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_ssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_PTRDIFF_T */
+ #define ASSIGN_ssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
+#endif /* src: ssize_t dst: ptrdiff_t */
+
/* src: ssize_t, dst: size_t */
#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_SIZE_T
#define ASSIGN_ssize_t_TO_size_t(dst, dsttype, src, srctype) \
@@ -1179,6 +1422,18 @@
ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
#endif /* src: haddr_t dst: uint64_t */
+/* src: haddr_t, dst: ptrdiff_t */
+#if H5_SIZEOF_HADDR_T < H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_haddr_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_haddr_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_PTRDIFF_T */
+ #define ASSIGN_haddr_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#endif /* src: haddr_t dst: ptrdiff_t */
+
/* src: haddr_t, dst: size_t */
#if H5_SIZEOF_HADDR_T < H5_SIZEOF_SIZE_T
#define ASSIGN_haddr_t_TO_size_t(dst, dsttype, src, srctype) \
@@ -1314,6 +1569,18 @@
ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
#endif /* src: hsize_t dst: uint64_t */
+/* src: hsize_t, dst: ptrdiff_t */
+#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_hsize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_hsize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_PTRDIFF_T */
+ #define ASSIGN_hsize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#endif /* src: hsize_t dst: ptrdiff_t */
+
/* src: hsize_t, dst: size_t */
#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_SIZE_T
#define ASSIGN_hsize_t_TO_size_t(dst, dsttype, src, srctype) \
@@ -1449,6 +1716,18 @@
ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)
#endif /* src: hssize_t dst: uint64_t */
+/* src: hssize_t, dst: ptrdiff_t */
+#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_hssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_hssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_PTRDIFF_T */
+ #define ASSIGN_hssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
+#endif /* src: hssize_t dst: ptrdiff_t */
+
/* src: hssize_t, dst: size_t */
#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_SIZE_T
#define ASSIGN_hssize_t_TO_size_t(dst, dsttype, src, srctype) \
@@ -1584,6 +1863,18 @@
ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)
#endif /* src: h5_stat_size_t dst: uint64_t */
+/* src: h5_stat_size_t, dst: ptrdiff_t */
+#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_h5_stat_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_PTRDIFF_T
+ #define ASSIGN_h5_stat_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)
+#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_PTRDIFF_T */
+ #define ASSIGN_h5_stat_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \
+ ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)
+#endif /* src: h5_stat_size_t dst: ptrdiff_t */
+
/* src: h5_stat_size_t, dst: size_t */
#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_SIZE_T
#define ASSIGN_h5_stat_size_t_TO_size_t(dst, dsttype, src, srctype) \
diff --git a/src/H5overflow.txt b/src/H5overflow.txt
index c8c1996..c093fd5 100644
--- a/src/H5overflow.txt
+++ b/src/H5overflow.txt
@@ -36,6 +36,7 @@ uint8_t, UNSIGNED;
uint16_t, UNSIGNED;
uint32_t, UNSIGNED;
uint64_t, UNSIGNED;
+ptrdiff_t, SIGNED;
size_t, UNSIGNED;
ssize_t, SIGNED;
haddr_t, UNSIGNED;