GraphicsMagick: ReadBMPImage(): Fix GCC 13.1.0 warning about qua...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.7040.1691253778.8047.graphicsmagick-commit@lists.sourceforge.net>
changeset f16afdc154d1 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=f16afdc154d1
summary: ReadBMPImage(): Fix GCC 13.1.0 warning about quantum_bits being possibly used while uninitialized.

diffstat:

 ChangeLog          |  5 +++++
 coders/bmp.c       |  4 ++--
 www/Changelog.html |  4 ++++
 3 files changed, 11 insertions(+), 2 deletions(-)

diffs (49 lines):

diff -r d2658922fcc7 -r f16afdc154d1 ChangeLog
--- a/ChangeLog	Sat Aug 05 08:03:47 2023 -0500
+++ b/ChangeLog	Sat Aug 05 11:42:46 2023 -0500
@@ -1,5 +1,10 @@
 2023-08-05  Bob Friesenhahn  <[email protected]>
 
+	* coders/bmp.c (ReadBMPImage): Fix GCC 13.1.0 warning about
+	quantum_bits being possibly used while uninitialized.  I don't see
+	how that is possible based on current logic, but avoid the
+	warning.
+
 	* magick/gem.c (ExpandAffine): Mark as a pure function.
 
 2023-07-31  Bob Friesenhahn  <[email protected]>
diff -r d2658922fcc7 -r f16afdc154d1 coders/bmp.c
--- a/coders/bmp.c	Sat Aug 05 08:03:47 2023 -0500
+++ b/coders/bmp.c	Sat Aug 05 11:42:46 2023 -0500
@@ -1218,6 +1218,8 @@
     image->units=PixelsPerCentimeterResolution;
     image->x_resolution=bmp_info.x_pixels/100.0;
     image->y_resolution=bmp_info.y_pixels/100.0;
+    (void) memset(&quantum_bits,0,sizeof(PixelPacket));
+    (void) memset(&shift,0,sizeof(PixelPacket));
     /*
       Convert BMP raster image to pixel packets.
     */
@@ -1245,8 +1247,6 @@
         /*
           Get shift and quantum bits info from bitfield masks.
         */
-        (void) memset(&shift,0,sizeof(PixelPacket));
-        (void) memset(&quantum_bits,0,sizeof(PixelPacket));
         if (bmp_info.red_mask != 0U)
           while ((shift.red < 32U) && (((bmp_info.red_mask << shift.red) & 0x80000000U) == 0))
             shift.red++;
diff -r d2658922fcc7 -r f16afdc154d1 www/Changelog.html
--- a/www/Changelog.html	Sat Aug 05 08:03:47 2023 -0500
+++ b/www/Changelog.html	Sat Aug 05 11:42:46 2023 -0500
@@ -40,6 +40,10 @@
 <p>2023-08-05  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
 <blockquote>
 <ul class="simple">
+<li><p>coders/bmp.c (ReadBMPImage): Fix GCC 13.1.0 warning about
+quantum_bits being possibly used while uninitialized.  I don't see
+how that is possible based on current logic, but avoid the
+warning.</p></li>
 <li><p>magick/gem.c (ExpandAffine): Mark as a pure function.</p></li>
 </ul>
 </blockquote>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.