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

Unified Diff: include/v8.h

Issue 11469014: Add a safe API for creating ASCII-only strings
Patch Set: Created 8 years 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 | « no previous file | src/api.cc » ('j') | src/heap.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index c422e172d2dd15dc51854faad7798bb216f2b623..5e2e879ec09c7af4141c9e38afcdf836ed3264a0 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1262,6 +1262,13 @@ class String : public Primitive {
*/
V8EXPORT static Local<String> New(const char* data, int length = -1);
+ /**
+ * Allocates a new string from ASCII data.
+ * Any non-ASCII characters will have the high bit stripped.
+ * The second parameter 'length' gives the buffer length.
+ */
+ V8EXPORT static Local<String> NewFromAscii(const char* data, int length = -1);
+
/** Allocates a new string from 16-bit character codes.*/
V8EXPORT static Local<String> New(const uint16_t* data, int length = -1);
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698