Skip to content
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

Merged
merged 13 commits into from
Dec 15, 2014
Merged

Conversation

natevw
Copy link
Contributor

@natevw natevw commented Nov 15, 2014

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:

  • adds utf16le encoding/decoding (which had been completely absent)
  • improves ascii/binary/hex/base64 logic too
  • generally cleaner in/out logic

@natevw natevw force-pushed the nvw-buffer-encoding branch from a3f421c to 2e89eb2 Compare November 18, 2014 02:12
@natevw natevw changed the title [NRY] fix up Buffer's handling of all the encodings Fix up Buffer's handling of all the encodings Nov 18, 2014
@natevw
Copy link
Contributor Author

natevw commented Nov 18, 2014

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."))
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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.

@natevw
Copy link
Contributor Author

natevw commented Nov 18, 2014

TODOs so far:

  • clean up utf16 endianness and duplicate code mess
  • follow up on calloc/malloc thread
  • move base64 to C? [could easily land separately]

@natevw
Copy link
Contributor Author

natevw commented Nov 19, 2014

(Sorry, meant to get this updated yesterday…planning on it first thing this afternoon!)

natevw added a commit that referenced this pull request Nov 19, 2014
@natevw natevw force-pushed the nvw-buffer-encoding branch from e1fc152 to e6e5ce0 Compare November 26, 2014 00:16
natevw added a commit that referenced this pull request Nov 26, 2014
@natevw
Copy link
Contributor Author

natevw commented Nov 26, 2014

Okay I have:

@tcr wanna review again?

tm-rampart added a commit that referenced this pull request Dec 4, 2014
Found this larking about.

NOTE: this is actually the only (current!) user of tm_endian_t, but it has been left since e.g. #645 and/or #566 will want it
@natevw
Copy link
Contributor Author

natevw commented Dec 4, 2014

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.)

@tcr tcr force-pushed the nvw-buffer-encoding branch from e6e5ce0 to 93f31fc Compare December 15, 2014 18:55
@tm-rampart
Copy link
Contributor

Approved by @tcr. Running tests.

tm-rampart added a commit that referenced this pull request Dec 15, 2014
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
tm-rampart added a commit to tessel/t1-firmware that referenced this pull request Dec 15, 2014
@tm-rampart
Copy link
Contributor

Merge or tests failed.

@tm-rampart
Copy link
Contributor

Approved by @tcr. Running tests.

tm-rampart added a commit that referenced this pull request Dec 15, 2014
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
tm-rampart added a commit to tessel/t1-firmware that referenced this pull request Dec 15, 2014
@tm-rampart
Copy link
Contributor

Merge or tests failed.

@tm-rampart
Copy link
Contributor

Approved by @johnnyman727. Running tests.

tm-rampart added a commit that referenced this pull request Dec 15, 2014
…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
tm-rampart added a commit to tessel/t1-firmware that referenced this pull request Dec 15, 2014
@tm-rampart
Copy link
Contributor

Merge or tests failed.

@tm-rampart
Copy link
Contributor

Approved by @johnnyman727. Running tests.

tm-rampart added a commit that referenced this pull request Dec 15, 2014
…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
tm-rampart added a commit to tessel/t1-firmware that referenced this pull request Dec 15, 2014
@tm-rampart tm-rampart merged commit 93f31fc into master Dec 15, 2014
natevw added a commit that referenced this pull request Feb 20, 2015
@Frijol Frijol deleted the nvw-buffer-encoding branch August 20, 2015 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants