From 97976066aa8e109da41a6f9f455dc3eb57696939 Mon Sep 17 00:00:00 2001 From: "ddkilzer@apple.com" Date: Mon, 22 Apr 2013 19:13:30 +0000 Subject: [PATCH] StringImpl.h should compile with -Wshorten-64-to-32 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(this); ~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): Add static_cast() to formalize taking the lower 32-bits of the pointer value on 64-bit architectures. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@148900 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WTF/ChangeLog | 18 ++++++++++++++++++ Source/WTF/wtf/text/StringImpl.h | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index b798b6403c6b..fc4629eeb7cb 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,21 @@ +2013-04-22 David Kilzer + + StringImpl.h should compile with -Wshorten-64-to-32 + + + 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(this); + ~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + * wtf/text/StringImpl.h: + (WTF::StringImpl::StringImpl): Add static_cast() to + formalize taking the lower 32-bits of the pointer value on + 64-bit architectures. + 2013-04-22 Andreas Kling Shrink baseline size of WTF::Vector on 64-bit by switching to unsigned capacity and size. diff --git a/Source/WTF/wtf/text/StringImpl.h b/Source/WTF/wtf/text/StringImpl.h index 1869d6c6cd96..0d9db48b150c 100644 --- a/Source/WTF/wtf/text/StringImpl.h +++ b/Source/WTF/wtf/text/StringImpl.h @@ -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(this); + unsigned hash = static_cast(reinterpret_cast(this)); hash <<= s_flagCount; if (!hash) hash = 1 << s_flagCount; -- 2.36.0