Add BrotliCopyPreloadedSymbols function.

Add a single trivial use to avoid complier warning.

PiperOrigin-RevId: 671098230
This commit is contained in:
Ilya Tokar 2024-09-04 14:20:28 -07:00 committed by Copybara-Service
parent 39bcecf455
commit d6dc555eee

View File

@ -1899,6 +1899,22 @@ static BROTLI_INLINE BROTLI_BOOL CheckInputAmount(
} \
}
/* Reads up to limit symbols from br and copies them into ringbuffer,
starting from pos. Caller must ensure that this is safe. */
static BROTLI_INLINE void BrotliCopyPreloadedSymbols(BrotliBitReader* br,
brotli_reg_t* bits,
brotli_reg_t* value,
BrotliDecoderState* s,
int pos,
int limit) {
int pos_limit = pos + limit;
for (; pos < pos_limit; pos++) {
s->ringbuffer[pos] =
(uint8_t)ReadPreloadedSymbol(s->literal_htree, br, bits, value);
BROTLI_LOG_ARRAY_INDEX(s->ringbuffer, pos);
}
}
static BROTLI_INLINE BrotliDecoderErrorCode ProcessCommandsInternal(
int safe, BrotliDecoderState* s) {
int pos = s->pos;
@ -1969,8 +1985,7 @@ CommandInner:
goto NextLiteralBlock;
}
if (!safe) {
s->ringbuffer[pos] =
(uint8_t)ReadPreloadedSymbol(s->literal_htree, br, &bits, &value);
BrotliCopyPreloadedSymbols(br, &bits, &value, s, pos, 1);
} else {
brotli_reg_t literal;
if (!SafeReadSymbol(s->literal_htree, br, &literal)) {