Changeset 64302 in webkit for trunk/JavaScriptCore/wtf/MD5.cpp


Ignore:
Timestamp:
Jul 29, 2010, 12:52:22 PM (15 years ago)
Author:
Csaba Osztrogonác
Message:

2010-07-29 Gabor Loki <[email protected]>

Reviewed by Gavin Barraclough.

Avoid increasing required alignment of target type warning on ARM
https://bugs.webkit.org/show_bug.cgi?id=38045

The reinterpret_cast<Type1*>([pointer to Type2]) expressions - where
sizeof(Type1) > sizeof(Type2) - cause the following warning on ARM:
increases required alignment of target type warnings.
Casting the type of [pointer to Type2] object to void* bypasses the
warning.

  • assembler/ARMAssembler.cpp: (JSC::ARMAssembler::executableCopy):
  • assembler/AssemblerBuffer.h: (JSC::AssemblerBuffer::putShortUnchecked): (JSC::AssemblerBuffer::putIntUnchecked): (JSC::AssemblerBuffer::putInt64Unchecked):
  • jit/JITStubs.cpp:
  • pcre/pcre_compile.cpp: (jsRegExpCompile):
  • wtf/FastMalloc.cpp: (WTF::PageHeapAllocator::New): (WTF::TCMalloc_Central_FreeList::Populate):
  • wtf/MD5.cpp: (WTF::reverseBytes): (WTF::MD5::addBytes): (WTF::MD5::checksum):
  • wtf/StdLibExtras.h: (reinterpret_cast_ptr):
  • wtf/Vector.h: (WTF::VectorBuffer::inlineBuffer):
  • wtf/qt/StringQt.cpp: (WebCore::String::String):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/MD5.cpp

    r59067 r64302  
    5555#include "text/CString.h"
    5656#endif
     57#include <wtf/StdLibExtras.h>
    5758
    5859namespace WTF {
     
    104105        uint32_t t = static_cast<uint32_t>(buf[3] << 8 | buf[2]) << 16 | buf[1] << 8 | buf[0];
    105106        ASSERT_WITH_MESSAGE(!(reinterpret_cast<uintptr_t>(buf) % sizeof(t)), "alignment error of buf");
    106         *reinterpret_cast<uint32_t *>(buf) = t;
     107        *reinterpret_cast_ptr<uint32_t *>(buf) = t;
    107108        buf += 4;
    108109    } while (--longs);
     
    239240        memcpy(p, buf, t);
    240241        reverseBytes(m_in, 16);
    241         MD5Transform(m_buf, reinterpret_cast<uint32_t*>(m_in)); // m_in is 4-byte aligned.
     242        MD5Transform(m_buf, reinterpret_cast_ptr<uint32_t*>(m_in)); // m_in is 4-byte aligned.
    242243        buf += t;
    243244        length -= t;
     
    249250        memcpy(m_in, buf, 64);
    250251        reverseBytes(m_in, 16);
    251         MD5Transform(m_buf, reinterpret_cast<uint32_t*>(m_in)); // m_in is 4-byte aligned.
     252        MD5Transform(m_buf, reinterpret_cast_ptr<uint32_t*>(m_in)); // m_in is 4-byte aligned.
    252253        buf += 64;
    253254        length -= 64;
     
    276277        memset(p, 0, count);
    277278        reverseBytes(m_in, 16);
    278         MD5Transform(m_buf, reinterpret_cast<uint32_t *>(m_in)); // m_in is 4-byte aligned.
     279        MD5Transform(m_buf, reinterpret_cast_ptr<uint32_t *>(m_in)); // m_in is 4-byte aligned.
    279280
    280281        // Now fill the next block with 56 bytes
     
    288289    // Append length in bits and transform
    289290    // m_in is 4-byte aligned.
    290     (reinterpret_cast<uint32_t*>(m_in))[14] = m_bits[0];
    291     (reinterpret_cast<uint32_t*>(m_in))[15] = m_bits[1];
    292 
    293     MD5Transform(m_buf, reinterpret_cast<uint32_t*>(m_in));
     291    (reinterpret_cast_ptr<uint32_t*>(m_in))[14] = m_bits[0];
     292    (reinterpret_cast_ptr<uint32_t*>(m_in))[15] = m_bits[1];
     293
     294    MD5Transform(m_buf, reinterpret_cast_ptr<uint32_t*>(m_in));
    294295    reverseBytes(reinterpret_cast<uint8_t*>(m_buf), 4);
    295296
Note: See TracChangeset for help on using the changeset viewer.