GeezerVison is showing github.com — src: remove NODE_INVALID_UTF8 environment variable · juliens/node@364cc7e
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/node.cc -8Lines changed: 0 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -139,9 +139,6 @@ static uv_async_t dispatch_debug_messages_async; | 139 | 139 |
| 140 | 140 | static Isolate* node_isolate = nullptr; | 141 | 141 |
| 142 | | -int WRITE_UTF8_FLAGS = v8::String::HINT_MANY_WRITES_EXPECTED | | 143 | | - v8::String::NO_NULL_TERMINATION; | 144 | | - | 145 | 142 | class ArrayBufferAllocator : public ArrayBuffer::Allocator { | 146 | 143 | public: | 147 | 144 | // Impose an upper limit to avoid out of memory errors that bring down | @@ -3819,11 +3816,6 @@ static void StartNodeInstance(void* arg) { | 3819 | 3816 | int Start(int argc, char** argv) { | 3820 | 3817 | PlatformInit(); | 3821 | 3818 |
| 3822 | | - const char* replace_invalid = secure_getenv("NODE_INVALID_UTF8"); | 3823 | | - | 3824 | | - if (replace_invalid == nullptr) | 3825 | | - WRITE_UTF8_FLAGS |= String::REPLACE_INVALID_UTF8; | 3826 | | - | 3827 | 3819 | CHECK_GT(argc, 0); | 3828 | 3820 |
| 3829 | 3821 | // Hack around with the argv pointer. Used for process.title = "blah". | |
Collapse file Copy file name to clipboardExpand all lines: src/string_bytes.cc +4-3Lines changed: 4 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -287,8 +287,9 @@ size_t StringBytes::Write(Isolate* isolate, | 287 | 287 | Local<String> str = val.As<String>(); | 288 | 288 | len = len < buflen ? len : buflen; | 289 | 289 |
| 290 | | - int flags = String::NO_NULL_TERMINATION | | 291 | | - String::HINT_MANY_WRITES_EXPECTED; | | 290 | + int flags = String::HINT_MANY_WRITES_EXPECTED | | | 291 | + String::NO_NULL_TERMINATION | | | 292 | + String::REPLACE_INVALID_UTF8; | 292 | 293 |
| 293 | 294 | switch (encoding) { | 294 | 295 | case ASCII: | @@ -311,7 +312,7 @@ size_t StringBytes::Write(Isolate* isolate, | 311 | 312 | // well? | 312 | 313 | memcpy(buf, data, len); | 313 | 314 | else | 314 | | - len = str->WriteUtf8(buf, buflen, chars_written, WRITE_UTF8_FLAGS); | | 315 | + len = str->WriteUtf8(buf, buflen, chars_written, flags); | 315 | 316 | break; | 316 | 317 |
| 317 | 318 | case UCS2: | |
Collapse file Copy file name to clipboardExpand all lines: src/string_bytes.h -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 10 | 10 |
| 11 | 11 | namespace node { | 12 | 12 |
| 13 | | -extern int WRITE_UTF8_FLAGS; | 14 | | - | 15 | 13 | class StringBytes { | 16 | 14 | public: | 17 | 15 | class InlineDecoder { | |
Collapse file Copy file name to clipboardExpand all lines: src/util.cc +3-6Lines changed: 3 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,12 +23,9 @@ Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Handle<v8::Value> value) | 23 | 23 | str = str_st_; | 24 | 24 | CHECK_NE(str, NULL); | 25 | 25 |
| 26 | | - int flags = WRITE_UTF8_FLAGS; | 27 | | - | 28 | | - length_ = val_->WriteUtf8(str, | 29 | | - len, | 30 | | - 0, | 31 | | - flags); | | 26 | + const int flags = | | 27 | + v8::String::NO_NULL_TERMINATION | v8::String::REPLACE_INVALID_UTF8; | | 28 | + length_ = val_->WriteUtf8(str, len, 0, flags); | 32 | 29 | str[length_] = '\0'; | 33 | 30 |
| 34 | 31 | str_ = reinterpret_cast<char*>(str); | |
|