Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: src/api.cc

Issue 14638003: deprecate WriteAscii and MayContainNonAscii (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | src/debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 4352ef3301e2f56a44689bc27459219b8cf1961e..0a4d47d84d2f6c1f5ed572ca9f303c3d889ec4f5 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3314,7 +3314,7 @@ Local<String> v8::Object::ObjectProtoToString() {
const char* postfix = "]";
int prefix_len = i::StrLength(prefix);
- int str_len = str->Length();
+ int str_len = str->Utf8Length();
int postfix_len = i::StrLength(postfix);
int buf_len = prefix_len + str_len + postfix_len;
@@ -3326,7 +3326,7 @@ Local<String> v8::Object::ObjectProtoToString() {
ptr += prefix_len;
// Write real content.
- str->WriteAscii(ptr, 0, str_len);
+ str->WriteUtf8(ptr, str_len);
ptr += str_len;
// Write postfix.
@@ -6451,9 +6451,10 @@ String::AsciiValue::AsciiValue(v8::Handle<v8::Value> obj)
TryCatch try_catch;
Handle<String> str = obj->ToString();
if (str.IsEmpty()) return;
- length_ = str->Length();
+ length_ = str->Utf8Length();
str_ = i::NewArray<char>(length_ + 1);
- str->WriteAscii(str_);
+ str->WriteUtf8(str_);
+ ASSERT(i::String::NonAsciiStart(str_, length_) >= length_);
}
« no previous file with comments | « include/v8.h ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698