/src/wuffs/release/c/wuffs-unsupported-snapshot.c
Line | Count | Source |
1 | | #ifndef WUFFS_INCLUDE_GUARD |
2 | | #define WUFFS_INCLUDE_GUARD |
3 | | |
4 | | // Wuffs ships as a "single file C library" or "header file library" as per |
5 | | // https://github.com/nothings/stb/blob/master/docs/stb_howto.txt |
6 | | // |
7 | | // To use that single file as a "foo.c"-like implementation, instead of a |
8 | | // "foo.h"-like header, #define WUFFS_IMPLEMENTATION before #include'ing or |
9 | | // compiling it. |
10 | | |
11 | | // Wuffs' C code is generated automatically, not hand-written. These warnings' |
12 | | // costs outweigh the benefits. |
13 | | // |
14 | | // The "|| defined(__clang__)" isn't redundant. While vanilla clang defines |
15 | | // __GNUC__, clang-cl (which mimics MSVC's cl.exe) does not. |
16 | | #if defined(__GNUC__) || defined(__clang__) |
17 | | #pragma GCC diagnostic push |
18 | | #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" |
19 | | #pragma GCC diagnostic ignored "-Wmissing-field-initializers" |
20 | | #pragma GCC diagnostic ignored "-Wunreachable-code" |
21 | | #pragma GCC diagnostic ignored "-Wunused-function" |
22 | | #pragma GCC diagnostic ignored "-Wunused-parameter" |
23 | | #if defined(__cplusplus) |
24 | | #pragma GCC diagnostic ignored "-Wold-style-cast" |
25 | | #endif |
26 | | #endif |
27 | | |
28 | | // Copyright 2017 The Wuffs Authors. |
29 | | // |
30 | | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
31 | | // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
32 | | // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your |
33 | | // option. This file may not be copied, modified, or distributed |
34 | | // except according to those terms. |
35 | | // |
36 | | // SPDX-License-Identifier: Apache-2.0 OR MIT |
37 | | |
38 | | #include <stdbool.h> |
39 | | #include <stdint.h> |
40 | | #include <stdlib.h> |
41 | | #include <string.h> |
42 | | |
43 | | #ifdef __cplusplus |
44 | | #if (__cplusplus >= 201103L) || defined(_MSC_VER) |
45 | | #include <memory> |
46 | | #define WUFFS_BASE__HAVE_EQ_DELETE |
47 | | #define WUFFS_BASE__HAVE_UNIQUE_PTR |
48 | | // The "defined(__clang__)" isn't redundant. While vanilla clang defines |
49 | | // __GNUC__, clang-cl (which mimics MSVC's cl.exe) does not. |
50 | | #elif defined(__GNUC__) || defined(__clang__) |
51 | | #warning "Wuffs' C++ code expects -std=c++11 or later" |
52 | | #endif |
53 | | |
54 | | extern "C" { |
55 | | #endif |
56 | | |
57 | | // ---------------- Version |
58 | | |
59 | | // WUFFS_VERSION is the major.minor.patch version, as per https://semver.org/, |
60 | | // as a uint64_t. The major number is the high 32 bits. The minor number is the |
61 | | // middle 16 bits. The patch number is the low 16 bits. The pre-release label |
62 | | // and build metadata are part of the string representation (such as |
63 | | // "1.2.3-beta+456.20181231") but not the uint64_t representation. |
64 | | // |
65 | | // WUFFS_VERSION_PRE_RELEASE_LABEL (such as "", "beta" or "rc.1") being |
66 | | // non-empty denotes a developer preview, not a release version, and has no |
67 | | // backwards or forwards compatibility guarantees. |
68 | | // |
69 | | // WUFFS_VERSION_BUILD_METADATA_XXX, if non-zero, are the number of commits and |
70 | | // the last commit date in the repository used to build this library. Within |
71 | | // each major.minor branch, the commit count should increase monotonically. |
72 | | // |
73 | | // ยก Some code generation programs can override WUFFS_VERSION. |
74 | 311k | #define WUFFS_VERSION 0 |
75 | 180k | #define WUFFS_VERSION_MAJOR 0 |
76 | 180k | #define WUFFS_VERSION_MINOR 0 |
77 | | #define WUFFS_VERSION_PATCH 0 |
78 | | #define WUFFS_VERSION_PRE_RELEASE_LABEL "unsupported.snapshot" |
79 | | #define WUFFS_VERSION_BUILD_METADATA_COMMIT_COUNT 0 |
80 | | #define WUFFS_VERSION_BUILD_METADATA_COMMIT_DATE 0 |
81 | | #define WUFFS_VERSION_STRING "0.0.0+0.00000000" |
82 | | |
83 | | // ---------------- Private Implementation Macros Re-definition Check |
84 | | |
85 | | // Users (those who #include the "wuffs-vM.N.c" file) should not define any |
86 | | // WUFFS_PRIVATE_IMPL__ETC macros, only WUFFS_CONFIG__ETC macros (and |
87 | | // WUFFS_IMPLEMENTATION). Mucking about with the private implementation macros |
88 | | // is not supported and may break when upgrading to newer Wuffs versions. |
89 | | |
90 | | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__ARM_CRC32) || \ |
91 | | defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__ARM_NEON) || \ |
92 | | defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) || \ |
93 | | defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64_V2) || \ |
94 | | defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64_V3) || \ |
95 | | defined(WUFFS_PRIVATE_IMPL__HPD__DECIMAL_POINT__RANGE) || \ |
96 | | defined(WUFFS_PRIVATE_IMPL__HPD__DIGITS_PRECISION) || \ |
97 | | defined(WUFFS_PRIVATE_IMPL__HPD__SHIFT__MAX_INCL) || \ |
98 | | defined(WUFFS_PRIVATE_IMPL__LOW_BITS_MASK__U16) || \ |
99 | | defined(WUFFS_PRIVATE_IMPL__LOW_BITS_MASK__U32) || \ |
100 | | defined(WUFFS_PRIVATE_IMPL__LOW_BITS_MASK__U64) || \ |
101 | | defined(WUFFS_PRIVATE_IMPL__LOW_BITS_MASK__U8) |
102 | | |
103 | | #if defined(__GNUC__) || defined(__clang__) |
104 | | #warning "Defining WUFFS_PRIVATE_IMPL__ETC yourself is not supported" |
105 | | #elif defined(_MSC_VER) |
106 | | #pragma message("Defining WUFFS_PRIVATE_IMPL__ETC yourself is not supported") |
107 | | #endif |
108 | | |
109 | | #endif |
110 | | |
111 | | // ---------------- Obsolete Macros Check |
112 | | |
113 | | // std/tga was renamed to std/targa in September 2024 (Wuffs v0.4 alpha). |
114 | | #if defined(WUFFS_CONFIG__MODULE__TGA) |
115 | | |
116 | | #if defined(__GNUC__) || defined(__clang__) |
117 | | #warning "WUFFS_CONFIG__MODULE__TGA was renamed to WUFFS_CONFIG__MODULE__TARGA" |
118 | | #elif defined(_MSC_VER) |
119 | | #pragma message( \ |
120 | | "WUFFS_CONFIG__MODULE__TGA was renamed to WUFFS_CONFIG__MODULE__TARGA") |
121 | | #endif |
122 | | |
123 | | #endif |
124 | | |
125 | | // ---------------- Configuration |
126 | | |
127 | | // Define WUFFS_CONFIG__AVOID_CPU_ARCH to avoid any code tied to a specific CPU |
128 | | // architecture, such as SSE SIMD for the x86 CPU family. |
129 | | #if defined(WUFFS_CONFIG__AVOID_CPU_ARCH) // (#if-chain ref AVOID_CPU_ARCH_0) |
130 | | // No-op. |
131 | | #else // (#if-chain ref AVOID_CPU_ARCH_0) |
132 | | |
133 | | // The "defined(__clang__)" isn't redundant. While vanilla clang defines |
134 | | // __GNUC__, clang-cl (which mimics MSVC's cl.exe) does not. |
135 | | #if defined(__GNUC__) || defined(__clang__) |
136 | | #define WUFFS_BASE__MAYBE_ATTRIBUTE_TARGET(arg) __attribute__((target(arg))) |
137 | | #else |
138 | | #define WUFFS_BASE__MAYBE_ATTRIBUTE_TARGET(arg) |
139 | | #endif // defined(__GNUC__) || defined(__clang__) |
140 | | |
141 | | #if defined(__GNUC__) // (#if-chain ref AVOID_CPU_ARCH_1) |
142 | | |
143 | | // To simplify Wuffs code, "cpu_arch >= arm_xxx" requires xxx but also |
144 | | // unaligned little-endian load/stores. |
145 | | #if defined(__ARM_FEATURE_UNALIGNED) && !defined(__native_client__) && \ |
146 | | defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) |
147 | | // Not all gcc versions define __ARM_ACLE, even if they support crc32 |
148 | | // intrinsics. Look for __ARM_FEATURE_CRC32 instead. |
149 | | #if defined(__ARM_FEATURE_CRC32) |
150 | | #include <arm_acle.h> |
151 | | #define WUFFS_PRIVATE_IMPL__CPU_ARCH__ARM_CRC32 |
152 | | #endif // defined(__ARM_FEATURE_CRC32) |
153 | | #if defined(__ARM_NEON) |
154 | | #include <arm_neon.h> |
155 | | #define WUFFS_PRIVATE_IMPL__CPU_ARCH__ARM_NEON |
156 | | #endif // defined(__ARM_NEON) |
157 | | #endif // defined(__ARM_FEATURE_UNALIGNED) etc |
158 | | |
159 | | // Similarly, "cpu_arch >= x86_sse42" requires SSE4.2 but also PCLMUL and |
160 | | // POPCNT. This is checked at runtime via cpuid, not at compile time. |
161 | | // |
162 | | // Likewise, "cpu_arch >= x86_avx2" also requires PCLMUL, POPCNT and SSE4.2. |
163 | | // |
164 | | // ---- |
165 | | // |
166 | | // Technically, we could use the SSE family on 32-bit x86, not just 64-bit x86. |
167 | | // But some intrinsics don't compile in 32-bit mode. It's not worth the hassle. |
168 | | // https://github.com/google/wuffs/issues/145 |
169 | | #if defined(__x86_64__) |
170 | | #if !defined(__native_client__) |
171 | | #include <cpuid.h> |
172 | | #include <x86intrin.h> |
173 | | #define WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64 |
174 | | #define WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64_V2 |
175 | | #define WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64_V3 |
176 | | #endif // !defined(__native_client__) |
177 | | #endif // defined(__x86_64__) |
178 | | |
179 | | #elif defined(_MSC_VER) // (#if-chain ref AVOID_CPU_ARCH_1) |
180 | | |
181 | | #if defined(_M_X64) |
182 | | |
183 | | // On X86_64, Microsoft Visual C/C++ (MSVC) only supports SSE2 by default. |
184 | | // There are /arch:SSE2, /arch:AVX and /arch:AVX2 compiler flags (the AVX2 one |
185 | | // is roughly equivalent to X86_64_V3), but there is no /arch:SSE42 compiler |
186 | | // flag that's equivalent to X86_64_V2. |
187 | | // |
188 | | // For getting maximum performance with X86_64 MSVC and Wuffs, pass /arch:AVX2 |
189 | | // (and then test on the oldest hardware you intend to support). |
190 | | // |
191 | | // Absent that compiler flag, either define one of the three macros listed |
192 | | // below or else the X86_64 SIMD code will be disabled and you'll get a #pragma |
193 | | // message stating this library "performs best with /arch:AVX2". This message |
194 | | // is harmless and ignorable, in that the non-SIMD code is still correct and |
195 | | // reasonably performant, but is a reminder that when combining Wuffs and MSVC, |
196 | | // some compiler configuration is required for maximum performance. |
197 | | // |
198 | | // - WUFFS_CONFIG__DISABLE_MSVC_CPU_ARCH__X86_64_FAMILY |
199 | | // - WUFFS_CONFIG__ENABLE_MSVC_CPU_ARCH__X86_64_V2 (enables SSE4.2 and below) |
200 | | // - WUFFS_CONFIG__ENABLE_MSVC_CPU_ARCH__X86_64_V3 (enables AVX2 and below) |
201 | | // |
202 | | // Defining the first one (WUFFS_CONFIG__DISABLE_MSVC_CPU_ARCH__X86_64_FAMILY) |
203 | | // or defining none of those three (the default state) are equivalent (in that |
204 | | // both disable the SIMD code paths), other than that pragma message. |
205 | | // |
206 | | // When defining these WUFFS_CONFIG__ENABLE_ETC macros with MSVC, be aware that |
207 | | // some users report it leading to ICEs (Internal Compiler Errors), but other |
208 | | // users report no problems at all (and improved performance). It's unclear |
209 | | // exactly what combination of SIMD code and MSVC configuration lead to ICEs. |
210 | | // Do your own testing with your own MSVC version and configuration. |
211 | | // |
212 | | // https://github.com/google/wuffs/issues/148 |
213 | | // https://github.com/google/wuffs/issues/151 |
214 | | // https://developercommunity.visualstudio.com/t/fatal--error-C1001:-Internal-compiler-er/10703305 |
215 | | // |
216 | | // Clang (including clang-cl) and GCC don't need this WUFFS_CONFIG__ETC macro |
217 | | // machinery, or having the Wuffs-the-library user to fiddle with compiler |
218 | | // flags, because they support "__attribute__((target(arg)))". |
219 | | #if defined(__AVX2__) || defined(__clang__) || \ |
220 | | defined(WUFFS_CONFIG__ENABLE_MSVC_CPU_ARCH__X86_64_V3) |
221 | | #define WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64 |
222 | | #define WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64_V2 |
223 | | #define WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64_V3 |
224 | | #elif defined(WUFFS_CONFIG__ENABLE_MSVC_CPU_ARCH__X86_64_V2) |
225 | | #define WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64 |
226 | | #define WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64_V2 |
227 | | #elif !defined(WUFFS_CONFIG__DISABLE_MSVC_CPU_ARCH__X86_64_FAMILY) |
228 | | #pragma message("Wuffs with MSVC+X64 performs best with /arch:AVX2") |
229 | | #endif // defined(__AVX2__) || defined(__clang__) || etc |
230 | | |
231 | | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) |
232 | | |
233 | | #if defined(WUFFS_CONFIG__DISABLE_MSVC_CPU_ARCH__X86_64_FAMILY) |
234 | | #error "MSVC_CPU_ARCH simultaneously enabled and disabled" |
235 | | #endif |
236 | | |
237 | | #include <intrin.h> |
238 | | // intrin.h isn't enough for X64 SIMD, with clang-cl, if we want to use |
239 | | // "__attribute__((target(arg)))" without e.g. "/arch:AVX". |
240 | | // |
241 | | // Some web pages suggest that <immintrin.h> is all you need, as it pulls in |
242 | | // the earlier SIMD families like SSE4.2, but that doesn't seem to work in |
243 | | // practice, possibly for the same reason that just <intrin.h> doesn't work. |
244 | | #include <immintrin.h> // AVX, AVX2, FMA, POPCNT |
245 | | #include <nmmintrin.h> // SSE4.2 |
246 | | #include <wmmintrin.h> // AES, PCLMUL |
247 | | |
248 | | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) |
249 | | #endif // defined(_M_X64) |
250 | | #endif // (#if-chain ref AVOID_CPU_ARCH_1) |
251 | | #endif // (#if-chain ref AVOID_CPU_ARCH_0) |
252 | | |
253 | | // -------- |
254 | | |
255 | | // Define WUFFS_CONFIG__STATIC_FUNCTIONS (combined with WUFFS_IMPLEMENTATION) |
256 | | // to make all of Wuffs' functions have static storage. |
257 | | // |
258 | | // This can help the compiler ignore or discard unused code, which can produce |
259 | | // faster compiles and smaller binaries. Other motivations are discussed in the |
260 | | // "ALLOW STATIC IMPLEMENTATION" section of |
261 | | // https://raw.githubusercontent.com/nothings/stb/master/docs/stb_howto.txt |
262 | | #if defined(WUFFS_CONFIG__STATIC_FUNCTIONS) |
263 | | #define WUFFS_BASE__MAYBE_STATIC static |
264 | | #else |
265 | | #define WUFFS_BASE__MAYBE_STATIC |
266 | | #endif // defined(WUFFS_CONFIG__STATIC_FUNCTIONS) |
267 | | |
268 | | // ---------------- CPU Architecture |
269 | | |
270 | | static inline bool // |
271 | 0 | wuffs_base__cpu_arch__have_arm_crc32(void) { |
272 | 0 | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__ARM_CRC32) |
273 | 0 | return true; |
274 | 0 | #else |
275 | 0 | return false; |
276 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__ARM_CRC32) |
277 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__cpu_arch__have_arm_crc32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__cpu_arch__have_arm_crc32() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__cpu_arch__have_arm_crc32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__cpu_arch__have_arm_crc32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__cpu_arch__have_arm_crc32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__cpu_arch__have_arm_crc32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__cpu_arch__have_arm_crc32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__cpu_arch__have_arm_crc32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__cpu_arch__have_arm_crc32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__cpu_arch__have_arm_crc32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__cpu_arch__have_arm_crc32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__cpu_arch__have_arm_crc32 |
278 | | |
279 | | static inline bool // |
280 | 0 | wuffs_base__cpu_arch__have_arm_neon(void) { |
281 | 0 | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__ARM_NEON) |
282 | 0 | return true; |
283 | 0 | #else |
284 | 0 | return false; |
285 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__ARM_NEON) |
286 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__cpu_arch__have_arm_neon Unexecuted instantiation: json_fuzzer.cc:wuffs_base__cpu_arch__have_arm_neon() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__cpu_arch__have_arm_neon Unexecuted instantiation: xz_fuzzer.c:wuffs_base__cpu_arch__have_arm_neon Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__cpu_arch__have_arm_neon Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__cpu_arch__have_arm_neon Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__cpu_arch__have_arm_neon Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__cpu_arch__have_arm_neon Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__cpu_arch__have_arm_neon Unexecuted instantiation: targa_fuzzer.c:wuffs_base__cpu_arch__have_arm_neon Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__cpu_arch__have_arm_neon Unexecuted instantiation: webp_fuzzer.c:wuffs_base__cpu_arch__have_arm_neon |
287 | | |
288 | | static inline bool // |
289 | 6.63k | wuffs_base__cpu_arch__have_x86_avx2(void) { |
290 | | #if defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) && \ |
291 | | defined(__AVX2__) |
292 | | return true; |
293 | | #else |
294 | 6.63k | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) |
295 | | // GCC defines these macros but MSVC does not. |
296 | | // - bit_AVX2 = (1 << 5) |
297 | 6.63k | const unsigned int avx2_ebx7 = 0x00000020; |
298 | | // GCC defines these macros but MSVC does not. |
299 | | // - bit_PCLMUL = (1 << 1) |
300 | | // - bit_POPCNT = (1 << 23) |
301 | | // - bit_SSE4_2 = (1 << 20) |
302 | 6.63k | const unsigned int avx2_ecx1 = 0x00900002; |
303 | | |
304 | | // clang defines __GNUC__ and clang-cl defines _MSC_VER (but not __GNUC__). |
305 | 6.63k | #if defined(__GNUC__) |
306 | 6.63k | unsigned int eax7 = 0; |
307 | 6.63k | unsigned int ebx7 = 0; |
308 | 6.63k | unsigned int ecx7 = 0; |
309 | 6.63k | unsigned int edx7 = 0; |
310 | 6.63k | if (__get_cpuid_count(7, 0, &eax7, &ebx7, &ecx7, &edx7) && |
311 | 6.63k | ((ebx7 & avx2_ebx7) == avx2_ebx7)) { |
312 | 6.63k | unsigned int eax1 = 0; |
313 | 6.63k | unsigned int ebx1 = 0; |
314 | 6.63k | unsigned int ecx1 = 0; |
315 | 6.63k | unsigned int edx1 = 0; |
316 | 6.63k | if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1) && |
317 | 6.63k | ((ecx1 & avx2_ecx1) == avx2_ecx1)) { |
318 | 6.63k | return true; |
319 | 6.63k | } |
320 | 6.63k | } |
321 | | #elif defined(_MSC_VER) // defined(__GNUC__) |
322 | | int x7[4]; |
323 | | __cpuidex(x7, 7, 0); |
324 | | if ((((unsigned int)(x7[1])) & avx2_ebx7) == avx2_ebx7) { |
325 | | int x1[4]; |
326 | | __cpuid(x1, 1); |
327 | | if ((((unsigned int)(x1[2])) & avx2_ecx1) == avx2_ecx1) { |
328 | | return true; |
329 | | } |
330 | | } |
331 | | #else |
332 | | #error "WUFFS_PRIVATE_IMPL__CPU_ARCH__ETC combined with an unsupported compiler" |
333 | | #endif // defined(__GNUC__); defined(_MSC_VER) |
334 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) |
335 | 0 | return false; |
336 | 6.63k | #endif // defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) && |
337 | | // defined(__AVX2__) |
338 | 6.63k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__cpu_arch__have_x86_avx2 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__cpu_arch__have_x86_avx2() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__cpu_arch__have_x86_avx2 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__cpu_arch__have_x86_avx2 jpeg_fuzzer.c:wuffs_base__cpu_arch__have_x86_avx2 Line | Count | Source | 289 | 4.04k | wuffs_base__cpu_arch__have_x86_avx2(void) { | 290 | | #if defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) && \ | 291 | | defined(__AVX2__) | 292 | | return true; | 293 | | #else | 294 | 4.04k | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 295 | | // GCC defines these macros but MSVC does not. | 296 | | // - bit_AVX2 = (1 << 5) | 297 | 4.04k | const unsigned int avx2_ebx7 = 0x00000020; | 298 | | // GCC defines these macros but MSVC does not. | 299 | | // - bit_PCLMUL = (1 << 1) | 300 | | // - bit_POPCNT = (1 << 23) | 301 | | // - bit_SSE4_2 = (1 << 20) | 302 | 4.04k | const unsigned int avx2_ecx1 = 0x00900002; | 303 | | | 304 | | // clang defines __GNUC__ and clang-cl defines _MSC_VER (but not __GNUC__). | 305 | 4.04k | #if defined(__GNUC__) | 306 | 4.04k | unsigned int eax7 = 0; | 307 | 4.04k | unsigned int ebx7 = 0; | 308 | 4.04k | unsigned int ecx7 = 0; | 309 | 4.04k | unsigned int edx7 = 0; | 310 | 4.04k | if (__get_cpuid_count(7, 0, &eax7, &ebx7, &ecx7, &edx7) && | 311 | 4.04k | ((ebx7 & avx2_ebx7) == avx2_ebx7)) { | 312 | 4.04k | unsigned int eax1 = 0; | 313 | 4.04k | unsigned int ebx1 = 0; | 314 | 4.04k | unsigned int ecx1 = 0; | 315 | 4.04k | unsigned int edx1 = 0; | 316 | 4.04k | if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1) && | 317 | 4.04k | ((ecx1 & avx2_ecx1) == avx2_ecx1)) { | 318 | 4.04k | return true; | 319 | 4.04k | } | 320 | 4.04k | } | 321 | | #elif defined(_MSC_VER) // defined(__GNUC__) | 322 | | int x7[4]; | 323 | | __cpuidex(x7, 7, 0); | 324 | | if ((((unsigned int)(x7[1])) & avx2_ebx7) == avx2_ebx7) { | 325 | | int x1[4]; | 326 | | __cpuid(x1, 1); | 327 | | if ((((unsigned int)(x1[2])) & avx2_ecx1) == avx2_ecx1) { | 328 | | return true; | 329 | | } | 330 | | } | 331 | | #else | 332 | | #error "WUFFS_PRIVATE_IMPL__CPU_ARCH__ETC combined with an unsupported compiler" | 333 | | #endif // defined(__GNUC__); defined(_MSC_VER) | 334 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 335 | 0 | return false; | 336 | 4.04k | #endif // defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) && | 337 | | // defined(__AVX2__) | 338 | 4.04k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__cpu_arch__have_x86_avx2 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__cpu_arch__have_x86_avx2 pixel_swizzler_fuzzer.c:wuffs_base__cpu_arch__have_x86_avx2 Line | Count | Source | 289 | 914 | wuffs_base__cpu_arch__have_x86_avx2(void) { | 290 | | #if defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) && \ | 291 | | defined(__AVX2__) | 292 | | return true; | 293 | | #else | 294 | 914 | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 295 | | // GCC defines these macros but MSVC does not. | 296 | | // - bit_AVX2 = (1 << 5) | 297 | 914 | const unsigned int avx2_ebx7 = 0x00000020; | 298 | | // GCC defines these macros but MSVC does not. | 299 | | // - bit_PCLMUL = (1 << 1) | 300 | | // - bit_POPCNT = (1 << 23) | 301 | | // - bit_SSE4_2 = (1 << 20) | 302 | 914 | const unsigned int avx2_ecx1 = 0x00900002; | 303 | | | 304 | | // clang defines __GNUC__ and clang-cl defines _MSC_VER (but not __GNUC__). | 305 | 914 | #if defined(__GNUC__) | 306 | 914 | unsigned int eax7 = 0; | 307 | 914 | unsigned int ebx7 = 0; | 308 | 914 | unsigned int ecx7 = 0; | 309 | 914 | unsigned int edx7 = 0; | 310 | 914 | if (__get_cpuid_count(7, 0, &eax7, &ebx7, &ecx7, &edx7) && | 311 | 914 | ((ebx7 & avx2_ebx7) == avx2_ebx7)) { | 312 | 914 | unsigned int eax1 = 0; | 313 | 914 | unsigned int ebx1 = 0; | 314 | 914 | unsigned int ecx1 = 0; | 315 | 914 | unsigned int edx1 = 0; | 316 | 914 | if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1) && | 317 | 914 | ((ecx1 & avx2_ecx1) == avx2_ecx1)) { | 318 | 914 | return true; | 319 | 914 | } | 320 | 914 | } | 321 | | #elif defined(_MSC_VER) // defined(__GNUC__) | 322 | | int x7[4]; | 323 | | __cpuidex(x7, 7, 0); | 324 | | if ((((unsigned int)(x7[1])) & avx2_ebx7) == avx2_ebx7) { | 325 | | int x1[4]; | 326 | | __cpuid(x1, 1); | 327 | | if ((((unsigned int)(x1[2])) & avx2_ecx1) == avx2_ecx1) { | 328 | | return true; | 329 | | } | 330 | | } | 331 | | #else | 332 | | #error "WUFFS_PRIVATE_IMPL__CPU_ARCH__ETC combined with an unsupported compiler" | 333 | | #endif // defined(__GNUC__); defined(_MSC_VER) | 334 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 335 | 0 | return false; | 336 | 914 | #endif // defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) && | 337 | | // defined(__AVX2__) | 338 | 914 | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__cpu_arch__have_x86_avx2 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__cpu_arch__have_x86_avx2 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__cpu_arch__have_x86_avx2 webp_fuzzer.c:wuffs_base__cpu_arch__have_x86_avx2 Line | Count | Source | 289 | 1.67k | wuffs_base__cpu_arch__have_x86_avx2(void) { | 290 | | #if defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) && \ | 291 | | defined(__AVX2__) | 292 | | return true; | 293 | | #else | 294 | 1.67k | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 295 | | // GCC defines these macros but MSVC does not. | 296 | | // - bit_AVX2 = (1 << 5) | 297 | 1.67k | const unsigned int avx2_ebx7 = 0x00000020; | 298 | | // GCC defines these macros but MSVC does not. | 299 | | // - bit_PCLMUL = (1 << 1) | 300 | | // - bit_POPCNT = (1 << 23) | 301 | | // - bit_SSE4_2 = (1 << 20) | 302 | 1.67k | const unsigned int avx2_ecx1 = 0x00900002; | 303 | | | 304 | | // clang defines __GNUC__ and clang-cl defines _MSC_VER (but not __GNUC__). | 305 | 1.67k | #if defined(__GNUC__) | 306 | 1.67k | unsigned int eax7 = 0; | 307 | 1.67k | unsigned int ebx7 = 0; | 308 | 1.67k | unsigned int ecx7 = 0; | 309 | 1.67k | unsigned int edx7 = 0; | 310 | 1.67k | if (__get_cpuid_count(7, 0, &eax7, &ebx7, &ecx7, &edx7) && | 311 | 1.67k | ((ebx7 & avx2_ebx7) == avx2_ebx7)) { | 312 | 1.67k | unsigned int eax1 = 0; | 313 | 1.67k | unsigned int ebx1 = 0; | 314 | 1.67k | unsigned int ecx1 = 0; | 315 | 1.67k | unsigned int edx1 = 0; | 316 | 1.67k | if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1) && | 317 | 1.67k | ((ecx1 & avx2_ecx1) == avx2_ecx1)) { | 318 | 1.67k | return true; | 319 | 1.67k | } | 320 | 1.67k | } | 321 | | #elif defined(_MSC_VER) // defined(__GNUC__) | 322 | | int x7[4]; | 323 | | __cpuidex(x7, 7, 0); | 324 | | if ((((unsigned int)(x7[1])) & avx2_ebx7) == avx2_ebx7) { | 325 | | int x1[4]; | 326 | | __cpuid(x1, 1); | 327 | | if ((((unsigned int)(x1[2])) & avx2_ecx1) == avx2_ecx1) { | 328 | | return true; | 329 | | } | 330 | | } | 331 | | #else | 332 | | #error "WUFFS_PRIVATE_IMPL__CPU_ARCH__ETC combined with an unsupported compiler" | 333 | | #endif // defined(__GNUC__); defined(_MSC_VER) | 334 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 335 | 0 | return false; | 336 | 1.67k | #endif // defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) && | 337 | | // defined(__AVX2__) | 338 | 1.67k | } |
|
339 | | |
340 | | static inline bool // |
341 | 6.86k | wuffs_base__cpu_arch__have_x86_bmi2(void) { |
342 | | #if defined(__BMI2__) |
343 | | return true; |
344 | | #else |
345 | 6.86k | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) |
346 | | // GCC defines these macros but MSVC does not. |
347 | | // - bit_BMI2 = (1 << 8) |
348 | 6.86k | const unsigned int bmi2_ebx7 = 0x00000100; |
349 | | |
350 | | // clang defines __GNUC__ and clang-cl defines _MSC_VER (but not __GNUC__). |
351 | 6.86k | #if defined(__GNUC__) |
352 | 6.86k | unsigned int eax7 = 0; |
353 | 6.86k | unsigned int ebx7 = 0; |
354 | 6.86k | unsigned int ecx7 = 0; |
355 | 6.86k | unsigned int edx7 = 0; |
356 | 6.86k | if (__get_cpuid_count(7, 0, &eax7, &ebx7, &ecx7, &edx7) && |
357 | 6.86k | ((ebx7 & bmi2_ebx7) == bmi2_ebx7)) { |
358 | 6.86k | return true; |
359 | 6.86k | } |
360 | | #elif defined(_MSC_VER) // defined(__GNUC__) |
361 | | int x7[4]; |
362 | | __cpuidex(x7, 7, 0); |
363 | | if ((((unsigned int)(x7[1])) & bmi2_ebx7) == bmi2_ebx7) { |
364 | | return true; |
365 | | } |
366 | | #else |
367 | | #error "WUFFS_PRIVATE_IMPL__CPU_ARCH__ETC combined with an unsupported compiler" |
368 | | #endif // defined(__GNUC__); defined(_MSC_VER) |
369 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) |
370 | 0 | return false; |
371 | 6.86k | #endif // defined(__BMI2__) |
372 | 6.86k | } png_fuzzer.c:wuffs_base__cpu_arch__have_x86_bmi2 Line | Count | Source | 341 | 5.54k | wuffs_base__cpu_arch__have_x86_bmi2(void) { | 342 | | #if defined(__BMI2__) | 343 | | return true; | 344 | | #else | 345 | 5.54k | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 346 | | // GCC defines these macros but MSVC does not. | 347 | | // - bit_BMI2 = (1 << 8) | 348 | 5.54k | const unsigned int bmi2_ebx7 = 0x00000100; | 349 | | | 350 | | // clang defines __GNUC__ and clang-cl defines _MSC_VER (but not __GNUC__). | 351 | 5.54k | #if defined(__GNUC__) | 352 | 5.54k | unsigned int eax7 = 0; | 353 | 5.54k | unsigned int ebx7 = 0; | 354 | 5.54k | unsigned int ecx7 = 0; | 355 | 5.54k | unsigned int edx7 = 0; | 356 | 5.54k | if (__get_cpuid_count(7, 0, &eax7, &ebx7, &ecx7, &edx7) && | 357 | 5.54k | ((ebx7 & bmi2_ebx7) == bmi2_ebx7)) { | 358 | 5.54k | return true; | 359 | 5.54k | } | 360 | | #elif defined(_MSC_VER) // defined(__GNUC__) | 361 | | int x7[4]; | 362 | | __cpuidex(x7, 7, 0); | 363 | | if ((((unsigned int)(x7[1])) & bmi2_ebx7) == bmi2_ebx7) { | 364 | | return true; | 365 | | } | 366 | | #else | 367 | | #error "WUFFS_PRIVATE_IMPL__CPU_ARCH__ETC combined with an unsupported compiler" | 368 | | #endif // defined(__GNUC__); defined(_MSC_VER) | 369 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 370 | 0 | return false; | 371 | 5.54k | #endif // defined(__BMI2__) | 372 | 5.54k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__cpu_arch__have_x86_bmi2() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__cpu_arch__have_x86_bmi2 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__cpu_arch__have_x86_bmi2 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__cpu_arch__have_x86_bmi2 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__cpu_arch__have_x86_bmi2 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__cpu_arch__have_x86_bmi2 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__cpu_arch__have_x86_bmi2 zlib_fuzzer.c:wuffs_base__cpu_arch__have_x86_bmi2 Line | Count | Source | 341 | 1.31k | wuffs_base__cpu_arch__have_x86_bmi2(void) { | 342 | | #if defined(__BMI2__) | 343 | | return true; | 344 | | #else | 345 | 1.31k | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 346 | | // GCC defines these macros but MSVC does not. | 347 | | // - bit_BMI2 = (1 << 8) | 348 | 1.31k | const unsigned int bmi2_ebx7 = 0x00000100; | 349 | | | 350 | | // clang defines __GNUC__ and clang-cl defines _MSC_VER (but not __GNUC__). | 351 | 1.31k | #if defined(__GNUC__) | 352 | 1.31k | unsigned int eax7 = 0; | 353 | 1.31k | unsigned int ebx7 = 0; | 354 | 1.31k | unsigned int ecx7 = 0; | 355 | 1.31k | unsigned int edx7 = 0; | 356 | 1.31k | if (__get_cpuid_count(7, 0, &eax7, &ebx7, &ecx7, &edx7) && | 357 | 1.31k | ((ebx7 & bmi2_ebx7) == bmi2_ebx7)) { | 358 | 1.31k | return true; | 359 | 1.31k | } | 360 | | #elif defined(_MSC_VER) // defined(__GNUC__) | 361 | | int x7[4]; | 362 | | __cpuidex(x7, 7, 0); | 363 | | if ((((unsigned int)(x7[1])) & bmi2_ebx7) == bmi2_ebx7) { | 364 | | return true; | 365 | | } | 366 | | #else | 367 | | #error "WUFFS_PRIVATE_IMPL__CPU_ARCH__ETC combined with an unsupported compiler" | 368 | | #endif // defined(__GNUC__); defined(_MSC_VER) | 369 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 370 | 0 | return false; | 371 | 1.31k | #endif // defined(__BMI2__) | 372 | 1.31k | } |
Unexecuted instantiation: targa_fuzzer.c:wuffs_base__cpu_arch__have_x86_bmi2 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__cpu_arch__have_x86_bmi2 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__cpu_arch__have_x86_bmi2 |
373 | | |
374 | | static inline bool // |
375 | 39.7k | wuffs_base__cpu_arch__have_x86_sse42(void) { |
376 | | #if defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) |
377 | | return true; |
378 | | #else |
379 | 39.7k | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) |
380 | | // GCC defines these macros but MSVC does not. |
381 | | // - bit_PCLMUL = (1 << 1) |
382 | | // - bit_POPCNT = (1 << 23) |
383 | | // - bit_SSE4_2 = (1 << 20) |
384 | 39.7k | const unsigned int sse42_ecx1 = 0x00900002; |
385 | | |
386 | | // clang defines __GNUC__ and clang-cl defines _MSC_VER (but not __GNUC__). |
387 | 39.7k | #if defined(__GNUC__) |
388 | 39.7k | unsigned int eax1 = 0; |
389 | 39.7k | unsigned int ebx1 = 0; |
390 | 39.7k | unsigned int ecx1 = 0; |
391 | 39.7k | unsigned int edx1 = 0; |
392 | 39.7k | if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1) && |
393 | 39.7k | ((ecx1 & sse42_ecx1) == sse42_ecx1)) { |
394 | 39.7k | return true; |
395 | 39.7k | } |
396 | | #elif defined(_MSC_VER) // defined(__GNUC__) |
397 | | int x1[4]; |
398 | | __cpuid(x1, 1); |
399 | | if ((((unsigned int)(x1[2])) & sse42_ecx1) == sse42_ecx1) { |
400 | | return true; |
401 | | } |
402 | | #else |
403 | | #error "WUFFS_PRIVATE_IMPL__CPU_ARCH__ETC combined with an unsupported compiler" |
404 | | #endif // defined(__GNUC__); defined(_MSC_VER) |
405 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) |
406 | 0 | return false; |
407 | 39.7k | #endif // defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) |
408 | 39.7k | } png_fuzzer.c:wuffs_base__cpu_arch__have_x86_sse42 Line | Count | Source | 375 | 34.3k | wuffs_base__cpu_arch__have_x86_sse42(void) { | 376 | | #if defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) | 377 | | return true; | 378 | | #else | 379 | 34.3k | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 380 | | // GCC defines these macros but MSVC does not. | 381 | | // - bit_PCLMUL = (1 << 1) | 382 | | // - bit_POPCNT = (1 << 23) | 383 | | // - bit_SSE4_2 = (1 << 20) | 384 | 34.3k | const unsigned int sse42_ecx1 = 0x00900002; | 385 | | | 386 | | // clang defines __GNUC__ and clang-cl defines _MSC_VER (but not __GNUC__). | 387 | 34.3k | #if defined(__GNUC__) | 388 | 34.3k | unsigned int eax1 = 0; | 389 | 34.3k | unsigned int ebx1 = 0; | 390 | 34.3k | unsigned int ecx1 = 0; | 391 | 34.3k | unsigned int edx1 = 0; | 392 | 34.3k | if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1) && | 393 | 34.3k | ((ecx1 & sse42_ecx1) == sse42_ecx1)) { | 394 | 34.3k | return true; | 395 | 34.3k | } | 396 | | #elif defined(_MSC_VER) // defined(__GNUC__) | 397 | | int x1[4]; | 398 | | __cpuid(x1, 1); | 399 | | if ((((unsigned int)(x1[2])) & sse42_ecx1) == sse42_ecx1) { | 400 | | return true; | 401 | | } | 402 | | #else | 403 | | #error "WUFFS_PRIVATE_IMPL__CPU_ARCH__ETC combined with an unsupported compiler" | 404 | | #endif // defined(__GNUC__); defined(_MSC_VER) | 405 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 406 | 0 | return false; | 407 | 34.3k | #endif // defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) | 408 | 34.3k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__cpu_arch__have_x86_sse42() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__cpu_arch__have_x86_sse42 xz_fuzzer.c:wuffs_base__cpu_arch__have_x86_sse42 Line | Count | Source | 375 | 3.76k | wuffs_base__cpu_arch__have_x86_sse42(void) { | 376 | | #if defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) | 377 | | return true; | 378 | | #else | 379 | 3.76k | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 380 | | // GCC defines these macros but MSVC does not. | 381 | | // - bit_PCLMUL = (1 << 1) | 382 | | // - bit_POPCNT = (1 << 23) | 383 | | // - bit_SSE4_2 = (1 << 20) | 384 | 3.76k | const unsigned int sse42_ecx1 = 0x00900002; | 385 | | | 386 | | // clang defines __GNUC__ and clang-cl defines _MSC_VER (but not __GNUC__). | 387 | 3.76k | #if defined(__GNUC__) | 388 | 3.76k | unsigned int eax1 = 0; | 389 | 3.76k | unsigned int ebx1 = 0; | 390 | 3.76k | unsigned int ecx1 = 0; | 391 | 3.76k | unsigned int edx1 = 0; | 392 | 3.76k | if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1) && | 393 | 3.76k | ((ecx1 & sse42_ecx1) == sse42_ecx1)) { | 394 | 3.76k | return true; | 395 | 3.76k | } | 396 | | #elif defined(_MSC_VER) // defined(__GNUC__) | 397 | | int x1[4]; | 398 | | __cpuid(x1, 1); | 399 | | if ((((unsigned int)(x1[2])) & sse42_ecx1) == sse42_ecx1) { | 400 | | return true; | 401 | | } | 402 | | #else | 403 | | #error "WUFFS_PRIVATE_IMPL__CPU_ARCH__ETC combined with an unsupported compiler" | 404 | | #endif // defined(__GNUC__); defined(_MSC_VER) | 405 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 406 | 0 | return false; | 407 | 3.76k | #endif // defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) | 408 | 3.76k | } |
jpeg_fuzzer.c:wuffs_base__cpu_arch__have_x86_sse42 Line | Count | Source | 375 | 1.01k | wuffs_base__cpu_arch__have_x86_sse42(void) { | 376 | | #if defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) | 377 | | return true; | 378 | | #else | 379 | 1.01k | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 380 | | // GCC defines these macros but MSVC does not. | 381 | | // - bit_PCLMUL = (1 << 1) | 382 | | // - bit_POPCNT = (1 << 23) | 383 | | // - bit_SSE4_2 = (1 << 20) | 384 | 1.01k | const unsigned int sse42_ecx1 = 0x00900002; | 385 | | | 386 | | // clang defines __GNUC__ and clang-cl defines _MSC_VER (but not __GNUC__). | 387 | 1.01k | #if defined(__GNUC__) | 388 | 1.01k | unsigned int eax1 = 0; | 389 | 1.01k | unsigned int ebx1 = 0; | 390 | 1.01k | unsigned int ecx1 = 0; | 391 | 1.01k | unsigned int edx1 = 0; | 392 | 1.01k | if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1) && | 393 | 1.01k | ((ecx1 & sse42_ecx1) == sse42_ecx1)) { | 394 | 1.01k | return true; | 395 | 1.01k | } | 396 | | #elif defined(_MSC_VER) // defined(__GNUC__) | 397 | | int x1[4]; | 398 | | __cpuid(x1, 1); | 399 | | if ((((unsigned int)(x1[2])) & sse42_ecx1) == sse42_ecx1) { | 400 | | return true; | 401 | | } | 402 | | #else | 403 | | #error "WUFFS_PRIVATE_IMPL__CPU_ARCH__ETC combined with an unsupported compiler" | 404 | | #endif // defined(__GNUC__); defined(_MSC_VER) | 405 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 406 | 0 | return false; | 407 | 1.01k | #endif // defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) | 408 | 1.01k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__cpu_arch__have_x86_sse42 bmp_fuzzer.c:wuffs_base__cpu_arch__have_x86_sse42 Line | Count | Source | 375 | 108 | wuffs_base__cpu_arch__have_x86_sse42(void) { | 376 | | #if defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) | 377 | | return true; | 378 | | #else | 379 | 108 | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 380 | | // GCC defines these macros but MSVC does not. | 381 | | // - bit_PCLMUL = (1 << 1) | 382 | | // - bit_POPCNT = (1 << 23) | 383 | | // - bit_SSE4_2 = (1 << 20) | 384 | 108 | const unsigned int sse42_ecx1 = 0x00900002; | 385 | | | 386 | | // clang defines __GNUC__ and clang-cl defines _MSC_VER (but not __GNUC__). | 387 | 108 | #if defined(__GNUC__) | 388 | 108 | unsigned int eax1 = 0; | 389 | 108 | unsigned int ebx1 = 0; | 390 | 108 | unsigned int ecx1 = 0; | 391 | 108 | unsigned int edx1 = 0; | 392 | 108 | if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1) && | 393 | 108 | ((ecx1 & sse42_ecx1) == sse42_ecx1)) { | 394 | 108 | return true; | 395 | 108 | } | 396 | | #elif defined(_MSC_VER) // defined(__GNUC__) | 397 | | int x1[4]; | 398 | | __cpuid(x1, 1); | 399 | | if ((((unsigned int)(x1[2])) & sse42_ecx1) == sse42_ecx1) { | 400 | | return true; | 401 | | } | 402 | | #else | 403 | | #error "WUFFS_PRIVATE_IMPL__CPU_ARCH__ETC combined with an unsupported compiler" | 404 | | #endif // defined(__GNUC__); defined(_MSC_VER) | 405 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 406 | 0 | return false; | 407 | 108 | #endif // defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) | 408 | 108 | } |
pixel_swizzler_fuzzer.c:wuffs_base__cpu_arch__have_x86_sse42 Line | Count | Source | 375 | 128 | wuffs_base__cpu_arch__have_x86_sse42(void) { | 376 | | #if defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) | 377 | | return true; | 378 | | #else | 379 | 128 | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 380 | | // GCC defines these macros but MSVC does not. | 381 | | // - bit_PCLMUL = (1 << 1) | 382 | | // - bit_POPCNT = (1 << 23) | 383 | | // - bit_SSE4_2 = (1 << 20) | 384 | 128 | const unsigned int sse42_ecx1 = 0x00900002; | 385 | | | 386 | | // clang defines __GNUC__ and clang-cl defines _MSC_VER (but not __GNUC__). | 387 | 128 | #if defined(__GNUC__) | 388 | 128 | unsigned int eax1 = 0; | 389 | 128 | unsigned int ebx1 = 0; | 390 | 128 | unsigned int ecx1 = 0; | 391 | 128 | unsigned int edx1 = 0; | 392 | 128 | if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1) && | 393 | 128 | ((ecx1 & sse42_ecx1) == sse42_ecx1)) { | 394 | 128 | return true; | 395 | 128 | } | 396 | | #elif defined(_MSC_VER) // defined(__GNUC__) | 397 | | int x1[4]; | 398 | | __cpuid(x1, 1); | 399 | | if ((((unsigned int)(x1[2])) & sse42_ecx1) == sse42_ecx1) { | 400 | | return true; | 401 | | } | 402 | | #else | 403 | | #error "WUFFS_PRIVATE_IMPL__CPU_ARCH__ETC combined with an unsupported compiler" | 404 | | #endif // defined(__GNUC__); defined(_MSC_VER) | 405 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 406 | 0 | return false; | 407 | 128 | #endif // defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) | 408 | 128 | } |
zlib_fuzzer.c:wuffs_base__cpu_arch__have_x86_sse42 Line | Count | Source | 375 | 148 | wuffs_base__cpu_arch__have_x86_sse42(void) { | 376 | | #if defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) | 377 | | return true; | 378 | | #else | 379 | 148 | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 380 | | // GCC defines these macros but MSVC does not. | 381 | | // - bit_PCLMUL = (1 << 1) | 382 | | // - bit_POPCNT = (1 << 23) | 383 | | // - bit_SSE4_2 = (1 << 20) | 384 | 148 | const unsigned int sse42_ecx1 = 0x00900002; | 385 | | | 386 | | // clang defines __GNUC__ and clang-cl defines _MSC_VER (but not __GNUC__). | 387 | 148 | #if defined(__GNUC__) | 388 | 148 | unsigned int eax1 = 0; | 389 | 148 | unsigned int ebx1 = 0; | 390 | 148 | unsigned int ecx1 = 0; | 391 | 148 | unsigned int edx1 = 0; | 392 | 148 | if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1) && | 393 | 148 | ((ecx1 & sse42_ecx1) == sse42_ecx1)) { | 394 | 148 | return true; | 395 | 148 | } | 396 | | #elif defined(_MSC_VER) // defined(__GNUC__) | 397 | | int x1[4]; | 398 | | __cpuid(x1, 1); | 399 | | if ((((unsigned int)(x1[2])) & sse42_ecx1) == sse42_ecx1) { | 400 | | return true; | 401 | | } | 402 | | #else | 403 | | #error "WUFFS_PRIVATE_IMPL__CPU_ARCH__ETC combined with an unsupported compiler" | 404 | | #endif // defined(__GNUC__); defined(_MSC_VER) | 405 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 406 | 0 | return false; | 407 | 148 | #endif // defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) | 408 | 148 | } |
targa_fuzzer.c:wuffs_base__cpu_arch__have_x86_sse42 Line | Count | Source | 375 | 213 | wuffs_base__cpu_arch__have_x86_sse42(void) { | 376 | | #if defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) | 377 | | return true; | 378 | | #else | 379 | 213 | #if defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 380 | | // GCC defines these macros but MSVC does not. | 381 | | // - bit_PCLMUL = (1 << 1) | 382 | | // - bit_POPCNT = (1 << 23) | 383 | | // - bit_SSE4_2 = (1 << 20) | 384 | 213 | const unsigned int sse42_ecx1 = 0x00900002; | 385 | | | 386 | | // clang defines __GNUC__ and clang-cl defines _MSC_VER (but not __GNUC__). | 387 | 213 | #if defined(__GNUC__) | 388 | 213 | unsigned int eax1 = 0; | 389 | 213 | unsigned int ebx1 = 0; | 390 | 213 | unsigned int ecx1 = 0; | 391 | 213 | unsigned int edx1 = 0; | 392 | 213 | if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1) && | 393 | 213 | ((ecx1 & sse42_ecx1) == sse42_ecx1)) { | 394 | 213 | return true; | 395 | 213 | } | 396 | | #elif defined(_MSC_VER) // defined(__GNUC__) | 397 | | int x1[4]; | 398 | | __cpuid(x1, 1); | 399 | | if ((((unsigned int)(x1[2])) & sse42_ecx1) == sse42_ecx1) { | 400 | | return true; | 401 | | } | 402 | | #else | 403 | | #error "WUFFS_PRIVATE_IMPL__CPU_ARCH__ETC combined with an unsupported compiler" | 404 | | #endif // defined(__GNUC__); defined(_MSC_VER) | 405 | 0 | #endif // defined(WUFFS_PRIVATE_IMPL__CPU_ARCH__X86_64) | 406 | 0 | return false; | 407 | 213 | #endif // defined(__PCLMUL__) && defined(__POPCNT__) && defined(__SSE4_2__) | 408 | 213 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__cpu_arch__have_x86_sse42 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__cpu_arch__have_x86_sse42 |
409 | | |
410 | | // ---------------- Fundamentals |
411 | | |
412 | | // Wuffs assumes that: |
413 | | // - converting a uint32_t to a size_t will never overflow. |
414 | | // - converting a size_t to a uint64_t will never overflow. |
415 | | #if defined(__WORDSIZE) |
416 | | #if (__WORDSIZE != 32) && (__WORDSIZE != 64) |
417 | | #error "Wuffs requires a word size of either 32 or 64 bits" |
418 | | #endif |
419 | | #endif |
420 | | |
421 | | // The "defined(__clang__)" isn't redundant. While vanilla clang defines |
422 | | // __GNUC__, clang-cl (which mimics MSVC's cl.exe) does not. |
423 | | #if defined(__GNUC__) || defined(__clang__) |
424 | | #define WUFFS_BASE__FORCE_INLINE __attribute__((__always_inline__)) |
425 | | #define WUFFS_BASE__POTENTIALLY_UNUSED __attribute__((unused)) |
426 | | #define WUFFS_BASE__WARN_UNUSED_RESULT __attribute__((warn_unused_result)) |
427 | | #elif defined(_MSC_VER) |
428 | | #define WUFFS_BASE__FORCE_INLINE __forceinline |
429 | | #define WUFFS_BASE__POTENTIALLY_UNUSED |
430 | | #define WUFFS_BASE__WARN_UNUSED_RESULT |
431 | | #else |
432 | | #define WUFFS_BASE__FORCE_INLINE |
433 | | #define WUFFS_BASE__POTENTIALLY_UNUSED |
434 | | #define WUFFS_BASE__WARN_UNUSED_RESULT |
435 | | #endif |
436 | | |
437 | | // Clang's "-fsanitize=integer" checks for "unsigned-integer-overflow" even |
438 | | // though, for *unsigned* integers, it is *not* undefined behavior. The check |
439 | | // is still made because unsigned integer overflow "is often unintentional". |
440 | | // https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html |
441 | | // |
442 | | // However, for Wuffs' generated C code, unsigned overflow is intentional. The |
443 | | // programmer has to use "~mod+" instead of a plain "+" operator in Wuffs code. |
444 | | // Further runtime checks for unsigned integer overflow can add performance |
445 | | // overhead (fuzzers can then time out) and can raise false negatives, without |
446 | | // generating much benefits. We disable the "unsigned-integer-overflow" check. |
447 | | #if defined(__has_feature) |
448 | | #if __has_feature(undefined_behavior_sanitizer) |
449 | | #define WUFFS_BASE__GENERATED_C_CODE \ |
450 | | __attribute__((no_sanitize("unsigned-integer-overflow"))) |
451 | | #endif |
452 | | #endif |
453 | | #if !defined(WUFFS_BASE__GENERATED_C_CODE) |
454 | | #define WUFFS_BASE__GENERATED_C_CODE |
455 | | #endif |
456 | | |
457 | | // -------- |
458 | | |
459 | | // Options (bitwise or'ed together) for wuffs_foo__bar__initialize functions. |
460 | | |
461 | | #define WUFFS_INITIALIZE__DEFAULT_OPTIONS ((uint32_t)0x00000000) |
462 | | |
463 | | // WUFFS_INITIALIZE__ALREADY_ZEROED means that the "self" receiver struct value |
464 | | // has already been set to all zeroes. |
465 | 204k | #define WUFFS_INITIALIZE__ALREADY_ZEROED ((uint32_t)0x00000001) |
466 | | |
467 | | // WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED means that, absent |
468 | | // WUFFS_INITIALIZE__ALREADY_ZEROED, only some of the "self" receiver struct |
469 | | // value will be set to all zeroes. Internal buffers, which tend to be a large |
470 | | // proportion of the struct's size, will be left uninitialized. Internal means |
471 | | // that the buffer is contained by the receiver struct, as opposed to being |
472 | | // passed as a separately allocated "work buffer". |
473 | | // |
474 | | // For more detail, see: |
475 | | // https://github.com/google/wuffs/blob/main/doc/note/initialization.md |
476 | | #define WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED \ |
477 | 279k | ((uint32_t)0x00000002) |
478 | | |
479 | | // -------- |
480 | | |
481 | | #ifdef __cplusplus |
482 | | // Wuffs structs are just data, not resources (in the RAII sense). They don't |
483 | | // subclass anything. They don't have virtual destructors. They don't contain |
484 | | // pointers to dynamically allocated memory. They don't contain file |
485 | | // descriptors. And so on. Destroying such a struct (e.g. via a |
486 | | // wuffs_foo__bar::unique_ptr) can just call free, especially as |
487 | | // sizeof(wuffs_foo__bar) isn't supposed to be part of the public (stable) API. |
488 | | struct wuffs_unique_ptr_deleter { |
489 | 6.11k | void operator()(void* p) { free(p); } |
490 | | }; |
491 | | #endif // __cplusplus |
492 | | |
493 | | // -------- |
494 | | |
495 | | #if defined(__GNUC__) |
496 | | #pragma GCC diagnostic push |
497 | | #pragma GCC diagnostic ignored "-Wcast-qual" |
498 | | #endif |
499 | | |
500 | | static inline uint8_t* // |
501 | 2.89k | wuffs_base__strip_const_from_u8_ptr(const uint8_t* ptr) { |
502 | 2.89k | return (uint8_t*)ptr; |
503 | 2.89k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__strip_const_from_u8_ptr Unexecuted instantiation: json_fuzzer.cc:wuffs_base__strip_const_from_u8_ptr(unsigned char const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__strip_const_from_u8_ptr xz_fuzzer.c:wuffs_base__strip_const_from_u8_ptr Line | Count | Source | 501 | 104 | wuffs_base__strip_const_from_u8_ptr(const uint8_t* ptr) { | 502 | 104 | return (uint8_t*)ptr; | 503 | 104 | } |
jpeg_fuzzer.c:wuffs_base__strip_const_from_u8_ptr Line | Count | Source | 501 | 2.79k | wuffs_base__strip_const_from_u8_ptr(const uint8_t* ptr) { | 502 | 2.79k | return (uint8_t*)ptr; | 503 | 2.79k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__strip_const_from_u8_ptr Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__strip_const_from_u8_ptr Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__strip_const_from_u8_ptr Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__strip_const_from_u8_ptr Unexecuted instantiation: targa_fuzzer.c:wuffs_base__strip_const_from_u8_ptr Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__strip_const_from_u8_ptr Unexecuted instantiation: webp_fuzzer.c:wuffs_base__strip_const_from_u8_ptr |
504 | | |
505 | | static inline uint16_t* // |
506 | 0 | wuffs_base__strip_const_from_u16_ptr(const uint16_t* ptr) { |
507 | 0 | return (uint16_t*)ptr; |
508 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__strip_const_from_u16_ptr Unexecuted instantiation: json_fuzzer.cc:wuffs_base__strip_const_from_u16_ptr(unsigned short const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__strip_const_from_u16_ptr Unexecuted instantiation: xz_fuzzer.c:wuffs_base__strip_const_from_u16_ptr Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__strip_const_from_u16_ptr Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__strip_const_from_u16_ptr Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__strip_const_from_u16_ptr Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__strip_const_from_u16_ptr Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__strip_const_from_u16_ptr Unexecuted instantiation: targa_fuzzer.c:wuffs_base__strip_const_from_u16_ptr Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__strip_const_from_u16_ptr Unexecuted instantiation: webp_fuzzer.c:wuffs_base__strip_const_from_u16_ptr |
509 | | |
510 | | static inline uint32_t* // |
511 | 0 | wuffs_base__strip_const_from_u32_ptr(const uint32_t* ptr) { |
512 | 0 | return (uint32_t*)ptr; |
513 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__strip_const_from_u32_ptr Unexecuted instantiation: json_fuzzer.cc:wuffs_base__strip_const_from_u32_ptr(unsigned int const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__strip_const_from_u32_ptr Unexecuted instantiation: xz_fuzzer.c:wuffs_base__strip_const_from_u32_ptr Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__strip_const_from_u32_ptr Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__strip_const_from_u32_ptr Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__strip_const_from_u32_ptr Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__strip_const_from_u32_ptr Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__strip_const_from_u32_ptr Unexecuted instantiation: targa_fuzzer.c:wuffs_base__strip_const_from_u32_ptr Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__strip_const_from_u32_ptr Unexecuted instantiation: webp_fuzzer.c:wuffs_base__strip_const_from_u32_ptr |
514 | | |
515 | | static inline uint64_t* // |
516 | 0 | wuffs_base__strip_const_from_u64_ptr(const uint64_t* ptr) { |
517 | 0 | return (uint64_t*)ptr; |
518 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__strip_const_from_u64_ptr Unexecuted instantiation: json_fuzzer.cc:wuffs_base__strip_const_from_u64_ptr(unsigned long const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__strip_const_from_u64_ptr Unexecuted instantiation: xz_fuzzer.c:wuffs_base__strip_const_from_u64_ptr Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__strip_const_from_u64_ptr Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__strip_const_from_u64_ptr Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__strip_const_from_u64_ptr Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__strip_const_from_u64_ptr Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__strip_const_from_u64_ptr Unexecuted instantiation: targa_fuzzer.c:wuffs_base__strip_const_from_u64_ptr Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__strip_const_from_u64_ptr Unexecuted instantiation: webp_fuzzer.c:wuffs_base__strip_const_from_u64_ptr |
519 | | |
520 | | #if defined(__GNUC__) |
521 | | #pragma GCC diagnostic pop |
522 | | #endif |
523 | | |
524 | | // -------- |
525 | | |
526 | | // wuffs_base__empty_struct is used when a Wuffs function returns an empty |
527 | | // struct. In C, if a function f returns void, you can't say "x = f()", but in |
528 | | // Wuffs, if a function g returns empty, you can say "y = g()". |
529 | | typedef struct wuffs_base__empty_struct__struct { |
530 | | // private_impl is a placeholder field. It isn't explicitly used, except that |
531 | | // without it, the sizeof a struct with no fields can differ across C/C++ |
532 | | // compilers, and it is undefined behavior in C99. For example, gcc says that |
533 | | // the sizeof an empty struct is 0, and g++ says that it is 1. This leads to |
534 | | // ABI incompatibility if a Wuffs .c file is processed by one compiler and |
535 | | // its .h file with another compiler. |
536 | | // |
537 | | // Instead, we explicitly insert an otherwise unused field, so that the |
538 | | // sizeof this struct is always 1. |
539 | | uint8_t private_impl; |
540 | | } wuffs_base__empty_struct; |
541 | | |
542 | | static inline wuffs_base__empty_struct // |
543 | 1.82G | wuffs_base__make_empty_struct(void) { |
544 | 1.82G | wuffs_base__empty_struct ret; |
545 | 1.82G | ret.private_impl = 0; |
546 | 1.82G | return ret; |
547 | 1.82G | } png_fuzzer.c:wuffs_base__make_empty_struct Line | Count | Source | 543 | 1.25M | wuffs_base__make_empty_struct(void) { | 544 | 1.25M | wuffs_base__empty_struct ret; | 545 | 1.25M | ret.private_impl = 0; | 546 | 1.25M | return ret; | 547 | 1.25M | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_empty_struct() gif_fuzzer.c:wuffs_base__make_empty_struct Line | Count | Source | 543 | 639k | wuffs_base__make_empty_struct(void) { | 544 | 639k | wuffs_base__empty_struct ret; | 545 | 639k | ret.private_impl = 0; | 546 | 639k | return ret; | 547 | 639k | } |
xz_fuzzer.c:wuffs_base__make_empty_struct Line | Count | Source | 543 | 97.1k | wuffs_base__make_empty_struct(void) { | 544 | 97.1k | wuffs_base__empty_struct ret; | 545 | 97.1k | ret.private_impl = 0; | 546 | 97.1k | return ret; | 547 | 97.1k | } |
jpeg_fuzzer.c:wuffs_base__make_empty_struct Line | Count | Source | 543 | 1.33G | wuffs_base__make_empty_struct(void) { | 544 | 1.33G | wuffs_base__empty_struct ret; | 545 | 1.33G | ret.private_impl = 0; | 546 | 1.33G | return ret; | 547 | 1.33G | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_empty_struct Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_empty_struct Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_empty_struct zlib_fuzzer.c:wuffs_base__make_empty_struct Line | Count | Source | 543 | 10.5k | wuffs_base__make_empty_struct(void) { | 544 | 10.5k | wuffs_base__empty_struct ret; | 545 | 10.5k | ret.private_impl = 0; | 546 | 10.5k | return ret; | 547 | 10.5k | } |
Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_empty_struct bzip2_fuzzer.c:wuffs_base__make_empty_struct Line | Count | Source | 543 | 37.1k | wuffs_base__make_empty_struct(void) { | 544 | 37.1k | wuffs_base__empty_struct ret; | 545 | 37.1k | ret.private_impl = 0; | 546 | 37.1k | return ret; | 547 | 37.1k | } |
webp_fuzzer.c:wuffs_base__make_empty_struct Line | Count | Source | 543 | 487M | wuffs_base__make_empty_struct(void) { | 544 | 487M | wuffs_base__empty_struct ret; | 545 | 487M | ret.private_impl = 0; | 546 | 487M | return ret; | 547 | 487M | } |
|
548 | | |
549 | | // wuffs_base__utility is a placeholder receiver type. It enables what Java |
550 | | // calls static methods, as opposed to regular methods. |
551 | | typedef struct wuffs_base__utility__struct { |
552 | | // private_impl is a placeholder field. It isn't explicitly used, except that |
553 | | // without it, the sizeof a struct with no fields can differ across C/C++ |
554 | | // compilers, and it is undefined behavior in C99. For example, gcc says that |
555 | | // the sizeof an empty struct is 0, and g++ says that it is 1. This leads to |
556 | | // ABI incompatibility if a Wuffs .c file is processed by one compiler and |
557 | | // its .h file with another compiler. |
558 | | // |
559 | | // Instead, we explicitly insert an otherwise unused field, so that the |
560 | | // sizeof this struct is always 1. |
561 | | uint8_t private_impl; |
562 | | } wuffs_base__utility; |
563 | | |
564 | | typedef struct wuffs_base__vtable__struct { |
565 | | const char* vtable_name; |
566 | | const void* function_pointers; |
567 | | } wuffs_base__vtable; |
568 | | |
569 | | // -------- |
570 | | |
571 | | // See https://github.com/google/wuffs/blob/main/doc/note/statuses.md |
572 | | typedef struct wuffs_base__status__struct { |
573 | | const char* repr; |
574 | | |
575 | | #ifdef __cplusplus |
576 | | inline bool is_complete() const; |
577 | | inline bool is_error() const; |
578 | | inline bool is_note() const; |
579 | | inline bool is_ok() const; |
580 | | inline bool is_suspension() const; |
581 | | inline bool is_truncated_input_error() const; |
582 | | inline const char* message() const; |
583 | | #endif // __cplusplus |
584 | | |
585 | | } wuffs_base__status; |
586 | | |
587 | | extern const char wuffs_base__note__i_o_redirect[]; |
588 | | extern const char wuffs_base__note__end_of_data[]; |
589 | | extern const char wuffs_base__note__metadata_reported[]; |
590 | | extern const char wuffs_base__suspension__even_more_information[]; |
591 | | extern const char wuffs_base__suspension__mispositioned_read[]; |
592 | | extern const char wuffs_base__suspension__mispositioned_write[]; |
593 | | extern const char wuffs_base__suspension__short_read[]; |
594 | | extern const char wuffs_base__suspension__short_workbuf[]; |
595 | | extern const char wuffs_base__suspension__short_write[]; |
596 | | extern const char wuffs_base__error__bad_i_o_position[]; |
597 | | extern const char wuffs_base__error__bad_argument_length_too_short[]; |
598 | | extern const char wuffs_base__error__bad_argument[]; |
599 | | extern const char wuffs_base__error__bad_call_sequence[]; |
600 | | extern const char wuffs_base__error__bad_data[]; |
601 | | extern const char wuffs_base__error__bad_receiver[]; |
602 | | extern const char wuffs_base__error__bad_restart[]; |
603 | | extern const char wuffs_base__error__bad_sizeof_receiver[]; |
604 | | extern const char wuffs_base__error__bad_vtable[]; |
605 | | extern const char wuffs_base__error__bad_workbuf_length[]; |
606 | | extern const char wuffs_base__error__bad_wuffs_version[]; |
607 | | extern const char wuffs_base__error__cannot_return_a_suspension[]; |
608 | | extern const char wuffs_base__error__disabled_by_wuffs_config_dst_pixel_format_enable_allowlist[]; |
609 | | extern const char wuffs_base__error__disabled_by_previous_error[]; |
610 | | extern const char wuffs_base__error__initialize_falsely_claimed_already_zeroed[]; |
611 | | extern const char wuffs_base__error__initialize_not_called[]; |
612 | | extern const char wuffs_base__error__insufficient_history[]; |
613 | | extern const char wuffs_base__error__interleaved_coroutine_calls[]; |
614 | | extern const char wuffs_base__error__no_more_information[]; |
615 | | extern const char wuffs_base__error__not_enough_data[]; |
616 | | extern const char wuffs_base__error__out_of_bounds[]; |
617 | | extern const char wuffs_base__error__unsupported_image_dimension[]; |
618 | | extern const char wuffs_base__error__unsupported_method[]; |
619 | | extern const char wuffs_base__error__unsupported_option[]; |
620 | | extern const char wuffs_base__error__unsupported_pixel_swizzler_option[]; |
621 | | extern const char wuffs_base__error__too_much_data[]; |
622 | | |
623 | | static inline wuffs_base__status // |
624 | 835M | wuffs_base__make_status(const char* repr) { |
625 | 835M | wuffs_base__status z; |
626 | 835M | z.repr = repr; |
627 | 835M | return z; |
628 | 835M | } png_fuzzer.c:wuffs_base__make_status Line | Count | Source | 624 | 511k | wuffs_base__make_status(const char* repr) { | 625 | 511k | wuffs_base__status z; | 626 | 511k | z.repr = repr; | 627 | 511k | return z; | 628 | 511k | } |
json_fuzzer.cc:wuffs_base__make_status(char const*) Line | Count | Source | 624 | 6.90M | wuffs_base__make_status(const char* repr) { | 625 | 6.90M | wuffs_base__status z; | 626 | 6.90M | z.repr = repr; | 627 | 6.90M | return z; | 628 | 6.90M | } |
gif_fuzzer.c:wuffs_base__make_status Line | Count | Source | 624 | 4.33M | wuffs_base__make_status(const char* repr) { | 625 | 4.33M | wuffs_base__status z; | 626 | 4.33M | z.repr = repr; | 627 | 4.33M | return z; | 628 | 4.33M | } |
xz_fuzzer.c:wuffs_base__make_status Line | Count | Source | 624 | 719k | wuffs_base__make_status(const char* repr) { | 625 | 719k | wuffs_base__status z; | 626 | 719k | z.repr = repr; | 627 | 719k | return z; | 628 | 719k | } |
jpeg_fuzzer.c:wuffs_base__make_status Line | Count | Source | 624 | 819M | wuffs_base__make_status(const char* repr) { | 625 | 819M | wuffs_base__status z; | 626 | 819M | z.repr = repr; | 627 | 819M | return z; | 628 | 819M | } |
cbor_fuzzer.c:wuffs_base__make_status Line | Count | Source | 624 | 1.60M | wuffs_base__make_status(const char* repr) { | 625 | 1.60M | wuffs_base__status z; | 626 | 1.60M | z.repr = repr; | 627 | 1.60M | return z; | 628 | 1.60M | } |
bmp_fuzzer.c:wuffs_base__make_status Line | Count | Source | 624 | 37.6k | wuffs_base__make_status(const char* repr) { | 625 | 37.6k | wuffs_base__status z; | 626 | 37.6k | z.repr = repr; | 627 | 37.6k | return z; | 628 | 37.6k | } |
pixel_swizzler_fuzzer.c:wuffs_base__make_status Line | Count | Source | 624 | 467k | wuffs_base__make_status(const char* repr) { | 625 | 467k | wuffs_base__status z; | 626 | 467k | z.repr = repr; | 627 | 467k | return z; | 628 | 467k | } |
zlib_fuzzer.c:wuffs_base__make_status Line | Count | Source | 624 | 175k | wuffs_base__make_status(const char* repr) { | 625 | 175k | wuffs_base__status z; | 626 | 175k | z.repr = repr; | 627 | 175k | return z; | 628 | 175k | } |
targa_fuzzer.c:wuffs_base__make_status Line | Count | Source | 624 | 14.4k | wuffs_base__make_status(const char* repr) { | 625 | 14.4k | wuffs_base__status z; | 626 | 14.4k | z.repr = repr; | 627 | 14.4k | return z; | 628 | 14.4k | } |
bzip2_fuzzer.c:wuffs_base__make_status Line | Count | Source | 624 | 142k | wuffs_base__make_status(const char* repr) { | 625 | 142k | wuffs_base__status z; | 626 | 142k | z.repr = repr; | 627 | 142k | return z; | 628 | 142k | } |
webp_fuzzer.c:wuffs_base__make_status Line | Count | Source | 624 | 1.38M | wuffs_base__make_status(const char* repr) { | 625 | 1.38M | wuffs_base__status z; | 626 | 1.38M | z.repr = repr; | 627 | 1.38M | return z; | 628 | 1.38M | } |
|
629 | | |
630 | | static inline bool // |
631 | 0 | wuffs_base__status__is_complete(const wuffs_base__status* z) { |
632 | 0 | return (z->repr == NULL) || ((*z->repr != '$') && (*z->repr != '#')); |
633 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__status__is_complete Unexecuted instantiation: json_fuzzer.cc:wuffs_base__status__is_complete(wuffs_base__status__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__status__is_complete Unexecuted instantiation: xz_fuzzer.c:wuffs_base__status__is_complete Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__status__is_complete Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__status__is_complete Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__status__is_complete Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__status__is_complete Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__status__is_complete Unexecuted instantiation: targa_fuzzer.c:wuffs_base__status__is_complete Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__status__is_complete Unexecuted instantiation: webp_fuzzer.c:wuffs_base__status__is_complete |
634 | | |
635 | | static inline bool // |
636 | 4.70M | wuffs_base__status__is_error(const wuffs_base__status* z) { |
637 | 4.70M | return z->repr && (*z->repr == '#'); |
638 | 4.70M | } png_fuzzer.c:wuffs_base__status__is_error Line | Count | Source | 636 | 110k | wuffs_base__status__is_error(const wuffs_base__status* z) { | 637 | 110k | return z->repr && (*z->repr == '#'); | 638 | 110k | } |
json_fuzzer.cc:wuffs_base__status__is_error(wuffs_base__status__struct const*) Line | Count | Source | 636 | 2.86M | wuffs_base__status__is_error(const wuffs_base__status* z) { | 637 | 2.86M | return z->repr && (*z->repr == '#'); | 638 | 2.86M | } |
gif_fuzzer.c:wuffs_base__status__is_error Line | Count | Source | 636 | 642k | wuffs_base__status__is_error(const wuffs_base__status* z) { | 637 | 642k | return z->repr && (*z->repr == '#'); | 638 | 642k | } |
xz_fuzzer.c:wuffs_base__status__is_error Line | Count | Source | 636 | 144k | wuffs_base__status__is_error(const wuffs_base__status* z) { | 637 | 144k | return z->repr && (*z->repr == '#'); | 638 | 144k | } |
jpeg_fuzzer.c:wuffs_base__status__is_error Line | Count | Source | 636 | 18.2k | wuffs_base__status__is_error(const wuffs_base__status* z) { | 637 | 18.2k | return z->repr && (*z->repr == '#'); | 638 | 18.2k | } |
cbor_fuzzer.c:wuffs_base__status__is_error Line | Count | Source | 636 | 802k | wuffs_base__status__is_error(const wuffs_base__status* z) { | 637 | 802k | return z->repr && (*z->repr == '#'); | 638 | 802k | } |
bmp_fuzzer.c:wuffs_base__status__is_error Line | Count | Source | 636 | 6.84k | wuffs_base__status__is_error(const wuffs_base__status* z) { | 637 | 6.84k | return z->repr && (*z->repr == '#'); | 638 | 6.84k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__status__is_error zlib_fuzzer.c:wuffs_base__status__is_error Line | Count | Source | 636 | 48.5k | wuffs_base__status__is_error(const wuffs_base__status* z) { | 637 | 48.5k | return z->repr && (*z->repr == '#'); | 638 | 48.5k | } |
targa_fuzzer.c:wuffs_base__status__is_error Line | Count | Source | 636 | 3.02k | wuffs_base__status__is_error(const wuffs_base__status* z) { | 637 | 3.02k | return z->repr && (*z->repr == '#'); | 638 | 3.02k | } |
bzip2_fuzzer.c:wuffs_base__status__is_error Line | Count | Source | 636 | 32.6k | wuffs_base__status__is_error(const wuffs_base__status* z) { | 637 | 32.6k | return z->repr && (*z->repr == '#'); | 638 | 32.6k | } |
webp_fuzzer.c:wuffs_base__status__is_error Line | Count | Source | 636 | 25.3k | wuffs_base__status__is_error(const wuffs_base__status* z) { | 637 | 25.3k | return z->repr && (*z->repr == '#'); | 638 | 25.3k | } |
|
639 | | |
640 | | static inline bool // |
641 | 0 | wuffs_base__status__is_note(const wuffs_base__status* z) { |
642 | 0 | return z->repr && (*z->repr != '$') && (*z->repr != '#'); |
643 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__status__is_note Unexecuted instantiation: json_fuzzer.cc:wuffs_base__status__is_note(wuffs_base__status__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__status__is_note Unexecuted instantiation: xz_fuzzer.c:wuffs_base__status__is_note Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__status__is_note Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__status__is_note Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__status__is_note Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__status__is_note Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__status__is_note Unexecuted instantiation: targa_fuzzer.c:wuffs_base__status__is_note Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__status__is_note Unexecuted instantiation: webp_fuzzer.c:wuffs_base__status__is_note |
644 | | |
645 | | static inline bool // |
646 | 2.36M | wuffs_base__status__is_ok(const wuffs_base__status* z) { |
647 | 2.36M | return z->repr == NULL; |
648 | 2.36M | } png_fuzzer.c:wuffs_base__status__is_ok Line | Count | Source | 646 | 110k | wuffs_base__status__is_ok(const wuffs_base__status* z) { | 647 | | return z->repr == NULL; | 648 | 110k | } |
json_fuzzer.cc:wuffs_base__status__is_ok(wuffs_base__status__struct const*) Line | Count | Source | 646 | 1.16M | wuffs_base__status__is_ok(const wuffs_base__status* z) { | 647 | | return z->repr == NULL; | 648 | 1.16M | } |
gif_fuzzer.c:wuffs_base__status__is_ok Line | Count | Source | 646 | 785k | wuffs_base__status__is_ok(const wuffs_base__status* z) { | 647 | | return z->repr == NULL; | 648 | 785k | } |
xz_fuzzer.c:wuffs_base__status__is_ok Line | Count | Source | 646 | 182k | wuffs_base__status__is_ok(const wuffs_base__status* z) { | 647 | | return z->repr == NULL; | 648 | 182k | } |
jpeg_fuzzer.c:wuffs_base__status__is_ok Line | Count | Source | 646 | 19.2k | wuffs_base__status__is_ok(const wuffs_base__status* z) { | 647 | | return z->repr == NULL; | 648 | 19.2k | } |
cbor_fuzzer.c:wuffs_base__status__is_ok Line | Count | Source | 646 | 2.18k | wuffs_base__status__is_ok(const wuffs_base__status* z) { | 647 | | return z->repr == NULL; | 648 | 2.18k | } |
bmp_fuzzer.c:wuffs_base__status__is_ok Line | Count | Source | 646 | 14.9k | wuffs_base__status__is_ok(const wuffs_base__status* z) { | 647 | | return z->repr == NULL; | 648 | 14.9k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__status__is_ok zlib_fuzzer.c:wuffs_base__status__is_ok Line | Count | Source | 646 | 14.2k | wuffs_base__status__is_ok(const wuffs_base__status* z) { | 647 | | return z->repr == NULL; | 648 | 14.2k | } |
targa_fuzzer.c:wuffs_base__status__is_ok Line | Count | Source | 646 | 5.97k | wuffs_base__status__is_ok(const wuffs_base__status* z) { | 647 | | return z->repr == NULL; | 648 | 5.97k | } |
bzip2_fuzzer.c:wuffs_base__status__is_ok Line | Count | Source | 646 | 1.24k | wuffs_base__status__is_ok(const wuffs_base__status* z) { | 647 | | return z->repr == NULL; | 648 | 1.24k | } |
webp_fuzzer.c:wuffs_base__status__is_ok Line | Count | Source | 646 | 58.9k | wuffs_base__status__is_ok(const wuffs_base__status* z) { | 647 | | return z->repr == NULL; | 648 | 58.9k | } |
|
649 | | |
650 | | static inline bool // |
651 | 11.0M | wuffs_base__status__is_suspension(const wuffs_base__status* z) { |
652 | 11.0M | return z->repr && (*z->repr == '$'); |
653 | 11.0M | } png_fuzzer.c:wuffs_base__status__is_suspension Line | Count | Source | 651 | 158k | wuffs_base__status__is_suspension(const wuffs_base__status* z) { | 652 | 158k | return z->repr && (*z->repr == '$'); | 653 | 158k | } |
json_fuzzer.cc:wuffs_base__status__is_suspension(wuffs_base__status__struct const*) Line | Count | Source | 651 | 8.38M | wuffs_base__status__is_suspension(const wuffs_base__status* z) { | 652 | 8.38M | return z->repr && (*z->repr == '$'); | 653 | 8.38M | } |
gif_fuzzer.c:wuffs_base__status__is_suspension Line | Count | Source | 651 | 6.51k | wuffs_base__status__is_suspension(const wuffs_base__status* z) { | 652 | 6.51k | return z->repr && (*z->repr == '$'); | 653 | 6.51k | } |
xz_fuzzer.c:wuffs_base__status__is_suspension Line | Count | Source | 651 | 202k | wuffs_base__status__is_suspension(const wuffs_base__status* z) { | 652 | 202k | return z->repr && (*z->repr == '$'); | 653 | 202k | } |
jpeg_fuzzer.c:wuffs_base__status__is_suspension Line | Count | Source | 651 | 10.2k | wuffs_base__status__is_suspension(const wuffs_base__status* z) { | 652 | 10.2k | return z->repr && (*z->repr == '$'); | 653 | 10.2k | } |
cbor_fuzzer.c:wuffs_base__status__is_suspension Line | Count | Source | 651 | 2.15M | wuffs_base__status__is_suspension(const wuffs_base__status* z) { | 652 | 2.15M | return z->repr && (*z->repr == '$'); | 653 | 2.15M | } |
bmp_fuzzer.c:wuffs_base__status__is_suspension Line | Count | Source | 651 | 4.37k | wuffs_base__status__is_suspension(const wuffs_base__status* z) { | 652 | 4.37k | return z->repr && (*z->repr == '$'); | 653 | 4.37k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__status__is_suspension zlib_fuzzer.c:wuffs_base__status__is_suspension Line | Count | Source | 651 | 80.2k | wuffs_base__status__is_suspension(const wuffs_base__status* z) { | 652 | 80.2k | return z->repr && (*z->repr == '$'); | 653 | 80.2k | } |
targa_fuzzer.c:wuffs_base__status__is_suspension Line | Count | Source | 651 | 1.71k | wuffs_base__status__is_suspension(const wuffs_base__status* z) { | 652 | 1.71k | return z->repr && (*z->repr == '$'); | 653 | 1.71k | } |
bzip2_fuzzer.c:wuffs_base__status__is_suspension Line | Count | Source | 651 | 47.1k | wuffs_base__status__is_suspension(const wuffs_base__status* z) { | 652 | 47.1k | return z->repr && (*z->repr == '$'); | 653 | 47.1k | } |
webp_fuzzer.c:wuffs_base__status__is_suspension Line | Count | Source | 651 | 10.0k | wuffs_base__status__is_suspension(const wuffs_base__status* z) { | 652 | 10.0k | return z->repr && (*z->repr == '$'); | 653 | 10.0k | } |
|
654 | | |
655 | | static inline bool // |
656 | 0 | wuffs_base__status__is_truncated_input_error(const wuffs_base__status* z) { |
657 | 0 | const char* p = z->repr; |
658 | 0 | if (!p || (*p != '#')) { |
659 | 0 | return false; |
660 | 0 | } |
661 | 0 | p++; |
662 | 0 | while (1) { |
663 | 0 | if (*p == 0) { |
664 | 0 | return false; |
665 | 0 | } else if (*p++ == ':') { |
666 | 0 | break; |
667 | 0 | } |
668 | 0 | } |
669 | 0 | return strcmp(p, " truncated input") == 0; |
670 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__status__is_truncated_input_error Unexecuted instantiation: json_fuzzer.cc:wuffs_base__status__is_truncated_input_error(wuffs_base__status__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__status__is_truncated_input_error Unexecuted instantiation: xz_fuzzer.c:wuffs_base__status__is_truncated_input_error Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__status__is_truncated_input_error Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__status__is_truncated_input_error Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__status__is_truncated_input_error Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__status__is_truncated_input_error Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__status__is_truncated_input_error Unexecuted instantiation: targa_fuzzer.c:wuffs_base__status__is_truncated_input_error Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__status__is_truncated_input_error Unexecuted instantiation: webp_fuzzer.c:wuffs_base__status__is_truncated_input_error |
671 | | |
672 | | // wuffs_base__status__message strips the leading '$', '#' or '@'. |
673 | | static inline const char* // |
674 | 42.1k | wuffs_base__status__message(const wuffs_base__status* z) { |
675 | 42.1k | if (z->repr) { |
676 | 42.0k | if ((*z->repr == '$') || (*z->repr == '#') || (*z->repr == '@')) { |
677 | 42.0k | return z->repr + 1; |
678 | 42.0k | } |
679 | 42.0k | } |
680 | 44 | return z->repr; |
681 | 42.1k | } png_fuzzer.c:wuffs_base__status__message Line | Count | Source | 674 | 6.11k | wuffs_base__status__message(const wuffs_base__status* z) { | 675 | 6.11k | if (z->repr) { | 676 | 6.11k | if ((*z->repr == '$') || (*z->repr == '#') || (*z->repr == '@')) { | 677 | 6.11k | return z->repr + 1; | 678 | 6.11k | } | 679 | 6.11k | } | 680 | 0 | return z->repr; | 681 | 6.11k | } |
json_fuzzer.cc:wuffs_base__status__message(wuffs_base__status__struct const*) Line | Count | Source | 674 | 8.14k | wuffs_base__status__message(const wuffs_base__status* z) { | 675 | 8.14k | if (z->repr) { | 676 | 8.14k | if ((*z->repr == '$') || (*z->repr == '#') || (*z->repr == '@')) { | 677 | 8.14k | return z->repr + 1; | 678 | 8.14k | } | 679 | 8.14k | } | 680 | 0 | return z->repr; | 681 | 8.14k | } |
gif_fuzzer.c:wuffs_base__status__message Line | Count | Source | 674 | 2.21k | wuffs_base__status__message(const wuffs_base__status* z) { | 675 | 2.21k | if (z->repr) { | 676 | 2.21k | if ((*z->repr == '$') || (*z->repr == '#') || (*z->repr == '@')) { | 677 | 2.21k | return z->repr + 1; | 678 | 2.21k | } | 679 | 2.21k | } | 680 | 0 | return z->repr; | 681 | 2.21k | } |
xz_fuzzer.c:wuffs_base__status__message Line | Count | Source | 674 | 8.44k | wuffs_base__status__message(const wuffs_base__status* z) { | 675 | 8.44k | if (z->repr) { | 676 | 8.43k | if ((*z->repr == '$') || (*z->repr == '#') || (*z->repr == '@')) { | 677 | 8.43k | return z->repr + 1; | 678 | 8.43k | } | 679 | 8.43k | } | 680 | 3 | return z->repr; | 681 | 8.44k | } |
jpeg_fuzzer.c:wuffs_base__status__message Line | Count | Source | 674 | 3.88k | wuffs_base__status__message(const wuffs_base__status* z) { | 675 | 3.88k | if (z->repr) { | 676 | 3.88k | if ((*z->repr == '$') || (*z->repr == '#') || (*z->repr == '@')) { | 677 | 3.88k | return z->repr + 1; | 678 | 3.88k | } | 679 | 3.88k | } | 680 | 0 | return z->repr; | 681 | 3.88k | } |
cbor_fuzzer.c:wuffs_base__status__message Line | Count | Source | 674 | 1.83k | wuffs_base__status__message(const wuffs_base__status* z) { | 675 | 1.83k | if (z->repr) { | 676 | 1.83k | if ((*z->repr == '$') || (*z->repr == '#') || (*z->repr == '@')) { | 677 | 1.83k | return z->repr + 1; | 678 | 1.83k | } | 679 | 1.83k | } | 680 | 0 | return z->repr; | 681 | 1.83k | } |
bmp_fuzzer.c:wuffs_base__status__message Line | Count | Source | 674 | 3.01k | wuffs_base__status__message(const wuffs_base__status* z) { | 675 | 3.01k | if (z->repr) { | 676 | 3.01k | if ((*z->repr == '$') || (*z->repr == '#') || (*z->repr == '@')) { | 677 | 3.01k | return z->repr + 1; | 678 | 3.01k | } | 679 | 3.01k | } | 680 | 0 | return z->repr; | 681 | 3.01k | } |
pixel_swizzler_fuzzer.c:wuffs_base__status__message Line | Count | Source | 674 | 1.94k | wuffs_base__status__message(const wuffs_base__status* z) { | 675 | 1.94k | if (z->repr) { | 676 | 1.94k | if ((*z->repr == '$') || (*z->repr == '#') || (*z->repr == '@')) { | 677 | 1.94k | return z->repr + 1; | 678 | 1.94k | } | 679 | 1.94k | } | 680 | 0 | return z->repr; | 681 | 1.94k | } |
zlib_fuzzer.c:wuffs_base__status__message Line | Count | Source | 674 | 1.37k | wuffs_base__status__message(const wuffs_base__status* z) { | 675 | 1.37k | if (z->repr) { | 676 | 1.34k | if ((*z->repr == '$') || (*z->repr == '#') || (*z->repr == '@')) { | 677 | 1.34k | return z->repr + 1; | 678 | 1.34k | } | 679 | 1.34k | } | 680 | 39 | return z->repr; | 681 | 1.37k | } |
targa_fuzzer.c:wuffs_base__status__message Line | Count | Source | 674 | 1.10k | wuffs_base__status__message(const wuffs_base__status* z) { | 675 | 1.10k | if (z->repr) { | 676 | 1.10k | if ((*z->repr == '$') || (*z->repr == '#') || (*z->repr == '@')) { | 677 | 1.10k | return z->repr + 1; | 678 | 1.10k | } | 679 | 1.10k | } | 680 | 0 | return z->repr; | 681 | 1.10k | } |
bzip2_fuzzer.c:wuffs_base__status__message Line | Count | Source | 674 | 1.24k | wuffs_base__status__message(const wuffs_base__status* z) { | 675 | 1.24k | if (z->repr) { | 676 | 1.23k | if ((*z->repr == '$') || (*z->repr == '#') || (*z->repr == '@')) { | 677 | 1.23k | return z->repr + 1; | 678 | 1.23k | } | 679 | 1.23k | } | 680 | 2 | return z->repr; | 681 | 1.24k | } |
webp_fuzzer.c:wuffs_base__status__message Line | Count | Source | 674 | 2.80k | wuffs_base__status__message(const wuffs_base__status* z) { | 675 | 2.80k | if (z->repr) { | 676 | 2.80k | if ((*z->repr == '$') || (*z->repr == '#') || (*z->repr == '@')) { | 677 | 2.80k | return z->repr + 1; | 678 | 2.80k | } | 679 | 2.80k | } | 680 | 0 | return z->repr; | 681 | 2.80k | } |
|
682 | | |
683 | | #ifdef __cplusplus |
684 | | |
685 | | inline bool // |
686 | 0 | wuffs_base__status::is_complete() const { |
687 | 0 | return wuffs_base__status__is_complete(this); |
688 | 0 | } |
689 | | |
690 | | inline bool // |
691 | 0 | wuffs_base__status::is_error() const { |
692 | 0 | return wuffs_base__status__is_error(this); |
693 | 0 | } |
694 | | |
695 | | inline bool // |
696 | 0 | wuffs_base__status::is_note() const { |
697 | 0 | return wuffs_base__status__is_note(this); |
698 | 0 | } |
699 | | |
700 | | inline bool // |
701 | 1.16M | wuffs_base__status::is_ok() const { |
702 | 1.16M | return wuffs_base__status__is_ok(this); |
703 | 1.16M | } |
704 | | |
705 | | inline bool // |
706 | 0 | wuffs_base__status::is_suspension() const { |
707 | 0 | return wuffs_base__status__is_suspension(this); |
708 | 0 | } |
709 | | |
710 | | inline bool // |
711 | 0 | wuffs_base__status::is_truncated_input_error() const { |
712 | 0 | return wuffs_base__status__is_truncated_input_error(this); |
713 | 0 | } |
714 | | |
715 | | inline const char* // |
716 | 3.29k | wuffs_base__status::message() const { |
717 | 3.29k | return wuffs_base__status__message(this); |
718 | 3.29k | } |
719 | | |
720 | | #endif // __cplusplus |
721 | | |
722 | | // -------- |
723 | | |
724 | | // WUFFS_BASE__RESULT is a result type: either a status (an error) or a value. |
725 | | // |
726 | | // A result with all fields NULL or zero is as valid as a zero-valued T. |
727 | | #define WUFFS_BASE__RESULT(T) \ |
728 | | struct { \ |
729 | | wuffs_base__status status; \ |
730 | | T value; \ |
731 | | } |
732 | | |
733 | | typedef WUFFS_BASE__RESULT(double) wuffs_base__result_f64; |
734 | | typedef WUFFS_BASE__RESULT(int64_t) wuffs_base__result_i64; |
735 | | typedef WUFFS_BASE__RESULT(uint64_t) wuffs_base__result_u64; |
736 | | |
737 | | // -------- |
738 | | |
739 | | // wuffs_base__transform__output is the result of transforming from a src slice |
740 | | // to a dst slice. |
741 | | typedef struct wuffs_base__transform__output__struct { |
742 | | wuffs_base__status status; |
743 | | size_t num_dst; |
744 | | size_t num_src; |
745 | | } wuffs_base__transform__output; |
746 | | |
747 | | // -------- |
748 | | |
749 | | // FourCC constants. Four Character Codes are literally four ASCII characters |
750 | | // (sometimes padded with ' ' spaces) that pack neatly into a signed or |
751 | | // unsigned 32-bit integer. ASCII letters are conventionally upper case. |
752 | | // |
753 | | // They are often used to identify video codecs (e.g. "H265") and pixel formats |
754 | | // (e.g. "YV12"). Wuffs uses them for that but also generally for naming |
755 | | // various things: compression formats (e.g. "BZ2 "), image metadata (e.g. |
756 | | // "EXIF"), file formats (e.g. "HTML"), etc. |
757 | | // |
758 | | // Wuffs' u32 values are big-endian ("JPEG" is 0x4A504547 not 0x4745504A) to |
759 | | // preserve ordering: "JPEG" < "MP3 " and 0x4A504547 < 0x4D503320. |
760 | | |
761 | | // Android Binary XML (for resources; see AndroidBinXmlParser.java). |
762 | | #define WUFFS_BASE__FOURCC__ABXR 0x41425852 |
763 | | |
764 | | // Android Binary XML (for system_server; see BinaryXmlSerializer.java). |
765 | | #define WUFFS_BASE__FOURCC__ABXS 0x41425853 |
766 | | |
767 | | // Background Color. |
768 | | #define WUFFS_BASE__FOURCC__BGCL 0x4247434C |
769 | | |
770 | | // Bitmap. |
771 | | #define WUFFS_BASE__FOURCC__BMP 0x424D5020 |
772 | | |
773 | | // Brotli. |
774 | | #define WUFFS_BASE__FOURCC__BRTL 0x4252544C |
775 | | |
776 | | // Bzip2. |
777 | | #define WUFFS_BASE__FOURCC__BZ2 0x425A3220 |
778 | | |
779 | | // Concise Binary Object Representation. |
780 | | #define WUFFS_BASE__FOURCC__CBOR 0x43424F52 |
781 | | |
782 | | // Primary Chromaticities and White Point. |
783 | | #define WUFFS_BASE__FOURCC__CHRM 0x4348524D |
784 | | |
785 | | // Cascading Style Sheets. |
786 | | #define WUFFS_BASE__FOURCC__CSS 0x43535320 |
787 | | |
788 | | // Encapsulated PostScript. |
789 | | #define WUFFS_BASE__FOURCC__EPS 0x45505320 |
790 | | |
791 | | // Ericsson Texture Compression 2 (iPACKMAN). |
792 | | #define WUFFS_BASE__FOURCC__ETC2 0x45544332 |
793 | | |
794 | | // Exchangeable Image File Format. |
795 | | #define WUFFS_BASE__FOURCC__EXIF 0x45584946 |
796 | | |
797 | | // Free Lossless Audio Codec. |
798 | | #define WUFFS_BASE__FOURCC__FLAC 0x464C4143 |
799 | | |
800 | | // Gamma Correction. |
801 | | #define WUFFS_BASE__FOURCC__GAMA 0x47414D41 |
802 | | |
803 | | // Graphics Interchange Format. |
804 | | #define WUFFS_BASE__FOURCC__GIF 0x47494620 |
805 | | |
806 | | // GNU Zip. |
807 | | #define WUFFS_BASE__FOURCC__GZ 0x475A2020 |
808 | | |
809 | | // High Efficiency Image File. |
810 | | #define WUFFS_BASE__FOURCC__HEIF 0x48454946 |
811 | | |
812 | | // Handsum. |
813 | | #define WUFFS_BASE__FOURCC__HNSM 0x484E534D |
814 | | |
815 | | // Hypertext Markup Language. |
816 | | #define WUFFS_BASE__FOURCC__HTML 0x48544D4C |
817 | | |
818 | | // International Color Consortium Profile. |
819 | | #define WUFFS_BASE__FOURCC__ICCP 0x49434350 |
820 | | |
821 | | // Icon. |
822 | | #define WUFFS_BASE__FOURCC__ICO 0x49434F20 |
823 | | |
824 | | // Icon Vector Graphics. |
825 | | #define WUFFS_BASE__FOURCC__ICVG 0x49435647 |
826 | | |
827 | | // Initialization. |
828 | | #define WUFFS_BASE__FOURCC__INI 0x494E4920 |
829 | | |
830 | | // Joint Photographic Experts Group. |
831 | | #define WUFFS_BASE__FOURCC__JPEG 0x4A504547 |
832 | | |
833 | | // JavaScript. |
834 | | #define WUFFS_BASE__FOURCC__JS 0x4A532020 |
835 | | |
836 | | // JavaScript Object Notation. |
837 | | #define WUFFS_BASE__FOURCC__JSON 0x4A534F4E |
838 | | |
839 | | // JSON With Commas and Comments. |
840 | | #define WUFFS_BASE__FOURCC__JWCC 0x4A574343 |
841 | | |
842 | | // Key-Value Pair. |
843 | | #define WUFFS_BASE__FOURCC__KVP 0x4B565020 |
844 | | |
845 | | // Key-Value Pair (Key). |
846 | | #define WUFFS_BASE__FOURCC__KVPK 0x4B56504B |
847 | | |
848 | | // Key-Value Pair (Value). |
849 | | #define WUFFS_BASE__FOURCC__KVPV 0x4B565056 |
850 | | |
851 | | // LempelโZiv 4. |
852 | | #define WUFFS_BASE__FOURCC__LZ4 0x4C5A3420 |
853 | | |
854 | | // Lzip. |
855 | | #define WUFFS_BASE__FOURCC__LZIP 0x4C5A4950 |
856 | | |
857 | | // LempelโZiv Markov-chain Algorithm. |
858 | | #define WUFFS_BASE__FOURCC__LZMA 0x4C5A4D41 |
859 | | |
860 | | // Markdown. |
861 | | #define WUFFS_BASE__FOURCC__MD 0x4D442020 |
862 | | |
863 | | // Modification Time. |
864 | | #define WUFFS_BASE__FOURCC__MTIM 0x4D54494D |
865 | | |
866 | | // MPEG-1 Audio Layer III. |
867 | | #define WUFFS_BASE__FOURCC__MP3 0x4D503320 |
868 | | |
869 | | // Naive Image. |
870 | | #define WUFFS_BASE__FOURCC__NIE 0x4E494520 |
871 | | |
872 | | // Netpbm (Portable Anymap). |
873 | | #define WUFFS_BASE__FOURCC__NPBM 0x4E50424D |
874 | | |
875 | | // Offset (2-Dimensional). |
876 | | #define WUFFS_BASE__FOURCC__OFS2 0x4F465332 |
877 | | |
878 | | // Open Type Format. |
879 | | #define WUFFS_BASE__FOURCC__OTF 0x4F544620 |
880 | | |
881 | | // Portable Document Format. |
882 | | #define WUFFS_BASE__FOURCC__PDF 0x50444620 |
883 | | |
884 | | // Physical Dimensions. |
885 | | #define WUFFS_BASE__FOURCC__PHYD 0x50485944 |
886 | | |
887 | | // Portable Network Graphics. |
888 | | #define WUFFS_BASE__FOURCC__PNG 0x504E4720 |
889 | | |
890 | | // PostScript. |
891 | | #define WUFFS_BASE__FOURCC__PS 0x50532020 |
892 | | |
893 | | // Quite OK Image. |
894 | | #define WUFFS_BASE__FOURCC__QOI 0x514F4920 |
895 | | |
896 | | // Random Access Compression. |
897 | | #define WUFFS_BASE__FOURCC__RAC 0x52414320 |
898 | | |
899 | | // Raw. |
900 | | #define WUFFS_BASE__FOURCC__RAW 0x52415720 |
901 | | |
902 | | // Resource Interchange File Format. |
903 | | #define WUFFS_BASE__FOURCC__RIFF 0x52494646 |
904 | | |
905 | | // Riegeli Records. |
906 | | #define WUFFS_BASE__FOURCC__RIGL 0x5249474C |
907 | | |
908 | | // Snappy. |
909 | | #define WUFFS_BASE__FOURCC__SNPY 0x534E5059 |
910 | | |
911 | | // Standard Red Green Blue (Rendering Intent). |
912 | | #define WUFFS_BASE__FOURCC__SRGB 0x53524742 |
913 | | |
914 | | // Scalable Vector Graphics. |
915 | | #define WUFFS_BASE__FOURCC__SVG 0x53564720 |
916 | | |
917 | | // Tape Archive. |
918 | | #define WUFFS_BASE__FOURCC__TAR 0x54415220 |
919 | | |
920 | | // Text. |
921 | | #define WUFFS_BASE__FOURCC__TEXT 0x54455854 |
922 | | |
923 | | // Truevision Advanced Raster Graphics Adapter. |
924 | | #define WUFFS_BASE__FOURCC__TGA 0x54474120 |
925 | | |
926 | | // Thumbhash. |
927 | | #define WUFFS_BASE__FOURCC__TH 0x54482020 |
928 | | |
929 | | // Tagged Image File Format. |
930 | | #define WUFFS_BASE__FOURCC__TIFF 0x54494646 |
931 | | |
932 | | // Tom's Obvious Minimal Language. |
933 | | #define WUFFS_BASE__FOURCC__TOML 0x544F4D4C |
934 | | |
935 | | // Waveform. |
936 | | #define WUFFS_BASE__FOURCC__WAVE 0x57415645 |
937 | | |
938 | | // Wireless Bitmap. |
939 | | #define WUFFS_BASE__FOURCC__WBMP 0x57424D50 |
940 | | |
941 | | // Web Picture. |
942 | | #define WUFFS_BASE__FOURCC__WEBP 0x57454250 |
943 | | |
944 | | // Web Open Font Format. |
945 | | #define WUFFS_BASE__FOURCC__WOFF 0x574F4646 |
946 | | |
947 | | // Extensible Markup Language. |
948 | | #define WUFFS_BASE__FOURCC__XML 0x584D4C20 |
949 | | |
950 | | // Extensible Metadata Platform. |
951 | | #define WUFFS_BASE__FOURCC__XMP 0x584D5020 |
952 | | |
953 | | // Xz. |
954 | | #define WUFFS_BASE__FOURCC__XZ 0x585A2020 |
955 | | |
956 | | // Zip. |
957 | | #define WUFFS_BASE__FOURCC__ZIP 0x5A495020 |
958 | | |
959 | | // Zlib. |
960 | | #define WUFFS_BASE__FOURCC__ZLIB 0x5A4C4942 |
961 | | |
962 | | // Zstandard. |
963 | | #define WUFFS_BASE__FOURCC__ZSTD 0x5A535444 |
964 | | |
965 | | // -------- |
966 | | |
967 | | // Various MIME types in 4/4/2 base-38 encoding, per |
968 | | // doc/note/enumerated-media-types.txt |
969 | | |
970 | | // base38("appl/defl/..") = 0x9CC62_607F1000 |
971 | | #define WUFFS_BASE__MIME_TYPE__APPLICATION_DEFLATE 2757997688197120 |
972 | | |
973 | | // base38("appl/octe/..") = 0x9CC62_A9E37800 |
974 | | #define WUFFS_BASE__MIME_TYPE__APPLICATION_OCTET_STREAM 2757998919514112 |
975 | | |
976 | | // -------- |
977 | | |
978 | | // Quirks. |
979 | | |
980 | 33.1k | #define WUFFS_BASE__QUIRK_IGNORE_CHECKSUM 1 |
981 | | |
982 | | #define WUFFS_BASE__QUIRK_QUALITY 2 |
983 | | |
984 | | #define WUFFS_BASE__QUIRK_SOURCE_LENGTH 3 |
985 | | |
986 | | // -------- |
987 | | |
988 | | // Flicks are a unit of time. One flick (frame-tick) is 1 / 705_600_000 of a |
989 | | // second. See https://github.com/OculusVR/Flicks |
990 | | typedef int64_t wuffs_base__flicks; |
991 | | |
992 | | #define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000) |
993 | | #define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600) |
994 | | |
995 | | // ---------------- Numeric Types |
996 | | |
997 | | // The helpers below are functions, instead of macros, because their arguments |
998 | | // can be an expression that we shouldn't evaluate more than once. |
999 | | // |
1000 | | // They are static, so that linking multiple wuffs .o files won't complain about |
1001 | | // duplicate function definitions. |
1002 | | // |
1003 | | // They are explicitly marked inline, even if modern compilers don't use the |
1004 | | // inline attribute to guide optimizations such as inlining, to avoid the |
1005 | | // -Wunused-function warning, and we like to compile with -Wall -Werror. |
1006 | | |
1007 | | static inline int8_t // |
1008 | 0 | wuffs_base__i8__min(int8_t x, int8_t y) { |
1009 | 0 | return x < y ? x : y; |
1010 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__i8__min Unexecuted instantiation: json_fuzzer.cc:wuffs_base__i8__min(signed char, signed char) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__i8__min Unexecuted instantiation: xz_fuzzer.c:wuffs_base__i8__min Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__i8__min Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__i8__min Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__i8__min Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__i8__min Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__i8__min Unexecuted instantiation: targa_fuzzer.c:wuffs_base__i8__min Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__i8__min Unexecuted instantiation: webp_fuzzer.c:wuffs_base__i8__min |
1011 | | |
1012 | | static inline int8_t // |
1013 | 0 | wuffs_base__i8__max(int8_t x, int8_t y) { |
1014 | 0 | return x > y ? x : y; |
1015 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__i8__max Unexecuted instantiation: json_fuzzer.cc:wuffs_base__i8__max(signed char, signed char) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__i8__max Unexecuted instantiation: xz_fuzzer.c:wuffs_base__i8__max Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__i8__max Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__i8__max Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__i8__max Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__i8__max Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__i8__max Unexecuted instantiation: targa_fuzzer.c:wuffs_base__i8__max Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__i8__max Unexecuted instantiation: webp_fuzzer.c:wuffs_base__i8__max |
1016 | | |
1017 | | static inline int16_t // |
1018 | 0 | wuffs_base__i16__min(int16_t x, int16_t y) { |
1019 | 0 | return x < y ? x : y; |
1020 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__i16__min Unexecuted instantiation: json_fuzzer.cc:wuffs_base__i16__min(short, short) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__i16__min Unexecuted instantiation: xz_fuzzer.c:wuffs_base__i16__min Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__i16__min Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__i16__min Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__i16__min Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__i16__min Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__i16__min Unexecuted instantiation: targa_fuzzer.c:wuffs_base__i16__min Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__i16__min Unexecuted instantiation: webp_fuzzer.c:wuffs_base__i16__min |
1021 | | |
1022 | | static inline int16_t // |
1023 | 0 | wuffs_base__i16__max(int16_t x, int16_t y) { |
1024 | 0 | return x > y ? x : y; |
1025 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__i16__max Unexecuted instantiation: json_fuzzer.cc:wuffs_base__i16__max(short, short) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__i16__max Unexecuted instantiation: xz_fuzzer.c:wuffs_base__i16__max Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__i16__max Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__i16__max Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__i16__max Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__i16__max Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__i16__max Unexecuted instantiation: targa_fuzzer.c:wuffs_base__i16__max Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__i16__max Unexecuted instantiation: webp_fuzzer.c:wuffs_base__i16__max |
1026 | | |
1027 | | static inline int32_t // |
1028 | 0 | wuffs_base__i32__min(int32_t x, int32_t y) { |
1029 | 0 | return x < y ? x : y; |
1030 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__i32__min Unexecuted instantiation: json_fuzzer.cc:wuffs_base__i32__min(int, int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__i32__min Unexecuted instantiation: xz_fuzzer.c:wuffs_base__i32__min Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__i32__min Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__i32__min Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__i32__min Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__i32__min Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__i32__min Unexecuted instantiation: targa_fuzzer.c:wuffs_base__i32__min Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__i32__min Unexecuted instantiation: webp_fuzzer.c:wuffs_base__i32__min |
1031 | | |
1032 | | static inline int32_t // |
1033 | 0 | wuffs_base__i32__max(int32_t x, int32_t y) { |
1034 | 0 | return x > y ? x : y; |
1035 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__i32__max Unexecuted instantiation: json_fuzzer.cc:wuffs_base__i32__max(int, int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__i32__max Unexecuted instantiation: xz_fuzzer.c:wuffs_base__i32__max Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__i32__max Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__i32__max Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__i32__max Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__i32__max Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__i32__max Unexecuted instantiation: targa_fuzzer.c:wuffs_base__i32__max Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__i32__max Unexecuted instantiation: webp_fuzzer.c:wuffs_base__i32__max |
1036 | | |
1037 | | static inline int64_t // |
1038 | 0 | wuffs_base__i64__min(int64_t x, int64_t y) { |
1039 | 0 | return x < y ? x : y; |
1040 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__i64__min Unexecuted instantiation: json_fuzzer.cc:wuffs_base__i64__min(long, long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__i64__min Unexecuted instantiation: xz_fuzzer.c:wuffs_base__i64__min Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__i64__min Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__i64__min Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__i64__min Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__i64__min Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__i64__min Unexecuted instantiation: targa_fuzzer.c:wuffs_base__i64__min Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__i64__min Unexecuted instantiation: webp_fuzzer.c:wuffs_base__i64__min |
1041 | | |
1042 | | static inline int64_t // |
1043 | 0 | wuffs_base__i64__max(int64_t x, int64_t y) { |
1044 | 0 | return x > y ? x : y; |
1045 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__i64__max Unexecuted instantiation: json_fuzzer.cc:wuffs_base__i64__max(long, long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__i64__max Unexecuted instantiation: xz_fuzzer.c:wuffs_base__i64__max Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__i64__max Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__i64__max Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__i64__max Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__i64__max Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__i64__max Unexecuted instantiation: targa_fuzzer.c:wuffs_base__i64__max Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__i64__max Unexecuted instantiation: webp_fuzzer.c:wuffs_base__i64__max |
1046 | | |
1047 | | static inline uint8_t // |
1048 | 4.51k | wuffs_base__u8__min(uint8_t x, uint8_t y) { |
1049 | 4.51k | return x < y ? x : y; |
1050 | 4.51k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u8__min Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u8__min(unsigned char, unsigned char) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u8__min Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u8__min jpeg_fuzzer.c:wuffs_base__u8__min Line | Count | Source | 1048 | 4.51k | wuffs_base__u8__min(uint8_t x, uint8_t y) { | 1049 | 4.51k | return x < y ? x : y; | 1050 | 4.51k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u8__min Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u8__min Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u8__min Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u8__min Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u8__min Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u8__min Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u8__min |
1051 | | |
1052 | | static inline uint8_t // |
1053 | 0 | wuffs_base__u8__max(uint8_t x, uint8_t y) { |
1054 | 0 | return x > y ? x : y; |
1055 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u8__max Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u8__max(unsigned char, unsigned char) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u8__max Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u8__max Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u8__max Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u8__max Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u8__max Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u8__max Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u8__max Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u8__max Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u8__max Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u8__max |
1056 | | |
1057 | | static inline uint16_t // |
1058 | 0 | wuffs_base__u16__min(uint16_t x, uint16_t y) { |
1059 | 0 | return x < y ? x : y; |
1060 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u16__min Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u16__min(unsigned short, unsigned short) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u16__min Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u16__min Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u16__min Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u16__min Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u16__min Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u16__min Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u16__min Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u16__min Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u16__min Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u16__min |
1061 | | |
1062 | | static inline uint16_t // |
1063 | 0 | wuffs_base__u16__max(uint16_t x, uint16_t y) { |
1064 | 0 | return x > y ? x : y; |
1065 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u16__max Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u16__max(unsigned short, unsigned short) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u16__max Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u16__max Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u16__max Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u16__max Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u16__max Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u16__max Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u16__max Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u16__max Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u16__max Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u16__max |
1066 | | |
1067 | | static inline uint32_t // |
1068 | 1.11G | wuffs_base__u32__min(uint32_t x, uint32_t y) { |
1069 | 1.11G | return x < y ? x : y; |
1070 | 1.11G | } png_fuzzer.c:wuffs_base__u32__min Line | Count | Source | 1068 | 12.9k | wuffs_base__u32__min(uint32_t x, uint32_t y) { | 1069 | 12.9k | return x < y ? x : y; | 1070 | 12.9k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u32__min(unsigned int, unsigned int) gif_fuzzer.c:wuffs_base__u32__min Line | Count | Source | 1068 | 3.56M | wuffs_base__u32__min(uint32_t x, uint32_t y) { | 1069 | 3.56M | return x < y ? x : y; | 1070 | 3.56M | } |
xz_fuzzer.c:wuffs_base__u32__min Line | Count | Source | 1068 | 17.6k | wuffs_base__u32__min(uint32_t x, uint32_t y) { | 1069 | 17.6k | return x < y ? x : y; | 1070 | 17.6k | } |
jpeg_fuzzer.c:wuffs_base__u32__min Line | Count | Source | 1068 | 1.10G | wuffs_base__u32__min(uint32_t x, uint32_t y) { | 1069 | 1.10G | return x < y ? x : y; | 1070 | 1.10G | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u32__min bmp_fuzzer.c:wuffs_base__u32__min Line | Count | Source | 1068 | 806k | wuffs_base__u32__min(uint32_t x, uint32_t y) { | 1069 | 806k | return x < y ? x : y; | 1070 | 806k | } |
pixel_swizzler_fuzzer.c:wuffs_base__u32__min Line | Count | Source | 1068 | 29.7k | wuffs_base__u32__min(uint32_t x, uint32_t y) { | 1069 | 29.7k | return x < y ? x : y; | 1070 | 29.7k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u32__min targa_fuzzer.c:wuffs_base__u32__min Line | Count | Source | 1068 | 1.78k | wuffs_base__u32__min(uint32_t x, uint32_t y) { | 1069 | 1.78k | return x < y ? x : y; | 1070 | 1.78k | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u32__min webp_fuzzer.c:wuffs_base__u32__min Line | Count | Source | 1068 | 679k | wuffs_base__u32__min(uint32_t x, uint32_t y) { | 1069 | 679k | return x < y ? x : y; | 1070 | 679k | } |
|
1071 | | |
1072 | | static inline uint32_t // |
1073 | 2.14M | wuffs_base__u32__max(uint32_t x, uint32_t y) { |
1074 | 2.14M | return x > y ? x : y; |
1075 | 2.14M | } png_fuzzer.c:wuffs_base__u32__max Line | Count | Source | 1073 | 12.9k | wuffs_base__u32__max(uint32_t x, uint32_t y) { | 1074 | 12.9k | return x > y ? x : y; | 1075 | 12.9k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u32__max(unsigned int, unsigned int) gif_fuzzer.c:wuffs_base__u32__max Line | Count | Source | 1073 | 2.05M | wuffs_base__u32__max(uint32_t x, uint32_t y) { | 1074 | 2.05M | return x > y ? x : y; | 1075 | 2.05M | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u32__max jpeg_fuzzer.c:wuffs_base__u32__max Line | Count | Source | 1073 | 10.4k | wuffs_base__u32__max(uint32_t x, uint32_t y) { | 1074 | 10.4k | return x > y ? x : y; | 1075 | 10.4k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u32__max bmp_fuzzer.c:wuffs_base__u32__max Line | Count | Source | 1073 | 3.44k | wuffs_base__u32__max(uint32_t x, uint32_t y) { | 1074 | 3.44k | return x > y ? x : y; | 1075 | 3.44k | } |
pixel_swizzler_fuzzer.c:wuffs_base__u32__max Line | Count | Source | 1073 | 39.5k | wuffs_base__u32__max(uint32_t x, uint32_t y) { | 1074 | 39.5k | return x > y ? x : y; | 1075 | 39.5k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u32__max targa_fuzzer.c:wuffs_base__u32__max Line | Count | Source | 1073 | 1.78k | wuffs_base__u32__max(uint32_t x, uint32_t y) { | 1074 | 1.78k | return x > y ? x : y; | 1075 | 1.78k | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u32__max webp_fuzzer.c:wuffs_base__u32__max Line | Count | Source | 1073 | 23.8k | wuffs_base__u32__max(uint32_t x, uint32_t y) { | 1074 | 23.8k | return x > y ? x : y; | 1075 | 23.8k | } |
|
1076 | | |
1077 | | static inline uint64_t // |
1078 | 2.73M | wuffs_base__u64__min(uint64_t x, uint64_t y) { |
1079 | 2.73M | return x < y ? x : y; |
1080 | 2.73M | } png_fuzzer.c:wuffs_base__u64__min Line | Count | Source | 1078 | 689k | wuffs_base__u64__min(uint64_t x, uint64_t y) { | 1079 | 689k | return x < y ? x : y; | 1080 | 689k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u64__min(unsigned long, unsigned long) gif_fuzzer.c:wuffs_base__u64__min Line | Count | Source | 1078 | 375k | wuffs_base__u64__min(uint64_t x, uint64_t y) { | 1079 | 375k | return x < y ? x : y; | 1080 | 375k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u64__min Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u64__min cbor_fuzzer.c:wuffs_base__u64__min Line | Count | Source | 1078 | 780k | wuffs_base__u64__min(uint64_t x, uint64_t y) { | 1079 | 780k | return x < y ? x : y; | 1080 | 780k | } |
bmp_fuzzer.c:wuffs_base__u64__min Line | Count | Source | 1078 | 716 | wuffs_base__u64__min(uint64_t x, uint64_t y) { | 1079 | 716 | return x < y ? x : y; | 1080 | 716 | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u64__min Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u64__min targa_fuzzer.c:wuffs_base__u64__min Line | Count | Source | 1078 | 888k | wuffs_base__u64__min(uint64_t x, uint64_t y) { | 1079 | 888k | return x < y ? x : y; | 1080 | 888k | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u64__min Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u64__min |
1081 | | |
1082 | | static inline uint64_t // |
1083 | 1.74k | wuffs_base__u64__max(uint64_t x, uint64_t y) { |
1084 | 1.74k | return x > y ? x : y; |
1085 | 1.74k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u64__max Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u64__max(unsigned long, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u64__max Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u64__max Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u64__max Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u64__max Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u64__max Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u64__max Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u64__max Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u64__max Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u64__max webp_fuzzer.c:wuffs_base__u64__max Line | Count | Source | 1083 | 1.74k | wuffs_base__u64__max(uint64_t x, uint64_t y) { | 1084 | 1.74k | return x > y ? x : y; | 1085 | 1.74k | } |
|
1086 | | |
1087 | | // -------- |
1088 | | |
1089 | | static inline uint8_t // |
1090 | 0 | wuffs_base__u8__rotate_left(uint8_t x, uint32_t n) { |
1091 | 0 | n &= 7; |
1092 | 0 | return ((uint8_t)(x << n)) | ((uint8_t)(x >> (8 - n))); |
1093 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u8__rotate_left Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u8__rotate_left(unsigned char, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u8__rotate_left Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u8__rotate_left Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u8__rotate_left Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u8__rotate_left Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u8__rotate_left Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u8__rotate_left Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u8__rotate_left Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u8__rotate_left Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u8__rotate_left Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u8__rotate_left |
1094 | | |
1095 | | static inline uint8_t // |
1096 | 0 | wuffs_base__u8__rotate_right(uint8_t x, uint32_t n) { |
1097 | 0 | n &= 7; |
1098 | 0 | return ((uint8_t)(x >> n)) | ((uint8_t)(x << (8 - n))); |
1099 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u8__rotate_right Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u8__rotate_right(unsigned char, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u8__rotate_right Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u8__rotate_right Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u8__rotate_right Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u8__rotate_right Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u8__rotate_right Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u8__rotate_right Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u8__rotate_right Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u8__rotate_right Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u8__rotate_right Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u8__rotate_right |
1100 | | |
1101 | | static inline uint16_t // |
1102 | 0 | wuffs_base__u16__rotate_left(uint16_t x, uint32_t n) { |
1103 | 0 | n &= 15; |
1104 | 0 | return ((uint16_t)(x << n)) | ((uint16_t)(x >> (16 - n))); |
1105 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u16__rotate_left Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u16__rotate_left(unsigned short, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u16__rotate_left Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u16__rotate_left Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u16__rotate_left Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u16__rotate_left Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u16__rotate_left Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u16__rotate_left Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u16__rotate_left Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u16__rotate_left Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u16__rotate_left Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u16__rotate_left |
1106 | | |
1107 | | static inline uint16_t // |
1108 | 0 | wuffs_base__u16__rotate_right(uint16_t x, uint32_t n) { |
1109 | 0 | n &= 15; |
1110 | 0 | return ((uint16_t)(x >> n)) | ((uint16_t)(x << (16 - n))); |
1111 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u16__rotate_right Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u16__rotate_right(unsigned short, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u16__rotate_right Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u16__rotate_right Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u16__rotate_right Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u16__rotate_right Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u16__rotate_right Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u16__rotate_right Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u16__rotate_right Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u16__rotate_right Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u16__rotate_right Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u16__rotate_right |
1112 | | |
1113 | | static inline uint32_t // |
1114 | 0 | wuffs_base__u32__rotate_left(uint32_t x, uint32_t n) { |
1115 | 0 | n &= 31; |
1116 | 0 | return ((uint32_t)(x << n)) | ((uint32_t)(x >> (32 - n))); |
1117 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u32__rotate_left Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u32__rotate_left(unsigned int, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u32__rotate_left Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u32__rotate_left Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u32__rotate_left Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u32__rotate_left Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u32__rotate_left Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u32__rotate_left Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u32__rotate_left Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u32__rotate_left Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u32__rotate_left Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u32__rotate_left |
1118 | | |
1119 | | static inline uint32_t // |
1120 | 0 | wuffs_base__u32__rotate_right(uint32_t x, uint32_t n) { |
1121 | 0 | n &= 31; |
1122 | 0 | return ((uint32_t)(x >> n)) | ((uint32_t)(x << (32 - n))); |
1123 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u32__rotate_right Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u32__rotate_right(unsigned int, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u32__rotate_right Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u32__rotate_right Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u32__rotate_right Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u32__rotate_right Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u32__rotate_right Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u32__rotate_right Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u32__rotate_right Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u32__rotate_right Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u32__rotate_right Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u32__rotate_right |
1124 | | |
1125 | | static inline uint64_t // |
1126 | 0 | wuffs_base__u64__rotate_left(uint64_t x, uint32_t n) { |
1127 | 0 | n &= 63; |
1128 | 0 | return ((uint64_t)(x << n)) | ((uint64_t)(x >> (64 - n))); |
1129 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u64__rotate_left Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u64__rotate_left(unsigned long, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u64__rotate_left Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u64__rotate_left Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u64__rotate_left Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u64__rotate_left Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u64__rotate_left Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u64__rotate_left Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u64__rotate_left Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u64__rotate_left Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u64__rotate_left Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u64__rotate_left |
1130 | | |
1131 | | static inline uint64_t // |
1132 | 60.3k | wuffs_base__u64__rotate_right(uint64_t x, uint32_t n) { |
1133 | 60.3k | n &= 63; |
1134 | 60.3k | return ((uint64_t)(x >> n)) | ((uint64_t)(x << (64 - n))); |
1135 | 60.3k | } png_fuzzer.c:wuffs_base__u64__rotate_right Line | Count | Source | 1132 | 6.12k | wuffs_base__u64__rotate_right(uint64_t x, uint32_t n) { | 1133 | 6.12k | n &= 63; | 1134 | 6.12k | return ((uint64_t)(x >> n)) | ((uint64_t)(x << (64 - n))); | 1135 | 6.12k | } |
json_fuzzer.cc:wuffs_base__u64__rotate_right(unsigned long, unsigned int) Line | Count | Source | 1132 | 30.2k | wuffs_base__u64__rotate_right(uint64_t x, uint32_t n) { | 1133 | 30.2k | n &= 63; | 1134 | 30.2k | return ((uint64_t)(x >> n)) | ((uint64_t)(x << (64 - n))); | 1135 | 30.2k | } |
gif_fuzzer.c:wuffs_base__u64__rotate_right Line | Count | Source | 1132 | 4.69k | wuffs_base__u64__rotate_right(uint64_t x, uint32_t n) { | 1133 | 4.69k | n &= 63; | 1134 | 4.69k | return ((uint64_t)(x >> n)) | ((uint64_t)(x << (64 - n))); | 1135 | 4.69k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u64__rotate_right jpeg_fuzzer.c:wuffs_base__u64__rotate_right Line | Count | Source | 1132 | 3.92k | wuffs_base__u64__rotate_right(uint64_t x, uint32_t n) { | 1133 | 3.92k | n &= 63; | 1134 | 3.92k | return ((uint64_t)(x >> n)) | ((uint64_t)(x << (64 - n))); | 1135 | 3.92k | } |
cbor_fuzzer.c:wuffs_base__u64__rotate_right Line | Count | Source | 1132 | 6.03k | wuffs_base__u64__rotate_right(uint64_t x, uint32_t n) { | 1133 | 6.03k | n &= 63; | 1134 | 6.03k | return ((uint64_t)(x >> n)) | ((uint64_t)(x << (64 - n))); | 1135 | 6.03k | } |
bmp_fuzzer.c:wuffs_base__u64__rotate_right Line | Count | Source | 1132 | 3.18k | wuffs_base__u64__rotate_right(uint64_t x, uint32_t n) { | 1133 | 3.18k | n &= 63; | 1134 | 3.18k | return ((uint64_t)(x >> n)) | ((uint64_t)(x << (64 - n))); | 1135 | 3.18k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u64__rotate_right Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u64__rotate_right targa_fuzzer.c:wuffs_base__u64__rotate_right Line | Count | Source | 1132 | 1.17k | wuffs_base__u64__rotate_right(uint64_t x, uint32_t n) { | 1133 | 1.17k | n &= 63; | 1134 | 1.17k | return ((uint64_t)(x >> n)) | ((uint64_t)(x << (64 - n))); | 1135 | 1.17k | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u64__rotate_right webp_fuzzer.c:wuffs_base__u64__rotate_right Line | Count | Source | 1132 | 4.98k | wuffs_base__u64__rotate_right(uint64_t x, uint32_t n) { | 1133 | 4.98k | n &= 63; | 1134 | 4.98k | return ((uint64_t)(x >> n)) | ((uint64_t)(x << (64 - n))); | 1135 | 4.98k | } |
|
1136 | | |
1137 | | // -------- |
1138 | | |
1139 | | // Saturating arithmetic (sat_add, sat_sub) branchless bit-twiddling algorithms |
1140 | | // are per https://locklessinc.com/articles/sat_arithmetic/ |
1141 | | // |
1142 | | // It is important that the underlying types are unsigned integers, as signed |
1143 | | // integer arithmetic overflow is undefined behavior in C. |
1144 | | |
1145 | | static inline uint8_t // |
1146 | 0 | wuffs_base__u8__sat_add(uint8_t x, uint8_t y) { |
1147 | 0 | uint8_t res = (uint8_t)(x + y); |
1148 | 0 | res |= (uint8_t)(-(res < x)); |
1149 | 0 | return res; |
1150 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u8__sat_add Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u8__sat_add(unsigned char, unsigned char) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u8__sat_add Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u8__sat_add Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u8__sat_add Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u8__sat_add Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u8__sat_add Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u8__sat_add Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u8__sat_add Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u8__sat_add Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u8__sat_add Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u8__sat_add |
1151 | | |
1152 | | static inline uint8_t // |
1153 | 0 | wuffs_base__u8__sat_sub(uint8_t x, uint8_t y) { |
1154 | 0 | uint8_t res = (uint8_t)(x - y); |
1155 | 0 | res &= (uint8_t)(-(res <= x)); |
1156 | 0 | return res; |
1157 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u8__sat_sub Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u8__sat_sub(unsigned char, unsigned char) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u8__sat_sub Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u8__sat_sub Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u8__sat_sub Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u8__sat_sub Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u8__sat_sub Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u8__sat_sub Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u8__sat_sub Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u8__sat_sub Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u8__sat_sub Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u8__sat_sub |
1158 | | |
1159 | | static inline uint16_t // |
1160 | 0 | wuffs_base__u16__sat_add(uint16_t x, uint16_t y) { |
1161 | 0 | uint16_t res = (uint16_t)(x + y); |
1162 | 0 | res |= (uint16_t)(-(res < x)); |
1163 | 0 | return res; |
1164 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u16__sat_add Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u16__sat_add(unsigned short, unsigned short) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u16__sat_add Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u16__sat_add Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u16__sat_add Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u16__sat_add Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u16__sat_add Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u16__sat_add Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u16__sat_add Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u16__sat_add Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u16__sat_add Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u16__sat_add |
1165 | | |
1166 | | static inline uint16_t // |
1167 | 0 | wuffs_base__u16__sat_sub(uint16_t x, uint16_t y) { |
1168 | 0 | uint16_t res = (uint16_t)(x - y); |
1169 | 0 | res &= (uint16_t)(-(res <= x)); |
1170 | 0 | return res; |
1171 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u16__sat_sub Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u16__sat_sub(unsigned short, unsigned short) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u16__sat_sub Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u16__sat_sub Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u16__sat_sub Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u16__sat_sub Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u16__sat_sub Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u16__sat_sub Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u16__sat_sub Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u16__sat_sub Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u16__sat_sub Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u16__sat_sub |
1172 | | |
1173 | | static inline uint32_t // |
1174 | 11.2M | wuffs_base__u32__sat_add(uint32_t x, uint32_t y) { |
1175 | 11.2M | uint32_t res = (uint32_t)(x + y); |
1176 | 11.2M | res |= (uint32_t)(-(res < x)); |
1177 | 11.2M | return res; |
1178 | 11.2M | } png_fuzzer.c:wuffs_base__u32__sat_add Line | Count | Source | 1174 | 9.08k | wuffs_base__u32__sat_add(uint32_t x, uint32_t y) { | 1175 | 9.08k | uint32_t res = (uint32_t)(x + y); | 1176 | 9.08k | res |= (uint32_t)(-(res < x)); | 1177 | 9.08k | return res; | 1178 | 9.08k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u32__sat_add(unsigned int, unsigned int) gif_fuzzer.c:wuffs_base__u32__sat_add Line | Count | Source | 1174 | 7.32M | wuffs_base__u32__sat_add(uint32_t x, uint32_t y) { | 1175 | 7.32M | uint32_t res = (uint32_t)(x + y); | 1176 | 7.32M | res |= (uint32_t)(-(res < x)); | 1177 | 7.32M | return res; | 1178 | 7.32M | } |
xz_fuzzer.c:wuffs_base__u32__sat_add Line | Count | Source | 1174 | 16.3k | wuffs_base__u32__sat_add(uint32_t x, uint32_t y) { | 1175 | 16.3k | uint32_t res = (uint32_t)(x + y); | 1176 | 16.3k | res |= (uint32_t)(-(res < x)); | 1177 | 16.3k | return res; | 1178 | 16.3k | } |
jpeg_fuzzer.c:wuffs_base__u32__sat_add Line | Count | Source | 1174 | 2.05k | wuffs_base__u32__sat_add(uint32_t x, uint32_t y) { | 1175 | 2.05k | uint32_t res = (uint32_t)(x + y); | 1176 | 2.05k | res |= (uint32_t)(-(res < x)); | 1177 | 2.05k | return res; | 1178 | 2.05k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u32__sat_add bmp_fuzzer.c:wuffs_base__u32__sat_add Line | Count | Source | 1174 | 3.89M | wuffs_base__u32__sat_add(uint32_t x, uint32_t y) { | 1175 | 3.89M | uint32_t res = (uint32_t)(x + y); | 1176 | 3.89M | res |= (uint32_t)(-(res < x)); | 1177 | 3.89M | return res; | 1178 | 3.89M | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u32__sat_add Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u32__sat_add Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u32__sat_add Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u32__sat_add Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u32__sat_add |
1179 | | |
1180 | | static inline uint32_t // |
1181 | 1.08G | wuffs_base__u32__sat_sub(uint32_t x, uint32_t y) { |
1182 | 1.08G | uint32_t res = (uint32_t)(x - y); |
1183 | 1.08G | res &= (uint32_t)(-(res <= x)); |
1184 | 1.08G | return res; |
1185 | 1.08G | } png_fuzzer.c:wuffs_base__u32__sat_sub Line | Count | Source | 1181 | 21.2k | wuffs_base__u32__sat_sub(uint32_t x, uint32_t y) { | 1182 | 21.2k | uint32_t res = (uint32_t)(x - y); | 1183 | 21.2k | res &= (uint32_t)(-(res <= x)); | 1184 | 21.2k | return res; | 1185 | 21.2k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u32__sat_sub(unsigned int, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__u32__sat_sub Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u32__sat_sub jpeg_fuzzer.c:wuffs_base__u32__sat_sub Line | Count | Source | 1181 | 1.08G | wuffs_base__u32__sat_sub(uint32_t x, uint32_t y) { | 1182 | 1.08G | uint32_t res = (uint32_t)(x - y); | 1183 | 1.08G | res &= (uint32_t)(-(res <= x)); | 1184 | 1.08G | return res; | 1185 | 1.08G | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u32__sat_sub bmp_fuzzer.c:wuffs_base__u32__sat_sub Line | Count | Source | 1181 | 61.6k | wuffs_base__u32__sat_sub(uint32_t x, uint32_t y) { | 1182 | 61.6k | uint32_t res = (uint32_t)(x - y); | 1183 | 61.6k | res &= (uint32_t)(-(res <= x)); | 1184 | 61.6k | return res; | 1185 | 61.6k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u32__sat_sub Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u32__sat_sub Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u32__sat_sub Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u32__sat_sub webp_fuzzer.c:wuffs_base__u32__sat_sub Line | Count | Source | 1181 | 17.6k | wuffs_base__u32__sat_sub(uint32_t x, uint32_t y) { | 1182 | 17.6k | uint32_t res = (uint32_t)(x - y); | 1183 | 17.6k | res &= (uint32_t)(-(res <= x)); | 1184 | 17.6k | return res; | 1185 | 17.6k | } |
|
1186 | | |
1187 | | static inline uint64_t // |
1188 | 29.6M | wuffs_base__u64__sat_add(uint64_t x, uint64_t y) { |
1189 | 29.6M | uint64_t res = (uint64_t)(x + y); |
1190 | 29.6M | res |= (uint64_t)(-(res < x)); |
1191 | 29.6M | return res; |
1192 | 29.6M | } png_fuzzer.c:wuffs_base__u64__sat_add Line | Count | Source | 1188 | 44.2k | wuffs_base__u64__sat_add(uint64_t x, uint64_t y) { | 1189 | 44.2k | uint64_t res = (uint64_t)(x + y); | 1190 | 44.2k | res |= (uint64_t)(-(res < x)); | 1191 | 44.2k | return res; | 1192 | 44.2k | } |
json_fuzzer.cc:wuffs_base__u64__sat_add(unsigned long, unsigned long) Line | Count | Source | 1188 | 3.26M | wuffs_base__u64__sat_add(uint64_t x, uint64_t y) { | 1189 | 3.26M | uint64_t res = (uint64_t)(x + y); | 1190 | 3.26M | res |= (uint64_t)(-(res < x)); | 1191 | 3.26M | return res; | 1192 | 3.26M | } |
gif_fuzzer.c:wuffs_base__u64__sat_add Line | Count | Source | 1188 | 1.72M | wuffs_base__u64__sat_add(uint64_t x, uint64_t y) { | 1189 | 1.72M | uint64_t res = (uint64_t)(x + y); | 1190 | 1.72M | res |= (uint64_t)(-(res < x)); | 1191 | 1.72M | return res; | 1192 | 1.72M | } |
xz_fuzzer.c:wuffs_base__u64__sat_add Line | Count | Source | 1188 | 199k | wuffs_base__u64__sat_add(uint64_t x, uint64_t y) { | 1189 | 199k | uint64_t res = (uint64_t)(x + y); | 1190 | 199k | res |= (uint64_t)(-(res < x)); | 1191 | 199k | return res; | 1192 | 199k | } |
jpeg_fuzzer.c:wuffs_base__u64__sat_add Line | Count | Source | 1188 | 23.5M | wuffs_base__u64__sat_add(uint64_t x, uint64_t y) { | 1189 | 23.5M | uint64_t res = (uint64_t)(x + y); | 1190 | 23.5M | res |= (uint64_t)(-(res < x)); | 1191 | 23.5M | return res; | 1192 | 23.5M | } |
cbor_fuzzer.c:wuffs_base__u64__sat_add Line | Count | Source | 1188 | 896k | wuffs_base__u64__sat_add(uint64_t x, uint64_t y) { | 1189 | 896k | uint64_t res = (uint64_t)(x + y); | 1190 | 896k | res |= (uint64_t)(-(res < x)); | 1191 | 896k | return res; | 1192 | 896k | } |
bmp_fuzzer.c:wuffs_base__u64__sat_add Line | Count | Source | 1188 | 8.01k | wuffs_base__u64__sat_add(uint64_t x, uint64_t y) { | 1189 | 8.01k | uint64_t res = (uint64_t)(x + y); | 1190 | 8.01k | res |= (uint64_t)(-(res < x)); | 1191 | 8.01k | return res; | 1192 | 8.01k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u64__sat_add zlib_fuzzer.c:wuffs_base__u64__sat_add Line | Count | Source | 1188 | 8.99k | wuffs_base__u64__sat_add(uint64_t x, uint64_t y) { | 1189 | 8.99k | uint64_t res = (uint64_t)(x + y); | 1190 | 8.99k | res |= (uint64_t)(-(res < x)); | 1191 | 8.99k | return res; | 1192 | 8.99k | } |
targa_fuzzer.c:wuffs_base__u64__sat_add Line | Count | Source | 1188 | 918 | wuffs_base__u64__sat_add(uint64_t x, uint64_t y) { | 1189 | 918 | uint64_t res = (uint64_t)(x + y); | 1190 | 918 | res |= (uint64_t)(-(res < x)); | 1191 | 918 | return res; | 1192 | 918 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u64__sat_add webp_fuzzer.c:wuffs_base__u64__sat_add Line | Count | Source | 1188 | 6.43k | wuffs_base__u64__sat_add(uint64_t x, uint64_t y) { | 1189 | 6.43k | uint64_t res = (uint64_t)(x + y); | 1190 | 6.43k | res |= (uint64_t)(-(res < x)); | 1191 | 6.43k | return res; | 1192 | 6.43k | } |
|
1193 | | |
1194 | | static inline uint64_t // |
1195 | 195k | wuffs_base__u64__sat_sub(uint64_t x, uint64_t y) { |
1196 | 195k | uint64_t res = (uint64_t)(x - y); |
1197 | 195k | res &= (uint64_t)(-(res <= x)); |
1198 | 195k | return res; |
1199 | 195k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__u64__sat_sub Unexecuted instantiation: json_fuzzer.cc:wuffs_base__u64__sat_sub(unsigned long, unsigned long) gif_fuzzer.c:wuffs_base__u64__sat_sub Line | Count | Source | 1195 | 195k | wuffs_base__u64__sat_sub(uint64_t x, uint64_t y) { | 1196 | 195k | uint64_t res = (uint64_t)(x - y); | 1197 | 195k | res &= (uint64_t)(-(res <= x)); | 1198 | 195k | return res; | 1199 | 195k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__u64__sat_sub Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__u64__sat_sub Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__u64__sat_sub Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__u64__sat_sub Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__u64__sat_sub Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__u64__sat_sub Unexecuted instantiation: targa_fuzzer.c:wuffs_base__u64__sat_sub Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__u64__sat_sub Unexecuted instantiation: webp_fuzzer.c:wuffs_base__u64__sat_sub |
1200 | | |
1201 | | // -------- |
1202 | | |
1203 | | typedef struct wuffs_base__multiply_u64__output__struct { |
1204 | | uint64_t lo; |
1205 | | uint64_t hi; |
1206 | | } wuffs_base__multiply_u64__output; |
1207 | | |
1208 | | // wuffs_base__multiply_u64 returns x*y as a 128-bit value. |
1209 | | // |
1210 | | // The maximum inclusive output hi_lo is 0xFFFFFFFFFFFFFFFE_0000000000000001. |
1211 | | static inline wuffs_base__multiply_u64__output // |
1212 | 39.4k | wuffs_base__multiply_u64(uint64_t x, uint64_t y) { |
1213 | 39.4k | #if defined(__SIZEOF_INT128__) |
1214 | 39.4k | __uint128_t z = ((__uint128_t)x) * ((__uint128_t)y); |
1215 | 39.4k | wuffs_base__multiply_u64__output o; |
1216 | 39.4k | o.lo = ((uint64_t)(z)); |
1217 | 39.4k | o.hi = ((uint64_t)(z >> 64)); |
1218 | 39.4k | return o; |
1219 | | #else |
1220 | | // TODO: consider using the _mul128 intrinsic if defined(_MSC_VER). |
1221 | | uint64_t x0 = x & 0xFFFFFFFF; |
1222 | | uint64_t x1 = x >> 32; |
1223 | | uint64_t y0 = y & 0xFFFFFFFF; |
1224 | | uint64_t y1 = y >> 32; |
1225 | | uint64_t w0 = x0 * y0; |
1226 | | uint64_t t = (x1 * y0) + (w0 >> 32); |
1227 | | uint64_t w1 = t & 0xFFFFFFFF; |
1228 | | uint64_t w2 = t >> 32; |
1229 | | w1 += x0 * y1; |
1230 | | wuffs_base__multiply_u64__output o; |
1231 | | o.lo = x * y; |
1232 | | o.hi = (x1 * y1) + w2 + (w1 >> 32); |
1233 | | return o; |
1234 | | #endif |
1235 | 39.4k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__multiply_u64 json_fuzzer.cc:wuffs_base__multiply_u64(unsigned long, unsigned long) Line | Count | Source | 1212 | 39.4k | wuffs_base__multiply_u64(uint64_t x, uint64_t y) { | 1213 | 39.4k | #if defined(__SIZEOF_INT128__) | 1214 | 39.4k | __uint128_t z = ((__uint128_t)x) * ((__uint128_t)y); | 1215 | 39.4k | wuffs_base__multiply_u64__output o; | 1216 | 39.4k | o.lo = ((uint64_t)(z)); | 1217 | 39.4k | o.hi = ((uint64_t)(z >> 64)); | 1218 | 39.4k | return o; | 1219 | | #else | 1220 | | // TODO: consider using the _mul128 intrinsic if defined(_MSC_VER). | 1221 | | uint64_t x0 = x & 0xFFFFFFFF; | 1222 | | uint64_t x1 = x >> 32; | 1223 | | uint64_t y0 = y & 0xFFFFFFFF; | 1224 | | uint64_t y1 = y >> 32; | 1225 | | uint64_t w0 = x0 * y0; | 1226 | | uint64_t t = (x1 * y0) + (w0 >> 32); | 1227 | | uint64_t w1 = t & 0xFFFFFFFF; | 1228 | | uint64_t w2 = t >> 32; | 1229 | | w1 += x0 * y1; | 1230 | | wuffs_base__multiply_u64__output o; | 1231 | | o.lo = x * y; | 1232 | | o.hi = (x1 * y1) + w2 + (w1 >> 32); | 1233 | | return o; | 1234 | | #endif | 1235 | 39.4k | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__multiply_u64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__multiply_u64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__multiply_u64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__multiply_u64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__multiply_u64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__multiply_u64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__multiply_u64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__multiply_u64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__multiply_u64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__multiply_u64 |
1236 | | |
1237 | | // -------- |
1238 | | |
1239 | | typedef struct wuffs_base__bitvec256__struct { |
1240 | | // elements_u64[0] holds the LSBs (least significant bits) and |
1241 | | // elements_u64[3] holds the MSBs (most significant bits). |
1242 | | uint64_t elements_u64[4]; |
1243 | | } wuffs_base__bitvec256; |
1244 | | |
1245 | | static inline wuffs_base__bitvec256 // |
1246 | | wuffs_base__make_bitvec256(uint64_t e00, |
1247 | | uint64_t e01, |
1248 | | uint64_t e02, |
1249 | 581 | uint64_t e03) { |
1250 | 581 | wuffs_base__bitvec256 res; |
1251 | 581 | res.elements_u64[0] = e00; |
1252 | 581 | res.elements_u64[1] = e01; |
1253 | 581 | res.elements_u64[2] = e02; |
1254 | 581 | res.elements_u64[3] = e03; |
1255 | 581 | return res; |
1256 | 581 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_bitvec256 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_bitvec256(unsigned long, unsigned long, unsigned long, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_bitvec256 xz_fuzzer.c:wuffs_base__make_bitvec256 Line | Count | Source | 1249 | 581 | uint64_t e03) { | 1250 | 581 | wuffs_base__bitvec256 res; | 1251 | 581 | res.elements_u64[0] = e00; | 1252 | 581 | res.elements_u64[1] = e01; | 1253 | 581 | res.elements_u64[2] = e02; | 1254 | 581 | res.elements_u64[3] = e03; | 1255 | 581 | return res; | 1256 | 581 | } |
Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_bitvec256 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_bitvec256 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_bitvec256 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_bitvec256 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_bitvec256 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_bitvec256 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_bitvec256 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_bitvec256 |
1257 | | |
1258 | | static inline uint64_t // |
1259 | 1.56k | wuffs_base__bitvec256__get_u64(const wuffs_base__bitvec256* b, uint32_t i) { |
1260 | 1.56k | return b->elements_u64[i & 3]; |
1261 | 1.56k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__bitvec256__get_u64 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__bitvec256__get_u64(wuffs_base__bitvec256__struct const*, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__bitvec256__get_u64 xz_fuzzer.c:wuffs_base__bitvec256__get_u64 Line | Count | Source | 1259 | 1.56k | wuffs_base__bitvec256__get_u64(const wuffs_base__bitvec256* b, uint32_t i) { | 1260 | 1.56k | return b->elements_u64[i & 3]; | 1261 | 1.56k | } |
Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__bitvec256__get_u64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__bitvec256__get_u64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__bitvec256__get_u64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__bitvec256__get_u64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__bitvec256__get_u64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__bitvec256__get_u64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__bitvec256__get_u64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__bitvec256__get_u64 |
1262 | | |
1263 | | // -------- |
1264 | | |
1265 | | // wuffs_base__optional_u63 is like a std::optional<uint64_t>, but for C (not |
1266 | | // just C++) and the value can only hold 63 bits (not 64). |
1267 | | // |
1268 | | // Do not manipulate repr directly; it is a private implementation detail. |
1269 | | typedef struct wuffs_base__optional_u63__struct { |
1270 | | uint64_t repr; |
1271 | | |
1272 | | #ifdef __cplusplus |
1273 | | inline bool has_value() const; |
1274 | | inline uint64_t value() const; |
1275 | | inline uint64_t value_or(uint64_t default_value) const; |
1276 | | #endif // __cplusplus |
1277 | | |
1278 | | } wuffs_base__optional_u63; |
1279 | | |
1280 | | // wuffs_base__make_optional_u63 ignores value when has_value is false. |
1281 | | // |
1282 | | // Preconditions: |
1283 | | // - value < (1 << 63). |
1284 | | static inline wuffs_base__optional_u63 // |
1285 | 0 | wuffs_base__make_optional_u63(bool has_value, uint64_t value) { |
1286 | 0 | wuffs_base__optional_u63 res; |
1287 | 0 | res.repr = has_value ? ((value << 1u) | 1u) : 0u; |
1288 | 0 | return res; |
1289 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_optional_u63 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_optional_u63(bool, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_optional_u63 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_optional_u63 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_optional_u63 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_optional_u63 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_optional_u63 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_optional_u63 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_optional_u63 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_optional_u63 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_optional_u63 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_optional_u63 |
1290 | | |
1291 | | static inline bool // |
1292 | 0 | wuffs_base__optional_u63__has_value(const wuffs_base__optional_u63* o) { |
1293 | 0 | return o->repr; |
1294 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__optional_u63__has_value Unexecuted instantiation: json_fuzzer.cc:wuffs_base__optional_u63__has_value(wuffs_base__optional_u63__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__optional_u63__has_value Unexecuted instantiation: xz_fuzzer.c:wuffs_base__optional_u63__has_value Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__optional_u63__has_value Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__optional_u63__has_value Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__optional_u63__has_value Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__optional_u63__has_value Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__optional_u63__has_value Unexecuted instantiation: targa_fuzzer.c:wuffs_base__optional_u63__has_value Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__optional_u63__has_value Unexecuted instantiation: webp_fuzzer.c:wuffs_base__optional_u63__has_value |
1295 | | |
1296 | | // wuffs_base__optional_u63__value returns zero when o does not have a value. |
1297 | | static inline uint64_t // |
1298 | 0 | wuffs_base__optional_u63__value(const wuffs_base__optional_u63* o) { |
1299 | 0 | return o->repr >> 1u; |
1300 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__optional_u63__value Unexecuted instantiation: json_fuzzer.cc:wuffs_base__optional_u63__value(wuffs_base__optional_u63__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__optional_u63__value Unexecuted instantiation: xz_fuzzer.c:wuffs_base__optional_u63__value Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__optional_u63__value Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__optional_u63__value Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__optional_u63__value Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__optional_u63__value Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__optional_u63__value Unexecuted instantiation: targa_fuzzer.c:wuffs_base__optional_u63__value Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__optional_u63__value Unexecuted instantiation: webp_fuzzer.c:wuffs_base__optional_u63__value |
1301 | | |
1302 | | static inline uint64_t // |
1303 | | wuffs_base__optional_u63__value_or(const wuffs_base__optional_u63* o, |
1304 | 0 | uint64_t default_value) { |
1305 | 0 | return o->repr ? (o->repr >> 1u) : default_value; |
1306 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__optional_u63__value_or Unexecuted instantiation: json_fuzzer.cc:wuffs_base__optional_u63__value_or(wuffs_base__optional_u63__struct const*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__optional_u63__value_or Unexecuted instantiation: xz_fuzzer.c:wuffs_base__optional_u63__value_or Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__optional_u63__value_or Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__optional_u63__value_or Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__optional_u63__value_or Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__optional_u63__value_or Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__optional_u63__value_or Unexecuted instantiation: targa_fuzzer.c:wuffs_base__optional_u63__value_or Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__optional_u63__value_or Unexecuted instantiation: webp_fuzzer.c:wuffs_base__optional_u63__value_or |
1307 | | |
1308 | | #ifdef __cplusplus |
1309 | | |
1310 | | inline bool // |
1311 | 0 | wuffs_base__optional_u63::has_value() const { |
1312 | 0 | return wuffs_base__optional_u63__has_value(this); |
1313 | 0 | } |
1314 | | |
1315 | | inline uint64_t // |
1316 | 0 | wuffs_base__optional_u63::value() const { |
1317 | 0 | return wuffs_base__optional_u63__value(this); |
1318 | 0 | } |
1319 | | |
1320 | | inline uint64_t // |
1321 | 0 | wuffs_base__optional_u63::value_or(uint64_t default_value) const { |
1322 | 0 | return wuffs_base__optional_u63__value_or(this, default_value); |
1323 | 0 | } |
1324 | | |
1325 | | #endif // __cplusplus |
1326 | | |
1327 | | // -------- |
1328 | | |
1329 | | // The "defined(__clang__)" isn't redundant. While vanilla clang defines |
1330 | | // __GNUC__, clang-cl (which mimics MSVC's cl.exe) does not. |
1331 | | #if (defined(__GNUC__) || defined(__clang__)) && (__SIZEOF_LONG__ == 8) |
1332 | | |
1333 | | static inline uint32_t // |
1334 | 35.8k | wuffs_base__count_leading_zeroes_u64(uint64_t u) { |
1335 | 35.8k | return u ? ((uint32_t)(__builtin_clzl(u))) : 64u; |
1336 | 35.8k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__count_leading_zeroes_u64 json_fuzzer.cc:wuffs_base__count_leading_zeroes_u64(unsigned long) Line | Count | Source | 1334 | 35.8k | wuffs_base__count_leading_zeroes_u64(uint64_t u) { | 1335 | 35.8k | return u ? ((uint32_t)(__builtin_clzl(u))) : 64u; | 1336 | 35.8k | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__count_leading_zeroes_u64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__count_leading_zeroes_u64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__count_leading_zeroes_u64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__count_leading_zeroes_u64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__count_leading_zeroes_u64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__count_leading_zeroes_u64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__count_leading_zeroes_u64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__count_leading_zeroes_u64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__count_leading_zeroes_u64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__count_leading_zeroes_u64 |
1337 | | |
1338 | | #else |
1339 | | // TODO: consider using the _BitScanReverse intrinsic if defined(_MSC_VER). |
1340 | | |
1341 | | static inline uint32_t // |
1342 | | wuffs_base__count_leading_zeroes_u64(uint64_t u) { |
1343 | | if (u == 0) { |
1344 | | return 64; |
1345 | | } |
1346 | | |
1347 | | uint32_t n = 0; |
1348 | | if ((u >> 32) == 0) { |
1349 | | n |= 32; |
1350 | | u <<= 32; |
1351 | | } |
1352 | | if ((u >> 48) == 0) { |
1353 | | n |= 16; |
1354 | | u <<= 16; |
1355 | | } |
1356 | | if ((u >> 56) == 0) { |
1357 | | n |= 8; |
1358 | | u <<= 8; |
1359 | | } |
1360 | | if ((u >> 60) == 0) { |
1361 | | n |= 4; |
1362 | | u <<= 4; |
1363 | | } |
1364 | | if ((u >> 62) == 0) { |
1365 | | n |= 2; |
1366 | | u <<= 2; |
1367 | | } |
1368 | | if ((u >> 63) == 0) { |
1369 | | n |= 1; |
1370 | | u <<= 1; |
1371 | | } |
1372 | | return n; |
1373 | | } |
1374 | | |
1375 | | #endif // (defined(__GNUC__) || defined(__clang__)) && (__SIZEOF_LONG__ == 8) |
1376 | | |
1377 | | // -------- |
1378 | | |
1379 | | // Normally, the wuffs_base__peek_etc and wuffs_base__poke_etc implementations |
1380 | | // are both (1) correct regardless of CPU endianness and (2) very fast (e.g. an |
1381 | | // inlined wuffs_base__peek_u32le__no_bounds_check call, in an optimized clang |
1382 | | // or gcc build, is a single MOV instruction on x86_64). |
1383 | | // |
1384 | | // However, the endian-agnostic implementations are slow on Microsoft's C |
1385 | | // compiler (MSC). Alternative memcpy-based implementations restore speed, but |
1386 | | // they are only correct on little-endian CPU architectures. Defining |
1387 | | // WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE opts in to these implementations. |
1388 | | // |
1389 | | // https://godbolt.org/z/q4MfjzTPh |
1390 | | #if defined(_MSC_VER) && !defined(__clang__) && \ |
1391 | | (defined(_M_ARM64) || defined(_M_X64)) |
1392 | | #define WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE |
1393 | | #endif |
1394 | | |
1395 | | #define wuffs_base__peek_u8be__no_bounds_check \ |
1396 | 149M | wuffs_base__peek_u8__no_bounds_check |
1397 | | #define wuffs_base__peek_u8le__no_bounds_check \ |
1398 | | wuffs_base__peek_u8__no_bounds_check |
1399 | | |
1400 | | static inline uint8_t // |
1401 | 149M | wuffs_base__peek_u8__no_bounds_check(const uint8_t* p) { |
1402 | 149M | return p[0]; |
1403 | 149M | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__peek_u8__no_bounds_check json_fuzzer.cc:wuffs_base__peek_u8__no_bounds_check(unsigned char const*) Line | Count | Source | 1401 | 122M | wuffs_base__peek_u8__no_bounds_check(const uint8_t* p) { | 1402 | 122M | return p[0]; | 1403 | 122M | } |
gif_fuzzer.c:wuffs_base__peek_u8__no_bounds_check Line | Count | Source | 1401 | 313k | wuffs_base__peek_u8__no_bounds_check(const uint8_t* p) { | 1402 | 313k | return p[0]; | 1403 | 313k | } |
xz_fuzzer.c:wuffs_base__peek_u8__no_bounds_check Line | Count | Source | 1401 | 5.05M | wuffs_base__peek_u8__no_bounds_check(const uint8_t* p) { | 1402 | 5.05M | return p[0]; | 1403 | 5.05M | } |
jpeg_fuzzer.c:wuffs_base__peek_u8__no_bounds_check Line | Count | Source | 1401 | 11.3M | wuffs_base__peek_u8__no_bounds_check(const uint8_t* p) { | 1402 | 11.3M | return p[0]; | 1403 | 11.3M | } |
cbor_fuzzer.c:wuffs_base__peek_u8__no_bounds_check Line | Count | Source | 1401 | 2.67M | wuffs_base__peek_u8__no_bounds_check(const uint8_t* p) { | 1402 | 2.67M | return p[0]; | 1403 | 2.67M | } |
bmp_fuzzer.c:wuffs_base__peek_u8__no_bounds_check Line | Count | Source | 1401 | 5.42M | wuffs_base__peek_u8__no_bounds_check(const uint8_t* p) { | 1402 | 5.42M | return p[0]; | 1403 | 5.42M | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__peek_u8__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__peek_u8__no_bounds_check targa_fuzzer.c:wuffs_base__peek_u8__no_bounds_check Line | Count | Source | 1401 | 1.41M | wuffs_base__peek_u8__no_bounds_check(const uint8_t* p) { | 1402 | 1.41M | return p[0]; | 1403 | 1.41M | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__peek_u8__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__peek_u8__no_bounds_check |
1404 | | |
1405 | | static inline uint16_t // |
1406 | 138k | wuffs_base__peek_u16be__no_bounds_check(const uint8_t* p) { |
1407 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) |
1408 | | uint16_t x; |
1409 | | memcpy(&x, p, 2); |
1410 | | return _byteswap_ushort(x); |
1411 | | #else |
1412 | 138k | return (uint16_t)(((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0)); |
1413 | 138k | #endif |
1414 | 138k | } png_fuzzer.c:wuffs_base__peek_u16be__no_bounds_check Line | Count | Source | 1406 | 10.8k | wuffs_base__peek_u16be__no_bounds_check(const uint8_t* p) { | 1407 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1408 | | uint16_t x; | 1409 | | memcpy(&x, p, 2); | 1410 | | return _byteswap_ushort(x); | 1411 | | #else | 1412 | 10.8k | return (uint16_t)(((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0)); | 1413 | 10.8k | #endif | 1414 | 10.8k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__peek_u16be__no_bounds_check(unsigned char const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__peek_u16be__no_bounds_check xz_fuzzer.c:wuffs_base__peek_u16be__no_bounds_check Line | Count | Source | 1406 | 69.6k | wuffs_base__peek_u16be__no_bounds_check(const uint8_t* p) { | 1407 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1408 | | uint16_t x; | 1409 | | memcpy(&x, p, 2); | 1410 | | return _byteswap_ushort(x); | 1411 | | #else | 1412 | 69.6k | return (uint16_t)(((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0)); | 1413 | 69.6k | #endif | 1414 | 69.6k | } |
jpeg_fuzzer.c:wuffs_base__peek_u16be__no_bounds_check Line | Count | Source | 1406 | 32.4k | wuffs_base__peek_u16be__no_bounds_check(const uint8_t* p) { | 1407 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1408 | | uint16_t x; | 1409 | | memcpy(&x, p, 2); | 1410 | | return _byteswap_ushort(x); | 1411 | | #else | 1412 | 32.4k | return (uint16_t)(((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0)); | 1413 | 32.4k | #endif | 1414 | 32.4k | } |
cbor_fuzzer.c:wuffs_base__peek_u16be__no_bounds_check Line | Count | Source | 1406 | 16.3k | wuffs_base__peek_u16be__no_bounds_check(const uint8_t* p) { | 1407 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1408 | | uint16_t x; | 1409 | | memcpy(&x, p, 2); | 1410 | | return _byteswap_ushort(x); | 1411 | | #else | 1412 | 16.3k | return (uint16_t)(((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0)); | 1413 | 16.3k | #endif | 1414 | 16.3k | } |
bmp_fuzzer.c:wuffs_base__peek_u16be__no_bounds_check Line | Count | Source | 1406 | 7.57k | wuffs_base__peek_u16be__no_bounds_check(const uint8_t* p) { | 1407 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1408 | | uint16_t x; | 1409 | | memcpy(&x, p, 2); | 1410 | | return _byteswap_ushort(x); | 1411 | | #else | 1412 | 7.57k | return (uint16_t)(((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0)); | 1413 | 7.57k | #endif | 1414 | 7.57k | } |
pixel_swizzler_fuzzer.c:wuffs_base__peek_u16be__no_bounds_check Line | Count | Source | 1406 | 62 | wuffs_base__peek_u16be__no_bounds_check(const uint8_t* p) { | 1407 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1408 | | uint16_t x; | 1409 | | memcpy(&x, p, 2); | 1410 | | return _byteswap_ushort(x); | 1411 | | #else | 1412 | 62 | return (uint16_t)(((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0)); | 1413 | 62 | #endif | 1414 | 62 | } |
zlib_fuzzer.c:wuffs_base__peek_u16be__no_bounds_check Line | Count | Source | 1406 | 1.36k | wuffs_base__peek_u16be__no_bounds_check(const uint8_t* p) { | 1407 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1408 | | uint16_t x; | 1409 | | memcpy(&x, p, 2); | 1410 | | return _byteswap_ushort(x); | 1411 | | #else | 1412 | 1.36k | return (uint16_t)(((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0)); | 1413 | 1.36k | #endif | 1414 | 1.36k | } |
Unexecuted instantiation: targa_fuzzer.c:wuffs_base__peek_u16be__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__peek_u16be__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__peek_u16be__no_bounds_check |
1415 | | |
1416 | | static inline uint16_t // |
1417 | 34.5M | wuffs_base__peek_u16le__no_bounds_check(const uint8_t* p) { |
1418 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) |
1419 | | uint16_t x; |
1420 | | memcpy(&x, p, 2); |
1421 | | return x; |
1422 | | #else |
1423 | 34.5M | return (uint16_t)(((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8)); |
1424 | 34.5M | #endif |
1425 | 34.5M | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__peek_u16le__no_bounds_check json_fuzzer.cc:wuffs_base__peek_u16le__no_bounds_check(unsigned char const*) Line | Count | Source | 1417 | 28.9M | wuffs_base__peek_u16le__no_bounds_check(const uint8_t* p) { | 1418 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1419 | | uint16_t x; | 1420 | | memcpy(&x, p, 2); | 1421 | | return x; | 1422 | | #else | 1423 | 28.9M | return (uint16_t)(((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8)); | 1424 | 28.9M | #endif | 1425 | 28.9M | } |
gif_fuzzer.c:wuffs_base__peek_u16le__no_bounds_check Line | Count | Source | 1417 | 1.15M | wuffs_base__peek_u16le__no_bounds_check(const uint8_t* p) { | 1418 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1419 | | uint16_t x; | 1420 | | memcpy(&x, p, 2); | 1421 | | return x; | 1422 | | #else | 1423 | 1.15M | return (uint16_t)(((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8)); | 1424 | 1.15M | #endif | 1425 | 1.15M | } |
xz_fuzzer.c:wuffs_base__peek_u16le__no_bounds_check Line | Count | Source | 1417 | 1.80M | wuffs_base__peek_u16le__no_bounds_check(const uint8_t* p) { | 1418 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1419 | | uint16_t x; | 1420 | | memcpy(&x, p, 2); | 1421 | | return x; | 1422 | | #else | 1423 | 1.80M | return (uint16_t)(((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8)); | 1424 | 1.80M | #endif | 1425 | 1.80M | } |
jpeg_fuzzer.c:wuffs_base__peek_u16le__no_bounds_check Line | Count | Source | 1417 | 297k | wuffs_base__peek_u16le__no_bounds_check(const uint8_t* p) { | 1418 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1419 | | uint16_t x; | 1420 | | memcpy(&x, p, 2); | 1421 | | return x; | 1422 | | #else | 1423 | 297k | return (uint16_t)(((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8)); | 1424 | 297k | #endif | 1425 | 297k | } |
cbor_fuzzer.c:wuffs_base__peek_u16le__no_bounds_check Line | Count | Source | 1417 | 8.86k | wuffs_base__peek_u16le__no_bounds_check(const uint8_t* p) { | 1418 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1419 | | uint16_t x; | 1420 | | memcpy(&x, p, 2); | 1421 | | return x; | 1422 | | #else | 1423 | 8.86k | return (uint16_t)(((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8)); | 1424 | 8.86k | #endif | 1425 | 8.86k | } |
bmp_fuzzer.c:wuffs_base__peek_u16le__no_bounds_check Line | Count | Source | 1417 | 1.36M | wuffs_base__peek_u16le__no_bounds_check(const uint8_t* p) { | 1418 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1419 | | uint16_t x; | 1420 | | memcpy(&x, p, 2); | 1421 | | return x; | 1422 | | #else | 1423 | 1.36M | return (uint16_t)(((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8)); | 1424 | 1.36M | #endif | 1425 | 1.36M | } |
pixel_swizzler_fuzzer.c:wuffs_base__peek_u16le__no_bounds_check Line | Count | Source | 1417 | 9.26k | wuffs_base__peek_u16le__no_bounds_check(const uint8_t* p) { | 1418 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1419 | | uint16_t x; | 1420 | | memcpy(&x, p, 2); | 1421 | | return x; | 1422 | | #else | 1423 | 9.26k | return (uint16_t)(((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8)); | 1424 | 9.26k | #endif | 1425 | 9.26k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__peek_u16le__no_bounds_check targa_fuzzer.c:wuffs_base__peek_u16le__no_bounds_check Line | Count | Source | 1417 | 1.02M | wuffs_base__peek_u16le__no_bounds_check(const uint8_t* p) { | 1418 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1419 | | uint16_t x; | 1420 | | memcpy(&x, p, 2); | 1421 | | return x; | 1422 | | #else | 1423 | 1.02M | return (uint16_t)(((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8)); | 1424 | 1.02M | #endif | 1425 | 1.02M | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__peek_u16le__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__peek_u16le__no_bounds_check |
1426 | | |
1427 | | static inline uint32_t // |
1428 | 73.9k | wuffs_base__peek_u24be__no_bounds_check(const uint8_t* p) { |
1429 | 73.9k | return ((uint32_t)(p[0]) << 16) | ((uint32_t)(p[1]) << 8) | |
1430 | 73.9k | ((uint32_t)(p[2]) << 0); |
1431 | 73.9k | } png_fuzzer.c:wuffs_base__peek_u24be__no_bounds_check Line | Count | Source | 1428 | 12.8k | wuffs_base__peek_u24be__no_bounds_check(const uint8_t* p) { | 1429 | 12.8k | return ((uint32_t)(p[0]) << 16) | ((uint32_t)(p[1]) << 8) | | 1430 | 12.8k | ((uint32_t)(p[2]) << 0); | 1431 | 12.8k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__peek_u24be__no_bounds_check(unsigned char const*) gif_fuzzer.c:wuffs_base__peek_u24be__no_bounds_check Line | Count | Source | 1428 | 60.6k | wuffs_base__peek_u24be__no_bounds_check(const uint8_t* p) { | 1429 | 60.6k | return ((uint32_t)(p[0]) << 16) | ((uint32_t)(p[1]) << 8) | | 1430 | 60.6k | ((uint32_t)(p[2]) << 0); | 1431 | 60.6k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__peek_u24be__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__peek_u24be__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__peek_u24be__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__peek_u24be__no_bounds_check pixel_swizzler_fuzzer.c:wuffs_base__peek_u24be__no_bounds_check Line | Count | Source | 1428 | 452 | wuffs_base__peek_u24be__no_bounds_check(const uint8_t* p) { | 1429 | 452 | return ((uint32_t)(p[0]) << 16) | ((uint32_t)(p[1]) << 8) | | 1430 | 452 | ((uint32_t)(p[2]) << 0); | 1431 | 452 | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__peek_u24be__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__peek_u24be__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__peek_u24be__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__peek_u24be__no_bounds_check |
1432 | | |
1433 | | static inline uint32_t // |
1434 | 810k | wuffs_base__peek_u24le__no_bounds_check(const uint8_t* p) { |
1435 | 810k | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | |
1436 | 810k | ((uint32_t)(p[2]) << 16); |
1437 | 810k | } png_fuzzer.c:wuffs_base__peek_u24le__no_bounds_check Line | Count | Source | 1434 | 158k | wuffs_base__peek_u24le__no_bounds_check(const uint8_t* p) { | 1435 | 158k | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1436 | 158k | ((uint32_t)(p[2]) << 16); | 1437 | 158k | } |
json_fuzzer.cc:wuffs_base__peek_u24le__no_bounds_check(unsigned char const*) Line | Count | Source | 1434 | 614k | wuffs_base__peek_u24le__no_bounds_check(const uint8_t* p) { | 1435 | 614k | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1436 | 614k | ((uint32_t)(p[2]) << 16); | 1437 | 614k | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__peek_u24le__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__peek_u24le__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__peek_u24le__no_bounds_check cbor_fuzzer.c:wuffs_base__peek_u24le__no_bounds_check Line | Count | Source | 1434 | 16.5k | wuffs_base__peek_u24le__no_bounds_check(const uint8_t* p) { | 1435 | 16.5k | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1436 | 16.5k | ((uint32_t)(p[2]) << 16); | 1437 | 16.5k | } |
bmp_fuzzer.c:wuffs_base__peek_u24le__no_bounds_check Line | Count | Source | 1434 | 9.69k | wuffs_base__peek_u24le__no_bounds_check(const uint8_t* p) { | 1435 | 9.69k | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1436 | 9.69k | ((uint32_t)(p[2]) << 16); | 1437 | 9.69k | } |
pixel_swizzler_fuzzer.c:wuffs_base__peek_u24le__no_bounds_check Line | Count | Source | 1434 | 965 | wuffs_base__peek_u24le__no_bounds_check(const uint8_t* p) { | 1435 | 965 | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1436 | 965 | ((uint32_t)(p[2]) << 16); | 1437 | 965 | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__peek_u24le__no_bounds_check targa_fuzzer.c:wuffs_base__peek_u24le__no_bounds_check Line | Count | Source | 1434 | 3.79k | wuffs_base__peek_u24le__no_bounds_check(const uint8_t* p) { | 1435 | 3.79k | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1436 | 3.79k | ((uint32_t)(p[2]) << 16); | 1437 | 3.79k | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__peek_u24le__no_bounds_check webp_fuzzer.c:wuffs_base__peek_u24le__no_bounds_check Line | Count | Source | 1434 | 6.34k | wuffs_base__peek_u24le__no_bounds_check(const uint8_t* p) { | 1435 | 6.34k | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1436 | 6.34k | ((uint32_t)(p[2]) << 16); | 1437 | 6.34k | } |
|
1438 | | |
1439 | | static inline uint32_t // |
1440 | 887k | wuffs_base__peek_u32be__no_bounds_check(const uint8_t* p) { |
1441 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) |
1442 | | uint32_t x; |
1443 | | memcpy(&x, p, 4); |
1444 | | return _byteswap_ulong(x); |
1445 | | #else |
1446 | 887k | return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) | |
1447 | 887k | ((uint32_t)(p[2]) << 8) | ((uint32_t)(p[3]) << 0); |
1448 | 887k | #endif |
1449 | 887k | } png_fuzzer.c:wuffs_base__peek_u32be__no_bounds_check Line | Count | Source | 1440 | 81.5k | wuffs_base__peek_u32be__no_bounds_check(const uint8_t* p) { | 1441 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1442 | | uint32_t x; | 1443 | | memcpy(&x, p, 4); | 1444 | | return _byteswap_ulong(x); | 1445 | | #else | 1446 | 81.5k | return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) | | 1447 | 81.5k | ((uint32_t)(p[2]) << 8) | ((uint32_t)(p[3]) << 0); | 1448 | 81.5k | #endif | 1449 | 81.5k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__peek_u32be__no_bounds_check(unsigned char const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__peek_u32be__no_bounds_check xz_fuzzer.c:wuffs_base__peek_u32be__no_bounds_check Line | Count | Source | 1440 | 23.5k | wuffs_base__peek_u32be__no_bounds_check(const uint8_t* p) { | 1441 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1442 | | uint32_t x; | 1443 | | memcpy(&x, p, 4); | 1444 | | return _byteswap_ulong(x); | 1445 | | #else | 1446 | 23.5k | return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) | | 1447 | 23.5k | ((uint32_t)(p[2]) << 8) | ((uint32_t)(p[3]) << 0); | 1448 | 23.5k | #endif | 1449 | 23.5k | } |
Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__peek_u32be__no_bounds_check cbor_fuzzer.c:wuffs_base__peek_u32be__no_bounds_check Line | Count | Source | 1440 | 2.26k | wuffs_base__peek_u32be__no_bounds_check(const uint8_t* p) { | 1441 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1442 | | uint32_t x; | 1443 | | memcpy(&x, p, 4); | 1444 | | return _byteswap_ulong(x); | 1445 | | #else | 1446 | 2.26k | return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) | | 1447 | 2.26k | ((uint32_t)(p[2]) << 8) | ((uint32_t)(p[3]) << 0); | 1448 | 2.26k | #endif | 1449 | 2.26k | } |
bmp_fuzzer.c:wuffs_base__peek_u32be__no_bounds_check Line | Count | Source | 1440 | 728k | wuffs_base__peek_u32be__no_bounds_check(const uint8_t* p) { | 1441 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1442 | | uint32_t x; | 1443 | | memcpy(&x, p, 4); | 1444 | | return _byteswap_ulong(x); | 1445 | | #else | 1446 | 728k | return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) | | 1447 | 728k | ((uint32_t)(p[2]) << 8) | ((uint32_t)(p[3]) << 0); | 1448 | 728k | #endif | 1449 | 728k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__peek_u32be__no_bounds_check zlib_fuzzer.c:wuffs_base__peek_u32be__no_bounds_check Line | Count | Source | 1440 | 109 | wuffs_base__peek_u32be__no_bounds_check(const uint8_t* p) { | 1441 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1442 | | uint32_t x; | 1443 | | memcpy(&x, p, 4); | 1444 | | return _byteswap_ulong(x); | 1445 | | #else | 1446 | 109 | return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) | | 1447 | 109 | ((uint32_t)(p[2]) << 8) | ((uint32_t)(p[3]) << 0); | 1448 | 109 | #endif | 1449 | 109 | } |
Unexecuted instantiation: targa_fuzzer.c:wuffs_base__peek_u32be__no_bounds_check bzip2_fuzzer.c:wuffs_base__peek_u32be__no_bounds_check Line | Count | Source | 1440 | 51.5k | wuffs_base__peek_u32be__no_bounds_check(const uint8_t* p) { | 1441 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1442 | | uint32_t x; | 1443 | | memcpy(&x, p, 4); | 1444 | | return _byteswap_ulong(x); | 1445 | | #else | 1446 | 51.5k | return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) | | 1447 | 51.5k | ((uint32_t)(p[2]) << 8) | ((uint32_t)(p[3]) << 0); | 1448 | 51.5k | #endif | 1449 | 51.5k | } |
Unexecuted instantiation: webp_fuzzer.c:wuffs_base__peek_u32be__no_bounds_check |
1450 | | |
1451 | | static inline uint32_t // |
1452 | 1.82G | wuffs_base__peek_u32le__no_bounds_check(const uint8_t* p) { |
1453 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) |
1454 | | uint32_t x; |
1455 | | memcpy(&x, p, 4); |
1456 | | return x; |
1457 | | #else |
1458 | 1.82G | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | |
1459 | 1.82G | ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24); |
1460 | 1.82G | #endif |
1461 | 1.82G | } png_fuzzer.c:wuffs_base__peek_u32le__no_bounds_check Line | Count | Source | 1452 | 124M | wuffs_base__peek_u32le__no_bounds_check(const uint8_t* p) { | 1453 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1454 | | uint32_t x; | 1455 | | memcpy(&x, p, 4); | 1456 | | return x; | 1457 | | #else | 1458 | 124M | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1459 | 124M | ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24); | 1460 | 124M | #endif | 1461 | 124M | } |
json_fuzzer.cc:wuffs_base__peek_u32le__no_bounds_check(unsigned char const*) Line | Count | Source | 1452 | 23.3M | wuffs_base__peek_u32le__no_bounds_check(const uint8_t* p) { | 1453 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1454 | | uint32_t x; | 1455 | | memcpy(&x, p, 4); | 1456 | | return x; | 1457 | | #else | 1458 | 23.3M | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1459 | 23.3M | ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24); | 1460 | 23.3M | #endif | 1461 | 23.3M | } |
gif_fuzzer.c:wuffs_base__peek_u32le__no_bounds_check Line | Count | Source | 1452 | 4.44M | wuffs_base__peek_u32le__no_bounds_check(const uint8_t* p) { | 1453 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1454 | | uint32_t x; | 1455 | | memcpy(&x, p, 4); | 1456 | | return x; | 1457 | | #else | 1458 | 4.44M | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1459 | 4.44M | ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24); | 1460 | 4.44M | #endif | 1461 | 4.44M | } |
xz_fuzzer.c:wuffs_base__peek_u32le__no_bounds_check Line | Count | Source | 1452 | 29.1k | wuffs_base__peek_u32le__no_bounds_check(const uint8_t* p) { | 1453 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1454 | | uint32_t x; | 1455 | | memcpy(&x, p, 4); | 1456 | | return x; | 1457 | | #else | 1458 | 29.1k | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1459 | 29.1k | ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24); | 1460 | 29.1k | #endif | 1461 | 29.1k | } |
jpeg_fuzzer.c:wuffs_base__peek_u32le__no_bounds_check Line | Count | Source | 1452 | 1.00G | wuffs_base__peek_u32le__no_bounds_check(const uint8_t* p) { | 1453 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1454 | | uint32_t x; | 1455 | | memcpy(&x, p, 4); | 1456 | | return x; | 1457 | | #else | 1458 | 1.00G | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1459 | 1.00G | ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24); | 1460 | 1.00G | #endif | 1461 | 1.00G | } |
cbor_fuzzer.c:wuffs_base__peek_u32le__no_bounds_check Line | Count | Source | 1452 | 2.63k | wuffs_base__peek_u32le__no_bounds_check(const uint8_t* p) { | 1453 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1454 | | uint32_t x; | 1455 | | memcpy(&x, p, 4); | 1456 | | return x; | 1457 | | #else | 1458 | 2.63k | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1459 | 2.63k | ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24); | 1460 | 2.63k | #endif | 1461 | 2.63k | } |
bmp_fuzzer.c:wuffs_base__peek_u32le__no_bounds_check Line | Count | Source | 1452 | 135M | wuffs_base__peek_u32le__no_bounds_check(const uint8_t* p) { | 1453 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1454 | | uint32_t x; | 1455 | | memcpy(&x, p, 4); | 1456 | | return x; | 1457 | | #else | 1458 | 135M | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1459 | 135M | ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24); | 1460 | 135M | #endif | 1461 | 135M | } |
pixel_swizzler_fuzzer.c:wuffs_base__peek_u32le__no_bounds_check Line | Count | Source | 1452 | 58.4k | wuffs_base__peek_u32le__no_bounds_check(const uint8_t* p) { | 1453 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1454 | | uint32_t x; | 1455 | | memcpy(&x, p, 4); | 1456 | | return x; | 1457 | | #else | 1458 | 58.4k | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1459 | 58.4k | ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24); | 1460 | 58.4k | #endif | 1461 | 58.4k | } |
zlib_fuzzer.c:wuffs_base__peek_u32le__no_bounds_check Line | Count | Source | 1452 | 1.19k | wuffs_base__peek_u32le__no_bounds_check(const uint8_t* p) { | 1453 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1454 | | uint32_t x; | 1455 | | memcpy(&x, p, 4); | 1456 | | return x; | 1457 | | #else | 1458 | 1.19k | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1459 | 1.19k | ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24); | 1460 | 1.19k | #endif | 1461 | 1.19k | } |
targa_fuzzer.c:wuffs_base__peek_u32le__no_bounds_check Line | Count | Source | 1452 | 5.76M | wuffs_base__peek_u32le__no_bounds_check(const uint8_t* p) { | 1453 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1454 | | uint32_t x; | 1455 | | memcpy(&x, p, 4); | 1456 | | return x; | 1457 | | #else | 1458 | 5.76M | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1459 | 5.76M | ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24); | 1460 | 5.76M | #endif | 1461 | 5.76M | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__peek_u32le__no_bounds_check webp_fuzzer.c:wuffs_base__peek_u32le__no_bounds_check Line | Count | Source | 1452 | 532M | wuffs_base__peek_u32le__no_bounds_check(const uint8_t* p) { | 1453 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1454 | | uint32_t x; | 1455 | | memcpy(&x, p, 4); | 1456 | | return x; | 1457 | | #else | 1458 | 532M | return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | | 1459 | 532M | ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24); | 1460 | 532M | #endif | 1461 | 532M | } |
|
1462 | | |
1463 | | static inline uint64_t // |
1464 | 0 | wuffs_base__peek_u40be__no_bounds_check(const uint8_t* p) { |
1465 | 0 | return ((uint64_t)(p[0]) << 32) | ((uint64_t)(p[1]) << 24) | |
1466 | 0 | ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 8) | |
1467 | 0 | ((uint64_t)(p[4]) << 0); |
1468 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__peek_u40be__no_bounds_check Unexecuted instantiation: json_fuzzer.cc:wuffs_base__peek_u40be__no_bounds_check(unsigned char const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__peek_u40be__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__peek_u40be__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__peek_u40be__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__peek_u40be__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__peek_u40be__no_bounds_check Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__peek_u40be__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__peek_u40be__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__peek_u40be__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__peek_u40be__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__peek_u40be__no_bounds_check |
1469 | | |
1470 | | static inline uint64_t // |
1471 | 0 | wuffs_base__peek_u40le__no_bounds_check(const uint8_t* p) { |
1472 | 0 | return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) | |
1473 | 0 | ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) | |
1474 | 0 | ((uint64_t)(p[4]) << 32); |
1475 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__peek_u40le__no_bounds_check Unexecuted instantiation: json_fuzzer.cc:wuffs_base__peek_u40le__no_bounds_check(unsigned char const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__peek_u40le__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__peek_u40le__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__peek_u40le__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__peek_u40le__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__peek_u40le__no_bounds_check Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__peek_u40le__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__peek_u40le__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__peek_u40le__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__peek_u40le__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__peek_u40le__no_bounds_check |
1476 | | |
1477 | | static inline uint64_t // |
1478 | 138 | wuffs_base__peek_u48be__no_bounds_check(const uint8_t* p) { |
1479 | 138 | return ((uint64_t)(p[0]) << 40) | ((uint64_t)(p[1]) << 32) | |
1480 | 138 | ((uint64_t)(p[2]) << 24) | ((uint64_t)(p[3]) << 16) | |
1481 | 138 | ((uint64_t)(p[4]) << 8) | ((uint64_t)(p[5]) << 0); |
1482 | 138 | } png_fuzzer.c:wuffs_base__peek_u48be__no_bounds_check Line | Count | Source | 1478 | 138 | wuffs_base__peek_u48be__no_bounds_check(const uint8_t* p) { | 1479 | 138 | return ((uint64_t)(p[0]) << 40) | ((uint64_t)(p[1]) << 32) | | 1480 | 138 | ((uint64_t)(p[2]) << 24) | ((uint64_t)(p[3]) << 16) | | 1481 | 138 | ((uint64_t)(p[4]) << 8) | ((uint64_t)(p[5]) << 0); | 1482 | 138 | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__peek_u48be__no_bounds_check(unsigned char const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__peek_u48be__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__peek_u48be__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__peek_u48be__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__peek_u48be__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__peek_u48be__no_bounds_check Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__peek_u48be__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__peek_u48be__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__peek_u48be__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__peek_u48be__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__peek_u48be__no_bounds_check |
1483 | | |
1484 | | static inline uint64_t // |
1485 | 58.8k | wuffs_base__peek_u48le__no_bounds_check(const uint8_t* p) { |
1486 | 58.8k | return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) | |
1487 | 58.8k | ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) | |
1488 | 58.8k | ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40); |
1489 | 58.8k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__peek_u48le__no_bounds_check json_fuzzer.cc:wuffs_base__peek_u48le__no_bounds_check(unsigned char const*) Line | Count | Source | 1485 | 39.7k | wuffs_base__peek_u48le__no_bounds_check(const uint8_t* p) { | 1486 | 39.7k | return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) | | 1487 | 39.7k | ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) | | 1488 | 39.7k | ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40); | 1489 | 39.7k | } |
gif_fuzzer.c:wuffs_base__peek_u48le__no_bounds_check Line | Count | Source | 1485 | 2.33k | wuffs_base__peek_u48le__no_bounds_check(const uint8_t* p) { | 1486 | 2.33k | return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) | | 1487 | 2.33k | ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) | | 1488 | 2.33k | ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40); | 1489 | 2.33k | } |
xz_fuzzer.c:wuffs_base__peek_u48le__no_bounds_check Line | Count | Source | 1485 | 16.7k | wuffs_base__peek_u48le__no_bounds_check(const uint8_t* p) { | 1486 | 16.7k | return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) | | 1487 | 16.7k | ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) | | 1488 | 16.7k | ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40); | 1489 | 16.7k | } |
Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__peek_u48le__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__peek_u48le__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__peek_u48le__no_bounds_check Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__peek_u48le__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__peek_u48le__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__peek_u48le__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__peek_u48le__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__peek_u48le__no_bounds_check |
1490 | | |
1491 | | static inline uint64_t // |
1492 | 0 | wuffs_base__peek_u56be__no_bounds_check(const uint8_t* p) { |
1493 | 0 | return ((uint64_t)(p[0]) << 48) | ((uint64_t)(p[1]) << 40) | |
1494 | 0 | ((uint64_t)(p[2]) << 32) | ((uint64_t)(p[3]) << 24) | |
1495 | 0 | ((uint64_t)(p[4]) << 16) | ((uint64_t)(p[5]) << 8) | |
1496 | 0 | ((uint64_t)(p[6]) << 0); |
1497 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__peek_u56be__no_bounds_check Unexecuted instantiation: json_fuzzer.cc:wuffs_base__peek_u56be__no_bounds_check(unsigned char const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__peek_u56be__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__peek_u56be__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__peek_u56be__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__peek_u56be__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__peek_u56be__no_bounds_check Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__peek_u56be__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__peek_u56be__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__peek_u56be__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__peek_u56be__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__peek_u56be__no_bounds_check |
1498 | | |
1499 | | static inline uint64_t // |
1500 | 0 | wuffs_base__peek_u56le__no_bounds_check(const uint8_t* p) { |
1501 | 0 | return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) | |
1502 | 0 | ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) | |
1503 | 0 | ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40) | |
1504 | 0 | ((uint64_t)(p[6]) << 48); |
1505 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__peek_u56le__no_bounds_check Unexecuted instantiation: json_fuzzer.cc:wuffs_base__peek_u56le__no_bounds_check(unsigned char const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__peek_u56le__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__peek_u56le__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__peek_u56le__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__peek_u56le__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__peek_u56le__no_bounds_check Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__peek_u56le__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__peek_u56le__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__peek_u56le__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__peek_u56le__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__peek_u56le__no_bounds_check |
1506 | | |
1507 | | static inline uint64_t // |
1508 | 112M | wuffs_base__peek_u64be__no_bounds_check(const uint8_t* p) { |
1509 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) |
1510 | | uint64_t x; |
1511 | | memcpy(&x, p, 8); |
1512 | | return _byteswap_uint64(x); |
1513 | | #else |
1514 | 112M | return ((uint64_t)(p[0]) << 56) | ((uint64_t)(p[1]) << 48) | |
1515 | 112M | ((uint64_t)(p[2]) << 40) | ((uint64_t)(p[3]) << 32) | |
1516 | 112M | ((uint64_t)(p[4]) << 24) | ((uint64_t)(p[5]) << 16) | |
1517 | 112M | ((uint64_t)(p[6]) << 8) | ((uint64_t)(p[7]) << 0); |
1518 | 112M | #endif |
1519 | 112M | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__peek_u64be__no_bounds_check Unexecuted instantiation: json_fuzzer.cc:wuffs_base__peek_u64be__no_bounds_check(unsigned char const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__peek_u64be__no_bounds_check xz_fuzzer.c:wuffs_base__peek_u64be__no_bounds_check Line | Count | Source | 1508 | 1.56k | wuffs_base__peek_u64be__no_bounds_check(const uint8_t* p) { | 1509 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1510 | | uint64_t x; | 1511 | | memcpy(&x, p, 8); | 1512 | | return _byteswap_uint64(x); | 1513 | | #else | 1514 | 1.56k | return ((uint64_t)(p[0]) << 56) | ((uint64_t)(p[1]) << 48) | | 1515 | 1.56k | ((uint64_t)(p[2]) << 40) | ((uint64_t)(p[3]) << 32) | | 1516 | 1.56k | ((uint64_t)(p[4]) << 24) | ((uint64_t)(p[5]) << 16) | | 1517 | 1.56k | ((uint64_t)(p[6]) << 8) | ((uint64_t)(p[7]) << 0); | 1518 | 1.56k | #endif | 1519 | 1.56k | } |
jpeg_fuzzer.c:wuffs_base__peek_u64be__no_bounds_check Line | Count | Source | 1508 | 112M | wuffs_base__peek_u64be__no_bounds_check(const uint8_t* p) { | 1509 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1510 | | uint64_t x; | 1511 | | memcpy(&x, p, 8); | 1512 | | return _byteswap_uint64(x); | 1513 | | #else | 1514 | 112M | return ((uint64_t)(p[0]) << 56) | ((uint64_t)(p[1]) << 48) | | 1515 | 112M | ((uint64_t)(p[2]) << 40) | ((uint64_t)(p[3]) << 32) | | 1516 | 112M | ((uint64_t)(p[4]) << 24) | ((uint64_t)(p[5]) << 16) | | 1517 | 112M | ((uint64_t)(p[6]) << 8) | ((uint64_t)(p[7]) << 0); | 1518 | 112M | #endif | 1519 | 112M | } |
cbor_fuzzer.c:wuffs_base__peek_u64be__no_bounds_check Line | Count | Source | 1508 | 2.32k | wuffs_base__peek_u64be__no_bounds_check(const uint8_t* p) { | 1509 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1510 | | uint64_t x; | 1511 | | memcpy(&x, p, 8); | 1512 | | return _byteswap_uint64(x); | 1513 | | #else | 1514 | 2.32k | return ((uint64_t)(p[0]) << 56) | ((uint64_t)(p[1]) << 48) | | 1515 | 2.32k | ((uint64_t)(p[2]) << 40) | ((uint64_t)(p[3]) << 32) | | 1516 | 2.32k | ((uint64_t)(p[4]) << 24) | ((uint64_t)(p[5]) << 16) | | 1517 | 2.32k | ((uint64_t)(p[6]) << 8) | ((uint64_t)(p[7]) << 0); | 1518 | 2.32k | #endif | 1519 | 2.32k | } |
Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__peek_u64be__no_bounds_check Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__peek_u64be__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__peek_u64be__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__peek_u64be__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__peek_u64be__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__peek_u64be__no_bounds_check |
1520 | | |
1521 | | static inline uint64_t // |
1522 | 293M | wuffs_base__peek_u64le__no_bounds_check(const uint8_t* p) { |
1523 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) |
1524 | | uint64_t x; |
1525 | | memcpy(&x, p, 8); |
1526 | | return x; |
1527 | | #else |
1528 | 293M | return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) | |
1529 | 293M | ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) | |
1530 | 293M | ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40) | |
1531 | 293M | ((uint64_t)(p[6]) << 48) | ((uint64_t)(p[7]) << 56); |
1532 | 293M | #endif |
1533 | 293M | } png_fuzzer.c:wuffs_base__peek_u64le__no_bounds_check Line | Count | Source | 1522 | 53.1M | wuffs_base__peek_u64le__no_bounds_check(const uint8_t* p) { | 1523 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1524 | | uint64_t x; | 1525 | | memcpy(&x, p, 8); | 1526 | | return x; | 1527 | | #else | 1528 | 53.1M | return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) | | 1529 | 53.1M | ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) | | 1530 | 53.1M | ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40) | | 1531 | 53.1M | ((uint64_t)(p[6]) << 48) | ((uint64_t)(p[7]) << 56); | 1532 | 53.1M | #endif | 1533 | 53.1M | } |
json_fuzzer.cc:wuffs_base__peek_u64le__no_bounds_check(unsigned char const*) Line | Count | Source | 1522 | 57.9k | wuffs_base__peek_u64le__no_bounds_check(const uint8_t* p) { | 1523 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1524 | | uint64_t x; | 1525 | | memcpy(&x, p, 8); | 1526 | | return x; | 1527 | | #else | 1528 | 57.9k | return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) | | 1529 | 57.9k | ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) | | 1530 | 57.9k | ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40) | | 1531 | 57.9k | ((uint64_t)(p[6]) << 48) | ((uint64_t)(p[7]) << 56); | 1532 | 57.9k | #endif | 1533 | 57.9k | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__peek_u64le__no_bounds_check xz_fuzzer.c:wuffs_base__peek_u64le__no_bounds_check Line | Count | Source | 1522 | 3.55k | wuffs_base__peek_u64le__no_bounds_check(const uint8_t* p) { | 1523 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1524 | | uint64_t x; | 1525 | | memcpy(&x, p, 8); | 1526 | | return x; | 1527 | | #else | 1528 | 3.55k | return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) | | 1529 | 3.55k | ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) | | 1530 | 3.55k | ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40) | | 1531 | 3.55k | ((uint64_t)(p[6]) << 48) | ((uint64_t)(p[7]) << 56); | 1532 | 3.55k | #endif | 1533 | 3.55k | } |
jpeg_fuzzer.c:wuffs_base__peek_u64le__no_bounds_check Line | Count | Source | 1522 | 234M | wuffs_base__peek_u64le__no_bounds_check(const uint8_t* p) { | 1523 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1524 | | uint64_t x; | 1525 | | memcpy(&x, p, 8); | 1526 | | return x; | 1527 | | #else | 1528 | 234M | return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) | | 1529 | 234M | ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) | | 1530 | 234M | ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40) | | 1531 | 234M | ((uint64_t)(p[6]) << 48) | ((uint64_t)(p[7]) << 56); | 1532 | 234M | #endif | 1533 | 234M | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__peek_u64le__no_bounds_check bmp_fuzzer.c:wuffs_base__peek_u64le__no_bounds_check Line | Count | Source | 1522 | 2.24M | wuffs_base__peek_u64le__no_bounds_check(const uint8_t* p) { | 1523 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1524 | | uint64_t x; | 1525 | | memcpy(&x, p, 8); | 1526 | | return x; | 1527 | | #else | 1528 | 2.24M | return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) | | 1529 | 2.24M | ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) | | 1530 | 2.24M | ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40) | | 1531 | 2.24M | ((uint64_t)(p[6]) << 48) | ((uint64_t)(p[7]) << 56); | 1532 | 2.24M | #endif | 1533 | 2.24M | } |
pixel_swizzler_fuzzer.c:wuffs_base__peek_u64le__no_bounds_check Line | Count | Source | 1522 | 6.07k | wuffs_base__peek_u64le__no_bounds_check(const uint8_t* p) { | 1523 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1524 | | uint64_t x; | 1525 | | memcpy(&x, p, 8); | 1526 | | return x; | 1527 | | #else | 1528 | 6.07k | return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) | | 1529 | 6.07k | ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) | | 1530 | 6.07k | ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40) | | 1531 | 6.07k | ((uint64_t)(p[6]) << 48) | ((uint64_t)(p[7]) << 56); | 1532 | 6.07k | #endif | 1533 | 6.07k | } |
zlib_fuzzer.c:wuffs_base__peek_u64le__no_bounds_check Line | Count | Source | 1522 | 3.33M | wuffs_base__peek_u64le__no_bounds_check(const uint8_t* p) { | 1523 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) | 1524 | | uint64_t x; | 1525 | | memcpy(&x, p, 8); | 1526 | | return x; | 1527 | | #else | 1528 | 3.33M | return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) | | 1529 | 3.33M | ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) | | 1530 | 3.33M | ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40) | | 1531 | 3.33M | ((uint64_t)(p[6]) << 48) | ((uint64_t)(p[7]) << 56); | 1532 | 3.33M | #endif | 1533 | 3.33M | } |
Unexecuted instantiation: targa_fuzzer.c:wuffs_base__peek_u64le__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__peek_u64le__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__peek_u64le__no_bounds_check |
1534 | | |
1535 | | // -------- |
1536 | | |
1537 | | #define wuffs_base__poke_u8be__no_bounds_check \ |
1538 | 896M | wuffs_base__poke_u8__no_bounds_check |
1539 | | #define wuffs_base__poke_u8le__no_bounds_check \ |
1540 | | wuffs_base__poke_u8__no_bounds_check |
1541 | | |
1542 | | static inline void // |
1543 | 896M | wuffs_base__poke_u8__no_bounds_check(uint8_t* p, uint8_t x) { |
1544 | 896M | p[0] = x; |
1545 | 896M | } png_fuzzer.c:wuffs_base__poke_u8__no_bounds_check Line | Count | Source | 1543 | 23.8M | wuffs_base__poke_u8__no_bounds_check(uint8_t* p, uint8_t x) { | 1544 | 23.8M | p[0] = x; | 1545 | 23.8M | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__poke_u8__no_bounds_check(unsigned char*, unsigned char) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__poke_u8__no_bounds_check xz_fuzzer.c:wuffs_base__poke_u8__no_bounds_check Line | Count | Source | 1543 | 129M | wuffs_base__poke_u8__no_bounds_check(uint8_t* p, uint8_t x) { | 1544 | 129M | p[0] = x; | 1545 | 129M | } |
Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__poke_u8__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__poke_u8__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__poke_u8__no_bounds_check pixel_swizzler_fuzzer.c:wuffs_base__poke_u8__no_bounds_check Line | Count | Source | 1543 | 101k | wuffs_base__poke_u8__no_bounds_check(uint8_t* p, uint8_t x) { | 1544 | 101k | p[0] = x; | 1545 | 101k | } |
zlib_fuzzer.c:wuffs_base__poke_u8__no_bounds_check Line | Count | Source | 1543 | 1.19M | wuffs_base__poke_u8__no_bounds_check(uint8_t* p, uint8_t x) { | 1544 | 1.19M | p[0] = x; | 1545 | 1.19M | } |
Unexecuted instantiation: targa_fuzzer.c:wuffs_base__poke_u8__no_bounds_check bzip2_fuzzer.c:wuffs_base__poke_u8__no_bounds_check Line | Count | Source | 1543 | 741M | wuffs_base__poke_u8__no_bounds_check(uint8_t* p, uint8_t x) { | 1544 | 741M | p[0] = x; | 1545 | 741M | } |
Unexecuted instantiation: webp_fuzzer.c:wuffs_base__poke_u8__no_bounds_check |
1546 | | |
1547 | | static inline void // |
1548 | 13.7k | wuffs_base__poke_u16be__no_bounds_check(uint8_t* p, uint16_t x) { |
1549 | 13.7k | p[0] = (uint8_t)(x >> 8); |
1550 | 13.7k | p[1] = (uint8_t)(x >> 0); |
1551 | 13.7k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__poke_u16be__no_bounds_check Unexecuted instantiation: json_fuzzer.cc:wuffs_base__poke_u16be__no_bounds_check(unsigned char*, unsigned short) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__poke_u16be__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__poke_u16be__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__poke_u16be__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__poke_u16be__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__poke_u16be__no_bounds_check pixel_swizzler_fuzzer.c:wuffs_base__poke_u16be__no_bounds_check Line | Count | Source | 1548 | 13.7k | wuffs_base__poke_u16be__no_bounds_check(uint8_t* p, uint16_t x) { | 1549 | 13.7k | p[0] = (uint8_t)(x >> 8); | 1550 | 13.7k | p[1] = (uint8_t)(x >> 0); | 1551 | 13.7k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__poke_u16be__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__poke_u16be__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__poke_u16be__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__poke_u16be__no_bounds_check |
1552 | | |
1553 | | static inline void // |
1554 | 90.4k | wuffs_base__poke_u16le__no_bounds_check(uint8_t* p, uint16_t x) { |
1555 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) || \ |
1556 | | (defined(__GNUC__) && !defined(__clang__) && defined(__x86_64__)) |
1557 | | // This seems to perform better on gcc 10 (but not clang 9). Clang also |
1558 | | // defines "__GNUC__". |
1559 | | memcpy(p, &x, 2); |
1560 | | #else |
1561 | 90.4k | p[0] = (uint8_t)(x >> 0); |
1562 | 90.4k | p[1] = (uint8_t)(x >> 8); |
1563 | 90.4k | #endif |
1564 | 90.4k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__poke_u16le__no_bounds_check Unexecuted instantiation: json_fuzzer.cc:wuffs_base__poke_u16le__no_bounds_check(unsigned char*, unsigned short) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__poke_u16le__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__poke_u16le__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__poke_u16le__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__poke_u16le__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__poke_u16le__no_bounds_check pixel_swizzler_fuzzer.c:wuffs_base__poke_u16le__no_bounds_check Line | Count | Source | 1554 | 90.4k | wuffs_base__poke_u16le__no_bounds_check(uint8_t* p, uint16_t x) { | 1555 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) || \ | 1556 | | (defined(__GNUC__) && !defined(__clang__) && defined(__x86_64__)) | 1557 | | // This seems to perform better on gcc 10 (but not clang 9). Clang also | 1558 | | // defines "__GNUC__". | 1559 | | memcpy(p, &x, 2); | 1560 | | #else | 1561 | 90.4k | p[0] = (uint8_t)(x >> 0); | 1562 | 90.4k | p[1] = (uint8_t)(x >> 8); | 1563 | 90.4k | #endif | 1564 | 90.4k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__poke_u16le__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__poke_u16le__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__poke_u16le__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__poke_u16le__no_bounds_check |
1565 | | |
1566 | | static inline void // |
1567 | 0 | wuffs_base__poke_u24be__no_bounds_check(uint8_t* p, uint32_t x) { |
1568 | 0 | p[0] = (uint8_t)(x >> 16); |
1569 | 0 | p[1] = (uint8_t)(x >> 8); |
1570 | 0 | p[2] = (uint8_t)(x >> 0); |
1571 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__poke_u24be__no_bounds_check Unexecuted instantiation: json_fuzzer.cc:wuffs_base__poke_u24be__no_bounds_check(unsigned char*, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__poke_u24be__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__poke_u24be__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__poke_u24be__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__poke_u24be__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__poke_u24be__no_bounds_check Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__poke_u24be__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__poke_u24be__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__poke_u24be__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__poke_u24be__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__poke_u24be__no_bounds_check |
1572 | | |
1573 | | static inline void // |
1574 | 4.52M | wuffs_base__poke_u24le__no_bounds_check(uint8_t* p, uint32_t x) { |
1575 | 4.52M | p[0] = (uint8_t)(x >> 0); |
1576 | 4.52M | p[1] = (uint8_t)(x >> 8); |
1577 | 4.52M | p[2] = (uint8_t)(x >> 16); |
1578 | 4.52M | } png_fuzzer.c:wuffs_base__poke_u24le__no_bounds_check Line | Count | Source | 1574 | 4.41M | wuffs_base__poke_u24le__no_bounds_check(uint8_t* p, uint32_t x) { | 1575 | 4.41M | p[0] = (uint8_t)(x >> 0); | 1576 | 4.41M | p[1] = (uint8_t)(x >> 8); | 1577 | 4.41M | p[2] = (uint8_t)(x >> 16); | 1578 | 4.41M | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__poke_u24le__no_bounds_check(unsigned char*, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__poke_u24le__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__poke_u24le__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__poke_u24le__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__poke_u24le__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__poke_u24le__no_bounds_check pixel_swizzler_fuzzer.c:wuffs_base__poke_u24le__no_bounds_check Line | Count | Source | 1574 | 109k | wuffs_base__poke_u24le__no_bounds_check(uint8_t* p, uint32_t x) { | 1575 | 109k | p[0] = (uint8_t)(x >> 0); | 1576 | 109k | p[1] = (uint8_t)(x >> 8); | 1577 | 109k | p[2] = (uint8_t)(x >> 16); | 1578 | 109k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__poke_u24le__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__poke_u24le__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__poke_u24le__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__poke_u24le__no_bounds_check |
1579 | | |
1580 | | static inline void // |
1581 | 0 | wuffs_base__poke_u32be__no_bounds_check(uint8_t* p, uint32_t x) { |
1582 | 0 | p[0] = (uint8_t)(x >> 24); |
1583 | 0 | p[1] = (uint8_t)(x >> 16); |
1584 | 0 | p[2] = (uint8_t)(x >> 8); |
1585 | 0 | p[3] = (uint8_t)(x >> 0); |
1586 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__poke_u32be__no_bounds_check Unexecuted instantiation: json_fuzzer.cc:wuffs_base__poke_u32be__no_bounds_check(unsigned char*, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__poke_u32be__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__poke_u32be__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__poke_u32be__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__poke_u32be__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__poke_u32be__no_bounds_check Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__poke_u32be__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__poke_u32be__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__poke_u32be__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__poke_u32be__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__poke_u32be__no_bounds_check |
1587 | | |
1588 | | static inline void // |
1589 | 6.02G | wuffs_base__poke_u32le__no_bounds_check(uint8_t* p, uint32_t x) { |
1590 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) || \ |
1591 | | (defined(__GNUC__) && !defined(__clang__) && defined(__x86_64__)) |
1592 | | // This seems to perform better on gcc 10 (but not clang 9). Clang also |
1593 | | // defines "__GNUC__". |
1594 | | memcpy(p, &x, 4); |
1595 | | #else |
1596 | 6.02G | p[0] = (uint8_t)(x >> 0); |
1597 | 6.02G | p[1] = (uint8_t)(x >> 8); |
1598 | 6.02G | p[2] = (uint8_t)(x >> 16); |
1599 | 6.02G | p[3] = (uint8_t)(x >> 24); |
1600 | 6.02G | #endif |
1601 | 6.02G | } png_fuzzer.c:wuffs_base__poke_u32le__no_bounds_check Line | Count | Source | 1589 | 180M | wuffs_base__poke_u32le__no_bounds_check(uint8_t* p, uint32_t x) { | 1590 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) || \ | 1591 | | (defined(__GNUC__) && !defined(__clang__) && defined(__x86_64__)) | 1592 | | // This seems to perform better on gcc 10 (but not clang 9). Clang also | 1593 | | // defines "__GNUC__". | 1594 | | memcpy(p, &x, 4); | 1595 | | #else | 1596 | 180M | p[0] = (uint8_t)(x >> 0); | 1597 | 180M | p[1] = (uint8_t)(x >> 8); | 1598 | 180M | p[2] = (uint8_t)(x >> 16); | 1599 | 180M | p[3] = (uint8_t)(x >> 24); | 1600 | 180M | #endif | 1601 | 180M | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__poke_u32le__no_bounds_check(unsigned char*, unsigned int) gif_fuzzer.c:wuffs_base__poke_u32le__no_bounds_check Line | Count | Source | 1589 | 3.53M | wuffs_base__poke_u32le__no_bounds_check(uint8_t* p, uint32_t x) { | 1590 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) || \ | 1591 | | (defined(__GNUC__) && !defined(__clang__) && defined(__x86_64__)) | 1592 | | // This seems to perform better on gcc 10 (but not clang 9). Clang also | 1593 | | // defines "__GNUC__". | 1594 | | memcpy(p, &x, 4); | 1595 | | #else | 1596 | 3.53M | p[0] = (uint8_t)(x >> 0); | 1597 | 3.53M | p[1] = (uint8_t)(x >> 8); | 1598 | 3.53M | p[2] = (uint8_t)(x >> 16); | 1599 | 3.53M | p[3] = (uint8_t)(x >> 24); | 1600 | 3.53M | #endif | 1601 | 3.53M | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__poke_u32le__no_bounds_check jpeg_fuzzer.c:wuffs_base__poke_u32le__no_bounds_check Line | Count | Source | 1589 | 873M | wuffs_base__poke_u32le__no_bounds_check(uint8_t* p, uint32_t x) { | 1590 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) || \ | 1591 | | (defined(__GNUC__) && !defined(__clang__) && defined(__x86_64__)) | 1592 | | // This seems to perform better on gcc 10 (but not clang 9). Clang also | 1593 | | // defines "__GNUC__". | 1594 | | memcpy(p, &x, 4); | 1595 | | #else | 1596 | 873M | p[0] = (uint8_t)(x >> 0); | 1597 | 873M | p[1] = (uint8_t)(x >> 8); | 1598 | 873M | p[2] = (uint8_t)(x >> 16); | 1599 | 873M | p[3] = (uint8_t)(x >> 24); | 1600 | 873M | #endif | 1601 | 873M | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__poke_u32le__no_bounds_check bmp_fuzzer.c:wuffs_base__poke_u32le__no_bounds_check Line | Count | Source | 1589 | 136M | wuffs_base__poke_u32le__no_bounds_check(uint8_t* p, uint32_t x) { | 1590 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) || \ | 1591 | | (defined(__GNUC__) && !defined(__clang__) && defined(__x86_64__)) | 1592 | | // This seems to perform better on gcc 10 (but not clang 9). Clang also | 1593 | | // defines "__GNUC__". | 1594 | | memcpy(p, &x, 4); | 1595 | | #else | 1596 | 136M | p[0] = (uint8_t)(x >> 0); | 1597 | 136M | p[1] = (uint8_t)(x >> 8); | 1598 | 136M | p[2] = (uint8_t)(x >> 16); | 1599 | 136M | p[3] = (uint8_t)(x >> 24); | 1600 | 136M | #endif | 1601 | 136M | } |
pixel_swizzler_fuzzer.c:wuffs_base__poke_u32le__no_bounds_check Line | Count | Source | 1589 | 242k | wuffs_base__poke_u32le__no_bounds_check(uint8_t* p, uint32_t x) { | 1590 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) || \ | 1591 | | (defined(__GNUC__) && !defined(__clang__) && defined(__x86_64__)) | 1592 | | // This seems to perform better on gcc 10 (but not clang 9). Clang also | 1593 | | // defines "__GNUC__". | 1594 | | memcpy(p, &x, 4); | 1595 | | #else | 1596 | 242k | p[0] = (uint8_t)(x >> 0); | 1597 | 242k | p[1] = (uint8_t)(x >> 8); | 1598 | 242k | p[2] = (uint8_t)(x >> 16); | 1599 | 242k | p[3] = (uint8_t)(x >> 24); | 1600 | 242k | #endif | 1601 | 242k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__poke_u32le__no_bounds_check targa_fuzzer.c:wuffs_base__poke_u32le__no_bounds_check Line | Count | Source | 1589 | 5.54M | wuffs_base__poke_u32le__no_bounds_check(uint8_t* p, uint32_t x) { | 1590 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) || \ | 1591 | | (defined(__GNUC__) && !defined(__clang__) && defined(__x86_64__)) | 1592 | | // This seems to perform better on gcc 10 (but not clang 9). Clang also | 1593 | | // defines "__GNUC__". | 1594 | | memcpy(p, &x, 4); | 1595 | | #else | 1596 | 5.54M | p[0] = (uint8_t)(x >> 0); | 1597 | 5.54M | p[1] = (uint8_t)(x >> 8); | 1598 | 5.54M | p[2] = (uint8_t)(x >> 16); | 1599 | 5.54M | p[3] = (uint8_t)(x >> 24); | 1600 | 5.54M | #endif | 1601 | 5.54M | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__poke_u32le__no_bounds_check webp_fuzzer.c:wuffs_base__poke_u32le__no_bounds_check Line | Count | Source | 1589 | 4.82G | wuffs_base__poke_u32le__no_bounds_check(uint8_t* p, uint32_t x) { | 1590 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) || \ | 1591 | | (defined(__GNUC__) && !defined(__clang__) && defined(__x86_64__)) | 1592 | | // This seems to perform better on gcc 10 (but not clang 9). Clang also | 1593 | | // defines "__GNUC__". | 1594 | | memcpy(p, &x, 4); | 1595 | | #else | 1596 | 4.82G | p[0] = (uint8_t)(x >> 0); | 1597 | 4.82G | p[1] = (uint8_t)(x >> 8); | 1598 | 4.82G | p[2] = (uint8_t)(x >> 16); | 1599 | 4.82G | p[3] = (uint8_t)(x >> 24); | 1600 | 4.82G | #endif | 1601 | 4.82G | } |
|
1602 | | |
1603 | | static inline void // |
1604 | 0 | wuffs_base__poke_u40be__no_bounds_check(uint8_t* p, uint64_t x) { |
1605 | 0 | p[0] = (uint8_t)(x >> 32); |
1606 | 0 | p[1] = (uint8_t)(x >> 24); |
1607 | 0 | p[2] = (uint8_t)(x >> 16); |
1608 | 0 | p[3] = (uint8_t)(x >> 8); |
1609 | 0 | p[4] = (uint8_t)(x >> 0); |
1610 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__poke_u40be__no_bounds_check Unexecuted instantiation: json_fuzzer.cc:wuffs_base__poke_u40be__no_bounds_check(unsigned char*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__poke_u40be__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__poke_u40be__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__poke_u40be__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__poke_u40be__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__poke_u40be__no_bounds_check Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__poke_u40be__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__poke_u40be__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__poke_u40be__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__poke_u40be__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__poke_u40be__no_bounds_check |
1611 | | |
1612 | | static inline void // |
1613 | 0 | wuffs_base__poke_u40le__no_bounds_check(uint8_t* p, uint64_t x) { |
1614 | 0 | p[0] = (uint8_t)(x >> 0); |
1615 | 0 | p[1] = (uint8_t)(x >> 8); |
1616 | 0 | p[2] = (uint8_t)(x >> 16); |
1617 | 0 | p[3] = (uint8_t)(x >> 24); |
1618 | 0 | p[4] = (uint8_t)(x >> 32); |
1619 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__poke_u40le__no_bounds_check Unexecuted instantiation: json_fuzzer.cc:wuffs_base__poke_u40le__no_bounds_check(unsigned char*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__poke_u40le__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__poke_u40le__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__poke_u40le__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__poke_u40le__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__poke_u40le__no_bounds_check Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__poke_u40le__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__poke_u40le__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__poke_u40le__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__poke_u40le__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__poke_u40le__no_bounds_check |
1620 | | |
1621 | | static inline void // |
1622 | 0 | wuffs_base__poke_u48be__no_bounds_check(uint8_t* p, uint64_t x) { |
1623 | 0 | p[0] = (uint8_t)(x >> 40); |
1624 | 0 | p[1] = (uint8_t)(x >> 32); |
1625 | 0 | p[2] = (uint8_t)(x >> 24); |
1626 | 0 | p[3] = (uint8_t)(x >> 16); |
1627 | 0 | p[4] = (uint8_t)(x >> 8); |
1628 | 0 | p[5] = (uint8_t)(x >> 0); |
1629 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__poke_u48be__no_bounds_check Unexecuted instantiation: json_fuzzer.cc:wuffs_base__poke_u48be__no_bounds_check(unsigned char*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__poke_u48be__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__poke_u48be__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__poke_u48be__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__poke_u48be__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__poke_u48be__no_bounds_check Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__poke_u48be__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__poke_u48be__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__poke_u48be__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__poke_u48be__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__poke_u48be__no_bounds_check |
1630 | | |
1631 | | static inline void // |
1632 | 0 | wuffs_base__poke_u48le__no_bounds_check(uint8_t* p, uint64_t x) { |
1633 | 0 | p[0] = (uint8_t)(x >> 0); |
1634 | 0 | p[1] = (uint8_t)(x >> 8); |
1635 | 0 | p[2] = (uint8_t)(x >> 16); |
1636 | 0 | p[3] = (uint8_t)(x >> 24); |
1637 | 0 | p[4] = (uint8_t)(x >> 32); |
1638 | 0 | p[5] = (uint8_t)(x >> 40); |
1639 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__poke_u48le__no_bounds_check Unexecuted instantiation: json_fuzzer.cc:wuffs_base__poke_u48le__no_bounds_check(unsigned char*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__poke_u48le__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__poke_u48le__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__poke_u48le__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__poke_u48le__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__poke_u48le__no_bounds_check Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__poke_u48le__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__poke_u48le__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__poke_u48le__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__poke_u48le__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__poke_u48le__no_bounds_check |
1640 | | |
1641 | | static inline void // |
1642 | 0 | wuffs_base__poke_u56be__no_bounds_check(uint8_t* p, uint64_t x) { |
1643 | 0 | p[0] = (uint8_t)(x >> 48); |
1644 | 0 | p[1] = (uint8_t)(x >> 40); |
1645 | 0 | p[2] = (uint8_t)(x >> 32); |
1646 | 0 | p[3] = (uint8_t)(x >> 24); |
1647 | 0 | p[4] = (uint8_t)(x >> 16); |
1648 | 0 | p[5] = (uint8_t)(x >> 8); |
1649 | 0 | p[6] = (uint8_t)(x >> 0); |
1650 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__poke_u56be__no_bounds_check Unexecuted instantiation: json_fuzzer.cc:wuffs_base__poke_u56be__no_bounds_check(unsigned char*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__poke_u56be__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__poke_u56be__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__poke_u56be__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__poke_u56be__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__poke_u56be__no_bounds_check Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__poke_u56be__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__poke_u56be__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__poke_u56be__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__poke_u56be__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__poke_u56be__no_bounds_check |
1651 | | |
1652 | | static inline void // |
1653 | 0 | wuffs_base__poke_u56le__no_bounds_check(uint8_t* p, uint64_t x) { |
1654 | 0 | p[0] = (uint8_t)(x >> 0); |
1655 | 0 | p[1] = (uint8_t)(x >> 8); |
1656 | 0 | p[2] = (uint8_t)(x >> 16); |
1657 | 0 | p[3] = (uint8_t)(x >> 24); |
1658 | 0 | p[4] = (uint8_t)(x >> 32); |
1659 | 0 | p[5] = (uint8_t)(x >> 40); |
1660 | 0 | p[6] = (uint8_t)(x >> 48); |
1661 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__poke_u56le__no_bounds_check Unexecuted instantiation: json_fuzzer.cc:wuffs_base__poke_u56le__no_bounds_check(unsigned char*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__poke_u56le__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__poke_u56le__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__poke_u56le__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__poke_u56le__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__poke_u56le__no_bounds_check Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__poke_u56le__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__poke_u56le__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__poke_u56le__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__poke_u56le__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__poke_u56le__no_bounds_check |
1662 | | |
1663 | | static inline void // |
1664 | 0 | wuffs_base__poke_u64be__no_bounds_check(uint8_t* p, uint64_t x) { |
1665 | 0 | p[0] = (uint8_t)(x >> 56); |
1666 | 0 | p[1] = (uint8_t)(x >> 48); |
1667 | 0 | p[2] = (uint8_t)(x >> 40); |
1668 | 0 | p[3] = (uint8_t)(x >> 32); |
1669 | 0 | p[4] = (uint8_t)(x >> 24); |
1670 | 0 | p[5] = (uint8_t)(x >> 16); |
1671 | 0 | p[6] = (uint8_t)(x >> 8); |
1672 | 0 | p[7] = (uint8_t)(x >> 0); |
1673 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__poke_u64be__no_bounds_check Unexecuted instantiation: json_fuzzer.cc:wuffs_base__poke_u64be__no_bounds_check(unsigned char*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__poke_u64be__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__poke_u64be__no_bounds_check Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__poke_u64be__no_bounds_check Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__poke_u64be__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__poke_u64be__no_bounds_check Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__poke_u64be__no_bounds_check Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__poke_u64be__no_bounds_check Unexecuted instantiation: targa_fuzzer.c:wuffs_base__poke_u64be__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__poke_u64be__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__poke_u64be__no_bounds_check |
1674 | | |
1675 | | static inline void // |
1676 | 1.04G | wuffs_base__poke_u64le__no_bounds_check(uint8_t* p, uint64_t x) { |
1677 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) || \ |
1678 | | (defined(__GNUC__) && !defined(__clang__) && defined(__x86_64__)) |
1679 | | // This seems to perform better on gcc 10 (but not clang 9). Clang also |
1680 | | // defines "__GNUC__". |
1681 | | memcpy(p, &x, 8); |
1682 | | #else |
1683 | 1.04G | p[0] = (uint8_t)(x >> 0); |
1684 | 1.04G | p[1] = (uint8_t)(x >> 8); |
1685 | 1.04G | p[2] = (uint8_t)(x >> 16); |
1686 | 1.04G | p[3] = (uint8_t)(x >> 24); |
1687 | 1.04G | p[4] = (uint8_t)(x >> 32); |
1688 | 1.04G | p[5] = (uint8_t)(x >> 40); |
1689 | 1.04G | p[6] = (uint8_t)(x >> 48); |
1690 | 1.04G | p[7] = (uint8_t)(x >> 56); |
1691 | 1.04G | #endif |
1692 | 1.04G | } png_fuzzer.c:wuffs_base__poke_u64le__no_bounds_check Line | Count | Source | 1676 | 33.8M | wuffs_base__poke_u64le__no_bounds_check(uint8_t* p, uint64_t x) { | 1677 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) || \ | 1678 | | (defined(__GNUC__) && !defined(__clang__) && defined(__x86_64__)) | 1679 | | // This seems to perform better on gcc 10 (but not clang 9). Clang also | 1680 | | // defines "__GNUC__". | 1681 | | memcpy(p, &x, 8); | 1682 | | #else | 1683 | 33.8M | p[0] = (uint8_t)(x >> 0); | 1684 | 33.8M | p[1] = (uint8_t)(x >> 8); | 1685 | 33.8M | p[2] = (uint8_t)(x >> 16); | 1686 | 33.8M | p[3] = (uint8_t)(x >> 24); | 1687 | 33.8M | p[4] = (uint8_t)(x >> 32); | 1688 | 33.8M | p[5] = (uint8_t)(x >> 40); | 1689 | 33.8M | p[6] = (uint8_t)(x >> 48); | 1690 | 33.8M | p[7] = (uint8_t)(x >> 56); | 1691 | 33.8M | #endif | 1692 | 33.8M | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__poke_u64le__no_bounds_check(unsigned char*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__poke_u64le__no_bounds_check Unexecuted instantiation: xz_fuzzer.c:wuffs_base__poke_u64le__no_bounds_check jpeg_fuzzer.c:wuffs_base__poke_u64le__no_bounds_check Line | Count | Source | 1676 | 938M | wuffs_base__poke_u64le__no_bounds_check(uint8_t* p, uint64_t x) { | 1677 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) || \ | 1678 | | (defined(__GNUC__) && !defined(__clang__) && defined(__x86_64__)) | 1679 | | // This seems to perform better on gcc 10 (but not clang 9). Clang also | 1680 | | // defines "__GNUC__". | 1681 | | memcpy(p, &x, 8); | 1682 | | #else | 1683 | 938M | p[0] = (uint8_t)(x >> 0); | 1684 | 938M | p[1] = (uint8_t)(x >> 8); | 1685 | 938M | p[2] = (uint8_t)(x >> 16); | 1686 | 938M | p[3] = (uint8_t)(x >> 24); | 1687 | 938M | p[4] = (uint8_t)(x >> 32); | 1688 | 938M | p[5] = (uint8_t)(x >> 40); | 1689 | 938M | p[6] = (uint8_t)(x >> 48); | 1690 | 938M | p[7] = (uint8_t)(x >> 56); | 1691 | 938M | #endif | 1692 | 938M | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__poke_u64le__no_bounds_check Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__poke_u64le__no_bounds_check pixel_swizzler_fuzzer.c:wuffs_base__poke_u64le__no_bounds_check Line | Count | Source | 1676 | 79.7k | wuffs_base__poke_u64le__no_bounds_check(uint8_t* p, uint64_t x) { | 1677 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) || \ | 1678 | | (defined(__GNUC__) && !defined(__clang__) && defined(__x86_64__)) | 1679 | | // This seems to perform better on gcc 10 (but not clang 9). Clang also | 1680 | | // defines "__GNUC__". | 1681 | | memcpy(p, &x, 8); | 1682 | | #else | 1683 | 79.7k | p[0] = (uint8_t)(x >> 0); | 1684 | 79.7k | p[1] = (uint8_t)(x >> 8); | 1685 | 79.7k | p[2] = (uint8_t)(x >> 16); | 1686 | 79.7k | p[3] = (uint8_t)(x >> 24); | 1687 | 79.7k | p[4] = (uint8_t)(x >> 32); | 1688 | 79.7k | p[5] = (uint8_t)(x >> 40); | 1689 | 79.7k | p[6] = (uint8_t)(x >> 48); | 1690 | 79.7k | p[7] = (uint8_t)(x >> 56); | 1691 | 79.7k | #endif | 1692 | 79.7k | } |
zlib_fuzzer.c:wuffs_base__poke_u64le__no_bounds_check Line | Count | Source | 1676 | 68.6M | wuffs_base__poke_u64le__no_bounds_check(uint8_t* p, uint64_t x) { | 1677 | | #if defined(WUFFS_BASE__USE_MEMCPY_LE_PEEK_POKE) || \ | 1678 | | (defined(__GNUC__) && !defined(__clang__) && defined(__x86_64__)) | 1679 | | // This seems to perform better on gcc 10 (but not clang 9). Clang also | 1680 | | // defines "__GNUC__". | 1681 | | memcpy(p, &x, 8); | 1682 | | #else | 1683 | 68.6M | p[0] = (uint8_t)(x >> 0); | 1684 | 68.6M | p[1] = (uint8_t)(x >> 8); | 1685 | 68.6M | p[2] = (uint8_t)(x >> 16); | 1686 | 68.6M | p[3] = (uint8_t)(x >> 24); | 1687 | 68.6M | p[4] = (uint8_t)(x >> 32); | 1688 | 68.6M | p[5] = (uint8_t)(x >> 40); | 1689 | 68.6M | p[6] = (uint8_t)(x >> 48); | 1690 | 68.6M | p[7] = (uint8_t)(x >> 56); | 1691 | 68.6M | #endif | 1692 | 68.6M | } |
Unexecuted instantiation: targa_fuzzer.c:wuffs_base__poke_u64le__no_bounds_check Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__poke_u64le__no_bounds_check Unexecuted instantiation: webp_fuzzer.c:wuffs_base__poke_u64le__no_bounds_check |
1693 | | |
1694 | | // -------- |
1695 | | |
1696 | | static inline uint64_t // |
1697 | | wuffs_base__pack_u8x8le_as_u64(uint8_t a0, |
1698 | | uint8_t a1, |
1699 | | uint8_t a2, |
1700 | | uint8_t a3, |
1701 | | uint8_t a4, |
1702 | | uint8_t a5, |
1703 | | uint8_t a6, |
1704 | 0 | uint8_t a7) { |
1705 | 0 | return (((uint64_t)a0) << 0) | // |
1706 | 0 | (((uint64_t)a1) << 8) | // |
1707 | 0 | (((uint64_t)a2) << 16) | // |
1708 | 0 | (((uint64_t)a3) << 24) | // |
1709 | 0 | (((uint64_t)a4) << 32) | // |
1710 | 0 | (((uint64_t)a5) << 40) | // |
1711 | 0 | (((uint64_t)a6) << 48) | // |
1712 | 0 | (((uint64_t)a7) << 56); |
1713 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pack_u8x8le_as_u64 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pack_u8x8le_as_u64(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pack_u8x8le_as_u64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pack_u8x8le_as_u64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pack_u8x8le_as_u64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pack_u8x8le_as_u64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pack_u8x8le_as_u64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pack_u8x8le_as_u64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pack_u8x8le_as_u64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pack_u8x8le_as_u64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pack_u8x8le_as_u64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pack_u8x8le_as_u64 |
1714 | | |
1715 | | static inline uint64_t // |
1716 | | wuffs_base__pack_u16x4le_as_u64(uint16_t a0, |
1717 | | uint16_t a1, |
1718 | | uint16_t a2, |
1719 | 0 | uint16_t a3) { |
1720 | 0 | return (((uint64_t)a0) << 0) | // |
1721 | 0 | (((uint64_t)a1) << 16) | // |
1722 | 0 | (((uint64_t)a2) << 32) | // |
1723 | 0 | (((uint64_t)a3) << 48); |
1724 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pack_u16x4le_as_u64 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pack_u16x4le_as_u64(unsigned short, unsigned short, unsigned short, unsigned short) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pack_u16x4le_as_u64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pack_u16x4le_as_u64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pack_u16x4le_as_u64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pack_u16x4le_as_u64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pack_u16x4le_as_u64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pack_u16x4le_as_u64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pack_u16x4le_as_u64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pack_u16x4le_as_u64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pack_u16x4le_as_u64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pack_u16x4le_as_u64 |
1725 | | |
1726 | | static inline uint64_t // |
1727 | 0 | wuffs_base__pack_u32x2le_as_u64(uint32_t a0, uint32_t a1) { |
1728 | 0 | return (((uint64_t)a0) << 0) | // |
1729 | 0 | (((uint64_t)a1) << 32); |
1730 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pack_u32x2le_as_u64 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pack_u32x2le_as_u64(unsigned int, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pack_u32x2le_as_u64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pack_u32x2le_as_u64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pack_u32x2le_as_u64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pack_u32x2le_as_u64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pack_u32x2le_as_u64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pack_u32x2le_as_u64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pack_u32x2le_as_u64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pack_u32x2le_as_u64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pack_u32x2le_as_u64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pack_u32x2le_as_u64 |
1731 | | |
1732 | | // ---------------- Slices and Tables |
1733 | | |
1734 | | // WUFFS_BASE__SLICE is a 1-dimensional buffer. |
1735 | | // |
1736 | | // len measures a number of elements, not necessarily a size in bytes. |
1737 | | // |
1738 | | // A value with all fields NULL or zero is a valid, empty slice. |
1739 | | #define WUFFS_BASE__SLICE(T) \ |
1740 | | struct { \ |
1741 | | T* ptr; \ |
1742 | | size_t len; \ |
1743 | | } |
1744 | | |
1745 | | // WUFFS_BASE__TABLE is a 2-dimensional buffer. |
1746 | | // |
1747 | | // width, height and stride measure a number of elements, not necessarily a |
1748 | | // size in bytes. |
1749 | | // |
1750 | | // A value with all fields NULL or zero is a valid, empty table. |
1751 | | #define WUFFS_BASE__TABLE(T) \ |
1752 | | struct { \ |
1753 | | T* ptr; \ |
1754 | | size_t width; \ |
1755 | | size_t height; \ |
1756 | | size_t stride; \ |
1757 | | } |
1758 | | |
1759 | | typedef WUFFS_BASE__SLICE(uint8_t) wuffs_base__slice_u8; |
1760 | | typedef WUFFS_BASE__SLICE(uint16_t) wuffs_base__slice_u16; |
1761 | | typedef WUFFS_BASE__SLICE(uint32_t) wuffs_base__slice_u32; |
1762 | | typedef WUFFS_BASE__SLICE(uint64_t) wuffs_base__slice_u64; |
1763 | | |
1764 | | typedef WUFFS_BASE__TABLE(uint8_t) wuffs_base__table_u8; |
1765 | | typedef WUFFS_BASE__TABLE(uint16_t) wuffs_base__table_u16; |
1766 | | typedef WUFFS_BASE__TABLE(uint32_t) wuffs_base__table_u32; |
1767 | | typedef WUFFS_BASE__TABLE(uint64_t) wuffs_base__table_u64; |
1768 | | |
1769 | | static inline wuffs_base__slice_u8 // |
1770 | 5.32G | wuffs_base__make_slice_u8(uint8_t* ptr, size_t len) { |
1771 | 5.32G | wuffs_base__slice_u8 ret; |
1772 | 5.32G | ret.ptr = ptr; |
1773 | 5.32G | ret.len = len; |
1774 | 5.32G | return ret; |
1775 | 5.32G | } png_fuzzer.c:wuffs_base__make_slice_u8 Line | Count | Source | 1770 | 657M | wuffs_base__make_slice_u8(uint8_t* ptr, size_t len) { | 1771 | 657M | wuffs_base__slice_u8 ret; | 1772 | 657M | ret.ptr = ptr; | 1773 | 657M | ret.len = len; | 1774 | 657M | return ret; | 1775 | 657M | } |
json_fuzzer.cc:wuffs_base__make_slice_u8(unsigned char*, unsigned long) Line | Count | Source | 1770 | 9.54M | wuffs_base__make_slice_u8(uint8_t* ptr, size_t len) { | 1771 | 9.54M | wuffs_base__slice_u8 ret; | 1772 | 9.54M | ret.ptr = ptr; | 1773 | 9.54M | ret.len = len; | 1774 | 9.54M | return ret; | 1775 | 9.54M | } |
gif_fuzzer.c:wuffs_base__make_slice_u8 Line | Count | Source | 1770 | 10.1M | wuffs_base__make_slice_u8(uint8_t* ptr, size_t len) { | 1771 | 10.1M | wuffs_base__slice_u8 ret; | 1772 | 10.1M | ret.ptr = ptr; | 1773 | 10.1M | ret.len = len; | 1774 | 10.1M | return ret; | 1775 | 10.1M | } |
xz_fuzzer.c:wuffs_base__make_slice_u8 Line | Count | Source | 1770 | 74.6M | wuffs_base__make_slice_u8(uint8_t* ptr, size_t len) { | 1771 | 74.6M | wuffs_base__slice_u8 ret; | 1772 | 74.6M | ret.ptr = ptr; | 1773 | 74.6M | ret.len = len; | 1774 | 74.6M | return ret; | 1775 | 74.6M | } |
jpeg_fuzzer.c:wuffs_base__make_slice_u8 Line | Count | Source | 1770 | 2.06G | wuffs_base__make_slice_u8(uint8_t* ptr, size_t len) { | 1771 | 2.06G | wuffs_base__slice_u8 ret; | 1772 | 2.06G | ret.ptr = ptr; | 1773 | 2.06G | ret.len = len; | 1774 | 2.06G | return ret; | 1775 | 2.06G | } |
cbor_fuzzer.c:wuffs_base__make_slice_u8 Line | Count | Source | 1770 | 975k | wuffs_base__make_slice_u8(uint8_t* ptr, size_t len) { | 1771 | 975k | wuffs_base__slice_u8 ret; | 1772 | 975k | ret.ptr = ptr; | 1773 | 975k | ret.len = len; | 1774 | 975k | return ret; | 1775 | 975k | } |
bmp_fuzzer.c:wuffs_base__make_slice_u8 Line | Count | Source | 1770 | 202M | wuffs_base__make_slice_u8(uint8_t* ptr, size_t len) { | 1771 | 202M | wuffs_base__slice_u8 ret; | 1772 | 202M | ret.ptr = ptr; | 1773 | 202M | ret.len = len; | 1774 | 202M | return ret; | 1775 | 202M | } |
pixel_swizzler_fuzzer.c:wuffs_base__make_slice_u8 Line | Count | Source | 1770 | 81.6k | wuffs_base__make_slice_u8(uint8_t* ptr, size_t len) { | 1771 | 81.6k | wuffs_base__slice_u8 ret; | 1772 | 81.6k | ret.ptr = ptr; | 1773 | 81.6k | ret.len = len; | 1774 | 81.6k | return ret; | 1775 | 81.6k | } |
zlib_fuzzer.c:wuffs_base__make_slice_u8 Line | Count | Source | 1770 | 58.3k | wuffs_base__make_slice_u8(uint8_t* ptr, size_t len) { | 1771 | 58.3k | wuffs_base__slice_u8 ret; | 1772 | 58.3k | ret.ptr = ptr; | 1773 | 58.3k | ret.len = len; | 1774 | 58.3k | return ret; | 1775 | 58.3k | } |
targa_fuzzer.c:wuffs_base__make_slice_u8 Line | Count | Source | 1770 | 8.98M | wuffs_base__make_slice_u8(uint8_t* ptr, size_t len) { | 1771 | 8.98M | wuffs_base__slice_u8 ret; | 1772 | 8.98M | ret.ptr = ptr; | 1773 | 8.98M | ret.len = len; | 1774 | 8.98M | return ret; | 1775 | 8.98M | } |
bzip2_fuzzer.c:wuffs_base__make_slice_u8 Line | Count | Source | 1770 | 37.1k | wuffs_base__make_slice_u8(uint8_t* ptr, size_t len) { | 1771 | 37.1k | wuffs_base__slice_u8 ret; | 1772 | 37.1k | ret.ptr = ptr; | 1773 | 37.1k | ret.len = len; | 1774 | 37.1k | return ret; | 1775 | 37.1k | } |
webp_fuzzer.c:wuffs_base__make_slice_u8 Line | Count | Source | 1770 | 2.30G | wuffs_base__make_slice_u8(uint8_t* ptr, size_t len) { | 1771 | 2.30G | wuffs_base__slice_u8 ret; | 1772 | 2.30G | ret.ptr = ptr; | 1773 | 2.30G | ret.len = len; | 1774 | 2.30G | return ret; | 1775 | 2.30G | } |
|
1776 | | |
1777 | | static inline wuffs_base__slice_u16 // |
1778 | 0 | wuffs_base__make_slice_u16(uint16_t* ptr, size_t len) { |
1779 | 0 | wuffs_base__slice_u16 ret; |
1780 | 0 | ret.ptr = ptr; |
1781 | 0 | ret.len = len; |
1782 | 0 | return ret; |
1783 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_slice_u16 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_slice_u16(unsigned short*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_slice_u16 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_slice_u16 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_slice_u16 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_slice_u16 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_slice_u16 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_slice_u16 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_slice_u16 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_slice_u16 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_slice_u16 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_slice_u16 |
1784 | | |
1785 | | static inline wuffs_base__slice_u32 // |
1786 | 0 | wuffs_base__make_slice_u32(uint32_t* ptr, size_t len) { |
1787 | 0 | wuffs_base__slice_u32 ret; |
1788 | 0 | ret.ptr = ptr; |
1789 | 0 | ret.len = len; |
1790 | 0 | return ret; |
1791 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_slice_u32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_slice_u32(unsigned int*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_slice_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_slice_u32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_slice_u32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_slice_u32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_slice_u32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_slice_u32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_slice_u32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_slice_u32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_slice_u32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_slice_u32 |
1792 | | |
1793 | | static inline wuffs_base__slice_u64 // |
1794 | 0 | wuffs_base__make_slice_u64(uint64_t* ptr, size_t len) { |
1795 | 0 | wuffs_base__slice_u64 ret; |
1796 | 0 | ret.ptr = ptr; |
1797 | 0 | ret.len = len; |
1798 | 0 | return ret; |
1799 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_slice_u64 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_slice_u64(unsigned long*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_slice_u64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_slice_u64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_slice_u64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_slice_u64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_slice_u64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_slice_u64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_slice_u64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_slice_u64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_slice_u64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_slice_u64 |
1800 | | |
1801 | | static inline wuffs_base__slice_u8 // |
1802 | 483M | wuffs_base__make_slice_u8_ij(uint8_t* ptr, size_t i, size_t j) { |
1803 | 483M | wuffs_base__slice_u8 ret; |
1804 | 483M | ret.ptr = i ? (ptr + i) : ptr; |
1805 | 483M | ret.len = (j >= i) ? (j - i) : 0; |
1806 | 483M | return ret; |
1807 | 483M | } png_fuzzer.c:wuffs_base__make_slice_u8_ij Line | Count | Source | 1802 | 148k | wuffs_base__make_slice_u8_ij(uint8_t* ptr, size_t i, size_t j) { | 1803 | 148k | wuffs_base__slice_u8 ret; | 1804 | 148k | ret.ptr = i ? (ptr + i) : ptr; | 1805 | 148k | ret.len = (j >= i) ? (j - i) : 0; | 1806 | 148k | return ret; | 1807 | 148k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_slice_u8_ij(unsigned char*, unsigned long, unsigned long) gif_fuzzer.c:wuffs_base__make_slice_u8_ij Line | Count | Source | 1802 | 437k | wuffs_base__make_slice_u8_ij(uint8_t* ptr, size_t i, size_t j) { | 1803 | 437k | wuffs_base__slice_u8 ret; | 1804 | 437k | ret.ptr = i ? (ptr + i) : ptr; | 1805 | 437k | ret.len = (j >= i) ? (j - i) : 0; | 1806 | 437k | return ret; | 1807 | 437k | } |
xz_fuzzer.c:wuffs_base__make_slice_u8_ij Line | Count | Source | 1802 | 2.19k | wuffs_base__make_slice_u8_ij(uint8_t* ptr, size_t i, size_t j) { | 1803 | 2.19k | wuffs_base__slice_u8 ret; | 1804 | 2.19k | ret.ptr = i ? (ptr + i) : ptr; | 1805 | 2.19k | ret.len = (j >= i) ? (j - i) : 0; | 1806 | 2.19k | return ret; | 1807 | 2.19k | } |
jpeg_fuzzer.c:wuffs_base__make_slice_u8_ij Line | Count | Source | 1802 | 23.6M | wuffs_base__make_slice_u8_ij(uint8_t* ptr, size_t i, size_t j) { | 1803 | 23.6M | wuffs_base__slice_u8 ret; | 1804 | 23.6M | ret.ptr = i ? (ptr + i) : ptr; | 1805 | 23.6M | ret.len = (j >= i) ? (j - i) : 0; | 1806 | 23.6M | return ret; | 1807 | 23.6M | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_slice_u8_ij bmp_fuzzer.c:wuffs_base__make_slice_u8_ij Line | Count | Source | 1802 | 3.25k | wuffs_base__make_slice_u8_ij(uint8_t* ptr, size_t i, size_t j) { | 1803 | 3.25k | wuffs_base__slice_u8 ret; | 1804 | 3.25k | ret.ptr = i ? (ptr + i) : ptr; | 1805 | 3.25k | ret.len = (j >= i) ? (j - i) : 0; | 1806 | 3.25k | return ret; | 1807 | 3.25k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_slice_u8_ij zlib_fuzzer.c:wuffs_base__make_slice_u8_ij Line | Count | Source | 1802 | 9.64k | wuffs_base__make_slice_u8_ij(uint8_t* ptr, size_t i, size_t j) { | 1803 | 9.64k | wuffs_base__slice_u8 ret; | 1804 | 9.64k | ret.ptr = i ? (ptr + i) : ptr; | 1805 | 9.64k | ret.len = (j >= i) ? (j - i) : 0; | 1806 | 9.64k | return ret; | 1807 | 9.64k | } |
Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_slice_u8_ij bzip2_fuzzer.c:wuffs_base__make_slice_u8_ij Line | Count | Source | 1802 | 24.6k | wuffs_base__make_slice_u8_ij(uint8_t* ptr, size_t i, size_t j) { | 1803 | 24.6k | wuffs_base__slice_u8 ret; | 1804 | 24.6k | ret.ptr = i ? (ptr + i) : ptr; | 1805 | 24.6k | ret.len = (j >= i) ? (j - i) : 0; | 1806 | 24.6k | return ret; | 1807 | 24.6k | } |
webp_fuzzer.c:wuffs_base__make_slice_u8_ij Line | Count | Source | 1802 | 458M | wuffs_base__make_slice_u8_ij(uint8_t* ptr, size_t i, size_t j) { | 1803 | 458M | wuffs_base__slice_u8 ret; | 1804 | 458M | ret.ptr = i ? (ptr + i) : ptr; | 1805 | 458M | ret.len = (j >= i) ? (j - i) : 0; | 1806 | 458M | return ret; | 1807 | 458M | } |
|
1808 | | |
1809 | | static inline wuffs_base__slice_u16 // |
1810 | 0 | wuffs_base__make_slice_u16_ij(uint16_t* ptr, size_t i, size_t j) { |
1811 | 0 | wuffs_base__slice_u16 ret; |
1812 | 0 | ret.ptr = i ? (ptr + i) : ptr; |
1813 | 0 | ret.len = (j >= i) ? (j - i) : 0; |
1814 | 0 | return ret; |
1815 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_slice_u16_ij Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_slice_u16_ij(unsigned short*, unsigned long, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_slice_u16_ij Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_slice_u16_ij Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_slice_u16_ij Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_slice_u16_ij Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_slice_u16_ij Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_slice_u16_ij Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_slice_u16_ij Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_slice_u16_ij Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_slice_u16_ij Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_slice_u16_ij |
1816 | | |
1817 | | static inline wuffs_base__slice_u32 // |
1818 | 0 | wuffs_base__make_slice_u32_ij(uint32_t* ptr, size_t i, size_t j) { |
1819 | 0 | wuffs_base__slice_u32 ret; |
1820 | 0 | ret.ptr = i ? (ptr + i) : ptr; |
1821 | 0 | ret.len = (j >= i) ? (j - i) : 0; |
1822 | 0 | return ret; |
1823 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_slice_u32_ij Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_slice_u32_ij(unsigned int*, unsigned long, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_slice_u32_ij Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_slice_u32_ij Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_slice_u32_ij Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_slice_u32_ij Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_slice_u32_ij Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_slice_u32_ij Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_slice_u32_ij Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_slice_u32_ij Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_slice_u32_ij Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_slice_u32_ij |
1824 | | |
1825 | | static inline wuffs_base__slice_u64 // |
1826 | 0 | wuffs_base__make_slice_u64_ij(uint64_t* ptr, size_t i, size_t j) { |
1827 | 0 | wuffs_base__slice_u64 ret; |
1828 | 0 | ret.ptr = i ? (ptr + i) : ptr; |
1829 | 0 | ret.len = (j >= i) ? (j - i) : 0; |
1830 | 0 | return ret; |
1831 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_slice_u64_ij Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_slice_u64_ij(unsigned long*, unsigned long, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_slice_u64_ij Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_slice_u64_ij Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_slice_u64_ij Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_slice_u64_ij Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_slice_u64_ij Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_slice_u64_ij Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_slice_u64_ij Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_slice_u64_ij Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_slice_u64_ij Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_slice_u64_ij |
1832 | | |
1833 | | static inline wuffs_base__slice_u8 // |
1834 | 9.37M | wuffs_base__empty_slice_u8(void) { |
1835 | 9.37M | wuffs_base__slice_u8 ret; |
1836 | 9.37M | ret.ptr = NULL; |
1837 | 9.37M | ret.len = 0; |
1838 | 9.37M | return ret; |
1839 | 9.37M | } png_fuzzer.c:wuffs_base__empty_slice_u8 Line | Count | Source | 1834 | 32.2k | wuffs_base__empty_slice_u8(void) { | 1835 | 32.2k | wuffs_base__slice_u8 ret; | 1836 | | ret.ptr = NULL; | 1837 | 32.2k | ret.len = 0; | 1838 | 32.2k | return ret; | 1839 | 32.2k | } |
json_fuzzer.cc:wuffs_base__empty_slice_u8() Line | Count | Source | 1834 | 40.2k | wuffs_base__empty_slice_u8(void) { | 1835 | 40.2k | wuffs_base__slice_u8 ret; | 1836 | | ret.ptr = NULL; | 1837 | 40.2k | ret.len = 0; | 1838 | 40.2k | return ret; | 1839 | 40.2k | } |
gif_fuzzer.c:wuffs_base__empty_slice_u8 Line | Count | Source | 1834 | 5.94M | wuffs_base__empty_slice_u8(void) { | 1835 | 5.94M | wuffs_base__slice_u8 ret; | 1836 | | ret.ptr = NULL; | 1837 | 5.94M | ret.len = 0; | 1838 | 5.94M | return ret; | 1839 | 5.94M | } |
xz_fuzzer.c:wuffs_base__empty_slice_u8 Line | Count | Source | 1834 | 147 | wuffs_base__empty_slice_u8(void) { | 1835 | 147 | wuffs_base__slice_u8 ret; | 1836 | | ret.ptr = NULL; | 1837 | 147 | ret.len = 0; | 1838 | 147 | return ret; | 1839 | 147 | } |
jpeg_fuzzer.c:wuffs_base__empty_slice_u8 Line | Count | Source | 1834 | 2.85k | wuffs_base__empty_slice_u8(void) { | 1835 | 2.85k | wuffs_base__slice_u8 ret; | 1836 | | ret.ptr = NULL; | 1837 | 2.85k | ret.len = 0; | 1838 | 2.85k | return ret; | 1839 | 2.85k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_slice_u8 bmp_fuzzer.c:wuffs_base__empty_slice_u8 Line | Count | Source | 1834 | 2.22M | wuffs_base__empty_slice_u8(void) { | 1835 | 2.22M | wuffs_base__slice_u8 ret; | 1836 | | ret.ptr = NULL; | 1837 | 2.22M | ret.len = 0; | 1838 | 2.22M | return ret; | 1839 | 2.22M | } |
pixel_swizzler_fuzzer.c:wuffs_base__empty_slice_u8 Line | Count | Source | 1834 | 3.29k | wuffs_base__empty_slice_u8(void) { | 1835 | 3.29k | wuffs_base__slice_u8 ret; | 1836 | | ret.ptr = NULL; | 1837 | 3.29k | ret.len = 0; | 1838 | 3.29k | return ret; | 1839 | 3.29k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_slice_u8 targa_fuzzer.c:wuffs_base__empty_slice_u8 Line | Count | Source | 1834 | 735k | wuffs_base__empty_slice_u8(void) { | 1835 | 735k | wuffs_base__slice_u8 ret; | 1836 | | ret.ptr = NULL; | 1837 | 735k | ret.len = 0; | 1838 | 735k | return ret; | 1839 | 735k | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_slice_u8 webp_fuzzer.c:wuffs_base__empty_slice_u8 Line | Count | Source | 1834 | 392k | wuffs_base__empty_slice_u8(void) { | 1835 | 392k | wuffs_base__slice_u8 ret; | 1836 | | ret.ptr = NULL; | 1837 | 392k | ret.len = 0; | 1838 | 392k | return ret; | 1839 | 392k | } |
|
1840 | | |
1841 | | static inline wuffs_base__slice_u16 // |
1842 | 0 | wuffs_base__empty_slice_u16(void) { |
1843 | 0 | wuffs_base__slice_u16 ret; |
1844 | 0 | ret.ptr = NULL; |
1845 | 0 | ret.len = 0; |
1846 | 0 | return ret; |
1847 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_slice_u16 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_slice_u16() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_slice_u16 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_slice_u16 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_slice_u16 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_slice_u16 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_slice_u16 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_slice_u16 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_slice_u16 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_slice_u16 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_slice_u16 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_slice_u16 |
1848 | | |
1849 | | static inline wuffs_base__slice_u32 // |
1850 | 0 | wuffs_base__empty_slice_u32(void) { |
1851 | 0 | wuffs_base__slice_u32 ret; |
1852 | 0 | ret.ptr = NULL; |
1853 | 0 | ret.len = 0; |
1854 | 0 | return ret; |
1855 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_slice_u32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_slice_u32() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_slice_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_slice_u32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_slice_u32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_slice_u32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_slice_u32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_slice_u32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_slice_u32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_slice_u32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_slice_u32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_slice_u32 |
1856 | | |
1857 | | static inline wuffs_base__slice_u64 // |
1858 | 0 | wuffs_base__empty_slice_u64(void) { |
1859 | 0 | wuffs_base__slice_u64 ret; |
1860 | 0 | ret.ptr = NULL; |
1861 | 0 | ret.len = 0; |
1862 | 0 | return ret; |
1863 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_slice_u64 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_slice_u64() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_slice_u64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_slice_u64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_slice_u64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_slice_u64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_slice_u64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_slice_u64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_slice_u64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_slice_u64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_slice_u64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_slice_u64 |
1864 | | |
1865 | | static inline wuffs_base__table_u8 // |
1866 | | wuffs_base__make_table_u8(uint8_t* ptr, |
1867 | | size_t width, |
1868 | | size_t height, |
1869 | 3.82k | size_t stride) { |
1870 | 3.82k | wuffs_base__table_u8 ret; |
1871 | 3.82k | ret.ptr = ptr; |
1872 | 3.82k | ret.width = width; |
1873 | 3.82k | ret.height = height; |
1874 | 3.82k | ret.stride = stride; |
1875 | 3.82k | return ret; |
1876 | 3.82k | } png_fuzzer.c:wuffs_base__make_table_u8 Line | Count | Source | 1869 | 3.82k | size_t stride) { | 1870 | 3.82k | wuffs_base__table_u8 ret; | 1871 | 3.82k | ret.ptr = ptr; | 1872 | 3.82k | ret.width = width; | 1873 | 3.82k | ret.height = height; | 1874 | 3.82k | ret.stride = stride; | 1875 | 3.82k | return ret; | 1876 | 3.82k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_table_u8(unsigned char*, unsigned long, unsigned long, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_table_u8 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_table_u8 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_table_u8 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_table_u8 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_table_u8 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_table_u8 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_table_u8 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_table_u8 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_table_u8 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_table_u8 |
1877 | | |
1878 | | static inline wuffs_base__table_u16 // |
1879 | | wuffs_base__make_table_u16(uint16_t* ptr, |
1880 | | size_t width, |
1881 | | size_t height, |
1882 | 0 | size_t stride) { |
1883 | 0 | wuffs_base__table_u16 ret; |
1884 | 0 | ret.ptr = ptr; |
1885 | 0 | ret.width = width; |
1886 | 0 | ret.height = height; |
1887 | 0 | ret.stride = stride; |
1888 | 0 | return ret; |
1889 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_table_u16 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_table_u16(unsigned short*, unsigned long, unsigned long, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_table_u16 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_table_u16 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_table_u16 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_table_u16 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_table_u16 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_table_u16 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_table_u16 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_table_u16 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_table_u16 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_table_u16 |
1890 | | |
1891 | | static inline wuffs_base__table_u32 // |
1892 | | wuffs_base__make_table_u32(uint32_t* ptr, |
1893 | | size_t width, |
1894 | | size_t height, |
1895 | 0 | size_t stride) { |
1896 | 0 | wuffs_base__table_u32 ret; |
1897 | 0 | ret.ptr = ptr; |
1898 | 0 | ret.width = width; |
1899 | 0 | ret.height = height; |
1900 | 0 | ret.stride = stride; |
1901 | 0 | return ret; |
1902 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_table_u32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_table_u32(unsigned int*, unsigned long, unsigned long, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_table_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_table_u32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_table_u32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_table_u32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_table_u32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_table_u32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_table_u32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_table_u32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_table_u32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_table_u32 |
1903 | | |
1904 | | static inline wuffs_base__table_u64 // |
1905 | | wuffs_base__make_table_u64(uint64_t* ptr, |
1906 | | size_t width, |
1907 | | size_t height, |
1908 | 0 | size_t stride) { |
1909 | 0 | wuffs_base__table_u64 ret; |
1910 | 0 | ret.ptr = ptr; |
1911 | 0 | ret.width = width; |
1912 | 0 | ret.height = height; |
1913 | 0 | ret.stride = stride; |
1914 | 0 | return ret; |
1915 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_table_u64 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_table_u64(unsigned long*, unsigned long, unsigned long, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_table_u64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_table_u64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_table_u64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_table_u64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_table_u64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_table_u64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_table_u64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_table_u64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_table_u64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_table_u64 |
1916 | | |
1917 | | static inline wuffs_base__table_u8 // |
1918 | 0 | wuffs_base__empty_table_u8(void) { |
1919 | 0 | wuffs_base__table_u8 ret; |
1920 | 0 | ret.ptr = NULL; |
1921 | 0 | ret.width = 0; |
1922 | 0 | ret.height = 0; |
1923 | 0 | ret.stride = 0; |
1924 | 0 | return ret; |
1925 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_table_u8 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_table_u8() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_table_u8 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_table_u8 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_table_u8 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_table_u8 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_table_u8 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_table_u8 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_table_u8 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_table_u8 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_table_u8 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_table_u8 |
1926 | | |
1927 | | static inline wuffs_base__table_u16 // |
1928 | 0 | wuffs_base__empty_table_u16(void) { |
1929 | 0 | wuffs_base__table_u16 ret; |
1930 | 0 | ret.ptr = NULL; |
1931 | 0 | ret.width = 0; |
1932 | 0 | ret.height = 0; |
1933 | 0 | ret.stride = 0; |
1934 | 0 | return ret; |
1935 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_table_u16 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_table_u16() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_table_u16 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_table_u16 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_table_u16 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_table_u16 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_table_u16 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_table_u16 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_table_u16 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_table_u16 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_table_u16 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_table_u16 |
1936 | | |
1937 | | static inline wuffs_base__table_u32 // |
1938 | 0 | wuffs_base__empty_table_u32(void) { |
1939 | 0 | wuffs_base__table_u32 ret; |
1940 | 0 | ret.ptr = NULL; |
1941 | 0 | ret.width = 0; |
1942 | 0 | ret.height = 0; |
1943 | 0 | ret.stride = 0; |
1944 | 0 | return ret; |
1945 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_table_u32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_table_u32() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_table_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_table_u32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_table_u32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_table_u32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_table_u32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_table_u32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_table_u32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_table_u32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_table_u32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_table_u32 |
1946 | | |
1947 | | static inline wuffs_base__table_u64 // |
1948 | 0 | wuffs_base__empty_table_u64(void) { |
1949 | 0 | wuffs_base__table_u64 ret; |
1950 | 0 | ret.ptr = NULL; |
1951 | 0 | ret.width = 0; |
1952 | 0 | ret.height = 0; |
1953 | 0 | ret.stride = 0; |
1954 | 0 | return ret; |
1955 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_table_u64 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_table_u64() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_table_u64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_table_u64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_table_u64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_table_u64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_table_u64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_table_u64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_table_u64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_table_u64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_table_u64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_table_u64 |
1956 | | |
1957 | | static inline bool // |
1958 | 0 | wuffs_base__slice_u8__overlaps(wuffs_base__slice_u8 s, wuffs_base__slice_u8 t) { |
1959 | 0 | return ((s.ptr <= t.ptr) && (t.ptr < (s.ptr + s.len))) || |
1960 | 0 | ((t.ptr <= s.ptr) && (s.ptr < (t.ptr + t.len))); |
1961 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__slice_u8__overlaps Unexecuted instantiation: json_fuzzer.cc:wuffs_base__slice_u8__overlaps(wuffs_base__slice_u8, wuffs_base__slice_u8) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__slice_u8__overlaps Unexecuted instantiation: xz_fuzzer.c:wuffs_base__slice_u8__overlaps Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__slice_u8__overlaps Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__slice_u8__overlaps Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__slice_u8__overlaps Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__slice_u8__overlaps Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__slice_u8__overlaps Unexecuted instantiation: targa_fuzzer.c:wuffs_base__slice_u8__overlaps Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__slice_u8__overlaps Unexecuted instantiation: webp_fuzzer.c:wuffs_base__slice_u8__overlaps |
1962 | | |
1963 | | // wuffs_base__slice_u8__subslice_i returns s[i:]. |
1964 | | // |
1965 | | // It returns an empty slice if i is out of bounds. |
1966 | | static inline wuffs_base__slice_u8 // |
1967 | 4.80G | wuffs_base__slice_u8__subslice_i(wuffs_base__slice_u8 s, uint64_t i) { |
1968 | 4.80G | if ((i <= SIZE_MAX) && (i <= s.len)) { |
1969 | | // The "i ? (s.ptr + i) : s.ptr" expression is equivalent to the plain |
1970 | | // "s.ptr + i", except for the fact that in C (prior to C29), but not in |
1971 | | // C++, "NULL + 0" is, technically, undefined behavior (and triggers |
1972 | | // ubsan). See C29 N3322 and https://reviews.llvm.org/D67122 |
1973 | 4.80G | return wuffs_base__make_slice_u8(i ? (s.ptr + i) : s.ptr, |
1974 | 4.80G | ((size_t)(s.len - i))); |
1975 | 4.80G | } |
1976 | 0 | return wuffs_base__empty_slice_u8(); |
1977 | 4.80G | } png_fuzzer.c:wuffs_base__slice_u8__subslice_i Line | Count | Source | 1967 | 418M | wuffs_base__slice_u8__subslice_i(wuffs_base__slice_u8 s, uint64_t i) { | 1968 | 418M | if ((i <= SIZE_MAX) && (i <= s.len)) { | 1969 | | // The "i ? (s.ptr + i) : s.ptr" expression is equivalent to the plain | 1970 | | // "s.ptr + i", except for the fact that in C (prior to C29), but not in | 1971 | | // C++, "NULL + 0" is, technically, undefined behavior (and triggers | 1972 | | // ubsan). See C29 N3322 and https://reviews.llvm.org/D67122 | 1973 | 418M | return wuffs_base__make_slice_u8(i ? (s.ptr + i) : s.ptr, | 1974 | 418M | ((size_t)(s.len - i))); | 1975 | 418M | } | 1976 | 0 | return wuffs_base__empty_slice_u8(); | 1977 | 418M | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__slice_u8__subslice_i(wuffs_base__slice_u8, unsigned long) gif_fuzzer.c:wuffs_base__slice_u8__subslice_i Line | Count | Source | 1967 | 3.74M | wuffs_base__slice_u8__subslice_i(wuffs_base__slice_u8 s, uint64_t i) { | 1968 | 3.74M | if ((i <= SIZE_MAX) && (i <= s.len)) { | 1969 | | // The "i ? (s.ptr + i) : s.ptr" expression is equivalent to the plain | 1970 | | // "s.ptr + i", except for the fact that in C (prior to C29), but not in | 1971 | | // C++, "NULL + 0" is, technically, undefined behavior (and triggers | 1972 | | // ubsan). See C29 N3322 and https://reviews.llvm.org/D67122 | 1973 | 3.74M | return wuffs_base__make_slice_u8(i ? (s.ptr + i) : s.ptr, | 1974 | 3.74M | ((size_t)(s.len - i))); | 1975 | 3.74M | } | 1976 | 0 | return wuffs_base__empty_slice_u8(); | 1977 | 3.74M | } |
xz_fuzzer.c:wuffs_base__slice_u8__subslice_i Line | Count | Source | 1967 | 74.5M | wuffs_base__slice_u8__subslice_i(wuffs_base__slice_u8 s, uint64_t i) { | 1968 | 74.5M | if ((i <= SIZE_MAX) && (i <= s.len)) { | 1969 | | // The "i ? (s.ptr + i) : s.ptr" expression is equivalent to the plain | 1970 | | // "s.ptr + i", except for the fact that in C (prior to C29), but not in | 1971 | | // C++, "NULL + 0" is, technically, undefined behavior (and triggers | 1972 | | // ubsan). See C29 N3322 and https://reviews.llvm.org/D67122 | 1973 | 74.5M | return wuffs_base__make_slice_u8(i ? (s.ptr + i) : s.ptr, | 1974 | 74.5M | ((size_t)(s.len - i))); | 1975 | 74.5M | } | 1976 | 0 | return wuffs_base__empty_slice_u8(); | 1977 | 74.5M | } |
jpeg_fuzzer.c:wuffs_base__slice_u8__subslice_i Line | Count | Source | 1967 | 2.03G | wuffs_base__slice_u8__subslice_i(wuffs_base__slice_u8 s, uint64_t i) { | 1968 | 2.03G | if ((i <= SIZE_MAX) && (i <= s.len)) { | 1969 | | // The "i ? (s.ptr + i) : s.ptr" expression is equivalent to the plain | 1970 | | // "s.ptr + i", except for the fact that in C (prior to C29), but not in | 1971 | | // C++, "NULL + 0" is, technically, undefined behavior (and triggers | 1972 | | // ubsan). See C29 N3322 and https://reviews.llvm.org/D67122 | 1973 | 2.03G | return wuffs_base__make_slice_u8(i ? (s.ptr + i) : s.ptr, | 1974 | 2.03G | ((size_t)(s.len - i))); | 1975 | 2.03G | } | 1976 | 0 | return wuffs_base__empty_slice_u8(); | 1977 | 2.03G | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__slice_u8__subslice_i bmp_fuzzer.c:wuffs_base__slice_u8__subslice_i Line | Count | Source | 1967 | 1.67M | wuffs_base__slice_u8__subslice_i(wuffs_base__slice_u8 s, uint64_t i) { | 1968 | 1.67M | if ((i <= SIZE_MAX) && (i <= s.len)) { | 1969 | | // The "i ? (s.ptr + i) : s.ptr" expression is equivalent to the plain | 1970 | | // "s.ptr + i", except for the fact that in C (prior to C29), but not in | 1971 | | // C++, "NULL + 0" is, technically, undefined behavior (and triggers | 1972 | | // ubsan). See C29 N3322 and https://reviews.llvm.org/D67122 | 1973 | 1.67M | return wuffs_base__make_slice_u8(i ? (s.ptr + i) : s.ptr, | 1974 | 1.67M | ((size_t)(s.len - i))); | 1975 | 1.67M | } | 1976 | 0 | return wuffs_base__empty_slice_u8(); | 1977 | 1.67M | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__slice_u8__subslice_i zlib_fuzzer.c:wuffs_base__slice_u8__subslice_i Line | Count | Source | 1967 | 7.04k | wuffs_base__slice_u8__subslice_i(wuffs_base__slice_u8 s, uint64_t i) { | 1968 | 7.04k | if ((i <= SIZE_MAX) && (i <= s.len)) { | 1969 | | // The "i ? (s.ptr + i) : s.ptr" expression is equivalent to the plain | 1970 | | // "s.ptr + i", except for the fact that in C (prior to C29), but not in | 1971 | | // C++, "NULL + 0" is, technically, undefined behavior (and triggers | 1972 | | // ubsan). See C29 N3322 and https://reviews.llvm.org/D67122 | 1973 | 7.04k | return wuffs_base__make_slice_u8(i ? (s.ptr + i) : s.ptr, | 1974 | 7.04k | ((size_t)(s.len - i))); | 1975 | 7.04k | } | 1976 | 0 | return wuffs_base__empty_slice_u8(); | 1977 | 7.04k | } |
targa_fuzzer.c:wuffs_base__slice_u8__subslice_i Line | Count | Source | 1967 | 4.86M | wuffs_base__slice_u8__subslice_i(wuffs_base__slice_u8 s, uint64_t i) { | 1968 | 4.86M | if ((i <= SIZE_MAX) && (i <= s.len)) { | 1969 | | // The "i ? (s.ptr + i) : s.ptr" expression is equivalent to the plain | 1970 | | // "s.ptr + i", except for the fact that in C (prior to C29), but not in | 1971 | | // C++, "NULL + 0" is, technically, undefined behavior (and triggers | 1972 | | // ubsan). See C29 N3322 and https://reviews.llvm.org/D67122 | 1973 | 4.86M | return wuffs_base__make_slice_u8(i ? (s.ptr + i) : s.ptr, | 1974 | 4.86M | ((size_t)(s.len - i))); | 1975 | 4.86M | } | 1976 | 0 | return wuffs_base__empty_slice_u8(); | 1977 | 4.86M | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__slice_u8__subslice_i webp_fuzzer.c:wuffs_base__slice_u8__subslice_i Line | Count | Source | 1967 | 2.27G | wuffs_base__slice_u8__subslice_i(wuffs_base__slice_u8 s, uint64_t i) { | 1968 | 2.27G | if ((i <= SIZE_MAX) && (i <= s.len)) { | 1969 | | // The "i ? (s.ptr + i) : s.ptr" expression is equivalent to the plain | 1970 | | // "s.ptr + i", except for the fact that in C (prior to C29), but not in | 1971 | | // C++, "NULL + 0" is, technically, undefined behavior (and triggers | 1972 | | // ubsan). See C29 N3322 and https://reviews.llvm.org/D67122 | 1973 | 2.27G | return wuffs_base__make_slice_u8(i ? (s.ptr + i) : s.ptr, | 1974 | 2.27G | ((size_t)(s.len - i))); | 1975 | 2.27G | } | 1976 | 0 | return wuffs_base__empty_slice_u8(); | 1977 | 2.27G | } |
|
1978 | | |
1979 | | // wuffs_base__slice_u8__subslice_j returns s[:j]. |
1980 | | // |
1981 | | // It returns an empty slice if j is out of bounds. |
1982 | | static inline wuffs_base__slice_u8 // |
1983 | 110M | wuffs_base__slice_u8__subslice_j(wuffs_base__slice_u8 s, uint64_t j) { |
1984 | 110M | if ((j <= SIZE_MAX) && (j <= s.len)) { |
1985 | 110M | return wuffs_base__make_slice_u8(s.ptr, ((size_t)j)); |
1986 | 110M | } |
1987 | 0 | return wuffs_base__empty_slice_u8(); |
1988 | 110M | } png_fuzzer.c:wuffs_base__slice_u8__subslice_j Line | Count | Source | 1983 | 107M | wuffs_base__slice_u8__subslice_j(wuffs_base__slice_u8 s, uint64_t j) { | 1984 | 107M | if ((j <= SIZE_MAX) && (j <= s.len)) { | 1985 | 107M | return wuffs_base__make_slice_u8(s.ptr, ((size_t)j)); | 1986 | 107M | } | 1987 | 0 | return wuffs_base__empty_slice_u8(); | 1988 | 107M | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__slice_u8__subslice_j(wuffs_base__slice_u8, unsigned long) gif_fuzzer.c:wuffs_base__slice_u8__subslice_j Line | Count | Source | 1983 | 2.83M | wuffs_base__slice_u8__subslice_j(wuffs_base__slice_u8 s, uint64_t j) { | 1984 | 2.83M | if ((j <= SIZE_MAX) && (j <= s.len)) { | 1985 | 2.83M | return wuffs_base__make_slice_u8(s.ptr, ((size_t)j)); | 1986 | 2.83M | } | 1987 | 0 | return wuffs_base__empty_slice_u8(); | 1988 | 2.83M | } |
xz_fuzzer.c:wuffs_base__slice_u8__subslice_j Line | Count | Source | 1983 | 16.3k | wuffs_base__slice_u8__subslice_j(wuffs_base__slice_u8 s, uint64_t j) { | 1984 | 16.3k | if ((j <= SIZE_MAX) && (j <= s.len)) { | 1985 | 16.3k | return wuffs_base__make_slice_u8(s.ptr, ((size_t)j)); | 1986 | 16.3k | } | 1987 | 0 | return wuffs_base__empty_slice_u8(); | 1988 | 16.3k | } |
Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__slice_u8__subslice_j Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__slice_u8__subslice_j Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__slice_u8__subslice_j Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__slice_u8__subslice_j zlib_fuzzer.c:wuffs_base__slice_u8__subslice_j Line | Count | Source | 1983 | 14.6k | wuffs_base__slice_u8__subslice_j(wuffs_base__slice_u8 s, uint64_t j) { | 1984 | 14.6k | if ((j <= SIZE_MAX) && (j <= s.len)) { | 1985 | 14.6k | return wuffs_base__make_slice_u8(s.ptr, ((size_t)j)); | 1986 | 14.6k | } | 1987 | 0 | return wuffs_base__empty_slice_u8(); | 1988 | 14.6k | } |
Unexecuted instantiation: targa_fuzzer.c:wuffs_base__slice_u8__subslice_j Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__slice_u8__subslice_j webp_fuzzer.c:wuffs_base__slice_u8__subslice_j Line | Count | Source | 1983 | 597k | wuffs_base__slice_u8__subslice_j(wuffs_base__slice_u8 s, uint64_t j) { | 1984 | 597k | if ((j <= SIZE_MAX) && (j <= s.len)) { | 1985 | 597k | return wuffs_base__make_slice_u8(s.ptr, ((size_t)j)); | 1986 | 597k | } | 1987 | 0 | return wuffs_base__empty_slice_u8(); | 1988 | 597k | } |
|
1989 | | |
1990 | | // wuffs_base__slice_u8__subslice_ij returns s[i:j]. |
1991 | | // |
1992 | | // It returns an empty slice if i or j is out of bounds. |
1993 | | static inline wuffs_base__slice_u8 // |
1994 | | wuffs_base__slice_u8__subslice_ij(wuffs_base__slice_u8 s, |
1995 | | uint64_t i, |
1996 | 30.1M | uint64_t j) { |
1997 | 30.1M | if ((i <= j) && (j <= SIZE_MAX) && (j <= s.len)) { |
1998 | | // The "i ? (s.ptr + i) : s.ptr" expression is equivalent to the plain |
1999 | | // "s.ptr + i", except for the fact that in C (prior to C29), but not in |
2000 | | // C++, "NULL + 0" is, technically, undefined behavior (and triggers |
2001 | | // ubsan). See C29 N3322 and https://reviews.llvm.org/D67122 |
2002 | 30.1M | return wuffs_base__make_slice_u8(i ? (s.ptr + i) : s.ptr, |
2003 | 30.1M | ((size_t)(j - i))); |
2004 | 30.1M | } |
2005 | 0 | return wuffs_base__empty_slice_u8(); |
2006 | 30.1M | } png_fuzzer.c:wuffs_base__slice_u8__subslice_ij Line | Count | Source | 1996 | 21.2k | uint64_t j) { | 1997 | 21.2k | if ((i <= j) && (j <= SIZE_MAX) && (j <= s.len)) { | 1998 | | // The "i ? (s.ptr + i) : s.ptr" expression is equivalent to the plain | 1999 | | // "s.ptr + i", except for the fact that in C (prior to C29), but not in | 2000 | | // C++, "NULL + 0" is, technically, undefined behavior (and triggers | 2001 | | // ubsan). See C29 N3322 and https://reviews.llvm.org/D67122 | 2002 | 21.2k | return wuffs_base__make_slice_u8(i ? (s.ptr + i) : s.ptr, | 2003 | 21.2k | ((size_t)(j - i))); | 2004 | 21.2k | } | 2005 | 0 | return wuffs_base__empty_slice_u8(); | 2006 | 21.2k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__slice_u8__subslice_ij(wuffs_base__slice_u8, unsigned long, unsigned long) gif_fuzzer.c:wuffs_base__slice_u8__subslice_ij Line | Count | Source | 1996 | 559k | uint64_t j) { | 1997 | 559k | if ((i <= j) && (j <= SIZE_MAX) && (j <= s.len)) { | 1998 | | // The "i ? (s.ptr + i) : s.ptr" expression is equivalent to the plain | 1999 | | // "s.ptr + i", except for the fact that in C (prior to C29), but not in | 2000 | | // C++, "NULL + 0" is, technically, undefined behavior (and triggers | 2001 | | // ubsan). See C29 N3322 and https://reviews.llvm.org/D67122 | 2002 | 559k | return wuffs_base__make_slice_u8(i ? (s.ptr + i) : s.ptr, | 2003 | 559k | ((size_t)(j - i))); | 2004 | 559k | } | 2005 | 0 | return wuffs_base__empty_slice_u8(); | 2006 | 559k | } |
xz_fuzzer.c:wuffs_base__slice_u8__subslice_ij Line | Count | Source | 1996 | 14.8k | uint64_t j) { | 1997 | 14.8k | if ((i <= j) && (j <= SIZE_MAX) && (j <= s.len)) { | 1998 | | // The "i ? (s.ptr + i) : s.ptr" expression is equivalent to the plain | 1999 | | // "s.ptr + i", except for the fact that in C (prior to C29), but not in | 2000 | | // C++, "NULL + 0" is, technically, undefined behavior (and triggers | 2001 | | // ubsan). See C29 N3322 and https://reviews.llvm.org/D67122 | 2002 | 14.8k | return wuffs_base__make_slice_u8(i ? (s.ptr + i) : s.ptr, | 2003 | 14.8k | ((size_t)(j - i))); | 2004 | 14.8k | } | 2005 | 0 | return wuffs_base__empty_slice_u8(); | 2006 | 14.8k | } |
jpeg_fuzzer.c:wuffs_base__slice_u8__subslice_ij Line | Count | Source | 1996 | 3.17k | uint64_t j) { | 1997 | 3.17k | if ((i <= j) && (j <= SIZE_MAX) && (j <= s.len)) { | 1998 | | // The "i ? (s.ptr + i) : s.ptr" expression is equivalent to the plain | 1999 | | // "s.ptr + i", except for the fact that in C (prior to C29), but not in | 2000 | | // C++, "NULL + 0" is, technically, undefined behavior (and triggers | 2001 | | // ubsan). See C29 N3322 and https://reviews.llvm.org/D67122 | 2002 | 3.17k | return wuffs_base__make_slice_u8(i ? (s.ptr + i) : s.ptr, | 2003 | 3.17k | ((size_t)(j - i))); | 2004 | 3.17k | } | 2005 | 0 | return wuffs_base__empty_slice_u8(); | 2006 | 3.17k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__slice_u8__subslice_ij Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__slice_u8__subslice_ij Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__slice_u8__subslice_ij Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__slice_u8__subslice_ij Unexecuted instantiation: targa_fuzzer.c:wuffs_base__slice_u8__subslice_ij Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__slice_u8__subslice_ij webp_fuzzer.c:wuffs_base__slice_u8__subslice_ij Line | Count | Source | 1996 | 29.5M | uint64_t j) { | 1997 | 29.5M | if ((i <= j) && (j <= SIZE_MAX) && (j <= s.len)) { | 1998 | | // The "i ? (s.ptr + i) : s.ptr" expression is equivalent to the plain | 1999 | | // "s.ptr + i", except for the fact that in C (prior to C29), but not in | 2000 | | // C++, "NULL + 0" is, technically, undefined behavior (and triggers | 2001 | | // ubsan). See C29 N3322 and https://reviews.llvm.org/D67122 | 2002 | 29.5M | return wuffs_base__make_slice_u8(i ? (s.ptr + i) : s.ptr, | 2003 | 29.5M | ((size_t)(j - i))); | 2004 | 29.5M | } | 2005 | 0 | return wuffs_base__empty_slice_u8(); | 2006 | 29.5M | } |
|
2007 | | |
2008 | | // wuffs_base__table_u8__subtable_ij returns t[ix:jx, iy:jy]. |
2009 | | // |
2010 | | // It returns an empty table if i or j is out of bounds. |
2011 | | static inline wuffs_base__table_u8 // |
2012 | | wuffs_base__table_u8__subtable_ij(wuffs_base__table_u8 t, |
2013 | | uint64_t ix, |
2014 | | uint64_t iy, |
2015 | | uint64_t jx, |
2016 | 3.82k | uint64_t jy) { |
2017 | 3.82k | if ((ix <= jx) && (jx <= SIZE_MAX) && (jx <= t.width) && // |
2018 | 3.82k | (iy <= jy) && (jy <= SIZE_MAX) && (jy <= t.height)) { |
2019 | 3.82k | return wuffs_base__make_table_u8(t.ptr + ix + (iy * t.stride), // |
2020 | 3.82k | ((size_t)(jx - ix)), // |
2021 | 3.82k | ((size_t)(jy - iy)), // |
2022 | 3.82k | t.stride); // |
2023 | 3.82k | } |
2024 | 0 | return wuffs_base__make_table_u8(NULL, 0, 0, 0); |
2025 | 3.82k | } png_fuzzer.c:wuffs_base__table_u8__subtable_ij Line | Count | Source | 2016 | 3.82k | uint64_t jy) { | 2017 | 3.82k | if ((ix <= jx) && (jx <= SIZE_MAX) && (jx <= t.width) && // | 2018 | 3.82k | (iy <= jy) && (jy <= SIZE_MAX) && (jy <= t.height)) { | 2019 | 3.82k | return wuffs_base__make_table_u8(t.ptr + ix + (iy * t.stride), // | 2020 | 3.82k | ((size_t)(jx - ix)), // | 2021 | 3.82k | ((size_t)(jy - iy)), // | 2022 | 3.82k | t.stride); // | 2023 | 3.82k | } | 2024 | 0 | return wuffs_base__make_table_u8(NULL, 0, 0, 0); | 2025 | 3.82k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__table_u8__subtable_ij(wuffs_base__table_u8, unsigned long, unsigned long, unsigned long, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__table_u8__subtable_ij Unexecuted instantiation: xz_fuzzer.c:wuffs_base__table_u8__subtable_ij Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__table_u8__subtable_ij Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__table_u8__subtable_ij Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__table_u8__subtable_ij Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__table_u8__subtable_ij Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__table_u8__subtable_ij Unexecuted instantiation: targa_fuzzer.c:wuffs_base__table_u8__subtable_ij Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__table_u8__subtable_ij Unexecuted instantiation: webp_fuzzer.c:wuffs_base__table_u8__subtable_ij |
2026 | | |
2027 | | // wuffs_base__table__flattened_length returns the number of elements covered |
2028 | | // by the 1-dimensional span that backs a 2-dimensional table. This counts the |
2029 | | // elements inside the table and, when width != stride, the elements outside |
2030 | | // the table but between its rows. |
2031 | | // |
2032 | | // For example, consider a width 10, height 4, stride 10 table. Mark its first |
2033 | | // and last (inclusive) elements with 'a' and 'z'. This function returns 40. |
2034 | | // |
2035 | | // a123456789 |
2036 | | // 0123456789 |
2037 | | // 0123456789 |
2038 | | // 012345678z |
2039 | | // |
2040 | | // Now consider the sub-table of that from (2, 1) inclusive to (8, 4) exclusive. |
2041 | | // |
2042 | | // a123456789 |
2043 | | // 01iiiiiioo |
2044 | | // ooiiiiiioo |
2045 | | // ooiiiiii8z |
2046 | | // |
2047 | | // This function (called with width 6, height 3, stride 10) returns 26: 18 'i' |
2048 | | // inside elements plus 8 'o' outside elements. Note that 26 is less than a |
2049 | | // naive (height * stride = 30) computation. Indeed, advancing 29 elements from |
2050 | | // the first 'i' would venture past 'z', out of bounds of the original table. |
2051 | | // |
2052 | | // It does not check for overflow, but if the arguments come from a table that |
2053 | | // exists in memory and each element occupies a positive number of bytes then |
2054 | | // the result should be bounded by the amount of allocatable memory (which |
2055 | | // shouldn't overflow SIZE_MAX). |
2056 | | static inline size_t // |
2057 | | wuffs_base__table__flattened_length(size_t width, |
2058 | | size_t height, |
2059 | 0 | size_t stride) { |
2060 | 0 | if (height == 0) { |
2061 | 0 | return 0; |
2062 | 0 | } |
2063 | 0 | return ((height - 1) * stride) + width; |
2064 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__table__flattened_length Unexecuted instantiation: json_fuzzer.cc:wuffs_base__table__flattened_length(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__table__flattened_length Unexecuted instantiation: xz_fuzzer.c:wuffs_base__table__flattened_length Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__table__flattened_length Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__table__flattened_length Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__table__flattened_length Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__table__flattened_length Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__table__flattened_length Unexecuted instantiation: targa_fuzzer.c:wuffs_base__table__flattened_length Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__table__flattened_length Unexecuted instantiation: webp_fuzzer.c:wuffs_base__table__flattened_length |
2065 | | |
2066 | | // ---------------- Magic Numbers |
2067 | | |
2068 | | // wuffs_base__magic_number_guess_fourcc guesses the file format of some data, |
2069 | | // given its starting bytes (the prefix_data argument) and whether or not there |
2070 | | // may be further bytes (the prefix_closed argument; true means that |
2071 | | // prefix_data is the entire data). |
2072 | | // |
2073 | | // It returns a positive FourCC value on success. |
2074 | | // |
2075 | | // It returns zero if nothing matches its hard-coded list of 'magic numbers'. |
2076 | | // |
2077 | | // It returns a negative value if prefix_closed is false and a longer prefix is |
2078 | | // required for a conclusive result. For example, a single 'B' byte (without |
2079 | | // further data) is not enough to discriminate the BMP and BPG image file |
2080 | | // formats. Similarly, a single '\xFF' byte might be the start of JPEG data or |
2081 | | // it might be the start of some other binary data. |
2082 | | // |
2083 | | // It does not do a full validity check. Like any guess made from a short |
2084 | | // prefix of the data, it may return false positives. Data that starts with 99 |
2085 | | // bytes of valid JPEG followed by corruption or truncation is an invalid JPEG |
2086 | | // image overall, but this function will still return WUFFS_BASE__FOURCC__JPEG. |
2087 | | // |
2088 | | // Another source of false positives is that some 'magic numbers' are valid |
2089 | | // ASCII data. A file starting with "GIF87a and GIF89a are the two versions of |
2090 | | // GIF" will match GIF's 'magic number' even if it's plain text, not an image. |
2091 | | // |
2092 | | // For modular builds that divide the base module into sub-modules, using this |
2093 | | // function requires the WUFFS_CONFIG__MODULE__BASE__MAGIC sub-module, not just |
2094 | | // WUFFS_CONFIG__MODULE__BASE__CORE. |
2095 | | WUFFS_BASE__MAYBE_STATIC int32_t // |
2096 | | wuffs_base__magic_number_guess_fourcc(wuffs_base__slice_u8 prefix_data, |
2097 | | bool prefix_closed); |
2098 | | |
2099 | | // ---------------- Quirk Values |
2100 | | |
2101 | | // These constants are the value half of a key-value pair, where the key is |
2102 | | // WUFFS_BASE__QUIRK_QUALITY. |
2103 | | // |
2104 | | // In the Wuffs API, set_quirk takes a u64 value. These macro definitions are |
2105 | | // likewise unsigned values (uint64_t) but for this particular key, they are |
2106 | | // best interpreted as signed values (int64_t). "Lower-than-default quality" |
2107 | | // and "higher-than-default quality", as signed values, are -1 and +1. |
2108 | | // |
2109 | | // See doc/note/quirks.md for some more discussion about trade-offs. |
2110 | | #define WUFFS_BASE__QUIRK_QUALITY__VALUE__LOWER_QUALITY UINT64_MAX |
2111 | | #define WUFFS_BASE__QUIRK_QUALITY__VALUE__HIGHER_QUALITY ((uint64_t)1) |
2112 | | |
2113 | | // ---------------- Ranges and Rects |
2114 | | |
2115 | | // See https://github.com/google/wuffs/blob/main/doc/note/ranges-and-rects.md |
2116 | | |
2117 | | // -------- |
2118 | | |
2119 | | typedef struct wuffs_base__range_ie_i32__struct { |
2120 | | int32_t min_incl; |
2121 | | int32_t max_excl; |
2122 | | |
2123 | | #ifdef __cplusplus |
2124 | | inline bool is_empty() const; |
2125 | | inline bool equals(wuffs_base__range_ie_i32__struct s) const; |
2126 | | inline wuffs_base__range_ie_i32__struct intersect( |
2127 | | wuffs_base__range_ie_i32__struct s) const; |
2128 | | inline wuffs_base__range_ie_i32__struct unite( |
2129 | | wuffs_base__range_ie_i32__struct s) const; |
2130 | | inline bool contains(int32_t x) const; |
2131 | | inline bool contains_range(wuffs_base__range_ie_i32__struct s) const; |
2132 | | inline uint32_t length() const; |
2133 | | #endif // __cplusplus |
2134 | | |
2135 | | } wuffs_base__range_ie_i32; |
2136 | | |
2137 | | static inline wuffs_base__range_ie_i32 // |
2138 | 0 | wuffs_base__empty_range_ie_i32(void) { |
2139 | 0 | wuffs_base__range_ie_i32 ret; |
2140 | 0 | ret.min_incl = 0; |
2141 | 0 | ret.max_excl = 0; |
2142 | 0 | return ret; |
2143 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_range_ie_i32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_range_ie_i32() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_range_ie_i32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_range_ie_i32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_range_ie_i32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_range_ie_i32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_range_ie_i32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_range_ie_i32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_range_ie_i32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_range_ie_i32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_range_ie_i32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_range_ie_i32 |
2144 | | |
2145 | | static inline wuffs_base__range_ie_i32 // |
2146 | 0 | wuffs_base__make_range_ie_i32(int32_t min_incl, int32_t max_excl) { |
2147 | 0 | wuffs_base__range_ie_i32 ret; |
2148 | 0 | ret.min_incl = min_incl; |
2149 | 0 | ret.max_excl = max_excl; |
2150 | 0 | return ret; |
2151 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_range_ie_i32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_range_ie_i32(int, int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_range_ie_i32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_range_ie_i32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_range_ie_i32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_range_ie_i32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_range_ie_i32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_range_ie_i32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_range_ie_i32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_range_ie_i32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_range_ie_i32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_range_ie_i32 |
2152 | | |
2153 | | static inline bool // |
2154 | 0 | wuffs_base__range_ie_i32__is_empty(const wuffs_base__range_ie_i32* r) { |
2155 | 0 | return r->min_incl >= r->max_excl; |
2156 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_i32__is_empty Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_i32__is_empty(wuffs_base__range_ie_i32__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_i32__is_empty Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_i32__is_empty Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_i32__is_empty Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_i32__is_empty Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_i32__is_empty Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_i32__is_empty Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_i32__is_empty Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_i32__is_empty Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_i32__is_empty Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_i32__is_empty |
2157 | | |
2158 | | static inline bool // |
2159 | | wuffs_base__range_ie_i32__equals(const wuffs_base__range_ie_i32* r, |
2160 | 0 | wuffs_base__range_ie_i32 s) { |
2161 | 0 | return (r->min_incl == s.min_incl && r->max_excl == s.max_excl) || |
2162 | 0 | (wuffs_base__range_ie_i32__is_empty(r) && |
2163 | 0 | wuffs_base__range_ie_i32__is_empty(&s)); |
2164 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_i32__equals Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_i32__equals(wuffs_base__range_ie_i32__struct const*, wuffs_base__range_ie_i32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_i32__equals Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_i32__equals Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_i32__equals Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_i32__equals Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_i32__equals Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_i32__equals Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_i32__equals Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_i32__equals Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_i32__equals Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_i32__equals |
2165 | | |
2166 | | static inline wuffs_base__range_ie_i32 // |
2167 | | wuffs_base__range_ie_i32__intersect(const wuffs_base__range_ie_i32* r, |
2168 | 0 | wuffs_base__range_ie_i32 s) { |
2169 | 0 | wuffs_base__range_ie_i32 t; |
2170 | 0 | t.min_incl = wuffs_base__i32__max(r->min_incl, s.min_incl); |
2171 | 0 | t.max_excl = wuffs_base__i32__min(r->max_excl, s.max_excl); |
2172 | 0 | return t; |
2173 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_i32__intersect Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_i32__intersect(wuffs_base__range_ie_i32__struct const*, wuffs_base__range_ie_i32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_i32__intersect Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_i32__intersect Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_i32__intersect Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_i32__intersect Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_i32__intersect Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_i32__intersect Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_i32__intersect Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_i32__intersect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_i32__intersect Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_i32__intersect |
2174 | | |
2175 | | static inline wuffs_base__range_ie_i32 // |
2176 | | wuffs_base__range_ie_i32__unite(const wuffs_base__range_ie_i32* r, |
2177 | 0 | wuffs_base__range_ie_i32 s) { |
2178 | 0 | if (wuffs_base__range_ie_i32__is_empty(r)) { |
2179 | 0 | return s; |
2180 | 0 | } |
2181 | 0 | if (wuffs_base__range_ie_i32__is_empty(&s)) { |
2182 | 0 | return *r; |
2183 | 0 | } |
2184 | 0 | wuffs_base__range_ie_i32 t; |
2185 | 0 | t.min_incl = wuffs_base__i32__min(r->min_incl, s.min_incl); |
2186 | 0 | t.max_excl = wuffs_base__i32__max(r->max_excl, s.max_excl); |
2187 | 0 | return t; |
2188 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_i32__unite Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_i32__unite(wuffs_base__range_ie_i32__struct const*, wuffs_base__range_ie_i32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_i32__unite Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_i32__unite Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_i32__unite Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_i32__unite Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_i32__unite Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_i32__unite Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_i32__unite Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_i32__unite Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_i32__unite Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_i32__unite |
2189 | | |
2190 | | static inline bool // |
2191 | | wuffs_base__range_ie_i32__contains(const wuffs_base__range_ie_i32* r, |
2192 | 0 | int32_t x) { |
2193 | 0 | return (r->min_incl <= x) && (x < r->max_excl); |
2194 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_i32__contains Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_i32__contains(wuffs_base__range_ie_i32__struct const*, int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_i32__contains Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_i32__contains Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_i32__contains Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_i32__contains Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_i32__contains Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_i32__contains Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_i32__contains Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_i32__contains Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_i32__contains Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_i32__contains |
2195 | | |
2196 | | static inline bool // |
2197 | | wuffs_base__range_ie_i32__contains_range(const wuffs_base__range_ie_i32* r, |
2198 | 0 | wuffs_base__range_ie_i32 s) { |
2199 | 0 | return wuffs_base__range_ie_i32__equals( |
2200 | 0 | &s, wuffs_base__range_ie_i32__intersect(r, s)); |
2201 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_i32__contains_range Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_i32__contains_range(wuffs_base__range_ie_i32__struct const*, wuffs_base__range_ie_i32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_i32__contains_range Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_i32__contains_range Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_i32__contains_range Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_i32__contains_range Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_i32__contains_range Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_i32__contains_range Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_i32__contains_range Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_i32__contains_range Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_i32__contains_range Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_i32__contains_range |
2202 | | |
2203 | | static inline uint32_t // |
2204 | 0 | wuffs_base__range_ie_i32__length(const wuffs_base__range_ie_i32* r) { |
2205 | 0 | return (r->max_excl > r->min_incl) |
2206 | 0 | ? (((uint32_t)(r->max_excl)) - ((uint32_t)(r->min_incl))) |
2207 | 0 | : 0; |
2208 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_i32__length Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_i32__length(wuffs_base__range_ie_i32__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_i32__length Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_i32__length Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_i32__length Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_i32__length Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_i32__length Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_i32__length Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_i32__length Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_i32__length Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_i32__length Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_i32__length |
2209 | | |
2210 | | #ifdef __cplusplus |
2211 | | |
2212 | | inline bool // |
2213 | 0 | wuffs_base__range_ie_i32::is_empty() const { |
2214 | 0 | return wuffs_base__range_ie_i32__is_empty(this); |
2215 | 0 | } |
2216 | | |
2217 | | inline bool // |
2218 | 0 | wuffs_base__range_ie_i32::equals(wuffs_base__range_ie_i32 s) const { |
2219 | 0 | return wuffs_base__range_ie_i32__equals(this, s); |
2220 | 0 | } |
2221 | | |
2222 | | inline wuffs_base__range_ie_i32 // |
2223 | 0 | wuffs_base__range_ie_i32::intersect(wuffs_base__range_ie_i32 s) const { |
2224 | 0 | return wuffs_base__range_ie_i32__intersect(this, s); |
2225 | 0 | } |
2226 | | |
2227 | | inline wuffs_base__range_ie_i32 // |
2228 | 0 | wuffs_base__range_ie_i32::unite(wuffs_base__range_ie_i32 s) const { |
2229 | 0 | return wuffs_base__range_ie_i32__unite(this, s); |
2230 | 0 | } |
2231 | | |
2232 | | inline bool // |
2233 | 0 | wuffs_base__range_ie_i32::contains(int32_t x) const { |
2234 | 0 | return wuffs_base__range_ie_i32__contains(this, x); |
2235 | 0 | } |
2236 | | |
2237 | | inline bool // |
2238 | 0 | wuffs_base__range_ie_i32::contains_range(wuffs_base__range_ie_i32 s) const { |
2239 | 0 | return wuffs_base__range_ie_i32__contains_range(this, s); |
2240 | 0 | } |
2241 | | |
2242 | | inline uint32_t // |
2243 | 0 | wuffs_base__range_ie_i32::length() const { |
2244 | 0 | return wuffs_base__range_ie_i32__length(this); |
2245 | 0 | } |
2246 | | |
2247 | | #endif // __cplusplus |
2248 | | |
2249 | | // -------- |
2250 | | |
2251 | | typedef struct wuffs_base__range_ie_u32__struct { |
2252 | | uint32_t min_incl; |
2253 | | uint32_t max_excl; |
2254 | | |
2255 | | #ifdef __cplusplus |
2256 | | inline bool is_empty() const; |
2257 | | inline bool equals(wuffs_base__range_ie_u32__struct s) const; |
2258 | | inline wuffs_base__range_ie_u32__struct intersect( |
2259 | | wuffs_base__range_ie_u32__struct s) const; |
2260 | | inline wuffs_base__range_ie_u32__struct unite( |
2261 | | wuffs_base__range_ie_u32__struct s) const; |
2262 | | inline bool contains(uint32_t x) const; |
2263 | | inline bool contains_range(wuffs_base__range_ie_u32__struct s) const; |
2264 | | inline uint32_t length() const; |
2265 | | #endif // __cplusplus |
2266 | | |
2267 | | } wuffs_base__range_ie_u32; |
2268 | | |
2269 | | static inline wuffs_base__range_ie_u32 // |
2270 | 0 | wuffs_base__empty_range_ie_u32(void) { |
2271 | 0 | wuffs_base__range_ie_u32 ret; |
2272 | 0 | ret.min_incl = 0; |
2273 | 0 | ret.max_excl = 0; |
2274 | 0 | return ret; |
2275 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_range_ie_u32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_range_ie_u32() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_range_ie_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_range_ie_u32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_range_ie_u32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_range_ie_u32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_range_ie_u32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_range_ie_u32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_range_ie_u32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_range_ie_u32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_range_ie_u32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_range_ie_u32 |
2276 | | |
2277 | | static inline wuffs_base__range_ie_u32 // |
2278 | 0 | wuffs_base__make_range_ie_u32(uint32_t min_incl, uint32_t max_excl) { |
2279 | 0 | wuffs_base__range_ie_u32 ret; |
2280 | 0 | ret.min_incl = min_incl; |
2281 | 0 | ret.max_excl = max_excl; |
2282 | 0 | return ret; |
2283 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_range_ie_u32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_range_ie_u32(unsigned int, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_range_ie_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_range_ie_u32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_range_ie_u32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_range_ie_u32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_range_ie_u32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_range_ie_u32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_range_ie_u32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_range_ie_u32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_range_ie_u32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_range_ie_u32 |
2284 | | |
2285 | | static inline bool // |
2286 | 0 | wuffs_base__range_ie_u32__is_empty(const wuffs_base__range_ie_u32* r) { |
2287 | 0 | return r->min_incl >= r->max_excl; |
2288 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_u32__is_empty Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_u32__is_empty(wuffs_base__range_ie_u32__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_u32__is_empty Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_u32__is_empty Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_u32__is_empty Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_u32__is_empty Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_u32__is_empty Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_u32__is_empty Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_u32__is_empty Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_u32__is_empty Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_u32__is_empty Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_u32__is_empty |
2289 | | |
2290 | | static inline bool // |
2291 | | wuffs_base__range_ie_u32__equals(const wuffs_base__range_ie_u32* r, |
2292 | 0 | wuffs_base__range_ie_u32 s) { |
2293 | 0 | return (r->min_incl == s.min_incl && r->max_excl == s.max_excl) || |
2294 | 0 | (wuffs_base__range_ie_u32__is_empty(r) && |
2295 | 0 | wuffs_base__range_ie_u32__is_empty(&s)); |
2296 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_u32__equals Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_u32__equals(wuffs_base__range_ie_u32__struct const*, wuffs_base__range_ie_u32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_u32__equals Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_u32__equals Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_u32__equals Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_u32__equals Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_u32__equals Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_u32__equals Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_u32__equals Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_u32__equals Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_u32__equals Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_u32__equals |
2297 | | |
2298 | | static inline wuffs_base__range_ie_u32 // |
2299 | | wuffs_base__range_ie_u32__intersect(const wuffs_base__range_ie_u32* r, |
2300 | 0 | wuffs_base__range_ie_u32 s) { |
2301 | 0 | wuffs_base__range_ie_u32 t; |
2302 | 0 | t.min_incl = wuffs_base__u32__max(r->min_incl, s.min_incl); |
2303 | 0 | t.max_excl = wuffs_base__u32__min(r->max_excl, s.max_excl); |
2304 | 0 | return t; |
2305 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_u32__intersect Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_u32__intersect(wuffs_base__range_ie_u32__struct const*, wuffs_base__range_ie_u32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_u32__intersect Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_u32__intersect Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_u32__intersect Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_u32__intersect Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_u32__intersect Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_u32__intersect Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_u32__intersect Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_u32__intersect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_u32__intersect Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_u32__intersect |
2306 | | |
2307 | | static inline wuffs_base__range_ie_u32 // |
2308 | | wuffs_base__range_ie_u32__unite(const wuffs_base__range_ie_u32* r, |
2309 | 0 | wuffs_base__range_ie_u32 s) { |
2310 | 0 | if (wuffs_base__range_ie_u32__is_empty(r)) { |
2311 | 0 | return s; |
2312 | 0 | } |
2313 | 0 | if (wuffs_base__range_ie_u32__is_empty(&s)) { |
2314 | 0 | return *r; |
2315 | 0 | } |
2316 | 0 | wuffs_base__range_ie_u32 t; |
2317 | 0 | t.min_incl = wuffs_base__u32__min(r->min_incl, s.min_incl); |
2318 | 0 | t.max_excl = wuffs_base__u32__max(r->max_excl, s.max_excl); |
2319 | 0 | return t; |
2320 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_u32__unite Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_u32__unite(wuffs_base__range_ie_u32__struct const*, wuffs_base__range_ie_u32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_u32__unite Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_u32__unite Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_u32__unite Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_u32__unite Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_u32__unite Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_u32__unite Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_u32__unite Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_u32__unite Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_u32__unite Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_u32__unite |
2321 | | |
2322 | | static inline bool // |
2323 | | wuffs_base__range_ie_u32__contains(const wuffs_base__range_ie_u32* r, |
2324 | 0 | uint32_t x) { |
2325 | 0 | return (r->min_incl <= x) && (x < r->max_excl); |
2326 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_u32__contains Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_u32__contains(wuffs_base__range_ie_u32__struct const*, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_u32__contains Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_u32__contains Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_u32__contains Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_u32__contains Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_u32__contains Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_u32__contains Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_u32__contains Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_u32__contains Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_u32__contains Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_u32__contains |
2327 | | |
2328 | | static inline bool // |
2329 | | wuffs_base__range_ie_u32__contains_range(const wuffs_base__range_ie_u32* r, |
2330 | 0 | wuffs_base__range_ie_u32 s) { |
2331 | 0 | return wuffs_base__range_ie_u32__equals( |
2332 | 0 | &s, wuffs_base__range_ie_u32__intersect(r, s)); |
2333 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_u32__contains_range Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_u32__contains_range(wuffs_base__range_ie_u32__struct const*, wuffs_base__range_ie_u32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_u32__contains_range Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_u32__contains_range Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_u32__contains_range Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_u32__contains_range Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_u32__contains_range Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_u32__contains_range Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_u32__contains_range Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_u32__contains_range Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_u32__contains_range Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_u32__contains_range |
2334 | | |
2335 | | static inline uint32_t // |
2336 | 0 | wuffs_base__range_ie_u32__length(const wuffs_base__range_ie_u32* r) { |
2337 | 0 | return wuffs_base__u32__sat_sub(r->max_excl, r->min_incl); |
2338 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_u32__length Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_u32__length(wuffs_base__range_ie_u32__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_u32__length Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_u32__length Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_u32__length Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_u32__length Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_u32__length Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_u32__length Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_u32__length Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_u32__length Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_u32__length Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_u32__length |
2339 | | |
2340 | | #ifdef __cplusplus |
2341 | | |
2342 | | inline bool // |
2343 | 0 | wuffs_base__range_ie_u32::is_empty() const { |
2344 | 0 | return wuffs_base__range_ie_u32__is_empty(this); |
2345 | 0 | } |
2346 | | |
2347 | | inline bool // |
2348 | 0 | wuffs_base__range_ie_u32::equals(wuffs_base__range_ie_u32 s) const { |
2349 | 0 | return wuffs_base__range_ie_u32__equals(this, s); |
2350 | 0 | } |
2351 | | |
2352 | | inline wuffs_base__range_ie_u32 // |
2353 | 0 | wuffs_base__range_ie_u32::intersect(wuffs_base__range_ie_u32 s) const { |
2354 | 0 | return wuffs_base__range_ie_u32__intersect(this, s); |
2355 | 0 | } |
2356 | | |
2357 | | inline wuffs_base__range_ie_u32 // |
2358 | 0 | wuffs_base__range_ie_u32::unite(wuffs_base__range_ie_u32 s) const { |
2359 | 0 | return wuffs_base__range_ie_u32__unite(this, s); |
2360 | 0 | } |
2361 | | |
2362 | | inline bool // |
2363 | 0 | wuffs_base__range_ie_u32::contains(uint32_t x) const { |
2364 | 0 | return wuffs_base__range_ie_u32__contains(this, x); |
2365 | 0 | } |
2366 | | |
2367 | | inline bool // |
2368 | 0 | wuffs_base__range_ie_u32::contains_range(wuffs_base__range_ie_u32 s) const { |
2369 | 0 | return wuffs_base__range_ie_u32__contains_range(this, s); |
2370 | 0 | } |
2371 | | |
2372 | | inline uint32_t // |
2373 | 0 | wuffs_base__range_ie_u32::length() const { |
2374 | 0 | return wuffs_base__range_ie_u32__length(this); |
2375 | 0 | } |
2376 | | |
2377 | | #endif // __cplusplus |
2378 | | |
2379 | | // -------- |
2380 | | |
2381 | | typedef struct wuffs_base__range_ie_u64__struct { |
2382 | | uint64_t min_incl; |
2383 | | uint64_t max_excl; |
2384 | | |
2385 | | #ifdef __cplusplus |
2386 | | inline bool is_empty() const; |
2387 | | inline bool equals(wuffs_base__range_ie_u64__struct s) const; |
2388 | | inline wuffs_base__range_ie_u64__struct intersect( |
2389 | | wuffs_base__range_ie_u64__struct s) const; |
2390 | | inline wuffs_base__range_ie_u64__struct unite( |
2391 | | wuffs_base__range_ie_u64__struct s) const; |
2392 | | inline bool contains(uint64_t x) const; |
2393 | | inline bool contains_range(wuffs_base__range_ie_u64__struct s) const; |
2394 | | inline uint64_t length() const; |
2395 | | #endif // __cplusplus |
2396 | | |
2397 | | } wuffs_base__range_ie_u64; |
2398 | | |
2399 | | static inline wuffs_base__range_ie_u64 // |
2400 | 0 | wuffs_base__empty_range_ie_u64(void) { |
2401 | 0 | wuffs_base__range_ie_u64 ret; |
2402 | 0 | ret.min_incl = 0; |
2403 | 0 | ret.max_excl = 0; |
2404 | 0 | return ret; |
2405 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_range_ie_u64 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_range_ie_u64() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_range_ie_u64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_range_ie_u64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_range_ie_u64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_range_ie_u64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_range_ie_u64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_range_ie_u64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_range_ie_u64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_range_ie_u64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_range_ie_u64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_range_ie_u64 |
2406 | | |
2407 | | static inline wuffs_base__range_ie_u64 // |
2408 | 0 | wuffs_base__make_range_ie_u64(uint64_t min_incl, uint64_t max_excl) { |
2409 | 0 | wuffs_base__range_ie_u64 ret; |
2410 | 0 | ret.min_incl = min_incl; |
2411 | 0 | ret.max_excl = max_excl; |
2412 | 0 | return ret; |
2413 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_range_ie_u64 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_range_ie_u64(unsigned long, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_range_ie_u64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_range_ie_u64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_range_ie_u64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_range_ie_u64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_range_ie_u64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_range_ie_u64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_range_ie_u64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_range_ie_u64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_range_ie_u64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_range_ie_u64 |
2414 | | |
2415 | | static inline bool // |
2416 | 0 | wuffs_base__range_ie_u64__is_empty(const wuffs_base__range_ie_u64* r) { |
2417 | 0 | return r->min_incl >= r->max_excl; |
2418 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_u64__is_empty Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_u64__is_empty(wuffs_base__range_ie_u64__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_u64__is_empty Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_u64__is_empty Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_u64__is_empty Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_u64__is_empty Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_u64__is_empty Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_u64__is_empty Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_u64__is_empty Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_u64__is_empty Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_u64__is_empty Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_u64__is_empty |
2419 | | |
2420 | | static inline bool // |
2421 | | wuffs_base__range_ie_u64__equals(const wuffs_base__range_ie_u64* r, |
2422 | 0 | wuffs_base__range_ie_u64 s) { |
2423 | 0 | return (r->min_incl == s.min_incl && r->max_excl == s.max_excl) || |
2424 | 0 | (wuffs_base__range_ie_u64__is_empty(r) && |
2425 | 0 | wuffs_base__range_ie_u64__is_empty(&s)); |
2426 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_u64__equals Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_u64__equals(wuffs_base__range_ie_u64__struct const*, wuffs_base__range_ie_u64__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_u64__equals Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_u64__equals Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_u64__equals Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_u64__equals Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_u64__equals Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_u64__equals Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_u64__equals Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_u64__equals Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_u64__equals Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_u64__equals |
2427 | | |
2428 | | static inline wuffs_base__range_ie_u64 // |
2429 | | wuffs_base__range_ie_u64__intersect(const wuffs_base__range_ie_u64* r, |
2430 | 0 | wuffs_base__range_ie_u64 s) { |
2431 | 0 | wuffs_base__range_ie_u64 t; |
2432 | 0 | t.min_incl = wuffs_base__u64__max(r->min_incl, s.min_incl); |
2433 | 0 | t.max_excl = wuffs_base__u64__min(r->max_excl, s.max_excl); |
2434 | 0 | return t; |
2435 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_u64__intersect Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_u64__intersect(wuffs_base__range_ie_u64__struct const*, wuffs_base__range_ie_u64__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_u64__intersect Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_u64__intersect Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_u64__intersect Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_u64__intersect Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_u64__intersect Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_u64__intersect Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_u64__intersect Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_u64__intersect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_u64__intersect Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_u64__intersect |
2436 | | |
2437 | | static inline wuffs_base__range_ie_u64 // |
2438 | | wuffs_base__range_ie_u64__unite(const wuffs_base__range_ie_u64* r, |
2439 | 0 | wuffs_base__range_ie_u64 s) { |
2440 | 0 | if (wuffs_base__range_ie_u64__is_empty(r)) { |
2441 | 0 | return s; |
2442 | 0 | } |
2443 | 0 | if (wuffs_base__range_ie_u64__is_empty(&s)) { |
2444 | 0 | return *r; |
2445 | 0 | } |
2446 | 0 | wuffs_base__range_ie_u64 t; |
2447 | 0 | t.min_incl = wuffs_base__u64__min(r->min_incl, s.min_incl); |
2448 | 0 | t.max_excl = wuffs_base__u64__max(r->max_excl, s.max_excl); |
2449 | 0 | return t; |
2450 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_u64__unite Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_u64__unite(wuffs_base__range_ie_u64__struct const*, wuffs_base__range_ie_u64__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_u64__unite Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_u64__unite Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_u64__unite Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_u64__unite Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_u64__unite Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_u64__unite Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_u64__unite Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_u64__unite Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_u64__unite Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_u64__unite |
2451 | | |
2452 | | static inline bool // |
2453 | | wuffs_base__range_ie_u64__contains(const wuffs_base__range_ie_u64* r, |
2454 | 0 | uint64_t x) { |
2455 | 0 | return (r->min_incl <= x) && (x < r->max_excl); |
2456 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_u64__contains Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_u64__contains(wuffs_base__range_ie_u64__struct const*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_u64__contains Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_u64__contains Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_u64__contains Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_u64__contains Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_u64__contains Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_u64__contains Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_u64__contains Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_u64__contains Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_u64__contains Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_u64__contains |
2457 | | |
2458 | | static inline bool // |
2459 | | wuffs_base__range_ie_u64__contains_range(const wuffs_base__range_ie_u64* r, |
2460 | 0 | wuffs_base__range_ie_u64 s) { |
2461 | 0 | return wuffs_base__range_ie_u64__equals( |
2462 | 0 | &s, wuffs_base__range_ie_u64__intersect(r, s)); |
2463 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_u64__contains_range Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_u64__contains_range(wuffs_base__range_ie_u64__struct const*, wuffs_base__range_ie_u64__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_u64__contains_range Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_u64__contains_range Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_u64__contains_range Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_u64__contains_range Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_u64__contains_range Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_u64__contains_range Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_u64__contains_range Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_u64__contains_range Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_u64__contains_range Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_u64__contains_range |
2464 | | |
2465 | | static inline uint64_t // |
2466 | 0 | wuffs_base__range_ie_u64__length(const wuffs_base__range_ie_u64* r) { |
2467 | 0 | return wuffs_base__u64__sat_sub(r->max_excl, r->min_incl); |
2468 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ie_u64__length Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ie_u64__length(wuffs_base__range_ie_u64__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ie_u64__length Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ie_u64__length Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ie_u64__length Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ie_u64__length Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ie_u64__length Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ie_u64__length Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ie_u64__length Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ie_u64__length Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ie_u64__length Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ie_u64__length |
2469 | | |
2470 | | #ifdef __cplusplus |
2471 | | |
2472 | | inline bool // |
2473 | 0 | wuffs_base__range_ie_u64::is_empty() const { |
2474 | 0 | return wuffs_base__range_ie_u64__is_empty(this); |
2475 | 0 | } |
2476 | | |
2477 | | inline bool // |
2478 | 0 | wuffs_base__range_ie_u64::equals(wuffs_base__range_ie_u64 s) const { |
2479 | 0 | return wuffs_base__range_ie_u64__equals(this, s); |
2480 | 0 | } |
2481 | | |
2482 | | inline wuffs_base__range_ie_u64 // |
2483 | 0 | wuffs_base__range_ie_u64::intersect(wuffs_base__range_ie_u64 s) const { |
2484 | 0 | return wuffs_base__range_ie_u64__intersect(this, s); |
2485 | 0 | } |
2486 | | |
2487 | | inline wuffs_base__range_ie_u64 // |
2488 | 0 | wuffs_base__range_ie_u64::unite(wuffs_base__range_ie_u64 s) const { |
2489 | 0 | return wuffs_base__range_ie_u64__unite(this, s); |
2490 | 0 | } |
2491 | | |
2492 | | inline bool // |
2493 | 0 | wuffs_base__range_ie_u64::contains(uint64_t x) const { |
2494 | 0 | return wuffs_base__range_ie_u64__contains(this, x); |
2495 | 0 | } |
2496 | | |
2497 | | inline bool // |
2498 | 0 | wuffs_base__range_ie_u64::contains_range(wuffs_base__range_ie_u64 s) const { |
2499 | 0 | return wuffs_base__range_ie_u64__contains_range(this, s); |
2500 | 0 | } |
2501 | | |
2502 | | inline uint64_t // |
2503 | 0 | wuffs_base__range_ie_u64::length() const { |
2504 | 0 | return wuffs_base__range_ie_u64__length(this); |
2505 | 0 | } |
2506 | | |
2507 | | #endif // __cplusplus |
2508 | | |
2509 | | // -------- |
2510 | | |
2511 | | typedef struct wuffs_base__range_ii_u32__struct { |
2512 | | uint32_t min_incl; |
2513 | | uint32_t max_incl; |
2514 | | |
2515 | | #ifdef __cplusplus |
2516 | | inline bool is_empty() const; |
2517 | | inline bool equals(wuffs_base__range_ii_u32__struct s) const; |
2518 | | inline wuffs_base__range_ii_u32__struct intersect( |
2519 | | wuffs_base__range_ii_u32__struct s) const; |
2520 | | inline wuffs_base__range_ii_u32__struct unite( |
2521 | | wuffs_base__range_ii_u32__struct s) const; |
2522 | | inline bool contains(uint32_t x) const; |
2523 | | inline bool contains_range(wuffs_base__range_ii_u32__struct s) const; |
2524 | | #endif // __cplusplus |
2525 | | |
2526 | | } wuffs_base__range_ii_u32; |
2527 | | |
2528 | | static inline wuffs_base__range_ii_u32 // |
2529 | 0 | wuffs_base__empty_range_ii_u32(void) { |
2530 | 0 | wuffs_base__range_ii_u32 ret; |
2531 | 0 | ret.min_incl = 0; |
2532 | 0 | ret.max_incl = 0; |
2533 | 0 | return ret; |
2534 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_range_ii_u32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_range_ii_u32() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_range_ii_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_range_ii_u32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_range_ii_u32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_range_ii_u32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_range_ii_u32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_range_ii_u32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_range_ii_u32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_range_ii_u32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_range_ii_u32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_range_ii_u32 |
2535 | | |
2536 | | static inline wuffs_base__range_ii_u32 // |
2537 | 0 | wuffs_base__make_range_ii_u32(uint32_t min_incl, uint32_t max_incl) { |
2538 | 0 | wuffs_base__range_ii_u32 ret; |
2539 | 0 | ret.min_incl = min_incl; |
2540 | 0 | ret.max_incl = max_incl; |
2541 | 0 | return ret; |
2542 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_range_ii_u32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_range_ii_u32(unsigned int, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_range_ii_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_range_ii_u32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_range_ii_u32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_range_ii_u32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_range_ii_u32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_range_ii_u32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_range_ii_u32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_range_ii_u32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_range_ii_u32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_range_ii_u32 |
2543 | | |
2544 | | static inline bool // |
2545 | 0 | wuffs_base__range_ii_u32__is_empty(const wuffs_base__range_ii_u32* r) { |
2546 | 0 | return r->min_incl > r->max_incl; |
2547 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ii_u32__is_empty Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ii_u32__is_empty(wuffs_base__range_ii_u32__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ii_u32__is_empty Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ii_u32__is_empty Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ii_u32__is_empty Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ii_u32__is_empty Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ii_u32__is_empty Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ii_u32__is_empty Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ii_u32__is_empty Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ii_u32__is_empty Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ii_u32__is_empty Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ii_u32__is_empty |
2548 | | |
2549 | | static inline bool // |
2550 | | wuffs_base__range_ii_u32__equals(const wuffs_base__range_ii_u32* r, |
2551 | 0 | wuffs_base__range_ii_u32 s) { |
2552 | 0 | return (r->min_incl == s.min_incl && r->max_incl == s.max_incl) || |
2553 | 0 | (wuffs_base__range_ii_u32__is_empty(r) && |
2554 | 0 | wuffs_base__range_ii_u32__is_empty(&s)); |
2555 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ii_u32__equals Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ii_u32__equals(wuffs_base__range_ii_u32__struct const*, wuffs_base__range_ii_u32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ii_u32__equals Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ii_u32__equals Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ii_u32__equals Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ii_u32__equals Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ii_u32__equals Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ii_u32__equals Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ii_u32__equals Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ii_u32__equals Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ii_u32__equals Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ii_u32__equals |
2556 | | |
2557 | | static inline wuffs_base__range_ii_u32 // |
2558 | | wuffs_base__range_ii_u32__intersect(const wuffs_base__range_ii_u32* r, |
2559 | 0 | wuffs_base__range_ii_u32 s) { |
2560 | 0 | wuffs_base__range_ii_u32 t; |
2561 | 0 | t.min_incl = wuffs_base__u32__max(r->min_incl, s.min_incl); |
2562 | 0 | t.max_incl = wuffs_base__u32__min(r->max_incl, s.max_incl); |
2563 | 0 | return t; |
2564 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ii_u32__intersect Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ii_u32__intersect(wuffs_base__range_ii_u32__struct const*, wuffs_base__range_ii_u32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ii_u32__intersect Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ii_u32__intersect Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ii_u32__intersect Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ii_u32__intersect Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ii_u32__intersect Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ii_u32__intersect Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ii_u32__intersect Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ii_u32__intersect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ii_u32__intersect Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ii_u32__intersect |
2565 | | |
2566 | | static inline wuffs_base__range_ii_u32 // |
2567 | | wuffs_base__range_ii_u32__unite(const wuffs_base__range_ii_u32* r, |
2568 | 0 | wuffs_base__range_ii_u32 s) { |
2569 | 0 | if (wuffs_base__range_ii_u32__is_empty(r)) { |
2570 | 0 | return s; |
2571 | 0 | } |
2572 | 0 | if (wuffs_base__range_ii_u32__is_empty(&s)) { |
2573 | 0 | return *r; |
2574 | 0 | } |
2575 | 0 | wuffs_base__range_ii_u32 t; |
2576 | 0 | t.min_incl = wuffs_base__u32__min(r->min_incl, s.min_incl); |
2577 | 0 | t.max_incl = wuffs_base__u32__max(r->max_incl, s.max_incl); |
2578 | 0 | return t; |
2579 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ii_u32__unite Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ii_u32__unite(wuffs_base__range_ii_u32__struct const*, wuffs_base__range_ii_u32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ii_u32__unite Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ii_u32__unite Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ii_u32__unite Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ii_u32__unite Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ii_u32__unite Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ii_u32__unite Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ii_u32__unite Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ii_u32__unite Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ii_u32__unite Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ii_u32__unite |
2580 | | |
2581 | | static inline bool // |
2582 | | wuffs_base__range_ii_u32__contains(const wuffs_base__range_ii_u32* r, |
2583 | 0 | uint32_t x) { |
2584 | 0 | return (r->min_incl <= x) && (x <= r->max_incl); |
2585 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ii_u32__contains Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ii_u32__contains(wuffs_base__range_ii_u32__struct const*, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ii_u32__contains Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ii_u32__contains Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ii_u32__contains Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ii_u32__contains Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ii_u32__contains Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ii_u32__contains Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ii_u32__contains Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ii_u32__contains Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ii_u32__contains Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ii_u32__contains |
2586 | | |
2587 | | static inline bool // |
2588 | | wuffs_base__range_ii_u32__contains_range(const wuffs_base__range_ii_u32* r, |
2589 | 0 | wuffs_base__range_ii_u32 s) { |
2590 | 0 | return wuffs_base__range_ii_u32__equals( |
2591 | 0 | &s, wuffs_base__range_ii_u32__intersect(r, s)); |
2592 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ii_u32__contains_range Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ii_u32__contains_range(wuffs_base__range_ii_u32__struct const*, wuffs_base__range_ii_u32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ii_u32__contains_range Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ii_u32__contains_range Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ii_u32__contains_range Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ii_u32__contains_range Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ii_u32__contains_range Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ii_u32__contains_range Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ii_u32__contains_range Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ii_u32__contains_range Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ii_u32__contains_range Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ii_u32__contains_range |
2593 | | |
2594 | | #ifdef __cplusplus |
2595 | | |
2596 | | inline bool // |
2597 | 0 | wuffs_base__range_ii_u32::is_empty() const { |
2598 | 0 | return wuffs_base__range_ii_u32__is_empty(this); |
2599 | 0 | } |
2600 | | |
2601 | | inline bool // |
2602 | 0 | wuffs_base__range_ii_u32::equals(wuffs_base__range_ii_u32 s) const { |
2603 | 0 | return wuffs_base__range_ii_u32__equals(this, s); |
2604 | 0 | } |
2605 | | |
2606 | | inline wuffs_base__range_ii_u32 // |
2607 | 0 | wuffs_base__range_ii_u32::intersect(wuffs_base__range_ii_u32 s) const { |
2608 | 0 | return wuffs_base__range_ii_u32__intersect(this, s); |
2609 | 0 | } |
2610 | | |
2611 | | inline wuffs_base__range_ii_u32 // |
2612 | 0 | wuffs_base__range_ii_u32::unite(wuffs_base__range_ii_u32 s) const { |
2613 | 0 | return wuffs_base__range_ii_u32__unite(this, s); |
2614 | 0 | } |
2615 | | |
2616 | | inline bool // |
2617 | 0 | wuffs_base__range_ii_u32::contains(uint32_t x) const { |
2618 | 0 | return wuffs_base__range_ii_u32__contains(this, x); |
2619 | 0 | } |
2620 | | |
2621 | | inline bool // |
2622 | 0 | wuffs_base__range_ii_u32::contains_range(wuffs_base__range_ii_u32 s) const { |
2623 | 0 | return wuffs_base__range_ii_u32__contains_range(this, s); |
2624 | 0 | } |
2625 | | |
2626 | | #endif // __cplusplus |
2627 | | |
2628 | | // -------- |
2629 | | |
2630 | | typedef struct wuffs_base__range_ii_u64__struct { |
2631 | | uint64_t min_incl; |
2632 | | uint64_t max_incl; |
2633 | | |
2634 | | #ifdef __cplusplus |
2635 | | inline bool is_empty() const; |
2636 | | inline bool equals(wuffs_base__range_ii_u64__struct s) const; |
2637 | | inline wuffs_base__range_ii_u64__struct intersect( |
2638 | | wuffs_base__range_ii_u64__struct s) const; |
2639 | | inline wuffs_base__range_ii_u64__struct unite( |
2640 | | wuffs_base__range_ii_u64__struct s) const; |
2641 | | inline bool contains(uint64_t x) const; |
2642 | | inline bool contains_range(wuffs_base__range_ii_u64__struct s) const; |
2643 | | #endif // __cplusplus |
2644 | | |
2645 | | } wuffs_base__range_ii_u64; |
2646 | | |
2647 | | static inline wuffs_base__range_ii_u64 // |
2648 | 0 | wuffs_base__empty_range_ii_u64(void) { |
2649 | 0 | wuffs_base__range_ii_u64 ret; |
2650 | 0 | ret.min_incl = 0; |
2651 | 0 | ret.max_incl = 0; |
2652 | 0 | return ret; |
2653 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_range_ii_u64 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_range_ii_u64() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_range_ii_u64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_range_ii_u64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_range_ii_u64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_range_ii_u64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_range_ii_u64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_range_ii_u64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_range_ii_u64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_range_ii_u64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_range_ii_u64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_range_ii_u64 |
2654 | | |
2655 | | static inline wuffs_base__range_ii_u64 // |
2656 | 17.5k | wuffs_base__make_range_ii_u64(uint64_t min_incl, uint64_t max_incl) { |
2657 | 17.5k | wuffs_base__range_ii_u64 ret; |
2658 | 17.5k | ret.min_incl = min_incl; |
2659 | 17.5k | ret.max_incl = max_incl; |
2660 | 17.5k | return ret; |
2661 | 17.5k | } png_fuzzer.c:wuffs_base__make_range_ii_u64 Line | Count | Source | 2656 | 4.31k | wuffs_base__make_range_ii_u64(uint64_t min_incl, uint64_t max_incl) { | 2657 | 4.31k | wuffs_base__range_ii_u64 ret; | 2658 | 4.31k | ret.min_incl = min_incl; | 2659 | 4.31k | ret.max_incl = max_incl; | 2660 | 4.31k | return ret; | 2661 | 4.31k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_range_ii_u64(unsigned long, unsigned long) gif_fuzzer.c:wuffs_base__make_range_ii_u64 Line | Count | Source | 2656 | 1.64k | wuffs_base__make_range_ii_u64(uint64_t min_incl, uint64_t max_incl) { | 2657 | 1.64k | wuffs_base__range_ii_u64 ret; | 2658 | 1.64k | ret.min_incl = min_incl; | 2659 | 1.64k | ret.max_incl = max_incl; | 2660 | 1.64k | return ret; | 2661 | 1.64k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_range_ii_u64 jpeg_fuzzer.c:wuffs_base__make_range_ii_u64 Line | Count | Source | 2656 | 2.87k | wuffs_base__make_range_ii_u64(uint64_t min_incl, uint64_t max_incl) { | 2657 | 2.87k | wuffs_base__range_ii_u64 ret; | 2658 | 2.87k | ret.min_incl = min_incl; | 2659 | 2.87k | ret.max_incl = max_incl; | 2660 | 2.87k | return ret; | 2661 | 2.87k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_range_ii_u64 bmp_fuzzer.c:wuffs_base__make_range_ii_u64 Line | Count | Source | 2656 | 1.75k | wuffs_base__make_range_ii_u64(uint64_t min_incl, uint64_t max_incl) { | 2657 | 1.75k | wuffs_base__range_ii_u64 ret; | 2658 | 1.75k | ret.min_incl = min_incl; | 2659 | 1.75k | ret.max_incl = max_incl; | 2660 | 1.75k | return ret; | 2661 | 1.75k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_range_ii_u64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_range_ii_u64 targa_fuzzer.c:wuffs_base__make_range_ii_u64 Line | Count | Source | 2656 | 918 | wuffs_base__make_range_ii_u64(uint64_t min_incl, uint64_t max_incl) { | 2657 | 918 | wuffs_base__range_ii_u64 ret; | 2658 | 918 | ret.min_incl = min_incl; | 2659 | 918 | ret.max_incl = max_incl; | 2660 | 918 | return ret; | 2661 | 918 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_range_ii_u64 webp_fuzzer.c:wuffs_base__make_range_ii_u64 Line | Count | Source | 2656 | 6.04k | wuffs_base__make_range_ii_u64(uint64_t min_incl, uint64_t max_incl) { | 2657 | 6.04k | wuffs_base__range_ii_u64 ret; | 2658 | 6.04k | ret.min_incl = min_incl; | 2659 | 6.04k | ret.max_incl = max_incl; | 2660 | 6.04k | return ret; | 2661 | 6.04k | } |
|
2662 | | |
2663 | | static inline bool // |
2664 | 870 | wuffs_base__range_ii_u64__is_empty(const wuffs_base__range_ii_u64* r) { |
2665 | 870 | return r->min_incl > r->max_incl; |
2666 | 870 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ii_u64__is_empty Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ii_u64__is_empty(wuffs_base__range_ii_u64__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ii_u64__is_empty Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ii_u64__is_empty Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ii_u64__is_empty Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ii_u64__is_empty Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ii_u64__is_empty Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ii_u64__is_empty Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ii_u64__is_empty Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ii_u64__is_empty Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ii_u64__is_empty webp_fuzzer.c:wuffs_base__range_ii_u64__is_empty Line | Count | Source | 2664 | 870 | wuffs_base__range_ii_u64__is_empty(const wuffs_base__range_ii_u64* r) { | 2665 | 870 | return r->min_incl > r->max_incl; | 2666 | 870 | } |
|
2667 | | |
2668 | | static inline bool // |
2669 | | wuffs_base__range_ii_u64__equals(const wuffs_base__range_ii_u64* r, |
2670 | 0 | wuffs_base__range_ii_u64 s) { |
2671 | 0 | return (r->min_incl == s.min_incl && r->max_incl == s.max_incl) || |
2672 | 0 | (wuffs_base__range_ii_u64__is_empty(r) && |
2673 | 0 | wuffs_base__range_ii_u64__is_empty(&s)); |
2674 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ii_u64__equals Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ii_u64__equals(wuffs_base__range_ii_u64__struct const*, wuffs_base__range_ii_u64__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ii_u64__equals Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ii_u64__equals Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ii_u64__equals Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ii_u64__equals Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ii_u64__equals Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ii_u64__equals Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ii_u64__equals Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ii_u64__equals Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ii_u64__equals Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ii_u64__equals |
2675 | | |
2676 | | static inline wuffs_base__range_ii_u64 // |
2677 | | wuffs_base__range_ii_u64__intersect(const wuffs_base__range_ii_u64* r, |
2678 | 0 | wuffs_base__range_ii_u64 s) { |
2679 | 0 | wuffs_base__range_ii_u64 t; |
2680 | 0 | t.min_incl = wuffs_base__u64__max(r->min_incl, s.min_incl); |
2681 | 0 | t.max_incl = wuffs_base__u64__min(r->max_incl, s.max_incl); |
2682 | 0 | return t; |
2683 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ii_u64__intersect Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ii_u64__intersect(wuffs_base__range_ii_u64__struct const*, wuffs_base__range_ii_u64__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ii_u64__intersect Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ii_u64__intersect Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ii_u64__intersect Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ii_u64__intersect Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ii_u64__intersect Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ii_u64__intersect Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ii_u64__intersect Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ii_u64__intersect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ii_u64__intersect Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ii_u64__intersect |
2684 | | |
2685 | | static inline wuffs_base__range_ii_u64 // |
2686 | | wuffs_base__range_ii_u64__unite(const wuffs_base__range_ii_u64* r, |
2687 | 0 | wuffs_base__range_ii_u64 s) { |
2688 | 0 | if (wuffs_base__range_ii_u64__is_empty(r)) { |
2689 | 0 | return s; |
2690 | 0 | } |
2691 | 0 | if (wuffs_base__range_ii_u64__is_empty(&s)) { |
2692 | 0 | return *r; |
2693 | 0 | } |
2694 | 0 | wuffs_base__range_ii_u64 t; |
2695 | 0 | t.min_incl = wuffs_base__u64__min(r->min_incl, s.min_incl); |
2696 | 0 | t.max_incl = wuffs_base__u64__max(r->max_incl, s.max_incl); |
2697 | 0 | return t; |
2698 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ii_u64__unite Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ii_u64__unite(wuffs_base__range_ii_u64__struct const*, wuffs_base__range_ii_u64__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ii_u64__unite Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ii_u64__unite Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ii_u64__unite Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ii_u64__unite Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ii_u64__unite Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ii_u64__unite Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ii_u64__unite Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ii_u64__unite Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ii_u64__unite Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ii_u64__unite |
2699 | | |
2700 | | static inline bool // |
2701 | | wuffs_base__range_ii_u64__contains(const wuffs_base__range_ii_u64* r, |
2702 | 0 | uint64_t x) { |
2703 | 0 | return (r->min_incl <= x) && (x <= r->max_incl); |
2704 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ii_u64__contains Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ii_u64__contains(wuffs_base__range_ii_u64__struct const*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ii_u64__contains Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ii_u64__contains Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ii_u64__contains Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ii_u64__contains Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ii_u64__contains Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ii_u64__contains Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ii_u64__contains Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ii_u64__contains Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ii_u64__contains Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ii_u64__contains |
2705 | | |
2706 | | static inline bool // |
2707 | | wuffs_base__range_ii_u64__contains_range(const wuffs_base__range_ii_u64* r, |
2708 | 0 | wuffs_base__range_ii_u64 s) { |
2709 | 0 | return wuffs_base__range_ii_u64__equals( |
2710 | 0 | &s, wuffs_base__range_ii_u64__intersect(r, s)); |
2711 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__range_ii_u64__contains_range Unexecuted instantiation: json_fuzzer.cc:wuffs_base__range_ii_u64__contains_range(wuffs_base__range_ii_u64__struct const*, wuffs_base__range_ii_u64__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__range_ii_u64__contains_range Unexecuted instantiation: xz_fuzzer.c:wuffs_base__range_ii_u64__contains_range Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__range_ii_u64__contains_range Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__range_ii_u64__contains_range Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__range_ii_u64__contains_range Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__range_ii_u64__contains_range Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__range_ii_u64__contains_range Unexecuted instantiation: targa_fuzzer.c:wuffs_base__range_ii_u64__contains_range Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__range_ii_u64__contains_range Unexecuted instantiation: webp_fuzzer.c:wuffs_base__range_ii_u64__contains_range |
2712 | | |
2713 | | #ifdef __cplusplus |
2714 | | |
2715 | | inline bool // |
2716 | 0 | wuffs_base__range_ii_u64::is_empty() const { |
2717 | 0 | return wuffs_base__range_ii_u64__is_empty(this); |
2718 | 0 | } |
2719 | | |
2720 | | inline bool // |
2721 | 0 | wuffs_base__range_ii_u64::equals(wuffs_base__range_ii_u64 s) const { |
2722 | 0 | return wuffs_base__range_ii_u64__equals(this, s); |
2723 | 0 | } |
2724 | | |
2725 | | inline wuffs_base__range_ii_u64 // |
2726 | 0 | wuffs_base__range_ii_u64::intersect(wuffs_base__range_ii_u64 s) const { |
2727 | 0 | return wuffs_base__range_ii_u64__intersect(this, s); |
2728 | 0 | } |
2729 | | |
2730 | | inline wuffs_base__range_ii_u64 // |
2731 | 0 | wuffs_base__range_ii_u64::unite(wuffs_base__range_ii_u64 s) const { |
2732 | 0 | return wuffs_base__range_ii_u64__unite(this, s); |
2733 | 0 | } |
2734 | | |
2735 | | inline bool // |
2736 | 0 | wuffs_base__range_ii_u64::contains(uint64_t x) const { |
2737 | 0 | return wuffs_base__range_ii_u64__contains(this, x); |
2738 | 0 | } |
2739 | | |
2740 | | inline bool // |
2741 | 0 | wuffs_base__range_ii_u64::contains_range(wuffs_base__range_ii_u64 s) const { |
2742 | 0 | return wuffs_base__range_ii_u64__contains_range(this, s); |
2743 | 0 | } |
2744 | | |
2745 | | #endif // __cplusplus |
2746 | | |
2747 | | // -------- |
2748 | | |
2749 | | typedef struct wuffs_base__rect_ie_i32__struct { |
2750 | | int32_t min_incl_x; |
2751 | | int32_t min_incl_y; |
2752 | | int32_t max_excl_x; |
2753 | | int32_t max_excl_y; |
2754 | | |
2755 | | #ifdef __cplusplus |
2756 | | inline bool is_empty() const; |
2757 | | inline bool equals(wuffs_base__rect_ie_i32__struct s) const; |
2758 | | inline wuffs_base__rect_ie_i32__struct intersect( |
2759 | | wuffs_base__rect_ie_i32__struct s) const; |
2760 | | inline wuffs_base__rect_ie_i32__struct unite( |
2761 | | wuffs_base__rect_ie_i32__struct s) const; |
2762 | | inline bool contains(int32_t x, int32_t y) const; |
2763 | | inline bool contains_rect(wuffs_base__rect_ie_i32__struct s) const; |
2764 | | inline uint32_t width() const; |
2765 | | inline uint32_t height() const; |
2766 | | #endif // __cplusplus |
2767 | | |
2768 | | } wuffs_base__rect_ie_i32; |
2769 | | |
2770 | | static inline wuffs_base__rect_ie_i32 // |
2771 | 0 | wuffs_base__empty_rect_ie_i32(void) { |
2772 | 0 | wuffs_base__rect_ie_i32 ret; |
2773 | 0 | ret.min_incl_x = 0; |
2774 | 0 | ret.min_incl_y = 0; |
2775 | 0 | ret.max_excl_x = 0; |
2776 | 0 | ret.max_excl_y = 0; |
2777 | 0 | return ret; |
2778 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_rect_ie_i32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_rect_ie_i32() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_rect_ie_i32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_rect_ie_i32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_rect_ie_i32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_rect_ie_i32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_rect_ie_i32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_rect_ie_i32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_rect_ie_i32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_rect_ie_i32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_rect_ie_i32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_rect_ie_i32 |
2779 | | |
2780 | | static inline wuffs_base__rect_ie_i32 // |
2781 | | wuffs_base__make_rect_ie_i32(int32_t min_incl_x, |
2782 | | int32_t min_incl_y, |
2783 | | int32_t max_excl_x, |
2784 | 0 | int32_t max_excl_y) { |
2785 | 0 | wuffs_base__rect_ie_i32 ret; |
2786 | 0 | ret.min_incl_x = min_incl_x; |
2787 | 0 | ret.min_incl_y = min_incl_y; |
2788 | 0 | ret.max_excl_x = max_excl_x; |
2789 | 0 | ret.max_excl_y = max_excl_y; |
2790 | 0 | return ret; |
2791 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_rect_ie_i32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_rect_ie_i32(int, int, int, int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_rect_ie_i32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_rect_ie_i32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_rect_ie_i32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_rect_ie_i32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_rect_ie_i32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_rect_ie_i32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_rect_ie_i32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_rect_ie_i32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_rect_ie_i32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_rect_ie_i32 |
2792 | | |
2793 | | static inline bool // |
2794 | 0 | wuffs_base__rect_ie_i32__is_empty(const wuffs_base__rect_ie_i32* r) { |
2795 | 0 | return (r->min_incl_x >= r->max_excl_x) || (r->min_incl_y >= r->max_excl_y); |
2796 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ie_i32__is_empty Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ie_i32__is_empty(wuffs_base__rect_ie_i32__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ie_i32__is_empty Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ie_i32__is_empty Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ie_i32__is_empty Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ie_i32__is_empty Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ie_i32__is_empty Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ie_i32__is_empty Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ie_i32__is_empty Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ie_i32__is_empty Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ie_i32__is_empty Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ie_i32__is_empty |
2797 | | |
2798 | | static inline bool // |
2799 | | wuffs_base__rect_ie_i32__equals(const wuffs_base__rect_ie_i32* r, |
2800 | 0 | wuffs_base__rect_ie_i32 s) { |
2801 | 0 | return (r->min_incl_x == s.min_incl_x && r->min_incl_y == s.min_incl_y && |
2802 | 0 | r->max_excl_x == s.max_excl_x && r->max_excl_y == s.max_excl_y) || |
2803 | 0 | (wuffs_base__rect_ie_i32__is_empty(r) && |
2804 | 0 | wuffs_base__rect_ie_i32__is_empty(&s)); |
2805 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ie_i32__equals Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ie_i32__equals(wuffs_base__rect_ie_i32__struct const*, wuffs_base__rect_ie_i32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ie_i32__equals Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ie_i32__equals Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ie_i32__equals Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ie_i32__equals Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ie_i32__equals Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ie_i32__equals Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ie_i32__equals Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ie_i32__equals Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ie_i32__equals Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ie_i32__equals |
2806 | | |
2807 | | static inline wuffs_base__rect_ie_i32 // |
2808 | | wuffs_base__rect_ie_i32__intersect(const wuffs_base__rect_ie_i32* r, |
2809 | 0 | wuffs_base__rect_ie_i32 s) { |
2810 | 0 | wuffs_base__rect_ie_i32 t; |
2811 | 0 | t.min_incl_x = wuffs_base__i32__max(r->min_incl_x, s.min_incl_x); |
2812 | 0 | t.min_incl_y = wuffs_base__i32__max(r->min_incl_y, s.min_incl_y); |
2813 | 0 | t.max_excl_x = wuffs_base__i32__min(r->max_excl_x, s.max_excl_x); |
2814 | 0 | t.max_excl_y = wuffs_base__i32__min(r->max_excl_y, s.max_excl_y); |
2815 | 0 | return t; |
2816 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ie_i32__intersect Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ie_i32__intersect(wuffs_base__rect_ie_i32__struct const*, wuffs_base__rect_ie_i32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ie_i32__intersect Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ie_i32__intersect Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ie_i32__intersect Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ie_i32__intersect Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ie_i32__intersect Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ie_i32__intersect Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ie_i32__intersect Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ie_i32__intersect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ie_i32__intersect Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ie_i32__intersect |
2817 | | |
2818 | | static inline wuffs_base__rect_ie_i32 // |
2819 | | wuffs_base__rect_ie_i32__unite(const wuffs_base__rect_ie_i32* r, |
2820 | 0 | wuffs_base__rect_ie_i32 s) { |
2821 | 0 | if (wuffs_base__rect_ie_i32__is_empty(r)) { |
2822 | 0 | return s; |
2823 | 0 | } |
2824 | 0 | if (wuffs_base__rect_ie_i32__is_empty(&s)) { |
2825 | 0 | return *r; |
2826 | 0 | } |
2827 | 0 | wuffs_base__rect_ie_i32 t; |
2828 | 0 | t.min_incl_x = wuffs_base__i32__min(r->min_incl_x, s.min_incl_x); |
2829 | 0 | t.min_incl_y = wuffs_base__i32__min(r->min_incl_y, s.min_incl_y); |
2830 | 0 | t.max_excl_x = wuffs_base__i32__max(r->max_excl_x, s.max_excl_x); |
2831 | 0 | t.max_excl_y = wuffs_base__i32__max(r->max_excl_y, s.max_excl_y); |
2832 | 0 | return t; |
2833 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ie_i32__unite Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ie_i32__unite(wuffs_base__rect_ie_i32__struct const*, wuffs_base__rect_ie_i32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ie_i32__unite Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ie_i32__unite Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ie_i32__unite Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ie_i32__unite Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ie_i32__unite Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ie_i32__unite Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ie_i32__unite Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ie_i32__unite Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ie_i32__unite Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ie_i32__unite |
2834 | | |
2835 | | static inline bool // |
2836 | | wuffs_base__rect_ie_i32__contains(const wuffs_base__rect_ie_i32* r, |
2837 | | int32_t x, |
2838 | 0 | int32_t y) { |
2839 | 0 | return (r->min_incl_x <= x) && (x < r->max_excl_x) && (r->min_incl_y <= y) && |
2840 | 0 | (y < r->max_excl_y); |
2841 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ie_i32__contains Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ie_i32__contains(wuffs_base__rect_ie_i32__struct const*, int, int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ie_i32__contains Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ie_i32__contains Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ie_i32__contains Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ie_i32__contains Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ie_i32__contains Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ie_i32__contains Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ie_i32__contains Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ie_i32__contains Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ie_i32__contains Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ie_i32__contains |
2842 | | |
2843 | | static inline bool // |
2844 | | wuffs_base__rect_ie_i32__contains_rect(const wuffs_base__rect_ie_i32* r, |
2845 | 0 | wuffs_base__rect_ie_i32 s) { |
2846 | 0 | return wuffs_base__rect_ie_i32__equals( |
2847 | 0 | &s, wuffs_base__rect_ie_i32__intersect(r, s)); |
2848 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ie_i32__contains_rect Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ie_i32__contains_rect(wuffs_base__rect_ie_i32__struct const*, wuffs_base__rect_ie_i32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ie_i32__contains_rect Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ie_i32__contains_rect Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ie_i32__contains_rect Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ie_i32__contains_rect Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ie_i32__contains_rect Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ie_i32__contains_rect Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ie_i32__contains_rect Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ie_i32__contains_rect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ie_i32__contains_rect Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ie_i32__contains_rect |
2849 | | |
2850 | | static inline uint32_t // |
2851 | 0 | wuffs_base__rect_ie_i32__width(const wuffs_base__rect_ie_i32* r) { |
2852 | 0 | return (r->max_excl_x > r->min_incl_x) |
2853 | 0 | ? (((uint32_t)(r->max_excl_x)) - ((uint32_t)(r->min_incl_x))) |
2854 | 0 | : 0; |
2855 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ie_i32__width Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ie_i32__width(wuffs_base__rect_ie_i32__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ie_i32__width Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ie_i32__width Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ie_i32__width Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ie_i32__width Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ie_i32__width Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ie_i32__width Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ie_i32__width Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ie_i32__width Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ie_i32__width Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ie_i32__width |
2856 | | |
2857 | | static inline uint32_t // |
2858 | 0 | wuffs_base__rect_ie_i32__height(const wuffs_base__rect_ie_i32* r) { |
2859 | 0 | return (r->max_excl_y > r->min_incl_y) |
2860 | 0 | ? (((uint32_t)(r->max_excl_y)) - ((uint32_t)(r->min_incl_y))) |
2861 | 0 | : 0; |
2862 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ie_i32__height Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ie_i32__height(wuffs_base__rect_ie_i32__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ie_i32__height Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ie_i32__height Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ie_i32__height Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ie_i32__height Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ie_i32__height Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ie_i32__height Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ie_i32__height Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ie_i32__height Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ie_i32__height Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ie_i32__height |
2863 | | |
2864 | | #ifdef __cplusplus |
2865 | | |
2866 | | inline bool // |
2867 | 0 | wuffs_base__rect_ie_i32::is_empty() const { |
2868 | 0 | return wuffs_base__rect_ie_i32__is_empty(this); |
2869 | 0 | } |
2870 | | |
2871 | | inline bool // |
2872 | 0 | wuffs_base__rect_ie_i32::equals(wuffs_base__rect_ie_i32 s) const { |
2873 | 0 | return wuffs_base__rect_ie_i32__equals(this, s); |
2874 | 0 | } |
2875 | | |
2876 | | inline wuffs_base__rect_ie_i32 // |
2877 | 0 | wuffs_base__rect_ie_i32::intersect(wuffs_base__rect_ie_i32 s) const { |
2878 | 0 | return wuffs_base__rect_ie_i32__intersect(this, s); |
2879 | 0 | } |
2880 | | |
2881 | | inline wuffs_base__rect_ie_i32 // |
2882 | 0 | wuffs_base__rect_ie_i32::unite(wuffs_base__rect_ie_i32 s) const { |
2883 | 0 | return wuffs_base__rect_ie_i32__unite(this, s); |
2884 | 0 | } |
2885 | | |
2886 | | inline bool // |
2887 | 0 | wuffs_base__rect_ie_i32::contains(int32_t x, int32_t y) const { |
2888 | 0 | return wuffs_base__rect_ie_i32__contains(this, x, y); |
2889 | 0 | } |
2890 | | |
2891 | | inline bool // |
2892 | 0 | wuffs_base__rect_ie_i32::contains_rect(wuffs_base__rect_ie_i32 s) const { |
2893 | 0 | return wuffs_base__rect_ie_i32__contains_rect(this, s); |
2894 | 0 | } |
2895 | | |
2896 | | inline uint32_t // |
2897 | 0 | wuffs_base__rect_ie_i32::width() const { |
2898 | 0 | return wuffs_base__rect_ie_i32__width(this); |
2899 | 0 | } |
2900 | | |
2901 | | inline uint32_t // |
2902 | 0 | wuffs_base__rect_ie_i32::height() const { |
2903 | 0 | return wuffs_base__rect_ie_i32__height(this); |
2904 | 0 | } |
2905 | | |
2906 | | #endif // __cplusplus |
2907 | | |
2908 | | // -------- |
2909 | | |
2910 | | typedef struct wuffs_base__rect_ie_u32__struct { |
2911 | | uint32_t min_incl_x; |
2912 | | uint32_t min_incl_y; |
2913 | | uint32_t max_excl_x; |
2914 | | uint32_t max_excl_y; |
2915 | | |
2916 | | #ifdef __cplusplus |
2917 | | inline bool is_empty() const; |
2918 | | inline bool equals(wuffs_base__rect_ie_u32__struct s) const; |
2919 | | inline wuffs_base__rect_ie_u32__struct intersect( |
2920 | | wuffs_base__rect_ie_u32__struct s) const; |
2921 | | inline wuffs_base__rect_ie_u32__struct unite( |
2922 | | wuffs_base__rect_ie_u32__struct s) const; |
2923 | | inline bool contains(uint32_t x, uint32_t y) const; |
2924 | | inline bool contains_rect(wuffs_base__rect_ie_u32__struct s) const; |
2925 | | inline uint32_t width() const; |
2926 | | inline uint32_t height() const; |
2927 | | #endif // __cplusplus |
2928 | | |
2929 | | } wuffs_base__rect_ie_u32; |
2930 | | |
2931 | | static inline wuffs_base__rect_ie_u32 // |
2932 | 0 | wuffs_base__empty_rect_ie_u32(void) { |
2933 | 0 | wuffs_base__rect_ie_u32 ret; |
2934 | 0 | ret.min_incl_x = 0; |
2935 | 0 | ret.min_incl_y = 0; |
2936 | 0 | ret.max_excl_x = 0; |
2937 | 0 | ret.max_excl_y = 0; |
2938 | 0 | return ret; |
2939 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_rect_ie_u32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_rect_ie_u32() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_rect_ie_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_rect_ie_u32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_rect_ie_u32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_rect_ie_u32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_rect_ie_u32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_rect_ie_u32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_rect_ie_u32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_rect_ie_u32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_rect_ie_u32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_rect_ie_u32 |
2940 | | |
2941 | | static inline wuffs_base__rect_ie_u32 // |
2942 | | wuffs_base__make_rect_ie_u32(uint32_t min_incl_x, |
2943 | | uint32_t min_incl_y, |
2944 | | uint32_t max_excl_x, |
2945 | 551k | uint32_t max_excl_y) { |
2946 | 551k | wuffs_base__rect_ie_u32 ret; |
2947 | 551k | ret.min_incl_x = min_incl_x; |
2948 | 551k | ret.min_incl_y = min_incl_y; |
2949 | 551k | ret.max_excl_x = max_excl_x; |
2950 | 551k | ret.max_excl_y = max_excl_y; |
2951 | 551k | return ret; |
2952 | 551k | } png_fuzzer.c:wuffs_base__make_rect_ie_u32 Line | Count | Source | 2945 | 12.9k | uint32_t max_excl_y) { | 2946 | 12.9k | wuffs_base__rect_ie_u32 ret; | 2947 | 12.9k | ret.min_incl_x = min_incl_x; | 2948 | 12.9k | ret.min_incl_y = min_incl_y; | 2949 | 12.9k | ret.max_excl_x = max_excl_x; | 2950 | 12.9k | ret.max_excl_y = max_excl_y; | 2951 | 12.9k | return ret; | 2952 | 12.9k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_rect_ie_u32(unsigned int, unsigned int, unsigned int, unsigned int) gif_fuzzer.c:wuffs_base__make_rect_ie_u32 Line | Count | Source | 2945 | 519k | uint32_t max_excl_y) { | 2946 | 519k | wuffs_base__rect_ie_u32 ret; | 2947 | 519k | ret.min_incl_x = min_incl_x; | 2948 | 519k | ret.min_incl_y = min_incl_y; | 2949 | 519k | ret.max_excl_x = max_excl_x; | 2950 | 519k | ret.max_excl_y = max_excl_y; | 2951 | 519k | return ret; | 2952 | 519k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_rect_ie_u32 jpeg_fuzzer.c:wuffs_base__make_rect_ie_u32 Line | Count | Source | 2945 | 5.70k | uint32_t max_excl_y) { | 2946 | 5.70k | wuffs_base__rect_ie_u32 ret; | 2947 | 5.70k | ret.min_incl_x = min_incl_x; | 2948 | 5.70k | ret.min_incl_y = min_incl_y; | 2949 | 5.70k | ret.max_excl_x = max_excl_x; | 2950 | 5.70k | ret.max_excl_y = max_excl_y; | 2951 | 5.70k | return ret; | 2952 | 5.70k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_rect_ie_u32 bmp_fuzzer.c:wuffs_base__make_rect_ie_u32 Line | Count | Source | 2945 | 3.44k | uint32_t max_excl_y) { | 2946 | 3.44k | wuffs_base__rect_ie_u32 ret; | 2947 | 3.44k | ret.min_incl_x = min_incl_x; | 2948 | 3.44k | ret.min_incl_y = min_incl_y; | 2949 | 3.44k | ret.max_excl_x = max_excl_x; | 2950 | 3.44k | ret.max_excl_y = max_excl_y; | 2951 | 3.44k | return ret; | 2952 | 3.44k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_rect_ie_u32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_rect_ie_u32 targa_fuzzer.c:wuffs_base__make_rect_ie_u32 Line | Count | Source | 2945 | 1.78k | uint32_t max_excl_y) { | 2946 | 1.78k | wuffs_base__rect_ie_u32 ret; | 2947 | 1.78k | ret.min_incl_x = min_incl_x; | 2948 | 1.78k | ret.min_incl_y = min_incl_y; | 2949 | 1.78k | ret.max_excl_x = max_excl_x; | 2950 | 1.78k | ret.max_excl_y = max_excl_y; | 2951 | 1.78k | return ret; | 2952 | 1.78k | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_rect_ie_u32 webp_fuzzer.c:wuffs_base__make_rect_ie_u32 Line | Count | Source | 2945 | 8.46k | uint32_t max_excl_y) { | 2946 | 8.46k | wuffs_base__rect_ie_u32 ret; | 2947 | 8.46k | ret.min_incl_x = min_incl_x; | 2948 | 8.46k | ret.min_incl_y = min_incl_y; | 2949 | 8.46k | ret.max_excl_x = max_excl_x; | 2950 | 8.46k | ret.max_excl_y = max_excl_y; | 2951 | 8.46k | return ret; | 2952 | 8.46k | } |
|
2953 | | |
2954 | | static inline bool // |
2955 | 311k | wuffs_base__rect_ie_u32__is_empty(const wuffs_base__rect_ie_u32* r) { |
2956 | 311k | return (r->min_incl_x >= r->max_excl_x) || (r->min_incl_y >= r->max_excl_y); |
2957 | 311k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ie_u32__is_empty Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ie_u32__is_empty(wuffs_base__rect_ie_u32__struct const*) gif_fuzzer.c:wuffs_base__rect_ie_u32__is_empty Line | Count | Source | 2955 | 311k | wuffs_base__rect_ie_u32__is_empty(const wuffs_base__rect_ie_u32* r) { | 2956 | 311k | return (r->min_incl_x >= r->max_excl_x) || (r->min_incl_y >= r->max_excl_y); | 2957 | 311k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ie_u32__is_empty Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ie_u32__is_empty Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ie_u32__is_empty Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ie_u32__is_empty Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ie_u32__is_empty Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ie_u32__is_empty Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ie_u32__is_empty Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ie_u32__is_empty Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ie_u32__is_empty |
2958 | | |
2959 | | static inline bool // |
2960 | | wuffs_base__rect_ie_u32__equals(const wuffs_base__rect_ie_u32* r, |
2961 | 539k | wuffs_base__rect_ie_u32 s) { |
2962 | 539k | return (r->min_incl_x == s.min_incl_x && r->min_incl_y == s.min_incl_y && |
2963 | 539k | r->max_excl_x == s.max_excl_x && r->max_excl_y == s.max_excl_y) || |
2964 | 155k | (wuffs_base__rect_ie_u32__is_empty(r) && |
2965 | 155k | wuffs_base__rect_ie_u32__is_empty(&s)); |
2966 | 539k | } png_fuzzer.c:wuffs_base__rect_ie_u32__equals Line | Count | Source | 2961 | 9.08k | wuffs_base__rect_ie_u32 s) { | 2962 | 9.08k | return (r->min_incl_x == s.min_incl_x && r->min_incl_y == s.min_incl_y && | 2963 | 9.08k | r->max_excl_x == s.max_excl_x && r->max_excl_y == s.max_excl_y) || | 2964 | 0 | (wuffs_base__rect_ie_u32__is_empty(r) && | 2965 | 0 | wuffs_base__rect_ie_u32__is_empty(&s)); | 2966 | 9.08k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ie_u32__equals(wuffs_base__rect_ie_u32__struct const*, wuffs_base__rect_ie_u32__struct) gif_fuzzer.c:wuffs_base__rect_ie_u32__equals Line | Count | Source | 2961 | 518k | wuffs_base__rect_ie_u32 s) { | 2962 | 518k | return (r->min_incl_x == s.min_incl_x && r->min_incl_y == s.min_incl_y && | 2963 | 518k | r->max_excl_x == s.max_excl_x && r->max_excl_y == s.max_excl_y) || | 2964 | 155k | (wuffs_base__rect_ie_u32__is_empty(r) && | 2965 | 155k | wuffs_base__rect_ie_u32__is_empty(&s)); | 2966 | 518k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ie_u32__equals jpeg_fuzzer.c:wuffs_base__rect_ie_u32__equals Line | Count | Source | 2961 | 2.86k | wuffs_base__rect_ie_u32 s) { | 2962 | 2.86k | return (r->min_incl_x == s.min_incl_x && r->min_incl_y == s.min_incl_y && | 2963 | 2.86k | r->max_excl_x == s.max_excl_x && r->max_excl_y == s.max_excl_y) || | 2964 | 0 | (wuffs_base__rect_ie_u32__is_empty(r) && | 2965 | 0 | wuffs_base__rect_ie_u32__is_empty(&s)); | 2966 | 2.86k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ie_u32__equals bmp_fuzzer.c:wuffs_base__rect_ie_u32__equals Line | Count | Source | 2961 | 1.85k | wuffs_base__rect_ie_u32 s) { | 2962 | 1.85k | return (r->min_incl_x == s.min_incl_x && r->min_incl_y == s.min_incl_y && | 2963 | 1.85k | r->max_excl_x == s.max_excl_x && r->max_excl_y == s.max_excl_y) || | 2964 | 0 | (wuffs_base__rect_ie_u32__is_empty(r) && | 2965 | 0 | wuffs_base__rect_ie_u32__is_empty(&s)); | 2966 | 1.85k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ie_u32__equals Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ie_u32__equals targa_fuzzer.c:wuffs_base__rect_ie_u32__equals Line | Count | Source | 2961 | 941 | wuffs_base__rect_ie_u32 s) { | 2962 | 941 | return (r->min_incl_x == s.min_incl_x && r->min_incl_y == s.min_incl_y && | 2963 | 941 | r->max_excl_x == s.max_excl_x && r->max_excl_y == s.max_excl_y) || | 2964 | 0 | (wuffs_base__rect_ie_u32__is_empty(r) && | 2965 | 0 | wuffs_base__rect_ie_u32__is_empty(&s)); | 2966 | 941 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ie_u32__equals webp_fuzzer.c:wuffs_base__rect_ie_u32__equals Line | Count | Source | 2961 | 6.33k | wuffs_base__rect_ie_u32 s) { | 2962 | 6.33k | return (r->min_incl_x == s.min_incl_x && r->min_incl_y == s.min_incl_y && | 2963 | 6.33k | r->max_excl_x == s.max_excl_x && r->max_excl_y == s.max_excl_y) || | 2964 | 0 | (wuffs_base__rect_ie_u32__is_empty(r) && | 2965 | 0 | wuffs_base__rect_ie_u32__is_empty(&s)); | 2966 | 6.33k | } |
|
2967 | | |
2968 | | static inline wuffs_base__rect_ie_u32 // |
2969 | | wuffs_base__rect_ie_u32__intersect(const wuffs_base__rect_ie_u32* r, |
2970 | 275k | wuffs_base__rect_ie_u32 s) { |
2971 | 275k | wuffs_base__rect_ie_u32 t; |
2972 | 275k | t.min_incl_x = wuffs_base__u32__max(r->min_incl_x, s.min_incl_x); |
2973 | 275k | t.min_incl_y = wuffs_base__u32__max(r->min_incl_y, s.min_incl_y); |
2974 | 275k | t.max_excl_x = wuffs_base__u32__min(r->max_excl_x, s.max_excl_x); |
2975 | 275k | t.max_excl_y = wuffs_base__u32__min(r->max_excl_y, s.max_excl_y); |
2976 | 275k | return t; |
2977 | 275k | } png_fuzzer.c:wuffs_base__rect_ie_u32__intersect Line | Count | Source | 2970 | 6.49k | wuffs_base__rect_ie_u32 s) { | 2971 | 6.49k | wuffs_base__rect_ie_u32 t; | 2972 | 6.49k | t.min_incl_x = wuffs_base__u32__max(r->min_incl_x, s.min_incl_x); | 2973 | 6.49k | t.min_incl_y = wuffs_base__u32__max(r->min_incl_y, s.min_incl_y); | 2974 | 6.49k | t.max_excl_x = wuffs_base__u32__min(r->max_excl_x, s.max_excl_x); | 2975 | 6.49k | t.max_excl_y = wuffs_base__u32__min(r->max_excl_y, s.max_excl_y); | 2976 | 6.49k | return t; | 2977 | 6.49k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ie_u32__intersect(wuffs_base__rect_ie_u32__struct const*, wuffs_base__rect_ie_u32__struct) gif_fuzzer.c:wuffs_base__rect_ie_u32__intersect Line | Count | Source | 2970 | 259k | wuffs_base__rect_ie_u32 s) { | 2971 | 259k | wuffs_base__rect_ie_u32 t; | 2972 | 259k | t.min_incl_x = wuffs_base__u32__max(r->min_incl_x, s.min_incl_x); | 2973 | 259k | t.min_incl_y = wuffs_base__u32__max(r->min_incl_y, s.min_incl_y); | 2974 | 259k | t.max_excl_x = wuffs_base__u32__min(r->max_excl_x, s.max_excl_x); | 2975 | 259k | t.max_excl_y = wuffs_base__u32__min(r->max_excl_y, s.max_excl_y); | 2976 | 259k | return t; | 2977 | 259k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ie_u32__intersect jpeg_fuzzer.c:wuffs_base__rect_ie_u32__intersect Line | Count | Source | 2970 | 2.85k | wuffs_base__rect_ie_u32 s) { | 2971 | 2.85k | wuffs_base__rect_ie_u32 t; | 2972 | 2.85k | t.min_incl_x = wuffs_base__u32__max(r->min_incl_x, s.min_incl_x); | 2973 | 2.85k | t.min_incl_y = wuffs_base__u32__max(r->min_incl_y, s.min_incl_y); | 2974 | 2.85k | t.max_excl_x = wuffs_base__u32__min(r->max_excl_x, s.max_excl_x); | 2975 | 2.85k | t.max_excl_y = wuffs_base__u32__min(r->max_excl_y, s.max_excl_y); | 2976 | 2.85k | return t; | 2977 | 2.85k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ie_u32__intersect bmp_fuzzer.c:wuffs_base__rect_ie_u32__intersect Line | Count | Source | 2970 | 1.72k | wuffs_base__rect_ie_u32 s) { | 2971 | 1.72k | wuffs_base__rect_ie_u32 t; | 2972 | 1.72k | t.min_incl_x = wuffs_base__u32__max(r->min_incl_x, s.min_incl_x); | 2973 | 1.72k | t.min_incl_y = wuffs_base__u32__max(r->min_incl_y, s.min_incl_y); | 2974 | 1.72k | t.max_excl_x = wuffs_base__u32__min(r->max_excl_x, s.max_excl_x); | 2975 | 1.72k | t.max_excl_y = wuffs_base__u32__min(r->max_excl_y, s.max_excl_y); | 2976 | 1.72k | return t; | 2977 | 1.72k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ie_u32__intersect Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ie_u32__intersect targa_fuzzer.c:wuffs_base__rect_ie_u32__intersect Line | Count | Source | 2970 | 893 | wuffs_base__rect_ie_u32 s) { | 2971 | 893 | wuffs_base__rect_ie_u32 t; | 2972 | 893 | t.min_incl_x = wuffs_base__u32__max(r->min_incl_x, s.min_incl_x); | 2973 | 893 | t.min_incl_y = wuffs_base__u32__max(r->min_incl_y, s.min_incl_y); | 2974 | 893 | t.max_excl_x = wuffs_base__u32__min(r->max_excl_x, s.max_excl_x); | 2975 | 893 | t.max_excl_y = wuffs_base__u32__min(r->max_excl_y, s.max_excl_y); | 2976 | 893 | return t; | 2977 | 893 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ie_u32__intersect webp_fuzzer.c:wuffs_base__rect_ie_u32__intersect Line | Count | Source | 2970 | 4.23k | wuffs_base__rect_ie_u32 s) { | 2971 | 4.23k | wuffs_base__rect_ie_u32 t; | 2972 | 4.23k | t.min_incl_x = wuffs_base__u32__max(r->min_incl_x, s.min_incl_x); | 2973 | 4.23k | t.min_incl_y = wuffs_base__u32__max(r->min_incl_y, s.min_incl_y); | 2974 | 4.23k | t.max_excl_x = wuffs_base__u32__min(r->max_excl_x, s.max_excl_x); | 2975 | 4.23k | t.max_excl_y = wuffs_base__u32__min(r->max_excl_y, s.max_excl_y); | 2976 | 4.23k | return t; | 2977 | 4.23k | } |
|
2978 | | |
2979 | | static inline wuffs_base__rect_ie_u32 // |
2980 | | wuffs_base__rect_ie_u32__unite(const wuffs_base__rect_ie_u32* r, |
2981 | 0 | wuffs_base__rect_ie_u32 s) { |
2982 | 0 | if (wuffs_base__rect_ie_u32__is_empty(r)) { |
2983 | 0 | return s; |
2984 | 0 | } |
2985 | 0 | if (wuffs_base__rect_ie_u32__is_empty(&s)) { |
2986 | 0 | return *r; |
2987 | 0 | } |
2988 | 0 | wuffs_base__rect_ie_u32 t; |
2989 | 0 | t.min_incl_x = wuffs_base__u32__min(r->min_incl_x, s.min_incl_x); |
2990 | 0 | t.min_incl_y = wuffs_base__u32__min(r->min_incl_y, s.min_incl_y); |
2991 | 0 | t.max_excl_x = wuffs_base__u32__max(r->max_excl_x, s.max_excl_x); |
2992 | 0 | t.max_excl_y = wuffs_base__u32__max(r->max_excl_y, s.max_excl_y); |
2993 | 0 | return t; |
2994 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ie_u32__unite Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ie_u32__unite(wuffs_base__rect_ie_u32__struct const*, wuffs_base__rect_ie_u32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ie_u32__unite Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ie_u32__unite Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ie_u32__unite Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ie_u32__unite Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ie_u32__unite Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ie_u32__unite Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ie_u32__unite Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ie_u32__unite Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ie_u32__unite Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ie_u32__unite |
2995 | | |
2996 | | static inline bool // |
2997 | | wuffs_base__rect_ie_u32__contains(const wuffs_base__rect_ie_u32* r, |
2998 | | uint32_t x, |
2999 | 0 | uint32_t y) { |
3000 | 0 | return (r->min_incl_x <= x) && (x < r->max_excl_x) && (r->min_incl_y <= y) && |
3001 | 0 | (y < r->max_excl_y); |
3002 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ie_u32__contains Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ie_u32__contains(wuffs_base__rect_ie_u32__struct const*, unsigned int, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ie_u32__contains Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ie_u32__contains Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ie_u32__contains Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ie_u32__contains Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ie_u32__contains Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ie_u32__contains Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ie_u32__contains Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ie_u32__contains Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ie_u32__contains Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ie_u32__contains |
3003 | | |
3004 | | static inline bool // |
3005 | | wuffs_base__rect_ie_u32__contains_rect(const wuffs_base__rect_ie_u32* r, |
3006 | 275k | wuffs_base__rect_ie_u32 s) { |
3007 | 275k | return wuffs_base__rect_ie_u32__equals( |
3008 | 275k | &s, wuffs_base__rect_ie_u32__intersect(r, s)); |
3009 | 275k | } png_fuzzer.c:wuffs_base__rect_ie_u32__contains_rect Line | Count | Source | 3006 | 6.49k | wuffs_base__rect_ie_u32 s) { | 3007 | 6.49k | return wuffs_base__rect_ie_u32__equals( | 3008 | 6.49k | &s, wuffs_base__rect_ie_u32__intersect(r, s)); | 3009 | 6.49k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ie_u32__contains_rect(wuffs_base__rect_ie_u32__struct const*, wuffs_base__rect_ie_u32__struct) gif_fuzzer.c:wuffs_base__rect_ie_u32__contains_rect Line | Count | Source | 3006 | 259k | wuffs_base__rect_ie_u32 s) { | 3007 | 259k | return wuffs_base__rect_ie_u32__equals( | 3008 | 259k | &s, wuffs_base__rect_ie_u32__intersect(r, s)); | 3009 | 259k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ie_u32__contains_rect jpeg_fuzzer.c:wuffs_base__rect_ie_u32__contains_rect Line | Count | Source | 3006 | 2.85k | wuffs_base__rect_ie_u32 s) { | 3007 | 2.85k | return wuffs_base__rect_ie_u32__equals( | 3008 | 2.85k | &s, wuffs_base__rect_ie_u32__intersect(r, s)); | 3009 | 2.85k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ie_u32__contains_rect bmp_fuzzer.c:wuffs_base__rect_ie_u32__contains_rect Line | Count | Source | 3006 | 1.72k | wuffs_base__rect_ie_u32 s) { | 3007 | 1.72k | return wuffs_base__rect_ie_u32__equals( | 3008 | 1.72k | &s, wuffs_base__rect_ie_u32__intersect(r, s)); | 3009 | 1.72k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ie_u32__contains_rect Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ie_u32__contains_rect targa_fuzzer.c:wuffs_base__rect_ie_u32__contains_rect Line | Count | Source | 3006 | 893 | wuffs_base__rect_ie_u32 s) { | 3007 | 893 | return wuffs_base__rect_ie_u32__equals( | 3008 | 893 | &s, wuffs_base__rect_ie_u32__intersect(r, s)); | 3009 | 893 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ie_u32__contains_rect webp_fuzzer.c:wuffs_base__rect_ie_u32__contains_rect Line | Count | Source | 3006 | 4.23k | wuffs_base__rect_ie_u32 s) { | 3007 | 4.23k | return wuffs_base__rect_ie_u32__equals( | 3008 | 4.23k | &s, wuffs_base__rect_ie_u32__intersect(r, s)); | 3009 | 4.23k | } |
|
3010 | | |
3011 | | static inline uint32_t // |
3012 | 0 | wuffs_base__rect_ie_u32__width(const wuffs_base__rect_ie_u32* r) { |
3013 | 0 | return wuffs_base__u32__sat_sub(r->max_excl_x, r->min_incl_x); |
3014 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ie_u32__width Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ie_u32__width(wuffs_base__rect_ie_u32__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ie_u32__width Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ie_u32__width Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ie_u32__width Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ie_u32__width Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ie_u32__width Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ie_u32__width Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ie_u32__width Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ie_u32__width Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ie_u32__width Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ie_u32__width |
3015 | | |
3016 | | static inline uint32_t // |
3017 | 0 | wuffs_base__rect_ie_u32__height(const wuffs_base__rect_ie_u32* r) { |
3018 | 0 | return wuffs_base__u32__sat_sub(r->max_excl_y, r->min_incl_y); |
3019 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ie_u32__height Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ie_u32__height(wuffs_base__rect_ie_u32__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ie_u32__height Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ie_u32__height Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ie_u32__height Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ie_u32__height Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ie_u32__height Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ie_u32__height Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ie_u32__height Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ie_u32__height Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ie_u32__height Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ie_u32__height |
3020 | | |
3021 | | #ifdef __cplusplus |
3022 | | |
3023 | | inline bool // |
3024 | 0 | wuffs_base__rect_ie_u32::is_empty() const { |
3025 | 0 | return wuffs_base__rect_ie_u32__is_empty(this); |
3026 | 0 | } |
3027 | | |
3028 | | inline bool // |
3029 | 0 | wuffs_base__rect_ie_u32::equals(wuffs_base__rect_ie_u32 s) const { |
3030 | 0 | return wuffs_base__rect_ie_u32__equals(this, s); |
3031 | 0 | } |
3032 | | |
3033 | | inline wuffs_base__rect_ie_u32 // |
3034 | 0 | wuffs_base__rect_ie_u32::intersect(wuffs_base__rect_ie_u32 s) const { |
3035 | 0 | return wuffs_base__rect_ie_u32__intersect(this, s); |
3036 | 0 | } |
3037 | | |
3038 | | inline wuffs_base__rect_ie_u32 // |
3039 | 0 | wuffs_base__rect_ie_u32::unite(wuffs_base__rect_ie_u32 s) const { |
3040 | 0 | return wuffs_base__rect_ie_u32__unite(this, s); |
3041 | 0 | } |
3042 | | |
3043 | | inline bool // |
3044 | 0 | wuffs_base__rect_ie_u32::contains(uint32_t x, uint32_t y) const { |
3045 | 0 | return wuffs_base__rect_ie_u32__contains(this, x, y); |
3046 | 0 | } |
3047 | | |
3048 | | inline bool // |
3049 | 0 | wuffs_base__rect_ie_u32::contains_rect(wuffs_base__rect_ie_u32 s) const { |
3050 | 0 | return wuffs_base__rect_ie_u32__contains_rect(this, s); |
3051 | 0 | } |
3052 | | |
3053 | | inline uint32_t // |
3054 | 0 | wuffs_base__rect_ie_u32::width() const { |
3055 | 0 | return wuffs_base__rect_ie_u32__width(this); |
3056 | 0 | } |
3057 | | |
3058 | | inline uint32_t // |
3059 | 0 | wuffs_base__rect_ie_u32::height() const { |
3060 | 0 | return wuffs_base__rect_ie_u32__height(this); |
3061 | 0 | } |
3062 | | |
3063 | | #endif // __cplusplus |
3064 | | |
3065 | | // -------- |
3066 | | |
3067 | | typedef struct wuffs_base__rect_ii_u32__struct { |
3068 | | uint32_t min_incl_x; |
3069 | | uint32_t min_incl_y; |
3070 | | uint32_t max_incl_x; |
3071 | | uint32_t max_incl_y; |
3072 | | |
3073 | | #ifdef __cplusplus |
3074 | | inline bool is_empty() const; |
3075 | | inline bool equals(wuffs_base__rect_ii_u32__struct s) const; |
3076 | | inline wuffs_base__rect_ii_u32__struct intersect( |
3077 | | wuffs_base__rect_ii_u32__struct s) const; |
3078 | | inline wuffs_base__rect_ii_u32__struct unite( |
3079 | | wuffs_base__rect_ii_u32__struct s) const; |
3080 | | inline bool contains(uint32_t x, uint32_t y) const; |
3081 | | inline bool contains_rect(wuffs_base__rect_ii_u32__struct s) const; |
3082 | | #endif // __cplusplus |
3083 | | |
3084 | | } wuffs_base__rect_ii_u32; |
3085 | | |
3086 | | static inline wuffs_base__rect_ii_u32 // |
3087 | 0 | wuffs_base__empty_rect_ii_u32(void) { |
3088 | 0 | wuffs_base__rect_ii_u32 ret; |
3089 | 0 | ret.min_incl_x = 0; |
3090 | 0 | ret.min_incl_y = 0; |
3091 | 0 | ret.max_incl_x = 0; |
3092 | 0 | ret.max_incl_y = 0; |
3093 | 0 | return ret; |
3094 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_rect_ii_u32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_rect_ii_u32() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_rect_ii_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_rect_ii_u32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_rect_ii_u32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_rect_ii_u32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_rect_ii_u32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_rect_ii_u32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_rect_ii_u32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_rect_ii_u32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_rect_ii_u32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_rect_ii_u32 |
3095 | | |
3096 | | static inline wuffs_base__rect_ii_u32 // |
3097 | | wuffs_base__make_rect_ii_u32(uint32_t min_incl_x, |
3098 | | uint32_t min_incl_y, |
3099 | | uint32_t max_incl_x, |
3100 | 0 | uint32_t max_incl_y) { |
3101 | 0 | wuffs_base__rect_ii_u32 ret; |
3102 | 0 | ret.min_incl_x = min_incl_x; |
3103 | 0 | ret.min_incl_y = min_incl_y; |
3104 | 0 | ret.max_incl_x = max_incl_x; |
3105 | 0 | ret.max_incl_y = max_incl_y; |
3106 | 0 | return ret; |
3107 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_rect_ii_u32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_rect_ii_u32(unsigned int, unsigned int, unsigned int, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_rect_ii_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_rect_ii_u32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_rect_ii_u32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_rect_ii_u32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_rect_ii_u32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_rect_ii_u32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_rect_ii_u32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_rect_ii_u32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_rect_ii_u32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_rect_ii_u32 |
3108 | | |
3109 | | static inline bool // |
3110 | 0 | wuffs_base__rect_ii_u32__is_empty(const wuffs_base__rect_ii_u32* r) { |
3111 | 0 | return (r->min_incl_x > r->max_incl_x) || (r->min_incl_y > r->max_incl_y); |
3112 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ii_u32__is_empty Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ii_u32__is_empty(wuffs_base__rect_ii_u32__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ii_u32__is_empty Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ii_u32__is_empty Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ii_u32__is_empty Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ii_u32__is_empty Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ii_u32__is_empty Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ii_u32__is_empty Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ii_u32__is_empty Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ii_u32__is_empty Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ii_u32__is_empty Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ii_u32__is_empty |
3113 | | |
3114 | | static inline bool // |
3115 | | wuffs_base__rect_ii_u32__equals(const wuffs_base__rect_ii_u32* r, |
3116 | 0 | wuffs_base__rect_ii_u32 s) { |
3117 | 0 | return (r->min_incl_x == s.min_incl_x && r->min_incl_y == s.min_incl_y && |
3118 | 0 | r->max_incl_x == s.max_incl_x && r->max_incl_y == s.max_incl_y) || |
3119 | 0 | (wuffs_base__rect_ii_u32__is_empty(r) && |
3120 | 0 | wuffs_base__rect_ii_u32__is_empty(&s)); |
3121 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ii_u32__equals Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ii_u32__equals(wuffs_base__rect_ii_u32__struct const*, wuffs_base__rect_ii_u32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ii_u32__equals Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ii_u32__equals Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ii_u32__equals Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ii_u32__equals Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ii_u32__equals Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ii_u32__equals Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ii_u32__equals Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ii_u32__equals Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ii_u32__equals Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ii_u32__equals |
3122 | | |
3123 | | static inline wuffs_base__rect_ii_u32 // |
3124 | | wuffs_base__rect_ii_u32__intersect(const wuffs_base__rect_ii_u32* r, |
3125 | 0 | wuffs_base__rect_ii_u32 s) { |
3126 | 0 | wuffs_base__rect_ii_u32 t; |
3127 | 0 | t.min_incl_x = wuffs_base__u32__max(r->min_incl_x, s.min_incl_x); |
3128 | 0 | t.min_incl_y = wuffs_base__u32__max(r->min_incl_y, s.min_incl_y); |
3129 | 0 | t.max_incl_x = wuffs_base__u32__min(r->max_incl_x, s.max_incl_x); |
3130 | 0 | t.max_incl_y = wuffs_base__u32__min(r->max_incl_y, s.max_incl_y); |
3131 | 0 | return t; |
3132 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ii_u32__intersect Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ii_u32__intersect(wuffs_base__rect_ii_u32__struct const*, wuffs_base__rect_ii_u32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ii_u32__intersect Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ii_u32__intersect Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ii_u32__intersect Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ii_u32__intersect Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ii_u32__intersect Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ii_u32__intersect Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ii_u32__intersect Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ii_u32__intersect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ii_u32__intersect Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ii_u32__intersect |
3133 | | |
3134 | | static inline wuffs_base__rect_ii_u32 // |
3135 | | wuffs_base__rect_ii_u32__unite(const wuffs_base__rect_ii_u32* r, |
3136 | 0 | wuffs_base__rect_ii_u32 s) { |
3137 | 0 | if (wuffs_base__rect_ii_u32__is_empty(r)) { |
3138 | 0 | return s; |
3139 | 0 | } |
3140 | 0 | if (wuffs_base__rect_ii_u32__is_empty(&s)) { |
3141 | 0 | return *r; |
3142 | 0 | } |
3143 | 0 | wuffs_base__rect_ii_u32 t; |
3144 | 0 | t.min_incl_x = wuffs_base__u32__min(r->min_incl_x, s.min_incl_x); |
3145 | 0 | t.min_incl_y = wuffs_base__u32__min(r->min_incl_y, s.min_incl_y); |
3146 | 0 | t.max_incl_x = wuffs_base__u32__max(r->max_incl_x, s.max_incl_x); |
3147 | 0 | t.max_incl_y = wuffs_base__u32__max(r->max_incl_y, s.max_incl_y); |
3148 | 0 | return t; |
3149 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ii_u32__unite Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ii_u32__unite(wuffs_base__rect_ii_u32__struct const*, wuffs_base__rect_ii_u32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ii_u32__unite Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ii_u32__unite Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ii_u32__unite Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ii_u32__unite Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ii_u32__unite Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ii_u32__unite Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ii_u32__unite Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ii_u32__unite Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ii_u32__unite Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ii_u32__unite |
3150 | | |
3151 | | static inline bool // |
3152 | | wuffs_base__rect_ii_u32__contains(const wuffs_base__rect_ii_u32* r, |
3153 | | uint32_t x, |
3154 | 0 | uint32_t y) { |
3155 | 0 | return (r->min_incl_x <= x) && (x <= r->max_incl_x) && (r->min_incl_y <= y) && |
3156 | 0 | (y <= r->max_incl_y); |
3157 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ii_u32__contains Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ii_u32__contains(wuffs_base__rect_ii_u32__struct const*, unsigned int, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ii_u32__contains Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ii_u32__contains Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ii_u32__contains Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ii_u32__contains Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ii_u32__contains Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ii_u32__contains Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ii_u32__contains Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ii_u32__contains Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ii_u32__contains Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ii_u32__contains |
3158 | | |
3159 | | static inline bool // |
3160 | | wuffs_base__rect_ii_u32__contains_rect(const wuffs_base__rect_ii_u32* r, |
3161 | 0 | wuffs_base__rect_ii_u32 s) { |
3162 | 0 | return wuffs_base__rect_ii_u32__equals( |
3163 | 0 | &s, wuffs_base__rect_ii_u32__intersect(r, s)); |
3164 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__rect_ii_u32__contains_rect Unexecuted instantiation: json_fuzzer.cc:wuffs_base__rect_ii_u32__contains_rect(wuffs_base__rect_ii_u32__struct const*, wuffs_base__rect_ii_u32__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__rect_ii_u32__contains_rect Unexecuted instantiation: xz_fuzzer.c:wuffs_base__rect_ii_u32__contains_rect Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__rect_ii_u32__contains_rect Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__rect_ii_u32__contains_rect Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__rect_ii_u32__contains_rect Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__rect_ii_u32__contains_rect Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__rect_ii_u32__contains_rect Unexecuted instantiation: targa_fuzzer.c:wuffs_base__rect_ii_u32__contains_rect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__rect_ii_u32__contains_rect Unexecuted instantiation: webp_fuzzer.c:wuffs_base__rect_ii_u32__contains_rect |
3165 | | |
3166 | | #ifdef __cplusplus |
3167 | | |
3168 | | inline bool // |
3169 | 0 | wuffs_base__rect_ii_u32::is_empty() const { |
3170 | 0 | return wuffs_base__rect_ii_u32__is_empty(this); |
3171 | 0 | } |
3172 | | |
3173 | | inline bool // |
3174 | 0 | wuffs_base__rect_ii_u32::equals(wuffs_base__rect_ii_u32 s) const { |
3175 | 0 | return wuffs_base__rect_ii_u32__equals(this, s); |
3176 | 0 | } |
3177 | | |
3178 | | inline wuffs_base__rect_ii_u32 // |
3179 | 0 | wuffs_base__rect_ii_u32::intersect(wuffs_base__rect_ii_u32 s) const { |
3180 | 0 | return wuffs_base__rect_ii_u32__intersect(this, s); |
3181 | 0 | } |
3182 | | |
3183 | | inline wuffs_base__rect_ii_u32 // |
3184 | 0 | wuffs_base__rect_ii_u32::unite(wuffs_base__rect_ii_u32 s) const { |
3185 | 0 | return wuffs_base__rect_ii_u32__unite(this, s); |
3186 | 0 | } |
3187 | | |
3188 | | inline bool // |
3189 | 0 | wuffs_base__rect_ii_u32::contains(uint32_t x, uint32_t y) const { |
3190 | 0 | return wuffs_base__rect_ii_u32__contains(this, x, y); |
3191 | 0 | } |
3192 | | |
3193 | | inline bool // |
3194 | 0 | wuffs_base__rect_ii_u32::contains_rect(wuffs_base__rect_ii_u32 s) const { |
3195 | 0 | return wuffs_base__rect_ii_u32__contains_rect(this, s); |
3196 | 0 | } |
3197 | | |
3198 | | #endif // __cplusplus |
3199 | | |
3200 | | // ---------------- More Information |
3201 | | |
3202 | | // wuffs_base__more_information holds additional fields, typically when a Wuffs |
3203 | | // method returns a [note status](/doc/note/statuses.md). |
3204 | | // |
3205 | | // The flavor field follows the base38 namespace |
3206 | | // convention](/doc/note/base38-and-fourcc.md). The other fields' semantics |
3207 | | // depends on the flavor. |
3208 | | typedef struct wuffs_base__more_information__struct { |
3209 | | uint32_t flavor; |
3210 | | uint32_t w; |
3211 | | uint64_t x; |
3212 | | uint64_t y; |
3213 | | uint64_t z; |
3214 | | |
3215 | | #ifdef __cplusplus |
3216 | | inline void set(uint32_t flavor_arg, |
3217 | | uint32_t w_arg, |
3218 | | uint64_t x_arg, |
3219 | | uint64_t y_arg, |
3220 | | uint64_t z_arg); |
3221 | | inline uint32_t io_redirect__fourcc() const; |
3222 | | inline wuffs_base__range_ie_u64 io_redirect__range() const; |
3223 | | inline uint64_t io_seek__position() const; |
3224 | | inline uint32_t metadata__fourcc() const; |
3225 | | inline wuffs_base__range_ie_u64 metadata_raw_passthrough__range() const; |
3226 | | inline int32_t metadata_parsed__chrm(uint32_t component) const; |
3227 | | inline uint32_t metadata_parsed__gama() const; |
3228 | | inline uint32_t metadata_parsed__srgb() const; |
3229 | | #endif // __cplusplus |
3230 | | |
3231 | | } wuffs_base__more_information; |
3232 | | |
3233 | | #define WUFFS_BASE__MORE_INFORMATION__FLAVOR__IO_REDIRECT 1 |
3234 | | #define WUFFS_BASE__MORE_INFORMATION__FLAVOR__IO_SEEK 2 |
3235 | 0 | #define WUFFS_BASE__MORE_INFORMATION__FLAVOR__METADATA_RAW_PASSTHROUGH 3 |
3236 | 0 | #define WUFFS_BASE__MORE_INFORMATION__FLAVOR__METADATA_RAW_TRANSFORM 4 |
3237 | 0 | #define WUFFS_BASE__MORE_INFORMATION__FLAVOR__METADATA_PARSED 5 |
3238 | | |
3239 | | static inline wuffs_base__more_information // |
3240 | 0 | wuffs_base__empty_more_information(void) { |
3241 | 0 | wuffs_base__more_information ret; |
3242 | 0 | ret.flavor = 0; |
3243 | 0 | ret.w = 0; |
3244 | 0 | ret.x = 0; |
3245 | 0 | ret.y = 0; |
3246 | 0 | ret.z = 0; |
3247 | 0 | return ret; |
3248 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_more_information Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_more_information() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_more_information Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_more_information Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_more_information Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_more_information Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_more_information Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_more_information Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_more_information Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_more_information Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_more_information Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_more_information |
3249 | | |
3250 | | static inline void // |
3251 | | wuffs_base__more_information__set(wuffs_base__more_information* m, |
3252 | | uint32_t flavor, |
3253 | | uint32_t w, |
3254 | | uint64_t x, |
3255 | | uint64_t y, |
3256 | 0 | uint64_t z) { |
3257 | 0 | if (!m) { |
3258 | 0 | return; |
3259 | 0 | } |
3260 | 0 | m->flavor = flavor; |
3261 | 0 | m->w = w; |
3262 | 0 | m->x = x; |
3263 | 0 | m->y = y; |
3264 | 0 | m->z = z; |
3265 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__more_information__set Unexecuted instantiation: json_fuzzer.cc:wuffs_base__more_information__set(wuffs_base__more_information__struct*, unsigned int, unsigned int, unsigned long, unsigned long, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__more_information__set Unexecuted instantiation: xz_fuzzer.c:wuffs_base__more_information__set Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__more_information__set Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__more_information__set Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__more_information__set Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__more_information__set Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__more_information__set Unexecuted instantiation: targa_fuzzer.c:wuffs_base__more_information__set Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__more_information__set Unexecuted instantiation: webp_fuzzer.c:wuffs_base__more_information__set |
3266 | | |
3267 | | static inline uint32_t // |
3268 | | wuffs_base__more_information__io_redirect__fourcc( |
3269 | 0 | const wuffs_base__more_information* m) { |
3270 | 0 | return m->w; |
3271 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__more_information__io_redirect__fourcc Unexecuted instantiation: json_fuzzer.cc:wuffs_base__more_information__io_redirect__fourcc(wuffs_base__more_information__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__more_information__io_redirect__fourcc Unexecuted instantiation: xz_fuzzer.c:wuffs_base__more_information__io_redirect__fourcc Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__more_information__io_redirect__fourcc Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__more_information__io_redirect__fourcc Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__more_information__io_redirect__fourcc Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__more_information__io_redirect__fourcc Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__more_information__io_redirect__fourcc Unexecuted instantiation: targa_fuzzer.c:wuffs_base__more_information__io_redirect__fourcc Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__more_information__io_redirect__fourcc Unexecuted instantiation: webp_fuzzer.c:wuffs_base__more_information__io_redirect__fourcc |
3272 | | |
3273 | | static inline wuffs_base__range_ie_u64 // |
3274 | | wuffs_base__more_information__io_redirect__range( |
3275 | 0 | const wuffs_base__more_information* m) { |
3276 | 0 | wuffs_base__range_ie_u64 ret; |
3277 | 0 | ret.min_incl = m->y; |
3278 | 0 | ret.max_excl = m->z; |
3279 | 0 | return ret; |
3280 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__more_information__io_redirect__range Unexecuted instantiation: json_fuzzer.cc:wuffs_base__more_information__io_redirect__range(wuffs_base__more_information__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__more_information__io_redirect__range Unexecuted instantiation: xz_fuzzer.c:wuffs_base__more_information__io_redirect__range Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__more_information__io_redirect__range Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__more_information__io_redirect__range Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__more_information__io_redirect__range Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__more_information__io_redirect__range Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__more_information__io_redirect__range Unexecuted instantiation: targa_fuzzer.c:wuffs_base__more_information__io_redirect__range Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__more_information__io_redirect__range Unexecuted instantiation: webp_fuzzer.c:wuffs_base__more_information__io_redirect__range |
3281 | | |
3282 | | static inline uint64_t // |
3283 | | wuffs_base__more_information__io_seek__position( |
3284 | 0 | const wuffs_base__more_information* m) { |
3285 | 0 | return m->x; |
3286 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__more_information__io_seek__position Unexecuted instantiation: json_fuzzer.cc:wuffs_base__more_information__io_seek__position(wuffs_base__more_information__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__more_information__io_seek__position Unexecuted instantiation: xz_fuzzer.c:wuffs_base__more_information__io_seek__position Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__more_information__io_seek__position Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__more_information__io_seek__position Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__more_information__io_seek__position Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__more_information__io_seek__position Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__more_information__io_seek__position Unexecuted instantiation: targa_fuzzer.c:wuffs_base__more_information__io_seek__position Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__more_information__io_seek__position Unexecuted instantiation: webp_fuzzer.c:wuffs_base__more_information__io_seek__position |
3287 | | |
3288 | | static inline uint32_t // |
3289 | | wuffs_base__more_information__metadata__fourcc( |
3290 | 0 | const wuffs_base__more_information* m) { |
3291 | 0 | return m->w; |
3292 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__more_information__metadata__fourcc Unexecuted instantiation: json_fuzzer.cc:wuffs_base__more_information__metadata__fourcc(wuffs_base__more_information__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__more_information__metadata__fourcc Unexecuted instantiation: xz_fuzzer.c:wuffs_base__more_information__metadata__fourcc Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__more_information__metadata__fourcc Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__more_information__metadata__fourcc Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__more_information__metadata__fourcc Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__more_information__metadata__fourcc Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__more_information__metadata__fourcc Unexecuted instantiation: targa_fuzzer.c:wuffs_base__more_information__metadata__fourcc Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__more_information__metadata__fourcc Unexecuted instantiation: webp_fuzzer.c:wuffs_base__more_information__metadata__fourcc |
3293 | | |
3294 | | static inline wuffs_base__range_ie_u64 // |
3295 | | wuffs_base__more_information__metadata_raw_passthrough__range( |
3296 | 0 | const wuffs_base__more_information* m) { |
3297 | 0 | wuffs_base__range_ie_u64 ret; |
3298 | 0 | ret.min_incl = m->y; |
3299 | 0 | ret.max_excl = m->z; |
3300 | 0 | return ret; |
3301 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__more_information__metadata_raw_passthrough__range Unexecuted instantiation: json_fuzzer.cc:wuffs_base__more_information__metadata_raw_passthrough__range(wuffs_base__more_information__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__more_information__metadata_raw_passthrough__range Unexecuted instantiation: xz_fuzzer.c:wuffs_base__more_information__metadata_raw_passthrough__range Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__more_information__metadata_raw_passthrough__range Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__more_information__metadata_raw_passthrough__range Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__more_information__metadata_raw_passthrough__range Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__more_information__metadata_raw_passthrough__range Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__more_information__metadata_raw_passthrough__range Unexecuted instantiation: targa_fuzzer.c:wuffs_base__more_information__metadata_raw_passthrough__range Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__more_information__metadata_raw_passthrough__range Unexecuted instantiation: webp_fuzzer.c:wuffs_base__more_information__metadata_raw_passthrough__range |
3302 | | |
3303 | | #define WUFFS_BASE__MORE_INFORMATION__METADATA_PARSED__CHRM__WHITE_X 0 |
3304 | | #define WUFFS_BASE__MORE_INFORMATION__METADATA_PARSED__CHRM__WHITE_Y 1 |
3305 | | #define WUFFS_BASE__MORE_INFORMATION__METADATA_PARSED__CHRM__RED_X 2 |
3306 | | #define WUFFS_BASE__MORE_INFORMATION__METADATA_PARSED__CHRM__RED_Y 3 |
3307 | | #define WUFFS_BASE__MORE_INFORMATION__METADATA_PARSED__CHRM__GREEN_X 4 |
3308 | | #define WUFFS_BASE__MORE_INFORMATION__METADATA_PARSED__CHRM__GREEN_Y 5 |
3309 | | #define WUFFS_BASE__MORE_INFORMATION__METADATA_PARSED__CHRM__BLUE_X 6 |
3310 | | #define WUFFS_BASE__MORE_INFORMATION__METADATA_PARSED__CHRM__BLUE_Y 7 |
3311 | | |
3312 | | // wuffs_base__more_information__metadata_parsed__chrm returns chromaticity |
3313 | | // values (scaled by 100000) like the PNG "cHRM" chunk. For example, the sRGB |
3314 | | // color space corresponds to: |
3315 | | // - ETC__CHRM__WHITE_X 31270 |
3316 | | // - ETC__CHRM__WHITE_Y 32900 |
3317 | | // - ETC__CHRM__RED_X 64000 |
3318 | | // - ETC__CHRM__RED_Y 33000 |
3319 | | // - ETC__CHRM__GREEN_X 30000 |
3320 | | // - ETC__CHRM__GREEN_Y 60000 |
3321 | | // - ETC__CHRM__BLUE_X 15000 |
3322 | | // - ETC__CHRM__BLUE_Y 6000 |
3323 | | // |
3324 | | // See |
3325 | | // https://ciechanow.ski/color-spaces/#chromaticity-and-white-point-coordinates |
3326 | | static inline int32_t // |
3327 | | wuffs_base__more_information__metadata_parsed__chrm( |
3328 | | const wuffs_base__more_information* m, |
3329 | 0 | uint32_t component) { |
3330 | 0 | // After the flavor and the w field (holding a FourCC), a |
3331 | 0 | // wuffs_base__more_information holds 24 bytes of data in three uint64_t |
3332 | 0 | // typed fields (x, y and z). We pack the eight chromaticity values (wx, wy, |
3333 | 0 | // rx, ..., by), basically int24_t values, into 24 bytes like this: |
3334 | 0 | // - LSB MSB |
3335 | 0 | // - x: wx wx wx wy wy wy rx rx |
3336 | 0 | // - y: rx ry ry ry gx gx gx gy |
3337 | 0 | // - z: gy gy bx bx bx by by by |
3338 | 0 | uint32_t u = 0; |
3339 | 0 | switch (component & 7) { |
3340 | 0 | case 0: |
3341 | 0 | u = ((uint32_t)(m->x >> 0)); |
3342 | 0 | break; |
3343 | 0 | case 1: |
3344 | 0 | u = ((uint32_t)(m->x >> 24)); |
3345 | 0 | break; |
3346 | 0 | case 2: |
3347 | 0 | u = ((uint32_t)((m->x >> 48) | (m->y << 16))); |
3348 | 0 | break; |
3349 | 0 | case 3: |
3350 | 0 | u = ((uint32_t)(m->y >> 8)); |
3351 | 0 | break; |
3352 | 0 | case 4: |
3353 | 0 | u = ((uint32_t)(m->y >> 32)); |
3354 | 0 | break; |
3355 | 0 | case 5: |
3356 | 0 | u = ((uint32_t)((m->y >> 56) | (m->z << 8))); |
3357 | 0 | break; |
3358 | 0 | case 6: |
3359 | 0 | u = ((uint32_t)(m->z >> 16)); |
3360 | 0 | break; |
3361 | 0 | case 7: |
3362 | 0 | u = ((uint32_t)(m->z >> 40)); |
3363 | 0 | break; |
3364 | 0 | } |
3365 | 0 | // The left-right shifts sign-extend from 24-bit to 32-bit integers. |
3366 | 0 | return ((int32_t)(u << 8)) >> 8; |
3367 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__more_information__metadata_parsed__chrm Unexecuted instantiation: json_fuzzer.cc:wuffs_base__more_information__metadata_parsed__chrm(wuffs_base__more_information__struct const*, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__more_information__metadata_parsed__chrm Unexecuted instantiation: xz_fuzzer.c:wuffs_base__more_information__metadata_parsed__chrm Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__more_information__metadata_parsed__chrm Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__more_information__metadata_parsed__chrm Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__more_information__metadata_parsed__chrm Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__more_information__metadata_parsed__chrm Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__more_information__metadata_parsed__chrm Unexecuted instantiation: targa_fuzzer.c:wuffs_base__more_information__metadata_parsed__chrm Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__more_information__metadata_parsed__chrm Unexecuted instantiation: webp_fuzzer.c:wuffs_base__more_information__metadata_parsed__chrm |
3368 | | |
3369 | | // wuffs_base__more_information__metadata_parsed__gama returns inverse gamma |
3370 | | // correction values (scaled by 100000) like the PNG "gAMA" chunk. For example, |
3371 | | // for gamma = 2.2, this returns 45455 (approximating 100000 / 2.2). |
3372 | | static inline uint32_t // |
3373 | | wuffs_base__more_information__metadata_parsed__gama( |
3374 | 0 | const wuffs_base__more_information* m) { |
3375 | 0 | return ((uint32_t)(m->x)); |
3376 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__more_information__metadata_parsed__gama Unexecuted instantiation: json_fuzzer.cc:wuffs_base__more_information__metadata_parsed__gama(wuffs_base__more_information__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__more_information__metadata_parsed__gama Unexecuted instantiation: xz_fuzzer.c:wuffs_base__more_information__metadata_parsed__gama Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__more_information__metadata_parsed__gama Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__more_information__metadata_parsed__gama Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__more_information__metadata_parsed__gama Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__more_information__metadata_parsed__gama Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__more_information__metadata_parsed__gama Unexecuted instantiation: targa_fuzzer.c:wuffs_base__more_information__metadata_parsed__gama Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__more_information__metadata_parsed__gama Unexecuted instantiation: webp_fuzzer.c:wuffs_base__more_information__metadata_parsed__gama |
3377 | | |
3378 | | #define WUFFS_BASE__SRGB_RENDERING_INTENT__PERCEPTUAL 0 |
3379 | | #define WUFFS_BASE__SRGB_RENDERING_INTENT__RELATIVE_COLORIMETRIC 1 |
3380 | | #define WUFFS_BASE__SRGB_RENDERING_INTENT__SATURATION 2 |
3381 | | #define WUFFS_BASE__SRGB_RENDERING_INTENT__ABSOLUTE_COLORIMETRIC 3 |
3382 | | |
3383 | | // wuffs_base__more_information__metadata_parsed__srgb returns the sRGB |
3384 | | // rendering intent like the PNG "sRGB" chunk. |
3385 | | static inline uint32_t // |
3386 | | wuffs_base__more_information__metadata_parsed__srgb( |
3387 | 0 | const wuffs_base__more_information* m) { |
3388 | 0 | return m->x & 3; |
3389 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__more_information__metadata_parsed__srgb Unexecuted instantiation: json_fuzzer.cc:wuffs_base__more_information__metadata_parsed__srgb(wuffs_base__more_information__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__more_information__metadata_parsed__srgb Unexecuted instantiation: xz_fuzzer.c:wuffs_base__more_information__metadata_parsed__srgb Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__more_information__metadata_parsed__srgb Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__more_information__metadata_parsed__srgb Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__more_information__metadata_parsed__srgb Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__more_information__metadata_parsed__srgb Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__more_information__metadata_parsed__srgb Unexecuted instantiation: targa_fuzzer.c:wuffs_base__more_information__metadata_parsed__srgb Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__more_information__metadata_parsed__srgb Unexecuted instantiation: webp_fuzzer.c:wuffs_base__more_information__metadata_parsed__srgb |
3390 | | |
3391 | | #ifdef __cplusplus |
3392 | | |
3393 | | inline void // |
3394 | | wuffs_base__more_information::set(uint32_t flavor_arg, |
3395 | | uint32_t w_arg, |
3396 | | uint64_t x_arg, |
3397 | | uint64_t y_arg, |
3398 | 0 | uint64_t z_arg) { |
3399 | 0 | wuffs_base__more_information__set(this, flavor_arg, w_arg, x_arg, y_arg, |
3400 | 0 | z_arg); |
3401 | 0 | } |
3402 | | |
3403 | | inline uint32_t // |
3404 | 0 | wuffs_base__more_information::io_redirect__fourcc() const { |
3405 | 0 | return wuffs_base__more_information__io_redirect__fourcc(this); |
3406 | 0 | } |
3407 | | |
3408 | | inline wuffs_base__range_ie_u64 // |
3409 | 0 | wuffs_base__more_information::io_redirect__range() const { |
3410 | 0 | return wuffs_base__more_information__io_redirect__range(this); |
3411 | 0 | } |
3412 | | |
3413 | | inline uint64_t // |
3414 | 0 | wuffs_base__more_information::io_seek__position() const { |
3415 | 0 | return wuffs_base__more_information__io_seek__position(this); |
3416 | 0 | } |
3417 | | |
3418 | | inline uint32_t // |
3419 | 0 | wuffs_base__more_information::metadata__fourcc() const { |
3420 | 0 | return wuffs_base__more_information__metadata__fourcc(this); |
3421 | 0 | } |
3422 | | |
3423 | | inline wuffs_base__range_ie_u64 // |
3424 | 0 | wuffs_base__more_information::metadata_raw_passthrough__range() const { |
3425 | 0 | return wuffs_base__more_information__metadata_raw_passthrough__range(this); |
3426 | 0 | } |
3427 | | |
3428 | | inline int32_t // |
3429 | 0 | wuffs_base__more_information::metadata_parsed__chrm(uint32_t component) const { |
3430 | 0 | return wuffs_base__more_information__metadata_parsed__chrm(this, component); |
3431 | 0 | } |
3432 | | |
3433 | | inline uint32_t // |
3434 | 0 | wuffs_base__more_information::metadata_parsed__gama() const { |
3435 | 0 | return wuffs_base__more_information__metadata_parsed__gama(this); |
3436 | 0 | } |
3437 | | |
3438 | | inline uint32_t // |
3439 | 0 | wuffs_base__more_information::metadata_parsed__srgb() const { |
3440 | 0 | return wuffs_base__more_information__metadata_parsed__srgb(this); |
3441 | 0 | } |
3442 | | |
3443 | | #endif // __cplusplus |
3444 | | |
3445 | | // ---------------- I/O |
3446 | | // |
3447 | | // See (/doc/note/io-input-output.md). |
3448 | | |
3449 | | // wuffs_base__io_buffer_meta is the metadata for a wuffs_base__io_buffer's |
3450 | | // data. |
3451 | | typedef struct wuffs_base__io_buffer_meta__struct { |
3452 | | size_t wi; // Write index. Invariant: wi <= len. |
3453 | | size_t ri; // Read index. Invariant: ri <= wi. |
3454 | | uint64_t pos; // Buffer position (relative to the start of stream). |
3455 | | bool closed; // No further writes are expected. |
3456 | | } wuffs_base__io_buffer_meta; |
3457 | | |
3458 | | // wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length) plus |
3459 | | // additional metadata. It is a linear buffer, not a circular buffer. |
3460 | | // |
3461 | | // A value with all fields zero is a valid, empty buffer. |
3462 | | typedef struct wuffs_base__io_buffer__struct { |
3463 | | wuffs_base__slice_u8 data; |
3464 | | wuffs_base__io_buffer_meta meta; |
3465 | | |
3466 | | #ifdef __cplusplus |
3467 | | inline bool is_valid() const; |
3468 | | inline size_t compact(); |
3469 | | inline size_t compact_retaining(uint64_t history_retain_length); |
3470 | | inline size_t reader_length() const; |
3471 | | inline uint8_t* reader_pointer() const; |
3472 | | inline uint64_t reader_position() const; |
3473 | | inline wuffs_base__slice_u8 reader_slice() const; |
3474 | | inline size_t writer_length() const; |
3475 | | inline uint8_t* writer_pointer() const; |
3476 | | inline uint64_t writer_position() const; |
3477 | | inline wuffs_base__slice_u8 writer_slice() const; |
3478 | | #endif // __cplusplus |
3479 | | |
3480 | | } wuffs_base__io_buffer; |
3481 | | |
3482 | | static inline wuffs_base__io_buffer // |
3483 | | wuffs_base__make_io_buffer(wuffs_base__slice_u8 data, |
3484 | 0 | wuffs_base__io_buffer_meta meta) { |
3485 | 0 | wuffs_base__io_buffer ret; |
3486 | 0 | ret.data = data; |
3487 | 0 | ret.meta = meta; |
3488 | 0 | return ret; |
3489 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_io_buffer Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_io_buffer(wuffs_base__slice_u8, wuffs_base__io_buffer_meta__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_io_buffer Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_io_buffer Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_io_buffer Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_io_buffer Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_io_buffer Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_io_buffer Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_io_buffer Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_io_buffer Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_io_buffer Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_io_buffer |
3490 | | |
3491 | | static inline wuffs_base__io_buffer_meta // |
3492 | | wuffs_base__make_io_buffer_meta(size_t wi, |
3493 | | size_t ri, |
3494 | | uint64_t pos, |
3495 | 0 | bool closed) { |
3496 | 0 | wuffs_base__io_buffer_meta ret; |
3497 | 0 | ret.wi = wi; |
3498 | 0 | ret.ri = ri; |
3499 | 0 | ret.pos = pos; |
3500 | 0 | ret.closed = closed; |
3501 | 0 | return ret; |
3502 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_io_buffer_meta Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_io_buffer_meta(unsigned long, unsigned long, unsigned long, bool) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_io_buffer_meta Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_io_buffer_meta Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_io_buffer_meta Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_io_buffer_meta Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_io_buffer_meta Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_io_buffer_meta Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_io_buffer_meta Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_io_buffer_meta Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_io_buffer_meta Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_io_buffer_meta |
3503 | | |
3504 | | static inline wuffs_base__io_buffer // |
3505 | 50.4k | wuffs_base__ptr_u8__reader(uint8_t* ptr, size_t len, bool closed) { |
3506 | 50.4k | wuffs_base__io_buffer ret; |
3507 | 50.4k | ret.data.ptr = ptr; |
3508 | 50.4k | ret.data.len = len; |
3509 | 50.4k | ret.meta.wi = len; |
3510 | 50.4k | ret.meta.ri = 0; |
3511 | 50.4k | ret.meta.pos = 0; |
3512 | 50.4k | ret.meta.closed = closed; |
3513 | 50.4k | return ret; |
3514 | 50.4k | } png_fuzzer.c:wuffs_base__ptr_u8__reader Line | Count | Source | 3505 | 6.12k | wuffs_base__ptr_u8__reader(uint8_t* ptr, size_t len, bool closed) { | 3506 | 6.12k | wuffs_base__io_buffer ret; | 3507 | 6.12k | ret.data.ptr = ptr; | 3508 | 6.12k | ret.data.len = len; | 3509 | 6.12k | ret.meta.wi = len; | 3510 | 6.12k | ret.meta.ri = 0; | 3511 | 6.12k | ret.meta.pos = 0; | 3512 | 6.12k | ret.meta.closed = closed; | 3513 | 6.12k | return ret; | 3514 | 6.12k | } |
json_fuzzer.cc:wuffs_base__ptr_u8__reader(unsigned char*, unsigned long, bool) Line | Count | Source | 3505 | 12.2k | wuffs_base__ptr_u8__reader(uint8_t* ptr, size_t len, bool closed) { | 3506 | 12.2k | wuffs_base__io_buffer ret; | 3507 | 12.2k | ret.data.ptr = ptr; | 3508 | 12.2k | ret.data.len = len; | 3509 | 12.2k | ret.meta.wi = len; | 3510 | 12.2k | ret.meta.ri = 0; | 3511 | 12.2k | ret.meta.pos = 0; | 3512 | 12.2k | ret.meta.closed = closed; | 3513 | 12.2k | return ret; | 3514 | 12.2k | } |
gif_fuzzer.c:wuffs_base__ptr_u8__reader Line | Count | Source | 3505 | 2.34k | wuffs_base__ptr_u8__reader(uint8_t* ptr, size_t len, bool closed) { | 3506 | 2.34k | wuffs_base__io_buffer ret; | 3507 | 2.34k | ret.data.ptr = ptr; | 3508 | 2.34k | ret.data.len = len; | 3509 | 2.34k | ret.meta.wi = len; | 3510 | 2.34k | ret.meta.ri = 0; | 3511 | 2.34k | ret.meta.pos = 0; | 3512 | 2.34k | ret.meta.closed = closed; | 3513 | 2.34k | return ret; | 3514 | 2.34k | } |
xz_fuzzer.c:wuffs_base__ptr_u8__reader Line | Count | Source | 3505 | 8.44k | wuffs_base__ptr_u8__reader(uint8_t* ptr, size_t len, bool closed) { | 3506 | 8.44k | wuffs_base__io_buffer ret; | 3507 | 8.44k | ret.data.ptr = ptr; | 3508 | 8.44k | ret.data.len = len; | 3509 | 8.44k | ret.meta.wi = len; | 3510 | 8.44k | ret.meta.ri = 0; | 3511 | 8.44k | ret.meta.pos = 0; | 3512 | 8.44k | ret.meta.closed = closed; | 3513 | 8.44k | return ret; | 3514 | 8.44k | } |
jpeg_fuzzer.c:wuffs_base__ptr_u8__reader Line | Count | Source | 3505 | 3.92k | wuffs_base__ptr_u8__reader(uint8_t* ptr, size_t len, bool closed) { | 3506 | 3.92k | wuffs_base__io_buffer ret; | 3507 | 3.92k | ret.data.ptr = ptr; | 3508 | 3.92k | ret.data.len = len; | 3509 | 3.92k | ret.meta.wi = len; | 3510 | 3.92k | ret.meta.ri = 0; | 3511 | 3.92k | ret.meta.pos = 0; | 3512 | 3.92k | ret.meta.closed = closed; | 3513 | 3.92k | return ret; | 3514 | 3.92k | } |
cbor_fuzzer.c:wuffs_base__ptr_u8__reader Line | Count | Source | 3505 | 2.18k | wuffs_base__ptr_u8__reader(uint8_t* ptr, size_t len, bool closed) { | 3506 | 2.18k | wuffs_base__io_buffer ret; | 3507 | 2.18k | ret.data.ptr = ptr; | 3508 | 2.18k | ret.data.len = len; | 3509 | 2.18k | ret.meta.wi = len; | 3510 | 2.18k | ret.meta.ri = 0; | 3511 | 2.18k | ret.meta.pos = 0; | 3512 | 2.18k | ret.meta.closed = closed; | 3513 | 2.18k | return ret; | 3514 | 2.18k | } |
bmp_fuzzer.c:wuffs_base__ptr_u8__reader Line | Count | Source | 3505 | 3.18k | wuffs_base__ptr_u8__reader(uint8_t* ptr, size_t len, bool closed) { | 3506 | 3.18k | wuffs_base__io_buffer ret; | 3507 | 3.18k | ret.data.ptr = ptr; | 3508 | 3.18k | ret.data.len = len; | 3509 | 3.18k | ret.meta.wi = len; | 3510 | 3.18k | ret.meta.ri = 0; | 3511 | 3.18k | ret.meta.pos = 0; | 3512 | 3.18k | ret.meta.closed = closed; | 3513 | 3.18k | return ret; | 3514 | 3.18k | } |
pixel_swizzler_fuzzer.c:wuffs_base__ptr_u8__reader Line | Count | Source | 3505 | 3.29k | wuffs_base__ptr_u8__reader(uint8_t* ptr, size_t len, bool closed) { | 3506 | 3.29k | wuffs_base__io_buffer ret; | 3507 | 3.29k | ret.data.ptr = ptr; | 3508 | 3.29k | ret.data.len = len; | 3509 | 3.29k | ret.meta.wi = len; | 3510 | 3.29k | ret.meta.ri = 0; | 3511 | 3.29k | ret.meta.pos = 0; | 3512 | 3.29k | ret.meta.closed = closed; | 3513 | 3.29k | return ret; | 3514 | 3.29k | } |
zlib_fuzzer.c:wuffs_base__ptr_u8__reader Line | Count | Source | 3505 | 1.37k | wuffs_base__ptr_u8__reader(uint8_t* ptr, size_t len, bool closed) { | 3506 | 1.37k | wuffs_base__io_buffer ret; | 3507 | 1.37k | ret.data.ptr = ptr; | 3508 | 1.37k | ret.data.len = len; | 3509 | 1.37k | ret.meta.wi = len; | 3510 | 1.37k | ret.meta.ri = 0; | 3511 | 1.37k | ret.meta.pos = 0; | 3512 | 1.37k | ret.meta.closed = closed; | 3513 | 1.37k | return ret; | 3514 | 1.37k | } |
targa_fuzzer.c:wuffs_base__ptr_u8__reader Line | Count | Source | 3505 | 1.17k | wuffs_base__ptr_u8__reader(uint8_t* ptr, size_t len, bool closed) { | 3506 | 1.17k | wuffs_base__io_buffer ret; | 3507 | 1.17k | ret.data.ptr = ptr; | 3508 | 1.17k | ret.data.len = len; | 3509 | 1.17k | ret.meta.wi = len; | 3510 | 1.17k | ret.meta.ri = 0; | 3511 | 1.17k | ret.meta.pos = 0; | 3512 | 1.17k | ret.meta.closed = closed; | 3513 | 1.17k | return ret; | 3514 | 1.17k | } |
bzip2_fuzzer.c:wuffs_base__ptr_u8__reader Line | Count | Source | 3505 | 1.24k | wuffs_base__ptr_u8__reader(uint8_t* ptr, size_t len, bool closed) { | 3506 | 1.24k | wuffs_base__io_buffer ret; | 3507 | 1.24k | ret.data.ptr = ptr; | 3508 | 1.24k | ret.data.len = len; | 3509 | 1.24k | ret.meta.wi = len; | 3510 | 1.24k | ret.meta.ri = 0; | 3511 | 1.24k | ret.meta.pos = 0; | 3512 | 1.24k | ret.meta.closed = closed; | 3513 | 1.24k | return ret; | 3514 | 1.24k | } |
webp_fuzzer.c:wuffs_base__ptr_u8__reader Line | Count | Source | 3505 | 4.98k | wuffs_base__ptr_u8__reader(uint8_t* ptr, size_t len, bool closed) { | 3506 | 4.98k | wuffs_base__io_buffer ret; | 3507 | 4.98k | ret.data.ptr = ptr; | 3508 | 4.98k | ret.data.len = len; | 3509 | 4.98k | ret.meta.wi = len; | 3510 | 4.98k | ret.meta.ri = 0; | 3511 | 4.98k | ret.meta.pos = 0; | 3512 | 4.98k | ret.meta.closed = closed; | 3513 | 4.98k | return ret; | 3514 | 4.98k | } |
|
3515 | | |
3516 | | static inline wuffs_base__io_buffer // |
3517 | 11.0k | wuffs_base__ptr_u8__writer(uint8_t* ptr, size_t len) { |
3518 | 11.0k | wuffs_base__io_buffer ret; |
3519 | 11.0k | ret.data.ptr = ptr; |
3520 | 11.0k | ret.data.len = len; |
3521 | 11.0k | ret.meta.wi = 0; |
3522 | 11.0k | ret.meta.ri = 0; |
3523 | 11.0k | ret.meta.pos = 0; |
3524 | 11.0k | ret.meta.closed = false; |
3525 | 11.0k | return ret; |
3526 | 11.0k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__ptr_u8__writer Unexecuted instantiation: json_fuzzer.cc:wuffs_base__ptr_u8__writer(unsigned char*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__ptr_u8__writer xz_fuzzer.c:wuffs_base__ptr_u8__writer Line | Count | Source | 3517 | 8.44k | wuffs_base__ptr_u8__writer(uint8_t* ptr, size_t len) { | 3518 | 8.44k | wuffs_base__io_buffer ret; | 3519 | 8.44k | ret.data.ptr = ptr; | 3520 | 8.44k | ret.data.len = len; | 3521 | 8.44k | ret.meta.wi = 0; | 3522 | 8.44k | ret.meta.ri = 0; | 3523 | 8.44k | ret.meta.pos = 0; | 3524 | | ret.meta.closed = false; | 3525 | 8.44k | return ret; | 3526 | 8.44k | } |
Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__ptr_u8__writer Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__ptr_u8__writer Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__ptr_u8__writer Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__ptr_u8__writer zlib_fuzzer.c:wuffs_base__ptr_u8__writer Line | Count | Source | 3517 | 1.37k | wuffs_base__ptr_u8__writer(uint8_t* ptr, size_t len) { | 3518 | 1.37k | wuffs_base__io_buffer ret; | 3519 | 1.37k | ret.data.ptr = ptr; | 3520 | 1.37k | ret.data.len = len; | 3521 | 1.37k | ret.meta.wi = 0; | 3522 | 1.37k | ret.meta.ri = 0; | 3523 | 1.37k | ret.meta.pos = 0; | 3524 | | ret.meta.closed = false; | 3525 | 1.37k | return ret; | 3526 | 1.37k | } |
Unexecuted instantiation: targa_fuzzer.c:wuffs_base__ptr_u8__writer bzip2_fuzzer.c:wuffs_base__ptr_u8__writer Line | Count | Source | 3517 | 1.24k | wuffs_base__ptr_u8__writer(uint8_t* ptr, size_t len) { | 3518 | 1.24k | wuffs_base__io_buffer ret; | 3519 | 1.24k | ret.data.ptr = ptr; | 3520 | 1.24k | ret.data.len = len; | 3521 | 1.24k | ret.meta.wi = 0; | 3522 | 1.24k | ret.meta.ri = 0; | 3523 | 1.24k | ret.meta.pos = 0; | 3524 | | ret.meta.closed = false; | 3525 | 1.24k | return ret; | 3526 | 1.24k | } |
Unexecuted instantiation: webp_fuzzer.c:wuffs_base__ptr_u8__writer |
3527 | | |
3528 | | static inline wuffs_base__io_buffer // |
3529 | 0 | wuffs_base__slice_u8__reader(wuffs_base__slice_u8 s, bool closed) { |
3530 | 0 | wuffs_base__io_buffer ret; |
3531 | 0 | ret.data.ptr = s.ptr; |
3532 | 0 | ret.data.len = s.len; |
3533 | 0 | ret.meta.wi = s.len; |
3534 | 0 | ret.meta.ri = 0; |
3535 | 0 | ret.meta.pos = 0; |
3536 | 0 | ret.meta.closed = closed; |
3537 | 0 | return ret; |
3538 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__slice_u8__reader Unexecuted instantiation: json_fuzzer.cc:wuffs_base__slice_u8__reader(wuffs_base__slice_u8, bool) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__slice_u8__reader Unexecuted instantiation: xz_fuzzer.c:wuffs_base__slice_u8__reader Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__slice_u8__reader Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__slice_u8__reader Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__slice_u8__reader Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__slice_u8__reader Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__slice_u8__reader Unexecuted instantiation: targa_fuzzer.c:wuffs_base__slice_u8__reader Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__slice_u8__reader Unexecuted instantiation: webp_fuzzer.c:wuffs_base__slice_u8__reader |
3539 | | |
3540 | | static inline wuffs_base__io_buffer // |
3541 | 0 | wuffs_base__slice_u8__writer(wuffs_base__slice_u8 s) { |
3542 | 0 | wuffs_base__io_buffer ret; |
3543 | 0 | ret.data.ptr = s.ptr; |
3544 | 0 | ret.data.len = s.len; |
3545 | 0 | ret.meta.wi = 0; |
3546 | 0 | ret.meta.ri = 0; |
3547 | 0 | ret.meta.pos = 0; |
3548 | 0 | ret.meta.closed = false; |
3549 | 0 | return ret; |
3550 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__slice_u8__writer Unexecuted instantiation: json_fuzzer.cc:wuffs_base__slice_u8__writer(wuffs_base__slice_u8) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__slice_u8__writer Unexecuted instantiation: xz_fuzzer.c:wuffs_base__slice_u8__writer Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__slice_u8__writer Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__slice_u8__writer Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__slice_u8__writer Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__slice_u8__writer Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__slice_u8__writer Unexecuted instantiation: targa_fuzzer.c:wuffs_base__slice_u8__writer Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__slice_u8__writer Unexecuted instantiation: webp_fuzzer.c:wuffs_base__slice_u8__writer |
3551 | | |
3552 | | static inline wuffs_base__io_buffer // |
3553 | 24.0M | wuffs_base__empty_io_buffer(void) { |
3554 | 24.0M | wuffs_base__io_buffer ret; |
3555 | 24.0M | ret.data.ptr = NULL; |
3556 | 24.0M | ret.data.len = 0; |
3557 | 24.0M | ret.meta.wi = 0; |
3558 | 24.0M | ret.meta.ri = 0; |
3559 | 24.0M | ret.meta.pos = 0; |
3560 | 24.0M | ret.meta.closed = false; |
3561 | 24.0M | return ret; |
3562 | 24.0M | } png_fuzzer.c:wuffs_base__empty_io_buffer Line | Count | Source | 3553 | 10.7k | wuffs_base__empty_io_buffer(void) { | 3554 | 10.7k | wuffs_base__io_buffer ret; | 3555 | 10.7k | ret.data.ptr = NULL; | 3556 | 10.7k | ret.data.len = 0; | 3557 | 10.7k | ret.meta.wi = 0; | 3558 | 10.7k | ret.meta.ri = 0; | 3559 | 10.7k | ret.meta.pos = 0; | 3560 | | ret.meta.closed = false; | 3561 | 10.7k | return ret; | 3562 | 10.7k | } |
json_fuzzer.cc:wuffs_base__empty_io_buffer() Line | Count | Source | 3553 | 6.11k | wuffs_base__empty_io_buffer(void) { | 3554 | 6.11k | wuffs_base__io_buffer ret; | 3555 | | ret.data.ptr = NULL; | 3556 | 6.11k | ret.data.len = 0; | 3557 | 6.11k | ret.meta.wi = 0; | 3558 | 6.11k | ret.meta.ri = 0; | 3559 | 6.11k | ret.meta.pos = 0; | 3560 | 6.11k | ret.meta.closed = false; | 3561 | 6.11k | return ret; | 3562 | 6.11k | } |
gif_fuzzer.c:wuffs_base__empty_io_buffer Line | Count | Source | 3553 | 259k | wuffs_base__empty_io_buffer(void) { | 3554 | 259k | wuffs_base__io_buffer ret; | 3555 | 259k | ret.data.ptr = NULL; | 3556 | 259k | ret.data.len = 0; | 3557 | 259k | ret.meta.wi = 0; | 3558 | 259k | ret.meta.ri = 0; | 3559 | 259k | ret.meta.pos = 0; | 3560 | | ret.meta.closed = false; | 3561 | 259k | return ret; | 3562 | 259k | } |
xz_fuzzer.c:wuffs_base__empty_io_buffer Line | Count | Source | 3553 | 147 | wuffs_base__empty_io_buffer(void) { | 3554 | 147 | wuffs_base__io_buffer ret; | 3555 | 147 | ret.data.ptr = NULL; | 3556 | 147 | ret.data.len = 0; | 3557 | 147 | ret.meta.wi = 0; | 3558 | 147 | ret.meta.ri = 0; | 3559 | 147 | ret.meta.pos = 0; | 3560 | | ret.meta.closed = false; | 3561 | 147 | return ret; | 3562 | 147 | } |
jpeg_fuzzer.c:wuffs_base__empty_io_buffer Line | Count | Source | 3553 | 23.7M | wuffs_base__empty_io_buffer(void) { | 3554 | 23.7M | wuffs_base__io_buffer ret; | 3555 | 23.7M | ret.data.ptr = NULL; | 3556 | 23.7M | ret.data.len = 0; | 3557 | 23.7M | ret.meta.wi = 0; | 3558 | 23.7M | ret.meta.ri = 0; | 3559 | 23.7M | ret.meta.pos = 0; | 3560 | | ret.meta.closed = false; | 3561 | 23.7M | return ret; | 3562 | 23.7M | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_io_buffer Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_io_buffer Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_io_buffer Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_io_buffer Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_io_buffer Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_io_buffer Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_io_buffer |
3563 | | |
3564 | | static inline wuffs_base__io_buffer_meta // |
3565 | 0 | wuffs_base__empty_io_buffer_meta(void) { |
3566 | 0 | wuffs_base__io_buffer_meta ret; |
3567 | 0 | ret.wi = 0; |
3568 | 0 | ret.ri = 0; |
3569 | 0 | ret.pos = 0; |
3570 | 0 | ret.closed = false; |
3571 | 0 | return ret; |
3572 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_io_buffer_meta Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_io_buffer_meta() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_io_buffer_meta Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_io_buffer_meta Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_io_buffer_meta Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_io_buffer_meta Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_io_buffer_meta Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_io_buffer_meta Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_io_buffer_meta Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_io_buffer_meta Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_io_buffer_meta Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_io_buffer_meta |
3573 | | |
3574 | | static inline bool // |
3575 | 0 | wuffs_base__io_buffer__is_valid(const wuffs_base__io_buffer* buf) { |
3576 | 0 | if (buf) { |
3577 | 0 | if (buf->data.ptr) { |
3578 | 0 | return (buf->meta.ri <= buf->meta.wi) && (buf->meta.wi <= buf->data.len); |
3579 | 0 | } else { |
3580 | 0 | return (buf->meta.ri == 0) && (buf->meta.wi == 0) && (buf->data.len == 0); |
3581 | 0 | } |
3582 | 0 | } |
3583 | 0 | return false; |
3584 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__io_buffer__is_valid Unexecuted instantiation: json_fuzzer.cc:wuffs_base__io_buffer__is_valid(wuffs_base__io_buffer__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__io_buffer__is_valid Unexecuted instantiation: xz_fuzzer.c:wuffs_base__io_buffer__is_valid Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__io_buffer__is_valid Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__io_buffer__is_valid Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__io_buffer__is_valid Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__io_buffer__is_valid Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__io_buffer__is_valid Unexecuted instantiation: targa_fuzzer.c:wuffs_base__io_buffer__is_valid Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__io_buffer__is_valid Unexecuted instantiation: webp_fuzzer.c:wuffs_base__io_buffer__is_valid |
3585 | | |
3586 | | // wuffs_base__io_buffer__compact moves any written but unread bytes to the |
3587 | | // start of the buffer. |
3588 | | // |
3589 | | // It returns the increase in the writer length: how much meta.wi fell by. |
3590 | | static inline size_t // |
3591 | 0 | wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { |
3592 | 0 | if (!buf || (buf->meta.ri == 0)) { |
3593 | 0 | return 0; |
3594 | 0 | } |
3595 | 0 | size_t old_ri = buf->meta.ri; |
3596 | 0 | buf->meta.pos = wuffs_base__u64__sat_add(buf->meta.pos, buf->meta.ri); |
3597 | 0 | size_t new_wi = buf->meta.wi - buf->meta.ri; |
3598 | 0 | if (new_wi != 0) { |
3599 | 0 | memmove(buf->data.ptr, buf->data.ptr + buf->meta.ri, new_wi); |
3600 | 0 | } |
3601 | 0 | buf->meta.wi = new_wi; |
3602 | 0 | buf->meta.ri = 0; |
3603 | 0 | return old_ri; |
3604 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__io_buffer__compact Unexecuted instantiation: json_fuzzer.cc:wuffs_base__io_buffer__compact(wuffs_base__io_buffer__struct*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__io_buffer__compact Unexecuted instantiation: xz_fuzzer.c:wuffs_base__io_buffer__compact Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__io_buffer__compact Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__io_buffer__compact Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__io_buffer__compact Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__io_buffer__compact Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__io_buffer__compact Unexecuted instantiation: targa_fuzzer.c:wuffs_base__io_buffer__compact Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__io_buffer__compact Unexecuted instantiation: webp_fuzzer.c:wuffs_base__io_buffer__compact |
3605 | | |
3606 | | // wuffs_base__io_buffer__compact_retaining moves any written but unread bytes |
3607 | | // closer to the start of the buffer. It retains H bytes of history (the most |
3608 | | // recently read bytes), where H is min(buf->meta.ri, history_retain_length). |
3609 | | // It is therefore a no-op if history_retain_length is UINT64_MAX. A |
3610 | | // postcondition is that buf->meta.ri == H. |
3611 | | // |
3612 | | // It returns the increase in the writer length: how much meta.wi fell by. |
3613 | | // |
3614 | | // wuffs_base__io_buffer__compact_retaining(0) is equivalent to |
3615 | | // wuffs_base__io_buffer__compact(). |
3616 | | // |
3617 | | // For example, if buf started like this: |
3618 | | // |
3619 | | // +--- ri = 3 |
3620 | | // v |
3621 | | // abcdefgh?? len = 10, pos = 900 |
3622 | | // ^ |
3623 | | // +--- wi = 8 |
3624 | | // |
3625 | | // Then, depending on history_retain_length, the resultant buf would be: |
3626 | | // |
3627 | | // HRL = 0 defgh????? ri = 0 wi = 5 pos = 903 return = 3 |
3628 | | // HRL = 1 cdefgh???? ri = 1 wi = 6 pos = 902 return = 2 |
3629 | | // HRL = 2 bcdefgh??? ri = 2 wi = 7 pos = 901 return = 1 |
3630 | | // HRL = 3 abcdefgh?? ri = 3 wi = 8 pos = 900 return = 0 |
3631 | | // HRL = 4+ abcdefgh?? ri = 3 wi = 8 pos = 900 return = 0 |
3632 | | static inline size_t // |
3633 | | wuffs_base__io_buffer__compact_retaining(wuffs_base__io_buffer* buf, |
3634 | 0 | uint64_t history_retain_length) { |
3635 | 0 | if (!buf || (buf->meta.ri == 0)) { |
3636 | 0 | return 0; |
3637 | 0 | } |
3638 | 0 | size_t old_ri = buf->meta.ri; |
3639 | 0 | size_t new_ri = (size_t)(wuffs_base__u64__min(old_ri, history_retain_length)); |
3640 | 0 | size_t memmove_start = old_ri - new_ri; |
3641 | 0 | buf->meta.pos = wuffs_base__u64__sat_add(buf->meta.pos, memmove_start); |
3642 | 0 | size_t new_wi = buf->meta.wi - memmove_start; |
3643 | 0 | if ((new_wi != 0) && (memmove_start != 0)) { |
3644 | 0 | memmove(buf->data.ptr, buf->data.ptr + memmove_start, new_wi); |
3645 | 0 | } |
3646 | 0 | buf->meta.wi = new_wi; |
3647 | 0 | buf->meta.ri = new_ri; |
3648 | 0 | return memmove_start; |
3649 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__io_buffer__compact_retaining Unexecuted instantiation: json_fuzzer.cc:wuffs_base__io_buffer__compact_retaining(wuffs_base__io_buffer__struct*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__io_buffer__compact_retaining Unexecuted instantiation: xz_fuzzer.c:wuffs_base__io_buffer__compact_retaining Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__io_buffer__compact_retaining Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__io_buffer__compact_retaining Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__io_buffer__compact_retaining Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__io_buffer__compact_retaining Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__io_buffer__compact_retaining Unexecuted instantiation: targa_fuzzer.c:wuffs_base__io_buffer__compact_retaining Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__io_buffer__compact_retaining Unexecuted instantiation: webp_fuzzer.c:wuffs_base__io_buffer__compact_retaining |
3650 | | |
3651 | | static inline size_t // |
3652 | 6.11k | wuffs_base__io_buffer__reader_length(const wuffs_base__io_buffer* buf) { |
3653 | 6.11k | return buf ? buf->meta.wi - buf->meta.ri : 0; |
3654 | 6.11k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__io_buffer__reader_length json_fuzzer.cc:wuffs_base__io_buffer__reader_length(wuffs_base__io_buffer__struct const*) Line | Count | Source | 3652 | 6.11k | wuffs_base__io_buffer__reader_length(const wuffs_base__io_buffer* buf) { | 3653 | 6.11k | return buf ? buf->meta.wi - buf->meta.ri : 0; | 3654 | 6.11k | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__io_buffer__reader_length Unexecuted instantiation: xz_fuzzer.c:wuffs_base__io_buffer__reader_length Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__io_buffer__reader_length Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__io_buffer__reader_length Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__io_buffer__reader_length Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__io_buffer__reader_length Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__io_buffer__reader_length Unexecuted instantiation: targa_fuzzer.c:wuffs_base__io_buffer__reader_length Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__io_buffer__reader_length Unexecuted instantiation: webp_fuzzer.c:wuffs_base__io_buffer__reader_length |
3655 | | |
3656 | | static inline uint8_t* // |
3657 | 6.11k | wuffs_base__io_buffer__reader_pointer(const wuffs_base__io_buffer* buf) { |
3658 | 6.11k | return (buf && buf->data.ptr) ? (buf->data.ptr + buf->meta.ri) : NULL; |
3659 | 6.11k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__io_buffer__reader_pointer json_fuzzer.cc:wuffs_base__io_buffer__reader_pointer(wuffs_base__io_buffer__struct const*) Line | Count | Source | 3657 | 6.11k | wuffs_base__io_buffer__reader_pointer(const wuffs_base__io_buffer* buf) { | 3658 | 6.11k | return (buf && buf->data.ptr) ? (buf->data.ptr + buf->meta.ri) : NULL; | 3659 | 6.11k | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__io_buffer__reader_pointer Unexecuted instantiation: xz_fuzzer.c:wuffs_base__io_buffer__reader_pointer Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__io_buffer__reader_pointer Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__io_buffer__reader_pointer Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__io_buffer__reader_pointer Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__io_buffer__reader_pointer Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__io_buffer__reader_pointer Unexecuted instantiation: targa_fuzzer.c:wuffs_base__io_buffer__reader_pointer Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__io_buffer__reader_pointer Unexecuted instantiation: webp_fuzzer.c:wuffs_base__io_buffer__reader_pointer |
3660 | | |
3661 | | static inline uint64_t // |
3662 | 0 | wuffs_base__io_buffer__reader_position(const wuffs_base__io_buffer* buf) { |
3663 | 0 | return buf ? wuffs_base__u64__sat_add(buf->meta.pos, buf->meta.ri) : 0; |
3664 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__io_buffer__reader_position Unexecuted instantiation: json_fuzzer.cc:wuffs_base__io_buffer__reader_position(wuffs_base__io_buffer__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__io_buffer__reader_position Unexecuted instantiation: xz_fuzzer.c:wuffs_base__io_buffer__reader_position Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__io_buffer__reader_position Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__io_buffer__reader_position Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__io_buffer__reader_position Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__io_buffer__reader_position Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__io_buffer__reader_position Unexecuted instantiation: targa_fuzzer.c:wuffs_base__io_buffer__reader_position Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__io_buffer__reader_position Unexecuted instantiation: webp_fuzzer.c:wuffs_base__io_buffer__reader_position |
3665 | | |
3666 | | static inline wuffs_base__slice_u8 // |
3667 | 0 | wuffs_base__io_buffer__reader_slice(const wuffs_base__io_buffer* buf) { |
3668 | 0 | return (buf && buf->data.ptr) |
3669 | 0 | ? wuffs_base__make_slice_u8(buf->data.ptr + buf->meta.ri, |
3670 | 0 | buf->meta.wi - buf->meta.ri) |
3671 | 0 | : wuffs_base__empty_slice_u8(); |
3672 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__io_buffer__reader_slice Unexecuted instantiation: json_fuzzer.cc:wuffs_base__io_buffer__reader_slice(wuffs_base__io_buffer__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__io_buffer__reader_slice Unexecuted instantiation: xz_fuzzer.c:wuffs_base__io_buffer__reader_slice Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__io_buffer__reader_slice Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__io_buffer__reader_slice Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__io_buffer__reader_slice Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__io_buffer__reader_slice Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__io_buffer__reader_slice Unexecuted instantiation: targa_fuzzer.c:wuffs_base__io_buffer__reader_slice Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__io_buffer__reader_slice Unexecuted instantiation: webp_fuzzer.c:wuffs_base__io_buffer__reader_slice |
3673 | | |
3674 | | static inline size_t // |
3675 | 0 | wuffs_base__io_buffer__writer_length(const wuffs_base__io_buffer* buf) { |
3676 | 0 | return buf ? buf->data.len - buf->meta.wi : 0; |
3677 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__io_buffer__writer_length Unexecuted instantiation: json_fuzzer.cc:wuffs_base__io_buffer__writer_length(wuffs_base__io_buffer__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__io_buffer__writer_length Unexecuted instantiation: xz_fuzzer.c:wuffs_base__io_buffer__writer_length Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__io_buffer__writer_length Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__io_buffer__writer_length Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__io_buffer__writer_length Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__io_buffer__writer_length Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__io_buffer__writer_length Unexecuted instantiation: targa_fuzzer.c:wuffs_base__io_buffer__writer_length Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__io_buffer__writer_length Unexecuted instantiation: webp_fuzzer.c:wuffs_base__io_buffer__writer_length |
3678 | | |
3679 | | static inline uint8_t* // |
3680 | 0 | wuffs_base__io_buffer__writer_pointer(const wuffs_base__io_buffer* buf) { |
3681 | 0 | return (buf && buf->data.ptr) ? (buf->data.ptr + buf->meta.wi) : NULL; |
3682 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__io_buffer__writer_pointer Unexecuted instantiation: json_fuzzer.cc:wuffs_base__io_buffer__writer_pointer(wuffs_base__io_buffer__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__io_buffer__writer_pointer Unexecuted instantiation: xz_fuzzer.c:wuffs_base__io_buffer__writer_pointer Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__io_buffer__writer_pointer Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__io_buffer__writer_pointer Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__io_buffer__writer_pointer Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__io_buffer__writer_pointer Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__io_buffer__writer_pointer Unexecuted instantiation: targa_fuzzer.c:wuffs_base__io_buffer__writer_pointer Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__io_buffer__writer_pointer Unexecuted instantiation: webp_fuzzer.c:wuffs_base__io_buffer__writer_pointer |
3683 | | |
3684 | | static inline uint64_t // |
3685 | 0 | wuffs_base__io_buffer__writer_position(const wuffs_base__io_buffer* buf) { |
3686 | 0 | return buf ? wuffs_base__u64__sat_add(buf->meta.pos, buf->meta.wi) : 0; |
3687 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__io_buffer__writer_position Unexecuted instantiation: json_fuzzer.cc:wuffs_base__io_buffer__writer_position(wuffs_base__io_buffer__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__io_buffer__writer_position Unexecuted instantiation: xz_fuzzer.c:wuffs_base__io_buffer__writer_position Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__io_buffer__writer_position Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__io_buffer__writer_position Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__io_buffer__writer_position Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__io_buffer__writer_position Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__io_buffer__writer_position Unexecuted instantiation: targa_fuzzer.c:wuffs_base__io_buffer__writer_position Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__io_buffer__writer_position Unexecuted instantiation: webp_fuzzer.c:wuffs_base__io_buffer__writer_position |
3688 | | |
3689 | | static inline wuffs_base__slice_u8 // |
3690 | 0 | wuffs_base__io_buffer__writer_slice(const wuffs_base__io_buffer* buf) { |
3691 | 0 | return (buf && buf->data.ptr) |
3692 | 0 | ? wuffs_base__make_slice_u8(buf->data.ptr + buf->meta.wi, |
3693 | 0 | buf->data.len - buf->meta.wi) |
3694 | 0 | : wuffs_base__empty_slice_u8(); |
3695 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__io_buffer__writer_slice Unexecuted instantiation: json_fuzzer.cc:wuffs_base__io_buffer__writer_slice(wuffs_base__io_buffer__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__io_buffer__writer_slice Unexecuted instantiation: xz_fuzzer.c:wuffs_base__io_buffer__writer_slice Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__io_buffer__writer_slice Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__io_buffer__writer_slice Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__io_buffer__writer_slice Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__io_buffer__writer_slice Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__io_buffer__writer_slice Unexecuted instantiation: targa_fuzzer.c:wuffs_base__io_buffer__writer_slice Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__io_buffer__writer_slice Unexecuted instantiation: webp_fuzzer.c:wuffs_base__io_buffer__writer_slice |
3696 | | |
3697 | | #ifdef __cplusplus |
3698 | | |
3699 | | inline bool // |
3700 | 0 | wuffs_base__io_buffer::is_valid() const { |
3701 | 0 | return wuffs_base__io_buffer__is_valid(this); |
3702 | 0 | } |
3703 | | |
3704 | | inline size_t // |
3705 | 0 | wuffs_base__io_buffer::compact() { |
3706 | 0 | return wuffs_base__io_buffer__compact(this); |
3707 | 0 | } |
3708 | | |
3709 | | inline size_t // |
3710 | 0 | wuffs_base__io_buffer::compact_retaining(uint64_t history_retain_length) { |
3711 | 0 | return wuffs_base__io_buffer__compact_retaining(this, history_retain_length); |
3712 | 0 | } |
3713 | | |
3714 | | inline size_t // |
3715 | 6.11k | wuffs_base__io_buffer::reader_length() const { |
3716 | 6.11k | return wuffs_base__io_buffer__reader_length(this); |
3717 | 6.11k | } |
3718 | | |
3719 | | inline uint8_t* // |
3720 | 6.11k | wuffs_base__io_buffer::reader_pointer() const { |
3721 | 6.11k | return wuffs_base__io_buffer__reader_pointer(this); |
3722 | 6.11k | } |
3723 | | |
3724 | | inline uint64_t // |
3725 | 0 | wuffs_base__io_buffer::reader_position() const { |
3726 | 0 | return wuffs_base__io_buffer__reader_position(this); |
3727 | 0 | } |
3728 | | |
3729 | | inline wuffs_base__slice_u8 // |
3730 | 0 | wuffs_base__io_buffer::reader_slice() const { |
3731 | 0 | return wuffs_base__io_buffer__reader_slice(this); |
3732 | 0 | } |
3733 | | |
3734 | | inline size_t // |
3735 | 0 | wuffs_base__io_buffer::writer_length() const { |
3736 | 0 | return wuffs_base__io_buffer__writer_length(this); |
3737 | 0 | } |
3738 | | |
3739 | | inline uint8_t* // |
3740 | 0 | wuffs_base__io_buffer::writer_pointer() const { |
3741 | 0 | return wuffs_base__io_buffer__writer_pointer(this); |
3742 | 0 | } |
3743 | | |
3744 | | inline uint64_t // |
3745 | 0 | wuffs_base__io_buffer::writer_position() const { |
3746 | 0 | return wuffs_base__io_buffer__writer_position(this); |
3747 | 0 | } |
3748 | | |
3749 | | inline wuffs_base__slice_u8 // |
3750 | 0 | wuffs_base__io_buffer::writer_slice() const { |
3751 | 0 | return wuffs_base__io_buffer__writer_slice(this); |
3752 | 0 | } |
3753 | | |
3754 | | #endif // __cplusplus |
3755 | | |
3756 | | // ---------------- Tokens |
3757 | | |
3758 | | // wuffs_base__token is an element of a byte stream's tokenization. |
3759 | | // |
3760 | | // See https://github.com/google/wuffs/blob/main/doc/note/tokens.md |
3761 | | typedef struct wuffs_base__token__struct { |
3762 | | uint64_t repr; |
3763 | | |
3764 | | #ifdef __cplusplus |
3765 | | inline int64_t value() const; |
3766 | | inline int64_t value_extension() const; |
3767 | | inline int64_t value_major() const; |
3768 | | inline int64_t value_base_category() const; |
3769 | | inline uint64_t value_minor() const; |
3770 | | inline uint64_t value_base_detail() const; |
3771 | | inline int64_t value_base_detail__sign_extended() const; |
3772 | | inline bool continued() const; |
3773 | | inline uint64_t length() const; |
3774 | | #endif // __cplusplus |
3775 | | |
3776 | | } wuffs_base__token; |
3777 | | |
3778 | | static inline wuffs_base__token // |
3779 | 20.3M | wuffs_base__make_token(uint64_t repr) { |
3780 | 20.3M | wuffs_base__token ret; |
3781 | 20.3M | ret.repr = repr; |
3782 | 20.3M | return ret; |
3783 | 20.3M | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_token json_fuzzer.cc:wuffs_base__make_token(unsigned long) Line | Count | Source | 3779 | 16.9M | wuffs_base__make_token(uint64_t repr) { | 3780 | 16.9M | wuffs_base__token ret; | 3781 | 16.9M | ret.repr = repr; | 3782 | 16.9M | return ret; | 3783 | 16.9M | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_token Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_token Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_token cbor_fuzzer.c:wuffs_base__make_token Line | Count | Source | 3779 | 3.34M | wuffs_base__make_token(uint64_t repr) { | 3780 | 3.34M | wuffs_base__token ret; | 3781 | 3.34M | ret.repr = repr; | 3782 | 3.34M | return ret; | 3783 | 3.34M | } |
Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_token Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_token Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_token Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_token Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_token Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_token |
3784 | | |
3785 | | // -------- |
3786 | | |
3787 | | // clang-format off |
3788 | | |
3789 | | // -------- |
3790 | | |
3791 | | #define WUFFS_BASE__TOKEN__LENGTH__MAX_INCL 0xFFFF |
3792 | | |
3793 | | #define WUFFS_BASE__TOKEN__VALUE__SHIFT 17 |
3794 | 8.96M | #define WUFFS_BASE__TOKEN__VALUE_EXTENSION__SHIFT 17 |
3795 | 1.66M | #define WUFFS_BASE__TOKEN__VALUE_MAJOR__SHIFT 42 |
3796 | 20.3M | #define WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT 17 |
3797 | 17.7M | #define WUFFS_BASE__TOKEN__VALUE_BASE_CATEGORY__SHIFT 38 |
3798 | 17.7M | #define WUFFS_BASE__TOKEN__VALUE_BASE_DETAIL__SHIFT 17 |
3799 | 9.07M | #define WUFFS_BASE__TOKEN__CONTINUED__SHIFT 16 |
3800 | 38.1M | #define WUFFS_BASE__TOKEN__LENGTH__SHIFT 0 |
3801 | | |
3802 | | #define WUFFS_BASE__TOKEN__VALUE_EXTENSION__NUM_BITS 46 |
3803 | | |
3804 | | // -------- |
3805 | | |
3806 | 7.49M | #define WUFFS_BASE__TOKEN__VBC__FILLER 0 |
3807 | 4.65M | #define WUFFS_BASE__TOKEN__VBC__STRUCTURE 1 |
3808 | 411k | #define WUFFS_BASE__TOKEN__VBC__STRING 2 |
3809 | 8.19M | #define WUFFS_BASE__TOKEN__VBC__UNICODE_CODE_POINT 3 |
3810 | 6.66k | #define WUFFS_BASE__TOKEN__VBC__LITERAL 4 |
3811 | 1.16M | #define WUFFS_BASE__TOKEN__VBC__NUMBER 5 |
3812 | | #define WUFFS_BASE__TOKEN__VBC__INLINE_INTEGER_SIGNED 6 |
3813 | | #define WUFFS_BASE__TOKEN__VBC__INLINE_INTEGER_UNSIGNED 7 |
3814 | | |
3815 | | // -------- |
3816 | | |
3817 | | #define WUFFS_BASE__TOKEN__VBD__FILLER__PUNCTUATION 0x00001 |
3818 | | #define WUFFS_BASE__TOKEN__VBD__FILLER__COMMENT_BLOCK 0x00002 |
3819 | | #define WUFFS_BASE__TOKEN__VBD__FILLER__COMMENT_LINE 0x00004 |
3820 | | |
3821 | | // COMMENT_ANY is a bit-wise or of COMMENT_BLOCK AND COMMENT_LINE. |
3822 | | #define WUFFS_BASE__TOKEN__VBD__FILLER__COMMENT_ANY 0x00006 |
3823 | | |
3824 | | // -------- |
3825 | | |
3826 | 1.16M | #define WUFFS_BASE__TOKEN__VBD__STRUCTURE__PUSH 0x00001 |
3827 | 948k | #define WUFFS_BASE__TOKEN__VBD__STRUCTURE__POP 0x00002 |
3828 | 666k | #define WUFFS_BASE__TOKEN__VBD__STRUCTURE__FROM_NONE 0x00010 |
3829 | 664k | #define WUFFS_BASE__TOKEN__VBD__STRUCTURE__FROM_LIST 0x00020 |
3830 | 344k | #define WUFFS_BASE__TOKEN__VBD__STRUCTURE__FROM_DICT 0x00040 |
3831 | 666k | #define WUFFS_BASE__TOKEN__VBD__STRUCTURE__TO_NONE 0x01000 |
3832 | 667k | #define WUFFS_BASE__TOKEN__VBD__STRUCTURE__TO_LIST 0x02000 |
3833 | 63.5k | #define WUFFS_BASE__TOKEN__VBD__STRUCTURE__TO_DICT 0x04000 |
3834 | | |
3835 | | // -------- |
3836 | | |
3837 | | // DEFINITELY_FOO means that the destination bytes (and also the source bytes, |
3838 | | // for 1_DST_1_SRC_COPY) are in the FOO format. Definitely means that the lack |
3839 | | // of the bit means "maybe FOO". It does not necessarily mean "not FOO". |
3840 | | // |
3841 | | // CHAIN_ETC means that decoding the entire token chain forms a UTF-8 or ASCII |
3842 | | // string, not just this current token. CHAIN_ETC_UTF_8 therefore distinguishes |
3843 | | // Unicode (UTF-8) strings from byte strings. MUST means that the the token |
3844 | | // producer (e.g. parser) must verify this. SHOULD means that the token |
3845 | | // consumer (e.g. renderer) should verify this. |
3846 | | // |
3847 | | // When a CHAIN_ETC_UTF_8 bit is set, the parser must ensure that non-ASCII |
3848 | | // code points (with multi-byte UTF-8 encodings) do not straddle token |
3849 | | // boundaries. Checking UTF-8 validity can inspect each token separately. |
3850 | | // |
3851 | | // The lack of any particular bit is conservative: it is valid for all-ASCII |
3852 | | // strings, in a single- or multi-token chain, to have none of these bits set. |
3853 | 279k | #define WUFFS_BASE__TOKEN__VBD__STRING__DEFINITELY_UTF_8 0x00001 |
3854 | | #define WUFFS_BASE__TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8 0x00002 |
3855 | | #define WUFFS_BASE__TOKEN__VBD__STRING__CHAIN_SHOULD_BE_UTF_8 0x00004 |
3856 | 279k | #define WUFFS_BASE__TOKEN__VBD__STRING__DEFINITELY_ASCII 0x00010 |
3857 | | #define WUFFS_BASE__TOKEN__VBD__STRING__CHAIN_MUST_BE_ASCII 0x00020 |
3858 | | #define WUFFS_BASE__TOKEN__VBD__STRING__CHAIN_SHOULD_BE_ASCII 0x00040 |
3859 | | |
3860 | | // CONVERT_D_DST_S_SRC means that multiples of S source bytes (possibly padded) |
3861 | | // produces multiples of D destination bytes. For example, |
3862 | | // CONVERT_1_DST_4_SRC_BACKSLASH_X means a source like "\\x23\\x67\\xAB", where |
3863 | | // 12 src bytes encode 3 dst bytes. |
3864 | | // |
3865 | | // Post-processing may further transform those D destination bytes (e.g. treat |
3866 | | // "\\xFF" as the Unicode code point U+00FF instead of the byte 0xFF), but that |
3867 | | // is out of scope of this VBD's semantics. |
3868 | | // |
3869 | | // When src is the empty string, multiple conversion algorithms are applicable |
3870 | | // (so these bits are not necessarily mutually exclusive), all producing the |
3871 | | // same empty dst string. |
3872 | 51.7k | #define WUFFS_BASE__TOKEN__VBD__STRING__CONVERT_0_DST_1_SRC_DROP 0x00100 |
3873 | 388k | #define WUFFS_BASE__TOKEN__VBD__STRING__CONVERT_1_DST_1_SRC_COPY 0x00200 |
3874 | | #define WUFFS_BASE__TOKEN__VBD__STRING__CONVERT_1_DST_2_SRC_HEXADECIMAL 0x00400 |
3875 | | #define WUFFS_BASE__TOKEN__VBD__STRING__CONVERT_1_DST_4_SRC_BACKSLASH_X 0x00800 |
3876 | | #define WUFFS_BASE__TOKEN__VBD__STRING__CONVERT_3_DST_4_SRC_BASE_64_STD 0x01000 |
3877 | | #define WUFFS_BASE__TOKEN__VBD__STRING__CONVERT_3_DST_4_SRC_BASE_64_URL 0x02000 |
3878 | | #define WUFFS_BASE__TOKEN__VBD__STRING__CONVERT_4_DST_5_SRC_ASCII_85 0x04000 |
3879 | | #define WUFFS_BASE__TOKEN__VBD__STRING__CONVERT_5_DST_8_SRC_BASE_32_HEX 0x08000 |
3880 | | #define WUFFS_BASE__TOKEN__VBD__STRING__CONVERT_5_DST_8_SRC_BASE_32_STD 0x10000 |
3881 | | |
3882 | | // -------- |
3883 | | |
3884 | | #define WUFFS_BASE__TOKEN__VBD__LITERAL__UNDEFINED 0x00001 |
3885 | 6.66k | #define WUFFS_BASE__TOKEN__VBD__LITERAL__NULL 0x00002 |
3886 | | #define WUFFS_BASE__TOKEN__VBD__LITERAL__FALSE 0x00004 |
3887 | 3.63k | #define WUFFS_BASE__TOKEN__VBD__LITERAL__TRUE 0x00008 |
3888 | | |
3889 | | // -------- |
3890 | | |
3891 | | // For a source string of "123" or "0x9A", it is valid for a tokenizer to |
3892 | | // return any combination of: |
3893 | | // - WUFFS_BASE__TOKEN__VBD__NUMBER__CONTENT_FLOATING_POINT. |
3894 | | // - WUFFS_BASE__TOKEN__VBD__NUMBER__CONTENT_INTEGER_SIGNED. |
3895 | | // - WUFFS_BASE__TOKEN__VBD__NUMBER__CONTENT_INTEGER_UNSIGNED. |
3896 | | // |
3897 | | // For a source string of "+123" or "-0x9A", only the first two are valid. |
3898 | | // |
3899 | | // For a source string of "123.", only the first one is valid. |
3900 | 48.8k | #define WUFFS_BASE__TOKEN__VBD__NUMBER__CONTENT_FLOATING_POINT 0x00001 |
3901 | 1.15M | #define WUFFS_BASE__TOKEN__VBD__NUMBER__CONTENT_INTEGER_SIGNED 0x00002 |
3902 | | #define WUFFS_BASE__TOKEN__VBD__NUMBER__CONTENT_INTEGER_UNSIGNED 0x00004 |
3903 | | |
3904 | 9.24k | #define WUFFS_BASE__TOKEN__VBD__NUMBER__CONTENT_NEG_INF 0x00010 |
3905 | 7.69k | #define WUFFS_BASE__TOKEN__VBD__NUMBER__CONTENT_POS_INF 0x00020 |
3906 | 5.38k | #define WUFFS_BASE__TOKEN__VBD__NUMBER__CONTENT_NEG_NAN 0x00040 |
3907 | 2.30k | #define WUFFS_BASE__TOKEN__VBD__NUMBER__CONTENT_POS_NAN 0x00080 |
3908 | | |
3909 | | // The number 300 might be represented as "\x01\x2C", "\x2C\x01\x00\x00" or |
3910 | | // "300", which are big-endian, little-endian or text. For binary formats, the |
3911 | | // token length (after adjusting for FORMAT_IGNORE_ETC) discriminates |
3912 | | // e.g. u16 little-endian vs u32 little-endian. |
3913 | | #define WUFFS_BASE__TOKEN__VBD__NUMBER__FORMAT_BINARY_BIG_ENDIAN 0x00100 |
3914 | | #define WUFFS_BASE__TOKEN__VBD__NUMBER__FORMAT_BINARY_LITTLE_ENDIAN 0x00200 |
3915 | 1.16M | #define WUFFS_BASE__TOKEN__VBD__NUMBER__FORMAT_TEXT 0x00400 |
3916 | | |
3917 | | #define WUFFS_BASE__TOKEN__VBD__NUMBER__FORMAT_IGNORE_FIRST_BYTE 0x01000 |
3918 | | |
3919 | | // -------- |
3920 | | |
3921 | | // clang-format on |
3922 | | |
3923 | | // -------- |
3924 | | |
3925 | | // wuffs_base__token__value returns the token's high 46 bits, sign-extended. A |
3926 | | // negative value means an extended token, non-negative means a simple token. |
3927 | | static inline int64_t // |
3928 | 0 | wuffs_base__token__value(const wuffs_base__token* t) { |
3929 | 0 | return ((int64_t)(t->repr)) >> WUFFS_BASE__TOKEN__VALUE__SHIFT; |
3930 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token__value Unexecuted instantiation: json_fuzzer.cc:wuffs_base__token__value(wuffs_base__token__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token__value Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token__value Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token__value Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__token__value Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token__value Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token__value Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token__value Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token__value Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token__value Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token__value |
3931 | | |
3932 | | // wuffs_base__token__value_extension returns a negative value if the token was |
3933 | | // not an extended token. |
3934 | | static inline int64_t // |
3935 | 8.96M | wuffs_base__token__value_extension(const wuffs_base__token* t) { |
3936 | 8.96M | return (~(int64_t)(t->repr)) >> WUFFS_BASE__TOKEN__VALUE_EXTENSION__SHIFT; |
3937 | 8.96M | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token__value_extension json_fuzzer.cc:wuffs_base__token__value_extension(wuffs_base__token__struct const*) Line | Count | Source | 3935 | 7.31M | wuffs_base__token__value_extension(const wuffs_base__token* t) { | 3936 | 7.31M | return (~(int64_t)(t->repr)) >> WUFFS_BASE__TOKEN__VALUE_EXTENSION__SHIFT; | 3937 | 7.31M | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token__value_extension Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token__value_extension Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token__value_extension cbor_fuzzer.c:wuffs_base__token__value_extension Line | Count | Source | 3935 | 1.65M | wuffs_base__token__value_extension(const wuffs_base__token* t) { | 3936 | 1.65M | return (~(int64_t)(t->repr)) >> WUFFS_BASE__TOKEN__VALUE_EXTENSION__SHIFT; | 3937 | 1.65M | } |
Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token__value_extension Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token__value_extension Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token__value_extension Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token__value_extension Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token__value_extension Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token__value_extension |
3938 | | |
3939 | | // wuffs_base__token__value_major returns a negative value if the token was not |
3940 | | // a simple token. |
3941 | | static inline int64_t // |
3942 | 1.65M | wuffs_base__token__value_major(const wuffs_base__token* t) { |
3943 | 1.65M | return ((int64_t)(t->repr)) >> WUFFS_BASE__TOKEN__VALUE_MAJOR__SHIFT; |
3944 | 1.65M | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token__value_major Unexecuted instantiation: json_fuzzer.cc:wuffs_base__token__value_major(wuffs_base__token__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token__value_major Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token__value_major Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token__value_major cbor_fuzzer.c:wuffs_base__token__value_major Line | Count | Source | 3942 | 1.65M | wuffs_base__token__value_major(const wuffs_base__token* t) { | 3943 | 1.65M | return ((int64_t)(t->repr)) >> WUFFS_BASE__TOKEN__VALUE_MAJOR__SHIFT; | 3944 | 1.65M | } |
Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token__value_major Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token__value_major Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token__value_major Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token__value_major Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token__value_major Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token__value_major |
3945 | | |
3946 | | // wuffs_base__token__value_base_category returns a negative value if the token |
3947 | | // was not a simple token. |
3948 | | static inline int64_t // |
3949 | 17.7M | wuffs_base__token__value_base_category(const wuffs_base__token* t) { |
3950 | 17.7M | return ((int64_t)(t->repr)) >> WUFFS_BASE__TOKEN__VALUE_BASE_CATEGORY__SHIFT; |
3951 | 17.7M | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token__value_base_category json_fuzzer.cc:wuffs_base__token__value_base_category(wuffs_base__token__struct const*) Line | Count | Source | 3949 | 16.1M | wuffs_base__token__value_base_category(const wuffs_base__token* t) { | 3950 | 16.1M | return ((int64_t)(t->repr)) >> WUFFS_BASE__TOKEN__VALUE_BASE_CATEGORY__SHIFT; | 3951 | 16.1M | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token__value_base_category Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token__value_base_category Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token__value_base_category cbor_fuzzer.c:wuffs_base__token__value_base_category Line | Count | Source | 3949 | 1.65M | wuffs_base__token__value_base_category(const wuffs_base__token* t) { | 3950 | 1.65M | return ((int64_t)(t->repr)) >> WUFFS_BASE__TOKEN__VALUE_BASE_CATEGORY__SHIFT; | 3951 | 1.65M | } |
Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token__value_base_category Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token__value_base_category Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token__value_base_category Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token__value_base_category Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token__value_base_category Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token__value_base_category |
3952 | | |
3953 | | static inline uint64_t // |
3954 | 5.98k | wuffs_base__token__value_minor(const wuffs_base__token* t) { |
3955 | 5.98k | return (t->repr >> WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) & 0x1FFFFFF; |
3956 | 5.98k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token__value_minor Unexecuted instantiation: json_fuzzer.cc:wuffs_base__token__value_minor(wuffs_base__token__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token__value_minor Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token__value_minor Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token__value_minor cbor_fuzzer.c:wuffs_base__token__value_minor Line | Count | Source | 3954 | 5.98k | wuffs_base__token__value_minor(const wuffs_base__token* t) { | 3955 | 5.98k | return (t->repr >> WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) & 0x1FFFFFF; | 3956 | 5.98k | } |
Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token__value_minor Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token__value_minor Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token__value_minor Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token__value_minor Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token__value_minor Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token__value_minor |
3957 | | |
3958 | | static inline uint64_t // |
3959 | 17.7M | wuffs_base__token__value_base_detail(const wuffs_base__token* t) { |
3960 | 17.7M | return (t->repr >> WUFFS_BASE__TOKEN__VALUE_BASE_DETAIL__SHIFT) & 0x1FFFFF; |
3961 | 17.7M | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token__value_base_detail json_fuzzer.cc:wuffs_base__token__value_base_detail(wuffs_base__token__struct const*) Line | Count | Source | 3959 | 16.1M | wuffs_base__token__value_base_detail(const wuffs_base__token* t) { | 3960 | 16.1M | return (t->repr >> WUFFS_BASE__TOKEN__VALUE_BASE_DETAIL__SHIFT) & 0x1FFFFF; | 3961 | 16.1M | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token__value_base_detail Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token__value_base_detail Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token__value_base_detail cbor_fuzzer.c:wuffs_base__token__value_base_detail Line | Count | Source | 3959 | 1.65M | wuffs_base__token__value_base_detail(const wuffs_base__token* t) { | 3960 | 1.65M | return (t->repr >> WUFFS_BASE__TOKEN__VALUE_BASE_DETAIL__SHIFT) & 0x1FFFFF; | 3961 | 1.65M | } |
Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token__value_base_detail Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token__value_base_detail Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token__value_base_detail Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token__value_base_detail Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token__value_base_detail Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token__value_base_detail |
3962 | | |
3963 | | static inline int64_t // |
3964 | | wuffs_base__token__value_base_detail__sign_extended( |
3965 | 0 | const wuffs_base__token* t) { |
3966 | 0 | // The VBD is 21 bits in the middle of t->repr. Left shift the high (64 - 21 |
3967 | 0 | // - ETC__SHIFT) bits off, then right shift (sign-extending) back down. |
3968 | 0 | uint64_t u = t->repr << (43 - WUFFS_BASE__TOKEN__VALUE_BASE_DETAIL__SHIFT); |
3969 | 0 | return ((int64_t)u) >> 43; |
3970 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token__value_base_detail__sign_extended Unexecuted instantiation: json_fuzzer.cc:wuffs_base__token__value_base_detail__sign_extended(wuffs_base__token__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token__value_base_detail__sign_extended Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token__value_base_detail__sign_extended Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token__value_base_detail__sign_extended Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__token__value_base_detail__sign_extended Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token__value_base_detail__sign_extended Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token__value_base_detail__sign_extended Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token__value_base_detail__sign_extended Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token__value_base_detail__sign_extended Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token__value_base_detail__sign_extended Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token__value_base_detail__sign_extended |
3971 | | |
3972 | | static inline bool // |
3973 | 14.9M | wuffs_base__token__continued(const wuffs_base__token* t) { |
3974 | 14.9M | return t->repr & 0x10000; |
3975 | 14.9M | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token__continued json_fuzzer.cc:wuffs_base__token__continued(wuffs_base__token__struct const*) Line | Count | Source | 3973 | 13.2M | wuffs_base__token__continued(const wuffs_base__token* t) { | 3974 | 13.2M | return t->repr & 0x10000; | 3975 | 13.2M | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token__continued Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token__continued Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token__continued cbor_fuzzer.c:wuffs_base__token__continued Line | Count | Source | 3973 | 1.65M | wuffs_base__token__continued(const wuffs_base__token* t) { | 3974 | 1.65M | return t->repr & 0x10000; | 3975 | 1.65M | } |
Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token__continued Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token__continued Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token__continued Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token__continued Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token__continued Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token__continued |
3976 | | |
3977 | | static inline uint64_t // |
3978 | 17.7M | wuffs_base__token__length(const wuffs_base__token* t) { |
3979 | 17.7M | return (t->repr >> WUFFS_BASE__TOKEN__LENGTH__SHIFT) & 0xFFFF; |
3980 | 17.7M | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token__length json_fuzzer.cc:wuffs_base__token__length(wuffs_base__token__struct const*) Line | Count | Source | 3978 | 16.1M | wuffs_base__token__length(const wuffs_base__token* t) { | 3979 | 16.1M | return (t->repr >> WUFFS_BASE__TOKEN__LENGTH__SHIFT) & 0xFFFF; | 3980 | 16.1M | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token__length Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token__length Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token__length cbor_fuzzer.c:wuffs_base__token__length Line | Count | Source | 3978 | 1.65M | wuffs_base__token__length(const wuffs_base__token* t) { | 3979 | 1.65M | return (t->repr >> WUFFS_BASE__TOKEN__LENGTH__SHIFT) & 0xFFFF; | 3980 | 1.65M | } |
Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token__length Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token__length Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token__length Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token__length Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token__length Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token__length |
3981 | | |
3982 | | #ifdef __cplusplus |
3983 | | |
3984 | | inline int64_t // |
3985 | 0 | wuffs_base__token::value() const { |
3986 | 0 | return wuffs_base__token__value(this); |
3987 | 0 | } |
3988 | | |
3989 | | inline int64_t // |
3990 | 0 | wuffs_base__token::value_extension() const { |
3991 | 0 | return wuffs_base__token__value_extension(this); |
3992 | 0 | } |
3993 | | |
3994 | | inline int64_t // |
3995 | 0 | wuffs_base__token::value_major() const { |
3996 | 0 | return wuffs_base__token__value_major(this); |
3997 | 0 | } |
3998 | | |
3999 | | inline int64_t // |
4000 | 8.82M | wuffs_base__token::value_base_category() const { |
4001 | 8.82M | return wuffs_base__token__value_base_category(this); |
4002 | 8.82M | } |
4003 | | |
4004 | | inline uint64_t // |
4005 | 0 | wuffs_base__token::value_minor() const { |
4006 | 0 | return wuffs_base__token__value_minor(this); |
4007 | 0 | } |
4008 | | |
4009 | | inline uint64_t // |
4010 | 8.82M | wuffs_base__token::value_base_detail() const { |
4011 | 8.82M | return wuffs_base__token__value_base_detail(this); |
4012 | 8.82M | } |
4013 | | |
4014 | | inline int64_t // |
4015 | 0 | wuffs_base__token::value_base_detail__sign_extended() const { |
4016 | 0 | return wuffs_base__token__value_base_detail__sign_extended(this); |
4017 | 0 | } |
4018 | | |
4019 | | inline bool // |
4020 | 5.93M | wuffs_base__token::continued() const { |
4021 | 5.93M | return wuffs_base__token__continued(this); |
4022 | 5.93M | } |
4023 | | |
4024 | | inline uint64_t // |
4025 | 8.82M | wuffs_base__token::length() const { |
4026 | 8.82M | return wuffs_base__token__length(this); |
4027 | 8.82M | } |
4028 | | |
4029 | | #endif // __cplusplus |
4030 | | |
4031 | | // -------- |
4032 | | |
4033 | | #if defined(__GNUC__) |
4034 | | #pragma GCC diagnostic push |
4035 | | #pragma GCC diagnostic ignored "-Wcast-qual" |
4036 | | #endif |
4037 | | |
4038 | | static inline wuffs_base__token* // |
4039 | 0 | wuffs_base__strip_const_from_token_ptr(const wuffs_base__token* ptr) { |
4040 | 0 | return (wuffs_base__token*)ptr; |
4041 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__strip_const_from_token_ptr Unexecuted instantiation: json_fuzzer.cc:wuffs_base__strip_const_from_token_ptr(wuffs_base__token__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__strip_const_from_token_ptr Unexecuted instantiation: xz_fuzzer.c:wuffs_base__strip_const_from_token_ptr Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__strip_const_from_token_ptr Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__strip_const_from_token_ptr Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__strip_const_from_token_ptr Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__strip_const_from_token_ptr Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__strip_const_from_token_ptr Unexecuted instantiation: targa_fuzzer.c:wuffs_base__strip_const_from_token_ptr Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__strip_const_from_token_ptr Unexecuted instantiation: webp_fuzzer.c:wuffs_base__strip_const_from_token_ptr |
4042 | | |
4043 | | #if defined(__GNUC__) |
4044 | | #pragma GCC diagnostic pop |
4045 | | #endif |
4046 | | |
4047 | | // -------- |
4048 | | |
4049 | | typedef WUFFS_BASE__SLICE(wuffs_base__token) wuffs_base__slice_token; |
4050 | | |
4051 | | static inline wuffs_base__slice_token // |
4052 | 6.11k | wuffs_base__make_slice_token(wuffs_base__token* ptr, size_t len) { |
4053 | 6.11k | wuffs_base__slice_token ret; |
4054 | 6.11k | ret.ptr = ptr; |
4055 | 6.11k | ret.len = len; |
4056 | 6.11k | return ret; |
4057 | 6.11k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_slice_token json_fuzzer.cc:wuffs_base__make_slice_token(wuffs_base__token__struct*, unsigned long) Line | Count | Source | 4052 | 6.11k | wuffs_base__make_slice_token(wuffs_base__token* ptr, size_t len) { | 4053 | 6.11k | wuffs_base__slice_token ret; | 4054 | 6.11k | ret.ptr = ptr; | 4055 | 6.11k | ret.len = len; | 4056 | 6.11k | return ret; | 4057 | 6.11k | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_slice_token Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_slice_token Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_slice_token Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_slice_token Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_slice_token Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_slice_token Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_slice_token Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_slice_token Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_slice_token Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_slice_token |
4058 | | |
4059 | | static inline wuffs_base__slice_token // |
4060 | 0 | wuffs_base__empty_slice_token(void) { |
4061 | 0 | wuffs_base__slice_token ret; |
4062 | 0 | ret.ptr = NULL; |
4063 | 0 | ret.len = 0; |
4064 | 0 | return ret; |
4065 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_slice_token Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_slice_token() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_slice_token Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_slice_token Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_slice_token Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_slice_token Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_slice_token Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_slice_token Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_slice_token Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_slice_token Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_slice_token Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_slice_token |
4066 | | |
4067 | | // -------- |
4068 | | |
4069 | | // wuffs_base__token_buffer_meta is the metadata for a |
4070 | | // wuffs_base__token_buffer's data. |
4071 | | typedef struct wuffs_base__token_buffer_meta__struct { |
4072 | | size_t wi; // Write index. Invariant: wi <= len. |
4073 | | size_t ri; // Read index. Invariant: ri <= wi. |
4074 | | uint64_t pos; // Position of the buffer start relative to the stream start. |
4075 | | bool closed; // No further writes are expected. |
4076 | | } wuffs_base__token_buffer_meta; |
4077 | | |
4078 | | // wuffs_base__token_buffer is a 1-dimensional buffer (a pointer and length) |
4079 | | // plus additional metadata. It is a linear buffer, not a circular buffer. |
4080 | | // |
4081 | | // A value with all fields zero is a valid, empty buffer. |
4082 | | typedef struct wuffs_base__token_buffer__struct { |
4083 | | wuffs_base__slice_token data; |
4084 | | wuffs_base__token_buffer_meta meta; |
4085 | | |
4086 | | #ifdef __cplusplus |
4087 | | inline bool is_valid() const; |
4088 | | inline size_t compact(); |
4089 | | inline size_t compact_retaining(uint64_t history_retain_length); |
4090 | | inline uint64_t reader_length() const; |
4091 | | inline wuffs_base__token* reader_pointer() const; |
4092 | | inline wuffs_base__slice_token reader_slice() const; |
4093 | | inline uint64_t reader_token_position() const; |
4094 | | inline uint64_t writer_length() const; |
4095 | | inline uint64_t writer_token_position() const; |
4096 | | inline wuffs_base__token* writer_pointer() const; |
4097 | | inline wuffs_base__slice_token writer_slice() const; |
4098 | | #endif // __cplusplus |
4099 | | |
4100 | | } wuffs_base__token_buffer; |
4101 | | |
4102 | | static inline wuffs_base__token_buffer // |
4103 | | wuffs_base__make_token_buffer(wuffs_base__slice_token data, |
4104 | 0 | wuffs_base__token_buffer_meta meta) { |
4105 | 0 | wuffs_base__token_buffer ret; |
4106 | 0 | ret.data = data; |
4107 | 0 | ret.meta = meta; |
4108 | 0 | return ret; |
4109 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_token_buffer Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_token_buffer(wuffs_base__slice_token, wuffs_base__token_buffer_meta__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_token_buffer Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_token_buffer Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_token_buffer Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_token_buffer Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_token_buffer Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_token_buffer Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_token_buffer Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_token_buffer Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_token_buffer Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_token_buffer |
4110 | | |
4111 | | static inline wuffs_base__token_buffer_meta // |
4112 | | wuffs_base__make_token_buffer_meta(size_t wi, |
4113 | | size_t ri, |
4114 | | uint64_t pos, |
4115 | 0 | bool closed) { |
4116 | 0 | wuffs_base__token_buffer_meta ret; |
4117 | 0 | ret.wi = wi; |
4118 | 0 | ret.ri = ri; |
4119 | 0 | ret.pos = pos; |
4120 | 0 | ret.closed = closed; |
4121 | 0 | return ret; |
4122 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_token_buffer_meta Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_token_buffer_meta(unsigned long, unsigned long, unsigned long, bool) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_token_buffer_meta Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_token_buffer_meta Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_token_buffer_meta Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_token_buffer_meta Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_token_buffer_meta Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_token_buffer_meta Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_token_buffer_meta Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_token_buffer_meta Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_token_buffer_meta Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_token_buffer_meta |
4123 | | |
4124 | | static inline wuffs_base__token_buffer // |
4125 | 0 | wuffs_base__slice_token__reader(wuffs_base__slice_token s, bool closed) { |
4126 | 0 | wuffs_base__token_buffer ret; |
4127 | 0 | ret.data.ptr = s.ptr; |
4128 | 0 | ret.data.len = s.len; |
4129 | 0 | ret.meta.wi = s.len; |
4130 | 0 | ret.meta.ri = 0; |
4131 | 0 | ret.meta.pos = 0; |
4132 | 0 | ret.meta.closed = closed; |
4133 | 0 | return ret; |
4134 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__slice_token__reader Unexecuted instantiation: json_fuzzer.cc:wuffs_base__slice_token__reader(wuffs_base__slice_token, bool) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__slice_token__reader Unexecuted instantiation: xz_fuzzer.c:wuffs_base__slice_token__reader Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__slice_token__reader Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__slice_token__reader Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__slice_token__reader Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__slice_token__reader Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__slice_token__reader Unexecuted instantiation: targa_fuzzer.c:wuffs_base__slice_token__reader Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__slice_token__reader Unexecuted instantiation: webp_fuzzer.c:wuffs_base__slice_token__reader |
4135 | | |
4136 | | static inline wuffs_base__token_buffer // |
4137 | 6.11k | wuffs_base__slice_token__writer(wuffs_base__slice_token s) { |
4138 | 6.11k | wuffs_base__token_buffer ret; |
4139 | 6.11k | ret.data.ptr = s.ptr; |
4140 | 6.11k | ret.data.len = s.len; |
4141 | 6.11k | ret.meta.wi = 0; |
4142 | 6.11k | ret.meta.ri = 0; |
4143 | 6.11k | ret.meta.pos = 0; |
4144 | 6.11k | ret.meta.closed = false; |
4145 | 6.11k | return ret; |
4146 | 6.11k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__slice_token__writer json_fuzzer.cc:wuffs_base__slice_token__writer(wuffs_base__slice_token) Line | Count | Source | 4137 | 6.11k | wuffs_base__slice_token__writer(wuffs_base__slice_token s) { | 4138 | 6.11k | wuffs_base__token_buffer ret; | 4139 | 6.11k | ret.data.ptr = s.ptr; | 4140 | 6.11k | ret.data.len = s.len; | 4141 | 6.11k | ret.meta.wi = 0; | 4142 | 6.11k | ret.meta.ri = 0; | 4143 | 6.11k | ret.meta.pos = 0; | 4144 | 6.11k | ret.meta.closed = false; | 4145 | 6.11k | return ret; | 4146 | 6.11k | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__slice_token__writer Unexecuted instantiation: xz_fuzzer.c:wuffs_base__slice_token__writer Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__slice_token__writer Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__slice_token__writer Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__slice_token__writer Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__slice_token__writer Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__slice_token__writer Unexecuted instantiation: targa_fuzzer.c:wuffs_base__slice_token__writer Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__slice_token__writer Unexecuted instantiation: webp_fuzzer.c:wuffs_base__slice_token__writer |
4147 | | |
4148 | | static inline wuffs_base__token_buffer // |
4149 | 0 | wuffs_base__empty_token_buffer(void) { |
4150 | 0 | wuffs_base__token_buffer ret; |
4151 | 0 | ret.data.ptr = NULL; |
4152 | 0 | ret.data.len = 0; |
4153 | 0 | ret.meta.wi = 0; |
4154 | 0 | ret.meta.ri = 0; |
4155 | 0 | ret.meta.pos = 0; |
4156 | 0 | ret.meta.closed = false; |
4157 | 0 | return ret; |
4158 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_token_buffer Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_token_buffer() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_token_buffer Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_token_buffer Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_token_buffer Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_token_buffer Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_token_buffer Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_token_buffer Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_token_buffer Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_token_buffer Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_token_buffer Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_token_buffer |
4159 | | |
4160 | | static inline wuffs_base__token_buffer_meta // |
4161 | 0 | wuffs_base__empty_token_buffer_meta(void) { |
4162 | 0 | wuffs_base__token_buffer_meta ret; |
4163 | 0 | ret.wi = 0; |
4164 | 0 | ret.ri = 0; |
4165 | 0 | ret.pos = 0; |
4166 | 0 | ret.closed = false; |
4167 | 0 | return ret; |
4168 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__empty_token_buffer_meta Unexecuted instantiation: json_fuzzer.cc:wuffs_base__empty_token_buffer_meta() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__empty_token_buffer_meta Unexecuted instantiation: xz_fuzzer.c:wuffs_base__empty_token_buffer_meta Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__empty_token_buffer_meta Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__empty_token_buffer_meta Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__empty_token_buffer_meta Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__empty_token_buffer_meta Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__empty_token_buffer_meta Unexecuted instantiation: targa_fuzzer.c:wuffs_base__empty_token_buffer_meta Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__empty_token_buffer_meta Unexecuted instantiation: webp_fuzzer.c:wuffs_base__empty_token_buffer_meta |
4169 | | |
4170 | | static inline bool // |
4171 | 0 | wuffs_base__token_buffer__is_valid(const wuffs_base__token_buffer* buf) { |
4172 | 0 | if (buf) { |
4173 | 0 | if (buf->data.ptr) { |
4174 | 0 | return (buf->meta.ri <= buf->meta.wi) && (buf->meta.wi <= buf->data.len); |
4175 | 0 | } else { |
4176 | 0 | return (buf->meta.ri == 0) && (buf->meta.wi == 0) && (buf->data.len == 0); |
4177 | 0 | } |
4178 | 0 | } |
4179 | 0 | return false; |
4180 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token_buffer__is_valid Unexecuted instantiation: json_fuzzer.cc:wuffs_base__token_buffer__is_valid(wuffs_base__token_buffer__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token_buffer__is_valid Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token_buffer__is_valid Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token_buffer__is_valid Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__token_buffer__is_valid Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token_buffer__is_valid Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token_buffer__is_valid Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token_buffer__is_valid Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token_buffer__is_valid Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token_buffer__is_valid Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token_buffer__is_valid |
4181 | | |
4182 | | // wuffs_base__token_buffer__compact moves any written but unread tokens to the |
4183 | | // start of the buffer. |
4184 | | // |
4185 | | // It returns the increase in the writer length: how much meta.wi fell by. |
4186 | | static inline size_t // |
4187 | 524k | wuffs_base__token_buffer__compact(wuffs_base__token_buffer* buf) { |
4188 | 524k | if (!buf || (buf->meta.ri == 0)) { |
4189 | 0 | return 0; |
4190 | 0 | } |
4191 | 524k | size_t old_ri = buf->meta.ri; |
4192 | 524k | buf->meta.pos = wuffs_base__u64__sat_add(buf->meta.pos, buf->meta.ri); |
4193 | 524k | size_t new_wi = buf->meta.wi - buf->meta.ri; |
4194 | 524k | if (new_wi != 0) { |
4195 | 0 | memmove(buf->data.ptr, buf->data.ptr + buf->meta.ri, |
4196 | 0 | new_wi * sizeof(wuffs_base__token)); |
4197 | 0 | } |
4198 | 524k | buf->meta.wi = new_wi; |
4199 | 524k | buf->meta.ri = 0; |
4200 | 524k | return old_ri; |
4201 | 524k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token_buffer__compact json_fuzzer.cc:wuffs_base__token_buffer__compact(wuffs_base__token_buffer__struct*) Line | Count | Source | 4187 | 430k | wuffs_base__token_buffer__compact(wuffs_base__token_buffer* buf) { | 4188 | 430k | if (!buf || (buf->meta.ri == 0)) { | 4189 | 0 | return 0; | 4190 | 0 | } | 4191 | 430k | size_t old_ri = buf->meta.ri; | 4192 | 430k | buf->meta.pos = wuffs_base__u64__sat_add(buf->meta.pos, buf->meta.ri); | 4193 | 430k | size_t new_wi = buf->meta.wi - buf->meta.ri; | 4194 | 430k | if (new_wi != 0) { | 4195 | 0 | memmove(buf->data.ptr, buf->data.ptr + buf->meta.ri, | 4196 | 0 | new_wi * sizeof(wuffs_base__token)); | 4197 | 0 | } | 4198 | 430k | buf->meta.wi = new_wi; | 4199 | 430k | buf->meta.ri = 0; | 4200 | 430k | return old_ri; | 4201 | 430k | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token_buffer__compact Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token_buffer__compact Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token_buffer__compact cbor_fuzzer.c:wuffs_base__token_buffer__compact Line | Count | Source | 4187 | 94.6k | wuffs_base__token_buffer__compact(wuffs_base__token_buffer* buf) { | 4188 | 94.6k | if (!buf || (buf->meta.ri == 0)) { | 4189 | 0 | return 0; | 4190 | 0 | } | 4191 | 94.6k | size_t old_ri = buf->meta.ri; | 4192 | 94.6k | buf->meta.pos = wuffs_base__u64__sat_add(buf->meta.pos, buf->meta.ri); | 4193 | 94.6k | size_t new_wi = buf->meta.wi - buf->meta.ri; | 4194 | 94.6k | if (new_wi != 0) { | 4195 | 0 | memmove(buf->data.ptr, buf->data.ptr + buf->meta.ri, | 4196 | 0 | new_wi * sizeof(wuffs_base__token)); | 4197 | 0 | } | 4198 | 94.6k | buf->meta.wi = new_wi; | 4199 | 94.6k | buf->meta.ri = 0; | 4200 | 94.6k | return old_ri; | 4201 | 94.6k | } |
Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token_buffer__compact Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token_buffer__compact Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token_buffer__compact Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token_buffer__compact Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token_buffer__compact Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token_buffer__compact |
4202 | | |
4203 | | // wuffs_base__token_buffer__compact_retaining moves any written but unread |
4204 | | // tokens closer to the start of the buffer. It retains H tokens of history |
4205 | | // (the most recently read tokens), where H is min(buf->meta.ri, |
4206 | | // history_retain_length). It is therefore a no-op if history_retain_length is |
4207 | | // UINT64_MAX. A postcondition is that buf->meta.ri == H. |
4208 | | // |
4209 | | // It returns the increase in the writer length: how much meta.wi fell by. |
4210 | | // |
4211 | | // wuffs_base__token_buffer__compact_retaining(0) is equivalent to |
4212 | | // wuffs_base__token_buffer__compact(). |
4213 | | // |
4214 | | // For example, if buf started like this: |
4215 | | // |
4216 | | // +--- ri = 3 |
4217 | | // v |
4218 | | // abcdefgh?? len = 10, pos = 900 |
4219 | | // ^ |
4220 | | // +--- wi = 8 |
4221 | | // |
4222 | | // Then, depending on history_retain_length, the resultant buf would be: |
4223 | | // |
4224 | | // HRL = 0 defgh????? ri = 0 wi = 5 pos = 903 return = 3 |
4225 | | // HRL = 1 cdefgh???? ri = 1 wi = 6 pos = 902 return = 2 |
4226 | | // HRL = 2 bcdefgh??? ri = 2 wi = 7 pos = 901 return = 1 |
4227 | | // HRL = 3 abcdefgh?? ri = 3 wi = 8 pos = 900 return = 0 |
4228 | | // HRL = 4+ abcdefgh?? ri = 3 wi = 8 pos = 900 return = 0 |
4229 | | static inline size_t // |
4230 | | wuffs_base__token_buffer__compact_retaining(wuffs_base__token_buffer* buf, |
4231 | 0 | uint64_t history_retain_length) { |
4232 | 0 | if (!buf || (buf->meta.ri == 0)) { |
4233 | 0 | return 0; |
4234 | 0 | } |
4235 | 0 | size_t old_ri = buf->meta.ri; |
4236 | 0 | size_t new_ri = (size_t)(wuffs_base__u64__min(old_ri, history_retain_length)); |
4237 | 0 | size_t memmove_start = old_ri - new_ri; |
4238 | 0 | buf->meta.pos = wuffs_base__u64__sat_add(buf->meta.pos, memmove_start); |
4239 | 0 | size_t new_wi = buf->meta.wi - memmove_start; |
4240 | 0 | if ((new_wi != 0) && (memmove_start != 0)) { |
4241 | 0 | memmove(buf->data.ptr, buf->data.ptr + memmove_start, |
4242 | 0 | new_wi * sizeof(wuffs_base__token)); |
4243 | 0 | } |
4244 | 0 | buf->meta.wi = new_wi; |
4245 | 0 | buf->meta.ri = new_ri; |
4246 | 0 | return memmove_start; |
4247 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token_buffer__compact_retaining Unexecuted instantiation: json_fuzzer.cc:wuffs_base__token_buffer__compact_retaining(wuffs_base__token_buffer__struct*, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token_buffer__compact_retaining Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token_buffer__compact_retaining Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token_buffer__compact_retaining Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__token_buffer__compact_retaining Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token_buffer__compact_retaining Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token_buffer__compact_retaining Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token_buffer__compact_retaining Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token_buffer__compact_retaining Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token_buffer__compact_retaining Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token_buffer__compact_retaining |
4248 | | |
4249 | | static inline uint64_t // |
4250 | 0 | wuffs_base__token_buffer__reader_length(const wuffs_base__token_buffer* buf) { |
4251 | 0 | return buf ? buf->meta.wi - buf->meta.ri : 0; |
4252 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token_buffer__reader_length Unexecuted instantiation: json_fuzzer.cc:wuffs_base__token_buffer__reader_length(wuffs_base__token_buffer__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token_buffer__reader_length Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token_buffer__reader_length Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token_buffer__reader_length Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__token_buffer__reader_length Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token_buffer__reader_length Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token_buffer__reader_length Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token_buffer__reader_length Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token_buffer__reader_length Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token_buffer__reader_length Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token_buffer__reader_length |
4253 | | |
4254 | | static inline wuffs_base__token* // |
4255 | 0 | wuffs_base__token_buffer__reader_pointer(const wuffs_base__token_buffer* buf) { |
4256 | 0 | return buf ? (buf->data.ptr + buf->meta.ri) : NULL; |
4257 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token_buffer__reader_pointer Unexecuted instantiation: json_fuzzer.cc:wuffs_base__token_buffer__reader_pointer(wuffs_base__token_buffer__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token_buffer__reader_pointer Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token_buffer__reader_pointer Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token_buffer__reader_pointer Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__token_buffer__reader_pointer Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token_buffer__reader_pointer Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token_buffer__reader_pointer Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token_buffer__reader_pointer Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token_buffer__reader_pointer Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token_buffer__reader_pointer Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token_buffer__reader_pointer |
4258 | | |
4259 | | static inline wuffs_base__slice_token // |
4260 | 0 | wuffs_base__token_buffer__reader_slice(const wuffs_base__token_buffer* buf) { |
4261 | 0 | return buf ? wuffs_base__make_slice_token(buf->data.ptr + buf->meta.ri, |
4262 | 0 | buf->meta.wi - buf->meta.ri) |
4263 | 0 | : wuffs_base__empty_slice_token(); |
4264 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token_buffer__reader_slice Unexecuted instantiation: json_fuzzer.cc:wuffs_base__token_buffer__reader_slice(wuffs_base__token_buffer__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token_buffer__reader_slice Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token_buffer__reader_slice Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token_buffer__reader_slice Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__token_buffer__reader_slice Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token_buffer__reader_slice Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token_buffer__reader_slice Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token_buffer__reader_slice Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token_buffer__reader_slice Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token_buffer__reader_slice Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token_buffer__reader_slice |
4265 | | |
4266 | | static inline uint64_t // |
4267 | | wuffs_base__token_buffer__reader_token_position( |
4268 | 0 | const wuffs_base__token_buffer* buf) { |
4269 | 0 | return buf ? wuffs_base__u64__sat_add(buf->meta.pos, buf->meta.ri) : 0; |
4270 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token_buffer__reader_token_position Unexecuted instantiation: json_fuzzer.cc:wuffs_base__token_buffer__reader_token_position(wuffs_base__token_buffer__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token_buffer__reader_token_position Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token_buffer__reader_token_position Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token_buffer__reader_token_position Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__token_buffer__reader_token_position Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token_buffer__reader_token_position Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token_buffer__reader_token_position Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token_buffer__reader_token_position Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token_buffer__reader_token_position Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token_buffer__reader_token_position Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token_buffer__reader_token_position |
4271 | | |
4272 | | static inline uint64_t // |
4273 | 0 | wuffs_base__token_buffer__writer_length(const wuffs_base__token_buffer* buf) { |
4274 | 0 | return buf ? buf->data.len - buf->meta.wi : 0; |
4275 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token_buffer__writer_length Unexecuted instantiation: json_fuzzer.cc:wuffs_base__token_buffer__writer_length(wuffs_base__token_buffer__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token_buffer__writer_length Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token_buffer__writer_length Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token_buffer__writer_length Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__token_buffer__writer_length Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token_buffer__writer_length Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token_buffer__writer_length Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token_buffer__writer_length Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token_buffer__writer_length Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token_buffer__writer_length Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token_buffer__writer_length |
4276 | | |
4277 | | static inline wuffs_base__token* // |
4278 | 0 | wuffs_base__token_buffer__writer_pointer(const wuffs_base__token_buffer* buf) { |
4279 | 0 | return buf ? (buf->data.ptr + buf->meta.wi) : NULL; |
4280 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token_buffer__writer_pointer Unexecuted instantiation: json_fuzzer.cc:wuffs_base__token_buffer__writer_pointer(wuffs_base__token_buffer__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token_buffer__writer_pointer Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token_buffer__writer_pointer Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token_buffer__writer_pointer Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__token_buffer__writer_pointer Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token_buffer__writer_pointer Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token_buffer__writer_pointer Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token_buffer__writer_pointer Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token_buffer__writer_pointer Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token_buffer__writer_pointer Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token_buffer__writer_pointer |
4281 | | |
4282 | | static inline wuffs_base__slice_token // |
4283 | 0 | wuffs_base__token_buffer__writer_slice(const wuffs_base__token_buffer* buf) { |
4284 | 0 | return buf ? wuffs_base__make_slice_token(buf->data.ptr + buf->meta.wi, |
4285 | 0 | buf->data.len - buf->meta.wi) |
4286 | 0 | : wuffs_base__empty_slice_token(); |
4287 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token_buffer__writer_slice Unexecuted instantiation: json_fuzzer.cc:wuffs_base__token_buffer__writer_slice(wuffs_base__token_buffer__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token_buffer__writer_slice Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token_buffer__writer_slice Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token_buffer__writer_slice Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__token_buffer__writer_slice Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token_buffer__writer_slice Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token_buffer__writer_slice Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token_buffer__writer_slice Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token_buffer__writer_slice Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token_buffer__writer_slice Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token_buffer__writer_slice |
4288 | | |
4289 | | static inline uint64_t // |
4290 | | wuffs_base__token_buffer__writer_token_position( |
4291 | 0 | const wuffs_base__token_buffer* buf) { |
4292 | 0 | return buf ? wuffs_base__u64__sat_add(buf->meta.pos, buf->meta.wi) : 0; |
4293 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__token_buffer__writer_token_position Unexecuted instantiation: json_fuzzer.cc:wuffs_base__token_buffer__writer_token_position(wuffs_base__token_buffer__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__token_buffer__writer_token_position Unexecuted instantiation: xz_fuzzer.c:wuffs_base__token_buffer__writer_token_position Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__token_buffer__writer_token_position Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__token_buffer__writer_token_position Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__token_buffer__writer_token_position Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__token_buffer__writer_token_position Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__token_buffer__writer_token_position Unexecuted instantiation: targa_fuzzer.c:wuffs_base__token_buffer__writer_token_position Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__token_buffer__writer_token_position Unexecuted instantiation: webp_fuzzer.c:wuffs_base__token_buffer__writer_token_position |
4294 | | |
4295 | | #ifdef __cplusplus |
4296 | | |
4297 | | inline bool // |
4298 | 0 | wuffs_base__token_buffer::is_valid() const { |
4299 | 0 | return wuffs_base__token_buffer__is_valid(this); |
4300 | 0 | } |
4301 | | |
4302 | | inline size_t // |
4303 | 34.1k | wuffs_base__token_buffer::compact() { |
4304 | 34.1k | return wuffs_base__token_buffer__compact(this); |
4305 | 34.1k | } |
4306 | | |
4307 | | inline size_t // |
4308 | 0 | wuffs_base__token_buffer::compact_retaining(uint64_t history_retain_length) { |
4309 | 0 | return wuffs_base__token_buffer__compact_retaining(this, |
4310 | 0 | history_retain_length); |
4311 | 0 | } |
4312 | | |
4313 | | inline uint64_t // |
4314 | 0 | wuffs_base__token_buffer::reader_length() const { |
4315 | 0 | return wuffs_base__token_buffer__reader_length(this); |
4316 | 0 | } |
4317 | | |
4318 | | inline wuffs_base__token* // |
4319 | 0 | wuffs_base__token_buffer::reader_pointer() const { |
4320 | 0 | return wuffs_base__token_buffer__reader_pointer(this); |
4321 | 0 | } |
4322 | | |
4323 | | inline wuffs_base__slice_token // |
4324 | 0 | wuffs_base__token_buffer::reader_slice() const { |
4325 | 0 | return wuffs_base__token_buffer__reader_slice(this); |
4326 | 0 | } |
4327 | | |
4328 | | inline uint64_t // |
4329 | 0 | wuffs_base__token_buffer::reader_token_position() const { |
4330 | 0 | return wuffs_base__token_buffer__reader_token_position(this); |
4331 | 0 | } |
4332 | | |
4333 | | inline uint64_t // |
4334 | 0 | wuffs_base__token_buffer::writer_length() const { |
4335 | 0 | return wuffs_base__token_buffer__writer_length(this); |
4336 | 0 | } |
4337 | | |
4338 | | inline wuffs_base__token* // |
4339 | 0 | wuffs_base__token_buffer::writer_pointer() const { |
4340 | 0 | return wuffs_base__token_buffer__writer_pointer(this); |
4341 | 0 | } |
4342 | | |
4343 | | inline wuffs_base__slice_token // |
4344 | 0 | wuffs_base__token_buffer::writer_slice() const { |
4345 | 0 | return wuffs_base__token_buffer__writer_slice(this); |
4346 | 0 | } |
4347 | | |
4348 | | inline uint64_t // |
4349 | 0 | wuffs_base__token_buffer::writer_token_position() const { |
4350 | 0 | return wuffs_base__token_buffer__writer_token_position(this); |
4351 | 0 | } |
4352 | | |
4353 | | #endif // __cplusplus |
4354 | | |
4355 | | // ---------------- Memory Allocation |
4356 | | |
4357 | | // The memory allocation related functions in this section aren't used by Wuffs |
4358 | | // per se, but they may be helpful to the code that uses Wuffs. |
4359 | | |
4360 | | // wuffs_base__malloc_slice_uxx wraps calling a malloc-like function, except |
4361 | | // that it takes a uint64_t number of elements instead of a size_t size in |
4362 | | // bytes, and it returns a slice (a pointer and a length) instead of just a |
4363 | | // pointer. |
4364 | | // |
4365 | | // You can pass the C stdlib's malloc as the malloc_func. |
4366 | | // |
4367 | | // It returns an empty slice (containing a NULL ptr field) if num_uxx is zero |
4368 | | // or if (num_uxx * sizeof(uintxx_t)) would overflow SIZE_MAX. |
4369 | | |
4370 | | static inline wuffs_base__slice_u8 // |
4371 | 26.7k | wuffs_base__malloc_slice_u8(void* (*malloc_func)(size_t), uint64_t num_u8) { |
4372 | 26.7k | if (malloc_func && num_u8 && (num_u8 <= (SIZE_MAX / sizeof(uint8_t)))) { |
4373 | 26.7k | void* p = (*malloc_func)((size_t)(num_u8 * sizeof(uint8_t))); |
4374 | 26.7k | if (p) { |
4375 | 26.7k | return wuffs_base__make_slice_u8((uint8_t*)(p), (size_t)num_u8); |
4376 | 26.7k | } |
4377 | 26.7k | } |
4378 | 0 | return wuffs_base__empty_slice_u8(); |
4379 | 26.7k | } png_fuzzer.c:wuffs_base__malloc_slice_u8 Line | Count | Source | 4371 | 8.61k | wuffs_base__malloc_slice_u8(void* (*malloc_func)(size_t), uint64_t num_u8) { | 4372 | 8.61k | if (malloc_func && num_u8 && (num_u8 <= (SIZE_MAX / sizeof(uint8_t)))) { | 4373 | 8.61k | void* p = (*malloc_func)((size_t)(num_u8 * sizeof(uint8_t))); | 4374 | 8.61k | if (p) { | 4375 | 8.61k | return wuffs_base__make_slice_u8((uint8_t*)(p), (size_t)num_u8); | 4376 | 8.61k | } | 4377 | 8.61k | } | 4378 | 0 | return wuffs_base__empty_slice_u8(); | 4379 | 8.61k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__malloc_slice_u8(void* (*)(unsigned long), unsigned long) gif_fuzzer.c:wuffs_base__malloc_slice_u8 Line | Count | Source | 4371 | 1.42k | wuffs_base__malloc_slice_u8(void* (*malloc_func)(size_t), uint64_t num_u8) { | 4372 | 1.42k | if (malloc_func && num_u8 && (num_u8 <= (SIZE_MAX / sizeof(uint8_t)))) { | 4373 | 1.42k | void* p = (*malloc_func)((size_t)(num_u8 * sizeof(uint8_t))); | 4374 | 1.42k | if (p) { | 4375 | 1.42k | return wuffs_base__make_slice_u8((uint8_t*)(p), (size_t)num_u8); | 4376 | 1.42k | } | 4377 | 1.42k | } | 4378 | 0 | return wuffs_base__empty_slice_u8(); | 4379 | 1.42k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__malloc_slice_u8 jpeg_fuzzer.c:wuffs_base__malloc_slice_u8 Line | Count | Source | 4371 | 5.71k | wuffs_base__malloc_slice_u8(void* (*malloc_func)(size_t), uint64_t num_u8) { | 4372 | 5.71k | if (malloc_func && num_u8 && (num_u8 <= (SIZE_MAX / sizeof(uint8_t)))) { | 4373 | 5.71k | void* p = (*malloc_func)((size_t)(num_u8 * sizeof(uint8_t))); | 4374 | 5.71k | if (p) { | 4375 | 5.71k | return wuffs_base__make_slice_u8((uint8_t*)(p), (size_t)num_u8); | 4376 | 5.71k | } | 4377 | 5.71k | } | 4378 | 0 | return wuffs_base__empty_slice_u8(); | 4379 | 5.71k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__malloc_slice_u8 bmp_fuzzer.c:wuffs_base__malloc_slice_u8 Line | Count | Source | 4371 | 1.70k | wuffs_base__malloc_slice_u8(void* (*malloc_func)(size_t), uint64_t num_u8) { | 4372 | 1.70k | if (malloc_func && num_u8 && (num_u8 <= (SIZE_MAX / sizeof(uint8_t)))) { | 4373 | 1.70k | void* p = (*malloc_func)((size_t)(num_u8 * sizeof(uint8_t))); | 4374 | 1.70k | if (p) { | 4375 | 1.70k | return wuffs_base__make_slice_u8((uint8_t*)(p), (size_t)num_u8); | 4376 | 1.70k | } | 4377 | 1.70k | } | 4378 | 0 | return wuffs_base__empty_slice_u8(); | 4379 | 1.70k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__malloc_slice_u8 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__malloc_slice_u8 targa_fuzzer.c:wuffs_base__malloc_slice_u8 Line | Count | Source | 4371 | 862 | wuffs_base__malloc_slice_u8(void* (*malloc_func)(size_t), uint64_t num_u8) { | 4372 | 862 | if (malloc_func && num_u8 && (num_u8 <= (SIZE_MAX / sizeof(uint8_t)))) { | 4373 | 862 | void* p = (*malloc_func)((size_t)(num_u8 * sizeof(uint8_t))); | 4374 | 862 | if (p) { | 4375 | 862 | return wuffs_base__make_slice_u8((uint8_t*)(p), (size_t)num_u8); | 4376 | 862 | } | 4377 | 862 | } | 4378 | 0 | return wuffs_base__empty_slice_u8(); | 4379 | 862 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__malloc_slice_u8 webp_fuzzer.c:wuffs_base__malloc_slice_u8 Line | Count | Source | 4371 | 8.46k | wuffs_base__malloc_slice_u8(void* (*malloc_func)(size_t), uint64_t num_u8) { | 4372 | 8.46k | if (malloc_func && num_u8 && (num_u8 <= (SIZE_MAX / sizeof(uint8_t)))) { | 4373 | 8.46k | void* p = (*malloc_func)((size_t)(num_u8 * sizeof(uint8_t))); | 4374 | 8.46k | if (p) { | 4375 | 8.46k | return wuffs_base__make_slice_u8((uint8_t*)(p), (size_t)num_u8); | 4376 | 8.46k | } | 4377 | 8.46k | } | 4378 | 0 | return wuffs_base__empty_slice_u8(); | 4379 | 8.46k | } |
|
4380 | | |
4381 | | static inline wuffs_base__slice_u16 // |
4382 | 0 | wuffs_base__malloc_slice_u16(void* (*malloc_func)(size_t), uint64_t num_u16) { |
4383 | 0 | if (malloc_func && num_u16 && (num_u16 <= (SIZE_MAX / sizeof(uint16_t)))) { |
4384 | 0 | void* p = (*malloc_func)((size_t)(num_u16 * sizeof(uint16_t))); |
4385 | 0 | if (p) { |
4386 | 0 | return wuffs_base__make_slice_u16((uint16_t*)(p), (size_t)num_u16); |
4387 | 0 | } |
4388 | 0 | } |
4389 | 0 | return wuffs_base__empty_slice_u16(); |
4390 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__malloc_slice_u16 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__malloc_slice_u16(void* (*)(unsigned long), unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__malloc_slice_u16 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__malloc_slice_u16 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__malloc_slice_u16 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__malloc_slice_u16 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__malloc_slice_u16 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__malloc_slice_u16 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__malloc_slice_u16 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__malloc_slice_u16 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__malloc_slice_u16 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__malloc_slice_u16 |
4391 | | |
4392 | | static inline wuffs_base__slice_u32 // |
4393 | 0 | wuffs_base__malloc_slice_u32(void* (*malloc_func)(size_t), uint64_t num_u32) { |
4394 | 0 | if (malloc_func && num_u32 && (num_u32 <= (SIZE_MAX / sizeof(uint32_t)))) { |
4395 | 0 | void* p = (*malloc_func)((size_t)(num_u32 * sizeof(uint32_t))); |
4396 | 0 | if (p) { |
4397 | 0 | return wuffs_base__make_slice_u32((uint32_t*)(p), (size_t)num_u32); |
4398 | 0 | } |
4399 | 0 | } |
4400 | 0 | return wuffs_base__empty_slice_u32(); |
4401 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__malloc_slice_u32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__malloc_slice_u32(void* (*)(unsigned long), unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__malloc_slice_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__malloc_slice_u32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__malloc_slice_u32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__malloc_slice_u32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__malloc_slice_u32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__malloc_slice_u32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__malloc_slice_u32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__malloc_slice_u32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__malloc_slice_u32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__malloc_slice_u32 |
4402 | | |
4403 | | static inline wuffs_base__slice_u64 // |
4404 | 0 | wuffs_base__malloc_slice_u64(void* (*malloc_func)(size_t), uint64_t num_u64) { |
4405 | 0 | if (malloc_func && num_u64 && (num_u64 <= (SIZE_MAX / sizeof(uint64_t)))) { |
4406 | 0 | void* p = (*malloc_func)((size_t)(num_u64 * sizeof(uint64_t))); |
4407 | 0 | if (p) { |
4408 | 0 | return wuffs_base__make_slice_u64((uint64_t*)(p), (size_t)num_u64); |
4409 | 0 | } |
4410 | 0 | } |
4411 | 0 | return wuffs_base__empty_slice_u64(); |
4412 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__malloc_slice_u64 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__malloc_slice_u64(void* (*)(unsigned long), unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__malloc_slice_u64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__malloc_slice_u64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__malloc_slice_u64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__malloc_slice_u64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__malloc_slice_u64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__malloc_slice_u64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__malloc_slice_u64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__malloc_slice_u64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__malloc_slice_u64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__malloc_slice_u64 |
4413 | | |
4414 | | // ---------------- Images |
4415 | | |
4416 | | // WUFFS_BASE__IMAGE__DIMENSION_MAX_INCL is the largest width or height |
4417 | | // (measured in pixels) supported by Wuffs' standard library's image codecs. |
4418 | | // |
4419 | | // Any non-negative integer N less than or equal to ((1 << 24) - 1) can be |
4420 | | // losslessly converted to and from single-precision floating point (what C |
4421 | | // calls the "float" type and what Go calls "float32"). |
4422 | | // |
4423 | | // A Wuffs image can have up to 4 channels and up to 8 bytes per channel (8 is |
4424 | | // also known as sizeof(double)), combining for up to 32 bytes per pixel. When |
4425 | | // calculating memory requirements, the 0xFFFFFF upper bound also means that: |
4426 | | // - (32 * N) will not overflow an int32_t or uint32_t. |
4427 | | // - (32 * N * N) will not overflow an int64_t or uint64_t, provided that N |
4428 | | // already has a 64-bit type. |
4429 | | // |
4430 | | // 0xFFFFFF in decimal is 16777215. |
4431 | | #define WUFFS_BASE__IMAGE__DIMENSION_MAX_INCL 0xFFFFFF |
4432 | | |
4433 | | // wuffs_base__color_u32_argb_premul is an 8 bit per channel premultiplied |
4434 | | // Alpha, Red, Green, Blue color, as a uint32_t value. Its value is always |
4435 | | // 0xAARRGGBB (Alpha most significant, Blue least), regardless of endianness. |
4436 | | typedef uint32_t wuffs_base__color_u32_argb_premul; |
4437 | | |
4438 | | // wuffs_base__color_u32_argb_nonpremul is non-premultiplied version of |
4439 | | // wuffs_base__color_u32_argb_premul. |
4440 | | typedef uint32_t wuffs_base__color_u32_argb_nonpremul; |
4441 | | |
4442 | | // wuffs_base__color_u32_argb_premul__is_valid returns whether c's Red, Green |
4443 | | // and Blue channels are all less than or equal to its Alpha channel. c uses |
4444 | | // premultiplied alpha, so 50% opaque 100% saturated red is 0x7F7F_0000 and a |
4445 | | // value like 0x7F80_0000 is invalid. |
4446 | | static inline bool // |
4447 | | wuffs_base__color_u32_argb_premul__is_valid( |
4448 | 0 | wuffs_base__color_u32_argb_premul c) { |
4449 | 0 | uint32_t a = 0xFF & (c >> 24); |
4450 | 0 | uint32_t r = 0xFF & (c >> 16); |
4451 | 0 | uint32_t g = 0xFF & (c >> 8); |
4452 | 0 | uint32_t b = 0xFF & (c >> 0); |
4453 | 0 | return (a >= r) && (a >= g) && (a >= b); |
4454 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_u32_argb_premul__is_valid Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_u32_argb_premul__is_valid(unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_u32_argb_premul__is_valid Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_u32_argb_premul__is_valid Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_u32_argb_premul__is_valid Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_u32_argb_premul__is_valid Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_u32_argb_premul__is_valid Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__color_u32_argb_premul__is_valid Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_u32_argb_premul__is_valid Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_u32_argb_premul__is_valid Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_u32_argb_premul__is_valid Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_u32_argb_premul__is_valid |
4455 | | |
4456 | | static inline uint16_t // |
4457 | | wuffs_base__color_u32_argb_premul__as__color_u16_rgb_565( |
4458 | 47.8k | wuffs_base__color_u32_argb_premul c) { |
4459 | 47.8k | uint32_t r5 = 0xF800 & (c >> 8); |
4460 | 47.8k | uint32_t g6 = 0x07E0 & (c >> 5); |
4461 | 47.8k | uint32_t b5 = 0x001F & (c >> 3); |
4462 | 47.8k | return (uint16_t)(r5 | g6 | b5); |
4463 | 47.8k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_rgb_565 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_u32_argb_premul__as__color_u16_rgb_565(unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_rgb_565 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_rgb_565 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_rgb_565 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_rgb_565 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_rgb_565 pixel_swizzler_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_rgb_565 Line | Count | Source | 4458 | 47.8k | wuffs_base__color_u32_argb_premul c) { | 4459 | 47.8k | uint32_t r5 = 0xF800 & (c >> 8); | 4460 | 47.8k | uint32_t g6 = 0x07E0 & (c >> 5); | 4461 | 47.8k | uint32_t b5 = 0x001F & (c >> 3); | 4462 | 47.8k | return (uint16_t)(r5 | g6 | b5); | 4463 | 47.8k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_rgb_565 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_rgb_565 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_rgb_565 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_rgb_565 |
4464 | | |
4465 | | static inline wuffs_base__color_u32_argb_premul // |
4466 | 2.57k | wuffs_base__color_u16_rgb_565__as__color_u32_argb_premul(uint16_t rgb_565) { |
4467 | 2.57k | uint32_t b5 = 0x1F & (rgb_565 >> 0); |
4468 | 2.57k | uint32_t b = (b5 << 3) | (b5 >> 2); |
4469 | 2.57k | uint32_t g6 = 0x3F & (rgb_565 >> 5); |
4470 | 2.57k | uint32_t g = (g6 << 2) | (g6 >> 4); |
4471 | 2.57k | uint32_t r5 = 0x1F & (rgb_565 >> 11); |
4472 | 2.57k | uint32_t r = (r5 << 3) | (r5 >> 2); |
4473 | 2.57k | return 0xFF000000 | (r << 16) | (g << 8) | (b << 0); |
4474 | 2.57k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_u16_rgb_565__as__color_u32_argb_premul Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_u16_rgb_565__as__color_u32_argb_premul(unsigned short) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_u16_rgb_565__as__color_u32_argb_premul Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_u16_rgb_565__as__color_u32_argb_premul Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_u16_rgb_565__as__color_u32_argb_premul Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_u16_rgb_565__as__color_u32_argb_premul Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_u16_rgb_565__as__color_u32_argb_premul pixel_swizzler_fuzzer.c:wuffs_base__color_u16_rgb_565__as__color_u32_argb_premul Line | Count | Source | 4466 | 2.57k | wuffs_base__color_u16_rgb_565__as__color_u32_argb_premul(uint16_t rgb_565) { | 4467 | 2.57k | uint32_t b5 = 0x1F & (rgb_565 >> 0); | 4468 | 2.57k | uint32_t b = (b5 << 3) | (b5 >> 2); | 4469 | 2.57k | uint32_t g6 = 0x3F & (rgb_565 >> 5); | 4470 | 2.57k | uint32_t g = (g6 << 2) | (g6 >> 4); | 4471 | 2.57k | uint32_t r5 = 0x1F & (rgb_565 >> 11); | 4472 | 2.57k | uint32_t r = (r5 << 3) | (r5 >> 2); | 4473 | 2.57k | return 0xFF000000 | (r << 16) | (g << 8) | (b << 0); | 4474 | 2.57k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_u16_rgb_565__as__color_u32_argb_premul Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_u16_rgb_565__as__color_u32_argb_premul Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_u16_rgb_565__as__color_u32_argb_premul Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_u16_rgb_565__as__color_u32_argb_premul |
4475 | | |
4476 | | static inline uint8_t // |
4477 | | wuffs_base__color_u32_argb_premul__as__color_u8_gray( |
4478 | 72.1k | wuffs_base__color_u32_argb_premul c) { |
4479 | | // Work in 16-bit color. |
4480 | 72.1k | uint32_t cr = 0x101 * (0xFF & (c >> 16)); |
4481 | 72.1k | uint32_t cg = 0x101 * (0xFF & (c >> 8)); |
4482 | 72.1k | uint32_t cb = 0x101 * (0xFF & (c >> 0)); |
4483 | | |
4484 | | // These coefficients (the fractions 0.299, 0.587 and 0.114) are the same |
4485 | | // as those given by the JFIF specification. |
4486 | | // |
4487 | | // Note that 19595 + 38470 + 7471 equals 65536, also known as (1 << 16). We |
4488 | | // shift by 24, not just by 16, because the return value is 8-bit color, not |
4489 | | // 16-bit color. |
4490 | 72.1k | uint32_t weighted_average = (19595 * cr) + (38470 * cg) + (7471 * cb) + 32768; |
4491 | 72.1k | return (uint8_t)(weighted_average >> 24); |
4492 | 72.1k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u8_gray Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_u32_argb_premul__as__color_u8_gray(unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u8_gray Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u8_gray Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u8_gray Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u8_gray Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u8_gray pixel_swizzler_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u8_gray Line | Count | Source | 4478 | 72.1k | wuffs_base__color_u32_argb_premul c) { | 4479 | | // Work in 16-bit color. | 4480 | 72.1k | uint32_t cr = 0x101 * (0xFF & (c >> 16)); | 4481 | 72.1k | uint32_t cg = 0x101 * (0xFF & (c >> 8)); | 4482 | 72.1k | uint32_t cb = 0x101 * (0xFF & (c >> 0)); | 4483 | | | 4484 | | // These coefficients (the fractions 0.299, 0.587 and 0.114) are the same | 4485 | | // as those given by the JFIF specification. | 4486 | | // | 4487 | | // Note that 19595 + 38470 + 7471 equals 65536, also known as (1 << 16). We | 4488 | | // shift by 24, not just by 16, because the return value is 8-bit color, not | 4489 | | // 16-bit color. | 4490 | 72.1k | uint32_t weighted_average = (19595 * cr) + (38470 * cg) + (7471 * cb) + 32768; | 4491 | 72.1k | return (uint8_t)(weighted_average >> 24); | 4492 | 72.1k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u8_gray Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u8_gray Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u8_gray Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u8_gray |
4493 | | |
4494 | | static inline uint16_t // |
4495 | | wuffs_base__color_u32_argb_premul__as__color_u16_alpha_gray_nonpremul( |
4496 | 23.7k | wuffs_base__color_u32_argb_premul c) { |
4497 | 23.7k | uint32_t a = 0xFF & (c >> 24); |
4498 | 23.7k | if (a == 0) { |
4499 | 0 | return 0; |
4500 | 0 | } |
4501 | 23.7k | uint32_t a16 = a * 0x101; |
4502 | | |
4503 | 23.7k | uint32_t cr = 0xFF & (c >> 16); |
4504 | 23.7k | cr = (cr * (0x101 * 0xFFFF)) / a16; |
4505 | 23.7k | uint32_t cg = 0xFF & (c >> 8); |
4506 | 23.7k | cg = (cg * (0x101 * 0xFFFF)) / a16; |
4507 | 23.7k | uint32_t cb = 0xFF & (c >> 0); |
4508 | 23.7k | cb = (cb * (0x101 * 0xFFFF)) / a16; |
4509 | | |
4510 | 23.7k | uint32_t weighted_average = (19595 * cr) + (38470 * cg) + (7471 * cb) + 32768; |
4511 | 23.7k | return (uint16_t)((a16 & 0xFF00) | (weighted_average >> 24)); |
4512 | 23.7k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_alpha_gray_nonpremul Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_u32_argb_premul__as__color_u16_alpha_gray_nonpremul(unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_alpha_gray_nonpremul Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_alpha_gray_nonpremul Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_alpha_gray_nonpremul Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_alpha_gray_nonpremul Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_alpha_gray_nonpremul pixel_swizzler_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_alpha_gray_nonpremul Line | Count | Source | 4496 | 23.7k | wuffs_base__color_u32_argb_premul c) { | 4497 | 23.7k | uint32_t a = 0xFF & (c >> 24); | 4498 | 23.7k | if (a == 0) { | 4499 | 0 | return 0; | 4500 | 0 | } | 4501 | 23.7k | uint32_t a16 = a * 0x101; | 4502 | | | 4503 | 23.7k | uint32_t cr = 0xFF & (c >> 16); | 4504 | 23.7k | cr = (cr * (0x101 * 0xFFFF)) / a16; | 4505 | 23.7k | uint32_t cg = 0xFF & (c >> 8); | 4506 | 23.7k | cg = (cg * (0x101 * 0xFFFF)) / a16; | 4507 | 23.7k | uint32_t cb = 0xFF & (c >> 0); | 4508 | 23.7k | cb = (cb * (0x101 * 0xFFFF)) / a16; | 4509 | | | 4510 | 23.7k | uint32_t weighted_average = (19595 * cr) + (38470 * cg) + (7471 * cb) + 32768; | 4511 | 23.7k | return (uint16_t)((a16 & 0xFF00) | (weighted_average >> 24)); | 4512 | 23.7k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_alpha_gray_nonpremul Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_alpha_gray_nonpremul Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_alpha_gray_nonpremul Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_alpha_gray_nonpremul |
4513 | | |
4514 | | static inline uint16_t // |
4515 | | wuffs_base__color_u32_argb_premul__as__color_u16_gray( |
4516 | 25.5k | wuffs_base__color_u32_argb_premul c) { |
4517 | | // Work in 16-bit color. |
4518 | 25.5k | uint32_t cr = 0x101 * (0xFF & (c >> 16)); |
4519 | 25.5k | uint32_t cg = 0x101 * (0xFF & (c >> 8)); |
4520 | 25.5k | uint32_t cb = 0x101 * (0xFF & (c >> 0)); |
4521 | | |
4522 | | // These coefficients (the fractions 0.299, 0.587 and 0.114) are the same |
4523 | | // as those given by the JFIF specification. |
4524 | | // |
4525 | | // Note that 19595 + 38470 + 7471 equals 65536, also known as (1 << 16). |
4526 | 25.5k | uint32_t weighted_average = (19595 * cr) + (38470 * cg) + (7471 * cb) + 32768; |
4527 | 25.5k | return (uint16_t)(weighted_average >> 16); |
4528 | 25.5k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_gray Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_u32_argb_premul__as__color_u16_gray(unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_gray Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_gray Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_gray Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_gray Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_gray pixel_swizzler_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_gray Line | Count | Source | 4516 | 25.5k | wuffs_base__color_u32_argb_premul c) { | 4517 | | // Work in 16-bit color. | 4518 | 25.5k | uint32_t cr = 0x101 * (0xFF & (c >> 16)); | 4519 | 25.5k | uint32_t cg = 0x101 * (0xFF & (c >> 8)); | 4520 | 25.5k | uint32_t cb = 0x101 * (0xFF & (c >> 0)); | 4521 | | | 4522 | | // These coefficients (the fractions 0.299, 0.587 and 0.114) are the same | 4523 | | // as those given by the JFIF specification. | 4524 | | // | 4525 | | // Note that 19595 + 38470 + 7471 equals 65536, also known as (1 << 16). | 4526 | 25.5k | uint32_t weighted_average = (19595 * cr) + (38470 * cg) + (7471 * cb) + 32768; | 4527 | 25.5k | return (uint16_t)(weighted_average >> 16); | 4528 | 25.5k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_gray Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_gray Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_gray Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u16_gray |
4529 | | |
4530 | | // wuffs_base__color_u32_argb_nonpremul__as__color_u32_argb_premul converts |
4531 | | // from non-premultiplied alpha to premultiplied alpha. |
4532 | | static inline wuffs_base__color_u32_argb_premul // |
4533 | | wuffs_base__color_u32_argb_nonpremul__as__color_u32_argb_premul( |
4534 | 544M | uint32_t argb_nonpremul) { |
4535 | | // Multiplying by 0x101 (twice, once for alpha and once for color) converts |
4536 | | // from 8-bit to 16-bit color. Shifting right by 8 undoes that. |
4537 | | // |
4538 | | // Working in the higher bit depth can produce slightly different (and |
4539 | | // arguably slightly more accurate) results. For example, given 8-bit blue |
4540 | | // and alpha of 0x80 and 0x81: |
4541 | | // |
4542 | | // - ((0x80 * 0x81 ) / 0xFF ) = 0x40 = 0x40 |
4543 | | // - ((0x8080 * 0x8181) / 0xFFFF) >> 8 = 0x4101 >> 8 = 0x41 |
4544 | 544M | uint32_t a = 0xFF & (argb_nonpremul >> 24); |
4545 | 544M | uint32_t a16 = a * (0x101 * 0x101); |
4546 | | |
4547 | 544M | uint32_t r = 0xFF & (argb_nonpremul >> 16); |
4548 | 544M | r = ((r * a16) / 0xFFFF) >> 8; |
4549 | 544M | uint32_t g = 0xFF & (argb_nonpremul >> 8); |
4550 | 544M | g = ((g * a16) / 0xFFFF) >> 8; |
4551 | 544M | uint32_t b = 0xFF & (argb_nonpremul >> 0); |
4552 | 544M | b = ((b * a16) / 0xFFFF) >> 8; |
4553 | | |
4554 | 544M | return (a << 24) | (r << 16) | (g << 8) | (b << 0); |
4555 | 544M | } png_fuzzer.c:wuffs_base__color_u32_argb_nonpremul__as__color_u32_argb_premul Line | Count | Source | 4534 | 67.6M | uint32_t argb_nonpremul) { | 4535 | | // Multiplying by 0x101 (twice, once for alpha and once for color) converts | 4536 | | // from 8-bit to 16-bit color. Shifting right by 8 undoes that. | 4537 | | // | 4538 | | // Working in the higher bit depth can produce slightly different (and | 4539 | | // arguably slightly more accurate) results. For example, given 8-bit blue | 4540 | | // and alpha of 0x80 and 0x81: | 4541 | | // | 4542 | | // - ((0x80 * 0x81 ) / 0xFF ) = 0x40 = 0x40 | 4543 | | // - ((0x8080 * 0x8181) / 0xFFFF) >> 8 = 0x4101 >> 8 = 0x41 | 4544 | 67.6M | uint32_t a = 0xFF & (argb_nonpremul >> 24); | 4545 | 67.6M | uint32_t a16 = a * (0x101 * 0x101); | 4546 | | | 4547 | 67.6M | uint32_t r = 0xFF & (argb_nonpremul >> 16); | 4548 | 67.6M | r = ((r * a16) / 0xFFFF) >> 8; | 4549 | 67.6M | uint32_t g = 0xFF & (argb_nonpremul >> 8); | 4550 | 67.6M | g = ((g * a16) / 0xFFFF) >> 8; | 4551 | 67.6M | uint32_t b = 0xFF & (argb_nonpremul >> 0); | 4552 | 67.6M | b = ((b * a16) / 0xFFFF) >> 8; | 4553 | | | 4554 | 67.6M | return (a << 24) | (r << 16) | (g << 8) | (b << 0); | 4555 | 67.6M | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_u32_argb_nonpremul__as__color_u32_argb_premul(unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_u32_argb_nonpremul__as__color_u32_argb_premul Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_u32_argb_nonpremul__as__color_u32_argb_premul Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_u32_argb_nonpremul__as__color_u32_argb_premul Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_u32_argb_nonpremul__as__color_u32_argb_premul bmp_fuzzer.c:wuffs_base__color_u32_argb_nonpremul__as__color_u32_argb_premul Line | Count | Source | 4534 | 591k | uint32_t argb_nonpremul) { | 4535 | | // Multiplying by 0x101 (twice, once for alpha and once for color) converts | 4536 | | // from 8-bit to 16-bit color. Shifting right by 8 undoes that. | 4537 | | // | 4538 | | // Working in the higher bit depth can produce slightly different (and | 4539 | | // arguably slightly more accurate) results. For example, given 8-bit blue | 4540 | | // and alpha of 0x80 and 0x81: | 4541 | | // | 4542 | | // - ((0x80 * 0x81 ) / 0xFF ) = 0x40 = 0x40 | 4543 | | // - ((0x8080 * 0x8181) / 0xFFFF) >> 8 = 0x4101 >> 8 = 0x41 | 4544 | 591k | uint32_t a = 0xFF & (argb_nonpremul >> 24); | 4545 | 591k | uint32_t a16 = a * (0x101 * 0x101); | 4546 | | | 4547 | 591k | uint32_t r = 0xFF & (argb_nonpremul >> 16); | 4548 | 591k | r = ((r * a16) / 0xFFFF) >> 8; | 4549 | 591k | uint32_t g = 0xFF & (argb_nonpremul >> 8); | 4550 | 591k | g = ((g * a16) / 0xFFFF) >> 8; | 4551 | 591k | uint32_t b = 0xFF & (argb_nonpremul >> 0); | 4552 | 591k | b = ((b * a16) / 0xFFFF) >> 8; | 4553 | | | 4554 | 591k | return (a << 24) | (r << 16) | (g << 8) | (b << 0); | 4555 | 591k | } |
pixel_swizzler_fuzzer.c:wuffs_base__color_u32_argb_nonpremul__as__color_u32_argb_premul Line | Count | Source | 4534 | 14.0k | uint32_t argb_nonpremul) { | 4535 | | // Multiplying by 0x101 (twice, once for alpha and once for color) converts | 4536 | | // from 8-bit to 16-bit color. Shifting right by 8 undoes that. | 4537 | | // | 4538 | | // Working in the higher bit depth can produce slightly different (and | 4539 | | // arguably slightly more accurate) results. For example, given 8-bit blue | 4540 | | // and alpha of 0x80 and 0x81: | 4541 | | // | 4542 | | // - ((0x80 * 0x81 ) / 0xFF ) = 0x40 = 0x40 | 4543 | | // - ((0x8080 * 0x8181) / 0xFFFF) >> 8 = 0x4101 >> 8 = 0x41 | 4544 | 14.0k | uint32_t a = 0xFF & (argb_nonpremul >> 24); | 4545 | 14.0k | uint32_t a16 = a * (0x101 * 0x101); | 4546 | | | 4547 | 14.0k | uint32_t r = 0xFF & (argb_nonpremul >> 16); | 4548 | 14.0k | r = ((r * a16) / 0xFFFF) >> 8; | 4549 | 14.0k | uint32_t g = 0xFF & (argb_nonpremul >> 8); | 4550 | 14.0k | g = ((g * a16) / 0xFFFF) >> 8; | 4551 | 14.0k | uint32_t b = 0xFF & (argb_nonpremul >> 0); | 4552 | 14.0k | b = ((b * a16) / 0xFFFF) >> 8; | 4553 | | | 4554 | 14.0k | return (a << 24) | (r << 16) | (g << 8) | (b << 0); | 4555 | 14.0k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_u32_argb_nonpremul__as__color_u32_argb_premul targa_fuzzer.c:wuffs_base__color_u32_argb_nonpremul__as__color_u32_argb_premul Line | Count | Source | 4534 | 1.55M | uint32_t argb_nonpremul) { | 4535 | | // Multiplying by 0x101 (twice, once for alpha and once for color) converts | 4536 | | // from 8-bit to 16-bit color. Shifting right by 8 undoes that. | 4537 | | // | 4538 | | // Working in the higher bit depth can produce slightly different (and | 4539 | | // arguably slightly more accurate) results. For example, given 8-bit blue | 4540 | | // and alpha of 0x80 and 0x81: | 4541 | | // | 4542 | | // - ((0x80 * 0x81 ) / 0xFF ) = 0x40 = 0x40 | 4543 | | // - ((0x8080 * 0x8181) / 0xFFFF) >> 8 = 0x4101 >> 8 = 0x41 | 4544 | 1.55M | uint32_t a = 0xFF & (argb_nonpremul >> 24); | 4545 | 1.55M | uint32_t a16 = a * (0x101 * 0x101); | 4546 | | | 4547 | 1.55M | uint32_t r = 0xFF & (argb_nonpremul >> 16); | 4548 | 1.55M | r = ((r * a16) / 0xFFFF) >> 8; | 4549 | 1.55M | uint32_t g = 0xFF & (argb_nonpremul >> 8); | 4550 | 1.55M | g = ((g * a16) / 0xFFFF) >> 8; | 4551 | 1.55M | uint32_t b = 0xFF & (argb_nonpremul >> 0); | 4552 | 1.55M | b = ((b * a16) / 0xFFFF) >> 8; | 4553 | | | 4554 | 1.55M | return (a << 24) | (r << 16) | (g << 8) | (b << 0); | 4555 | 1.55M | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_u32_argb_nonpremul__as__color_u32_argb_premul webp_fuzzer.c:wuffs_base__color_u32_argb_nonpremul__as__color_u32_argb_premul Line | Count | Source | 4534 | 474M | uint32_t argb_nonpremul) { | 4535 | | // Multiplying by 0x101 (twice, once for alpha and once for color) converts | 4536 | | // from 8-bit to 16-bit color. Shifting right by 8 undoes that. | 4537 | | // | 4538 | | // Working in the higher bit depth can produce slightly different (and | 4539 | | // arguably slightly more accurate) results. For example, given 8-bit blue | 4540 | | // and alpha of 0x80 and 0x81: | 4541 | | // | 4542 | | // - ((0x80 * 0x81 ) / 0xFF ) = 0x40 = 0x40 | 4543 | | // - ((0x8080 * 0x8181) / 0xFFFF) >> 8 = 0x4101 >> 8 = 0x41 | 4544 | 474M | uint32_t a = 0xFF & (argb_nonpremul >> 24); | 4545 | 474M | uint32_t a16 = a * (0x101 * 0x101); | 4546 | | | 4547 | 474M | uint32_t r = 0xFF & (argb_nonpremul >> 16); | 4548 | 474M | r = ((r * a16) / 0xFFFF) >> 8; | 4549 | 474M | uint32_t g = 0xFF & (argb_nonpremul >> 8); | 4550 | 474M | g = ((g * a16) / 0xFFFF) >> 8; | 4551 | 474M | uint32_t b = 0xFF & (argb_nonpremul >> 0); | 4552 | 474M | b = ((b * a16) / 0xFFFF) >> 8; | 4553 | | | 4554 | 474M | return (a << 24) | (r << 16) | (g << 8) | (b << 0); | 4555 | 474M | } |
|
4556 | | |
4557 | | // wuffs_base__color_u32_argb_premul__as__color_u32_argb_nonpremul converts |
4558 | | // from premultiplied alpha to non-premultiplied alpha. |
4559 | | static inline uint32_t // |
4560 | | wuffs_base__color_u32_argb_premul__as__color_u32_argb_nonpremul( |
4561 | 39.3k | wuffs_base__color_u32_argb_premul c) { |
4562 | 39.3k | uint32_t a = 0xFF & (c >> 24); |
4563 | 39.3k | if (a == 0xFF) { |
4564 | 38.2k | return c; |
4565 | 38.2k | } else if (a == 0) { |
4566 | 280 | return 0; |
4567 | 280 | } |
4568 | 852 | uint32_t a16 = a * 0x101; |
4569 | | |
4570 | 852 | uint32_t r = 0xFF & (c >> 16); |
4571 | 852 | r = ((r * (0x101 * 0xFFFF)) / a16) >> 8; |
4572 | 852 | uint32_t g = 0xFF & (c >> 8); |
4573 | 852 | g = ((g * (0x101 * 0xFFFF)) / a16) >> 8; |
4574 | 852 | uint32_t b = 0xFF & (c >> 0); |
4575 | 852 | b = ((b * (0x101 * 0xFFFF)) / a16) >> 8; |
4576 | | |
4577 | 852 | return (a << 24) | (r << 16) | (g << 8) | (b << 0); |
4578 | 39.3k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u32_argb_nonpremul Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_u32_argb_premul__as__color_u32_argb_nonpremul(unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u32_argb_nonpremul Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u32_argb_nonpremul Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u32_argb_nonpremul Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u32_argb_nonpremul Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u32_argb_nonpremul pixel_swizzler_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u32_argb_nonpremul Line | Count | Source | 4561 | 39.3k | wuffs_base__color_u32_argb_premul c) { | 4562 | 39.3k | uint32_t a = 0xFF & (c >> 24); | 4563 | 39.3k | if (a == 0xFF) { | 4564 | 38.2k | return c; | 4565 | 38.2k | } else if (a == 0) { | 4566 | 280 | return 0; | 4567 | 280 | } | 4568 | 852 | uint32_t a16 = a * 0x101; | 4569 | | | 4570 | 852 | uint32_t r = 0xFF & (c >> 16); | 4571 | 852 | r = ((r * (0x101 * 0xFFFF)) / a16) >> 8; | 4572 | 852 | uint32_t g = 0xFF & (c >> 8); | 4573 | 852 | g = ((g * (0x101 * 0xFFFF)) / a16) >> 8; | 4574 | 852 | uint32_t b = 0xFF & (c >> 0); | 4575 | 852 | b = ((b * (0x101 * 0xFFFF)) / a16) >> 8; | 4576 | | | 4577 | 852 | return (a << 24) | (r << 16) | (g << 8) | (b << 0); | 4578 | 39.3k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u32_argb_nonpremul Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u32_argb_nonpremul Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u32_argb_nonpremul Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u32_argb_nonpremul |
4579 | | |
4580 | | // wuffs_base__color_u64_argb_nonpremul__as__color_u32_argb_premul converts |
4581 | | // from 4x16LE non-premultiplied alpha to 4x8 premultiplied alpha. |
4582 | | static inline wuffs_base__color_u32_argb_premul // |
4583 | | wuffs_base__color_u64_argb_nonpremul__as__color_u32_argb_premul( |
4584 | 23.2M | uint64_t argb_nonpremul) { |
4585 | 23.2M | uint32_t a16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 48))); |
4586 | | |
4587 | 23.2M | uint32_t r16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 32))); |
4588 | 23.2M | r16 = (r16 * a16) / 0xFFFF; |
4589 | 23.2M | uint32_t g16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 16))); |
4590 | 23.2M | g16 = (g16 * a16) / 0xFFFF; |
4591 | 23.2M | uint32_t b16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 0))); |
4592 | 23.2M | b16 = (b16 * a16) / 0xFFFF; |
4593 | | |
4594 | 23.2M | return ((a16 >> 8) << 24) | ((r16 >> 8) << 16) | ((g16 >> 8) << 8) | |
4595 | 23.2M | ((b16 >> 8) << 0); |
4596 | 23.2M | } png_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u32_argb_premul Line | Count | Source | 4584 | 21.3M | uint64_t argb_nonpremul) { | 4585 | 21.3M | uint32_t a16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 48))); | 4586 | | | 4587 | 21.3M | uint32_t r16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 32))); | 4588 | 21.3M | r16 = (r16 * a16) / 0xFFFF; | 4589 | 21.3M | uint32_t g16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 16))); | 4590 | 21.3M | g16 = (g16 * a16) / 0xFFFF; | 4591 | 21.3M | uint32_t b16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 0))); | 4592 | 21.3M | b16 = (b16 * a16) / 0xFFFF; | 4593 | | | 4594 | 21.3M | return ((a16 >> 8) << 24) | ((r16 >> 8) << 16) | ((g16 >> 8) << 8) | | 4595 | 21.3M | ((b16 >> 8) << 0); | 4596 | 21.3M | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_u64_argb_nonpremul__as__color_u32_argb_premul(unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u32_argb_premul Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u32_argb_premul Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u32_argb_premul Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u32_argb_premul bmp_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u32_argb_premul Line | Count | Source | 4584 | 1.87M | uint64_t argb_nonpremul) { | 4585 | 1.87M | uint32_t a16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 48))); | 4586 | | | 4587 | 1.87M | uint32_t r16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 32))); | 4588 | 1.87M | r16 = (r16 * a16) / 0xFFFF; | 4589 | 1.87M | uint32_t g16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 16))); | 4590 | 1.87M | g16 = (g16 * a16) / 0xFFFF; | 4591 | 1.87M | uint32_t b16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 0))); | 4592 | 1.87M | b16 = (b16 * a16) / 0xFFFF; | 4593 | | | 4594 | 1.87M | return ((a16 >> 8) << 24) | ((r16 >> 8) << 16) | ((g16 >> 8) << 8) | | 4595 | 1.87M | ((b16 >> 8) << 0); | 4596 | 1.87M | } |
pixel_swizzler_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u32_argb_premul Line | Count | Source | 4584 | 668 | uint64_t argb_nonpremul) { | 4585 | 668 | uint32_t a16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 48))); | 4586 | | | 4587 | 668 | uint32_t r16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 32))); | 4588 | 668 | r16 = (r16 * a16) / 0xFFFF; | 4589 | 668 | uint32_t g16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 16))); | 4590 | 668 | g16 = (g16 * a16) / 0xFFFF; | 4591 | 668 | uint32_t b16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 0))); | 4592 | 668 | b16 = (b16 * a16) / 0xFFFF; | 4593 | | | 4594 | 668 | return ((a16 >> 8) << 24) | ((r16 >> 8) << 16) | ((g16 >> 8) << 8) | | 4595 | 668 | ((b16 >> 8) << 0); | 4596 | 668 | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u32_argb_premul Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u32_argb_premul Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u32_argb_premul Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u32_argb_premul |
4597 | | |
4598 | | // wuffs_base__color_u32_argb_premul__as__color_u64_argb_nonpremul converts |
4599 | | // from 4x8 premultiplied alpha to 4x16LE non-premultiplied alpha. |
4600 | | static inline uint64_t // |
4601 | | wuffs_base__color_u32_argb_premul__as__color_u64_argb_nonpremul( |
4602 | 76.5k | wuffs_base__color_u32_argb_premul c) { |
4603 | 76.5k | uint32_t a = 0xFF & (c >> 24); |
4604 | 76.5k | if (a == 0xFF) { |
4605 | 76.5k | uint64_t r16 = 0x101 * (0xFF & (c >> 16)); |
4606 | 76.5k | uint64_t g16 = 0x101 * (0xFF & (c >> 8)); |
4607 | 76.5k | uint64_t b16 = 0x101 * (0xFF & (c >> 0)); |
4608 | 76.5k | return 0xFFFF000000000000u | (r16 << 32) | (g16 << 16) | (b16 << 0); |
4609 | 76.5k | } else if (a == 0) { |
4610 | 0 | return 0; |
4611 | 0 | } |
4612 | 0 | uint64_t a16 = a * 0x101; |
4613 | |
|
4614 | 0 | uint64_t r = 0xFF & (c >> 16); |
4615 | 0 | uint64_t r16 = (r * (0x101 * 0xFFFF)) / a16; |
4616 | 0 | uint64_t g = 0xFF & (c >> 8); |
4617 | 0 | uint64_t g16 = (g * (0x101 * 0xFFFF)) / a16; |
4618 | 0 | uint64_t b = 0xFF & (c >> 0); |
4619 | 0 | uint64_t b16 = (b * (0x101 * 0xFFFF)) / a16; |
4620 | |
|
4621 | 0 | return (a16 << 48) | (r16 << 32) | (g16 << 16) | (b16 << 0); |
4622 | 76.5k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u64_argb_nonpremul Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_u32_argb_premul__as__color_u64_argb_nonpremul(unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u64_argb_nonpremul Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u64_argb_nonpremul Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u64_argb_nonpremul Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u64_argb_nonpremul Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u64_argb_nonpremul pixel_swizzler_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u64_argb_nonpremul Line | Count | Source | 4602 | 76.5k | wuffs_base__color_u32_argb_premul c) { | 4603 | 76.5k | uint32_t a = 0xFF & (c >> 24); | 4604 | 76.5k | if (a == 0xFF) { | 4605 | 76.5k | uint64_t r16 = 0x101 * (0xFF & (c >> 16)); | 4606 | 76.5k | uint64_t g16 = 0x101 * (0xFF & (c >> 8)); | 4607 | 76.5k | uint64_t b16 = 0x101 * (0xFF & (c >> 0)); | 4608 | 76.5k | return 0xFFFF000000000000u | (r16 << 32) | (g16 << 16) | (b16 << 0); | 4609 | 76.5k | } else if (a == 0) { | 4610 | 0 | return 0; | 4611 | 0 | } | 4612 | 0 | uint64_t a16 = a * 0x101; | 4613 | |
| 4614 | 0 | uint64_t r = 0xFF & (c >> 16); | 4615 | 0 | uint64_t r16 = (r * (0x101 * 0xFFFF)) / a16; | 4616 | 0 | uint64_t g = 0xFF & (c >> 8); | 4617 | 0 | uint64_t g16 = (g * (0x101 * 0xFFFF)) / a16; | 4618 | 0 | uint64_t b = 0xFF & (c >> 0); | 4619 | 0 | uint64_t b16 = (b * (0x101 * 0xFFFF)) / a16; | 4620 | |
| 4621 | 0 | return (a16 << 48) | (r16 << 32) | (g16 << 16) | (b16 << 0); | 4622 | 76.5k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u64_argb_nonpremul Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u64_argb_nonpremul Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u64_argb_nonpremul Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_u32_argb_premul__as__color_u64_argb_nonpremul |
4623 | | |
4624 | | static inline uint8_t // |
4625 | 133 | wuffs_base__color_u64_argb_premul__as__color_u8_gray(uint64_t argb_premul) { |
4626 | 133 | uint32_t r16 = ((uint32_t)(0xFFFF & (argb_premul >> 32))); |
4627 | 133 | uint32_t g16 = ((uint32_t)(0xFFFF & (argb_premul >> 16))); |
4628 | 133 | uint32_t b16 = ((uint32_t)(0xFFFF & (argb_premul >> 0))); |
4629 | | |
4630 | | // These coefficients (the fractions 0.299, 0.587 and 0.114) are the same |
4631 | | // as those given by the JFIF specification. |
4632 | | // |
4633 | | // Note that 19595 + 38470 + 7471 equals 65536, also known as (1 << 16). We |
4634 | | // shift by 24, not just by 16, because the return value is 8-bit color, not |
4635 | | // 16-bit color. |
4636 | 133 | uint32_t weighted_average = |
4637 | 133 | (19595 * r16) + (38470 * g16) + (7471 * b16) + 32768; |
4638 | 133 | return (uint8_t)(weighted_average >> 24); |
4639 | 133 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u8_gray Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_u64_argb_premul__as__color_u8_gray(unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u8_gray Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u8_gray Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u8_gray Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u8_gray Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u8_gray pixel_swizzler_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u8_gray Line | Count | Source | 4625 | 133 | wuffs_base__color_u64_argb_premul__as__color_u8_gray(uint64_t argb_premul) { | 4626 | 133 | uint32_t r16 = ((uint32_t)(0xFFFF & (argb_premul >> 32))); | 4627 | 133 | uint32_t g16 = ((uint32_t)(0xFFFF & (argb_premul >> 16))); | 4628 | 133 | uint32_t b16 = ((uint32_t)(0xFFFF & (argb_premul >> 0))); | 4629 | | | 4630 | | // These coefficients (the fractions 0.299, 0.587 and 0.114) are the same | 4631 | | // as those given by the JFIF specification. | 4632 | | // | 4633 | | // Note that 19595 + 38470 + 7471 equals 65536, also known as (1 << 16). We | 4634 | | // shift by 24, not just by 16, because the return value is 8-bit color, not | 4635 | | // 16-bit color. | 4636 | 133 | uint32_t weighted_average = | 4637 | 133 | (19595 * r16) + (38470 * g16) + (7471 * b16) + 32768; | 4638 | 133 | return (uint8_t)(weighted_average >> 24); | 4639 | 133 | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u8_gray Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u8_gray Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u8_gray Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u8_gray |
4640 | | |
4641 | | static inline uint64_t // |
4642 | | wuffs_base__color_u64_argb_premul__as__color_u64_argb_nonpremul( |
4643 | 891 | uint64_t argb_premul) { |
4644 | 891 | uint64_t a = 0xFFFF & (argb_premul >> 48); |
4645 | 891 | if (a == 0xFFFF) { |
4646 | 136 | return argb_premul; |
4647 | 755 | } else if (a == 0) { |
4648 | 174 | return 0; |
4649 | 174 | } |
4650 | | |
4651 | 581 | uint64_t r = 0xFFFF & (argb_premul >> 32); |
4652 | 581 | r = (r * 0xFFFF) / a; |
4653 | 581 | uint64_t g = 0xFFFF & (argb_premul >> 16); |
4654 | 581 | g = (g * 0xFFFF) / a; |
4655 | 581 | uint64_t b = 0xFFFF & (argb_premul >> 0); |
4656 | 581 | b = (b * 0xFFFF) / a; |
4657 | | |
4658 | 581 | return (a << 48) | (r << 32) | (g << 16) | (b << 0); |
4659 | 891 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u64_argb_nonpremul Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_u64_argb_premul__as__color_u64_argb_nonpremul(unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u64_argb_nonpremul Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u64_argb_nonpremul Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u64_argb_nonpremul Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u64_argb_nonpremul Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u64_argb_nonpremul pixel_swizzler_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u64_argb_nonpremul Line | Count | Source | 4643 | 891 | uint64_t argb_premul) { | 4644 | 891 | uint64_t a = 0xFFFF & (argb_premul >> 48); | 4645 | 891 | if (a == 0xFFFF) { | 4646 | 136 | return argb_premul; | 4647 | 755 | } else if (a == 0) { | 4648 | 174 | return 0; | 4649 | 174 | } | 4650 | | | 4651 | 581 | uint64_t r = 0xFFFF & (argb_premul >> 32); | 4652 | 581 | r = (r * 0xFFFF) / a; | 4653 | 581 | uint64_t g = 0xFFFF & (argb_premul >> 16); | 4654 | 581 | g = (g * 0xFFFF) / a; | 4655 | 581 | uint64_t b = 0xFFFF & (argb_premul >> 0); | 4656 | 581 | b = (b * 0xFFFF) / a; | 4657 | | | 4658 | 581 | return (a << 48) | (r << 32) | (g << 16) | (b << 0); | 4659 | 891 | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u64_argb_nonpremul Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u64_argb_nonpremul Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u64_argb_nonpremul Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_u64_argb_premul__as__color_u64_argb_nonpremul |
4660 | | |
4661 | | static inline uint64_t // |
4662 | | wuffs_base__color_u64_argb_nonpremul__as__color_u64_argb_premul( |
4663 | 0 | uint64_t argb_nonpremul) { |
4664 | 0 | uint64_t a = 0xFFFF & (argb_nonpremul >> 48); |
4665 | |
|
4666 | 0 | uint64_t r = 0xFFFF & (argb_nonpremul >> 32); |
4667 | 0 | r = (r * a) / 0xFFFF; |
4668 | 0 | uint64_t g = 0xFFFF & (argb_nonpremul >> 16); |
4669 | 0 | g = (g * a) / 0xFFFF; |
4670 | 0 | uint64_t b = 0xFFFF & (argb_nonpremul >> 0); |
4671 | 0 | b = (b * a) / 0xFFFF; |
4672 | |
|
4673 | 0 | return (a << 48) | (r << 32) | (g << 16) | (b << 0); |
4674 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u64_argb_premul Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_u64_argb_nonpremul__as__color_u64_argb_premul(unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u64_argb_premul Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u64_argb_premul Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u64_argb_premul Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u64_argb_premul Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u64_argb_premul Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u64_argb_premul Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u64_argb_premul Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u64_argb_premul Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u64_argb_premul Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u64_argb_premul |
4675 | | |
4676 | | static inline uint8_t // |
4677 | | wuffs_base__color_u64_argb_nonpremul__as__color_u8_gray( |
4678 | 66 | uint64_t argb_nonpremul) { |
4679 | 66 | uint32_t a16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 48))); |
4680 | | |
4681 | 66 | uint32_t r16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 32))); |
4682 | 66 | r16 = (r16 * a16) / 0xFFFF; |
4683 | 66 | uint32_t g16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 16))); |
4684 | 66 | g16 = (g16 * a16) / 0xFFFF; |
4685 | 66 | uint32_t b16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 0))); |
4686 | 66 | b16 = (b16 * a16) / 0xFFFF; |
4687 | | |
4688 | | // These coefficients (the fractions 0.299, 0.587 and 0.114) are the same |
4689 | | // as those given by the JFIF specification. |
4690 | | // |
4691 | | // Note that 19595 + 38470 + 7471 equals 65536, also known as (1 << 16). We |
4692 | | // shift by 24, not just by 16, because the return value is 8-bit color, not |
4693 | | // 16-bit color. |
4694 | 66 | uint32_t weighted_average = |
4695 | 66 | (19595 * r16) + (38470 * g16) + (7471 * b16) + 32768; |
4696 | 66 | return (uint8_t)(weighted_average >> 24); |
4697 | 66 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u8_gray Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_u64_argb_nonpremul__as__color_u8_gray(unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u8_gray Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u8_gray Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u8_gray Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u8_gray Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u8_gray pixel_swizzler_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u8_gray Line | Count | Source | 4678 | 66 | uint64_t argb_nonpremul) { | 4679 | 66 | uint32_t a16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 48))); | 4680 | | | 4681 | 66 | uint32_t r16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 32))); | 4682 | 66 | r16 = (r16 * a16) / 0xFFFF; | 4683 | 66 | uint32_t g16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 16))); | 4684 | 66 | g16 = (g16 * a16) / 0xFFFF; | 4685 | 66 | uint32_t b16 = ((uint32_t)(0xFFFF & (argb_nonpremul >> 0))); | 4686 | 66 | b16 = (b16 * a16) / 0xFFFF; | 4687 | | | 4688 | | // These coefficients (the fractions 0.299, 0.587 and 0.114) are the same | 4689 | | // as those given by the JFIF specification. | 4690 | | // | 4691 | | // Note that 19595 + 38470 + 7471 equals 65536, also known as (1 << 16). We | 4692 | | // shift by 24, not just by 16, because the return value is 8-bit color, not | 4693 | | // 16-bit color. | 4694 | 66 | uint32_t weighted_average = | 4695 | 66 | (19595 * r16) + (38470 * g16) + (7471 * b16) + 32768; | 4696 | 66 | return (uint8_t)(weighted_average >> 24); | 4697 | 66 | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u8_gray Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u8_gray Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u8_gray Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_u64_argb_nonpremul__as__color_u8_gray |
4698 | | |
4699 | | static inline uint64_t // |
4700 | 3.25k | wuffs_base__color_u32__as__color_u64(uint32_t c) { |
4701 | 3.25k | uint64_t a16 = 0x101 * (0xFF & (c >> 24)); |
4702 | 3.25k | uint64_t r16 = 0x101 * (0xFF & (c >> 16)); |
4703 | 3.25k | uint64_t g16 = 0x101 * (0xFF & (c >> 8)); |
4704 | 3.25k | uint64_t b16 = 0x101 * (0xFF & (c >> 0)); |
4705 | 3.25k | return (a16 << 48) | (r16 << 32) | (g16 << 16) | (b16 << 0); |
4706 | 3.25k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_u32__as__color_u64 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_u32__as__color_u64(unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_u32__as__color_u64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_u32__as__color_u64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_u32__as__color_u64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_u32__as__color_u64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_u32__as__color_u64 pixel_swizzler_fuzzer.c:wuffs_base__color_u32__as__color_u64 Line | Count | Source | 4700 | 3.25k | wuffs_base__color_u32__as__color_u64(uint32_t c) { | 4701 | 3.25k | uint64_t a16 = 0x101 * (0xFF & (c >> 24)); | 4702 | 3.25k | uint64_t r16 = 0x101 * (0xFF & (c >> 16)); | 4703 | 3.25k | uint64_t g16 = 0x101 * (0xFF & (c >> 8)); | 4704 | 3.25k | uint64_t b16 = 0x101 * (0xFF & (c >> 0)); | 4705 | 3.25k | return (a16 << 48) | (r16 << 32) | (g16 << 16) | (b16 << 0); | 4706 | 3.25k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_u32__as__color_u64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_u32__as__color_u64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_u32__as__color_u64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_u32__as__color_u64 |
4707 | | |
4708 | | static inline uint32_t // |
4709 | 377k | wuffs_base__color_u64__as__color_u32(uint64_t c) { |
4710 | 377k | uint32_t a = ((uint32_t)(0xFF & (c >> 56))); |
4711 | 377k | uint32_t r = ((uint32_t)(0xFF & (c >> 40))); |
4712 | 377k | uint32_t g = ((uint32_t)(0xFF & (c >> 24))); |
4713 | 377k | uint32_t b = ((uint32_t)(0xFF & (c >> 8))); |
4714 | 377k | return (a << 24) | (r << 16) | (g << 8) | (b << 0); |
4715 | 377k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_u64__as__color_u32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_u64__as__color_u32(unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_u64__as__color_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_u64__as__color_u32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_u64__as__color_u32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_u64__as__color_u32 bmp_fuzzer.c:wuffs_base__color_u64__as__color_u32 Line | Count | Source | 4709 | 375k | wuffs_base__color_u64__as__color_u32(uint64_t c) { | 4710 | 375k | uint32_t a = ((uint32_t)(0xFF & (c >> 56))); | 4711 | 375k | uint32_t r = ((uint32_t)(0xFF & (c >> 40))); | 4712 | 375k | uint32_t g = ((uint32_t)(0xFF & (c >> 24))); | 4713 | 375k | uint32_t b = ((uint32_t)(0xFF & (c >> 8))); | 4714 | 375k | return (a << 24) | (r << 16) | (g << 8) | (b << 0); | 4715 | 375k | } |
pixel_swizzler_fuzzer.c:wuffs_base__color_u64__as__color_u32 Line | Count | Source | 4709 | 2.43k | wuffs_base__color_u64__as__color_u32(uint64_t c) { | 4710 | 2.43k | uint32_t a = ((uint32_t)(0xFF & (c >> 56))); | 4711 | 2.43k | uint32_t r = ((uint32_t)(0xFF & (c >> 40))); | 4712 | 2.43k | uint32_t g = ((uint32_t)(0xFF & (c >> 24))); | 4713 | 2.43k | uint32_t b = ((uint32_t)(0xFF & (c >> 8))); | 4714 | 2.43k | return (a << 24) | (r << 16) | (g << 8) | (b << 0); | 4715 | 2.43k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_u64__as__color_u32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_u64__as__color_u32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_u64__as__color_u32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_u64__as__color_u32 |
4716 | | |
4717 | | // wuffs_base__color_ycc__as__color_u32 converts from YCbCr to 0xAARRGGBB. The |
4718 | | // alpha bits are always 0xFF. |
4719 | | // |
4720 | | // There is no YCC_MODEL (like bt601fr) in the macro name. For backwards |
4721 | | // compatibility, it uses WUFFS_BASE__YCC_MODEL__BT_601_FULL_RANGE, like JPEG. |
4722 | | #define wuffs_base__color_ycc__as__color_u32 \ |
4723 | | wuffs_base__color_ycc_bt601fr__as__color_u32 |
4724 | | |
4725 | | // wuffs_base__color_ycc__as__color_u32_abgr is like |
4726 | | // wuffs_base__color_ycc__as__color_u32 but the uint32_t returned is in |
4727 | | // 0xAABBGGRR order, not 0xAARRGGBB. |
4728 | | // |
4729 | | // There is no YCC_MODEL (like bt601fr) in the macro name. For backwards |
4730 | | // compatibility, it uses WUFFS_BASE__YCC_MODEL__BT_601_FULL_RANGE, like JPEG. |
4731 | | #define wuffs_base__color_ycc__as__color_u32_abgr \ |
4732 | | wuffs_base__color_ycc_bt601fr__as__color_u32_abgr |
4733 | | |
4734 | | // wuffs_base__color_ycc_bt601fr__as__color_u32 is |
4735 | | // wuffs_base__color_ycc__as__color_u32 for |
4736 | | // WUFFS_BASE__YCC_MODEL__BT_601_FULL_RANGE. |
4737 | | static inline wuffs_base__color_u32_argb_premul // |
4738 | | wuffs_base__color_ycc_bt601fr__as__color_u32(uint8_t yy, |
4739 | | uint8_t cb, |
4740 | 247M | uint8_t cr) { |
4741 | | // Work in 16.16 fixed point arithmetic (so that 'one half' is (1 << 15)) and |
4742 | | // bias the chroma values by 0x80. |
4743 | 247M | uint32_t yy32 = (((uint32_t)yy) << 16) | (1 << 15); |
4744 | 247M | uint32_t cb32 = (((uint32_t)cb) - 0x80); |
4745 | 247M | uint32_t cr32 = (((uint32_t)cr) - 0x80); |
4746 | | |
4747 | | // The formulae: |
4748 | | // |
4749 | | // R = Y + 1.40200 * Cr |
4750 | | // G = Y - 0.34414 * Cb - 0.71414 * Cr |
4751 | | // B = Y + 1.77200 * Cb |
4752 | | // |
4753 | | // When scaled by 1<<16: |
4754 | | // |
4755 | | // 0.34414 becomes 0x0581A = 22554. |
4756 | | // 0.71414 becomes 0x0B6D2 = 46802. |
4757 | | // 1.40200 becomes 0x166E9 = 91881. |
4758 | | // 1.77200 becomes 0x1C5A2 = 116130. |
4759 | | // |
4760 | | // Since we're working in 16.16 fixed point arithmetic, masking by 0x00FF0000 |
4761 | | // (possibly followed by a shift) gives the relevant 8 bits per channel. |
4762 | | // |
4763 | | // However, we need to saturate for overflow (above 0x00FFFFFF, but not so |
4764 | | // high that the MSB Most Significant Bit is set) or for underflow (below |
4765 | | // 0x00000000 as int32_t, which means that the MSB is set as uint32_t). In |
4766 | | // both cases, some of the high 8 bits (bits 24 ..= 31) will be set. |
4767 | | // |
4768 | | // "((uint32_t)(((int32_t)x) >> 31))" just replicates x's MSB across all 32 |
4769 | | // bits. Prepending that with "~" inverts those bits. Thus, "~(etc)" is |
4770 | | // either 0xFFFFFFFF (for overflow) or 0x00000000 (for underflow). |
4771 | 247M | uint32_t rr32 = yy32 + (0x166E9 * cr32); |
4772 | 247M | uint32_t gg32 = yy32 - (0x0581A * cb32) - (0x0B6D2 * cr32); |
4773 | 247M | uint32_t bb32 = yy32 + (0x1C5A2 * cb32); |
4774 | 247M | if (rr32 >> 24) { |
4775 | 673k | rr32 = ~((uint32_t)(((int32_t)rr32) >> 31)); |
4776 | 673k | } |
4777 | 247M | if (gg32 >> 24) { |
4778 | 441k | gg32 = ~((uint32_t)(((int32_t)gg32) >> 31)); |
4779 | 441k | } |
4780 | 247M | if (bb32 >> 24) { |
4781 | 1.27M | bb32 = ~((uint32_t)(((int32_t)bb32) >> 31)); |
4782 | 1.27M | } |
4783 | 247M | return 0xFF000000 | // |
4784 | 247M | ((0x00FF0000 & rr32) >> 0) | // |
4785 | 247M | ((0x00FF0000 & gg32) >> 8) | // |
4786 | 247M | ((0x00FF0000 & bb32) >> 16); |
4787 | 247M | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_ycc_bt601fr__as__color_u32(unsigned char, unsigned char, unsigned char) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32 jpeg_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32 Line | Count | Source | 4740 | 246M | uint8_t cr) { | 4741 | | // Work in 16.16 fixed point arithmetic (so that 'one half' is (1 << 15)) and | 4742 | | // bias the chroma values by 0x80. | 4743 | 246M | uint32_t yy32 = (((uint32_t)yy) << 16) | (1 << 15); | 4744 | 246M | uint32_t cb32 = (((uint32_t)cb) - 0x80); | 4745 | 246M | uint32_t cr32 = (((uint32_t)cr) - 0x80); | 4746 | | | 4747 | | // The formulae: | 4748 | | // | 4749 | | // R = Y + 1.40200 * Cr | 4750 | | // G = Y - 0.34414 * Cb - 0.71414 * Cr | 4751 | | // B = Y + 1.77200 * Cb | 4752 | | // | 4753 | | // When scaled by 1<<16: | 4754 | | // | 4755 | | // 0.34414 becomes 0x0581A = 22554. | 4756 | | // 0.71414 becomes 0x0B6D2 = 46802. | 4757 | | // 1.40200 becomes 0x166E9 = 91881. | 4758 | | // 1.77200 becomes 0x1C5A2 = 116130. | 4759 | | // | 4760 | | // Since we're working in 16.16 fixed point arithmetic, masking by 0x00FF0000 | 4761 | | // (possibly followed by a shift) gives the relevant 8 bits per channel. | 4762 | | // | 4763 | | // However, we need to saturate for overflow (above 0x00FFFFFF, but not so | 4764 | | // high that the MSB Most Significant Bit is set) or for underflow (below | 4765 | | // 0x00000000 as int32_t, which means that the MSB is set as uint32_t). In | 4766 | | // both cases, some of the high 8 bits (bits 24 ..= 31) will be set. | 4767 | | // | 4768 | | // "((uint32_t)(((int32_t)x) >> 31))" just replicates x's MSB across all 32 | 4769 | | // bits. Prepending that with "~" inverts those bits. Thus, "~(etc)" is | 4770 | | // either 0xFFFFFFFF (for overflow) or 0x00000000 (for underflow). | 4771 | 246M | uint32_t rr32 = yy32 + (0x166E9 * cr32); | 4772 | 246M | uint32_t gg32 = yy32 - (0x0581A * cb32) - (0x0B6D2 * cr32); | 4773 | 246M | uint32_t bb32 = yy32 + (0x1C5A2 * cb32); | 4774 | 246M | if (rr32 >> 24) { | 4775 | 587k | rr32 = ~((uint32_t)(((int32_t)rr32) >> 31)); | 4776 | 587k | } | 4777 | 246M | if (gg32 >> 24) { | 4778 | 382k | gg32 = ~((uint32_t)(((int32_t)gg32) >> 31)); | 4779 | 382k | } | 4780 | 246M | if (bb32 >> 24) { | 4781 | 1.15M | bb32 = ~((uint32_t)(((int32_t)bb32) >> 31)); | 4782 | 1.15M | } | 4783 | 246M | return 0xFF000000 | // | 4784 | 246M | ((0x00FF0000 & rr32) >> 0) | // | 4785 | 246M | ((0x00FF0000 & gg32) >> 8) | // | 4786 | 246M | ((0x00FF0000 & bb32) >> 16); | 4787 | 246M | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32 pixel_swizzler_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32 Line | Count | Source | 4740 | 273k | uint8_t cr) { | 4741 | | // Work in 16.16 fixed point arithmetic (so that 'one half' is (1 << 15)) and | 4742 | | // bias the chroma values by 0x80. | 4743 | 273k | uint32_t yy32 = (((uint32_t)yy) << 16) | (1 << 15); | 4744 | 273k | uint32_t cb32 = (((uint32_t)cb) - 0x80); | 4745 | 273k | uint32_t cr32 = (((uint32_t)cr) - 0x80); | 4746 | | | 4747 | | // The formulae: | 4748 | | // | 4749 | | // R = Y + 1.40200 * Cr | 4750 | | // G = Y - 0.34414 * Cb - 0.71414 * Cr | 4751 | | // B = Y + 1.77200 * Cb | 4752 | | // | 4753 | | // When scaled by 1<<16: | 4754 | | // | 4755 | | // 0.34414 becomes 0x0581A = 22554. | 4756 | | // 0.71414 becomes 0x0B6D2 = 46802. | 4757 | | // 1.40200 becomes 0x166E9 = 91881. | 4758 | | // 1.77200 becomes 0x1C5A2 = 116130. | 4759 | | // | 4760 | | // Since we're working in 16.16 fixed point arithmetic, masking by 0x00FF0000 | 4761 | | // (possibly followed by a shift) gives the relevant 8 bits per channel. | 4762 | | // | 4763 | | // However, we need to saturate for overflow (above 0x00FFFFFF, but not so | 4764 | | // high that the MSB Most Significant Bit is set) or for underflow (below | 4765 | | // 0x00000000 as int32_t, which means that the MSB is set as uint32_t). In | 4766 | | // both cases, some of the high 8 bits (bits 24 ..= 31) will be set. | 4767 | | // | 4768 | | // "((uint32_t)(((int32_t)x) >> 31))" just replicates x's MSB across all 32 | 4769 | | // bits. Prepending that with "~" inverts those bits. Thus, "~(etc)" is | 4770 | | // either 0xFFFFFFFF (for overflow) or 0x00000000 (for underflow). | 4771 | 273k | uint32_t rr32 = yy32 + (0x166E9 * cr32); | 4772 | 273k | uint32_t gg32 = yy32 - (0x0581A * cb32) - (0x0B6D2 * cr32); | 4773 | 273k | uint32_t bb32 = yy32 + (0x1C5A2 * cb32); | 4774 | 273k | if (rr32 >> 24) { | 4775 | 85.7k | rr32 = ~((uint32_t)(((int32_t)rr32) >> 31)); | 4776 | 85.7k | } | 4777 | 273k | if (gg32 >> 24) { | 4778 | 58.4k | gg32 = ~((uint32_t)(((int32_t)gg32) >> 31)); | 4779 | 58.4k | } | 4780 | 273k | if (bb32 >> 24) { | 4781 | 123k | bb32 = ~((uint32_t)(((int32_t)bb32) >> 31)); | 4782 | 123k | } | 4783 | 273k | return 0xFF000000 | // | 4784 | 273k | ((0x00FF0000 & rr32) >> 0) | // | 4785 | 273k | ((0x00FF0000 & gg32) >> 8) | // | 4786 | 273k | ((0x00FF0000 & bb32) >> 16); | 4787 | 273k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32 |
4788 | | |
4789 | | // wuffs_base__color_ycc_bt601fr__as__color_u32_abgr is |
4790 | | // wuffs_base__color_ycc__as__color_u32_abgr for |
4791 | | // WUFFS_BASE__YCC_MODEL__BT_601_FULL_RANGE. |
4792 | | static inline uint32_t // |
4793 | | wuffs_base__color_ycc_bt601fr__as__color_u32_abgr(uint8_t yy, |
4794 | | uint8_t cb, |
4795 | 63.2k | uint8_t cr) { |
4796 | 63.2k | uint32_t yy32 = (((uint32_t)yy) << 16) | (1 << 15); |
4797 | 63.2k | uint32_t cb32 = (((uint32_t)cb) - 0x80); |
4798 | 63.2k | uint32_t cr32 = (((uint32_t)cr) - 0x80); |
4799 | 63.2k | uint32_t rr32 = yy32 + (0x166E9 * cr32); |
4800 | 63.2k | uint32_t gg32 = yy32 - (0x0581A * cb32) - (0x0B6D2 * cr32); |
4801 | 63.2k | uint32_t bb32 = yy32 + (0x1C5A2 * cb32); |
4802 | 63.2k | if (rr32 >> 24) { |
4803 | 21.7k | rr32 = ~((uint32_t)(((int32_t)rr32) >> 31)); |
4804 | 21.7k | } |
4805 | 63.2k | if (gg32 >> 24) { |
4806 | 16.8k | gg32 = ~((uint32_t)(((int32_t)gg32) >> 31)); |
4807 | 16.8k | } |
4808 | 63.2k | if (bb32 >> 24) { |
4809 | 30.4k | bb32 = ~((uint32_t)(((int32_t)bb32) >> 31)); |
4810 | 30.4k | } |
4811 | 63.2k | return 0xFF000000 | // |
4812 | 63.2k | ((0x00FF0000 & bb32) >> 0) | // |
4813 | 63.2k | ((0x00FF0000 & gg32) >> 8) | // |
4814 | 63.2k | ((0x00FF0000 & rr32) >> 16); |
4815 | 63.2k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32_abgr Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_ycc_bt601fr__as__color_u32_abgr(unsigned char, unsigned char, unsigned char) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32_abgr Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32_abgr Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32_abgr Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32_abgr Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32_abgr pixel_swizzler_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32_abgr Line | Count | Source | 4795 | 63.2k | uint8_t cr) { | 4796 | 63.2k | uint32_t yy32 = (((uint32_t)yy) << 16) | (1 << 15); | 4797 | 63.2k | uint32_t cb32 = (((uint32_t)cb) - 0x80); | 4798 | 63.2k | uint32_t cr32 = (((uint32_t)cr) - 0x80); | 4799 | 63.2k | uint32_t rr32 = yy32 + (0x166E9 * cr32); | 4800 | 63.2k | uint32_t gg32 = yy32 - (0x0581A * cb32) - (0x0B6D2 * cr32); | 4801 | 63.2k | uint32_t bb32 = yy32 + (0x1C5A2 * cb32); | 4802 | 63.2k | if (rr32 >> 24) { | 4803 | 21.7k | rr32 = ~((uint32_t)(((int32_t)rr32) >> 31)); | 4804 | 21.7k | } | 4805 | 63.2k | if (gg32 >> 24) { | 4806 | 16.8k | gg32 = ~((uint32_t)(((int32_t)gg32) >> 31)); | 4807 | 16.8k | } | 4808 | 63.2k | if (bb32 >> 24) { | 4809 | 30.4k | bb32 = ~((uint32_t)(((int32_t)bb32) >> 31)); | 4810 | 30.4k | } | 4811 | 63.2k | return 0xFF000000 | // | 4812 | 63.2k | ((0x00FF0000 & bb32) >> 0) | // | 4813 | 63.2k | ((0x00FF0000 & gg32) >> 8) | // | 4814 | 63.2k | ((0x00FF0000 & rr32) >> 16); | 4815 | 63.2k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32_abgr Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32_abgr Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32_abgr Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_ycc_bt601fr__as__color_u32_abgr |
4816 | | |
4817 | | // wuffs_base__color_ycc_bt601sr__as__color_u32 is |
4818 | | // wuffs_base__color_ycc__as__color_u32 for |
4819 | | // WUFFS_BASE__YCC_MODEL__BT_601_STUDIO_RANGE. |
4820 | | static inline wuffs_base__color_u32_argb_premul // |
4821 | | wuffs_base__color_ycc_bt601sr__as__color_u32(uint8_t yy, |
4822 | | uint8_t cb, |
4823 | 3.57G | uint8_t cr) { |
4824 | | // The constants here match those used in libwebp's src/dsp/yuv.h, using |
4825 | | // 18.14 fixed point arithmetic. (1 << 14) equals 16384. |
4826 | | // |
4827 | | // 19077 โ 16384 * 1.164 |
4828 | | // 26149 โ 16384 * 1.596 |
4829 | | // 6419 โ 16384 * 0.392 |
4830 | | // 13320 โ 16384 * 0.813 |
4831 | | // 33050 โ 16384 * 2.017 |
4832 | | // 14234 โ 16384 * 0.869 |
4833 | | // 8708 โ 16384 * 0.531 |
4834 | | // 17685 โ 16384 * 1.079 |
4835 | | |
4836 | 3.57G | int32_t y0 = ((int32_t)yy * 19077) >> 8; |
4837 | 3.57G | int32_t rr = ((int32_t)cr * 26149) >> 8; |
4838 | 3.57G | int32_t gb = ((int32_t)cb * 6419) >> 8; |
4839 | 3.57G | int32_t gr = ((int32_t)cr * 13320) >> 8; |
4840 | 3.57G | int32_t bb = ((int32_t)cb * 33050) >> 8; |
4841 | | |
4842 | 3.57G | int32_t r1 = y0 + rr - 14234; |
4843 | 3.57G | int32_t g1 = y0 - gb - gr + 8708; |
4844 | 3.57G | int32_t b1 = y0 + bb - 17685; |
4845 | | |
4846 | 3.57G | uint32_t r = (r1 < 0) ? 0u : (r1 > 16320) ? 255u : ((uint32_t)r1 >> 6); |
4847 | 3.57G | uint32_t g = (g1 < 0) ? 0u : (g1 > 16320) ? 255u : ((uint32_t)g1 >> 6); |
4848 | 3.57G | uint32_t b = (b1 < 0) ? 0u : (b1 > 16320) ? 255u : ((uint32_t)b1 >> 6); |
4849 | | |
4850 | 3.57G | return 0xFF000000u | (r << 16) | (g << 8) | b; |
4851 | 3.57G | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_ycc_bt601sr__as__color_u32(unsigned char, unsigned char, unsigned char) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32 webp_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32 Line | Count | Source | 4823 | 3.57G | uint8_t cr) { | 4824 | | // The constants here match those used in libwebp's src/dsp/yuv.h, using | 4825 | | // 18.14 fixed point arithmetic. (1 << 14) equals 16384. | 4826 | | // | 4827 | | // 19077 โ 16384 * 1.164 | 4828 | | // 26149 โ 16384 * 1.596 | 4829 | | // 6419 โ 16384 * 0.392 | 4830 | | // 13320 โ 16384 * 0.813 | 4831 | | // 33050 โ 16384 * 2.017 | 4832 | | // 14234 โ 16384 * 0.869 | 4833 | | // 8708 โ 16384 * 0.531 | 4834 | | // 17685 โ 16384 * 1.079 | 4835 | | | 4836 | 3.57G | int32_t y0 = ((int32_t)yy * 19077) >> 8; | 4837 | 3.57G | int32_t rr = ((int32_t)cr * 26149) >> 8; | 4838 | 3.57G | int32_t gb = ((int32_t)cb * 6419) >> 8; | 4839 | 3.57G | int32_t gr = ((int32_t)cr * 13320) >> 8; | 4840 | 3.57G | int32_t bb = ((int32_t)cb * 33050) >> 8; | 4841 | | | 4842 | 3.57G | int32_t r1 = y0 + rr - 14234; | 4843 | 3.57G | int32_t g1 = y0 - gb - gr + 8708; | 4844 | 3.57G | int32_t b1 = y0 + bb - 17685; | 4845 | | | 4846 | 3.57G | uint32_t r = (r1 < 0) ? 0u : (r1 > 16320) ? 255u : ((uint32_t)r1 >> 6); | 4847 | 3.57G | uint32_t g = (g1 < 0) ? 0u : (g1 > 16320) ? 255u : ((uint32_t)g1 >> 6); | 4848 | 3.57G | uint32_t b = (b1 < 0) ? 0u : (b1 > 16320) ? 255u : ((uint32_t)b1 >> 6); | 4849 | | | 4850 | 3.57G | return 0xFF000000u | (r << 16) | (g << 8) | b; | 4851 | 3.57G | } |
|
4852 | | |
4853 | | // wuffs_base__color_ycc_bt601sr__as__color_u32_abgr is |
4854 | | // wuffs_base__color_ycc__as__color_u32_abgr for |
4855 | | // WUFFS_BASE__YCC_MODEL__BT_601_STUDIO_RANGE. |
4856 | | static inline uint32_t // |
4857 | | wuffs_base__color_ycc_bt601sr__as__color_u32_abgr(uint8_t yy, |
4858 | | uint8_t cb, |
4859 | 0 | uint8_t cr) { |
4860 | 0 | int32_t y0 = ((int32_t)yy * 19077) >> 8; |
4861 | 0 | int32_t rr = ((int32_t)cr * 26149) >> 8; |
4862 | 0 | int32_t gb = ((int32_t)cb * 6419) >> 8; |
4863 | 0 | int32_t gr = ((int32_t)cr * 13320) >> 8; |
4864 | 0 | int32_t bb = ((int32_t)cb * 33050) >> 8; |
4865 | |
|
4866 | 0 | int32_t r1 = y0 + rr - 14234; |
4867 | 0 | int32_t g1 = y0 - gb - gr + 8708; |
4868 | 0 | int32_t b1 = y0 + bb - 17685; |
4869 | |
|
4870 | 0 | uint32_t r = (r1 < 0) ? 0u : (r1 > 16320) ? 255u : ((uint32_t)r1 >> 6); |
4871 | 0 | uint32_t g = (g1 < 0) ? 0u : (g1 > 16320) ? 255u : ((uint32_t)g1 >> 6); |
4872 | 0 | uint32_t b = (b1 < 0) ? 0u : (b1 > 16320) ? 255u : ((uint32_t)b1 >> 6); |
4873 | |
|
4874 | 0 | return 0xFF000000u | (b << 16) | (g << 8) | r; |
4875 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32_abgr Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_ycc_bt601sr__as__color_u32_abgr(unsigned char, unsigned char, unsigned char) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32_abgr Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32_abgr Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32_abgr Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32_abgr Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32_abgr Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32_abgr Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32_abgr Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32_abgr Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32_abgr Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_ycc_bt601sr__as__color_u32_abgr |
4876 | | |
4877 | | static inline uint32_t // |
4878 | 57.7M | wuffs_base__color_swap_u32_argb_abgr(uint32_t u) { |
4879 | 57.7M | uint32_t o = u & 0xFF00FF00ul; |
4880 | 57.7M | uint32_t r = u & 0x00FF0000ul; |
4881 | 57.7M | uint32_t b = u & 0x000000FFul; |
4882 | 57.7M | return o | (r >> 16) | (b << 16); |
4883 | 57.7M | } png_fuzzer.c:wuffs_base__color_swap_u32_argb_abgr Line | Count | Source | 4878 | 57.6M | wuffs_base__color_swap_u32_argb_abgr(uint32_t u) { | 4879 | 57.6M | uint32_t o = u & 0xFF00FF00ul; | 4880 | 57.6M | uint32_t r = u & 0x00FF0000ul; | 4881 | 57.6M | uint32_t b = u & 0x000000FFul; | 4882 | 57.6M | return o | (r >> 16) | (b << 16); | 4883 | 57.6M | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_swap_u32_argb_abgr(unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_swap_u32_argb_abgr Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_swap_u32_argb_abgr Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_swap_u32_argb_abgr Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_swap_u32_argb_abgr Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_swap_u32_argb_abgr pixel_swizzler_fuzzer.c:wuffs_base__color_swap_u32_argb_abgr Line | Count | Source | 4878 | 81.7k | wuffs_base__color_swap_u32_argb_abgr(uint32_t u) { | 4879 | 81.7k | uint32_t o = u & 0xFF00FF00ul; | 4880 | 81.7k | uint32_t r = u & 0x00FF0000ul; | 4881 | 81.7k | uint32_t b = u & 0x000000FFul; | 4882 | 81.7k | return o | (r >> 16) | (b << 16); | 4883 | 81.7k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_swap_u32_argb_abgr Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_swap_u32_argb_abgr Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_swap_u32_argb_abgr Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_swap_u32_argb_abgr |
4884 | | |
4885 | | // wuffs_base__color_swap_u64_argb_abgr converts between 0xAAAARRRRGGGGBBBB and |
4886 | | // 0xAAAABBBBGGGGRRRR. |
4887 | | static inline uint64_t // |
4888 | 555 | wuffs_base__color_swap_u64_argb_abgr(uint64_t u) { |
4889 | 555 | uint64_t o = u & 0xFFFF0000FFFF0000ull; |
4890 | 555 | uint64_t r = u & 0x0000FFFF00000000ull; |
4891 | 555 | uint64_t b = u & 0x000000000000FFFFull; |
4892 | 555 | return o | (r >> 32) | (b << 32); |
4893 | 555 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__color_swap_u64_argb_abgr Unexecuted instantiation: json_fuzzer.cc:wuffs_base__color_swap_u64_argb_abgr(unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__color_swap_u64_argb_abgr Unexecuted instantiation: xz_fuzzer.c:wuffs_base__color_swap_u64_argb_abgr Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__color_swap_u64_argb_abgr Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__color_swap_u64_argb_abgr Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__color_swap_u64_argb_abgr pixel_swizzler_fuzzer.c:wuffs_base__color_swap_u64_argb_abgr Line | Count | Source | 4888 | 555 | wuffs_base__color_swap_u64_argb_abgr(uint64_t u) { | 4889 | 555 | uint64_t o = u & 0xFFFF0000FFFF0000ull; | 4890 | 555 | uint64_t r = u & 0x0000FFFF00000000ull; | 4891 | 555 | uint64_t b = u & 0x000000000000FFFFull; | 4892 | 555 | return o | (r >> 32) | (b << 32); | 4893 | 555 | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__color_swap_u64_argb_abgr Unexecuted instantiation: targa_fuzzer.c:wuffs_base__color_swap_u64_argb_abgr Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__color_swap_u64_argb_abgr Unexecuted instantiation: webp_fuzzer.c:wuffs_base__color_swap_u64_argb_abgr |
4894 | | |
4895 | | // -------- |
4896 | | |
4897 | | typedef uint8_t wuffs_base__pixel_blend; |
4898 | | |
4899 | | // wuffs_base__pixel_blend encodes how to blend source and destination pixels, |
4900 | | // accounting for transparency. It encompasses the Porter-Duff compositing |
4901 | | // operators as well as the other blending modes defined by PDF. |
4902 | | // |
4903 | | // TODO: implement the other modes. |
4904 | 816k | #define WUFFS_BASE__PIXEL_BLEND__SRC ((wuffs_base__pixel_blend)0) |
4905 | 3.20k | #define WUFFS_BASE__PIXEL_BLEND__SRC_OVER ((wuffs_base__pixel_blend)1) |
4906 | | |
4907 | | static inline wuffs_base__pixel_blend // |
4908 | 106 | wuffs_base__make_pixel_blend(uint8_t repr) { |
4909 | 106 | return repr; |
4910 | 106 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_pixel_blend Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_pixel_blend(unsigned char) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_pixel_blend Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_pixel_blend Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_pixel_blend Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_pixel_blend Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_pixel_blend Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_pixel_blend Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_pixel_blend Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_pixel_blend Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_pixel_blend webp_fuzzer.c:wuffs_base__make_pixel_blend Line | Count | Source | 4908 | 106 | wuffs_base__make_pixel_blend(uint8_t repr) { | 4909 | 106 | return repr; | 4910 | 106 | } |
|
4911 | | |
4912 | | // -------- |
4913 | | |
4914 | | // wuffs_base__pixel_alpha_transparency is a pixel format's alpha channel |
4915 | | // model. It is a property of the pixel format in general, not of a specific |
4916 | | // pixel. An RGBA pixel format (with alpha) can still have fully opaque pixels. |
4917 | | typedef uint32_t wuffs_base__pixel_alpha_transparency; |
4918 | | |
4919 | 0 | #define WUFFS_BASE__PIXEL_ALPHA_TRANSPARENCY__OPAQUE 0 |
4920 | | #define WUFFS_BASE__PIXEL_ALPHA_TRANSPARENCY__NONPREMULTIPLIED_ALPHA 1 |
4921 | | #define WUFFS_BASE__PIXEL_ALPHA_TRANSPARENCY__PREMULTIPLIED_ALPHA 2 |
4922 | | #define WUFFS_BASE__PIXEL_ALPHA_TRANSPARENCY__BINARY_ALPHA 3 |
4923 | | |
4924 | | // -------- |
4925 | | |
4926 | | // wuffs_base__pixel_coloration is whether a pixel format's color model has no |
4927 | | // color (alpha only), gray color or rich (non-gray) color. Rich color includes |
4928 | | // RGB, BGR, YCC, YCCK, CMY and CMYK. |
4929 | | // |
4930 | | // Coloration does not capture the alpha aspect of the color model. It does not |
4931 | | // distinguish RGB from RGBA. |
4932 | | typedef uint32_t wuffs_base__pixel_coloration; |
4933 | | |
4934 | | #define WUFFS_BASE__PIXEL_COLORATION__NONE 0 |
4935 | | #define WUFFS_BASE__PIXEL_COLORATION__GRAY 1 |
4936 | | #define WUFFS_BASE__PIXEL_COLORATION__RICH 3 |
4937 | | |
4938 | | // -------- |
4939 | | |
4940 | | // Deprecated: use WUFFS_BASE__PIXEL_FORMAT__NUM_PLANES_MAX_INCL. |
4941 | | #define WUFFS_BASE__PIXEL_FORMAT__NUM_PLANES_MAX 4 |
4942 | | |
4943 | 135k | #define WUFFS_BASE__PIXEL_FORMAT__NUM_PLANES_MAX_INCL 4 |
4944 | | |
4945 | | #define WUFFS_BASE__PIXEL_FORMAT__INDEXED__INDEX_PLANE 0 |
4946 | 269k | #define WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE 3 |
4947 | | |
4948 | | // A palette is 256 entries ร 4 bytes per entry (e.g. BGRA). |
4949 | 4.70M | #define WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH 1024 |
4950 | | |
4951 | | // wuffs_base__pixel_format encodes the format of the bytes that constitute an |
4952 | | // image frame's pixel data. |
4953 | | // |
4954 | | // See https://github.com/google/wuffs/blob/main/doc/note/pixel-formats.md |
4955 | | // |
4956 | | // Do not manipulate its bits directly; they are private implementation |
4957 | | // details. Use methods such as wuffs_base__pixel_format__num_planes instead. |
4958 | | typedef struct wuffs_base__pixel_format__struct { |
4959 | | uint32_t repr; |
4960 | | |
4961 | | #ifdef __cplusplus |
4962 | | inline bool is_valid() const; |
4963 | | inline uint32_t bits_per_pixel() const; |
4964 | | inline uint32_t default_background_color() const; |
4965 | | inline bool is_direct() const; |
4966 | | inline bool is_indexed() const; |
4967 | | inline bool is_interleaved() const; |
4968 | | inline bool is_planar() const; |
4969 | | inline uint32_t coloration() const; |
4970 | | inline uint32_t num_planes() const; |
4971 | | inline wuffs_base__pixel_alpha_transparency transparency() const; |
4972 | | #endif // __cplusplus |
4973 | | |
4974 | | } wuffs_base__pixel_format; |
4975 | | |
4976 | | static inline wuffs_base__pixel_format // |
4977 | 292k | wuffs_base__make_pixel_format(uint32_t repr) { |
4978 | 292k | wuffs_base__pixel_format f; |
4979 | 292k | f.repr = repr; |
4980 | 292k | return f; |
4981 | 292k | } png_fuzzer.c:wuffs_base__make_pixel_format Line | Count | Source | 4977 | 12.7k | wuffs_base__make_pixel_format(uint32_t repr) { | 4978 | 12.7k | wuffs_base__pixel_format f; | 4979 | 12.7k | f.repr = repr; | 4980 | 12.7k | return f; | 4981 | 12.7k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_pixel_format(unsigned int) gif_fuzzer.c:wuffs_base__make_pixel_format Line | Count | Source | 4977 | 259k | wuffs_base__make_pixel_format(uint32_t repr) { | 4978 | 259k | wuffs_base__pixel_format f; | 4979 | 259k | f.repr = repr; | 4980 | 259k | return f; | 4981 | 259k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_pixel_format jpeg_fuzzer.c:wuffs_base__make_pixel_format Line | Count | Source | 4977 | 2.85k | wuffs_base__make_pixel_format(uint32_t repr) { | 4978 | 2.85k | wuffs_base__pixel_format f; | 4979 | 2.85k | f.repr = repr; | 4980 | 2.85k | return f; | 4981 | 2.85k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_pixel_format bmp_fuzzer.c:wuffs_base__make_pixel_format Line | Count | Source | 4977 | 3.36k | wuffs_base__make_pixel_format(uint32_t repr) { | 4978 | 3.36k | wuffs_base__pixel_format f; | 4979 | 3.36k | f.repr = repr; | 4980 | 3.36k | return f; | 4981 | 3.36k | } |
pixel_swizzler_fuzzer.c:wuffs_base__make_pixel_format Line | Count | Source | 4977 | 9.87k | wuffs_base__make_pixel_format(uint32_t repr) { | 4978 | 9.87k | wuffs_base__pixel_format f; | 4979 | 9.87k | f.repr = repr; | 4980 | 9.87k | return f; | 4981 | 9.87k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_pixel_format targa_fuzzer.c:wuffs_base__make_pixel_format Line | Count | Source | 4977 | 1.78k | wuffs_base__make_pixel_format(uint32_t repr) { | 4978 | 1.78k | wuffs_base__pixel_format f; | 4979 | 1.78k | f.repr = repr; | 4980 | 1.78k | return f; | 4981 | 1.78k | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_pixel_format webp_fuzzer.c:wuffs_base__make_pixel_format Line | Count | Source | 4977 | 2.10k | wuffs_base__make_pixel_format(uint32_t repr) { | 4978 | 2.10k | wuffs_base__pixel_format f; | 4979 | 2.10k | f.repr = repr; | 4980 | 2.10k | return f; | 4981 | 2.10k | } |
|
4982 | | |
4983 | | // Common 8-bit-depth pixel formats. This list is not exhaustive; not all valid |
4984 | | // wuffs_base__pixel_format values are present. |
4985 | | |
4986 | | // clang-format off |
4987 | | |
4988 | 0 | #define WUFFS_BASE__PIXEL_FORMAT__INVALID 0x00000000 |
4989 | | |
4990 | | #define WUFFS_BASE__PIXEL_FORMAT__A 0x02000008 |
4991 | | |
4992 | 58.5k | #define WUFFS_BASE__PIXEL_FORMAT__Y 0x20000008 |
4993 | 12.2k | #define WUFFS_BASE__PIXEL_FORMAT__Y_16LE 0x2000000B |
4994 | 14.3k | #define WUFFS_BASE__PIXEL_FORMAT__Y_16BE 0x2010000B |
4995 | 24.5k | #define WUFFS_BASE__PIXEL_FORMAT__YA_NONPREMUL 0x21000088 |
4996 | | #define WUFFS_BASE__PIXEL_FORMAT__YA_PREMUL 0x22000088 |
4997 | | #define WUFFS_BASE__PIXEL_FORMAT__YXXX 0x30008888 |
4998 | | |
4999 | | #define WUFFS_BASE__PIXEL_FORMAT__YCBCR 0x40020888 |
5000 | | #define WUFFS_BASE__PIXEL_FORMAT__YCBCRA_NONPREMUL 0x41038888 |
5001 | | #define WUFFS_BASE__PIXEL_FORMAT__YCBCRK 0x50038888 |
5002 | | |
5003 | | #define WUFFS_BASE__PIXEL_FORMAT__YCOCG 0x60020888 |
5004 | | #define WUFFS_BASE__PIXEL_FORMAT__YCOCGA_NONPREMUL 0x61038888 |
5005 | | #define WUFFS_BASE__PIXEL_FORMAT__YCOCGK 0x70038888 |
5006 | | |
5007 | 108k | #define WUFFS_BASE__PIXEL_FORMAT__INDEXED__BGRA_NONPREMUL 0x81040008 |
5008 | 59.4k | #define WUFFS_BASE__PIXEL_FORMAT__INDEXED__BGRA_PREMUL 0x82040008 |
5009 | 577k | #define WUFFS_BASE__PIXEL_FORMAT__INDEXED__BGRA_BINARY 0x83040008 |
5010 | | |
5011 | 46.3k | #define WUFFS_BASE__PIXEL_FORMAT__BGR_565 0x80000565 |
5012 | 53.3k | #define WUFFS_BASE__PIXEL_FORMAT__BGR 0x80000888 |
5013 | 1.21M | #define WUFFS_BASE__PIXEL_FORMAT__BGRA_NONPREMUL 0x81008888 |
5014 | 79.6k | #define WUFFS_BASE__PIXEL_FORMAT__BGRA_NONPREMUL_4X16LE 0x8100BBBB |
5015 | 506M | #define WUFFS_BASE__PIXEL_FORMAT__BGRA_PREMUL 0x82008888 |
5016 | 584 | #define WUFFS_BASE__PIXEL_FORMAT__BGRA_PREMUL_4X16LE 0x8200BBBB |
5017 | 46.2k | #define WUFFS_BASE__PIXEL_FORMAT__BGRA_BINARY 0x83008888 |
5018 | 819M | #define WUFFS_BASE__PIXEL_FORMAT__BGRX 0x90008888 |
5019 | | |
5020 | 58.5k | #define WUFFS_BASE__PIXEL_FORMAT__RGB 0xA0000888 |
5021 | 18.5k | #define WUFFS_BASE__PIXEL_FORMAT__RGBA_NONPREMUL 0xA1008888 |
5022 | 85 | #define WUFFS_BASE__PIXEL_FORMAT__RGBA_NONPREMUL_4X16LE 0xA100BBBB |
5023 | 16.5k | #define WUFFS_BASE__PIXEL_FORMAT__RGBA_PREMUL 0xA2008888 |
5024 | 39 | #define WUFFS_BASE__PIXEL_FORMAT__RGBA_PREMUL_4X16LE 0xA200BBBB |
5025 | 2.21k | #define WUFFS_BASE__PIXEL_FORMAT__RGBA_BINARY 0xA3008888 |
5026 | 15.9k | #define WUFFS_BASE__PIXEL_FORMAT__RGBX 0xB0008888 |
5027 | | |
5028 | | #define WUFFS_BASE__PIXEL_FORMAT__CMY 0xC0020888 |
5029 | | #define WUFFS_BASE__PIXEL_FORMAT__CMYK 0xD0038888 |
5030 | | |
5031 | | // clang-format on |
5032 | | |
5033 | | extern const uint32_t wuffs_private_impl__pixel_format__bits_per_channel[16]; |
5034 | | |
5035 | | static inline bool // |
5036 | 0 | wuffs_base__pixel_format__is_valid(const wuffs_base__pixel_format* f) { |
5037 | 0 | return f->repr != 0; |
5038 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pixel_format__is_valid Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_format__is_valid(wuffs_base__pixel_format__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_format__is_valid Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_format__is_valid Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_format__is_valid Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_format__is_valid Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pixel_format__is_valid Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_format__is_valid Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_format__is_valid Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pixel_format__is_valid Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_format__is_valid Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pixel_format__is_valid |
5039 | | |
5040 | | // wuffs_base__pixel_format__bits_per_pixel returns the number of bits per |
5041 | | // pixel for interleaved pixel formats, and returns 0 for planar pixel formats. |
5042 | | static inline uint32_t // |
5043 | 726k | wuffs_base__pixel_format__bits_per_pixel(const wuffs_base__pixel_format* f) { |
5044 | 726k | if (((f->repr >> 16) & 0x03) != 0) { |
5045 | 0 | return 0; |
5046 | 0 | } |
5047 | 726k | return wuffs_private_impl__pixel_format__bits_per_channel[0x0F & |
5048 | 726k | (f->repr >> 0)] + |
5049 | 726k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & |
5050 | 726k | (f->repr >> 4)] + |
5051 | 726k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & |
5052 | 726k | (f->repr >> 8)] + |
5053 | 726k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & |
5054 | 726k | (f->repr >> 12)]; |
5055 | 726k | } png_fuzzer.c:wuffs_base__pixel_format__bits_per_pixel Line | Count | Source | 5043 | 31.0k | wuffs_base__pixel_format__bits_per_pixel(const wuffs_base__pixel_format* f) { | 5044 | 31.0k | if (((f->repr >> 16) & 0x03) != 0) { | 5045 | 0 | return 0; | 5046 | 0 | } | 5047 | 31.0k | return wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5048 | 31.0k | (f->repr >> 0)] + | 5049 | 31.0k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5050 | 31.0k | (f->repr >> 4)] + | 5051 | 31.0k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5052 | 31.0k | (f->repr >> 8)] + | 5053 | 31.0k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5054 | 31.0k | (f->repr >> 12)]; | 5055 | 31.0k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_format__bits_per_pixel(wuffs_base__pixel_format__struct const*) gif_fuzzer.c:wuffs_base__pixel_format__bits_per_pixel Line | Count | Source | 5043 | 642k | wuffs_base__pixel_format__bits_per_pixel(const wuffs_base__pixel_format* f) { | 5044 | 642k | if (((f->repr >> 16) & 0x03) != 0) { | 5045 | 0 | return 0; | 5046 | 0 | } | 5047 | 642k | return wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5048 | 642k | (f->repr >> 0)] + | 5049 | 642k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5050 | 642k | (f->repr >> 4)] + | 5051 | 642k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5052 | 642k | (f->repr >> 8)] + | 5053 | 642k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5054 | 642k | (f->repr >> 12)]; | 5055 | 642k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_format__bits_per_pixel jpeg_fuzzer.c:wuffs_base__pixel_format__bits_per_pixel Line | Count | Source | 5043 | 13.3k | wuffs_base__pixel_format__bits_per_pixel(const wuffs_base__pixel_format* f) { | 5044 | 13.3k | if (((f->repr >> 16) & 0x03) != 0) { | 5045 | 0 | return 0; | 5046 | 0 | } | 5047 | 13.3k | return wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5048 | 13.3k | (f->repr >> 0)] + | 5049 | 13.3k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5050 | 13.3k | (f->repr >> 4)] + | 5051 | 13.3k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5052 | 13.3k | (f->repr >> 8)] + | 5053 | 13.3k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5054 | 13.3k | (f->repr >> 12)]; | 5055 | 13.3k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_format__bits_per_pixel bmp_fuzzer.c:wuffs_base__pixel_format__bits_per_pixel Line | Count | Source | 5043 | 8.37k | wuffs_base__pixel_format__bits_per_pixel(const wuffs_base__pixel_format* f) { | 5044 | 8.37k | if (((f->repr >> 16) & 0x03) != 0) { | 5045 | 0 | return 0; | 5046 | 0 | } | 5047 | 8.37k | return wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5048 | 8.37k | (f->repr >> 0)] + | 5049 | 8.37k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5050 | 8.37k | (f->repr >> 4)] + | 5051 | 8.37k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5052 | 8.37k | (f->repr >> 8)] + | 5053 | 8.37k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5054 | 8.37k | (f->repr >> 12)]; | 5055 | 8.37k | } |
pixel_swizzler_fuzzer.c:wuffs_base__pixel_format__bits_per_pixel Line | Count | Source | 5043 | 13.1k | wuffs_base__pixel_format__bits_per_pixel(const wuffs_base__pixel_format* f) { | 5044 | 13.1k | if (((f->repr >> 16) & 0x03) != 0) { | 5045 | 0 | return 0; | 5046 | 0 | } | 5047 | 13.1k | return wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5048 | 13.1k | (f->repr >> 0)] + | 5049 | 13.1k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5050 | 13.1k | (f->repr >> 4)] + | 5051 | 13.1k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5052 | 13.1k | (f->repr >> 8)] + | 5053 | 13.1k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5054 | 13.1k | (f->repr >> 12)]; | 5055 | 13.1k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_format__bits_per_pixel targa_fuzzer.c:wuffs_base__pixel_format__bits_per_pixel Line | Count | Source | 5043 | 4.48k | wuffs_base__pixel_format__bits_per_pixel(const wuffs_base__pixel_format* f) { | 5044 | 4.48k | if (((f->repr >> 16) & 0x03) != 0) { | 5045 | 0 | return 0; | 5046 | 0 | } | 5047 | 4.48k | return wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5048 | 4.48k | (f->repr >> 0)] + | 5049 | 4.48k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5050 | 4.48k | (f->repr >> 4)] + | 5051 | 4.48k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5052 | 4.48k | (f->repr >> 8)] + | 5053 | 4.48k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5054 | 4.48k | (f->repr >> 12)]; | 5055 | 4.48k | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_format__bits_per_pixel webp_fuzzer.c:wuffs_base__pixel_format__bits_per_pixel Line | Count | Source | 5043 | 13.0k | wuffs_base__pixel_format__bits_per_pixel(const wuffs_base__pixel_format* f) { | 5044 | 13.0k | if (((f->repr >> 16) & 0x03) != 0) { | 5045 | 0 | return 0; | 5046 | 0 | } | 5047 | 13.0k | return wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5048 | 13.0k | (f->repr >> 0)] + | 5049 | 13.0k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5050 | 13.0k | (f->repr >> 4)] + | 5051 | 13.0k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5052 | 13.0k | (f->repr >> 8)] + | 5053 | 13.0k | wuffs_private_impl__pixel_format__bits_per_channel[0x0F & | 5054 | 13.0k | (f->repr >> 12)]; | 5055 | 13.0k | } |
|
5056 | | |
5057 | | static inline uint32_t // |
5058 | | wuffs_base__pixel_format__default_background_color( |
5059 | 9.10k | const wuffs_base__pixel_format* f) { |
5060 | 9.10k | return ((f->repr & 0x03000000) == 0) ? 0xFF000000 // Opaque black. |
5061 | 9.10k | : 0x00000000; // Transparent black. |
5062 | 9.10k | } png_fuzzer.c:wuffs_base__pixel_format__default_background_color Line | Count | Source | 5059 | 6.49k | const wuffs_base__pixel_format* f) { | 5060 | 6.49k | return ((f->repr & 0x03000000) == 0) ? 0xFF000000 // Opaque black. | 5061 | 6.49k | : 0x00000000; // Transparent black. | 5062 | 6.49k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_format__default_background_color(wuffs_base__pixel_format__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_format__default_background_color Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_format__default_background_color Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_format__default_background_color Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_format__default_background_color bmp_fuzzer.c:wuffs_base__pixel_format__default_background_color Line | Count | Source | 5059 | 1.72k | const wuffs_base__pixel_format* f) { | 5060 | 1.72k | return ((f->repr & 0x03000000) == 0) ? 0xFF000000 // Opaque black. | 5061 | 1.72k | : 0x00000000; // Transparent black. | 5062 | 1.72k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_format__default_background_color Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_format__default_background_color targa_fuzzer.c:wuffs_base__pixel_format__default_background_color Line | Count | Source | 5059 | 893 | const wuffs_base__pixel_format* f) { | 5060 | 893 | return ((f->repr & 0x03000000) == 0) ? 0xFF000000 // Opaque black. | 5061 | 893 | : 0x00000000; // Transparent black. | 5062 | 893 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_format__default_background_color Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pixel_format__default_background_color |
5063 | | |
5064 | | static inline bool // |
5065 | 0 | wuffs_base__pixel_format__is_direct(const wuffs_base__pixel_format* f) { |
5066 | 0 | return ((f->repr >> 18) & 0x01) == 0; |
5067 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pixel_format__is_direct Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_format__is_direct(wuffs_base__pixel_format__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_format__is_direct Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_format__is_direct Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_format__is_direct Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_format__is_direct Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pixel_format__is_direct Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_format__is_direct Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_format__is_direct Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pixel_format__is_direct Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_format__is_direct Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pixel_format__is_direct |
5068 | | |
5069 | | static inline bool // |
5070 | 15.3M | wuffs_base__pixel_format__is_indexed(const wuffs_base__pixel_format* f) { |
5071 | 15.3M | return ((f->repr >> 18) & 0x01) != 0; |
5072 | 15.3M | } png_fuzzer.c:wuffs_base__pixel_format__is_indexed Line | Count | Source | 5070 | 24.7k | wuffs_base__pixel_format__is_indexed(const wuffs_base__pixel_format* f) { | 5071 | 24.7k | return ((f->repr >> 18) & 0x01) != 0; | 5072 | 24.7k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_format__is_indexed(wuffs_base__pixel_format__struct const*) gif_fuzzer.c:wuffs_base__pixel_format__is_indexed Line | Count | Source | 5070 | 262k | wuffs_base__pixel_format__is_indexed(const wuffs_base__pixel_format* f) { | 5071 | 262k | return ((f->repr >> 18) & 0x01) != 0; | 5072 | 262k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_format__is_indexed jpeg_fuzzer.c:wuffs_base__pixel_format__is_indexed Line | Count | Source | 5070 | 14.9M | wuffs_base__pixel_format__is_indexed(const wuffs_base__pixel_format* f) { | 5071 | 14.9M | return ((f->repr >> 18) & 0x01) != 0; | 5072 | 14.9M | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_format__is_indexed bmp_fuzzer.c:wuffs_base__pixel_format__is_indexed Line | Count | Source | 5070 | 6.73k | wuffs_base__pixel_format__is_indexed(const wuffs_base__pixel_format* f) { | 5071 | 6.73k | return ((f->repr >> 18) & 0x01) != 0; | 5072 | 6.73k | } |
pixel_swizzler_fuzzer.c:wuffs_base__pixel_format__is_indexed Line | Count | Source | 5070 | 55.0k | wuffs_base__pixel_format__is_indexed(const wuffs_base__pixel_format* f) { | 5071 | 55.0k | return ((f->repr >> 18) & 0x01) != 0; | 5072 | 55.0k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_format__is_indexed targa_fuzzer.c:wuffs_base__pixel_format__is_indexed Line | Count | Source | 5070 | 3.58k | wuffs_base__pixel_format__is_indexed(const wuffs_base__pixel_format* f) { | 5071 | 3.58k | return ((f->repr >> 18) & 0x01) != 0; | 5072 | 3.58k | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_format__is_indexed webp_fuzzer.c:wuffs_base__pixel_format__is_indexed Line | Count | Source | 5070 | 12.6k | wuffs_base__pixel_format__is_indexed(const wuffs_base__pixel_format* f) { | 5071 | 12.6k | return ((f->repr >> 18) & 0x01) != 0; | 5072 | 12.6k | } |
|
5073 | | |
5074 | | static inline bool // |
5075 | 0 | wuffs_base__pixel_format__is_interleaved(const wuffs_base__pixel_format* f) { |
5076 | 0 | return ((f->repr >> 16) & 0x03) == 0; |
5077 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pixel_format__is_interleaved Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_format__is_interleaved(wuffs_base__pixel_format__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_format__is_interleaved Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_format__is_interleaved Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_format__is_interleaved Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_format__is_interleaved Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pixel_format__is_interleaved Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_format__is_interleaved Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_format__is_interleaved Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pixel_format__is_interleaved Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_format__is_interleaved Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pixel_format__is_interleaved |
5078 | | |
5079 | | static inline bool // |
5080 | 820M | wuffs_base__pixel_format__is_planar(const wuffs_base__pixel_format* f) { |
5081 | 820M | return ((f->repr >> 16) & 0x03) != 0; |
5082 | 820M | } png_fuzzer.c:wuffs_base__pixel_format__is_planar Line | Count | Source | 5080 | 8.61k | wuffs_base__pixel_format__is_planar(const wuffs_base__pixel_format* f) { | 5081 | 8.61k | return ((f->repr >> 16) & 0x03) != 0; | 5082 | 8.61k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_format__is_planar(wuffs_base__pixel_format__struct const*) gif_fuzzer.c:wuffs_base__pixel_format__is_planar Line | Count | Source | 5080 | 3.21k | wuffs_base__pixel_format__is_planar(const wuffs_base__pixel_format* f) { | 5081 | 3.21k | return ((f->repr >> 16) & 0x03) != 0; | 5082 | 3.21k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_format__is_planar jpeg_fuzzer.c:wuffs_base__pixel_format__is_planar Line | Count | Source | 5080 | 819M | wuffs_base__pixel_format__is_planar(const wuffs_base__pixel_format* f) { | 5081 | 819M | return ((f->repr >> 16) & 0x03) != 0; | 5082 | 819M | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_format__is_planar bmp_fuzzer.c:wuffs_base__pixel_format__is_planar Line | Count | Source | 5080 | 3.48k | wuffs_base__pixel_format__is_planar(const wuffs_base__pixel_format* f) { | 5081 | 3.48k | return ((f->repr >> 16) & 0x03) != 0; | 5082 | 3.48k | } |
pixel_swizzler_fuzzer.c:wuffs_base__pixel_format__is_planar Line | Count | Source | 5080 | 465k | wuffs_base__pixel_format__is_planar(const wuffs_base__pixel_format* f) { | 5081 | 465k | return ((f->repr >> 16) & 0x03) != 0; | 5082 | 465k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_format__is_planar targa_fuzzer.c:wuffs_base__pixel_format__is_planar Line | Count | Source | 5080 | 1.81k | wuffs_base__pixel_format__is_planar(const wuffs_base__pixel_format* f) { | 5081 | 1.81k | return ((f->repr >> 16) & 0x03) != 0; | 5082 | 1.81k | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_format__is_planar webp_fuzzer.c:wuffs_base__pixel_format__is_planar Line | Count | Source | 5080 | 1.19M | wuffs_base__pixel_format__is_planar(const wuffs_base__pixel_format* f) { | 5081 | 1.19M | return ((f->repr >> 16) & 0x03) != 0; | 5082 | 1.19M | } |
|
5083 | | |
5084 | | static inline uint32_t // |
5085 | 0 | wuffs_base__pixel_format__coloration(const wuffs_base__pixel_format* f) { |
5086 | 0 | uint32_t n = (f->repr) >> 29; |
5087 | 0 | return (n <= 1) ? n : 3; |
5088 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pixel_format__coloration Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_format__coloration(wuffs_base__pixel_format__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_format__coloration Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_format__coloration Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_format__coloration Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_format__coloration Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pixel_format__coloration Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_format__coloration Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_format__coloration Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pixel_format__coloration Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_format__coloration Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pixel_format__coloration |
5089 | | |
5090 | | static inline uint32_t // |
5091 | 0 | wuffs_base__pixel_format__num_planes(const wuffs_base__pixel_format* f) { |
5092 | 0 | return ((f->repr >> 16) & 0x03) + 1; |
5093 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pixel_format__num_planes Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_format__num_planes(wuffs_base__pixel_format__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_format__num_planes Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_format__num_planes Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_format__num_planes Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_format__num_planes Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pixel_format__num_planes Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_format__num_planes Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_format__num_planes Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pixel_format__num_planes Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_format__num_planes Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pixel_format__num_planes |
5094 | | |
5095 | | static inline wuffs_base__pixel_alpha_transparency // |
5096 | 0 | wuffs_base__pixel_format__transparency(const wuffs_base__pixel_format* f) { |
5097 | 0 | return (wuffs_base__pixel_alpha_transparency)((f->repr >> 24) & 0x03); |
5098 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pixel_format__transparency Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_format__transparency(wuffs_base__pixel_format__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_format__transparency Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_format__transparency Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_format__transparency Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_format__transparency Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pixel_format__transparency Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_format__transparency Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_format__transparency Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pixel_format__transparency Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_format__transparency Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pixel_format__transparency |
5099 | | |
5100 | | #ifdef __cplusplus |
5101 | | |
5102 | | inline bool // |
5103 | 0 | wuffs_base__pixel_format::is_valid() const { |
5104 | 0 | return wuffs_base__pixel_format__is_valid(this); |
5105 | 0 | } |
5106 | | |
5107 | | inline uint32_t // |
5108 | 0 | wuffs_base__pixel_format::bits_per_pixel() const { |
5109 | 0 | return wuffs_base__pixel_format__bits_per_pixel(this); |
5110 | 0 | } |
5111 | | |
5112 | | inline uint32_t // |
5113 | 0 | wuffs_base__pixel_format::default_background_color() const { |
5114 | 0 | return wuffs_base__pixel_format__default_background_color(this); |
5115 | 0 | } |
5116 | | |
5117 | | inline bool // |
5118 | 0 | wuffs_base__pixel_format::is_direct() const { |
5119 | 0 | return wuffs_base__pixel_format__is_direct(this); |
5120 | 0 | } |
5121 | | |
5122 | | inline bool // |
5123 | 0 | wuffs_base__pixel_format::is_indexed() const { |
5124 | 0 | return wuffs_base__pixel_format__is_indexed(this); |
5125 | 0 | } |
5126 | | |
5127 | | inline bool // |
5128 | 0 | wuffs_base__pixel_format::is_interleaved() const { |
5129 | 0 | return wuffs_base__pixel_format__is_interleaved(this); |
5130 | 0 | } |
5131 | | |
5132 | | inline bool // |
5133 | 0 | wuffs_base__pixel_format::is_planar() const { |
5134 | 0 | return wuffs_base__pixel_format__is_planar(this); |
5135 | 0 | } |
5136 | | |
5137 | | inline uint32_t // |
5138 | 0 | wuffs_base__pixel_format::coloration() const { |
5139 | 0 | return wuffs_base__pixel_format__coloration(this); |
5140 | 0 | } |
5141 | | |
5142 | | inline uint32_t // |
5143 | 0 | wuffs_base__pixel_format::num_planes() const { |
5144 | 0 | return wuffs_base__pixel_format__num_planes(this); |
5145 | 0 | } |
5146 | | |
5147 | | inline wuffs_base__pixel_alpha_transparency // |
5148 | 0 | wuffs_base__pixel_format::transparency() const { |
5149 | 0 | return wuffs_base__pixel_format__transparency(this); |
5150 | 0 | } |
5151 | | |
5152 | | #endif // __cplusplus |
5153 | | |
5154 | | // -------- |
5155 | | |
5156 | | // wuffs_base__pixel_subsampling encodes whether sample values cover one pixel |
5157 | | // or cover multiple pixels. |
5158 | | // |
5159 | | // See https://github.com/google/wuffs/blob/main/doc/note/pixel-subsampling.md |
5160 | | // |
5161 | | // Do not manipulate its bits directly; they are private implementation |
5162 | | // details. Use methods such as wuffs_base__pixel_subsampling__bias_x instead. |
5163 | | typedef struct wuffs_base__pixel_subsampling__struct { |
5164 | | uint32_t repr; |
5165 | | |
5166 | | #ifdef __cplusplus |
5167 | | inline uint32_t bias_x(uint32_t plane) const; |
5168 | | inline uint32_t denominator_x(uint32_t plane) const; |
5169 | | inline uint32_t bias_y(uint32_t plane) const; |
5170 | | inline uint32_t denominator_y(uint32_t plane) const; |
5171 | | #endif // __cplusplus |
5172 | | |
5173 | | } wuffs_base__pixel_subsampling; |
5174 | | |
5175 | | static inline wuffs_base__pixel_subsampling // |
5176 | 0 | wuffs_base__make_pixel_subsampling(uint32_t repr) { |
5177 | 0 | wuffs_base__pixel_subsampling s; |
5178 | 0 | s.repr = repr; |
5179 | 0 | return s; |
5180 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_pixel_subsampling Unexecuted instantiation: json_fuzzer.cc:wuffs_base__make_pixel_subsampling(unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_pixel_subsampling Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_pixel_subsampling Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_pixel_subsampling Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__make_pixel_subsampling Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_pixel_subsampling Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_pixel_subsampling Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_pixel_subsampling Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_pixel_subsampling Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_pixel_subsampling Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_pixel_subsampling |
5181 | | |
5182 | 8.50k | #define WUFFS_BASE__PIXEL_SUBSAMPLING__NONE 0x00000000 |
5183 | | |
5184 | | #define WUFFS_BASE__PIXEL_SUBSAMPLING__444 0x000000 |
5185 | | #define WUFFS_BASE__PIXEL_SUBSAMPLING__440 0x010100 |
5186 | | #define WUFFS_BASE__PIXEL_SUBSAMPLING__422 0x101000 |
5187 | | #define WUFFS_BASE__PIXEL_SUBSAMPLING__420 0x111100 |
5188 | | #define WUFFS_BASE__PIXEL_SUBSAMPLING__411 0x303000 |
5189 | | #define WUFFS_BASE__PIXEL_SUBSAMPLING__410 0x313100 |
5190 | | |
5191 | | static inline uint32_t // |
5192 | | wuffs_base__pixel_subsampling__bias_x(const wuffs_base__pixel_subsampling* s, |
5193 | 0 | uint32_t plane) { |
5194 | 0 | uint32_t shift = ((plane & 0x03) * 8) + 6; |
5195 | 0 | return (s->repr >> shift) & 0x03; |
5196 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pixel_subsampling__bias_x Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_subsampling__bias_x(wuffs_base__pixel_subsampling__struct const*, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_subsampling__bias_x Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_subsampling__bias_x Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_subsampling__bias_x Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_subsampling__bias_x Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pixel_subsampling__bias_x Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_subsampling__bias_x Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_subsampling__bias_x Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pixel_subsampling__bias_x Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_subsampling__bias_x Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pixel_subsampling__bias_x |
5197 | | |
5198 | | static inline uint32_t // |
5199 | | wuffs_base__pixel_subsampling__denominator_x( |
5200 | | const wuffs_base__pixel_subsampling* s, |
5201 | 0 | uint32_t plane) { |
5202 | 0 | uint32_t shift = ((plane & 0x03) * 8) + 4; |
5203 | 0 | return ((s->repr >> shift) & 0x03) + 1; |
5204 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pixel_subsampling__denominator_x Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_subsampling__denominator_x(wuffs_base__pixel_subsampling__struct const*, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_subsampling__denominator_x Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_subsampling__denominator_x Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_subsampling__denominator_x Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_subsampling__denominator_x Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pixel_subsampling__denominator_x Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_subsampling__denominator_x Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_subsampling__denominator_x Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pixel_subsampling__denominator_x Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_subsampling__denominator_x Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pixel_subsampling__denominator_x |
5205 | | |
5206 | | static inline uint32_t // |
5207 | | wuffs_base__pixel_subsampling__bias_y(const wuffs_base__pixel_subsampling* s, |
5208 | 0 | uint32_t plane) { |
5209 | 0 | uint32_t shift = ((plane & 0x03) * 8) + 2; |
5210 | 0 | return (s->repr >> shift) & 0x03; |
5211 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pixel_subsampling__bias_y Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_subsampling__bias_y(wuffs_base__pixel_subsampling__struct const*, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_subsampling__bias_y Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_subsampling__bias_y Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_subsampling__bias_y Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_subsampling__bias_y Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pixel_subsampling__bias_y Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_subsampling__bias_y Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_subsampling__bias_y Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pixel_subsampling__bias_y Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_subsampling__bias_y Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pixel_subsampling__bias_y |
5212 | | |
5213 | | static inline uint32_t // |
5214 | | wuffs_base__pixel_subsampling__denominator_y( |
5215 | | const wuffs_base__pixel_subsampling* s, |
5216 | 0 | uint32_t plane) { |
5217 | 0 | uint32_t shift = ((plane & 0x03) * 8) + 0; |
5218 | 0 | return ((s->repr >> shift) & 0x03) + 1; |
5219 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pixel_subsampling__denominator_y Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_subsampling__denominator_y(wuffs_base__pixel_subsampling__struct const*, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_subsampling__denominator_y Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_subsampling__denominator_y Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_subsampling__denominator_y Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_subsampling__denominator_y Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pixel_subsampling__denominator_y Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_subsampling__denominator_y Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_subsampling__denominator_y Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pixel_subsampling__denominator_y Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_subsampling__denominator_y Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pixel_subsampling__denominator_y |
5220 | | |
5221 | | #ifdef __cplusplus |
5222 | | |
5223 | | inline uint32_t // |
5224 | 0 | wuffs_base__pixel_subsampling::bias_x(uint32_t plane) const { |
5225 | 0 | return wuffs_base__pixel_subsampling__bias_x(this, plane); |
5226 | 0 | } |
5227 | | |
5228 | | inline uint32_t // |
5229 | 0 | wuffs_base__pixel_subsampling::denominator_x(uint32_t plane) const { |
5230 | 0 | return wuffs_base__pixel_subsampling__denominator_x(this, plane); |
5231 | 0 | } |
5232 | | |
5233 | | inline uint32_t // |
5234 | 0 | wuffs_base__pixel_subsampling::bias_y(uint32_t plane) const { |
5235 | 0 | return wuffs_base__pixel_subsampling__bias_y(this, plane); |
5236 | 0 | } |
5237 | | |
5238 | | inline uint32_t // |
5239 | 0 | wuffs_base__pixel_subsampling::denominator_y(uint32_t plane) const { |
5240 | 0 | return wuffs_base__pixel_subsampling__denominator_y(this, plane); |
5241 | 0 | } |
5242 | | |
5243 | | #endif // __cplusplus |
5244 | | |
5245 | | // -------- |
5246 | | |
5247 | | // YCbCr Models are how to convert to and from RGB. Here's the formulae from |
5248 | | // https://gist.github.com/yohhoy/dafa5a47dade85d8b40625261af3776a |
5249 | | // |
5250 | | // ---- |
5251 | | // |
5252 | | // Y = (a * R) + (b * G) + (c * B) |
5253 | | // Cb = (B - Y) / d |
5254 | | // Cr = (R - Y) / e |
5255 | | // |
5256 | | // BT.601 BT.709 BT.2020 |
5257 | | // a 0.299 0.2126 0.2627 |
5258 | | // b 0.587 0.7152 0.6780 |
5259 | | // c 0.114 0.0722 0.0593 |
5260 | | // d 1.772 1.8556 1.8814 |
5261 | | // e 1.402 1.5748 1.4746 |
5262 | | // |
5263 | | // R = Y + (e * Cr) |
5264 | | // G = Y - ((c / b) * d * Cb) - ((a / b) * e * Cr) |
5265 | | // B = Y + (d * Cb) |
5266 | | // |
5267 | | // https://www.itu.int/rec/R-REC-BT.601 |
5268 | | // https://www.itu.int/rec/R-REC-BT.709 |
5269 | | // https://www.itu.int/rec/R-REC-BT.2020 |
5270 | | // |
5271 | | // ---- |
5272 | | // |
5273 | | // The formulae and abcde constants above are for Full Range. They need scaling |
5274 | | // and biasing for Studio Range. |
5275 | | // |
5276 | | // Full Range means that the luma (Y) and chroma (Cb, Cr) samples all range in |
5277 | | // [0 ..= 255], for 8-bit samples. This is equivalent to [0.0 ..= 1.0] or |
5278 | | // sometimes [-0.5 ..= +0.5], for floating point samples. |
5279 | | // |
5280 | | // Studio Range means that luma (Y) ranges in [16 ..= 235] and chroma (Cb, Cr) |
5281 | | // ranges in [16 ..= 240], again for 8-bit samples. |
5282 | | // |
5283 | | // JPEG/JFIF uses BT.601 Full Range. WEBP uses BT.601 Studio Range. |
5284 | | // |
5285 | | // ---- |
5286 | | // |
5287 | | // Beyond the various ITU BT (Broadcast Television) standards linked from that |
5288 | | // gist, some nominally-YCbCr data streams (like 3- or 4-channel JPEG images) |
5289 | | // can, in practice, hold RGB or CMY/CMYK samples. |
5290 | | // |
5291 | | // For CMY, C = (100% - R), M = (100% - G) and Y = (100% - B). Black (K), if |
5292 | | // present, then modulates the three RGB values. |
5293 | | // |
5294 | | // ---- |
5295 | | // |
5296 | | // The 0x02 bit means the fourth channel is an alpha channel and, if set, then |
5297 | | // the 0x01 bit gives the blend mode (WUFFS_BASE__PIXEL_BLEND__SRC is 0, |
5298 | | // WUFFS_BASE__PIXEL_BLEND__SRC_OVER is 1). |
5299 | | |
5300 | | // clang-format off |
5301 | | |
5302 | 80 | #define WUFFS_BASE__YCC_MODEL__BT_601_FULL_RANGE 0x00 |
5303 | 3.48k | #define WUFFS_BASE__YCC_MODEL__BT_601_STUDIO_RANGE 0x04 |
5304 | 118 | #define WUFFS_BASE__YCC_MODEL__BT_601_STUDIO_RANGE__ALPHA__SRC 0x06 |
5305 | 0 | #define WUFFS_BASE__YCC_MODEL__BT_601_STUDIO_RANGE__ALPHA__SRC_OVER 0x07 |
5306 | 4.04k | #define WUFFS_BASE__YCC_MODEL__RGB 0x40 |
5307 | 176 | #define WUFFS_BASE__YCC_MODEL__CMY 0x80 |
5308 | | |
5309 | | // clang-format on |
5310 | | |
5311 | | // -------- |
5312 | | |
5313 | | typedef struct wuffs_base__pixel_config__struct { |
5314 | | // Do not access the private_impl's fields directly. There is no API/ABI |
5315 | | // compatibility or safety guarantee if you do so. |
5316 | | struct { |
5317 | | wuffs_base__pixel_format pixfmt; |
5318 | | wuffs_base__pixel_subsampling pixsub; |
5319 | | uint32_t width; |
5320 | | uint32_t height; |
5321 | | } private_impl; |
5322 | | |
5323 | | #ifdef __cplusplus |
5324 | | inline void set(uint32_t pixfmt_repr, |
5325 | | uint32_t pixsub_repr, |
5326 | | uint32_t width, |
5327 | | uint32_t height); |
5328 | | inline void invalidate(); |
5329 | | inline bool is_valid() const; |
5330 | | inline wuffs_base__pixel_format pixel_format() const; |
5331 | | inline wuffs_base__pixel_subsampling pixel_subsampling() const; |
5332 | | inline wuffs_base__rect_ie_u32 bounds() const; |
5333 | | inline uint32_t width() const; |
5334 | | inline uint32_t height() const; |
5335 | | inline uint64_t pixbuf_len() const; |
5336 | | #endif // __cplusplus |
5337 | | |
5338 | | } wuffs_base__pixel_config; |
5339 | | |
5340 | | static inline wuffs_base__pixel_config // |
5341 | 0 | wuffs_base__null_pixel_config(void) { |
5342 | 0 | wuffs_base__pixel_config ret; |
5343 | 0 | ret.private_impl.pixfmt.repr = 0; |
5344 | 0 | ret.private_impl.pixsub.repr = 0; |
5345 | 0 | ret.private_impl.width = 0; |
5346 | 0 | ret.private_impl.height = 0; |
5347 | 0 | return ret; |
5348 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__null_pixel_config Unexecuted instantiation: json_fuzzer.cc:wuffs_base__null_pixel_config() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__null_pixel_config Unexecuted instantiation: xz_fuzzer.c:wuffs_base__null_pixel_config Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__null_pixel_config Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__null_pixel_config Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__null_pixel_config Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__null_pixel_config Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__null_pixel_config Unexecuted instantiation: targa_fuzzer.c:wuffs_base__null_pixel_config Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__null_pixel_config Unexecuted instantiation: webp_fuzzer.c:wuffs_base__null_pixel_config |
5349 | | |
5350 | | // TODO: Should this function return bool? An error type? |
5351 | | static inline void // |
5352 | | wuffs_base__pixel_config__set(wuffs_base__pixel_config* c, |
5353 | | uint32_t pixfmt_repr, |
5354 | | uint32_t pixsub_repr, |
5355 | | uint32_t width, |
5356 | 11.7k | uint32_t height) { |
5357 | 11.7k | if (!c) { |
5358 | 0 | return; |
5359 | 0 | } |
5360 | 11.7k | if (pixfmt_repr) { |
5361 | 11.7k | do { |
5362 | | #if SIZE_MAX < 0xFFFFFFFFFFFFFFFFull |
5363 | | uint64_t wh = ((uint64_t)width) * ((uint64_t)height); |
5364 | | // TODO: handle things other than 1 byte per pixel. |
5365 | | if (wh > ((uint64_t)SIZE_MAX)) { |
5366 | | break; |
5367 | | } |
5368 | | #endif |
5369 | 11.7k | c->private_impl.pixfmt.repr = pixfmt_repr; |
5370 | 11.7k | c->private_impl.pixsub.repr = pixsub_repr; |
5371 | 11.7k | c->private_impl.width = width; |
5372 | 11.7k | c->private_impl.height = height; |
5373 | 11.7k | return; |
5374 | 11.7k | } while (0); |
5375 | 11.7k | } |
5376 | | |
5377 | 0 | c->private_impl.pixfmt.repr = 0; |
5378 | 0 | c->private_impl.pixsub.repr = 0; |
5379 | 0 | c->private_impl.width = 0; |
5380 | 0 | c->private_impl.height = 0; |
5381 | 0 | } png_fuzzer.c:wuffs_base__pixel_config__set Line | Count | Source | 5356 | 2.17k | uint32_t height) { | 5357 | 2.17k | if (!c) { | 5358 | 0 | return; | 5359 | 0 | } | 5360 | 2.17k | if (pixfmt_repr) { | 5361 | 2.17k | do { | 5362 | | #if SIZE_MAX < 0xFFFFFFFFFFFFFFFFull | 5363 | | uint64_t wh = ((uint64_t)width) * ((uint64_t)height); | 5364 | | // TODO: handle things other than 1 byte per pixel. | 5365 | | if (wh > ((uint64_t)SIZE_MAX)) { | 5366 | | break; | 5367 | | } | 5368 | | #endif | 5369 | 2.17k | c->private_impl.pixfmt.repr = pixfmt_repr; | 5370 | 2.17k | c->private_impl.pixsub.repr = pixsub_repr; | 5371 | 2.17k | c->private_impl.width = width; | 5372 | 2.17k | c->private_impl.height = height; | 5373 | 2.17k | return; | 5374 | 2.17k | } while (0); | 5375 | 2.17k | } | 5376 | | | 5377 | 0 | c->private_impl.pixfmt.repr = 0; | 5378 | 0 | c->private_impl.pixsub.repr = 0; | 5379 | 0 | c->private_impl.width = 0; | 5380 | 0 | c->private_impl.height = 0; | 5381 | 0 | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_config__set(wuffs_base__pixel_config__struct*, unsigned int, unsigned int, unsigned int, unsigned int) gif_fuzzer.c:wuffs_base__pixel_config__set Line | Count | Source | 5356 | 783 | uint32_t height) { | 5357 | 783 | if (!c) { | 5358 | 0 | return; | 5359 | 0 | } | 5360 | 783 | if (pixfmt_repr) { | 5361 | 783 | do { | 5362 | | #if SIZE_MAX < 0xFFFFFFFFFFFFFFFFull | 5363 | | uint64_t wh = ((uint64_t)width) * ((uint64_t)height); | 5364 | | // TODO: handle things other than 1 byte per pixel. | 5365 | | if (wh > ((uint64_t)SIZE_MAX)) { | 5366 | | break; | 5367 | | } | 5368 | | #endif | 5369 | 783 | c->private_impl.pixfmt.repr = pixfmt_repr; | 5370 | 783 | c->private_impl.pixsub.repr = pixsub_repr; | 5371 | 783 | c->private_impl.width = width; | 5372 | 783 | c->private_impl.height = height; | 5373 | 783 | return; | 5374 | 783 | } while (0); | 5375 | 783 | } | 5376 | | | 5377 | 0 | c->private_impl.pixfmt.repr = 0; | 5378 | 0 | c->private_impl.pixsub.repr = 0; | 5379 | 0 | c->private_impl.width = 0; | 5380 | 0 | c->private_impl.height = 0; | 5381 | 0 | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_config__set jpeg_fuzzer.c:wuffs_base__pixel_config__set Line | Count | Source | 5356 | 1.47k | uint32_t height) { | 5357 | 1.47k | if (!c) { | 5358 | 0 | return; | 5359 | 0 | } | 5360 | 1.47k | if (pixfmt_repr) { | 5361 | 1.47k | do { | 5362 | | #if SIZE_MAX < 0xFFFFFFFFFFFFFFFFull | 5363 | | uint64_t wh = ((uint64_t)width) * ((uint64_t)height); | 5364 | | // TODO: handle things other than 1 byte per pixel. | 5365 | | if (wh > ((uint64_t)SIZE_MAX)) { | 5366 | | break; | 5367 | | } | 5368 | | #endif | 5369 | 1.47k | c->private_impl.pixfmt.repr = pixfmt_repr; | 5370 | 1.47k | c->private_impl.pixsub.repr = pixsub_repr; | 5371 | 1.47k | c->private_impl.width = width; | 5372 | 1.47k | c->private_impl.height = height; | 5373 | 1.47k | return; | 5374 | 1.47k | } while (0); | 5375 | 1.47k | } | 5376 | | | 5377 | 0 | c->private_impl.pixfmt.repr = 0; | 5378 | 0 | c->private_impl.pixsub.repr = 0; | 5379 | 0 | c->private_impl.width = 0; | 5380 | 0 | c->private_impl.height = 0; | 5381 | 0 | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_config__set bmp_fuzzer.c:wuffs_base__pixel_config__set Line | Count | Source | 5356 | 1.37k | uint32_t height) { | 5357 | 1.37k | if (!c) { | 5358 | 0 | return; | 5359 | 0 | } | 5360 | 1.37k | if (pixfmt_repr) { | 5361 | 1.37k | do { | 5362 | | #if SIZE_MAX < 0xFFFFFFFFFFFFFFFFull | 5363 | | uint64_t wh = ((uint64_t)width) * ((uint64_t)height); | 5364 | | // TODO: handle things other than 1 byte per pixel. | 5365 | | if (wh > ((uint64_t)SIZE_MAX)) { | 5366 | | break; | 5367 | | } | 5368 | | #endif | 5369 | 1.37k | c->private_impl.pixfmt.repr = pixfmt_repr; | 5370 | 1.37k | c->private_impl.pixsub.repr = pixsub_repr; | 5371 | 1.37k | c->private_impl.width = width; | 5372 | 1.37k | c->private_impl.height = height; | 5373 | 1.37k | return; | 5374 | 1.37k | } while (0); | 5375 | 1.37k | } | 5376 | | | 5377 | 0 | c->private_impl.pixfmt.repr = 0; | 5378 | 0 | c->private_impl.pixsub.repr = 0; | 5379 | 0 | c->private_impl.width = 0; | 5380 | 0 | c->private_impl.height = 0; | 5381 | 0 | } |
pixel_swizzler_fuzzer.c:wuffs_base__pixel_config__set Line | Count | Source | 5356 | 3.29k | uint32_t height) { | 5357 | 3.29k | if (!c) { | 5358 | 0 | return; | 5359 | 0 | } | 5360 | 3.29k | if (pixfmt_repr) { | 5361 | 3.29k | do { | 5362 | | #if SIZE_MAX < 0xFFFFFFFFFFFFFFFFull | 5363 | | uint64_t wh = ((uint64_t)width) * ((uint64_t)height); | 5364 | | // TODO: handle things other than 1 byte per pixel. | 5365 | | if (wh > ((uint64_t)SIZE_MAX)) { | 5366 | | break; | 5367 | | } | 5368 | | #endif | 5369 | 3.29k | c->private_impl.pixfmt.repr = pixfmt_repr; | 5370 | 3.29k | c->private_impl.pixsub.repr = pixsub_repr; | 5371 | 3.29k | c->private_impl.width = width; | 5372 | 3.29k | c->private_impl.height = height; | 5373 | 3.29k | return; | 5374 | 3.29k | } while (0); | 5375 | 3.29k | } | 5376 | | | 5377 | 0 | c->private_impl.pixfmt.repr = 0; | 5378 | 0 | c->private_impl.pixsub.repr = 0; | 5379 | 0 | c->private_impl.width = 0; | 5380 | 0 | c->private_impl.height = 0; | 5381 | 0 | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_config__set targa_fuzzer.c:wuffs_base__pixel_config__set Line | Count | Source | 5356 | 516 | uint32_t height) { | 5357 | 516 | if (!c) { | 5358 | 0 | return; | 5359 | 0 | } | 5360 | 516 | if (pixfmt_repr) { | 5361 | 516 | do { | 5362 | | #if SIZE_MAX < 0xFFFFFFFFFFFFFFFFull | 5363 | | uint64_t wh = ((uint64_t)width) * ((uint64_t)height); | 5364 | | // TODO: handle things other than 1 byte per pixel. | 5365 | | if (wh > ((uint64_t)SIZE_MAX)) { | 5366 | | break; | 5367 | | } | 5368 | | #endif | 5369 | 516 | c->private_impl.pixfmt.repr = pixfmt_repr; | 5370 | 516 | c->private_impl.pixsub.repr = pixsub_repr; | 5371 | 516 | c->private_impl.width = width; | 5372 | 516 | c->private_impl.height = height; | 5373 | 516 | return; | 5374 | 516 | } while (0); | 5375 | 516 | } | 5376 | | | 5377 | 0 | c->private_impl.pixfmt.repr = 0; | 5378 | 0 | c->private_impl.pixsub.repr = 0; | 5379 | 0 | c->private_impl.width = 0; | 5380 | 0 | c->private_impl.height = 0; | 5381 | 0 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_config__set webp_fuzzer.c:wuffs_base__pixel_config__set Line | Count | Source | 5356 | 2.18k | uint32_t height) { | 5357 | 2.18k | if (!c) { | 5358 | 0 | return; | 5359 | 0 | } | 5360 | 2.18k | if (pixfmt_repr) { | 5361 | 2.18k | do { | 5362 | | #if SIZE_MAX < 0xFFFFFFFFFFFFFFFFull | 5363 | | uint64_t wh = ((uint64_t)width) * ((uint64_t)height); | 5364 | | // TODO: handle things other than 1 byte per pixel. | 5365 | | if (wh > ((uint64_t)SIZE_MAX)) { | 5366 | | break; | 5367 | | } | 5368 | | #endif | 5369 | 2.18k | c->private_impl.pixfmt.repr = pixfmt_repr; | 5370 | 2.18k | c->private_impl.pixsub.repr = pixsub_repr; | 5371 | 2.18k | c->private_impl.width = width; | 5372 | 2.18k | c->private_impl.height = height; | 5373 | 2.18k | return; | 5374 | 2.18k | } while (0); | 5375 | 2.18k | } | 5376 | | | 5377 | 0 | c->private_impl.pixfmt.repr = 0; | 5378 | 0 | c->private_impl.pixsub.repr = 0; | 5379 | 0 | c->private_impl.width = 0; | 5380 | 0 | c->private_impl.height = 0; | 5381 | 0 | } |
|
5382 | | |
5383 | | static inline void // |
5384 | 0 | wuffs_base__pixel_config__invalidate(wuffs_base__pixel_config* c) { |
5385 | 0 | if (c) { |
5386 | 0 | c->private_impl.pixfmt.repr = 0; |
5387 | 0 | c->private_impl.pixsub.repr = 0; |
5388 | 0 | c->private_impl.width = 0; |
5389 | 0 | c->private_impl.height = 0; |
5390 | 0 | } |
5391 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pixel_config__invalidate Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_config__invalidate(wuffs_base__pixel_config__struct*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_config__invalidate Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_config__invalidate Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_config__invalidate Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_config__invalidate Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pixel_config__invalidate Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_config__invalidate Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_config__invalidate Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pixel_config__invalidate Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_config__invalidate Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pixel_config__invalidate |
5392 | | |
5393 | | static inline bool // |
5394 | 15.8k | wuffs_base__pixel_config__is_valid(const wuffs_base__pixel_config* c) { |
5395 | 15.8k | return c && c->private_impl.pixfmt.repr; |
5396 | 15.8k | } png_fuzzer.c:wuffs_base__pixel_config__is_valid Line | Count | Source | 5394 | 4.31k | wuffs_base__pixel_config__is_valid(const wuffs_base__pixel_config* c) { | 5395 | 4.31k | return c && c->private_impl.pixfmt.repr; | 5396 | 4.31k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_config__is_valid(wuffs_base__pixel_config__struct const*) gif_fuzzer.c:wuffs_base__pixel_config__is_valid Line | Count | Source | 5394 | 1.64k | wuffs_base__pixel_config__is_valid(const wuffs_base__pixel_config* c) { | 5395 | 1.64k | return c && c->private_impl.pixfmt.repr; | 5396 | 1.64k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_config__is_valid jpeg_fuzzer.c:wuffs_base__pixel_config__is_valid Line | Count | Source | 5394 | 2.87k | wuffs_base__pixel_config__is_valid(const wuffs_base__pixel_config* c) { | 5395 | 2.87k | return c && c->private_impl.pixfmt.repr; | 5396 | 2.87k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_config__is_valid bmp_fuzzer.c:wuffs_base__pixel_config__is_valid Line | Count | Source | 5394 | 1.75k | wuffs_base__pixel_config__is_valid(const wuffs_base__pixel_config* c) { | 5395 | 1.75k | return c && c->private_impl.pixfmt.repr; | 5396 | 1.75k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_config__is_valid Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_config__is_valid targa_fuzzer.c:wuffs_base__pixel_config__is_valid Line | Count | Source | 5394 | 918 | wuffs_base__pixel_config__is_valid(const wuffs_base__pixel_config* c) { | 5395 | 918 | return c && c->private_impl.pixfmt.repr; | 5396 | 918 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_config__is_valid webp_fuzzer.c:wuffs_base__pixel_config__is_valid Line | Count | Source | 5394 | 4.30k | wuffs_base__pixel_config__is_valid(const wuffs_base__pixel_config* c) { | 5395 | 4.30k | return c && c->private_impl.pixfmt.repr; | 5396 | 4.30k | } |
|
5397 | | |
5398 | | static inline wuffs_base__pixel_format // |
5399 | 0 | wuffs_base__pixel_config__pixel_format(const wuffs_base__pixel_config* c) { |
5400 | 0 | return c ? c->private_impl.pixfmt : wuffs_base__make_pixel_format(0); |
5401 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pixel_config__pixel_format Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_config__pixel_format(wuffs_base__pixel_config__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_config__pixel_format Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_config__pixel_format Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_config__pixel_format Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_config__pixel_format Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pixel_config__pixel_format Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_config__pixel_format Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_config__pixel_format Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pixel_config__pixel_format Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_config__pixel_format Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pixel_config__pixel_format |
5402 | | |
5403 | | static inline wuffs_base__pixel_subsampling // |
5404 | 0 | wuffs_base__pixel_config__pixel_subsampling(const wuffs_base__pixel_config* c) { |
5405 | 0 | return c ? c->private_impl.pixsub : wuffs_base__make_pixel_subsampling(0); |
5406 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pixel_config__pixel_subsampling Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_config__pixel_subsampling(wuffs_base__pixel_config__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_config__pixel_subsampling Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_config__pixel_subsampling Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_config__pixel_subsampling Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_config__pixel_subsampling Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pixel_config__pixel_subsampling Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_config__pixel_subsampling Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_config__pixel_subsampling Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pixel_config__pixel_subsampling Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_config__pixel_subsampling Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pixel_config__pixel_subsampling |
5407 | | |
5408 | | static inline wuffs_base__rect_ie_u32 // |
5409 | 0 | wuffs_base__pixel_config__bounds(const wuffs_base__pixel_config* c) { |
5410 | 0 | if (c) { |
5411 | 0 | wuffs_base__rect_ie_u32 ret; |
5412 | 0 | ret.min_incl_x = 0; |
5413 | 0 | ret.min_incl_y = 0; |
5414 | 0 | ret.max_excl_x = c->private_impl.width; |
5415 | 0 | ret.max_excl_y = c->private_impl.height; |
5416 | 0 | return ret; |
5417 | 0 | } |
5418 | | |
5419 | 0 | wuffs_base__rect_ie_u32 ret; |
5420 | 0 | ret.min_incl_x = 0; |
5421 | 0 | ret.min_incl_y = 0; |
5422 | 0 | ret.max_excl_x = 0; |
5423 | 0 | ret.max_excl_y = 0; |
5424 | 0 | return ret; |
5425 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pixel_config__bounds Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_config__bounds(wuffs_base__pixel_config__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_config__bounds Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_config__bounds Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_config__bounds Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_config__bounds Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pixel_config__bounds Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_config__bounds Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_config__bounds Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pixel_config__bounds Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_config__bounds Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pixel_config__bounds |
5426 | | |
5427 | | static inline uint32_t // |
5428 | 13.1k | wuffs_base__pixel_config__width(const wuffs_base__pixel_config* c) { |
5429 | 13.1k | return c ? c->private_impl.width : 0; |
5430 | 13.1k | } png_fuzzer.c:wuffs_base__pixel_config__width Line | Count | Source | 5428 | 2.17k | wuffs_base__pixel_config__width(const wuffs_base__pixel_config* c) { | 5429 | 2.17k | return c ? c->private_impl.width : 0; | 5430 | 2.17k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_config__width(wuffs_base__pixel_config__struct const*) gif_fuzzer.c:wuffs_base__pixel_config__width Line | Count | Source | 5428 | 783 | wuffs_base__pixel_config__width(const wuffs_base__pixel_config* c) { | 5429 | 783 | return c ? c->private_impl.width : 0; | 5430 | 783 | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_config__width jpeg_fuzzer.c:wuffs_base__pixel_config__width Line | Count | Source | 5428 | 2.27k | wuffs_base__pixel_config__width(const wuffs_base__pixel_config* c) { | 5429 | 2.27k | return c ? c->private_impl.width : 0; | 5430 | 2.27k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_config__width bmp_fuzzer.c:wuffs_base__pixel_config__width Line | Count | Source | 5428 | 1.37k | wuffs_base__pixel_config__width(const wuffs_base__pixel_config* c) { | 5429 | 1.37k | return c ? c->private_impl.width : 0; | 5430 | 1.37k | } |
pixel_swizzler_fuzzer.c:wuffs_base__pixel_config__width Line | Count | Source | 5428 | 2.13k | wuffs_base__pixel_config__width(const wuffs_base__pixel_config* c) { | 5429 | 2.13k | return c ? c->private_impl.width : 0; | 5430 | 2.13k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_config__width targa_fuzzer.c:wuffs_base__pixel_config__width Line | Count | Source | 5428 | 516 | wuffs_base__pixel_config__width(const wuffs_base__pixel_config* c) { | 5429 | 516 | return c ? c->private_impl.width : 0; | 5430 | 516 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_config__width webp_fuzzer.c:wuffs_base__pixel_config__width Line | Count | Source | 5428 | 3.86k | wuffs_base__pixel_config__width(const wuffs_base__pixel_config* c) { | 5429 | 3.86k | return c ? c->private_impl.width : 0; | 5430 | 3.86k | } |
|
5431 | | |
5432 | | static inline uint32_t // |
5433 | 13.1k | wuffs_base__pixel_config__height(const wuffs_base__pixel_config* c) { |
5434 | 13.1k | return c ? c->private_impl.height : 0; |
5435 | 13.1k | } png_fuzzer.c:wuffs_base__pixel_config__height Line | Count | Source | 5433 | 2.17k | wuffs_base__pixel_config__height(const wuffs_base__pixel_config* c) { | 5434 | 2.17k | return c ? c->private_impl.height : 0; | 5435 | 2.17k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_config__height(wuffs_base__pixel_config__struct const*) gif_fuzzer.c:wuffs_base__pixel_config__height Line | Count | Source | 5433 | 783 | wuffs_base__pixel_config__height(const wuffs_base__pixel_config* c) { | 5434 | 783 | return c ? c->private_impl.height : 0; | 5435 | 783 | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_config__height jpeg_fuzzer.c:wuffs_base__pixel_config__height Line | Count | Source | 5433 | 2.27k | wuffs_base__pixel_config__height(const wuffs_base__pixel_config* c) { | 5434 | 2.27k | return c ? c->private_impl.height : 0; | 5435 | 2.27k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_config__height bmp_fuzzer.c:wuffs_base__pixel_config__height Line | Count | Source | 5433 | 1.37k | wuffs_base__pixel_config__height(const wuffs_base__pixel_config* c) { | 5434 | 1.37k | return c ? c->private_impl.height : 0; | 5435 | 1.37k | } |
pixel_swizzler_fuzzer.c:wuffs_base__pixel_config__height Line | Count | Source | 5433 | 2.13k | wuffs_base__pixel_config__height(const wuffs_base__pixel_config* c) { | 5434 | 2.13k | return c ? c->private_impl.height : 0; | 5435 | 2.13k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_config__height targa_fuzzer.c:wuffs_base__pixel_config__height Line | Count | Source | 5433 | 516 | wuffs_base__pixel_config__height(const wuffs_base__pixel_config* c) { | 5434 | 516 | return c ? c->private_impl.height : 0; | 5435 | 516 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_config__height webp_fuzzer.c:wuffs_base__pixel_config__height Line | Count | Source | 5433 | 3.86k | wuffs_base__pixel_config__height(const wuffs_base__pixel_config* c) { | 5434 | 3.86k | return c ? c->private_impl.height : 0; | 5435 | 3.86k | } |
|
5436 | | |
5437 | | // TODO: this is the right API for planar (not interleaved) pixbufs? Should it |
5438 | | // allow decoding into a color model different from the format's intrinsic one? |
5439 | | // For example, decoding a JPEG image straight to RGBA instead of to YCbCr? |
5440 | | static inline uint64_t // |
5441 | 19.0k | wuffs_base__pixel_config__pixbuf_len(const wuffs_base__pixel_config* c) { |
5442 | 19.0k | if (!c) { |
5443 | 0 | return 0; |
5444 | 0 | } |
5445 | 19.0k | if (wuffs_base__pixel_format__is_planar(&c->private_impl.pixfmt)) { |
5446 | | // TODO: support planar pixel formats, concious of pixel subsampling. |
5447 | 0 | return 0; |
5448 | 0 | } |
5449 | 19.0k | uint32_t bits_per_pixel = |
5450 | 19.0k | wuffs_base__pixel_format__bits_per_pixel(&c->private_impl.pixfmt); |
5451 | 19.0k | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { |
5452 | | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? |
5453 | 0 | return 0; |
5454 | 0 | } |
5455 | 19.0k | uint64_t bytes_per_pixel = bits_per_pixel / 8; |
5456 | | |
5457 | 19.0k | uint64_t n = |
5458 | 19.0k | ((uint64_t)c->private_impl.width) * ((uint64_t)c->private_impl.height); |
5459 | 19.0k | if (n > (UINT64_MAX / bytes_per_pixel)) { |
5460 | 0 | return 0; |
5461 | 0 | } |
5462 | 19.0k | n *= bytes_per_pixel; |
5463 | | |
5464 | 19.0k | if (wuffs_base__pixel_format__is_indexed(&c->private_impl.pixfmt)) { |
5465 | 1.18k | if (n > |
5466 | 1.18k | (UINT64_MAX - WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH)) { |
5467 | 0 | return 0; |
5468 | 0 | } |
5469 | 1.18k | n += WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; |
5470 | 1.18k | } |
5471 | | |
5472 | 19.0k | return n; |
5473 | 19.0k | } png_fuzzer.c:wuffs_base__pixel_config__pixbuf_len Line | Count | Source | 5441 | 4.30k | wuffs_base__pixel_config__pixbuf_len(const wuffs_base__pixel_config* c) { | 5442 | 4.30k | if (!c) { | 5443 | 0 | return 0; | 5444 | 0 | } | 5445 | 4.30k | if (wuffs_base__pixel_format__is_planar(&c->private_impl.pixfmt)) { | 5446 | | // TODO: support planar pixel formats, concious of pixel subsampling. | 5447 | 0 | return 0; | 5448 | 0 | } | 5449 | 4.30k | uint32_t bits_per_pixel = | 5450 | 4.30k | wuffs_base__pixel_format__bits_per_pixel(&c->private_impl.pixfmt); | 5451 | 4.30k | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { | 5452 | | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? | 5453 | 0 | return 0; | 5454 | 0 | } | 5455 | 4.30k | uint64_t bytes_per_pixel = bits_per_pixel / 8; | 5456 | | | 5457 | 4.30k | uint64_t n = | 5458 | 4.30k | ((uint64_t)c->private_impl.width) * ((uint64_t)c->private_impl.height); | 5459 | 4.30k | if (n > (UINT64_MAX / bytes_per_pixel)) { | 5460 | 0 | return 0; | 5461 | 0 | } | 5462 | 4.30k | n *= bytes_per_pixel; | 5463 | | | 5464 | 4.30k | if (wuffs_base__pixel_format__is_indexed(&c->private_impl.pixfmt)) { | 5465 | 69 | if (n > | 5466 | 69 | (UINT64_MAX - WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH)) { | 5467 | 0 | return 0; | 5468 | 0 | } | 5469 | 69 | n += WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 5470 | 69 | } | 5471 | | | 5472 | 4.30k | return n; | 5473 | 4.30k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_config__pixbuf_len(wuffs_base__pixel_config__struct const*) gif_fuzzer.c:wuffs_base__pixel_config__pixbuf_len Line | Count | Source | 5441 | 1.64k | wuffs_base__pixel_config__pixbuf_len(const wuffs_base__pixel_config* c) { | 5442 | 1.64k | if (!c) { | 5443 | 0 | return 0; | 5444 | 0 | } | 5445 | 1.64k | if (wuffs_base__pixel_format__is_planar(&c->private_impl.pixfmt)) { | 5446 | | // TODO: support planar pixel formats, concious of pixel subsampling. | 5447 | 0 | return 0; | 5448 | 0 | } | 5449 | 1.64k | uint32_t bits_per_pixel = | 5450 | 1.64k | wuffs_base__pixel_format__bits_per_pixel(&c->private_impl.pixfmt); | 5451 | 1.64k | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { | 5452 | | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? | 5453 | 0 | return 0; | 5454 | 0 | } | 5455 | 1.64k | uint64_t bytes_per_pixel = bits_per_pixel / 8; | 5456 | | | 5457 | 1.64k | uint64_t n = | 5458 | 1.64k | ((uint64_t)c->private_impl.width) * ((uint64_t)c->private_impl.height); | 5459 | 1.64k | if (n > (UINT64_MAX / bytes_per_pixel)) { | 5460 | 0 | return 0; | 5461 | 0 | } | 5462 | 1.64k | n *= bytes_per_pixel; | 5463 | | | 5464 | 1.64k | if (wuffs_base__pixel_format__is_indexed(&c->private_impl.pixfmt)) { | 5465 | 857 | if (n > | 5466 | 857 | (UINT64_MAX - WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH)) { | 5467 | 0 | return 0; | 5468 | 0 | } | 5469 | 857 | n += WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 5470 | 857 | } | 5471 | | | 5472 | 1.64k | return n; | 5473 | 1.64k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_config__pixbuf_len jpeg_fuzzer.c:wuffs_base__pixel_config__pixbuf_len Line | Count | Source | 5441 | 2.85k | wuffs_base__pixel_config__pixbuf_len(const wuffs_base__pixel_config* c) { | 5442 | 2.85k | if (!c) { | 5443 | 0 | return 0; | 5444 | 0 | } | 5445 | 2.85k | if (wuffs_base__pixel_format__is_planar(&c->private_impl.pixfmt)) { | 5446 | | // TODO: support planar pixel formats, concious of pixel subsampling. | 5447 | 0 | return 0; | 5448 | 0 | } | 5449 | 2.85k | uint32_t bits_per_pixel = | 5450 | 2.85k | wuffs_base__pixel_format__bits_per_pixel(&c->private_impl.pixfmt); | 5451 | 2.85k | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { | 5452 | | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? | 5453 | 0 | return 0; | 5454 | 0 | } | 5455 | 2.85k | uint64_t bytes_per_pixel = bits_per_pixel / 8; | 5456 | | | 5457 | 2.85k | uint64_t n = | 5458 | 2.85k | ((uint64_t)c->private_impl.width) * ((uint64_t)c->private_impl.height); | 5459 | 2.85k | if (n > (UINT64_MAX / bytes_per_pixel)) { | 5460 | 0 | return 0; | 5461 | 0 | } | 5462 | 2.85k | n *= bytes_per_pixel; | 5463 | | | 5464 | 2.85k | if (wuffs_base__pixel_format__is_indexed(&c->private_impl.pixfmt)) { | 5465 | 0 | if (n > | 5466 | 0 | (UINT64_MAX - WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH)) { | 5467 | 0 | return 0; | 5468 | 0 | } | 5469 | 0 | n += WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 5470 | 0 | } | 5471 | | | 5472 | 2.85k | return n; | 5473 | 2.85k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_config__pixbuf_len bmp_fuzzer.c:wuffs_base__pixel_config__pixbuf_len Line | Count | Source | 5441 | 1.75k | wuffs_base__pixel_config__pixbuf_len(const wuffs_base__pixel_config* c) { | 5442 | 1.75k | if (!c) { | 5443 | 0 | return 0; | 5444 | 0 | } | 5445 | 1.75k | if (wuffs_base__pixel_format__is_planar(&c->private_impl.pixfmt)) { | 5446 | | // TODO: support planar pixel formats, concious of pixel subsampling. | 5447 | 0 | return 0; | 5448 | 0 | } | 5449 | 1.75k | uint32_t bits_per_pixel = | 5450 | 1.75k | wuffs_base__pixel_format__bits_per_pixel(&c->private_impl.pixfmt); | 5451 | 1.75k | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { | 5452 | | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? | 5453 | 0 | return 0; | 5454 | 0 | } | 5455 | 1.75k | uint64_t bytes_per_pixel = bits_per_pixel / 8; | 5456 | | | 5457 | 1.75k | uint64_t n = | 5458 | 1.75k | ((uint64_t)c->private_impl.width) * ((uint64_t)c->private_impl.height); | 5459 | 1.75k | if (n > (UINT64_MAX / bytes_per_pixel)) { | 5460 | 0 | return 0; | 5461 | 0 | } | 5462 | 1.75k | n *= bytes_per_pixel; | 5463 | | | 5464 | 1.75k | if (wuffs_base__pixel_format__is_indexed(&c->private_impl.pixfmt)) { | 5465 | 0 | if (n > | 5466 | 0 | (UINT64_MAX - WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH)) { | 5467 | 0 | return 0; | 5468 | 0 | } | 5469 | 0 | n += WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 5470 | 0 | } | 5471 | | | 5472 | 1.75k | return n; | 5473 | 1.75k | } |
pixel_swizzler_fuzzer.c:wuffs_base__pixel_config__pixbuf_len Line | Count | Source | 5441 | 3.29k | wuffs_base__pixel_config__pixbuf_len(const wuffs_base__pixel_config* c) { | 5442 | 3.29k | if (!c) { | 5443 | 0 | return 0; | 5444 | 0 | } | 5445 | 3.29k | if (wuffs_base__pixel_format__is_planar(&c->private_impl.pixfmt)) { | 5446 | | // TODO: support planar pixel formats, concious of pixel subsampling. | 5447 | 0 | return 0; | 5448 | 0 | } | 5449 | 3.29k | uint32_t bits_per_pixel = | 5450 | 3.29k | wuffs_base__pixel_format__bits_per_pixel(&c->private_impl.pixfmt); | 5451 | 3.29k | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { | 5452 | | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? | 5453 | 0 | return 0; | 5454 | 0 | } | 5455 | 3.29k | uint64_t bytes_per_pixel = bits_per_pixel / 8; | 5456 | | | 5457 | 3.29k | uint64_t n = | 5458 | 3.29k | ((uint64_t)c->private_impl.width) * ((uint64_t)c->private_impl.height); | 5459 | 3.29k | if (n > (UINT64_MAX / bytes_per_pixel)) { | 5460 | 0 | return 0; | 5461 | 0 | } | 5462 | 3.29k | n *= bytes_per_pixel; | 5463 | | | 5464 | 3.29k | if (wuffs_base__pixel_format__is_indexed(&c->private_impl.pixfmt)) { | 5465 | 117 | if (n > | 5466 | 117 | (UINT64_MAX - WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH)) { | 5467 | 0 | return 0; | 5468 | 0 | } | 5469 | 117 | n += WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 5470 | 117 | } | 5471 | | | 5472 | 3.29k | return n; | 5473 | 3.29k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_config__pixbuf_len targa_fuzzer.c:wuffs_base__pixel_config__pixbuf_len Line | Count | Source | 5441 | 918 | wuffs_base__pixel_config__pixbuf_len(const wuffs_base__pixel_config* c) { | 5442 | 918 | if (!c) { | 5443 | 0 | return 0; | 5444 | 0 | } | 5445 | 918 | if (wuffs_base__pixel_format__is_planar(&c->private_impl.pixfmt)) { | 5446 | | // TODO: support planar pixel formats, concious of pixel subsampling. | 5447 | 0 | return 0; | 5448 | 0 | } | 5449 | 918 | uint32_t bits_per_pixel = | 5450 | 918 | wuffs_base__pixel_format__bits_per_pixel(&c->private_impl.pixfmt); | 5451 | 918 | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { | 5452 | | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? | 5453 | 0 | return 0; | 5454 | 0 | } | 5455 | 918 | uint64_t bytes_per_pixel = bits_per_pixel / 8; | 5456 | | | 5457 | 918 | uint64_t n = | 5458 | 918 | ((uint64_t)c->private_impl.width) * ((uint64_t)c->private_impl.height); | 5459 | 918 | if (n > (UINT64_MAX / bytes_per_pixel)) { | 5460 | 0 | return 0; | 5461 | 0 | } | 5462 | 918 | n *= bytes_per_pixel; | 5463 | | | 5464 | 918 | if (wuffs_base__pixel_format__is_indexed(&c->private_impl.pixfmt)) { | 5465 | 141 | if (n > | 5466 | 141 | (UINT64_MAX - WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH)) { | 5467 | 0 | return 0; | 5468 | 0 | } | 5469 | 141 | n += WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 5470 | 141 | } | 5471 | | | 5472 | 918 | return n; | 5473 | 918 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_config__pixbuf_len webp_fuzzer.c:wuffs_base__pixel_config__pixbuf_len Line | Count | Source | 5441 | 4.23k | wuffs_base__pixel_config__pixbuf_len(const wuffs_base__pixel_config* c) { | 5442 | 4.23k | if (!c) { | 5443 | 0 | return 0; | 5444 | 0 | } | 5445 | 4.23k | if (wuffs_base__pixel_format__is_planar(&c->private_impl.pixfmt)) { | 5446 | | // TODO: support planar pixel formats, concious of pixel subsampling. | 5447 | 0 | return 0; | 5448 | 0 | } | 5449 | 4.23k | uint32_t bits_per_pixel = | 5450 | 4.23k | wuffs_base__pixel_format__bits_per_pixel(&c->private_impl.pixfmt); | 5451 | 4.23k | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { | 5452 | | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? | 5453 | 0 | return 0; | 5454 | 0 | } | 5455 | 4.23k | uint64_t bytes_per_pixel = bits_per_pixel / 8; | 5456 | | | 5457 | 4.23k | uint64_t n = | 5458 | 4.23k | ((uint64_t)c->private_impl.width) * ((uint64_t)c->private_impl.height); | 5459 | 4.23k | if (n > (UINT64_MAX / bytes_per_pixel)) { | 5460 | 0 | return 0; | 5461 | 0 | } | 5462 | 4.23k | n *= bytes_per_pixel; | 5463 | | | 5464 | 4.23k | if (wuffs_base__pixel_format__is_indexed(&c->private_impl.pixfmt)) { | 5465 | 0 | if (n > | 5466 | 0 | (UINT64_MAX - WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH)) { | 5467 | 0 | return 0; | 5468 | 0 | } | 5469 | 0 | n += WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 5470 | 0 | } | 5471 | | | 5472 | 4.23k | return n; | 5473 | 4.23k | } |
|
5474 | | |
5475 | | #ifdef __cplusplus |
5476 | | |
5477 | | inline void // |
5478 | | wuffs_base__pixel_config::set(uint32_t pixfmt_repr, |
5479 | | uint32_t pixsub_repr, |
5480 | | uint32_t width, |
5481 | 0 | uint32_t height) { |
5482 | 0 | wuffs_base__pixel_config__set(this, pixfmt_repr, pixsub_repr, width, height); |
5483 | 0 | } |
5484 | | |
5485 | | inline void // |
5486 | 0 | wuffs_base__pixel_config::invalidate() { |
5487 | 0 | wuffs_base__pixel_config__invalidate(this); |
5488 | 0 | } |
5489 | | |
5490 | | inline bool // |
5491 | 0 | wuffs_base__pixel_config::is_valid() const { |
5492 | 0 | return wuffs_base__pixel_config__is_valid(this); |
5493 | 0 | } |
5494 | | |
5495 | | inline wuffs_base__pixel_format // |
5496 | 0 | wuffs_base__pixel_config::pixel_format() const { |
5497 | 0 | return wuffs_base__pixel_config__pixel_format(this); |
5498 | 0 | } |
5499 | | |
5500 | | inline wuffs_base__pixel_subsampling // |
5501 | 0 | wuffs_base__pixel_config::pixel_subsampling() const { |
5502 | 0 | return wuffs_base__pixel_config__pixel_subsampling(this); |
5503 | 0 | } |
5504 | | |
5505 | | inline wuffs_base__rect_ie_u32 // |
5506 | 0 | wuffs_base__pixel_config::bounds() const { |
5507 | 0 | return wuffs_base__pixel_config__bounds(this); |
5508 | 0 | } |
5509 | | |
5510 | | inline uint32_t // |
5511 | 0 | wuffs_base__pixel_config::width() const { |
5512 | 0 | return wuffs_base__pixel_config__width(this); |
5513 | 0 | } |
5514 | | |
5515 | | inline uint32_t // |
5516 | 0 | wuffs_base__pixel_config::height() const { |
5517 | 0 | return wuffs_base__pixel_config__height(this); |
5518 | 0 | } |
5519 | | |
5520 | | inline uint64_t // |
5521 | 0 | wuffs_base__pixel_config::pixbuf_len() const { |
5522 | 0 | return wuffs_base__pixel_config__pixbuf_len(this); |
5523 | 0 | } |
5524 | | |
5525 | | #endif // __cplusplus |
5526 | | |
5527 | | // -------- |
5528 | | |
5529 | | typedef struct wuffs_base__image_config__struct { |
5530 | | wuffs_base__pixel_config pixcfg; |
5531 | | |
5532 | | // Do not access the private_impl's fields directly. There is no API/ABI |
5533 | | // compatibility or safety guarantee if you do so. |
5534 | | struct { |
5535 | | uint64_t first_frame_io_position; |
5536 | | bool first_frame_is_opaque; |
5537 | | } private_impl; |
5538 | | |
5539 | | #ifdef __cplusplus |
5540 | | inline void set(uint32_t pixfmt_repr, |
5541 | | uint32_t pixsub_repr, |
5542 | | uint32_t width, |
5543 | | uint32_t height, |
5544 | | uint64_t first_frame_io_position, |
5545 | | bool first_frame_is_opaque); |
5546 | | inline void invalidate(); |
5547 | | inline bool is_valid() const; |
5548 | | inline uint64_t first_frame_io_position() const; |
5549 | | inline bool first_frame_is_opaque() const; |
5550 | | #endif // __cplusplus |
5551 | | |
5552 | | } wuffs_base__image_config; |
5553 | | |
5554 | | static inline wuffs_base__image_config // |
5555 | 0 | wuffs_base__null_image_config(void) { |
5556 | 0 | wuffs_base__image_config ret; |
5557 | 0 | ret.pixcfg = wuffs_base__null_pixel_config(); |
5558 | 0 | ret.private_impl.first_frame_io_position = 0; |
5559 | 0 | ret.private_impl.first_frame_is_opaque = false; |
5560 | 0 | return ret; |
5561 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__null_image_config Unexecuted instantiation: json_fuzzer.cc:wuffs_base__null_image_config() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__null_image_config Unexecuted instantiation: xz_fuzzer.c:wuffs_base__null_image_config Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__null_image_config Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__null_image_config Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__null_image_config Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__null_image_config Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__null_image_config Unexecuted instantiation: targa_fuzzer.c:wuffs_base__null_image_config Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__null_image_config Unexecuted instantiation: webp_fuzzer.c:wuffs_base__null_image_config |
5562 | | |
5563 | | // TODO: Should this function return bool? An error type? |
5564 | | static inline void // |
5565 | | wuffs_base__image_config__set(wuffs_base__image_config* c, |
5566 | | uint32_t pixfmt_repr, |
5567 | | uint32_t pixsub_repr, |
5568 | | uint32_t width, |
5569 | | uint32_t height, |
5570 | | uint64_t first_frame_io_position, |
5571 | 15.8k | bool first_frame_is_opaque) { |
5572 | 15.8k | if (!c) { |
5573 | 0 | return; |
5574 | 0 | } |
5575 | 15.8k | if (pixfmt_repr) { |
5576 | 15.8k | c->pixcfg.private_impl.pixfmt.repr = pixfmt_repr; |
5577 | 15.8k | c->pixcfg.private_impl.pixsub.repr = pixsub_repr; |
5578 | 15.8k | c->pixcfg.private_impl.width = width; |
5579 | 15.8k | c->pixcfg.private_impl.height = height; |
5580 | 15.8k | c->private_impl.first_frame_io_position = first_frame_io_position; |
5581 | 15.8k | c->private_impl.first_frame_is_opaque = first_frame_is_opaque; |
5582 | 15.8k | return; |
5583 | 15.8k | } |
5584 | | |
5585 | 0 | c->pixcfg.private_impl.pixfmt.repr = 0; |
5586 | 0 | c->pixcfg.private_impl.pixsub.repr = 0; |
5587 | 0 | c->pixcfg.private_impl.width = 0; |
5588 | 0 | c->pixcfg.private_impl.height = 0; |
5589 | 0 | c->private_impl.first_frame_io_position = 0; |
5590 | 0 | c->private_impl.first_frame_is_opaque = 0; |
5591 | 0 | } png_fuzzer.c:wuffs_base__image_config__set Line | Count | Source | 5571 | 4.31k | bool first_frame_is_opaque) { | 5572 | 4.31k | if (!c) { | 5573 | 0 | return; | 5574 | 0 | } | 5575 | 4.31k | if (pixfmt_repr) { | 5576 | 4.31k | c->pixcfg.private_impl.pixfmt.repr = pixfmt_repr; | 5577 | 4.31k | c->pixcfg.private_impl.pixsub.repr = pixsub_repr; | 5578 | 4.31k | c->pixcfg.private_impl.width = width; | 5579 | 4.31k | c->pixcfg.private_impl.height = height; | 5580 | 4.31k | c->private_impl.first_frame_io_position = first_frame_io_position; | 5581 | 4.31k | c->private_impl.first_frame_is_opaque = first_frame_is_opaque; | 5582 | 4.31k | return; | 5583 | 4.31k | } | 5584 | | | 5585 | 0 | c->pixcfg.private_impl.pixfmt.repr = 0; | 5586 | 0 | c->pixcfg.private_impl.pixsub.repr = 0; | 5587 | 0 | c->pixcfg.private_impl.width = 0; | 5588 | 0 | c->pixcfg.private_impl.height = 0; | 5589 | 0 | c->private_impl.first_frame_io_position = 0; | 5590 | 0 | c->private_impl.first_frame_is_opaque = 0; | 5591 | 0 | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__image_config__set(wuffs_base__image_config__struct*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, bool) gif_fuzzer.c:wuffs_base__image_config__set Line | Count | Source | 5571 | 1.64k | bool first_frame_is_opaque) { | 5572 | 1.64k | if (!c) { | 5573 | 0 | return; | 5574 | 0 | } | 5575 | 1.64k | if (pixfmt_repr) { | 5576 | 1.64k | c->pixcfg.private_impl.pixfmt.repr = pixfmt_repr; | 5577 | 1.64k | c->pixcfg.private_impl.pixsub.repr = pixsub_repr; | 5578 | 1.64k | c->pixcfg.private_impl.width = width; | 5579 | 1.64k | c->pixcfg.private_impl.height = height; | 5580 | 1.64k | c->private_impl.first_frame_io_position = first_frame_io_position; | 5581 | 1.64k | c->private_impl.first_frame_is_opaque = first_frame_is_opaque; | 5582 | 1.64k | return; | 5583 | 1.64k | } | 5584 | | | 5585 | 0 | c->pixcfg.private_impl.pixfmt.repr = 0; | 5586 | 0 | c->pixcfg.private_impl.pixsub.repr = 0; | 5587 | 0 | c->pixcfg.private_impl.width = 0; | 5588 | 0 | c->pixcfg.private_impl.height = 0; | 5589 | 0 | c->private_impl.first_frame_io_position = 0; | 5590 | 0 | c->private_impl.first_frame_is_opaque = 0; | 5591 | 0 | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__image_config__set jpeg_fuzzer.c:wuffs_base__image_config__set Line | Count | Source | 5571 | 2.87k | bool first_frame_is_opaque) { | 5572 | 2.87k | if (!c) { | 5573 | 0 | return; | 5574 | 0 | } | 5575 | 2.87k | if (pixfmt_repr) { | 5576 | 2.87k | c->pixcfg.private_impl.pixfmt.repr = pixfmt_repr; | 5577 | 2.87k | c->pixcfg.private_impl.pixsub.repr = pixsub_repr; | 5578 | 2.87k | c->pixcfg.private_impl.width = width; | 5579 | 2.87k | c->pixcfg.private_impl.height = height; | 5580 | 2.87k | c->private_impl.first_frame_io_position = first_frame_io_position; | 5581 | 2.87k | c->private_impl.first_frame_is_opaque = first_frame_is_opaque; | 5582 | 2.87k | return; | 5583 | 2.87k | } | 5584 | | | 5585 | 0 | c->pixcfg.private_impl.pixfmt.repr = 0; | 5586 | 0 | c->pixcfg.private_impl.pixsub.repr = 0; | 5587 | 0 | c->pixcfg.private_impl.width = 0; | 5588 | 0 | c->pixcfg.private_impl.height = 0; | 5589 | 0 | c->private_impl.first_frame_io_position = 0; | 5590 | 0 | c->private_impl.first_frame_is_opaque = 0; | 5591 | 0 | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__image_config__set bmp_fuzzer.c:wuffs_base__image_config__set Line | Count | Source | 5571 | 1.75k | bool first_frame_is_opaque) { | 5572 | 1.75k | if (!c) { | 5573 | 0 | return; | 5574 | 0 | } | 5575 | 1.75k | if (pixfmt_repr) { | 5576 | 1.75k | c->pixcfg.private_impl.pixfmt.repr = pixfmt_repr; | 5577 | 1.75k | c->pixcfg.private_impl.pixsub.repr = pixsub_repr; | 5578 | 1.75k | c->pixcfg.private_impl.width = width; | 5579 | 1.75k | c->pixcfg.private_impl.height = height; | 5580 | 1.75k | c->private_impl.first_frame_io_position = first_frame_io_position; | 5581 | 1.75k | c->private_impl.first_frame_is_opaque = first_frame_is_opaque; | 5582 | 1.75k | return; | 5583 | 1.75k | } | 5584 | | | 5585 | 0 | c->pixcfg.private_impl.pixfmt.repr = 0; | 5586 | 0 | c->pixcfg.private_impl.pixsub.repr = 0; | 5587 | 0 | c->pixcfg.private_impl.width = 0; | 5588 | 0 | c->pixcfg.private_impl.height = 0; | 5589 | 0 | c->private_impl.first_frame_io_position = 0; | 5590 | 0 | c->private_impl.first_frame_is_opaque = 0; | 5591 | 0 | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__image_config__set Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__image_config__set targa_fuzzer.c:wuffs_base__image_config__set Line | Count | Source | 5571 | 918 | bool first_frame_is_opaque) { | 5572 | 918 | if (!c) { | 5573 | 0 | return; | 5574 | 0 | } | 5575 | 918 | if (pixfmt_repr) { | 5576 | 918 | c->pixcfg.private_impl.pixfmt.repr = pixfmt_repr; | 5577 | 918 | c->pixcfg.private_impl.pixsub.repr = pixsub_repr; | 5578 | 918 | c->pixcfg.private_impl.width = width; | 5579 | 918 | c->pixcfg.private_impl.height = height; | 5580 | 918 | c->private_impl.first_frame_io_position = first_frame_io_position; | 5581 | 918 | c->private_impl.first_frame_is_opaque = first_frame_is_opaque; | 5582 | 918 | return; | 5583 | 918 | } | 5584 | | | 5585 | 0 | c->pixcfg.private_impl.pixfmt.repr = 0; | 5586 | 0 | c->pixcfg.private_impl.pixsub.repr = 0; | 5587 | 0 | c->pixcfg.private_impl.width = 0; | 5588 | 0 | c->pixcfg.private_impl.height = 0; | 5589 | 0 | c->private_impl.first_frame_io_position = 0; | 5590 | 0 | c->private_impl.first_frame_is_opaque = 0; | 5591 | 0 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__image_config__set webp_fuzzer.c:wuffs_base__image_config__set Line | Count | Source | 5571 | 4.30k | bool first_frame_is_opaque) { | 5572 | 4.30k | if (!c) { | 5573 | 0 | return; | 5574 | 0 | } | 5575 | 4.30k | if (pixfmt_repr) { | 5576 | 4.30k | c->pixcfg.private_impl.pixfmt.repr = pixfmt_repr; | 5577 | 4.30k | c->pixcfg.private_impl.pixsub.repr = pixsub_repr; | 5578 | 4.30k | c->pixcfg.private_impl.width = width; | 5579 | 4.30k | c->pixcfg.private_impl.height = height; | 5580 | 4.30k | c->private_impl.first_frame_io_position = first_frame_io_position; | 5581 | 4.30k | c->private_impl.first_frame_is_opaque = first_frame_is_opaque; | 5582 | 4.30k | return; | 5583 | 4.30k | } | 5584 | | | 5585 | 0 | c->pixcfg.private_impl.pixfmt.repr = 0; | 5586 | 0 | c->pixcfg.private_impl.pixsub.repr = 0; | 5587 | 0 | c->pixcfg.private_impl.width = 0; | 5588 | 0 | c->pixcfg.private_impl.height = 0; | 5589 | 0 | c->private_impl.first_frame_io_position = 0; | 5590 | 0 | c->private_impl.first_frame_is_opaque = 0; | 5591 | 0 | } |
|
5592 | | |
5593 | | static inline void // |
5594 | 0 | wuffs_base__image_config__invalidate(wuffs_base__image_config* c) { |
5595 | 0 | if (c) { |
5596 | 0 | c->pixcfg.private_impl.pixfmt.repr = 0; |
5597 | 0 | c->pixcfg.private_impl.pixsub.repr = 0; |
5598 | 0 | c->pixcfg.private_impl.width = 0; |
5599 | 0 | c->pixcfg.private_impl.height = 0; |
5600 | 0 | c->private_impl.first_frame_io_position = 0; |
5601 | 0 | c->private_impl.first_frame_is_opaque = 0; |
5602 | 0 | } |
5603 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__image_config__invalidate Unexecuted instantiation: json_fuzzer.cc:wuffs_base__image_config__invalidate(wuffs_base__image_config__struct*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__image_config__invalidate Unexecuted instantiation: xz_fuzzer.c:wuffs_base__image_config__invalidate Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__image_config__invalidate Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__image_config__invalidate Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__image_config__invalidate Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__image_config__invalidate Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__image_config__invalidate Unexecuted instantiation: targa_fuzzer.c:wuffs_base__image_config__invalidate Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__image_config__invalidate Unexecuted instantiation: webp_fuzzer.c:wuffs_base__image_config__invalidate |
5604 | | |
5605 | | static inline bool // |
5606 | 15.8k | wuffs_base__image_config__is_valid(const wuffs_base__image_config* c) { |
5607 | 15.8k | return c && wuffs_base__pixel_config__is_valid(&(c->pixcfg)); |
5608 | 15.8k | } png_fuzzer.c:wuffs_base__image_config__is_valid Line | Count | Source | 5606 | 4.31k | wuffs_base__image_config__is_valid(const wuffs_base__image_config* c) { | 5607 | 4.31k | return c && wuffs_base__pixel_config__is_valid(&(c->pixcfg)); | 5608 | 4.31k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__image_config__is_valid(wuffs_base__image_config__struct const*) gif_fuzzer.c:wuffs_base__image_config__is_valid Line | Count | Source | 5606 | 1.64k | wuffs_base__image_config__is_valid(const wuffs_base__image_config* c) { | 5607 | 1.64k | return c && wuffs_base__pixel_config__is_valid(&(c->pixcfg)); | 5608 | 1.64k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__image_config__is_valid jpeg_fuzzer.c:wuffs_base__image_config__is_valid Line | Count | Source | 5606 | 2.87k | wuffs_base__image_config__is_valid(const wuffs_base__image_config* c) { | 5607 | 2.87k | return c && wuffs_base__pixel_config__is_valid(&(c->pixcfg)); | 5608 | 2.87k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__image_config__is_valid bmp_fuzzer.c:wuffs_base__image_config__is_valid Line | Count | Source | 5606 | 1.75k | wuffs_base__image_config__is_valid(const wuffs_base__image_config* c) { | 5607 | 1.75k | return c && wuffs_base__pixel_config__is_valid(&(c->pixcfg)); | 5608 | 1.75k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__image_config__is_valid Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__image_config__is_valid targa_fuzzer.c:wuffs_base__image_config__is_valid Line | Count | Source | 5606 | 918 | wuffs_base__image_config__is_valid(const wuffs_base__image_config* c) { | 5607 | 918 | return c && wuffs_base__pixel_config__is_valid(&(c->pixcfg)); | 5608 | 918 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__image_config__is_valid webp_fuzzer.c:wuffs_base__image_config__is_valid Line | Count | Source | 5606 | 4.30k | wuffs_base__image_config__is_valid(const wuffs_base__image_config* c) { | 5607 | 4.30k | return c && wuffs_base__pixel_config__is_valid(&(c->pixcfg)); | 5608 | 4.30k | } |
|
5609 | | |
5610 | | static inline uint64_t // |
5611 | | wuffs_base__image_config__first_frame_io_position( |
5612 | 0 | const wuffs_base__image_config* c) { |
5613 | 0 | return c ? c->private_impl.first_frame_io_position : 0; |
5614 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__image_config__first_frame_io_position Unexecuted instantiation: json_fuzzer.cc:wuffs_base__image_config__first_frame_io_position(wuffs_base__image_config__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__image_config__first_frame_io_position Unexecuted instantiation: xz_fuzzer.c:wuffs_base__image_config__first_frame_io_position Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__image_config__first_frame_io_position Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__image_config__first_frame_io_position Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__image_config__first_frame_io_position Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__image_config__first_frame_io_position Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__image_config__first_frame_io_position Unexecuted instantiation: targa_fuzzer.c:wuffs_base__image_config__first_frame_io_position Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__image_config__first_frame_io_position Unexecuted instantiation: webp_fuzzer.c:wuffs_base__image_config__first_frame_io_position |
5615 | | |
5616 | | static inline bool // |
5617 | | wuffs_base__image_config__first_frame_is_opaque( |
5618 | 0 | const wuffs_base__image_config* c) { |
5619 | 0 | return c ? c->private_impl.first_frame_is_opaque : false; |
5620 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__image_config__first_frame_is_opaque Unexecuted instantiation: json_fuzzer.cc:wuffs_base__image_config__first_frame_is_opaque(wuffs_base__image_config__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__image_config__first_frame_is_opaque Unexecuted instantiation: xz_fuzzer.c:wuffs_base__image_config__first_frame_is_opaque Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__image_config__first_frame_is_opaque Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__image_config__first_frame_is_opaque Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__image_config__first_frame_is_opaque Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__image_config__first_frame_is_opaque Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__image_config__first_frame_is_opaque Unexecuted instantiation: targa_fuzzer.c:wuffs_base__image_config__first_frame_is_opaque Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__image_config__first_frame_is_opaque Unexecuted instantiation: webp_fuzzer.c:wuffs_base__image_config__first_frame_is_opaque |
5621 | | |
5622 | | #ifdef __cplusplus |
5623 | | |
5624 | | inline void // |
5625 | | wuffs_base__image_config::set(uint32_t pixfmt_repr, |
5626 | | uint32_t pixsub_repr, |
5627 | | uint32_t width, |
5628 | | uint32_t height, |
5629 | | uint64_t first_frame_io_position, |
5630 | 0 | bool first_frame_is_opaque) { |
5631 | 0 | wuffs_base__image_config__set(this, pixfmt_repr, pixsub_repr, width, height, |
5632 | 0 | first_frame_io_position, first_frame_is_opaque); |
5633 | 0 | } |
5634 | | |
5635 | | inline void // |
5636 | 0 | wuffs_base__image_config::invalidate() { |
5637 | 0 | wuffs_base__image_config__invalidate(this); |
5638 | 0 | } |
5639 | | |
5640 | | inline bool // |
5641 | 0 | wuffs_base__image_config::is_valid() const { |
5642 | 0 | return wuffs_base__image_config__is_valid(this); |
5643 | 0 | } |
5644 | | |
5645 | | inline uint64_t // |
5646 | 0 | wuffs_base__image_config::first_frame_io_position() const { |
5647 | 0 | return wuffs_base__image_config__first_frame_io_position(this); |
5648 | 0 | } |
5649 | | |
5650 | | inline bool // |
5651 | 0 | wuffs_base__image_config::first_frame_is_opaque() const { |
5652 | 0 | return wuffs_base__image_config__first_frame_is_opaque(this); |
5653 | 0 | } |
5654 | | |
5655 | | #endif // __cplusplus |
5656 | | |
5657 | | // -------- |
5658 | | |
5659 | | // wuffs_base__animation_disposal encodes, for an animated image, how to |
5660 | | // dispose of a frame after displaying it: |
5661 | | // - None means to draw the next frame on top of this one. |
5662 | | // - Restore Background means to clear the frame's dirty rectangle to "the |
5663 | | // background color" (in practice, this means transparent black) before |
5664 | | // drawing the next frame. |
5665 | | // - Restore Previous means to undo the current frame, so that the next frame |
5666 | | // is drawn on top of the previous one. |
5667 | | typedef uint8_t wuffs_base__animation_disposal; |
5668 | | |
5669 | | #define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0) |
5670 | | #define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \ |
5671 | | ((wuffs_base__animation_disposal)1) |
5672 | | #define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \ |
5673 | | ((wuffs_base__animation_disposal)2) |
5674 | | |
5675 | | // -------- |
5676 | | |
5677 | | typedef struct wuffs_base__frame_config__struct { |
5678 | | // Do not access the private_impl's fields directly. There is no API/ABI |
5679 | | // compatibility or safety guarantee if you do so. |
5680 | | struct { |
5681 | | wuffs_base__rect_ie_u32 bounds; |
5682 | | wuffs_base__flicks duration; |
5683 | | uint64_t index; |
5684 | | uint64_t io_position; |
5685 | | wuffs_base__animation_disposal disposal; |
5686 | | bool opaque_within_bounds; |
5687 | | bool overwrite_instead_of_blend; |
5688 | | wuffs_base__color_u32_argb_premul background_color; |
5689 | | } private_impl; |
5690 | | |
5691 | | #ifdef __cplusplus |
5692 | | inline void set(wuffs_base__rect_ie_u32 bounds, |
5693 | | wuffs_base__flicks duration, |
5694 | | uint64_t index, |
5695 | | uint64_t io_position, |
5696 | | wuffs_base__animation_disposal disposal, |
5697 | | bool opaque_within_bounds, |
5698 | | bool overwrite_instead_of_blend, |
5699 | | wuffs_base__color_u32_argb_premul background_color); |
5700 | | inline wuffs_base__rect_ie_u32 bounds() const; |
5701 | | inline uint32_t width() const; |
5702 | | inline uint32_t height() const; |
5703 | | inline wuffs_base__flicks duration() const; |
5704 | | inline uint64_t index() const; |
5705 | | inline uint64_t io_position() const; |
5706 | | inline wuffs_base__animation_disposal disposal() const; |
5707 | | inline bool opaque_within_bounds() const; |
5708 | | inline bool overwrite_instead_of_blend() const; |
5709 | | inline wuffs_base__color_u32_argb_premul background_color() const; |
5710 | | #endif // __cplusplus |
5711 | | |
5712 | | } wuffs_base__frame_config; |
5713 | | |
5714 | | static inline wuffs_base__frame_config // |
5715 | 0 | wuffs_base__null_frame_config(void) { |
5716 | 0 | wuffs_base__frame_config ret; |
5717 | 0 | ret.private_impl.bounds = wuffs_base__make_rect_ie_u32(0, 0, 0, 0); |
5718 | 0 | ret.private_impl.duration = 0; |
5719 | 0 | ret.private_impl.index = 0; |
5720 | 0 | ret.private_impl.io_position = 0; |
5721 | 0 | ret.private_impl.disposal = 0; |
5722 | 0 | ret.private_impl.opaque_within_bounds = false; |
5723 | 0 | ret.private_impl.overwrite_instead_of_blend = false; |
5724 | 0 | return ret; |
5725 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__null_frame_config Unexecuted instantiation: json_fuzzer.cc:wuffs_base__null_frame_config() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__null_frame_config Unexecuted instantiation: xz_fuzzer.c:wuffs_base__null_frame_config Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__null_frame_config Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__null_frame_config Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__null_frame_config Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__null_frame_config Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__null_frame_config Unexecuted instantiation: targa_fuzzer.c:wuffs_base__null_frame_config Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__null_frame_config Unexecuted instantiation: webp_fuzzer.c:wuffs_base__null_frame_config |
5726 | | |
5727 | | static inline void // |
5728 | | wuffs_base__frame_config__set( |
5729 | | wuffs_base__frame_config* c, |
5730 | | wuffs_base__rect_ie_u32 bounds, |
5731 | | wuffs_base__flicks duration, |
5732 | | uint64_t index, |
5733 | | uint64_t io_position, |
5734 | | wuffs_base__animation_disposal disposal, |
5735 | | bool opaque_within_bounds, |
5736 | | bool overwrite_instead_of_blend, |
5737 | 275k | wuffs_base__color_u32_argb_premul background_color) { |
5738 | 275k | if (!c) { |
5739 | 0 | return; |
5740 | 0 | } |
5741 | | |
5742 | 275k | c->private_impl.bounds = bounds; |
5743 | 275k | c->private_impl.duration = duration; |
5744 | 275k | c->private_impl.index = index; |
5745 | 275k | c->private_impl.io_position = io_position; |
5746 | 275k | c->private_impl.disposal = disposal; |
5747 | 275k | c->private_impl.opaque_within_bounds = opaque_within_bounds; |
5748 | 275k | c->private_impl.overwrite_instead_of_blend = overwrite_instead_of_blend; |
5749 | 275k | c->private_impl.background_color = background_color; |
5750 | 275k | } png_fuzzer.c:wuffs_base__frame_config__set Line | Count | Source | 5737 | 6.49k | wuffs_base__color_u32_argb_premul background_color) { | 5738 | 6.49k | if (!c) { | 5739 | 0 | return; | 5740 | 0 | } | 5741 | | | 5742 | 6.49k | c->private_impl.bounds = bounds; | 5743 | 6.49k | c->private_impl.duration = duration; | 5744 | 6.49k | c->private_impl.index = index; | 5745 | 6.49k | c->private_impl.io_position = io_position; | 5746 | 6.49k | c->private_impl.disposal = disposal; | 5747 | 6.49k | c->private_impl.opaque_within_bounds = opaque_within_bounds; | 5748 | 6.49k | c->private_impl.overwrite_instead_of_blend = overwrite_instead_of_blend; | 5749 | 6.49k | c->private_impl.background_color = background_color; | 5750 | 6.49k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__frame_config__set(wuffs_base__frame_config__struct*, wuffs_base__rect_ie_u32__struct, long, unsigned long, unsigned long, unsigned char, bool, bool, unsigned int) gif_fuzzer.c:wuffs_base__frame_config__set Line | Count | Source | 5737 | 259k | wuffs_base__color_u32_argb_premul background_color) { | 5738 | 259k | if (!c) { | 5739 | 0 | return; | 5740 | 0 | } | 5741 | | | 5742 | 259k | c->private_impl.bounds = bounds; | 5743 | 259k | c->private_impl.duration = duration; | 5744 | 259k | c->private_impl.index = index; | 5745 | 259k | c->private_impl.io_position = io_position; | 5746 | 259k | c->private_impl.disposal = disposal; | 5747 | 259k | c->private_impl.opaque_within_bounds = opaque_within_bounds; | 5748 | 259k | c->private_impl.overwrite_instead_of_blend = overwrite_instead_of_blend; | 5749 | 259k | c->private_impl.background_color = background_color; | 5750 | 259k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__frame_config__set jpeg_fuzzer.c:wuffs_base__frame_config__set Line | Count | Source | 5737 | 2.85k | wuffs_base__color_u32_argb_premul background_color) { | 5738 | 2.85k | if (!c) { | 5739 | 0 | return; | 5740 | 0 | } | 5741 | | | 5742 | 2.85k | c->private_impl.bounds = bounds; | 5743 | 2.85k | c->private_impl.duration = duration; | 5744 | 2.85k | c->private_impl.index = index; | 5745 | 2.85k | c->private_impl.io_position = io_position; | 5746 | 2.85k | c->private_impl.disposal = disposal; | 5747 | 2.85k | c->private_impl.opaque_within_bounds = opaque_within_bounds; | 5748 | 2.85k | c->private_impl.overwrite_instead_of_blend = overwrite_instead_of_blend; | 5749 | 2.85k | c->private_impl.background_color = background_color; | 5750 | 2.85k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__frame_config__set bmp_fuzzer.c:wuffs_base__frame_config__set Line | Count | Source | 5737 | 1.72k | wuffs_base__color_u32_argb_premul background_color) { | 5738 | 1.72k | if (!c) { | 5739 | 0 | return; | 5740 | 0 | } | 5741 | | | 5742 | 1.72k | c->private_impl.bounds = bounds; | 5743 | 1.72k | c->private_impl.duration = duration; | 5744 | 1.72k | c->private_impl.index = index; | 5745 | 1.72k | c->private_impl.io_position = io_position; | 5746 | 1.72k | c->private_impl.disposal = disposal; | 5747 | 1.72k | c->private_impl.opaque_within_bounds = opaque_within_bounds; | 5748 | 1.72k | c->private_impl.overwrite_instead_of_blend = overwrite_instead_of_blend; | 5749 | 1.72k | c->private_impl.background_color = background_color; | 5750 | 1.72k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__frame_config__set Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__frame_config__set targa_fuzzer.c:wuffs_base__frame_config__set Line | Count | Source | 5737 | 893 | wuffs_base__color_u32_argb_premul background_color) { | 5738 | 893 | if (!c) { | 5739 | 0 | return; | 5740 | 0 | } | 5741 | | | 5742 | 893 | c->private_impl.bounds = bounds; | 5743 | 893 | c->private_impl.duration = duration; | 5744 | 893 | c->private_impl.index = index; | 5745 | 893 | c->private_impl.io_position = io_position; | 5746 | 893 | c->private_impl.disposal = disposal; | 5747 | 893 | c->private_impl.opaque_within_bounds = opaque_within_bounds; | 5748 | 893 | c->private_impl.overwrite_instead_of_blend = overwrite_instead_of_blend; | 5749 | 893 | c->private_impl.background_color = background_color; | 5750 | 893 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__frame_config__set webp_fuzzer.c:wuffs_base__frame_config__set Line | Count | Source | 5737 | 4.23k | wuffs_base__color_u32_argb_premul background_color) { | 5738 | 4.23k | if (!c) { | 5739 | 0 | return; | 5740 | 0 | } | 5741 | | | 5742 | 4.23k | c->private_impl.bounds = bounds; | 5743 | 4.23k | c->private_impl.duration = duration; | 5744 | 4.23k | c->private_impl.index = index; | 5745 | 4.23k | c->private_impl.io_position = io_position; | 5746 | 4.23k | c->private_impl.disposal = disposal; | 5747 | 4.23k | c->private_impl.opaque_within_bounds = opaque_within_bounds; | 5748 | 4.23k | c->private_impl.overwrite_instead_of_blend = overwrite_instead_of_blend; | 5749 | 4.23k | c->private_impl.background_color = background_color; | 5750 | 4.23k | } |
|
5751 | | |
5752 | | static inline wuffs_base__rect_ie_u32 // |
5753 | 275k | wuffs_base__frame_config__bounds(const wuffs_base__frame_config* c) { |
5754 | 275k | if (c) { |
5755 | 275k | return c->private_impl.bounds; |
5756 | 275k | } |
5757 | | |
5758 | 0 | wuffs_base__rect_ie_u32 ret; |
5759 | 0 | ret.min_incl_x = 0; |
5760 | 0 | ret.min_incl_y = 0; |
5761 | 0 | ret.max_excl_x = 0; |
5762 | 0 | ret.max_excl_y = 0; |
5763 | 0 | return ret; |
5764 | 275k | } png_fuzzer.c:wuffs_base__frame_config__bounds Line | Count | Source | 5753 | 6.49k | wuffs_base__frame_config__bounds(const wuffs_base__frame_config* c) { | 5754 | 6.49k | if (c) { | 5755 | 6.49k | return c->private_impl.bounds; | 5756 | 6.49k | } | 5757 | | | 5758 | 0 | wuffs_base__rect_ie_u32 ret; | 5759 | 0 | ret.min_incl_x = 0; | 5760 | 0 | ret.min_incl_y = 0; | 5761 | 0 | ret.max_excl_x = 0; | 5762 | 0 | ret.max_excl_y = 0; | 5763 | 0 | return ret; | 5764 | 6.49k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__frame_config__bounds(wuffs_base__frame_config__struct const*) gif_fuzzer.c:wuffs_base__frame_config__bounds Line | Count | Source | 5753 | 259k | wuffs_base__frame_config__bounds(const wuffs_base__frame_config* c) { | 5754 | 259k | if (c) { | 5755 | 259k | return c->private_impl.bounds; | 5756 | 259k | } | 5757 | | | 5758 | 0 | wuffs_base__rect_ie_u32 ret; | 5759 | 0 | ret.min_incl_x = 0; | 5760 | 0 | ret.min_incl_y = 0; | 5761 | 0 | ret.max_excl_x = 0; | 5762 | 0 | ret.max_excl_y = 0; | 5763 | 0 | return ret; | 5764 | 259k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__frame_config__bounds jpeg_fuzzer.c:wuffs_base__frame_config__bounds Line | Count | Source | 5753 | 2.85k | wuffs_base__frame_config__bounds(const wuffs_base__frame_config* c) { | 5754 | 2.85k | if (c) { | 5755 | 2.85k | return c->private_impl.bounds; | 5756 | 2.85k | } | 5757 | | | 5758 | 0 | wuffs_base__rect_ie_u32 ret; | 5759 | 0 | ret.min_incl_x = 0; | 5760 | 0 | ret.min_incl_y = 0; | 5761 | 0 | ret.max_excl_x = 0; | 5762 | 0 | ret.max_excl_y = 0; | 5763 | 0 | return ret; | 5764 | 2.85k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__frame_config__bounds bmp_fuzzer.c:wuffs_base__frame_config__bounds Line | Count | Source | 5753 | 1.72k | wuffs_base__frame_config__bounds(const wuffs_base__frame_config* c) { | 5754 | 1.72k | if (c) { | 5755 | 1.72k | return c->private_impl.bounds; | 5756 | 1.72k | } | 5757 | | | 5758 | 0 | wuffs_base__rect_ie_u32 ret; | 5759 | 0 | ret.min_incl_x = 0; | 5760 | 0 | ret.min_incl_y = 0; | 5761 | 0 | ret.max_excl_x = 0; | 5762 | 0 | ret.max_excl_y = 0; | 5763 | 0 | return ret; | 5764 | 1.72k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__frame_config__bounds Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__frame_config__bounds targa_fuzzer.c:wuffs_base__frame_config__bounds Line | Count | Source | 5753 | 893 | wuffs_base__frame_config__bounds(const wuffs_base__frame_config* c) { | 5754 | 893 | if (c) { | 5755 | 893 | return c->private_impl.bounds; | 5756 | 893 | } | 5757 | | | 5758 | 0 | wuffs_base__rect_ie_u32 ret; | 5759 | 0 | ret.min_incl_x = 0; | 5760 | 0 | ret.min_incl_y = 0; | 5761 | 0 | ret.max_excl_x = 0; | 5762 | 0 | ret.max_excl_y = 0; | 5763 | 0 | return ret; | 5764 | 893 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__frame_config__bounds webp_fuzzer.c:wuffs_base__frame_config__bounds Line | Count | Source | 5753 | 4.23k | wuffs_base__frame_config__bounds(const wuffs_base__frame_config* c) { | 5754 | 4.23k | if (c) { | 5755 | 4.23k | return c->private_impl.bounds; | 5756 | 4.23k | } | 5757 | | | 5758 | 0 | wuffs_base__rect_ie_u32 ret; | 5759 | 0 | ret.min_incl_x = 0; | 5760 | 0 | ret.min_incl_y = 0; | 5761 | 0 | ret.max_excl_x = 0; | 5762 | 0 | ret.max_excl_y = 0; | 5763 | 0 | return ret; | 5764 | 4.23k | } |
|
5765 | | |
5766 | | static inline uint32_t // |
5767 | 0 | wuffs_base__frame_config__width(const wuffs_base__frame_config* c) { |
5768 | 0 | return c ? wuffs_base__rect_ie_u32__width(&c->private_impl.bounds) : 0; |
5769 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__frame_config__width Unexecuted instantiation: json_fuzzer.cc:wuffs_base__frame_config__width(wuffs_base__frame_config__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__frame_config__width Unexecuted instantiation: xz_fuzzer.c:wuffs_base__frame_config__width Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__frame_config__width Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__frame_config__width Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__frame_config__width Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__frame_config__width Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__frame_config__width Unexecuted instantiation: targa_fuzzer.c:wuffs_base__frame_config__width Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__frame_config__width Unexecuted instantiation: webp_fuzzer.c:wuffs_base__frame_config__width |
5770 | | |
5771 | | static inline uint32_t // |
5772 | 0 | wuffs_base__frame_config__height(const wuffs_base__frame_config* c) { |
5773 | 0 | return c ? wuffs_base__rect_ie_u32__height(&c->private_impl.bounds) : 0; |
5774 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__frame_config__height Unexecuted instantiation: json_fuzzer.cc:wuffs_base__frame_config__height(wuffs_base__frame_config__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__frame_config__height Unexecuted instantiation: xz_fuzzer.c:wuffs_base__frame_config__height Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__frame_config__height Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__frame_config__height Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__frame_config__height Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__frame_config__height Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__frame_config__height Unexecuted instantiation: targa_fuzzer.c:wuffs_base__frame_config__height Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__frame_config__height Unexecuted instantiation: webp_fuzzer.c:wuffs_base__frame_config__height |
5775 | | |
5776 | | // wuffs_base__frame_config__duration returns the amount of time to display |
5777 | | // this frame. Zero means to display forever - a still (non-animated) image. |
5778 | | static inline wuffs_base__flicks // |
5779 | 0 | wuffs_base__frame_config__duration(const wuffs_base__frame_config* c) { |
5780 | 0 | return c ? c->private_impl.duration : 0; |
5781 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__frame_config__duration Unexecuted instantiation: json_fuzzer.cc:wuffs_base__frame_config__duration(wuffs_base__frame_config__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__frame_config__duration Unexecuted instantiation: xz_fuzzer.c:wuffs_base__frame_config__duration Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__frame_config__duration Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__frame_config__duration Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__frame_config__duration Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__frame_config__duration Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__frame_config__duration Unexecuted instantiation: targa_fuzzer.c:wuffs_base__frame_config__duration Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__frame_config__duration Unexecuted instantiation: webp_fuzzer.c:wuffs_base__frame_config__duration |
5782 | | |
5783 | | // wuffs_base__frame_config__index returns the index of this frame. The first |
5784 | | // frame in an image has index 0, the second frame has index 1, and so on. |
5785 | | static inline uint64_t // |
5786 | 0 | wuffs_base__frame_config__index(const wuffs_base__frame_config* c) { |
5787 | 0 | return c ? c->private_impl.index : 0; |
5788 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__frame_config__index Unexecuted instantiation: json_fuzzer.cc:wuffs_base__frame_config__index(wuffs_base__frame_config__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__frame_config__index Unexecuted instantiation: xz_fuzzer.c:wuffs_base__frame_config__index Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__frame_config__index Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__frame_config__index Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__frame_config__index Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__frame_config__index Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__frame_config__index Unexecuted instantiation: targa_fuzzer.c:wuffs_base__frame_config__index Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__frame_config__index Unexecuted instantiation: webp_fuzzer.c:wuffs_base__frame_config__index |
5789 | | |
5790 | | // wuffs_base__frame_config__io_position returns the I/O stream position before |
5791 | | // the frame config. |
5792 | | static inline uint64_t // |
5793 | 0 | wuffs_base__frame_config__io_position(const wuffs_base__frame_config* c) { |
5794 | 0 | return c ? c->private_impl.io_position : 0; |
5795 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__frame_config__io_position Unexecuted instantiation: json_fuzzer.cc:wuffs_base__frame_config__io_position(wuffs_base__frame_config__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__frame_config__io_position Unexecuted instantiation: xz_fuzzer.c:wuffs_base__frame_config__io_position Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__frame_config__io_position Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__frame_config__io_position Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__frame_config__io_position Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__frame_config__io_position Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__frame_config__io_position Unexecuted instantiation: targa_fuzzer.c:wuffs_base__frame_config__io_position Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__frame_config__io_position Unexecuted instantiation: webp_fuzzer.c:wuffs_base__frame_config__io_position |
5796 | | |
5797 | | // wuffs_base__frame_config__disposal returns, for an animated image, how to |
5798 | | // dispose of this frame after displaying it. |
5799 | | static inline wuffs_base__animation_disposal // |
5800 | 0 | wuffs_base__frame_config__disposal(const wuffs_base__frame_config* c) { |
5801 | 0 | return c ? c->private_impl.disposal : 0; |
5802 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__frame_config__disposal Unexecuted instantiation: json_fuzzer.cc:wuffs_base__frame_config__disposal(wuffs_base__frame_config__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__frame_config__disposal Unexecuted instantiation: xz_fuzzer.c:wuffs_base__frame_config__disposal Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__frame_config__disposal Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__frame_config__disposal Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__frame_config__disposal Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__frame_config__disposal Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__frame_config__disposal Unexecuted instantiation: targa_fuzzer.c:wuffs_base__frame_config__disposal Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__frame_config__disposal Unexecuted instantiation: webp_fuzzer.c:wuffs_base__frame_config__disposal |
5803 | | |
5804 | | // wuffs_base__frame_config__opaque_within_bounds returns whether all pixels |
5805 | | // within the frame's bounds are fully opaque. It makes no claim about pixels |
5806 | | // outside the frame bounds but still inside the overall image. The two |
5807 | | // bounding rectangles can differ for animated images. |
5808 | | // |
5809 | | // Its semantics are conservative. It is valid for a fully opaque frame to have |
5810 | | // this value be false: a false negative. |
5811 | | // |
5812 | | // If true, drawing the frame with WUFFS_BASE__PIXEL_BLEND__SRC and |
5813 | | // WUFFS_BASE__PIXEL_BLEND__SRC_OVER should be equivalent, in terms of |
5814 | | // resultant pixels, but the former may be faster. |
5815 | | static inline bool // |
5816 | | wuffs_base__frame_config__opaque_within_bounds( |
5817 | 0 | const wuffs_base__frame_config* c) { |
5818 | 0 | return c && c->private_impl.opaque_within_bounds; |
5819 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__frame_config__opaque_within_bounds Unexecuted instantiation: json_fuzzer.cc:wuffs_base__frame_config__opaque_within_bounds(wuffs_base__frame_config__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__frame_config__opaque_within_bounds Unexecuted instantiation: xz_fuzzer.c:wuffs_base__frame_config__opaque_within_bounds Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__frame_config__opaque_within_bounds Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__frame_config__opaque_within_bounds Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__frame_config__opaque_within_bounds Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__frame_config__opaque_within_bounds Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__frame_config__opaque_within_bounds Unexecuted instantiation: targa_fuzzer.c:wuffs_base__frame_config__opaque_within_bounds Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__frame_config__opaque_within_bounds Unexecuted instantiation: webp_fuzzer.c:wuffs_base__frame_config__opaque_within_bounds |
5820 | | |
5821 | | // wuffs_base__frame_config__overwrite_instead_of_blend returns, for an |
5822 | | // animated image, whether to ignore the previous image state (within the frame |
5823 | | // bounds) when drawing this incremental frame. Equivalently, whether to use |
5824 | | // WUFFS_BASE__PIXEL_BLEND__SRC instead of WUFFS_BASE__PIXEL_BLEND__SRC_OVER. |
5825 | | // |
5826 | | // The WebP spec (https://developers.google.com/speed/webp/docs/riff_container) |
5827 | | // calls this the "Blending method" bit. WebP's "Do not blend" corresponds to |
5828 | | // Wuffs' "overwrite_instead_of_blend". |
5829 | | static inline bool // |
5830 | | wuffs_base__frame_config__overwrite_instead_of_blend( |
5831 | 0 | const wuffs_base__frame_config* c) { |
5832 | 0 | return c && c->private_impl.overwrite_instead_of_blend; |
5833 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__frame_config__overwrite_instead_of_blend Unexecuted instantiation: json_fuzzer.cc:wuffs_base__frame_config__overwrite_instead_of_blend(wuffs_base__frame_config__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__frame_config__overwrite_instead_of_blend Unexecuted instantiation: xz_fuzzer.c:wuffs_base__frame_config__overwrite_instead_of_blend Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__frame_config__overwrite_instead_of_blend Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__frame_config__overwrite_instead_of_blend Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__frame_config__overwrite_instead_of_blend Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__frame_config__overwrite_instead_of_blend Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__frame_config__overwrite_instead_of_blend Unexecuted instantiation: targa_fuzzer.c:wuffs_base__frame_config__overwrite_instead_of_blend Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__frame_config__overwrite_instead_of_blend Unexecuted instantiation: webp_fuzzer.c:wuffs_base__frame_config__overwrite_instead_of_blend |
5834 | | |
5835 | | static inline wuffs_base__color_u32_argb_premul // |
5836 | 0 | wuffs_base__frame_config__background_color(const wuffs_base__frame_config* c) { |
5837 | 0 | return c ? c->private_impl.background_color : 0; |
5838 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__frame_config__background_color Unexecuted instantiation: json_fuzzer.cc:wuffs_base__frame_config__background_color(wuffs_base__frame_config__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__frame_config__background_color Unexecuted instantiation: xz_fuzzer.c:wuffs_base__frame_config__background_color Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__frame_config__background_color Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__frame_config__background_color Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__frame_config__background_color Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__frame_config__background_color Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__frame_config__background_color Unexecuted instantiation: targa_fuzzer.c:wuffs_base__frame_config__background_color Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__frame_config__background_color Unexecuted instantiation: webp_fuzzer.c:wuffs_base__frame_config__background_color |
5839 | | |
5840 | | #ifdef __cplusplus |
5841 | | |
5842 | | inline void // |
5843 | | wuffs_base__frame_config::set( |
5844 | | wuffs_base__rect_ie_u32 bounds, |
5845 | | wuffs_base__flicks duration, |
5846 | | uint64_t index, |
5847 | | uint64_t io_position, |
5848 | | wuffs_base__animation_disposal disposal, |
5849 | | bool opaque_within_bounds, |
5850 | | bool overwrite_instead_of_blend, |
5851 | 0 | wuffs_base__color_u32_argb_premul background_color) { |
5852 | 0 | wuffs_base__frame_config__set(this, bounds, duration, index, io_position, |
5853 | 0 | disposal, opaque_within_bounds, |
5854 | 0 | overwrite_instead_of_blend, background_color); |
5855 | 0 | } |
5856 | | |
5857 | | inline wuffs_base__rect_ie_u32 // |
5858 | 0 | wuffs_base__frame_config::bounds() const { |
5859 | 0 | return wuffs_base__frame_config__bounds(this); |
5860 | 0 | } |
5861 | | |
5862 | | inline uint32_t // |
5863 | 0 | wuffs_base__frame_config::width() const { |
5864 | 0 | return wuffs_base__frame_config__width(this); |
5865 | 0 | } |
5866 | | |
5867 | | inline uint32_t // |
5868 | 0 | wuffs_base__frame_config::height() const { |
5869 | 0 | return wuffs_base__frame_config__height(this); |
5870 | 0 | } |
5871 | | |
5872 | | inline wuffs_base__flicks // |
5873 | 0 | wuffs_base__frame_config::duration() const { |
5874 | 0 | return wuffs_base__frame_config__duration(this); |
5875 | 0 | } |
5876 | | |
5877 | | inline uint64_t // |
5878 | 0 | wuffs_base__frame_config::index() const { |
5879 | 0 | return wuffs_base__frame_config__index(this); |
5880 | 0 | } |
5881 | | |
5882 | | inline uint64_t // |
5883 | 0 | wuffs_base__frame_config::io_position() const { |
5884 | 0 | return wuffs_base__frame_config__io_position(this); |
5885 | 0 | } |
5886 | | |
5887 | | inline wuffs_base__animation_disposal // |
5888 | 0 | wuffs_base__frame_config::disposal() const { |
5889 | 0 | return wuffs_base__frame_config__disposal(this); |
5890 | 0 | } |
5891 | | |
5892 | | inline bool // |
5893 | 0 | wuffs_base__frame_config::opaque_within_bounds() const { |
5894 | 0 | return wuffs_base__frame_config__opaque_within_bounds(this); |
5895 | 0 | } |
5896 | | |
5897 | | inline bool // |
5898 | 0 | wuffs_base__frame_config::overwrite_instead_of_blend() const { |
5899 | 0 | return wuffs_base__frame_config__overwrite_instead_of_blend(this); |
5900 | 0 | } |
5901 | | |
5902 | | inline wuffs_base__color_u32_argb_premul // |
5903 | 0 | wuffs_base__frame_config::background_color() const { |
5904 | 0 | return wuffs_base__frame_config__background_color(this); |
5905 | 0 | } |
5906 | | |
5907 | | #endif // __cplusplus |
5908 | | |
5909 | | // -------- |
5910 | | |
5911 | | typedef struct wuffs_base__pixel_buffer__struct { |
5912 | | wuffs_base__pixel_config pixcfg; |
5913 | | |
5914 | | // Do not access the private_impl's fields directly. There is no API/ABI |
5915 | | // compatibility or safety guarantee if you do so. |
5916 | | struct { |
5917 | | wuffs_base__table_u8 planes[WUFFS_BASE__PIXEL_FORMAT__NUM_PLANES_MAX_INCL]; |
5918 | | // TODO: color spaces. |
5919 | | } private_impl; |
5920 | | |
5921 | | #ifdef __cplusplus |
5922 | | inline wuffs_base__status set_interleaved( |
5923 | | const wuffs_base__pixel_config* pixcfg, |
5924 | | wuffs_base__table_u8 primary_memory, |
5925 | | wuffs_base__slice_u8 palette_memory); |
5926 | | inline wuffs_base__status set_from_slice( |
5927 | | const wuffs_base__pixel_config* pixcfg, |
5928 | | wuffs_base__slice_u8 pixbuf_memory); |
5929 | | inline wuffs_base__slice_u8 palette(); |
5930 | | inline wuffs_base__slice_u8 palette_or_else(wuffs_base__slice_u8 fallback); |
5931 | | inline wuffs_base__pixel_format pixel_format() const; |
5932 | | inline wuffs_base__table_u8 plane(uint32_t p); |
5933 | | // Deprecated: use color_u32_argb_premul_at. |
5934 | | inline wuffs_base__color_u32_argb_premul color_u32_at(uint32_t x, |
5935 | | uint32_t y) const; |
5936 | | inline wuffs_base__color_u32_argb_premul color_u32_argb_premul_at( |
5937 | | uint32_t x, |
5938 | | uint32_t y) const; |
5939 | | // Deprecated: use set_color_u32_argb_premul_at. |
5940 | | inline wuffs_base__status set_color_u32_at( |
5941 | | uint32_t x, |
5942 | | uint32_t y, |
5943 | | wuffs_base__color_u32_argb_premul color); |
5944 | | inline wuffs_base__status set_color_u32_argb_premul_at( |
5945 | | uint32_t x, |
5946 | | uint32_t y, |
5947 | | wuffs_base__color_u32_argb_premul color); |
5948 | | // Deprecated: use set_color_u32_argb_premul_fill_rect. |
5949 | | inline wuffs_base__status set_color_u32_fill_rect( |
5950 | | wuffs_base__rect_ie_u32 rect, |
5951 | | wuffs_base__color_u32_argb_premul color); |
5952 | | inline wuffs_base__status set_color_u32_argb_premul_fill_rect( |
5953 | | wuffs_base__rect_ie_u32 rect, |
5954 | | wuffs_base__color_u32_argb_premul color); |
5955 | | inline wuffs_base__status set_color_u32_argb_nonpremul_at( |
5956 | | uint32_t x, |
5957 | | uint32_t y, |
5958 | | wuffs_base__color_u32_argb_nonpremul color); |
5959 | | inline bool is_opaque(); |
5960 | | #endif // __cplusplus |
5961 | | |
5962 | | } wuffs_base__pixel_buffer; |
5963 | | |
5964 | | static inline wuffs_base__pixel_buffer // |
5965 | 0 | wuffs_base__null_pixel_buffer(void) { |
5966 | 0 | wuffs_base__pixel_buffer ret; |
5967 | 0 | ret.pixcfg = wuffs_base__null_pixel_config(); |
5968 | 0 | ret.private_impl.planes[0] = wuffs_base__empty_table_u8(); |
5969 | 0 | ret.private_impl.planes[1] = wuffs_base__empty_table_u8(); |
5970 | 0 | ret.private_impl.planes[2] = wuffs_base__empty_table_u8(); |
5971 | 0 | ret.private_impl.planes[3] = wuffs_base__empty_table_u8(); |
5972 | 0 | return ret; |
5973 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__null_pixel_buffer Unexecuted instantiation: json_fuzzer.cc:wuffs_base__null_pixel_buffer() Unexecuted instantiation: gif_fuzzer.c:wuffs_base__null_pixel_buffer Unexecuted instantiation: xz_fuzzer.c:wuffs_base__null_pixel_buffer Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__null_pixel_buffer Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__null_pixel_buffer Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__null_pixel_buffer Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__null_pixel_buffer Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__null_pixel_buffer Unexecuted instantiation: targa_fuzzer.c:wuffs_base__null_pixel_buffer Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__null_pixel_buffer Unexecuted instantiation: webp_fuzzer.c:wuffs_base__null_pixel_buffer |
5974 | | |
5975 | | static inline wuffs_base__status // |
5976 | | wuffs_base__pixel_buffer__set_interleaved( |
5977 | | wuffs_base__pixel_buffer* pb, |
5978 | | const wuffs_base__pixel_config* pixcfg, |
5979 | | wuffs_base__table_u8 primary_memory, |
5980 | 0 | wuffs_base__slice_u8 palette_memory) { |
5981 | 0 | if (!pb) { |
5982 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_receiver); |
5983 | 0 | } |
5984 | 0 | memset(pb, 0, sizeof(*pb)); |
5985 | 0 | if (!pixcfg || |
5986 | 0 | wuffs_base__pixel_format__is_planar(&pixcfg->private_impl.pixfmt)) { |
5987 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); |
5988 | 0 | } |
5989 | 0 | if (wuffs_base__pixel_format__is_indexed(&pixcfg->private_impl.pixfmt) && |
5990 | 0 | (palette_memory.len < |
5991 | 0 | WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH)) { |
5992 | 0 | return wuffs_base__make_status( |
5993 | 0 | wuffs_base__error__bad_argument_length_too_short); |
5994 | 0 | } |
5995 | 0 | uint32_t bits_per_pixel = |
5996 | 0 | wuffs_base__pixel_format__bits_per_pixel(&pixcfg->private_impl.pixfmt); |
5997 | 0 | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { |
5998 | 0 | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? |
5999 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); |
6000 | 0 | } |
6001 | 0 | uint64_t bytes_per_pixel = bits_per_pixel / 8; |
6002 | 0 |
|
6003 | 0 | uint64_t width_in_bytes = |
6004 | 0 | ((uint64_t)pixcfg->private_impl.width) * bytes_per_pixel; |
6005 | 0 | if ((width_in_bytes > primary_memory.width) || |
6006 | 0 | (pixcfg->private_impl.height > primary_memory.height)) { |
6007 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); |
6008 | 0 | } |
6009 | 0 |
|
6010 | 0 | pb->pixcfg = *pixcfg; |
6011 | 0 | pb->private_impl.planes[0] = primary_memory; |
6012 | 0 | if (wuffs_base__pixel_format__is_indexed(&pixcfg->private_impl.pixfmt)) { |
6013 | 0 | wuffs_base__table_u8* tab = |
6014 | 0 | &pb->private_impl |
6015 | 0 | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; |
6016 | 0 | tab->ptr = palette_memory.ptr; |
6017 | 0 | tab->width = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; |
6018 | 0 | tab->height = 1; |
6019 | 0 | tab->stride = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; |
6020 | 0 | } |
6021 | 0 | return wuffs_base__make_status(NULL); |
6022 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pixel_buffer__set_interleaved Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_buffer__set_interleaved(wuffs_base__pixel_buffer__struct*, wuffs_base__pixel_config__struct const*, wuffs_base__table_u8, wuffs_base__slice_u8) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_buffer__set_interleaved Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_buffer__set_interleaved Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_buffer__set_interleaved Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_buffer__set_interleaved Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pixel_buffer__set_interleaved Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_buffer__set_interleaved Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_buffer__set_interleaved Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pixel_buffer__set_interleaved Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_buffer__set_interleaved Unexecuted instantiation: webp_fuzzer.c:wuffs_base__pixel_buffer__set_interleaved |
6023 | | |
6024 | | static inline wuffs_base__status // |
6025 | | wuffs_base__pixel_buffer__set_from_slice(wuffs_base__pixel_buffer* pb, |
6026 | | const wuffs_base__pixel_config* pixcfg, |
6027 | 18.8k | wuffs_base__slice_u8 pixbuf_memory) { |
6028 | 18.8k | if (!pb) { |
6029 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_receiver); |
6030 | 0 | } |
6031 | 18.8k | memset(pb, 0, sizeof(*pb)); |
6032 | 18.8k | if (!pixcfg) { |
6033 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); |
6034 | 0 | } |
6035 | 18.8k | if (wuffs_base__pixel_format__is_planar(&pixcfg->private_impl.pixfmt)) { |
6036 | | // TODO: support planar pixel formats, concious of pixel subsampling. |
6037 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); |
6038 | 0 | } |
6039 | 18.8k | uint32_t bits_per_pixel = |
6040 | 18.8k | wuffs_base__pixel_format__bits_per_pixel(&pixcfg->private_impl.pixfmt); |
6041 | 18.8k | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { |
6042 | | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? |
6043 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); |
6044 | 0 | } |
6045 | 18.8k | uint64_t bytes_per_pixel = bits_per_pixel / 8; |
6046 | | |
6047 | 18.8k | uint8_t* ptr = pixbuf_memory.ptr; |
6048 | 18.8k | uint64_t len = pixbuf_memory.len; |
6049 | 18.8k | if (wuffs_base__pixel_format__is_indexed(&pixcfg->private_impl.pixfmt)) { |
6050 | | // Split a WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH byte |
6051 | | // chunk (1024 bytes = 256 palette entries ร 4 bytes per entry) from the |
6052 | | // start of pixbuf_memory. We split from the start, not the end, so that |
6053 | | // the both chunks' pointers have the same alignment as the original |
6054 | | // pointer, up to an alignment of 1024. |
6055 | 1.13k | if (len < WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) { |
6056 | 0 | return wuffs_base__make_status( |
6057 | 0 | wuffs_base__error__bad_argument_length_too_short); |
6058 | 0 | } |
6059 | 1.13k | wuffs_base__table_u8* tab = |
6060 | 1.13k | &pb->private_impl |
6061 | 1.13k | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; |
6062 | 1.13k | tab->ptr = ptr; |
6063 | 1.13k | tab->width = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; |
6064 | 1.13k | tab->height = 1; |
6065 | 1.13k | tab->stride = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; |
6066 | 1.13k | ptr += WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; |
6067 | 1.13k | len -= WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; |
6068 | 1.13k | } |
6069 | | |
6070 | 18.8k | uint64_t wh = ((uint64_t)pixcfg->private_impl.width) * |
6071 | 18.8k | ((uint64_t)pixcfg->private_impl.height); |
6072 | 18.8k | size_t width = (size_t)(pixcfg->private_impl.width); |
6073 | 18.8k | if ((wh > (UINT64_MAX / bytes_per_pixel)) || |
6074 | 18.8k | (width > (SIZE_MAX / bytes_per_pixel))) { |
6075 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); |
6076 | 0 | } |
6077 | 18.8k | wh *= bytes_per_pixel; |
6078 | 18.8k | width = ((size_t)(width * bytes_per_pixel)); |
6079 | 18.8k | if (wh > len) { |
6080 | 0 | return wuffs_base__make_status( |
6081 | 0 | wuffs_base__error__bad_argument_length_too_short); |
6082 | 0 | } |
6083 | | |
6084 | 18.8k | pb->pixcfg = *pixcfg; |
6085 | 18.8k | wuffs_base__table_u8* tab = &pb->private_impl.planes[0]; |
6086 | 18.8k | tab->ptr = ptr; |
6087 | 18.8k | tab->width = width; |
6088 | 18.8k | tab->height = pixcfg->private_impl.height; |
6089 | 18.8k | tab->stride = width; |
6090 | 18.8k | return wuffs_base__make_status(NULL); |
6091 | 18.8k | } png_fuzzer.c:wuffs_base__pixel_buffer__set_from_slice Line | Count | Source | 6027 | 4.30k | wuffs_base__slice_u8 pixbuf_memory) { | 6028 | 4.30k | if (!pb) { | 6029 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_receiver); | 6030 | 0 | } | 6031 | 4.30k | memset(pb, 0, sizeof(*pb)); | 6032 | 4.30k | if (!pixcfg) { | 6033 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); | 6034 | 0 | } | 6035 | 4.30k | if (wuffs_base__pixel_format__is_planar(&pixcfg->private_impl.pixfmt)) { | 6036 | | // TODO: support planar pixel formats, concious of pixel subsampling. | 6037 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); | 6038 | 0 | } | 6039 | 4.30k | uint32_t bits_per_pixel = | 6040 | 4.30k | wuffs_base__pixel_format__bits_per_pixel(&pixcfg->private_impl.pixfmt); | 6041 | 4.30k | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { | 6042 | | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? | 6043 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); | 6044 | 0 | } | 6045 | 4.30k | uint64_t bytes_per_pixel = bits_per_pixel / 8; | 6046 | | | 6047 | 4.30k | uint8_t* ptr = pixbuf_memory.ptr; | 6048 | 4.30k | uint64_t len = pixbuf_memory.len; | 6049 | 4.30k | if (wuffs_base__pixel_format__is_indexed(&pixcfg->private_impl.pixfmt)) { | 6050 | | // Split a WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH byte | 6051 | | // chunk (1024 bytes = 256 palette entries ร 4 bytes per entry) from the | 6052 | | // start of pixbuf_memory. We split from the start, not the end, so that | 6053 | | // the both chunks' pointers have the same alignment as the original | 6054 | | // pointer, up to an alignment of 1024. | 6055 | 69 | if (len < WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) { | 6056 | 0 | return wuffs_base__make_status( | 6057 | 0 | wuffs_base__error__bad_argument_length_too_short); | 6058 | 0 | } | 6059 | 69 | wuffs_base__table_u8* tab = | 6060 | 69 | &pb->private_impl | 6061 | 69 | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; | 6062 | 69 | tab->ptr = ptr; | 6063 | 69 | tab->width = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6064 | 69 | tab->height = 1; | 6065 | 69 | tab->stride = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6066 | 69 | ptr += WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6067 | 69 | len -= WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6068 | 69 | } | 6069 | | | 6070 | 4.30k | uint64_t wh = ((uint64_t)pixcfg->private_impl.width) * | 6071 | 4.30k | ((uint64_t)pixcfg->private_impl.height); | 6072 | 4.30k | size_t width = (size_t)(pixcfg->private_impl.width); | 6073 | 4.30k | if ((wh > (UINT64_MAX / bytes_per_pixel)) || | 6074 | 4.30k | (width > (SIZE_MAX / bytes_per_pixel))) { | 6075 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); | 6076 | 0 | } | 6077 | 4.30k | wh *= bytes_per_pixel; | 6078 | 4.30k | width = ((size_t)(width * bytes_per_pixel)); | 6079 | 4.30k | if (wh > len) { | 6080 | 0 | return wuffs_base__make_status( | 6081 | 0 | wuffs_base__error__bad_argument_length_too_short); | 6082 | 0 | } | 6083 | | | 6084 | 4.30k | pb->pixcfg = *pixcfg; | 6085 | 4.30k | wuffs_base__table_u8* tab = &pb->private_impl.planes[0]; | 6086 | 4.30k | tab->ptr = ptr; | 6087 | 4.30k | tab->width = width; | 6088 | 4.30k | tab->height = pixcfg->private_impl.height; | 6089 | 4.30k | tab->stride = width; | 6090 | | return wuffs_base__make_status(NULL); | 6091 | 4.30k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_buffer__set_from_slice(wuffs_base__pixel_buffer__struct*, wuffs_base__pixel_config__struct const*, wuffs_base__slice_u8) gif_fuzzer.c:wuffs_base__pixel_buffer__set_from_slice Line | Count | Source | 6027 | 1.57k | wuffs_base__slice_u8 pixbuf_memory) { | 6028 | 1.57k | if (!pb) { | 6029 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_receiver); | 6030 | 0 | } | 6031 | 1.57k | memset(pb, 0, sizeof(*pb)); | 6032 | 1.57k | if (!pixcfg) { | 6033 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); | 6034 | 0 | } | 6035 | 1.57k | if (wuffs_base__pixel_format__is_planar(&pixcfg->private_impl.pixfmt)) { | 6036 | | // TODO: support planar pixel formats, concious of pixel subsampling. | 6037 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); | 6038 | 0 | } | 6039 | 1.57k | uint32_t bits_per_pixel = | 6040 | 1.57k | wuffs_base__pixel_format__bits_per_pixel(&pixcfg->private_impl.pixfmt); | 6041 | 1.57k | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { | 6042 | | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? | 6043 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); | 6044 | 0 | } | 6045 | 1.57k | uint64_t bytes_per_pixel = bits_per_pixel / 8; | 6046 | | | 6047 | 1.57k | uint8_t* ptr = pixbuf_memory.ptr; | 6048 | 1.57k | uint64_t len = pixbuf_memory.len; | 6049 | 1.57k | if (wuffs_base__pixel_format__is_indexed(&pixcfg->private_impl.pixfmt)) { | 6050 | | // Split a WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH byte | 6051 | | // chunk (1024 bytes = 256 palette entries ร 4 bytes per entry) from the | 6052 | | // start of pixbuf_memory. We split from the start, not the end, so that | 6053 | | // the both chunks' pointers have the same alignment as the original | 6054 | | // pointer, up to an alignment of 1024. | 6055 | 819 | if (len < WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) { | 6056 | 0 | return wuffs_base__make_status( | 6057 | 0 | wuffs_base__error__bad_argument_length_too_short); | 6058 | 0 | } | 6059 | 819 | wuffs_base__table_u8* tab = | 6060 | 819 | &pb->private_impl | 6061 | 819 | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; | 6062 | 819 | tab->ptr = ptr; | 6063 | 819 | tab->width = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6064 | 819 | tab->height = 1; | 6065 | 819 | tab->stride = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6066 | 819 | ptr += WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6067 | 819 | len -= WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6068 | 819 | } | 6069 | | | 6070 | 1.57k | uint64_t wh = ((uint64_t)pixcfg->private_impl.width) * | 6071 | 1.57k | ((uint64_t)pixcfg->private_impl.height); | 6072 | 1.57k | size_t width = (size_t)(pixcfg->private_impl.width); | 6073 | 1.57k | if ((wh > (UINT64_MAX / bytes_per_pixel)) || | 6074 | 1.57k | (width > (SIZE_MAX / bytes_per_pixel))) { | 6075 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); | 6076 | 0 | } | 6077 | 1.57k | wh *= bytes_per_pixel; | 6078 | 1.57k | width = ((size_t)(width * bytes_per_pixel)); | 6079 | 1.57k | if (wh > len) { | 6080 | 0 | return wuffs_base__make_status( | 6081 | 0 | wuffs_base__error__bad_argument_length_too_short); | 6082 | 0 | } | 6083 | | | 6084 | 1.57k | pb->pixcfg = *pixcfg; | 6085 | 1.57k | wuffs_base__table_u8* tab = &pb->private_impl.planes[0]; | 6086 | 1.57k | tab->ptr = ptr; | 6087 | 1.57k | tab->width = width; | 6088 | 1.57k | tab->height = pixcfg->private_impl.height; | 6089 | 1.57k | tab->stride = width; | 6090 | | return wuffs_base__make_status(NULL); | 6091 | 1.57k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_buffer__set_from_slice jpeg_fuzzer.c:wuffs_base__pixel_buffer__set_from_slice Line | Count | Source | 6027 | 2.85k | wuffs_base__slice_u8 pixbuf_memory) { | 6028 | 2.85k | if (!pb) { | 6029 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_receiver); | 6030 | 0 | } | 6031 | 2.85k | memset(pb, 0, sizeof(*pb)); | 6032 | 2.85k | if (!pixcfg) { | 6033 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); | 6034 | 0 | } | 6035 | 2.85k | if (wuffs_base__pixel_format__is_planar(&pixcfg->private_impl.pixfmt)) { | 6036 | | // TODO: support planar pixel formats, concious of pixel subsampling. | 6037 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); | 6038 | 0 | } | 6039 | 2.85k | uint32_t bits_per_pixel = | 6040 | 2.85k | wuffs_base__pixel_format__bits_per_pixel(&pixcfg->private_impl.pixfmt); | 6041 | 2.85k | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { | 6042 | | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? | 6043 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); | 6044 | 0 | } | 6045 | 2.85k | uint64_t bytes_per_pixel = bits_per_pixel / 8; | 6046 | | | 6047 | 2.85k | uint8_t* ptr = pixbuf_memory.ptr; | 6048 | 2.85k | uint64_t len = pixbuf_memory.len; | 6049 | 2.85k | if (wuffs_base__pixel_format__is_indexed(&pixcfg->private_impl.pixfmt)) { | 6050 | | // Split a WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH byte | 6051 | | // chunk (1024 bytes = 256 palette entries ร 4 bytes per entry) from the | 6052 | | // start of pixbuf_memory. We split from the start, not the end, so that | 6053 | | // the both chunks' pointers have the same alignment as the original | 6054 | | // pointer, up to an alignment of 1024. | 6055 | 0 | if (len < WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) { | 6056 | 0 | return wuffs_base__make_status( | 6057 | 0 | wuffs_base__error__bad_argument_length_too_short); | 6058 | 0 | } | 6059 | 0 | wuffs_base__table_u8* tab = | 6060 | 0 | &pb->private_impl | 6061 | 0 | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; | 6062 | 0 | tab->ptr = ptr; | 6063 | 0 | tab->width = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6064 | 0 | tab->height = 1; | 6065 | 0 | tab->stride = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6066 | 0 | ptr += WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6067 | 0 | len -= WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6068 | 0 | } | 6069 | | | 6070 | 2.85k | uint64_t wh = ((uint64_t)pixcfg->private_impl.width) * | 6071 | 2.85k | ((uint64_t)pixcfg->private_impl.height); | 6072 | 2.85k | size_t width = (size_t)(pixcfg->private_impl.width); | 6073 | 2.85k | if ((wh > (UINT64_MAX / bytes_per_pixel)) || | 6074 | 2.85k | (width > (SIZE_MAX / bytes_per_pixel))) { | 6075 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); | 6076 | 0 | } | 6077 | 2.85k | wh *= bytes_per_pixel; | 6078 | 2.85k | width = ((size_t)(width * bytes_per_pixel)); | 6079 | 2.85k | if (wh > len) { | 6080 | 0 | return wuffs_base__make_status( | 6081 | 0 | wuffs_base__error__bad_argument_length_too_short); | 6082 | 0 | } | 6083 | | | 6084 | 2.85k | pb->pixcfg = *pixcfg; | 6085 | 2.85k | wuffs_base__table_u8* tab = &pb->private_impl.planes[0]; | 6086 | 2.85k | tab->ptr = ptr; | 6087 | 2.85k | tab->width = width; | 6088 | 2.85k | tab->height = pixcfg->private_impl.height; | 6089 | 2.85k | tab->stride = width; | 6090 | | return wuffs_base__make_status(NULL); | 6091 | 2.85k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_buffer__set_from_slice bmp_fuzzer.c:wuffs_base__pixel_buffer__set_from_slice Line | Count | Source | 6027 | 1.72k | wuffs_base__slice_u8 pixbuf_memory) { | 6028 | 1.72k | if (!pb) { | 6029 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_receiver); | 6030 | 0 | } | 6031 | 1.72k | memset(pb, 0, sizeof(*pb)); | 6032 | 1.72k | if (!pixcfg) { | 6033 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); | 6034 | 0 | } | 6035 | 1.72k | if (wuffs_base__pixel_format__is_planar(&pixcfg->private_impl.pixfmt)) { | 6036 | | // TODO: support planar pixel formats, concious of pixel subsampling. | 6037 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); | 6038 | 0 | } | 6039 | 1.72k | uint32_t bits_per_pixel = | 6040 | 1.72k | wuffs_base__pixel_format__bits_per_pixel(&pixcfg->private_impl.pixfmt); | 6041 | 1.72k | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { | 6042 | | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? | 6043 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); | 6044 | 0 | } | 6045 | 1.72k | uint64_t bytes_per_pixel = bits_per_pixel / 8; | 6046 | | | 6047 | 1.72k | uint8_t* ptr = pixbuf_memory.ptr; | 6048 | 1.72k | uint64_t len = pixbuf_memory.len; | 6049 | 1.72k | if (wuffs_base__pixel_format__is_indexed(&pixcfg->private_impl.pixfmt)) { | 6050 | | // Split a WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH byte | 6051 | | // chunk (1024 bytes = 256 palette entries ร 4 bytes per entry) from the | 6052 | | // start of pixbuf_memory. We split from the start, not the end, so that | 6053 | | // the both chunks' pointers have the same alignment as the original | 6054 | | // pointer, up to an alignment of 1024. | 6055 | 0 | if (len < WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) { | 6056 | 0 | return wuffs_base__make_status( | 6057 | 0 | wuffs_base__error__bad_argument_length_too_short); | 6058 | 0 | } | 6059 | 0 | wuffs_base__table_u8* tab = | 6060 | 0 | &pb->private_impl | 6061 | 0 | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; | 6062 | 0 | tab->ptr = ptr; | 6063 | 0 | tab->width = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6064 | 0 | tab->height = 1; | 6065 | 0 | tab->stride = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6066 | 0 | ptr += WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6067 | 0 | len -= WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6068 | 0 | } | 6069 | | | 6070 | 1.72k | uint64_t wh = ((uint64_t)pixcfg->private_impl.width) * | 6071 | 1.72k | ((uint64_t)pixcfg->private_impl.height); | 6072 | 1.72k | size_t width = (size_t)(pixcfg->private_impl.width); | 6073 | 1.72k | if ((wh > (UINT64_MAX / bytes_per_pixel)) || | 6074 | 1.72k | (width > (SIZE_MAX / bytes_per_pixel))) { | 6075 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); | 6076 | 0 | } | 6077 | 1.72k | wh *= bytes_per_pixel; | 6078 | 1.72k | width = ((size_t)(width * bytes_per_pixel)); | 6079 | 1.72k | if (wh > len) { | 6080 | 0 | return wuffs_base__make_status( | 6081 | 0 | wuffs_base__error__bad_argument_length_too_short); | 6082 | 0 | } | 6083 | | | 6084 | 1.72k | pb->pixcfg = *pixcfg; | 6085 | 1.72k | wuffs_base__table_u8* tab = &pb->private_impl.planes[0]; | 6086 | 1.72k | tab->ptr = ptr; | 6087 | 1.72k | tab->width = width; | 6088 | 1.72k | tab->height = pixcfg->private_impl.height; | 6089 | 1.72k | tab->stride = width; | 6090 | | return wuffs_base__make_status(NULL); | 6091 | 1.72k | } |
pixel_swizzler_fuzzer.c:wuffs_base__pixel_buffer__set_from_slice Line | Count | Source | 6027 | 3.29k | wuffs_base__slice_u8 pixbuf_memory) { | 6028 | 3.29k | if (!pb) { | 6029 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_receiver); | 6030 | 0 | } | 6031 | 3.29k | memset(pb, 0, sizeof(*pb)); | 6032 | 3.29k | if (!pixcfg) { | 6033 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); | 6034 | 0 | } | 6035 | 3.29k | if (wuffs_base__pixel_format__is_planar(&pixcfg->private_impl.pixfmt)) { | 6036 | | // TODO: support planar pixel formats, concious of pixel subsampling. | 6037 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); | 6038 | 0 | } | 6039 | 3.29k | uint32_t bits_per_pixel = | 6040 | 3.29k | wuffs_base__pixel_format__bits_per_pixel(&pixcfg->private_impl.pixfmt); | 6041 | 3.29k | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { | 6042 | | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? | 6043 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); | 6044 | 0 | } | 6045 | 3.29k | uint64_t bytes_per_pixel = bits_per_pixel / 8; | 6046 | | | 6047 | 3.29k | uint8_t* ptr = pixbuf_memory.ptr; | 6048 | 3.29k | uint64_t len = pixbuf_memory.len; | 6049 | 3.29k | if (wuffs_base__pixel_format__is_indexed(&pixcfg->private_impl.pixfmt)) { | 6050 | | // Split a WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH byte | 6051 | | // chunk (1024 bytes = 256 palette entries ร 4 bytes per entry) from the | 6052 | | // start of pixbuf_memory. We split from the start, not the end, so that | 6053 | | // the both chunks' pointers have the same alignment as the original | 6054 | | // pointer, up to an alignment of 1024. | 6055 | 117 | if (len < WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) { | 6056 | 0 | return wuffs_base__make_status( | 6057 | 0 | wuffs_base__error__bad_argument_length_too_short); | 6058 | 0 | } | 6059 | 117 | wuffs_base__table_u8* tab = | 6060 | 117 | &pb->private_impl | 6061 | 117 | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; | 6062 | 117 | tab->ptr = ptr; | 6063 | 117 | tab->width = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6064 | 117 | tab->height = 1; | 6065 | 117 | tab->stride = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6066 | 117 | ptr += WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6067 | 117 | len -= WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6068 | 117 | } | 6069 | | | 6070 | 3.29k | uint64_t wh = ((uint64_t)pixcfg->private_impl.width) * | 6071 | 3.29k | ((uint64_t)pixcfg->private_impl.height); | 6072 | 3.29k | size_t width = (size_t)(pixcfg->private_impl.width); | 6073 | 3.29k | if ((wh > (UINT64_MAX / bytes_per_pixel)) || | 6074 | 3.29k | (width > (SIZE_MAX / bytes_per_pixel))) { | 6075 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); | 6076 | 0 | } | 6077 | 3.29k | wh *= bytes_per_pixel; | 6078 | 3.29k | width = ((size_t)(width * bytes_per_pixel)); | 6079 | 3.29k | if (wh > len) { | 6080 | 0 | return wuffs_base__make_status( | 6081 | 0 | wuffs_base__error__bad_argument_length_too_short); | 6082 | 0 | } | 6083 | | | 6084 | 3.29k | pb->pixcfg = *pixcfg; | 6085 | 3.29k | wuffs_base__table_u8* tab = &pb->private_impl.planes[0]; | 6086 | 3.29k | tab->ptr = ptr; | 6087 | 3.29k | tab->width = width; | 6088 | 3.29k | tab->height = pixcfg->private_impl.height; | 6089 | 3.29k | tab->stride = width; | 6090 | | return wuffs_base__make_status(NULL); | 6091 | 3.29k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_buffer__set_from_slice targa_fuzzer.c:wuffs_base__pixel_buffer__set_from_slice Line | Count | Source | 6027 | 893 | wuffs_base__slice_u8 pixbuf_memory) { | 6028 | 893 | if (!pb) { | 6029 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_receiver); | 6030 | 0 | } | 6031 | 893 | memset(pb, 0, sizeof(*pb)); | 6032 | 893 | if (!pixcfg) { | 6033 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); | 6034 | 0 | } | 6035 | 893 | if (wuffs_base__pixel_format__is_planar(&pixcfg->private_impl.pixfmt)) { | 6036 | | // TODO: support planar pixel formats, concious of pixel subsampling. | 6037 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); | 6038 | 0 | } | 6039 | 893 | uint32_t bits_per_pixel = | 6040 | 893 | wuffs_base__pixel_format__bits_per_pixel(&pixcfg->private_impl.pixfmt); | 6041 | 893 | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { | 6042 | | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? | 6043 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); | 6044 | 0 | } | 6045 | 893 | uint64_t bytes_per_pixel = bits_per_pixel / 8; | 6046 | | | 6047 | 893 | uint8_t* ptr = pixbuf_memory.ptr; | 6048 | 893 | uint64_t len = pixbuf_memory.len; | 6049 | 893 | if (wuffs_base__pixel_format__is_indexed(&pixcfg->private_impl.pixfmt)) { | 6050 | | // Split a WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH byte | 6051 | | // chunk (1024 bytes = 256 palette entries ร 4 bytes per entry) from the | 6052 | | // start of pixbuf_memory. We split from the start, not the end, so that | 6053 | | // the both chunks' pointers have the same alignment as the original | 6054 | | // pointer, up to an alignment of 1024. | 6055 | 128 | if (len < WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) { | 6056 | 0 | return wuffs_base__make_status( | 6057 | 0 | wuffs_base__error__bad_argument_length_too_short); | 6058 | 0 | } | 6059 | 128 | wuffs_base__table_u8* tab = | 6060 | 128 | &pb->private_impl | 6061 | 128 | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; | 6062 | 128 | tab->ptr = ptr; | 6063 | 128 | tab->width = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6064 | 128 | tab->height = 1; | 6065 | 128 | tab->stride = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6066 | 128 | ptr += WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6067 | 128 | len -= WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6068 | 128 | } | 6069 | | | 6070 | 893 | uint64_t wh = ((uint64_t)pixcfg->private_impl.width) * | 6071 | 893 | ((uint64_t)pixcfg->private_impl.height); | 6072 | 893 | size_t width = (size_t)(pixcfg->private_impl.width); | 6073 | 893 | if ((wh > (UINT64_MAX / bytes_per_pixel)) || | 6074 | 893 | (width > (SIZE_MAX / bytes_per_pixel))) { | 6075 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); | 6076 | 0 | } | 6077 | 893 | wh *= bytes_per_pixel; | 6078 | 893 | width = ((size_t)(width * bytes_per_pixel)); | 6079 | 893 | if (wh > len) { | 6080 | 0 | return wuffs_base__make_status( | 6081 | 0 | wuffs_base__error__bad_argument_length_too_short); | 6082 | 0 | } | 6083 | | | 6084 | 893 | pb->pixcfg = *pixcfg; | 6085 | 893 | wuffs_base__table_u8* tab = &pb->private_impl.planes[0]; | 6086 | 893 | tab->ptr = ptr; | 6087 | 893 | tab->width = width; | 6088 | 893 | tab->height = pixcfg->private_impl.height; | 6089 | 893 | tab->stride = width; | 6090 | | return wuffs_base__make_status(NULL); | 6091 | 893 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_buffer__set_from_slice webp_fuzzer.c:wuffs_base__pixel_buffer__set_from_slice Line | Count | Source | 6027 | 4.23k | wuffs_base__slice_u8 pixbuf_memory) { | 6028 | 4.23k | if (!pb) { | 6029 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_receiver); | 6030 | 0 | } | 6031 | 4.23k | memset(pb, 0, sizeof(*pb)); | 6032 | 4.23k | if (!pixcfg) { | 6033 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); | 6034 | 0 | } | 6035 | 4.23k | if (wuffs_base__pixel_format__is_planar(&pixcfg->private_impl.pixfmt)) { | 6036 | | // TODO: support planar pixel formats, concious of pixel subsampling. | 6037 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); | 6038 | 0 | } | 6039 | 4.23k | uint32_t bits_per_pixel = | 6040 | 4.23k | wuffs_base__pixel_format__bits_per_pixel(&pixcfg->private_impl.pixfmt); | 6041 | 4.23k | if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) { | 6042 | | // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel? | 6043 | 0 | return wuffs_base__make_status(wuffs_base__error__unsupported_option); | 6044 | 0 | } | 6045 | 4.23k | uint64_t bytes_per_pixel = bits_per_pixel / 8; | 6046 | | | 6047 | 4.23k | uint8_t* ptr = pixbuf_memory.ptr; | 6048 | 4.23k | uint64_t len = pixbuf_memory.len; | 6049 | 4.23k | if (wuffs_base__pixel_format__is_indexed(&pixcfg->private_impl.pixfmt)) { | 6050 | | // Split a WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH byte | 6051 | | // chunk (1024 bytes = 256 palette entries ร 4 bytes per entry) from the | 6052 | | // start of pixbuf_memory. We split from the start, not the end, so that | 6053 | | // the both chunks' pointers have the same alignment as the original | 6054 | | // pointer, up to an alignment of 1024. | 6055 | 0 | if (len < WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) { | 6056 | 0 | return wuffs_base__make_status( | 6057 | 0 | wuffs_base__error__bad_argument_length_too_short); | 6058 | 0 | } | 6059 | 0 | wuffs_base__table_u8* tab = | 6060 | 0 | &pb->private_impl | 6061 | 0 | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; | 6062 | 0 | tab->ptr = ptr; | 6063 | 0 | tab->width = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6064 | 0 | tab->height = 1; | 6065 | 0 | tab->stride = WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6066 | 0 | ptr += WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6067 | 0 | len -= WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH; | 6068 | 0 | } | 6069 | | | 6070 | 4.23k | uint64_t wh = ((uint64_t)pixcfg->private_impl.width) * | 6071 | 4.23k | ((uint64_t)pixcfg->private_impl.height); | 6072 | 4.23k | size_t width = (size_t)(pixcfg->private_impl.width); | 6073 | 4.23k | if ((wh > (UINT64_MAX / bytes_per_pixel)) || | 6074 | 4.23k | (width > (SIZE_MAX / bytes_per_pixel))) { | 6075 | 0 | return wuffs_base__make_status(wuffs_base__error__bad_argument); | 6076 | 0 | } | 6077 | 4.23k | wh *= bytes_per_pixel; | 6078 | 4.23k | width = ((size_t)(width * bytes_per_pixel)); | 6079 | 4.23k | if (wh > len) { | 6080 | 0 | return wuffs_base__make_status( | 6081 | 0 | wuffs_base__error__bad_argument_length_too_short); | 6082 | 0 | } | 6083 | | | 6084 | 4.23k | pb->pixcfg = *pixcfg; | 6085 | 4.23k | wuffs_base__table_u8* tab = &pb->private_impl.planes[0]; | 6086 | 4.23k | tab->ptr = ptr; | 6087 | 4.23k | tab->width = width; | 6088 | 4.23k | tab->height = pixcfg->private_impl.height; | 6089 | 4.23k | tab->stride = width; | 6090 | | return wuffs_base__make_status(NULL); | 6091 | 4.23k | } |
|
6092 | | |
6093 | | // wuffs_base__pixel_buffer__palette returns the palette color data. If |
6094 | | // non-empty, it will have length |
6095 | | // WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH. |
6096 | | static inline wuffs_base__slice_u8 // |
6097 | 51.8k | wuffs_base__pixel_buffer__palette(wuffs_base__pixel_buffer* pb) { |
6098 | 51.8k | if (pb && |
6099 | 51.8k | wuffs_base__pixel_format__is_indexed(&pb->pixcfg.private_impl.pixfmt)) { |
6100 | 48.4k | wuffs_base__table_u8* tab = |
6101 | 48.4k | &pb->private_impl |
6102 | 48.4k | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; |
6103 | 48.4k | if ((tab->width == |
6104 | 48.4k | WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) && |
6105 | 48.4k | (tab->height == 1)) { |
6106 | 48.4k | return wuffs_base__make_slice_u8( |
6107 | 48.4k | tab->ptr, WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH); |
6108 | 48.4k | } |
6109 | 48.4k | } |
6110 | 3.34k | return wuffs_base__empty_slice_u8(); |
6111 | 51.8k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__pixel_buffer__palette Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_buffer__palette(wuffs_base__pixel_buffer__struct*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__pixel_buffer__palette Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_buffer__palette Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__pixel_buffer__palette Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_buffer__palette Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__pixel_buffer__palette pixel_swizzler_fuzzer.c:wuffs_base__pixel_buffer__palette Line | Count | Source | 6097 | 48.4k | wuffs_base__pixel_buffer__palette(wuffs_base__pixel_buffer* pb) { | 6098 | 48.4k | if (pb && | 6099 | 48.4k | wuffs_base__pixel_format__is_indexed(&pb->pixcfg.private_impl.pixfmt)) { | 6100 | 48.4k | wuffs_base__table_u8* tab = | 6101 | 48.4k | &pb->private_impl | 6102 | 48.4k | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; | 6103 | 48.4k | if ((tab->width == | 6104 | 48.4k | WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) && | 6105 | 48.4k | (tab->height == 1)) { | 6106 | 48.4k | return wuffs_base__make_slice_u8( | 6107 | 48.4k | tab->ptr, WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH); | 6108 | 48.4k | } | 6109 | 48.4k | } | 6110 | 0 | return wuffs_base__empty_slice_u8(); | 6111 | 48.4k | } |
Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_buffer__palette Unexecuted instantiation: targa_fuzzer.c:wuffs_base__pixel_buffer__palette Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_buffer__palette webp_fuzzer.c:wuffs_base__pixel_buffer__palette Line | Count | Source | 6097 | 3.34k | wuffs_base__pixel_buffer__palette(wuffs_base__pixel_buffer* pb) { | 6098 | 3.34k | if (pb && | 6099 | 3.34k | wuffs_base__pixel_format__is_indexed(&pb->pixcfg.private_impl.pixfmt)) { | 6100 | 0 | wuffs_base__table_u8* tab = | 6101 | 0 | &pb->private_impl | 6102 | 0 | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; | 6103 | 0 | if ((tab->width == | 6104 | 0 | WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) && | 6105 | 0 | (tab->height == 1)) { | 6106 | 0 | return wuffs_base__make_slice_u8( | 6107 | 0 | tab->ptr, WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH); | 6108 | 0 | } | 6109 | 0 | } | 6110 | 3.34k | return wuffs_base__empty_slice_u8(); | 6111 | 3.34k | } |
|
6112 | | |
6113 | | static inline wuffs_base__slice_u8 // |
6114 | | wuffs_base__pixel_buffer__palette_or_else(wuffs_base__pixel_buffer* pb, |
6115 | 15.2M | wuffs_base__slice_u8 fallback) { |
6116 | 15.2M | if (pb && |
6117 | 15.2M | wuffs_base__pixel_format__is_indexed(&pb->pixcfg.private_impl.pixfmt)) { |
6118 | 219k | wuffs_base__table_u8* tab = |
6119 | 219k | &pb->private_impl |
6120 | 219k | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; |
6121 | 219k | if ((tab->width == |
6122 | 219k | WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) && |
6123 | 219k | (tab->height == 1)) { |
6124 | 219k | return wuffs_base__make_slice_u8( |
6125 | 219k | tab->ptr, WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH); |
6126 | 219k | } |
6127 | 219k | } |
6128 | 15.0M | return fallback; |
6129 | 15.2M | } png_fuzzer.c:wuffs_base__pixel_buffer__palette_or_else Line | Count | Source | 6115 | 16.1k | wuffs_base__slice_u8 fallback) { | 6116 | 16.1k | if (pb && | 6117 | 16.1k | wuffs_base__pixel_format__is_indexed(&pb->pixcfg.private_impl.pixfmt)) { | 6118 | 994 | wuffs_base__table_u8* tab = | 6119 | 994 | &pb->private_impl | 6120 | 994 | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; | 6121 | 994 | if ((tab->width == | 6122 | 994 | WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) && | 6123 | 994 | (tab->height == 1)) { | 6124 | 994 | return wuffs_base__make_slice_u8( | 6125 | 994 | tab->ptr, WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH); | 6126 | 994 | } | 6127 | 994 | } | 6128 | 15.1k | return fallback; | 6129 | 16.1k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_buffer__palette_or_else(wuffs_base__pixel_buffer__struct*, wuffs_base__slice_u8) gif_fuzzer.c:wuffs_base__pixel_buffer__palette_or_else Line | Count | Source | 6115 | 259k | wuffs_base__slice_u8 fallback) { | 6116 | 259k | if (pb && | 6117 | 259k | wuffs_base__pixel_format__is_indexed(&pb->pixcfg.private_impl.pixfmt)) { | 6118 | 218k | wuffs_base__table_u8* tab = | 6119 | 218k | &pb->private_impl | 6120 | 218k | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; | 6121 | 218k | if ((tab->width == | 6122 | 218k | WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) && | 6123 | 218k | (tab->height == 1)) { | 6124 | 218k | return wuffs_base__make_slice_u8( | 6125 | 218k | tab->ptr, WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH); | 6126 | 218k | } | 6127 | 218k | } | 6128 | 40.7k | return fallback; | 6129 | 259k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_buffer__palette_or_else jpeg_fuzzer.c:wuffs_base__pixel_buffer__palette_or_else Line | Count | Source | 6115 | 14.9M | wuffs_base__slice_u8 fallback) { | 6116 | 14.9M | if (pb && | 6117 | 14.9M | wuffs_base__pixel_format__is_indexed(&pb->pixcfg.private_impl.pixfmt)) { | 6118 | 0 | wuffs_base__table_u8* tab = | 6119 | 0 | &pb->private_impl | 6120 | 0 | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; | 6121 | 0 | if ((tab->width == | 6122 | 0 | WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) && | 6123 | 0 | (tab->height == 1)) { | 6124 | 0 | return wuffs_base__make_slice_u8( | 6125 | 0 | tab->ptr, WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH); | 6126 | 0 | } | 6127 | 0 | } | 6128 | 14.9M | return fallback; | 6129 | 14.9M | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_buffer__palette_or_else bmp_fuzzer.c:wuffs_base__pixel_buffer__palette_or_else Line | Count | Source | 6115 | 3.25k | wuffs_base__slice_u8 fallback) { | 6116 | 3.25k | if (pb && | 6117 | 3.25k | wuffs_base__pixel_format__is_indexed(&pb->pixcfg.private_impl.pixfmt)) { | 6118 | 0 | wuffs_base__table_u8* tab = | 6119 | 0 | &pb->private_impl | 6120 | 0 | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; | 6121 | 0 | if ((tab->width == | 6122 | 0 | WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) && | 6123 | 0 | (tab->height == 1)) { | 6124 | 0 | return wuffs_base__make_slice_u8( | 6125 | 0 | tab->ptr, WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH); | 6126 | 0 | } | 6127 | 0 | } | 6128 | 3.25k | return fallback; | 6129 | 3.25k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_buffer__palette_or_else Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_buffer__palette_or_else targa_fuzzer.c:wuffs_base__pixel_buffer__palette_or_else Line | Count | Source | 6115 | 1.77k | wuffs_base__slice_u8 fallback) { | 6116 | 1.77k | if (pb && | 6117 | 1.77k | wuffs_base__pixel_format__is_indexed(&pb->pixcfg.private_impl.pixfmt)) { | 6118 | 248 | wuffs_base__table_u8* tab = | 6119 | 248 | &pb->private_impl | 6120 | 248 | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; | 6121 | 248 | if ((tab->width == | 6122 | 248 | WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) && | 6123 | 248 | (tab->height == 1)) { | 6124 | 248 | return wuffs_base__make_slice_u8( | 6125 | 248 | tab->ptr, WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH); | 6126 | 248 | } | 6127 | 248 | } | 6128 | 1.52k | return fallback; | 6129 | 1.77k | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_buffer__palette_or_else webp_fuzzer.c:wuffs_base__pixel_buffer__palette_or_else Line | Count | Source | 6115 | 860 | wuffs_base__slice_u8 fallback) { | 6116 | 860 | if (pb && | 6117 | 860 | wuffs_base__pixel_format__is_indexed(&pb->pixcfg.private_impl.pixfmt)) { | 6118 | 0 | wuffs_base__table_u8* tab = | 6119 | 0 | &pb->private_impl | 6120 | 0 | .planes[WUFFS_BASE__PIXEL_FORMAT__INDEXED__COLOR_PLANE]; | 6121 | 0 | if ((tab->width == | 6122 | 0 | WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) && | 6123 | 0 | (tab->height == 1)) { | 6124 | 0 | return wuffs_base__make_slice_u8( | 6125 | 0 | tab->ptr, WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH); | 6126 | 0 | } | 6127 | 0 | } | 6128 | 860 | return fallback; | 6129 | 860 | } |
|
6130 | | |
6131 | | static inline wuffs_base__pixel_format // |
6132 | 408k | wuffs_base__pixel_buffer__pixel_format(const wuffs_base__pixel_buffer* pb) { |
6133 | 408k | if (pb) { |
6134 | 408k | return pb->pixcfg.private_impl.pixfmt; |
6135 | 408k | } |
6136 | 0 | return wuffs_base__make_pixel_format(WUFFS_BASE__PIXEL_FORMAT__INVALID); |
6137 | 408k | } png_fuzzer.c:wuffs_base__pixel_buffer__pixel_format Line | Count | Source | 6132 | 16.1k | wuffs_base__pixel_buffer__pixel_format(const wuffs_base__pixel_buffer* pb) { | 6133 | 16.1k | if (pb) { | 6134 | 16.1k | return pb->pixcfg.private_impl.pixfmt; | 6135 | 16.1k | } | 6136 | 0 | return wuffs_base__make_pixel_format(WUFFS_BASE__PIXEL_FORMAT__INVALID); | 6137 | 16.1k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_buffer__pixel_format(wuffs_base__pixel_buffer__struct const*) gif_fuzzer.c:wuffs_base__pixel_buffer__pixel_format Line | Count | Source | 6132 | 379k | wuffs_base__pixel_buffer__pixel_format(const wuffs_base__pixel_buffer* pb) { | 6133 | 379k | if (pb) { | 6134 | 379k | return pb->pixcfg.private_impl.pixfmt; | 6135 | 379k | } | 6136 | 0 | return wuffs_base__make_pixel_format(WUFFS_BASE__PIXEL_FORMAT__INVALID); | 6137 | 379k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_buffer__pixel_format jpeg_fuzzer.c:wuffs_base__pixel_buffer__pixel_format Line | Count | Source | 6132 | 4.74k | wuffs_base__pixel_buffer__pixel_format(const wuffs_base__pixel_buffer* pb) { | 6133 | 4.74k | if (pb) { | 6134 | 4.74k | return pb->pixcfg.private_impl.pixfmt; | 6135 | 4.74k | } | 6136 | 0 | return wuffs_base__make_pixel_format(WUFFS_BASE__PIXEL_FORMAT__INVALID); | 6137 | 4.74k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_buffer__pixel_format bmp_fuzzer.c:wuffs_base__pixel_buffer__pixel_format Line | Count | Source | 6132 | 3.25k | wuffs_base__pixel_buffer__pixel_format(const wuffs_base__pixel_buffer* pb) { | 6133 | 3.25k | if (pb) { | 6134 | 3.25k | return pb->pixcfg.private_impl.pixfmt; | 6135 | 3.25k | } | 6136 | 0 | return wuffs_base__make_pixel_format(WUFFS_BASE__PIXEL_FORMAT__INVALID); | 6137 | 3.25k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_buffer__pixel_format Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_buffer__pixel_format targa_fuzzer.c:wuffs_base__pixel_buffer__pixel_format Line | Count | Source | 6132 | 1.77k | wuffs_base__pixel_buffer__pixel_format(const wuffs_base__pixel_buffer* pb) { | 6133 | 1.77k | if (pb) { | 6134 | 1.77k | return pb->pixcfg.private_impl.pixfmt; | 6135 | 1.77k | } | 6136 | 0 | return wuffs_base__make_pixel_format(WUFFS_BASE__PIXEL_FORMAT__INVALID); | 6137 | 1.77k | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_buffer__pixel_format webp_fuzzer.c:wuffs_base__pixel_buffer__pixel_format Line | Count | Source | 6132 | 2.53k | wuffs_base__pixel_buffer__pixel_format(const wuffs_base__pixel_buffer* pb) { | 6133 | 2.53k | if (pb) { | 6134 | 2.53k | return pb->pixcfg.private_impl.pixfmt; | 6135 | 2.53k | } | 6136 | 0 | return wuffs_base__make_pixel_format(WUFFS_BASE__PIXEL_FORMAT__INVALID); | 6137 | 2.53k | } |
|
6138 | | |
6139 | | static inline wuffs_base__table_u8 // |
6140 | 135k | wuffs_base__pixel_buffer__plane(wuffs_base__pixel_buffer* pb, uint32_t p) { |
6141 | 135k | if (pb && (p < WUFFS_BASE__PIXEL_FORMAT__NUM_PLANES_MAX_INCL)) { |
6142 | 135k | return pb->private_impl.planes[p]; |
6143 | 135k | } |
6144 | | |
6145 | 0 | wuffs_base__table_u8 ret; |
6146 | 0 | ret.ptr = NULL; |
6147 | 0 | ret.width = 0; |
6148 | 0 | ret.height = 0; |
6149 | 0 | ret.stride = 0; |
6150 | 0 | return ret; |
6151 | 135k | } png_fuzzer.c:wuffs_base__pixel_buffer__plane Line | Count | Source | 6140 | 9.86k | wuffs_base__pixel_buffer__plane(wuffs_base__pixel_buffer* pb, uint32_t p) { | 6141 | 9.86k | if (pb && (p < WUFFS_BASE__PIXEL_FORMAT__NUM_PLANES_MAX_INCL)) { | 6142 | 9.86k | return pb->private_impl.planes[p]; | 6143 | 9.86k | } | 6144 | | | 6145 | 0 | wuffs_base__table_u8 ret; | 6146 | | ret.ptr = NULL; | 6147 | 0 | ret.width = 0; | 6148 | 0 | ret.height = 0; | 6149 | 0 | ret.stride = 0; | 6150 | 0 | return ret; | 6151 | 9.86k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_base__pixel_buffer__plane(wuffs_base__pixel_buffer__struct*, unsigned int) gif_fuzzer.c:wuffs_base__pixel_buffer__plane Line | Count | Source | 6140 | 120k | wuffs_base__pixel_buffer__plane(wuffs_base__pixel_buffer* pb, uint32_t p) { | 6141 | 120k | if (pb && (p < WUFFS_BASE__PIXEL_FORMAT__NUM_PLANES_MAX_INCL)) { | 6142 | 120k | return pb->private_impl.planes[p]; | 6143 | 120k | } | 6144 | | | 6145 | 0 | wuffs_base__table_u8 ret; | 6146 | | ret.ptr = NULL; | 6147 | 0 | ret.width = 0; | 6148 | 0 | ret.height = 0; | 6149 | 0 | ret.stride = 0; | 6150 | 0 | return ret; | 6151 | 120k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_base__pixel_buffer__plane jpeg_fuzzer.c:wuffs_base__pixel_buffer__plane Line | Count | Source | 6140 | 1.89k | wuffs_base__pixel_buffer__plane(wuffs_base__pixel_buffer* pb, uint32_t p) { | 6141 | 1.89k | if (pb && (p < WUFFS_BASE__PIXEL_FORMAT__NUM_PLANES_MAX_INCL)) { | 6142 | 1.89k | return pb->private_impl.planes[p]; | 6143 | 1.89k | } | 6144 | | | 6145 | 0 | wuffs_base__table_u8 ret; | 6146 | | ret.ptr = NULL; | 6147 | 0 | ret.width = 0; | 6148 | 0 | ret.height = 0; | 6149 | 0 | ret.stride = 0; | 6150 | 0 | return ret; | 6151 | 1.89k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__pixel_buffer__plane bmp_fuzzer.c:wuffs_base__pixel_buffer__plane Line | Count | Source | 6140 | 1.61k | wuffs_base__pixel_buffer__plane(wuffs_base__pixel_buffer* pb, uint32_t p) { | 6141 | 1.61k | if (pb && (p < WUFFS_BASE__PIXEL_FORMAT__NUM_PLANES_MAX_INCL)) { | 6142 | 1.61k | return pb->private_impl.planes[p]; | 6143 | 1.61k | } | 6144 | | | 6145 | 0 | wuffs_base__table_u8 ret; | 6146 | | ret.ptr = NULL; | 6147 | 0 | ret.width = 0; | 6148 | 0 | ret.height = 0; | 6149 | 0 | ret.stride = 0; | 6150 | 0 | return ret; | 6151 | 1.61k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__pixel_buffer__plane Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__pixel_buffer__plane targa_fuzzer.c:wuffs_base__pixel_buffer__plane Line | Count | Source | 6140 | 883 | wuffs_base__pixel_buffer__plane(wuffs_base__pixel_buffer* pb, uint32_t p) { | 6141 | 883 | if (pb && (p < WUFFS_BASE__PIXEL_FORMAT__NUM_PLANES_MAX_INCL)) { | 6142 | 883 | return pb->private_impl.planes[p]; | 6143 | 883 | } | 6144 | | | 6145 | 0 | wuffs_base__table_u8 ret; | 6146 | | ret.ptr = NULL; | 6147 | 0 | ret.width = 0; | 6148 | 0 | ret.height = 0; | 6149 | 0 | ret.stride = 0; | 6150 | 0 | return ret; | 6151 | 883 | } |
Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__pixel_buffer__plane webp_fuzzer.c:wuffs_base__pixel_buffer__plane Line | Count | Source | 6140 | 430 | wuffs_base__pixel_buffer__plane(wuffs_base__pixel_buffer* pb, uint32_t p) { | 6141 | 430 | if (pb && (p < WUFFS_BASE__PIXEL_FORMAT__NUM_PLANES_MAX_INCL)) { | 6142 | 430 | return pb->private_impl.planes[p]; | 6143 | 430 | } | 6144 | | | 6145 | 0 | wuffs_base__table_u8 ret; | 6146 | | ret.ptr = NULL; | 6147 | 0 | ret.width = 0; | 6148 | 0 | ret.height = 0; | 6149 | 0 | ret.stride = 0; | 6150 | 0 | return ret; | 6151 | 430 | } |
|
6152 | | |
6153 | | // Deprecated: use the second name, not the first. |
6154 | | #define wuffs_base__pixel_buffer__color_u32_at \ |
6155 | | wuffs_base__pixel_buffer__color_u32_argb_premul_at |
6156 | | |
6157 | | // Deprecated: use the second name, not the first. |
6158 | | #define wuffs_base__pixel_buffer__set_color_u32_at \ |
6159 | | wuffs_base__pixel_buffer__set_color_u32_argb_premul_at |
6160 | | |
6161 | | // Deprecated: use the second name, not the first. |
6162 | | #define wuffs_base__pixel_buffer__set_color_u32_fill_rect \ |
6163 | | wuffs_base__pixel_buffer__set_color_u32_argb_premul_fill_rect |
6164 | | |
6165 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__color_u32_argb_premul // |
6166 | | wuffs_base__pixel_buffer__color_u32_argb_premul_at( |
6167 | | const wuffs_base__pixel_buffer* pb, |
6168 | | uint32_t x, |
6169 | | uint32_t y); |
6170 | | |
6171 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status // |
6172 | | wuffs_base__pixel_buffer__set_color_u32_argb_premul_at( |
6173 | | wuffs_base__pixel_buffer* pb, |
6174 | | uint32_t x, |
6175 | | uint32_t y, |
6176 | | wuffs_base__color_u32_argb_premul color); |
6177 | | |
6178 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status // |
6179 | | wuffs_base__pixel_buffer__set_color_u32_argb_premul_fill_rect( |
6180 | | wuffs_base__pixel_buffer* pb, |
6181 | | wuffs_base__rect_ie_u32 rect, |
6182 | | wuffs_base__color_u32_argb_premul color); |
6183 | | |
6184 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status // |
6185 | | wuffs_base__pixel_buffer__set_color_u32_argb_nonpremul_at( |
6186 | | wuffs_base__pixel_buffer* pb, |
6187 | | uint32_t x, |
6188 | | uint32_t y, |
6189 | | wuffs_base__color_u32_argb_nonpremul color); |
6190 | | |
6191 | | WUFFS_BASE__MAYBE_STATIC bool // |
6192 | | wuffs_base__pixel_buffer__is_opaque(const wuffs_base__pixel_buffer* pb); |
6193 | | |
6194 | | #ifdef __cplusplus |
6195 | | |
6196 | | inline wuffs_base__status // |
6197 | | wuffs_base__pixel_buffer::set_interleaved( |
6198 | | const wuffs_base__pixel_config* pixcfg_arg, |
6199 | | wuffs_base__table_u8 primary_memory, |
6200 | 0 | wuffs_base__slice_u8 palette_memory) { |
6201 | 0 | return wuffs_base__pixel_buffer__set_interleaved( |
6202 | 0 | this, pixcfg_arg, primary_memory, palette_memory); |
6203 | 0 | } |
6204 | | |
6205 | | inline wuffs_base__status // |
6206 | | wuffs_base__pixel_buffer::set_from_slice( |
6207 | | const wuffs_base__pixel_config* pixcfg_arg, |
6208 | 0 | wuffs_base__slice_u8 pixbuf_memory) { |
6209 | 0 | return wuffs_base__pixel_buffer__set_from_slice(this, pixcfg_arg, |
6210 | 0 | pixbuf_memory); |
6211 | 0 | } |
6212 | | |
6213 | | inline wuffs_base__slice_u8 // |
6214 | 0 | wuffs_base__pixel_buffer::palette() { |
6215 | 0 | return wuffs_base__pixel_buffer__palette(this); |
6216 | 0 | } |
6217 | | |
6218 | | inline wuffs_base__slice_u8 // |
6219 | 0 | wuffs_base__pixel_buffer::palette_or_else(wuffs_base__slice_u8 fallback) { |
6220 | 0 | return wuffs_base__pixel_buffer__palette_or_else(this, fallback); |
6221 | 0 | } |
6222 | | |
6223 | | inline wuffs_base__pixel_format // |
6224 | 0 | wuffs_base__pixel_buffer::pixel_format() const { |
6225 | 0 | return wuffs_base__pixel_buffer__pixel_format(this); |
6226 | 0 | } |
6227 | | |
6228 | | inline wuffs_base__table_u8 // |
6229 | 0 | wuffs_base__pixel_buffer::plane(uint32_t p) { |
6230 | 0 | return wuffs_base__pixel_buffer__plane(this, p); |
6231 | 0 | } |
6232 | | |
6233 | | inline wuffs_base__color_u32_argb_premul // |
6234 | 0 | wuffs_base__pixel_buffer::color_u32_at(uint32_t x, uint32_t y) const { |
6235 | 0 | return wuffs_base__pixel_buffer__color_u32_argb_premul_at(this, x, y); |
6236 | 0 | } |
6237 | | |
6238 | | inline wuffs_base__color_u32_argb_premul // |
6239 | | wuffs_base__pixel_buffer::color_u32_argb_premul_at(uint32_t x, |
6240 | 0 | uint32_t y) const { |
6241 | 0 | return wuffs_base__pixel_buffer__color_u32_argb_premul_at(this, x, y); |
6242 | 0 | } |
6243 | | |
6244 | | inline wuffs_base__status // |
6245 | | wuffs_base__pixel_buffer::set_color_u32_at( |
6246 | | uint32_t x, |
6247 | | uint32_t y, |
6248 | 0 | wuffs_base__color_u32_argb_premul color) { |
6249 | 0 | return wuffs_base__pixel_buffer__set_color_u32_argb_premul_at(this, x, y, |
6250 | 0 | color); |
6251 | 0 | } |
6252 | | |
6253 | | inline wuffs_base__status // |
6254 | | wuffs_base__pixel_buffer::set_color_u32_argb_premul_at( |
6255 | | uint32_t x, |
6256 | | uint32_t y, |
6257 | 0 | wuffs_base__color_u32_argb_premul color) { |
6258 | 0 | return wuffs_base__pixel_buffer__set_color_u32_argb_premul_at(this, x, y, |
6259 | 0 | color); |
6260 | 0 | } |
6261 | | |
6262 | | inline wuffs_base__status // |
6263 | | wuffs_base__pixel_buffer::set_color_u32_fill_rect( |
6264 | | wuffs_base__rect_ie_u32 rect, |
6265 | 0 | wuffs_base__color_u32_argb_premul color) { |
6266 | 0 | return wuffs_base__pixel_buffer__set_color_u32_argb_premul_fill_rect( |
6267 | 0 | this, rect, color); |
6268 | 0 | } |
6269 | | |
6270 | | inline wuffs_base__status // |
6271 | | wuffs_base__pixel_buffer::set_color_u32_argb_premul_fill_rect( |
6272 | | wuffs_base__rect_ie_u32 rect, |
6273 | 0 | wuffs_base__color_u32_argb_premul color) { |
6274 | 0 | return wuffs_base__pixel_buffer__set_color_u32_argb_premul_fill_rect( |
6275 | 0 | this, rect, color); |
6276 | 0 | } |
6277 | | |
6278 | | inline wuffs_base__status // |
6279 | | wuffs_base__pixel_buffer::set_color_u32_argb_nonpremul_at( |
6280 | | uint32_t x, |
6281 | | uint32_t y, |
6282 | 0 | wuffs_base__color_u32_argb_nonpremul color) { |
6283 | 0 | return wuffs_base__pixel_buffer__set_color_u32_argb_nonpremul_at(this, x, y, |
6284 | 0 | color); |
6285 | 0 | } |
6286 | | |
6287 | | inline bool // |
6288 | 0 | wuffs_base__pixel_buffer::is_opaque() { |
6289 | 0 | return wuffs_base__pixel_buffer__is_opaque(this); |
6290 | 0 | } |
6291 | | |
6292 | | #endif // __cplusplus |
6293 | | |
6294 | | // -------- |
6295 | | |
6296 | | typedef struct wuffs_base__decode_frame_options__struct { |
6297 | | // Do not access the private_impl's fields directly. There is no API/ABI |
6298 | | // compatibility or safety guarantee if you do so. |
6299 | | struct { |
6300 | | uint8_t TODO; |
6301 | | } private_impl; |
6302 | | |
6303 | | #ifdef __cplusplus |
6304 | | #endif // __cplusplus |
6305 | | |
6306 | | } wuffs_base__decode_frame_options; |
6307 | | |
6308 | | #ifdef __cplusplus |
6309 | | |
6310 | | #endif // __cplusplus |
6311 | | |
6312 | | // -------- |
6313 | | |
6314 | | // wuffs_base__pixel_palette__closest_element returns the index of the palette |
6315 | | // element that minimizes the sum of squared differences of the four ARGB |
6316 | | // channels, working in premultiplied alpha. Ties favor the smaller index. |
6317 | | // |
6318 | | // The palette_slice.len may equal (N*4), for N less than 256, which means that |
6319 | | // only the first N palette elements are considered. It returns 0 when N is 0. |
6320 | | // |
6321 | | // Applying this function on a per-pixel basis will not produce whole-of-image |
6322 | | // dithering. |
6323 | | WUFFS_BASE__MAYBE_STATIC uint8_t // |
6324 | | wuffs_base__pixel_palette__closest_element( |
6325 | | wuffs_base__slice_u8 palette_slice, |
6326 | | wuffs_base__pixel_format palette_format, |
6327 | | wuffs_base__color_u32_argb_premul c); |
6328 | | |
6329 | | // -------- |
6330 | | |
6331 | | // TODO: should the func type take restrict pointers? |
6332 | | typedef uint64_t (*wuffs_base__pixel_swizzler__func)(uint8_t* dst_ptr, |
6333 | | size_t dst_len, |
6334 | | uint8_t* dst_palette_ptr, |
6335 | | size_t dst_palette_len, |
6336 | | const uint8_t* src_ptr, |
6337 | | size_t src_len); |
6338 | | |
6339 | | typedef uint64_t (*wuffs_base__pixel_swizzler__transparent_black_func)( |
6340 | | uint8_t* dst_ptr, |
6341 | | size_t dst_len, |
6342 | | uint8_t* dst_palette_ptr, |
6343 | | size_t dst_palette_len, |
6344 | | uint64_t num_pixels, |
6345 | | uint32_t dst_pixfmt_bytes_per_pixel); |
6346 | | |
6347 | | typedef struct wuffs_base__pixel_swizzler__struct { |
6348 | | // Do not access the private_impl's fields directly. There is no API/ABI |
6349 | | // compatibility or safety guarantee if you do so. |
6350 | | struct { |
6351 | | wuffs_base__pixel_swizzler__func func; |
6352 | | wuffs_base__pixel_swizzler__transparent_black_func transparent_black_func; |
6353 | | uint32_t dst_pixfmt_bytes_per_pixel; |
6354 | | uint32_t src_pixfmt_bytes_per_pixel; |
6355 | | } private_impl; |
6356 | | |
6357 | | #ifdef __cplusplus |
6358 | | inline wuffs_base__status prepare(wuffs_base__pixel_format dst_pixfmt, |
6359 | | wuffs_base__slice_u8 dst_palette, |
6360 | | wuffs_base__pixel_format src_pixfmt, |
6361 | | wuffs_base__slice_u8 src_palette, |
6362 | | wuffs_base__pixel_blend blend); |
6363 | | inline uint64_t swizzle_interleaved_from_slice( |
6364 | | wuffs_base__slice_u8 dst, |
6365 | | wuffs_base__slice_u8 dst_palette, |
6366 | | wuffs_base__slice_u8 src) const; |
6367 | | #endif // __cplusplus |
6368 | | |
6369 | | } wuffs_base__pixel_swizzler; |
6370 | | |
6371 | | // wuffs_base__pixel_swizzler__prepare readies the pixel swizzler so that its |
6372 | | // other methods may be called. |
6373 | | // |
6374 | | // For modular builds that divide the base module into sub-modules, using this |
6375 | | // function requires the WUFFS_CONFIG__MODULE__BASE__PIXCONV sub-module, not |
6376 | | // just WUFFS_CONFIG__MODULE__BASE__CORE. |
6377 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status // |
6378 | | wuffs_base__pixel_swizzler__prepare(wuffs_base__pixel_swizzler* p, |
6379 | | wuffs_base__pixel_format dst_pixfmt, |
6380 | | wuffs_base__slice_u8 dst_palette, |
6381 | | wuffs_base__pixel_format src_pixfmt, |
6382 | | wuffs_base__slice_u8 src_palette, |
6383 | | wuffs_base__pixel_blend blend); |
6384 | | |
6385 | | // wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice converts pixels |
6386 | | // from a source format to a destination format. |
6387 | | // |
6388 | | // For modular builds that divide the base module into sub-modules, using this |
6389 | | // function requires the WUFFS_CONFIG__MODULE__BASE__PIXCONV sub-module, not |
6390 | | // just WUFFS_CONFIG__MODULE__BASE__CORE. |
6391 | | WUFFS_BASE__MAYBE_STATIC uint64_t // |
6392 | | wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice( |
6393 | | const wuffs_base__pixel_swizzler* p, |
6394 | | wuffs_base__slice_u8 dst, |
6395 | | wuffs_base__slice_u8 dst_palette, |
6396 | | wuffs_base__slice_u8 src); |
6397 | | |
6398 | | #ifdef __cplusplus |
6399 | | |
6400 | | inline wuffs_base__status // |
6401 | | wuffs_base__pixel_swizzler::prepare(wuffs_base__pixel_format dst_pixfmt, |
6402 | | wuffs_base__slice_u8 dst_palette, |
6403 | | wuffs_base__pixel_format src_pixfmt, |
6404 | | wuffs_base__slice_u8 src_palette, |
6405 | 0 | wuffs_base__pixel_blend blend) { |
6406 | 0 | return wuffs_base__pixel_swizzler__prepare(this, dst_pixfmt, dst_palette, |
6407 | 0 | src_pixfmt, src_palette, blend); |
6408 | 0 | } |
6409 | | |
6410 | | uint64_t // |
6411 | | wuffs_base__pixel_swizzler::swizzle_interleaved_from_slice( |
6412 | | wuffs_base__slice_u8 dst, |
6413 | | wuffs_base__slice_u8 dst_palette, |
6414 | 0 | wuffs_base__slice_u8 src) const { |
6415 | 0 | return wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice( |
6416 | 0 | this, dst, dst_palette, src); |
6417 | 0 | } |
6418 | | |
6419 | | #endif // __cplusplus |
6420 | | |
6421 | | // ---------------- String Conversions |
6422 | | |
6423 | | // Options (bitwise or'ed together) for wuffs_base__parse_number_xxx |
6424 | | // functions. The XXX options apply to both integer and floating point. The FXX |
6425 | | // options apply only to floating point. |
6426 | | |
6427 | 1.16M | #define WUFFS_BASE__PARSE_NUMBER_XXX__DEFAULT_OPTIONS ((uint32_t)0x00000000) |
6428 | | |
6429 | | // WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES means to accept |
6430 | | // inputs like "00", "0644" and "00.7". By default, they are rejected. |
6431 | | #define WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES \ |
6432 | 2.21k | ((uint32_t)0x00000001) |
6433 | | |
6434 | | // WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES means to accept inputs like |
6435 | | // "1__2" and "_3.141_592". By default, they are rejected. |
6436 | 2.25M | #define WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES ((uint32_t)0x00000002) |
6437 | | |
6438 | | // WUFFS_BASE__PARSE_NUMBER_FXX__DECIMAL_SEPARATOR_IS_A_COMMA means to accept |
6439 | | // "1,5" and not "1.5" as one-and-a-half. |
6440 | | // |
6441 | | // If the caller wants to accept either, it is responsible for canonicalizing |
6442 | | // the input before calling wuffs_base__parse_number_fxx. The caller also has |
6443 | | // more context on e.g. exactly how to treat something like "$1,234". |
6444 | | #define WUFFS_BASE__PARSE_NUMBER_FXX__DECIMAL_SEPARATOR_IS_A_COMMA \ |
6445 | 63.1k | ((uint32_t)0x00000010) |
6446 | | |
6447 | | // WUFFS_BASE__PARSE_NUMBER_FXX__REJECT_INF_AND_NAN means to reject inputs that |
6448 | | // would lead to infinite or Not-a-Number floating point values. By default, |
6449 | | // they are accepted. |
6450 | | // |
6451 | | // This affects the literal "inf" as input, but also affects inputs like |
6452 | | // "1e999" that would overflow double-precision floating point. |
6453 | 3.56k | #define WUFFS_BASE__PARSE_NUMBER_FXX__REJECT_INF_AND_NAN ((uint32_t)0x00000020) |
6454 | | |
6455 | | // -------- |
6456 | | |
6457 | | // Options (bitwise or'ed together) for wuffs_base__render_number_xxx |
6458 | | // functions. The XXX options apply to both integer and floating point. The FXX |
6459 | | // options apply only to floating point. |
6460 | | |
6461 | | #define WUFFS_BASE__RENDER_NUMBER_XXX__DEFAULT_OPTIONS ((uint32_t)0x00000000) |
6462 | | |
6463 | | // WUFFS_BASE__RENDER_NUMBER_XXX__ALIGN_RIGHT means to render to the right side |
6464 | | // (higher indexes) of the destination slice, leaving any untouched bytes on |
6465 | | // the left side (lower indexes). The default is vice versa: rendering on the |
6466 | | // left with slack on the right. |
6467 | 0 | #define WUFFS_BASE__RENDER_NUMBER_XXX__ALIGN_RIGHT ((uint32_t)0x00000100) |
6468 | | |
6469 | | // WUFFS_BASE__RENDER_NUMBER_XXX__LEADING_PLUS_SIGN means to render the leading |
6470 | | // "+" for non-negative numbers: "+0" and "+12.3" instead of "0" and "12.3". |
6471 | 0 | #define WUFFS_BASE__RENDER_NUMBER_XXX__LEADING_PLUS_SIGN ((uint32_t)0x00000200) |
6472 | | |
6473 | | // WUFFS_BASE__RENDER_NUMBER_FXX__DECIMAL_SEPARATOR_IS_A_COMMA means to render |
6474 | | // one-and-a-half as "1,5" instead of "1.5". |
6475 | | #define WUFFS_BASE__RENDER_NUMBER_FXX__DECIMAL_SEPARATOR_IS_A_COMMA \ |
6476 | 0 | ((uint32_t)0x00001000) |
6477 | | |
6478 | | // WUFFS_BASE__RENDER_NUMBER_FXX__EXPONENT_ETC means whether to never |
6479 | | // (EXPONENT_ABSENT, equivalent to printf's "%f") or to always |
6480 | | // (EXPONENT_PRESENT, equivalent to printf's "%e") render a floating point |
6481 | | // number as "1.23e+05" instead of "123000". |
6482 | | // |
6483 | | // Having both bits set is the same has having neither bit set, where the |
6484 | | // notation used depends on whether the exponent is sufficiently large: "0.5" |
6485 | | // is preferred over "5e-01" but "5e-09" is preferred over "0.000000005". |
6486 | 0 | #define WUFFS_BASE__RENDER_NUMBER_FXX__EXPONENT_ABSENT ((uint32_t)0x00002000) |
6487 | 0 | #define WUFFS_BASE__RENDER_NUMBER_FXX__EXPONENT_PRESENT ((uint32_t)0x00004000) |
6488 | | |
6489 | | // WUFFS_BASE__RENDER_NUMBER_FXX__JUST_ENOUGH_PRECISION means to render the |
6490 | | // smallest number of digits so that parsing the resultant string will recover |
6491 | | // the same double-precision floating point number. |
6492 | | // |
6493 | | // For example, double-precision cannot distinguish between 0.3 and |
6494 | | // 0.299999999999999988897769753748434595763683319091796875, so when this bit |
6495 | | // is set, rendering the latter will produce "0.3" but rendering |
6496 | | // 0.3000000000000000444089209850062616169452667236328125 will produce |
6497 | | // "0.30000000000000004". |
6498 | | #define WUFFS_BASE__RENDER_NUMBER_FXX__JUST_ENOUGH_PRECISION \ |
6499 | 0 | ((uint32_t)0x00008000) |
6500 | | |
6501 | | // ---------------- IEEE 754 Floating Point |
6502 | | |
6503 | | // wuffs_base__ieee_754_bit_representation__etc converts between a double |
6504 | | // precision numerical value and its IEEE 754 representations: |
6505 | | // - 16-bit: 1 sign bit, 5 exponent bits, 10 explicit significand bits. |
6506 | | // - 32-bit: 1 sign bit, 8 exponent bits, 23 explicit significand bits. |
6507 | | // - 64-bit: 1 sign bit, 11 exponent bits, 52 explicit significand bits. |
6508 | | // |
6509 | | // For example, it converts between: |
6510 | | // - +1.0 and 0x3C00, 0x3F80_0000 or 0x3FF0_0000_0000_0000. |
6511 | | // - +5.5 and 0x4580, 0x40B0_0000 or 0x4016_0000_0000_0000. |
6512 | | // - -inf and 0xFC00, 0xFF80_0000 or 0xFFF0_0000_0000_0000. |
6513 | | // |
6514 | | // Converting from f64 to shorter formats (f16 or f32, represented in C as |
6515 | | // uint16_t and uint32_t) may be lossy. Such functions have names that look |
6516 | | // like etc_truncate, as converting finite numbers produce equal or smaller |
6517 | | // (closer-to-zero) finite numbers. For example, 1048576.0 is a perfectly valid |
6518 | | // f64 number, but converting it to a f16 (with truncation) produces 65504.0, |
6519 | | // the largest finite f16 number. Truncating a f64-typed value d to f32 does |
6520 | | // not always produce the same result as the C-style cast ((float)d), as |
6521 | | // casting can convert from finite numbers to infinite ones. |
6522 | | // |
6523 | | // Converting infinities or NaNs produces infinities or NaNs and always report |
6524 | | // no loss, even though there a multiple NaN representations so that round- |
6525 | | // tripping a f64-typed NaN may produce a different 64 bits. Nonetheless, the |
6526 | | // etc_truncate functions preserve a NaN's "quiet vs signaling" bit. |
6527 | | // |
6528 | | // See https://en.wikipedia.org/wiki/Double-precision_floating-point_format |
6529 | | |
6530 | | typedef struct wuffs_base__lossy_value_u16__struct { |
6531 | | uint16_t value; |
6532 | | bool lossy; |
6533 | | } wuffs_base__lossy_value_u16; |
6534 | | |
6535 | | typedef struct wuffs_base__lossy_value_u32__struct { |
6536 | | uint32_t value; |
6537 | | bool lossy; |
6538 | | } wuffs_base__lossy_value_u32; |
6539 | | |
6540 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__lossy_value_u16 // |
6541 | | wuffs_base__ieee_754_bit_representation__from_f64_to_u16_truncate(double f); |
6542 | | |
6543 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__lossy_value_u32 // |
6544 | | wuffs_base__ieee_754_bit_representation__from_f64_to_u32_truncate(double f); |
6545 | | |
6546 | | static inline uint64_t // |
6547 | 0 | wuffs_base__ieee_754_bit_representation__from_f64_to_u64(double f) { |
6548 | 0 | uint64_t u = 0; |
6549 | 0 | if (sizeof(uint64_t) == sizeof(double)) { |
6550 | 0 | memcpy(&u, &f, sizeof(uint64_t)); |
6551 | 0 | } |
6552 | 0 | return u; |
6553 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_f64_to_u64 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__ieee_754_bit_representation__from_f64_to_u64(double) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_f64_to_u64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_f64_to_u64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_f64_to_u64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_f64_to_u64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_f64_to_u64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_f64_to_u64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_f64_to_u64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_f64_to_u64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_f64_to_u64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_f64_to_u64 |
6554 | | |
6555 | | static inline double // |
6556 | 0 | wuffs_base__ieee_754_bit_representation__from_u16_to_f64(uint16_t u) { |
6557 | 0 | uint64_t v = ((uint64_t)(u & 0x8000)) << 48; |
6558 | 0 |
|
6559 | 0 | do { |
6560 | 0 | uint64_t exp = (u >> 10) & 0x1F; |
6561 | 0 | uint64_t man = u & 0x3FF; |
6562 | 0 | if (exp == 0x1F) { // Infinity or NaN. |
6563 | 0 | exp = 2047; |
6564 | 0 | } else if (exp != 0) { // Normal. |
6565 | 0 | exp += 1008; // 1008 = 1023 - 15, the difference in biases. |
6566 | 0 | } else if (man != 0) { // Subnormal but non-zero. |
6567 | 0 | uint32_t clz = wuffs_base__count_leading_zeroes_u64(man); |
6568 | 0 | exp = 1062 - clz; // 1062 = 1008 + 64 - 10. |
6569 | 0 | man = 0x3FF & (man << (clz - 53)); |
6570 | 0 | } else { // Zero. |
6571 | 0 | break; |
6572 | 0 | } |
6573 | 0 | v |= (exp << 52) | (man << 42); |
6574 | 0 | } while (0); |
6575 | 0 |
|
6576 | 0 | double f = 0; |
6577 | 0 | if (sizeof(uint64_t) == sizeof(double)) { |
6578 | 0 | memcpy(&f, &v, sizeof(uint64_t)); |
6579 | 0 | } |
6580 | 0 | return f; |
6581 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u16_to_f64 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__ieee_754_bit_representation__from_u16_to_f64(unsigned short) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u16_to_f64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u16_to_f64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u16_to_f64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u16_to_f64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u16_to_f64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u16_to_f64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u16_to_f64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u16_to_f64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u16_to_f64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u16_to_f64 |
6582 | | |
6583 | | static inline double // |
6584 | 0 | wuffs_base__ieee_754_bit_representation__from_u32_to_f64(uint32_t u) { |
6585 | 0 | float f = 0; |
6586 | 0 | if (sizeof(uint32_t) == sizeof(float)) { |
6587 | 0 | memcpy(&f, &u, sizeof(uint32_t)); |
6588 | 0 | } |
6589 | 0 | return (double)f; |
6590 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u32_to_f64 Unexecuted instantiation: json_fuzzer.cc:wuffs_base__ieee_754_bit_representation__from_u32_to_f64(unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u32_to_f64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u32_to_f64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u32_to_f64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u32_to_f64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u32_to_f64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u32_to_f64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u32_to_f64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u32_to_f64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u32_to_f64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u32_to_f64 |
6591 | | |
6592 | | static inline double // |
6593 | 50.4k | wuffs_base__ieee_754_bit_representation__from_u64_to_f64(uint64_t u) { |
6594 | 50.4k | double f = 0; |
6595 | 50.4k | if (sizeof(uint64_t) == sizeof(double)) { |
6596 | 50.4k | memcpy(&f, &u, sizeof(uint64_t)); |
6597 | 50.4k | } |
6598 | 50.4k | return f; |
6599 | 50.4k | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u64_to_f64 json_fuzzer.cc:wuffs_base__ieee_754_bit_representation__from_u64_to_f64(unsigned long) Line | Count | Source | 6593 | 50.4k | wuffs_base__ieee_754_bit_representation__from_u64_to_f64(uint64_t u) { | 6594 | 50.4k | double f = 0; | 6595 | 50.4k | if (sizeof(uint64_t) == sizeof(double)) { | 6596 | 50.4k | memcpy(&f, &u, sizeof(uint64_t)); | 6597 | 50.4k | } | 6598 | 50.4k | return f; | 6599 | 50.4k | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u64_to_f64 Unexecuted instantiation: xz_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u64_to_f64 Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u64_to_f64 Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u64_to_f64 Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u64_to_f64 Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u64_to_f64 Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u64_to_f64 Unexecuted instantiation: targa_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u64_to_f64 Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u64_to_f64 Unexecuted instantiation: webp_fuzzer.c:wuffs_base__ieee_754_bit_representation__from_u64_to_f64 |
6600 | | |
6601 | | // ---------------- Parsing and Rendering Numbers |
6602 | | |
6603 | | // wuffs_base__parse_number_f64 parses the floating point number in s. For |
6604 | | // example, if s contains the bytes "1.5" then it will return the double 1.5. |
6605 | | // |
6606 | | // It returns an error if s does not contain a floating point number. |
6607 | | // |
6608 | | // It does not necessarily return an error if the conversion is lossy, e.g. if |
6609 | | // s is "0.3", which double-precision floating point cannot represent exactly. |
6610 | | // |
6611 | | // Similarly, the returned value may be infinite (and no error returned) even |
6612 | | // if s was not "inf", when the input is nominally finite but sufficiently |
6613 | | // larger than DBL_MAX, about 1.8e+308. |
6614 | | // |
6615 | | // It is similar to the C standard library's strtod function, but: |
6616 | | // - Errors are returned in-band (in a result type), not out-of-band (errno). |
6617 | | // - It takes a slice (a pointer and length), not a NUL-terminated C string. |
6618 | | // - It does not take an optional endptr argument. It does not allow a partial |
6619 | | // parse: it returns an error unless all of s is consumed. |
6620 | | // - It does not allow whitespace, leading or otherwise. |
6621 | | // - It does not allow hexadecimal floating point numbers. |
6622 | | // - It is not affected by i18n / l10n settings such as environment variables. |
6623 | | // |
6624 | | // The options argument can change these, but by default, it: |
6625 | | // - Allows "inf", "+Infinity" and "-NAN", case insensitive. Similarly, |
6626 | | // without an explicit opt-out, it would successfully parse "1e999" as |
6627 | | // infinity, even though it overflows double-precision floating point. |
6628 | | // - Rejects underscores. With an explicit opt-in, "_3.141_592" would |
6629 | | // successfully parse as an approximation to ฯ. |
6630 | | // - Rejects unnecessary leading zeroes: "00", "0644" and "00.7". |
6631 | | // - Uses a dot '1.5' instead of a comma '1,5' for the decimal separator. |
6632 | | // |
6633 | | // For modular builds that divide the base module into sub-modules, using this |
6634 | | // function requires the WUFFS_CONFIG__MODULE__BASE__FLOATCONV sub-module, not |
6635 | | // just WUFFS_CONFIG__MODULE__BASE__CORE. |
6636 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__result_f64 // |
6637 | | wuffs_base__parse_number_f64(wuffs_base__slice_u8 s, uint32_t options); |
6638 | | |
6639 | | // wuffs_base__parse_number_i64 parses the ASCII integer in s. For example, if |
6640 | | // s contains the bytes "-123" then it will return the int64_t -123. |
6641 | | // |
6642 | | // It returns an error if s does not contain an integer or if the integer |
6643 | | // within would overflow an int64_t. |
6644 | | // |
6645 | | // It is similar to wuffs_base__parse_number_u64 but it returns a signed |
6646 | | // integer, not an unsigned integer. It also allows a leading '+' or '-'. |
6647 | | // |
6648 | | // For modular builds that divide the base module into sub-modules, using this |
6649 | | // function requires the WUFFS_CONFIG__MODULE__BASE__INTCONV sub-module, not |
6650 | | // just WUFFS_CONFIG__MODULE__BASE__CORE. |
6651 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__result_i64 // |
6652 | | wuffs_base__parse_number_i64(wuffs_base__slice_u8 s, uint32_t options); |
6653 | | |
6654 | | // wuffs_base__parse_number_u64 parses the ASCII integer in s. For example, if |
6655 | | // s contains the bytes "123" then it will return the uint64_t 123. |
6656 | | // |
6657 | | // It returns an error if s does not contain an integer or if the integer |
6658 | | // within would overflow a uint64_t. |
6659 | | // |
6660 | | // It is similar to the C standard library's strtoull function, but: |
6661 | | // - Errors are returned in-band (in a result type), not out-of-band (errno). |
6662 | | // - It takes a slice (a pointer and length), not a NUL-terminated C string. |
6663 | | // - It does not take an optional endptr argument. It does not allow a partial |
6664 | | // parse: it returns an error unless all of s is consumed. |
6665 | | // - It does not allow whitespace, leading or otherwise. |
6666 | | // - It does not allow a leading '+' or '-'. |
6667 | | // - It does not take a base argument (e.g. base 10 vs base 16). Instead, it |
6668 | | // always accepts both decimal (e.g "1234", "0d5678") and hexadecimal (e.g. |
6669 | | // "0x9aBC"). The caller is responsible for prior filtering of e.g. hex |
6670 | | // numbers if they are unwanted. For example, Wuffs' JSON decoder will only |
6671 | | // produce a wuffs_base__token for decimal numbers, not hexadecimal. |
6672 | | // - It is not affected by i18n / l10n settings such as environment variables. |
6673 | | // |
6674 | | // The options argument can change these, but by default, it: |
6675 | | // - Rejects underscores. With an explicit opt-in, "__0D_1_002" would |
6676 | | // successfully parse as "one thousand and two". Underscores are still |
6677 | | // rejected inside the optional 2-byte opening "0d" or "0X" that denotes |
6678 | | // base-10 or base-16. |
6679 | | // - Rejects unnecessary leading zeroes: "00" and "0644". |
6680 | | // |
6681 | | // For modular builds that divide the base module into sub-modules, using this |
6682 | | // function requires the WUFFS_CONFIG__MODULE__BASE__INTCONV sub-module, not |
6683 | | // just WUFFS_CONFIG__MODULE__BASE__CORE. |
6684 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__result_u64 // |
6685 | | wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options); |
6686 | | |
6687 | | // -------- |
6688 | | |
6689 | | // WUFFS_BASE__I64__BYTE_LENGTH__MAX_INCL is the string length of |
6690 | | // "-9223372036854775808" and "+9223372036854775807", INT64_MIN and INT64_MAX. |
6691 | | #define WUFFS_BASE__I64__BYTE_LENGTH__MAX_INCL 20 |
6692 | | |
6693 | | // WUFFS_BASE__U64__BYTE_LENGTH__MAX_INCL is the string length of |
6694 | | // "+18446744073709551615", UINT64_MAX. |
6695 | | #define WUFFS_BASE__U64__BYTE_LENGTH__MAX_INCL 21 |
6696 | | |
6697 | | // wuffs_base__render_number_f64 writes the decimal encoding of x to dst and |
6698 | | // returns the number of bytes written. If dst is shorter than the entire |
6699 | | // encoding, it returns 0 (and no bytes are written). |
6700 | | // |
6701 | | // For those familiar with C's printf or Go's fmt.Printf functions: |
6702 | | // - "%e" means the WUFFS_BASE__RENDER_NUMBER_FXX__EXPONENT_PRESENT option. |
6703 | | // - "%f" means the WUFFS_BASE__RENDER_NUMBER_FXX__EXPONENT_ABSENT option. |
6704 | | // - "%g" means neither or both bits are set. |
6705 | | // |
6706 | | // The precision argument controls the number of digits rendered, excluding the |
6707 | | // exponent (the "e+05" in "1.23e+05"): |
6708 | | // - for "%e" and "%f" it is the number of digits after the decimal separator, |
6709 | | // - for "%g" it is the number of significant digits (and trailing zeroes are |
6710 | | // removed). |
6711 | | // |
6712 | | // A precision of 6 gives similar output to printf's defaults. |
6713 | | // |
6714 | | // A precision greater than 4095 is equivalent to 4095. |
6715 | | // |
6716 | | // The precision argument is ignored when the |
6717 | | // WUFFS_BASE__RENDER_NUMBER_FXX__JUST_ENOUGH_PRECISION option is set. This is |
6718 | | // similar to Go's strconv.FormatFloat with a negative (i.e. non-sensical) |
6719 | | // precision, but there is no corresponding feature in C's printf. |
6720 | | // |
6721 | | // Extreme values of x will be rendered as "NaN", "Inf" (or "+Inf" if the |
6722 | | // WUFFS_BASE__RENDER_NUMBER_XXX__LEADING_PLUS_SIGN option is set) or "-Inf". |
6723 | | // |
6724 | | // For modular builds that divide the base module into sub-modules, using this |
6725 | | // function requires the WUFFS_CONFIG__MODULE__BASE__FLOATCONV sub-module, not |
6726 | | // just WUFFS_CONFIG__MODULE__BASE__CORE. |
6727 | | WUFFS_BASE__MAYBE_STATIC size_t // |
6728 | | wuffs_base__render_number_f64(wuffs_base__slice_u8 dst, |
6729 | | double x, |
6730 | | uint32_t precision, |
6731 | | uint32_t options); |
6732 | | |
6733 | | // wuffs_base__render_number_i64 writes the decimal encoding of x to dst and |
6734 | | // returns the number of bytes written. If dst is shorter than the entire |
6735 | | // encoding, it returns 0 (and no bytes are written). |
6736 | | // |
6737 | | // dst will never be too short if its length is at least 20, also known as |
6738 | | // WUFFS_BASE__I64__BYTE_LENGTH__MAX_INCL. |
6739 | | // |
6740 | | // For modular builds that divide the base module into sub-modules, using this |
6741 | | // function requires the WUFFS_CONFIG__MODULE__BASE__INTCONV sub-module, not |
6742 | | // just WUFFS_CONFIG__MODULE__BASE__CORE. |
6743 | | WUFFS_BASE__MAYBE_STATIC size_t // |
6744 | | wuffs_base__render_number_i64(wuffs_base__slice_u8 dst, |
6745 | | int64_t x, |
6746 | | uint32_t options); |
6747 | | |
6748 | | // wuffs_base__render_number_u64 writes the decimal encoding of x to dst and |
6749 | | // returns the number of bytes written. If dst is shorter than the entire |
6750 | | // encoding, it returns 0 (and no bytes are written). |
6751 | | // |
6752 | | // dst will never be too short if its length is at least 21, also known as |
6753 | | // WUFFS_BASE__U64__BYTE_LENGTH__MAX_INCL. |
6754 | | // |
6755 | | // For modular builds that divide the base module into sub-modules, using this |
6756 | | // function requires the WUFFS_CONFIG__MODULE__BASE__INTCONV sub-module, not |
6757 | | // just WUFFS_CONFIG__MODULE__BASE__CORE. |
6758 | | WUFFS_BASE__MAYBE_STATIC size_t // |
6759 | | wuffs_base__render_number_u64(wuffs_base__slice_u8 dst, |
6760 | | uint64_t x, |
6761 | | uint32_t options); |
6762 | | |
6763 | | // ---------------- Base-16 |
6764 | | |
6765 | | // Options (bitwise or'ed together) for wuffs_base__base_16__xxx functions. |
6766 | | |
6767 | | #define WUFFS_BASE__BASE_16__DEFAULT_OPTIONS ((uint32_t)0x00000000) |
6768 | | |
6769 | | // wuffs_base__base_16__decode2 converts "6A6b" to "jk", where e.g. 'j' is |
6770 | | // U+006A. There are 2 src bytes for every dst byte. |
6771 | | // |
6772 | | // It assumes that the src bytes are two hexadecimal digits (0-9, A-F, a-f), |
6773 | | // repeated. It may write nonsense bytes if not, although it will not read or |
6774 | | // write out of bounds. |
6775 | | // |
6776 | | // For modular builds that divide the base module into sub-modules, using this |
6777 | | // function requires the WUFFS_CONFIG__MODULE__BASE__INTCONV sub-module, not |
6778 | | // just WUFFS_CONFIG__MODULE__BASE__CORE. |
6779 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__transform__output // |
6780 | | wuffs_base__base_16__decode2(wuffs_base__slice_u8 dst, |
6781 | | wuffs_base__slice_u8 src, |
6782 | | bool src_closed, |
6783 | | uint32_t options); |
6784 | | |
6785 | | // wuffs_base__base_16__decode4 converts both "\\x6A\\x6b" and "??6a??6B" to |
6786 | | // "jk", where e.g. 'j' is U+006A. There are 4 src bytes for every dst byte. |
6787 | | // |
6788 | | // It assumes that the src bytes are two ignored bytes and then two hexadecimal |
6789 | | // digits (0-9, A-F, a-f), repeated. It may write nonsense bytes if not, |
6790 | | // although it will not read or write out of bounds. |
6791 | | // |
6792 | | // For modular builds that divide the base module into sub-modules, using this |
6793 | | // function requires the WUFFS_CONFIG__MODULE__BASE__INTCONV sub-module, not |
6794 | | // just WUFFS_CONFIG__MODULE__BASE__CORE. |
6795 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__transform__output // |
6796 | | wuffs_base__base_16__decode4(wuffs_base__slice_u8 dst, |
6797 | | wuffs_base__slice_u8 src, |
6798 | | bool src_closed, |
6799 | | uint32_t options); |
6800 | | |
6801 | | // wuffs_base__base_16__encode2 converts "jk" to "6A6B", where e.g. 'j' is |
6802 | | // U+006A. There are 2 dst bytes for every src byte. |
6803 | | // |
6804 | | // For modular builds that divide the base module into sub-modules, using this |
6805 | | // function requires the WUFFS_CONFIG__MODULE__BASE__INTCONV sub-module, not |
6806 | | // just WUFFS_CONFIG__MODULE__BASE__CORE. |
6807 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__transform__output // |
6808 | | wuffs_base__base_16__encode2(wuffs_base__slice_u8 dst, |
6809 | | wuffs_base__slice_u8 src, |
6810 | | bool src_closed, |
6811 | | uint32_t options); |
6812 | | |
6813 | | // wuffs_base__base_16__encode4 converts "jk" to "\\x6A\\x6B", where e.g. 'j' |
6814 | | // is U+006A. There are 4 dst bytes for every src byte. |
6815 | | // |
6816 | | // For modular builds that divide the base module into sub-modules, using this |
6817 | | // function requires the WUFFS_CONFIG__MODULE__BASE__INTCONV sub-module, not |
6818 | | // just WUFFS_CONFIG__MODULE__BASE__CORE. |
6819 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__transform__output // |
6820 | | wuffs_base__base_16__encode4(wuffs_base__slice_u8 dst, |
6821 | | wuffs_base__slice_u8 src, |
6822 | | bool src_closed, |
6823 | | uint32_t options); |
6824 | | |
6825 | | // ---------------- Base-64 |
6826 | | |
6827 | | // Options (bitwise or'ed together) for wuffs_base__base_64__xxx functions. |
6828 | | |
6829 | | #define WUFFS_BASE__BASE_64__DEFAULT_OPTIONS ((uint32_t)0x00000000) |
6830 | | |
6831 | | // WUFFS_BASE__BASE_64__DECODE_ALLOW_PADDING means that, when decoding base-64, |
6832 | | // the input may (but does not need to) be padded with '=' bytes so that the |
6833 | | // overall encoded length in bytes is a multiple of 4. A successful decoding |
6834 | | // will return a num_src that includes those padding bytes. |
6835 | | // |
6836 | | // Excess padding (e.g. three final '='s) will be rejected as bad data. |
6837 | 0 | #define WUFFS_BASE__BASE_64__DECODE_ALLOW_PADDING ((uint32_t)0x00000001) |
6838 | | |
6839 | | // WUFFS_BASE__BASE_64__ENCODE_EMIT_PADDING means that, when encoding base-64, |
6840 | | // the output will be padded with '=' bytes so that the overall encoded length |
6841 | | // in bytes is a multiple of 4. |
6842 | 0 | #define WUFFS_BASE__BASE_64__ENCODE_EMIT_PADDING ((uint32_t)0x00000002) |
6843 | | |
6844 | | // WUFFS_BASE__BASE_64__URL_ALPHABET means that, for base-64, the URL-friendly |
6845 | | // and file-name-friendly alphabet be used, as per RFC 4648 section 5. When |
6846 | | // this option bit is off, the standard alphabet from section 4 is used. |
6847 | 0 | #define WUFFS_BASE__BASE_64__URL_ALPHABET ((uint32_t)0x00000100) |
6848 | | |
6849 | | // wuffs_base__base_64__decode transforms base-64 encoded bytes from src to |
6850 | | // arbitrary bytes in dst. |
6851 | | // |
6852 | | // It will not permit line breaks or other whitespace in src. Filtering those |
6853 | | // out is the responsibility of the caller. |
6854 | | // |
6855 | | // For modular builds that divide the base module into sub-modules, using this |
6856 | | // function requires the WUFFS_CONFIG__MODULE__BASE__INTCONV sub-module, not |
6857 | | // just WUFFS_CONFIG__MODULE__BASE__CORE. |
6858 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__transform__output // |
6859 | | wuffs_base__base_64__decode(wuffs_base__slice_u8 dst, |
6860 | | wuffs_base__slice_u8 src, |
6861 | | bool src_closed, |
6862 | | uint32_t options); |
6863 | | |
6864 | | // wuffs_base__base_64__encode transforms arbitrary bytes from src to base-64 |
6865 | | // encoded bytes in dst. |
6866 | | // |
6867 | | // For modular builds that divide the base module into sub-modules, using this |
6868 | | // function requires the WUFFS_CONFIG__MODULE__BASE__INTCONV sub-module, not |
6869 | | // just WUFFS_CONFIG__MODULE__BASE__CORE. |
6870 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__transform__output // |
6871 | | wuffs_base__base_64__encode(wuffs_base__slice_u8 dst, |
6872 | | wuffs_base__slice_u8 src, |
6873 | | bool src_closed, |
6874 | | uint32_t options); |
6875 | | |
6876 | | // ---------------- Unicode and UTF-8 |
6877 | | |
6878 | | #define WUFFS_BASE__UNICODE_CODE_POINT__MIN_INCL 0x00000000 |
6879 | 3.85M | #define WUFFS_BASE__UNICODE_CODE_POINT__MAX_INCL 0x0010FFFF |
6880 | | |
6881 | 34.1k | #define WUFFS_BASE__UNICODE_REPLACEMENT_CHARACTER 0x0000FFFD |
6882 | | |
6883 | 3.85M | #define WUFFS_BASE__UNICODE_SURROGATE__MIN_INCL 0x0000D800 |
6884 | 3.83M | #define WUFFS_BASE__UNICODE_SURROGATE__MAX_INCL 0x0000DFFF |
6885 | | |
6886 | | #define WUFFS_BASE__ASCII__MIN_INCL 0x00 |
6887 | | #define WUFFS_BASE__ASCII__MAX_INCL 0x7F |
6888 | | |
6889 | | #define WUFFS_BASE__UTF_8__BYTE_LENGTH__MIN_INCL 1 |
6890 | 4.33M | #define WUFFS_BASE__UTF_8__BYTE_LENGTH__MAX_INCL 4 |
6891 | | |
6892 | | #define WUFFS_BASE__UTF_8__BYTE_LENGTH_1__CODE_POINT__MIN_INCL 0x00000000 |
6893 | | #define WUFFS_BASE__UTF_8__BYTE_LENGTH_1__CODE_POINT__MAX_INCL 0x0000007F |
6894 | | #define WUFFS_BASE__UTF_8__BYTE_LENGTH_2__CODE_POINT__MIN_INCL 0x00000080 |
6895 | | #define WUFFS_BASE__UTF_8__BYTE_LENGTH_2__CODE_POINT__MAX_INCL 0x000007FF |
6896 | | #define WUFFS_BASE__UTF_8__BYTE_LENGTH_3__CODE_POINT__MIN_INCL 0x00000800 |
6897 | | #define WUFFS_BASE__UTF_8__BYTE_LENGTH_3__CODE_POINT__MAX_INCL 0x0000FFFF |
6898 | | #define WUFFS_BASE__UTF_8__BYTE_LENGTH_4__CODE_POINT__MIN_INCL 0x00010000 |
6899 | | #define WUFFS_BASE__UTF_8__BYTE_LENGTH_4__CODE_POINT__MAX_INCL 0x0010FFFF |
6900 | | |
6901 | | // -------- |
6902 | | |
6903 | | // wuffs_base__utf_8__next__output is the type returned by |
6904 | | // wuffs_base__utf_8__next. |
6905 | | typedef struct wuffs_base__utf_8__next__output__struct { |
6906 | | uint32_t code_point; |
6907 | | uint32_t byte_length; |
6908 | | |
6909 | | #ifdef __cplusplus |
6910 | | inline bool is_valid() const; |
6911 | | #endif // __cplusplus |
6912 | | |
6913 | | } wuffs_base__utf_8__next__output; |
6914 | | |
6915 | | static inline wuffs_base__utf_8__next__output // |
6916 | | wuffs_base__make_utf_8__next__output(uint32_t code_point, |
6917 | 16.9M | uint32_t byte_length) { |
6918 | 16.9M | wuffs_base__utf_8__next__output ret; |
6919 | 16.9M | ret.code_point = code_point; |
6920 | 16.9M | ret.byte_length = byte_length; |
6921 | 16.9M | return ret; |
6922 | 16.9M | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__make_utf_8__next__output json_fuzzer.cc:wuffs_base__make_utf_8__next__output(unsigned int, unsigned int) Line | Count | Source | 6917 | 16.4M | uint32_t byte_length) { | 6918 | 16.4M | wuffs_base__utf_8__next__output ret; | 6919 | 16.4M | ret.code_point = code_point; | 6920 | 16.4M | ret.byte_length = byte_length; | 6921 | 16.4M | return ret; | 6922 | 16.4M | } |
Unexecuted instantiation: gif_fuzzer.c:wuffs_base__make_utf_8__next__output Unexecuted instantiation: xz_fuzzer.c:wuffs_base__make_utf_8__next__output Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__make_utf_8__next__output cbor_fuzzer.c:wuffs_base__make_utf_8__next__output Line | Count | Source | 6917 | 494k | uint32_t byte_length) { | 6918 | 494k | wuffs_base__utf_8__next__output ret; | 6919 | 494k | ret.code_point = code_point; | 6920 | 494k | ret.byte_length = byte_length; | 6921 | 494k | return ret; | 6922 | 494k | } |
Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__make_utf_8__next__output Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__make_utf_8__next__output Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__make_utf_8__next__output Unexecuted instantiation: targa_fuzzer.c:wuffs_base__make_utf_8__next__output Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__make_utf_8__next__output Unexecuted instantiation: webp_fuzzer.c:wuffs_base__make_utf_8__next__output |
6923 | | |
6924 | | static inline bool // |
6925 | | wuffs_base__utf_8__next__output__is_valid( |
6926 | 0 | const wuffs_base__utf_8__next__output* o) { |
6927 | 0 | if (o) { |
6928 | 0 | uint32_t cp = o->code_point; |
6929 | 0 | switch (o->byte_length) { |
6930 | 0 | case 1: |
6931 | 0 | return (cp <= 0x7F); |
6932 | 0 | case 2: |
6933 | 0 | return (0x080 <= cp) && (cp <= 0x7FF); |
6934 | 0 | case 3: |
6935 | 0 | // Avoid the 0xD800 ..= 0xDFFF surrogate range. |
6936 | 0 | return ((0x0800 <= cp) && (cp <= 0xD7FF)) || |
6937 | 0 | ((0xE000 <= cp) && (cp <= 0xFFFF)); |
6938 | 0 | case 4: |
6939 | 0 | return (0x00010000 <= cp) && (cp <= 0x0010FFFF); |
6940 | 0 | } |
6941 | 0 | } |
6942 | 0 | return false; |
6943 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_base__utf_8__next__output__is_valid Unexecuted instantiation: json_fuzzer.cc:wuffs_base__utf_8__next__output__is_valid(wuffs_base__utf_8__next__output__struct const*) Unexecuted instantiation: gif_fuzzer.c:wuffs_base__utf_8__next__output__is_valid Unexecuted instantiation: xz_fuzzer.c:wuffs_base__utf_8__next__output__is_valid Unexecuted instantiation: jpeg_fuzzer.c:wuffs_base__utf_8__next__output__is_valid Unexecuted instantiation: cbor_fuzzer.c:wuffs_base__utf_8__next__output__is_valid Unexecuted instantiation: bmp_fuzzer.c:wuffs_base__utf_8__next__output__is_valid Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_base__utf_8__next__output__is_valid Unexecuted instantiation: zlib_fuzzer.c:wuffs_base__utf_8__next__output__is_valid Unexecuted instantiation: targa_fuzzer.c:wuffs_base__utf_8__next__output__is_valid Unexecuted instantiation: bzip2_fuzzer.c:wuffs_base__utf_8__next__output__is_valid Unexecuted instantiation: webp_fuzzer.c:wuffs_base__utf_8__next__output__is_valid |
6944 | | |
6945 | | #ifdef __cplusplus |
6946 | | |
6947 | | inline bool // |
6948 | 0 | wuffs_base__utf_8__next__output::is_valid() const { |
6949 | 0 | return wuffs_base__utf_8__next__output__is_valid(this); |
6950 | 0 | } |
6951 | | |
6952 | | #endif // __cplusplus |
6953 | | |
6954 | | // -------- |
6955 | | |
6956 | | // wuffs_base__utf_8__encode writes the UTF-8 encoding of code_point to s and |
6957 | | // returns the number of bytes written. If code_point is invalid, or if s is |
6958 | | // shorter than the entire encoding, it returns 0 (and no bytes are written). |
6959 | | // |
6960 | | // s will never be too short if its length is at least 4, also known as |
6961 | | // WUFFS_BASE__UTF_8__BYTE_LENGTH__MAX_INCL. |
6962 | | // |
6963 | | // For modular builds that divide the base module into sub-modules, using this |
6964 | | // function requires the WUFFS_CONFIG__MODULE__BASE__UTF8 sub-module, not just |
6965 | | // WUFFS_CONFIG__MODULE__BASE__CORE. |
6966 | | WUFFS_BASE__MAYBE_STATIC size_t // |
6967 | | wuffs_base__utf_8__encode(wuffs_base__slice_u8 dst, uint32_t code_point); |
6968 | | |
6969 | | // wuffs_base__utf_8__next returns the next UTF-8 code point (and that code |
6970 | | // point's byte length) at the start of the read-only slice (s_ptr, s_len). |
6971 | | // |
6972 | | // There are exactly two cases in which this function returns something where |
6973 | | // wuffs_base__utf_8__next__output__is_valid is false: |
6974 | | // - If s is empty then it returns {.code_point=0, .byte_length=0}. |
6975 | | // - If s is non-empty and starts with invalid UTF-8 then it returns |
6976 | | // {.code_point=WUFFS_BASE__UNICODE_REPLACEMENT_CHARACTER, .byte_length=1}. |
6977 | | // |
6978 | | // Otherwise, it returns something where |
6979 | | // wuffs_base__utf_8__next__output__is_valid is true. |
6980 | | // |
6981 | | // In any case, it always returns an output that satisfies both of: |
6982 | | // - (output.code_point <= WUFFS_BASE__UNICODE_CODE_POINT__MAX_INCL). |
6983 | | // - (output.byte_length <= s_len). |
6984 | | // |
6985 | | // If s is a sub-slice of a larger slice of valid UTF-8, but that sub-slice |
6986 | | // boundary occurs in the middle of a multi-byte UTF-8 encoding of a single |
6987 | | // code point, then this function may return something invalid. It is the |
6988 | | // caller's responsibility to split on or otherwise manage UTF-8 boundaries. |
6989 | | // |
6990 | | // For modular builds that divide the base module into sub-modules, using this |
6991 | | // function requires the WUFFS_CONFIG__MODULE__BASE__UTF8 sub-module, not just |
6992 | | // WUFFS_CONFIG__MODULE__BASE__CORE. |
6993 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__utf_8__next__output // |
6994 | | wuffs_base__utf_8__next(const uint8_t* s_ptr, size_t s_len); |
6995 | | |
6996 | | // wuffs_base__utf_8__next_from_end is like wuffs_base__utf_8__next except that |
6997 | | // it looks at the end of (s_ptr, s_len) instead of the start. |
6998 | | // |
6999 | | // For modular builds that divide the base module into sub-modules, using this |
7000 | | // function requires the WUFFS_CONFIG__MODULE__BASE__UTF8 sub-module, not just |
7001 | | // WUFFS_CONFIG__MODULE__BASE__CORE. |
7002 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__utf_8__next__output // |
7003 | | wuffs_base__utf_8__next_from_end(const uint8_t* s_ptr, size_t s_len); |
7004 | | |
7005 | | // wuffs_base__utf_8__longest_valid_prefix returns the largest n such that the |
7006 | | // sub-slice s[..n] is valid UTF-8, where s is the read-only slice (s_ptr, |
7007 | | // s_len). |
7008 | | // |
7009 | | // In particular, it returns s_len if and only if all of s is valid UTF-8. |
7010 | | // |
7011 | | // If s is a sub-slice of a larger slice of valid UTF-8, but that sub-slice |
7012 | | // boundary occurs in the middle of a multi-byte UTF-8 encoding of a single |
7013 | | // code point, then this function will return less than s_len. It is the |
7014 | | // caller's responsibility to split on or otherwise manage UTF-8 boundaries. |
7015 | | // |
7016 | | // For modular builds that divide the base module into sub-modules, using this |
7017 | | // function requires the WUFFS_CONFIG__MODULE__BASE__UTF8 sub-module, not just |
7018 | | // WUFFS_CONFIG__MODULE__BASE__CORE. |
7019 | | WUFFS_BASE__MAYBE_STATIC size_t // |
7020 | | wuffs_base__utf_8__longest_valid_prefix(const uint8_t* s_ptr, size_t s_len); |
7021 | | |
7022 | | // wuffs_base__ascii__longest_valid_prefix returns the largest n such that the |
7023 | | // sub-slice s[..n] is valid ASCII, where s is the read-only slice (s_ptr, |
7024 | | // s_len). |
7025 | | // |
7026 | | // In particular, it returns s_len if and only if all of s is valid ASCII. |
7027 | | // Equivalently, when none of the bytes in s have the 0x80 high bit set. |
7028 | | // |
7029 | | // For modular builds that divide the base module into sub-modules, using this |
7030 | | // function requires the WUFFS_CONFIG__MODULE__BASE__UTF8 sub-module, not just |
7031 | | // WUFFS_CONFIG__MODULE__BASE__CORE. |
7032 | | WUFFS_BASE__MAYBE_STATIC size_t // |
7033 | | wuffs_base__ascii__longest_valid_prefix(const uint8_t* s_ptr, size_t s_len); |
7034 | | |
7035 | | // ---------------- Interface Declarations. |
7036 | | |
7037 | | // For modular builds that divide the base module into sub-modules, using these |
7038 | | // functions require the WUFFS_CONFIG__MODULE__BASE__INTERFACES sub-module, not |
7039 | | // just WUFFS_CONFIG__MODULE__BASE__CORE. |
7040 | | |
7041 | | // -------- |
7042 | | |
7043 | | extern const char wuffs_base__hasher_u32__vtable_name[]; |
7044 | | |
7045 | | typedef struct wuffs_base__hasher_u32__func_ptrs__struct { |
7046 | | uint32_t (*checksum_u32)( |
7047 | | const void* self); |
7048 | | uint64_t (*get_quirk)( |
7049 | | const void* self, |
7050 | | uint32_t a_key); |
7051 | | wuffs_base__status (*set_quirk)( |
7052 | | void* self, |
7053 | | uint32_t a_key, |
7054 | | uint64_t a_value); |
7055 | | wuffs_base__empty_struct (*update)( |
7056 | | void* self, |
7057 | | wuffs_base__slice_u8 a_x); |
7058 | | uint32_t (*update_u32)( |
7059 | | void* self, |
7060 | | wuffs_base__slice_u8 a_x); |
7061 | | } wuffs_base__hasher_u32__func_ptrs; |
7062 | | |
7063 | | typedef struct wuffs_base__hasher_u32__struct wuffs_base__hasher_u32; |
7064 | | |
7065 | | WUFFS_BASE__GENERATED_C_CODE |
7066 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
7067 | | wuffs_base__hasher_u32__checksum_u32( |
7068 | | const wuffs_base__hasher_u32* self); |
7069 | | |
7070 | | WUFFS_BASE__GENERATED_C_CODE |
7071 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
7072 | | wuffs_base__hasher_u32__get_quirk( |
7073 | | const wuffs_base__hasher_u32* self, |
7074 | | uint32_t a_key); |
7075 | | |
7076 | | WUFFS_BASE__GENERATED_C_CODE |
7077 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
7078 | | wuffs_base__hasher_u32__set_quirk( |
7079 | | wuffs_base__hasher_u32* self, |
7080 | | uint32_t a_key, |
7081 | | uint64_t a_value); |
7082 | | |
7083 | | WUFFS_BASE__GENERATED_C_CODE |
7084 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
7085 | | wuffs_base__hasher_u32__update( |
7086 | | wuffs_base__hasher_u32* self, |
7087 | | wuffs_base__slice_u8 a_x); |
7088 | | |
7089 | | WUFFS_BASE__GENERATED_C_CODE |
7090 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
7091 | | wuffs_base__hasher_u32__update_u32( |
7092 | | wuffs_base__hasher_u32* self, |
7093 | | wuffs_base__slice_u8 a_x); |
7094 | | |
7095 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
7096 | | |
7097 | | struct wuffs_base__hasher_u32__struct { |
7098 | | struct { |
7099 | | uint32_t magic; |
7100 | | uint32_t active_coroutine; |
7101 | | wuffs_base__vtable first_vtable; |
7102 | | } private_impl; |
7103 | | |
7104 | | #ifdef __cplusplus |
7105 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
7106 | | using unique_ptr = std::unique_ptr<wuffs_base__hasher_u32, wuffs_unique_ptr_deleter>; |
7107 | | #endif |
7108 | | |
7109 | | inline uint32_t |
7110 | 0 | checksum_u32() const { |
7111 | 0 | return wuffs_base__hasher_u32__checksum_u32(this); |
7112 | 0 | } |
7113 | | |
7114 | | inline uint64_t |
7115 | | get_quirk( |
7116 | 0 | uint32_t a_key) const { |
7117 | 0 | return wuffs_base__hasher_u32__get_quirk( |
7118 | 0 | this, a_key); |
7119 | 0 | } |
7120 | | |
7121 | | inline wuffs_base__status |
7122 | | set_quirk( |
7123 | | uint32_t a_key, |
7124 | 0 | uint64_t a_value) { |
7125 | 0 | return wuffs_base__hasher_u32__set_quirk( |
7126 | 0 | this, a_key, a_value); |
7127 | 0 | } |
7128 | | |
7129 | | inline wuffs_base__empty_struct |
7130 | | update( |
7131 | 0 | wuffs_base__slice_u8 a_x) { |
7132 | 0 | return wuffs_base__hasher_u32__update( |
7133 | 0 | this, a_x); |
7134 | 0 | } |
7135 | | |
7136 | | inline uint32_t |
7137 | | update_u32( |
7138 | 0 | wuffs_base__slice_u8 a_x) { |
7139 | 0 | return wuffs_base__hasher_u32__update_u32( |
7140 | 0 | this, a_x); |
7141 | 0 | } |
7142 | | |
7143 | | #endif // __cplusplus |
7144 | | }; // struct wuffs_base__hasher_u32__struct |
7145 | | |
7146 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
7147 | | |
7148 | | // -------- |
7149 | | |
7150 | | extern const char wuffs_base__hasher_u64__vtable_name[]; |
7151 | | |
7152 | | typedef struct wuffs_base__hasher_u64__func_ptrs__struct { |
7153 | | uint64_t (*checksum_u64)( |
7154 | | const void* self); |
7155 | | uint64_t (*get_quirk)( |
7156 | | const void* self, |
7157 | | uint32_t a_key); |
7158 | | wuffs_base__status (*set_quirk)( |
7159 | | void* self, |
7160 | | uint32_t a_key, |
7161 | | uint64_t a_value); |
7162 | | wuffs_base__empty_struct (*update)( |
7163 | | void* self, |
7164 | | wuffs_base__slice_u8 a_x); |
7165 | | uint64_t (*update_u64)( |
7166 | | void* self, |
7167 | | wuffs_base__slice_u8 a_x); |
7168 | | } wuffs_base__hasher_u64__func_ptrs; |
7169 | | |
7170 | | typedef struct wuffs_base__hasher_u64__struct wuffs_base__hasher_u64; |
7171 | | |
7172 | | WUFFS_BASE__GENERATED_C_CODE |
7173 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
7174 | | wuffs_base__hasher_u64__checksum_u64( |
7175 | | const wuffs_base__hasher_u64* self); |
7176 | | |
7177 | | WUFFS_BASE__GENERATED_C_CODE |
7178 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
7179 | | wuffs_base__hasher_u64__get_quirk( |
7180 | | const wuffs_base__hasher_u64* self, |
7181 | | uint32_t a_key); |
7182 | | |
7183 | | WUFFS_BASE__GENERATED_C_CODE |
7184 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
7185 | | wuffs_base__hasher_u64__set_quirk( |
7186 | | wuffs_base__hasher_u64* self, |
7187 | | uint32_t a_key, |
7188 | | uint64_t a_value); |
7189 | | |
7190 | | WUFFS_BASE__GENERATED_C_CODE |
7191 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
7192 | | wuffs_base__hasher_u64__update( |
7193 | | wuffs_base__hasher_u64* self, |
7194 | | wuffs_base__slice_u8 a_x); |
7195 | | |
7196 | | WUFFS_BASE__GENERATED_C_CODE |
7197 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
7198 | | wuffs_base__hasher_u64__update_u64( |
7199 | | wuffs_base__hasher_u64* self, |
7200 | | wuffs_base__slice_u8 a_x); |
7201 | | |
7202 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
7203 | | |
7204 | | struct wuffs_base__hasher_u64__struct { |
7205 | | struct { |
7206 | | uint32_t magic; |
7207 | | uint32_t active_coroutine; |
7208 | | wuffs_base__vtable first_vtable; |
7209 | | } private_impl; |
7210 | | |
7211 | | #ifdef __cplusplus |
7212 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
7213 | | using unique_ptr = std::unique_ptr<wuffs_base__hasher_u64, wuffs_unique_ptr_deleter>; |
7214 | | #endif |
7215 | | |
7216 | | inline uint64_t |
7217 | 0 | checksum_u64() const { |
7218 | 0 | return wuffs_base__hasher_u64__checksum_u64(this); |
7219 | 0 | } |
7220 | | |
7221 | | inline uint64_t |
7222 | | get_quirk( |
7223 | 0 | uint32_t a_key) const { |
7224 | 0 | return wuffs_base__hasher_u64__get_quirk( |
7225 | 0 | this, a_key); |
7226 | 0 | } |
7227 | | |
7228 | | inline wuffs_base__status |
7229 | | set_quirk( |
7230 | | uint32_t a_key, |
7231 | 0 | uint64_t a_value) { |
7232 | 0 | return wuffs_base__hasher_u64__set_quirk( |
7233 | 0 | this, a_key, a_value); |
7234 | 0 | } |
7235 | | |
7236 | | inline wuffs_base__empty_struct |
7237 | | update( |
7238 | 0 | wuffs_base__slice_u8 a_x) { |
7239 | 0 | return wuffs_base__hasher_u64__update( |
7240 | 0 | this, a_x); |
7241 | 0 | } |
7242 | | |
7243 | | inline uint64_t |
7244 | | update_u64( |
7245 | 0 | wuffs_base__slice_u8 a_x) { |
7246 | 0 | return wuffs_base__hasher_u64__update_u64( |
7247 | 0 | this, a_x); |
7248 | 0 | } |
7249 | | |
7250 | | #endif // __cplusplus |
7251 | | }; // struct wuffs_base__hasher_u64__struct |
7252 | | |
7253 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
7254 | | |
7255 | | // -------- |
7256 | | |
7257 | | extern const char wuffs_base__hasher_bitvec256__vtable_name[]; |
7258 | | |
7259 | | typedef struct wuffs_base__hasher_bitvec256__func_ptrs__struct { |
7260 | | wuffs_base__bitvec256 (*checksum_bitvec256)( |
7261 | | const void* self); |
7262 | | uint64_t (*get_quirk)( |
7263 | | const void* self, |
7264 | | uint32_t a_key); |
7265 | | wuffs_base__status (*set_quirk)( |
7266 | | void* self, |
7267 | | uint32_t a_key, |
7268 | | uint64_t a_value); |
7269 | | wuffs_base__empty_struct (*update)( |
7270 | | void* self, |
7271 | | wuffs_base__slice_u8 a_x); |
7272 | | wuffs_base__bitvec256 (*update_bitvec256)( |
7273 | | void* self, |
7274 | | wuffs_base__slice_u8 a_x); |
7275 | | } wuffs_base__hasher_bitvec256__func_ptrs; |
7276 | | |
7277 | | typedef struct wuffs_base__hasher_bitvec256__struct wuffs_base__hasher_bitvec256; |
7278 | | |
7279 | | WUFFS_BASE__GENERATED_C_CODE |
7280 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__bitvec256 |
7281 | | wuffs_base__hasher_bitvec256__checksum_bitvec256( |
7282 | | const wuffs_base__hasher_bitvec256* self); |
7283 | | |
7284 | | WUFFS_BASE__GENERATED_C_CODE |
7285 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
7286 | | wuffs_base__hasher_bitvec256__get_quirk( |
7287 | | const wuffs_base__hasher_bitvec256* self, |
7288 | | uint32_t a_key); |
7289 | | |
7290 | | WUFFS_BASE__GENERATED_C_CODE |
7291 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
7292 | | wuffs_base__hasher_bitvec256__set_quirk( |
7293 | | wuffs_base__hasher_bitvec256* self, |
7294 | | uint32_t a_key, |
7295 | | uint64_t a_value); |
7296 | | |
7297 | | WUFFS_BASE__GENERATED_C_CODE |
7298 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
7299 | | wuffs_base__hasher_bitvec256__update( |
7300 | | wuffs_base__hasher_bitvec256* self, |
7301 | | wuffs_base__slice_u8 a_x); |
7302 | | |
7303 | | WUFFS_BASE__GENERATED_C_CODE |
7304 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__bitvec256 |
7305 | | wuffs_base__hasher_bitvec256__update_bitvec256( |
7306 | | wuffs_base__hasher_bitvec256* self, |
7307 | | wuffs_base__slice_u8 a_x); |
7308 | | |
7309 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
7310 | | |
7311 | | struct wuffs_base__hasher_bitvec256__struct { |
7312 | | struct { |
7313 | | uint32_t magic; |
7314 | | uint32_t active_coroutine; |
7315 | | wuffs_base__vtable first_vtable; |
7316 | | } private_impl; |
7317 | | |
7318 | | #ifdef __cplusplus |
7319 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
7320 | | using unique_ptr = std::unique_ptr<wuffs_base__hasher_bitvec256, wuffs_unique_ptr_deleter>; |
7321 | | #endif |
7322 | | |
7323 | | inline wuffs_base__bitvec256 |
7324 | 0 | checksum_bitvec256() const { |
7325 | 0 | return wuffs_base__hasher_bitvec256__checksum_bitvec256(this); |
7326 | 0 | } |
7327 | | |
7328 | | inline uint64_t |
7329 | | get_quirk( |
7330 | 0 | uint32_t a_key) const { |
7331 | 0 | return wuffs_base__hasher_bitvec256__get_quirk( |
7332 | 0 | this, a_key); |
7333 | 0 | } |
7334 | | |
7335 | | inline wuffs_base__status |
7336 | | set_quirk( |
7337 | | uint32_t a_key, |
7338 | 0 | uint64_t a_value) { |
7339 | 0 | return wuffs_base__hasher_bitvec256__set_quirk( |
7340 | 0 | this, a_key, a_value); |
7341 | 0 | } |
7342 | | |
7343 | | inline wuffs_base__empty_struct |
7344 | | update( |
7345 | 0 | wuffs_base__slice_u8 a_x) { |
7346 | 0 | return wuffs_base__hasher_bitvec256__update( |
7347 | 0 | this, a_x); |
7348 | 0 | } |
7349 | | |
7350 | | inline wuffs_base__bitvec256 |
7351 | | update_bitvec256( |
7352 | 0 | wuffs_base__slice_u8 a_x) { |
7353 | 0 | return wuffs_base__hasher_bitvec256__update_bitvec256( |
7354 | 0 | this, a_x); |
7355 | 0 | } |
7356 | | |
7357 | | #endif // __cplusplus |
7358 | | }; // struct wuffs_base__hasher_bitvec256__struct |
7359 | | |
7360 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
7361 | | |
7362 | | // -------- |
7363 | | |
7364 | | extern const char wuffs_base__image_decoder__vtable_name[]; |
7365 | | |
7366 | | typedef struct wuffs_base__image_decoder__func_ptrs__struct { |
7367 | | wuffs_base__status (*decode_frame)( |
7368 | | void* self, |
7369 | | wuffs_base__pixel_buffer* a_dst, |
7370 | | wuffs_base__io_buffer* a_src, |
7371 | | wuffs_base__pixel_blend a_blend, |
7372 | | wuffs_base__slice_u8 a_workbuf, |
7373 | | wuffs_base__decode_frame_options* a_opts); |
7374 | | wuffs_base__status (*decode_frame_config)( |
7375 | | void* self, |
7376 | | wuffs_base__frame_config* a_dst, |
7377 | | wuffs_base__io_buffer* a_src); |
7378 | | wuffs_base__status (*decode_image_config)( |
7379 | | void* self, |
7380 | | wuffs_base__image_config* a_dst, |
7381 | | wuffs_base__io_buffer* a_src); |
7382 | | wuffs_base__rect_ie_u32 (*frame_dirty_rect)( |
7383 | | const void* self); |
7384 | | uint64_t (*get_quirk)( |
7385 | | const void* self, |
7386 | | uint32_t a_key); |
7387 | | uint32_t (*num_animation_loops)( |
7388 | | const void* self); |
7389 | | uint64_t (*num_decoded_frame_configs)( |
7390 | | const void* self); |
7391 | | uint64_t (*num_decoded_frames)( |
7392 | | const void* self); |
7393 | | wuffs_base__status (*restart_frame)( |
7394 | | void* self, |
7395 | | uint64_t a_index, |
7396 | | uint64_t a_io_position); |
7397 | | wuffs_base__status (*set_quirk)( |
7398 | | void* self, |
7399 | | uint32_t a_key, |
7400 | | uint64_t a_value); |
7401 | | wuffs_base__empty_struct (*set_report_metadata)( |
7402 | | void* self, |
7403 | | uint32_t a_fourcc, |
7404 | | bool a_report); |
7405 | | wuffs_base__status (*tell_me_more)( |
7406 | | void* self, |
7407 | | wuffs_base__io_buffer* a_dst, |
7408 | | wuffs_base__more_information* a_minfo, |
7409 | | wuffs_base__io_buffer* a_src); |
7410 | | wuffs_base__range_ii_u64 (*workbuf_len)( |
7411 | | const void* self); |
7412 | | } wuffs_base__image_decoder__func_ptrs; |
7413 | | |
7414 | | typedef struct wuffs_base__image_decoder__struct wuffs_base__image_decoder; |
7415 | | |
7416 | | WUFFS_BASE__GENERATED_C_CODE |
7417 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
7418 | | wuffs_base__image_decoder__decode_frame( |
7419 | | wuffs_base__image_decoder* self, |
7420 | | wuffs_base__pixel_buffer* a_dst, |
7421 | | wuffs_base__io_buffer* a_src, |
7422 | | wuffs_base__pixel_blend a_blend, |
7423 | | wuffs_base__slice_u8 a_workbuf, |
7424 | | wuffs_base__decode_frame_options* a_opts); |
7425 | | |
7426 | | WUFFS_BASE__GENERATED_C_CODE |
7427 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
7428 | | wuffs_base__image_decoder__decode_frame_config( |
7429 | | wuffs_base__image_decoder* self, |
7430 | | wuffs_base__frame_config* a_dst, |
7431 | | wuffs_base__io_buffer* a_src); |
7432 | | |
7433 | | WUFFS_BASE__GENERATED_C_CODE |
7434 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
7435 | | wuffs_base__image_decoder__decode_image_config( |
7436 | | wuffs_base__image_decoder* self, |
7437 | | wuffs_base__image_config* a_dst, |
7438 | | wuffs_base__io_buffer* a_src); |
7439 | | |
7440 | | WUFFS_BASE__GENERATED_C_CODE |
7441 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32 |
7442 | | wuffs_base__image_decoder__frame_dirty_rect( |
7443 | | const wuffs_base__image_decoder* self); |
7444 | | |
7445 | | WUFFS_BASE__GENERATED_C_CODE |
7446 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
7447 | | wuffs_base__image_decoder__get_quirk( |
7448 | | const wuffs_base__image_decoder* self, |
7449 | | uint32_t a_key); |
7450 | | |
7451 | | WUFFS_BASE__GENERATED_C_CODE |
7452 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
7453 | | wuffs_base__image_decoder__num_animation_loops( |
7454 | | const wuffs_base__image_decoder* self); |
7455 | | |
7456 | | WUFFS_BASE__GENERATED_C_CODE |
7457 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
7458 | | wuffs_base__image_decoder__num_decoded_frame_configs( |
7459 | | const wuffs_base__image_decoder* self); |
7460 | | |
7461 | | WUFFS_BASE__GENERATED_C_CODE |
7462 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
7463 | | wuffs_base__image_decoder__num_decoded_frames( |
7464 | | const wuffs_base__image_decoder* self); |
7465 | | |
7466 | | WUFFS_BASE__GENERATED_C_CODE |
7467 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
7468 | | wuffs_base__image_decoder__restart_frame( |
7469 | | wuffs_base__image_decoder* self, |
7470 | | uint64_t a_index, |
7471 | | uint64_t a_io_position); |
7472 | | |
7473 | | WUFFS_BASE__GENERATED_C_CODE |
7474 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
7475 | | wuffs_base__image_decoder__set_quirk( |
7476 | | wuffs_base__image_decoder* self, |
7477 | | uint32_t a_key, |
7478 | | uint64_t a_value); |
7479 | | |
7480 | | WUFFS_BASE__GENERATED_C_CODE |
7481 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
7482 | | wuffs_base__image_decoder__set_report_metadata( |
7483 | | wuffs_base__image_decoder* self, |
7484 | | uint32_t a_fourcc, |
7485 | | bool a_report); |
7486 | | |
7487 | | WUFFS_BASE__GENERATED_C_CODE |
7488 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
7489 | | wuffs_base__image_decoder__tell_me_more( |
7490 | | wuffs_base__image_decoder* self, |
7491 | | wuffs_base__io_buffer* a_dst, |
7492 | | wuffs_base__more_information* a_minfo, |
7493 | | wuffs_base__io_buffer* a_src); |
7494 | | |
7495 | | WUFFS_BASE__GENERATED_C_CODE |
7496 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
7497 | | wuffs_base__image_decoder__workbuf_len( |
7498 | | const wuffs_base__image_decoder* self); |
7499 | | |
7500 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
7501 | | |
7502 | | struct wuffs_base__image_decoder__struct { |
7503 | | struct { |
7504 | | uint32_t magic; |
7505 | | uint32_t active_coroutine; |
7506 | | wuffs_base__vtable first_vtable; |
7507 | | } private_impl; |
7508 | | |
7509 | | #ifdef __cplusplus |
7510 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
7511 | | using unique_ptr = std::unique_ptr<wuffs_base__image_decoder, wuffs_unique_ptr_deleter>; |
7512 | | #endif |
7513 | | |
7514 | | inline wuffs_base__status |
7515 | | decode_frame( |
7516 | | wuffs_base__pixel_buffer* a_dst, |
7517 | | wuffs_base__io_buffer* a_src, |
7518 | | wuffs_base__pixel_blend a_blend, |
7519 | | wuffs_base__slice_u8 a_workbuf, |
7520 | 0 | wuffs_base__decode_frame_options* a_opts) { |
7521 | 0 | return wuffs_base__image_decoder__decode_frame( |
7522 | 0 | this, a_dst, a_src, a_blend, a_workbuf, a_opts); |
7523 | 0 | } |
7524 | | |
7525 | | inline wuffs_base__status |
7526 | | decode_frame_config( |
7527 | | wuffs_base__frame_config* a_dst, |
7528 | 0 | wuffs_base__io_buffer* a_src) { |
7529 | 0 | return wuffs_base__image_decoder__decode_frame_config( |
7530 | 0 | this, a_dst, a_src); |
7531 | 0 | } |
7532 | | |
7533 | | inline wuffs_base__status |
7534 | | decode_image_config( |
7535 | | wuffs_base__image_config* a_dst, |
7536 | 0 | wuffs_base__io_buffer* a_src) { |
7537 | 0 | return wuffs_base__image_decoder__decode_image_config( |
7538 | 0 | this, a_dst, a_src); |
7539 | 0 | } |
7540 | | |
7541 | | inline wuffs_base__rect_ie_u32 |
7542 | 0 | frame_dirty_rect() const { |
7543 | 0 | return wuffs_base__image_decoder__frame_dirty_rect(this); |
7544 | 0 | } |
7545 | | |
7546 | | inline uint64_t |
7547 | | get_quirk( |
7548 | 0 | uint32_t a_key) const { |
7549 | 0 | return wuffs_base__image_decoder__get_quirk( |
7550 | 0 | this, a_key); |
7551 | 0 | } |
7552 | | |
7553 | | inline uint32_t |
7554 | 0 | num_animation_loops() const { |
7555 | 0 | return wuffs_base__image_decoder__num_animation_loops(this); |
7556 | 0 | } |
7557 | | |
7558 | | inline uint64_t |
7559 | 0 | num_decoded_frame_configs() const { |
7560 | 0 | return wuffs_base__image_decoder__num_decoded_frame_configs(this); |
7561 | 0 | } |
7562 | | |
7563 | | inline uint64_t |
7564 | 0 | num_decoded_frames() const { |
7565 | 0 | return wuffs_base__image_decoder__num_decoded_frames(this); |
7566 | 0 | } |
7567 | | |
7568 | | inline wuffs_base__status |
7569 | | restart_frame( |
7570 | | uint64_t a_index, |
7571 | 0 | uint64_t a_io_position) { |
7572 | 0 | return wuffs_base__image_decoder__restart_frame( |
7573 | 0 | this, a_index, a_io_position); |
7574 | 0 | } |
7575 | | |
7576 | | inline wuffs_base__status |
7577 | | set_quirk( |
7578 | | uint32_t a_key, |
7579 | 0 | uint64_t a_value) { |
7580 | 0 | return wuffs_base__image_decoder__set_quirk( |
7581 | 0 | this, a_key, a_value); |
7582 | 0 | } |
7583 | | |
7584 | | inline wuffs_base__empty_struct |
7585 | | set_report_metadata( |
7586 | | uint32_t a_fourcc, |
7587 | 0 | bool a_report) { |
7588 | 0 | return wuffs_base__image_decoder__set_report_metadata( |
7589 | 0 | this, a_fourcc, a_report); |
7590 | 0 | } |
7591 | | |
7592 | | inline wuffs_base__status |
7593 | | tell_me_more( |
7594 | | wuffs_base__io_buffer* a_dst, |
7595 | | wuffs_base__more_information* a_minfo, |
7596 | 0 | wuffs_base__io_buffer* a_src) { |
7597 | 0 | return wuffs_base__image_decoder__tell_me_more( |
7598 | 0 | this, a_dst, a_minfo, a_src); |
7599 | 0 | } |
7600 | | |
7601 | | inline wuffs_base__range_ii_u64 |
7602 | 0 | workbuf_len() const { |
7603 | 0 | return wuffs_base__image_decoder__workbuf_len(this); |
7604 | 0 | } |
7605 | | |
7606 | | #endif // __cplusplus |
7607 | | }; // struct wuffs_base__image_decoder__struct |
7608 | | |
7609 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
7610 | | |
7611 | | // -------- |
7612 | | |
7613 | | extern const char wuffs_base__io_transformer__vtable_name[]; |
7614 | | |
7615 | | typedef struct wuffs_base__io_transformer__func_ptrs__struct { |
7616 | | wuffs_base__optional_u63 (*dst_history_retain_length)( |
7617 | | const void* self); |
7618 | | uint64_t (*get_quirk)( |
7619 | | const void* self, |
7620 | | uint32_t a_key); |
7621 | | wuffs_base__status (*set_quirk)( |
7622 | | void* self, |
7623 | | uint32_t a_key, |
7624 | | uint64_t a_value); |
7625 | | wuffs_base__status (*transform_io)( |
7626 | | void* self, |
7627 | | wuffs_base__io_buffer* a_dst, |
7628 | | wuffs_base__io_buffer* a_src, |
7629 | | wuffs_base__slice_u8 a_workbuf); |
7630 | | wuffs_base__range_ii_u64 (*workbuf_len)( |
7631 | | const void* self); |
7632 | | } wuffs_base__io_transformer__func_ptrs; |
7633 | | |
7634 | | typedef struct wuffs_base__io_transformer__struct wuffs_base__io_transformer; |
7635 | | |
7636 | | WUFFS_BASE__GENERATED_C_CODE |
7637 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63 |
7638 | | wuffs_base__io_transformer__dst_history_retain_length( |
7639 | | const wuffs_base__io_transformer* self); |
7640 | | |
7641 | | WUFFS_BASE__GENERATED_C_CODE |
7642 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
7643 | | wuffs_base__io_transformer__get_quirk( |
7644 | | const wuffs_base__io_transformer* self, |
7645 | | uint32_t a_key); |
7646 | | |
7647 | | WUFFS_BASE__GENERATED_C_CODE |
7648 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
7649 | | wuffs_base__io_transformer__set_quirk( |
7650 | | wuffs_base__io_transformer* self, |
7651 | | uint32_t a_key, |
7652 | | uint64_t a_value); |
7653 | | |
7654 | | WUFFS_BASE__GENERATED_C_CODE |
7655 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
7656 | | wuffs_base__io_transformer__transform_io( |
7657 | | wuffs_base__io_transformer* self, |
7658 | | wuffs_base__io_buffer* a_dst, |
7659 | | wuffs_base__io_buffer* a_src, |
7660 | | wuffs_base__slice_u8 a_workbuf); |
7661 | | |
7662 | | WUFFS_BASE__GENERATED_C_CODE |
7663 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
7664 | | wuffs_base__io_transformer__workbuf_len( |
7665 | | const wuffs_base__io_transformer* self); |
7666 | | |
7667 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
7668 | | |
7669 | | struct wuffs_base__io_transformer__struct { |
7670 | | struct { |
7671 | | uint32_t magic; |
7672 | | uint32_t active_coroutine; |
7673 | | wuffs_base__vtable first_vtable; |
7674 | | } private_impl; |
7675 | | |
7676 | | #ifdef __cplusplus |
7677 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
7678 | | using unique_ptr = std::unique_ptr<wuffs_base__io_transformer, wuffs_unique_ptr_deleter>; |
7679 | | #endif |
7680 | | |
7681 | | inline wuffs_base__optional_u63 |
7682 | 0 | dst_history_retain_length() const { |
7683 | 0 | return wuffs_base__io_transformer__dst_history_retain_length(this); |
7684 | 0 | } |
7685 | | |
7686 | | inline uint64_t |
7687 | | get_quirk( |
7688 | 0 | uint32_t a_key) const { |
7689 | 0 | return wuffs_base__io_transformer__get_quirk( |
7690 | 0 | this, a_key); |
7691 | 0 | } |
7692 | | |
7693 | | inline wuffs_base__status |
7694 | | set_quirk( |
7695 | | uint32_t a_key, |
7696 | 0 | uint64_t a_value) { |
7697 | 0 | return wuffs_base__io_transformer__set_quirk( |
7698 | 0 | this, a_key, a_value); |
7699 | 0 | } |
7700 | | |
7701 | | inline wuffs_base__status |
7702 | | transform_io( |
7703 | | wuffs_base__io_buffer* a_dst, |
7704 | | wuffs_base__io_buffer* a_src, |
7705 | 0 | wuffs_base__slice_u8 a_workbuf) { |
7706 | 0 | return wuffs_base__io_transformer__transform_io( |
7707 | 0 | this, a_dst, a_src, a_workbuf); |
7708 | 0 | } |
7709 | | |
7710 | | inline wuffs_base__range_ii_u64 |
7711 | 0 | workbuf_len() const { |
7712 | 0 | return wuffs_base__io_transformer__workbuf_len(this); |
7713 | 0 | } |
7714 | | |
7715 | | #endif // __cplusplus |
7716 | | }; // struct wuffs_base__io_transformer__struct |
7717 | | |
7718 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
7719 | | |
7720 | | // -------- |
7721 | | |
7722 | | extern const char wuffs_base__token_decoder__vtable_name[]; |
7723 | | |
7724 | | typedef struct wuffs_base__token_decoder__func_ptrs__struct { |
7725 | | wuffs_base__status (*decode_tokens)( |
7726 | | void* self, |
7727 | | wuffs_base__token_buffer* a_dst, |
7728 | | wuffs_base__io_buffer* a_src, |
7729 | | wuffs_base__slice_u8 a_workbuf); |
7730 | | uint64_t (*get_quirk)( |
7731 | | const void* self, |
7732 | | uint32_t a_key); |
7733 | | wuffs_base__status (*set_quirk)( |
7734 | | void* self, |
7735 | | uint32_t a_key, |
7736 | | uint64_t a_value); |
7737 | | wuffs_base__range_ii_u64 (*workbuf_len)( |
7738 | | const void* self); |
7739 | | } wuffs_base__token_decoder__func_ptrs; |
7740 | | |
7741 | | typedef struct wuffs_base__token_decoder__struct wuffs_base__token_decoder; |
7742 | | |
7743 | | WUFFS_BASE__GENERATED_C_CODE |
7744 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
7745 | | wuffs_base__token_decoder__decode_tokens( |
7746 | | wuffs_base__token_decoder* self, |
7747 | | wuffs_base__token_buffer* a_dst, |
7748 | | wuffs_base__io_buffer* a_src, |
7749 | | wuffs_base__slice_u8 a_workbuf); |
7750 | | |
7751 | | WUFFS_BASE__GENERATED_C_CODE |
7752 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
7753 | | wuffs_base__token_decoder__get_quirk( |
7754 | | const wuffs_base__token_decoder* self, |
7755 | | uint32_t a_key); |
7756 | | |
7757 | | WUFFS_BASE__GENERATED_C_CODE |
7758 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
7759 | | wuffs_base__token_decoder__set_quirk( |
7760 | | wuffs_base__token_decoder* self, |
7761 | | uint32_t a_key, |
7762 | | uint64_t a_value); |
7763 | | |
7764 | | WUFFS_BASE__GENERATED_C_CODE |
7765 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
7766 | | wuffs_base__token_decoder__workbuf_len( |
7767 | | const wuffs_base__token_decoder* self); |
7768 | | |
7769 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
7770 | | |
7771 | | struct wuffs_base__token_decoder__struct { |
7772 | | struct { |
7773 | | uint32_t magic; |
7774 | | uint32_t active_coroutine; |
7775 | | wuffs_base__vtable first_vtable; |
7776 | | } private_impl; |
7777 | | |
7778 | | #ifdef __cplusplus |
7779 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
7780 | | using unique_ptr = std::unique_ptr<wuffs_base__token_decoder, wuffs_unique_ptr_deleter>; |
7781 | | #endif |
7782 | | |
7783 | | inline wuffs_base__status |
7784 | | decode_tokens( |
7785 | | wuffs_base__token_buffer* a_dst, |
7786 | | wuffs_base__io_buffer* a_src, |
7787 | 0 | wuffs_base__slice_u8 a_workbuf) { |
7788 | 0 | return wuffs_base__token_decoder__decode_tokens( |
7789 | 0 | this, a_dst, a_src, a_workbuf); |
7790 | 0 | } |
7791 | | |
7792 | | inline uint64_t |
7793 | | get_quirk( |
7794 | 0 | uint32_t a_key) const { |
7795 | 0 | return wuffs_base__token_decoder__get_quirk( |
7796 | 0 | this, a_key); |
7797 | 0 | } |
7798 | | |
7799 | | inline wuffs_base__status |
7800 | | set_quirk( |
7801 | | uint32_t a_key, |
7802 | 0 | uint64_t a_value) { |
7803 | 0 | return wuffs_base__token_decoder__set_quirk( |
7804 | 0 | this, a_key, a_value); |
7805 | 0 | } |
7806 | | |
7807 | | inline wuffs_base__range_ii_u64 |
7808 | 0 | workbuf_len() const { |
7809 | 0 | return wuffs_base__token_decoder__workbuf_len(this); |
7810 | 0 | } |
7811 | | |
7812 | | #endif // __cplusplus |
7813 | | }; // struct wuffs_base__token_decoder__struct |
7814 | | |
7815 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
7816 | | |
7817 | | // ---------------- |
7818 | | |
7819 | | #ifdef __cplusplus |
7820 | | } // extern "C" |
7821 | | #endif |
7822 | | |
7823 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__ADLER32) || defined(WUFFS_NONMONOLITHIC) |
7824 | | |
7825 | | // ---------------- Status Codes |
7826 | | |
7827 | | // ---------------- Public Consts |
7828 | | |
7829 | | // ---------------- Struct Declarations |
7830 | | |
7831 | | typedef struct wuffs_adler32__hasher__struct wuffs_adler32__hasher; |
7832 | | |
7833 | | #ifdef __cplusplus |
7834 | | extern "C" { |
7835 | | #endif |
7836 | | |
7837 | | // ---------------- Public Initializer Prototypes |
7838 | | |
7839 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
7840 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
7841 | | // |
7842 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
7843 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
7844 | | |
7845 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
7846 | | wuffs_adler32__hasher__initialize( |
7847 | | wuffs_adler32__hasher* self, |
7848 | | size_t sizeof_star_self, |
7849 | | uint64_t wuffs_version, |
7850 | | uint32_t options); |
7851 | | |
7852 | | size_t |
7853 | | sizeof__wuffs_adler32__hasher(void); |
7854 | | |
7855 | | // ---------------- Allocs |
7856 | | |
7857 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
7858 | | // memory allocation fails. If they return non-NULL, there is no need to call |
7859 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
7860 | | // calling free on the returned pointer. That pointer is effectively a C++ |
7861 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
7862 | | |
7863 | | wuffs_adler32__hasher* |
7864 | | wuffs_adler32__hasher__alloc(void); |
7865 | | |
7866 | | static inline wuffs_base__hasher_u32* |
7867 | 0 | wuffs_adler32__hasher__alloc_as__wuffs_base__hasher_u32(void) { |
7868 | 0 | return (wuffs_base__hasher_u32*)(wuffs_adler32__hasher__alloc()); |
7869 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_adler32__hasher__alloc_as__wuffs_base__hasher_u32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_adler32__hasher__alloc_as__wuffs_base__hasher_u32 |
7870 | | |
7871 | | // ---------------- Upcasts |
7872 | | |
7873 | | static inline wuffs_base__hasher_u32* |
7874 | | wuffs_adler32__hasher__upcast_as__wuffs_base__hasher_u32( |
7875 | 0 | wuffs_adler32__hasher* p) { |
7876 | 0 | return (wuffs_base__hasher_u32*)p; |
7877 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_adler32__hasher__upcast_as__wuffs_base__hasher_u32 Unexecuted instantiation: zlib_fuzzer.c:wuffs_adler32__hasher__upcast_as__wuffs_base__hasher_u32 |
7878 | | |
7879 | | // ---------------- Public Function Prototypes |
7880 | | |
7881 | | WUFFS_BASE__GENERATED_C_CODE |
7882 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
7883 | | wuffs_adler32__hasher__get_quirk( |
7884 | | const wuffs_adler32__hasher* self, |
7885 | | uint32_t a_key); |
7886 | | |
7887 | | WUFFS_BASE__GENERATED_C_CODE |
7888 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
7889 | | wuffs_adler32__hasher__set_quirk( |
7890 | | wuffs_adler32__hasher* self, |
7891 | | uint32_t a_key, |
7892 | | uint64_t a_value); |
7893 | | |
7894 | | WUFFS_BASE__GENERATED_C_CODE |
7895 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
7896 | | wuffs_adler32__hasher__update( |
7897 | | wuffs_adler32__hasher* self, |
7898 | | wuffs_base__slice_u8 a_x); |
7899 | | |
7900 | | WUFFS_BASE__GENERATED_C_CODE |
7901 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
7902 | | wuffs_adler32__hasher__update_u32( |
7903 | | wuffs_adler32__hasher* self, |
7904 | | wuffs_base__slice_u8 a_x); |
7905 | | |
7906 | | WUFFS_BASE__GENERATED_C_CODE |
7907 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
7908 | | wuffs_adler32__hasher__checksum_u32( |
7909 | | const wuffs_adler32__hasher* self); |
7910 | | |
7911 | | #ifdef __cplusplus |
7912 | | } // extern "C" |
7913 | | #endif |
7914 | | |
7915 | | // ---------------- Struct Definitions |
7916 | | |
7917 | | // These structs' fields, and the sizeof them, are private implementation |
7918 | | // details that aren't guaranteed to be stable across Wuffs versions. |
7919 | | // |
7920 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
7921 | | |
7922 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
7923 | | |
7924 | | struct wuffs_adler32__hasher__struct { |
7925 | | // Do not access the private_impl's or private_data's fields directly. There |
7926 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
7927 | | // the wuffs_foo__bar__baz functions. |
7928 | | // |
7929 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
7930 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
7931 | | |
7932 | | struct { |
7933 | | uint32_t magic; |
7934 | | uint32_t active_coroutine; |
7935 | | wuffs_base__vtable vtable_for__wuffs_base__hasher_u32; |
7936 | | wuffs_base__vtable null_vtable; |
7937 | | |
7938 | | uint32_t f_state; |
7939 | | bool f_started; |
7940 | | |
7941 | | wuffs_base__empty_struct (*choosy_up)( |
7942 | | wuffs_adler32__hasher* self, |
7943 | | wuffs_base__slice_u8 a_x); |
7944 | | } private_impl; |
7945 | | |
7946 | | #ifdef __cplusplus |
7947 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
7948 | | using unique_ptr = std::unique_ptr<wuffs_adler32__hasher, wuffs_unique_ptr_deleter>; |
7949 | | |
7950 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
7951 | | |
7952 | | static inline unique_ptr |
7953 | | alloc() { |
7954 | | return unique_ptr(wuffs_adler32__hasher__alloc()); |
7955 | | } |
7956 | | |
7957 | | static inline wuffs_base__hasher_u32::unique_ptr |
7958 | | alloc_as__wuffs_base__hasher_u32() { |
7959 | | return wuffs_base__hasher_u32::unique_ptr( |
7960 | | wuffs_adler32__hasher__alloc_as__wuffs_base__hasher_u32()); |
7961 | | } |
7962 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
7963 | | |
7964 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
7965 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
7966 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
7967 | | // size and field layout is not part of the public, stable, memory-safe API. |
7968 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
7969 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
7970 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
7971 | | // |
7972 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
7973 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
7974 | | // order to provide convenience methods. These forward on "this", so that you |
7975 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
7976 | | wuffs_adler32__hasher__struct() = delete; |
7977 | | wuffs_adler32__hasher__struct(const wuffs_adler32__hasher__struct&) = delete; |
7978 | | wuffs_adler32__hasher__struct& operator=( |
7979 | | const wuffs_adler32__hasher__struct&) = delete; |
7980 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
7981 | | |
7982 | | #if !defined(WUFFS_IMPLEMENTATION) |
7983 | | // As above, the size of the struct is not part of the public API, and unless |
7984 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
7985 | | // allocated, not stack allocated. Its size is not intended to be known at |
7986 | | // compile time, but it is unfortunately divulged as a side effect of |
7987 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
7988 | | // instead of "sizeof T", invoking the operator. To make the two values |
7989 | | // different, so that passing the latter will be rejected by the initialize |
7990 | | // function, we add an arbitrary amount of dead weight. |
7991 | | uint8_t dead_weight[123000000]; // 123 MB. |
7992 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
7993 | | |
7994 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
7995 | | initialize( |
7996 | | size_t sizeof_star_self, |
7997 | | uint64_t wuffs_version, |
7998 | | uint32_t options) { |
7999 | | return wuffs_adler32__hasher__initialize( |
8000 | | this, sizeof_star_self, wuffs_version, options); |
8001 | | } |
8002 | | |
8003 | | inline wuffs_base__hasher_u32* |
8004 | | upcast_as__wuffs_base__hasher_u32() { |
8005 | | return (wuffs_base__hasher_u32*)this; |
8006 | | } |
8007 | | |
8008 | | inline uint64_t |
8009 | | get_quirk( |
8010 | | uint32_t a_key) const { |
8011 | | return wuffs_adler32__hasher__get_quirk(this, a_key); |
8012 | | } |
8013 | | |
8014 | | inline wuffs_base__status |
8015 | | set_quirk( |
8016 | | uint32_t a_key, |
8017 | | uint64_t a_value) { |
8018 | | return wuffs_adler32__hasher__set_quirk(this, a_key, a_value); |
8019 | | } |
8020 | | |
8021 | | inline wuffs_base__empty_struct |
8022 | | update( |
8023 | | wuffs_base__slice_u8 a_x) { |
8024 | | return wuffs_adler32__hasher__update(this, a_x); |
8025 | | } |
8026 | | |
8027 | | inline uint32_t |
8028 | | update_u32( |
8029 | | wuffs_base__slice_u8 a_x) { |
8030 | | return wuffs_adler32__hasher__update_u32(this, a_x); |
8031 | | } |
8032 | | |
8033 | | inline uint32_t |
8034 | | checksum_u32() const { |
8035 | | return wuffs_adler32__hasher__checksum_u32(this); |
8036 | | } |
8037 | | |
8038 | | #endif // __cplusplus |
8039 | | }; // struct wuffs_adler32__hasher__struct |
8040 | | |
8041 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
8042 | | |
8043 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__ADLER32) || defined(WUFFS_NONMONOLITHIC) |
8044 | | |
8045 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__BMP) || defined(WUFFS_NONMONOLITHIC) |
8046 | | |
8047 | | // ---------------- Status Codes |
8048 | | |
8049 | | extern const char wuffs_bmp__error__bad_header[]; |
8050 | | extern const char wuffs_bmp__error__bad_rle_compression[]; |
8051 | | extern const char wuffs_bmp__error__truncated_input[]; |
8052 | | extern const char wuffs_bmp__error__unsupported_bmp_file[]; |
8053 | | |
8054 | | // ---------------- Public Consts |
8055 | | |
8056 | | #define WUFFS_BMP__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u |
8057 | | |
8058 | | // ---------------- Struct Declarations |
8059 | | |
8060 | | typedef struct wuffs_bmp__decoder__struct wuffs_bmp__decoder; |
8061 | | |
8062 | | #ifdef __cplusplus |
8063 | | extern "C" { |
8064 | | #endif |
8065 | | |
8066 | | // ---------------- Public Initializer Prototypes |
8067 | | |
8068 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
8069 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
8070 | | // |
8071 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
8072 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
8073 | | |
8074 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
8075 | | wuffs_bmp__decoder__initialize( |
8076 | | wuffs_bmp__decoder* self, |
8077 | | size_t sizeof_star_self, |
8078 | | uint64_t wuffs_version, |
8079 | | uint32_t options); |
8080 | | |
8081 | | size_t |
8082 | | sizeof__wuffs_bmp__decoder(void); |
8083 | | |
8084 | | // ---------------- Allocs |
8085 | | |
8086 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
8087 | | // memory allocation fails. If they return non-NULL, there is no need to call |
8088 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
8089 | | // calling free on the returned pointer. That pointer is effectively a C++ |
8090 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
8091 | | |
8092 | | wuffs_bmp__decoder* |
8093 | | wuffs_bmp__decoder__alloc(void); |
8094 | | |
8095 | | static inline wuffs_base__image_decoder* |
8096 | 0 | wuffs_bmp__decoder__alloc_as__wuffs_base__image_decoder(void) { |
8097 | 0 | return (wuffs_base__image_decoder*)(wuffs_bmp__decoder__alloc()); |
8098 | 0 | } |
8099 | | |
8100 | | // ---------------- Upcasts |
8101 | | |
8102 | | static inline wuffs_base__image_decoder* |
8103 | | wuffs_bmp__decoder__upcast_as__wuffs_base__image_decoder( |
8104 | 3.18k | wuffs_bmp__decoder* p) { |
8105 | 3.18k | return (wuffs_base__image_decoder*)p; |
8106 | 3.18k | } |
8107 | | |
8108 | | // ---------------- Public Function Prototypes |
8109 | | |
8110 | | WUFFS_BASE__GENERATED_C_CODE |
8111 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
8112 | | wuffs_bmp__decoder__get_quirk( |
8113 | | const wuffs_bmp__decoder* self, |
8114 | | uint32_t a_key); |
8115 | | |
8116 | | WUFFS_BASE__GENERATED_C_CODE |
8117 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
8118 | | wuffs_bmp__decoder__set_quirk( |
8119 | | wuffs_bmp__decoder* self, |
8120 | | uint32_t a_key, |
8121 | | uint64_t a_value); |
8122 | | |
8123 | | WUFFS_BASE__GENERATED_C_CODE |
8124 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
8125 | | wuffs_bmp__decoder__decode_image_config( |
8126 | | wuffs_bmp__decoder* self, |
8127 | | wuffs_base__image_config* a_dst, |
8128 | | wuffs_base__io_buffer* a_src); |
8129 | | |
8130 | | WUFFS_BASE__GENERATED_C_CODE |
8131 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
8132 | | wuffs_bmp__decoder__decode_frame_config( |
8133 | | wuffs_bmp__decoder* self, |
8134 | | wuffs_base__frame_config* a_dst, |
8135 | | wuffs_base__io_buffer* a_src); |
8136 | | |
8137 | | WUFFS_BASE__GENERATED_C_CODE |
8138 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
8139 | | wuffs_bmp__decoder__decode_frame( |
8140 | | wuffs_bmp__decoder* self, |
8141 | | wuffs_base__pixel_buffer* a_dst, |
8142 | | wuffs_base__io_buffer* a_src, |
8143 | | wuffs_base__pixel_blend a_blend, |
8144 | | wuffs_base__slice_u8 a_workbuf, |
8145 | | wuffs_base__decode_frame_options* a_opts); |
8146 | | |
8147 | | WUFFS_BASE__GENERATED_C_CODE |
8148 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32 |
8149 | | wuffs_bmp__decoder__frame_dirty_rect( |
8150 | | const wuffs_bmp__decoder* self); |
8151 | | |
8152 | | WUFFS_BASE__GENERATED_C_CODE |
8153 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
8154 | | wuffs_bmp__decoder__num_animation_loops( |
8155 | | const wuffs_bmp__decoder* self); |
8156 | | |
8157 | | WUFFS_BASE__GENERATED_C_CODE |
8158 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
8159 | | wuffs_bmp__decoder__num_decoded_frame_configs( |
8160 | | const wuffs_bmp__decoder* self); |
8161 | | |
8162 | | WUFFS_BASE__GENERATED_C_CODE |
8163 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
8164 | | wuffs_bmp__decoder__num_decoded_frames( |
8165 | | const wuffs_bmp__decoder* self); |
8166 | | |
8167 | | WUFFS_BASE__GENERATED_C_CODE |
8168 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
8169 | | wuffs_bmp__decoder__restart_frame( |
8170 | | wuffs_bmp__decoder* self, |
8171 | | uint64_t a_index, |
8172 | | uint64_t a_io_position); |
8173 | | |
8174 | | WUFFS_BASE__GENERATED_C_CODE |
8175 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
8176 | | wuffs_bmp__decoder__set_report_metadata( |
8177 | | wuffs_bmp__decoder* self, |
8178 | | uint32_t a_fourcc, |
8179 | | bool a_report); |
8180 | | |
8181 | | WUFFS_BASE__GENERATED_C_CODE |
8182 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
8183 | | wuffs_bmp__decoder__tell_me_more( |
8184 | | wuffs_bmp__decoder* self, |
8185 | | wuffs_base__io_buffer* a_dst, |
8186 | | wuffs_base__more_information* a_minfo, |
8187 | | wuffs_base__io_buffer* a_src); |
8188 | | |
8189 | | WUFFS_BASE__GENERATED_C_CODE |
8190 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
8191 | | wuffs_bmp__decoder__workbuf_len( |
8192 | | const wuffs_bmp__decoder* self); |
8193 | | |
8194 | | #ifdef __cplusplus |
8195 | | } // extern "C" |
8196 | | #endif |
8197 | | |
8198 | | // ---------------- Struct Definitions |
8199 | | |
8200 | | // These structs' fields, and the sizeof them, are private implementation |
8201 | | // details that aren't guaranteed to be stable across Wuffs versions. |
8202 | | // |
8203 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
8204 | | |
8205 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
8206 | | |
8207 | | struct wuffs_bmp__decoder__struct { |
8208 | | // Do not access the private_impl's or private_data's fields directly. There |
8209 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
8210 | | // the wuffs_foo__bar__baz functions. |
8211 | | // |
8212 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
8213 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
8214 | | |
8215 | | struct { |
8216 | | uint32_t magic; |
8217 | | uint32_t active_coroutine; |
8218 | | wuffs_base__vtable vtable_for__wuffs_base__image_decoder; |
8219 | | wuffs_base__vtable null_vtable; |
8220 | | |
8221 | | uint32_t f_width; |
8222 | | uint32_t f_height; |
8223 | | uint8_t f_call_sequence; |
8224 | | bool f_top_down; |
8225 | | uint32_t f_pad_per_row; |
8226 | | uint32_t f_src_pixfmt; |
8227 | | uint32_t f_io_redirect_fourcc; |
8228 | | uint64_t f_io_redirect_pos; |
8229 | | uint64_t f_frame_config_io_position; |
8230 | | uint32_t f_bitmap_info_len; |
8231 | | uint32_t f_padding; |
8232 | | uint32_t f_bits_per_pixel; |
8233 | | uint32_t f_compression; |
8234 | | uint32_t f_channel_masks[4]; |
8235 | | uint8_t f_channel_shifts[4]; |
8236 | | uint8_t f_channel_num_bits[4]; |
8237 | | uint32_t f_dst_x; |
8238 | | uint32_t f_dst_y; |
8239 | | uint32_t f_dst_y_inc; |
8240 | | uint32_t f_pending_pad; |
8241 | | uint32_t f_rle_state; |
8242 | | uint32_t f_rle_length; |
8243 | | uint8_t f_rle_delta_x; |
8244 | | bool f_rle_padded; |
8245 | | wuffs_base__pixel_swizzler f_swizzler; |
8246 | | |
8247 | | uint32_t p_decode_image_config; |
8248 | | uint32_t p_do_decode_image_config; |
8249 | | uint32_t p_decode_frame_config; |
8250 | | uint32_t p_do_decode_frame_config; |
8251 | | uint32_t p_decode_frame; |
8252 | | uint32_t p_do_decode_frame; |
8253 | | uint32_t p_tell_me_more; |
8254 | | uint32_t p_read_palette; |
8255 | | } private_impl; |
8256 | | |
8257 | | struct { |
8258 | | uint8_t f_scratch[2048]; |
8259 | | uint8_t f_src_palette[1024]; |
8260 | | |
8261 | | struct { |
8262 | | uint64_t scratch; |
8263 | | } s_do_decode_image_config; |
8264 | | struct { |
8265 | | uint64_t scratch; |
8266 | | } s_do_decode_frame; |
8267 | | struct { |
8268 | | uint32_t v_i; |
8269 | | uint64_t scratch; |
8270 | | } s_read_palette; |
8271 | | } private_data; |
8272 | | |
8273 | | #ifdef __cplusplus |
8274 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
8275 | | using unique_ptr = std::unique_ptr<wuffs_bmp__decoder, wuffs_unique_ptr_deleter>; |
8276 | | |
8277 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
8278 | | |
8279 | | static inline unique_ptr |
8280 | | alloc() { |
8281 | | return unique_ptr(wuffs_bmp__decoder__alloc()); |
8282 | | } |
8283 | | |
8284 | | static inline wuffs_base__image_decoder::unique_ptr |
8285 | | alloc_as__wuffs_base__image_decoder() { |
8286 | | return wuffs_base__image_decoder::unique_ptr( |
8287 | | wuffs_bmp__decoder__alloc_as__wuffs_base__image_decoder()); |
8288 | | } |
8289 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
8290 | | |
8291 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
8292 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
8293 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
8294 | | // size and field layout is not part of the public, stable, memory-safe API. |
8295 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
8296 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
8297 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
8298 | | // |
8299 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
8300 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
8301 | | // order to provide convenience methods. These forward on "this", so that you |
8302 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
8303 | | wuffs_bmp__decoder__struct() = delete; |
8304 | | wuffs_bmp__decoder__struct(const wuffs_bmp__decoder__struct&) = delete; |
8305 | | wuffs_bmp__decoder__struct& operator=( |
8306 | | const wuffs_bmp__decoder__struct&) = delete; |
8307 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
8308 | | |
8309 | | #if !defined(WUFFS_IMPLEMENTATION) |
8310 | | // As above, the size of the struct is not part of the public API, and unless |
8311 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
8312 | | // allocated, not stack allocated. Its size is not intended to be known at |
8313 | | // compile time, but it is unfortunately divulged as a side effect of |
8314 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
8315 | | // instead of "sizeof T", invoking the operator. To make the two values |
8316 | | // different, so that passing the latter will be rejected by the initialize |
8317 | | // function, we add an arbitrary amount of dead weight. |
8318 | | uint8_t dead_weight[123000000]; // 123 MB. |
8319 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
8320 | | |
8321 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
8322 | | initialize( |
8323 | | size_t sizeof_star_self, |
8324 | | uint64_t wuffs_version, |
8325 | | uint32_t options) { |
8326 | | return wuffs_bmp__decoder__initialize( |
8327 | | this, sizeof_star_self, wuffs_version, options); |
8328 | | } |
8329 | | |
8330 | | inline wuffs_base__image_decoder* |
8331 | | upcast_as__wuffs_base__image_decoder() { |
8332 | | return (wuffs_base__image_decoder*)this; |
8333 | | } |
8334 | | |
8335 | | inline uint64_t |
8336 | | get_quirk( |
8337 | | uint32_t a_key) const { |
8338 | | return wuffs_bmp__decoder__get_quirk(this, a_key); |
8339 | | } |
8340 | | |
8341 | | inline wuffs_base__status |
8342 | | set_quirk( |
8343 | | uint32_t a_key, |
8344 | | uint64_t a_value) { |
8345 | | return wuffs_bmp__decoder__set_quirk(this, a_key, a_value); |
8346 | | } |
8347 | | |
8348 | | inline wuffs_base__status |
8349 | | decode_image_config( |
8350 | | wuffs_base__image_config* a_dst, |
8351 | | wuffs_base__io_buffer* a_src) { |
8352 | | return wuffs_bmp__decoder__decode_image_config(this, a_dst, a_src); |
8353 | | } |
8354 | | |
8355 | | inline wuffs_base__status |
8356 | | decode_frame_config( |
8357 | | wuffs_base__frame_config* a_dst, |
8358 | | wuffs_base__io_buffer* a_src) { |
8359 | | return wuffs_bmp__decoder__decode_frame_config(this, a_dst, a_src); |
8360 | | } |
8361 | | |
8362 | | inline wuffs_base__status |
8363 | | decode_frame( |
8364 | | wuffs_base__pixel_buffer* a_dst, |
8365 | | wuffs_base__io_buffer* a_src, |
8366 | | wuffs_base__pixel_blend a_blend, |
8367 | | wuffs_base__slice_u8 a_workbuf, |
8368 | | wuffs_base__decode_frame_options* a_opts) { |
8369 | | return wuffs_bmp__decoder__decode_frame(this, a_dst, a_src, a_blend, a_workbuf, a_opts); |
8370 | | } |
8371 | | |
8372 | | inline wuffs_base__rect_ie_u32 |
8373 | | frame_dirty_rect() const { |
8374 | | return wuffs_bmp__decoder__frame_dirty_rect(this); |
8375 | | } |
8376 | | |
8377 | | inline uint32_t |
8378 | | num_animation_loops() const { |
8379 | | return wuffs_bmp__decoder__num_animation_loops(this); |
8380 | | } |
8381 | | |
8382 | | inline uint64_t |
8383 | | num_decoded_frame_configs() const { |
8384 | | return wuffs_bmp__decoder__num_decoded_frame_configs(this); |
8385 | | } |
8386 | | |
8387 | | inline uint64_t |
8388 | | num_decoded_frames() const { |
8389 | | return wuffs_bmp__decoder__num_decoded_frames(this); |
8390 | | } |
8391 | | |
8392 | | inline wuffs_base__status |
8393 | | restart_frame( |
8394 | | uint64_t a_index, |
8395 | | uint64_t a_io_position) { |
8396 | | return wuffs_bmp__decoder__restart_frame(this, a_index, a_io_position); |
8397 | | } |
8398 | | |
8399 | | inline wuffs_base__empty_struct |
8400 | | set_report_metadata( |
8401 | | uint32_t a_fourcc, |
8402 | | bool a_report) { |
8403 | | return wuffs_bmp__decoder__set_report_metadata(this, a_fourcc, a_report); |
8404 | | } |
8405 | | |
8406 | | inline wuffs_base__status |
8407 | | tell_me_more( |
8408 | | wuffs_base__io_buffer* a_dst, |
8409 | | wuffs_base__more_information* a_minfo, |
8410 | | wuffs_base__io_buffer* a_src) { |
8411 | | return wuffs_bmp__decoder__tell_me_more(this, a_dst, a_minfo, a_src); |
8412 | | } |
8413 | | |
8414 | | inline wuffs_base__range_ii_u64 |
8415 | | workbuf_len() const { |
8416 | | return wuffs_bmp__decoder__workbuf_len(this); |
8417 | | } |
8418 | | |
8419 | | #endif // __cplusplus |
8420 | | }; // struct wuffs_bmp__decoder__struct |
8421 | | |
8422 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
8423 | | |
8424 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__BMP) || defined(WUFFS_NONMONOLITHIC) |
8425 | | |
8426 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__BZIP2) || defined(WUFFS_NONMONOLITHIC) |
8427 | | |
8428 | | // ---------------- Status Codes |
8429 | | |
8430 | | extern const char wuffs_bzip2__error__bad_huffman_code_over_subscribed[]; |
8431 | | extern const char wuffs_bzip2__error__bad_huffman_code_under_subscribed[]; |
8432 | | extern const char wuffs_bzip2__error__bad_block_header[]; |
8433 | | extern const char wuffs_bzip2__error__bad_block_length[]; |
8434 | | extern const char wuffs_bzip2__error__bad_checksum[]; |
8435 | | extern const char wuffs_bzip2__error__bad_header[]; |
8436 | | extern const char wuffs_bzip2__error__bad_number_of_sections[]; |
8437 | | extern const char wuffs_bzip2__error__truncated_input[]; |
8438 | | extern const char wuffs_bzip2__error__unsupported_block_randomization[]; |
8439 | | |
8440 | | // ---------------- Public Consts |
8441 | | |
8442 | | #define WUFFS_BZIP2__DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE 0u |
8443 | | |
8444 | 45.3k | #define WUFFS_BZIP2__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u |
8445 | | |
8446 | | // ---------------- Struct Declarations |
8447 | | |
8448 | | typedef struct wuffs_bzip2__decoder__struct wuffs_bzip2__decoder; |
8449 | | |
8450 | | #ifdef __cplusplus |
8451 | | extern "C" { |
8452 | | #endif |
8453 | | |
8454 | | // ---------------- Public Initializer Prototypes |
8455 | | |
8456 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
8457 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
8458 | | // |
8459 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
8460 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
8461 | | |
8462 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
8463 | | wuffs_bzip2__decoder__initialize( |
8464 | | wuffs_bzip2__decoder* self, |
8465 | | size_t sizeof_star_self, |
8466 | | uint64_t wuffs_version, |
8467 | | uint32_t options); |
8468 | | |
8469 | | size_t |
8470 | | sizeof__wuffs_bzip2__decoder(void); |
8471 | | |
8472 | | // ---------------- Allocs |
8473 | | |
8474 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
8475 | | // memory allocation fails. If they return non-NULL, there is no need to call |
8476 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
8477 | | // calling free on the returned pointer. That pointer is effectively a C++ |
8478 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
8479 | | |
8480 | | wuffs_bzip2__decoder* |
8481 | | wuffs_bzip2__decoder__alloc(void); |
8482 | | |
8483 | | static inline wuffs_base__io_transformer* |
8484 | 0 | wuffs_bzip2__decoder__alloc_as__wuffs_base__io_transformer(void) { |
8485 | 0 | return (wuffs_base__io_transformer*)(wuffs_bzip2__decoder__alloc()); |
8486 | 0 | } |
8487 | | |
8488 | | // ---------------- Upcasts |
8489 | | |
8490 | | static inline wuffs_base__io_transformer* |
8491 | | wuffs_bzip2__decoder__upcast_as__wuffs_base__io_transformer( |
8492 | 0 | wuffs_bzip2__decoder* p) { |
8493 | 0 | return (wuffs_base__io_transformer*)p; |
8494 | 0 | } |
8495 | | |
8496 | | // ---------------- Public Function Prototypes |
8497 | | |
8498 | | WUFFS_BASE__GENERATED_C_CODE |
8499 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
8500 | | wuffs_bzip2__decoder__get_quirk( |
8501 | | const wuffs_bzip2__decoder* self, |
8502 | | uint32_t a_key); |
8503 | | |
8504 | | WUFFS_BASE__GENERATED_C_CODE |
8505 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
8506 | | wuffs_bzip2__decoder__set_quirk( |
8507 | | wuffs_bzip2__decoder* self, |
8508 | | uint32_t a_key, |
8509 | | uint64_t a_value); |
8510 | | |
8511 | | WUFFS_BASE__GENERATED_C_CODE |
8512 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63 |
8513 | | wuffs_bzip2__decoder__dst_history_retain_length( |
8514 | | const wuffs_bzip2__decoder* self); |
8515 | | |
8516 | | WUFFS_BASE__GENERATED_C_CODE |
8517 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
8518 | | wuffs_bzip2__decoder__workbuf_len( |
8519 | | const wuffs_bzip2__decoder* self); |
8520 | | |
8521 | | WUFFS_BASE__GENERATED_C_CODE |
8522 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
8523 | | wuffs_bzip2__decoder__transform_io( |
8524 | | wuffs_bzip2__decoder* self, |
8525 | | wuffs_base__io_buffer* a_dst, |
8526 | | wuffs_base__io_buffer* a_src, |
8527 | | wuffs_base__slice_u8 a_workbuf); |
8528 | | |
8529 | | #ifdef __cplusplus |
8530 | | } // extern "C" |
8531 | | #endif |
8532 | | |
8533 | | // ---------------- Struct Definitions |
8534 | | |
8535 | | // These structs' fields, and the sizeof them, are private implementation |
8536 | | // details that aren't guaranteed to be stable across Wuffs versions. |
8537 | | // |
8538 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
8539 | | |
8540 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
8541 | | |
8542 | | struct wuffs_bzip2__decoder__struct { |
8543 | | // Do not access the private_impl's or private_data's fields directly. There |
8544 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
8545 | | // the wuffs_foo__bar__baz functions. |
8546 | | // |
8547 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
8548 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
8549 | | |
8550 | | struct { |
8551 | | uint32_t magic; |
8552 | | uint32_t active_coroutine; |
8553 | | wuffs_base__vtable vtable_for__wuffs_base__io_transformer; |
8554 | | wuffs_base__vtable null_vtable; |
8555 | | |
8556 | | uint32_t f_bits; |
8557 | | uint32_t f_n_bits; |
8558 | | uint32_t f_max_incl_block_size; |
8559 | | uint32_t f_block_size; |
8560 | | bool f_decode_huffman_finished; |
8561 | | uint8_t f_decode_huffman_which; |
8562 | | uint32_t f_decode_huffman_ticks; |
8563 | | uint32_t f_decode_huffman_section; |
8564 | | uint32_t f_decode_huffman_run_shift; |
8565 | | uint32_t f_flush_pointer; |
8566 | | uint32_t f_flush_repeat_count; |
8567 | | uint8_t f_flush_prev; |
8568 | | bool f_ignore_checksum; |
8569 | | uint32_t f_final_checksum_have; |
8570 | | uint32_t f_block_checksum_have; |
8571 | | uint32_t f_block_checksum_want; |
8572 | | uint32_t f_original_pointer; |
8573 | | uint32_t f_num_symbols; |
8574 | | uint32_t f_num_huffman_codes; |
8575 | | uint32_t f_num_sections; |
8576 | | uint32_t f_code_lengths_bitmask; |
8577 | | |
8578 | | uint32_t p_transform_io; |
8579 | | uint32_t p_do_transform_io; |
8580 | | uint32_t p_prepare_block; |
8581 | | uint32_t p_read_code_lengths; |
8582 | | uint32_t p_flush_slow; |
8583 | | uint32_t p_decode_huffman_slow; |
8584 | | } private_impl; |
8585 | | |
8586 | | struct { |
8587 | | uint32_t f_scratch; |
8588 | | uint32_t f_letter_counts[256]; |
8589 | | uint8_t f_presence[256]; |
8590 | | uint8_t f_mtft[256]; |
8591 | | uint8_t f_huffman_selectors[32768]; |
8592 | | uint16_t f_huffman_trees[6][257][2]; |
8593 | | uint16_t f_huffman_tables[6][256]; |
8594 | | uint32_t f_bwt[1048576]; |
8595 | | |
8596 | | struct { |
8597 | | uint32_t v_i; |
8598 | | uint64_t v_tag; |
8599 | | uint32_t v_final_checksum_want; |
8600 | | } s_do_transform_io; |
8601 | | struct { |
8602 | | uint32_t v_i; |
8603 | | uint32_t v_selector; |
8604 | | } s_prepare_block; |
8605 | | struct { |
8606 | | uint32_t v_i; |
8607 | | uint32_t v_code_length; |
8608 | | } s_read_code_lengths; |
8609 | | struct { |
8610 | | uint32_t v_flush_pointer; |
8611 | | uint32_t v_flush_repeat_count; |
8612 | | uint8_t v_flush_prev; |
8613 | | uint32_t v_block_checksum_have; |
8614 | | uint32_t v_block_size; |
8615 | | uint8_t v_curr; |
8616 | | uint64_t scratch; |
8617 | | } s_flush_slow; |
8618 | | struct { |
8619 | | uint32_t v_node_index; |
8620 | | } s_decode_huffman_slow; |
8621 | | } private_data; |
8622 | | |
8623 | | #ifdef __cplusplus |
8624 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
8625 | | using unique_ptr = std::unique_ptr<wuffs_bzip2__decoder, wuffs_unique_ptr_deleter>; |
8626 | | |
8627 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
8628 | | |
8629 | | static inline unique_ptr |
8630 | | alloc() { |
8631 | | return unique_ptr(wuffs_bzip2__decoder__alloc()); |
8632 | | } |
8633 | | |
8634 | | static inline wuffs_base__io_transformer::unique_ptr |
8635 | | alloc_as__wuffs_base__io_transformer() { |
8636 | | return wuffs_base__io_transformer::unique_ptr( |
8637 | | wuffs_bzip2__decoder__alloc_as__wuffs_base__io_transformer()); |
8638 | | } |
8639 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
8640 | | |
8641 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
8642 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
8643 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
8644 | | // size and field layout is not part of the public, stable, memory-safe API. |
8645 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
8646 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
8647 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
8648 | | // |
8649 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
8650 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
8651 | | // order to provide convenience methods. These forward on "this", so that you |
8652 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
8653 | | wuffs_bzip2__decoder__struct() = delete; |
8654 | | wuffs_bzip2__decoder__struct(const wuffs_bzip2__decoder__struct&) = delete; |
8655 | | wuffs_bzip2__decoder__struct& operator=( |
8656 | | const wuffs_bzip2__decoder__struct&) = delete; |
8657 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
8658 | | |
8659 | | #if !defined(WUFFS_IMPLEMENTATION) |
8660 | | // As above, the size of the struct is not part of the public API, and unless |
8661 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
8662 | | // allocated, not stack allocated. Its size is not intended to be known at |
8663 | | // compile time, but it is unfortunately divulged as a side effect of |
8664 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
8665 | | // instead of "sizeof T", invoking the operator. To make the two values |
8666 | | // different, so that passing the latter will be rejected by the initialize |
8667 | | // function, we add an arbitrary amount of dead weight. |
8668 | | uint8_t dead_weight[123000000]; // 123 MB. |
8669 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
8670 | | |
8671 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
8672 | | initialize( |
8673 | | size_t sizeof_star_self, |
8674 | | uint64_t wuffs_version, |
8675 | | uint32_t options) { |
8676 | | return wuffs_bzip2__decoder__initialize( |
8677 | | this, sizeof_star_self, wuffs_version, options); |
8678 | | } |
8679 | | |
8680 | | inline wuffs_base__io_transformer* |
8681 | | upcast_as__wuffs_base__io_transformer() { |
8682 | | return (wuffs_base__io_transformer*)this; |
8683 | | } |
8684 | | |
8685 | | inline uint64_t |
8686 | | get_quirk( |
8687 | | uint32_t a_key) const { |
8688 | | return wuffs_bzip2__decoder__get_quirk(this, a_key); |
8689 | | } |
8690 | | |
8691 | | inline wuffs_base__status |
8692 | | set_quirk( |
8693 | | uint32_t a_key, |
8694 | | uint64_t a_value) { |
8695 | | return wuffs_bzip2__decoder__set_quirk(this, a_key, a_value); |
8696 | | } |
8697 | | |
8698 | | inline wuffs_base__optional_u63 |
8699 | | dst_history_retain_length() const { |
8700 | | return wuffs_bzip2__decoder__dst_history_retain_length(this); |
8701 | | } |
8702 | | |
8703 | | inline wuffs_base__range_ii_u64 |
8704 | | workbuf_len() const { |
8705 | | return wuffs_bzip2__decoder__workbuf_len(this); |
8706 | | } |
8707 | | |
8708 | | inline wuffs_base__status |
8709 | | transform_io( |
8710 | | wuffs_base__io_buffer* a_dst, |
8711 | | wuffs_base__io_buffer* a_src, |
8712 | | wuffs_base__slice_u8 a_workbuf) { |
8713 | | return wuffs_bzip2__decoder__transform_io(this, a_dst, a_src, a_workbuf); |
8714 | | } |
8715 | | |
8716 | | #endif // __cplusplus |
8717 | | }; // struct wuffs_bzip2__decoder__struct |
8718 | | |
8719 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
8720 | | |
8721 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__BZIP2) || defined(WUFFS_NONMONOLITHIC) |
8722 | | |
8723 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__CBOR) || defined(WUFFS_NONMONOLITHIC) |
8724 | | |
8725 | | // ---------------- Status Codes |
8726 | | |
8727 | | extern const char wuffs_cbor__error__bad_input[]; |
8728 | | extern const char wuffs_cbor__error__unsupported_recursion_depth[]; |
8729 | | |
8730 | | // ---------------- Public Consts |
8731 | | |
8732 | 802k | #define WUFFS_CBOR__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u |
8733 | | |
8734 | 116k | #define WUFFS_CBOR__DECODER_DEPTH_MAX_INCL 1024u |
8735 | | |
8736 | 2.01k | #define WUFFS_CBOR__DECODER_DST_TOKEN_BUFFER_LENGTH_MIN_INCL 2u |
8737 | | |
8738 | 2.01k | #define WUFFS_CBOR__DECODER_SRC_IO_BUFFER_LENGTH_MIN_INCL 9u |
8739 | | |
8740 | 1.65M | #define WUFFS_CBOR__TOKEN_VALUE_MAJOR 731642u |
8741 | | |
8742 | | #define WUFFS_CBOR__TOKEN_VALUE_MINOR__DETAIL_MASK 262143u |
8743 | | |
8744 | | #define WUFFS_CBOR__TOKEN_VALUE_MINOR__MINUS_1_MINUS_X 16777216u |
8745 | | |
8746 | | #define WUFFS_CBOR__TOKEN_VALUE_MINOR__SIMPLE_VALUE 8388608u |
8747 | | |
8748 | 5.98k | #define WUFFS_CBOR__TOKEN_VALUE_MINOR__TAG 4194304u |
8749 | | |
8750 | | // ---------------- Struct Declarations |
8751 | | |
8752 | | typedef struct wuffs_cbor__decoder__struct wuffs_cbor__decoder; |
8753 | | |
8754 | | #ifdef __cplusplus |
8755 | | extern "C" { |
8756 | | #endif |
8757 | | |
8758 | | // ---------------- Public Initializer Prototypes |
8759 | | |
8760 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
8761 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
8762 | | // |
8763 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
8764 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
8765 | | |
8766 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
8767 | | wuffs_cbor__decoder__initialize( |
8768 | | wuffs_cbor__decoder* self, |
8769 | | size_t sizeof_star_self, |
8770 | | uint64_t wuffs_version, |
8771 | | uint32_t options); |
8772 | | |
8773 | | size_t |
8774 | | sizeof__wuffs_cbor__decoder(void); |
8775 | | |
8776 | | // ---------------- Allocs |
8777 | | |
8778 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
8779 | | // memory allocation fails. If they return non-NULL, there is no need to call |
8780 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
8781 | | // calling free on the returned pointer. That pointer is effectively a C++ |
8782 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
8783 | | |
8784 | | wuffs_cbor__decoder* |
8785 | | wuffs_cbor__decoder__alloc(void); |
8786 | | |
8787 | | static inline wuffs_base__token_decoder* |
8788 | 0 | wuffs_cbor__decoder__alloc_as__wuffs_base__token_decoder(void) { |
8789 | 0 | return (wuffs_base__token_decoder*)(wuffs_cbor__decoder__alloc()); |
8790 | 0 | } |
8791 | | |
8792 | | // ---------------- Upcasts |
8793 | | |
8794 | | static inline wuffs_base__token_decoder* |
8795 | | wuffs_cbor__decoder__upcast_as__wuffs_base__token_decoder( |
8796 | 0 | wuffs_cbor__decoder* p) { |
8797 | 0 | return (wuffs_base__token_decoder*)p; |
8798 | 0 | } |
8799 | | |
8800 | | // ---------------- Public Function Prototypes |
8801 | | |
8802 | | WUFFS_BASE__GENERATED_C_CODE |
8803 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
8804 | | wuffs_cbor__decoder__get_quirk( |
8805 | | const wuffs_cbor__decoder* self, |
8806 | | uint32_t a_key); |
8807 | | |
8808 | | WUFFS_BASE__GENERATED_C_CODE |
8809 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
8810 | | wuffs_cbor__decoder__set_quirk( |
8811 | | wuffs_cbor__decoder* self, |
8812 | | uint32_t a_key, |
8813 | | uint64_t a_value); |
8814 | | |
8815 | | WUFFS_BASE__GENERATED_C_CODE |
8816 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
8817 | | wuffs_cbor__decoder__workbuf_len( |
8818 | | const wuffs_cbor__decoder* self); |
8819 | | |
8820 | | WUFFS_BASE__GENERATED_C_CODE |
8821 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
8822 | | wuffs_cbor__decoder__decode_tokens( |
8823 | | wuffs_cbor__decoder* self, |
8824 | | wuffs_base__token_buffer* a_dst, |
8825 | | wuffs_base__io_buffer* a_src, |
8826 | | wuffs_base__slice_u8 a_workbuf); |
8827 | | |
8828 | | #ifdef __cplusplus |
8829 | | } // extern "C" |
8830 | | #endif |
8831 | | |
8832 | | // ---------------- Struct Definitions |
8833 | | |
8834 | | // These structs' fields, and the sizeof them, are private implementation |
8835 | | // details that aren't guaranteed to be stable across Wuffs versions. |
8836 | | // |
8837 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
8838 | | |
8839 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
8840 | | |
8841 | | struct wuffs_cbor__decoder__struct { |
8842 | | // Do not access the private_impl's or private_data's fields directly. There |
8843 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
8844 | | // the wuffs_foo__bar__baz functions. |
8845 | | // |
8846 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
8847 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
8848 | | |
8849 | | struct { |
8850 | | uint32_t magic; |
8851 | | uint32_t active_coroutine; |
8852 | | wuffs_base__vtable vtable_for__wuffs_base__token_decoder; |
8853 | | wuffs_base__vtable null_vtable; |
8854 | | |
8855 | | bool f_end_of_data; |
8856 | | |
8857 | | uint32_t p_decode_tokens; |
8858 | | } private_impl; |
8859 | | |
8860 | | struct { |
8861 | | uint32_t f_stack[64]; |
8862 | | uint64_t f_container_num_remaining[1024]; |
8863 | | |
8864 | | struct { |
8865 | | uint64_t v_string_length; |
8866 | | uint32_t v_depth; |
8867 | | bool v_tagged; |
8868 | | uint8_t v_indefinite_string_major_type; |
8869 | | } s_decode_tokens; |
8870 | | } private_data; |
8871 | | |
8872 | | #ifdef __cplusplus |
8873 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
8874 | | using unique_ptr = std::unique_ptr<wuffs_cbor__decoder, wuffs_unique_ptr_deleter>; |
8875 | | |
8876 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
8877 | | |
8878 | | static inline unique_ptr |
8879 | | alloc() { |
8880 | | return unique_ptr(wuffs_cbor__decoder__alloc()); |
8881 | | } |
8882 | | |
8883 | | static inline wuffs_base__token_decoder::unique_ptr |
8884 | | alloc_as__wuffs_base__token_decoder() { |
8885 | | return wuffs_base__token_decoder::unique_ptr( |
8886 | | wuffs_cbor__decoder__alloc_as__wuffs_base__token_decoder()); |
8887 | | } |
8888 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
8889 | | |
8890 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
8891 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
8892 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
8893 | | // size and field layout is not part of the public, stable, memory-safe API. |
8894 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
8895 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
8896 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
8897 | | // |
8898 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
8899 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
8900 | | // order to provide convenience methods. These forward on "this", so that you |
8901 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
8902 | | wuffs_cbor__decoder__struct() = delete; |
8903 | | wuffs_cbor__decoder__struct(const wuffs_cbor__decoder__struct&) = delete; |
8904 | | wuffs_cbor__decoder__struct& operator=( |
8905 | | const wuffs_cbor__decoder__struct&) = delete; |
8906 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
8907 | | |
8908 | | #if !defined(WUFFS_IMPLEMENTATION) |
8909 | | // As above, the size of the struct is not part of the public API, and unless |
8910 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
8911 | | // allocated, not stack allocated. Its size is not intended to be known at |
8912 | | // compile time, but it is unfortunately divulged as a side effect of |
8913 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
8914 | | // instead of "sizeof T", invoking the operator. To make the two values |
8915 | | // different, so that passing the latter will be rejected by the initialize |
8916 | | // function, we add an arbitrary amount of dead weight. |
8917 | | uint8_t dead_weight[123000000]; // 123 MB. |
8918 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
8919 | | |
8920 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
8921 | | initialize( |
8922 | | size_t sizeof_star_self, |
8923 | | uint64_t wuffs_version, |
8924 | | uint32_t options) { |
8925 | | return wuffs_cbor__decoder__initialize( |
8926 | | this, sizeof_star_self, wuffs_version, options); |
8927 | | } |
8928 | | |
8929 | | inline wuffs_base__token_decoder* |
8930 | | upcast_as__wuffs_base__token_decoder() { |
8931 | | return (wuffs_base__token_decoder*)this; |
8932 | | } |
8933 | | |
8934 | | inline uint64_t |
8935 | | get_quirk( |
8936 | | uint32_t a_key) const { |
8937 | | return wuffs_cbor__decoder__get_quirk(this, a_key); |
8938 | | } |
8939 | | |
8940 | | inline wuffs_base__status |
8941 | | set_quirk( |
8942 | | uint32_t a_key, |
8943 | | uint64_t a_value) { |
8944 | | return wuffs_cbor__decoder__set_quirk(this, a_key, a_value); |
8945 | | } |
8946 | | |
8947 | | inline wuffs_base__range_ii_u64 |
8948 | | workbuf_len() const { |
8949 | | return wuffs_cbor__decoder__workbuf_len(this); |
8950 | | } |
8951 | | |
8952 | | inline wuffs_base__status |
8953 | | decode_tokens( |
8954 | | wuffs_base__token_buffer* a_dst, |
8955 | | wuffs_base__io_buffer* a_src, |
8956 | | wuffs_base__slice_u8 a_workbuf) { |
8957 | | return wuffs_cbor__decoder__decode_tokens(this, a_dst, a_src, a_workbuf); |
8958 | | } |
8959 | | |
8960 | | #endif // __cplusplus |
8961 | | }; // struct wuffs_cbor__decoder__struct |
8962 | | |
8963 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
8964 | | |
8965 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__CBOR) || defined(WUFFS_NONMONOLITHIC) |
8966 | | |
8967 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__CRC32) || defined(WUFFS_NONMONOLITHIC) |
8968 | | |
8969 | | // ---------------- Status Codes |
8970 | | |
8971 | | // ---------------- Public Consts |
8972 | | |
8973 | | // ---------------- Struct Declarations |
8974 | | |
8975 | | typedef struct wuffs_crc32__ieee_hasher__struct wuffs_crc32__ieee_hasher; |
8976 | | |
8977 | | #ifdef __cplusplus |
8978 | | extern "C" { |
8979 | | #endif |
8980 | | |
8981 | | // ---------------- Public Initializer Prototypes |
8982 | | |
8983 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
8984 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
8985 | | // |
8986 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
8987 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
8988 | | |
8989 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
8990 | | wuffs_crc32__ieee_hasher__initialize( |
8991 | | wuffs_crc32__ieee_hasher* self, |
8992 | | size_t sizeof_star_self, |
8993 | | uint64_t wuffs_version, |
8994 | | uint32_t options); |
8995 | | |
8996 | | size_t |
8997 | | sizeof__wuffs_crc32__ieee_hasher(void); |
8998 | | |
8999 | | // ---------------- Allocs |
9000 | | |
9001 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
9002 | | // memory allocation fails. If they return non-NULL, there is no need to call |
9003 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
9004 | | // calling free on the returned pointer. That pointer is effectively a C++ |
9005 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
9006 | | |
9007 | | wuffs_crc32__ieee_hasher* |
9008 | | wuffs_crc32__ieee_hasher__alloc(void); |
9009 | | |
9010 | | static inline wuffs_base__hasher_u32* |
9011 | 0 | wuffs_crc32__ieee_hasher__alloc_as__wuffs_base__hasher_u32(void) { |
9012 | 0 | return (wuffs_base__hasher_u32*)(wuffs_crc32__ieee_hasher__alloc()); |
9013 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_crc32__ieee_hasher__alloc_as__wuffs_base__hasher_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_crc32__ieee_hasher__alloc_as__wuffs_base__hasher_u32 |
9014 | | |
9015 | | // ---------------- Upcasts |
9016 | | |
9017 | | static inline wuffs_base__hasher_u32* |
9018 | | wuffs_crc32__ieee_hasher__upcast_as__wuffs_base__hasher_u32( |
9019 | 0 | wuffs_crc32__ieee_hasher* p) { |
9020 | 0 | return (wuffs_base__hasher_u32*)p; |
9021 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_crc32__ieee_hasher__upcast_as__wuffs_base__hasher_u32 Unexecuted instantiation: xz_fuzzer.c:wuffs_crc32__ieee_hasher__upcast_as__wuffs_base__hasher_u32 |
9022 | | |
9023 | | // ---------------- Public Function Prototypes |
9024 | | |
9025 | | WUFFS_BASE__GENERATED_C_CODE |
9026 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
9027 | | wuffs_crc32__ieee_hasher__get_quirk( |
9028 | | const wuffs_crc32__ieee_hasher* self, |
9029 | | uint32_t a_key); |
9030 | | |
9031 | | WUFFS_BASE__GENERATED_C_CODE |
9032 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
9033 | | wuffs_crc32__ieee_hasher__set_quirk( |
9034 | | wuffs_crc32__ieee_hasher* self, |
9035 | | uint32_t a_key, |
9036 | | uint64_t a_value); |
9037 | | |
9038 | | WUFFS_BASE__GENERATED_C_CODE |
9039 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
9040 | | wuffs_crc32__ieee_hasher__update( |
9041 | | wuffs_crc32__ieee_hasher* self, |
9042 | | wuffs_base__slice_u8 a_x); |
9043 | | |
9044 | | WUFFS_BASE__GENERATED_C_CODE |
9045 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
9046 | | wuffs_crc32__ieee_hasher__update_u32( |
9047 | | wuffs_crc32__ieee_hasher* self, |
9048 | | wuffs_base__slice_u8 a_x); |
9049 | | |
9050 | | WUFFS_BASE__GENERATED_C_CODE |
9051 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
9052 | | wuffs_crc32__ieee_hasher__checksum_u32( |
9053 | | const wuffs_crc32__ieee_hasher* self); |
9054 | | |
9055 | | #ifdef __cplusplus |
9056 | | } // extern "C" |
9057 | | #endif |
9058 | | |
9059 | | // ---------------- Struct Definitions |
9060 | | |
9061 | | // These structs' fields, and the sizeof them, are private implementation |
9062 | | // details that aren't guaranteed to be stable across Wuffs versions. |
9063 | | // |
9064 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
9065 | | |
9066 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
9067 | | |
9068 | | struct wuffs_crc32__ieee_hasher__struct { |
9069 | | // Do not access the private_impl's or private_data's fields directly. There |
9070 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
9071 | | // the wuffs_foo__bar__baz functions. |
9072 | | // |
9073 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
9074 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
9075 | | |
9076 | | struct { |
9077 | | uint32_t magic; |
9078 | | uint32_t active_coroutine; |
9079 | | wuffs_base__vtable vtable_for__wuffs_base__hasher_u32; |
9080 | | wuffs_base__vtable null_vtable; |
9081 | | |
9082 | | uint32_t f_state; |
9083 | | |
9084 | | wuffs_base__empty_struct (*choosy_up)( |
9085 | | wuffs_crc32__ieee_hasher* self, |
9086 | | wuffs_base__slice_u8 a_x); |
9087 | | } private_impl; |
9088 | | |
9089 | | #ifdef __cplusplus |
9090 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
9091 | | using unique_ptr = std::unique_ptr<wuffs_crc32__ieee_hasher, wuffs_unique_ptr_deleter>; |
9092 | | |
9093 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
9094 | | |
9095 | | static inline unique_ptr |
9096 | | alloc() { |
9097 | | return unique_ptr(wuffs_crc32__ieee_hasher__alloc()); |
9098 | | } |
9099 | | |
9100 | | static inline wuffs_base__hasher_u32::unique_ptr |
9101 | | alloc_as__wuffs_base__hasher_u32() { |
9102 | | return wuffs_base__hasher_u32::unique_ptr( |
9103 | | wuffs_crc32__ieee_hasher__alloc_as__wuffs_base__hasher_u32()); |
9104 | | } |
9105 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
9106 | | |
9107 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
9108 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
9109 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
9110 | | // size and field layout is not part of the public, stable, memory-safe API. |
9111 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
9112 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
9113 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
9114 | | // |
9115 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
9116 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
9117 | | // order to provide convenience methods. These forward on "this", so that you |
9118 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
9119 | | wuffs_crc32__ieee_hasher__struct() = delete; |
9120 | | wuffs_crc32__ieee_hasher__struct(const wuffs_crc32__ieee_hasher__struct&) = delete; |
9121 | | wuffs_crc32__ieee_hasher__struct& operator=( |
9122 | | const wuffs_crc32__ieee_hasher__struct&) = delete; |
9123 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
9124 | | |
9125 | | #if !defined(WUFFS_IMPLEMENTATION) |
9126 | | // As above, the size of the struct is not part of the public API, and unless |
9127 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
9128 | | // allocated, not stack allocated. Its size is not intended to be known at |
9129 | | // compile time, but it is unfortunately divulged as a side effect of |
9130 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
9131 | | // instead of "sizeof T", invoking the operator. To make the two values |
9132 | | // different, so that passing the latter will be rejected by the initialize |
9133 | | // function, we add an arbitrary amount of dead weight. |
9134 | | uint8_t dead_weight[123000000]; // 123 MB. |
9135 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
9136 | | |
9137 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
9138 | | initialize( |
9139 | | size_t sizeof_star_self, |
9140 | | uint64_t wuffs_version, |
9141 | | uint32_t options) { |
9142 | | return wuffs_crc32__ieee_hasher__initialize( |
9143 | | this, sizeof_star_self, wuffs_version, options); |
9144 | | } |
9145 | | |
9146 | | inline wuffs_base__hasher_u32* |
9147 | | upcast_as__wuffs_base__hasher_u32() { |
9148 | | return (wuffs_base__hasher_u32*)this; |
9149 | | } |
9150 | | |
9151 | | inline uint64_t |
9152 | | get_quirk( |
9153 | | uint32_t a_key) const { |
9154 | | return wuffs_crc32__ieee_hasher__get_quirk(this, a_key); |
9155 | | } |
9156 | | |
9157 | | inline wuffs_base__status |
9158 | | set_quirk( |
9159 | | uint32_t a_key, |
9160 | | uint64_t a_value) { |
9161 | | return wuffs_crc32__ieee_hasher__set_quirk(this, a_key, a_value); |
9162 | | } |
9163 | | |
9164 | | inline wuffs_base__empty_struct |
9165 | | update( |
9166 | | wuffs_base__slice_u8 a_x) { |
9167 | | return wuffs_crc32__ieee_hasher__update(this, a_x); |
9168 | | } |
9169 | | |
9170 | | inline uint32_t |
9171 | | update_u32( |
9172 | | wuffs_base__slice_u8 a_x) { |
9173 | | return wuffs_crc32__ieee_hasher__update_u32(this, a_x); |
9174 | | } |
9175 | | |
9176 | | inline uint32_t |
9177 | | checksum_u32() const { |
9178 | | return wuffs_crc32__ieee_hasher__checksum_u32(this); |
9179 | | } |
9180 | | |
9181 | | #endif // __cplusplus |
9182 | | }; // struct wuffs_crc32__ieee_hasher__struct |
9183 | | |
9184 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
9185 | | |
9186 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__CRC32) || defined(WUFFS_NONMONOLITHIC) |
9187 | | |
9188 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__CRC64) || defined(WUFFS_NONMONOLITHIC) |
9189 | | |
9190 | | // ---------------- Status Codes |
9191 | | |
9192 | | // ---------------- Public Consts |
9193 | | |
9194 | | // ---------------- Struct Declarations |
9195 | | |
9196 | | typedef struct wuffs_crc64__ecma_hasher__struct wuffs_crc64__ecma_hasher; |
9197 | | |
9198 | | #ifdef __cplusplus |
9199 | | extern "C" { |
9200 | | #endif |
9201 | | |
9202 | | // ---------------- Public Initializer Prototypes |
9203 | | |
9204 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
9205 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
9206 | | // |
9207 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
9208 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
9209 | | |
9210 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
9211 | | wuffs_crc64__ecma_hasher__initialize( |
9212 | | wuffs_crc64__ecma_hasher* self, |
9213 | | size_t sizeof_star_self, |
9214 | | uint64_t wuffs_version, |
9215 | | uint32_t options); |
9216 | | |
9217 | | size_t |
9218 | | sizeof__wuffs_crc64__ecma_hasher(void); |
9219 | | |
9220 | | // ---------------- Allocs |
9221 | | |
9222 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
9223 | | // memory allocation fails. If they return non-NULL, there is no need to call |
9224 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
9225 | | // calling free on the returned pointer. That pointer is effectively a C++ |
9226 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
9227 | | |
9228 | | wuffs_crc64__ecma_hasher* |
9229 | | wuffs_crc64__ecma_hasher__alloc(void); |
9230 | | |
9231 | | static inline wuffs_base__hasher_u64* |
9232 | 0 | wuffs_crc64__ecma_hasher__alloc_as__wuffs_base__hasher_u64(void) { |
9233 | 0 | return (wuffs_base__hasher_u64*)(wuffs_crc64__ecma_hasher__alloc()); |
9234 | 0 | } |
9235 | | |
9236 | | // ---------------- Upcasts |
9237 | | |
9238 | | static inline wuffs_base__hasher_u64* |
9239 | | wuffs_crc64__ecma_hasher__upcast_as__wuffs_base__hasher_u64( |
9240 | 0 | wuffs_crc64__ecma_hasher* p) { |
9241 | 0 | return (wuffs_base__hasher_u64*)p; |
9242 | 0 | } |
9243 | | |
9244 | | // ---------------- Public Function Prototypes |
9245 | | |
9246 | | WUFFS_BASE__GENERATED_C_CODE |
9247 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
9248 | | wuffs_crc64__ecma_hasher__get_quirk( |
9249 | | const wuffs_crc64__ecma_hasher* self, |
9250 | | uint32_t a_key); |
9251 | | |
9252 | | WUFFS_BASE__GENERATED_C_CODE |
9253 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
9254 | | wuffs_crc64__ecma_hasher__set_quirk( |
9255 | | wuffs_crc64__ecma_hasher* self, |
9256 | | uint32_t a_key, |
9257 | | uint64_t a_value); |
9258 | | |
9259 | | WUFFS_BASE__GENERATED_C_CODE |
9260 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
9261 | | wuffs_crc64__ecma_hasher__update( |
9262 | | wuffs_crc64__ecma_hasher* self, |
9263 | | wuffs_base__slice_u8 a_x); |
9264 | | |
9265 | | WUFFS_BASE__GENERATED_C_CODE |
9266 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
9267 | | wuffs_crc64__ecma_hasher__update_u64( |
9268 | | wuffs_crc64__ecma_hasher* self, |
9269 | | wuffs_base__slice_u8 a_x); |
9270 | | |
9271 | | WUFFS_BASE__GENERATED_C_CODE |
9272 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
9273 | | wuffs_crc64__ecma_hasher__checksum_u64( |
9274 | | const wuffs_crc64__ecma_hasher* self); |
9275 | | |
9276 | | #ifdef __cplusplus |
9277 | | } // extern "C" |
9278 | | #endif |
9279 | | |
9280 | | // ---------------- Struct Definitions |
9281 | | |
9282 | | // These structs' fields, and the sizeof them, are private implementation |
9283 | | // details that aren't guaranteed to be stable across Wuffs versions. |
9284 | | // |
9285 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
9286 | | |
9287 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
9288 | | |
9289 | | struct wuffs_crc64__ecma_hasher__struct { |
9290 | | // Do not access the private_impl's or private_data's fields directly. There |
9291 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
9292 | | // the wuffs_foo__bar__baz functions. |
9293 | | // |
9294 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
9295 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
9296 | | |
9297 | | struct { |
9298 | | uint32_t magic; |
9299 | | uint32_t active_coroutine; |
9300 | | wuffs_base__vtable vtable_for__wuffs_base__hasher_u64; |
9301 | | wuffs_base__vtable null_vtable; |
9302 | | |
9303 | | uint64_t f_state; |
9304 | | |
9305 | | wuffs_base__empty_struct (*choosy_up)( |
9306 | | wuffs_crc64__ecma_hasher* self, |
9307 | | wuffs_base__slice_u8 a_x); |
9308 | | } private_impl; |
9309 | | |
9310 | | #ifdef __cplusplus |
9311 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
9312 | | using unique_ptr = std::unique_ptr<wuffs_crc64__ecma_hasher, wuffs_unique_ptr_deleter>; |
9313 | | |
9314 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
9315 | | |
9316 | | static inline unique_ptr |
9317 | | alloc() { |
9318 | | return unique_ptr(wuffs_crc64__ecma_hasher__alloc()); |
9319 | | } |
9320 | | |
9321 | | static inline wuffs_base__hasher_u64::unique_ptr |
9322 | | alloc_as__wuffs_base__hasher_u64() { |
9323 | | return wuffs_base__hasher_u64::unique_ptr( |
9324 | | wuffs_crc64__ecma_hasher__alloc_as__wuffs_base__hasher_u64()); |
9325 | | } |
9326 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
9327 | | |
9328 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
9329 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
9330 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
9331 | | // size and field layout is not part of the public, stable, memory-safe API. |
9332 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
9333 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
9334 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
9335 | | // |
9336 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
9337 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
9338 | | // order to provide convenience methods. These forward on "this", so that you |
9339 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
9340 | | wuffs_crc64__ecma_hasher__struct() = delete; |
9341 | | wuffs_crc64__ecma_hasher__struct(const wuffs_crc64__ecma_hasher__struct&) = delete; |
9342 | | wuffs_crc64__ecma_hasher__struct& operator=( |
9343 | | const wuffs_crc64__ecma_hasher__struct&) = delete; |
9344 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
9345 | | |
9346 | | #if !defined(WUFFS_IMPLEMENTATION) |
9347 | | // As above, the size of the struct is not part of the public API, and unless |
9348 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
9349 | | // allocated, not stack allocated. Its size is not intended to be known at |
9350 | | // compile time, but it is unfortunately divulged as a side effect of |
9351 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
9352 | | // instead of "sizeof T", invoking the operator. To make the two values |
9353 | | // different, so that passing the latter will be rejected by the initialize |
9354 | | // function, we add an arbitrary amount of dead weight. |
9355 | | uint8_t dead_weight[123000000]; // 123 MB. |
9356 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
9357 | | |
9358 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
9359 | | initialize( |
9360 | | size_t sizeof_star_self, |
9361 | | uint64_t wuffs_version, |
9362 | | uint32_t options) { |
9363 | | return wuffs_crc64__ecma_hasher__initialize( |
9364 | | this, sizeof_star_self, wuffs_version, options); |
9365 | | } |
9366 | | |
9367 | | inline wuffs_base__hasher_u64* |
9368 | | upcast_as__wuffs_base__hasher_u64() { |
9369 | | return (wuffs_base__hasher_u64*)this; |
9370 | | } |
9371 | | |
9372 | | inline uint64_t |
9373 | | get_quirk( |
9374 | | uint32_t a_key) const { |
9375 | | return wuffs_crc64__ecma_hasher__get_quirk(this, a_key); |
9376 | | } |
9377 | | |
9378 | | inline wuffs_base__status |
9379 | | set_quirk( |
9380 | | uint32_t a_key, |
9381 | | uint64_t a_value) { |
9382 | | return wuffs_crc64__ecma_hasher__set_quirk(this, a_key, a_value); |
9383 | | } |
9384 | | |
9385 | | inline wuffs_base__empty_struct |
9386 | | update( |
9387 | | wuffs_base__slice_u8 a_x) { |
9388 | | return wuffs_crc64__ecma_hasher__update(this, a_x); |
9389 | | } |
9390 | | |
9391 | | inline uint64_t |
9392 | | update_u64( |
9393 | | wuffs_base__slice_u8 a_x) { |
9394 | | return wuffs_crc64__ecma_hasher__update_u64(this, a_x); |
9395 | | } |
9396 | | |
9397 | | inline uint64_t |
9398 | | checksum_u64() const { |
9399 | | return wuffs_crc64__ecma_hasher__checksum_u64(this); |
9400 | | } |
9401 | | |
9402 | | #endif // __cplusplus |
9403 | | }; // struct wuffs_crc64__ecma_hasher__struct |
9404 | | |
9405 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
9406 | | |
9407 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__CRC64) || defined(WUFFS_NONMONOLITHIC) |
9408 | | |
9409 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__DEFLATE) || defined(WUFFS_NONMONOLITHIC) |
9410 | | |
9411 | | // ---------------- Status Codes |
9412 | | |
9413 | | extern const char wuffs_deflate__error__bad_huffman_code_over_subscribed[]; |
9414 | | extern const char wuffs_deflate__error__bad_huffman_code_under_subscribed[]; |
9415 | | extern const char wuffs_deflate__error__bad_huffman_code_length_count[]; |
9416 | | extern const char wuffs_deflate__error__bad_huffman_code_length_repetition[]; |
9417 | | extern const char wuffs_deflate__error__bad_huffman_code[]; |
9418 | | extern const char wuffs_deflate__error__bad_huffman_minimum_code_length[]; |
9419 | | extern const char wuffs_deflate__error__bad_block[]; |
9420 | | extern const char wuffs_deflate__error__bad_distance[]; |
9421 | | extern const char wuffs_deflate__error__bad_distance_code_count[]; |
9422 | | extern const char wuffs_deflate__error__bad_literal_length_code_count[]; |
9423 | | extern const char wuffs_deflate__error__inconsistent_stored_block_length[]; |
9424 | | extern const char wuffs_deflate__error__missing_end_of_block_code[]; |
9425 | | extern const char wuffs_deflate__error__no_huffman_codes[]; |
9426 | | extern const char wuffs_deflate__error__truncated_input[]; |
9427 | | |
9428 | | // ---------------- Public Consts |
9429 | | |
9430 | | #define WUFFS_DEFLATE__DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE 0u |
9431 | | |
9432 | | #define WUFFS_DEFLATE__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 1u |
9433 | | |
9434 | | // ---------------- Struct Declarations |
9435 | | |
9436 | | typedef struct wuffs_deflate__decoder__struct wuffs_deflate__decoder; |
9437 | | |
9438 | | #ifdef __cplusplus |
9439 | | extern "C" { |
9440 | | #endif |
9441 | | |
9442 | | // ---------------- Public Initializer Prototypes |
9443 | | |
9444 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
9445 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
9446 | | // |
9447 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
9448 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
9449 | | |
9450 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
9451 | | wuffs_deflate__decoder__initialize( |
9452 | | wuffs_deflate__decoder* self, |
9453 | | size_t sizeof_star_self, |
9454 | | uint64_t wuffs_version, |
9455 | | uint32_t options); |
9456 | | |
9457 | | size_t |
9458 | | sizeof__wuffs_deflate__decoder(void); |
9459 | | |
9460 | | // ---------------- Allocs |
9461 | | |
9462 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
9463 | | // memory allocation fails. If they return non-NULL, there is no need to call |
9464 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
9465 | | // calling free on the returned pointer. That pointer is effectively a C++ |
9466 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
9467 | | |
9468 | | wuffs_deflate__decoder* |
9469 | | wuffs_deflate__decoder__alloc(void); |
9470 | | |
9471 | | static inline wuffs_base__io_transformer* |
9472 | 0 | wuffs_deflate__decoder__alloc_as__wuffs_base__io_transformer(void) { |
9473 | 0 | return (wuffs_base__io_transformer*)(wuffs_deflate__decoder__alloc()); |
9474 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_deflate__decoder__alloc_as__wuffs_base__io_transformer Unexecuted instantiation: zlib_fuzzer.c:wuffs_deflate__decoder__alloc_as__wuffs_base__io_transformer |
9475 | | |
9476 | | // ---------------- Upcasts |
9477 | | |
9478 | | static inline wuffs_base__io_transformer* |
9479 | | wuffs_deflate__decoder__upcast_as__wuffs_base__io_transformer( |
9480 | 0 | wuffs_deflate__decoder* p) { |
9481 | 0 | return (wuffs_base__io_transformer*)p; |
9482 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_deflate__decoder__upcast_as__wuffs_base__io_transformer Unexecuted instantiation: zlib_fuzzer.c:wuffs_deflate__decoder__upcast_as__wuffs_base__io_transformer |
9483 | | |
9484 | | // ---------------- Public Function Prototypes |
9485 | | |
9486 | | WUFFS_BASE__GENERATED_C_CODE |
9487 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
9488 | | wuffs_deflate__decoder__add_history( |
9489 | | wuffs_deflate__decoder* self, |
9490 | | wuffs_base__slice_u8 a_hist); |
9491 | | |
9492 | | WUFFS_BASE__GENERATED_C_CODE |
9493 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
9494 | | wuffs_deflate__decoder__get_quirk( |
9495 | | const wuffs_deflate__decoder* self, |
9496 | | uint32_t a_key); |
9497 | | |
9498 | | WUFFS_BASE__GENERATED_C_CODE |
9499 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
9500 | | wuffs_deflate__decoder__set_quirk( |
9501 | | wuffs_deflate__decoder* self, |
9502 | | uint32_t a_key, |
9503 | | uint64_t a_value); |
9504 | | |
9505 | | WUFFS_BASE__GENERATED_C_CODE |
9506 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63 |
9507 | | wuffs_deflate__decoder__dst_history_retain_length( |
9508 | | const wuffs_deflate__decoder* self); |
9509 | | |
9510 | | WUFFS_BASE__GENERATED_C_CODE |
9511 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
9512 | | wuffs_deflate__decoder__workbuf_len( |
9513 | | const wuffs_deflate__decoder* self); |
9514 | | |
9515 | | WUFFS_BASE__GENERATED_C_CODE |
9516 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
9517 | | wuffs_deflate__decoder__transform_io( |
9518 | | wuffs_deflate__decoder* self, |
9519 | | wuffs_base__io_buffer* a_dst, |
9520 | | wuffs_base__io_buffer* a_src, |
9521 | | wuffs_base__slice_u8 a_workbuf); |
9522 | | |
9523 | | #ifdef __cplusplus |
9524 | | } // extern "C" |
9525 | | #endif |
9526 | | |
9527 | | // ---------------- Struct Definitions |
9528 | | |
9529 | | // These structs' fields, and the sizeof them, are private implementation |
9530 | | // details that aren't guaranteed to be stable across Wuffs versions. |
9531 | | // |
9532 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
9533 | | |
9534 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
9535 | | |
9536 | | struct wuffs_deflate__decoder__struct { |
9537 | | // Do not access the private_impl's or private_data's fields directly. There |
9538 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
9539 | | // the wuffs_foo__bar__baz functions. |
9540 | | // |
9541 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
9542 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
9543 | | |
9544 | | struct { |
9545 | | uint32_t magic; |
9546 | | uint32_t active_coroutine; |
9547 | | wuffs_base__vtable vtable_for__wuffs_base__io_transformer; |
9548 | | wuffs_base__vtable null_vtable; |
9549 | | |
9550 | | uint32_t f_bits; |
9551 | | uint32_t f_n_bits; |
9552 | | uint64_t f_transformed_history_count; |
9553 | | uint32_t f_history_index; |
9554 | | uint32_t f_n_huffs_bits[2]; |
9555 | | bool f_end_of_block; |
9556 | | |
9557 | | uint32_t p_transform_io; |
9558 | | uint32_t p_do_transform_io; |
9559 | | uint32_t p_decode_blocks; |
9560 | | uint32_t p_decode_uncompressed; |
9561 | | uint32_t p_init_dynamic_huffman; |
9562 | | wuffs_base__status (*choosy_decode_huffman_fast64)( |
9563 | | wuffs_deflate__decoder* self, |
9564 | | wuffs_base__io_buffer* a_dst, |
9565 | | wuffs_base__io_buffer* a_src); |
9566 | | uint32_t p_decode_huffman_slow; |
9567 | | } private_impl; |
9568 | | |
9569 | | struct { |
9570 | | uint32_t f_huffs[2][1024]; |
9571 | | uint8_t f_history[33025]; |
9572 | | uint8_t f_code_lengths[320]; |
9573 | | |
9574 | | struct { |
9575 | | uint32_t v_final; |
9576 | | } s_decode_blocks; |
9577 | | struct { |
9578 | | uint32_t v_length; |
9579 | | uint64_t scratch; |
9580 | | } s_decode_uncompressed; |
9581 | | struct { |
9582 | | uint32_t v_bits; |
9583 | | uint32_t v_n_bits; |
9584 | | uint32_t v_n_lit; |
9585 | | uint32_t v_n_dist; |
9586 | | uint32_t v_n_clen; |
9587 | | uint32_t v_i; |
9588 | | uint32_t v_mask; |
9589 | | uint32_t v_n_extra_bits; |
9590 | | uint8_t v_rep_symbol; |
9591 | | uint32_t v_rep_count; |
9592 | | } s_init_dynamic_huffman; |
9593 | | struct { |
9594 | | uint32_t v_bits; |
9595 | | uint32_t v_n_bits; |
9596 | | uint32_t v_table_entry_n_bits; |
9597 | | uint32_t v_lmask; |
9598 | | uint32_t v_dmask; |
9599 | | uint32_t v_redir_top; |
9600 | | uint32_t v_redir_mask; |
9601 | | uint32_t v_length; |
9602 | | uint32_t v_dist_minus_1; |
9603 | | uint64_t scratch; |
9604 | | } s_decode_huffman_slow; |
9605 | | } private_data; |
9606 | | |
9607 | | #ifdef __cplusplus |
9608 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
9609 | | using unique_ptr = std::unique_ptr<wuffs_deflate__decoder, wuffs_unique_ptr_deleter>; |
9610 | | |
9611 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
9612 | | |
9613 | | static inline unique_ptr |
9614 | | alloc() { |
9615 | | return unique_ptr(wuffs_deflate__decoder__alloc()); |
9616 | | } |
9617 | | |
9618 | | static inline wuffs_base__io_transformer::unique_ptr |
9619 | | alloc_as__wuffs_base__io_transformer() { |
9620 | | return wuffs_base__io_transformer::unique_ptr( |
9621 | | wuffs_deflate__decoder__alloc_as__wuffs_base__io_transformer()); |
9622 | | } |
9623 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
9624 | | |
9625 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
9626 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
9627 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
9628 | | // size and field layout is not part of the public, stable, memory-safe API. |
9629 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
9630 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
9631 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
9632 | | // |
9633 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
9634 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
9635 | | // order to provide convenience methods. These forward on "this", so that you |
9636 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
9637 | | wuffs_deflate__decoder__struct() = delete; |
9638 | | wuffs_deflate__decoder__struct(const wuffs_deflate__decoder__struct&) = delete; |
9639 | | wuffs_deflate__decoder__struct& operator=( |
9640 | | const wuffs_deflate__decoder__struct&) = delete; |
9641 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
9642 | | |
9643 | | #if !defined(WUFFS_IMPLEMENTATION) |
9644 | | // As above, the size of the struct is not part of the public API, and unless |
9645 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
9646 | | // allocated, not stack allocated. Its size is not intended to be known at |
9647 | | // compile time, but it is unfortunately divulged as a side effect of |
9648 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
9649 | | // instead of "sizeof T", invoking the operator. To make the two values |
9650 | | // different, so that passing the latter will be rejected by the initialize |
9651 | | // function, we add an arbitrary amount of dead weight. |
9652 | | uint8_t dead_weight[123000000]; // 123 MB. |
9653 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
9654 | | |
9655 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
9656 | | initialize( |
9657 | | size_t sizeof_star_self, |
9658 | | uint64_t wuffs_version, |
9659 | | uint32_t options) { |
9660 | | return wuffs_deflate__decoder__initialize( |
9661 | | this, sizeof_star_self, wuffs_version, options); |
9662 | | } |
9663 | | |
9664 | | inline wuffs_base__io_transformer* |
9665 | | upcast_as__wuffs_base__io_transformer() { |
9666 | | return (wuffs_base__io_transformer*)this; |
9667 | | } |
9668 | | |
9669 | | inline wuffs_base__empty_struct |
9670 | | add_history( |
9671 | | wuffs_base__slice_u8 a_hist) { |
9672 | | return wuffs_deflate__decoder__add_history(this, a_hist); |
9673 | | } |
9674 | | |
9675 | | inline uint64_t |
9676 | | get_quirk( |
9677 | | uint32_t a_key) const { |
9678 | | return wuffs_deflate__decoder__get_quirk(this, a_key); |
9679 | | } |
9680 | | |
9681 | | inline wuffs_base__status |
9682 | | set_quirk( |
9683 | | uint32_t a_key, |
9684 | | uint64_t a_value) { |
9685 | | return wuffs_deflate__decoder__set_quirk(this, a_key, a_value); |
9686 | | } |
9687 | | |
9688 | | inline wuffs_base__optional_u63 |
9689 | | dst_history_retain_length() const { |
9690 | | return wuffs_deflate__decoder__dst_history_retain_length(this); |
9691 | | } |
9692 | | |
9693 | | inline wuffs_base__range_ii_u64 |
9694 | | workbuf_len() const { |
9695 | | return wuffs_deflate__decoder__workbuf_len(this); |
9696 | | } |
9697 | | |
9698 | | inline wuffs_base__status |
9699 | | transform_io( |
9700 | | wuffs_base__io_buffer* a_dst, |
9701 | | wuffs_base__io_buffer* a_src, |
9702 | | wuffs_base__slice_u8 a_workbuf) { |
9703 | | return wuffs_deflate__decoder__transform_io(this, a_dst, a_src, a_workbuf); |
9704 | | } |
9705 | | |
9706 | | #endif // __cplusplus |
9707 | | }; // struct wuffs_deflate__decoder__struct |
9708 | | |
9709 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
9710 | | |
9711 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__DEFLATE) || defined(WUFFS_NONMONOLITHIC) |
9712 | | |
9713 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__ETC2) || defined(WUFFS_NONMONOLITHIC) |
9714 | | |
9715 | | // ---------------- Status Codes |
9716 | | |
9717 | | extern const char wuffs_etc2__error__bad_header[]; |
9718 | | extern const char wuffs_etc2__error__truncated_input[]; |
9719 | | |
9720 | | // ---------------- Public Consts |
9721 | | |
9722 | | #define WUFFS_ETC2__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u |
9723 | | |
9724 | | // ---------------- Struct Declarations |
9725 | | |
9726 | | typedef struct wuffs_etc2__decoder__struct wuffs_etc2__decoder; |
9727 | | |
9728 | | #ifdef __cplusplus |
9729 | | extern "C" { |
9730 | | #endif |
9731 | | |
9732 | | // ---------------- Public Initializer Prototypes |
9733 | | |
9734 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
9735 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
9736 | | // |
9737 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
9738 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
9739 | | |
9740 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
9741 | | wuffs_etc2__decoder__initialize( |
9742 | | wuffs_etc2__decoder* self, |
9743 | | size_t sizeof_star_self, |
9744 | | uint64_t wuffs_version, |
9745 | | uint32_t options); |
9746 | | |
9747 | | size_t |
9748 | | sizeof__wuffs_etc2__decoder(void); |
9749 | | |
9750 | | // ---------------- Allocs |
9751 | | |
9752 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
9753 | | // memory allocation fails. If they return non-NULL, there is no need to call |
9754 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
9755 | | // calling free on the returned pointer. That pointer is effectively a C++ |
9756 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
9757 | | |
9758 | | wuffs_etc2__decoder* |
9759 | | wuffs_etc2__decoder__alloc(void); |
9760 | | |
9761 | | static inline wuffs_base__image_decoder* |
9762 | | wuffs_etc2__decoder__alloc_as__wuffs_base__image_decoder(void) { |
9763 | | return (wuffs_base__image_decoder*)(wuffs_etc2__decoder__alloc()); |
9764 | | } |
9765 | | |
9766 | | // ---------------- Upcasts |
9767 | | |
9768 | | static inline wuffs_base__image_decoder* |
9769 | | wuffs_etc2__decoder__upcast_as__wuffs_base__image_decoder( |
9770 | | wuffs_etc2__decoder* p) { |
9771 | | return (wuffs_base__image_decoder*)p; |
9772 | | } |
9773 | | |
9774 | | // ---------------- Public Function Prototypes |
9775 | | |
9776 | | WUFFS_BASE__GENERATED_C_CODE |
9777 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
9778 | | wuffs_etc2__decoder__get_quirk( |
9779 | | const wuffs_etc2__decoder* self, |
9780 | | uint32_t a_key); |
9781 | | |
9782 | | WUFFS_BASE__GENERATED_C_CODE |
9783 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
9784 | | wuffs_etc2__decoder__set_quirk( |
9785 | | wuffs_etc2__decoder* self, |
9786 | | uint32_t a_key, |
9787 | | uint64_t a_value); |
9788 | | |
9789 | | WUFFS_BASE__GENERATED_C_CODE |
9790 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
9791 | | wuffs_etc2__decoder__decode_image_config( |
9792 | | wuffs_etc2__decoder* self, |
9793 | | wuffs_base__image_config* a_dst, |
9794 | | wuffs_base__io_buffer* a_src); |
9795 | | |
9796 | | WUFFS_BASE__GENERATED_C_CODE |
9797 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
9798 | | wuffs_etc2__decoder__decode_frame_config( |
9799 | | wuffs_etc2__decoder* self, |
9800 | | wuffs_base__frame_config* a_dst, |
9801 | | wuffs_base__io_buffer* a_src); |
9802 | | |
9803 | | WUFFS_BASE__GENERATED_C_CODE |
9804 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
9805 | | wuffs_etc2__decoder__decode_frame( |
9806 | | wuffs_etc2__decoder* self, |
9807 | | wuffs_base__pixel_buffer* a_dst, |
9808 | | wuffs_base__io_buffer* a_src, |
9809 | | wuffs_base__pixel_blend a_blend, |
9810 | | wuffs_base__slice_u8 a_workbuf, |
9811 | | wuffs_base__decode_frame_options* a_opts); |
9812 | | |
9813 | | WUFFS_BASE__GENERATED_C_CODE |
9814 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32 |
9815 | | wuffs_etc2__decoder__frame_dirty_rect( |
9816 | | const wuffs_etc2__decoder* self); |
9817 | | |
9818 | | WUFFS_BASE__GENERATED_C_CODE |
9819 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
9820 | | wuffs_etc2__decoder__num_animation_loops( |
9821 | | const wuffs_etc2__decoder* self); |
9822 | | |
9823 | | WUFFS_BASE__GENERATED_C_CODE |
9824 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
9825 | | wuffs_etc2__decoder__num_decoded_frame_configs( |
9826 | | const wuffs_etc2__decoder* self); |
9827 | | |
9828 | | WUFFS_BASE__GENERATED_C_CODE |
9829 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
9830 | | wuffs_etc2__decoder__num_decoded_frames( |
9831 | | const wuffs_etc2__decoder* self); |
9832 | | |
9833 | | WUFFS_BASE__GENERATED_C_CODE |
9834 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
9835 | | wuffs_etc2__decoder__restart_frame( |
9836 | | wuffs_etc2__decoder* self, |
9837 | | uint64_t a_index, |
9838 | | uint64_t a_io_position); |
9839 | | |
9840 | | WUFFS_BASE__GENERATED_C_CODE |
9841 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
9842 | | wuffs_etc2__decoder__set_report_metadata( |
9843 | | wuffs_etc2__decoder* self, |
9844 | | uint32_t a_fourcc, |
9845 | | bool a_report); |
9846 | | |
9847 | | WUFFS_BASE__GENERATED_C_CODE |
9848 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
9849 | | wuffs_etc2__decoder__tell_me_more( |
9850 | | wuffs_etc2__decoder* self, |
9851 | | wuffs_base__io_buffer* a_dst, |
9852 | | wuffs_base__more_information* a_minfo, |
9853 | | wuffs_base__io_buffer* a_src); |
9854 | | |
9855 | | WUFFS_BASE__GENERATED_C_CODE |
9856 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
9857 | | wuffs_etc2__decoder__workbuf_len( |
9858 | | const wuffs_etc2__decoder* self); |
9859 | | |
9860 | | #ifdef __cplusplus |
9861 | | } // extern "C" |
9862 | | #endif |
9863 | | |
9864 | | // ---------------- Struct Definitions |
9865 | | |
9866 | | // These structs' fields, and the sizeof them, are private implementation |
9867 | | // details that aren't guaranteed to be stable across Wuffs versions. |
9868 | | // |
9869 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
9870 | | |
9871 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
9872 | | |
9873 | | struct wuffs_etc2__decoder__struct { |
9874 | | // Do not access the private_impl's or private_data's fields directly. There |
9875 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
9876 | | // the wuffs_foo__bar__baz functions. |
9877 | | // |
9878 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
9879 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
9880 | | |
9881 | | struct { |
9882 | | uint32_t magic; |
9883 | | uint32_t active_coroutine; |
9884 | | wuffs_base__vtable vtable_for__wuffs_base__image_decoder; |
9885 | | wuffs_base__vtable null_vtable; |
9886 | | |
9887 | | uint32_t f_pixfmt; |
9888 | | uint32_t f_width; |
9889 | | uint32_t f_height; |
9890 | | uint8_t f_call_sequence; |
9891 | | bool f_srgb; |
9892 | | uint32_t f_num_buffered_blocks; |
9893 | | uint32_t f_dst_x; |
9894 | | uint32_t f_dst_y; |
9895 | | wuffs_base__pixel_swizzler f_swizzler; |
9896 | | |
9897 | | uint32_t p_decode_image_config; |
9898 | | uint32_t p_do_decode_image_config; |
9899 | | uint32_t p_decode_frame_config; |
9900 | | uint32_t p_do_decode_frame_config; |
9901 | | uint32_t p_decode_frame; |
9902 | | uint32_t p_do_decode_frame; |
9903 | | uint32_t p_from_src_to_colors; |
9904 | | wuffs_base__empty_struct (*choosy_from_colors_to_buffer)( |
9905 | | wuffs_etc2__decoder* self); |
9906 | | } private_impl; |
9907 | | |
9908 | | struct { |
9909 | | uint64_t f_colors[2][64]; |
9910 | | uint8_t f_buffer[4096]; |
9911 | | |
9912 | | struct { |
9913 | | uint16_t v_rounded_up_width; |
9914 | | uint16_t v_rounded_up_height; |
9915 | | uint64_t scratch; |
9916 | | } s_do_decode_image_config; |
9917 | | struct { |
9918 | | uint32_t v_remaining; |
9919 | | } s_do_decode_frame; |
9920 | | struct { |
9921 | | uint32_t v_bi; |
9922 | | uint64_t scratch; |
9923 | | } s_from_src_to_colors; |
9924 | | } private_data; |
9925 | | |
9926 | | #ifdef __cplusplus |
9927 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
9928 | | using unique_ptr = std::unique_ptr<wuffs_etc2__decoder, wuffs_unique_ptr_deleter>; |
9929 | | |
9930 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
9931 | | |
9932 | | static inline unique_ptr |
9933 | | alloc() { |
9934 | | return unique_ptr(wuffs_etc2__decoder__alloc()); |
9935 | | } |
9936 | | |
9937 | | static inline wuffs_base__image_decoder::unique_ptr |
9938 | | alloc_as__wuffs_base__image_decoder() { |
9939 | | return wuffs_base__image_decoder::unique_ptr( |
9940 | | wuffs_etc2__decoder__alloc_as__wuffs_base__image_decoder()); |
9941 | | } |
9942 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
9943 | | |
9944 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
9945 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
9946 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
9947 | | // size and field layout is not part of the public, stable, memory-safe API. |
9948 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
9949 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
9950 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
9951 | | // |
9952 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
9953 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
9954 | | // order to provide convenience methods. These forward on "this", so that you |
9955 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
9956 | | wuffs_etc2__decoder__struct() = delete; |
9957 | | wuffs_etc2__decoder__struct(const wuffs_etc2__decoder__struct&) = delete; |
9958 | | wuffs_etc2__decoder__struct& operator=( |
9959 | | const wuffs_etc2__decoder__struct&) = delete; |
9960 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
9961 | | |
9962 | | #if !defined(WUFFS_IMPLEMENTATION) |
9963 | | // As above, the size of the struct is not part of the public API, and unless |
9964 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
9965 | | // allocated, not stack allocated. Its size is not intended to be known at |
9966 | | // compile time, but it is unfortunately divulged as a side effect of |
9967 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
9968 | | // instead of "sizeof T", invoking the operator. To make the two values |
9969 | | // different, so that passing the latter will be rejected by the initialize |
9970 | | // function, we add an arbitrary amount of dead weight. |
9971 | | uint8_t dead_weight[123000000]; // 123 MB. |
9972 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
9973 | | |
9974 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
9975 | | initialize( |
9976 | | size_t sizeof_star_self, |
9977 | | uint64_t wuffs_version, |
9978 | | uint32_t options) { |
9979 | | return wuffs_etc2__decoder__initialize( |
9980 | | this, sizeof_star_self, wuffs_version, options); |
9981 | | } |
9982 | | |
9983 | | inline wuffs_base__image_decoder* |
9984 | | upcast_as__wuffs_base__image_decoder() { |
9985 | | return (wuffs_base__image_decoder*)this; |
9986 | | } |
9987 | | |
9988 | | inline uint64_t |
9989 | | get_quirk( |
9990 | | uint32_t a_key) const { |
9991 | | return wuffs_etc2__decoder__get_quirk(this, a_key); |
9992 | | } |
9993 | | |
9994 | | inline wuffs_base__status |
9995 | | set_quirk( |
9996 | | uint32_t a_key, |
9997 | | uint64_t a_value) { |
9998 | | return wuffs_etc2__decoder__set_quirk(this, a_key, a_value); |
9999 | | } |
10000 | | |
10001 | | inline wuffs_base__status |
10002 | | decode_image_config( |
10003 | | wuffs_base__image_config* a_dst, |
10004 | | wuffs_base__io_buffer* a_src) { |
10005 | | return wuffs_etc2__decoder__decode_image_config(this, a_dst, a_src); |
10006 | | } |
10007 | | |
10008 | | inline wuffs_base__status |
10009 | | decode_frame_config( |
10010 | | wuffs_base__frame_config* a_dst, |
10011 | | wuffs_base__io_buffer* a_src) { |
10012 | | return wuffs_etc2__decoder__decode_frame_config(this, a_dst, a_src); |
10013 | | } |
10014 | | |
10015 | | inline wuffs_base__status |
10016 | | decode_frame( |
10017 | | wuffs_base__pixel_buffer* a_dst, |
10018 | | wuffs_base__io_buffer* a_src, |
10019 | | wuffs_base__pixel_blend a_blend, |
10020 | | wuffs_base__slice_u8 a_workbuf, |
10021 | | wuffs_base__decode_frame_options* a_opts) { |
10022 | | return wuffs_etc2__decoder__decode_frame(this, a_dst, a_src, a_blend, a_workbuf, a_opts); |
10023 | | } |
10024 | | |
10025 | | inline wuffs_base__rect_ie_u32 |
10026 | | frame_dirty_rect() const { |
10027 | | return wuffs_etc2__decoder__frame_dirty_rect(this); |
10028 | | } |
10029 | | |
10030 | | inline uint32_t |
10031 | | num_animation_loops() const { |
10032 | | return wuffs_etc2__decoder__num_animation_loops(this); |
10033 | | } |
10034 | | |
10035 | | inline uint64_t |
10036 | | num_decoded_frame_configs() const { |
10037 | | return wuffs_etc2__decoder__num_decoded_frame_configs(this); |
10038 | | } |
10039 | | |
10040 | | inline uint64_t |
10041 | | num_decoded_frames() const { |
10042 | | return wuffs_etc2__decoder__num_decoded_frames(this); |
10043 | | } |
10044 | | |
10045 | | inline wuffs_base__status |
10046 | | restart_frame( |
10047 | | uint64_t a_index, |
10048 | | uint64_t a_io_position) { |
10049 | | return wuffs_etc2__decoder__restart_frame(this, a_index, a_io_position); |
10050 | | } |
10051 | | |
10052 | | inline wuffs_base__empty_struct |
10053 | | set_report_metadata( |
10054 | | uint32_t a_fourcc, |
10055 | | bool a_report) { |
10056 | | return wuffs_etc2__decoder__set_report_metadata(this, a_fourcc, a_report); |
10057 | | } |
10058 | | |
10059 | | inline wuffs_base__status |
10060 | | tell_me_more( |
10061 | | wuffs_base__io_buffer* a_dst, |
10062 | | wuffs_base__more_information* a_minfo, |
10063 | | wuffs_base__io_buffer* a_src) { |
10064 | | return wuffs_etc2__decoder__tell_me_more(this, a_dst, a_minfo, a_src); |
10065 | | } |
10066 | | |
10067 | | inline wuffs_base__range_ii_u64 |
10068 | | workbuf_len() const { |
10069 | | return wuffs_etc2__decoder__workbuf_len(this); |
10070 | | } |
10071 | | |
10072 | | #endif // __cplusplus |
10073 | | }; // struct wuffs_etc2__decoder__struct |
10074 | | |
10075 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
10076 | | |
10077 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__ETC2) || defined(WUFFS_NONMONOLITHIC) |
10078 | | |
10079 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__GIF) || defined(WUFFS_NONMONOLITHIC) |
10080 | | |
10081 | | // ---------------- Status Codes |
10082 | | |
10083 | | extern const char wuffs_gif__error__bad_lzw_code[]; |
10084 | | extern const char wuffs_gif__error__bad_extension_label[]; |
10085 | | extern const char wuffs_gif__error__bad_frame_size[]; |
10086 | | extern const char wuffs_gif__error__bad_graphic_control[]; |
10087 | | extern const char wuffs_gif__error__bad_header[]; |
10088 | | extern const char wuffs_gif__error__bad_literal_width[]; |
10089 | | extern const char wuffs_gif__error__bad_palette[]; |
10090 | | extern const char wuffs_gif__error__truncated_input[]; |
10091 | | |
10092 | | // ---------------- Public Consts |
10093 | | |
10094 | | #define WUFFS_GIF__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u |
10095 | | |
10096 | 2.34k | #define WUFFS_GIF__QUIRK_DELAY_NUM_DECODED_FRAMES 983928832u |
10097 | | |
10098 | 2.34k | #define WUFFS_GIF__QUIRK_FIRST_FRAME_LOCAL_PALETTE_MEANS_BLACK_BACKGROUND 983928833u |
10099 | | |
10100 | 2.34k | #define WUFFS_GIF__QUIRK_HONOR_BACKGROUND_COLOR 983928834u |
10101 | | |
10102 | 2.34k | #define WUFFS_GIF__QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA 983928835u |
10103 | | |
10104 | 2.34k | #define WUFFS_GIF__QUIRK_IMAGE_BOUNDS_ARE_STRICT 983928836u |
10105 | | |
10106 | 2.34k | #define WUFFS_GIF__QUIRK_REJECT_EMPTY_FRAME 983928837u |
10107 | | |
10108 | 2.34k | #define WUFFS_GIF__QUIRK_REJECT_EMPTY_PALETTE 983928838u |
10109 | | |
10110 | | // ---------------- Struct Declarations |
10111 | | |
10112 | | typedef struct wuffs_gif__decoder__struct wuffs_gif__decoder; |
10113 | | |
10114 | | #ifdef __cplusplus |
10115 | | extern "C" { |
10116 | | #endif |
10117 | | |
10118 | | // ---------------- Public Initializer Prototypes |
10119 | | |
10120 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
10121 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
10122 | | // |
10123 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
10124 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
10125 | | |
10126 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
10127 | | wuffs_gif__decoder__initialize( |
10128 | | wuffs_gif__decoder* self, |
10129 | | size_t sizeof_star_self, |
10130 | | uint64_t wuffs_version, |
10131 | | uint32_t options); |
10132 | | |
10133 | | size_t |
10134 | | sizeof__wuffs_gif__decoder(void); |
10135 | | |
10136 | | // ---------------- Allocs |
10137 | | |
10138 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
10139 | | // memory allocation fails. If they return non-NULL, there is no need to call |
10140 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
10141 | | // calling free on the returned pointer. That pointer is effectively a C++ |
10142 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
10143 | | |
10144 | | wuffs_gif__decoder* |
10145 | | wuffs_gif__decoder__alloc(void); |
10146 | | |
10147 | | static inline wuffs_base__image_decoder* |
10148 | 0 | wuffs_gif__decoder__alloc_as__wuffs_base__image_decoder(void) { |
10149 | 0 | return (wuffs_base__image_decoder*)(wuffs_gif__decoder__alloc()); |
10150 | 0 | } |
10151 | | |
10152 | | // ---------------- Upcasts |
10153 | | |
10154 | | static inline wuffs_base__image_decoder* |
10155 | | wuffs_gif__decoder__upcast_as__wuffs_base__image_decoder( |
10156 | 2.34k | wuffs_gif__decoder* p) { |
10157 | 2.34k | return (wuffs_base__image_decoder*)p; |
10158 | 2.34k | } |
10159 | | |
10160 | | // ---------------- Public Function Prototypes |
10161 | | |
10162 | | WUFFS_BASE__GENERATED_C_CODE |
10163 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
10164 | | wuffs_gif__decoder__get_quirk( |
10165 | | const wuffs_gif__decoder* self, |
10166 | | uint32_t a_key); |
10167 | | |
10168 | | WUFFS_BASE__GENERATED_C_CODE |
10169 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
10170 | | wuffs_gif__decoder__set_quirk( |
10171 | | wuffs_gif__decoder* self, |
10172 | | uint32_t a_key, |
10173 | | uint64_t a_value); |
10174 | | |
10175 | | WUFFS_BASE__GENERATED_C_CODE |
10176 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
10177 | | wuffs_gif__decoder__decode_image_config( |
10178 | | wuffs_gif__decoder* self, |
10179 | | wuffs_base__image_config* a_dst, |
10180 | | wuffs_base__io_buffer* a_src); |
10181 | | |
10182 | | WUFFS_BASE__GENERATED_C_CODE |
10183 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
10184 | | wuffs_gif__decoder__set_report_metadata( |
10185 | | wuffs_gif__decoder* self, |
10186 | | uint32_t a_fourcc, |
10187 | | bool a_report); |
10188 | | |
10189 | | WUFFS_BASE__GENERATED_C_CODE |
10190 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
10191 | | wuffs_gif__decoder__tell_me_more( |
10192 | | wuffs_gif__decoder* self, |
10193 | | wuffs_base__io_buffer* a_dst, |
10194 | | wuffs_base__more_information* a_minfo, |
10195 | | wuffs_base__io_buffer* a_src); |
10196 | | |
10197 | | WUFFS_BASE__GENERATED_C_CODE |
10198 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
10199 | | wuffs_gif__decoder__num_animation_loops( |
10200 | | const wuffs_gif__decoder* self); |
10201 | | |
10202 | | WUFFS_BASE__GENERATED_C_CODE |
10203 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
10204 | | wuffs_gif__decoder__num_decoded_frame_configs( |
10205 | | const wuffs_gif__decoder* self); |
10206 | | |
10207 | | WUFFS_BASE__GENERATED_C_CODE |
10208 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
10209 | | wuffs_gif__decoder__num_decoded_frames( |
10210 | | const wuffs_gif__decoder* self); |
10211 | | |
10212 | | WUFFS_BASE__GENERATED_C_CODE |
10213 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32 |
10214 | | wuffs_gif__decoder__frame_dirty_rect( |
10215 | | const wuffs_gif__decoder* self); |
10216 | | |
10217 | | WUFFS_BASE__GENERATED_C_CODE |
10218 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
10219 | | wuffs_gif__decoder__workbuf_len( |
10220 | | const wuffs_gif__decoder* self); |
10221 | | |
10222 | | WUFFS_BASE__GENERATED_C_CODE |
10223 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
10224 | | wuffs_gif__decoder__restart_frame( |
10225 | | wuffs_gif__decoder* self, |
10226 | | uint64_t a_index, |
10227 | | uint64_t a_io_position); |
10228 | | |
10229 | | WUFFS_BASE__GENERATED_C_CODE |
10230 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
10231 | | wuffs_gif__decoder__decode_frame_config( |
10232 | | wuffs_gif__decoder* self, |
10233 | | wuffs_base__frame_config* a_dst, |
10234 | | wuffs_base__io_buffer* a_src); |
10235 | | |
10236 | | WUFFS_BASE__GENERATED_C_CODE |
10237 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
10238 | | wuffs_gif__decoder__decode_frame( |
10239 | | wuffs_gif__decoder* self, |
10240 | | wuffs_base__pixel_buffer* a_dst, |
10241 | | wuffs_base__io_buffer* a_src, |
10242 | | wuffs_base__pixel_blend a_blend, |
10243 | | wuffs_base__slice_u8 a_workbuf, |
10244 | | wuffs_base__decode_frame_options* a_opts); |
10245 | | |
10246 | | #ifdef __cplusplus |
10247 | | } // extern "C" |
10248 | | #endif |
10249 | | |
10250 | | // ---------------- Struct Definitions |
10251 | | |
10252 | | // These structs' fields, and the sizeof them, are private implementation |
10253 | | // details that aren't guaranteed to be stable across Wuffs versions. |
10254 | | // |
10255 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
10256 | | |
10257 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
10258 | | |
10259 | | struct wuffs_gif__decoder__struct { |
10260 | | // Do not access the private_impl's or private_data's fields directly. There |
10261 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
10262 | | // the wuffs_foo__bar__baz functions. |
10263 | | // |
10264 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
10265 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
10266 | | |
10267 | | struct { |
10268 | | uint32_t magic; |
10269 | | uint32_t active_coroutine; |
10270 | | wuffs_base__vtable vtable_for__wuffs_base__image_decoder; |
10271 | | wuffs_base__vtable null_vtable; |
10272 | | |
10273 | | uint32_t f_width; |
10274 | | uint32_t f_height; |
10275 | | uint8_t f_call_sequence; |
10276 | | bool f_report_metadata_iccp; |
10277 | | bool f_report_metadata_xmp; |
10278 | | uint32_t f_metadata_fourcc; |
10279 | | uint64_t f_metadata_io_position; |
10280 | | bool f_quirks[7]; |
10281 | | bool f_delayed_num_decoded_frames; |
10282 | | bool f_seen_header; |
10283 | | bool f_ignored_but_affects_benchmarks; |
10284 | | bool f_has_global_palette; |
10285 | | uint8_t f_interlace; |
10286 | | bool f_seen_num_animation_loops_value; |
10287 | | uint32_t f_num_animation_loops_value; |
10288 | | uint32_t f_background_color_u32_argb_premul; |
10289 | | uint32_t f_black_color_u32_argb_premul; |
10290 | | bool f_gc_has_transparent_index; |
10291 | | uint8_t f_gc_transparent_index; |
10292 | | uint8_t f_gc_disposal; |
10293 | | uint64_t f_gc_duration; |
10294 | | uint64_t f_frame_config_io_position; |
10295 | | uint64_t f_num_decoded_frame_configs_value; |
10296 | | uint64_t f_num_decoded_frames_value; |
10297 | | uint32_t f_frame_rect_x0; |
10298 | | uint32_t f_frame_rect_y0; |
10299 | | uint32_t f_frame_rect_x1; |
10300 | | uint32_t f_frame_rect_y1; |
10301 | | uint32_t f_dst_x; |
10302 | | uint32_t f_dst_y; |
10303 | | uint32_t f_dirty_max_excl_y; |
10304 | | uint64_t f_compressed_ri; |
10305 | | uint64_t f_compressed_wi; |
10306 | | wuffs_base__pixel_swizzler f_swizzler; |
10307 | | uint32_t f_lzw_pending_literal_width_plus_one; |
10308 | | uint32_t f_lzw_literal_width; |
10309 | | uint32_t f_lzw_clear_code; |
10310 | | uint32_t f_lzw_end_code; |
10311 | | uint32_t f_lzw_save_code; |
10312 | | uint32_t f_lzw_prev_code; |
10313 | | uint32_t f_lzw_width; |
10314 | | uint32_t f_lzw_bits; |
10315 | | uint32_t f_lzw_n_bits; |
10316 | | uint32_t f_lzw_output_ri; |
10317 | | uint32_t f_lzw_output_wi; |
10318 | | uint32_t f_lzw_read_from_return_value; |
10319 | | uint16_t f_lzw_prefixes[4096]; |
10320 | | |
10321 | | uint32_t p_decode_image_config; |
10322 | | uint32_t p_do_decode_image_config; |
10323 | | uint32_t p_tell_me_more; |
10324 | | uint32_t p_do_tell_me_more; |
10325 | | uint32_t p_decode_frame_config; |
10326 | | uint32_t p_do_decode_frame_config; |
10327 | | uint32_t p_skip_frame; |
10328 | | uint32_t p_decode_frame; |
10329 | | uint32_t p_do_decode_frame; |
10330 | | uint32_t p_decode_up_to_id_part1; |
10331 | | uint32_t p_decode_header; |
10332 | | uint32_t p_decode_lsd; |
10333 | | uint32_t p_decode_extension; |
10334 | | uint32_t p_skip_blocks; |
10335 | | uint32_t p_decode_ae; |
10336 | | uint32_t p_decode_gc; |
10337 | | uint32_t p_decode_id_part0; |
10338 | | uint32_t p_decode_id_part1; |
10339 | | uint32_t p_decode_id_part2; |
10340 | | } private_impl; |
10341 | | |
10342 | | struct { |
10343 | | uint8_t f_compressed[4096]; |
10344 | | uint8_t f_palettes[2][1024]; |
10345 | | uint8_t f_dst_palette[1024]; |
10346 | | uint8_t f_lzw_suffixes[4096][8]; |
10347 | | uint16_t f_lzw_lm1s[4096]; |
10348 | | uint8_t f_lzw_output[8199]; |
10349 | | |
10350 | | struct { |
10351 | | uint32_t v_background_color; |
10352 | | } s_do_decode_frame_config; |
10353 | | struct { |
10354 | | uint64_t scratch; |
10355 | | } s_skip_frame; |
10356 | | struct { |
10357 | | uint64_t scratch; |
10358 | | } s_decode_header; |
10359 | | struct { |
10360 | | uint8_t v_flags; |
10361 | | uint8_t v_background_color_index; |
10362 | | uint32_t v_num_palette_entries; |
10363 | | uint32_t v_i; |
10364 | | uint64_t scratch; |
10365 | | } s_decode_lsd; |
10366 | | struct { |
10367 | | uint64_t scratch; |
10368 | | } s_skip_blocks; |
10369 | | struct { |
10370 | | uint8_t v_block_size; |
10371 | | bool v_is_animexts; |
10372 | | bool v_is_netscape; |
10373 | | bool v_is_iccp; |
10374 | | bool v_is_xmp; |
10375 | | uint64_t scratch; |
10376 | | } s_decode_ae; |
10377 | | struct { |
10378 | | uint64_t scratch; |
10379 | | } s_decode_gc; |
10380 | | struct { |
10381 | | uint64_t scratch; |
10382 | | } s_decode_id_part0; |
10383 | | struct { |
10384 | | uint8_t v_which_palette; |
10385 | | uint32_t v_num_palette_entries; |
10386 | | uint32_t v_i; |
10387 | | uint64_t scratch; |
10388 | | } s_decode_id_part1; |
10389 | | struct { |
10390 | | uint64_t v_block_size; |
10391 | | bool v_need_block_size; |
10392 | | uint64_t scratch; |
10393 | | } s_decode_id_part2; |
10394 | | } private_data; |
10395 | | |
10396 | | #ifdef __cplusplus |
10397 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
10398 | | using unique_ptr = std::unique_ptr<wuffs_gif__decoder, wuffs_unique_ptr_deleter>; |
10399 | | |
10400 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
10401 | | |
10402 | | static inline unique_ptr |
10403 | | alloc() { |
10404 | | return unique_ptr(wuffs_gif__decoder__alloc()); |
10405 | | } |
10406 | | |
10407 | | static inline wuffs_base__image_decoder::unique_ptr |
10408 | | alloc_as__wuffs_base__image_decoder() { |
10409 | | return wuffs_base__image_decoder::unique_ptr( |
10410 | | wuffs_gif__decoder__alloc_as__wuffs_base__image_decoder()); |
10411 | | } |
10412 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
10413 | | |
10414 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
10415 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
10416 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
10417 | | // size and field layout is not part of the public, stable, memory-safe API. |
10418 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
10419 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
10420 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
10421 | | // |
10422 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
10423 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
10424 | | // order to provide convenience methods. These forward on "this", so that you |
10425 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
10426 | | wuffs_gif__decoder__struct() = delete; |
10427 | | wuffs_gif__decoder__struct(const wuffs_gif__decoder__struct&) = delete; |
10428 | | wuffs_gif__decoder__struct& operator=( |
10429 | | const wuffs_gif__decoder__struct&) = delete; |
10430 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
10431 | | |
10432 | | #if !defined(WUFFS_IMPLEMENTATION) |
10433 | | // As above, the size of the struct is not part of the public API, and unless |
10434 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
10435 | | // allocated, not stack allocated. Its size is not intended to be known at |
10436 | | // compile time, but it is unfortunately divulged as a side effect of |
10437 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
10438 | | // instead of "sizeof T", invoking the operator. To make the two values |
10439 | | // different, so that passing the latter will be rejected by the initialize |
10440 | | // function, we add an arbitrary amount of dead weight. |
10441 | | uint8_t dead_weight[123000000]; // 123 MB. |
10442 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
10443 | | |
10444 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
10445 | | initialize( |
10446 | | size_t sizeof_star_self, |
10447 | | uint64_t wuffs_version, |
10448 | | uint32_t options) { |
10449 | | return wuffs_gif__decoder__initialize( |
10450 | | this, sizeof_star_self, wuffs_version, options); |
10451 | | } |
10452 | | |
10453 | | inline wuffs_base__image_decoder* |
10454 | | upcast_as__wuffs_base__image_decoder() { |
10455 | | return (wuffs_base__image_decoder*)this; |
10456 | | } |
10457 | | |
10458 | | inline uint64_t |
10459 | | get_quirk( |
10460 | | uint32_t a_key) const { |
10461 | | return wuffs_gif__decoder__get_quirk(this, a_key); |
10462 | | } |
10463 | | |
10464 | | inline wuffs_base__status |
10465 | | set_quirk( |
10466 | | uint32_t a_key, |
10467 | | uint64_t a_value) { |
10468 | | return wuffs_gif__decoder__set_quirk(this, a_key, a_value); |
10469 | | } |
10470 | | |
10471 | | inline wuffs_base__status |
10472 | | decode_image_config( |
10473 | | wuffs_base__image_config* a_dst, |
10474 | | wuffs_base__io_buffer* a_src) { |
10475 | | return wuffs_gif__decoder__decode_image_config(this, a_dst, a_src); |
10476 | | } |
10477 | | |
10478 | | inline wuffs_base__empty_struct |
10479 | | set_report_metadata( |
10480 | | uint32_t a_fourcc, |
10481 | | bool a_report) { |
10482 | | return wuffs_gif__decoder__set_report_metadata(this, a_fourcc, a_report); |
10483 | | } |
10484 | | |
10485 | | inline wuffs_base__status |
10486 | | tell_me_more( |
10487 | | wuffs_base__io_buffer* a_dst, |
10488 | | wuffs_base__more_information* a_minfo, |
10489 | | wuffs_base__io_buffer* a_src) { |
10490 | | return wuffs_gif__decoder__tell_me_more(this, a_dst, a_minfo, a_src); |
10491 | | } |
10492 | | |
10493 | | inline uint32_t |
10494 | | num_animation_loops() const { |
10495 | | return wuffs_gif__decoder__num_animation_loops(this); |
10496 | | } |
10497 | | |
10498 | | inline uint64_t |
10499 | | num_decoded_frame_configs() const { |
10500 | | return wuffs_gif__decoder__num_decoded_frame_configs(this); |
10501 | | } |
10502 | | |
10503 | | inline uint64_t |
10504 | | num_decoded_frames() const { |
10505 | | return wuffs_gif__decoder__num_decoded_frames(this); |
10506 | | } |
10507 | | |
10508 | | inline wuffs_base__rect_ie_u32 |
10509 | | frame_dirty_rect() const { |
10510 | | return wuffs_gif__decoder__frame_dirty_rect(this); |
10511 | | } |
10512 | | |
10513 | | inline wuffs_base__range_ii_u64 |
10514 | | workbuf_len() const { |
10515 | | return wuffs_gif__decoder__workbuf_len(this); |
10516 | | } |
10517 | | |
10518 | | inline wuffs_base__status |
10519 | | restart_frame( |
10520 | | uint64_t a_index, |
10521 | | uint64_t a_io_position) { |
10522 | | return wuffs_gif__decoder__restart_frame(this, a_index, a_io_position); |
10523 | | } |
10524 | | |
10525 | | inline wuffs_base__status |
10526 | | decode_frame_config( |
10527 | | wuffs_base__frame_config* a_dst, |
10528 | | wuffs_base__io_buffer* a_src) { |
10529 | | return wuffs_gif__decoder__decode_frame_config(this, a_dst, a_src); |
10530 | | } |
10531 | | |
10532 | | inline wuffs_base__status |
10533 | | decode_frame( |
10534 | | wuffs_base__pixel_buffer* a_dst, |
10535 | | wuffs_base__io_buffer* a_src, |
10536 | | wuffs_base__pixel_blend a_blend, |
10537 | | wuffs_base__slice_u8 a_workbuf, |
10538 | | wuffs_base__decode_frame_options* a_opts) { |
10539 | | return wuffs_gif__decoder__decode_frame(this, a_dst, a_src, a_blend, a_workbuf, a_opts); |
10540 | | } |
10541 | | |
10542 | | #endif // __cplusplus |
10543 | | }; // struct wuffs_gif__decoder__struct |
10544 | | |
10545 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
10546 | | |
10547 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__GIF) || defined(WUFFS_NONMONOLITHIC) |
10548 | | |
10549 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__GZIP) || defined(WUFFS_NONMONOLITHIC) |
10550 | | |
10551 | | // ---------------- Status Codes |
10552 | | |
10553 | | extern const char wuffs_gzip__error__bad_checksum[]; |
10554 | | extern const char wuffs_gzip__error__bad_compression_method[]; |
10555 | | extern const char wuffs_gzip__error__bad_encoding_flags[]; |
10556 | | extern const char wuffs_gzip__error__bad_header[]; |
10557 | | extern const char wuffs_gzip__error__truncated_input[]; |
10558 | | |
10559 | | // ---------------- Public Consts |
10560 | | |
10561 | | #define WUFFS_GZIP__DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE 0u |
10562 | | |
10563 | | #define WUFFS_GZIP__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 1u |
10564 | | |
10565 | | // ---------------- Struct Declarations |
10566 | | |
10567 | | typedef struct wuffs_gzip__decoder__struct wuffs_gzip__decoder; |
10568 | | |
10569 | | #ifdef __cplusplus |
10570 | | extern "C" { |
10571 | | #endif |
10572 | | |
10573 | | // ---------------- Public Initializer Prototypes |
10574 | | |
10575 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
10576 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
10577 | | // |
10578 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
10579 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
10580 | | |
10581 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
10582 | | wuffs_gzip__decoder__initialize( |
10583 | | wuffs_gzip__decoder* self, |
10584 | | size_t sizeof_star_self, |
10585 | | uint64_t wuffs_version, |
10586 | | uint32_t options); |
10587 | | |
10588 | | size_t |
10589 | | sizeof__wuffs_gzip__decoder(void); |
10590 | | |
10591 | | // ---------------- Allocs |
10592 | | |
10593 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
10594 | | // memory allocation fails. If they return non-NULL, there is no need to call |
10595 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
10596 | | // calling free on the returned pointer. That pointer is effectively a C++ |
10597 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
10598 | | |
10599 | | wuffs_gzip__decoder* |
10600 | | wuffs_gzip__decoder__alloc(void); |
10601 | | |
10602 | | static inline wuffs_base__io_transformer* |
10603 | | wuffs_gzip__decoder__alloc_as__wuffs_base__io_transformer(void) { |
10604 | | return (wuffs_base__io_transformer*)(wuffs_gzip__decoder__alloc()); |
10605 | | } |
10606 | | |
10607 | | // ---------------- Upcasts |
10608 | | |
10609 | | static inline wuffs_base__io_transformer* |
10610 | | wuffs_gzip__decoder__upcast_as__wuffs_base__io_transformer( |
10611 | | wuffs_gzip__decoder* p) { |
10612 | | return (wuffs_base__io_transformer*)p; |
10613 | | } |
10614 | | |
10615 | | // ---------------- Public Function Prototypes |
10616 | | |
10617 | | WUFFS_BASE__GENERATED_C_CODE |
10618 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
10619 | | wuffs_gzip__decoder__get_quirk( |
10620 | | const wuffs_gzip__decoder* self, |
10621 | | uint32_t a_key); |
10622 | | |
10623 | | WUFFS_BASE__GENERATED_C_CODE |
10624 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
10625 | | wuffs_gzip__decoder__set_quirk( |
10626 | | wuffs_gzip__decoder* self, |
10627 | | uint32_t a_key, |
10628 | | uint64_t a_value); |
10629 | | |
10630 | | WUFFS_BASE__GENERATED_C_CODE |
10631 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63 |
10632 | | wuffs_gzip__decoder__dst_history_retain_length( |
10633 | | const wuffs_gzip__decoder* self); |
10634 | | |
10635 | | WUFFS_BASE__GENERATED_C_CODE |
10636 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
10637 | | wuffs_gzip__decoder__workbuf_len( |
10638 | | const wuffs_gzip__decoder* self); |
10639 | | |
10640 | | WUFFS_BASE__GENERATED_C_CODE |
10641 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
10642 | | wuffs_gzip__decoder__transform_io( |
10643 | | wuffs_gzip__decoder* self, |
10644 | | wuffs_base__io_buffer* a_dst, |
10645 | | wuffs_base__io_buffer* a_src, |
10646 | | wuffs_base__slice_u8 a_workbuf); |
10647 | | |
10648 | | #ifdef __cplusplus |
10649 | | } // extern "C" |
10650 | | #endif |
10651 | | |
10652 | | // ---------------- Struct Definitions |
10653 | | |
10654 | | // These structs' fields, and the sizeof them, are private implementation |
10655 | | // details that aren't guaranteed to be stable across Wuffs versions. |
10656 | | // |
10657 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
10658 | | |
10659 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
10660 | | |
10661 | | struct wuffs_gzip__decoder__struct { |
10662 | | // Do not access the private_impl's or private_data's fields directly. There |
10663 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
10664 | | // the wuffs_foo__bar__baz functions. |
10665 | | // |
10666 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
10667 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
10668 | | |
10669 | | struct { |
10670 | | uint32_t magic; |
10671 | | uint32_t active_coroutine; |
10672 | | wuffs_base__vtable vtable_for__wuffs_base__io_transformer; |
10673 | | wuffs_base__vtable null_vtable; |
10674 | | |
10675 | | bool f_ignore_checksum; |
10676 | | |
10677 | | uint32_t p_transform_io; |
10678 | | uint32_t p_do_transform_io; |
10679 | | } private_impl; |
10680 | | |
10681 | | struct { |
10682 | | wuffs_crc32__ieee_hasher f_checksum; |
10683 | | wuffs_deflate__decoder f_flate; |
10684 | | |
10685 | | struct { |
10686 | | uint8_t v_flags; |
10687 | | uint32_t v_checksum_have; |
10688 | | uint32_t v_decoded_length_have; |
10689 | | uint32_t v_checksum_want; |
10690 | | uint64_t scratch; |
10691 | | } s_do_transform_io; |
10692 | | } private_data; |
10693 | | |
10694 | | #ifdef __cplusplus |
10695 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
10696 | | using unique_ptr = std::unique_ptr<wuffs_gzip__decoder, wuffs_unique_ptr_deleter>; |
10697 | | |
10698 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
10699 | | |
10700 | | static inline unique_ptr |
10701 | | alloc() { |
10702 | | return unique_ptr(wuffs_gzip__decoder__alloc()); |
10703 | | } |
10704 | | |
10705 | | static inline wuffs_base__io_transformer::unique_ptr |
10706 | | alloc_as__wuffs_base__io_transformer() { |
10707 | | return wuffs_base__io_transformer::unique_ptr( |
10708 | | wuffs_gzip__decoder__alloc_as__wuffs_base__io_transformer()); |
10709 | | } |
10710 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
10711 | | |
10712 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
10713 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
10714 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
10715 | | // size and field layout is not part of the public, stable, memory-safe API. |
10716 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
10717 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
10718 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
10719 | | // |
10720 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
10721 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
10722 | | // order to provide convenience methods. These forward on "this", so that you |
10723 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
10724 | | wuffs_gzip__decoder__struct() = delete; |
10725 | | wuffs_gzip__decoder__struct(const wuffs_gzip__decoder__struct&) = delete; |
10726 | | wuffs_gzip__decoder__struct& operator=( |
10727 | | const wuffs_gzip__decoder__struct&) = delete; |
10728 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
10729 | | |
10730 | | #if !defined(WUFFS_IMPLEMENTATION) |
10731 | | // As above, the size of the struct is not part of the public API, and unless |
10732 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
10733 | | // allocated, not stack allocated. Its size is not intended to be known at |
10734 | | // compile time, but it is unfortunately divulged as a side effect of |
10735 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
10736 | | // instead of "sizeof T", invoking the operator. To make the two values |
10737 | | // different, so that passing the latter will be rejected by the initialize |
10738 | | // function, we add an arbitrary amount of dead weight. |
10739 | | uint8_t dead_weight[123000000]; // 123 MB. |
10740 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
10741 | | |
10742 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
10743 | | initialize( |
10744 | | size_t sizeof_star_self, |
10745 | | uint64_t wuffs_version, |
10746 | | uint32_t options) { |
10747 | | return wuffs_gzip__decoder__initialize( |
10748 | | this, sizeof_star_self, wuffs_version, options); |
10749 | | } |
10750 | | |
10751 | | inline wuffs_base__io_transformer* |
10752 | | upcast_as__wuffs_base__io_transformer() { |
10753 | | return (wuffs_base__io_transformer*)this; |
10754 | | } |
10755 | | |
10756 | | inline uint64_t |
10757 | | get_quirk( |
10758 | | uint32_t a_key) const { |
10759 | | return wuffs_gzip__decoder__get_quirk(this, a_key); |
10760 | | } |
10761 | | |
10762 | | inline wuffs_base__status |
10763 | | set_quirk( |
10764 | | uint32_t a_key, |
10765 | | uint64_t a_value) { |
10766 | | return wuffs_gzip__decoder__set_quirk(this, a_key, a_value); |
10767 | | } |
10768 | | |
10769 | | inline wuffs_base__optional_u63 |
10770 | | dst_history_retain_length() const { |
10771 | | return wuffs_gzip__decoder__dst_history_retain_length(this); |
10772 | | } |
10773 | | |
10774 | | inline wuffs_base__range_ii_u64 |
10775 | | workbuf_len() const { |
10776 | | return wuffs_gzip__decoder__workbuf_len(this); |
10777 | | } |
10778 | | |
10779 | | inline wuffs_base__status |
10780 | | transform_io( |
10781 | | wuffs_base__io_buffer* a_dst, |
10782 | | wuffs_base__io_buffer* a_src, |
10783 | | wuffs_base__slice_u8 a_workbuf) { |
10784 | | return wuffs_gzip__decoder__transform_io(this, a_dst, a_src, a_workbuf); |
10785 | | } |
10786 | | |
10787 | | #endif // __cplusplus |
10788 | | }; // struct wuffs_gzip__decoder__struct |
10789 | | |
10790 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
10791 | | |
10792 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__GZIP) || defined(WUFFS_NONMONOLITHIC) |
10793 | | |
10794 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__HANDSUM) || defined(WUFFS_NONMONOLITHIC) |
10795 | | |
10796 | | // ---------------- Status Codes |
10797 | | |
10798 | | extern const char wuffs_handsum__error__bad_header[]; |
10799 | | extern const char wuffs_handsum__error__truncated_input[]; |
10800 | | |
10801 | | // ---------------- Public Consts |
10802 | | |
10803 | | #define WUFFS_HANDSUM__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u |
10804 | | |
10805 | | // ---------------- Struct Declarations |
10806 | | |
10807 | | typedef struct wuffs_handsum__decoder__struct wuffs_handsum__decoder; |
10808 | | |
10809 | | #ifdef __cplusplus |
10810 | | extern "C" { |
10811 | | #endif |
10812 | | |
10813 | | // ---------------- Public Initializer Prototypes |
10814 | | |
10815 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
10816 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
10817 | | // |
10818 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
10819 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
10820 | | |
10821 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
10822 | | wuffs_handsum__decoder__initialize( |
10823 | | wuffs_handsum__decoder* self, |
10824 | | size_t sizeof_star_self, |
10825 | | uint64_t wuffs_version, |
10826 | | uint32_t options); |
10827 | | |
10828 | | size_t |
10829 | | sizeof__wuffs_handsum__decoder(void); |
10830 | | |
10831 | | // ---------------- Allocs |
10832 | | |
10833 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
10834 | | // memory allocation fails. If they return non-NULL, there is no need to call |
10835 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
10836 | | // calling free on the returned pointer. That pointer is effectively a C++ |
10837 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
10838 | | |
10839 | | wuffs_handsum__decoder* |
10840 | | wuffs_handsum__decoder__alloc(void); |
10841 | | |
10842 | | static inline wuffs_base__image_decoder* |
10843 | | wuffs_handsum__decoder__alloc_as__wuffs_base__image_decoder(void) { |
10844 | | return (wuffs_base__image_decoder*)(wuffs_handsum__decoder__alloc()); |
10845 | | } |
10846 | | |
10847 | | // ---------------- Upcasts |
10848 | | |
10849 | | static inline wuffs_base__image_decoder* |
10850 | | wuffs_handsum__decoder__upcast_as__wuffs_base__image_decoder( |
10851 | | wuffs_handsum__decoder* p) { |
10852 | | return (wuffs_base__image_decoder*)p; |
10853 | | } |
10854 | | |
10855 | | // ---------------- Public Function Prototypes |
10856 | | |
10857 | | WUFFS_BASE__GENERATED_C_CODE |
10858 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
10859 | | wuffs_handsum__decoder__get_quirk( |
10860 | | const wuffs_handsum__decoder* self, |
10861 | | uint32_t a_key); |
10862 | | |
10863 | | WUFFS_BASE__GENERATED_C_CODE |
10864 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
10865 | | wuffs_handsum__decoder__set_quirk( |
10866 | | wuffs_handsum__decoder* self, |
10867 | | uint32_t a_key, |
10868 | | uint64_t a_value); |
10869 | | |
10870 | | WUFFS_BASE__GENERATED_C_CODE |
10871 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
10872 | | wuffs_handsum__decoder__decode_image_config( |
10873 | | wuffs_handsum__decoder* self, |
10874 | | wuffs_base__image_config* a_dst, |
10875 | | wuffs_base__io_buffer* a_src); |
10876 | | |
10877 | | WUFFS_BASE__GENERATED_C_CODE |
10878 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
10879 | | wuffs_handsum__decoder__decode_frame_config( |
10880 | | wuffs_handsum__decoder* self, |
10881 | | wuffs_base__frame_config* a_dst, |
10882 | | wuffs_base__io_buffer* a_src); |
10883 | | |
10884 | | WUFFS_BASE__GENERATED_C_CODE |
10885 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
10886 | | wuffs_handsum__decoder__decode_frame( |
10887 | | wuffs_handsum__decoder* self, |
10888 | | wuffs_base__pixel_buffer* a_dst, |
10889 | | wuffs_base__io_buffer* a_src, |
10890 | | wuffs_base__pixel_blend a_blend, |
10891 | | wuffs_base__slice_u8 a_workbuf, |
10892 | | wuffs_base__decode_frame_options* a_opts); |
10893 | | |
10894 | | WUFFS_BASE__GENERATED_C_CODE |
10895 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32 |
10896 | | wuffs_handsum__decoder__frame_dirty_rect( |
10897 | | const wuffs_handsum__decoder* self); |
10898 | | |
10899 | | WUFFS_BASE__GENERATED_C_CODE |
10900 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
10901 | | wuffs_handsum__decoder__num_animation_loops( |
10902 | | const wuffs_handsum__decoder* self); |
10903 | | |
10904 | | WUFFS_BASE__GENERATED_C_CODE |
10905 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
10906 | | wuffs_handsum__decoder__num_decoded_frame_configs( |
10907 | | const wuffs_handsum__decoder* self); |
10908 | | |
10909 | | WUFFS_BASE__GENERATED_C_CODE |
10910 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
10911 | | wuffs_handsum__decoder__num_decoded_frames( |
10912 | | const wuffs_handsum__decoder* self); |
10913 | | |
10914 | | WUFFS_BASE__GENERATED_C_CODE |
10915 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
10916 | | wuffs_handsum__decoder__restart_frame( |
10917 | | wuffs_handsum__decoder* self, |
10918 | | uint64_t a_index, |
10919 | | uint64_t a_io_position); |
10920 | | |
10921 | | WUFFS_BASE__GENERATED_C_CODE |
10922 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
10923 | | wuffs_handsum__decoder__set_report_metadata( |
10924 | | wuffs_handsum__decoder* self, |
10925 | | uint32_t a_fourcc, |
10926 | | bool a_report); |
10927 | | |
10928 | | WUFFS_BASE__GENERATED_C_CODE |
10929 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
10930 | | wuffs_handsum__decoder__tell_me_more( |
10931 | | wuffs_handsum__decoder* self, |
10932 | | wuffs_base__io_buffer* a_dst, |
10933 | | wuffs_base__more_information* a_minfo, |
10934 | | wuffs_base__io_buffer* a_src); |
10935 | | |
10936 | | WUFFS_BASE__GENERATED_C_CODE |
10937 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
10938 | | wuffs_handsum__decoder__workbuf_len( |
10939 | | const wuffs_handsum__decoder* self); |
10940 | | |
10941 | | #ifdef __cplusplus |
10942 | | } // extern "C" |
10943 | | #endif |
10944 | | |
10945 | | // ---------------- Struct Definitions |
10946 | | |
10947 | | // These structs' fields, and the sizeof them, are private implementation |
10948 | | // details that aren't guaranteed to be stable across Wuffs versions. |
10949 | | // |
10950 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
10951 | | |
10952 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
10953 | | |
10954 | | struct wuffs_handsum__decoder__struct { |
10955 | | // Do not access the private_impl's or private_data's fields directly. There |
10956 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
10957 | | // the wuffs_foo__bar__baz functions. |
10958 | | // |
10959 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
10960 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
10961 | | |
10962 | | struct { |
10963 | | uint32_t magic; |
10964 | | uint32_t active_coroutine; |
10965 | | wuffs_base__vtable vtable_for__wuffs_base__image_decoder; |
10966 | | wuffs_base__vtable null_vtable; |
10967 | | |
10968 | | uint32_t f_width; |
10969 | | uint32_t f_height; |
10970 | | uint32_t f_color; |
10971 | | uint32_t f_quality; |
10972 | | uint8_t f_call_sequence; |
10973 | | uint16_t f_bit_offset; |
10974 | | uint16_t f_coeffs[25]; |
10975 | | wuffs_base__pixel_swizzler f_swizzler; |
10976 | | |
10977 | | uint32_t p_decode_image_config; |
10978 | | uint32_t p_do_decode_image_config; |
10979 | | uint32_t p_decode_frame_config; |
10980 | | uint32_t p_do_decode_frame_config; |
10981 | | uint32_t p_decode_frame; |
10982 | | uint32_t p_do_decode_frame; |
10983 | | } private_impl; |
10984 | | |
10985 | | struct { |
10986 | | uint8_t f_bits[256]; |
10987 | | uint8_t f_buffers[2][16][64]; |
10988 | | |
10989 | | struct { |
10990 | | uint64_t scratch; |
10991 | | } s_do_decode_image_config; |
10992 | | struct { |
10993 | | uint32_t v_num_read; |
10994 | | } s_do_decode_frame; |
10995 | | } private_data; |
10996 | | |
10997 | | #ifdef __cplusplus |
10998 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
10999 | | using unique_ptr = std::unique_ptr<wuffs_handsum__decoder, wuffs_unique_ptr_deleter>; |
11000 | | |
11001 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
11002 | | |
11003 | | static inline unique_ptr |
11004 | | alloc() { |
11005 | | return unique_ptr(wuffs_handsum__decoder__alloc()); |
11006 | | } |
11007 | | |
11008 | | static inline wuffs_base__image_decoder::unique_ptr |
11009 | | alloc_as__wuffs_base__image_decoder() { |
11010 | | return wuffs_base__image_decoder::unique_ptr( |
11011 | | wuffs_handsum__decoder__alloc_as__wuffs_base__image_decoder()); |
11012 | | } |
11013 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
11014 | | |
11015 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
11016 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
11017 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
11018 | | // size and field layout is not part of the public, stable, memory-safe API. |
11019 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
11020 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
11021 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
11022 | | // |
11023 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
11024 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
11025 | | // order to provide convenience methods. These forward on "this", so that you |
11026 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
11027 | | wuffs_handsum__decoder__struct() = delete; |
11028 | | wuffs_handsum__decoder__struct(const wuffs_handsum__decoder__struct&) = delete; |
11029 | | wuffs_handsum__decoder__struct& operator=( |
11030 | | const wuffs_handsum__decoder__struct&) = delete; |
11031 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
11032 | | |
11033 | | #if !defined(WUFFS_IMPLEMENTATION) |
11034 | | // As above, the size of the struct is not part of the public API, and unless |
11035 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
11036 | | // allocated, not stack allocated. Its size is not intended to be known at |
11037 | | // compile time, but it is unfortunately divulged as a side effect of |
11038 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
11039 | | // instead of "sizeof T", invoking the operator. To make the two values |
11040 | | // different, so that passing the latter will be rejected by the initialize |
11041 | | // function, we add an arbitrary amount of dead weight. |
11042 | | uint8_t dead_weight[123000000]; // 123 MB. |
11043 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
11044 | | |
11045 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
11046 | | initialize( |
11047 | | size_t sizeof_star_self, |
11048 | | uint64_t wuffs_version, |
11049 | | uint32_t options) { |
11050 | | return wuffs_handsum__decoder__initialize( |
11051 | | this, sizeof_star_self, wuffs_version, options); |
11052 | | } |
11053 | | |
11054 | | inline wuffs_base__image_decoder* |
11055 | | upcast_as__wuffs_base__image_decoder() { |
11056 | | return (wuffs_base__image_decoder*)this; |
11057 | | } |
11058 | | |
11059 | | inline uint64_t |
11060 | | get_quirk( |
11061 | | uint32_t a_key) const { |
11062 | | return wuffs_handsum__decoder__get_quirk(this, a_key); |
11063 | | } |
11064 | | |
11065 | | inline wuffs_base__status |
11066 | | set_quirk( |
11067 | | uint32_t a_key, |
11068 | | uint64_t a_value) { |
11069 | | return wuffs_handsum__decoder__set_quirk(this, a_key, a_value); |
11070 | | } |
11071 | | |
11072 | | inline wuffs_base__status |
11073 | | decode_image_config( |
11074 | | wuffs_base__image_config* a_dst, |
11075 | | wuffs_base__io_buffer* a_src) { |
11076 | | return wuffs_handsum__decoder__decode_image_config(this, a_dst, a_src); |
11077 | | } |
11078 | | |
11079 | | inline wuffs_base__status |
11080 | | decode_frame_config( |
11081 | | wuffs_base__frame_config* a_dst, |
11082 | | wuffs_base__io_buffer* a_src) { |
11083 | | return wuffs_handsum__decoder__decode_frame_config(this, a_dst, a_src); |
11084 | | } |
11085 | | |
11086 | | inline wuffs_base__status |
11087 | | decode_frame( |
11088 | | wuffs_base__pixel_buffer* a_dst, |
11089 | | wuffs_base__io_buffer* a_src, |
11090 | | wuffs_base__pixel_blend a_blend, |
11091 | | wuffs_base__slice_u8 a_workbuf, |
11092 | | wuffs_base__decode_frame_options* a_opts) { |
11093 | | return wuffs_handsum__decoder__decode_frame(this, a_dst, a_src, a_blend, a_workbuf, a_opts); |
11094 | | } |
11095 | | |
11096 | | inline wuffs_base__rect_ie_u32 |
11097 | | frame_dirty_rect() const { |
11098 | | return wuffs_handsum__decoder__frame_dirty_rect(this); |
11099 | | } |
11100 | | |
11101 | | inline uint32_t |
11102 | | num_animation_loops() const { |
11103 | | return wuffs_handsum__decoder__num_animation_loops(this); |
11104 | | } |
11105 | | |
11106 | | inline uint64_t |
11107 | | num_decoded_frame_configs() const { |
11108 | | return wuffs_handsum__decoder__num_decoded_frame_configs(this); |
11109 | | } |
11110 | | |
11111 | | inline uint64_t |
11112 | | num_decoded_frames() const { |
11113 | | return wuffs_handsum__decoder__num_decoded_frames(this); |
11114 | | } |
11115 | | |
11116 | | inline wuffs_base__status |
11117 | | restart_frame( |
11118 | | uint64_t a_index, |
11119 | | uint64_t a_io_position) { |
11120 | | return wuffs_handsum__decoder__restart_frame(this, a_index, a_io_position); |
11121 | | } |
11122 | | |
11123 | | inline wuffs_base__empty_struct |
11124 | | set_report_metadata( |
11125 | | uint32_t a_fourcc, |
11126 | | bool a_report) { |
11127 | | return wuffs_handsum__decoder__set_report_metadata(this, a_fourcc, a_report); |
11128 | | } |
11129 | | |
11130 | | inline wuffs_base__status |
11131 | | tell_me_more( |
11132 | | wuffs_base__io_buffer* a_dst, |
11133 | | wuffs_base__more_information* a_minfo, |
11134 | | wuffs_base__io_buffer* a_src) { |
11135 | | return wuffs_handsum__decoder__tell_me_more(this, a_dst, a_minfo, a_src); |
11136 | | } |
11137 | | |
11138 | | inline wuffs_base__range_ii_u64 |
11139 | | workbuf_len() const { |
11140 | | return wuffs_handsum__decoder__workbuf_len(this); |
11141 | | } |
11142 | | |
11143 | | #endif // __cplusplus |
11144 | | }; // struct wuffs_handsum__decoder__struct |
11145 | | |
11146 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
11147 | | |
11148 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__HANDSUM) || defined(WUFFS_NONMONOLITHIC) |
11149 | | |
11150 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__JPEG) || defined(WUFFS_NONMONOLITHIC) |
11151 | | |
11152 | | // ---------------- Status Codes |
11153 | | |
11154 | | extern const char wuffs_jpeg__error__bad_dht_marker[]; |
11155 | | extern const char wuffs_jpeg__error__bad_dqt_marker[]; |
11156 | | extern const char wuffs_jpeg__error__bad_dri_marker[]; |
11157 | | extern const char wuffs_jpeg__error__bad_sof_marker[]; |
11158 | | extern const char wuffs_jpeg__error__bad_sos_marker[]; |
11159 | | extern const char wuffs_jpeg__error__bad_header[]; |
11160 | | extern const char wuffs_jpeg__error__bad_marker[]; |
11161 | | extern const char wuffs_jpeg__error__bad_scan_count[]; |
11162 | | extern const char wuffs_jpeg__error__missing_huffman_table[]; |
11163 | | extern const char wuffs_jpeg__error__missing_quantization_table[]; |
11164 | | extern const char wuffs_jpeg__error__rejected_progressive_jpeg[]; |
11165 | | extern const char wuffs_jpeg__error__short_sos_bitstream[]; |
11166 | | extern const char wuffs_jpeg__error__truncated_input[]; |
11167 | | extern const char wuffs_jpeg__error__unsupported_arithmetic_coding[]; |
11168 | | extern const char wuffs_jpeg__error__unsupported_color_model[]; |
11169 | | extern const char wuffs_jpeg__error__unsupported_fractional_sampling[]; |
11170 | | extern const char wuffs_jpeg__error__unsupported_hierarchical_coding[]; |
11171 | | extern const char wuffs_jpeg__error__unsupported_implicit_height[]; |
11172 | | extern const char wuffs_jpeg__error__unsupported_lossless_coding[]; |
11173 | | extern const char wuffs_jpeg__error__unsupported_marker[]; |
11174 | | extern const char wuffs_jpeg__error__unsupported_precision_12_bits[]; |
11175 | | extern const char wuffs_jpeg__error__unsupported_precision_16_bits[]; |
11176 | | extern const char wuffs_jpeg__error__unsupported_precision[]; |
11177 | | extern const char wuffs_jpeg__error__unsupported_scan_count[]; |
11178 | | |
11179 | | // ---------------- Public Consts |
11180 | | |
11181 | | #define WUFFS_JPEG__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 51552191232u |
11182 | | |
11183 | | #define WUFFS_JPEG__QUIRK_REJECT_PROGRESSIVE_JPEGS 1162824704u |
11184 | | |
11185 | | // ---------------- Struct Declarations |
11186 | | |
11187 | | typedef struct wuffs_jpeg__decoder__struct wuffs_jpeg__decoder; |
11188 | | |
11189 | | #ifdef __cplusplus |
11190 | | extern "C" { |
11191 | | #endif |
11192 | | |
11193 | | // ---------------- Public Initializer Prototypes |
11194 | | |
11195 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
11196 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
11197 | | // |
11198 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
11199 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
11200 | | |
11201 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
11202 | | wuffs_jpeg__decoder__initialize( |
11203 | | wuffs_jpeg__decoder* self, |
11204 | | size_t sizeof_star_self, |
11205 | | uint64_t wuffs_version, |
11206 | | uint32_t options); |
11207 | | |
11208 | | size_t |
11209 | | sizeof__wuffs_jpeg__decoder(void); |
11210 | | |
11211 | | // ---------------- Allocs |
11212 | | |
11213 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
11214 | | // memory allocation fails. If they return non-NULL, there is no need to call |
11215 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
11216 | | // calling free on the returned pointer. That pointer is effectively a C++ |
11217 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
11218 | | |
11219 | | wuffs_jpeg__decoder* |
11220 | | wuffs_jpeg__decoder__alloc(void); |
11221 | | |
11222 | | static inline wuffs_base__image_decoder* |
11223 | 0 | wuffs_jpeg__decoder__alloc_as__wuffs_base__image_decoder(void) { |
11224 | 0 | return (wuffs_base__image_decoder*)(wuffs_jpeg__decoder__alloc()); |
11225 | 0 | } |
11226 | | |
11227 | | // ---------------- Upcasts |
11228 | | |
11229 | | static inline wuffs_base__image_decoder* |
11230 | | wuffs_jpeg__decoder__upcast_as__wuffs_base__image_decoder( |
11231 | 3.92k | wuffs_jpeg__decoder* p) { |
11232 | 3.92k | return (wuffs_base__image_decoder*)p; |
11233 | 3.92k | } |
11234 | | |
11235 | | // ---------------- Public Function Prototypes |
11236 | | |
11237 | | WUFFS_BASE__GENERATED_C_CODE |
11238 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
11239 | | wuffs_jpeg__decoder__get_quirk( |
11240 | | const wuffs_jpeg__decoder* self, |
11241 | | uint32_t a_key); |
11242 | | |
11243 | | WUFFS_BASE__GENERATED_C_CODE |
11244 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
11245 | | wuffs_jpeg__decoder__set_quirk( |
11246 | | wuffs_jpeg__decoder* self, |
11247 | | uint32_t a_key, |
11248 | | uint64_t a_value); |
11249 | | |
11250 | | WUFFS_BASE__GENERATED_C_CODE |
11251 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
11252 | | wuffs_jpeg__decoder__decode_image_config( |
11253 | | wuffs_jpeg__decoder* self, |
11254 | | wuffs_base__image_config* a_dst, |
11255 | | wuffs_base__io_buffer* a_src); |
11256 | | |
11257 | | WUFFS_BASE__GENERATED_C_CODE |
11258 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
11259 | | wuffs_jpeg__decoder__decode_frame_config( |
11260 | | wuffs_jpeg__decoder* self, |
11261 | | wuffs_base__frame_config* a_dst, |
11262 | | wuffs_base__io_buffer* a_src); |
11263 | | |
11264 | | WUFFS_BASE__GENERATED_C_CODE |
11265 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
11266 | | wuffs_jpeg__decoder__decode_frame( |
11267 | | wuffs_jpeg__decoder* self, |
11268 | | wuffs_base__pixel_buffer* a_dst, |
11269 | | wuffs_base__io_buffer* a_src, |
11270 | | wuffs_base__pixel_blend a_blend, |
11271 | | wuffs_base__slice_u8 a_workbuf, |
11272 | | wuffs_base__decode_frame_options* a_opts); |
11273 | | |
11274 | | WUFFS_BASE__GENERATED_C_CODE |
11275 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32 |
11276 | | wuffs_jpeg__decoder__frame_dirty_rect( |
11277 | | const wuffs_jpeg__decoder* self); |
11278 | | |
11279 | | WUFFS_BASE__GENERATED_C_CODE |
11280 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
11281 | | wuffs_jpeg__decoder__num_animation_loops( |
11282 | | const wuffs_jpeg__decoder* self); |
11283 | | |
11284 | | WUFFS_BASE__GENERATED_C_CODE |
11285 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
11286 | | wuffs_jpeg__decoder__num_decoded_frame_configs( |
11287 | | const wuffs_jpeg__decoder* self); |
11288 | | |
11289 | | WUFFS_BASE__GENERATED_C_CODE |
11290 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
11291 | | wuffs_jpeg__decoder__num_decoded_frames( |
11292 | | const wuffs_jpeg__decoder* self); |
11293 | | |
11294 | | WUFFS_BASE__GENERATED_C_CODE |
11295 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
11296 | | wuffs_jpeg__decoder__restart_frame( |
11297 | | wuffs_jpeg__decoder* self, |
11298 | | uint64_t a_index, |
11299 | | uint64_t a_io_position); |
11300 | | |
11301 | | WUFFS_BASE__GENERATED_C_CODE |
11302 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
11303 | | wuffs_jpeg__decoder__set_report_metadata( |
11304 | | wuffs_jpeg__decoder* self, |
11305 | | uint32_t a_fourcc, |
11306 | | bool a_report); |
11307 | | |
11308 | | WUFFS_BASE__GENERATED_C_CODE |
11309 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
11310 | | wuffs_jpeg__decoder__tell_me_more( |
11311 | | wuffs_jpeg__decoder* self, |
11312 | | wuffs_base__io_buffer* a_dst, |
11313 | | wuffs_base__more_information* a_minfo, |
11314 | | wuffs_base__io_buffer* a_src); |
11315 | | |
11316 | | WUFFS_BASE__GENERATED_C_CODE |
11317 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
11318 | | wuffs_jpeg__decoder__workbuf_len( |
11319 | | const wuffs_jpeg__decoder* self); |
11320 | | |
11321 | | #ifdef __cplusplus |
11322 | | } // extern "C" |
11323 | | #endif |
11324 | | |
11325 | | // ---------------- Struct Definitions |
11326 | | |
11327 | | // These structs' fields, and the sizeof them, are private implementation |
11328 | | // details that aren't guaranteed to be stable across Wuffs versions. |
11329 | | // |
11330 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
11331 | | |
11332 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
11333 | | |
11334 | | struct wuffs_jpeg__decoder__struct { |
11335 | | // Do not access the private_impl's or private_data's fields directly. There |
11336 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
11337 | | // the wuffs_foo__bar__baz functions. |
11338 | | // |
11339 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
11340 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
11341 | | |
11342 | | struct { |
11343 | | uint32_t magic; |
11344 | | uint32_t active_coroutine; |
11345 | | wuffs_base__vtable vtable_for__wuffs_base__image_decoder; |
11346 | | wuffs_base__vtable null_vtable; |
11347 | | |
11348 | | uint32_t f_width; |
11349 | | uint32_t f_height; |
11350 | | uint32_t f_width_in_mcus; |
11351 | | uint32_t f_height_in_mcus; |
11352 | | uint8_t f_call_sequence; |
11353 | | bool f_test_only_interrupt_decode_mcu; |
11354 | | bool f_is_jfif; |
11355 | | uint8_t f_is_adobe; |
11356 | | uint8_t f_ycc_model; |
11357 | | uint8_t f_sof_marker; |
11358 | | uint8_t f_next_restart_marker; |
11359 | | uint8_t f_max_incl_components_h; |
11360 | | uint8_t f_max_incl_components_v; |
11361 | | uint32_t f_num_components; |
11362 | | uint8_t f_components_c[4]; |
11363 | | uint8_t f_components_h[4]; |
11364 | | uint8_t f_components_v[4]; |
11365 | | uint8_t f_components_tq[4]; |
11366 | | uint32_t f_components_workbuf_widths[4]; |
11367 | | uint32_t f_components_workbuf_heights[4]; |
11368 | | uint64_t f_components_workbuf_offsets[9]; |
11369 | | uint32_t f_scan_count; |
11370 | | uint32_t f_scan_num_components; |
11371 | | uint8_t f_scan_comps_cselector[4]; |
11372 | | uint8_t f_scan_comps_td[4]; |
11373 | | uint8_t f_scan_comps_ta[4]; |
11374 | | uint8_t f_scan_ss; |
11375 | | uint8_t f_scan_se; |
11376 | | uint8_t f_scan_ah; |
11377 | | uint8_t f_scan_al; |
11378 | | uint32_t f_scan_width_in_mcus; |
11379 | | uint32_t f_scan_height_in_mcus; |
11380 | | uint8_t f_scan_comps_bx_offset[16]; |
11381 | | uint8_t f_scan_comps_by_offset[16]; |
11382 | | uint32_t f_mcu_num_blocks; |
11383 | | uint32_t f_mcu_current_block; |
11384 | | uint32_t f_mcu_zig_index; |
11385 | | uint8_t f_mcu_blocks_sselector[16]; |
11386 | | uint64_t f_mcu_blocks_offset[10]; |
11387 | | uint32_t f_mcu_blocks_mx_mul[10]; |
11388 | | uint32_t f_mcu_blocks_my_mul[10]; |
11389 | | uint8_t f_mcu_blocks_dc_hselector[10]; |
11390 | | uint8_t f_mcu_blocks_ac_hselector[10]; |
11391 | | uint16_t f_mcu_previous_dc_values[4]; |
11392 | | uint8_t f_block_smoothing_lowest_scan_al[4][10]; |
11393 | | uint16_t f_block_smoothing_dc_values[5][5]; |
11394 | | uint32_t f_block_smoothing_mx_max_incl; |
11395 | | uint32_t f_block_smoothing_my_max_incl; |
11396 | | uint16_t f_restart_interval; |
11397 | | uint16_t f_saved_restart_interval; |
11398 | | uint16_t f_restarts_remaining; |
11399 | | uint16_t f_eob_run; |
11400 | | uint64_t f_frame_config_io_position; |
11401 | | uint32_t f_payload_length; |
11402 | | bool f_seen_dqt[4]; |
11403 | | bool f_saved_seen_dqt[4]; |
11404 | | bool f_seen_dht[8]; |
11405 | | uint64_t f_bitstream_bits; |
11406 | | uint32_t f_bitstream_n_bits; |
11407 | | uint32_t f_bitstream_ri; |
11408 | | uint32_t f_bitstream_wi; |
11409 | | bool f_bitstream_is_closed; |
11410 | | bool f_expect_multiple_scans; |
11411 | | bool f_use_lower_quality; |
11412 | | bool f_reject_progressive_jpegs; |
11413 | | bool f_swizzle_immediately; |
11414 | | wuffs_base__status f_swizzle_immediately_status; |
11415 | | uint32_t f_swizzle_immediately_b_offsets[10]; |
11416 | | uint32_t f_swizzle_immediately_c_offsets[5]; |
11417 | | uint32_t f_bitstream_padding; |
11418 | | uint16_t f_quant_tables[4][64]; |
11419 | | uint16_t f_saved_quant_tables[4][64]; |
11420 | | uint8_t f_huff_tables_symbols[8][256]; |
11421 | | uint32_t f_huff_tables_slow[8][16]; |
11422 | | uint16_t f_huff_tables_fast[8][256]; |
11423 | | wuffs_base__pixel_swizzler f_swizzler; |
11424 | | |
11425 | | wuffs_base__empty_struct (*choosy_decode_idct)( |
11426 | | wuffs_jpeg__decoder* self, |
11427 | | wuffs_base__slice_u8 a_dst_buffer, |
11428 | | uint64_t a_dst_stride, |
11429 | | uint32_t a_q); |
11430 | | uint32_t p_decode_image_config; |
11431 | | uint32_t p_do_decode_image_config; |
11432 | | uint32_t p_decode_dqt; |
11433 | | uint32_t p_decode_dri; |
11434 | | uint32_t p_decode_appn; |
11435 | | uint32_t p_decode_sof; |
11436 | | uint32_t p_decode_frame_config; |
11437 | | uint32_t p_do_decode_frame_config; |
11438 | | uint32_t p_decode_frame; |
11439 | | uint32_t p_do_decode_frame; |
11440 | | uint32_t p_decode_dht; |
11441 | | uint32_t p_decode_sos; |
11442 | | uint32_t p_prepare_scan; |
11443 | | wuffs_base__empty_struct (*choosy_load_mcu_blocks_for_single_component)( |
11444 | | wuffs_jpeg__decoder* self, |
11445 | | uint32_t a_mx, |
11446 | | uint32_t a_my, |
11447 | | wuffs_base__slice_u8 a_workbuf, |
11448 | | uint32_t a_csel); |
11449 | | uint32_t p_skip_past_the_next_restart_marker; |
11450 | | uint32_t (*choosy_decode_mcu)( |
11451 | | wuffs_jpeg__decoder* self, |
11452 | | wuffs_base__pixel_buffer* a_dst, |
11453 | | wuffs_base__slice_u8 a_workbuf, |
11454 | | uint32_t a_mx, |
11455 | | uint32_t a_my); |
11456 | | } private_impl; |
11457 | | |
11458 | | struct { |
11459 | | uint8_t f_bitstream_buffer[2048]; |
11460 | | uint16_t f_mcu_blocks[10][64]; |
11461 | | uint8_t f_swizzle_immediately_buffer[640]; |
11462 | | uint8_t f_swizzle_ycck_scratch_buffer_2k[2048]; |
11463 | | uint8_t f_dht_temp_counts[16]; |
11464 | | uint8_t f_dht_temp_bit_lengths[256]; |
11465 | | uint16_t f_dht_temp_bit_strings[256]; |
11466 | | uint8_t f_dst_palette[1024]; |
11467 | | |
11468 | | struct { |
11469 | | uint8_t v_marker; |
11470 | | uint64_t scratch; |
11471 | | } s_do_decode_image_config; |
11472 | | struct { |
11473 | | uint8_t v_q; |
11474 | | uint32_t v_i; |
11475 | | } s_decode_dqt; |
11476 | | struct { |
11477 | | uint64_t scratch; |
11478 | | } s_decode_dri; |
11479 | | struct { |
11480 | | uint64_t scratch; |
11481 | | } s_decode_appn; |
11482 | | struct { |
11483 | | uint32_t v_i; |
11484 | | uint64_t scratch; |
11485 | | } s_decode_sof; |
11486 | | struct { |
11487 | | uint8_t v_marker; |
11488 | | uint64_t scratch; |
11489 | | } s_do_decode_frame; |
11490 | | struct { |
11491 | | uint8_t v_tc4_th; |
11492 | | uint32_t v_total_count; |
11493 | | uint32_t v_i; |
11494 | | } s_decode_dht; |
11495 | | struct { |
11496 | | uint32_t v_my; |
11497 | | uint32_t v_mx; |
11498 | | } s_decode_sos; |
11499 | | struct { |
11500 | | uint32_t v_i; |
11501 | | uint64_t scratch; |
11502 | | } s_prepare_scan; |
11503 | | } private_data; |
11504 | | |
11505 | | #ifdef __cplusplus |
11506 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
11507 | | using unique_ptr = std::unique_ptr<wuffs_jpeg__decoder, wuffs_unique_ptr_deleter>; |
11508 | | |
11509 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
11510 | | |
11511 | | static inline unique_ptr |
11512 | | alloc() { |
11513 | | return unique_ptr(wuffs_jpeg__decoder__alloc()); |
11514 | | } |
11515 | | |
11516 | | static inline wuffs_base__image_decoder::unique_ptr |
11517 | | alloc_as__wuffs_base__image_decoder() { |
11518 | | return wuffs_base__image_decoder::unique_ptr( |
11519 | | wuffs_jpeg__decoder__alloc_as__wuffs_base__image_decoder()); |
11520 | | } |
11521 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
11522 | | |
11523 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
11524 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
11525 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
11526 | | // size and field layout is not part of the public, stable, memory-safe API. |
11527 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
11528 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
11529 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
11530 | | // |
11531 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
11532 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
11533 | | // order to provide convenience methods. These forward on "this", so that you |
11534 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
11535 | | wuffs_jpeg__decoder__struct() = delete; |
11536 | | wuffs_jpeg__decoder__struct(const wuffs_jpeg__decoder__struct&) = delete; |
11537 | | wuffs_jpeg__decoder__struct& operator=( |
11538 | | const wuffs_jpeg__decoder__struct&) = delete; |
11539 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
11540 | | |
11541 | | #if !defined(WUFFS_IMPLEMENTATION) |
11542 | | // As above, the size of the struct is not part of the public API, and unless |
11543 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
11544 | | // allocated, not stack allocated. Its size is not intended to be known at |
11545 | | // compile time, but it is unfortunately divulged as a side effect of |
11546 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
11547 | | // instead of "sizeof T", invoking the operator. To make the two values |
11548 | | // different, so that passing the latter will be rejected by the initialize |
11549 | | // function, we add an arbitrary amount of dead weight. |
11550 | | uint8_t dead_weight[123000000]; // 123 MB. |
11551 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
11552 | | |
11553 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
11554 | | initialize( |
11555 | | size_t sizeof_star_self, |
11556 | | uint64_t wuffs_version, |
11557 | | uint32_t options) { |
11558 | | return wuffs_jpeg__decoder__initialize( |
11559 | | this, sizeof_star_self, wuffs_version, options); |
11560 | | } |
11561 | | |
11562 | | inline wuffs_base__image_decoder* |
11563 | | upcast_as__wuffs_base__image_decoder() { |
11564 | | return (wuffs_base__image_decoder*)this; |
11565 | | } |
11566 | | |
11567 | | inline uint64_t |
11568 | | get_quirk( |
11569 | | uint32_t a_key) const { |
11570 | | return wuffs_jpeg__decoder__get_quirk(this, a_key); |
11571 | | } |
11572 | | |
11573 | | inline wuffs_base__status |
11574 | | set_quirk( |
11575 | | uint32_t a_key, |
11576 | | uint64_t a_value) { |
11577 | | return wuffs_jpeg__decoder__set_quirk(this, a_key, a_value); |
11578 | | } |
11579 | | |
11580 | | inline wuffs_base__status |
11581 | | decode_image_config( |
11582 | | wuffs_base__image_config* a_dst, |
11583 | | wuffs_base__io_buffer* a_src) { |
11584 | | return wuffs_jpeg__decoder__decode_image_config(this, a_dst, a_src); |
11585 | | } |
11586 | | |
11587 | | inline wuffs_base__status |
11588 | | decode_frame_config( |
11589 | | wuffs_base__frame_config* a_dst, |
11590 | | wuffs_base__io_buffer* a_src) { |
11591 | | return wuffs_jpeg__decoder__decode_frame_config(this, a_dst, a_src); |
11592 | | } |
11593 | | |
11594 | | inline wuffs_base__status |
11595 | | decode_frame( |
11596 | | wuffs_base__pixel_buffer* a_dst, |
11597 | | wuffs_base__io_buffer* a_src, |
11598 | | wuffs_base__pixel_blend a_blend, |
11599 | | wuffs_base__slice_u8 a_workbuf, |
11600 | | wuffs_base__decode_frame_options* a_opts) { |
11601 | | return wuffs_jpeg__decoder__decode_frame(this, a_dst, a_src, a_blend, a_workbuf, a_opts); |
11602 | | } |
11603 | | |
11604 | | inline wuffs_base__rect_ie_u32 |
11605 | | frame_dirty_rect() const { |
11606 | | return wuffs_jpeg__decoder__frame_dirty_rect(this); |
11607 | | } |
11608 | | |
11609 | | inline uint32_t |
11610 | | num_animation_loops() const { |
11611 | | return wuffs_jpeg__decoder__num_animation_loops(this); |
11612 | | } |
11613 | | |
11614 | | inline uint64_t |
11615 | | num_decoded_frame_configs() const { |
11616 | | return wuffs_jpeg__decoder__num_decoded_frame_configs(this); |
11617 | | } |
11618 | | |
11619 | | inline uint64_t |
11620 | | num_decoded_frames() const { |
11621 | | return wuffs_jpeg__decoder__num_decoded_frames(this); |
11622 | | } |
11623 | | |
11624 | | inline wuffs_base__status |
11625 | | restart_frame( |
11626 | | uint64_t a_index, |
11627 | | uint64_t a_io_position) { |
11628 | | return wuffs_jpeg__decoder__restart_frame(this, a_index, a_io_position); |
11629 | | } |
11630 | | |
11631 | | inline wuffs_base__empty_struct |
11632 | | set_report_metadata( |
11633 | | uint32_t a_fourcc, |
11634 | | bool a_report) { |
11635 | | return wuffs_jpeg__decoder__set_report_metadata(this, a_fourcc, a_report); |
11636 | | } |
11637 | | |
11638 | | inline wuffs_base__status |
11639 | | tell_me_more( |
11640 | | wuffs_base__io_buffer* a_dst, |
11641 | | wuffs_base__more_information* a_minfo, |
11642 | | wuffs_base__io_buffer* a_src) { |
11643 | | return wuffs_jpeg__decoder__tell_me_more(this, a_dst, a_minfo, a_src); |
11644 | | } |
11645 | | |
11646 | | inline wuffs_base__range_ii_u64 |
11647 | | workbuf_len() const { |
11648 | | return wuffs_jpeg__decoder__workbuf_len(this); |
11649 | | } |
11650 | | |
11651 | | #endif // __cplusplus |
11652 | | }; // struct wuffs_jpeg__decoder__struct |
11653 | | |
11654 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
11655 | | |
11656 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__JPEG) || defined(WUFFS_NONMONOLITHIC) |
11657 | | |
11658 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__JSON) || defined(WUFFS_NONMONOLITHIC) |
11659 | | |
11660 | | // ---------------- Status Codes |
11661 | | |
11662 | | extern const char wuffs_json__error__bad_c0_control_code[]; |
11663 | | extern const char wuffs_json__error__bad_utf_8[]; |
11664 | | extern const char wuffs_json__error__bad_backslash_escape[]; |
11665 | | extern const char wuffs_json__error__bad_input[]; |
11666 | | extern const char wuffs_json__error__bad_new_line_in_a_string[]; |
11667 | | extern const char wuffs_json__error__bad_quirk_combination[]; |
11668 | | extern const char wuffs_json__error__unsupported_number_length[]; |
11669 | | extern const char wuffs_json__error__unsupported_recursion_depth[]; |
11670 | | |
11671 | | // ---------------- Public Consts |
11672 | | |
11673 | 2.83M | #define WUFFS_JSON__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u |
11674 | | |
11675 | 362k | #define WUFFS_JSON__DECODER_DEPTH_MAX_INCL 1024u |
11676 | | |
11677 | 6.00k | #define WUFFS_JSON__DECODER_DST_TOKEN_BUFFER_LENGTH_MIN_INCL 1u |
11678 | | |
11679 | 6.00k | #define WUFFS_JSON__DECODER_SRC_IO_BUFFER_LENGTH_MIN_INCL 100u |
11680 | | |
11681 | | #define WUFFS_JSON__QUIRK_ALLOW_ASCII_CONTROL_CODES 1167656960u |
11682 | | |
11683 | | #define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_A 1167656961u |
11684 | | |
11685 | | #define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_CAPITAL_U 1167656962u |
11686 | | |
11687 | | #define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_E 1167656963u |
11688 | | |
11689 | | #define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_NEW_LINE 1167656964u |
11690 | | |
11691 | | #define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_QUESTION_MARK 1167656965u |
11692 | | |
11693 | | #define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_SINGLE_QUOTE 1167656966u |
11694 | | |
11695 | | #define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_V 1167656967u |
11696 | | |
11697 | | #define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_X_AS_CODE_POINTS 1167656969u |
11698 | | |
11699 | | #define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_ZERO 1167656970u |
11700 | | |
11701 | | #define WUFFS_JSON__QUIRK_ALLOW_COMMENT_BLOCK 1167656971u |
11702 | | |
11703 | | #define WUFFS_JSON__QUIRK_ALLOW_COMMENT_LINE 1167656972u |
11704 | | |
11705 | | #define WUFFS_JSON__QUIRK_ALLOW_EXTRA_COMMA 1167656973u |
11706 | | |
11707 | | #define WUFFS_JSON__QUIRK_ALLOW_INF_NAN_NUMBERS 1167656974u |
11708 | | |
11709 | | #define WUFFS_JSON__QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR 1167656975u |
11710 | | |
11711 | | #define WUFFS_JSON__QUIRK_ALLOW_LEADING_UNICODE_BYTE_ORDER_MARK 1167656976u |
11712 | | |
11713 | | #define WUFFS_JSON__QUIRK_ALLOW_TRAILING_FILLER 1167656977u |
11714 | | |
11715 | | #define WUFFS_JSON__QUIRK_EXPECT_TRAILING_NEW_LINE_OR_EOF 1167656978u |
11716 | | |
11717 | 51.4k | #define WUFFS_JSON__QUIRK_JSON_POINTER_ALLOW_TILDE_N_TILDE_R_TILDE_T 1167656979u |
11718 | | |
11719 | | #define WUFFS_JSON__QUIRK_REPLACE_INVALID_UNICODE 1167656980u |
11720 | | |
11721 | | // ---------------- Struct Declarations |
11722 | | |
11723 | | typedef struct wuffs_json__decoder__struct wuffs_json__decoder; |
11724 | | |
11725 | | #ifdef __cplusplus |
11726 | | extern "C" { |
11727 | | #endif |
11728 | | |
11729 | | // ---------------- Public Initializer Prototypes |
11730 | | |
11731 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
11732 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
11733 | | // |
11734 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
11735 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
11736 | | |
11737 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
11738 | | wuffs_json__decoder__initialize( |
11739 | | wuffs_json__decoder* self, |
11740 | | size_t sizeof_star_self, |
11741 | | uint64_t wuffs_version, |
11742 | | uint32_t options); |
11743 | | |
11744 | | size_t |
11745 | | sizeof__wuffs_json__decoder(void); |
11746 | | |
11747 | | // ---------------- Allocs |
11748 | | |
11749 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
11750 | | // memory allocation fails. If they return non-NULL, there is no need to call |
11751 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
11752 | | // calling free on the returned pointer. That pointer is effectively a C++ |
11753 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
11754 | | |
11755 | | wuffs_json__decoder* |
11756 | | wuffs_json__decoder__alloc(void); |
11757 | | |
11758 | | static inline wuffs_base__token_decoder* |
11759 | 0 | wuffs_json__decoder__alloc_as__wuffs_base__token_decoder(void) { |
11760 | 0 | return (wuffs_base__token_decoder*)(wuffs_json__decoder__alloc()); |
11761 | 0 | } |
11762 | | |
11763 | | // ---------------- Upcasts |
11764 | | |
11765 | | static inline wuffs_base__token_decoder* |
11766 | | wuffs_json__decoder__upcast_as__wuffs_base__token_decoder( |
11767 | 0 | wuffs_json__decoder* p) { |
11768 | 0 | return (wuffs_base__token_decoder*)p; |
11769 | 0 | } |
11770 | | |
11771 | | // ---------------- Public Function Prototypes |
11772 | | |
11773 | | WUFFS_BASE__GENERATED_C_CODE |
11774 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
11775 | | wuffs_json__decoder__get_quirk( |
11776 | | const wuffs_json__decoder* self, |
11777 | | uint32_t a_key); |
11778 | | |
11779 | | WUFFS_BASE__GENERATED_C_CODE |
11780 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
11781 | | wuffs_json__decoder__set_quirk( |
11782 | | wuffs_json__decoder* self, |
11783 | | uint32_t a_key, |
11784 | | uint64_t a_value); |
11785 | | |
11786 | | WUFFS_BASE__GENERATED_C_CODE |
11787 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
11788 | | wuffs_json__decoder__workbuf_len( |
11789 | | const wuffs_json__decoder* self); |
11790 | | |
11791 | | WUFFS_BASE__GENERATED_C_CODE |
11792 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
11793 | | wuffs_json__decoder__decode_tokens( |
11794 | | wuffs_json__decoder* self, |
11795 | | wuffs_base__token_buffer* a_dst, |
11796 | | wuffs_base__io_buffer* a_src, |
11797 | | wuffs_base__slice_u8 a_workbuf); |
11798 | | |
11799 | | #ifdef __cplusplus |
11800 | | } // extern "C" |
11801 | | #endif |
11802 | | |
11803 | | // ---------------- Struct Definitions |
11804 | | |
11805 | | // These structs' fields, and the sizeof them, are private implementation |
11806 | | // details that aren't guaranteed to be stable across Wuffs versions. |
11807 | | // |
11808 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
11809 | | |
11810 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
11811 | | |
11812 | | struct wuffs_json__decoder__struct { |
11813 | | // Do not access the private_impl's or private_data's fields directly. There |
11814 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
11815 | | // the wuffs_foo__bar__baz functions. |
11816 | | // |
11817 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
11818 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
11819 | | |
11820 | | struct { |
11821 | | uint32_t magic; |
11822 | | uint32_t active_coroutine; |
11823 | | wuffs_base__vtable vtable_for__wuffs_base__token_decoder; |
11824 | | wuffs_base__vtable null_vtable; |
11825 | | |
11826 | | bool f_quirks[21]; |
11827 | | bool f_allow_leading_ars; |
11828 | | bool f_allow_leading_ubom; |
11829 | | bool f_end_of_data; |
11830 | | uint8_t f_trailer_stop; |
11831 | | uint8_t f_comment_type; |
11832 | | |
11833 | | uint32_t p_decode_tokens; |
11834 | | uint32_t p_decode_leading; |
11835 | | uint32_t p_decode_comment; |
11836 | | uint32_t p_decode_inf_nan; |
11837 | | uint32_t p_decode_trailer; |
11838 | | } private_impl; |
11839 | | |
11840 | | struct { |
11841 | | uint32_t f_stack[32]; |
11842 | | |
11843 | | struct { |
11844 | | uint32_t v_depth; |
11845 | | uint32_t v_expect; |
11846 | | uint32_t v_expect_after_value; |
11847 | | } s_decode_tokens; |
11848 | | } private_data; |
11849 | | |
11850 | | #ifdef __cplusplus |
11851 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
11852 | | using unique_ptr = std::unique_ptr<wuffs_json__decoder, wuffs_unique_ptr_deleter>; |
11853 | | |
11854 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
11855 | | |
11856 | | static inline unique_ptr |
11857 | 6.11k | alloc() { |
11858 | 6.11k | return unique_ptr(wuffs_json__decoder__alloc()); |
11859 | 6.11k | } |
11860 | | |
11861 | | static inline wuffs_base__token_decoder::unique_ptr |
11862 | 0 | alloc_as__wuffs_base__token_decoder() { |
11863 | 0 | return wuffs_base__token_decoder::unique_ptr( |
11864 | 0 | wuffs_json__decoder__alloc_as__wuffs_base__token_decoder()); |
11865 | 0 | } |
11866 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
11867 | | |
11868 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
11869 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
11870 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
11871 | | // size and field layout is not part of the public, stable, memory-safe API. |
11872 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
11873 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
11874 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
11875 | | // |
11876 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
11877 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
11878 | | // order to provide convenience methods. These forward on "this", so that you |
11879 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
11880 | | wuffs_json__decoder__struct() = delete; |
11881 | | wuffs_json__decoder__struct(const wuffs_json__decoder__struct&) = delete; |
11882 | | wuffs_json__decoder__struct& operator=( |
11883 | | const wuffs_json__decoder__struct&) = delete; |
11884 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
11885 | | |
11886 | | #if !defined(WUFFS_IMPLEMENTATION) |
11887 | | // As above, the size of the struct is not part of the public API, and unless |
11888 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
11889 | | // allocated, not stack allocated. Its size is not intended to be known at |
11890 | | // compile time, but it is unfortunately divulged as a side effect of |
11891 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
11892 | | // instead of "sizeof T", invoking the operator. To make the two values |
11893 | | // different, so that passing the latter will be rejected by the initialize |
11894 | | // function, we add an arbitrary amount of dead weight. |
11895 | | uint8_t dead_weight[123000000]; // 123 MB. |
11896 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
11897 | | |
11898 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
11899 | | initialize( |
11900 | | size_t sizeof_star_self, |
11901 | | uint64_t wuffs_version, |
11902 | 0 | uint32_t options) { |
11903 | 0 | return wuffs_json__decoder__initialize( |
11904 | 0 | this, sizeof_star_self, wuffs_version, options); |
11905 | 0 | } |
11906 | | |
11907 | | inline wuffs_base__token_decoder* |
11908 | 0 | upcast_as__wuffs_base__token_decoder() { |
11909 | 0 | return (wuffs_base__token_decoder*)this; |
11910 | 0 | } |
11911 | | |
11912 | | inline uint64_t |
11913 | | get_quirk( |
11914 | 0 | uint32_t a_key) const { |
11915 | 0 | return wuffs_json__decoder__get_quirk(this, a_key); |
11916 | 0 | } |
11917 | | |
11918 | | inline wuffs_base__status |
11919 | | set_quirk( |
11920 | | uint32_t a_key, |
11921 | 51.4k | uint64_t a_value) { |
11922 | 51.4k | return wuffs_json__decoder__set_quirk(this, a_key, a_value); |
11923 | 51.4k | } |
11924 | | |
11925 | | inline wuffs_base__range_ii_u64 |
11926 | 0 | workbuf_len() const { |
11927 | 0 | return wuffs_json__decoder__workbuf_len(this); |
11928 | 0 | } |
11929 | | |
11930 | | inline wuffs_base__status |
11931 | | decode_tokens( |
11932 | | wuffs_base__token_buffer* a_dst, |
11933 | | wuffs_base__io_buffer* a_src, |
11934 | 40.2k | wuffs_base__slice_u8 a_workbuf) { |
11935 | 40.2k | return wuffs_json__decoder__decode_tokens(this, a_dst, a_src, a_workbuf); |
11936 | 40.2k | } |
11937 | | |
11938 | | #endif // __cplusplus |
11939 | | }; // struct wuffs_json__decoder__struct |
11940 | | |
11941 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
11942 | | |
11943 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__JSON) || defined(WUFFS_NONMONOLITHIC) |
11944 | | |
11945 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__LZMA) || defined(WUFFS_NONMONOLITHIC) |
11946 | | |
11947 | | // ---------------- Status Codes |
11948 | | |
11949 | | extern const char wuffs_lzma__error__bad_lzma2_header[]; |
11950 | | extern const char wuffs_lzma__error__bad_bitstream_trailer[]; |
11951 | | extern const char wuffs_lzma__error__bad_code[]; |
11952 | | extern const char wuffs_lzma__error__bad_decoded_length[]; |
11953 | | extern const char wuffs_lzma__error__bad_distance[]; |
11954 | | extern const char wuffs_lzma__error__bad_header[]; |
11955 | | extern const char wuffs_lzma__error__truncated_input[]; |
11956 | | extern const char wuffs_lzma__error__unsupported_decoded_length[]; |
11957 | | extern const char wuffs_lzma__error__unsupported_properties[]; |
11958 | | |
11959 | | // ---------------- Public Consts |
11960 | | |
11961 | | #define WUFFS_LZMA__DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE 0u |
11962 | | |
11963 | | #define WUFFS_LZMA__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 4294967568u |
11964 | | |
11965 | | #define WUFFS_LZMA__QUIRK_ALLOW_NON_ZERO_INITIAL_BYTE 1290294272u |
11966 | | |
11967 | | #define WUFFS_LZMA__QUIRK_FORMAT_EXTENSION 1290294273u |
11968 | | |
11969 | | // ---------------- Struct Declarations |
11970 | | |
11971 | | typedef struct wuffs_lzma__decoder__struct wuffs_lzma__decoder; |
11972 | | |
11973 | | #ifdef __cplusplus |
11974 | | extern "C" { |
11975 | | #endif |
11976 | | |
11977 | | // ---------------- Public Initializer Prototypes |
11978 | | |
11979 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
11980 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
11981 | | // |
11982 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
11983 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
11984 | | |
11985 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
11986 | | wuffs_lzma__decoder__initialize( |
11987 | | wuffs_lzma__decoder* self, |
11988 | | size_t sizeof_star_self, |
11989 | | uint64_t wuffs_version, |
11990 | | uint32_t options); |
11991 | | |
11992 | | size_t |
11993 | | sizeof__wuffs_lzma__decoder(void); |
11994 | | |
11995 | | // ---------------- Allocs |
11996 | | |
11997 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
11998 | | // memory allocation fails. If they return non-NULL, there is no need to call |
11999 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
12000 | | // calling free on the returned pointer. That pointer is effectively a C++ |
12001 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
12002 | | |
12003 | | wuffs_lzma__decoder* |
12004 | | wuffs_lzma__decoder__alloc(void); |
12005 | | |
12006 | | static inline wuffs_base__io_transformer* |
12007 | 0 | wuffs_lzma__decoder__alloc_as__wuffs_base__io_transformer(void) { |
12008 | 0 | return (wuffs_base__io_transformer*)(wuffs_lzma__decoder__alloc()); |
12009 | 0 | } |
12010 | | |
12011 | | // ---------------- Upcasts |
12012 | | |
12013 | | static inline wuffs_base__io_transformer* |
12014 | | wuffs_lzma__decoder__upcast_as__wuffs_base__io_transformer( |
12015 | 0 | wuffs_lzma__decoder* p) { |
12016 | 0 | return (wuffs_base__io_transformer*)p; |
12017 | 0 | } |
12018 | | |
12019 | | // ---------------- Public Function Prototypes |
12020 | | |
12021 | | WUFFS_BASE__GENERATED_C_CODE |
12022 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
12023 | | wuffs_lzma__decoder__get_quirk( |
12024 | | const wuffs_lzma__decoder* self, |
12025 | | uint32_t a_key); |
12026 | | |
12027 | | WUFFS_BASE__GENERATED_C_CODE |
12028 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
12029 | | wuffs_lzma__decoder__set_quirk( |
12030 | | wuffs_lzma__decoder* self, |
12031 | | uint32_t a_key, |
12032 | | uint64_t a_value); |
12033 | | |
12034 | | WUFFS_BASE__GENERATED_C_CODE |
12035 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63 |
12036 | | wuffs_lzma__decoder__dst_history_retain_length( |
12037 | | const wuffs_lzma__decoder* self); |
12038 | | |
12039 | | WUFFS_BASE__GENERATED_C_CODE |
12040 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
12041 | | wuffs_lzma__decoder__workbuf_len( |
12042 | | const wuffs_lzma__decoder* self); |
12043 | | |
12044 | | WUFFS_BASE__GENERATED_C_CODE |
12045 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
12046 | | wuffs_lzma__decoder__transform_io( |
12047 | | wuffs_lzma__decoder* self, |
12048 | | wuffs_base__io_buffer* a_dst, |
12049 | | wuffs_base__io_buffer* a_src, |
12050 | | wuffs_base__slice_u8 a_workbuf); |
12051 | | |
12052 | | #ifdef __cplusplus |
12053 | | } // extern "C" |
12054 | | #endif |
12055 | | |
12056 | | // ---------------- Struct Definitions |
12057 | | |
12058 | | // These structs' fields, and the sizeof them, are private implementation |
12059 | | // details that aren't guaranteed to be stable across Wuffs versions. |
12060 | | // |
12061 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
12062 | | |
12063 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
12064 | | |
12065 | | struct wuffs_lzma__decoder__struct { |
12066 | | // Do not access the private_impl's or private_data's fields directly. There |
12067 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
12068 | | // the wuffs_foo__bar__baz functions. |
12069 | | // |
12070 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
12071 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
12072 | | |
12073 | | struct { |
12074 | | uint32_t magic; |
12075 | | uint32_t active_coroutine; |
12076 | | wuffs_base__vtable vtable_for__wuffs_base__io_transformer; |
12077 | | wuffs_base__vtable null_vtable; |
12078 | | |
12079 | | uint32_t f_lc; |
12080 | | uint32_t f_lp; |
12081 | | uint32_t f_pb; |
12082 | | uint32_t f_format_extension; |
12083 | | uint32_t f_dict_size; |
12084 | | uint32_t f_dict_workbuf_index; |
12085 | | uint32_t f_dict_seen; |
12086 | | uint64_t f_decoded_length; |
12087 | | uint64_t f_lzma2_encoded_length_have; |
12088 | | uint64_t f_lzma2_encoded_length_want; |
12089 | | bool f_lzma2_need_prob_reset; |
12090 | | bool f_lzma2_need_properties; |
12091 | | bool f_lzma2_need_dict_reset; |
12092 | | bool f_prev_lzma2_chunk_was_uncompressed; |
12093 | | bool f_allow_non_zero_initial_byte; |
12094 | | bool f_end_of_chunk; |
12095 | | uint8_t f_stashed_bytes[2]; |
12096 | | uint32_t f_stashed_bits; |
12097 | | uint32_t f_stashed_range; |
12098 | | uint32_t f_stashed_state; |
12099 | | uint32_t f_stashed_rep0; |
12100 | | uint32_t f_stashed_rep1; |
12101 | | uint32_t f_stashed_rep2; |
12102 | | uint32_t f_stashed_rep3; |
12103 | | uint64_t f_stashed_pos; |
12104 | | uint64_t f_stashed_pos_end; |
12105 | | |
12106 | | uint32_t p_decode_bitstream_slow; |
12107 | | uint32_t p_transform_io; |
12108 | | uint32_t p_do_transform_io; |
12109 | | uint32_t p_decode_bitstream; |
12110 | | uint32_t p_update_stashed_bytes; |
12111 | | uint32_t p_decode_optional_end_of_stream; |
12112 | | } private_impl; |
12113 | | |
12114 | | struct { |
12115 | | uint16_t f_probs_ao00[192]; |
12116 | | uint16_t f_probs_ao20[12]; |
12117 | | uint16_t f_probs_ao40[12]; |
12118 | | uint16_t f_probs_ao41[192]; |
12119 | | uint16_t f_probs_ao60[12]; |
12120 | | uint16_t f_probs_ao63[12]; |
12121 | | uint16_t f_probs_match_len_low[16][8]; |
12122 | | uint16_t f_probs_match_len_mid[16][8]; |
12123 | | uint16_t f_probs_match_len_high[1][256]; |
12124 | | uint16_t f_probs_longrep_len_low[16][8]; |
12125 | | uint16_t f_probs_longrep_len_mid[16][8]; |
12126 | | uint16_t f_probs_longrep_len_high[1][256]; |
12127 | | uint16_t f_probs_slot[4][64]; |
12128 | | uint16_t f_probs_small_dist[128]; |
12129 | | uint16_t f_probs_large_dist[16]; |
12130 | | uint16_t f_probs_lit[16][768]; |
12131 | | |
12132 | | struct { |
12133 | | uint32_t v_bits; |
12134 | | uint32_t v_range; |
12135 | | uint32_t v_state; |
12136 | | uint32_t v_rep0; |
12137 | | uint32_t v_rep1; |
12138 | | uint32_t v_rep2; |
12139 | | uint32_t v_rep3; |
12140 | | uint32_t v_rep; |
12141 | | uint64_t v_pos; |
12142 | | uint64_t v_pos_end; |
12143 | | uint32_t v_lc; |
12144 | | uint64_t v_lp_mask; |
12145 | | uint64_t v_pb_mask; |
12146 | | uint32_t v_tree_node; |
12147 | | uint8_t v_prev_byte; |
12148 | | uint32_t v_match_byte; |
12149 | | uint32_t v_len_state; |
12150 | | uint32_t v_slot; |
12151 | | uint32_t v_len; |
12152 | | uint32_t v_lanl_offset; |
12153 | | uint32_t v_num_extra_bits; |
12154 | | uint32_t v_dist_extra_bits; |
12155 | | uint32_t v_i; |
12156 | | uint32_t v_index_lit; |
12157 | | uint32_t v_index_len; |
12158 | | uint32_t v_index_small_dist_base; |
12159 | | uint32_t v_index_small_dist_extra; |
12160 | | uint32_t v_index_large_dist; |
12161 | | uint32_t v_dist; |
12162 | | uint64_t scratch; |
12163 | | } s_decode_bitstream_slow; |
12164 | | struct { |
12165 | | uint8_t v_header_byte; |
12166 | | uint32_t v_length; |
12167 | | uint64_t scratch; |
12168 | | } s_do_transform_io; |
12169 | | } private_data; |
12170 | | |
12171 | | #ifdef __cplusplus |
12172 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
12173 | | using unique_ptr = std::unique_ptr<wuffs_lzma__decoder, wuffs_unique_ptr_deleter>; |
12174 | | |
12175 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
12176 | | |
12177 | | static inline unique_ptr |
12178 | | alloc() { |
12179 | | return unique_ptr(wuffs_lzma__decoder__alloc()); |
12180 | | } |
12181 | | |
12182 | | static inline wuffs_base__io_transformer::unique_ptr |
12183 | | alloc_as__wuffs_base__io_transformer() { |
12184 | | return wuffs_base__io_transformer::unique_ptr( |
12185 | | wuffs_lzma__decoder__alloc_as__wuffs_base__io_transformer()); |
12186 | | } |
12187 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
12188 | | |
12189 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
12190 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
12191 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
12192 | | // size and field layout is not part of the public, stable, memory-safe API. |
12193 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
12194 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
12195 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
12196 | | // |
12197 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
12198 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
12199 | | // order to provide convenience methods. These forward on "this", so that you |
12200 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
12201 | | wuffs_lzma__decoder__struct() = delete; |
12202 | | wuffs_lzma__decoder__struct(const wuffs_lzma__decoder__struct&) = delete; |
12203 | | wuffs_lzma__decoder__struct& operator=( |
12204 | | const wuffs_lzma__decoder__struct&) = delete; |
12205 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
12206 | | |
12207 | | #if !defined(WUFFS_IMPLEMENTATION) |
12208 | | // As above, the size of the struct is not part of the public API, and unless |
12209 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
12210 | | // allocated, not stack allocated. Its size is not intended to be known at |
12211 | | // compile time, but it is unfortunately divulged as a side effect of |
12212 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
12213 | | // instead of "sizeof T", invoking the operator. To make the two values |
12214 | | // different, so that passing the latter will be rejected by the initialize |
12215 | | // function, we add an arbitrary amount of dead weight. |
12216 | | uint8_t dead_weight[123000000]; // 123 MB. |
12217 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
12218 | | |
12219 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
12220 | | initialize( |
12221 | | size_t sizeof_star_self, |
12222 | | uint64_t wuffs_version, |
12223 | | uint32_t options) { |
12224 | | return wuffs_lzma__decoder__initialize( |
12225 | | this, sizeof_star_self, wuffs_version, options); |
12226 | | } |
12227 | | |
12228 | | inline wuffs_base__io_transformer* |
12229 | | upcast_as__wuffs_base__io_transformer() { |
12230 | | return (wuffs_base__io_transformer*)this; |
12231 | | } |
12232 | | |
12233 | | inline uint64_t |
12234 | | get_quirk( |
12235 | | uint32_t a_key) const { |
12236 | | return wuffs_lzma__decoder__get_quirk(this, a_key); |
12237 | | } |
12238 | | |
12239 | | inline wuffs_base__status |
12240 | | set_quirk( |
12241 | | uint32_t a_key, |
12242 | | uint64_t a_value) { |
12243 | | return wuffs_lzma__decoder__set_quirk(this, a_key, a_value); |
12244 | | } |
12245 | | |
12246 | | inline wuffs_base__optional_u63 |
12247 | | dst_history_retain_length() const { |
12248 | | return wuffs_lzma__decoder__dst_history_retain_length(this); |
12249 | | } |
12250 | | |
12251 | | inline wuffs_base__range_ii_u64 |
12252 | | workbuf_len() const { |
12253 | | return wuffs_lzma__decoder__workbuf_len(this); |
12254 | | } |
12255 | | |
12256 | | inline wuffs_base__status |
12257 | | transform_io( |
12258 | | wuffs_base__io_buffer* a_dst, |
12259 | | wuffs_base__io_buffer* a_src, |
12260 | | wuffs_base__slice_u8 a_workbuf) { |
12261 | | return wuffs_lzma__decoder__transform_io(this, a_dst, a_src, a_workbuf); |
12262 | | } |
12263 | | |
12264 | | #endif // __cplusplus |
12265 | | }; // struct wuffs_lzma__decoder__struct |
12266 | | |
12267 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
12268 | | |
12269 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__LZMA) || defined(WUFFS_NONMONOLITHIC) |
12270 | | |
12271 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__LZIP) || defined(WUFFS_NONMONOLITHIC) |
12272 | | |
12273 | | // ---------------- Status Codes |
12274 | | |
12275 | | extern const char wuffs_lzip__error__bad_checksum[]; |
12276 | | extern const char wuffs_lzip__error__bad_footer[]; |
12277 | | extern const char wuffs_lzip__error__bad_header[]; |
12278 | | extern const char wuffs_lzip__error__truncated_input[]; |
12279 | | |
12280 | | // ---------------- Public Consts |
12281 | | |
12282 | | #define WUFFS_LZIP__DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE 0u |
12283 | | |
12284 | | #define WUFFS_LZIP__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 4294967568u |
12285 | | |
12286 | | // ---------------- Struct Declarations |
12287 | | |
12288 | | typedef struct wuffs_lzip__decoder__struct wuffs_lzip__decoder; |
12289 | | |
12290 | | #ifdef __cplusplus |
12291 | | extern "C" { |
12292 | | #endif |
12293 | | |
12294 | | // ---------------- Public Initializer Prototypes |
12295 | | |
12296 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
12297 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
12298 | | // |
12299 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
12300 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
12301 | | |
12302 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
12303 | | wuffs_lzip__decoder__initialize( |
12304 | | wuffs_lzip__decoder* self, |
12305 | | size_t sizeof_star_self, |
12306 | | uint64_t wuffs_version, |
12307 | | uint32_t options); |
12308 | | |
12309 | | size_t |
12310 | | sizeof__wuffs_lzip__decoder(void); |
12311 | | |
12312 | | // ---------------- Allocs |
12313 | | |
12314 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
12315 | | // memory allocation fails. If they return non-NULL, there is no need to call |
12316 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
12317 | | // calling free on the returned pointer. That pointer is effectively a C++ |
12318 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
12319 | | |
12320 | | wuffs_lzip__decoder* |
12321 | | wuffs_lzip__decoder__alloc(void); |
12322 | | |
12323 | | static inline wuffs_base__io_transformer* |
12324 | | wuffs_lzip__decoder__alloc_as__wuffs_base__io_transformer(void) { |
12325 | | return (wuffs_base__io_transformer*)(wuffs_lzip__decoder__alloc()); |
12326 | | } |
12327 | | |
12328 | | // ---------------- Upcasts |
12329 | | |
12330 | | static inline wuffs_base__io_transformer* |
12331 | | wuffs_lzip__decoder__upcast_as__wuffs_base__io_transformer( |
12332 | | wuffs_lzip__decoder* p) { |
12333 | | return (wuffs_base__io_transformer*)p; |
12334 | | } |
12335 | | |
12336 | | // ---------------- Public Function Prototypes |
12337 | | |
12338 | | WUFFS_BASE__GENERATED_C_CODE |
12339 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
12340 | | wuffs_lzip__decoder__get_quirk( |
12341 | | const wuffs_lzip__decoder* self, |
12342 | | uint32_t a_key); |
12343 | | |
12344 | | WUFFS_BASE__GENERATED_C_CODE |
12345 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
12346 | | wuffs_lzip__decoder__set_quirk( |
12347 | | wuffs_lzip__decoder* self, |
12348 | | uint32_t a_key, |
12349 | | uint64_t a_value); |
12350 | | |
12351 | | WUFFS_BASE__GENERATED_C_CODE |
12352 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63 |
12353 | | wuffs_lzip__decoder__dst_history_retain_length( |
12354 | | const wuffs_lzip__decoder* self); |
12355 | | |
12356 | | WUFFS_BASE__GENERATED_C_CODE |
12357 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
12358 | | wuffs_lzip__decoder__workbuf_len( |
12359 | | const wuffs_lzip__decoder* self); |
12360 | | |
12361 | | WUFFS_BASE__GENERATED_C_CODE |
12362 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
12363 | | wuffs_lzip__decoder__transform_io( |
12364 | | wuffs_lzip__decoder* self, |
12365 | | wuffs_base__io_buffer* a_dst, |
12366 | | wuffs_base__io_buffer* a_src, |
12367 | | wuffs_base__slice_u8 a_workbuf); |
12368 | | |
12369 | | #ifdef __cplusplus |
12370 | | } // extern "C" |
12371 | | #endif |
12372 | | |
12373 | | // ---------------- Struct Definitions |
12374 | | |
12375 | | // These structs' fields, and the sizeof them, are private implementation |
12376 | | // details that aren't guaranteed to be stable across Wuffs versions. |
12377 | | // |
12378 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
12379 | | |
12380 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
12381 | | |
12382 | | struct wuffs_lzip__decoder__struct { |
12383 | | // Do not access the private_impl's or private_data's fields directly. There |
12384 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
12385 | | // the wuffs_foo__bar__baz functions. |
12386 | | // |
12387 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
12388 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
12389 | | |
12390 | | struct { |
12391 | | uint32_t magic; |
12392 | | uint32_t active_coroutine; |
12393 | | wuffs_base__vtable vtable_for__wuffs_base__io_transformer; |
12394 | | wuffs_base__vtable null_vtable; |
12395 | | |
12396 | | bool f_ignore_checksum; |
12397 | | uint64_t f_dsize_have; |
12398 | | uint64_t f_ssize_have; |
12399 | | |
12400 | | uint32_t p_transform_io; |
12401 | | uint32_t p_do_transform_io; |
12402 | | } private_impl; |
12403 | | |
12404 | | struct { |
12405 | | wuffs_crc32__ieee_hasher f_crc32; |
12406 | | wuffs_lzma__decoder f_lzma; |
12407 | | |
12408 | | struct { |
12409 | | uint64_t scratch; |
12410 | | } s_do_transform_io; |
12411 | | } private_data; |
12412 | | |
12413 | | #ifdef __cplusplus |
12414 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
12415 | | using unique_ptr = std::unique_ptr<wuffs_lzip__decoder, wuffs_unique_ptr_deleter>; |
12416 | | |
12417 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
12418 | | |
12419 | | static inline unique_ptr |
12420 | | alloc() { |
12421 | | return unique_ptr(wuffs_lzip__decoder__alloc()); |
12422 | | } |
12423 | | |
12424 | | static inline wuffs_base__io_transformer::unique_ptr |
12425 | | alloc_as__wuffs_base__io_transformer() { |
12426 | | return wuffs_base__io_transformer::unique_ptr( |
12427 | | wuffs_lzip__decoder__alloc_as__wuffs_base__io_transformer()); |
12428 | | } |
12429 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
12430 | | |
12431 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
12432 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
12433 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
12434 | | // size and field layout is not part of the public, stable, memory-safe API. |
12435 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
12436 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
12437 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
12438 | | // |
12439 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
12440 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
12441 | | // order to provide convenience methods. These forward on "this", so that you |
12442 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
12443 | | wuffs_lzip__decoder__struct() = delete; |
12444 | | wuffs_lzip__decoder__struct(const wuffs_lzip__decoder__struct&) = delete; |
12445 | | wuffs_lzip__decoder__struct& operator=( |
12446 | | const wuffs_lzip__decoder__struct&) = delete; |
12447 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
12448 | | |
12449 | | #if !defined(WUFFS_IMPLEMENTATION) |
12450 | | // As above, the size of the struct is not part of the public API, and unless |
12451 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
12452 | | // allocated, not stack allocated. Its size is not intended to be known at |
12453 | | // compile time, but it is unfortunately divulged as a side effect of |
12454 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
12455 | | // instead of "sizeof T", invoking the operator. To make the two values |
12456 | | // different, so that passing the latter will be rejected by the initialize |
12457 | | // function, we add an arbitrary amount of dead weight. |
12458 | | uint8_t dead_weight[123000000]; // 123 MB. |
12459 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
12460 | | |
12461 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
12462 | | initialize( |
12463 | | size_t sizeof_star_self, |
12464 | | uint64_t wuffs_version, |
12465 | | uint32_t options) { |
12466 | | return wuffs_lzip__decoder__initialize( |
12467 | | this, sizeof_star_self, wuffs_version, options); |
12468 | | } |
12469 | | |
12470 | | inline wuffs_base__io_transformer* |
12471 | | upcast_as__wuffs_base__io_transformer() { |
12472 | | return (wuffs_base__io_transformer*)this; |
12473 | | } |
12474 | | |
12475 | | inline uint64_t |
12476 | | get_quirk( |
12477 | | uint32_t a_key) const { |
12478 | | return wuffs_lzip__decoder__get_quirk(this, a_key); |
12479 | | } |
12480 | | |
12481 | | inline wuffs_base__status |
12482 | | set_quirk( |
12483 | | uint32_t a_key, |
12484 | | uint64_t a_value) { |
12485 | | return wuffs_lzip__decoder__set_quirk(this, a_key, a_value); |
12486 | | } |
12487 | | |
12488 | | inline wuffs_base__optional_u63 |
12489 | | dst_history_retain_length() const { |
12490 | | return wuffs_lzip__decoder__dst_history_retain_length(this); |
12491 | | } |
12492 | | |
12493 | | inline wuffs_base__range_ii_u64 |
12494 | | workbuf_len() const { |
12495 | | return wuffs_lzip__decoder__workbuf_len(this); |
12496 | | } |
12497 | | |
12498 | | inline wuffs_base__status |
12499 | | transform_io( |
12500 | | wuffs_base__io_buffer* a_dst, |
12501 | | wuffs_base__io_buffer* a_src, |
12502 | | wuffs_base__slice_u8 a_workbuf) { |
12503 | | return wuffs_lzip__decoder__transform_io(this, a_dst, a_src, a_workbuf); |
12504 | | } |
12505 | | |
12506 | | #endif // __cplusplus |
12507 | | }; // struct wuffs_lzip__decoder__struct |
12508 | | |
12509 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
12510 | | |
12511 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__LZIP) || defined(WUFFS_NONMONOLITHIC) |
12512 | | |
12513 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__LZW) || defined(WUFFS_NONMONOLITHIC) |
12514 | | |
12515 | | // ---------------- Status Codes |
12516 | | |
12517 | | extern const char wuffs_lzw__error__bad_code[]; |
12518 | | extern const char wuffs_lzw__error__truncated_input[]; |
12519 | | |
12520 | | // ---------------- Public Consts |
12521 | | |
12522 | | #define WUFFS_LZW__DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE 0u |
12523 | | |
12524 | | #define WUFFS_LZW__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u |
12525 | | |
12526 | | #define WUFFS_LZW__QUIRK_LITERAL_WIDTH_PLUS_ONE 1290672128u |
12527 | | |
12528 | | // ---------------- Struct Declarations |
12529 | | |
12530 | | typedef struct wuffs_lzw__decoder__struct wuffs_lzw__decoder; |
12531 | | |
12532 | | #ifdef __cplusplus |
12533 | | extern "C" { |
12534 | | #endif |
12535 | | |
12536 | | // ---------------- Public Initializer Prototypes |
12537 | | |
12538 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
12539 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
12540 | | // |
12541 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
12542 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
12543 | | |
12544 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
12545 | | wuffs_lzw__decoder__initialize( |
12546 | | wuffs_lzw__decoder* self, |
12547 | | size_t sizeof_star_self, |
12548 | | uint64_t wuffs_version, |
12549 | | uint32_t options); |
12550 | | |
12551 | | size_t |
12552 | | sizeof__wuffs_lzw__decoder(void); |
12553 | | |
12554 | | // ---------------- Allocs |
12555 | | |
12556 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
12557 | | // memory allocation fails. If they return non-NULL, there is no need to call |
12558 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
12559 | | // calling free on the returned pointer. That pointer is effectively a C++ |
12560 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
12561 | | |
12562 | | wuffs_lzw__decoder* |
12563 | | wuffs_lzw__decoder__alloc(void); |
12564 | | |
12565 | | static inline wuffs_base__io_transformer* |
12566 | | wuffs_lzw__decoder__alloc_as__wuffs_base__io_transformer(void) { |
12567 | | return (wuffs_base__io_transformer*)(wuffs_lzw__decoder__alloc()); |
12568 | | } |
12569 | | |
12570 | | // ---------------- Upcasts |
12571 | | |
12572 | | static inline wuffs_base__io_transformer* |
12573 | | wuffs_lzw__decoder__upcast_as__wuffs_base__io_transformer( |
12574 | | wuffs_lzw__decoder* p) { |
12575 | | return (wuffs_base__io_transformer*)p; |
12576 | | } |
12577 | | |
12578 | | // ---------------- Public Function Prototypes |
12579 | | |
12580 | | WUFFS_BASE__GENERATED_C_CODE |
12581 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
12582 | | wuffs_lzw__decoder__get_quirk( |
12583 | | const wuffs_lzw__decoder* self, |
12584 | | uint32_t a_key); |
12585 | | |
12586 | | WUFFS_BASE__GENERATED_C_CODE |
12587 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
12588 | | wuffs_lzw__decoder__set_quirk( |
12589 | | wuffs_lzw__decoder* self, |
12590 | | uint32_t a_key, |
12591 | | uint64_t a_value); |
12592 | | |
12593 | | WUFFS_BASE__GENERATED_C_CODE |
12594 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63 |
12595 | | wuffs_lzw__decoder__dst_history_retain_length( |
12596 | | const wuffs_lzw__decoder* self); |
12597 | | |
12598 | | WUFFS_BASE__GENERATED_C_CODE |
12599 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
12600 | | wuffs_lzw__decoder__workbuf_len( |
12601 | | const wuffs_lzw__decoder* self); |
12602 | | |
12603 | | WUFFS_BASE__GENERATED_C_CODE |
12604 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
12605 | | wuffs_lzw__decoder__transform_io( |
12606 | | wuffs_lzw__decoder* self, |
12607 | | wuffs_base__io_buffer* a_dst, |
12608 | | wuffs_base__io_buffer* a_src, |
12609 | | wuffs_base__slice_u8 a_workbuf); |
12610 | | |
12611 | | WUFFS_BASE__GENERATED_C_CODE |
12612 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__slice_u8 |
12613 | | wuffs_lzw__decoder__flush( |
12614 | | wuffs_lzw__decoder* self); |
12615 | | |
12616 | | #ifdef __cplusplus |
12617 | | } // extern "C" |
12618 | | #endif |
12619 | | |
12620 | | // ---------------- Struct Definitions |
12621 | | |
12622 | | // These structs' fields, and the sizeof them, are private implementation |
12623 | | // details that aren't guaranteed to be stable across Wuffs versions. |
12624 | | // |
12625 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
12626 | | |
12627 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
12628 | | |
12629 | | struct wuffs_lzw__decoder__struct { |
12630 | | // Do not access the private_impl's or private_data's fields directly. There |
12631 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
12632 | | // the wuffs_foo__bar__baz functions. |
12633 | | // |
12634 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
12635 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
12636 | | |
12637 | | struct { |
12638 | | uint32_t magic; |
12639 | | uint32_t active_coroutine; |
12640 | | wuffs_base__vtable vtable_for__wuffs_base__io_transformer; |
12641 | | wuffs_base__vtable null_vtable; |
12642 | | |
12643 | | uint32_t f_pending_literal_width_plus_one; |
12644 | | uint32_t f_literal_width; |
12645 | | uint32_t f_clear_code; |
12646 | | uint32_t f_end_code; |
12647 | | uint32_t f_save_code; |
12648 | | uint32_t f_prev_code; |
12649 | | uint32_t f_width; |
12650 | | uint32_t f_bits; |
12651 | | uint32_t f_n_bits; |
12652 | | uint32_t f_output_ri; |
12653 | | uint32_t f_output_wi; |
12654 | | uint32_t f_read_from_return_value; |
12655 | | uint16_t f_prefixes[4096]; |
12656 | | |
12657 | | uint32_t p_transform_io; |
12658 | | uint32_t p_write_to; |
12659 | | } private_impl; |
12660 | | |
12661 | | struct { |
12662 | | uint8_t f_suffixes[4096][8]; |
12663 | | uint16_t f_lm1s[4096]; |
12664 | | uint8_t f_output[8199]; |
12665 | | } private_data; |
12666 | | |
12667 | | #ifdef __cplusplus |
12668 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
12669 | | using unique_ptr = std::unique_ptr<wuffs_lzw__decoder, wuffs_unique_ptr_deleter>; |
12670 | | |
12671 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
12672 | | |
12673 | | static inline unique_ptr |
12674 | | alloc() { |
12675 | | return unique_ptr(wuffs_lzw__decoder__alloc()); |
12676 | | } |
12677 | | |
12678 | | static inline wuffs_base__io_transformer::unique_ptr |
12679 | | alloc_as__wuffs_base__io_transformer() { |
12680 | | return wuffs_base__io_transformer::unique_ptr( |
12681 | | wuffs_lzw__decoder__alloc_as__wuffs_base__io_transformer()); |
12682 | | } |
12683 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
12684 | | |
12685 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
12686 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
12687 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
12688 | | // size and field layout is not part of the public, stable, memory-safe API. |
12689 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
12690 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
12691 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
12692 | | // |
12693 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
12694 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
12695 | | // order to provide convenience methods. These forward on "this", so that you |
12696 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
12697 | | wuffs_lzw__decoder__struct() = delete; |
12698 | | wuffs_lzw__decoder__struct(const wuffs_lzw__decoder__struct&) = delete; |
12699 | | wuffs_lzw__decoder__struct& operator=( |
12700 | | const wuffs_lzw__decoder__struct&) = delete; |
12701 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
12702 | | |
12703 | | #if !defined(WUFFS_IMPLEMENTATION) |
12704 | | // As above, the size of the struct is not part of the public API, and unless |
12705 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
12706 | | // allocated, not stack allocated. Its size is not intended to be known at |
12707 | | // compile time, but it is unfortunately divulged as a side effect of |
12708 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
12709 | | // instead of "sizeof T", invoking the operator. To make the two values |
12710 | | // different, so that passing the latter will be rejected by the initialize |
12711 | | // function, we add an arbitrary amount of dead weight. |
12712 | | uint8_t dead_weight[123000000]; // 123 MB. |
12713 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
12714 | | |
12715 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
12716 | | initialize( |
12717 | | size_t sizeof_star_self, |
12718 | | uint64_t wuffs_version, |
12719 | | uint32_t options) { |
12720 | | return wuffs_lzw__decoder__initialize( |
12721 | | this, sizeof_star_self, wuffs_version, options); |
12722 | | } |
12723 | | |
12724 | | inline wuffs_base__io_transformer* |
12725 | | upcast_as__wuffs_base__io_transformer() { |
12726 | | return (wuffs_base__io_transformer*)this; |
12727 | | } |
12728 | | |
12729 | | inline uint64_t |
12730 | | get_quirk( |
12731 | | uint32_t a_key) const { |
12732 | | return wuffs_lzw__decoder__get_quirk(this, a_key); |
12733 | | } |
12734 | | |
12735 | | inline wuffs_base__status |
12736 | | set_quirk( |
12737 | | uint32_t a_key, |
12738 | | uint64_t a_value) { |
12739 | | return wuffs_lzw__decoder__set_quirk(this, a_key, a_value); |
12740 | | } |
12741 | | |
12742 | | inline wuffs_base__optional_u63 |
12743 | | dst_history_retain_length() const { |
12744 | | return wuffs_lzw__decoder__dst_history_retain_length(this); |
12745 | | } |
12746 | | |
12747 | | inline wuffs_base__range_ii_u64 |
12748 | | workbuf_len() const { |
12749 | | return wuffs_lzw__decoder__workbuf_len(this); |
12750 | | } |
12751 | | |
12752 | | inline wuffs_base__status |
12753 | | transform_io( |
12754 | | wuffs_base__io_buffer* a_dst, |
12755 | | wuffs_base__io_buffer* a_src, |
12756 | | wuffs_base__slice_u8 a_workbuf) { |
12757 | | return wuffs_lzw__decoder__transform_io(this, a_dst, a_src, a_workbuf); |
12758 | | } |
12759 | | |
12760 | | inline wuffs_base__slice_u8 |
12761 | | flush() { |
12762 | | return wuffs_lzw__decoder__flush(this); |
12763 | | } |
12764 | | |
12765 | | #endif // __cplusplus |
12766 | | }; // struct wuffs_lzw__decoder__struct |
12767 | | |
12768 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
12769 | | |
12770 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__LZW) || defined(WUFFS_NONMONOLITHIC) |
12771 | | |
12772 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__NETPBM) || defined(WUFFS_NONMONOLITHIC) |
12773 | | |
12774 | | // ---------------- Status Codes |
12775 | | |
12776 | | extern const char wuffs_netpbm__error__bad_header[]; |
12777 | | extern const char wuffs_netpbm__error__truncated_input[]; |
12778 | | extern const char wuffs_netpbm__error__unsupported_netpbm_file[]; |
12779 | | |
12780 | | // ---------------- Public Consts |
12781 | | |
12782 | | #define WUFFS_NETPBM__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u |
12783 | | |
12784 | | // ---------------- Struct Declarations |
12785 | | |
12786 | | typedef struct wuffs_netpbm__decoder__struct wuffs_netpbm__decoder; |
12787 | | |
12788 | | #ifdef __cplusplus |
12789 | | extern "C" { |
12790 | | #endif |
12791 | | |
12792 | | // ---------------- Public Initializer Prototypes |
12793 | | |
12794 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
12795 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
12796 | | // |
12797 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
12798 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
12799 | | |
12800 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
12801 | | wuffs_netpbm__decoder__initialize( |
12802 | | wuffs_netpbm__decoder* self, |
12803 | | size_t sizeof_star_self, |
12804 | | uint64_t wuffs_version, |
12805 | | uint32_t options); |
12806 | | |
12807 | | size_t |
12808 | | sizeof__wuffs_netpbm__decoder(void); |
12809 | | |
12810 | | // ---------------- Allocs |
12811 | | |
12812 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
12813 | | // memory allocation fails. If they return non-NULL, there is no need to call |
12814 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
12815 | | // calling free on the returned pointer. That pointer is effectively a C++ |
12816 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
12817 | | |
12818 | | wuffs_netpbm__decoder* |
12819 | | wuffs_netpbm__decoder__alloc(void); |
12820 | | |
12821 | | static inline wuffs_base__image_decoder* |
12822 | | wuffs_netpbm__decoder__alloc_as__wuffs_base__image_decoder(void) { |
12823 | | return (wuffs_base__image_decoder*)(wuffs_netpbm__decoder__alloc()); |
12824 | | } |
12825 | | |
12826 | | // ---------------- Upcasts |
12827 | | |
12828 | | static inline wuffs_base__image_decoder* |
12829 | | wuffs_netpbm__decoder__upcast_as__wuffs_base__image_decoder( |
12830 | | wuffs_netpbm__decoder* p) { |
12831 | | return (wuffs_base__image_decoder*)p; |
12832 | | } |
12833 | | |
12834 | | // ---------------- Public Function Prototypes |
12835 | | |
12836 | | WUFFS_BASE__GENERATED_C_CODE |
12837 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
12838 | | wuffs_netpbm__decoder__get_quirk( |
12839 | | const wuffs_netpbm__decoder* self, |
12840 | | uint32_t a_key); |
12841 | | |
12842 | | WUFFS_BASE__GENERATED_C_CODE |
12843 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
12844 | | wuffs_netpbm__decoder__set_quirk( |
12845 | | wuffs_netpbm__decoder* self, |
12846 | | uint32_t a_key, |
12847 | | uint64_t a_value); |
12848 | | |
12849 | | WUFFS_BASE__GENERATED_C_CODE |
12850 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
12851 | | wuffs_netpbm__decoder__decode_image_config( |
12852 | | wuffs_netpbm__decoder* self, |
12853 | | wuffs_base__image_config* a_dst, |
12854 | | wuffs_base__io_buffer* a_src); |
12855 | | |
12856 | | WUFFS_BASE__GENERATED_C_CODE |
12857 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
12858 | | wuffs_netpbm__decoder__decode_frame_config( |
12859 | | wuffs_netpbm__decoder* self, |
12860 | | wuffs_base__frame_config* a_dst, |
12861 | | wuffs_base__io_buffer* a_src); |
12862 | | |
12863 | | WUFFS_BASE__GENERATED_C_CODE |
12864 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
12865 | | wuffs_netpbm__decoder__decode_frame( |
12866 | | wuffs_netpbm__decoder* self, |
12867 | | wuffs_base__pixel_buffer* a_dst, |
12868 | | wuffs_base__io_buffer* a_src, |
12869 | | wuffs_base__pixel_blend a_blend, |
12870 | | wuffs_base__slice_u8 a_workbuf, |
12871 | | wuffs_base__decode_frame_options* a_opts); |
12872 | | |
12873 | | WUFFS_BASE__GENERATED_C_CODE |
12874 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32 |
12875 | | wuffs_netpbm__decoder__frame_dirty_rect( |
12876 | | const wuffs_netpbm__decoder* self); |
12877 | | |
12878 | | WUFFS_BASE__GENERATED_C_CODE |
12879 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
12880 | | wuffs_netpbm__decoder__num_animation_loops( |
12881 | | const wuffs_netpbm__decoder* self); |
12882 | | |
12883 | | WUFFS_BASE__GENERATED_C_CODE |
12884 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
12885 | | wuffs_netpbm__decoder__num_decoded_frame_configs( |
12886 | | const wuffs_netpbm__decoder* self); |
12887 | | |
12888 | | WUFFS_BASE__GENERATED_C_CODE |
12889 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
12890 | | wuffs_netpbm__decoder__num_decoded_frames( |
12891 | | const wuffs_netpbm__decoder* self); |
12892 | | |
12893 | | WUFFS_BASE__GENERATED_C_CODE |
12894 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
12895 | | wuffs_netpbm__decoder__restart_frame( |
12896 | | wuffs_netpbm__decoder* self, |
12897 | | uint64_t a_index, |
12898 | | uint64_t a_io_position); |
12899 | | |
12900 | | WUFFS_BASE__GENERATED_C_CODE |
12901 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
12902 | | wuffs_netpbm__decoder__set_report_metadata( |
12903 | | wuffs_netpbm__decoder* self, |
12904 | | uint32_t a_fourcc, |
12905 | | bool a_report); |
12906 | | |
12907 | | WUFFS_BASE__GENERATED_C_CODE |
12908 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
12909 | | wuffs_netpbm__decoder__tell_me_more( |
12910 | | wuffs_netpbm__decoder* self, |
12911 | | wuffs_base__io_buffer* a_dst, |
12912 | | wuffs_base__more_information* a_minfo, |
12913 | | wuffs_base__io_buffer* a_src); |
12914 | | |
12915 | | WUFFS_BASE__GENERATED_C_CODE |
12916 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
12917 | | wuffs_netpbm__decoder__workbuf_len( |
12918 | | const wuffs_netpbm__decoder* self); |
12919 | | |
12920 | | #ifdef __cplusplus |
12921 | | } // extern "C" |
12922 | | #endif |
12923 | | |
12924 | | // ---------------- Struct Definitions |
12925 | | |
12926 | | // These structs' fields, and the sizeof them, are private implementation |
12927 | | // details that aren't guaranteed to be stable across Wuffs versions. |
12928 | | // |
12929 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
12930 | | |
12931 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
12932 | | |
12933 | | struct wuffs_netpbm__decoder__struct { |
12934 | | // Do not access the private_impl's or private_data's fields directly. There |
12935 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
12936 | | // the wuffs_foo__bar__baz functions. |
12937 | | // |
12938 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
12939 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
12940 | | |
12941 | | struct { |
12942 | | uint32_t magic; |
12943 | | uint32_t active_coroutine; |
12944 | | wuffs_base__vtable vtable_for__wuffs_base__image_decoder; |
12945 | | wuffs_base__vtable null_vtable; |
12946 | | |
12947 | | uint32_t f_pixfmt; |
12948 | | uint32_t f_width; |
12949 | | uint32_t f_height; |
12950 | | uint32_t f_max_value; |
12951 | | uint8_t f_call_sequence; |
12952 | | uint64_t f_frame_config_io_position; |
12953 | | uint32_t f_dst_x; |
12954 | | uint32_t f_dst_y; |
12955 | | wuffs_base__pixel_swizzler f_swizzler; |
12956 | | |
12957 | | uint32_t p_decode_image_config; |
12958 | | uint32_t p_do_decode_image_config; |
12959 | | uint32_t p_decode_frame_config; |
12960 | | uint32_t p_do_decode_frame_config; |
12961 | | uint32_t p_decode_frame; |
12962 | | uint32_t p_do_decode_frame; |
12963 | | } private_impl; |
12964 | | |
12965 | | struct { |
12966 | | uint8_t f_buffer[8]; |
12967 | | } private_data; |
12968 | | |
12969 | | #ifdef __cplusplus |
12970 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
12971 | | using unique_ptr = std::unique_ptr<wuffs_netpbm__decoder, wuffs_unique_ptr_deleter>; |
12972 | | |
12973 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
12974 | | |
12975 | | static inline unique_ptr |
12976 | | alloc() { |
12977 | | return unique_ptr(wuffs_netpbm__decoder__alloc()); |
12978 | | } |
12979 | | |
12980 | | static inline wuffs_base__image_decoder::unique_ptr |
12981 | | alloc_as__wuffs_base__image_decoder() { |
12982 | | return wuffs_base__image_decoder::unique_ptr( |
12983 | | wuffs_netpbm__decoder__alloc_as__wuffs_base__image_decoder()); |
12984 | | } |
12985 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
12986 | | |
12987 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
12988 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
12989 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
12990 | | // size and field layout is not part of the public, stable, memory-safe API. |
12991 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
12992 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
12993 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
12994 | | // |
12995 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
12996 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
12997 | | // order to provide convenience methods. These forward on "this", so that you |
12998 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
12999 | | wuffs_netpbm__decoder__struct() = delete; |
13000 | | wuffs_netpbm__decoder__struct(const wuffs_netpbm__decoder__struct&) = delete; |
13001 | | wuffs_netpbm__decoder__struct& operator=( |
13002 | | const wuffs_netpbm__decoder__struct&) = delete; |
13003 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
13004 | | |
13005 | | #if !defined(WUFFS_IMPLEMENTATION) |
13006 | | // As above, the size of the struct is not part of the public API, and unless |
13007 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
13008 | | // allocated, not stack allocated. Its size is not intended to be known at |
13009 | | // compile time, but it is unfortunately divulged as a side effect of |
13010 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
13011 | | // instead of "sizeof T", invoking the operator. To make the two values |
13012 | | // different, so that passing the latter will be rejected by the initialize |
13013 | | // function, we add an arbitrary amount of dead weight. |
13014 | | uint8_t dead_weight[123000000]; // 123 MB. |
13015 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
13016 | | |
13017 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
13018 | | initialize( |
13019 | | size_t sizeof_star_self, |
13020 | | uint64_t wuffs_version, |
13021 | | uint32_t options) { |
13022 | | return wuffs_netpbm__decoder__initialize( |
13023 | | this, sizeof_star_self, wuffs_version, options); |
13024 | | } |
13025 | | |
13026 | | inline wuffs_base__image_decoder* |
13027 | | upcast_as__wuffs_base__image_decoder() { |
13028 | | return (wuffs_base__image_decoder*)this; |
13029 | | } |
13030 | | |
13031 | | inline uint64_t |
13032 | | get_quirk( |
13033 | | uint32_t a_key) const { |
13034 | | return wuffs_netpbm__decoder__get_quirk(this, a_key); |
13035 | | } |
13036 | | |
13037 | | inline wuffs_base__status |
13038 | | set_quirk( |
13039 | | uint32_t a_key, |
13040 | | uint64_t a_value) { |
13041 | | return wuffs_netpbm__decoder__set_quirk(this, a_key, a_value); |
13042 | | } |
13043 | | |
13044 | | inline wuffs_base__status |
13045 | | decode_image_config( |
13046 | | wuffs_base__image_config* a_dst, |
13047 | | wuffs_base__io_buffer* a_src) { |
13048 | | return wuffs_netpbm__decoder__decode_image_config(this, a_dst, a_src); |
13049 | | } |
13050 | | |
13051 | | inline wuffs_base__status |
13052 | | decode_frame_config( |
13053 | | wuffs_base__frame_config* a_dst, |
13054 | | wuffs_base__io_buffer* a_src) { |
13055 | | return wuffs_netpbm__decoder__decode_frame_config(this, a_dst, a_src); |
13056 | | } |
13057 | | |
13058 | | inline wuffs_base__status |
13059 | | decode_frame( |
13060 | | wuffs_base__pixel_buffer* a_dst, |
13061 | | wuffs_base__io_buffer* a_src, |
13062 | | wuffs_base__pixel_blend a_blend, |
13063 | | wuffs_base__slice_u8 a_workbuf, |
13064 | | wuffs_base__decode_frame_options* a_opts) { |
13065 | | return wuffs_netpbm__decoder__decode_frame(this, a_dst, a_src, a_blend, a_workbuf, a_opts); |
13066 | | } |
13067 | | |
13068 | | inline wuffs_base__rect_ie_u32 |
13069 | | frame_dirty_rect() const { |
13070 | | return wuffs_netpbm__decoder__frame_dirty_rect(this); |
13071 | | } |
13072 | | |
13073 | | inline uint32_t |
13074 | | num_animation_loops() const { |
13075 | | return wuffs_netpbm__decoder__num_animation_loops(this); |
13076 | | } |
13077 | | |
13078 | | inline uint64_t |
13079 | | num_decoded_frame_configs() const { |
13080 | | return wuffs_netpbm__decoder__num_decoded_frame_configs(this); |
13081 | | } |
13082 | | |
13083 | | inline uint64_t |
13084 | | num_decoded_frames() const { |
13085 | | return wuffs_netpbm__decoder__num_decoded_frames(this); |
13086 | | } |
13087 | | |
13088 | | inline wuffs_base__status |
13089 | | restart_frame( |
13090 | | uint64_t a_index, |
13091 | | uint64_t a_io_position) { |
13092 | | return wuffs_netpbm__decoder__restart_frame(this, a_index, a_io_position); |
13093 | | } |
13094 | | |
13095 | | inline wuffs_base__empty_struct |
13096 | | set_report_metadata( |
13097 | | uint32_t a_fourcc, |
13098 | | bool a_report) { |
13099 | | return wuffs_netpbm__decoder__set_report_metadata(this, a_fourcc, a_report); |
13100 | | } |
13101 | | |
13102 | | inline wuffs_base__status |
13103 | | tell_me_more( |
13104 | | wuffs_base__io_buffer* a_dst, |
13105 | | wuffs_base__more_information* a_minfo, |
13106 | | wuffs_base__io_buffer* a_src) { |
13107 | | return wuffs_netpbm__decoder__tell_me_more(this, a_dst, a_minfo, a_src); |
13108 | | } |
13109 | | |
13110 | | inline wuffs_base__range_ii_u64 |
13111 | | workbuf_len() const { |
13112 | | return wuffs_netpbm__decoder__workbuf_len(this); |
13113 | | } |
13114 | | |
13115 | | #endif // __cplusplus |
13116 | | }; // struct wuffs_netpbm__decoder__struct |
13117 | | |
13118 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
13119 | | |
13120 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__NETPBM) || defined(WUFFS_NONMONOLITHIC) |
13121 | | |
13122 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__NIE) || defined(WUFFS_NONMONOLITHIC) |
13123 | | |
13124 | | // ---------------- Status Codes |
13125 | | |
13126 | | extern const char wuffs_nie__error__bad_frame[]; |
13127 | | extern const char wuffs_nie__error__bad_header[]; |
13128 | | extern const char wuffs_nie__error__truncated_input[]; |
13129 | | extern const char wuffs_nie__error__unsupported_restart_frame_index[]; |
13130 | | |
13131 | | // ---------------- Public Consts |
13132 | | |
13133 | | #define WUFFS_NIE__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u |
13134 | | |
13135 | | // ---------------- Struct Declarations |
13136 | | |
13137 | | typedef struct wuffs_nie__decoder__struct wuffs_nie__decoder; |
13138 | | |
13139 | | #ifdef __cplusplus |
13140 | | extern "C" { |
13141 | | #endif |
13142 | | |
13143 | | // ---------------- Public Initializer Prototypes |
13144 | | |
13145 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
13146 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
13147 | | // |
13148 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
13149 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
13150 | | |
13151 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
13152 | | wuffs_nie__decoder__initialize( |
13153 | | wuffs_nie__decoder* self, |
13154 | | size_t sizeof_star_self, |
13155 | | uint64_t wuffs_version, |
13156 | | uint32_t options); |
13157 | | |
13158 | | size_t |
13159 | | sizeof__wuffs_nie__decoder(void); |
13160 | | |
13161 | | // ---------------- Allocs |
13162 | | |
13163 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
13164 | | // memory allocation fails. If they return non-NULL, there is no need to call |
13165 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
13166 | | // calling free on the returned pointer. That pointer is effectively a C++ |
13167 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
13168 | | |
13169 | | wuffs_nie__decoder* |
13170 | | wuffs_nie__decoder__alloc(void); |
13171 | | |
13172 | | static inline wuffs_base__image_decoder* |
13173 | | wuffs_nie__decoder__alloc_as__wuffs_base__image_decoder(void) { |
13174 | | return (wuffs_base__image_decoder*)(wuffs_nie__decoder__alloc()); |
13175 | | } |
13176 | | |
13177 | | // ---------------- Upcasts |
13178 | | |
13179 | | static inline wuffs_base__image_decoder* |
13180 | | wuffs_nie__decoder__upcast_as__wuffs_base__image_decoder( |
13181 | | wuffs_nie__decoder* p) { |
13182 | | return (wuffs_base__image_decoder*)p; |
13183 | | } |
13184 | | |
13185 | | // ---------------- Public Function Prototypes |
13186 | | |
13187 | | WUFFS_BASE__GENERATED_C_CODE |
13188 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
13189 | | wuffs_nie__decoder__get_quirk( |
13190 | | const wuffs_nie__decoder* self, |
13191 | | uint32_t a_key); |
13192 | | |
13193 | | WUFFS_BASE__GENERATED_C_CODE |
13194 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
13195 | | wuffs_nie__decoder__set_quirk( |
13196 | | wuffs_nie__decoder* self, |
13197 | | uint32_t a_key, |
13198 | | uint64_t a_value); |
13199 | | |
13200 | | WUFFS_BASE__GENERATED_C_CODE |
13201 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
13202 | | wuffs_nie__decoder__decode_image_config( |
13203 | | wuffs_nie__decoder* self, |
13204 | | wuffs_base__image_config* a_dst, |
13205 | | wuffs_base__io_buffer* a_src); |
13206 | | |
13207 | | WUFFS_BASE__GENERATED_C_CODE |
13208 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
13209 | | wuffs_nie__decoder__decode_frame_config( |
13210 | | wuffs_nie__decoder* self, |
13211 | | wuffs_base__frame_config* a_dst, |
13212 | | wuffs_base__io_buffer* a_src); |
13213 | | |
13214 | | WUFFS_BASE__GENERATED_C_CODE |
13215 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
13216 | | wuffs_nie__decoder__decode_frame( |
13217 | | wuffs_nie__decoder* self, |
13218 | | wuffs_base__pixel_buffer* a_dst, |
13219 | | wuffs_base__io_buffer* a_src, |
13220 | | wuffs_base__pixel_blend a_blend, |
13221 | | wuffs_base__slice_u8 a_workbuf, |
13222 | | wuffs_base__decode_frame_options* a_opts); |
13223 | | |
13224 | | WUFFS_BASE__GENERATED_C_CODE |
13225 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32 |
13226 | | wuffs_nie__decoder__frame_dirty_rect( |
13227 | | const wuffs_nie__decoder* self); |
13228 | | |
13229 | | WUFFS_BASE__GENERATED_C_CODE |
13230 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
13231 | | wuffs_nie__decoder__num_animation_loops( |
13232 | | const wuffs_nie__decoder* self); |
13233 | | |
13234 | | WUFFS_BASE__GENERATED_C_CODE |
13235 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
13236 | | wuffs_nie__decoder__num_decoded_frame_configs( |
13237 | | const wuffs_nie__decoder* self); |
13238 | | |
13239 | | WUFFS_BASE__GENERATED_C_CODE |
13240 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
13241 | | wuffs_nie__decoder__num_decoded_frames( |
13242 | | const wuffs_nie__decoder* self); |
13243 | | |
13244 | | WUFFS_BASE__GENERATED_C_CODE |
13245 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
13246 | | wuffs_nie__decoder__restart_frame( |
13247 | | wuffs_nie__decoder* self, |
13248 | | uint64_t a_index, |
13249 | | uint64_t a_io_position); |
13250 | | |
13251 | | WUFFS_BASE__GENERATED_C_CODE |
13252 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
13253 | | wuffs_nie__decoder__set_report_metadata( |
13254 | | wuffs_nie__decoder* self, |
13255 | | uint32_t a_fourcc, |
13256 | | bool a_report); |
13257 | | |
13258 | | WUFFS_BASE__GENERATED_C_CODE |
13259 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
13260 | | wuffs_nie__decoder__tell_me_more( |
13261 | | wuffs_nie__decoder* self, |
13262 | | wuffs_base__io_buffer* a_dst, |
13263 | | wuffs_base__more_information* a_minfo, |
13264 | | wuffs_base__io_buffer* a_src); |
13265 | | |
13266 | | WUFFS_BASE__GENERATED_C_CODE |
13267 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
13268 | | wuffs_nie__decoder__workbuf_len( |
13269 | | const wuffs_nie__decoder* self); |
13270 | | |
13271 | | #ifdef __cplusplus |
13272 | | } // extern "C" |
13273 | | #endif |
13274 | | |
13275 | | // ---------------- Struct Definitions |
13276 | | |
13277 | | // These structs' fields, and the sizeof them, are private implementation |
13278 | | // details that aren't guaranteed to be stable across Wuffs versions. |
13279 | | // |
13280 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
13281 | | |
13282 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
13283 | | |
13284 | | struct wuffs_nie__decoder__struct { |
13285 | | // Do not access the private_impl's or private_data's fields directly. There |
13286 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
13287 | | // the wuffs_foo__bar__baz functions. |
13288 | | // |
13289 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
13290 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
13291 | | |
13292 | | struct { |
13293 | | uint32_t magic; |
13294 | | uint32_t active_coroutine; |
13295 | | wuffs_base__vtable vtable_for__wuffs_base__image_decoder; |
13296 | | wuffs_base__vtable null_vtable; |
13297 | | |
13298 | | uint32_t f_pixfmt; |
13299 | | uint32_t f_width; |
13300 | | uint32_t f_height; |
13301 | | uint8_t f_call_sequence; |
13302 | | bool f_animated; |
13303 | | uint32_t f_nie_config; |
13304 | | uint32_t f_num_animation_loops_value; |
13305 | | uint64_t f_prev_duration; |
13306 | | uint64_t f_curr_duration; |
13307 | | uint64_t f_num_decoded_frame_configs_value; |
13308 | | uint64_t f_num_decoded_frames_value; |
13309 | | uint32_t f_dst_x; |
13310 | | uint32_t f_dst_y; |
13311 | | wuffs_base__pixel_swizzler f_swizzler; |
13312 | | |
13313 | | uint32_t p_decode_image_config; |
13314 | | uint32_t p_do_decode_image_config; |
13315 | | uint32_t p_decode_frame_config; |
13316 | | uint32_t p_do_decode_frame_config; |
13317 | | uint32_t p_decode_animation_info; |
13318 | | uint32_t p_skip_frame; |
13319 | | uint32_t p_decode_frame; |
13320 | | uint32_t p_do_decode_frame; |
13321 | | } private_impl; |
13322 | | |
13323 | | struct { |
13324 | | struct { |
13325 | | uint64_t scratch; |
13326 | | } s_do_decode_image_config; |
13327 | | struct { |
13328 | | uint64_t scratch; |
13329 | | } s_decode_animation_info; |
13330 | | struct { |
13331 | | uint64_t scratch; |
13332 | | } s_skip_frame; |
13333 | | } private_data; |
13334 | | |
13335 | | #ifdef __cplusplus |
13336 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
13337 | | using unique_ptr = std::unique_ptr<wuffs_nie__decoder, wuffs_unique_ptr_deleter>; |
13338 | | |
13339 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
13340 | | |
13341 | | static inline unique_ptr |
13342 | | alloc() { |
13343 | | return unique_ptr(wuffs_nie__decoder__alloc()); |
13344 | | } |
13345 | | |
13346 | | static inline wuffs_base__image_decoder::unique_ptr |
13347 | | alloc_as__wuffs_base__image_decoder() { |
13348 | | return wuffs_base__image_decoder::unique_ptr( |
13349 | | wuffs_nie__decoder__alloc_as__wuffs_base__image_decoder()); |
13350 | | } |
13351 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
13352 | | |
13353 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
13354 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
13355 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
13356 | | // size and field layout is not part of the public, stable, memory-safe API. |
13357 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
13358 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
13359 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
13360 | | // |
13361 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
13362 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
13363 | | // order to provide convenience methods. These forward on "this", so that you |
13364 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
13365 | | wuffs_nie__decoder__struct() = delete; |
13366 | | wuffs_nie__decoder__struct(const wuffs_nie__decoder__struct&) = delete; |
13367 | | wuffs_nie__decoder__struct& operator=( |
13368 | | const wuffs_nie__decoder__struct&) = delete; |
13369 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
13370 | | |
13371 | | #if !defined(WUFFS_IMPLEMENTATION) |
13372 | | // As above, the size of the struct is not part of the public API, and unless |
13373 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
13374 | | // allocated, not stack allocated. Its size is not intended to be known at |
13375 | | // compile time, but it is unfortunately divulged as a side effect of |
13376 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
13377 | | // instead of "sizeof T", invoking the operator. To make the two values |
13378 | | // different, so that passing the latter will be rejected by the initialize |
13379 | | // function, we add an arbitrary amount of dead weight. |
13380 | | uint8_t dead_weight[123000000]; // 123 MB. |
13381 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
13382 | | |
13383 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
13384 | | initialize( |
13385 | | size_t sizeof_star_self, |
13386 | | uint64_t wuffs_version, |
13387 | | uint32_t options) { |
13388 | | return wuffs_nie__decoder__initialize( |
13389 | | this, sizeof_star_self, wuffs_version, options); |
13390 | | } |
13391 | | |
13392 | | inline wuffs_base__image_decoder* |
13393 | | upcast_as__wuffs_base__image_decoder() { |
13394 | | return (wuffs_base__image_decoder*)this; |
13395 | | } |
13396 | | |
13397 | | inline uint64_t |
13398 | | get_quirk( |
13399 | | uint32_t a_key) const { |
13400 | | return wuffs_nie__decoder__get_quirk(this, a_key); |
13401 | | } |
13402 | | |
13403 | | inline wuffs_base__status |
13404 | | set_quirk( |
13405 | | uint32_t a_key, |
13406 | | uint64_t a_value) { |
13407 | | return wuffs_nie__decoder__set_quirk(this, a_key, a_value); |
13408 | | } |
13409 | | |
13410 | | inline wuffs_base__status |
13411 | | decode_image_config( |
13412 | | wuffs_base__image_config* a_dst, |
13413 | | wuffs_base__io_buffer* a_src) { |
13414 | | return wuffs_nie__decoder__decode_image_config(this, a_dst, a_src); |
13415 | | } |
13416 | | |
13417 | | inline wuffs_base__status |
13418 | | decode_frame_config( |
13419 | | wuffs_base__frame_config* a_dst, |
13420 | | wuffs_base__io_buffer* a_src) { |
13421 | | return wuffs_nie__decoder__decode_frame_config(this, a_dst, a_src); |
13422 | | } |
13423 | | |
13424 | | inline wuffs_base__status |
13425 | | decode_frame( |
13426 | | wuffs_base__pixel_buffer* a_dst, |
13427 | | wuffs_base__io_buffer* a_src, |
13428 | | wuffs_base__pixel_blend a_blend, |
13429 | | wuffs_base__slice_u8 a_workbuf, |
13430 | | wuffs_base__decode_frame_options* a_opts) { |
13431 | | return wuffs_nie__decoder__decode_frame(this, a_dst, a_src, a_blend, a_workbuf, a_opts); |
13432 | | } |
13433 | | |
13434 | | inline wuffs_base__rect_ie_u32 |
13435 | | frame_dirty_rect() const { |
13436 | | return wuffs_nie__decoder__frame_dirty_rect(this); |
13437 | | } |
13438 | | |
13439 | | inline uint32_t |
13440 | | num_animation_loops() const { |
13441 | | return wuffs_nie__decoder__num_animation_loops(this); |
13442 | | } |
13443 | | |
13444 | | inline uint64_t |
13445 | | num_decoded_frame_configs() const { |
13446 | | return wuffs_nie__decoder__num_decoded_frame_configs(this); |
13447 | | } |
13448 | | |
13449 | | inline uint64_t |
13450 | | num_decoded_frames() const { |
13451 | | return wuffs_nie__decoder__num_decoded_frames(this); |
13452 | | } |
13453 | | |
13454 | | inline wuffs_base__status |
13455 | | restart_frame( |
13456 | | uint64_t a_index, |
13457 | | uint64_t a_io_position) { |
13458 | | return wuffs_nie__decoder__restart_frame(this, a_index, a_io_position); |
13459 | | } |
13460 | | |
13461 | | inline wuffs_base__empty_struct |
13462 | | set_report_metadata( |
13463 | | uint32_t a_fourcc, |
13464 | | bool a_report) { |
13465 | | return wuffs_nie__decoder__set_report_metadata(this, a_fourcc, a_report); |
13466 | | } |
13467 | | |
13468 | | inline wuffs_base__status |
13469 | | tell_me_more( |
13470 | | wuffs_base__io_buffer* a_dst, |
13471 | | wuffs_base__more_information* a_minfo, |
13472 | | wuffs_base__io_buffer* a_src) { |
13473 | | return wuffs_nie__decoder__tell_me_more(this, a_dst, a_minfo, a_src); |
13474 | | } |
13475 | | |
13476 | | inline wuffs_base__range_ii_u64 |
13477 | | workbuf_len() const { |
13478 | | return wuffs_nie__decoder__workbuf_len(this); |
13479 | | } |
13480 | | |
13481 | | #endif // __cplusplus |
13482 | | }; // struct wuffs_nie__decoder__struct |
13483 | | |
13484 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
13485 | | |
13486 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__NIE) || defined(WUFFS_NONMONOLITHIC) |
13487 | | |
13488 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__ZLIB) || defined(WUFFS_NONMONOLITHIC) |
13489 | | |
13490 | | // ---------------- Status Codes |
13491 | | |
13492 | | extern const char wuffs_zlib__note__dictionary_required[]; |
13493 | | extern const char wuffs_zlib__error__bad_checksum[]; |
13494 | | extern const char wuffs_zlib__error__bad_compression_method[]; |
13495 | | extern const char wuffs_zlib__error__bad_compression_window_size[]; |
13496 | | extern const char wuffs_zlib__error__bad_parity_check[]; |
13497 | | extern const char wuffs_zlib__error__incorrect_dictionary[]; |
13498 | | extern const char wuffs_zlib__error__truncated_input[]; |
13499 | | |
13500 | | // ---------------- Public Consts |
13501 | | |
13502 | | #define WUFFS_ZLIB__QUIRK_JUST_RAW_DEFLATE 2056083456u |
13503 | | |
13504 | | #define WUFFS_ZLIB__DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE 0u |
13505 | | |
13506 | 45.3k | #define WUFFS_ZLIB__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 1u |
13507 | | |
13508 | | // ---------------- Struct Declarations |
13509 | | |
13510 | | typedef struct wuffs_zlib__decoder__struct wuffs_zlib__decoder; |
13511 | | |
13512 | | #ifdef __cplusplus |
13513 | | extern "C" { |
13514 | | #endif |
13515 | | |
13516 | | // ---------------- Public Initializer Prototypes |
13517 | | |
13518 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
13519 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
13520 | | // |
13521 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
13522 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
13523 | | |
13524 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
13525 | | wuffs_zlib__decoder__initialize( |
13526 | | wuffs_zlib__decoder* self, |
13527 | | size_t sizeof_star_self, |
13528 | | uint64_t wuffs_version, |
13529 | | uint32_t options); |
13530 | | |
13531 | | size_t |
13532 | | sizeof__wuffs_zlib__decoder(void); |
13533 | | |
13534 | | // ---------------- Allocs |
13535 | | |
13536 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
13537 | | // memory allocation fails. If they return non-NULL, there is no need to call |
13538 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
13539 | | // calling free on the returned pointer. That pointer is effectively a C++ |
13540 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
13541 | | |
13542 | | wuffs_zlib__decoder* |
13543 | | wuffs_zlib__decoder__alloc(void); |
13544 | | |
13545 | | static inline wuffs_base__io_transformer* |
13546 | 0 | wuffs_zlib__decoder__alloc_as__wuffs_base__io_transformer(void) { |
13547 | 0 | return (wuffs_base__io_transformer*)(wuffs_zlib__decoder__alloc()); |
13548 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_zlib__decoder__alloc_as__wuffs_base__io_transformer Unexecuted instantiation: zlib_fuzzer.c:wuffs_zlib__decoder__alloc_as__wuffs_base__io_transformer |
13549 | | |
13550 | | // ---------------- Upcasts |
13551 | | |
13552 | | static inline wuffs_base__io_transformer* |
13553 | | wuffs_zlib__decoder__upcast_as__wuffs_base__io_transformer( |
13554 | 0 | wuffs_zlib__decoder* p) { |
13555 | 0 | return (wuffs_base__io_transformer*)p; |
13556 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_zlib__decoder__upcast_as__wuffs_base__io_transformer Unexecuted instantiation: zlib_fuzzer.c:wuffs_zlib__decoder__upcast_as__wuffs_base__io_transformer |
13557 | | |
13558 | | // ---------------- Public Function Prototypes |
13559 | | |
13560 | | WUFFS_BASE__GENERATED_C_CODE |
13561 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
13562 | | wuffs_zlib__decoder__dictionary_id( |
13563 | | const wuffs_zlib__decoder* self); |
13564 | | |
13565 | | WUFFS_BASE__GENERATED_C_CODE |
13566 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
13567 | | wuffs_zlib__decoder__add_dictionary( |
13568 | | wuffs_zlib__decoder* self, |
13569 | | wuffs_base__slice_u8 a_dict); |
13570 | | |
13571 | | WUFFS_BASE__GENERATED_C_CODE |
13572 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
13573 | | wuffs_zlib__decoder__get_quirk( |
13574 | | const wuffs_zlib__decoder* self, |
13575 | | uint32_t a_key); |
13576 | | |
13577 | | WUFFS_BASE__GENERATED_C_CODE |
13578 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
13579 | | wuffs_zlib__decoder__set_quirk( |
13580 | | wuffs_zlib__decoder* self, |
13581 | | uint32_t a_key, |
13582 | | uint64_t a_value); |
13583 | | |
13584 | | WUFFS_BASE__GENERATED_C_CODE |
13585 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63 |
13586 | | wuffs_zlib__decoder__dst_history_retain_length( |
13587 | | const wuffs_zlib__decoder* self); |
13588 | | |
13589 | | WUFFS_BASE__GENERATED_C_CODE |
13590 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
13591 | | wuffs_zlib__decoder__workbuf_len( |
13592 | | const wuffs_zlib__decoder* self); |
13593 | | |
13594 | | WUFFS_BASE__GENERATED_C_CODE |
13595 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
13596 | | wuffs_zlib__decoder__transform_io( |
13597 | | wuffs_zlib__decoder* self, |
13598 | | wuffs_base__io_buffer* a_dst, |
13599 | | wuffs_base__io_buffer* a_src, |
13600 | | wuffs_base__slice_u8 a_workbuf); |
13601 | | |
13602 | | #ifdef __cplusplus |
13603 | | } // extern "C" |
13604 | | #endif |
13605 | | |
13606 | | // ---------------- Struct Definitions |
13607 | | |
13608 | | // These structs' fields, and the sizeof them, are private implementation |
13609 | | // details that aren't guaranteed to be stable across Wuffs versions. |
13610 | | // |
13611 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
13612 | | |
13613 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
13614 | | |
13615 | | struct wuffs_zlib__decoder__struct { |
13616 | | // Do not access the private_impl's or private_data's fields directly. There |
13617 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
13618 | | // the wuffs_foo__bar__baz functions. |
13619 | | // |
13620 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
13621 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
13622 | | |
13623 | | struct { |
13624 | | uint32_t magic; |
13625 | | uint32_t active_coroutine; |
13626 | | wuffs_base__vtable vtable_for__wuffs_base__io_transformer; |
13627 | | wuffs_base__vtable null_vtable; |
13628 | | |
13629 | | bool f_bad_call_sequence; |
13630 | | bool f_header_complete; |
13631 | | bool f_got_dictionary; |
13632 | | bool f_want_dictionary; |
13633 | | bool f_quirks[1]; |
13634 | | bool f_ignore_checksum; |
13635 | | uint32_t f_dict_id_have; |
13636 | | uint32_t f_dict_id_want; |
13637 | | |
13638 | | uint32_t p_transform_io; |
13639 | | uint32_t p_do_transform_io; |
13640 | | } private_impl; |
13641 | | |
13642 | | struct { |
13643 | | wuffs_adler32__hasher f_checksum; |
13644 | | wuffs_adler32__hasher f_dict_id_hasher; |
13645 | | wuffs_deflate__decoder f_flate; |
13646 | | |
13647 | | struct { |
13648 | | uint32_t v_checksum_have; |
13649 | | uint64_t scratch; |
13650 | | } s_do_transform_io; |
13651 | | } private_data; |
13652 | | |
13653 | | #ifdef __cplusplus |
13654 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
13655 | | using unique_ptr = std::unique_ptr<wuffs_zlib__decoder, wuffs_unique_ptr_deleter>; |
13656 | | |
13657 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
13658 | | |
13659 | | static inline unique_ptr |
13660 | | alloc() { |
13661 | | return unique_ptr(wuffs_zlib__decoder__alloc()); |
13662 | | } |
13663 | | |
13664 | | static inline wuffs_base__io_transformer::unique_ptr |
13665 | | alloc_as__wuffs_base__io_transformer() { |
13666 | | return wuffs_base__io_transformer::unique_ptr( |
13667 | | wuffs_zlib__decoder__alloc_as__wuffs_base__io_transformer()); |
13668 | | } |
13669 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
13670 | | |
13671 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
13672 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
13673 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
13674 | | // size and field layout is not part of the public, stable, memory-safe API. |
13675 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
13676 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
13677 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
13678 | | // |
13679 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
13680 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
13681 | | // order to provide convenience methods. These forward on "this", so that you |
13682 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
13683 | | wuffs_zlib__decoder__struct() = delete; |
13684 | | wuffs_zlib__decoder__struct(const wuffs_zlib__decoder__struct&) = delete; |
13685 | | wuffs_zlib__decoder__struct& operator=( |
13686 | | const wuffs_zlib__decoder__struct&) = delete; |
13687 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
13688 | | |
13689 | | #if !defined(WUFFS_IMPLEMENTATION) |
13690 | | // As above, the size of the struct is not part of the public API, and unless |
13691 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
13692 | | // allocated, not stack allocated. Its size is not intended to be known at |
13693 | | // compile time, but it is unfortunately divulged as a side effect of |
13694 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
13695 | | // instead of "sizeof T", invoking the operator. To make the two values |
13696 | | // different, so that passing the latter will be rejected by the initialize |
13697 | | // function, we add an arbitrary amount of dead weight. |
13698 | | uint8_t dead_weight[123000000]; // 123 MB. |
13699 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
13700 | | |
13701 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
13702 | | initialize( |
13703 | | size_t sizeof_star_self, |
13704 | | uint64_t wuffs_version, |
13705 | | uint32_t options) { |
13706 | | return wuffs_zlib__decoder__initialize( |
13707 | | this, sizeof_star_self, wuffs_version, options); |
13708 | | } |
13709 | | |
13710 | | inline wuffs_base__io_transformer* |
13711 | | upcast_as__wuffs_base__io_transformer() { |
13712 | | return (wuffs_base__io_transformer*)this; |
13713 | | } |
13714 | | |
13715 | | inline uint32_t |
13716 | | dictionary_id() const { |
13717 | | return wuffs_zlib__decoder__dictionary_id(this); |
13718 | | } |
13719 | | |
13720 | | inline wuffs_base__empty_struct |
13721 | | add_dictionary( |
13722 | | wuffs_base__slice_u8 a_dict) { |
13723 | | return wuffs_zlib__decoder__add_dictionary(this, a_dict); |
13724 | | } |
13725 | | |
13726 | | inline uint64_t |
13727 | | get_quirk( |
13728 | | uint32_t a_key) const { |
13729 | | return wuffs_zlib__decoder__get_quirk(this, a_key); |
13730 | | } |
13731 | | |
13732 | | inline wuffs_base__status |
13733 | | set_quirk( |
13734 | | uint32_t a_key, |
13735 | | uint64_t a_value) { |
13736 | | return wuffs_zlib__decoder__set_quirk(this, a_key, a_value); |
13737 | | } |
13738 | | |
13739 | | inline wuffs_base__optional_u63 |
13740 | | dst_history_retain_length() const { |
13741 | | return wuffs_zlib__decoder__dst_history_retain_length(this); |
13742 | | } |
13743 | | |
13744 | | inline wuffs_base__range_ii_u64 |
13745 | | workbuf_len() const { |
13746 | | return wuffs_zlib__decoder__workbuf_len(this); |
13747 | | } |
13748 | | |
13749 | | inline wuffs_base__status |
13750 | | transform_io( |
13751 | | wuffs_base__io_buffer* a_dst, |
13752 | | wuffs_base__io_buffer* a_src, |
13753 | | wuffs_base__slice_u8 a_workbuf) { |
13754 | | return wuffs_zlib__decoder__transform_io(this, a_dst, a_src, a_workbuf); |
13755 | | } |
13756 | | |
13757 | | #endif // __cplusplus |
13758 | | }; // struct wuffs_zlib__decoder__struct |
13759 | | |
13760 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
13761 | | |
13762 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__ZLIB) || defined(WUFFS_NONMONOLITHIC) |
13763 | | |
13764 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__PNG) || defined(WUFFS_NONMONOLITHIC) |
13765 | | |
13766 | | // ---------------- Status Codes |
13767 | | |
13768 | | extern const char wuffs_png__error__bad_animation_sequence_number[]; |
13769 | | extern const char wuffs_png__error__bad_checksum[]; |
13770 | | extern const char wuffs_png__error__bad_chunk[]; |
13771 | | extern const char wuffs_png__error__bad_filter[]; |
13772 | | extern const char wuffs_png__error__bad_header[]; |
13773 | | extern const char wuffs_png__error__bad_text_chunk_not_latin_1[]; |
13774 | | extern const char wuffs_png__error__missing_palette[]; |
13775 | | extern const char wuffs_png__error__truncated_input[]; |
13776 | | extern const char wuffs_png__error__unsupported_cgbi_extension[]; |
13777 | | extern const char wuffs_png__error__unsupported_png_compression_method[]; |
13778 | | extern const char wuffs_png__error__unsupported_png_file[]; |
13779 | | |
13780 | | // ---------------- Public Consts |
13781 | | |
13782 | | #define WUFFS_PNG__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 2251799562027015u |
13783 | | |
13784 | | #define WUFFS_PNG__DECODER_SRC_IO_BUFFER_LENGTH_MIN_INCL 8u |
13785 | | |
13786 | | // ---------------- Struct Declarations |
13787 | | |
13788 | | typedef struct wuffs_png__decoder__struct wuffs_png__decoder; |
13789 | | |
13790 | | #ifdef __cplusplus |
13791 | | extern "C" { |
13792 | | #endif |
13793 | | |
13794 | | // ---------------- Public Initializer Prototypes |
13795 | | |
13796 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
13797 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
13798 | | // |
13799 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
13800 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
13801 | | |
13802 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
13803 | | wuffs_png__decoder__initialize( |
13804 | | wuffs_png__decoder* self, |
13805 | | size_t sizeof_star_self, |
13806 | | uint64_t wuffs_version, |
13807 | | uint32_t options); |
13808 | | |
13809 | | size_t |
13810 | | sizeof__wuffs_png__decoder(void); |
13811 | | |
13812 | | // ---------------- Allocs |
13813 | | |
13814 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
13815 | | // memory allocation fails. If they return non-NULL, there is no need to call |
13816 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
13817 | | // calling free on the returned pointer. That pointer is effectively a C++ |
13818 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
13819 | | |
13820 | | wuffs_png__decoder* |
13821 | | wuffs_png__decoder__alloc(void); |
13822 | | |
13823 | | static inline wuffs_base__image_decoder* |
13824 | 0 | wuffs_png__decoder__alloc_as__wuffs_base__image_decoder(void) { |
13825 | 0 | return (wuffs_base__image_decoder*)(wuffs_png__decoder__alloc()); |
13826 | 0 | } |
13827 | | |
13828 | | // ---------------- Upcasts |
13829 | | |
13830 | | static inline wuffs_base__image_decoder* |
13831 | | wuffs_png__decoder__upcast_as__wuffs_base__image_decoder( |
13832 | 6.12k | wuffs_png__decoder* p) { |
13833 | 6.12k | return (wuffs_base__image_decoder*)p; |
13834 | 6.12k | } |
13835 | | |
13836 | | // ---------------- Public Function Prototypes |
13837 | | |
13838 | | WUFFS_BASE__GENERATED_C_CODE |
13839 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
13840 | | wuffs_png__decoder__get_quirk( |
13841 | | const wuffs_png__decoder* self, |
13842 | | uint32_t a_key); |
13843 | | |
13844 | | WUFFS_BASE__GENERATED_C_CODE |
13845 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
13846 | | wuffs_png__decoder__set_quirk( |
13847 | | wuffs_png__decoder* self, |
13848 | | uint32_t a_key, |
13849 | | uint64_t a_value); |
13850 | | |
13851 | | WUFFS_BASE__GENERATED_C_CODE |
13852 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
13853 | | wuffs_png__decoder__decode_image_config( |
13854 | | wuffs_png__decoder* self, |
13855 | | wuffs_base__image_config* a_dst, |
13856 | | wuffs_base__io_buffer* a_src); |
13857 | | |
13858 | | WUFFS_BASE__GENERATED_C_CODE |
13859 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
13860 | | wuffs_png__decoder__decode_frame_config( |
13861 | | wuffs_png__decoder* self, |
13862 | | wuffs_base__frame_config* a_dst, |
13863 | | wuffs_base__io_buffer* a_src); |
13864 | | |
13865 | | WUFFS_BASE__GENERATED_C_CODE |
13866 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
13867 | | wuffs_png__decoder__decode_frame( |
13868 | | wuffs_png__decoder* self, |
13869 | | wuffs_base__pixel_buffer* a_dst, |
13870 | | wuffs_base__io_buffer* a_src, |
13871 | | wuffs_base__pixel_blend a_blend, |
13872 | | wuffs_base__slice_u8 a_workbuf, |
13873 | | wuffs_base__decode_frame_options* a_opts); |
13874 | | |
13875 | | WUFFS_BASE__GENERATED_C_CODE |
13876 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32 |
13877 | | wuffs_png__decoder__frame_dirty_rect( |
13878 | | const wuffs_png__decoder* self); |
13879 | | |
13880 | | WUFFS_BASE__GENERATED_C_CODE |
13881 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
13882 | | wuffs_png__decoder__num_animation_loops( |
13883 | | const wuffs_png__decoder* self); |
13884 | | |
13885 | | WUFFS_BASE__GENERATED_C_CODE |
13886 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
13887 | | wuffs_png__decoder__num_decoded_frame_configs( |
13888 | | const wuffs_png__decoder* self); |
13889 | | |
13890 | | WUFFS_BASE__GENERATED_C_CODE |
13891 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
13892 | | wuffs_png__decoder__num_decoded_frames( |
13893 | | const wuffs_png__decoder* self); |
13894 | | |
13895 | | WUFFS_BASE__GENERATED_C_CODE |
13896 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
13897 | | wuffs_png__decoder__restart_frame( |
13898 | | wuffs_png__decoder* self, |
13899 | | uint64_t a_index, |
13900 | | uint64_t a_io_position); |
13901 | | |
13902 | | WUFFS_BASE__GENERATED_C_CODE |
13903 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
13904 | | wuffs_png__decoder__set_report_metadata( |
13905 | | wuffs_png__decoder* self, |
13906 | | uint32_t a_fourcc, |
13907 | | bool a_report); |
13908 | | |
13909 | | WUFFS_BASE__GENERATED_C_CODE |
13910 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
13911 | | wuffs_png__decoder__tell_me_more( |
13912 | | wuffs_png__decoder* self, |
13913 | | wuffs_base__io_buffer* a_dst, |
13914 | | wuffs_base__more_information* a_minfo, |
13915 | | wuffs_base__io_buffer* a_src); |
13916 | | |
13917 | | WUFFS_BASE__GENERATED_C_CODE |
13918 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
13919 | | wuffs_png__decoder__workbuf_len( |
13920 | | const wuffs_png__decoder* self); |
13921 | | |
13922 | | #ifdef __cplusplus |
13923 | | } // extern "C" |
13924 | | #endif |
13925 | | |
13926 | | // ---------------- Struct Definitions |
13927 | | |
13928 | | // These structs' fields, and the sizeof them, are private implementation |
13929 | | // details that aren't guaranteed to be stable across Wuffs versions. |
13930 | | // |
13931 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
13932 | | |
13933 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
13934 | | |
13935 | | struct wuffs_png__decoder__struct { |
13936 | | // Do not access the private_impl's or private_data's fields directly. There |
13937 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
13938 | | // the wuffs_foo__bar__baz functions. |
13939 | | // |
13940 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
13941 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
13942 | | |
13943 | | struct { |
13944 | | uint32_t magic; |
13945 | | uint32_t active_coroutine; |
13946 | | wuffs_base__vtable vtable_for__wuffs_base__image_decoder; |
13947 | | wuffs_base__vtable null_vtable; |
13948 | | |
13949 | | uint32_t f_width; |
13950 | | uint32_t f_height; |
13951 | | uint64_t f_pass_bytes_per_row; |
13952 | | uint64_t f_workbuf_wi; |
13953 | | uint64_t f_workbuf_hist_pos_base; |
13954 | | uint64_t f_overall_workbuf_length; |
13955 | | uint64_t f_pass_workbuf_length; |
13956 | | uint8_t f_call_sequence; |
13957 | | bool f_report_metadata_chrm; |
13958 | | bool f_report_metadata_exif; |
13959 | | bool f_report_metadata_gama; |
13960 | | bool f_report_metadata_iccp; |
13961 | | bool f_report_metadata_kvp; |
13962 | | bool f_report_metadata_srgb; |
13963 | | bool f_ignore_checksum; |
13964 | | uint8_t f_depth; |
13965 | | uint8_t f_color_type; |
13966 | | uint8_t f_filter_distance; |
13967 | | uint8_t f_interlace_pass; |
13968 | | bool f_seen_actl; |
13969 | | bool f_seen_chrm; |
13970 | | bool f_seen_fctl; |
13971 | | bool f_seen_exif; |
13972 | | bool f_seen_gama; |
13973 | | bool f_seen_iccp; |
13974 | | bool f_seen_idat; |
13975 | | bool f_seen_ihdr; |
13976 | | bool f_seen_plte; |
13977 | | bool f_seen_srgb; |
13978 | | bool f_seen_trns; |
13979 | | bool f_metadata_is_zlib_compressed; |
13980 | | bool f_zlib_is_dirty; |
13981 | | uint32_t f_chunk_type; |
13982 | | uint8_t f_chunk_type_array[4]; |
13983 | | uint32_t f_chunk_length; |
13984 | | uint64_t f_remap_transparency; |
13985 | | uint32_t f_dst_pixfmt; |
13986 | | uint32_t f_src_pixfmt; |
13987 | | uint32_t f_num_animation_frames_value; |
13988 | | uint32_t f_num_animation_loops_value; |
13989 | | uint32_t f_num_decoded_frame_configs_value; |
13990 | | uint32_t f_num_decoded_frames_value; |
13991 | | uint32_t f_frame_rect_x0; |
13992 | | uint32_t f_frame_rect_y0; |
13993 | | uint32_t f_frame_rect_x1; |
13994 | | uint32_t f_frame_rect_y1; |
13995 | | uint32_t f_first_rect_x0; |
13996 | | uint32_t f_first_rect_y0; |
13997 | | uint32_t f_first_rect_x1; |
13998 | | uint32_t f_first_rect_y1; |
13999 | | uint64_t f_frame_config_io_position; |
14000 | | uint64_t f_first_config_io_position; |
14001 | | uint64_t f_frame_duration; |
14002 | | uint64_t f_first_duration; |
14003 | | uint8_t f_frame_disposal; |
14004 | | uint8_t f_first_disposal; |
14005 | | bool f_frame_overwrite_instead_of_blend; |
14006 | | bool f_first_overwrite_instead_of_blend; |
14007 | | uint32_t f_next_animation_seq_num; |
14008 | | uint32_t f_metadata_flavor; |
14009 | | uint32_t f_metadata_fourcc; |
14010 | | uint64_t f_metadata_x; |
14011 | | uint64_t f_metadata_y; |
14012 | | uint64_t f_metadata_z; |
14013 | | uint32_t f_ztxt_ri; |
14014 | | uint32_t f_ztxt_wi; |
14015 | | uint64_t f_ztxt_hist_pos; |
14016 | | wuffs_base__pixel_swizzler f_swizzler; |
14017 | | |
14018 | | wuffs_base__empty_struct (*choosy_filter_1)( |
14019 | | wuffs_png__decoder* self, |
14020 | | wuffs_base__slice_u8 a_curr); |
14021 | | wuffs_base__empty_struct (*choosy_filter_3)( |
14022 | | wuffs_png__decoder* self, |
14023 | | wuffs_base__slice_u8 a_curr, |
14024 | | wuffs_base__slice_u8 a_prev); |
14025 | | wuffs_base__empty_struct (*choosy_filter_4)( |
14026 | | wuffs_png__decoder* self, |
14027 | | wuffs_base__slice_u8 a_curr, |
14028 | | wuffs_base__slice_u8 a_prev); |
14029 | | uint32_t p_decode_image_config; |
14030 | | uint32_t p_do_decode_image_config; |
14031 | | uint32_t p_decode_ihdr; |
14032 | | uint32_t p_decode_other_chunk; |
14033 | | uint32_t p_decode_actl; |
14034 | | uint32_t p_decode_chrm; |
14035 | | uint32_t p_decode_fctl; |
14036 | | uint32_t p_decode_gama; |
14037 | | uint32_t p_decode_iccp; |
14038 | | uint32_t p_decode_plte; |
14039 | | uint32_t p_decode_srgb; |
14040 | | uint32_t p_decode_trns; |
14041 | | uint32_t p_decode_frame_config; |
14042 | | uint32_t p_do_decode_frame_config; |
14043 | | uint32_t p_skip_frame; |
14044 | | uint32_t p_decode_frame; |
14045 | | uint32_t p_do_decode_frame; |
14046 | | uint32_t p_decode_pass; |
14047 | | uint32_t p_tell_me_more; |
14048 | | uint32_t p_do_tell_me_more; |
14049 | | wuffs_base__status (*choosy_filter_and_swizzle)( |
14050 | | wuffs_png__decoder* self, |
14051 | | wuffs_base__pixel_buffer* a_dst, |
14052 | | wuffs_base__slice_u8 a_workbuf); |
14053 | | } private_impl; |
14054 | | |
14055 | | struct { |
14056 | | wuffs_crc32__ieee_hasher f_crc32; |
14057 | | wuffs_zlib__decoder f_zlib; |
14058 | | uint8_t f_dst_palette[1024]; |
14059 | | uint8_t f_src_palette[1024]; |
14060 | | |
14061 | | struct { |
14062 | | uint32_t v_checksum_have; |
14063 | | uint64_t scratch; |
14064 | | } s_do_decode_image_config; |
14065 | | struct { |
14066 | | uint64_t scratch; |
14067 | | } s_decode_ihdr; |
14068 | | struct { |
14069 | | uint64_t scratch; |
14070 | | } s_decode_other_chunk; |
14071 | | struct { |
14072 | | uint64_t scratch; |
14073 | | } s_decode_actl; |
14074 | | struct { |
14075 | | uint64_t scratch; |
14076 | | } s_decode_chrm; |
14077 | | struct { |
14078 | | uint32_t v_x0; |
14079 | | uint32_t v_x1; |
14080 | | uint32_t v_y1; |
14081 | | uint64_t scratch; |
14082 | | } s_decode_fctl; |
14083 | | struct { |
14084 | | uint64_t scratch; |
14085 | | } s_decode_gama; |
14086 | | struct { |
14087 | | uint32_t v_num_entries; |
14088 | | uint32_t v_i; |
14089 | | uint64_t scratch; |
14090 | | } s_decode_plte; |
14091 | | struct { |
14092 | | uint32_t v_i; |
14093 | | uint32_t v_n; |
14094 | | uint64_t scratch; |
14095 | | } s_decode_trns; |
14096 | | struct { |
14097 | | uint64_t scratch; |
14098 | | } s_do_decode_frame_config; |
14099 | | struct { |
14100 | | uint64_t scratch; |
14101 | | } s_skip_frame; |
14102 | | struct { |
14103 | | uint64_t scratch; |
14104 | | } s_do_decode_frame; |
14105 | | struct { |
14106 | | uint64_t scratch; |
14107 | | } s_decode_pass; |
14108 | | struct { |
14109 | | wuffs_base__status v_zlib_status; |
14110 | | uint64_t scratch; |
14111 | | } s_do_tell_me_more; |
14112 | | } private_data; |
14113 | | |
14114 | | #ifdef __cplusplus |
14115 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
14116 | | using unique_ptr = std::unique_ptr<wuffs_png__decoder, wuffs_unique_ptr_deleter>; |
14117 | | |
14118 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
14119 | | |
14120 | | static inline unique_ptr |
14121 | | alloc() { |
14122 | | return unique_ptr(wuffs_png__decoder__alloc()); |
14123 | | } |
14124 | | |
14125 | | static inline wuffs_base__image_decoder::unique_ptr |
14126 | | alloc_as__wuffs_base__image_decoder() { |
14127 | | return wuffs_base__image_decoder::unique_ptr( |
14128 | | wuffs_png__decoder__alloc_as__wuffs_base__image_decoder()); |
14129 | | } |
14130 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
14131 | | |
14132 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
14133 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
14134 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
14135 | | // size and field layout is not part of the public, stable, memory-safe API. |
14136 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
14137 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
14138 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
14139 | | // |
14140 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
14141 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
14142 | | // order to provide convenience methods. These forward on "this", so that you |
14143 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
14144 | | wuffs_png__decoder__struct() = delete; |
14145 | | wuffs_png__decoder__struct(const wuffs_png__decoder__struct&) = delete; |
14146 | | wuffs_png__decoder__struct& operator=( |
14147 | | const wuffs_png__decoder__struct&) = delete; |
14148 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
14149 | | |
14150 | | #if !defined(WUFFS_IMPLEMENTATION) |
14151 | | // As above, the size of the struct is not part of the public API, and unless |
14152 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
14153 | | // allocated, not stack allocated. Its size is not intended to be known at |
14154 | | // compile time, but it is unfortunately divulged as a side effect of |
14155 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
14156 | | // instead of "sizeof T", invoking the operator. To make the two values |
14157 | | // different, so that passing the latter will be rejected by the initialize |
14158 | | // function, we add an arbitrary amount of dead weight. |
14159 | | uint8_t dead_weight[123000000]; // 123 MB. |
14160 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
14161 | | |
14162 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
14163 | | initialize( |
14164 | | size_t sizeof_star_self, |
14165 | | uint64_t wuffs_version, |
14166 | | uint32_t options) { |
14167 | | return wuffs_png__decoder__initialize( |
14168 | | this, sizeof_star_self, wuffs_version, options); |
14169 | | } |
14170 | | |
14171 | | inline wuffs_base__image_decoder* |
14172 | | upcast_as__wuffs_base__image_decoder() { |
14173 | | return (wuffs_base__image_decoder*)this; |
14174 | | } |
14175 | | |
14176 | | inline uint64_t |
14177 | | get_quirk( |
14178 | | uint32_t a_key) const { |
14179 | | return wuffs_png__decoder__get_quirk(this, a_key); |
14180 | | } |
14181 | | |
14182 | | inline wuffs_base__status |
14183 | | set_quirk( |
14184 | | uint32_t a_key, |
14185 | | uint64_t a_value) { |
14186 | | return wuffs_png__decoder__set_quirk(this, a_key, a_value); |
14187 | | } |
14188 | | |
14189 | | inline wuffs_base__status |
14190 | | decode_image_config( |
14191 | | wuffs_base__image_config* a_dst, |
14192 | | wuffs_base__io_buffer* a_src) { |
14193 | | return wuffs_png__decoder__decode_image_config(this, a_dst, a_src); |
14194 | | } |
14195 | | |
14196 | | inline wuffs_base__status |
14197 | | decode_frame_config( |
14198 | | wuffs_base__frame_config* a_dst, |
14199 | | wuffs_base__io_buffer* a_src) { |
14200 | | return wuffs_png__decoder__decode_frame_config(this, a_dst, a_src); |
14201 | | } |
14202 | | |
14203 | | inline wuffs_base__status |
14204 | | decode_frame( |
14205 | | wuffs_base__pixel_buffer* a_dst, |
14206 | | wuffs_base__io_buffer* a_src, |
14207 | | wuffs_base__pixel_blend a_blend, |
14208 | | wuffs_base__slice_u8 a_workbuf, |
14209 | | wuffs_base__decode_frame_options* a_opts) { |
14210 | | return wuffs_png__decoder__decode_frame(this, a_dst, a_src, a_blend, a_workbuf, a_opts); |
14211 | | } |
14212 | | |
14213 | | inline wuffs_base__rect_ie_u32 |
14214 | | frame_dirty_rect() const { |
14215 | | return wuffs_png__decoder__frame_dirty_rect(this); |
14216 | | } |
14217 | | |
14218 | | inline uint32_t |
14219 | | num_animation_loops() const { |
14220 | | return wuffs_png__decoder__num_animation_loops(this); |
14221 | | } |
14222 | | |
14223 | | inline uint64_t |
14224 | | num_decoded_frame_configs() const { |
14225 | | return wuffs_png__decoder__num_decoded_frame_configs(this); |
14226 | | } |
14227 | | |
14228 | | inline uint64_t |
14229 | | num_decoded_frames() const { |
14230 | | return wuffs_png__decoder__num_decoded_frames(this); |
14231 | | } |
14232 | | |
14233 | | inline wuffs_base__status |
14234 | | restart_frame( |
14235 | | uint64_t a_index, |
14236 | | uint64_t a_io_position) { |
14237 | | return wuffs_png__decoder__restart_frame(this, a_index, a_io_position); |
14238 | | } |
14239 | | |
14240 | | inline wuffs_base__empty_struct |
14241 | | set_report_metadata( |
14242 | | uint32_t a_fourcc, |
14243 | | bool a_report) { |
14244 | | return wuffs_png__decoder__set_report_metadata(this, a_fourcc, a_report); |
14245 | | } |
14246 | | |
14247 | | inline wuffs_base__status |
14248 | | tell_me_more( |
14249 | | wuffs_base__io_buffer* a_dst, |
14250 | | wuffs_base__more_information* a_minfo, |
14251 | | wuffs_base__io_buffer* a_src) { |
14252 | | return wuffs_png__decoder__tell_me_more(this, a_dst, a_minfo, a_src); |
14253 | | } |
14254 | | |
14255 | | inline wuffs_base__range_ii_u64 |
14256 | | workbuf_len() const { |
14257 | | return wuffs_png__decoder__workbuf_len(this); |
14258 | | } |
14259 | | |
14260 | | #endif // __cplusplus |
14261 | | }; // struct wuffs_png__decoder__struct |
14262 | | |
14263 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
14264 | | |
14265 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__PNG) || defined(WUFFS_NONMONOLITHIC) |
14266 | | |
14267 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__QOI) || defined(WUFFS_NONMONOLITHIC) |
14268 | | |
14269 | | // ---------------- Status Codes |
14270 | | |
14271 | | extern const char wuffs_qoi__error__bad_footer[]; |
14272 | | extern const char wuffs_qoi__error__bad_header[]; |
14273 | | extern const char wuffs_qoi__error__truncated_input[]; |
14274 | | |
14275 | | // ---------------- Public Consts |
14276 | | |
14277 | | #define WUFFS_QOI__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u |
14278 | | |
14279 | | // ---------------- Struct Declarations |
14280 | | |
14281 | | typedef struct wuffs_qoi__decoder__struct wuffs_qoi__decoder; |
14282 | | |
14283 | | #ifdef __cplusplus |
14284 | | extern "C" { |
14285 | | #endif |
14286 | | |
14287 | | // ---------------- Public Initializer Prototypes |
14288 | | |
14289 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
14290 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
14291 | | // |
14292 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
14293 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
14294 | | |
14295 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
14296 | | wuffs_qoi__decoder__initialize( |
14297 | | wuffs_qoi__decoder* self, |
14298 | | size_t sizeof_star_self, |
14299 | | uint64_t wuffs_version, |
14300 | | uint32_t options); |
14301 | | |
14302 | | size_t |
14303 | | sizeof__wuffs_qoi__decoder(void); |
14304 | | |
14305 | | // ---------------- Allocs |
14306 | | |
14307 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
14308 | | // memory allocation fails. If they return non-NULL, there is no need to call |
14309 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
14310 | | // calling free on the returned pointer. That pointer is effectively a C++ |
14311 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
14312 | | |
14313 | | wuffs_qoi__decoder* |
14314 | | wuffs_qoi__decoder__alloc(void); |
14315 | | |
14316 | | static inline wuffs_base__image_decoder* |
14317 | | wuffs_qoi__decoder__alloc_as__wuffs_base__image_decoder(void) { |
14318 | | return (wuffs_base__image_decoder*)(wuffs_qoi__decoder__alloc()); |
14319 | | } |
14320 | | |
14321 | | // ---------------- Upcasts |
14322 | | |
14323 | | static inline wuffs_base__image_decoder* |
14324 | | wuffs_qoi__decoder__upcast_as__wuffs_base__image_decoder( |
14325 | | wuffs_qoi__decoder* p) { |
14326 | | return (wuffs_base__image_decoder*)p; |
14327 | | } |
14328 | | |
14329 | | // ---------------- Public Function Prototypes |
14330 | | |
14331 | | WUFFS_BASE__GENERATED_C_CODE |
14332 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
14333 | | wuffs_qoi__decoder__get_quirk( |
14334 | | const wuffs_qoi__decoder* self, |
14335 | | uint32_t a_key); |
14336 | | |
14337 | | WUFFS_BASE__GENERATED_C_CODE |
14338 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
14339 | | wuffs_qoi__decoder__set_quirk( |
14340 | | wuffs_qoi__decoder* self, |
14341 | | uint32_t a_key, |
14342 | | uint64_t a_value); |
14343 | | |
14344 | | WUFFS_BASE__GENERATED_C_CODE |
14345 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
14346 | | wuffs_qoi__decoder__decode_image_config( |
14347 | | wuffs_qoi__decoder* self, |
14348 | | wuffs_base__image_config* a_dst, |
14349 | | wuffs_base__io_buffer* a_src); |
14350 | | |
14351 | | WUFFS_BASE__GENERATED_C_CODE |
14352 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
14353 | | wuffs_qoi__decoder__decode_frame_config( |
14354 | | wuffs_qoi__decoder* self, |
14355 | | wuffs_base__frame_config* a_dst, |
14356 | | wuffs_base__io_buffer* a_src); |
14357 | | |
14358 | | WUFFS_BASE__GENERATED_C_CODE |
14359 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
14360 | | wuffs_qoi__decoder__decode_frame( |
14361 | | wuffs_qoi__decoder* self, |
14362 | | wuffs_base__pixel_buffer* a_dst, |
14363 | | wuffs_base__io_buffer* a_src, |
14364 | | wuffs_base__pixel_blend a_blend, |
14365 | | wuffs_base__slice_u8 a_workbuf, |
14366 | | wuffs_base__decode_frame_options* a_opts); |
14367 | | |
14368 | | WUFFS_BASE__GENERATED_C_CODE |
14369 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32 |
14370 | | wuffs_qoi__decoder__frame_dirty_rect( |
14371 | | const wuffs_qoi__decoder* self); |
14372 | | |
14373 | | WUFFS_BASE__GENERATED_C_CODE |
14374 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
14375 | | wuffs_qoi__decoder__num_animation_loops( |
14376 | | const wuffs_qoi__decoder* self); |
14377 | | |
14378 | | WUFFS_BASE__GENERATED_C_CODE |
14379 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
14380 | | wuffs_qoi__decoder__num_decoded_frame_configs( |
14381 | | const wuffs_qoi__decoder* self); |
14382 | | |
14383 | | WUFFS_BASE__GENERATED_C_CODE |
14384 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
14385 | | wuffs_qoi__decoder__num_decoded_frames( |
14386 | | const wuffs_qoi__decoder* self); |
14387 | | |
14388 | | WUFFS_BASE__GENERATED_C_CODE |
14389 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
14390 | | wuffs_qoi__decoder__restart_frame( |
14391 | | wuffs_qoi__decoder* self, |
14392 | | uint64_t a_index, |
14393 | | uint64_t a_io_position); |
14394 | | |
14395 | | WUFFS_BASE__GENERATED_C_CODE |
14396 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
14397 | | wuffs_qoi__decoder__set_report_metadata( |
14398 | | wuffs_qoi__decoder* self, |
14399 | | uint32_t a_fourcc, |
14400 | | bool a_report); |
14401 | | |
14402 | | WUFFS_BASE__GENERATED_C_CODE |
14403 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
14404 | | wuffs_qoi__decoder__tell_me_more( |
14405 | | wuffs_qoi__decoder* self, |
14406 | | wuffs_base__io_buffer* a_dst, |
14407 | | wuffs_base__more_information* a_minfo, |
14408 | | wuffs_base__io_buffer* a_src); |
14409 | | |
14410 | | WUFFS_BASE__GENERATED_C_CODE |
14411 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
14412 | | wuffs_qoi__decoder__workbuf_len( |
14413 | | const wuffs_qoi__decoder* self); |
14414 | | |
14415 | | #ifdef __cplusplus |
14416 | | } // extern "C" |
14417 | | #endif |
14418 | | |
14419 | | // ---------------- Struct Definitions |
14420 | | |
14421 | | // These structs' fields, and the sizeof them, are private implementation |
14422 | | // details that aren't guaranteed to be stable across Wuffs versions. |
14423 | | // |
14424 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
14425 | | |
14426 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
14427 | | |
14428 | | struct wuffs_qoi__decoder__struct { |
14429 | | // Do not access the private_impl's or private_data's fields directly. There |
14430 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
14431 | | // the wuffs_foo__bar__baz functions. |
14432 | | // |
14433 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
14434 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
14435 | | |
14436 | | struct { |
14437 | | uint32_t magic; |
14438 | | uint32_t active_coroutine; |
14439 | | wuffs_base__vtable vtable_for__wuffs_base__image_decoder; |
14440 | | wuffs_base__vtable null_vtable; |
14441 | | |
14442 | | uint32_t f_pixfmt; |
14443 | | uint32_t f_width; |
14444 | | uint32_t f_height; |
14445 | | uint64_t f_remaining_pixels_times_4; |
14446 | | uint8_t f_call_sequence; |
14447 | | uint32_t f_buffer_index; |
14448 | | uint32_t f_dst_x; |
14449 | | uint32_t f_dst_y; |
14450 | | wuffs_base__pixel_swizzler f_swizzler; |
14451 | | |
14452 | | uint32_t p_decode_image_config; |
14453 | | uint32_t p_do_decode_image_config; |
14454 | | uint32_t p_decode_frame_config; |
14455 | | uint32_t p_do_decode_frame_config; |
14456 | | uint32_t p_decode_frame; |
14457 | | uint32_t p_do_decode_frame; |
14458 | | uint32_t p_from_src_to_buffer; |
14459 | | } private_impl; |
14460 | | |
14461 | | struct { |
14462 | | uint8_t f_pixel[4]; |
14463 | | uint8_t f_cache[256]; |
14464 | | uint8_t f_buffer[8196]; |
14465 | | |
14466 | | struct { |
14467 | | uint64_t scratch; |
14468 | | } s_do_decode_image_config; |
14469 | | struct { |
14470 | | uint64_t scratch; |
14471 | | } s_do_decode_frame; |
14472 | | struct { |
14473 | | uint8_t v_dg; |
14474 | | uint32_t v_bi; |
14475 | | uint32_t v_bk; |
14476 | | } s_from_src_to_buffer; |
14477 | | } private_data; |
14478 | | |
14479 | | #ifdef __cplusplus |
14480 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
14481 | | using unique_ptr = std::unique_ptr<wuffs_qoi__decoder, wuffs_unique_ptr_deleter>; |
14482 | | |
14483 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
14484 | | |
14485 | | static inline unique_ptr |
14486 | | alloc() { |
14487 | | return unique_ptr(wuffs_qoi__decoder__alloc()); |
14488 | | } |
14489 | | |
14490 | | static inline wuffs_base__image_decoder::unique_ptr |
14491 | | alloc_as__wuffs_base__image_decoder() { |
14492 | | return wuffs_base__image_decoder::unique_ptr( |
14493 | | wuffs_qoi__decoder__alloc_as__wuffs_base__image_decoder()); |
14494 | | } |
14495 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
14496 | | |
14497 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
14498 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
14499 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
14500 | | // size and field layout is not part of the public, stable, memory-safe API. |
14501 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
14502 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
14503 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
14504 | | // |
14505 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
14506 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
14507 | | // order to provide convenience methods. These forward on "this", so that you |
14508 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
14509 | | wuffs_qoi__decoder__struct() = delete; |
14510 | | wuffs_qoi__decoder__struct(const wuffs_qoi__decoder__struct&) = delete; |
14511 | | wuffs_qoi__decoder__struct& operator=( |
14512 | | const wuffs_qoi__decoder__struct&) = delete; |
14513 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
14514 | | |
14515 | | #if !defined(WUFFS_IMPLEMENTATION) |
14516 | | // As above, the size of the struct is not part of the public API, and unless |
14517 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
14518 | | // allocated, not stack allocated. Its size is not intended to be known at |
14519 | | // compile time, but it is unfortunately divulged as a side effect of |
14520 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
14521 | | // instead of "sizeof T", invoking the operator. To make the two values |
14522 | | // different, so that passing the latter will be rejected by the initialize |
14523 | | // function, we add an arbitrary amount of dead weight. |
14524 | | uint8_t dead_weight[123000000]; // 123 MB. |
14525 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
14526 | | |
14527 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
14528 | | initialize( |
14529 | | size_t sizeof_star_self, |
14530 | | uint64_t wuffs_version, |
14531 | | uint32_t options) { |
14532 | | return wuffs_qoi__decoder__initialize( |
14533 | | this, sizeof_star_self, wuffs_version, options); |
14534 | | } |
14535 | | |
14536 | | inline wuffs_base__image_decoder* |
14537 | | upcast_as__wuffs_base__image_decoder() { |
14538 | | return (wuffs_base__image_decoder*)this; |
14539 | | } |
14540 | | |
14541 | | inline uint64_t |
14542 | | get_quirk( |
14543 | | uint32_t a_key) const { |
14544 | | return wuffs_qoi__decoder__get_quirk(this, a_key); |
14545 | | } |
14546 | | |
14547 | | inline wuffs_base__status |
14548 | | set_quirk( |
14549 | | uint32_t a_key, |
14550 | | uint64_t a_value) { |
14551 | | return wuffs_qoi__decoder__set_quirk(this, a_key, a_value); |
14552 | | } |
14553 | | |
14554 | | inline wuffs_base__status |
14555 | | decode_image_config( |
14556 | | wuffs_base__image_config* a_dst, |
14557 | | wuffs_base__io_buffer* a_src) { |
14558 | | return wuffs_qoi__decoder__decode_image_config(this, a_dst, a_src); |
14559 | | } |
14560 | | |
14561 | | inline wuffs_base__status |
14562 | | decode_frame_config( |
14563 | | wuffs_base__frame_config* a_dst, |
14564 | | wuffs_base__io_buffer* a_src) { |
14565 | | return wuffs_qoi__decoder__decode_frame_config(this, a_dst, a_src); |
14566 | | } |
14567 | | |
14568 | | inline wuffs_base__status |
14569 | | decode_frame( |
14570 | | wuffs_base__pixel_buffer* a_dst, |
14571 | | wuffs_base__io_buffer* a_src, |
14572 | | wuffs_base__pixel_blend a_blend, |
14573 | | wuffs_base__slice_u8 a_workbuf, |
14574 | | wuffs_base__decode_frame_options* a_opts) { |
14575 | | return wuffs_qoi__decoder__decode_frame(this, a_dst, a_src, a_blend, a_workbuf, a_opts); |
14576 | | } |
14577 | | |
14578 | | inline wuffs_base__rect_ie_u32 |
14579 | | frame_dirty_rect() const { |
14580 | | return wuffs_qoi__decoder__frame_dirty_rect(this); |
14581 | | } |
14582 | | |
14583 | | inline uint32_t |
14584 | | num_animation_loops() const { |
14585 | | return wuffs_qoi__decoder__num_animation_loops(this); |
14586 | | } |
14587 | | |
14588 | | inline uint64_t |
14589 | | num_decoded_frame_configs() const { |
14590 | | return wuffs_qoi__decoder__num_decoded_frame_configs(this); |
14591 | | } |
14592 | | |
14593 | | inline uint64_t |
14594 | | num_decoded_frames() const { |
14595 | | return wuffs_qoi__decoder__num_decoded_frames(this); |
14596 | | } |
14597 | | |
14598 | | inline wuffs_base__status |
14599 | | restart_frame( |
14600 | | uint64_t a_index, |
14601 | | uint64_t a_io_position) { |
14602 | | return wuffs_qoi__decoder__restart_frame(this, a_index, a_io_position); |
14603 | | } |
14604 | | |
14605 | | inline wuffs_base__empty_struct |
14606 | | set_report_metadata( |
14607 | | uint32_t a_fourcc, |
14608 | | bool a_report) { |
14609 | | return wuffs_qoi__decoder__set_report_metadata(this, a_fourcc, a_report); |
14610 | | } |
14611 | | |
14612 | | inline wuffs_base__status |
14613 | | tell_me_more( |
14614 | | wuffs_base__io_buffer* a_dst, |
14615 | | wuffs_base__more_information* a_minfo, |
14616 | | wuffs_base__io_buffer* a_src) { |
14617 | | return wuffs_qoi__decoder__tell_me_more(this, a_dst, a_minfo, a_src); |
14618 | | } |
14619 | | |
14620 | | inline wuffs_base__range_ii_u64 |
14621 | | workbuf_len() const { |
14622 | | return wuffs_qoi__decoder__workbuf_len(this); |
14623 | | } |
14624 | | |
14625 | | #endif // __cplusplus |
14626 | | }; // struct wuffs_qoi__decoder__struct |
14627 | | |
14628 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
14629 | | |
14630 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__QOI) || defined(WUFFS_NONMONOLITHIC) |
14631 | | |
14632 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__SHA256) || defined(WUFFS_NONMONOLITHIC) |
14633 | | |
14634 | | // ---------------- Status Codes |
14635 | | |
14636 | | // ---------------- Public Consts |
14637 | | |
14638 | | // ---------------- Struct Declarations |
14639 | | |
14640 | | typedef struct wuffs_sha256__hasher__struct wuffs_sha256__hasher; |
14641 | | |
14642 | | #ifdef __cplusplus |
14643 | | extern "C" { |
14644 | | #endif |
14645 | | |
14646 | | // ---------------- Public Initializer Prototypes |
14647 | | |
14648 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
14649 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
14650 | | // |
14651 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
14652 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
14653 | | |
14654 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
14655 | | wuffs_sha256__hasher__initialize( |
14656 | | wuffs_sha256__hasher* self, |
14657 | | size_t sizeof_star_self, |
14658 | | uint64_t wuffs_version, |
14659 | | uint32_t options); |
14660 | | |
14661 | | size_t |
14662 | | sizeof__wuffs_sha256__hasher(void); |
14663 | | |
14664 | | // ---------------- Allocs |
14665 | | |
14666 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
14667 | | // memory allocation fails. If they return non-NULL, there is no need to call |
14668 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
14669 | | // calling free on the returned pointer. That pointer is effectively a C++ |
14670 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
14671 | | |
14672 | | wuffs_sha256__hasher* |
14673 | | wuffs_sha256__hasher__alloc(void); |
14674 | | |
14675 | | static inline wuffs_base__hasher_bitvec256* |
14676 | 0 | wuffs_sha256__hasher__alloc_as__wuffs_base__hasher_bitvec256(void) { |
14677 | 0 | return (wuffs_base__hasher_bitvec256*)(wuffs_sha256__hasher__alloc()); |
14678 | 0 | } |
14679 | | |
14680 | | // ---------------- Upcasts |
14681 | | |
14682 | | static inline wuffs_base__hasher_bitvec256* |
14683 | | wuffs_sha256__hasher__upcast_as__wuffs_base__hasher_bitvec256( |
14684 | 0 | wuffs_sha256__hasher* p) { |
14685 | 0 | return (wuffs_base__hasher_bitvec256*)p; |
14686 | 0 | } |
14687 | | |
14688 | | // ---------------- Public Function Prototypes |
14689 | | |
14690 | | WUFFS_BASE__GENERATED_C_CODE |
14691 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
14692 | | wuffs_sha256__hasher__get_quirk( |
14693 | | const wuffs_sha256__hasher* self, |
14694 | | uint32_t a_key); |
14695 | | |
14696 | | WUFFS_BASE__GENERATED_C_CODE |
14697 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
14698 | | wuffs_sha256__hasher__set_quirk( |
14699 | | wuffs_sha256__hasher* self, |
14700 | | uint32_t a_key, |
14701 | | uint64_t a_value); |
14702 | | |
14703 | | WUFFS_BASE__GENERATED_C_CODE |
14704 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
14705 | | wuffs_sha256__hasher__update( |
14706 | | wuffs_sha256__hasher* self, |
14707 | | wuffs_base__slice_u8 a_x); |
14708 | | |
14709 | | WUFFS_BASE__GENERATED_C_CODE |
14710 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__bitvec256 |
14711 | | wuffs_sha256__hasher__update_bitvec256( |
14712 | | wuffs_sha256__hasher* self, |
14713 | | wuffs_base__slice_u8 a_x); |
14714 | | |
14715 | | WUFFS_BASE__GENERATED_C_CODE |
14716 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__bitvec256 |
14717 | | wuffs_sha256__hasher__checksum_bitvec256( |
14718 | | const wuffs_sha256__hasher* self); |
14719 | | |
14720 | | #ifdef __cplusplus |
14721 | | } // extern "C" |
14722 | | #endif |
14723 | | |
14724 | | // ---------------- Struct Definitions |
14725 | | |
14726 | | // These structs' fields, and the sizeof them, are private implementation |
14727 | | // details that aren't guaranteed to be stable across Wuffs versions. |
14728 | | // |
14729 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
14730 | | |
14731 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
14732 | | |
14733 | | struct wuffs_sha256__hasher__struct { |
14734 | | // Do not access the private_impl's or private_data's fields directly. There |
14735 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
14736 | | // the wuffs_foo__bar__baz functions. |
14737 | | // |
14738 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
14739 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
14740 | | |
14741 | | struct { |
14742 | | uint32_t magic; |
14743 | | uint32_t active_coroutine; |
14744 | | wuffs_base__vtable vtable_for__wuffs_base__hasher_bitvec256; |
14745 | | wuffs_base__vtable null_vtable; |
14746 | | |
14747 | | uint64_t f_length_modulo_u64; |
14748 | | bool f_length_overflows_u64; |
14749 | | uint8_t f_padding0; |
14750 | | uint8_t f_padding1; |
14751 | | uint8_t f_padding2; |
14752 | | uint32_t f_buf_len; |
14753 | | uint8_t f_buf_data[64]; |
14754 | | uint32_t f_h0; |
14755 | | uint32_t f_h1; |
14756 | | uint32_t f_h2; |
14757 | | uint32_t f_h3; |
14758 | | uint32_t f_h4; |
14759 | | uint32_t f_h5; |
14760 | | uint32_t f_h6; |
14761 | | uint32_t f_h7; |
14762 | | } private_impl; |
14763 | | |
14764 | | #ifdef __cplusplus |
14765 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
14766 | | using unique_ptr = std::unique_ptr<wuffs_sha256__hasher, wuffs_unique_ptr_deleter>; |
14767 | | |
14768 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
14769 | | |
14770 | | static inline unique_ptr |
14771 | | alloc() { |
14772 | | return unique_ptr(wuffs_sha256__hasher__alloc()); |
14773 | | } |
14774 | | |
14775 | | static inline wuffs_base__hasher_bitvec256::unique_ptr |
14776 | | alloc_as__wuffs_base__hasher_bitvec256() { |
14777 | | return wuffs_base__hasher_bitvec256::unique_ptr( |
14778 | | wuffs_sha256__hasher__alloc_as__wuffs_base__hasher_bitvec256()); |
14779 | | } |
14780 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
14781 | | |
14782 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
14783 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
14784 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
14785 | | // size and field layout is not part of the public, stable, memory-safe API. |
14786 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
14787 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
14788 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
14789 | | // |
14790 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
14791 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
14792 | | // order to provide convenience methods. These forward on "this", so that you |
14793 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
14794 | | wuffs_sha256__hasher__struct() = delete; |
14795 | | wuffs_sha256__hasher__struct(const wuffs_sha256__hasher__struct&) = delete; |
14796 | | wuffs_sha256__hasher__struct& operator=( |
14797 | | const wuffs_sha256__hasher__struct&) = delete; |
14798 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
14799 | | |
14800 | | #if !defined(WUFFS_IMPLEMENTATION) |
14801 | | // As above, the size of the struct is not part of the public API, and unless |
14802 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
14803 | | // allocated, not stack allocated. Its size is not intended to be known at |
14804 | | // compile time, but it is unfortunately divulged as a side effect of |
14805 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
14806 | | // instead of "sizeof T", invoking the operator. To make the two values |
14807 | | // different, so that passing the latter will be rejected by the initialize |
14808 | | // function, we add an arbitrary amount of dead weight. |
14809 | | uint8_t dead_weight[123000000]; // 123 MB. |
14810 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
14811 | | |
14812 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
14813 | | initialize( |
14814 | | size_t sizeof_star_self, |
14815 | | uint64_t wuffs_version, |
14816 | | uint32_t options) { |
14817 | | return wuffs_sha256__hasher__initialize( |
14818 | | this, sizeof_star_self, wuffs_version, options); |
14819 | | } |
14820 | | |
14821 | | inline wuffs_base__hasher_bitvec256* |
14822 | | upcast_as__wuffs_base__hasher_bitvec256() { |
14823 | | return (wuffs_base__hasher_bitvec256*)this; |
14824 | | } |
14825 | | |
14826 | | inline uint64_t |
14827 | | get_quirk( |
14828 | | uint32_t a_key) const { |
14829 | | return wuffs_sha256__hasher__get_quirk(this, a_key); |
14830 | | } |
14831 | | |
14832 | | inline wuffs_base__status |
14833 | | set_quirk( |
14834 | | uint32_t a_key, |
14835 | | uint64_t a_value) { |
14836 | | return wuffs_sha256__hasher__set_quirk(this, a_key, a_value); |
14837 | | } |
14838 | | |
14839 | | inline wuffs_base__empty_struct |
14840 | | update( |
14841 | | wuffs_base__slice_u8 a_x) { |
14842 | | return wuffs_sha256__hasher__update(this, a_x); |
14843 | | } |
14844 | | |
14845 | | inline wuffs_base__bitvec256 |
14846 | | update_bitvec256( |
14847 | | wuffs_base__slice_u8 a_x) { |
14848 | | return wuffs_sha256__hasher__update_bitvec256(this, a_x); |
14849 | | } |
14850 | | |
14851 | | inline wuffs_base__bitvec256 |
14852 | | checksum_bitvec256() const { |
14853 | | return wuffs_sha256__hasher__checksum_bitvec256(this); |
14854 | | } |
14855 | | |
14856 | | #endif // __cplusplus |
14857 | | }; // struct wuffs_sha256__hasher__struct |
14858 | | |
14859 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
14860 | | |
14861 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__SHA256) || defined(WUFFS_NONMONOLITHIC) |
14862 | | |
14863 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__TARGA) || defined(WUFFS_NONMONOLITHIC) |
14864 | | |
14865 | | // ---------------- Status Codes |
14866 | | |
14867 | | extern const char wuffs_targa__error__bad_header[]; |
14868 | | extern const char wuffs_targa__error__bad_run_length_encoding[]; |
14869 | | extern const char wuffs_targa__error__truncated_input[]; |
14870 | | extern const char wuffs_targa__error__unsupported_targa_file[]; |
14871 | | |
14872 | | // ---------------- Public Consts |
14873 | | |
14874 | | #define WUFFS_TARGA__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u |
14875 | | |
14876 | | // ---------------- Struct Declarations |
14877 | | |
14878 | | typedef struct wuffs_targa__decoder__struct wuffs_targa__decoder; |
14879 | | |
14880 | | #ifdef __cplusplus |
14881 | | extern "C" { |
14882 | | #endif |
14883 | | |
14884 | | // ---------------- Public Initializer Prototypes |
14885 | | |
14886 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
14887 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
14888 | | // |
14889 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
14890 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
14891 | | |
14892 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
14893 | | wuffs_targa__decoder__initialize( |
14894 | | wuffs_targa__decoder* self, |
14895 | | size_t sizeof_star_self, |
14896 | | uint64_t wuffs_version, |
14897 | | uint32_t options); |
14898 | | |
14899 | | size_t |
14900 | | sizeof__wuffs_targa__decoder(void); |
14901 | | |
14902 | | // ---------------- Allocs |
14903 | | |
14904 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
14905 | | // memory allocation fails. If they return non-NULL, there is no need to call |
14906 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
14907 | | // calling free on the returned pointer. That pointer is effectively a C++ |
14908 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
14909 | | |
14910 | | wuffs_targa__decoder* |
14911 | | wuffs_targa__decoder__alloc(void); |
14912 | | |
14913 | | static inline wuffs_base__image_decoder* |
14914 | 0 | wuffs_targa__decoder__alloc_as__wuffs_base__image_decoder(void) { |
14915 | 0 | return (wuffs_base__image_decoder*)(wuffs_targa__decoder__alloc()); |
14916 | 0 | } |
14917 | | |
14918 | | // ---------------- Upcasts |
14919 | | |
14920 | | static inline wuffs_base__image_decoder* |
14921 | | wuffs_targa__decoder__upcast_as__wuffs_base__image_decoder( |
14922 | 1.17k | wuffs_targa__decoder* p) { |
14923 | 1.17k | return (wuffs_base__image_decoder*)p; |
14924 | 1.17k | } |
14925 | | |
14926 | | // ---------------- Public Function Prototypes |
14927 | | |
14928 | | WUFFS_BASE__GENERATED_C_CODE |
14929 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
14930 | | wuffs_targa__decoder__get_quirk( |
14931 | | const wuffs_targa__decoder* self, |
14932 | | uint32_t a_key); |
14933 | | |
14934 | | WUFFS_BASE__GENERATED_C_CODE |
14935 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
14936 | | wuffs_targa__decoder__set_quirk( |
14937 | | wuffs_targa__decoder* self, |
14938 | | uint32_t a_key, |
14939 | | uint64_t a_value); |
14940 | | |
14941 | | WUFFS_BASE__GENERATED_C_CODE |
14942 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
14943 | | wuffs_targa__decoder__decode_image_config( |
14944 | | wuffs_targa__decoder* self, |
14945 | | wuffs_base__image_config* a_dst, |
14946 | | wuffs_base__io_buffer* a_src); |
14947 | | |
14948 | | WUFFS_BASE__GENERATED_C_CODE |
14949 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
14950 | | wuffs_targa__decoder__decode_frame_config( |
14951 | | wuffs_targa__decoder* self, |
14952 | | wuffs_base__frame_config* a_dst, |
14953 | | wuffs_base__io_buffer* a_src); |
14954 | | |
14955 | | WUFFS_BASE__GENERATED_C_CODE |
14956 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
14957 | | wuffs_targa__decoder__decode_frame( |
14958 | | wuffs_targa__decoder* self, |
14959 | | wuffs_base__pixel_buffer* a_dst, |
14960 | | wuffs_base__io_buffer* a_src, |
14961 | | wuffs_base__pixel_blend a_blend, |
14962 | | wuffs_base__slice_u8 a_workbuf, |
14963 | | wuffs_base__decode_frame_options* a_opts); |
14964 | | |
14965 | | WUFFS_BASE__GENERATED_C_CODE |
14966 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32 |
14967 | | wuffs_targa__decoder__frame_dirty_rect( |
14968 | | const wuffs_targa__decoder* self); |
14969 | | |
14970 | | WUFFS_BASE__GENERATED_C_CODE |
14971 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
14972 | | wuffs_targa__decoder__num_animation_loops( |
14973 | | const wuffs_targa__decoder* self); |
14974 | | |
14975 | | WUFFS_BASE__GENERATED_C_CODE |
14976 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
14977 | | wuffs_targa__decoder__num_decoded_frame_configs( |
14978 | | const wuffs_targa__decoder* self); |
14979 | | |
14980 | | WUFFS_BASE__GENERATED_C_CODE |
14981 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
14982 | | wuffs_targa__decoder__num_decoded_frames( |
14983 | | const wuffs_targa__decoder* self); |
14984 | | |
14985 | | WUFFS_BASE__GENERATED_C_CODE |
14986 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
14987 | | wuffs_targa__decoder__restart_frame( |
14988 | | wuffs_targa__decoder* self, |
14989 | | uint64_t a_index, |
14990 | | uint64_t a_io_position); |
14991 | | |
14992 | | WUFFS_BASE__GENERATED_C_CODE |
14993 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
14994 | | wuffs_targa__decoder__set_report_metadata( |
14995 | | wuffs_targa__decoder* self, |
14996 | | uint32_t a_fourcc, |
14997 | | bool a_report); |
14998 | | |
14999 | | WUFFS_BASE__GENERATED_C_CODE |
15000 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
15001 | | wuffs_targa__decoder__tell_me_more( |
15002 | | wuffs_targa__decoder* self, |
15003 | | wuffs_base__io_buffer* a_dst, |
15004 | | wuffs_base__more_information* a_minfo, |
15005 | | wuffs_base__io_buffer* a_src); |
15006 | | |
15007 | | WUFFS_BASE__GENERATED_C_CODE |
15008 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
15009 | | wuffs_targa__decoder__workbuf_len( |
15010 | | const wuffs_targa__decoder* self); |
15011 | | |
15012 | | #ifdef __cplusplus |
15013 | | } // extern "C" |
15014 | | #endif |
15015 | | |
15016 | | // ---------------- Struct Definitions |
15017 | | |
15018 | | // These structs' fields, and the sizeof them, are private implementation |
15019 | | // details that aren't guaranteed to be stable across Wuffs versions. |
15020 | | // |
15021 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
15022 | | |
15023 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
15024 | | |
15025 | | struct wuffs_targa__decoder__struct { |
15026 | | // Do not access the private_impl's or private_data's fields directly. There |
15027 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
15028 | | // the wuffs_foo__bar__baz functions. |
15029 | | // |
15030 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
15031 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
15032 | | |
15033 | | struct { |
15034 | | uint32_t magic; |
15035 | | uint32_t active_coroutine; |
15036 | | wuffs_base__vtable vtable_for__wuffs_base__image_decoder; |
15037 | | wuffs_base__vtable null_vtable; |
15038 | | |
15039 | | uint32_t f_width; |
15040 | | uint32_t f_height; |
15041 | | uint8_t f_call_sequence; |
15042 | | uint8_t f_header_id_length; |
15043 | | uint8_t f_header_color_map_type; |
15044 | | uint8_t f_header_image_type; |
15045 | | uint16_t f_header_color_map_first_entry_index; |
15046 | | uint16_t f_header_color_map_length; |
15047 | | uint8_t f_header_color_map_entry_size; |
15048 | | uint8_t f_header_pixel_depth; |
15049 | | uint8_t f_header_image_descriptor; |
15050 | | bool f_opaque; |
15051 | | uint32_t f_scratch_bytes_per_pixel; |
15052 | | uint32_t f_src_bytes_per_pixel; |
15053 | | uint32_t f_src_pixfmt; |
15054 | | uint64_t f_frame_config_io_position; |
15055 | | wuffs_base__pixel_swizzler f_swizzler; |
15056 | | |
15057 | | uint32_t p_decode_image_config; |
15058 | | uint32_t p_do_decode_image_config; |
15059 | | uint32_t p_decode_frame_config; |
15060 | | uint32_t p_do_decode_frame_config; |
15061 | | uint32_t p_decode_frame; |
15062 | | uint32_t p_do_decode_frame; |
15063 | | } private_impl; |
15064 | | |
15065 | | struct { |
15066 | | uint8_t f_dst_palette[1024]; |
15067 | | uint8_t f_src_palette[1024]; |
15068 | | uint8_t f_scratch[4]; |
15069 | | |
15070 | | struct { |
15071 | | uint32_t v_i; |
15072 | | uint64_t scratch; |
15073 | | } s_do_decode_image_config; |
15074 | | struct { |
15075 | | uint64_t v_dst_bytes_per_pixel; |
15076 | | uint32_t v_dst_x; |
15077 | | uint32_t v_dst_y; |
15078 | | uint64_t v_mark; |
15079 | | uint32_t v_num_pixels32; |
15080 | | uint32_t v_lit_length; |
15081 | | uint32_t v_run_length; |
15082 | | uint64_t v_num_dst_bytes; |
15083 | | uint64_t scratch; |
15084 | | } s_do_decode_frame; |
15085 | | } private_data; |
15086 | | |
15087 | | #ifdef __cplusplus |
15088 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
15089 | | using unique_ptr = std::unique_ptr<wuffs_targa__decoder, wuffs_unique_ptr_deleter>; |
15090 | | |
15091 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
15092 | | |
15093 | | static inline unique_ptr |
15094 | | alloc() { |
15095 | | return unique_ptr(wuffs_targa__decoder__alloc()); |
15096 | | } |
15097 | | |
15098 | | static inline wuffs_base__image_decoder::unique_ptr |
15099 | | alloc_as__wuffs_base__image_decoder() { |
15100 | | return wuffs_base__image_decoder::unique_ptr( |
15101 | | wuffs_targa__decoder__alloc_as__wuffs_base__image_decoder()); |
15102 | | } |
15103 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
15104 | | |
15105 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
15106 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
15107 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
15108 | | // size and field layout is not part of the public, stable, memory-safe API. |
15109 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
15110 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
15111 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
15112 | | // |
15113 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
15114 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
15115 | | // order to provide convenience methods. These forward on "this", so that you |
15116 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
15117 | | wuffs_targa__decoder__struct() = delete; |
15118 | | wuffs_targa__decoder__struct(const wuffs_targa__decoder__struct&) = delete; |
15119 | | wuffs_targa__decoder__struct& operator=( |
15120 | | const wuffs_targa__decoder__struct&) = delete; |
15121 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
15122 | | |
15123 | | #if !defined(WUFFS_IMPLEMENTATION) |
15124 | | // As above, the size of the struct is not part of the public API, and unless |
15125 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
15126 | | // allocated, not stack allocated. Its size is not intended to be known at |
15127 | | // compile time, but it is unfortunately divulged as a side effect of |
15128 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
15129 | | // instead of "sizeof T", invoking the operator. To make the two values |
15130 | | // different, so that passing the latter will be rejected by the initialize |
15131 | | // function, we add an arbitrary amount of dead weight. |
15132 | | uint8_t dead_weight[123000000]; // 123 MB. |
15133 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
15134 | | |
15135 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
15136 | | initialize( |
15137 | | size_t sizeof_star_self, |
15138 | | uint64_t wuffs_version, |
15139 | | uint32_t options) { |
15140 | | return wuffs_targa__decoder__initialize( |
15141 | | this, sizeof_star_self, wuffs_version, options); |
15142 | | } |
15143 | | |
15144 | | inline wuffs_base__image_decoder* |
15145 | | upcast_as__wuffs_base__image_decoder() { |
15146 | | return (wuffs_base__image_decoder*)this; |
15147 | | } |
15148 | | |
15149 | | inline uint64_t |
15150 | | get_quirk( |
15151 | | uint32_t a_key) const { |
15152 | | return wuffs_targa__decoder__get_quirk(this, a_key); |
15153 | | } |
15154 | | |
15155 | | inline wuffs_base__status |
15156 | | set_quirk( |
15157 | | uint32_t a_key, |
15158 | | uint64_t a_value) { |
15159 | | return wuffs_targa__decoder__set_quirk(this, a_key, a_value); |
15160 | | } |
15161 | | |
15162 | | inline wuffs_base__status |
15163 | | decode_image_config( |
15164 | | wuffs_base__image_config* a_dst, |
15165 | | wuffs_base__io_buffer* a_src) { |
15166 | | return wuffs_targa__decoder__decode_image_config(this, a_dst, a_src); |
15167 | | } |
15168 | | |
15169 | | inline wuffs_base__status |
15170 | | decode_frame_config( |
15171 | | wuffs_base__frame_config* a_dst, |
15172 | | wuffs_base__io_buffer* a_src) { |
15173 | | return wuffs_targa__decoder__decode_frame_config(this, a_dst, a_src); |
15174 | | } |
15175 | | |
15176 | | inline wuffs_base__status |
15177 | | decode_frame( |
15178 | | wuffs_base__pixel_buffer* a_dst, |
15179 | | wuffs_base__io_buffer* a_src, |
15180 | | wuffs_base__pixel_blend a_blend, |
15181 | | wuffs_base__slice_u8 a_workbuf, |
15182 | | wuffs_base__decode_frame_options* a_opts) { |
15183 | | return wuffs_targa__decoder__decode_frame(this, a_dst, a_src, a_blend, a_workbuf, a_opts); |
15184 | | } |
15185 | | |
15186 | | inline wuffs_base__rect_ie_u32 |
15187 | | frame_dirty_rect() const { |
15188 | | return wuffs_targa__decoder__frame_dirty_rect(this); |
15189 | | } |
15190 | | |
15191 | | inline uint32_t |
15192 | | num_animation_loops() const { |
15193 | | return wuffs_targa__decoder__num_animation_loops(this); |
15194 | | } |
15195 | | |
15196 | | inline uint64_t |
15197 | | num_decoded_frame_configs() const { |
15198 | | return wuffs_targa__decoder__num_decoded_frame_configs(this); |
15199 | | } |
15200 | | |
15201 | | inline uint64_t |
15202 | | num_decoded_frames() const { |
15203 | | return wuffs_targa__decoder__num_decoded_frames(this); |
15204 | | } |
15205 | | |
15206 | | inline wuffs_base__status |
15207 | | restart_frame( |
15208 | | uint64_t a_index, |
15209 | | uint64_t a_io_position) { |
15210 | | return wuffs_targa__decoder__restart_frame(this, a_index, a_io_position); |
15211 | | } |
15212 | | |
15213 | | inline wuffs_base__empty_struct |
15214 | | set_report_metadata( |
15215 | | uint32_t a_fourcc, |
15216 | | bool a_report) { |
15217 | | return wuffs_targa__decoder__set_report_metadata(this, a_fourcc, a_report); |
15218 | | } |
15219 | | |
15220 | | inline wuffs_base__status |
15221 | | tell_me_more( |
15222 | | wuffs_base__io_buffer* a_dst, |
15223 | | wuffs_base__more_information* a_minfo, |
15224 | | wuffs_base__io_buffer* a_src) { |
15225 | | return wuffs_targa__decoder__tell_me_more(this, a_dst, a_minfo, a_src); |
15226 | | } |
15227 | | |
15228 | | inline wuffs_base__range_ii_u64 |
15229 | | workbuf_len() const { |
15230 | | return wuffs_targa__decoder__workbuf_len(this); |
15231 | | } |
15232 | | |
15233 | | #endif // __cplusplus |
15234 | | }; // struct wuffs_targa__decoder__struct |
15235 | | |
15236 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
15237 | | |
15238 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__TARGA) || defined(WUFFS_NONMONOLITHIC) |
15239 | | |
15240 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__THUMBHASH) || defined(WUFFS_NONMONOLITHIC) |
15241 | | |
15242 | | // ---------------- Status Codes |
15243 | | |
15244 | | extern const char wuffs_thumbhash__error__bad_header[]; |
15245 | | extern const char wuffs_thumbhash__error__truncated_input[]; |
15246 | | |
15247 | | // ---------------- Public Consts |
15248 | | |
15249 | | #define WUFFS_THUMBHASH__QUIRK_JUST_RAW_THUMBHASH 1712283648u |
15250 | | |
15251 | | #define WUFFS_THUMBHASH__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u |
15252 | | |
15253 | | // ---------------- Struct Declarations |
15254 | | |
15255 | | typedef struct wuffs_thumbhash__decoder__struct wuffs_thumbhash__decoder; |
15256 | | |
15257 | | #ifdef __cplusplus |
15258 | | extern "C" { |
15259 | | #endif |
15260 | | |
15261 | | // ---------------- Public Initializer Prototypes |
15262 | | |
15263 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
15264 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
15265 | | // |
15266 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
15267 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
15268 | | |
15269 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
15270 | | wuffs_thumbhash__decoder__initialize( |
15271 | | wuffs_thumbhash__decoder* self, |
15272 | | size_t sizeof_star_self, |
15273 | | uint64_t wuffs_version, |
15274 | | uint32_t options); |
15275 | | |
15276 | | size_t |
15277 | | sizeof__wuffs_thumbhash__decoder(void); |
15278 | | |
15279 | | // ---------------- Allocs |
15280 | | |
15281 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
15282 | | // memory allocation fails. If they return non-NULL, there is no need to call |
15283 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
15284 | | // calling free on the returned pointer. That pointer is effectively a C++ |
15285 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
15286 | | |
15287 | | wuffs_thumbhash__decoder* |
15288 | | wuffs_thumbhash__decoder__alloc(void); |
15289 | | |
15290 | | static inline wuffs_base__image_decoder* |
15291 | | wuffs_thumbhash__decoder__alloc_as__wuffs_base__image_decoder(void) { |
15292 | | return (wuffs_base__image_decoder*)(wuffs_thumbhash__decoder__alloc()); |
15293 | | } |
15294 | | |
15295 | | // ---------------- Upcasts |
15296 | | |
15297 | | static inline wuffs_base__image_decoder* |
15298 | | wuffs_thumbhash__decoder__upcast_as__wuffs_base__image_decoder( |
15299 | | wuffs_thumbhash__decoder* p) { |
15300 | | return (wuffs_base__image_decoder*)p; |
15301 | | } |
15302 | | |
15303 | | // ---------------- Public Function Prototypes |
15304 | | |
15305 | | WUFFS_BASE__GENERATED_C_CODE |
15306 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
15307 | | wuffs_thumbhash__decoder__get_quirk( |
15308 | | const wuffs_thumbhash__decoder* self, |
15309 | | uint32_t a_key); |
15310 | | |
15311 | | WUFFS_BASE__GENERATED_C_CODE |
15312 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
15313 | | wuffs_thumbhash__decoder__set_quirk( |
15314 | | wuffs_thumbhash__decoder* self, |
15315 | | uint32_t a_key, |
15316 | | uint64_t a_value); |
15317 | | |
15318 | | WUFFS_BASE__GENERATED_C_CODE |
15319 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
15320 | | wuffs_thumbhash__decoder__decode_image_config( |
15321 | | wuffs_thumbhash__decoder* self, |
15322 | | wuffs_base__image_config* a_dst, |
15323 | | wuffs_base__io_buffer* a_src); |
15324 | | |
15325 | | WUFFS_BASE__GENERATED_C_CODE |
15326 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
15327 | | wuffs_thumbhash__decoder__decode_frame_config( |
15328 | | wuffs_thumbhash__decoder* self, |
15329 | | wuffs_base__frame_config* a_dst, |
15330 | | wuffs_base__io_buffer* a_src); |
15331 | | |
15332 | | WUFFS_BASE__GENERATED_C_CODE |
15333 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
15334 | | wuffs_thumbhash__decoder__decode_frame( |
15335 | | wuffs_thumbhash__decoder* self, |
15336 | | wuffs_base__pixel_buffer* a_dst, |
15337 | | wuffs_base__io_buffer* a_src, |
15338 | | wuffs_base__pixel_blend a_blend, |
15339 | | wuffs_base__slice_u8 a_workbuf, |
15340 | | wuffs_base__decode_frame_options* a_opts); |
15341 | | |
15342 | | WUFFS_BASE__GENERATED_C_CODE |
15343 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32 |
15344 | | wuffs_thumbhash__decoder__frame_dirty_rect( |
15345 | | const wuffs_thumbhash__decoder* self); |
15346 | | |
15347 | | WUFFS_BASE__GENERATED_C_CODE |
15348 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
15349 | | wuffs_thumbhash__decoder__num_animation_loops( |
15350 | | const wuffs_thumbhash__decoder* self); |
15351 | | |
15352 | | WUFFS_BASE__GENERATED_C_CODE |
15353 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
15354 | | wuffs_thumbhash__decoder__num_decoded_frame_configs( |
15355 | | const wuffs_thumbhash__decoder* self); |
15356 | | |
15357 | | WUFFS_BASE__GENERATED_C_CODE |
15358 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
15359 | | wuffs_thumbhash__decoder__num_decoded_frames( |
15360 | | const wuffs_thumbhash__decoder* self); |
15361 | | |
15362 | | WUFFS_BASE__GENERATED_C_CODE |
15363 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
15364 | | wuffs_thumbhash__decoder__restart_frame( |
15365 | | wuffs_thumbhash__decoder* self, |
15366 | | uint64_t a_index, |
15367 | | uint64_t a_io_position); |
15368 | | |
15369 | | WUFFS_BASE__GENERATED_C_CODE |
15370 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
15371 | | wuffs_thumbhash__decoder__set_report_metadata( |
15372 | | wuffs_thumbhash__decoder* self, |
15373 | | uint32_t a_fourcc, |
15374 | | bool a_report); |
15375 | | |
15376 | | WUFFS_BASE__GENERATED_C_CODE |
15377 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
15378 | | wuffs_thumbhash__decoder__tell_me_more( |
15379 | | wuffs_thumbhash__decoder* self, |
15380 | | wuffs_base__io_buffer* a_dst, |
15381 | | wuffs_base__more_information* a_minfo, |
15382 | | wuffs_base__io_buffer* a_src); |
15383 | | |
15384 | | WUFFS_BASE__GENERATED_C_CODE |
15385 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
15386 | | wuffs_thumbhash__decoder__workbuf_len( |
15387 | | const wuffs_thumbhash__decoder* self); |
15388 | | |
15389 | | #ifdef __cplusplus |
15390 | | } // extern "C" |
15391 | | #endif |
15392 | | |
15393 | | // ---------------- Struct Definitions |
15394 | | |
15395 | | // These structs' fields, and the sizeof them, are private implementation |
15396 | | // details that aren't guaranteed to be stable across Wuffs versions. |
15397 | | // |
15398 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
15399 | | |
15400 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
15401 | | |
15402 | | struct wuffs_thumbhash__decoder__struct { |
15403 | | // Do not access the private_impl's or private_data's fields directly. There |
15404 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
15405 | | // the wuffs_foo__bar__baz functions. |
15406 | | // |
15407 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
15408 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
15409 | | |
15410 | | struct { |
15411 | | uint32_t magic; |
15412 | | uint32_t active_coroutine; |
15413 | | wuffs_base__vtable vtable_for__wuffs_base__image_decoder; |
15414 | | wuffs_base__vtable null_vtable; |
15415 | | |
15416 | | uint32_t f_pixfmt; |
15417 | | uint8_t f_w_dimension_code; |
15418 | | uint8_t f_h_dimension_code; |
15419 | | uint8_t f_call_sequence; |
15420 | | uint8_t f_frame_config_io_position; |
15421 | | uint64_t f_l_dc; |
15422 | | uint64_t f_p_dc; |
15423 | | uint64_t f_q_dc; |
15424 | | uint64_t f_a_dc; |
15425 | | bool f_quirk_just_raw_thumbhash; |
15426 | | uint8_t f_l_scale; |
15427 | | uint8_t f_p_scale; |
15428 | | uint8_t f_q_scale; |
15429 | | uint8_t f_a_scale; |
15430 | | uint8_t f_has_alpha; |
15431 | | uint8_t f_l_count; |
15432 | | uint8_t f_is_landscape; |
15433 | | uint32_t f_lx; |
15434 | | uint32_t f_ly; |
15435 | | wuffs_base__pixel_swizzler f_swizzler; |
15436 | | |
15437 | | uint32_t p_decode_image_config; |
15438 | | uint32_t p_do_decode_image_config; |
15439 | | uint32_t p_decode_frame_config; |
15440 | | uint32_t p_do_decode_frame_config; |
15441 | | uint32_t p_decode_frame; |
15442 | | uint32_t p_do_decode_frame; |
15443 | | uint32_t p_from_src_to_coeffs; |
15444 | | } private_impl; |
15445 | | |
15446 | | struct { |
15447 | | uint32_t f_lac[32]; |
15448 | | uint32_t f_pac[8]; |
15449 | | uint32_t f_qac[8]; |
15450 | | uint32_t f_aac[16]; |
15451 | | uint8_t f_pixels[32][128]; |
15452 | | |
15453 | | struct { |
15454 | | uint64_t scratch; |
15455 | | } s_do_decode_image_config; |
15456 | | struct { |
15457 | | uint32_t v_cy; |
15458 | | uint32_t v_cx; |
15459 | | uint32_t v_i; |
15460 | | bool v_has_bits; |
15461 | | } s_from_src_to_coeffs; |
15462 | | } private_data; |
15463 | | |
15464 | | #ifdef __cplusplus |
15465 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
15466 | | using unique_ptr = std::unique_ptr<wuffs_thumbhash__decoder, wuffs_unique_ptr_deleter>; |
15467 | | |
15468 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
15469 | | |
15470 | | static inline unique_ptr |
15471 | | alloc() { |
15472 | | return unique_ptr(wuffs_thumbhash__decoder__alloc()); |
15473 | | } |
15474 | | |
15475 | | static inline wuffs_base__image_decoder::unique_ptr |
15476 | | alloc_as__wuffs_base__image_decoder() { |
15477 | | return wuffs_base__image_decoder::unique_ptr( |
15478 | | wuffs_thumbhash__decoder__alloc_as__wuffs_base__image_decoder()); |
15479 | | } |
15480 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
15481 | | |
15482 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
15483 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
15484 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
15485 | | // size and field layout is not part of the public, stable, memory-safe API. |
15486 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
15487 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
15488 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
15489 | | // |
15490 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
15491 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
15492 | | // order to provide convenience methods. These forward on "this", so that you |
15493 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
15494 | | wuffs_thumbhash__decoder__struct() = delete; |
15495 | | wuffs_thumbhash__decoder__struct(const wuffs_thumbhash__decoder__struct&) = delete; |
15496 | | wuffs_thumbhash__decoder__struct& operator=( |
15497 | | const wuffs_thumbhash__decoder__struct&) = delete; |
15498 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
15499 | | |
15500 | | #if !defined(WUFFS_IMPLEMENTATION) |
15501 | | // As above, the size of the struct is not part of the public API, and unless |
15502 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
15503 | | // allocated, not stack allocated. Its size is not intended to be known at |
15504 | | // compile time, but it is unfortunately divulged as a side effect of |
15505 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
15506 | | // instead of "sizeof T", invoking the operator. To make the two values |
15507 | | // different, so that passing the latter will be rejected by the initialize |
15508 | | // function, we add an arbitrary amount of dead weight. |
15509 | | uint8_t dead_weight[123000000]; // 123 MB. |
15510 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
15511 | | |
15512 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
15513 | | initialize( |
15514 | | size_t sizeof_star_self, |
15515 | | uint64_t wuffs_version, |
15516 | | uint32_t options) { |
15517 | | return wuffs_thumbhash__decoder__initialize( |
15518 | | this, sizeof_star_self, wuffs_version, options); |
15519 | | } |
15520 | | |
15521 | | inline wuffs_base__image_decoder* |
15522 | | upcast_as__wuffs_base__image_decoder() { |
15523 | | return (wuffs_base__image_decoder*)this; |
15524 | | } |
15525 | | |
15526 | | inline uint64_t |
15527 | | get_quirk( |
15528 | | uint32_t a_key) const { |
15529 | | return wuffs_thumbhash__decoder__get_quirk(this, a_key); |
15530 | | } |
15531 | | |
15532 | | inline wuffs_base__status |
15533 | | set_quirk( |
15534 | | uint32_t a_key, |
15535 | | uint64_t a_value) { |
15536 | | return wuffs_thumbhash__decoder__set_quirk(this, a_key, a_value); |
15537 | | } |
15538 | | |
15539 | | inline wuffs_base__status |
15540 | | decode_image_config( |
15541 | | wuffs_base__image_config* a_dst, |
15542 | | wuffs_base__io_buffer* a_src) { |
15543 | | return wuffs_thumbhash__decoder__decode_image_config(this, a_dst, a_src); |
15544 | | } |
15545 | | |
15546 | | inline wuffs_base__status |
15547 | | decode_frame_config( |
15548 | | wuffs_base__frame_config* a_dst, |
15549 | | wuffs_base__io_buffer* a_src) { |
15550 | | return wuffs_thumbhash__decoder__decode_frame_config(this, a_dst, a_src); |
15551 | | } |
15552 | | |
15553 | | inline wuffs_base__status |
15554 | | decode_frame( |
15555 | | wuffs_base__pixel_buffer* a_dst, |
15556 | | wuffs_base__io_buffer* a_src, |
15557 | | wuffs_base__pixel_blend a_blend, |
15558 | | wuffs_base__slice_u8 a_workbuf, |
15559 | | wuffs_base__decode_frame_options* a_opts) { |
15560 | | return wuffs_thumbhash__decoder__decode_frame(this, a_dst, a_src, a_blend, a_workbuf, a_opts); |
15561 | | } |
15562 | | |
15563 | | inline wuffs_base__rect_ie_u32 |
15564 | | frame_dirty_rect() const { |
15565 | | return wuffs_thumbhash__decoder__frame_dirty_rect(this); |
15566 | | } |
15567 | | |
15568 | | inline uint32_t |
15569 | | num_animation_loops() const { |
15570 | | return wuffs_thumbhash__decoder__num_animation_loops(this); |
15571 | | } |
15572 | | |
15573 | | inline uint64_t |
15574 | | num_decoded_frame_configs() const { |
15575 | | return wuffs_thumbhash__decoder__num_decoded_frame_configs(this); |
15576 | | } |
15577 | | |
15578 | | inline uint64_t |
15579 | | num_decoded_frames() const { |
15580 | | return wuffs_thumbhash__decoder__num_decoded_frames(this); |
15581 | | } |
15582 | | |
15583 | | inline wuffs_base__status |
15584 | | restart_frame( |
15585 | | uint64_t a_index, |
15586 | | uint64_t a_io_position) { |
15587 | | return wuffs_thumbhash__decoder__restart_frame(this, a_index, a_io_position); |
15588 | | } |
15589 | | |
15590 | | inline wuffs_base__empty_struct |
15591 | | set_report_metadata( |
15592 | | uint32_t a_fourcc, |
15593 | | bool a_report) { |
15594 | | return wuffs_thumbhash__decoder__set_report_metadata(this, a_fourcc, a_report); |
15595 | | } |
15596 | | |
15597 | | inline wuffs_base__status |
15598 | | tell_me_more( |
15599 | | wuffs_base__io_buffer* a_dst, |
15600 | | wuffs_base__more_information* a_minfo, |
15601 | | wuffs_base__io_buffer* a_src) { |
15602 | | return wuffs_thumbhash__decoder__tell_me_more(this, a_dst, a_minfo, a_src); |
15603 | | } |
15604 | | |
15605 | | inline wuffs_base__range_ii_u64 |
15606 | | workbuf_len() const { |
15607 | | return wuffs_thumbhash__decoder__workbuf_len(this); |
15608 | | } |
15609 | | |
15610 | | #endif // __cplusplus |
15611 | | }; // struct wuffs_thumbhash__decoder__struct |
15612 | | |
15613 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
15614 | | |
15615 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__THUMBHASH) || defined(WUFFS_NONMONOLITHIC) |
15616 | | |
15617 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__VP8) || defined(WUFFS_NONMONOLITHIC) |
15618 | | |
15619 | | // ---------------- Status Codes |
15620 | | |
15621 | | extern const char wuffs_vp8__error__bad_quirk_source_length[]; |
15622 | | extern const char wuffs_vp8__error__bad_quirk_width_and_height[]; |
15623 | | extern const char wuffs_vp8__error__bad_header[]; |
15624 | | extern const char wuffs_vp8__error__inconsistent_width_and_height[]; |
15625 | | extern const char wuffs_vp8__error__missing_quirk_source_length[]; |
15626 | | extern const char wuffs_vp8__error__truncated_input[]; |
15627 | | extern const char wuffs_vp8__error__unsupported_quirk_source_length[]; |
15628 | | extern const char wuffs_vp8__error__unsupported_vp8_file[]; |
15629 | | |
15630 | | // ---------------- Public Consts |
15631 | | |
15632 | | #define WUFFS_VP8__QUIRK_HAS_ALPHA_SIDE_CHANNEL 1836840960u |
15633 | | |
15634 | | #define WUFFS_VP8__QUIRK_WIDTH_AND_HEIGHT 1836840961u |
15635 | | |
15636 | | #define WUFFS_VP8__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 822050816u |
15637 | | |
15638 | | // ---------------- Struct Declarations |
15639 | | |
15640 | | typedef struct wuffs_vp8__decoder__struct wuffs_vp8__decoder; |
15641 | | |
15642 | | #ifdef __cplusplus |
15643 | | extern "C" { |
15644 | | #endif |
15645 | | |
15646 | | // ---------------- Public Initializer Prototypes |
15647 | | |
15648 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
15649 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
15650 | | // |
15651 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
15652 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
15653 | | |
15654 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
15655 | | wuffs_vp8__decoder__initialize( |
15656 | | wuffs_vp8__decoder* self, |
15657 | | size_t sizeof_star_self, |
15658 | | uint64_t wuffs_version, |
15659 | | uint32_t options); |
15660 | | |
15661 | | size_t |
15662 | | sizeof__wuffs_vp8__decoder(void); |
15663 | | |
15664 | | // ---------------- Allocs |
15665 | | |
15666 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
15667 | | // memory allocation fails. If they return non-NULL, there is no need to call |
15668 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
15669 | | // calling free on the returned pointer. That pointer is effectively a C++ |
15670 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
15671 | | |
15672 | | wuffs_vp8__decoder* |
15673 | | wuffs_vp8__decoder__alloc(void); |
15674 | | |
15675 | | static inline wuffs_base__image_decoder* |
15676 | 0 | wuffs_vp8__decoder__alloc_as__wuffs_base__image_decoder(void) { |
15677 | 0 | return (wuffs_base__image_decoder*)(wuffs_vp8__decoder__alloc()); |
15678 | 0 | } |
15679 | | |
15680 | | // ---------------- Upcasts |
15681 | | |
15682 | | static inline wuffs_base__image_decoder* |
15683 | | wuffs_vp8__decoder__upcast_as__wuffs_base__image_decoder( |
15684 | 0 | wuffs_vp8__decoder* p) { |
15685 | 0 | return (wuffs_base__image_decoder*)p; |
15686 | 0 | } |
15687 | | |
15688 | | // ---------------- Public Function Prototypes |
15689 | | |
15690 | | WUFFS_BASE__GENERATED_C_CODE |
15691 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
15692 | | wuffs_vp8__decoder__get_quirk( |
15693 | | const wuffs_vp8__decoder* self, |
15694 | | uint32_t a_key); |
15695 | | |
15696 | | WUFFS_BASE__GENERATED_C_CODE |
15697 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
15698 | | wuffs_vp8__decoder__set_quirk( |
15699 | | wuffs_vp8__decoder* self, |
15700 | | uint32_t a_key, |
15701 | | uint64_t a_value); |
15702 | | |
15703 | | WUFFS_BASE__GENERATED_C_CODE |
15704 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
15705 | | wuffs_vp8__decoder__decode_image_config( |
15706 | | wuffs_vp8__decoder* self, |
15707 | | wuffs_base__image_config* a_dst, |
15708 | | wuffs_base__io_buffer* a_src); |
15709 | | |
15710 | | WUFFS_BASE__GENERATED_C_CODE |
15711 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
15712 | | wuffs_vp8__decoder__decode_frame_config( |
15713 | | wuffs_vp8__decoder* self, |
15714 | | wuffs_base__frame_config* a_dst, |
15715 | | wuffs_base__io_buffer* a_src); |
15716 | | |
15717 | | WUFFS_BASE__GENERATED_C_CODE |
15718 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
15719 | | wuffs_vp8__decoder__decode_frame( |
15720 | | wuffs_vp8__decoder* self, |
15721 | | wuffs_base__pixel_buffer* a_dst, |
15722 | | wuffs_base__io_buffer* a_src, |
15723 | | wuffs_base__pixel_blend a_blend, |
15724 | | wuffs_base__slice_u8 a_workbuf, |
15725 | | wuffs_base__decode_frame_options* a_opts); |
15726 | | |
15727 | | WUFFS_BASE__GENERATED_C_CODE |
15728 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32 |
15729 | | wuffs_vp8__decoder__frame_dirty_rect( |
15730 | | const wuffs_vp8__decoder* self); |
15731 | | |
15732 | | WUFFS_BASE__GENERATED_C_CODE |
15733 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
15734 | | wuffs_vp8__decoder__num_animation_loops( |
15735 | | const wuffs_vp8__decoder* self); |
15736 | | |
15737 | | WUFFS_BASE__GENERATED_C_CODE |
15738 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
15739 | | wuffs_vp8__decoder__num_decoded_frame_configs( |
15740 | | const wuffs_vp8__decoder* self); |
15741 | | |
15742 | | WUFFS_BASE__GENERATED_C_CODE |
15743 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
15744 | | wuffs_vp8__decoder__num_decoded_frames( |
15745 | | const wuffs_vp8__decoder* self); |
15746 | | |
15747 | | WUFFS_BASE__GENERATED_C_CODE |
15748 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
15749 | | wuffs_vp8__decoder__restart_frame( |
15750 | | wuffs_vp8__decoder* self, |
15751 | | uint64_t a_index, |
15752 | | uint64_t a_io_position); |
15753 | | |
15754 | | WUFFS_BASE__GENERATED_C_CODE |
15755 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
15756 | | wuffs_vp8__decoder__set_report_metadata( |
15757 | | wuffs_vp8__decoder* self, |
15758 | | uint32_t a_fourcc, |
15759 | | bool a_report); |
15760 | | |
15761 | | WUFFS_BASE__GENERATED_C_CODE |
15762 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
15763 | | wuffs_vp8__decoder__tell_me_more( |
15764 | | wuffs_vp8__decoder* self, |
15765 | | wuffs_base__io_buffer* a_dst, |
15766 | | wuffs_base__more_information* a_minfo, |
15767 | | wuffs_base__io_buffer* a_src); |
15768 | | |
15769 | | WUFFS_BASE__GENERATED_C_CODE |
15770 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
15771 | | wuffs_vp8__decoder__workbuf_len( |
15772 | | const wuffs_vp8__decoder* self); |
15773 | | |
15774 | | #ifdef __cplusplus |
15775 | | } // extern "C" |
15776 | | #endif |
15777 | | |
15778 | | // ---------------- Struct Definitions |
15779 | | |
15780 | | // These structs' fields, and the sizeof them, are private implementation |
15781 | | // details that aren't guaranteed to be stable across Wuffs versions. |
15782 | | // |
15783 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
15784 | | |
15785 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
15786 | | |
15787 | | struct wuffs_vp8__decoder__struct { |
15788 | | // Do not access the private_impl's or private_data's fields directly. There |
15789 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
15790 | | // the wuffs_foo__bar__baz functions. |
15791 | | // |
15792 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
15793 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
15794 | | |
15795 | | struct { |
15796 | | uint32_t magic; |
15797 | | uint32_t active_coroutine; |
15798 | | wuffs_base__vtable vtable_for__wuffs_base__image_decoder; |
15799 | | wuffs_base__vtable null_vtable; |
15800 | | |
15801 | | uint32_t f_width; |
15802 | | uint32_t f_height; |
15803 | | uint32_t f_mbw; |
15804 | | uint32_t f_mbh; |
15805 | | uint8_t f_call_sequence; |
15806 | | bool f_is_key_frame; |
15807 | | bool f_quirk_has_alpha_side_channel; |
15808 | | uint64_t f_frame_config_io_position; |
15809 | | uint64_t f_quirk_source_length; |
15810 | | uint64_t f_quirk_width_and_height; |
15811 | | uint32_t f_partitioned_data_length; |
15812 | | uint32_t f_workbuf_yuv_y_stride; |
15813 | | uint32_t f_workbuf_yuv_uv_stride; |
15814 | | uint64_t f_workbuf_yuv_y_end; |
15815 | | uint64_t f_workbuf_yuv_u_end; |
15816 | | uint64_t f_workbuf_yuv_v_end; |
15817 | | uint64_t f_part_workbuf_ris[9]; |
15818 | | uint32_t f_part_range_m1s[9]; |
15819 | | uint32_t f_part_bits[9]; |
15820 | | uint32_t f_part_n_bits[9]; |
15821 | | uint32_t f_part_lens[9]; |
15822 | | uint32_t f_num_other_partitions_m1; |
15823 | | bool f_seg_enabled; |
15824 | | bool f_seg_update_map; |
15825 | | bool f_seg_absolute; |
15826 | | uint8_t f_seg_quants[4]; |
15827 | | uint8_t f_seg_strengths[4]; |
15828 | | uint8_t f_seg_probs[3]; |
15829 | | bool f_filt_simple; |
15830 | | uint8_t f_filt_level; |
15831 | | uint8_t f_filt_sharpness; |
15832 | | bool f_filt_deltas_enabled; |
15833 | | uint8_t f_filt_deltas[2][4]; |
15834 | | uint32_t f_quant_yac_qi; |
15835 | | uint32_t f_quant_ydc_delta; |
15836 | | uint32_t f_quant_y2dc_delta; |
15837 | | uint32_t f_quant_y2ac_delta; |
15838 | | uint32_t f_quant_uvdc_delta; |
15839 | | uint32_t f_quant_uvac_delta; |
15840 | | uint32_t f_loop_filters[8]; |
15841 | | uint16_t f_dequants[4][3][2]; |
15842 | | uint32_t f_prob_skip; |
15843 | | uint8_t f_mb_subblock_modes[16]; |
15844 | | uint32_t f_mb_dc_nz; |
15845 | | uint32_t f_mb_ac_nz; |
15846 | | uint8_t f_yuv_cache[26][32]; |
15847 | | wuffs_base__pixel_swizzler f_swizzler; |
15848 | | |
15849 | | uint32_t p_copy_partitions_to_workbuf; |
15850 | | uint32_t p_decode_image_config; |
15851 | | uint32_t p_do_decode_image_config; |
15852 | | uint32_t p_decode_frame_config; |
15853 | | uint32_t p_do_decode_frame_config; |
15854 | | uint32_t p_decode_frame; |
15855 | | uint32_t p_do_decode_frame; |
15856 | | } private_impl; |
15857 | | |
15858 | | struct { |
15859 | | uint8_t f_swizzle_ycck_scratch_buffer_2k[2048]; |
15860 | | uint8_t f_coeff_probs[1056]; |
15861 | | uint16_t f_mb_coeffs[25][16]; |
15862 | | uint32_t f_mb_states_left; |
15863 | | uint32_t f_mb_states_top[1024]; |
15864 | | uint8_t f_mb_filters[2][1024]; |
15865 | | |
15866 | | struct { |
15867 | | uint64_t v_i; |
15868 | | uint64_t v_j; |
15869 | | } s_copy_partitions_to_workbuf; |
15870 | | struct { |
15871 | | uint64_t scratch; |
15872 | | } s_do_decode_image_config; |
15873 | | } private_data; |
15874 | | |
15875 | | #ifdef __cplusplus |
15876 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
15877 | | using unique_ptr = std::unique_ptr<wuffs_vp8__decoder, wuffs_unique_ptr_deleter>; |
15878 | | |
15879 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
15880 | | |
15881 | | static inline unique_ptr |
15882 | | alloc() { |
15883 | | return unique_ptr(wuffs_vp8__decoder__alloc()); |
15884 | | } |
15885 | | |
15886 | | static inline wuffs_base__image_decoder::unique_ptr |
15887 | | alloc_as__wuffs_base__image_decoder() { |
15888 | | return wuffs_base__image_decoder::unique_ptr( |
15889 | | wuffs_vp8__decoder__alloc_as__wuffs_base__image_decoder()); |
15890 | | } |
15891 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
15892 | | |
15893 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
15894 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
15895 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
15896 | | // size and field layout is not part of the public, stable, memory-safe API. |
15897 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
15898 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
15899 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
15900 | | // |
15901 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
15902 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
15903 | | // order to provide convenience methods. These forward on "this", so that you |
15904 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
15905 | | wuffs_vp8__decoder__struct() = delete; |
15906 | | wuffs_vp8__decoder__struct(const wuffs_vp8__decoder__struct&) = delete; |
15907 | | wuffs_vp8__decoder__struct& operator=( |
15908 | | const wuffs_vp8__decoder__struct&) = delete; |
15909 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
15910 | | |
15911 | | #if !defined(WUFFS_IMPLEMENTATION) |
15912 | | // As above, the size of the struct is not part of the public API, and unless |
15913 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
15914 | | // allocated, not stack allocated. Its size is not intended to be known at |
15915 | | // compile time, but it is unfortunately divulged as a side effect of |
15916 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
15917 | | // instead of "sizeof T", invoking the operator. To make the two values |
15918 | | // different, so that passing the latter will be rejected by the initialize |
15919 | | // function, we add an arbitrary amount of dead weight. |
15920 | | uint8_t dead_weight[123000000]; // 123 MB. |
15921 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
15922 | | |
15923 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
15924 | | initialize( |
15925 | | size_t sizeof_star_self, |
15926 | | uint64_t wuffs_version, |
15927 | | uint32_t options) { |
15928 | | return wuffs_vp8__decoder__initialize( |
15929 | | this, sizeof_star_self, wuffs_version, options); |
15930 | | } |
15931 | | |
15932 | | inline wuffs_base__image_decoder* |
15933 | | upcast_as__wuffs_base__image_decoder() { |
15934 | | return (wuffs_base__image_decoder*)this; |
15935 | | } |
15936 | | |
15937 | | inline uint64_t |
15938 | | get_quirk( |
15939 | | uint32_t a_key) const { |
15940 | | return wuffs_vp8__decoder__get_quirk(this, a_key); |
15941 | | } |
15942 | | |
15943 | | inline wuffs_base__status |
15944 | | set_quirk( |
15945 | | uint32_t a_key, |
15946 | | uint64_t a_value) { |
15947 | | return wuffs_vp8__decoder__set_quirk(this, a_key, a_value); |
15948 | | } |
15949 | | |
15950 | | inline wuffs_base__status |
15951 | | decode_image_config( |
15952 | | wuffs_base__image_config* a_dst, |
15953 | | wuffs_base__io_buffer* a_src) { |
15954 | | return wuffs_vp8__decoder__decode_image_config(this, a_dst, a_src); |
15955 | | } |
15956 | | |
15957 | | inline wuffs_base__status |
15958 | | decode_frame_config( |
15959 | | wuffs_base__frame_config* a_dst, |
15960 | | wuffs_base__io_buffer* a_src) { |
15961 | | return wuffs_vp8__decoder__decode_frame_config(this, a_dst, a_src); |
15962 | | } |
15963 | | |
15964 | | inline wuffs_base__status |
15965 | | decode_frame( |
15966 | | wuffs_base__pixel_buffer* a_dst, |
15967 | | wuffs_base__io_buffer* a_src, |
15968 | | wuffs_base__pixel_blend a_blend, |
15969 | | wuffs_base__slice_u8 a_workbuf, |
15970 | | wuffs_base__decode_frame_options* a_opts) { |
15971 | | return wuffs_vp8__decoder__decode_frame(this, a_dst, a_src, a_blend, a_workbuf, a_opts); |
15972 | | } |
15973 | | |
15974 | | inline wuffs_base__rect_ie_u32 |
15975 | | frame_dirty_rect() const { |
15976 | | return wuffs_vp8__decoder__frame_dirty_rect(this); |
15977 | | } |
15978 | | |
15979 | | inline uint32_t |
15980 | | num_animation_loops() const { |
15981 | | return wuffs_vp8__decoder__num_animation_loops(this); |
15982 | | } |
15983 | | |
15984 | | inline uint64_t |
15985 | | num_decoded_frame_configs() const { |
15986 | | return wuffs_vp8__decoder__num_decoded_frame_configs(this); |
15987 | | } |
15988 | | |
15989 | | inline uint64_t |
15990 | | num_decoded_frames() const { |
15991 | | return wuffs_vp8__decoder__num_decoded_frames(this); |
15992 | | } |
15993 | | |
15994 | | inline wuffs_base__status |
15995 | | restart_frame( |
15996 | | uint64_t a_index, |
15997 | | uint64_t a_io_position) { |
15998 | | return wuffs_vp8__decoder__restart_frame(this, a_index, a_io_position); |
15999 | | } |
16000 | | |
16001 | | inline wuffs_base__empty_struct |
16002 | | set_report_metadata( |
16003 | | uint32_t a_fourcc, |
16004 | | bool a_report) { |
16005 | | return wuffs_vp8__decoder__set_report_metadata(this, a_fourcc, a_report); |
16006 | | } |
16007 | | |
16008 | | inline wuffs_base__status |
16009 | | tell_me_more( |
16010 | | wuffs_base__io_buffer* a_dst, |
16011 | | wuffs_base__more_information* a_minfo, |
16012 | | wuffs_base__io_buffer* a_src) { |
16013 | | return wuffs_vp8__decoder__tell_me_more(this, a_dst, a_minfo, a_src); |
16014 | | } |
16015 | | |
16016 | | inline wuffs_base__range_ii_u64 |
16017 | | workbuf_len() const { |
16018 | | return wuffs_vp8__decoder__workbuf_len(this); |
16019 | | } |
16020 | | |
16021 | | #endif // __cplusplus |
16022 | | }; // struct wuffs_vp8__decoder__struct |
16023 | | |
16024 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
16025 | | |
16026 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__VP8) || defined(WUFFS_NONMONOLITHIC) |
16027 | | |
16028 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__WBMP) || defined(WUFFS_NONMONOLITHIC) |
16029 | | |
16030 | | // ---------------- Status Codes |
16031 | | |
16032 | | extern const char wuffs_wbmp__error__bad_header[]; |
16033 | | extern const char wuffs_wbmp__error__truncated_input[]; |
16034 | | |
16035 | | // ---------------- Public Consts |
16036 | | |
16037 | | #define WUFFS_WBMP__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u |
16038 | | |
16039 | | // ---------------- Struct Declarations |
16040 | | |
16041 | | typedef struct wuffs_wbmp__decoder__struct wuffs_wbmp__decoder; |
16042 | | |
16043 | | #ifdef __cplusplus |
16044 | | extern "C" { |
16045 | | #endif |
16046 | | |
16047 | | // ---------------- Public Initializer Prototypes |
16048 | | |
16049 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
16050 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
16051 | | // |
16052 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
16053 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
16054 | | |
16055 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
16056 | | wuffs_wbmp__decoder__initialize( |
16057 | | wuffs_wbmp__decoder* self, |
16058 | | size_t sizeof_star_self, |
16059 | | uint64_t wuffs_version, |
16060 | | uint32_t options); |
16061 | | |
16062 | | size_t |
16063 | | sizeof__wuffs_wbmp__decoder(void); |
16064 | | |
16065 | | // ---------------- Allocs |
16066 | | |
16067 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
16068 | | // memory allocation fails. If they return non-NULL, there is no need to call |
16069 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
16070 | | // calling free on the returned pointer. That pointer is effectively a C++ |
16071 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
16072 | | |
16073 | | wuffs_wbmp__decoder* |
16074 | | wuffs_wbmp__decoder__alloc(void); |
16075 | | |
16076 | | static inline wuffs_base__image_decoder* |
16077 | | wuffs_wbmp__decoder__alloc_as__wuffs_base__image_decoder(void) { |
16078 | | return (wuffs_base__image_decoder*)(wuffs_wbmp__decoder__alloc()); |
16079 | | } |
16080 | | |
16081 | | // ---------------- Upcasts |
16082 | | |
16083 | | static inline wuffs_base__image_decoder* |
16084 | | wuffs_wbmp__decoder__upcast_as__wuffs_base__image_decoder( |
16085 | | wuffs_wbmp__decoder* p) { |
16086 | | return (wuffs_base__image_decoder*)p; |
16087 | | } |
16088 | | |
16089 | | // ---------------- Public Function Prototypes |
16090 | | |
16091 | | WUFFS_BASE__GENERATED_C_CODE |
16092 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
16093 | | wuffs_wbmp__decoder__get_quirk( |
16094 | | const wuffs_wbmp__decoder* self, |
16095 | | uint32_t a_key); |
16096 | | |
16097 | | WUFFS_BASE__GENERATED_C_CODE |
16098 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
16099 | | wuffs_wbmp__decoder__set_quirk( |
16100 | | wuffs_wbmp__decoder* self, |
16101 | | uint32_t a_key, |
16102 | | uint64_t a_value); |
16103 | | |
16104 | | WUFFS_BASE__GENERATED_C_CODE |
16105 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
16106 | | wuffs_wbmp__decoder__decode_image_config( |
16107 | | wuffs_wbmp__decoder* self, |
16108 | | wuffs_base__image_config* a_dst, |
16109 | | wuffs_base__io_buffer* a_src); |
16110 | | |
16111 | | WUFFS_BASE__GENERATED_C_CODE |
16112 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
16113 | | wuffs_wbmp__decoder__decode_frame_config( |
16114 | | wuffs_wbmp__decoder* self, |
16115 | | wuffs_base__frame_config* a_dst, |
16116 | | wuffs_base__io_buffer* a_src); |
16117 | | |
16118 | | WUFFS_BASE__GENERATED_C_CODE |
16119 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
16120 | | wuffs_wbmp__decoder__decode_frame( |
16121 | | wuffs_wbmp__decoder* self, |
16122 | | wuffs_base__pixel_buffer* a_dst, |
16123 | | wuffs_base__io_buffer* a_src, |
16124 | | wuffs_base__pixel_blend a_blend, |
16125 | | wuffs_base__slice_u8 a_workbuf, |
16126 | | wuffs_base__decode_frame_options* a_opts); |
16127 | | |
16128 | | WUFFS_BASE__GENERATED_C_CODE |
16129 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32 |
16130 | | wuffs_wbmp__decoder__frame_dirty_rect( |
16131 | | const wuffs_wbmp__decoder* self); |
16132 | | |
16133 | | WUFFS_BASE__GENERATED_C_CODE |
16134 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
16135 | | wuffs_wbmp__decoder__num_animation_loops( |
16136 | | const wuffs_wbmp__decoder* self); |
16137 | | |
16138 | | WUFFS_BASE__GENERATED_C_CODE |
16139 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
16140 | | wuffs_wbmp__decoder__num_decoded_frame_configs( |
16141 | | const wuffs_wbmp__decoder* self); |
16142 | | |
16143 | | WUFFS_BASE__GENERATED_C_CODE |
16144 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
16145 | | wuffs_wbmp__decoder__num_decoded_frames( |
16146 | | const wuffs_wbmp__decoder* self); |
16147 | | |
16148 | | WUFFS_BASE__GENERATED_C_CODE |
16149 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
16150 | | wuffs_wbmp__decoder__restart_frame( |
16151 | | wuffs_wbmp__decoder* self, |
16152 | | uint64_t a_index, |
16153 | | uint64_t a_io_position); |
16154 | | |
16155 | | WUFFS_BASE__GENERATED_C_CODE |
16156 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
16157 | | wuffs_wbmp__decoder__set_report_metadata( |
16158 | | wuffs_wbmp__decoder* self, |
16159 | | uint32_t a_fourcc, |
16160 | | bool a_report); |
16161 | | |
16162 | | WUFFS_BASE__GENERATED_C_CODE |
16163 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
16164 | | wuffs_wbmp__decoder__tell_me_more( |
16165 | | wuffs_wbmp__decoder* self, |
16166 | | wuffs_base__io_buffer* a_dst, |
16167 | | wuffs_base__more_information* a_minfo, |
16168 | | wuffs_base__io_buffer* a_src); |
16169 | | |
16170 | | WUFFS_BASE__GENERATED_C_CODE |
16171 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
16172 | | wuffs_wbmp__decoder__workbuf_len( |
16173 | | const wuffs_wbmp__decoder* self); |
16174 | | |
16175 | | #ifdef __cplusplus |
16176 | | } // extern "C" |
16177 | | #endif |
16178 | | |
16179 | | // ---------------- Struct Definitions |
16180 | | |
16181 | | // These structs' fields, and the sizeof them, are private implementation |
16182 | | // details that aren't guaranteed to be stable across Wuffs versions. |
16183 | | // |
16184 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
16185 | | |
16186 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
16187 | | |
16188 | | struct wuffs_wbmp__decoder__struct { |
16189 | | // Do not access the private_impl's or private_data's fields directly. There |
16190 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
16191 | | // the wuffs_foo__bar__baz functions. |
16192 | | // |
16193 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
16194 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
16195 | | |
16196 | | struct { |
16197 | | uint32_t magic; |
16198 | | uint32_t active_coroutine; |
16199 | | wuffs_base__vtable vtable_for__wuffs_base__image_decoder; |
16200 | | wuffs_base__vtable null_vtable; |
16201 | | |
16202 | | uint32_t f_width; |
16203 | | uint32_t f_height; |
16204 | | uint8_t f_call_sequence; |
16205 | | uint64_t f_frame_config_io_position; |
16206 | | wuffs_base__pixel_swizzler f_swizzler; |
16207 | | |
16208 | | uint32_t p_decode_image_config; |
16209 | | uint32_t p_do_decode_image_config; |
16210 | | uint32_t p_decode_frame_config; |
16211 | | uint32_t p_do_decode_frame_config; |
16212 | | uint32_t p_decode_frame; |
16213 | | uint32_t p_do_decode_frame; |
16214 | | } private_impl; |
16215 | | |
16216 | | struct { |
16217 | | struct { |
16218 | | uint32_t v_i; |
16219 | | uint32_t v_p; |
16220 | | } s_do_decode_image_config; |
16221 | | struct { |
16222 | | uint64_t v_dst_bytes_per_pixel; |
16223 | | uint32_t v_dst_x; |
16224 | | uint32_t v_dst_y; |
16225 | | uint8_t v_src[1]; |
16226 | | uint8_t v_c8; |
16227 | | } s_do_decode_frame; |
16228 | | } private_data; |
16229 | | |
16230 | | #ifdef __cplusplus |
16231 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
16232 | | using unique_ptr = std::unique_ptr<wuffs_wbmp__decoder, wuffs_unique_ptr_deleter>; |
16233 | | |
16234 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
16235 | | |
16236 | | static inline unique_ptr |
16237 | | alloc() { |
16238 | | return unique_ptr(wuffs_wbmp__decoder__alloc()); |
16239 | | } |
16240 | | |
16241 | | static inline wuffs_base__image_decoder::unique_ptr |
16242 | | alloc_as__wuffs_base__image_decoder() { |
16243 | | return wuffs_base__image_decoder::unique_ptr( |
16244 | | wuffs_wbmp__decoder__alloc_as__wuffs_base__image_decoder()); |
16245 | | } |
16246 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
16247 | | |
16248 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
16249 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
16250 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
16251 | | // size and field layout is not part of the public, stable, memory-safe API. |
16252 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
16253 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
16254 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
16255 | | // |
16256 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
16257 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
16258 | | // order to provide convenience methods. These forward on "this", so that you |
16259 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
16260 | | wuffs_wbmp__decoder__struct() = delete; |
16261 | | wuffs_wbmp__decoder__struct(const wuffs_wbmp__decoder__struct&) = delete; |
16262 | | wuffs_wbmp__decoder__struct& operator=( |
16263 | | const wuffs_wbmp__decoder__struct&) = delete; |
16264 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
16265 | | |
16266 | | #if !defined(WUFFS_IMPLEMENTATION) |
16267 | | // As above, the size of the struct is not part of the public API, and unless |
16268 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
16269 | | // allocated, not stack allocated. Its size is not intended to be known at |
16270 | | // compile time, but it is unfortunately divulged as a side effect of |
16271 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
16272 | | // instead of "sizeof T", invoking the operator. To make the two values |
16273 | | // different, so that passing the latter will be rejected by the initialize |
16274 | | // function, we add an arbitrary amount of dead weight. |
16275 | | uint8_t dead_weight[123000000]; // 123 MB. |
16276 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
16277 | | |
16278 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
16279 | | initialize( |
16280 | | size_t sizeof_star_self, |
16281 | | uint64_t wuffs_version, |
16282 | | uint32_t options) { |
16283 | | return wuffs_wbmp__decoder__initialize( |
16284 | | this, sizeof_star_self, wuffs_version, options); |
16285 | | } |
16286 | | |
16287 | | inline wuffs_base__image_decoder* |
16288 | | upcast_as__wuffs_base__image_decoder() { |
16289 | | return (wuffs_base__image_decoder*)this; |
16290 | | } |
16291 | | |
16292 | | inline uint64_t |
16293 | | get_quirk( |
16294 | | uint32_t a_key) const { |
16295 | | return wuffs_wbmp__decoder__get_quirk(this, a_key); |
16296 | | } |
16297 | | |
16298 | | inline wuffs_base__status |
16299 | | set_quirk( |
16300 | | uint32_t a_key, |
16301 | | uint64_t a_value) { |
16302 | | return wuffs_wbmp__decoder__set_quirk(this, a_key, a_value); |
16303 | | } |
16304 | | |
16305 | | inline wuffs_base__status |
16306 | | decode_image_config( |
16307 | | wuffs_base__image_config* a_dst, |
16308 | | wuffs_base__io_buffer* a_src) { |
16309 | | return wuffs_wbmp__decoder__decode_image_config(this, a_dst, a_src); |
16310 | | } |
16311 | | |
16312 | | inline wuffs_base__status |
16313 | | decode_frame_config( |
16314 | | wuffs_base__frame_config* a_dst, |
16315 | | wuffs_base__io_buffer* a_src) { |
16316 | | return wuffs_wbmp__decoder__decode_frame_config(this, a_dst, a_src); |
16317 | | } |
16318 | | |
16319 | | inline wuffs_base__status |
16320 | | decode_frame( |
16321 | | wuffs_base__pixel_buffer* a_dst, |
16322 | | wuffs_base__io_buffer* a_src, |
16323 | | wuffs_base__pixel_blend a_blend, |
16324 | | wuffs_base__slice_u8 a_workbuf, |
16325 | | wuffs_base__decode_frame_options* a_opts) { |
16326 | | return wuffs_wbmp__decoder__decode_frame(this, a_dst, a_src, a_blend, a_workbuf, a_opts); |
16327 | | } |
16328 | | |
16329 | | inline wuffs_base__rect_ie_u32 |
16330 | | frame_dirty_rect() const { |
16331 | | return wuffs_wbmp__decoder__frame_dirty_rect(this); |
16332 | | } |
16333 | | |
16334 | | inline uint32_t |
16335 | | num_animation_loops() const { |
16336 | | return wuffs_wbmp__decoder__num_animation_loops(this); |
16337 | | } |
16338 | | |
16339 | | inline uint64_t |
16340 | | num_decoded_frame_configs() const { |
16341 | | return wuffs_wbmp__decoder__num_decoded_frame_configs(this); |
16342 | | } |
16343 | | |
16344 | | inline uint64_t |
16345 | | num_decoded_frames() const { |
16346 | | return wuffs_wbmp__decoder__num_decoded_frames(this); |
16347 | | } |
16348 | | |
16349 | | inline wuffs_base__status |
16350 | | restart_frame( |
16351 | | uint64_t a_index, |
16352 | | uint64_t a_io_position) { |
16353 | | return wuffs_wbmp__decoder__restart_frame(this, a_index, a_io_position); |
16354 | | } |
16355 | | |
16356 | | inline wuffs_base__empty_struct |
16357 | | set_report_metadata( |
16358 | | uint32_t a_fourcc, |
16359 | | bool a_report) { |
16360 | | return wuffs_wbmp__decoder__set_report_metadata(this, a_fourcc, a_report); |
16361 | | } |
16362 | | |
16363 | | inline wuffs_base__status |
16364 | | tell_me_more( |
16365 | | wuffs_base__io_buffer* a_dst, |
16366 | | wuffs_base__more_information* a_minfo, |
16367 | | wuffs_base__io_buffer* a_src) { |
16368 | | return wuffs_wbmp__decoder__tell_me_more(this, a_dst, a_minfo, a_src); |
16369 | | } |
16370 | | |
16371 | | inline wuffs_base__range_ii_u64 |
16372 | | workbuf_len() const { |
16373 | | return wuffs_wbmp__decoder__workbuf_len(this); |
16374 | | } |
16375 | | |
16376 | | #endif // __cplusplus |
16377 | | }; // struct wuffs_wbmp__decoder__struct |
16378 | | |
16379 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
16380 | | |
16381 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__WBMP) || defined(WUFFS_NONMONOLITHIC) |
16382 | | |
16383 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__WEBP) || defined(WUFFS_NONMONOLITHIC) |
16384 | | |
16385 | | // ---------------- Status Codes |
16386 | | |
16387 | | extern const char wuffs_webp__error__bad_alph_vp8l_combination[]; |
16388 | | extern const char wuffs_webp__error__bad_huffman_code_over_subscribed[]; |
16389 | | extern const char wuffs_webp__error__bad_huffman_code_under_subscribed[]; |
16390 | | extern const char wuffs_webp__error__bad_huffman_code[]; |
16391 | | extern const char wuffs_webp__error__bad_vp8x_chunk[]; |
16392 | | extern const char wuffs_webp__error__bad_back_reference[]; |
16393 | | extern const char wuffs_webp__error__bad_chunk_order[]; |
16394 | | extern const char wuffs_webp__error__bad_color_cache[]; |
16395 | | extern const char wuffs_webp__error__bad_header[]; |
16396 | | extern const char wuffs_webp__error__bad_transform[]; |
16397 | | extern const char wuffs_webp__error__short_chunk[]; |
16398 | | extern const char wuffs_webp__error__truncated_input[]; |
16399 | | extern const char wuffs_webp__error__unsupported_webp_file[]; |
16400 | | extern const char wuffs_webp__error__unsupported_number_of_huffman_groups[]; |
16401 | | |
16402 | | // ---------------- Public Consts |
16403 | | |
16404 | | #define WUFFS_WEBP__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 1275068416u |
16405 | | |
16406 | | // ---------------- Struct Declarations |
16407 | | |
16408 | | typedef struct wuffs_webp__decoder__struct wuffs_webp__decoder; |
16409 | | |
16410 | | #ifdef __cplusplus |
16411 | | extern "C" { |
16412 | | #endif |
16413 | | |
16414 | | // ---------------- Public Initializer Prototypes |
16415 | | |
16416 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
16417 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
16418 | | // |
16419 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
16420 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
16421 | | |
16422 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
16423 | | wuffs_webp__decoder__initialize( |
16424 | | wuffs_webp__decoder* self, |
16425 | | size_t sizeof_star_self, |
16426 | | uint64_t wuffs_version, |
16427 | | uint32_t options); |
16428 | | |
16429 | | size_t |
16430 | | sizeof__wuffs_webp__decoder(void); |
16431 | | |
16432 | | // ---------------- Allocs |
16433 | | |
16434 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
16435 | | // memory allocation fails. If they return non-NULL, there is no need to call |
16436 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
16437 | | // calling free on the returned pointer. That pointer is effectively a C++ |
16438 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
16439 | | |
16440 | | wuffs_webp__decoder* |
16441 | | wuffs_webp__decoder__alloc(void); |
16442 | | |
16443 | | static inline wuffs_base__image_decoder* |
16444 | 0 | wuffs_webp__decoder__alloc_as__wuffs_base__image_decoder(void) { |
16445 | 0 | return (wuffs_base__image_decoder*)(wuffs_webp__decoder__alloc()); |
16446 | 0 | } |
16447 | | |
16448 | | // ---------------- Upcasts |
16449 | | |
16450 | | static inline wuffs_base__image_decoder* |
16451 | | wuffs_webp__decoder__upcast_as__wuffs_base__image_decoder( |
16452 | 4.98k | wuffs_webp__decoder* p) { |
16453 | 4.98k | return (wuffs_base__image_decoder*)p; |
16454 | 4.98k | } |
16455 | | |
16456 | | // ---------------- Public Function Prototypes |
16457 | | |
16458 | | WUFFS_BASE__GENERATED_C_CODE |
16459 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
16460 | | wuffs_webp__decoder__get_quirk( |
16461 | | const wuffs_webp__decoder* self, |
16462 | | uint32_t a_key); |
16463 | | |
16464 | | WUFFS_BASE__GENERATED_C_CODE |
16465 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
16466 | | wuffs_webp__decoder__set_quirk( |
16467 | | wuffs_webp__decoder* self, |
16468 | | uint32_t a_key, |
16469 | | uint64_t a_value); |
16470 | | |
16471 | | WUFFS_BASE__GENERATED_C_CODE |
16472 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
16473 | | wuffs_webp__decoder__decode_image_config( |
16474 | | wuffs_webp__decoder* self, |
16475 | | wuffs_base__image_config* a_dst, |
16476 | | wuffs_base__io_buffer* a_src); |
16477 | | |
16478 | | WUFFS_BASE__GENERATED_C_CODE |
16479 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
16480 | | wuffs_webp__decoder__decode_frame_config( |
16481 | | wuffs_webp__decoder* self, |
16482 | | wuffs_base__frame_config* a_dst, |
16483 | | wuffs_base__io_buffer* a_src); |
16484 | | |
16485 | | WUFFS_BASE__GENERATED_C_CODE |
16486 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
16487 | | wuffs_webp__decoder__decode_frame( |
16488 | | wuffs_webp__decoder* self, |
16489 | | wuffs_base__pixel_buffer* a_dst, |
16490 | | wuffs_base__io_buffer* a_src, |
16491 | | wuffs_base__pixel_blend a_blend, |
16492 | | wuffs_base__slice_u8 a_workbuf, |
16493 | | wuffs_base__decode_frame_options* a_opts); |
16494 | | |
16495 | | WUFFS_BASE__GENERATED_C_CODE |
16496 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32 |
16497 | | wuffs_webp__decoder__frame_dirty_rect( |
16498 | | const wuffs_webp__decoder* self); |
16499 | | |
16500 | | WUFFS_BASE__GENERATED_C_CODE |
16501 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
16502 | | wuffs_webp__decoder__num_animation_loops( |
16503 | | const wuffs_webp__decoder* self); |
16504 | | |
16505 | | WUFFS_BASE__GENERATED_C_CODE |
16506 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
16507 | | wuffs_webp__decoder__num_decoded_frame_configs( |
16508 | | const wuffs_webp__decoder* self); |
16509 | | |
16510 | | WUFFS_BASE__GENERATED_C_CODE |
16511 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
16512 | | wuffs_webp__decoder__num_decoded_frames( |
16513 | | const wuffs_webp__decoder* self); |
16514 | | |
16515 | | WUFFS_BASE__GENERATED_C_CODE |
16516 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
16517 | | wuffs_webp__decoder__restart_frame( |
16518 | | wuffs_webp__decoder* self, |
16519 | | uint64_t a_index, |
16520 | | uint64_t a_io_position); |
16521 | | |
16522 | | WUFFS_BASE__GENERATED_C_CODE |
16523 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
16524 | | wuffs_webp__decoder__set_report_metadata( |
16525 | | wuffs_webp__decoder* self, |
16526 | | uint32_t a_fourcc, |
16527 | | bool a_report); |
16528 | | |
16529 | | WUFFS_BASE__GENERATED_C_CODE |
16530 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
16531 | | wuffs_webp__decoder__tell_me_more( |
16532 | | wuffs_webp__decoder* self, |
16533 | | wuffs_base__io_buffer* a_dst, |
16534 | | wuffs_base__more_information* a_minfo, |
16535 | | wuffs_base__io_buffer* a_src); |
16536 | | |
16537 | | WUFFS_BASE__GENERATED_C_CODE |
16538 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
16539 | | wuffs_webp__decoder__workbuf_len( |
16540 | | const wuffs_webp__decoder* self); |
16541 | | |
16542 | | #ifdef __cplusplus |
16543 | | } // extern "C" |
16544 | | #endif |
16545 | | |
16546 | | // ---------------- Struct Definitions |
16547 | | |
16548 | | // These structs' fields, and the sizeof them, are private implementation |
16549 | | // details that aren't guaranteed to be stable across Wuffs versions. |
16550 | | // |
16551 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
16552 | | |
16553 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
16554 | | |
16555 | | struct wuffs_webp__decoder__struct { |
16556 | | // Do not access the private_impl's or private_data's fields directly. There |
16557 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
16558 | | // the wuffs_foo__bar__baz functions. |
16559 | | // |
16560 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
16561 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
16562 | | |
16563 | | struct { |
16564 | | uint32_t magic; |
16565 | | uint32_t active_coroutine; |
16566 | | wuffs_base__vtable vtable_for__wuffs_base__image_decoder; |
16567 | | wuffs_base__vtable null_vtable; |
16568 | | |
16569 | | uint32_t f_width; |
16570 | | uint32_t f_height; |
16571 | | uint8_t f_call_sequence; |
16572 | | uint8_t f_code_length_code_lengths[19]; |
16573 | | bool f_sub_chunk_has_padding; |
16574 | | uint8_t f_variant; |
16575 | | uint8_t f_vp8x_header_flags; |
16576 | | uint8_t f_vp8x_alph_flags; |
16577 | | uint64_t f_frame_config_io_position; |
16578 | | uint32_t f_riff_chunk_length; |
16579 | | uint32_t f_rcl_remaining; |
16580 | | uint32_t f_sub_chunk_length; |
16581 | | uint32_t f_sub_chunk_type; |
16582 | | uint32_t f_bits; |
16583 | | uint32_t f_n_bits; |
16584 | | bool f_seen_transform[4]; |
16585 | | uint8_t f_transform_type[4]; |
16586 | | uint8_t f_transform_tile_size_log2[4]; |
16587 | | uint32_t f_n_transforms; |
16588 | | uint32_t f_color_cache_bits; |
16589 | | uint32_t f_overall_color_cache_bits; |
16590 | | uint32_t f_overall_tile_size_log2; |
16591 | | uint32_t f_overall_n_huffman_groups; |
16592 | | uint32_t f_ht_n_symbols; |
16593 | | uint32_t f_ht_code_lengths_remaining; |
16594 | | uint32_t f_color_indexing_palette_size; |
16595 | | uint32_t f_color_indexing_width; |
16596 | | uint32_t f_workbuf_offset_for_transform[4]; |
16597 | | uint32_t f_workbuf_offset_for_color_indexing; |
16598 | | wuffs_base__pixel_swizzler f_swizzler; |
16599 | | |
16600 | | uint32_t p_decode_alph; |
16601 | | uint32_t p_decode_alph_limited; |
16602 | | uint32_t p_decode_huffman_groups; |
16603 | | uint32_t p_decode_huffman_tree; |
16604 | | uint32_t p_decode_huffman_tree_simple; |
16605 | | uint32_t p_decode_code_length_code_lengths; |
16606 | | uint32_t p_build_code_lengths; |
16607 | | uint32_t p_decode_pixels_slow; |
16608 | | uint32_t p_do_decode_frame_vp8l; |
16609 | | uint32_t p_decode_transform; |
16610 | | uint32_t p_decode_color_cache_parameters; |
16611 | | uint32_t p_decode_hg_table; |
16612 | | uint32_t p_decode_pixels; |
16613 | | uint32_t p_decode_image_config; |
16614 | | uint32_t p_do_decode_image_config; |
16615 | | uint32_t p_do_decode_image_config_limited; |
16616 | | uint32_t p_do_decode_image_config_limited_vp8l; |
16617 | | uint32_t p_do_decode_image_config_limited_vp8x; |
16618 | | uint32_t p_decode_frame_config; |
16619 | | uint32_t p_do_decode_frame_config; |
16620 | | uint32_t p_decode_frame; |
16621 | | uint32_t p_do_decode_frame; |
16622 | | } private_impl; |
16623 | | |
16624 | | struct { |
16625 | | wuffs_vp8__decoder f_vp8; |
16626 | | uint8_t f_palette[1024]; |
16627 | | uint32_t f_color_cache[2048]; |
16628 | | uint16_t f_codes[2328]; |
16629 | | uint16_t f_code_lengths[2328]; |
16630 | | uint16_t f_code_lengths_huffman_nodes[37]; |
16631 | | uint16_t f_huffman_nodes[256][6267]; |
16632 | | |
16633 | | struct { |
16634 | | uint32_t v_hg; |
16635 | | uint32_t v_ht; |
16636 | | } s_decode_huffman_groups; |
16637 | | struct { |
16638 | | uint32_t v_use_second_symbol; |
16639 | | uint32_t v_first_symbol_n_bits; |
16640 | | uint32_t v_symbol0; |
16641 | | uint32_t v_base_offset; |
16642 | | } s_decode_huffman_tree_simple; |
16643 | | struct { |
16644 | | uint32_t v_n_codes; |
16645 | | uint32_t v_i; |
16646 | | } s_decode_code_length_code_lengths; |
16647 | | struct { |
16648 | | uint32_t v_length_n_bits; |
16649 | | uint16_t v_prev_code_length; |
16650 | | uint32_t v_s; |
16651 | | uint32_t v_s_max; |
16652 | | uint16_t v_node; |
16653 | | uint16_t v_repeat_value; |
16654 | | uint32_t v_repeat_n_bits; |
16655 | | } s_build_code_lengths; |
16656 | | struct { |
16657 | | uint64_t v_p; |
16658 | | uint64_t v_p_max; |
16659 | | uint32_t v_tile_size_log2; |
16660 | | uint32_t v_width_in_tiles; |
16661 | | uint32_t v_x; |
16662 | | uint32_t v_y; |
16663 | | uint32_t v_hg; |
16664 | | uint16_t v_node; |
16665 | | uint32_t v_color; |
16666 | | uint32_t v_back_ref_len_n_bits; |
16667 | | uint32_t v_back_ref_len_minus_1; |
16668 | | uint32_t v_back_ref_dist_n_bits; |
16669 | | uint32_t v_back_ref_dist_premap_minus_1; |
16670 | | uint64_t v_color_cache_p; |
16671 | | } s_decode_pixels_slow; |
16672 | | struct { |
16673 | | uint32_t v_width; |
16674 | | } s_do_decode_frame_vp8l; |
16675 | | struct { |
16676 | | uint32_t v_transform_type; |
16677 | | uint32_t v_tile_size_log2; |
16678 | | } s_decode_transform; |
16679 | | struct { |
16680 | | uint32_t v_tile_size_log2; |
16681 | | } s_decode_hg_table; |
16682 | | struct { |
16683 | | uint64_t scratch; |
16684 | | } s_do_decode_image_config; |
16685 | | struct { |
16686 | | uint64_t scratch; |
16687 | | } s_do_decode_image_config_limited; |
16688 | | struct { |
16689 | | uint64_t scratch; |
16690 | | } s_do_decode_image_config_limited_vp8l; |
16691 | | struct { |
16692 | | uint64_t scratch; |
16693 | | } s_do_decode_image_config_limited_vp8x; |
16694 | | struct { |
16695 | | uint64_t scratch; |
16696 | | } s_do_decode_frame; |
16697 | | } private_data; |
16698 | | |
16699 | | #ifdef __cplusplus |
16700 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
16701 | | using unique_ptr = std::unique_ptr<wuffs_webp__decoder, wuffs_unique_ptr_deleter>; |
16702 | | |
16703 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
16704 | | |
16705 | | static inline unique_ptr |
16706 | | alloc() { |
16707 | | return unique_ptr(wuffs_webp__decoder__alloc()); |
16708 | | } |
16709 | | |
16710 | | static inline wuffs_base__image_decoder::unique_ptr |
16711 | | alloc_as__wuffs_base__image_decoder() { |
16712 | | return wuffs_base__image_decoder::unique_ptr( |
16713 | | wuffs_webp__decoder__alloc_as__wuffs_base__image_decoder()); |
16714 | | } |
16715 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
16716 | | |
16717 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
16718 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
16719 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
16720 | | // size and field layout is not part of the public, stable, memory-safe API. |
16721 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
16722 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
16723 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
16724 | | // |
16725 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
16726 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
16727 | | // order to provide convenience methods. These forward on "this", so that you |
16728 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
16729 | | wuffs_webp__decoder__struct() = delete; |
16730 | | wuffs_webp__decoder__struct(const wuffs_webp__decoder__struct&) = delete; |
16731 | | wuffs_webp__decoder__struct& operator=( |
16732 | | const wuffs_webp__decoder__struct&) = delete; |
16733 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
16734 | | |
16735 | | #if !defined(WUFFS_IMPLEMENTATION) |
16736 | | // As above, the size of the struct is not part of the public API, and unless |
16737 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
16738 | | // allocated, not stack allocated. Its size is not intended to be known at |
16739 | | // compile time, but it is unfortunately divulged as a side effect of |
16740 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
16741 | | // instead of "sizeof T", invoking the operator. To make the two values |
16742 | | // different, so that passing the latter will be rejected by the initialize |
16743 | | // function, we add an arbitrary amount of dead weight. |
16744 | | uint8_t dead_weight[123000000]; // 123 MB. |
16745 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
16746 | | |
16747 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
16748 | | initialize( |
16749 | | size_t sizeof_star_self, |
16750 | | uint64_t wuffs_version, |
16751 | | uint32_t options) { |
16752 | | return wuffs_webp__decoder__initialize( |
16753 | | this, sizeof_star_self, wuffs_version, options); |
16754 | | } |
16755 | | |
16756 | | inline wuffs_base__image_decoder* |
16757 | | upcast_as__wuffs_base__image_decoder() { |
16758 | | return (wuffs_base__image_decoder*)this; |
16759 | | } |
16760 | | |
16761 | | inline uint64_t |
16762 | | get_quirk( |
16763 | | uint32_t a_key) const { |
16764 | | return wuffs_webp__decoder__get_quirk(this, a_key); |
16765 | | } |
16766 | | |
16767 | | inline wuffs_base__status |
16768 | | set_quirk( |
16769 | | uint32_t a_key, |
16770 | | uint64_t a_value) { |
16771 | | return wuffs_webp__decoder__set_quirk(this, a_key, a_value); |
16772 | | } |
16773 | | |
16774 | | inline wuffs_base__status |
16775 | | decode_image_config( |
16776 | | wuffs_base__image_config* a_dst, |
16777 | | wuffs_base__io_buffer* a_src) { |
16778 | | return wuffs_webp__decoder__decode_image_config(this, a_dst, a_src); |
16779 | | } |
16780 | | |
16781 | | inline wuffs_base__status |
16782 | | decode_frame_config( |
16783 | | wuffs_base__frame_config* a_dst, |
16784 | | wuffs_base__io_buffer* a_src) { |
16785 | | return wuffs_webp__decoder__decode_frame_config(this, a_dst, a_src); |
16786 | | } |
16787 | | |
16788 | | inline wuffs_base__status |
16789 | | decode_frame( |
16790 | | wuffs_base__pixel_buffer* a_dst, |
16791 | | wuffs_base__io_buffer* a_src, |
16792 | | wuffs_base__pixel_blend a_blend, |
16793 | | wuffs_base__slice_u8 a_workbuf, |
16794 | | wuffs_base__decode_frame_options* a_opts) { |
16795 | | return wuffs_webp__decoder__decode_frame(this, a_dst, a_src, a_blend, a_workbuf, a_opts); |
16796 | | } |
16797 | | |
16798 | | inline wuffs_base__rect_ie_u32 |
16799 | | frame_dirty_rect() const { |
16800 | | return wuffs_webp__decoder__frame_dirty_rect(this); |
16801 | | } |
16802 | | |
16803 | | inline uint32_t |
16804 | | num_animation_loops() const { |
16805 | | return wuffs_webp__decoder__num_animation_loops(this); |
16806 | | } |
16807 | | |
16808 | | inline uint64_t |
16809 | | num_decoded_frame_configs() const { |
16810 | | return wuffs_webp__decoder__num_decoded_frame_configs(this); |
16811 | | } |
16812 | | |
16813 | | inline uint64_t |
16814 | | num_decoded_frames() const { |
16815 | | return wuffs_webp__decoder__num_decoded_frames(this); |
16816 | | } |
16817 | | |
16818 | | inline wuffs_base__status |
16819 | | restart_frame( |
16820 | | uint64_t a_index, |
16821 | | uint64_t a_io_position) { |
16822 | | return wuffs_webp__decoder__restart_frame(this, a_index, a_io_position); |
16823 | | } |
16824 | | |
16825 | | inline wuffs_base__empty_struct |
16826 | | set_report_metadata( |
16827 | | uint32_t a_fourcc, |
16828 | | bool a_report) { |
16829 | | return wuffs_webp__decoder__set_report_metadata(this, a_fourcc, a_report); |
16830 | | } |
16831 | | |
16832 | | inline wuffs_base__status |
16833 | | tell_me_more( |
16834 | | wuffs_base__io_buffer* a_dst, |
16835 | | wuffs_base__more_information* a_minfo, |
16836 | | wuffs_base__io_buffer* a_src) { |
16837 | | return wuffs_webp__decoder__tell_me_more(this, a_dst, a_minfo, a_src); |
16838 | | } |
16839 | | |
16840 | | inline wuffs_base__range_ii_u64 |
16841 | | workbuf_len() const { |
16842 | | return wuffs_webp__decoder__workbuf_len(this); |
16843 | | } |
16844 | | |
16845 | | #endif // __cplusplus |
16846 | | }; // struct wuffs_webp__decoder__struct |
16847 | | |
16848 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
16849 | | |
16850 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__WEBP) || defined(WUFFS_NONMONOLITHIC) |
16851 | | |
16852 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__XXHASH32) || defined(WUFFS_NONMONOLITHIC) |
16853 | | |
16854 | | // ---------------- Status Codes |
16855 | | |
16856 | | // ---------------- Public Consts |
16857 | | |
16858 | | // ---------------- Struct Declarations |
16859 | | |
16860 | | typedef struct wuffs_xxhash32__hasher__struct wuffs_xxhash32__hasher; |
16861 | | |
16862 | | #ifdef __cplusplus |
16863 | | extern "C" { |
16864 | | #endif |
16865 | | |
16866 | | // ---------------- Public Initializer Prototypes |
16867 | | |
16868 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
16869 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
16870 | | // |
16871 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
16872 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
16873 | | |
16874 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
16875 | | wuffs_xxhash32__hasher__initialize( |
16876 | | wuffs_xxhash32__hasher* self, |
16877 | | size_t sizeof_star_self, |
16878 | | uint64_t wuffs_version, |
16879 | | uint32_t options); |
16880 | | |
16881 | | size_t |
16882 | | sizeof__wuffs_xxhash32__hasher(void); |
16883 | | |
16884 | | // ---------------- Allocs |
16885 | | |
16886 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
16887 | | // memory allocation fails. If they return non-NULL, there is no need to call |
16888 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
16889 | | // calling free on the returned pointer. That pointer is effectively a C++ |
16890 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
16891 | | |
16892 | | wuffs_xxhash32__hasher* |
16893 | | wuffs_xxhash32__hasher__alloc(void); |
16894 | | |
16895 | | static inline wuffs_base__hasher_u32* |
16896 | | wuffs_xxhash32__hasher__alloc_as__wuffs_base__hasher_u32(void) { |
16897 | | return (wuffs_base__hasher_u32*)(wuffs_xxhash32__hasher__alloc()); |
16898 | | } |
16899 | | |
16900 | | // ---------------- Upcasts |
16901 | | |
16902 | | static inline wuffs_base__hasher_u32* |
16903 | | wuffs_xxhash32__hasher__upcast_as__wuffs_base__hasher_u32( |
16904 | | wuffs_xxhash32__hasher* p) { |
16905 | | return (wuffs_base__hasher_u32*)p; |
16906 | | } |
16907 | | |
16908 | | // ---------------- Public Function Prototypes |
16909 | | |
16910 | | WUFFS_BASE__GENERATED_C_CODE |
16911 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
16912 | | wuffs_xxhash32__hasher__get_quirk( |
16913 | | const wuffs_xxhash32__hasher* self, |
16914 | | uint32_t a_key); |
16915 | | |
16916 | | WUFFS_BASE__GENERATED_C_CODE |
16917 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
16918 | | wuffs_xxhash32__hasher__set_quirk( |
16919 | | wuffs_xxhash32__hasher* self, |
16920 | | uint32_t a_key, |
16921 | | uint64_t a_value); |
16922 | | |
16923 | | WUFFS_BASE__GENERATED_C_CODE |
16924 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
16925 | | wuffs_xxhash32__hasher__update( |
16926 | | wuffs_xxhash32__hasher* self, |
16927 | | wuffs_base__slice_u8 a_x); |
16928 | | |
16929 | | WUFFS_BASE__GENERATED_C_CODE |
16930 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
16931 | | wuffs_xxhash32__hasher__update_u32( |
16932 | | wuffs_xxhash32__hasher* self, |
16933 | | wuffs_base__slice_u8 a_x); |
16934 | | |
16935 | | WUFFS_BASE__GENERATED_C_CODE |
16936 | | WUFFS_BASE__MAYBE_STATIC uint32_t |
16937 | | wuffs_xxhash32__hasher__checksum_u32( |
16938 | | const wuffs_xxhash32__hasher* self); |
16939 | | |
16940 | | #ifdef __cplusplus |
16941 | | } // extern "C" |
16942 | | #endif |
16943 | | |
16944 | | // ---------------- Struct Definitions |
16945 | | |
16946 | | // These structs' fields, and the sizeof them, are private implementation |
16947 | | // details that aren't guaranteed to be stable across Wuffs versions. |
16948 | | // |
16949 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
16950 | | |
16951 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
16952 | | |
16953 | | struct wuffs_xxhash32__hasher__struct { |
16954 | | // Do not access the private_impl's or private_data's fields directly. There |
16955 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
16956 | | // the wuffs_foo__bar__baz functions. |
16957 | | // |
16958 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
16959 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
16960 | | |
16961 | | struct { |
16962 | | uint32_t magic; |
16963 | | uint32_t active_coroutine; |
16964 | | wuffs_base__vtable vtable_for__wuffs_base__hasher_u32; |
16965 | | wuffs_base__vtable null_vtable; |
16966 | | |
16967 | | uint32_t f_length_modulo_u32; |
16968 | | bool f_length_overflows_u32; |
16969 | | uint8_t f_padding0; |
16970 | | uint8_t f_padding1; |
16971 | | uint8_t f_buf_len; |
16972 | | uint8_t f_buf_data[16]; |
16973 | | uint32_t f_v0; |
16974 | | uint32_t f_v1; |
16975 | | uint32_t f_v2; |
16976 | | uint32_t f_v3; |
16977 | | } private_impl; |
16978 | | |
16979 | | #ifdef __cplusplus |
16980 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
16981 | | using unique_ptr = std::unique_ptr<wuffs_xxhash32__hasher, wuffs_unique_ptr_deleter>; |
16982 | | |
16983 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
16984 | | |
16985 | | static inline unique_ptr |
16986 | | alloc() { |
16987 | | return unique_ptr(wuffs_xxhash32__hasher__alloc()); |
16988 | | } |
16989 | | |
16990 | | static inline wuffs_base__hasher_u32::unique_ptr |
16991 | | alloc_as__wuffs_base__hasher_u32() { |
16992 | | return wuffs_base__hasher_u32::unique_ptr( |
16993 | | wuffs_xxhash32__hasher__alloc_as__wuffs_base__hasher_u32()); |
16994 | | } |
16995 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
16996 | | |
16997 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
16998 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
16999 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
17000 | | // size and field layout is not part of the public, stable, memory-safe API. |
17001 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
17002 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
17003 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
17004 | | // |
17005 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
17006 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
17007 | | // order to provide convenience methods. These forward on "this", so that you |
17008 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
17009 | | wuffs_xxhash32__hasher__struct() = delete; |
17010 | | wuffs_xxhash32__hasher__struct(const wuffs_xxhash32__hasher__struct&) = delete; |
17011 | | wuffs_xxhash32__hasher__struct& operator=( |
17012 | | const wuffs_xxhash32__hasher__struct&) = delete; |
17013 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
17014 | | |
17015 | | #if !defined(WUFFS_IMPLEMENTATION) |
17016 | | // As above, the size of the struct is not part of the public API, and unless |
17017 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
17018 | | // allocated, not stack allocated. Its size is not intended to be known at |
17019 | | // compile time, but it is unfortunately divulged as a side effect of |
17020 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
17021 | | // instead of "sizeof T", invoking the operator. To make the two values |
17022 | | // different, so that passing the latter will be rejected by the initialize |
17023 | | // function, we add an arbitrary amount of dead weight. |
17024 | | uint8_t dead_weight[123000000]; // 123 MB. |
17025 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
17026 | | |
17027 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
17028 | | initialize( |
17029 | | size_t sizeof_star_self, |
17030 | | uint64_t wuffs_version, |
17031 | | uint32_t options) { |
17032 | | return wuffs_xxhash32__hasher__initialize( |
17033 | | this, sizeof_star_self, wuffs_version, options); |
17034 | | } |
17035 | | |
17036 | | inline wuffs_base__hasher_u32* |
17037 | | upcast_as__wuffs_base__hasher_u32() { |
17038 | | return (wuffs_base__hasher_u32*)this; |
17039 | | } |
17040 | | |
17041 | | inline uint64_t |
17042 | | get_quirk( |
17043 | | uint32_t a_key) const { |
17044 | | return wuffs_xxhash32__hasher__get_quirk(this, a_key); |
17045 | | } |
17046 | | |
17047 | | inline wuffs_base__status |
17048 | | set_quirk( |
17049 | | uint32_t a_key, |
17050 | | uint64_t a_value) { |
17051 | | return wuffs_xxhash32__hasher__set_quirk(this, a_key, a_value); |
17052 | | } |
17053 | | |
17054 | | inline wuffs_base__empty_struct |
17055 | | update( |
17056 | | wuffs_base__slice_u8 a_x) { |
17057 | | return wuffs_xxhash32__hasher__update(this, a_x); |
17058 | | } |
17059 | | |
17060 | | inline uint32_t |
17061 | | update_u32( |
17062 | | wuffs_base__slice_u8 a_x) { |
17063 | | return wuffs_xxhash32__hasher__update_u32(this, a_x); |
17064 | | } |
17065 | | |
17066 | | inline uint32_t |
17067 | | checksum_u32() const { |
17068 | | return wuffs_xxhash32__hasher__checksum_u32(this); |
17069 | | } |
17070 | | |
17071 | | #endif // __cplusplus |
17072 | | }; // struct wuffs_xxhash32__hasher__struct |
17073 | | |
17074 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
17075 | | |
17076 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__XXHASH32) || defined(WUFFS_NONMONOLITHIC) |
17077 | | |
17078 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__XXHASH64) || defined(WUFFS_NONMONOLITHIC) |
17079 | | |
17080 | | // ---------------- Status Codes |
17081 | | |
17082 | | // ---------------- Public Consts |
17083 | | |
17084 | | // ---------------- Struct Declarations |
17085 | | |
17086 | | typedef struct wuffs_xxhash64__hasher__struct wuffs_xxhash64__hasher; |
17087 | | |
17088 | | #ifdef __cplusplus |
17089 | | extern "C" { |
17090 | | #endif |
17091 | | |
17092 | | // ---------------- Public Initializer Prototypes |
17093 | | |
17094 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
17095 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
17096 | | // |
17097 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
17098 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
17099 | | |
17100 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
17101 | | wuffs_xxhash64__hasher__initialize( |
17102 | | wuffs_xxhash64__hasher* self, |
17103 | | size_t sizeof_star_self, |
17104 | | uint64_t wuffs_version, |
17105 | | uint32_t options); |
17106 | | |
17107 | | size_t |
17108 | | sizeof__wuffs_xxhash64__hasher(void); |
17109 | | |
17110 | | // ---------------- Allocs |
17111 | | |
17112 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
17113 | | // memory allocation fails. If they return non-NULL, there is no need to call |
17114 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
17115 | | // calling free on the returned pointer. That pointer is effectively a C++ |
17116 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
17117 | | |
17118 | | wuffs_xxhash64__hasher* |
17119 | | wuffs_xxhash64__hasher__alloc(void); |
17120 | | |
17121 | | static inline wuffs_base__hasher_u64* |
17122 | | wuffs_xxhash64__hasher__alloc_as__wuffs_base__hasher_u64(void) { |
17123 | | return (wuffs_base__hasher_u64*)(wuffs_xxhash64__hasher__alloc()); |
17124 | | } |
17125 | | |
17126 | | // ---------------- Upcasts |
17127 | | |
17128 | | static inline wuffs_base__hasher_u64* |
17129 | | wuffs_xxhash64__hasher__upcast_as__wuffs_base__hasher_u64( |
17130 | | wuffs_xxhash64__hasher* p) { |
17131 | | return (wuffs_base__hasher_u64*)p; |
17132 | | } |
17133 | | |
17134 | | // ---------------- Public Function Prototypes |
17135 | | |
17136 | | WUFFS_BASE__GENERATED_C_CODE |
17137 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
17138 | | wuffs_xxhash64__hasher__get_quirk( |
17139 | | const wuffs_xxhash64__hasher* self, |
17140 | | uint32_t a_key); |
17141 | | |
17142 | | WUFFS_BASE__GENERATED_C_CODE |
17143 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
17144 | | wuffs_xxhash64__hasher__set_quirk( |
17145 | | wuffs_xxhash64__hasher* self, |
17146 | | uint32_t a_key, |
17147 | | uint64_t a_value); |
17148 | | |
17149 | | WUFFS_BASE__GENERATED_C_CODE |
17150 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct |
17151 | | wuffs_xxhash64__hasher__update( |
17152 | | wuffs_xxhash64__hasher* self, |
17153 | | wuffs_base__slice_u8 a_x); |
17154 | | |
17155 | | WUFFS_BASE__GENERATED_C_CODE |
17156 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
17157 | | wuffs_xxhash64__hasher__update_u64( |
17158 | | wuffs_xxhash64__hasher* self, |
17159 | | wuffs_base__slice_u8 a_x); |
17160 | | |
17161 | | WUFFS_BASE__GENERATED_C_CODE |
17162 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
17163 | | wuffs_xxhash64__hasher__checksum_u64( |
17164 | | const wuffs_xxhash64__hasher* self); |
17165 | | |
17166 | | #ifdef __cplusplus |
17167 | | } // extern "C" |
17168 | | #endif |
17169 | | |
17170 | | // ---------------- Struct Definitions |
17171 | | |
17172 | | // These structs' fields, and the sizeof them, are private implementation |
17173 | | // details that aren't guaranteed to be stable across Wuffs versions. |
17174 | | // |
17175 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
17176 | | |
17177 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
17178 | | |
17179 | | struct wuffs_xxhash64__hasher__struct { |
17180 | | // Do not access the private_impl's or private_data's fields directly. There |
17181 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
17182 | | // the wuffs_foo__bar__baz functions. |
17183 | | // |
17184 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
17185 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
17186 | | |
17187 | | struct { |
17188 | | uint32_t magic; |
17189 | | uint32_t active_coroutine; |
17190 | | wuffs_base__vtable vtable_for__wuffs_base__hasher_u64; |
17191 | | wuffs_base__vtable null_vtable; |
17192 | | |
17193 | | uint64_t f_length_modulo_u64; |
17194 | | bool f_length_overflows_u64; |
17195 | | uint8_t f_padding0; |
17196 | | uint8_t f_padding1; |
17197 | | uint8_t f_padding2; |
17198 | | uint32_t f_buf_len; |
17199 | | uint8_t f_buf_data[32]; |
17200 | | uint64_t f_v0; |
17201 | | uint64_t f_v1; |
17202 | | uint64_t f_v2; |
17203 | | uint64_t f_v3; |
17204 | | } private_impl; |
17205 | | |
17206 | | #ifdef __cplusplus |
17207 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
17208 | | using unique_ptr = std::unique_ptr<wuffs_xxhash64__hasher, wuffs_unique_ptr_deleter>; |
17209 | | |
17210 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
17211 | | |
17212 | | static inline unique_ptr |
17213 | | alloc() { |
17214 | | return unique_ptr(wuffs_xxhash64__hasher__alloc()); |
17215 | | } |
17216 | | |
17217 | | static inline wuffs_base__hasher_u64::unique_ptr |
17218 | | alloc_as__wuffs_base__hasher_u64() { |
17219 | | return wuffs_base__hasher_u64::unique_ptr( |
17220 | | wuffs_xxhash64__hasher__alloc_as__wuffs_base__hasher_u64()); |
17221 | | } |
17222 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
17223 | | |
17224 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
17225 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
17226 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
17227 | | // size and field layout is not part of the public, stable, memory-safe API. |
17228 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
17229 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
17230 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
17231 | | // |
17232 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
17233 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
17234 | | // order to provide convenience methods. These forward on "this", so that you |
17235 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
17236 | | wuffs_xxhash64__hasher__struct() = delete; |
17237 | | wuffs_xxhash64__hasher__struct(const wuffs_xxhash64__hasher__struct&) = delete; |
17238 | | wuffs_xxhash64__hasher__struct& operator=( |
17239 | | const wuffs_xxhash64__hasher__struct&) = delete; |
17240 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
17241 | | |
17242 | | #if !defined(WUFFS_IMPLEMENTATION) |
17243 | | // As above, the size of the struct is not part of the public API, and unless |
17244 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
17245 | | // allocated, not stack allocated. Its size is not intended to be known at |
17246 | | // compile time, but it is unfortunately divulged as a side effect of |
17247 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
17248 | | // instead of "sizeof T", invoking the operator. To make the two values |
17249 | | // different, so that passing the latter will be rejected by the initialize |
17250 | | // function, we add an arbitrary amount of dead weight. |
17251 | | uint8_t dead_weight[123000000]; // 123 MB. |
17252 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
17253 | | |
17254 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
17255 | | initialize( |
17256 | | size_t sizeof_star_self, |
17257 | | uint64_t wuffs_version, |
17258 | | uint32_t options) { |
17259 | | return wuffs_xxhash64__hasher__initialize( |
17260 | | this, sizeof_star_self, wuffs_version, options); |
17261 | | } |
17262 | | |
17263 | | inline wuffs_base__hasher_u64* |
17264 | | upcast_as__wuffs_base__hasher_u64() { |
17265 | | return (wuffs_base__hasher_u64*)this; |
17266 | | } |
17267 | | |
17268 | | inline uint64_t |
17269 | | get_quirk( |
17270 | | uint32_t a_key) const { |
17271 | | return wuffs_xxhash64__hasher__get_quirk(this, a_key); |
17272 | | } |
17273 | | |
17274 | | inline wuffs_base__status |
17275 | | set_quirk( |
17276 | | uint32_t a_key, |
17277 | | uint64_t a_value) { |
17278 | | return wuffs_xxhash64__hasher__set_quirk(this, a_key, a_value); |
17279 | | } |
17280 | | |
17281 | | inline wuffs_base__empty_struct |
17282 | | update( |
17283 | | wuffs_base__slice_u8 a_x) { |
17284 | | return wuffs_xxhash64__hasher__update(this, a_x); |
17285 | | } |
17286 | | |
17287 | | inline uint64_t |
17288 | | update_u64( |
17289 | | wuffs_base__slice_u8 a_x) { |
17290 | | return wuffs_xxhash64__hasher__update_u64(this, a_x); |
17291 | | } |
17292 | | |
17293 | | inline uint64_t |
17294 | | checksum_u64() const { |
17295 | | return wuffs_xxhash64__hasher__checksum_u64(this); |
17296 | | } |
17297 | | |
17298 | | #endif // __cplusplus |
17299 | | }; // struct wuffs_xxhash64__hasher__struct |
17300 | | |
17301 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
17302 | | |
17303 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__XXHASH64) || defined(WUFFS_NONMONOLITHIC) |
17304 | | |
17305 | | #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__XZ) || defined(WUFFS_NONMONOLITHIC) |
17306 | | |
17307 | | // ---------------- Status Codes |
17308 | | |
17309 | | extern const char wuffs_xz__error__bad_bcj_offset[]; |
17310 | | extern const char wuffs_xz__error__bad_block_header[]; |
17311 | | extern const char wuffs_xz__error__bad_checksum[]; |
17312 | | extern const char wuffs_xz__error__bad_filter[]; |
17313 | | extern const char wuffs_xz__error__bad_footer[]; |
17314 | | extern const char wuffs_xz__error__bad_header[]; |
17315 | | extern const char wuffs_xz__error__bad_header_concatenated_stream[]; |
17316 | | extern const char wuffs_xz__error__bad_index[]; |
17317 | | extern const char wuffs_xz__error__bad_padding[]; |
17318 | | extern const char wuffs_xz__error__truncated_input[]; |
17319 | | extern const char wuffs_xz__error__unsupported_checksum_algorithm[]; |
17320 | | extern const char wuffs_xz__error__unsupported_filter[]; |
17321 | | extern const char wuffs_xz__error__unsupported_filter_combination[]; |
17322 | | |
17323 | | // ---------------- Public Consts |
17324 | | |
17325 | | #define WUFFS_XZ__QUIRK_DECODE_STANDALONE_CONCATENATED_STREAMS 1963655168u |
17326 | | |
17327 | | #define WUFFS_XZ__DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE 0u |
17328 | | |
17329 | | #define WUFFS_XZ__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 4294967568u |
17330 | | |
17331 | | // ---------------- Struct Declarations |
17332 | | |
17333 | | typedef struct wuffs_xz__decoder__struct wuffs_xz__decoder; |
17334 | | |
17335 | | #ifdef __cplusplus |
17336 | | extern "C" { |
17337 | | #endif |
17338 | | |
17339 | | // ---------------- Public Initializer Prototypes |
17340 | | |
17341 | | // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self, |
17342 | | // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)". |
17343 | | // |
17344 | | // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version. |
17345 | | // Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options. |
17346 | | |
17347 | | wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
17348 | | wuffs_xz__decoder__initialize( |
17349 | | wuffs_xz__decoder* self, |
17350 | | size_t sizeof_star_self, |
17351 | | uint64_t wuffs_version, |
17352 | | uint32_t options); |
17353 | | |
17354 | | size_t |
17355 | | sizeof__wuffs_xz__decoder(void); |
17356 | | |
17357 | | // ---------------- Allocs |
17358 | | |
17359 | | // These functions allocate and initialize Wuffs structs. They return NULL if |
17360 | | // memory allocation fails. If they return non-NULL, there is no need to call |
17361 | | // wuffs_foo__bar__initialize, but the caller is responsible for eventually |
17362 | | // calling free on the returned pointer. That pointer is effectively a C++ |
17363 | | // std::unique_ptr<T, wuffs_unique_ptr_deleter>. |
17364 | | |
17365 | | wuffs_xz__decoder* |
17366 | | wuffs_xz__decoder__alloc(void); |
17367 | | |
17368 | | static inline wuffs_base__io_transformer* |
17369 | 0 | wuffs_xz__decoder__alloc_as__wuffs_base__io_transformer(void) { |
17370 | 0 | return (wuffs_base__io_transformer*)(wuffs_xz__decoder__alloc()); |
17371 | 0 | } |
17372 | | |
17373 | | // ---------------- Upcasts |
17374 | | |
17375 | | static inline wuffs_base__io_transformer* |
17376 | | wuffs_xz__decoder__upcast_as__wuffs_base__io_transformer( |
17377 | 0 | wuffs_xz__decoder* p) { |
17378 | 0 | return (wuffs_base__io_transformer*)p; |
17379 | 0 | } |
17380 | | |
17381 | | // ---------------- Public Function Prototypes |
17382 | | |
17383 | | WUFFS_BASE__GENERATED_C_CODE |
17384 | | WUFFS_BASE__MAYBE_STATIC uint64_t |
17385 | | wuffs_xz__decoder__get_quirk( |
17386 | | const wuffs_xz__decoder* self, |
17387 | | uint32_t a_key); |
17388 | | |
17389 | | WUFFS_BASE__GENERATED_C_CODE |
17390 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
17391 | | wuffs_xz__decoder__set_quirk( |
17392 | | wuffs_xz__decoder* self, |
17393 | | uint32_t a_key, |
17394 | | uint64_t a_value); |
17395 | | |
17396 | | WUFFS_BASE__GENERATED_C_CODE |
17397 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63 |
17398 | | wuffs_xz__decoder__dst_history_retain_length( |
17399 | | const wuffs_xz__decoder* self); |
17400 | | |
17401 | | WUFFS_BASE__GENERATED_C_CODE |
17402 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 |
17403 | | wuffs_xz__decoder__workbuf_len( |
17404 | | const wuffs_xz__decoder* self); |
17405 | | |
17406 | | WUFFS_BASE__GENERATED_C_CODE |
17407 | | WUFFS_BASE__MAYBE_STATIC wuffs_base__status |
17408 | | wuffs_xz__decoder__transform_io( |
17409 | | wuffs_xz__decoder* self, |
17410 | | wuffs_base__io_buffer* a_dst, |
17411 | | wuffs_base__io_buffer* a_src, |
17412 | | wuffs_base__slice_u8 a_workbuf); |
17413 | | |
17414 | | #ifdef __cplusplus |
17415 | | } // extern "C" |
17416 | | #endif |
17417 | | |
17418 | | // ---------------- Struct Definitions |
17419 | | |
17420 | | // These structs' fields, and the sizeof them, are private implementation |
17421 | | // details that aren't guaranteed to be stable across Wuffs versions. |
17422 | | // |
17423 | | // See https://en.wikipedia.org/wiki/Opaque_pointer#C |
17424 | | |
17425 | | #if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
17426 | | |
17427 | | struct wuffs_xz__decoder__struct { |
17428 | | // Do not access the private_impl's or private_data's fields directly. There |
17429 | | // is no API/ABI compatibility or safety guarantee if you do so. Instead, use |
17430 | | // the wuffs_foo__bar__baz functions. |
17431 | | // |
17432 | | // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct |
17433 | | // can be stack allocated when WUFFS_IMPLEMENTATION is defined. |
17434 | | |
17435 | | struct { |
17436 | | uint32_t magic; |
17437 | | uint32_t active_coroutine; |
17438 | | wuffs_base__vtable vtable_for__wuffs_base__io_transformer; |
17439 | | wuffs_base__vtable null_vtable; |
17440 | | |
17441 | | uint32_t f_filters[3]; |
17442 | | uint32_t f_num_non_final_filters; |
17443 | | uint8_t f_checksummer; |
17444 | | bool f_ignore_checksum; |
17445 | | bool f_standalone_format; |
17446 | | bool f_lzma_needs_reset; |
17447 | | bool f_block_has_compressed_size; |
17448 | | bool f_block_has_uncompressed_size; |
17449 | | uint8_t f_bcj_undo_index; |
17450 | | uint32_t f_bcj_pos; |
17451 | | uint32_t f_bcj_x86_prev_mask; |
17452 | | uint64_t f_block_compressed_size; |
17453 | | uint64_t f_block_uncompressed_size; |
17454 | | uint64_t f_compressed_size_for_index; |
17455 | | uint32_t f_verification_have_hashed_sizes[2]; |
17456 | | uint32_t f_verification_want_hashed_sizes[2]; |
17457 | | uint64_t f_verification_have_total_sizes[2]; |
17458 | | uint64_t f_verification_want_total_sizes[2]; |
17459 | | uint64_t f_num_actual_blocks; |
17460 | | uint64_t f_num_index_blocks; |
17461 | | uint64_t f_index_block_compressed_size; |
17462 | | uint64_t f_index_block_uncompressed_size; |
17463 | | uint64_t f_backwards_size; |
17464 | | bool f_started_verify_index; |
17465 | | uint16_t f_flags; |
17466 | | |
17467 | | uint8_t (*choosy_apply_non_final_filters)( |
17468 | | wuffs_xz__decoder* self, |
17469 | | wuffs_base__slice_u8 a_dst_slice); |
17470 | | uint32_t p_transform_io; |
17471 | | uint32_t p_do_transform_io; |
17472 | | uint32_t p_decode_block_header_with_padding; |
17473 | | uint32_t p_decode_block_header_sans_padding; |
17474 | | uint32_t p_verify_index; |
17475 | | uint32_t p_verify_footer; |
17476 | | } private_impl; |
17477 | | |
17478 | | struct { |
17479 | | uint8_t f_filter_data[3][256]; |
17480 | | wuffs_crc32__ieee_hasher f_crc32; |
17481 | | wuffs_crc64__ecma_hasher f_crc64; |
17482 | | wuffs_sha256__hasher f_sha256; |
17483 | | wuffs_lzma__decoder f_lzma; |
17484 | | |
17485 | | struct { |
17486 | | uint32_t v_checksum32_have; |
17487 | | uint32_t v_checksum32_want; |
17488 | | wuffs_base__bitvec256 v_checksum256_have; |
17489 | | uint64_t v_compressed_size; |
17490 | | uint64_t v_uncompressed_size; |
17491 | | uint64_t scratch; |
17492 | | } s_do_transform_io; |
17493 | | struct { |
17494 | | uint64_t v_padded_size_have; |
17495 | | uint64_t v_padded_size_want; |
17496 | | } s_decode_block_header_with_padding; |
17497 | | struct { |
17498 | | uint8_t v_flags; |
17499 | | uint8_t v_filter_id; |
17500 | | uint32_t v_shift; |
17501 | | uint32_t v_f; |
17502 | | uint64_t scratch; |
17503 | | } s_decode_block_header_sans_padding; |
17504 | | struct { |
17505 | | uint32_t v_shift; |
17506 | | } s_verify_index; |
17507 | | struct { |
17508 | | uint64_t scratch; |
17509 | | } s_verify_footer; |
17510 | | } private_data; |
17511 | | |
17512 | | #ifdef __cplusplus |
17513 | | #if defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
17514 | | using unique_ptr = std::unique_ptr<wuffs_xz__decoder, wuffs_unique_ptr_deleter>; |
17515 | | |
17516 | | // On failure, the alloc_etc functions return nullptr. They don't throw. |
17517 | | |
17518 | | static inline unique_ptr |
17519 | | alloc() { |
17520 | | return unique_ptr(wuffs_xz__decoder__alloc()); |
17521 | | } |
17522 | | |
17523 | | static inline wuffs_base__io_transformer::unique_ptr |
17524 | | alloc_as__wuffs_base__io_transformer() { |
17525 | | return wuffs_base__io_transformer::unique_ptr( |
17526 | | wuffs_xz__decoder__alloc_as__wuffs_base__io_transformer()); |
17527 | | } |
17528 | | #endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
17529 | | |
17530 | | #if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
17531 | | // Disallow constructing or copying an object via standard C++ mechanisms, |
17532 | | // e.g. the "new" operator, as this struct is intentionally opaque. Its total |
17533 | | // size and field layout is not part of the public, stable, memory-safe API. |
17534 | | // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and |
17535 | | // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as |
17536 | | // their first argument) rather than tweaking bar.private_impl.qux fields. |
17537 | | // |
17538 | | // In C, we can just leave wuffs_foo__bar as an incomplete type (unless |
17539 | | // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in |
17540 | | // order to provide convenience methods. These forward on "this", so that you |
17541 | | // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". |
17542 | | wuffs_xz__decoder__struct() = delete; |
17543 | | wuffs_xz__decoder__struct(const wuffs_xz__decoder__struct&) = delete; |
17544 | | wuffs_xz__decoder__struct& operator=( |
17545 | | const wuffs_xz__decoder__struct&) = delete; |
17546 | | #endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION) |
17547 | | |
17548 | | #if !defined(WUFFS_IMPLEMENTATION) |
17549 | | // As above, the size of the struct is not part of the public API, and unless |
17550 | | // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap |
17551 | | // allocated, not stack allocated. Its size is not intended to be known at |
17552 | | // compile time, but it is unfortunately divulged as a side effect of |
17553 | | // defining C++ convenience methods. Use "sizeof__T()", calling the function, |
17554 | | // instead of "sizeof T", invoking the operator. To make the two values |
17555 | | // different, so that passing the latter will be rejected by the initialize |
17556 | | // function, we add an arbitrary amount of dead weight. |
17557 | | uint8_t dead_weight[123000000]; // 123 MB. |
17558 | | #endif // !defined(WUFFS_IMPLEMENTATION) |
17559 | | |
17560 | | inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT |
17561 | | initialize( |
17562 | | size_t sizeof_star_self, |
17563 | | uint64_t wuffs_version, |
17564 | | uint32_t options) { |
17565 | | return wuffs_xz__decoder__initialize( |
17566 | | this, sizeof_star_self, wuffs_version, options); |
17567 | | } |
17568 | | |
17569 | | inline wuffs_base__io_transformer* |
17570 | | upcast_as__wuffs_base__io_transformer() { |
17571 | | return (wuffs_base__io_transformer*)this; |
17572 | | } |
17573 | | |
17574 | | inline uint64_t |
17575 | | get_quirk( |
17576 | | uint32_t a_key) const { |
17577 | | return wuffs_xz__decoder__get_quirk(this, a_key); |
17578 | | } |
17579 | | |
17580 | | inline wuffs_base__status |
17581 | | set_quirk( |
17582 | | uint32_t a_key, |
17583 | | uint64_t a_value) { |
17584 | | return wuffs_xz__decoder__set_quirk(this, a_key, a_value); |
17585 | | } |
17586 | | |
17587 | | inline wuffs_base__optional_u63 |
17588 | | dst_history_retain_length() const { |
17589 | | return wuffs_xz__decoder__dst_history_retain_length(this); |
17590 | | } |
17591 | | |
17592 | | inline wuffs_base__range_ii_u64 |
17593 | | workbuf_len() const { |
17594 | | return wuffs_xz__decoder__workbuf_len(this); |
17595 | | } |
17596 | | |
17597 | | inline wuffs_base__status |
17598 | | transform_io( |
17599 | | wuffs_base__io_buffer* a_dst, |
17600 | | wuffs_base__io_buffer* a_src, |
17601 | | wuffs_base__slice_u8 a_workbuf) { |
17602 | | return wuffs_xz__decoder__transform_io(this, a_dst, a_src, a_workbuf); |
17603 | | } |
17604 | | |
17605 | | #endif // __cplusplus |
17606 | | }; // struct wuffs_xz__decoder__struct |
17607 | | |
17608 | | #endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION) |
17609 | | |
17610 | | #endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__XZ) || defined(WUFFS_NONMONOLITHIC) |
17611 | | |
17612 | | #if defined(__cplusplus) && defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
17613 | | |
17614 | | // ---------------- Auxiliary - Base |
17615 | | |
17616 | | // Auxiliary code is discussed at |
17617 | | // https://github.com/google/wuffs/blob/main/doc/note/auxiliary-code.md |
17618 | | |
17619 | | #include <stdio.h> |
17620 | | |
17621 | | #include <string> |
17622 | | #include <utility> |
17623 | | |
17624 | | namespace wuffs_aux { |
17625 | | |
17626 | | using IOBuffer = wuffs_base__io_buffer; |
17627 | | |
17628 | | // MemOwner represents ownership of some memory. Dynamically allocated memory |
17629 | | // (e.g. from malloc or new) is typically paired with free or delete, invoked |
17630 | | // when the std::unique_ptr is destroyed. Statically allocated memory might use |
17631 | | // MemOwner(nullptr, &free), even if that statically allocated memory is not |
17632 | | // nullptr, since calling free(nullptr) is a no-op. |
17633 | | using MemOwner = std::unique_ptr<void, decltype(&free)>; |
17634 | | |
17635 | | using QuirkKeyValuePair = std::pair<uint32_t, uint64_t>; |
17636 | | |
17637 | | namespace sync_io { |
17638 | | |
17639 | | // -------- |
17640 | | |
17641 | | // DynIOBuffer is an IOBuffer that is backed by a dynamically sized byte array. |
17642 | | // It owns that backing array and will free it in its destructor. |
17643 | | // |
17644 | | // The array size can be explicitly extended (by calling the grow method) but, |
17645 | | // unlike a C++ std::vector, there is no implicit extension (e.g. by calling |
17646 | | // std::vector::insert) and its maximum size is capped by the max_incl |
17647 | | // constructor argument. |
17648 | | // |
17649 | | // It contains an IOBuffer-typed field whose reader side provides access to |
17650 | | // previously written bytes and whose writer side provides access to the |
17651 | | // allocated but not-yet-written-to slack space. For Go programmers, this slack |
17652 | | // space is roughly analogous to the s[len(s):cap(s)] space of a slice s. |
17653 | | class DynIOBuffer { |
17654 | | public: |
17655 | | enum GrowResult { |
17656 | | OK = 0, |
17657 | | FailedMaxInclExceeded = 1, |
17658 | | FailedOutOfMemory = 2, |
17659 | | }; |
17660 | | |
17661 | | // m_buf holds the dynamically sized byte array and its read/write indexes: |
17662 | | // - m_buf.meta.wi is roughly analogous to a Go slice's length. |
17663 | | // - m_buf.data.len is roughly analogous to a Go slice's capacity. It is |
17664 | | // also equal to the m_buf.data.ptr malloc/realloc size. |
17665 | | // |
17666 | | // Users should not modify the m_buf.data.ptr or m_buf.data.len fields (as |
17667 | | // they are conceptually private to this class), but they can modify the |
17668 | | // bytes referenced by that pointer-length pair (e.g. compactions). |
17669 | | IOBuffer m_buf; |
17670 | | |
17671 | | // m_max_incl is an inclusive upper bound on the backing array size. |
17672 | | const uint64_t m_max_incl; |
17673 | | |
17674 | | // Constructor and destructor. |
17675 | | explicit DynIOBuffer(uint64_t max_incl); |
17676 | | ~DynIOBuffer(); |
17677 | | |
17678 | | // Drop frees the byte array and resets m_buf. The DynIOBuffer can still be |
17679 | | // used after a drop call. It just restarts from zero. |
17680 | | void drop(); |
17681 | | |
17682 | | // grow ensures that the byte array size is at least min_incl and at most |
17683 | | // max_incl. It returns FailedMaxInclExceeded if that would require |
17684 | | // allocating more than max_incl bytes, including the case where (min_incl > |
17685 | | // max_incl). It returns FailedOutOfMemory if memory allocation failed. |
17686 | | GrowResult grow(uint64_t min_incl); |
17687 | | |
17688 | | private: |
17689 | | // Delete the copy and assign constructors. |
17690 | | DynIOBuffer(const DynIOBuffer&) = delete; |
17691 | | DynIOBuffer& operator=(const DynIOBuffer&) = delete; |
17692 | | |
17693 | | static uint64_t round_up(uint64_t min_incl, uint64_t max_incl); |
17694 | | }; |
17695 | | |
17696 | | // -------- |
17697 | | |
17698 | | class Input { |
17699 | | public: |
17700 | | virtual ~Input(); |
17701 | | |
17702 | | virtual IOBuffer* BringsItsOwnIOBuffer(); |
17703 | | virtual std::string CopyIn(IOBuffer* dst) = 0; |
17704 | | }; |
17705 | | |
17706 | | // -------- |
17707 | | |
17708 | | // FileInput is an Input that reads from a file source. |
17709 | | // |
17710 | | // It does not take responsibility for closing the file when done. |
17711 | | class FileInput : public Input { |
17712 | | public: |
17713 | | FileInput(FILE* f); |
17714 | | |
17715 | | virtual std::string CopyIn(IOBuffer* dst); |
17716 | | |
17717 | | private: |
17718 | | FILE* m_f; |
17719 | | |
17720 | | // Delete the copy and assign constructors. |
17721 | | FileInput(const FileInput&) = delete; |
17722 | | FileInput& operator=(const FileInput&) = delete; |
17723 | | }; |
17724 | | |
17725 | | // -------- |
17726 | | |
17727 | | // MemoryInput is an Input that reads from an in-memory source. |
17728 | | // |
17729 | | // It does not take responsibility for freeing the memory when done. |
17730 | | class MemoryInput : public Input { |
17731 | | public: |
17732 | | MemoryInput(const char* ptr, size_t len); |
17733 | | MemoryInput(const uint8_t* ptr, size_t len); |
17734 | | |
17735 | | virtual IOBuffer* BringsItsOwnIOBuffer(); |
17736 | | virtual std::string CopyIn(IOBuffer* dst); |
17737 | | |
17738 | | private: |
17739 | | IOBuffer m_io; |
17740 | | |
17741 | | // Delete the copy and assign constructors. |
17742 | | MemoryInput(const MemoryInput&) = delete; |
17743 | | MemoryInput& operator=(const MemoryInput&) = delete; |
17744 | | }; |
17745 | | |
17746 | | // -------- |
17747 | | |
17748 | | } // namespace sync_io |
17749 | | |
17750 | | } // namespace wuffs_aux |
17751 | | |
17752 | | // ---------------- Auxiliary - CBOR |
17753 | | |
17754 | | namespace wuffs_aux { |
17755 | | |
17756 | | struct DecodeCborResult { |
17757 | | DecodeCborResult(std::string&& error_message0, uint64_t cursor_position0); |
17758 | | |
17759 | | std::string error_message; |
17760 | | uint64_t cursor_position; |
17761 | | }; |
17762 | | |
17763 | | class DecodeCborCallbacks { |
17764 | | public: |
17765 | | virtual ~DecodeCborCallbacks(); |
17766 | | |
17767 | | // AppendXxx are called for leaf nodes: literals, numbers, strings, etc. |
17768 | | |
17769 | | virtual std::string AppendNull() = 0; |
17770 | | virtual std::string AppendUndefined() = 0; |
17771 | | virtual std::string AppendBool(bool val) = 0; |
17772 | | virtual std::string AppendF64(double val) = 0; |
17773 | | virtual std::string AppendI64(int64_t val) = 0; |
17774 | | virtual std::string AppendU64(uint64_t val) = 0; |
17775 | | virtual std::string AppendByteString(std::string&& val) = 0; |
17776 | | virtual std::string AppendTextString(std::string&& val) = 0; |
17777 | | virtual std::string AppendMinus1MinusX(uint64_t val) = 0; |
17778 | | virtual std::string AppendCborSimpleValue(uint8_t val) = 0; |
17779 | | virtual std::string AppendCborTag(uint64_t val) = 0; |
17780 | | |
17781 | | // Push and Pop are called for container nodes: CBOR arrays (lists) and CBOR |
17782 | | // maps (dictionaries). |
17783 | | // |
17784 | | // The flags bits combine exactly one of: |
17785 | | // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__FROM_NONE |
17786 | | // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__FROM_LIST |
17787 | | // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__FROM_DICT |
17788 | | // and exactly one of: |
17789 | | // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__TO_NONE |
17790 | | // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__TO_LIST |
17791 | | // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__TO_DICT |
17792 | | |
17793 | | virtual std::string Push(uint32_t flags) = 0; |
17794 | | virtual std::string Pop(uint32_t flags) = 0; |
17795 | | |
17796 | | // Done is always the last Callback method called by DecodeCbor, whether or |
17797 | | // not parsing the input as CBOR encountered an error. Even when successful, |
17798 | | // trailing data may remain in input and buffer. |
17799 | | // |
17800 | | // Do not keep a reference to buffer or buffer.data.ptr after Done returns, |
17801 | | // as DecodeCbor may then de-allocate the backing array. |
17802 | | // |
17803 | | // The default Done implementation is a no-op. |
17804 | | virtual void // |
17805 | | Done(DecodeCborResult& result, sync_io::Input& input, IOBuffer& buffer); |
17806 | | }; |
17807 | | |
17808 | | // The FooArgBar types add structure to Foo's optional arguments. They wrap |
17809 | | // inner representations for several reasons: |
17810 | | // - It provides a home for the DefaultValue static method, for Foo callers |
17811 | | // that want to override some but not all optional arguments. |
17812 | | // - It provides the "Bar" name at Foo call sites, which can help self- |
17813 | | // document Foo calls with many arguemnts. |
17814 | | // - It provides some type safety against accidentally transposing or omitting |
17815 | | // adjacent fundamentally-numeric-typed optional arguments. |
17816 | | |
17817 | | // DecodeCborArgQuirks wraps an optional argument to DecodeCbor. |
17818 | | struct DecodeCborArgQuirks { |
17819 | | explicit DecodeCborArgQuirks(const QuirkKeyValuePair* ptr0, |
17820 | | const size_t len0); |
17821 | | |
17822 | | // DefaultValue returns an empty slice. |
17823 | | static DecodeCborArgQuirks DefaultValue(); |
17824 | | |
17825 | | const QuirkKeyValuePair* ptr; |
17826 | | const size_t len; |
17827 | | }; |
17828 | | |
17829 | | // DecodeCbor calls callbacks based on the CBOR-formatted data in input. |
17830 | | // |
17831 | | // On success, the returned error_message is empty and cursor_position counts |
17832 | | // the number of bytes consumed. On failure, error_message is non-empty and |
17833 | | // cursor_position is the location of the error. That error may be a content |
17834 | | // error (invalid CBOR) or an input error (e.g. network failure). |
17835 | | DecodeCborResult // |
17836 | | DecodeCbor(DecodeCborCallbacks& callbacks, |
17837 | | sync_io::Input& input, |
17838 | | DecodeCborArgQuirks quirks = DecodeCborArgQuirks::DefaultValue()); |
17839 | | |
17840 | | } // namespace wuffs_aux |
17841 | | |
17842 | | // ---------------- Auxiliary - Image |
17843 | | |
17844 | | namespace wuffs_aux { |
17845 | | |
17846 | | struct DecodeImageResult { |
17847 | | DecodeImageResult(MemOwner&& pixbuf_mem_owner0, |
17848 | | wuffs_base__pixel_buffer pixbuf0, |
17849 | | std::string&& error_message0); |
17850 | | DecodeImageResult(std::string&& error_message0); |
17851 | | |
17852 | | MemOwner pixbuf_mem_owner; |
17853 | | wuffs_base__pixel_buffer pixbuf; |
17854 | | std::string error_message; |
17855 | | }; |
17856 | | |
17857 | | // DecodeImageCallbacks are the callbacks given to DecodeImage. They are always |
17858 | | // called in this order: |
17859 | | // 1. SelectDecoder |
17860 | | // 2. HandleMetadata |
17861 | | // 3. SelectPixfmt |
17862 | | // 4. AllocPixbuf |
17863 | | // 5. AllocWorkbuf |
17864 | | // 6. Done |
17865 | | // |
17866 | | // It may return early - the third callback might not be invoked if the second |
17867 | | // one fails - but the final callback (Done) is always invoked. |
17868 | | class DecodeImageCallbacks { |
17869 | | public: |
17870 | | // AllocPixbufResult holds a memory allocation (the result of malloc or new, |
17871 | | // a statically allocated pointer, etc), or an error message. The memory is |
17872 | | // de-allocated when mem_owner goes out of scope and is destroyed. |
17873 | | struct AllocPixbufResult { |
17874 | | AllocPixbufResult(MemOwner&& mem_owner0, wuffs_base__pixel_buffer pixbuf0); |
17875 | | AllocPixbufResult(std::string&& error_message0); |
17876 | | |
17877 | | MemOwner mem_owner; |
17878 | | wuffs_base__pixel_buffer pixbuf; |
17879 | | std::string error_message; |
17880 | | }; |
17881 | | |
17882 | | // AllocWorkbufResult holds a memory allocation (the result of malloc or new, |
17883 | | // a statically allocated pointer, etc), or an error message. The memory is |
17884 | | // de-allocated when mem_owner goes out of scope and is destroyed. |
17885 | | struct AllocWorkbufResult { |
17886 | | AllocWorkbufResult(MemOwner&& mem_owner0, wuffs_base__slice_u8 workbuf0); |
17887 | | AllocWorkbufResult(std::string&& error_message0); |
17888 | | |
17889 | | MemOwner mem_owner; |
17890 | | wuffs_base__slice_u8 workbuf; |
17891 | | std::string error_message; |
17892 | | }; |
17893 | | |
17894 | | virtual ~DecodeImageCallbacks(); |
17895 | | |
17896 | | // SelectDecoder returns the image decoder for the input data's file format. |
17897 | | // Returning a nullptr means failure (DecodeImage_UnsupportedImageFormat). |
17898 | | // |
17899 | | // Common formats will have a FourCC value in the range [1 ..= 0x7FFF_FFFF], |
17900 | | // such as WUFFS_BASE__FOURCC__JPEG. A zero FourCC value means that Wuffs' |
17901 | | // standard library did not recognize the image format but if SelectDecoder |
17902 | | // was overridden, it may examine the input data's starting bytes and still |
17903 | | // provide its own image decoder, e.g. for an exotic image file format that's |
17904 | | // not in Wuffs' standard library. The prefix_etc fields have the same |
17905 | | // meaning as wuffs_base__magic_number_guess_fourcc arguments. SelectDecoder |
17906 | | // implementations should not modify prefix_data's contents. |
17907 | | // |
17908 | | // SelectDecoder might be called more than once, since some image file |
17909 | | // formats can wrap others. For example, a nominal BMP file can actually |
17910 | | // contain a JPEG or a PNG. |
17911 | | // |
17912 | | // The default SelectDecoder accepts the FOURCC codes listed below. For |
17913 | | // modular builds (i.e. when #define'ing WUFFS_CONFIG__MODULES), acceptance |
17914 | | // of the FOO file format is optional (for each value of FOO) and depends on |
17915 | | // the corresponding module to be enabled at compile time (i.e. #define'ing |
17916 | | // WUFFS_CONFIG__MODULE__FOO). |
17917 | | // |
17918 | | // - WUFFS_BASE__FOURCC__BMP |
17919 | | // - WUFFS_BASE__FOURCC__ETC2 |
17920 | | // - WUFFS_BASE__FOURCC__GIF |
17921 | | // - WUFFS_BASE__FOURCC__HNSM |
17922 | | // - WUFFS_BASE__FOURCC__JPEG |
17923 | | // - WUFFS_BASE__FOURCC__NIE |
17924 | | // - WUFFS_BASE__FOURCC__NPBM |
17925 | | // - WUFFS_BASE__FOURCC__PNG |
17926 | | // - WUFFS_BASE__FOURCC__QOI |
17927 | | // - WUFFS_BASE__FOURCC__TGA |
17928 | | // - WUFFS_BASE__FOURCC__TH |
17929 | | // - WUFFS_BASE__FOURCC__WBMP |
17930 | | // - WUFFS_BASE__FOURCC__WEBP |
17931 | | // |
17932 | | // The FOOBAR in WUFFS_BASE__FOURCC__FOBA is limited to four characters, but |
17933 | | // the FOOBAR in the corresponding WUFFS_CONFIG__MODULE__FOOBAR macro might |
17934 | | // be fuller and longer. For example, NPBM / NETPBM or TH / THUMBHASH. |
17935 | | virtual wuffs_base__image_decoder::unique_ptr // |
17936 | | SelectDecoder(uint32_t fourcc, |
17937 | | wuffs_base__slice_u8 prefix_data, |
17938 | | bool prefix_closed); |
17939 | | |
17940 | | // HandleMetadata acknowledges image metadata. minfo.flavor will be one of: |
17941 | | // - WUFFS_BASE__MORE_INFORMATION__FLAVOR__METADATA_RAW_PASSTHROUGH |
17942 | | // - WUFFS_BASE__MORE_INFORMATION__FLAVOR__METADATA_PARSED |
17943 | | // If it is METADATA_RAW_PASSTHROUGH then raw contains the metadata bytes. |
17944 | | // Those bytes should not be retained beyond the the HandleMetadata call. |
17945 | | // |
17946 | | // minfo.metadata__fourcc() will typically match one of the |
17947 | | // DecodeImageArgFlags bits. For example, if (REPORT_METADATA_CHRM | |
17948 | | // REPORT_METADATA_GAMA) was passed to DecodeImage then the metadata FourCC |
17949 | | // will be either WUFFS_BASE__FOURCC__CHRM or WUFFS_BASE__FOURCC__GAMA. |
17950 | | // |
17951 | | // It returns an error message, or an empty string on success. |
17952 | | virtual std::string // |
17953 | | HandleMetadata(const wuffs_base__more_information& minfo, |
17954 | | wuffs_base__slice_u8 raw); |
17955 | | |
17956 | | // SelectPixfmt returns the destination pixel format for AllocPixbuf. It |
17957 | | // should return wuffs_base__make_pixel_format(etc) called with one of: |
17958 | | // - WUFFS_BASE__PIXEL_FORMAT__Y |
17959 | | // - WUFFS_BASE__PIXEL_FORMAT__BGR_565 |
17960 | | // - WUFFS_BASE__PIXEL_FORMAT__BGR |
17961 | | // - WUFFS_BASE__PIXEL_FORMAT__BGRA_NONPREMUL |
17962 | | // - WUFFS_BASE__PIXEL_FORMAT__BGRA_NONPREMUL_4X16LE |
17963 | | // - WUFFS_BASE__PIXEL_FORMAT__BGRA_PREMUL |
17964 | | // - WUFFS_BASE__PIXEL_FORMAT__RGB |
17965 | | // - WUFFS_BASE__PIXEL_FORMAT__RGBA_NONPREMUL |
17966 | | // - WUFFS_BASE__PIXEL_FORMAT__RGBA_PREMUL |
17967 | | // or return image_config.pixcfg.pixel_format(). The latter means to use the |
17968 | | // image file's natural pixel format. For example, GIF images' natural pixel |
17969 | | // format is an indexed one. |
17970 | | // |
17971 | | // Returning otherwise means failure (DecodeImage_UnsupportedPixelFormat). |
17972 | | // |
17973 | | // The default SelectPixfmt implementation returns |
17974 | | // wuffs_base__make_pixel_format(WUFFS_BASE__PIXEL_FORMAT__BGRA_PREMUL) which |
17975 | | // is 4 bytes per pixel (8 bits per channel ร 4 channels). |
17976 | | virtual wuffs_base__pixel_format // |
17977 | | SelectPixfmt(const wuffs_base__image_config& image_config); |
17978 | | |
17979 | | // AllocPixbuf allocates the pixel buffer. |
17980 | | // |
17981 | | // allow_uninitialized_memory will be true if a valid background_color was |
17982 | | // passed to DecodeImage, since the pixel buffer's contents will be |
17983 | | // overwritten with that color after AllocPixbuf returns. |
17984 | | // |
17985 | | // The default AllocPixbuf implementation allocates either uninitialized or |
17986 | | // zeroed memory. Zeroed memory typically corresponds to filling with opaque |
17987 | | // black or transparent black, depending on the pixel format. |
17988 | | virtual AllocPixbufResult // |
17989 | | AllocPixbuf(const wuffs_base__image_config& image_config, |
17990 | | bool allow_uninitialized_memory); |
17991 | | |
17992 | | // AllocWorkbuf allocates the work buffer. The allocated buffer's length |
17993 | | // should be at least len_range.min_incl, but larger allocations (up to |
17994 | | // len_range.max_incl) may have better performance (by using more memory). |
17995 | | // |
17996 | | // The len_range argument will satisfy !len_range.is_empty(). |
17997 | | // |
17998 | | // The default AllocWorkbuf implementation allocates len_range.max_incl bytes |
17999 | | // of either uninitialized or zeroed memory. |
18000 | | virtual AllocWorkbufResult // |
18001 | | AllocWorkbuf(wuffs_base__range_ii_u64 len_range, |
18002 | | bool allow_uninitialized_memory); |
18003 | | |
18004 | | // Done is always the last Callback method called by DecodeImage, whether or |
18005 | | // not parsing the input encountered an error. Even when successful, trailing |
18006 | | // data may remain in input and buffer. |
18007 | | // |
18008 | | // The image_decoder is the one returned by SelectDecoder (if SelectDecoder |
18009 | | // was successful), or a no-op unique_ptr otherwise. Like any unique_ptr, |
18010 | | // ownership moves to the Done implementation. |
18011 | | // |
18012 | | // Do not keep a reference to buffer or buffer.data.ptr after Done returns, |
18013 | | // as DecodeImage may then de-allocate the backing array. |
18014 | | // |
18015 | | // The default Done implementation is a no-op, other than running the |
18016 | | // image_decoder unique_ptr destructor. |
18017 | | virtual void // |
18018 | | Done(DecodeImageResult& result, |
18019 | | sync_io::Input& input, |
18020 | | IOBuffer& buffer, |
18021 | | wuffs_base__image_decoder::unique_ptr image_decoder); |
18022 | | }; |
18023 | | |
18024 | | extern const char DecodeImage_BufferIsTooShort[]; |
18025 | | extern const char DecodeImage_MaxInclDimensionExceeded[]; |
18026 | | extern const char DecodeImage_MaxInclMetadataLengthExceeded[]; |
18027 | | extern const char DecodeImage_OutOfMemory[]; |
18028 | | extern const char DecodeImage_UnexpectedEndOfFile[]; |
18029 | | extern const char DecodeImage_UnsupportedImageFormat[]; |
18030 | | extern const char DecodeImage_UnsupportedMetadata[]; |
18031 | | extern const char DecodeImage_UnsupportedPixelBlend[]; |
18032 | | extern const char DecodeImage_UnsupportedPixelConfiguration[]; |
18033 | | extern const char DecodeImage_UnsupportedPixelFormat[]; |
18034 | | |
18035 | | // The FooArgBar types add structure to Foo's optional arguments. They wrap |
18036 | | // inner representations for several reasons: |
18037 | | // - It provides a home for the DefaultValue static method, for Foo callers |
18038 | | // that want to override some but not all optional arguments. |
18039 | | // - It provides the "Bar" name at Foo call sites, which can help self- |
18040 | | // document Foo calls with many arguemnts. |
18041 | | // - It provides some type safety against accidentally transposing or omitting |
18042 | | // adjacent fundamentally-numeric-typed optional arguments. |
18043 | | |
18044 | | // DecodeImageArgQuirks wraps an optional argument to DecodeImage. |
18045 | | struct DecodeImageArgQuirks { |
18046 | | explicit DecodeImageArgQuirks(const QuirkKeyValuePair* ptr0, |
18047 | | const size_t len0); |
18048 | | |
18049 | | // DefaultValue returns an empty slice. |
18050 | | static DecodeImageArgQuirks DefaultValue(); |
18051 | | |
18052 | | const QuirkKeyValuePair* ptr; |
18053 | | const size_t len; |
18054 | | }; |
18055 | | |
18056 | | // DecodeImageArgFlags wraps an optional argument to DecodeImage. |
18057 | | struct DecodeImageArgFlags { |
18058 | | explicit DecodeImageArgFlags(uint64_t repr0); |
18059 | | |
18060 | | // DefaultValue returns 0. |
18061 | | static DecodeImageArgFlags DefaultValue(); |
18062 | | |
18063 | | // TODO: support all of the REPORT_METADATA_FOO flags, not just CHRM, EXIF, |
18064 | | // GAMA, ICCP, KVP, SRGB and XMP. |
18065 | | |
18066 | | // Background Color. |
18067 | | static constexpr uint64_t REPORT_METADATA_BGCL = 0x0001; |
18068 | | // Primary Chromaticities and White Point. |
18069 | | static constexpr uint64_t REPORT_METADATA_CHRM = 0x0002; |
18070 | | // Exchangeable Image File Format. |
18071 | | static constexpr uint64_t REPORT_METADATA_EXIF = 0x0004; |
18072 | | // Gamma Correction. |
18073 | | static constexpr uint64_t REPORT_METADATA_GAMA = 0x0008; |
18074 | | // International Color Consortium Profile. |
18075 | | static constexpr uint64_t REPORT_METADATA_ICCP = 0x0010; |
18076 | | // Key-Value Pair. |
18077 | | // |
18078 | | // For PNG files, this includes iTXt, tEXt and zTXt chunks. In the |
18079 | | // HandleMetadata callback, the raw argument contains UTF-8 strings. |
18080 | | static constexpr uint64_t REPORT_METADATA_KVP = 0x0020; |
18081 | | // Modification Time. |
18082 | | static constexpr uint64_t REPORT_METADATA_MTIM = 0x0040; |
18083 | | // Offset (2-Dimensional). |
18084 | | static constexpr uint64_t REPORT_METADATA_OFS2 = 0x0080; |
18085 | | // Physical Dimensions. |
18086 | | static constexpr uint64_t REPORT_METADATA_PHYD = 0x0100; |
18087 | | // Standard Red Green Blue (Rendering Intent). |
18088 | | static constexpr uint64_t REPORT_METADATA_SRGB = 0x0200; |
18089 | | // Extensible Metadata Platform. |
18090 | | static constexpr uint64_t REPORT_METADATA_XMP = 0x0400; |
18091 | | |
18092 | | uint64_t repr; |
18093 | | }; |
18094 | | |
18095 | | // DecodeImageArgPixelBlend wraps an optional argument to DecodeImage. |
18096 | | struct DecodeImageArgPixelBlend { |
18097 | | explicit DecodeImageArgPixelBlend(wuffs_base__pixel_blend repr0); |
18098 | | |
18099 | | // DefaultValue returns WUFFS_BASE__PIXEL_BLEND__SRC. |
18100 | | static DecodeImageArgPixelBlend DefaultValue(); |
18101 | | |
18102 | | wuffs_base__pixel_blend repr; |
18103 | | }; |
18104 | | |
18105 | | // DecodeImageArgBackgroundColor wraps an optional argument to DecodeImage. |
18106 | | struct DecodeImageArgBackgroundColor { |
18107 | | explicit DecodeImageArgBackgroundColor( |
18108 | | wuffs_base__color_u32_argb_premul repr0); |
18109 | | |
18110 | | // DefaultValue returns 1, an invalid wuffs_base__color_u32_argb_premul. |
18111 | | static DecodeImageArgBackgroundColor DefaultValue(); |
18112 | | |
18113 | | wuffs_base__color_u32_argb_premul repr; |
18114 | | }; |
18115 | | |
18116 | | // DecodeImageArgMaxInclDimension wraps an optional argument to DecodeImage. |
18117 | | struct DecodeImageArgMaxInclDimension { |
18118 | | explicit DecodeImageArgMaxInclDimension(uint32_t repr0); |
18119 | | |
18120 | | // DefaultValue returns 1048575 = 0x000F_FFFF, more than 1 million pixels. |
18121 | | static DecodeImageArgMaxInclDimension DefaultValue(); |
18122 | | |
18123 | | uint32_t repr; |
18124 | | }; |
18125 | | |
18126 | | // DecodeImageArgMaxInclMetadataLength wraps an optional argument to |
18127 | | // DecodeImage. |
18128 | | struct DecodeImageArgMaxInclMetadataLength { |
18129 | | explicit DecodeImageArgMaxInclMetadataLength(uint64_t repr0); |
18130 | | |
18131 | | // DefaultValue returns 16777215 = 0x00FF_FFFF, one less than 16 MiB. |
18132 | | static DecodeImageArgMaxInclMetadataLength DefaultValue(); |
18133 | | |
18134 | | uint64_t repr; |
18135 | | }; |
18136 | | |
18137 | | // DecodeImage decodes the image data in input. A variety of image file formats |
18138 | | // can be decoded, depending on what callbacks.SelectDecoder returns. |
18139 | | // |
18140 | | // For animated formats, only the first frame is returned, since the API is |
18141 | | // simpler for synchronous I/O and having DecodeImage only return when |
18142 | | // completely done, but rendering animation often involves handling other |
18143 | | // events in between animation frames. To decode multiple frames of animated |
18144 | | // images, or for asynchronous I/O (e.g. when decoding an image streamed over |
18145 | | // the network), use Wuffs' lower level C API instead of its higher level, |
18146 | | // simplified C++ API (the wuffs_aux API). |
18147 | | // |
18148 | | // The DecodeImageResult's fields depend on whether decoding succeeded: |
18149 | | // - On total success, the error_message is empty and pixbuf.pixcfg.is_valid() |
18150 | | // is true. |
18151 | | // - On partial success (e.g. the input file was truncated but we are still |
18152 | | // able to decode some of the pixels), error_message is non-empty but |
18153 | | // pixbuf.pixcfg.is_valid() is still true. It is up to the caller whether to |
18154 | | // accept or reject partial success. |
18155 | | // - On failure, the error_message is non_empty and pixbuf.pixcfg.is_valid() |
18156 | | // is false. |
18157 | | // |
18158 | | // The callbacks allocate the pixel buffer memory and work buffer memory. On |
18159 | | // success, pixel buffer memory ownership is passed to the DecodeImage caller |
18160 | | // as the returned pixbuf_mem_owner. Regardless of success or failure, the work |
18161 | | // buffer memory is deleted. |
18162 | | // |
18163 | | // The pixel_blend (one of the constants listed below) determines how to |
18164 | | // composite the decoded image over the pixel buffer's original pixels (as |
18165 | | // returned by callbacks.AllocPixbuf): |
18166 | | // - WUFFS_BASE__PIXEL_BLEND__SRC |
18167 | | // - WUFFS_BASE__PIXEL_BLEND__SRC_OVER |
18168 | | // |
18169 | | // The background_color is used to fill the pixel buffer after |
18170 | | // callbacks.AllocPixbuf returns, if it is valid in the |
18171 | | // wuffs_base__color_u32_argb_premul__is_valid sense. The default value, |
18172 | | // 0x0000_0001, is not valid since its Blue channel value (0x01) is greater |
18173 | | // than its Alpha channel value (0x00). A valid background_color will typically |
18174 | | // be overwritten when pixel_blend is WUFFS_BASE__PIXEL_BLEND__SRC, but might |
18175 | | // still be visible on partial (not total) success or when pixel_blend is |
18176 | | // WUFFS_BASE__PIXEL_BLEND__SRC_OVER and the decoded image is not fully opaque. |
18177 | | // |
18178 | | // Decoding fails (with DecodeImage_MaxInclDimensionExceeded) if the image's |
18179 | | // width or height is greater than max_incl_dimension or if any opted-in (via |
18180 | | // flags bits) metadata is longer than max_incl_metadata_length. |
18181 | | DecodeImageResult // |
18182 | | DecodeImage(DecodeImageCallbacks& callbacks, |
18183 | | sync_io::Input& input, |
18184 | | DecodeImageArgQuirks quirks = DecodeImageArgQuirks::DefaultValue(), |
18185 | | DecodeImageArgFlags flags = DecodeImageArgFlags::DefaultValue(), |
18186 | | DecodeImageArgPixelBlend pixel_blend = |
18187 | | DecodeImageArgPixelBlend::DefaultValue(), |
18188 | | DecodeImageArgBackgroundColor background_color = |
18189 | | DecodeImageArgBackgroundColor::DefaultValue(), |
18190 | | DecodeImageArgMaxInclDimension max_incl_dimension = |
18191 | | DecodeImageArgMaxInclDimension::DefaultValue(), |
18192 | | DecodeImageArgMaxInclMetadataLength max_incl_metadata_length = |
18193 | | DecodeImageArgMaxInclMetadataLength::DefaultValue()); |
18194 | | |
18195 | | } // namespace wuffs_aux |
18196 | | |
18197 | | // ---------------- Auxiliary - JSON |
18198 | | |
18199 | | namespace wuffs_aux { |
18200 | | |
18201 | | struct DecodeJsonResult { |
18202 | | DecodeJsonResult(std::string&& error_message0, uint64_t cursor_position0); |
18203 | | |
18204 | | std::string error_message; |
18205 | | uint64_t cursor_position; |
18206 | | }; |
18207 | | |
18208 | | class DecodeJsonCallbacks { |
18209 | | public: |
18210 | | virtual ~DecodeJsonCallbacks(); |
18211 | | |
18212 | | // AppendXxx are called for leaf nodes: literals, numbers and strings. For |
18213 | | // strings, the Callbacks implementation is responsible for tracking map keys |
18214 | | // versus other values. |
18215 | | |
18216 | | virtual std::string AppendNull() = 0; |
18217 | | virtual std::string AppendBool(bool val) = 0; |
18218 | | virtual std::string AppendF64(double val) = 0; |
18219 | | virtual std::string AppendI64(int64_t val) = 0; |
18220 | | virtual std::string AppendTextString(std::string&& val) = 0; |
18221 | | |
18222 | | // Push and Pop are called for container nodes: JSON arrays (lists) and JSON |
18223 | | // objects (dictionaries). |
18224 | | // |
18225 | | // The flags bits combine exactly one of: |
18226 | | // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__FROM_NONE |
18227 | | // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__FROM_LIST |
18228 | | // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__FROM_DICT |
18229 | | // and exactly one of: |
18230 | | // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__TO_NONE |
18231 | | // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__TO_LIST |
18232 | | // - WUFFS_BASE__TOKEN__VBD__STRUCTURE__TO_DICT |
18233 | | |
18234 | | virtual std::string Push(uint32_t flags) = 0; |
18235 | | virtual std::string Pop(uint32_t flags) = 0; |
18236 | | |
18237 | | // Done is always the last Callback method called by DecodeJson, whether or |
18238 | | // not parsing the input as JSON encountered an error. Even when successful, |
18239 | | // trailing data may remain in input and buffer. See "Unintuitive JSON |
18240 | | // Parsing" (https://nullprogram.com/blog/2019/12/28/) which discusses JSON |
18241 | | // parsing and when it stops. |
18242 | | // |
18243 | | // Do not keep a reference to buffer or buffer.data.ptr after Done returns, |
18244 | | // as DecodeJson may then de-allocate the backing array. |
18245 | | // |
18246 | | // The default Done implementation is a no-op. |
18247 | | virtual void // |
18248 | | Done(DecodeJsonResult& result, sync_io::Input& input, IOBuffer& buffer); |
18249 | | }; |
18250 | | |
18251 | | extern const char DecodeJson_BadJsonPointer[]; |
18252 | | extern const char DecodeJson_NoMatch[]; |
18253 | | |
18254 | | // The FooArgBar types add structure to Foo's optional arguments. They wrap |
18255 | | // inner representations for several reasons: |
18256 | | // - It provides a home for the DefaultValue static method, for Foo callers |
18257 | | // that want to override some but not all optional arguments. |
18258 | | // - It provides the "Bar" name at Foo call sites, which can help self- |
18259 | | // document Foo calls with many arguemnts. |
18260 | | // - It provides some type safety against accidentally transposing or omitting |
18261 | | // adjacent fundamentally-numeric-typed optional arguments. |
18262 | | |
18263 | | // DecodeJsonArgQuirks wraps an optional argument to DecodeJson. |
18264 | | struct DecodeJsonArgQuirks { |
18265 | | explicit DecodeJsonArgQuirks(const QuirkKeyValuePair* ptr0, |
18266 | | const size_t len0); |
18267 | | |
18268 | | // DefaultValue returns an empty slice. |
18269 | | static DecodeJsonArgQuirks DefaultValue(); |
18270 | | |
18271 | | const QuirkKeyValuePair* ptr; |
18272 | | const size_t len; |
18273 | | }; |
18274 | | |
18275 | | // DecodeJsonArgJsonPointer wraps an optional argument to DecodeJson. |
18276 | | struct DecodeJsonArgJsonPointer { |
18277 | | explicit DecodeJsonArgJsonPointer(std::string repr0); |
18278 | | |
18279 | | // DefaultValue returns an empty string. |
18280 | | static DecodeJsonArgJsonPointer DefaultValue(); |
18281 | | |
18282 | | std::string repr; |
18283 | | }; |
18284 | | |
18285 | | // DecodeJson calls callbacks based on the JSON-formatted data in input. |
18286 | | // |
18287 | | // On success, the returned error_message is empty and cursor_position counts |
18288 | | // the number of bytes consumed. On failure, error_message is non-empty and |
18289 | | // cursor_position is the location of the error. That error may be a content |
18290 | | // error (invalid JSON) or an input error (e.g. network failure). |
18291 | | // |
18292 | | // json_pointer is a query in the JSON Pointer (RFC 6901) syntax. The callbacks |
18293 | | // run for the input's sub-node that matches the query. DecodeJson_NoMatch is |
18294 | | // returned if no matching sub-node was found. The empty query matches the |
18295 | | // input's root node, consistent with JSON Pointer semantics. |
18296 | | // |
18297 | | // The JSON Pointer implementation is greedy: duplicate keys are not rejected |
18298 | | // but only the first match for each '/'-separated fragment is followed. |
18299 | | DecodeJsonResult // |
18300 | | DecodeJson(DecodeJsonCallbacks& callbacks, |
18301 | | sync_io::Input& input, |
18302 | | DecodeJsonArgQuirks quirks = DecodeJsonArgQuirks::DefaultValue(), |
18303 | | DecodeJsonArgJsonPointer json_pointer = |
18304 | | DecodeJsonArgJsonPointer::DefaultValue()); |
18305 | | |
18306 | | } // namespace wuffs_aux |
18307 | | |
18308 | | #endif // defined(__cplusplus) && defined(WUFFS_BASE__HAVE_UNIQUE_PTR) |
18309 | | |
18310 | | // ---------------- Wuffs' reimplementation of the STB API. |
18311 | | // |
18312 | | // This is a drop-in replacement of that third-party library. |
18313 | | // |
18314 | | // Disabled by default, unless you #define the |
18315 | | // WUFFS_CONFIG__ENABLE_DROP_IN_REPLACEMENT__STB macro beforehand. |
18316 | | // |
18317 | | // For API docs, see https://github.com/nothings/stb |
18318 | | |
18319 | | #if defined(WUFFS_CONFIG__ENABLE_DROP_IN_REPLACEMENT__STB) |
18320 | | |
18321 | | #ifdef __cplusplus |
18322 | | extern "C" { |
18323 | | #endif |
18324 | | |
18325 | | #if defined(WUFFS_CONFIG__STATIC_FUNCTIONS) || defined(STB_IMAGE_STATIC) |
18326 | | #define WUFFS_DROP_IN__STB__MAYBE_STATIC static |
18327 | | #else |
18328 | | #define WUFFS_DROP_IN__STB__MAYBE_STATIC |
18329 | | #endif |
18330 | | |
18331 | | enum { |
18332 | | STBI_default = 0, |
18333 | | STBI_grey = 1, |
18334 | | STBI_grey_alpha = 2, |
18335 | | STBI_rgb = 3, |
18336 | | STBI_rgb_alpha = 4 |
18337 | | }; |
18338 | | |
18339 | | typedef unsigned char stbi_uc; |
18340 | | typedef unsigned short stbi_us; |
18341 | | |
18342 | | typedef struct { |
18343 | | int (*read)(void* user, char* data, int size); |
18344 | | void (*skip)(void* user, int n); |
18345 | | int (*eof)(void* user); |
18346 | | } stbi_io_callbacks; |
18347 | | |
18348 | | // -------- |
18349 | | |
18350 | | WUFFS_DROP_IN__STB__MAYBE_STATIC int // |
18351 | | stbi_info_from_memory( // |
18352 | | stbi_uc const* buffer, // |
18353 | | int len, // |
18354 | | int* x, // |
18355 | | int* y, // |
18356 | | int* comp); |
18357 | | |
18358 | | WUFFS_DROP_IN__STB__MAYBE_STATIC stbi_uc* // |
18359 | | stbi_load_from_memory( // |
18360 | | stbi_uc const* buffer, // |
18361 | | int len, // |
18362 | | int* x, // |
18363 | | int* y, // |
18364 | | int* channels_in_file, // |
18365 | | int desired_channels); |
18366 | | |
18367 | | WUFFS_DROP_IN__STB__MAYBE_STATIC int // |
18368 | | stbi_info_from_callbacks( // |
18369 | | stbi_io_callbacks const* clbk, // |
18370 | | void* user, // |
18371 | | int* x, // |
18372 | | int* y, // |
18373 | | int* comp); |
18374 | | |
18375 | | WUFFS_DROP_IN__STB__MAYBE_STATIC stbi_uc* // |
18376 | | stbi_load_from_callbacks( // |
18377 | | stbi_io_callbacks const* clbk, // |
18378 | | void* user, // |
18379 | | int* x, // |
18380 | | int* y, // |
18381 | | int* channels_in_file, // |
18382 | | int desired_channels); |
18383 | | |
18384 | | // -------- |
18385 | | |
18386 | | #if !defined(STBI_NO_STDIO) |
18387 | | |
18388 | | WUFFS_DROP_IN__STB__MAYBE_STATIC int // |
18389 | | stbi_info( // |
18390 | | char const* filename, // |
18391 | | int* x, // |
18392 | | int* y, // |
18393 | | int* comp); |
18394 | | |
18395 | | WUFFS_DROP_IN__STB__MAYBE_STATIC stbi_uc* // |
18396 | | stbi_load( // |
18397 | | char const* filename, // |
18398 | | int* x, // |
18399 | | int* y, // |
18400 | | int* channels_in_file, // |
18401 | | int desired_channels); |
18402 | | |
18403 | | WUFFS_DROP_IN__STB__MAYBE_STATIC int // |
18404 | | stbi_info_from_file( // |
18405 | | FILE* f, // |
18406 | | int* x, // |
18407 | | int* y, // |
18408 | | int* comp); |
18409 | | |
18410 | | WUFFS_DROP_IN__STB__MAYBE_STATIC stbi_uc* // |
18411 | | stbi_load_from_file( // |
18412 | | FILE* f, // |
18413 | | int* x, // |
18414 | | int* y, // |
18415 | | int* channels_in_file, // |
18416 | | int desired_channels); |
18417 | | |
18418 | | #endif // !defined(STBI_NO_STDIO) |
18419 | | |
18420 | | // -------- |
18421 | | |
18422 | | WUFFS_DROP_IN__STB__MAYBE_STATIC void // |
18423 | | stbi_image_free( // |
18424 | | void* retval_from_stbi_load); |
18425 | | |
18426 | | WUFFS_DROP_IN__STB__MAYBE_STATIC const char* // |
18427 | | stbi_failure_reason(void); |
18428 | | |
18429 | | #ifdef __cplusplus |
18430 | | } |
18431 | | #endif |
18432 | | |
18433 | | #endif // defined (WUFFS_CONFIG__ENABLE_DROP_IN_REPLACEMENT__STB) |
18434 | | |
18435 | | // โผ WUFFS C HEADER ENDS HERE. |
18436 | | #ifdef WUFFS_IMPLEMENTATION |
18437 | | |
18438 | | #ifdef __cplusplus |
18439 | | extern "C" { |
18440 | | #endif |
18441 | | |
18442 | | // ---------------- Fundamentals |
18443 | | |
18444 | | // WUFFS_BASE__MAGIC is a magic number to check that initializers are called. |
18445 | | // It's not foolproof, given C doesn't automatically zero memory before use, |
18446 | | // but it should catch 99.99% of cases. |
18447 | | // |
18448 | | // Its (non-zero) value is arbitrary, based on md5sum("wuffs"). |
18449 | 6.09M | #define WUFFS_BASE__MAGIC ((uint32_t)0x3CCB6C71) |
18450 | | |
18451 | | // WUFFS_BASE__DISABLED is a magic number to indicate that a non-recoverable |
18452 | | // error was previously encountered. |
18453 | | // |
18454 | | // Its (non-zero) value is arbitrary, based on md5sum("disabled"). |
18455 | 57.9k | #define WUFFS_BASE__DISABLED ((uint32_t)0x075AE3D2) |
18456 | | |
18457 | | // Use switch cases for coroutine suspension points, similar to the technique |
18458 | | // in https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html |
18459 | | // |
18460 | | // The implicit fallthrough is intentional. |
18461 | | // |
18462 | | // We use trivial macros instead of an explicit assignment and case statement |
18463 | | // so that clang-format doesn't get confused by the unusual "case"s. |
18464 | 3.45M | #define WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0 case 0:; |
18465 | | #define WUFFS_BASE__COROUTINE_SUSPENSION_POINT(n) \ |
18466 | 20.2M | coro_susp_point = n; \ |
18467 | 20.7M | case n:; |
18468 | | |
18469 | | #define WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(n) \ |
18470 | 4.47M | if (!status.repr) { \ |
18471 | 563k | goto ok; \ |
18472 | 3.90M | } else if (*status.repr != '$') { \ |
18473 | 36.2k | goto exit; \ |
18474 | 36.2k | } \ |
18475 | 3.87M | coro_susp_point = n; \ |
18476 | 3.87M | goto suspend; \ |
18477 | 3.87M | case n:; |
18478 | | |
18479 | | // The "defined(__clang__)" isn't redundant. While vanilla clang defines |
18480 | | // __GNUC__, clang-cl (which mimics MSVC's cl.exe) does not. |
18481 | | #if defined(__GNUC__) || defined(__clang__) |
18482 | 1.65M | #define WUFFS_BASE__LIKELY(expr) (__builtin_expect(!!(expr), 1)) |
18483 | 11.8M | #define WUFFS_BASE__UNLIKELY(expr) (__builtin_expect(!!(expr), 0)) |
18484 | | #else |
18485 | | #define WUFFS_BASE__LIKELY(expr) (expr) |
18486 | | #define WUFFS_BASE__UNLIKELY(expr) (expr) |
18487 | | #endif |
18488 | | |
18489 | | // -------- |
18490 | | |
18491 | | static inline wuffs_base__empty_struct // |
18492 | 54.2k | wuffs_private_impl__ignore_status(wuffs_base__status z) { |
18493 | 54.2k | return wuffs_base__make_empty_struct(); |
18494 | 54.2k | } png_fuzzer.c:wuffs_private_impl__ignore_status Line | Count | Source | 18492 | 23.5k | wuffs_private_impl__ignore_status(wuffs_base__status z) { | 18493 | 23.5k | return wuffs_base__make_empty_struct(); | 18494 | 23.5k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_private_impl__ignore_status(wuffs_base__status__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_private_impl__ignore_status xz_fuzzer.c:wuffs_private_impl__ignore_status Line | Count | Source | 18492 | 30.7k | wuffs_private_impl__ignore_status(wuffs_base__status z) { | 18493 | 30.7k | return wuffs_base__make_empty_struct(); | 18494 | 30.7k | } |
Unexecuted instantiation: jpeg_fuzzer.c:wuffs_private_impl__ignore_status Unexecuted instantiation: cbor_fuzzer.c:wuffs_private_impl__ignore_status Unexecuted instantiation: bmp_fuzzer.c:wuffs_private_impl__ignore_status Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_private_impl__ignore_status Unexecuted instantiation: zlib_fuzzer.c:wuffs_private_impl__ignore_status Unexecuted instantiation: targa_fuzzer.c:wuffs_private_impl__ignore_status Unexecuted instantiation: bzip2_fuzzer.c:wuffs_private_impl__ignore_status Unexecuted instantiation: webp_fuzzer.c:wuffs_private_impl__ignore_status |
18495 | | |
18496 | | static inline wuffs_base__status // |
18497 | 2.46k | wuffs_private_impl__status__ensure_not_a_suspension(wuffs_base__status z) { |
18498 | 2.46k | if (z.repr && (*z.repr == '$')) { |
18499 | 0 | z.repr = wuffs_base__error__cannot_return_a_suspension; |
18500 | 0 | } |
18501 | 2.46k | return z; |
18502 | 2.46k | } Unexecuted instantiation: png_fuzzer.c:wuffs_private_impl__status__ensure_not_a_suspension Unexecuted instantiation: json_fuzzer.cc:wuffs_private_impl__status__ensure_not_a_suspension(wuffs_base__status__struct) Unexecuted instantiation: gif_fuzzer.c:wuffs_private_impl__status__ensure_not_a_suspension Unexecuted instantiation: xz_fuzzer.c:wuffs_private_impl__status__ensure_not_a_suspension jpeg_fuzzer.c:wuffs_private_impl__status__ensure_not_a_suspension Line | Count | Source | 18497 | 793 | wuffs_private_impl__status__ensure_not_a_suspension(wuffs_base__status z) { | 18498 | 793 | if (z.repr && (*z.repr == '$')) { | 18499 | 0 | z.repr = wuffs_base__error__cannot_return_a_suspension; | 18500 | 0 | } | 18501 | 793 | return z; | 18502 | 793 | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_private_impl__status__ensure_not_a_suspension Unexecuted instantiation: bmp_fuzzer.c:wuffs_private_impl__status__ensure_not_a_suspension Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_private_impl__status__ensure_not_a_suspension Unexecuted instantiation: zlib_fuzzer.c:wuffs_private_impl__status__ensure_not_a_suspension Unexecuted instantiation: targa_fuzzer.c:wuffs_private_impl__status__ensure_not_a_suspension Unexecuted instantiation: bzip2_fuzzer.c:wuffs_private_impl__status__ensure_not_a_suspension webp_fuzzer.c:wuffs_private_impl__status__ensure_not_a_suspension Line | Count | Source | 18497 | 1.67k | wuffs_private_impl__status__ensure_not_a_suspension(wuffs_base__status z) { | 18498 | 1.67k | if (z.repr && (*z.repr == '$')) { | 18499 | 0 | z.repr = wuffs_base__error__cannot_return_a_suspension; | 18500 | 0 | } | 18501 | 1.67k | return z; | 18502 | 1.67k | } |
|
18503 | | |
18504 | | // -------- |
18505 | | |
18506 | | // wuffs_private_impl__iterate_total_advance returns the exclusive |
18507 | | // pointer-offset at which iteration should stop. The overall slice has length |
18508 | | // total_len, each iteration's sub-slice has length iter_len and are placed |
18509 | | // iter_advance apart. |
18510 | | // |
18511 | | // The iter_advance may not be larger than iter_len. The iter_advance may be |
18512 | | // smaller than iter_len, in which case the sub-slices will overlap. |
18513 | | // |
18514 | | // The return value r satisfies ((0 <= r) && (r <= total_len)). |
18515 | | // |
18516 | | // For example, if total_len = 15, iter_len = 5 and iter_advance = 3, there are |
18517 | | // four iterations at offsets 0, 3, 6 and 9. This function returns 12. |
18518 | | // |
18519 | | // 0123456789012345 |
18520 | | // [....] |
18521 | | // [....] |
18522 | | // [....] |
18523 | | // [....] |
18524 | | // $ |
18525 | | // 0123456789012345 |
18526 | | // |
18527 | | // For example, if total_len = 15, iter_len = 5 and iter_advance = 5, there are |
18528 | | // three iterations at offsets 0, 5 and 10. This function returns 15. |
18529 | | // |
18530 | | // 0123456789012345 |
18531 | | // [....] |
18532 | | // [....] |
18533 | | // [....] |
18534 | | // $ |
18535 | | // 0123456789012345 |
18536 | | static inline size_t // |
18537 | | wuffs_private_impl__iterate_total_advance(size_t total_len, |
18538 | | size_t iter_len, |
18539 | 158k | size_t iter_advance) { |
18540 | 158k | if (total_len >= iter_len) { |
18541 | 55.5k | size_t n = total_len - iter_len; |
18542 | 55.5k | return ((n / iter_advance) * iter_advance) + iter_advance; |
18543 | 55.5k | } |
18544 | 103k | return 0; |
18545 | 158k | } png_fuzzer.c:wuffs_private_impl__iterate_total_advance Line | Count | Source | 18539 | 158k | size_t iter_advance) { | 18540 | 158k | if (total_len >= iter_len) { | 18541 | 55.5k | size_t n = total_len - iter_len; | 18542 | 55.5k | return ((n / iter_advance) * iter_advance) + iter_advance; | 18543 | 55.5k | } | 18544 | 103k | return 0; | 18545 | 158k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_private_impl__iterate_total_advance(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: gif_fuzzer.c:wuffs_private_impl__iterate_total_advance Unexecuted instantiation: xz_fuzzer.c:wuffs_private_impl__iterate_total_advance Unexecuted instantiation: jpeg_fuzzer.c:wuffs_private_impl__iterate_total_advance Unexecuted instantiation: cbor_fuzzer.c:wuffs_private_impl__iterate_total_advance Unexecuted instantiation: bmp_fuzzer.c:wuffs_private_impl__iterate_total_advance Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_private_impl__iterate_total_advance Unexecuted instantiation: zlib_fuzzer.c:wuffs_private_impl__iterate_total_advance Unexecuted instantiation: targa_fuzzer.c:wuffs_private_impl__iterate_total_advance Unexecuted instantiation: bzip2_fuzzer.c:wuffs_private_impl__iterate_total_advance Unexecuted instantiation: webp_fuzzer.c:wuffs_private_impl__iterate_total_advance |
18546 | | |
18547 | | // ---------------- Numeric Types |
18548 | | |
18549 | | extern const uint8_t wuffs_private_impl__low_bits_mask__u8[8]; |
18550 | | extern const uint16_t wuffs_private_impl__low_bits_mask__u16[16]; |
18551 | | extern const uint32_t wuffs_private_impl__low_bits_mask__u32[32]; |
18552 | | extern const uint64_t wuffs_private_impl__low_bits_mask__u64[64]; |
18553 | | |
18554 | | #define WUFFS_PRIVATE_IMPL__LOW_BITS_MASK__U8(n) \ |
18555 | | (wuffs_private_impl__low_bits_mask__u8[n]) |
18556 | | #define WUFFS_PRIVATE_IMPL__LOW_BITS_MASK__U16(n) \ |
18557 | | (wuffs_private_impl__low_bits_mask__u16[n]) |
18558 | | #define WUFFS_PRIVATE_IMPL__LOW_BITS_MASK__U32(n) \ |
18559 | 2.48M | (wuffs_private_impl__low_bits_mask__u32[n]) |
18560 | | #define WUFFS_PRIVATE_IMPL__LOW_BITS_MASK__U64(n) \ |
18561 | 10.4M | (wuffs_private_impl__low_bits_mask__u64[n]) |
18562 | | |
18563 | | // -------- |
18564 | | |
18565 | | static inline void // |
18566 | 0 | wuffs_private_impl__u8__sat_add_indirect(uint8_t* x, uint8_t y) { |
18567 | 0 | *x = wuffs_base__u8__sat_add(*x, y); |
18568 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_private_impl__u8__sat_add_indirect Unexecuted instantiation: json_fuzzer.cc:wuffs_private_impl__u8__sat_add_indirect(unsigned char*, unsigned char) Unexecuted instantiation: gif_fuzzer.c:wuffs_private_impl__u8__sat_add_indirect Unexecuted instantiation: xz_fuzzer.c:wuffs_private_impl__u8__sat_add_indirect Unexecuted instantiation: jpeg_fuzzer.c:wuffs_private_impl__u8__sat_add_indirect Unexecuted instantiation: cbor_fuzzer.c:wuffs_private_impl__u8__sat_add_indirect Unexecuted instantiation: bmp_fuzzer.c:wuffs_private_impl__u8__sat_add_indirect Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_private_impl__u8__sat_add_indirect Unexecuted instantiation: zlib_fuzzer.c:wuffs_private_impl__u8__sat_add_indirect Unexecuted instantiation: targa_fuzzer.c:wuffs_private_impl__u8__sat_add_indirect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_private_impl__u8__sat_add_indirect Unexecuted instantiation: webp_fuzzer.c:wuffs_private_impl__u8__sat_add_indirect |
18569 | | |
18570 | | static inline void // |
18571 | 0 | wuffs_private_impl__u8__sat_sub_indirect(uint8_t* x, uint8_t y) { |
18572 | 0 | *x = wuffs_base__u8__sat_sub(*x, y); |
18573 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_private_impl__u8__sat_sub_indirect Unexecuted instantiation: json_fuzzer.cc:wuffs_private_impl__u8__sat_sub_indirect(unsigned char*, unsigned char) Unexecuted instantiation: gif_fuzzer.c:wuffs_private_impl__u8__sat_sub_indirect Unexecuted instantiation: xz_fuzzer.c:wuffs_private_impl__u8__sat_sub_indirect Unexecuted instantiation: jpeg_fuzzer.c:wuffs_private_impl__u8__sat_sub_indirect Unexecuted instantiation: cbor_fuzzer.c:wuffs_private_impl__u8__sat_sub_indirect Unexecuted instantiation: bmp_fuzzer.c:wuffs_private_impl__u8__sat_sub_indirect Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_private_impl__u8__sat_sub_indirect Unexecuted instantiation: zlib_fuzzer.c:wuffs_private_impl__u8__sat_sub_indirect Unexecuted instantiation: targa_fuzzer.c:wuffs_private_impl__u8__sat_sub_indirect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_private_impl__u8__sat_sub_indirect Unexecuted instantiation: webp_fuzzer.c:wuffs_private_impl__u8__sat_sub_indirect |
18574 | | |
18575 | | static inline void // |
18576 | 0 | wuffs_private_impl__u16__sat_add_indirect(uint16_t* x, uint16_t y) { |
18577 | 0 | *x = wuffs_base__u16__sat_add(*x, y); |
18578 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_private_impl__u16__sat_add_indirect Unexecuted instantiation: json_fuzzer.cc:wuffs_private_impl__u16__sat_add_indirect(unsigned short*, unsigned short) Unexecuted instantiation: gif_fuzzer.c:wuffs_private_impl__u16__sat_add_indirect Unexecuted instantiation: xz_fuzzer.c:wuffs_private_impl__u16__sat_add_indirect Unexecuted instantiation: jpeg_fuzzer.c:wuffs_private_impl__u16__sat_add_indirect Unexecuted instantiation: cbor_fuzzer.c:wuffs_private_impl__u16__sat_add_indirect Unexecuted instantiation: bmp_fuzzer.c:wuffs_private_impl__u16__sat_add_indirect Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_private_impl__u16__sat_add_indirect Unexecuted instantiation: zlib_fuzzer.c:wuffs_private_impl__u16__sat_add_indirect Unexecuted instantiation: targa_fuzzer.c:wuffs_private_impl__u16__sat_add_indirect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_private_impl__u16__sat_add_indirect Unexecuted instantiation: webp_fuzzer.c:wuffs_private_impl__u16__sat_add_indirect |
18579 | | |
18580 | | static inline void // |
18581 | 0 | wuffs_private_impl__u16__sat_sub_indirect(uint16_t* x, uint16_t y) { |
18582 | 0 | *x = wuffs_base__u16__sat_sub(*x, y); |
18583 | 0 | } Unexecuted instantiation: png_fuzzer.c:wuffs_private_impl__u16__sat_sub_indirect Unexecuted instantiation: json_fuzzer.cc:wuffs_private_impl__u16__sat_sub_indirect(unsigned short*, unsigned short) Unexecuted instantiation: gif_fuzzer.c:wuffs_private_impl__u16__sat_sub_indirect Unexecuted instantiation: xz_fuzzer.c:wuffs_private_impl__u16__sat_sub_indirect Unexecuted instantiation: jpeg_fuzzer.c:wuffs_private_impl__u16__sat_sub_indirect Unexecuted instantiation: cbor_fuzzer.c:wuffs_private_impl__u16__sat_sub_indirect Unexecuted instantiation: bmp_fuzzer.c:wuffs_private_impl__u16__sat_sub_indirect Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_private_impl__u16__sat_sub_indirect Unexecuted instantiation: zlib_fuzzer.c:wuffs_private_impl__u16__sat_sub_indirect Unexecuted instantiation: targa_fuzzer.c:wuffs_private_impl__u16__sat_sub_indirect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_private_impl__u16__sat_sub_indirect Unexecuted instantiation: webp_fuzzer.c:wuffs_private_impl__u16__sat_sub_indirect |
18584 | | |
18585 | | static inline void // |
18586 | 8.28M | wuffs_private_impl__u32__sat_add_indirect(uint32_t* x, uint32_t y) { |
18587 | 8.28M | *x = wuffs_base__u32__sat_add(*x, y); |
18588 | 8.28M | } png_fuzzer.c:wuffs_private_impl__u32__sat_add_indirect Line | Count | Source | 18586 | 9.08k | wuffs_private_impl__u32__sat_add_indirect(uint32_t* x, uint32_t y) { | 18587 | 9.08k | *x = wuffs_base__u32__sat_add(*x, y); | 18588 | 9.08k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_private_impl__u32__sat_add_indirect(unsigned int*, unsigned int) gif_fuzzer.c:wuffs_private_impl__u32__sat_add_indirect Line | Count | Source | 18586 | 4.35M | wuffs_private_impl__u32__sat_add_indirect(uint32_t* x, uint32_t y) { | 18587 | 4.35M | *x = wuffs_base__u32__sat_add(*x, y); | 18588 | 4.35M | } |
xz_fuzzer.c:wuffs_private_impl__u32__sat_add_indirect Line | Count | Source | 18586 | 16.3k | wuffs_private_impl__u32__sat_add_indirect(uint32_t* x, uint32_t y) { | 18587 | 16.3k | *x = wuffs_base__u32__sat_add(*x, y); | 18588 | 16.3k | } |
jpeg_fuzzer.c:wuffs_private_impl__u32__sat_add_indirect Line | Count | Source | 18586 | 2.05k | wuffs_private_impl__u32__sat_add_indirect(uint32_t* x, uint32_t y) { | 18587 | 2.05k | *x = wuffs_base__u32__sat_add(*x, y); | 18588 | 2.05k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_private_impl__u32__sat_add_indirect bmp_fuzzer.c:wuffs_private_impl__u32__sat_add_indirect Line | Count | Source | 18586 | 3.89M | wuffs_private_impl__u32__sat_add_indirect(uint32_t* x, uint32_t y) { | 18587 | 3.89M | *x = wuffs_base__u32__sat_add(*x, y); | 18588 | 3.89M | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_private_impl__u32__sat_add_indirect Unexecuted instantiation: zlib_fuzzer.c:wuffs_private_impl__u32__sat_add_indirect Unexecuted instantiation: targa_fuzzer.c:wuffs_private_impl__u32__sat_add_indirect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_private_impl__u32__sat_add_indirect Unexecuted instantiation: webp_fuzzer.c:wuffs_private_impl__u32__sat_add_indirect |
18589 | | |
18590 | | static inline void // |
18591 | 263k | wuffs_private_impl__u32__sat_sub_indirect(uint32_t* x, uint32_t y) { |
18592 | 263k | *x = wuffs_base__u32__sat_sub(*x, y); |
18593 | 263k | } png_fuzzer.c:wuffs_private_impl__u32__sat_sub_indirect Line | Count | Source | 18591 | 21.2k | wuffs_private_impl__u32__sat_sub_indirect(uint32_t* x, uint32_t y) { | 18592 | 21.2k | *x = wuffs_base__u32__sat_sub(*x, y); | 18593 | 21.2k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_private_impl__u32__sat_sub_indirect(unsigned int*, unsigned int) Unexecuted instantiation: gif_fuzzer.c:wuffs_private_impl__u32__sat_sub_indirect Unexecuted instantiation: xz_fuzzer.c:wuffs_private_impl__u32__sat_sub_indirect jpeg_fuzzer.c:wuffs_private_impl__u32__sat_sub_indirect Line | Count | Source | 18591 | 225k | wuffs_private_impl__u32__sat_sub_indirect(uint32_t* x, uint32_t y) { | 18592 | 225k | *x = wuffs_base__u32__sat_sub(*x, y); | 18593 | 225k | } |
Unexecuted instantiation: cbor_fuzzer.c:wuffs_private_impl__u32__sat_sub_indirect bmp_fuzzer.c:wuffs_private_impl__u32__sat_sub_indirect Line | Count | Source | 18591 | 1.26k | wuffs_private_impl__u32__sat_sub_indirect(uint32_t* x, uint32_t y) { | 18592 | 1.26k | *x = wuffs_base__u32__sat_sub(*x, y); | 18593 | 1.26k | } |
Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_private_impl__u32__sat_sub_indirect Unexecuted instantiation: zlib_fuzzer.c:wuffs_private_impl__u32__sat_sub_indirect Unexecuted instantiation: targa_fuzzer.c:wuffs_private_impl__u32__sat_sub_indirect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_private_impl__u32__sat_sub_indirect webp_fuzzer.c:wuffs_private_impl__u32__sat_sub_indirect Line | Count | Source | 18591 | 15.6k | wuffs_private_impl__u32__sat_sub_indirect(uint32_t* x, uint32_t y) { | 18592 | 15.6k | *x = wuffs_base__u32__sat_sub(*x, y); | 18593 | 15.6k | } |
|
18594 | | |
18595 | | static inline void // |
18596 | 1.66M | wuffs_private_impl__u64__sat_add_indirect(uint64_t* x, uint64_t y) { |
18597 | 1.66M | *x = wuffs_base__u64__sat_add(*x, y); |
18598 | 1.66M | } png_fuzzer.c:wuffs_private_impl__u64__sat_add_indirect Line | Count | Source | 18596 | 37.7k | wuffs_private_impl__u64__sat_add_indirect(uint64_t* x, uint64_t y) { | 18597 | 37.7k | *x = wuffs_base__u64__sat_add(*x, y); | 18598 | 37.7k | } |
Unexecuted instantiation: json_fuzzer.cc:wuffs_private_impl__u64__sat_add_indirect(unsigned long*, unsigned long) gif_fuzzer.c:wuffs_private_impl__u64__sat_add_indirect Line | Count | Source | 18596 | 1.45M | wuffs_private_impl__u64__sat_add_indirect(uint64_t* x, uint64_t y) { | 18597 | 1.45M | *x = wuffs_base__u64__sat_add(*x, y); | 18598 | 1.45M | } |
xz_fuzzer.c:wuffs_private_impl__u64__sat_add_indirect Line | Count | Source | 18596 | 160k | wuffs_private_impl__u64__sat_add_indirect(uint64_t* x, uint64_t y) { | 18597 | 160k | *x = wuffs_base__u64__sat_add(*x, y); | 18598 | 160k | } |
Unexecuted instantiation: jpeg_fuzzer.c:wuffs_private_impl__u64__sat_add_indirect Unexecuted instantiation: cbor_fuzzer.c:wuffs_private_impl__u64__sat_add_indirect Unexecuted instantiation: bmp_fuzzer.c:wuffs_private_impl__u64__sat_add_indirect Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_private_impl__u64__sat_add_indirect zlib_fuzzer.c:wuffs_private_impl__u64__sat_add_indirect Line | Count | Source | 18596 | 8.99k | wuffs_private_impl__u64__sat_add_indirect(uint64_t* x, uint64_t y) { | 18597 | 8.99k | *x = wuffs_base__u64__sat_add(*x, y); | 18598 | 8.99k | } |
Unexecuted instantiation: targa_fuzzer.c:wuffs_private_impl__u64__sat_add_indirect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_private_impl__u64__sat_add_indirect Unexecuted instantiation: webp_fuzzer.c:wuffs_private_impl__u64__sat_add_indirect |
18599 | | |
18600 | | static inline void // |
18601 | 195k | wuffs_private_impl__u64__sat_sub_indirect(uint64_t* x, uint64_t y) { |
18602 | 195k | *x = wuffs_base__u64__sat_sub(*x, y); |
18603 | 195k | } Unexecuted instantiation: png_fuzzer.c:wuffs_private_impl__u64__sat_sub_indirect Unexecuted instantiation: json_fuzzer.cc:wuffs_private_impl__u64__sat_sub_indirect(unsigned long*, unsigned long) gif_fuzzer.c:wuffs_private_impl__u64__sat_sub_indirect Line | Count | Source | 18601 | 195k | wuffs_private_impl__u64__sat_sub_indirect(uint64_t* x, uint64_t y) { | 18602 | 195k | *x = wuffs_base__u64__sat_sub(*x, y); | 18603 | 195k | } |
Unexecuted instantiation: xz_fuzzer.c:wuffs_private_impl__u64__sat_sub_indirect Unexecuted instantiation: jpeg_fuzzer.c:wuffs_private_impl__u64__sat_sub_indirect Unexecuted instantiation: cbor_fuzzer.c:wuffs_private_impl__u64__sat_sub_indirect Unexecuted instantiation: bmp_fuzzer.c:wuffs_private_impl__u64__sat_sub_indirect Unexecuted instantiation: pixel_swizzler_fuzzer.c:wuffs_private_impl__u64__sat_sub_indirect Unexecuted instantiation: zlib_fuzzer.c:wuffs_private_impl__u64__sat_sub_indirect Unexecuted instantiation: targa_fuzzer.c:wuffs_private_impl__u64__sat_sub_indirect Unexecuted instantiation: bzip2_fuzzer.c:wuffs_private_impl__u64__sat_sub_indirect Unexecuted instantiation: webp_fuzzer.c:wuffs_private_impl__u64__sat_sub_indirect |
18604 | | |
18605 | | // ---------------- Numeric Types (Utility) |
18606 | | |
18607 | | #define wuffs_base__utility__i64_divide(a, b) \ |
18608 | | ((uint64_t)(((int64_t)(a)) / ((int64_t)(b)))) |
18609 | | |
18610 | | #define wuffs_base__utility__sign_extend_convert_u8_u32(a) \ |
18611 | 250M | ((uint32_t)(int32_t)(int8_t)(a)) |
18612 | | |
18613 | | #define wuffs_base__utility__sign_extend_convert_u8_u64(a) \ |
18614 | | ((uint64_t)(int64_t)(int8_t)(a)) |
18615 | | |
18616 | | #define wuffs_base__utility__sign_extend_convert_u16_u32(a) \ |
18617 | 4.53G | ((uint32_t)(int32_t)(int16_t)(a)) |
18618 | | |
18619 <
|