Bug 33575

Summary: [Gtk] Compiler warning: comparisons like 'X<=Y<=Z' do not have their mathematical meaning
Product: WebKit Reporter: Magnus Boman <captain.magnus>
Component: WebKitGTKAssignee: Philippe Normand <pnormand>
Status: RESOLVED FIXED    
Severity: Normal CC: eric, pnormand, xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
fix compiler warnings xan.lopez: review+

Description Magnus Boman 2010-01-12 22:11:34 PST
Compiler complains about "comparisons like 'X<=Y<=Z' do not have their mathematical meaning" in WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp

Here's a patch. Not sure if I got it right though :-)


Index: WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
===================================================================
--- WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp.orig  2010-01-05 08:53:00.000000000 +1100
+++ WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp       2010-01-13 16:59:29.000000000 +1100
@@ -852,11 +852,11 @@ static HashSet<String> mimeTypeCache()
                         if (G_VALUE_TYPE(layer) == GST_TYPE_INT_RANGE) {
                             gint minLayer = gst_value_get_int_range_min(layer);
                             gint maxLayer = gst_value_get_int_range_max(layer);
-                            if (minLayer <= 1 <= maxLayer)
+                            if (minLayer <= 1 && 1 <= maxLayer)
                                 cache.add(String("audio/mp1"));
-                            if (minLayer <= 2 <= maxLayer)
+                            if (minLayer <= 2 && 2 <= maxLayer)
                                 cache.add(String("audio/mp2"));
-                            if (minLayer <= 3 <= maxLayer)
+                            if (minLayer <= 3 && 3 <= maxLayer)
                                 cache.add(String("audio/mp3"));
                         }
                     }
Comment 1 Alexey Proskuryakov 2010-01-13 13:01:20 PST
That's clearly a bug. Would you be willing to submit a patch for review, as described in <http://webkit.org/coding/contributing.html>?
Comment 2 Philippe Normand 2010-01-14 04:57:07 PST
Thanks Magnus for spotting this, it is my mistake :( I will try your patch and attach it here if you don't mind
Comment 3 Philippe Normand 2010-01-14 05:13:02 PST
Created attachment 46556 [details]
fix compiler warnings
Comment 4 Xan Lopez 2010-01-14 05:27:41 PST
Comment on attachment 46556 [details]
fix compiler warnings

LGTM.
Comment 5 Magnus Boman 2010-01-14 10:08:02 PST
(In reply to comment #2)
> Thanks Magnus for spotting this, it is my mistake :( I will try your patch and
> attach it here if you don't mind

Philippe,
I don't mind. Just wasn't sure that the logic was according to my patch.
Comment 6 Eric Seidel (no email) 2010-01-14 12:54:31 PST
Attachment 46556 [details] was posted by a committer and has review+, assigning to Philippe Normand for commit.
Comment 7 Philippe Normand 2010-01-15 03:55:17 PST
Landed as r53329. Thanks!