mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
fix(H5Zdeflate): suppress C4267 warning by casting nbytes to uLong for compressBound (#6411)
On MSVC ARM64, size_t is 64-bit while zlib's uLong is 32-bit, causing C4267 (conversion from 'size_t' to 'uLong', possible loss of data).
This commit is contained in:
+3
-1
@@ -176,7 +176,9 @@ H5Z__filter_deflate(unsigned flags, size_t cd_nelmts, const unsigned cd_values[]
|
||||
size_t z_dst_buf_size = zng_compressBound(nbytes); /* 5730 */
|
||||
size_t z_dst_nbytes = z_dst_buf_size;
|
||||
#else
|
||||
uLongf z_dst_buf_size = (uLongf)compressBound(nbytes);
|
||||
if ((size_t)(uLong)nbytes != nbytes)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "nbytes too large to cast to uLong for zlib compression");
|
||||
uLongf z_dst_buf_size = (uLongf)compressBound((uLong)nbytes);
|
||||
uLongf z_dst_nbytes = z_dst_buf_size;
|
||||
#endif
|
||||
uLong z_src_nbytes = (uLong)nbytes;
|
||||
|
||||
Reference in New Issue
Block a user