Title: [148979] trunk/Source/WTF
Revision
148979
Author
[email protected]
Date
2013-04-23 12:15:35 -0700 (Tue, 23 Apr 2013)

Log Message

RetainPtr.h should compile with -Wshorten-64-to-32
<http://webkit.org/b/115047>

Reviewed by Anders Carlsson.

Fixes the following warning:

    RetainPtr.h:318:20: error: implicit conversion loses integer precision: 'CFHashCode' (aka 'unsigned long') to 'unsigned int' [-Werror,-Wshorten-64-to-32]
                return CFHash(o.get());
                ~~~~~~ ^~~~~~~~~~~~~~~

* wtf/RetainPtr.h:
(WTF::RetainPtrObjectHash::hash): Cast return value of CFHash()
to unsigned.  This has no effect on 32-bit architectures, but
takes the lower 32-bits of the CFHashCode (unsigned long) on
64-bit architectures, which is what happens implicitly now.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (148978 => 148979)


--- trunk/Source/WTF/ChangeLog	2013-04-23 19:12:31 UTC (rev 148978)
+++ trunk/Source/WTF/ChangeLog	2013-04-23 19:15:35 UTC (rev 148979)
@@ -1,3 +1,22 @@
+2013-04-23  David Kilzer  <[email protected]>
+
+        RetainPtr.h should compile with -Wshorten-64-to-32
+        <http://webkit.org/b/115047>
+
+        Reviewed by Anders Carlsson.
+
+        Fixes the following warning:
+
+            RetainPtr.h:318:20: error: implicit conversion loses integer precision: 'CFHashCode' (aka 'unsigned long') to 'unsigned int' [-Werror,-Wshorten-64-to-32]
+                        return CFHash(o.get());
+                        ~~~~~~ ^~~~~~~~~~~~~~~
+
+        * wtf/RetainPtr.h:
+        (WTF::RetainPtrObjectHash::hash): Cast return value of CFHash()
+        to unsigned.  This has no effect on 32-bit architectures, but
+        takes the lower 32-bits of the CFHashCode (unsigned long) on
+        64-bit architectures, which is what happens implicitly now.
+
 2013-04-22  Patrick Gansterer  <[email protected]>
 
         [CMake] Move NullPtr.cpp from PlatformWinCE.cmake to CMakeLists.txt

Modified: trunk/Source/WTF/wtf/RetainPtr.h (148978 => 148979)


--- trunk/Source/WTF/wtf/RetainPtr.h	2013-04-23 19:12:31 UTC (rev 148978)
+++ trunk/Source/WTF/wtf/RetainPtr.h	2013-04-23 19:15:35 UTC (rev 148979)
@@ -315,7 +315,7 @@
         static unsigned hash(const RetainPtr<P>& o)
         {
             ASSERT_WITH_MESSAGE(o.get(), "attempt to use null RetainPtr in HashTable");
-            return CFHash(o.get());
+            return static_cast<unsigned>(CFHash(o.get()));
         }
         static bool equal(const RetainPtr<P>& a, const RetainPtr<P>& b)
         {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to