Compare commits

..

2 Commits

Author SHA1 Message Date
Eugene Kliuchnikov
f0468d0f2b Merge branch 'master' into test_835167838 2025-11-24 12:28:58 +01:00
Evgenii Kliuchnikov
2d3e943c52 internal change
PiperOrigin-RevId: 835167838
2025-11-21 04:58:24 -08:00
6 changed files with 27 additions and 29 deletions

View File

@@ -50,6 +50,6 @@ jobs:
- name: Lint Python code
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
ruff check --extend-select=C4,C90,PERF,RET,SIM,W
ruff check
# TODO(eustas): run buildifier

View File

@@ -131,14 +131,6 @@ static BROTLI_INLINE size_t ComputeDistanceCode(size_t distance,
#define PREFIX() D
#define ENABLE_COMPOUND_DICTIONARY 1
#define HASHER() H3
/* NOLINTNEXTLINE(build/include) */
#include "backward_references_inc.h"
#undef HASHER
#define HASHER() H4
/* NOLINTNEXTLINE(build/include) */
#include "backward_references_inc.h"
#undef HASHER
#define HASHER() H5
/* NOLINTNEXTLINE(build/include) */
#include "backward_references_inc.h"
@@ -200,8 +192,6 @@ void BrotliCreateBackwardReferences(size_t num_bytes,
literal_context_lut, params, hasher, dist_cache, \
last_insert_len, commands, num_commands, num_literals); \
return;
CASE_(3)
CASE_(4)
CASE_(5)
CASE_(6)
#if defined(BROTLI_MAX_SIMD_QUALITY)

View File

@@ -168,7 +168,7 @@ static BROTLI_INLINE void FN(FindLongestMatch)(
BROTLI_DCHECK(cur_ix_masked + max_length <= ring_buffer_mask + 1);
out->len_code_delta = 0;
if (prev_ix < cur_ix && cached_backward <= max_backward) {
if (prev_ix < cur_ix) {
prev_ix &= (uint32_t)ring_buffer_mask;
if (compare_char == data[prev_ix + best_len]) {
const size_t len = FindMatchLengthWithLimit(

View File

@@ -18,11 +18,13 @@ for line in lines:
if appendix_a_found:
if re_data_line.match(line) is not None:
data = line.strip()
dictionary.extend(int(data[2 * i:2 * i + 2], 16) for i in range(32))
for i in range(32):
dictionary.append(int(data[2 * i:2 * i + 2], 16))
if len(dictionary) == 122784:
break
elif line.startswith("Appendix A."):
appendix_a_found = True
else:
if line.startswith("Appendix A."):
appendix_a_found = True
bin_path = "dictionary.bin"

View File

@@ -40,12 +40,13 @@ for b in data:
is_skip = False
hi.append(unichr(cntr))
cntr = skip_flip_offset + 1
elif value >= 0x80:
cntr += 1
else:
is_skip = True
hi.append(unichr(cntr))
cntr = skip_flip_offset + 1
if value >= 0x80:
cntr += 1
else:
is_skip = True
hi.append(unichr(cntr))
cntr = skip_flip_offset + 1
hi.append(unichr(cntr))
low0 = low[0:len(low) // 2]
@@ -55,15 +56,15 @@ low1 = low[len(low) // 2:len(low)]
def escape(chars):
result = []
for c in chars:
if c == "\r":
if "\r" == c:
result.append("\\r")
elif c == "\n":
elif "\n" == c:
result.append("\\n")
elif c == "\t":
elif "\t" == c:
result.append("\\t")
elif c == "\"":
elif "\"" == c:
result.append("\\\"")
elif c == "\\":
elif "\\" == c:
result.append("\\\\")
elif ord(c) < 32 or ord(c) >= 127:
result.append("\\u%04X" % ord(c))

View File

@@ -53,7 +53,8 @@ def get_version():
def get_test_suite():
test_loader = unittest.TestLoader()
return test_loader.discover("python", pattern="*_test.py")
test_suite = test_loader.discover("python", pattern="*_test.py")
return test_suite
class BuildExt(build_ext):
@@ -76,9 +77,13 @@ class BuildExt(build_ext):
if not (self.force or dep_util.newer_group(depends, ext_path, "newer")):
log.debug("skipping '%s' extension (up-to-date)", ext.name)
return
log.info("building '%s' extension", ext.name)
else:
log.info("building '%s' extension", ext.name)
c_sources = [source for source in ext.sources if source.endswith(".c")]
c_sources = []
for source in ext.sources:
if source.endswith(".c"):
c_sources.append(source)
extra_args = ext.extra_compile_args or []
objects = []
@@ -179,7 +184,7 @@ USE_SYSTEM_BROTLI = bool_from_environ("USE_SYSTEM_BROTLI")
if USE_SYSTEM_BROTLI:
import pkgconfig
REQUIRED_BROTLI_SYSTEM_LIBRARIES = ["libbrotlicommon", "libbrotlienc", "libbrotlidec"]
define_macros = []