if (FLAG_enable_slow_asserts) {
// Assert that the resource and the string are equivalent.
ASSERT(static_cast<size_t>(this->length()) == resource->length());
- SmartPointer<uc16> smart_chars = this->ToWideCString();
+ SmartPointer<uc16> smart_chars(NewArray<uc16>(this->length()));
+ String::WriteToFlat(this, *smart_chars, 0, this->length());
ASSERT(memcmp(*smart_chars,
resource->data(),
resource->length() * sizeof(**smart_chars)) == 0);
if (FLAG_enable_slow_asserts) {
// Assert that the resource and the string are equivalent.
ASSERT(static_cast<size_t>(this->length()) == resource->length());
- SmartPointer<char> smart_chars = this->ToCString();
+ SmartPointer<char> smart_chars(NewArray<char>(this->length()));
+ String::WriteToFlat(this, *smart_chars, 0, this->length());
ASSERT(memcmp(*smart_chars,
resource->data(),
resource->length()*sizeof(**smart_chars)) == 0);