GraphicsMagick: PNMReadThreads(): Fix compiler warning regarding...
GraphicsMagick Commits <[email protected]> Fri, 15 Sep 2023 10:23:31 -0500
| Newsgroups | gmane.comp.video.graphicsmagick.cvs |
|---|---|
| Message-ID | <mailman.860.1694791418.7975.graphicsmagick-commit@lists.sourceforge.net> |
changeset 85068dab75e9 in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=85068dab75e9 summary: PNMReadThreads(): Fix compiler warning regarding overflow diffstat: ChangeLog | 3 +++ coders/pnm.c | 6 +++--- www/Changelog.html | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diffs (43 lines): diff -r f40fc1e9b251 -r 85068dab75e9 ChangeLog --- a/ChangeLog Fri Sep 15 09:59:28 2023 -0500 +++ b/ChangeLog Fri Sep 15 10:23:27 2023 -0500 @@ -1,5 +1,8 @@ 2023-09-15 Bob Friesenhahn <[email protected]> + * coders/pnm.c (PNMReadThreads): Fix compiler warning regarding + overflow. + * coders/sun.c (WriteSUNImage): Test for sun_info.length overflow in a way which should not provoke a compiler warning. diff -r f40fc1e9b251 -r 85068dab75e9 coders/pnm.c --- a/coders/pnm.c Fri Sep 15 09:59:28 2023 -0500 +++ b/coders/pnm.c Fri Sep 15 10:23:27 2023 -0500 @@ -310,12 +310,12 @@ static int PNMReadThreads(const Image* image, const size_t bytes_per_row) { const int omp_max_threads = omp_get_max_threads(); - long threads; + int threads; ARG_NOT_USED(image); - threads=(Min(bytes_per_row/4096UL,(unsigned long) omp_max_threads)); + threads=(int)(Min(bytes_per_row/4096U,(size_t) Max(0,omp_max_threads))); if (0 == threads) threads=1; - return (int) threads; + return threads; } #endif /* defined(HAVE_OPENMP) */ diff -r f40fc1e9b251 -r 85068dab75e9 www/Changelog.html --- a/www/Changelog.html Fri Sep 15 09:59:28 2023 -0500 +++ b/www/Changelog.html Fri Sep 15 10:23:27 2023 -0500 @@ -40,6 +40,8 @@ <p>2023-09-15 Bob Friesenhahn <<a class="reference external" href="mailto:bfriesen%40simple.dallas.tx.us">bfriesen<span>@</span>simple<span>.</span>dallas<span>.</span>tx<span>.</span>us</a>></p> <blockquote> <ul class="simple"> +<li><p>coders/pnm.c (PNMReadThreads): Fix compiler warning regarding +overflow.</p></li> <li><p>coders/sun.c (WriteSUNImage): Test for sun_info.length overflow in a way which should not provoke a compiler warning.</p></li> </ul>