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:
H. Joe Lee
2026-06-01 06:49:14 -05:00
committed by GitHub
parent 8a2fb792ef
commit 322d9366d8
+3 -1
View File
@@ -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;