Changeset 148900 in webkit


Ignore:
Timestamp:
Apr 22, 2013 12:13:30 PM (11 years ago)
Author:
ddkilzer@apple.com
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.

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r148891 r148900  
     12013-04-22  David Kilzer  <ddkilzer@apple.com>
     2
     3        StringImpl.h should compile with -Wshorten-64-to-32
     4        <http://webkit.org/b/114970>
     5
     6        Reviewed by Darin Adler.
     7
     8        Fixes the following warnings with -Wshorten-64-to-32:
     9
     10            StringImpl.h:317:25: error: implicit conversion loses integer precision: 'uintptr_t' (aka 'unsigned long') to 'unsigned int' [-Werror,-Wshorten-64-to-32]
     11                    unsigned hash = reinterpret_cast<uintptr_t>(this);
     12                             ~~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     13
     14        * wtf/text/StringImpl.h:
     15        (WTF::StringImpl::StringImpl): Add static_cast<uint32_t>() to
     16        formalize taking the lower 32-bits of the pointer value on
     17        64-bit architectures.
     18
    1192013-04-22  Andreas Kling  <akling@apple.com>
    220
  • trunk/Source/WTF/wtf/text/StringImpl.h

    r148857 r148900  
    314314        // that's exactly the oposite of what we want!), and teh normal hash would
    315315        // lead to lots of conflicts.
    316         unsigned hash = reinterpret_cast<uintptr_t>(this);
     316        unsigned hash = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(this));
    317317        hash <<= s_flagCount;
    318318        if (!hash)
Note: See TracChangeset for help on using the changeset viewer.