Title: [148900] trunk/Source/WTF
Revision
148900
Author
[email protected]
Date
2013-04-22 12:13:30 -0700 (Mon, 22 Apr 2013)

Log Message

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

Reviewed by Darin Adler.

Fixes the following warnings with -Wshorten-64-to-32:

    StringImpl.h:317:25: error: implicit conversion loses integer precision: 'uintptr_t' (aka 'unsigned long') to 'unsigned int' [-Werror,-Wshorten-64-to-32]
            unsigned hash = reinterpret_cast<uintptr_t>(this);
                     ~~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* wtf/text/StringImpl.h:
(WTF::StringImpl::StringImpl): Add static_cast<uint32_t>() to
formalize taking the lower 32-bits of the pointer value on
64-bit architectures.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (148899 => 148900)


--- trunk/Source/WTF/ChangeLog	2013-04-22 18:40:58 UTC (rev 148899)
+++ trunk/Source/WTF/ChangeLog	2013-04-22 19:13:30 UTC (rev 148900)
@@ -1,3 +1,21 @@
+2013-04-22  David Kilzer  <[email protected]>
+
+        StringImpl.h should compile with -Wshorten-64-to-32
+        <http://webkit.org/b/114970>
+
+        Reviewed by Darin Adler.
+
+        Fixes the following warnings with -Wshorten-64-to-32:
+
+            StringImpl.h:317:25: error: implicit conversion loses integer precision: 'uintptr_t' (aka 'unsigned long') to 'unsigned int' [-Werror,-Wshorten-64-to-32]
+                    unsigned hash = reinterpret_cast<uintptr_t>(this);
+                             ~~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::StringImpl): Add static_cast<uint32_t>() to
+        formalize taking the lower 32-bits of the pointer value on
+        64-bit architectures.
+
 2013-04-22  Andreas Kling  <[email protected]>
 
         Shrink baseline size of WTF::Vector on 64-bit by switching to unsigned capacity and size.

Modified: trunk/Source/WTF/wtf/text/StringImpl.h (148899 => 148900)


--- trunk/Source/WTF/wtf/text/StringImpl.h	2013-04-22 18:40:58 UTC (rev 148899)
+++ trunk/Source/WTF/wtf/text/StringImpl.h	2013-04-22 19:13:30 UTC (rev 148900)
@@ -313,7 +313,7 @@
         // keys means that we don't need them to match any other string (in fact,
         // that's exactly the oposite of what we want!), and teh normal hash would
         // lead to lots of conflicts.
-        unsigned hash = reinterpret_cast<uintptr_t>(this);
+        unsigned hash = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(this));
         hash <<= s_flagCount;
         if (!hash)
             hash = 1 << s_flagCount;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to