tenfourfox/modules/brotli
Cameron Kaiser c9b2922b70 hello FPR
2017-04-19 00:56:45 -07:00
..
dec hello FPR 2017-04-19 00:56:45 -07:00
moz.build hello FPR 2017-04-19 00:56:45 -07:00
README.mozilla hello FPR 2017-04-19 00:56:45 -07:00
update.sh hello FPR 2017-04-19 00:56:45 -07:00

This is the Brotli data compression library from
https://github.com/google/brotli.

Currently, we import only the Brotli decoder (the /dec/ subdirectory), not the
encoder (/enc/ subdirectory).

Upstream code can be viewed at
  https://github.com/google/brotli/tree/master/dec

and cloned by
  git clone https://github.com/google/brotli

The in-tree copy is updated by running
  sh update.sh
from within the modules/brotli directory.

Current version: [commit 933bb9bd800c8f5f7f6a02382d33c902a98ef73a].

this trivial patch is added to preserve no-warnings behavior in code
that includes the brotli interface. future imports are expected to
have an equivalent change made upstream already.

diff --git a/modules/brotli/dec/bit_reader.h b/modules/brotli/dec/bit_reader.h
--- a/modules/brotli/dec/bit_reader.h
+++ b/modules/brotli/dec/bit_reader.h
@@ -284,17 +284,17 @@ static BROTLI_INLINE int BrotliPeekByte(
   int bytes_left = (int)(sizeof(br->val_) - (br->bit_pos_ >> 3));
   if (br->bit_pos_ & 7) {
     return -1;
   }
   if (offset < bytes_left) {
     return (br->val_ >> (br->bit_pos_ + (unsigned)(offset << 3))) & 0xFF;
   }
   offset -= bytes_left;
-  if (offset < br->avail_in) {
+  if (offset < (long)br->avail_in) {
     return br->next_in[offset];
   }
   return -1;
 }
 
 /* Copies remaining input bytes stored in the bit reader to the output. Value
    num may not be larger than BrotliGetRemainingBytes. The bit reader must be
    warmed up again after this. */


This patch fixes a use-before declare error on big endian platforms
in bit_reader.h.  Upstream has already fixed this error by re-arranging 
some functions in the file.

diff --git a/modules/brotli/dec/bit_reader.h b/modules/brotli/dec/bit_reader.h
--- a/modules/brotli/dec/bit_reader.h
+++ b/modules/brotli/dec/bit_reader.h
@@ -58,17 +58,17 @@ typedef struct {
 /* Initializes the bitreader fields. */
 void BrotliInitBitReader(BrotliBitReader* const br, BrotliInput input);
 
 /* Ensures that accumulator is not empty. May consume one byte of input.
    Returns 0 if data is required but there is no input available.
    For BROTLI_BUILD_PORTABLE this function also prepares bit reader for aligned
    reading. */
 int BrotliWarmupBitReader(BrotliBitReader* const br);
-
+static BROTLI_INLINE void BrotliPullByte(BrotliBitReader* const br);
 /* Pulls data from the input to the the read buffer.
 
    Returns 0 if one of:
     - the input callback returned an error, or
     - there is no more input and the position is past the end of the stream.
     - finish is false and less than BROTLI_READ_SIZE are available - a next call
       when more data is available makes it continue including the partially read
       data