-
Notifications
You must be signed in to change notification settings - Fork 33
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
Fix up Buffer's handling of all the encodings #645
Conversation
a3f421c
to
2e89eb2
Compare
This now passes all relevant tests (including a sizeable handful of new ones) and just got rebased off master. Please review. |
@@ -186,7 +186,8 @@ function from_base64(to_decode) | |||
local char = string.sub(to_decode, i, i) | |||
local offset, _ = string.find(index_table, char) | |||
if offset == nil then | |||
error(js_new(global.Error, "Invalid character '" .. char .. "' found.")) | |||
--error(js_new(global.Error, "Invalid character '" .. tm.str_from_binary(char) .. "' found.")) |
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.
Delete unused line?
// NOTE: Ideally these would deal with native uint16_t arrays, and have separate uint16_t<->uint8_t endian helper. | ||
// But it doesn't seem worth the extra pain and potential performance hit right now. | ||
|
||
#define IS_BIG_ENDIAN 0 // TODO |
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.
Probably add the same constants as https://github.com/tessel/runtime/pull/566/files#diff-989f5e7cdba84de885a494044d101f0bR205
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.
Ah, missed those, and when originally done I had a completely different arrangment of the code where I strongly desired an actual preprocessor constant. However now it makes sense to just use a host-to-le-short style function there.
TODOs so far:
|
(Sorry, meant to get this updated yesterday…planning on it first thing this afternoon!) |
e1fc152
to
e6e5ce0
Compare
Okay I have:
@tcr wanna review again? |
What is the plan here? (This could give another speed bump to sdcard's fatfs speed due to workarounds it is using for lack of native utf16le support, btw.) |
… there but failing some tests
…have shared code in tm_str_to_X case but…meh?)
…s empty buffer on malformed base64
…uffer methods need, this way #566 will be able to share our tm_str_to_utf16 implemenattion
e6e5ce0
to
93f31fc
Compare
Approved by @tcr. Running tests. |
Mild overhaul to finish up Buffer encoding work which was started in the ["Strings" pull request](#542) but wasn't really fully implemented or thoroughly checked over. Highlights: - adds utf16le encoding/decoding (which had been completely absent) - improves ascii/binary/hex/base64 logic too - generally cleaner in/out logic
Approved by @tcr. Running tests. |
Mild overhaul to finish up Buffer encoding work which was started in the ["Strings" pull request](#542) but wasn't really fully implemented or thoroughly checked over. Highlights: - adds utf16le encoding/decoding (which had been completely absent) - improves ascii/binary/hex/base64 logic too - generally cleaner in/out logic
Approved by @johnnyman727. Running tests. |
…ings Mild overhaul to finish up Buffer encoding work which was started in the ["Strings" pull request](#542) but wasn't really fully implemented or thoroughly checked over. Highlights: - adds utf16le encoding/decoding (which had been completely absent) - improves ascii/binary/hex/base64 logic too - generally cleaner in/out logic
…l the encodings
Approved by @johnnyman727. Running tests. |
…ings Mild overhaul to finish up Buffer encoding work which was started in the ["Strings" pull request](#542) but wasn't really fully implemented or thoroughly checked over. Highlights: - adds utf16le encoding/decoding (which had been completely absent) - improves ascii/binary/hex/base64 logic too - generally cleaner in/out logic
…l the encodings
Mild overhaul to finish up Buffer encoding work which was started in the "Strings" pull request but wasn't really fully implemented or thoroughly checked over.
Highlights: