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

stdlib: base64 stream decoder #21348

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

stdlib: base64 stream decoder #21348

wants to merge 2 commits into from

Conversation

Arwalk
Copy link
Contributor

@Arwalk Arwalk commented Sep 8, 2024

Decoding part related to #20961.

This proposes stream-friendly interface for base64 decoding (decoding to stream, decoding from read stream to write stream).

While writing this, i realized the original base64 decoder with ignored characters was doing some semi-complicated stuff to keep track of its decoding state. This rewrites the original decoder to rely on the decoder without ignores, moving the track keeping to simply chunking 4 valid characters using streams. This should be equivalent in performances and do not requires memory allocation either.

lib/std/base64.zig Outdated Show resolved Hide resolved
@Arwalk Arwalk requested a review from linusg September 9, 2024 22:07
Copy link
Contributor

@linusg linusg left a comment

Choose a reason for hiding this comment

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

My review doesn't mean much here but stylistic changes LGTM, thanks :)

@Arwalk
Copy link
Contributor Author

Arwalk commented Oct 31, 2024

Hello there, i just updated my branch. Is there anyone to review this?

var tempSource: [3]u8 = undefined;
const bytesRead = try sourceReader.read(&tempSource);
var temp_source: [3]u8 = undefined;
const bytesRead = try source_reader.read(&temp_source);
Copy link
Contributor

Choose a reason for hiding this comment

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

Missed one: bytes_read

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