aboutsummaryrefslogtreecommitdiff
path: root/src/base64
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-02-23 23:57:19 -0800
committerGravatar GitHub <noreply@github.com> 2023-02-23 23:57:19 -0800
commit3f04f8d0a653cf5decef2225c2044742b382718a (patch)
tree91eb6500834e3157ecb9ab208101aa368a1191c8 /src/base64
parentb5bdde28ed34070cbb1d34d13f414f4c513ee40d (diff)
downloadbun-3f04f8d0a653cf5decef2225c2044742b382718a.tar.gz
bun-3f04f8d0a653cf5decef2225c2044742b382718a.tar.zst
bun-3f04f8d0a653cf5decef2225c2044742b382718a.zip
Upgrade Zig (#2151)
* fixup * Upgrade Zig * Remove bad assertion * strings * bump * mode -> optimize * optimize * Linux build * Update bindgen.zig
Diffstat (limited to 'src/base64')
-rw-r--r--src/base64/base64.zig8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/base64/base64.zig b/src/base64/base64.zig
index 8173767bc..daf5b228e 100644
--- a/src/base64/base64.zig
+++ b/src/base64/base64.zig
@@ -37,7 +37,6 @@ pub fn decodeURLSafe(destination: []u8, source: []const u8) DecodeResult {
pub fn encode(destination: []u8, source: []const u8) usize {
return zig_base64.standard.Encoder.encode(destination, source).len;
-
}
pub fn decodeLenUpperBound(len: usize) usize {
@@ -59,7 +58,6 @@ pub fn encodeLen(source: anytype) usize {
return zig_base64.standard.Encoder.calcSize(source.len);
}
-
pub const urlsafe = zig_base64.Base64DecoderWithIgnore.init(
zig_base64.url_safe_alphabet_chars,
null,
@@ -219,7 +217,7 @@ const zig_base64 = struct {
};
var char_in_alphabet = [_]bool{false} ** 256;
- for (alphabet_chars) |c, i| {
+ for (alphabet_chars, 0..) |c, i| {
assert(!char_in_alphabet[c]);
assert(pad_char == null or c != pad_char.?);
@@ -264,7 +262,7 @@ const zig_base64 = struct {
var acc_len: u4 = 0;
var dest_idx: usize = 0;
var leftover_idx: ?usize = null;
- for (source) |c, src_idx| {
+ for (source, 0..) |c, src_idx| {
const d = decoder.char_to_index[c];
if (d == invalid_char) {
if (decoder.pad_char == null or c != decoder.pad_char.?) return error.InvalidCharacter;
@@ -342,7 +340,7 @@ const zig_base64 = struct {
wrote.* = leftover_idx orelse dest_idx;
}
- for (source) |c, src_idx| {
+ for (source, 0..) |c, src_idx| {
if (decoder_with_ignore.char_is_ignored[c]) continue;
const d = decoder.char_to_index[c];
if (d == Base64Decoder.invalid_char) {