Skip to content

Commit

Permalink
endian naming change in zig-0.12.0-dev.1388
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihpense committed Nov 3, 2023
1 parent 2e44089 commit e8d6790
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/encoding.zig
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ pub const DefaultDecoder = struct {
state: union(enum) {
start,
utf8: Utf8Decoder,
utf16_le: Utf16Decoder(.Little),
utf16_be: Utf16Decoder(.Big),
utf16_le: Utf16Decoder(.little),
utf16_be: Utf16Decoder(.big),
} = .start,

pub const Error = Utf8Decoder.Error || Utf16Decoder(.Little).Error || Utf16Decoder(.Big).Error;
pub const Error = Utf8Decoder.Error || Utf16Decoder(.little).Error || Utf16Decoder(.big).Error;

pub const max_encoded_codepoint_len = 4;
const bom = 0xFEFF;
Expand Down Expand Up @@ -373,8 +373,8 @@ pub fn Utf16Decoder(comptime endian: std.builtin.Endian) type {

pub fn adaptTo(_: *Self, encoding: []const u8) error{InvalidEncoding}!void {
if (!(ascii.eqlIgnoreCase(encoding, "utf-16") or
(endian == .Big and ascii.eqlIgnoreCase(encoding, "utf-16be")) or
(endian == .Little and ascii.eqlIgnoreCase(encoding, "utf-16le"))))
(endian == .big and ascii.eqlIgnoreCase(encoding, "utf-16be")) or
(endian == .little and ascii.eqlIgnoreCase(encoding, "utf-16le"))))
{
return error.InvalidEncoding;
}
Expand All @@ -394,7 +394,7 @@ test Utf16Decoder {
"\x00\xD8\x00\x00" ++ // unpaired high surrogate followed by U+0000
"\xFF\xDF" // unpaired low surrogate
;
_ = try testDecode(Utf16Decoder(.Little), input, &.{
_ = try testDecode(Utf16Decoder(.little), input, &.{
'\x00',
'A',
'b',
Expand All @@ -417,7 +417,7 @@ test Utf16Decoder {
"\xD8\x00\x00\x00" ++ // unpaired high surrogate followed by U+0000
"\xDF\xFF" // unpaired low surrogate
;
_ = try testDecode(Utf16Decoder(.Big), input, &.{
_ = try testDecode(Utf16Decoder(.big), input, &.{
'\x00',
'A',
'b',
Expand Down

0 comments on commit e8d6790

Please sign in to comment.