mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 12:48:14 +00:00
ZLIB level 0: LEN/NLEN = i16.
This commit is contained in:
@@ -446,7 +446,7 @@ inflate_from_stream_raw :: proc(z: ^Context, allocator := context.allocator) ->
|
|||||||
final = compress.read_bits_lsb(z, 1);
|
final = compress.read_bits_lsb(z, 1);
|
||||||
type = compress.read_bits_lsb(z, 2);
|
type = compress.read_bits_lsb(z, 2);
|
||||||
|
|
||||||
// log.debugf("Final: %v | Type: %v\n", final, type);
|
// fmt.printf("Final: %v | Type: %v\n", final, type);
|
||||||
|
|
||||||
switch type {
|
switch type {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -455,9 +455,13 @@ inflate_from_stream_raw :: proc(z: ^Context, allocator := context.allocator) ->
|
|||||||
// Discard bits until next byte boundary
|
// Discard bits until next byte boundary
|
||||||
compress.discard_to_next_byte_lsb(z);
|
compress.discard_to_next_byte_lsb(z);
|
||||||
|
|
||||||
uncompressed_len := int(compress.read_bits_lsb(z, 16));
|
uncompressed_len := i16(compress.read_bits_lsb(z, 16));
|
||||||
length_check := int(compress.read_bits_lsb(z, 16));
|
length_check := i16(compress.read_bits_lsb(z, 16));
|
||||||
if uncompressed_len != ~length_check {
|
|
||||||
|
// fmt.printf("LEN: %v, ~LEN: %v, NLEN: %v, ~NLEN: %v\n", uncompressed_len, ~uncompressed_len, length_check, ~length_check);
|
||||||
|
|
||||||
|
|
||||||
|
if ~uncompressed_len != length_check {
|
||||||
return E_Deflate.Len_Nlen_Mismatch;
|
return E_Deflate.Len_Nlen_Mismatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user