diff --git a/doc/lz4_manual.html b/doc/lz4_manual.html index d14467f..f8639fe 100644 --- a/doc/lz4_manual.html +++ b/doc/lz4_manual.html @@ -15,8 +15,9 @@
  • Advanced Functions
  • Streaming Compression Functions
  • Streaming Decompression Functions
  • -
  • Private definitions
  • -
  • Obsolete Functions
  • +
  • Unstable declarations
  • +
  • Private definitions
  • +
  • Obsolete Functions

  • Introduction

    @@ -245,21 +246,79 @@ int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize,
      
     


    -

    Private definitions

    +

    Unstable declarations

    + Declarations in this section should be considered unstable.
    + Use at your own peril, etc., etc.
    + They may be removed in the future.
    + Their signatures may change.
    +
    + +
    void LZ4_resetStream_fast (LZ4_stream_t* streamPtr);
    +

    When an LZ4_stream_t is known to be in a internally coherent state, + it can often be prepared for a new compression with almost no work, only + sometimes falling back to the full, expensive reset that is always required + when the stream is in an indeterminate state (i.e., the reset performed by + LZ4_resetStream()). + + LZ4_streams are guaranteed to be in a valid state when: + - returned from LZ4_createStream() + - reset by LZ4_resetStream() + - memset(stream, 0, sizeof(LZ4_stream_t)) + - the stream was in a valid state and was reset by LZ4_resetStream_fast() + - the stream was in a valid state and was then used in any compression call + that returned success + - the stream was in an indeterminate state and was used in a compression + call that fully reset the state (LZ4_compress_fast_extState()) and that + returned success + +


    + +
    int LZ4_compress_fast_extState_fastReset (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
    +

    A variant of LZ4_compress_fast_extState(). + + Using this variant avoids an expensive initialization step. It is only safe + to call if the state buffer is known to be correctly initialized already + (see above comment on LZ4_resetStream_fast() for a definition of "correctly + initialized"). From a high level, the difference is that this function + initializes the provided state with a call to LZ4_resetStream_fast() while + LZ4_compress_fast_extState() starts with a call to LZ4_resetStream(). + +


    + +
    void LZ4_attach_dictionary(LZ4_stream_t *working_stream, const LZ4_stream_t *dictionary_stream);
    +

    This is an experimental API that allows for the efficient use of a + static dictionary many times. + + Rather than re-loading the dictionary buffer into a working context before + each compression, or copying a pre-loaded dictionary's LZ4_stream_t into a + working LZ4_stream_t, this function introduces a no-copy setup mechanism, + in which the working stream references the dictionary stream in-place. + + Several assumptions are made about the state of the dictionary stream. + Currently, only streams which have been prepared by LZ4_loadDict() should + be expected to work. + + Alternatively, the provided dictionary stream pointer may be NULL, in which + case any existing dictionary stream is unset. + + If a dictionary is provided, it replaces any pre-existing stream history. + The dictionary contents are the only history that can be referenced and + logically immediately precede the data compressed in the first subsequent + compression call. + + The dictionary will only remain attached to the working stream through the + first compression call, at the end of which it is cleared. The dictionary + stream (and source buffer) must remain in-place / accessible / unchanged + through the completion of the first compression call on the stream. + +


    + +

    Private definitions

      Do not use these definitions.
      They are exposed to allow static allocation of `LZ4_stream_t` and `LZ4_streamDecode_t`.
      Using these definitions will expose code to API and/or ABI break in future versions of the library.
     
    -
    typedef struct {
    -    uint32_t hashTable[LZ4_HASH_SIZE_U32];
    -    uint32_t currentOffset;
    -    uint32_t initCheck;
    -    const uint8_t* dictionary;
    -    uint8_t* bufferStart;   /* obsolete, used for slideInputBuffer */
    -    uint32_t dictSize;
    -} LZ4_stream_t_internal;
    -

    typedef struct {
         const uint8_t* externalDict;
         size_t extDictSize;
    @@ -267,15 +326,6 @@ int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize,
         size_t prefixSize;
     } LZ4_streamDecode_t_internal;
     

    -
    typedef struct {
    -    unsigned int hashTable[LZ4_HASH_SIZE_U32];
    -    unsigned int currentOffset;
    -    unsigned int initCheck;
    -    const unsigned char* dictionary;
    -    unsigned char* bufferStart;   /* obsolete, used for slideInputBuffer */
    -    unsigned int dictSize;
    -} LZ4_stream_t_internal;
    -

    typedef struct {
         const unsigned char* externalDict;
         size_t extDictSize;
    @@ -311,7 +361,7 @@ union LZ4_streamDecode_u {
      
     


    -

    Obsolete Functions

    
    +

    Obsolete Functions

    
     
     
    #ifdef LZ4_DISABLE_DEPRECATE_WARNINGS
     #  define LZ4_DEPRECATED(message)   /* disable deprecation warnings */
    diff --git a/lib/lz4.c b/lib/lz4.c
    index 21892d3..f55e4e1 100644
    --- a/lib/lz4.c
    +++ b/lib/lz4.c
    @@ -517,15 +517,15 @@ LZ4_FORCE_INLINE U32 LZ4_hashPosition(const void* const p, tableType_t const tab
         return LZ4_hash4(LZ4_read32(p), tableType);
     }
     
    -static void LZ4_putIndexOnHash(U32 index, U32 h, void* tableBase, tableType_t const tableType)
    +static void LZ4_putIndexOnHash(U32 idx, U32 h, void* tableBase, tableType_t const tableType)
     {
         switch (tableType)
         {
         default: /* fallthrough */
         case clearedTable: /* fallthrough */
         case byPtr: { /* illegal! */ assert(0); return; }
    -    case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = index; return; }
    -    case byU16: { U16* hashTable = (U16*) tableBase; assert(index < 65536); hashTable[h] = (U16)index; return; }
    +    case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = idx; return; }
    +    case byU16: { U16* hashTable = (U16*) tableBase; assert(idx < 65536); hashTable[h] = (U16)idx; return; }
         }
     }