From 8376f72ed6a8ca01548aad1a4f4f1df33094d3e0 Mon Sep 17 00:00:00 2001 From: Eugene Kliuchnikov Date: Wed, 10 Nov 2021 10:34:39 +0100 Subject: Prepare for copybara (#939) Co-authored-by: Eugene Kliuchnikov --- java/org/brotli/dec/Decode.java | 28 +++++++++++----------- java/org/brotli/dec/Huffman.java | 2 +- java/org/brotli/dec/build_defs.bzl | 3 ++- .../brotli/enc/PreparedDictionaryGenerator.java | 2 +- java/org/brotli/wrapper/dec/BUILD | 2 +- java/org/brotli/wrapper/dec/DecoderJNI.java | 2 +- java/org/brotli/wrapper/dec/decoder_jni.cc | 2 +- java/org/brotli/wrapper/enc/EncoderJNI.java | 2 +- java/org/brotli/wrapper/enc/encoder_jni.cc | 2 +- 9 files changed, 23 insertions(+), 22 deletions(-) (limited to 'java') diff --git a/java/org/brotli/dec/Decode.java b/java/org/brotli/dec/Decode.java index f5dbeae..b139ef7 100644 --- a/java/org/brotli/dec/Decode.java +++ b/java/org/brotli/dec/Decode.java @@ -88,7 +88,7 @@ final class Decode { 0x020000, 0x020004, 0x020003, 0x030002, 0x020000, 0x020004, 0x020003, 0x040005 }; - // TODO: generalize. + // TODO(eustas): generalize. static final int MAX_TRANSFORMED_WORD_LENGTH = 5 + 24 + 8; private static final int MAX_DISTANCE_BITS = 24; @@ -152,7 +152,7 @@ final class Decode { return NUM_DISTANCE_SHORT_CODES + ndirect + 2 * (maxndistbits << npostfix); } - // TODO: add a correctness test for this function when + // TODO(eustas): add a correctness test for this function when // large-window and dictionary are implemented. private static int calculateDistanceAlphabetLimit(int maxDistance, int npostfix, int ndirect) { if (maxDistance < ndirect + (2 << npostfix)) { @@ -265,7 +265,7 @@ final class Decode { s.isLargeWindow = 1; } - // TODO: do we need byte views? + // TODO(eustas): do we need byte views? static void attachDictionaryChunk(State s, byte[] data) { if (s.runningState != INITIALIZED) { throw new IllegalStateException("State MUST be freshly initialized"); @@ -485,7 +485,7 @@ final class Decode { if (space != 0) { throw new BrotliRuntimeException("Unused space"); // COV_NF_LINE } - // TODO: Pass max_symbol to Huffman table builder instead? + // TODO(eustas): Pass max_symbol to Huffman table builder instead? Utils.fillIntsWithZeroes(codeLengths, symbol, numSymbols); } @@ -504,7 +504,7 @@ final class Decode { */ private static int readSimpleHuffmanCode(int alphabetSizeMax, int alphabetSizeLimit, int[] tableGroup, int tableIdx, State s) { - // TODO: Avoid allocation? + // TODO(eustas): Avoid allocation? int[] codeLengths = new int[alphabetSizeLimit]; int[] symbols = new int[4]; @@ -560,7 +560,7 @@ final class Decode { break; } - // TODO: Use specialized version? + // TODO(eustas): Use specialized version? return Huffman.buildHuffmanTable( tableGroup, tableIdx, HUFFMAN_TABLE_BITS, codeLengths, alphabetSizeLimit); } @@ -568,7 +568,7 @@ final class Decode { // Decode Huffman-coded code lengths. private static int readComplexHuffmanCode(int alphabetSizeLimit, int skip, int[] tableGroup, int tableIdx, State s) { - // TODO: Avoid allocation? + // TODO(eustas): Avoid allocation? int[] codeLengths = new int[alphabetSizeLimit]; int[] codeLengthCodeLengths = new int[CODE_LENGTH_CODES]; int space = 32; @@ -577,7 +577,7 @@ final class Decode { int codeLenIdx = CODE_LENGTH_CODE_ORDER[i]; BitReader.fillBitWindow(s); int p = BitReader.peekBits(s) & 15; - // TODO: Demultiplex FIXED_TABLE. + // TODO(eustas): Demultiplex FIXED_TABLE. s.bitOffset += FIXED_TABLE[p] >> 16; int v = FIXED_TABLE[p] & 0xFFFF; codeLengthCodeLengths[codeLenIdx] = v; @@ -709,7 +709,7 @@ final class Decode { private static void maybeReallocateRingBuffer(State s) { int newSize = s.maxRingBufferSize; if (newSize > s.expectedTotalSize) { - /* TODO: Handle 2GB+ cases more gracefully. */ + /* TODO(eustas): Handle 2GB+ cases more gracefully. */ int minimalNewSize = s.expectedTotalSize; while ((newSize >> 1) > minimalNewSize) { newSize >>= 1; @@ -736,7 +736,7 @@ final class Decode { s.runningState = INIT_WRITE; return; } - // TODO: Reset? Do we need this? + // TODO(eustas): Reset? Do we need this? s.literalTreeGroup = new int[0]; s.commandTreeGroup = new int[0]; s.distanceTreeGroup = new int[0]; @@ -831,7 +831,7 @@ final class Decode { BitReader.fillBitWindow(s); s.distancePostfixBits = BitReader.readFewBits(s, 2); s.numDirectDistanceCodes = BitReader.readFewBits(s, 4) << s.distancePostfixBits; - // TODO: Reuse? + // TODO(eustas): Reuse? s.contextModes = new byte[s.numLiteralBlockTypes]; for (int i = 0; i < s.numLiteralBlockTypes;) { /* Ensure that less than 256 bits read between readMoreInput. */ @@ -843,7 +843,7 @@ final class Decode { BitReader.readMoreInput(s); } - // TODO: Reuse? + // TODO(eustas): Reuse? s.contextMap = new byte[s.numLiteralBlockTypes << LITERAL_CONTEXT_BITS]; int numLiteralTrees = decodeContextMap(s.numLiteralBlockTypes << LITERAL_CONTEXT_BITS, s.contextMap, s); @@ -855,7 +855,7 @@ final class Decode { } } - // TODO: Reuse? + // TODO(eustas): Reuse? s.distContextMap = new byte[s.numDistanceBlockTypes << DISTANCE_CONTEXT_BITS]; int numDistTrees = decodeContextMap(s.numDistanceBlockTypes << DISTANCE_CONTEXT_BITS, s.distContextMap, s); @@ -1091,7 +1091,7 @@ final class Decode { byte[] ringBuffer = s.ringBuffer; while (s.runningState != FINISHED) { - // TODO: extract cases to methods for the better readability. + // TODO(eustas): extract cases to methods for the better readability. switch (s.runningState) { case BLOCK_START: if (s.metaBlockLength < 0) { diff --git a/java/org/brotli/dec/Huffman.java b/java/org/brotli/dec/Huffman.java index 38f7f29..2a53789 100644 --- a/java/org/brotli/dec/Huffman.java +++ b/java/org/brotli/dec/Huffman.java @@ -66,7 +66,7 @@ final class Huffman { int tableOffset = tableGroup[tableIdx]; int key; // Reversed prefix code. int[] sorted = new int[codeLengthsSize]; // Symbols sorted by code length. - // TODO: fill with zeroes? + // TODO(eustas): fill with zeroes? int[] count = new int[MAX_LENGTH + 1]; // Number of codes of each length. int[] offset = new int[MAX_LENGTH + 1]; // Offsets in sorted table for each length. int symbol; diff --git a/java/org/brotli/dec/build_defs.bzl b/java/org/brotli/dec/build_defs.bzl index d0a015c..fd23a0d 100644 --- a/java/org/brotli/dec/build_defs.bzl +++ b/java/org/brotli/dec/build_defs.bzl @@ -11,7 +11,8 @@ def brotli_java_test(name, main_class = None, jvm_flags = None, **kwargs): jvm_flags = [] jvm_flags = jvm_flags + _TEST_JVM_FLAGS - test_package = native.package_name().replace("/", ".") + test_package = native.package_name().replace("/", ".").replace("javatests.", "") + if main_class == None: test_class = test_package + "." + name else: diff --git a/java/org/brotli/enc/PreparedDictionaryGenerator.java b/java/org/brotli/enc/PreparedDictionaryGenerator.java index 1257b92..3813429 100644 --- a/java/org/brotli/enc/PreparedDictionaryGenerator.java +++ b/java/org/brotli/enc/PreparedDictionaryGenerator.java @@ -73,7 +73,7 @@ public class PreparedDictionaryGenerator { accumulator |= (src.get(i) & 0xFFL) << (8 * i); } accumulator <<= 8; - /* TODO: apply custom "store" order. */ + /* TODO(eustas): apply custom "store" order. */ for (int i = 0; i + 7 < sourceSize; ++i) { accumulator = (accumulator >>> 8) | ((src.get(i + 7) & 0xFFL) << 56); long h = (accumulator & hashMask) * HASH_MULTIPLIER; diff --git a/java/org/brotli/wrapper/dec/BUILD b/java/org/brotli/wrapper/dec/BUILD index 7a99e98..985c928 100644 --- a/java/org/brotli/wrapper/dec/BUILD +++ b/java/org/brotli/wrapper/dec/BUILD @@ -7,7 +7,7 @@ filegroup( srcs = [ "decoder_jni.cc", "decoder_jni.h", - # TODO: investigate, why this prevents JNI library loading. + # TODO(eustas): investigate, why this prevents JNI library loading. #"decoder_jni_onload.cc", ], ) diff --git a/java/org/brotli/wrapper/dec/DecoderJNI.java b/java/org/brotli/wrapper/dec/DecoderJNI.java index fc5225d..7b8dace 100644 --- a/java/org/brotli/wrapper/dec/DecoderJNI.java +++ b/java/org/brotli/wrapper/dec/DecoderJNI.java @@ -126,7 +126,7 @@ public class DecoderJNI { @Override protected void finalize() throws Throwable { if (context[0] != 0) { - /* TODO: log resource leak? */ + /* TODO(eustas): log resource leak? */ destroy(); } super.finalize(); diff --git a/java/org/brotli/wrapper/dec/decoder_jni.cc b/java/org/brotli/wrapper/dec/decoder_jni.cc index ba341a3..3328a1a 100644 --- a/java/org/brotli/wrapper/dec/decoder_jni.cc +++ b/java/org/brotli/wrapper/dec/decoder_jni.cc @@ -79,7 +79,7 @@ Java_org_brotli_wrapper_dec_DecoderJNI_nativeCreate( } if (ok) { - /* TODO: future versions (e.g. when 128-bit architecture comes) + /* TODO(eustas): future versions (e.g. when 128-bit architecture comes) might require thread-safe cookie<->handle mapping. */ context[0] = reinterpret_cast(handle); } else if (!!handle) { diff --git a/java/org/brotli/wrapper/enc/EncoderJNI.java b/java/org/brotli/wrapper/enc/EncoderJNI.java index 1cbd7c1..3e77207 100644 --- a/java/org/brotli/wrapper/enc/EncoderJNI.java +++ b/java/org/brotli/wrapper/enc/EncoderJNI.java @@ -169,7 +169,7 @@ class EncoderJNI { @Override protected void finalize() throws Throwable { if (context[0] != 0) { - /* TODO: log resource leak? */ + /* TODO(eustas): log resource leak? */ destroy(); } super.finalize(); diff --git a/java/org/brotli/wrapper/enc/encoder_jni.cc b/java/org/brotli/wrapper/enc/encoder_jni.cc index 00fbfd8..adcc7bf 100644 --- a/java/org/brotli/wrapper/enc/encoder_jni.cc +++ b/java/org/brotli/wrapper/enc/encoder_jni.cc @@ -93,7 +93,7 @@ Java_org_brotli_wrapper_enc_EncoderJNI_nativeCreate( } if (ok) { - /* TODO: future versions (e.g. when 128-bit architecture comes) + /* TODO(eustas): future versions (e.g. when 128-bit architecture comes) might require thread-safe cookie<->handle mapping. */ context[0] = reinterpret_cast(handle); } else if (!!handle) { -- cgit v1.1