{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/42902447","id":42902447,"diff_hunk":"@@ -857,7 +856,16 @@ Local<Value> StringBytes::Encode(Isolate* isolate,\n                                  const uint16_t* buf,\n                                  size_t buflen) {\n   Local<String> val;\n-\n+  std::vector<uint16_t> dst;\n+  if (IsBigEndian()) {\n+    // Node's \"ucs2\" encoding expects LE character data inside a\n+    // Buffer, so we need to reorder on BE platforms.  See\n+    // http://nodejs.org/api/buffer.html regarding Node's \"ucs2\"\n+    // encoding specification\n+    dst.resize(buflen);\n+    SwapBytes(&dst[0], buf, buflen);","path":"src/string_bytes.cc","position":31,"original_position":31,"commit_id":"cb4874c4060895918e76585960c1c15a12fdabcb","original_commit_id":"cb4874c4060895918e76585960c1c15a12fdabcb","user":{"login":"exinfinitum","id":6677095,"avatar_url":"https://avatars.githubusercontent.com/u/6677095?v=3","gravatar_id":"","url":"https://api.github.com/users/exinfinitum","html_url":"https://github.com/exinfinitum","followers_url":"https://api.github.com/users/exinfinitum/followers","following_url":"https://api.github.com/users/exinfinitum/following{/other_user}","gists_url":"https://api.github.com/users/exinfinitum/gists{/gist_id}","starred_url":"https://api.github.com/users/exinfinitum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exinfinitum/subscriptions","organizations_url":"https://api.github.com/users/exinfinitum/orgs","repos_url":"https://api.github.com/users/exinfinitum/repos","events_url":"https://api.github.com/users/exinfinitum/events{/privacy}","received_events_url":"https://api.github.com/users/exinfinitum/received_events","type":"User","site_admin":false},"body":"Use of `std::vector` was suggested to me by bnoordhuis to avoid explicitly freeing memory. See https://github.com/nodejs/node/pull/3410#discussion-diff-42548236.","created_at":"2015-10-23T19:05:53Z","updated_at":"2015-10-23T19:05:53Z","html_url":"https://github.com/nodejs/node/pull/3410#discussion_r42902447","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/3410","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/42902447"},"html":{"href":"https://github.com/nodejs/node/pull/3410#discussion_r42902447"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/3410"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/3410","id":47958990,"html_url":"https://github.com/nodejs/node/pull/3410","diff_url":"https://github.com/nodejs/node/pull/3410.diff","patch_url":"https://github.com/nodejs/node/pull/3410.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/3410","number":3410,"state":"open","locked":false,"title":"src: added big-endian check and support to UTF-16 encode","user":{"login":"exinfinitum","id":6677095,"avatar_url":"https://avatars.githubusercontent.com/u/6677095?v=3","gravatar_id":"","url":"https://api.github.com/users/exinfinitum","html_url":"https://github.com/exinfinitum","followers_url":"https://api.github.com/users/exinfinitum/followers","following_url":"https://api.github.com/users/exinfinitum/following{/other_user}","gists_url":"https://api.github.com/users/exinfinitum/gists{/gist_id}","starred_url":"https://api.github.com/users/exinfinitum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exinfinitum/subscriptions","organizations_url":"https://api.github.com/users/exinfinitum/orgs","repos_url":"https://api.github.com/users/exinfinitum/repos","events_url":"https://api.github.com/users/exinfinitum/events{/privacy}","received_events_url":"https://api.github.com/users/exinfinitum/received_events","type":"User","site_admin":false},"body":"Added for loop to Encode function to support big-endian machines.\r\nUsed stack allocation instead of heap allocation to improve speed of endianness correction.\r\nResolves https://github.com/nodejs/node/issues/3409","created_at":"2015-10-16T20:54:30Z","updated_at":"2015-10-23T19:05:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6a44f127e5a9c19ad791f98751d069e1fa7c82fa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/3410/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/3410/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/3410/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/cb4874c4060895918e76585960c1c15a12fdabcb","head":{"label":"exinfinitum:community-master","ref":"community-master","sha":"cb4874c4060895918e76585960c1c15a12fdabcb","user":{"login":"exinfinitum","id":6677095,"avatar_url":"https://avatars.githubusercontent.com/u/6677095?v=3","gravatar_id":"","url":"https://api.github.com/users/exinfinitum","html_url":"https://github.com/exinfinitum","followers_url":"https://api.github.com/users/exinfinitum/followers","following_url":"https://api.github.com/users/exinfinitum/following{/other_user}","gists_url":"https://api.github.com/users/exinfinitum/gists{/gist_id}","starred_url":"https://api.github.com/users/exinfinitum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exinfinitum/subscriptions","organizations_url":"https://api.github.com/users/exinfinitum/orgs","repos_url":"https://api.github.com/users/exinfinitum/repos","events_url":"https://api.github.com/users/exinfinitum/events{/privacy}","received_events_url":"https://api.github.com/users/exinfinitum/received_events","type":"User","site_admin":false},"repo":{"id":44409475,"name":"node-1","full_name":"exinfinitum/node-1","owner":{"login":"exinfinitum","id":6677095,"avatar_url":"https://avatars.githubusercontent.com/u/6677095?v=3","gravatar_id":"","url":"https://api.github.com/users/exinfinitum","html_url":"https://github.com/exinfinitum","followers_url":"https://api.github.com/users/exinfinitum/followers","following_url":"https://api.github.com/users/exinfinitum/following{/other_user}","gists_url":"https://api.github.com/users/exinfinitum/gists{/gist_id}","starred_url":"https://api.github.com/users/exinfinitum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exinfinitum/subscriptions","organizations_url":"https://api.github.com/users/exinfinitum/orgs","repos_url":"https://api.github.com/users/exinfinitum/repos","events_url":"https://api.github.com/users/exinfinitum/events{/privacy}","received_events_url":"https://api.github.com/users/exinfinitum/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/exinfinitum/node-1","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":true,"url":"https://api.github.com/repos/exinfinitum/node-1","forks_url":"https://api.github.com/repos/exinfinitum/node-1/forks","keys_url":"https://api.github.com/repos/exinfinitum/node-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/exinfinitum/node-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/exinfinitum/node-1/teams","hooks_url":"https://api.github.com/repos/exinfinitum/node-1/hooks","issue_events_url":"https://api.github.com/repos/exinfinitum/node-1/issues/events{/number}","events_url":"https://api.github.com/repos/exinfinitum/node-1/events","assignees_url":"https://api.github.com/repos/exinfinitum/node-1/assignees{/user}","branches_url":"https://api.github.com/repos/exinfinitum/node-1/branches{/branch}","tags_url":"https://api.github.com/repos/exinfinitum/node-1/tags","blobs_url":"https://api.github.com/repos/exinfinitum/node-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/exinfinitum/node-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/exinfinitum/node-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/exinfinitum/node-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/exinfinitum/node-1/statuses/{sha}","languages_url":"https://api.github.com/repos/exinfinitum/node-1/languages","stargazers_url":"https://api.github.com/repos/exinfinitum/node-1/stargazers","contributors_url":"https://api.github.com/repos/exinfinitum/node-1/contributors","subscribers_url":"https://api.github.com/repos/exinfinitum/node-1/subscribers","subscription_url":"https://api.github.com/repos/exinfinitum/node-1/subscription","commits_url":"https://api.github.com/repos/exinfinitum/node-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/exinfinitum/node-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/exinfinitum/node-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/exinfinitum/node-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/exinfinitum/node-1/contents/{+path}","compare_url":"https://api.github.com/repos/exinfinitum/node-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/exinfinitum/node-1/merges","archive_url":"https://api.github.com/repos/exinfinitum/node-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/exinfinitum/node-1/downloads","issues_url":"https://api.github.com/repos/exinfinitum/node-1/issues{/number}","pulls_url":"https://api.github.com/repos/exinfinitum/node-1/pulls{/number}","milestones_url":"https://api.github.com/repos/exinfinitum/node-1/milestones{/number}","notifications_url":"https://api.github.com/repos/exinfinitum/node-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/exinfinitum/node-1/labels{/name}","releases_url":"https://api.github.com/repos/exinfinitum/node-1/releases{/id}","created_at":"2015-10-16T20:41:30Z","updated_at":"2015-10-16T20:41:50Z","pushed_at":"2015-10-23T18:37:44Z","git_url":"git://github.com/exinfinitum/node-1.git","ssh_url":"git@github.com:exinfinitum/node-1.git","clone_url":"https://github.com/exinfinitum/node-1.git","svn_url":"https://github.com/exinfinitum/node-1","homepage":"https://nodejs.org","size":149936,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nodejs:master","ref":"master","sha":"3a091d29bf02a7abaf8b241b9c801bc8b700e408","user":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":27193779,"name":"node","full_name":"nodejs/node","owner":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodejs/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":false,"url":"https://api.github.com/repos/nodejs/node","forks_url":"https://api.github.com/repos/nodejs/node/forks","keys_url":"https://api.github.com/repos/nodejs/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/node/teams","hooks_url":"https://api.github.com/repos/nodejs/node/hooks","issue_events_url":"https://api.github.com/repos/nodejs/node/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/node/events","assignees_url":"https://api.github.com/repos/nodejs/node/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/node/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/node/tags","blobs_url":"https://api.github.com/repos/nodejs/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/node/languages","stargazers_url":"https://api.github.com/repos/nodejs/node/stargazers","contributors_url":"https://api.github.com/repos/nodejs/node/contributors","subscribers_url":"https://api.github.com/repos/nodejs/node/subscribers","subscription_url":"https://api.github.com/repos/nodejs/node/subscription","commits_url":"https://api.github.com/repos/nodejs/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/node/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/node/merges","archive_url":"https://api.github.com/repos/nodejs/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/node/downloads","issues_url":"https://api.github.com/repos/nodejs/node/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/node/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/node/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/node/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/node/releases{/id}","created_at":"2014-11-26T19:57:11Z","updated_at":"2015-10-23T17:23:02Z","pushed_at":"2015-10-23T18:50:52Z","git_url":"git://github.com/nodejs/node.git","ssh_url":"git@github.com:nodejs/node.git","clone_url":"https://github.com/nodejs/node.git","svn_url":"https://github.com/nodejs/node","homepage":"https://nodejs.org","size":382996,"stargazers_count":16436,"watchers_count":16436,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1613,"mirror_url":null,"open_issues_count":509,"forks":1613,"open_issues":509,"watchers":16436,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/3410"},"html":{"href":"https://github.com/nodejs/node/pull/3410"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/3410"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/3410/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/3410/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/3410/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/cb4874c4060895918e76585960c1c15a12fdabcb"}}}}