Commit c15b1e79 authored by ddkilzer@apple.com's avatar ddkilzer@apple.com

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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8c24be5f
2013-04-22 David Kilzer <ddkilzer@apple.com>
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 <akling@apple.com>
Shrink baseline size of WTF::Vector on 64-bit by switching to unsigned capacity and size.
......
......@@ -313,7 +313,7 @@ private:
// 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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment