@@ -41,7 +41,7 @@ pub fn decodeFrameType(source: anytype) error{ BadMagic, EndOfStream }!frame.Kin
41
41
/// Errors returned:
42
42
/// - `error.BadMagic` if `magic` is not a valid magic number.
43
43
pub fn frameType (magic : u32 ) error {BadMagic }! frame.Kind {
44
- return if (magic == frame .ZStandard .magic_number )
44
+ return if (magic == frame .Zstandard .magic_number )
45
45
.zstandard
46
46
else if (isSkippableMagic (magic ))
47
47
.skippable
@@ -79,7 +79,7 @@ pub fn decodeFrame(
79
79
) ! ReadWriteCount {
80
80
var fbs = std .io .fixedBufferStream (src );
81
81
return switch (try decodeFrameType (fbs .reader ())) {
82
- .zstandard = > decodeZStandardFrame (dest , src , verify_checksum ),
82
+ .zstandard = > decodeZstandardFrame (dest , src , verify_checksum ),
83
83
.skippable = > ReadWriteCount {
84
84
.read_count = try fbs .reader ().readIntLittle (u32 ) + 8 ,
85
85
.write_count = 0 ,
@@ -126,7 +126,7 @@ pub fn decodeFrameAlloc(
126
126
const magic = try reader .readIntLittle (u32 );
127
127
return switch (try frameType (magic )) {
128
128
.zstandard = > .{
129
- .zstandard = try decodeZStandardFrameAlloc (allocator , src , verify_checksum , window_size_max ),
129
+ .zstandard = try decodeZstandardFrameAlloc (allocator , src , verify_checksum , window_size_max ),
130
130
},
131
131
.skippable = > .{
132
132
.skippable = .{
@@ -166,17 +166,17 @@ const FrameError = error{
166
166
/// - `error.UnusedBitSet` if the unused bit of the frame header is set
167
167
/// - `error.EndOfStream` if `src` does not contain a complete frame
168
168
/// - an error in `block.Error` if there are errors decoding a block
169
- pub fn decodeZStandardFrame (
169
+ pub fn decodeZstandardFrame (
170
170
dest : []u8 ,
171
171
src : []const u8 ,
172
172
verify_checksum : bool ,
173
173
) (error { UnknownContentSizeUnsupported , ContentTooLarge } || FrameError )! ReadWriteCount {
174
- assert (readInt (u32 , src [0.. 4]) == frame .ZStandard .magic_number );
174
+ assert (readInt (u32 , src [0.. 4]) == frame .Zstandard .magic_number );
175
175
var consumed_count : usize = 4 ;
176
176
177
177
var fbs = std .io .fixedBufferStream (src [consumed_count .. ]);
178
178
var source = fbs .reader ();
179
- const frame_header = try decodeZStandardHeader (source );
179
+ const frame_header = try decodeZstandardHeader (source );
180
180
consumed_count += fbs .pos ;
181
181
182
182
if (frame_header .descriptor .dictionary_id_flag != 0 ) return error .DictionaryIdFlagUnsupported ;
@@ -218,7 +218,7 @@ pub const FrameContext = struct {
218
218
/// - `error.WindowSizeUnknown` if the frame does not have a valid window size
219
219
/// - `error.WindowTooLarge` if the window size is larger than
220
220
pub fn init (
221
- frame_header : frame.ZStandard .Header ,
221
+ frame_header : frame.Zstandard .Header ,
222
222
window_size_max : usize ,
223
223
verify_checksum : bool ,
224
224
) Error ! FrameContext {
@@ -241,7 +241,7 @@ pub const FrameContext = struct {
241
241
};
242
242
243
243
/// Decode a Zstandard from from `src` and return the decompressed bytes and the
244
- /// number of bytes read; see `decodeZStandardFrame ()`. `allocator` is used to
244
+ /// number of bytes read; see `decodeZstandardFrame ()`. `allocator` is used to
245
245
/// allocate both the returned slice and internal buffers used during decoding.
246
246
/// The first four bytes of `src` must be the magic number for a Zstandard
247
247
/// frame.
@@ -259,20 +259,20 @@ pub const FrameContext = struct {
259
259
/// - `error.EndOfStream` if `src` does not contain a complete frame
260
260
/// - `error.OutOfMemory` if `allocator` cannot allocate enough memory
261
261
/// - an error in `block.Error` if there are errors decoding a block
262
- pub fn decodeZStandardFrameAlloc (
262
+ pub fn decodeZstandardFrameAlloc (
263
263
allocator : Allocator ,
264
264
src : []const u8 ,
265
265
verify_checksum : bool ,
266
266
window_size_max : usize ,
267
267
) (error {OutOfMemory } || FrameContext .Error || FrameError )! DecodeResult {
268
268
var result = std .ArrayList (u8 ).init (allocator );
269
- assert (readInt (u32 , src [0.. 4]) == frame .ZStandard .magic_number );
269
+ assert (readInt (u32 , src [0.. 4]) == frame .Zstandard .magic_number );
270
270
var consumed_count : usize = 4 ;
271
271
272
272
var frame_context = context : {
273
273
var fbs = std .io .fixedBufferStream (src [consumed_count .. ]);
274
274
var source = fbs .reader ();
275
- const frame_header = try decodeZStandardHeader (source );
275
+ const frame_header = try decodeZstandardHeader (source );
276
276
consumed_count += fbs .pos ;
277
277
break :context try FrameContext .init (frame_header , window_size_max , verify_checksum );
278
278
};
@@ -371,7 +371,7 @@ pub fn decodeSkippableHeader(src: *const [8]u8) frame.Skippable.Header {
371
371
372
372
/// Returns the window size required to decompress a frame, or `null` if it
373
373
/// cannot be determined (which indicates a malformed frame header).
374
- pub fn frameWindowSize (header : frame.ZStandard .Header ) ? u64 {
374
+ pub fn frameWindowSize (header : frame.Zstandard .Header ) ? u64 {
375
375
if (header .window_descriptor ) | descriptor | {
376
376
const exponent = (descriptor & 0b11111000 ) >> 3 ;
377
377
const mantissa = descriptor & 0b00000111 ;
@@ -389,8 +389,8 @@ const InvalidBit = error{ UnusedBitSet, ReservedBitSet };
389
389
/// - `error.UnusedBitSet` if the unused bits of the header are set
390
390
/// - `error.ReservedBitSet` if the reserved bits of the header are set
391
391
/// - `error.EndOfStream` if `source` does not contain a complete header
392
- pub fn decodeZStandardHeader (source : anytype ) (error {EndOfStream } || InvalidBit )! frame.ZStandard .Header {
393
- const descriptor = @bitCast (frame .ZStandard .Header .Descriptor , try source .readByte ());
392
+ pub fn decodeZstandardHeader (source : anytype ) (error {EndOfStream } || InvalidBit )! frame.Zstandard .Header {
393
+ const descriptor = @bitCast (frame .Zstandard .Header .Descriptor , try source .readByte ());
394
394
395
395
if (descriptor .unused ) return error .UnusedBitSet ;
396
396
if (descriptor .reserved ) return error .ReservedBitSet ;
@@ -414,7 +414,7 @@ pub fn decodeZStandardHeader(source: anytype) (error{EndOfStream} || InvalidBit)
414
414
if (field_size == 2 ) content_size .? += 256 ;
415
415
}
416
416
417
- const header = frame.ZStandard .Header {
417
+ const header = frame.Zstandard .Header {
418
418
.descriptor = descriptor ,
419
419
.window_descriptor = window_descriptor ,
420
420
.dictionary_id = dictionary_id ,
0 commit comments