Changeset 35177 in webkit


Ignore:
Timestamp:
Jul 14, 2008 7:17:56 PM (16 years ago)
Author:
mrowe@apple.com
Message:

Fix https://bugs.webkit.org/show_bug.cgi?id=20037
Bug 20037: GCC 4.2 build broken due to strict aliasing violation.

Reviewed by Sam Weinig.

  • kjs/ustring.cpp:

(KJS::UString::Rep::computeHash): Add a version of computeHash that takes a char* and explicit length.

  • kjs/ustring.h:
  • profiler/CallIdentifier.h:

(WTF::): Use new version of computeHash that takes a char* and explicit length to avoid unsafe aliasing.

Location:
trunk/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r35165 r35177  
     12008-07-14  Mark Rowe  <mrowe@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Fix https://bugs.webkit.org/show_bug.cgi?id=20037
     6        Bug 20037: GCC 4.2 build broken due to strict aliasing violation.
     7
     8        * kjs/ustring.cpp:
     9        (KJS::UString::Rep::computeHash): Add a version of computeHash that takes a char* and explicit length.
     10        * kjs/ustring.h:
     11        * profiler/CallIdentifier.h:
     12        (WTF::): Use new version of computeHash that takes a char* and explicit length to avoid unsafe aliasing.
     13
    1142008-07-14  David Hyatt  <hyatt@apple.com>
    215
  • trunk/JavaScriptCore/kjs/ustring.cpp

    r35027 r35177  
    314314// Paul Hsieh's SuperFastHash
    315315// http://www.azillionmonkeys.com/qed/hash.html
    316 unsigned UString::Rep::computeHash(const char* s)
     316unsigned UString::Rep::computeHash(const char* s, int l)
    317317{
    318318    // This hash is designed to work on 16-bit chunks at a time. But since the normal case
     
    322322    uint32_t hash = PHI;
    323323    uint32_t tmp;
    324     size_t l = strlen(s);
    325324
    326325    size_t rem = l & 1;
  • trunk/JavaScriptCore/kjs/ustring.h

    r35027 r35177  
    2525#include "collector.h"
    2626#include <stdint.h>
     27#include <string.h>
    2728#include <wtf/Assertions.h>
    2829#include <wtf/FastMalloc.h>
    2930#include <wtf/PassRefPtr.h>
    3031#include <wtf/RefPtr.h>
     32#include <wtf/Vector.h>
    3133#include <wtf/unicode/Unicode.h>
    32 #include <wtf/Vector.h>
    3334
    3435namespace KJS {
     
    9394
    9495            static unsigned computeHash(const UChar*, int length);
    95             static unsigned computeHash(const char*);
     96            static unsigned computeHash(const char*, int length);
     97            static unsigned computeHash(const char* s) { return computeHash(s, strlen(s)); }
    9698
    9799            Rep* ref() { ++rc; return this; }
  • trunk/JavaScriptCore/profiler/CallIdentifier.h

    r35096 r35177  
    7171                key.m_lineNumber
    7272            };
    73             return KJS::UString::Rep::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar));
     73            return KJS::UString::Rep::computeHash(reinterpret_cast<char*>(hashCodes), sizeof(hashCodes));
    7474        }
    7575
Note: See TracChangeset for help on using the changeset viewer.