base: rename history_retain_length

It was renamed to dst_history_retain_length.

It also was removed from image_decoders and token_decoders. It only
applies to io_transformers, as retaining history applies to the
destination (not source) IO buffer.

Also adjust example/bzcat and example/zcat to apply the history retain
length to the dst (not src) buffer.
This commit is contained in:
Nigel Tao committed 2023-12-17 12:26:08 +11:00
1 parent b4e09690a7
commit eed1af7bee
34 files changed
+179 -640

No files matched your search

+4 -4
View File
@@ -997,11 +997,11 @@ static void //
ignore_return_value(int ignored) {}
const char* //
read_src(uint64_t history_retain_length) {
read_src() {
if (g_src.meta.closed) {
return "main: internal error: read requested on a closed source";
}
g_src.compact_retaining(history_retain_length);
g_src.compact();
if (g_src.meta.wi >= g_src.data.len) {
return "main: g_src buffer is full";
}
@@ -1394,7 +1394,7 @@ main1(int argc, char** argv) {
}
// Check that we've exhausted the input.
if ((g_src.meta.ri == g_src.meta.wi) && !g_src.meta.closed) {
TRY(read_src(g_dec.history_retain_length().value_or(UINT64_MAX)));
TRY(read_src());
}
if ((g_src.meta.ri < g_src.meta.wi) || !g_src.meta.closed) {
return "main: valid JSON followed by further (unexpected) data";
@@ -1405,7 +1405,7 @@ main1(int argc, char** argv) {
if (g_cursor_index != g_src.meta.ri) {
return "main: internal error: inconsistent g_src indexes";
}
TRY(read_src(g_dec.history_retain_length().value_or(UINT64_MAX)));
TRY(read_src());
g_cursor_index = g_src.meta.ri;
} else if (status.repr == wuffs_base__suspension__short_write) {
g_tok.compact();