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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/heap.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 * Allocates a new string from either UTF-8 encoded or ASCII data. 1255 * Allocates a new string from either UTF-8 encoded or ASCII data.
1256 * The second parameter 'length' gives the buffer length. 1256 * The second parameter 'length' gives the buffer length.
1257 * If the data is UTF-8 encoded, the caller must 1257 * If the data is UTF-8 encoded, the caller must
1258 * be careful to supply the length parameter. 1258 * be careful to supply the length parameter.
1259 * If it is not given, the function calls 1259 * If it is not given, the function calls
1260 * 'strlen' to determine the buffer length, it might be 1260 * 'strlen' to determine the buffer length, it might be
1261 * wrong if 'data' contains a null character. 1261 * wrong if 'data' contains a null character.
1262 */ 1262 */
1263 V8EXPORT static Local<String> New(const char* data, int length = -1); 1263 V8EXPORT static Local<String> New(const char* data, int length = -1);
1264 1264
1265 /**
1266 * Allocates a new string from ASCII data.
1267 * Any non-ASCII characters will have the high bit stripped.
1268 * The second parameter 'length' gives the buffer length.
1269 */
1270 V8EXPORT static Local<String> NewFromAscii(const char* data, int length = -1);
1271
1265 /** Allocates a new string from 16-bit character codes.*/ 1272 /** Allocates a new string from 16-bit character codes.*/
1266 V8EXPORT static Local<String> New(const uint16_t* data, int length = -1); 1273 V8EXPORT static Local<String> New(const uint16_t* data, int length = -1);
1267 1274
1268 /** Creates a symbol. Returns one if it exists already.*/ 1275 /** Creates a symbol. Returns one if it exists already.*/
1269 V8EXPORT static Local<String> NewSymbol(const char* data, int length = -1); 1276 V8EXPORT static Local<String> NewSymbol(const char* data, int length = -1);
1270 1277
1271 /** 1278 /**
1272 * Creates a new string by concatenating the left and the right strings 1279 * Creates a new string by concatenating the left and the right strings
1273 * passed in as parameters. 1280 * passed in as parameters.
1274 */ 1281 */
(...skipping 3594 matching lines...) Expand 10 before | Expand all | Expand 10 after
4869 4876
4870 4877
4871 } // namespace v8 4878 } // namespace v8
4872 4879
4873 4880
4874 #undef V8EXPORT 4881 #undef V8EXPORT
4875 #undef TYPE_CHECK 4882 #undef TYPE_CHECK
4876 4883
4877 4884
4878 #endif // V8_H_ 4885 #endif // V8_H_
OLDNEW
« 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