diff options
author | Brad King <brad.king@kitware.com> | 2023-05-22 14:01:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-05-22 20:51:16 (GMT) |
commit | bba02b8b4beda4abacd5d3aa74d2d5e2ac1d717b (patch) | |
tree | 33bd4e8fca631b45ef004f3b2b9dbba76d65fc97 /Utilities | |
parent | 395f0cb69c8db2b4a36dc40d9776df9bea5afdb1 (diff) | |
download | CMake-bba02b8b4beda4abacd5d3aa74d2d5e2ac1d717b.zip CMake-bba02b8b4beda4abacd5d3aa74d2d5e2ac1d717b.tar.gz CMake-bba02b8b4beda4abacd5d3aa74d2d5e2ac1d717b.tar.bz2 |
zlib: Suppress clang-analyzer warnings
Diffstat (limited to 'Utilities')
-rw-r--r-- | Utilities/cmzlib/gzread.c | 6 | ||||
-rw-r--r-- | Utilities/cmzlib/gzwrite.c | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/Utilities/cmzlib/gzread.c b/Utilities/cmzlib/gzread.c index 22052dd..e3519e6 100644 --- a/Utilities/cmzlib/gzread.c +++ b/Utilities/cmzlib/gzread.c @@ -434,6 +434,12 @@ z_size_t ZEXPORT gzfread(buf, size, nitems, file) return 0; } +#ifdef __clang_analyzer__ + /* clang-analyzer does not see size==0 through len==0 below. */ + if (!size) + return 0; +#endif + /* read len or fewer bytes to buf, return the number of full items read */ return len ? gz_read(state, buf, len) / size : 0; } diff --git a/Utilities/cmzlib/gzwrite.c b/Utilities/cmzlib/gzwrite.c index a8ffc8f..33f4949 100644 --- a/Utilities/cmzlib/gzwrite.c +++ b/Utilities/cmzlib/gzwrite.c @@ -305,6 +305,12 @@ z_size_t ZEXPORT gzfwrite(buf, size, nitems, file) return 0; } +#ifdef __clang_analyzer__ + /* clang-analyzer does not see size==0 through len==0 below. */ + if (!size) + return 0; +#endif + /* write len bytes to buf, return the number of full items written */ return len ? gz_write(state, buf, len) / size : 0; } |