mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 08:32:11 +01:00
Generate macros for public scalar consts
This commit is contained in:
1 parent
4af1b88ef8
commit
5f7c807729
5 files changed
+19
-3
No files matched your search
@@ -681,6 +681,12 @@ func (g *gen) gatherScalarConsts(b *buffer, n *a.Const) error {
|
||||
}
|
||||
|
||||
func (g *gen) writeConst(b *buffer, n *a.Const) error {
|
||||
if n.Public() {
|
||||
if cv := n.Value().ConstValue(); cv != nil {
|
||||
b.printf("#define %s %v\n\n", strings.ToUpper(g.pkgPrefix+n.QID()[1].Str(g.tm)), cv)
|
||||
}
|
||||
}
|
||||
|
||||
b.writes("static const ")
|
||||
if err := g.writeCTypeName(b, n.XType(), "//\n"+g.pkgPrefix, n.QID()[1].Str(g.tm)); err != nil {
|
||||
return err
|
||||
|
||||
@@ -53,7 +53,7 @@ uint8_t lgtm_ptr[] = {
|
||||
};
|
||||
size_t lgtm_len = 20;
|
||||
|
||||
#define WORK_BUFFER_SIZE (32768 + 512)
|
||||
#define WORK_BUFFER_SIZE WUFFS_DEFLATE__MAX_INCL_WORKBUF_LEN
|
||||
uint8_t work_buffer[WORK_BUFFER_SIZE];
|
||||
|
||||
// ignore_return_value suppresses errors from -Wall -Werror.
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ for a C compiler $CC, such as clang or gcc.
|
||||
#define SRC_BUFFER_SIZE (128 * 1024)
|
||||
#endif
|
||||
|
||||
#define WORK_BUFFER_SIZE (32768 + 512)
|
||||
#define WORK_BUFFER_SIZE WUFFS_GZIP__MAX_INCL_WORKBUF_LEN
|
||||
|
||||
uint8_t dst_buffer[DST_BUFFER_SIZE];
|
||||
uint8_t src_buffer[SRC_BUFFER_SIZE];
|
||||
|
||||
@@ -48,7 +48,7 @@ It should print "PASS", amongst other information, and exit(0).
|
||||
#include "../../../release/c/wuffs-unsupported-snapshot.c"
|
||||
#include "../fuzzlib/fuzzlib.c"
|
||||
|
||||
#define WORK_BUFFER_SIZE (32768 + 512)
|
||||
#define WORK_BUFFER_SIZE WUFFS_ZLIB__MAX_INCL_WORKBUF_LEN
|
||||
uint8_t work_buffer[WORK_BUFFER_SIZE];
|
||||
|
||||
const char* fuzz(wuffs_base__io_reader src_reader, uint32_t hash) {
|
||||
|
||||
@@ -2647,6 +2647,8 @@ extern const char* wuffs_deflate__error__no_huffman_codes;
|
||||
|
||||
// ---------------- Public Consts
|
||||
|
||||
#define WUFFS_DEFLATE__MAX_INCL_WORKBUF_LEN 33280
|
||||
|
||||
static const uint64_t //
|
||||
wuffs_deflate__max_incl_workbuf_len //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 33280;
|
||||
@@ -2818,6 +2820,8 @@ extern const char* wuffs_lzw__error__bad_code;
|
||||
|
||||
// ---------------- Public Consts
|
||||
|
||||
#define WUFFS_LZW__MAX_INCL_WORKBUF_LEN 0
|
||||
|
||||
static const uint64_t //
|
||||
wuffs_lzw__max_incl_workbuf_len //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 0;
|
||||
@@ -2982,6 +2986,8 @@ extern const char* wuffs_gif__error__too_much_pixel_data;
|
||||
|
||||
// ---------------- Public Consts
|
||||
|
||||
#define WUFFS_GIF__MAX_INCL_WORKBUF_LEN 65535
|
||||
|
||||
static const uint64_t //
|
||||
wuffs_gif__max_incl_workbuf_len //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 65535;
|
||||
@@ -3276,6 +3282,8 @@ extern const char* wuffs_gzip__error__bad_header;
|
||||
|
||||
// ---------------- Public Consts
|
||||
|
||||
#define WUFFS_GZIP__MAX_INCL_WORKBUF_LEN 33280
|
||||
|
||||
static const uint64_t //
|
||||
wuffs_gzip__max_incl_workbuf_len //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 33280;
|
||||
@@ -3418,6 +3426,8 @@ extern const char* wuffs_zlib__error__bad_parity_check;
|
||||
|
||||
// ---------------- Public Consts
|
||||
|
||||
#define WUFFS_ZLIB__MAX_INCL_WORKBUF_LEN 33280
|
||||
|
||||
static const uint64_t //
|
||||
wuffs_zlib__max_incl_workbuf_len //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 33280;
|
||||
|
||||
Reference in new issue
Block a user