aboutsummaryrefslogtreecommitdiff
path: root/c/enc/encode.c
diff options
context:
space:
mode:
authorEugene Kliuchnikov <eustas.ru@gmail.com>2020-05-15 11:06:21 +0200
committerGitHub <noreply@github.com>2020-05-15 11:06:21 +0200
commit7f740f1308336e9ec0afdb9434896307859f5dc9 (patch)
tree72841d92798fabcfaec0b95091420ac37c82b86f /c/enc/encode.c
parentf83aa5169e3c09afa8db84d1180fd1fe8813118a (diff)
downloadbrotli-7f740f1308336e9ec0afdb9434896307859f5dc9.tar.gz
Update (#807)
- fix formatting - fix type conversion - fix no-op arithmetic with null-pointer - improve performance of hash_longest_match64 - go: detect read after close - java decoder: support compound dictionary - remove executable flag on non-scripts
Diffstat (limited to 'c/enc/encode.c')
-rw-r--r--c/enc/encode.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/c/enc/encode.c b/c/enc/encode.c
index 68548ef..8d90937 100644
--- a/c/enc/encode.c
+++ b/c/enc/encode.c
@@ -516,7 +516,7 @@ static BROTLI_BOOL ShouldCompress(
/* TODO: find more precise minimal block overhead. */
if (bytes <= 2) return BROTLI_FALSE;
if (num_commands < (bytes >> 8) + 2) {
- if (num_literals > 0.99 * (double)bytes) {
+ if ((double)num_literals > 0.99 * (double)bytes) {
uint32_t literal_histo[256] = { 0 };
static const uint32_t kSampleRate = 13;
static const double kMinEntropy = 7.92;
@@ -1686,8 +1686,10 @@ static BROTLI_BOOL BrotliEncoderCompressStreamFast(
&storage_ix, storage);
if (BROTLI_IS_OOM(m)) return BROTLI_FALSE;
}
- *next_in += block_size;
- *available_in -= block_size;
+ if (block_size != 0) {
+ *next_in += block_size;
+ *available_in -= block_size;
+ }
if (inplace) {
size_t out_bytes = storage_ix >> 3;
BROTLI_DCHECK(out_bytes <= *available_out);