std: change set_quirk_enabled to set_quirk

This commit is contained in:
Nigel Tao committed 2023-04-14 21:42:15 +10:00
1 parent 176cdf7527
commit 6e84987d33
37 files changed
+644 -490

No files matched your search

+2 -1
View File
@@ -18,7 +18,8 @@ pub struct hasher? implements base.hasher_u32(
started : base.bool,
)
pub func hasher.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
pub func hasher.set_quirk!(key: base.u32, value: base.u64) base.status {
return base."#unsupported option"
}
pub func hasher.update_u32!(x: roslice base.u8) base.u32 {
+2 -1
View File
@@ -82,7 +82,8 @@ pub struct decoder? implements base.image_decoder(
src_palette : array[4 * 256] base.u8,
)
pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
return base."#unsupported option"
}
pub func decoder.decode_image_config?(dst: nptr base.image_config, src: base.io_reader) {
+5 -3
View File
@@ -109,10 +109,12 @@ pub struct decoder? implements base.io_transformer(
bwt : array[1_048576] base.u32,
)
pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
if args.quirk == base.QUIRK_IGNORE_CHECKSUM {
this.ignore_checksum = args.enabled
pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
if args.key == base.QUIRK_IGNORE_CHECKSUM {
this.ignore_checksum = args.value > 0
return ok
}
return base."#unsupported option"
}
pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -1
View File
@@ -113,7 +113,8 @@ pub struct decoder? implements base.token_decoder(
container_num_remaining : array[1024] base.u64,
)
pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
return base."#unsupported option"
}
pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -1
View File
@@ -17,7 +17,8 @@ pub struct ieee_hasher? implements base.hasher_u32(
state : base.u32,
)
pub func ieee_hasher.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
pub func ieee_hasher.set_quirk!(key: base.u32, value: base.u64) base.status {
return base."#unsupported option"
}
// TODO: should it be ? instead of ! because it's public, and might need a way
+2 -1
View File
@@ -199,7 +199,8 @@ pub func decoder.add_history!(hist: slice base.u8) {
this.history[0x8000 ..].copy_from_slice!(s: this.history[..])
}
pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
return base."#unsupported option"
}
pub func decoder.workbuf_len() base.range_ii_u64 {
+7 -5
View File
@@ -88,13 +88,15 @@ pub struct decoder? implements base.image_decoder(
lzw : lzw.decoder,
)
pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
if (this.call_sequence == 0x00) and (args.quirk >= QUIRKS_BASE) {
args.quirk -= QUIRKS_BASE
if args.quirk < QUIRKS_COUNT {
this.quirks[args.quirk] = args.enabled
pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
if (this.call_sequence == 0x00) and (args.key >= QUIRKS_BASE) {
args.key -= QUIRKS_BASE
if args.key < QUIRKS_COUNT {
this.quirks[args.key] = args.value > 0
return ok
}
}
return base."#unsupported option"
}
pub func decoder.decode_image_config?(dst: nptr base.image_config, src: base.io_reader) {
+5 -3
View File
@@ -33,10 +33,12 @@ pub struct decoder? implements base.io_transformer(
util : base.utility,
)
pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
if args.quirk == base.QUIRK_IGNORE_CHECKSUM {
this.ignore_checksum = args.enabled
pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
if args.key == base.QUIRK_IGNORE_CHECKSUM {
this.ignore_checksum = args.value > 0
return ok
}
return base."#unsupported option"
}
pub func decoder.workbuf_len() base.range_ii_u64 {
+7 -5
View File
@@ -61,13 +61,15 @@ pub struct decoder? implements base.token_decoder(
stack : array[1024 / 32] base.u32,
)
pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
if args.quirk >= QUIRKS_BASE {
args.quirk -= QUIRKS_BASE
if args.quirk < QUIRKS_COUNT {
this.quirks[args.quirk] = args.enabled
pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
if args.key >= QUIRKS_BASE {
args.key -= QUIRKS_BASE
if args.key < QUIRKS_COUNT {
this.quirks[args.key] = args.value > 0
return ok
}
}
return base."#unsupported option"
}
pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -1
View File
@@ -70,7 +70,8 @@ pub struct decoder? implements base.io_transformer(
output : array[8192 + 7] base.u8,
)
pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
return base."#unsupported option"
}
pub func decoder.set_literal_width!(lw: base.u32[..= 8]) {
+2 -1
View File
@@ -36,7 +36,8 @@ pub struct decoder? implements base.image_decoder(
util : base.utility,
)
pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
return base."#unsupported option"
}
pub func decoder.decode_image_config?(dst: nptr base.image_config, src: base.io_reader) {
+8 -6
View File
@@ -155,11 +155,13 @@ pub struct decoder? implements base.image_decoder(
src_palette : array[4 * 256] base.u8,
)
pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
if args.quirk == base.QUIRK_IGNORE_CHECKSUM {
this.ignore_checksum = args.enabled
this.zlib.set_quirk_enabled!(quirk: args.quirk, enabled: args.enabled)
pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
if args.key == base.QUIRK_IGNORE_CHECKSUM {
this.ignore_checksum = args.value > 0
this.zlib.set_quirk!(key: args.key, value: args.value)
return ok
}
return base."#unsupported option"
}
pub func decoder.decode_image_config?(dst: nptr base.image_config, src: base.io_reader) {
@@ -1184,7 +1186,7 @@ pri func decoder.do_decode_frame?(dst: ptr base.pixel_buffer, src: base.io_reade
if this.zlib_is_dirty {
this.zlib.reset!()
if this.ignore_checksum {
this.zlib.set_quirk_enabled!(quirk: base.QUIRK_IGNORE_CHECKSUM, enabled: true)
this.zlib.set_quirk!(key: base.QUIRK_IGNORE_CHECKSUM, value: 1)
}
}
this.zlib_is_dirty = true
@@ -1463,7 +1465,7 @@ pri func decoder.do_tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inf
if this.zlib_is_dirty {
this.zlib.reset!()
if this.ignore_checksum {
this.zlib.set_quirk_enabled!(quirk: base.QUIRK_IGNORE_CHECKSUM, enabled: true)
this.zlib.set_quirk!(key: base.QUIRK_IGNORE_CHECKSUM, value: 1)
}
}
this.zlib_is_dirty = true
+2 -1
View File
@@ -52,7 +52,8 @@ pub struct decoder? implements base.image_decoder(
scratch : array[4] base.u8,
)
pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
return base."#unsupported option"
}
pub func decoder.decode_image_config?(dst: nptr base.image_config, src: base.io_reader) {
+2 -1
View File
@@ -31,7 +31,8 @@ pub struct decoder? implements base.image_decoder(
util : base.utility,
)
pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
return base."#unsupported option"
}
pub func decoder.decode_image_config?(dst: nptr base.image_config, src: base.io_reader) {
+11 -7
View File
@@ -62,17 +62,21 @@ pub func decoder.add_dictionary!(dict: slice base.u8) {
this.got_dictionary = true
}
pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
if this.header_complete {
this.bad_call_sequence = true
} else if args.quirk == base.QUIRK_IGNORE_CHECKSUM {
this.ignore_checksum = args.enabled
} else if args.quirk >= QUIRKS_BASE {
args.quirk -= QUIRKS_BASE
if args.quirk < QUIRKS_COUNT {
this.quirks[args.quirk] = args.enabled
return base."#bad call sequence"
} else if args.key == base.QUIRK_IGNORE_CHECKSUM {
this.ignore_checksum = args.value > 0
return ok
} else if args.key >= QUIRKS_BASE {
args.key -= QUIRKS_BASE
if args.key < QUIRKS_COUNT {
this.quirks[args.key] = args.value > 0
return ok
}
}
return base."#unsupported option"
}
pub func decoder.workbuf_len() base.range_ii_u64 {