-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: fix erroneous fallthrough in ParseEncoding() #7262
Conversation
@@ -143,11 +143,15 @@ ADDONS_BINDING_GYPS := \ | |||
$(filter-out test/addons/??_*/binding.gyp, \ | |||
$(wildcard test/addons/*/binding.gyp)) | |||
|
|||
ADDONS_BINDING_SOURCES := \ | |||
$(filter-out test/addons/??_*/*.cc, $(wildcard test/addons/*/*.cc)) \ | |||
$(filter-out test/addons/??_*/*.h, $(wildcard test/addons/*/*.h)) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny nit: the trailing \
here is superfluous/inconsistent with the way line continuations are ended in the rest of the Makefile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to write it like that because it keeps the diff small when you add lines later on. But you're right, the rest of the Makefile doesn't use that style.
LGTM |
Shouldn't the } else if (StringEqualNoCase(encoding, "latin1")) {
return LATIN1;
} else if (StringEqualNoCase(encoding, "binary")) {
return BINARY; // HERE
} else if (StringEqualNoCase(encoding, "buffer")) {
return BUFFER; I think it should be } else if (StringEqualNoCase(encoding, "latin1")) {
return LATIN1;
} else if (StringEqualNoCase(encoding, "binary")) {
return LATIN1; // HERE
} else if (StringEqualNoCase(encoding, "buffer")) {
return BUFFER; |
LGTM |
I think @thefourtheye is on to something. It wouldn't matter except that BINARY and LATIN1 are different values. @trevnorris Can you comment on whether this patch makes sense? diff --git a/src/node.h b/src/node.h
index d813b45..427f45d 100644
--- a/src/node.h
+++ b/src/node.h
@@ -278,7 +278,7 @@ inline void NODE_SET_PROTOTYPE_METHOD(v8::Local<v8::FunctionTemplate> recv,
}
#define NODE_SET_PROTOTYPE_METHOD node::NODE_SET_PROTOTYPE_METHOD
-enum encoding {ASCII, UTF8, BASE64, UCS2, LATIN1, BINARY, HEX, BUFFER};
+enum encoding {ASCII, UTF8, BASE64, UCS2, LATIN1, HEX, BUFFER, BINARY = LATIN1};
NODE_EXTERN enum encoding ParseEncoding(
v8::Isolate* isolate,
v8::Local<v8::Value> encoding_v, |
@bnoordhuis I think that makes better sense. The two are functionally equivalent. Rest of the changes LGTM. (thanks for adding the native API tests) |
The prerequisite for rebuilding was on the binding.gyp file but the actual sources. PR-URL: nodejs#7262 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
A missing 'break' statement unintentionally allowed "linary" and "luffer" as alternatives for "binary" and "buffer". Regression introduced in commit 54cc721 ("buffer: introduce latin1 encoding term".) PR-URL: nodejs#7262 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
59752ec
to
6b48324
Compare
Landed in d06820c...6b48324, thanks. I'm going to follow up with a separate PR for the BINARY/LATIN1 thing. |
This depends on #7111 which is semver minor, so will hold out on this until the next v6.x minor release |
The prerequisite for rebuilding was on the binding.gyp file but the actual sources. PR-URL: #7262 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
Make BINARY an alias for LATIN1 rather than a distinct enum value. PR-URL: nodejs#7284 Refs: nodejs#7262 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
added don't land label for v4.x @evanlucas did you want to leave the v6.x label on there ? |
It actually depends on a semver-major change, so I believe that leaving the |
A missing 'break' statement unintentionally allowed "linary" and "luffer" as alternatives for "binary" and "buffer". Regression introduced in commit 54cc721 ("buffer: introduce latin1 encoding term".) PR-URL: nodejs#7262 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
Make BINARY an alias for LATIN1 rather than a distinct enum value. PR-URL: nodejs#7284 Refs: nodejs#7262 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
A missing 'break' statement unintentionally allowed "linary"
and "luffer" as alternatives for "binary" and "buffer".
Regression introduced in commit 54cc721 ("buffer: introduce latin1
encoding term".)
R=@trevnorris
CI: https://ci.nodejs.org/job/node-test-pull-request/2972/