GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: remove NODE_INVALID_UTF8 environment variable · juliens/node@364cc7e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node.cc
    • string_bytes.cc
    • string_bytes.h
    • util.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,6 @@ static uv_async_t dispatch_debug_messages_async;
139139

140140
static Isolate* node_isolate = nullptr;
141141

142-
int WRITE_UTF8_FLAGS = v8::String::HINT_MANY_WRITES_EXPECTED |
143-
v8::String::NO_NULL_TERMINATION;
144-
145142
class ArrayBufferAllocator : public ArrayBuffer::Allocator {
146143
public:
147144
// Impose an upper limit to avoid out of memory errors that bring down
@@ -3819,11 +3816,6 @@ static void StartNodeInstance(void* arg) {
38193816
int Start(int argc, char** argv) {
38203817
PlatformInit();
38213818

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-
38273819
CHECK_GT(argc, 0);
38283820

38293821
// Hack around with the argv pointer. Used for process.title = "blah".
Collapse file

‎src/string_bytes.cc‎

Copy file name to clipboardExpand all lines: src/string_bytes.cc
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,9 @@ size_t StringBytes::Write(Isolate* isolate,
287287
Local<String> str = val.As<String>();
288288
len = len < buflen ? len : buflen;
289289

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;
292293

293294
switch (encoding) {
294295
case ASCII:
@@ -311,7 +312,7 @@ size_t StringBytes::Write(Isolate* isolate,
311312
// well?
312313
memcpy(buf, data, len);
313314
else
314-
len = str->WriteUtf8(buf, buflen, chars_written, WRITE_UTF8_FLAGS);
315+
len = str->WriteUtf8(buf, buflen, chars_written, flags);
315316
break;
316317

317318
case UCS2:
Collapse file

‎src/string_bytes.h‎

Copy file name to clipboardExpand all lines: src/string_bytes.h
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
namespace node {
1212

13-
extern int WRITE_UTF8_FLAGS;
14-
1513
class StringBytes {
1614
public:
1715
class InlineDecoder {
Collapse file

‎src/util.cc‎

Copy file name to clipboardExpand all lines: src/util.cc
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,9 @@ Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Handle<v8::Value> value)
2323
str = str_st_;
2424
CHECK_NE(str, NULL);
2525

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);
3229
str[length_] = '\0';
3330

3431
str_ = reinterpret_cast<char*>(str);

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.