Title: [129523] trunk/Source/WebCore
Revision
129523
Author
h...@chromium.org
Date
2012-09-25 10:12:02 -0700 (Tue, 25 Sep 2012)

Log Message

GIFImageReader: fix tautological compare
https://bugs.webkit.org/show_bug.cgi?id=97563

Reviewed by Adam Barth.

The frame_reader->disposal_method field is of type
ImageFrame::FrameDisposalMethod, which has a range of 0--3. Therefore,
recent versions of Clang concludes that the _expression_
frame_reader->disposal_method == 4
will never be true, and warns about it.

This patch fixes the code by doing the comparison before storing the
value in the enum.

No new functionality, no new tests.

* platform/image-decoders/gif/GIFImageReader.cpp:
(GIFImageReader::read):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (129522 => 129523)


--- trunk/Source/WebCore/ChangeLog	2012-09-25 17:10:32 UTC (rev 129522)
+++ trunk/Source/WebCore/ChangeLog	2012-09-25 17:12:02 UTC (rev 129523)
@@ -1,3 +1,24 @@
+2012-09-25  Hans Wennborg  <h...@chromium.org>
+
+        GIFImageReader: fix tautological compare
+        https://bugs.webkit.org/show_bug.cgi?id=97563
+
+        Reviewed by Adam Barth.
+
+        The frame_reader->disposal_method field is of type
+        ImageFrame::FrameDisposalMethod, which has a range of 0--3. Therefore,
+        recent versions of Clang concludes that the _expression_
+        frame_reader->disposal_method == 4
+        will never be true, and warns about it.
+
+        This patch fixes the code by doing the comparison before storing the
+        value in the enum.
+
+        No new functionality, no new tests.
+
+        * platform/image-decoders/gif/GIFImageReader.cpp:
+        (GIFImageReader::read):
+
 2012-09-25  Tommy Widenflycht  <tom...@google.com>
 
         MediaStream API: Update getUserMedia to match the latest specification

Modified: trunk/Source/WebCore/platform/image-decoders/gif/GIFImageReader.cpp (129522 => 129523)


--- trunk/Source/WebCore/platform/image-decoders/gif/GIFImageReader.cpp	2012-09-25 17:10:32 UTC (rev 129522)
+++ trunk/Source/WebCore/platform/image-decoders/gif/GIFImageReader.cpp	2012-09-25 17:12:02 UTC (rev 129523)
@@ -656,10 +656,11 @@
         }
         // NOTE: This relies on the values in the FrameDisposalMethod enum
         // matching those in the GIF spec!
-        frame_reader->disposal_method = (WebCore::ImageFrame::FrameDisposalMethod)(((*q) >> 2) & 0x7);
+        int disposal_method = ((*q) >> 2) & 0x7;
+        frame_reader->disposal_method = (WebCore::ImageFrame::FrameDisposalMethod)disposal_method;
         // Some specs say 3rd bit (value 4), other specs say value 3
         // Let's choose 3 (the more popular)
-        if (frame_reader->disposal_method == 4)
+        if (disposal_method == 4)
           frame_reader->disposal_method = WebCore::ImageFrame::DisposeOverwritePrevious;
         frame_reader->delay_time = GETINT16(q + 1) * 10;
       }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to