mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 08:32:11 +01:00
Have example/* global variable names start with g_
This commit is contained in:
1 parent
f3146c2ea9
commit
d60815c93f
7 files changed
+308
-302
No files matched your search
+10
-10
@@ -48,7 +48,7 @@ for a C compiler $CC, such as clang or gcc.
|
||||
#ifndef DST_BUFFER_ARRAY_SIZE
|
||||
#define DST_BUFFER_ARRAY_SIZE 1024
|
||||
#endif
|
||||
uint8_t dst_buffer_array[DST_BUFFER_ARRAY_SIZE];
|
||||
uint8_t g_dst_buffer_array[DST_BUFFER_ARRAY_SIZE];
|
||||
|
||||
// src_ptr and src_len hold a gzip-encoded "Hello Wuffs."
|
||||
//
|
||||
@@ -59,28 +59,28 @@ uint8_t dst_buffer_array[DST_BUFFER_ARRAY_SIZE];
|
||||
//
|
||||
// Passing --no-name to the gzip command line also means to skip the timestamp,
|
||||
// which means that its output is deterministic.
|
||||
uint8_t src_ptr[] = {
|
||||
uint8_t g_src_ptr[] = {
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, // 00..07
|
||||
0x00, 0x03, 0xf3, 0x48, 0xcd, 0xc9, 0xc9, 0x57, // 08..0F
|
||||
0x08, 0x2f, 0x4d, 0x4b, 0x2b, 0xd6, 0xe3, 0x02, // 10..17
|
||||
0x00, 0x3c, 0x84, 0x75, 0xbb, 0x0d, 0x00, 0x00, // 18..1F
|
||||
0x00, // 20..20
|
||||
};
|
||||
size_t src_len = 0x21;
|
||||
size_t g_src_len = 0x21;
|
||||
|
||||
#define WORK_BUFFER_ARRAY_SIZE \
|
||||
WUFFS_GZIP__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE
|
||||
#if WORK_BUFFER_ARRAY_SIZE > 0
|
||||
uint8_t work_buffer_array[WORK_BUFFER_ARRAY_SIZE];
|
||||
uint8_t g_work_buffer_array[WORK_BUFFER_ARRAY_SIZE];
|
||||
#else
|
||||
// Not all C/C++ compilers support 0-length arrays.
|
||||
uint8_t work_buffer_array[1];
|
||||
uint8_t g_work_buffer_array[1];
|
||||
#endif
|
||||
|
||||
static const char* //
|
||||
decode() {
|
||||
wuffs_base__io_buffer dst;
|
||||
dst.data.ptr = dst_buffer_array;
|
||||
dst.data.ptr = g_dst_buffer_array;
|
||||
dst.data.len = DST_BUFFER_ARRAY_SIZE;
|
||||
dst.meta.wi = 0;
|
||||
dst.meta.ri = 0;
|
||||
@@ -88,9 +88,9 @@ decode() {
|
||||
dst.meta.closed = false;
|
||||
|
||||
wuffs_base__io_buffer src;
|
||||
src.data.ptr = src_ptr;
|
||||
src.data.len = src_len;
|
||||
src.meta.wi = src_len;
|
||||
src.data.ptr = g_src_ptr;
|
||||
src.data.len = g_src_len;
|
||||
src.meta.wi = g_src_len;
|
||||
src.meta.ri = 0;
|
||||
src.meta.pos = 0;
|
||||
src.meta.closed = true;
|
||||
@@ -109,7 +109,7 @@ decode() {
|
||||
}
|
||||
status = wuffs_gzip__decoder__transform_io(
|
||||
dec, &dst, &src,
|
||||
wuffs_base__make_slice_u8(work_buffer_array, WORK_BUFFER_ARRAY_SIZE));
|
||||
wuffs_base__make_slice_u8(g_work_buffer_array, WORK_BUFFER_ARRAY_SIZE));
|
||||
if (!wuffs_base__status__is_ok(&status)) {
|
||||
free(dec);
|
||||
return wuffs_base__status__message(&status);
|
||||
|
||||
Reference in new issue
Block a user