Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (125134 => 125135)
--- trunk/Source/_javascript_Core/ChangeLog 2012-08-09 01:14:09 UTC (rev 125134)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-08-09 01:29:44 UTC (rev 125135)
@@ -1,3 +1,15 @@
+2012-08-08 Benjamin Poulain <[email protected]>
+
+ Use char* instead of LChar* for the public interface of String construction from literals
+ https://bugs.webkit.org/show_bug.cgi?id=93402
+
+ Reviewed by Michael Saboff.
+
+ Update JSC' Identifier to use StringImpl::createFromLiteral with a char*.
+
+ * runtime/Identifier.cpp:
+ (JSC::IdentifierASCIIStringTranslator::translate):
+
2012-08-08 Patrick Gansterer <[email protected]>
Remove ce_time.(cpp|h) from list of source files
Modified: trunk/Source/_javascript_Core/runtime/Identifier.cpp (125134 => 125135)
--- trunk/Source/_javascript_Core/runtime/Identifier.cpp 2012-08-09 01:14:09 UTC (rev 125134)
+++ trunk/Source/_javascript_Core/runtime/Identifier.cpp 2012-08-09 01:29:44 UTC (rev 125135)
@@ -60,7 +60,7 @@
static void translate(StringImpl*& location, const LChar* c, unsigned hash)
{
size_t length = strlen(reinterpret_cast<const char*>(c));
- location = StringImpl::createFromLiteral(c, length).leakRef();
+ location = StringImpl::createFromLiteral(reinterpret_cast<const char*>(c), length).leakRef();
location->setHash(hash);
}
};
Modified: trunk/Source/WTF/ChangeLog (125134 => 125135)
--- trunk/Source/WTF/ChangeLog 2012-08-09 01:14:09 UTC (rev 125134)
+++ trunk/Source/WTF/ChangeLog 2012-08-09 01:29:44 UTC (rev 125135)
@@ -1,3 +1,31 @@
+2012-08-08 Benjamin Poulain <[email protected]>
+
+ Use char* instead of LChar* for the public interface of String construction from literals
+ https://bugs.webkit.org/show_bug.cgi?id=93402
+
+ Reviewed by Michael Saboff.
+
+ When the initialization from literal was added, some constructor/initialization function were
+ using LChar for convenience.
+
+ Since those function should only take ASCII characters, using LChar* could cause confusion. This
+ patch intents to clarify this by using char* for all those APIs.
+
+ * wtf/text/AtomicString.cpp:
+ (WTF::CharBufferFromLiteralDataTranslator::hash):
+ (WTF::CharBufferFromLiteralDataTranslator::equal):
+ (WTF::CharBufferFromLiteralDataTranslator::translate):
+ (WTF::AtomicString::addFromLiteralData):
+ * wtf/text/AtomicString.h:
+ (WTF::AtomicString::AtomicString):
+ (AtomicString):
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::createFromLiteral):
+ * wtf/text/StringImpl.h:
+ (StringImpl):
+ (WTF::StringImpl::StringImpl):
+ (WTF::StringImpl::createFromLiteral):
+
2012-08-08 Patrick Gansterer <[email protected]>
Remove ce_time.(cpp|h) from list of source files
Modified: trunk/Source/WTF/wtf/text/AtomicString.cpp (125134 => 125135)
--- trunk/Source/WTF/wtf/text/AtomicString.cpp 2012-08-09 01:14:09 UTC (rev 125134)
+++ trunk/Source/WTF/wtf/text/AtomicString.cpp 2012-08-09 01:29:44 UTC (rev 125135)
@@ -297,19 +297,19 @@
return addToStringTable<SubstringLocation, SubstringTranslator>(buffer);
}
-typedef HashTranslatorCharBuffer<LChar> LCharBuffer;
-struct LCharBufferFromLiteralDataTranslator {
- static unsigned hash(const LCharBuffer& buf)
+typedef HashTranslatorCharBuffer<char> CharBuffer;
+struct CharBufferFromLiteralDataTranslator {
+ static unsigned hash(const CharBuffer& buf)
{
- return StringHasher::computeHashAndMaskTop8Bits(buf.s, buf.length);
+ return StringHasher::computeHashAndMaskTop8Bits(reinterpret_cast<const LChar*>(buf.s), buf.length);
}
- static bool equal(StringImpl* const& str, const LCharBuffer& buf)
+ static bool equal(StringImpl* const& str, const CharBuffer& buf)
{
return WTF::equal(str, buf.s, buf.length);
}
- static void translate(StringImpl*& location, const LCharBuffer& buf, unsigned hash)
+ static void translate(StringImpl*& location, const CharBuffer& buf, unsigned hash)
{
location = StringImpl::createFromLiteral(buf.s, buf.length).leakRef();
location->setHash(hash);
@@ -317,13 +317,13 @@
}
};
-PassRefPtr<StringImpl> AtomicString::addFromLiteralData(const LChar *characters, unsigned length)
+PassRefPtr<StringImpl> AtomicString::addFromLiteralData(const char* characters, unsigned length)
{
ASSERT(characters);
ASSERT(length);
- LCharBuffer buffer = { characters, length };
- return addToStringTable<LCharBuffer, LCharBufferFromLiteralDataTranslator>(buffer);
+ CharBuffer buffer = { characters, length };
+ return addToStringTable<CharBuffer, CharBufferFromLiteralDataTranslator>(buffer);
}
PassRefPtr<StringImpl> AtomicString::addSlowCase(StringImpl* r)
Modified: trunk/Source/WTF/wtf/text/AtomicString.h (125134 => 125135)
--- trunk/Source/WTF/wtf/text/AtomicString.h 2012-08-09 01:14:09 UTC (rev 125134)
+++ trunk/Source/WTF/wtf/text/AtomicString.h 2012-08-09 01:29:44 UTC (rev 125135)
@@ -53,12 +53,12 @@
enum ConstructFromLiteralTag { ConstructFromLiteral };
AtomicString(const char* characters, unsigned length, ConstructFromLiteralTag)
- : m_string(addFromLiteralData(reinterpret_cast<const LChar*>(characters), length))
+ : m_string(addFromLiteralData(characters, length))
{
}
template<unsigned charactersCount>
ALWAYS_INLINE AtomicString(const char (&characters)[charactersCount], ConstructFromLiteralTag)
- : m_string(addFromLiteralData(reinterpret_cast<const LChar*>(characters), charactersCount - 1))
+ : m_string(addFromLiteralData(characters, charactersCount - 1))
{
COMPILE_ASSERT(charactersCount > 1, AtomicStringFromLiteralNotEmpty);
COMPILE_ASSERT((charactersCount - 1 <= ((unsigned(~0) - sizeof(StringImpl)) / sizeof(LChar))), AtomicStringFromLiteralCannotOverflow);
@@ -169,7 +169,7 @@
return r;
return addSlowCase(r);
}
- WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> addFromLiteralData(const LChar *characters, unsigned length);
+ WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> addFromLiteralData(const char* characters, unsigned length);
WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> addSlowCase(StringImpl*);
WTF_EXPORT_STRING_API static AtomicString fromUTF8Internal(const char*, const char*);
};
Modified: trunk/Source/WTF/wtf/text/StringImpl.cpp (125134 => 125135)
--- trunk/Source/WTF/wtf/text/StringImpl.cpp 2012-08-09 01:14:09 UTC (rev 125134)
+++ trunk/Source/WTF/wtf/text/StringImpl.cpp 2012-08-09 01:29:44 UTC (rev 125135)
@@ -82,9 +82,9 @@
m_substringBuffer->deref();
}
-PassRefPtr<StringImpl> StringImpl::createFromLiteral(const LChar* characters, unsigned length)
+PassRefPtr<StringImpl> StringImpl::createFromLiteral(const char* characters, unsigned length)
{
- ASSERT(charactersAreAllASCII<LChar>(characters, length));
+ ASSERT(charactersAreAllASCII<LChar>(reinterpret_cast<const LChar*>(characters), length));
return adoptRef(new StringImpl(characters, length, ConstructFromLiteral));
}
Modified: trunk/Source/WTF/wtf/text/StringImpl.h (125134 => 125135)
--- trunk/Source/WTF/wtf/text/StringImpl.h 2012-08-09 01:14:09 UTC (rev 125134)
+++ trunk/Source/WTF/wtf/text/StringImpl.h 2012-08-09 01:29:44 UTC (rev 125135)
@@ -58,7 +58,7 @@
struct CStringTranslator;
struct HashAndCharactersTranslator;
struct HashAndUTF8CharactersTranslator;
-struct LCharBufferFromLiteralDataTranslator;
+struct CharBufferFromLiteralDataTranslator;
struct SubstringTranslator;
struct UCharBufferTranslator;
@@ -76,7 +76,7 @@
friend struct WTF::CStringTranslator;
friend struct WTF::HashAndCharactersTranslator;
friend struct WTF::HashAndUTF8CharactersTranslator;
- friend struct WTF::LCharBufferFromLiteralDataTranslator;
+ friend struct WTF::CharBufferFromLiteralDataTranslator;
friend struct WTF::SubstringTranslator;
friend struct WTF::UCharBufferTranslator;
friend class AtomicStringImpl;
@@ -166,10 +166,10 @@
}
enum ConstructFromLiteralTag { ConstructFromLiteral };
- StringImpl(const LChar* characters, unsigned length, ConstructFromLiteralTag)
+ StringImpl(const char* characters, unsigned length, ConstructFromLiteralTag)
: m_refCount(s_refCountIncrement)
, m_length(length)
- , m_data8(characters)
+ , m_data8(reinterpret_cast<const LChar*>(characters))
, m_buffer(0)
, m_hashAndFlags(s_hashFlag8BitBuffer | BufferInternal | s_hashFlagHasTerminatingNullCharacter)
{
@@ -297,14 +297,14 @@
return adoptRef(new StringImpl(rep->m_data16 + offset, length, ownerRep));
}
- WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> createFromLiteral(const LChar* characters, unsigned length);
+ WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> createFromLiteral(const char* characters, unsigned length);
template<unsigned charactersCount>
ALWAYS_INLINE static PassRefPtr<StringImpl> createFromLiteral(const char (&characters)[charactersCount])
{
COMPILE_ASSERT(charactersCount > 1, StringImplFromLiteralNotEmpty);
COMPILE_ASSERT((charactersCount - 1 <= ((unsigned(~0) - sizeof(StringImpl)) / sizeof(LChar))), StringImplFromLiteralCannotOverflow);
- return createFromLiteral(reinterpret_cast<const LChar*>(characters), charactersCount - 1);
+ return createFromLiteral(characters, charactersCount - 1);
}
WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> createUninitialized(unsigned length, LChar*& data);
Modified: trunk/Tools/ChangeLog (125134 => 125135)
--- trunk/Tools/ChangeLog 2012-08-09 01:14:09 UTC (rev 125134)
+++ trunk/Tools/ChangeLog 2012-08-09 01:29:44 UTC (rev 125135)
@@ -1,3 +1,13 @@
+2012-08-08 Benjamin Poulain <[email protected]>
+
+ Use char* instead of LChar* for the public interface of String construction from literals
+ https://bugs.webkit.org/show_bug.cgi?id=93402
+
+ Reviewed by Michael Saboff.
+
+ * TestWebKitAPI/Tests/WTF/StringImpl.cpp:
+ (TestWebKitAPI::TEST):
+
2012-08-08 Dirk Pranke <[email protected]>
nrwt: rename finder.py to layout_test_finder.py
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp (125134 => 125135)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp 2012-08-09 01:14:09 UTC (rev 125134)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp 2012-08-09 01:29:44 UTC (rev 125135)
@@ -38,7 +38,7 @@
ASSERT_TRUE(stringWithTemplate->hasTerminatingNullCharacter());
const char* programmaticStringData = "Explicit Size Literal";
- RefPtr<StringImpl> programmaticString = StringImpl::createFromLiteral(reinterpret_cast<const LChar*>(programmaticStringData), strlen(programmaticStringData));
+ RefPtr<StringImpl> programmaticString = StringImpl::createFromLiteral(programmaticStringData, strlen(programmaticStringData));
ASSERT_EQ(strlen(programmaticStringData), programmaticString->length());
ASSERT_TRUE(equal(programmaticString.get(), programmaticStringData));
ASSERT_EQ(programmaticStringData, reinterpret_cast<const char*>(programmaticString->characters8()));