compatibility with gcc-4.4 string.h version

Someone found it would be a great idea to define there a global variable under the very generic name "index".
Cause problem with shadow warnings, so no variable can be named "index" now ...

Also : automatically update API manual
This commit is contained in:
Cyan4973 2018-04-13 01:01:54 -07:00
parent 98811d6068
commit 57afa36795
2 changed files with 75 additions and 25 deletions

View File

@ -15,8 +15,9 @@
<li><a href="#Chapter5">Advanced Functions</a></li>
<li><a href="#Chapter6">Streaming Compression Functions</a></li>
<li><a href="#Chapter7">Streaming Decompression Functions</a></li>
<li><a href="#Chapter8">Private definitions</a></li>
<li><a href="#Chapter9">Obsolete Functions</a></li>
<li><a href="#Chapter8">Unstable declarations</a></li>
<li><a href="#Chapter9">Private definitions</a></li>
<li><a href="#Chapter10">Obsolete Functions</a></li>
</ol>
<hr>
<a name="Chapter1"></a><h2>Introduction</h2><pre>
@ -245,21 +246,79 @@ int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize,
</p></pre><BR>
<a name="Chapter8"></a><h2>Private definitions</h2><pre>
<a name="Chapter8"></a><h2>Unstable declarations</h2><pre>
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.
<BR></pre>
<pre><b>void LZ4_resetStream_fast (LZ4_stream_t* streamPtr);
</b><p> 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
</p></pre><BR>
<pre><b>int LZ4_compress_fast_extState_fastReset (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
</b><p> 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().
</p></pre><BR>
<pre><b>void LZ4_attach_dictionary(LZ4_stream_t *working_stream, const LZ4_stream_t *dictionary_stream);
</b><p> 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.
</p></pre><BR>
<a name="Chapter9"></a><h2>Private definitions</h2><pre>
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.
<BR></pre>
<pre><b>typedef struct {
uint32_t hashTable[LZ4_HASH_SIZE_U32];
uint32_t currentOffset;
uint32_t initCheck;
const uint8_t* dictionary;
uint8_t* bufferStart; </b>/* obsolete, used for slideInputBuffer */<b>
uint32_t dictSize;
} LZ4_stream_t_internal;
</b></pre><BR>
<pre><b>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;
</b></pre><BR>
<pre><b>typedef struct {
unsigned int hashTable[LZ4_HASH_SIZE_U32];
unsigned int currentOffset;
unsigned int initCheck;
const unsigned char* dictionary;
unsigned char* bufferStart; </b>/* obsolete, used for slideInputBuffer */<b>
unsigned int dictSize;
} LZ4_stream_t_internal;
</b></pre><BR>
<pre><b>typedef struct {
const unsigned char* externalDict;
size_t extDictSize;
@ -311,7 +361,7 @@ union LZ4_streamDecode_u {
</p></pre><BR>
<a name="Chapter9"></a><h2>Obsolete Functions</h2><pre></pre>
<a name="Chapter10"></a><h2>Obsolete Functions</h2><pre></pre>
<pre><b>#ifdef LZ4_DISABLE_DEPRECATE_WARNINGS
# define LZ4_DEPRECATED(message) </b>/* disable deprecation warnings */<b>

View File

@ -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; }
}
}