]> git.pld-linux.org Git - packages/nodejs.git/blob - nodejs-revert-utf8-v8.patch
noarch doc subpackage
[packages/nodejs.git] / nodejs-revert-utf8-v8.patch
1 From c7c934c66cd8712c9ff169f1ef4c5670d3ff99c8 Mon Sep 17 00:00:00 2001
2 From: "T.C. Hollingsworth" <tchollingsworth@gmail.com>
3 Date: Wed, 18 Jun 2014 23:09:03 -0700
4 Subject: [PATCH] Revert "string_bytes: Guarantee valid utf-8 output"
5
6 This reverts commit 0da4c671659cfbae12def127b2e94690b9d9b5e1.
7 ---
8  src/node.cc                |  7 -------
9  src/string_bytes.cc        |  2 +-
10  src/string_bytes.h         |  2 --
11  test/simple/test-buffer.js | 12 ------------
12  4 files changed, 1 insertion(+), 22 deletions(-)
13
14 diff --git a/src/node.cc b/src/node.cc
15 index 4223973..e9696cd 100644
16 --- a/src/node.cc
17 +++ b/src/node.cc
18 @@ -180,9 +180,6 @@ static uv_async_t dispatch_debug_messages_async;
19  // Declared in node_internals.h
20  Isolate* node_isolate = NULL;
21  
22 -int WRITE_UTF8_FLAGS = v8::String::HINT_MANY_WRITES_EXPECTED |
23 -                       v8::String::NO_NULL_TERMINATION;
24 -
25  static void Spin(uv_idle_t* handle, int status) {
26    assert((uv_idle_t*) handle == &tick_spinner);
27    assert(status == 0);
28 @@ -3077,11 +3074,6 @@ static char **copy_argv(int argc, char **argv) {
29  
30  
31  int Start(int argc, char *argv[]) {
32 -  const char* replaceInvalid = getenv("NODE_INVALID_UTF8");
33 -
34 -  if (replaceInvalid == NULL)
35 -    WRITE_UTF8_FLAGS |= String::REPLACE_INVALID_UTF8;
36 -
37    // Hack aroung with the argv pointer. Used for process.title = "blah".
38    argv = uv_setup_args(argc, argv);
39  
40 diff --git a/src/string_bytes.cc b/src/string_bytes.cc
41 index a7bab38..e4a34fe 100644
42 --- a/src/string_bytes.cc
43 +++ b/src/string_bytes.cc
44 @@ -199,7 +199,7 @@ size_t StringBytes::Write(char* buf,
45        break;
46  
47      case UTF8:
48 -      len = str->WriteUtf8(buf, buflen, chars_written, WRITE_UTF8_FLAGS);
49 +      len = str->WriteUtf8(buf, buflen, chars_written, flags);
50        break;
51  
52      case UCS2:
53 diff --git a/src/string_bytes.h b/src/string_bytes.h
54 index 31f04bb..8071a49 100644
55 --- a/src/string_bytes.h
56 +++ b/src/string_bytes.h
57 @@ -29,8 +29,6 @@
58  
59  namespace node {
60  
61 -extern int WRITE_UTF8_FLAGS;
62 -
63  using v8::Handle;
64  using v8::Local;
65  using v8::String;
66 diff --git a/test/simple/test-buffer.js b/test/simple/test-buffer.js
67 index f8b2798..3026824 100644
68 --- a/test/simple/test-buffer.js
69 +++ b/test/simple/test-buffer.js
70 @@ -791,18 +791,6 @@ assert.equal(buf[3], 0xFF);
71    assert.equal(buf[3], 0xFF);
72  });
73  
74 -// test unmatched surrogates not producing invalid utf8 output
75 -// ef bf bd = utf-8 representation of unicode replacement character
76 -// see https://codereview.chromium.org/121173009/
77 -buf = new Buffer('ab\ud800cd', 'utf8');
78 -assert.equal(buf[0], 0x61);
79 -assert.equal(buf[1], 0x62);
80 -assert.equal(buf[2], 0xef);
81 -assert.equal(buf[3], 0xbf);
82 -assert.equal(buf[4], 0xbd);
83 -assert.equal(buf[5], 0x63);
84 -assert.equal(buf[6], 0x64);
85 -
86  // test for buffer overrun
87  buf = new Buffer([0, 0, 0, 0, 0]); // length: 5
88  var sub = buf.slice(0, 4);         // length: 4
89 -- 
90 1.9.3
91
This page took 2.005378 seconds and 3 git commands to generate.