[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
jorlow at chromium.org
jorlow at chromium.org
Thu Oct 29 20:41:30 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 0f79b586e855f50c7e4fc90c66dc13c548af76ae
Author: jorlow at chromium.org <jorlow at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Oct 8 00:41:10 2009 +0000
2009-10-07 Jens Alfke <snej at chromium.org>
Reviewed by Dave Levin.
Fix StringImpl::m_buffer
https://bugs.webkit.org/show_bug.cgi?id=30189
Fix my previous StringImpl patch to avoid using an indefinite-length array member,
since MSVC doesn't like it. Instead, go back to offsetting by sizeof(StringImpl).
* platform/text/StringImpl.cpp:
(WebCore::StringImpl::StringImpl):
(WebCore::StringImpl::createUninitialized):
* platform/text/StringImpl.h:
(WebCore::StringImpl::bufferIsInternal):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49279 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2b45b03..f76305d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2009-10-07 Jens Alfke <snej at chromium.org>
+
+ Reviewed by Dave Levin.
+
+ Fix StringImpl::m_buffer
+ https://bugs.webkit.org/show_bug.cgi?id=30189
+
+ Fix my previous StringImpl patch to avoid using an indefinite-length array member,
+ since MSVC doesn't like it. Instead, go back to offsetting by sizeof(StringImpl).
+
+ * platform/text/StringImpl.cpp:
+ (WebCore::StringImpl::StringImpl):
+ (WebCore::StringImpl::createUninitialized):
+ * platform/text/StringImpl.h:
+ (WebCore::StringImpl::bufferIsInternal):
+
2009-10-07 Aaron Boodman <aa at chromium.org>
Reviewed by Adam Barth.
diff --git a/WebCore/platform/text/StringImpl.cpp b/WebCore/platform/text/StringImpl.cpp
index 24f8c5b..c3ab4be 100644
--- a/WebCore/platform/text/StringImpl.cpp
+++ b/WebCore/platform/text/StringImpl.cpp
@@ -36,7 +36,6 @@
#include "ThreadGlobalData.h"
#include <wtf/dtoa.h>
#include <wtf/Assertions.h>
-#include <wtf/StdLibExtras.h>
#include <wtf/Threading.h>
#include <wtf/unicode/Unicode.h>
@@ -83,7 +82,6 @@ StringImpl::StringImpl()
: m_data(0)
, m_length(0)
, m_hash(0)
- , m_buffer()
{
// Ensure that the hash is computed so that AtomicStringHash can call existingHash()
// with impunity. The empty string is special because it is never entered into
@@ -95,7 +93,6 @@ inline StringImpl::StringImpl(UChar* characters, unsigned length, AdoptBuffer)
: m_data(characters)
, m_length(length)
, m_hash(0)
- , m_buffer()
{
ASSERT(characters);
ASSERT(length);
@@ -106,7 +103,6 @@ StringImpl::StringImpl(const UChar* characters, unsigned length, unsigned hash)
: m_data(0)
, m_length(length)
, m_hash(hash)
- , m_buffer()
{
ASSERT(hash);
ASSERT(characters);
@@ -123,7 +119,6 @@ StringImpl::StringImpl(const char* characters, unsigned length, unsigned hash)
: m_data(0)
, m_length(length)
, m_hash(hash)
- , m_buffer()
{
ASSERT(hash);
ASSERT(characters);
@@ -959,9 +954,9 @@ PassRefPtr<StringImpl> StringImpl::createUninitialized(unsigned length, UChar*&
// Allocate a single buffer large enough to contain the StringImpl
// struct as well as the data which it contains. This removes one
// heap allocation from this call.
- size_t size = OBJECT_OFFSETOF(StringImpl, m_buffer) + length * sizeof(UChar);
+ size_t size = sizeof(StringImpl) + length * sizeof(UChar);
StringImpl* string = static_cast<StringImpl*>(fastMalloc(size));
- data = const_cast<UChar*>(&string->m_buffer[0]);
+ data = reinterpret_cast<UChar*>(string + 1);
string = new (string) StringImpl(data, length, AdoptBuffer());
return adoptRef(string);
}
diff --git a/WebCore/platform/text/StringImpl.h b/WebCore/platform/text/StringImpl.h
index 4f101e6..f3256cc 100644
--- a/WebCore/platform/text/StringImpl.h
+++ b/WebCore/platform/text/StringImpl.h
@@ -191,7 +191,7 @@ private:
// The StringImpl struct and its data may be allocated within a single heap block.
// In this case, the m_data pointer is an "internal buffer", and does not need to be deallocated.
- bool bufferIsInternal() { return m_data == &m_buffer[0]; }
+ bool bufferIsInternal() { return m_data == reinterpret_cast<const UChar*>(this + 1); }
enum StringImplFlags {
HasTerminatingNullCharacter,
@@ -202,17 +202,8 @@ private:
unsigned m_length;
mutable unsigned m_hash;
PtrAndFlags<SharedUChar, StringImplFlags> m_sharedBufferAndFlags;
- // m_buffer is declared with no size; the compiler treats it as zero size,
- // and the actual size is determined when the instance is created.
- // It will be zero unless using an "internal buffer", in which case m_data
- // will point to m_buffer and the length of m_buffer will be equal to m_length.
-#if COMPILER(GCC)
- const UChar m_buffer[];
-#else
- // Non-GCC compilers may not accept the "[]" syntax. So we'll waste 2 bytes when
- // allocating non-internal strings.
- const UChar m_buffer[1];
-#endif
+ // There is a fictitious variable-length UChar array at the end, which is used
+ // as the internal buffer by the createUninitialized and create methods.
};
bool equal(StringImpl*, StringImpl*);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list