mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 16:52:18 +01:00
Rename std/flate to std/deflate
This commit is contained in:
1 parent
d168e6977b
commit
1388f84e5c
20 files changed
+590
-571
No files matched your search
+62
-58
@@ -109,10 +109,10 @@ typedef struct {
|
||||
|
||||
// ---------------- Use Declarations
|
||||
|
||||
// ---------------- BEGIN USE "std/flate"
|
||||
// ---------------- BEGIN USE "std/deflate"
|
||||
|
||||
#ifndef WUFFS_FLATE_H
|
||||
#define WUFFS_FLATE_H
|
||||
#ifndef WUFFS_DEFLATE_H
|
||||
#define WUFFS_DEFLATE_H
|
||||
|
||||
// Code generated by wuffs-c. DO NOT EDIT.
|
||||
|
||||
@@ -131,55 +131,57 @@ extern "C" {
|
||||
// - bits 0-7 are a package-namespaced numeric code
|
||||
//
|
||||
// Do not manipulate these bits directly. Use the API functions such as
|
||||
// wuffs_flate__status__is_error instead.
|
||||
typedef int32_t wuffs_flate__status;
|
||||
// wuffs_deflate__status__is_error instead.
|
||||
typedef int32_t wuffs_deflate__status;
|
||||
|
||||
#define wuffs_flate__packageid 967230 // 0x000EC23E
|
||||
#define wuffs_deflate__packageid 967230 // 0x000EC23E
|
||||
|
||||
#define WUFFS_FLATE__STATUS_OK 0 // 0x00000000
|
||||
#define WUFFS_FLATE__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001
|
||||
#define WUFFS_FLATE__ERROR_BAD_RECEIVER -2147483646 // 0x80000002
|
||||
#define WUFFS_FLATE__ERROR_BAD_ARGUMENT -2147483645 // 0x80000003
|
||||
#define WUFFS_FLATE__ERROR_INITIALIZER_NOT_CALLED -2147483644 // 0x80000004
|
||||
#define WUFFS_FLATE__ERROR_INVALID_I_O_OPERATION -2147483643 // 0x80000005
|
||||
#define WUFFS_FLATE__ERROR_CLOSED_FOR_WRITES -2147483642 // 0x80000006
|
||||
#define WUFFS_FLATE__ERROR_UNEXPECTED_EOF -2147483641 // 0x80000007
|
||||
#define WUFFS_FLATE__SUSPENSION_SHORT_READ 8 // 0x00000008
|
||||
#define WUFFS_FLATE__SUSPENSION_SHORT_WRITE 9 // 0x00000009
|
||||
#define WUFFS_FLATE__ERROR_CANNOT_RETURN_A_SUSPENSION -2147483638 // 0x8000000A
|
||||
#define WUFFS_DEFLATE__STATUS_OK 0 // 0x00000000
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_RECEIVER -2147483646 // 0x80000002
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_ARGUMENT -2147483645 // 0x80000003
|
||||
#define WUFFS_DEFLATE__ERROR_INITIALIZER_NOT_CALLED -2147483644 // 0x80000004
|
||||
#define WUFFS_DEFLATE__ERROR_INVALID_I_O_OPERATION -2147483643 // 0x80000005
|
||||
#define WUFFS_DEFLATE__ERROR_CLOSED_FOR_WRITES -2147483642 // 0x80000006
|
||||
#define WUFFS_DEFLATE__ERROR_UNEXPECTED_EOF -2147483641 // 0x80000007
|
||||
#define WUFFS_DEFLATE__SUSPENSION_SHORT_READ 8 // 0x00000008
|
||||
#define WUFFS_DEFLATE__SUSPENSION_SHORT_WRITE 9 // 0x00000009
|
||||
#define WUFFS_DEFLATE__ERROR_CANNOT_RETURN_A_SUSPENSION \
|
||||
-2147483638 // 0x8000000A
|
||||
|
||||
#define WUFFS_FLATE__ERROR_BAD_HUFFMAN_CODE_OVER_SUBSCRIBED \
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_OVER_SUBSCRIBED \
|
||||
-1157040128 // 0xBB08F800
|
||||
#define WUFFS_FLATE__ERROR_BAD_HUFFMAN_CODE_UNDER_SUBSCRIBED \
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_UNDER_SUBSCRIBED \
|
||||
-1157040127 // 0xBB08F801
|
||||
#define WUFFS_FLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_COUNT \
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_COUNT \
|
||||
-1157040126 // 0xBB08F802
|
||||
#define WUFFS_FLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_REPETITION \
|
||||
-1157040125 // 0xBB08F803
|
||||
#define WUFFS_FLATE__ERROR_BAD_HUFFMAN_CODE -1157040124 // 0xBB08F804
|
||||
#define WUFFS_FLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \
|
||||
-1157040123 // 0xBB08F805
|
||||
#define WUFFS_FLATE__ERROR_BAD_DISTANCE -1157040122 // 0xBB08F806
|
||||
#define WUFFS_FLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1157040121 // 0xBB08F807
|
||||
#define WUFFS_FLATE__ERROR_BAD_FLATE_BLOCK -1157040120 // 0xBB08F808
|
||||
#define WUFFS_FLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_REPETITION \
|
||||
-1157040125 // 0xBB08F803
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -1157040124 // 0xBB08F804
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \
|
||||
-1157040123 // 0xBB08F805
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1157040122 // 0xBB08F806
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1157040121 // 0xBB08F807
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_FLATE_BLOCK -1157040120 // 0xBB08F808
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \
|
||||
-1157040119 // 0xBB08F809
|
||||
#define WUFFS_FLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \
|
||||
#define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \
|
||||
-1157040118 // 0xBB08F80A
|
||||
#define WUFFS_FLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_DECODER_STATE \
|
||||
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_DECODER_STATE \
|
||||
-1157040117 // 0xBB08F80B
|
||||
#define WUFFS_FLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_END_OF_BLOCK \
|
||||
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_END_OF_BLOCK \
|
||||
-1157040116 // 0xBB08F80C
|
||||
#define WUFFS_FLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_DISTANCE \
|
||||
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_DISTANCE \
|
||||
-1157040115 // 0xBB08F80D
|
||||
#define WUFFS_FLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_N_BITS \
|
||||
-1157040114 // 0xBB08F80E
|
||||
#define WUFFS_FLATE__ERROR_MISSING_END_OF_BLOCK_CODE -1157040113 // 0xBB08F80F
|
||||
#define WUFFS_FLATE__ERROR_NO_HUFFMAN_CODES -1157040112 // 0xBB08F810
|
||||
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_N_BITS \
|
||||
-1157040114 // 0xBB08F80E
|
||||
#define WUFFS_DEFLATE__ERROR_MISSING_END_OF_BLOCK_CODE \
|
||||
-1157040113 // 0xBB08F80F
|
||||
#define WUFFS_DEFLATE__ERROR_NO_HUFFMAN_CODES -1157040112 // 0xBB08F810
|
||||
|
||||
bool wuffs_flate__status__is_error(wuffs_flate__status s);
|
||||
bool wuffs_deflate__status__is_error(wuffs_deflate__status s);
|
||||
|
||||
const char* wuffs_flate__status__string(wuffs_flate__status s);
|
||||
const char* wuffs_deflate__status__string(wuffs_deflate__status s);
|
||||
|
||||
// ---------------- Public Consts
|
||||
|
||||
@@ -188,13 +190,13 @@ const char* wuffs_flate__status__string(wuffs_flate__status s);
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so. Instead, use the
|
||||
// wuffs_flate__flate_decoder__etc functions.
|
||||
// wuffs_deflate__flate_decoder__etc functions.
|
||||
//
|
||||
// In C++, these fields would be "private", but C does not support that.
|
||||
//
|
||||
// It is a struct, not a struct*, so that it can be stack allocated.
|
||||
struct {
|
||||
wuffs_flate__status status;
|
||||
wuffs_deflate__status status;
|
||||
uint32_t magic;
|
||||
|
||||
uint32_t f_bits;
|
||||
@@ -208,7 +210,7 @@ typedef struct {
|
||||
|
||||
struct {
|
||||
uint32_t coro_susp_point;
|
||||
wuffs_flate__status v_z;
|
||||
wuffs_deflate__status v_z;
|
||||
uint64_t v_n_copied;
|
||||
uint32_t v_already_full;
|
||||
} c_decode[1];
|
||||
@@ -259,23 +261,25 @@ typedef struct {
|
||||
uint32_t v_hdist;
|
||||
} c_decode_huffman_slow[1];
|
||||
} private_impl;
|
||||
} wuffs_flate__flate_decoder;
|
||||
} wuffs_deflate__flate_decoder;
|
||||
|
||||
// ---------------- Public Initializer Prototypes
|
||||
|
||||
// wuffs_flate__flate_decoder__initialize is an initializer function.
|
||||
// wuffs_deflate__flate_decoder__initialize is an initializer function.
|
||||
//
|
||||
// It should be called before any other wuffs_flate__flate_decoder__* function.
|
||||
// It should be called before any other wuffs_deflate__flate_decoder__*
|
||||
// function.
|
||||
//
|
||||
// Pass WUFFS_VERSION and 0 for wuffs_version and for_internal_use_only.
|
||||
void wuffs_flate__flate_decoder__initialize(wuffs_flate__flate_decoder* self,
|
||||
uint32_t wuffs_version,
|
||||
uint32_t for_internal_use_only);
|
||||
void wuffs_deflate__flate_decoder__initialize(
|
||||
wuffs_deflate__flate_decoder* self,
|
||||
uint32_t wuffs_version,
|
||||
uint32_t for_internal_use_only);
|
||||
|
||||
// ---------------- Public Function Prototypes
|
||||
|
||||
wuffs_flate__status wuffs_flate__flate_decoder__decode(
|
||||
wuffs_flate__flate_decoder* self,
|
||||
wuffs_deflate__status wuffs_deflate__flate_decoder__decode(
|
||||
wuffs_deflate__flate_decoder* self,
|
||||
wuffs_base__writer1 a_dst,
|
||||
wuffs_base__reader1 a_src);
|
||||
|
||||
@@ -283,9 +287,9 @@ wuffs_flate__status wuffs_flate__flate_decoder__decode(
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // WUFFS_FLATE_H
|
||||
#endif // WUFFS_DEFLATE_H
|
||||
|
||||
// ---------------- END USE "std/flate"
|
||||
// ---------------- END USE "std/deflate"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -363,7 +367,7 @@ typedef struct {
|
||||
wuffs_zlib__status status;
|
||||
uint32_t magic;
|
||||
|
||||
wuffs_flate__flate_decoder f_flate;
|
||||
wuffs_deflate__flate_decoder f_flate;
|
||||
wuffs_zlib__adler32 f_adler;
|
||||
|
||||
struct {
|
||||
@@ -598,9 +602,9 @@ static inline uint32_t wuffs_base__writer1__copy_from_history32(
|
||||
} else {
|
||||
n = length;
|
||||
}
|
||||
// TODO: unrolling by 3 seems best for the std/flate benchmarks, but that is
|
||||
// mostly because 3 is the minimum length for the flate format. This function
|
||||
// implementation shouldn't overfit to that one format. Perhaps the
|
||||
// TODO: unrolling by 3 seems best for the std/deflate benchmarks, but that
|
||||
// is mostly because 3 is the minimum length for the deflate format. This
|
||||
// function implementation shouldn't overfit to that one format. Perhaps the
|
||||
// copy_from_history32 Wuffs method should also take an unroll hint argument,
|
||||
// and the cgen can look if that argument is the constant expression '3'.
|
||||
//
|
||||
@@ -837,7 +841,7 @@ void wuffs_zlib__decoder__initialize(wuffs_zlib__decoder* self,
|
||||
memset(self, 0, sizeof(*self));
|
||||
}
|
||||
self->private_impl.magic = WUFFS_BASE__MAGIC;
|
||||
wuffs_flate__flate_decoder__initialize(
|
||||
wuffs_deflate__flate_decoder__initialize(
|
||||
&self->private_impl.f_flate, WUFFS_VERSION, WUFFS_BASE__ALREADY_ZEROED);
|
||||
wuffs_zlib__adler32__initialize(&self->private_impl.f_adler, WUFFS_VERSION,
|
||||
WUFFS_BASE__ALREADY_ZEROED);
|
||||
@@ -975,7 +979,7 @@ wuffs_zlib__status wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self,
|
||||
}
|
||||
}
|
||||
}
|
||||
wuffs_zlib__status t_2 = wuffs_flate__flate_decoder__decode(
|
||||
wuffs_zlib__status t_2 = wuffs_deflate__flate_decoder__decode(
|
||||
&self->private_impl.f_flate, a_dst, a_src);
|
||||
if (a_dst.buf) {
|
||||
b_wptr_dst = a_dst.buf->ptr + a_dst.buf->wi;
|
||||
|
||||
Reference in new issue
Block a user