Compare commits

...
14 Commits
Author SHA1 Message Date
Nigel Tao 1e03a0c84f wuffs gen -version=0.3.0 2023-01-26 17:18:14 +11:00
Nigel Tao c698d81b4d Update README.md, doc/changelog.md 2023-01-26 17:17:12 +11:00
Nigel Tao 95164c7a3f Update doc/binary-size.md 2023-01-26 15:56:07 +11:00
Nigel Tao 255d3a0a29 Fix C++ "init-statement in selection" warning 2023-01-26 15:39:23 +11:00
Nigel Tao e915543f09 Fix jsonfindptrs "internal error" false positive 2022-12-08 15:07:42 +11:00
Nigel Tao dee65c0e61 wuffs gen -version=0.3.0-rc.3 2022-10-28 17:29:05 +11:00
Nigel Tao c27250f52f Add -Wall to build-example.sh 2022-10-28 17:17:09 +11:00
Nigel Tao 9445c8b9d0 Guard header declarations on the MODULE_ETC macros 2022-10-28 17:11:14 +11:00
Nigel Tao b5ccd9e8e7 wuffs gen -version=0.3.0-rc.2 2022-10-20 11:23:06 +11:00
Nigel Tao b0e9efff3f Avoid (NULL + 0) in derived io_buffer variables
This addresses a "runtime error: applying zero offset to null pointer"
UBSAN (Undefined Behavior Sanitizer) warning using clang 15.0.1:
https://logs.chromium.org/logs/skia/5e005cc1b1981011/+/steps/dm/0/stdout

The offending line of code was "io1_a_dst = io0_a_dst + a_dst->meta.wi"
in wuffs_lzw__decoder__write_to and "io1_a_dst = NULL + 0" was Undefined
Behavior even though io1_a_dst was never dereferenced.

This commit avoids initializing io1_a_dst to (NULL + 0) when io0_a_dst
is NULL, falling back to initializing it with just NULL.

As discussed in https://reviews.llvm.org/D67122 while (nullptr + 0) is
Defined Behavior according to the C++ spec, (NULL + 0) is Undefined
Behavior (by omission) in C11 6.5.6/8: "If both the pointer operand and
the result point to elements of the same array object, or one past the
last element of the array object, the evaluation shall not produce an
overflow; otherwise, the behavior is undefined."

The benchmarks (an excerpt of the full suite is below) seem quite
sensitive to this simple change that's outside of hot loops, sometimes
much better and sometimes much worse. I don't know why.

name                                               old speed       new speed      delta

wuffs_bzip2_decode_10k/clang11                    63.1MB/s ± 0%   58.4MB/s ± 0%   -7.43%  (p=0.008 n=5+5)
wuffs_bzip2_decode_100k/clang11                   49.4MB/s ± 0%   46.2MB/s ± 0%   -6.35%  (p=0.008 n=5+5)

wuffs_bzip2_decode_10k/gcc10                      60.9MB/s ± 0%   56.3MB/s ± 0%   -7.59%  (p=0.016 n=5+4)
wuffs_bzip2_decode_100k/gcc10                     49.6MB/s ± 0%   47.0MB/s ± 0%   -5.15%  (p=0.008 n=5+5)

wuffs_deflate_decode_1k_full_init/clang11          196MB/s ± 0%    195MB/s ± 1%   -0.63%  (p=0.008 n=5+5)
wuffs_deflate_decode_1k_part_init/clang11          226MB/s ± 0%    224MB/s ± 0%   -0.95%  (p=0.008 n=5+5)
wuffs_deflate_decode_10k_full_init/clang11         409MB/s ± 0%    420MB/s ± 0%   +2.84%  (p=0.008 n=5+5)
wuffs_deflate_decode_10k_part_init/clang11         418MB/s ± 0%    431MB/s ± 0%   +2.97%  (p=0.008 n=5+5)
wuffs_deflate_decode_100k_just_one_read/clang11    517MB/s ± 1%    542MB/s ± 0%   +4.78%  (p=0.008 n=5+5)
wuffs_deflate_decode_100k_many_big_reads/clang11   330MB/s ± 0%    338MB/s ± 0%   +2.45%  (p=0.008 n=5+5)

wuffs_deflate_decode_1k_full_init/gcc10            188MB/s ± 0%    177MB/s ± 0%   -5.38%  (p=0.008 n=5+5)
wuffs_deflate_decode_1k_part_init/gcc10            218MB/s ± 0%    209MB/s ± 0%   -4.11%  (p=0.016 n=4+5)
wuffs_deflate_decode_10k_full_init/gcc10           402MB/s ± 0%    407MB/s ± 1%   +1.19%  (p=0.008 n=5+5)
wuffs_deflate_decode_10k_part_init/gcc10           413MB/s ± 0%    419MB/s ± 1%   +1.64%  (p=0.008 n=5+5)
wuffs_deflate_decode_100k_just_one_read/gcc10      520MB/s ± 0%    532MB/s ± 0%   +2.25%  (p=0.008 n=5+5)
wuffs_deflate_decode_100k_many_big_reads/gcc10     330MB/s ± 0%    335MB/s ± 0%   +1.56%  (p=0.008 n=5+5)

wuffs_gif_decode_1k_bw/clang11                     781MB/s ± 0%    645MB/s ± 0%  -17.46%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_full_init/clang11        176MB/s ± 0%    181MB/s ± 0%   +3.11%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/clang11        215MB/s ± 0%    223MB/s ± 0%   +3.46%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/clang11                  786MB/s ± 0%    801MB/s ± 0%   +1.94%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/clang11               208MB/s ± 0%    211MB/s ± 0%   +1.44%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/clang11                       261MB/s ± 0%    252MB/s ± 0%   -3.43%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/clang11           578MB/s ± 0%    583MB/s ± 0%   +0.86%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/clang11            224MB/s ± 0%    223MB/s ± 0%   -0.79%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_full_init/clang11           229MB/s ± 0%    225MB/s ± 0%   -1.73%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_part_init/clang11           229MB/s ± 0%    225MB/s ± 0%   -1.69%  (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/clang11           1.31GB/s ± 0%   1.29GB/s ± 0%   -1.06%  (p=0.008 n=5+5)

wuffs_gif_decode_1k_bw/gcc10                       650MB/s ± 0%    631MB/s ± 0%   -3.03%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_full_init/gcc10          169MB/s ± 0%    168MB/s ± 0%   -0.51%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/gcc10          202MB/s ± 0%    202MB/s ± 0%   -0.18%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/gcc10                    766MB/s ± 0%    790MB/s ± 0%   +3.08%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/gcc10                 202MB/s ± 0%    208MB/s ± 0%   +3.16%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/gcc10                         250MB/s ± 0%    258MB/s ± 0%   +3.20%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/gcc10             563MB/s ± 0%    566MB/s ± 0%   +0.57%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/gcc10              217MB/s ± 0%    220MB/s ± 0%   +1.49%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_full_init/gcc10             220MB/s ± 0%    224MB/s ± 0%   +1.49%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_part_init/gcc10             220MB/s ± 0%    224MB/s ± 0%   +1.43%  (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/gcc10             1.30GB/s ± 0%   1.30GB/s ± 0%   +0.34%  (p=0.008 n=5+5)

wuffs_lzw_decode_20k/clang11                       293MB/s ± 0%    292MB/s ± 0%   -0.41%  (p=0.008 n=5+5)
wuffs_lzw_decode_100k/clang11                      486MB/s ± 0%    537MB/s ± 0%  +10.49%  (p=0.008 n=5+5)

wuffs_lzw_decode_20k/gcc10                         258MB/s ± 0%    276MB/s ± 0%   +7.19%  (p=0.016 n=4+5)
wuffs_lzw_decode_100k/gcc10                        512MB/s ± 0%    527MB/s ± 0%   +3.08%  (p=0.016 n=4+5)
2022-10-20 11:18:09 +11:00
Nigel Tao 8b7f82142c Update doc/roadmap.md 2022-10-17 19:13:19 +11:00
Nigel Tao b245252e1e Update doc/benchmarks.md 2022-09-04 00:54:21 +10:00
Nigel Tao bad2693efb Add lib/litonlylzma.FileFormatXz 2022-08-24 22:46:01 +10:00
Nigel Tao be1f605108 Run gofmt 2022-08-21 21:41:06 +10:00
25 changed files with 1710 additions and 1098 deletions

No files matched your search

+31 -14
View File
@@ -1,17 +1,20 @@
![WUFFS Logo](./doc/logo/wuffs-acronym-logo-1536x1024.png)
Wuffs (Wrangling Untrusted File Formats Safely) is [formerly known as
Puffs](https://groups.google.com/d/topic/puffslang/ZX-ymyf8xh0/discussion)
(Parsing Untrusted File Formats Safely).
Wuffs is a **memory-safe programming language** (and a **standard library**
written in that language) for wrangling **untrusted file formats** safely.
written in that language) for **Wrangling Untrusted File Formats Safely**.
Wrangling includes parsing, decoding and encoding. Example file formats include
images, audio, video, fonts and compressed archives.
It is also **fast**. On many of its GIF decoding
[benchmarks](/doc/benchmarks.md), Wuffs measures **2x faster than "giflib" (C),
3x faster than "image/gif" (Go) and 7x faster than "gif" (Rust)**.
It is **fast**. Per its [benchmarks](/doc/benchmarks.md) and other docs:
- It can decode bzip2 **[1.3x faster than `/usr/bin/bzcat`
(C)](https://nigeltao.github.io/blog/2022/wuffs-bzip2-decoder.html)**.
- It can decode deflate up to **1.4x faster [than zlib-the-library (C)**.
- It can decode GIF **2x-6x faster than "giflib" (C), "image/gif" (Go) and
"gif" (Rust)**.
- It can decode PNG **[1.2x-2.7x faster than "libpng"
(C)](https://nigeltao.github.io/blog/2021/fastest-safest-png-decoder.html),
"image/png" (Go) and "png" (Rust)**.
## Goals and Non-Goals
@@ -44,11 +47,21 @@ the increment would otherwise overflow. Similarly, an integer arithmetic
expression like `x / y` is a compile time error unless the compiler can also
prove that `y` is not zero.
## Hermeticity
Wuffs is not a general purpose programming language. **It is for writing
libraries, not programs**. The idea isn't to write your whole program in Wuffs,
only the **parts that are both performance-conscious and security-conscious**.
For example, while technically possible, it is unlikely that a Wuffs compiler
would be worth writing entirely in Wuffs.
libraries, not programs**. Wuffs code is [hermetic](/doc/note/hermeticity.md)
and can only compute (e.g. convert "compressed bytes" to "decompressed bytes").
**It cannot make any syscalls** (e.g. it has no ambient authority to read your
files), implying that it cannot allocate or free memory (and is therefore
trivially safe against things like memory leaks, use-after-frees and
double-frees).
The idea isn't to write your whole program in Wuffs, **only the parts that are
both performance-conscious and security-conscious**. For example, while
technically possible, it is unlikely that a Wuffs compiler would be worth
writing entirely in Wuffs.
## What Does Wuffs Code Look Like?
@@ -187,12 +200,16 @@ The [Note](/doc/note) directory also contains various short articles.
# Status
Version 0.2. The API and ABI aren't stabilized yet. The compiler undoubtedly
Version 0.3. The API and ABI aren't stabilized yet. The compiler undoubtedly
has bugs. Assertion checking needs more rigor, especially around side effects
and aliasing, and being sufficiently well specified to allow alternative
implementations. Lots of detail needs work, but the broad brushstrokes are
there.
Nonetheless, Wuffs' GIF decoder has shipped in the Google Chrome web browser
[since June
2021](https://chromium-review.googlesource.com/c/chromium/src/+/2940044).
# Discussion
@@ -223,4 +240,4 @@ owned by Google.
---
Updated on December 2019.
Updated on January 2023.
+2 -2
View File
@@ -28,8 +28,8 @@ LDFLAGS=${LDFLAGS:-}
# The "-fdata-sections -ffunction-sections -Wl,--gc-sections" produces smaller
# binaries. See commit 41fce8a8 "Strip examples of unused data and functions".
CFLAGS=${CFLAGS:--O3 -fdata-sections -ffunction-sections -Wl,--gc-sections}
CXXFLAGS=${CXXFLAGS:--O3 -fdata-sections -ffunction-sections -Wl,--gc-sections}
CFLAGS=${CFLAGS:--O3 -fdata-sections -ffunction-sections -Wall -Wl,--gc-sections}
CXXFLAGS=${CXXFLAGS:--O3 -fdata-sections -ffunction-sections -Wall -Wl,--gc-sections}
mkdir -p gen/bin
+14 -14
View File
@@ -35,20 +35,20 @@
// To quantify "much faster", on this one C file, this program was 80 times
// faster than `clang-format`, even without a column limit:
//
// $ wc release/c/wuffs-v0.2.c
// 11858 35980 431885 release/c/wuffs-v0.2.c
// $ time dumbindent < release/c/wuffs-v0.2.c > /dev/null
// real 0m0.008s
// user 0m0.005s
// sys 0m0.005s
// $ time clang-format-9 < release/c/wuffs-v0.2.c > /dev/null
// real 0m0.668s
// user 0m0.618s
// sys 0m0.032s
// $ time clang-format-9 -style='{ColumnLimit: 0}' < release/c/wuffs-v0.2.c > /dev/null
// real 0m0.641s
// user 0m0.585s
// sys 0m0.037s
// $ wc release/c/wuffs-v0.2.c
// 11858 35980 431885 release/c/wuffs-v0.2.c
// $ time dumbindent < release/c/wuffs-v0.2.c > /dev/null
// real 0m0.008s
// user 0m0.005s
// sys 0m0.005s
// $ time clang-format-9 < release/c/wuffs-v0.2.c > /dev/null
// real 0m0.668s
// user 0m0.618s
// sys 0m0.032s
// $ time clang-format-9 -style='{ColumnLimit: 0}' < release/c/wuffs-v0.2.c > /dev/null
// real 0m0.641s
// user 0m0.585s
// sys 0m0.037s
//
// More commentary is at:
// https://godoc.org/github.com/google/wuffs/lib/dumbindent
+137 -137
View File
@@ -33,7 +33,7 @@ https://github.com/google/wuffs/blob/main/doc/spec/rac-spec.md
Usage:
ractool [flags] [input_filename]
ractool [flags] [input_filename]
If no input_filename is given, stdin is used. Either way, output is written to
stdout.
@@ -63,10 +63,10 @@ or temporary disk space.
Examples:
ractool -decode foo.rac | sha256sum
ractool -decode -drange=400..500 foo.rac
ractool -encode foo.dat > foo.rac
ractool -encode -codec=zlib -dchunksize=256k foo.dat > foo.rac
ractool -decode foo.rac | sha256sum
ractool -decode -drange=400..500 foo.rac
ractool -encode foo.dat > foo.rac
ractool -encode -codec=zlib -dchunksize=256k foo.dat > foo.rac
The "400..500" flag value means the 100 bytes ranging from a DSpace offset
(offset in terms of decompressed bytes, not compressed bytes) of 400
@@ -79,42 +79,42 @@ Similarly, "1m" and "1M" both mean 1 mebibyte (1048576 bytes).
General Flags:
-decode
whether to decode the input
-encode
whether to encode the input
-quiet
whether to suppress messages
-decode
whether to decode the input
-encode
whether to encode the input
-quiet
whether to suppress messages
Decode-Related Flags:
-drange
the "i..j" range to decompress, "..8" means the first 8 bytes
-singlethreaded
whether to decode on a single execution thread
-drange
the "i..j" range to decompress, "..8" means the first 8 bytes
-singlethreaded
whether to decode on a single execution thread
Encode-Related Flags:
-cchunksize
the chunk size (in CSpace)
-codec
the compression codec (default "zstd")
-cpagesize
the page size (in CSpace)
-dchunksize
the chunk size (in DSpace)
-indexlocation
the index location, "start" or "end" (default "start")
-resources
comma-separated list of resource files, such as shared dictionaries
-tmpdir
directory (e.g. $TMPDIR) for intermediate work; empty means in-memory
-cchunksize
the chunk size (in CSpace)
-codec
the compression codec (default "zstd")
-cpagesize
the page size (in CSpace)
-dchunksize
the chunk size (in DSpace)
-indexlocation
the index location, "start" or "end" (default "start")
-resources
comma-separated list of resource files, such as shared dictionaries
-tmpdir
directory (e.g. $TMPDIR) for intermediate work; empty means in-memory
Codecs:
lz4
zlib
zstd
lz4
zlib
zstd
Only zlib is fully supported. The others will work for the flags' default
values, but they (1) don't support -cchunksize, only -dchunksize, and (2) don't
@@ -125,123 +125,123 @@ Installation:
Like any other implemented-in-Go program, to install the ractool program:
go install github.com/google/wuffs/cmd/ractool
go install github.com/google/wuffs/cmd/ractool
Extended Example:
--------
$ # Fetch and unzip the enwik8 test file, a sample of Wikipedia.
$ wget http://mattmahoney.net/dc/enwik8.zip
$ unzip enwik8.zip
--------
$ # Fetch and unzip the enwik8 test file, a sample of Wikipedia.
$ wget http://mattmahoney.net/dc/enwik8.zip
$ unzip enwik8.zip
$ # Also zstd-encode it, as a reference point. Using compression level 15,
$ # instead of the default of 3, matches what ractool uses.
$ zstd -15 enwik8
$ # Also zstd-encode it, as a reference point. Using compression level 15,
$ # instead of the default of 3, matches what ractool uses.
$ zstd -15 enwik8
$ # Create a shared dictionary. Using zstd-the-program produces a
$ # dictionary that is especially useful for zstd-the-format, but it can
$ # also be used by other formats as a 'raw' prefix dictionary.
$ zstd -15 --train -B64K --maxdict=32K -o dict.dat enwik8
$ # Create a shared dictionary. Using zstd-the-program produces a
$ # dictionary that is especially useful for zstd-the-format, but it can
$ # also be used by other formats as a 'raw' prefix dictionary.
$ zstd -15 --train -B64K --maxdict=32K -o dict.dat enwik8
$ # RAC-encode it with various codecs, with and without that dictionary.
$ ractool -encode -codec=zlib -resources=dict.dat enwik8 > zlib.withdict.rac
$ ractool -encode -codec=zlib enwik8 > zlib.sansdict.rac
$ ractool -encode -codec=zstd -resources=dict.dat enwik8 > zstd.withdict.rac
$ ractool -encode -codec=zstd enwik8 > zstd.sansdict.rac
$ ractool -encode -codec=lz4 enwik8 > lz4.sansdict.rac
$ # RAC-encode it with various codecs, with and without that dictionary.
$ ractool -encode -codec=zlib -resources=dict.dat enwik8 > zlib.withdict.rac
$ ractool -encode -codec=zlib enwik8 > zlib.sansdict.rac
$ ractool -encode -codec=zstd -resources=dict.dat enwik8 > zstd.withdict.rac
$ ractool -encode -codec=zstd enwik8 > zstd.sansdict.rac
$ ractool -encode -codec=lz4 enwik8 > lz4.sansdict.rac
$ # The size overhead (comparing RAC+Xxx to Xxx) is about 0.2% (with) or
$ # 4.8% (sans) for zlib/zip and about 13% (with) or 28% (sans) for zstd,
$ # depending on whether we used a shared dictionary (with or sans).
$ ls -l
total 362080
-rw-r----- 1 tao tao 32768 Oct 25 10:10 dict.dat
-rw-r----- 1 tao tao 100000000 Jun 2 2011 enwik8
-rw-r----- 1 tao tao 36445475 Sep 2 2011 enwik8.zip
-rw-r----- 1 tao tao 29563109 Jun 2 2011 enwik8.zst
-rw-r----- 1 tao tao 58813316 Oct 25 10:17 lz4.sansdict.rac
-rw-r----- 1 tao tao 38185178 Oct 25 10:16 zlib.sansdict.rac
-rw-r----- 1 tao tao 36505786 Oct 25 10:16 zlib.withdict.rac
-rw-r----- 1 tao tao 37820491 Oct 25 10:17 zstd.sansdict.rac
-rw-r----- 1 tao tao 33386395 Oct 25 10:17 zstd.withdict.rac
$ # The size overhead (comparing RAC+Xxx to Xxx) is about 0.2% (with) or
$ # 4.8% (sans) for zlib/zip and about 13% (with) or 28% (sans) for zstd,
$ # depending on whether we used a shared dictionary (with or sans).
$ ls -l
total 362080
-rw-r----- 1 tao tao 32768 Oct 25 10:10 dict.dat
-rw-r----- 1 tao tao 100000000 Jun 2 2011 enwik8
-rw-r----- 1 tao tao 36445475 Sep 2 2011 enwik8.zip
-rw-r----- 1 tao tao 29563109 Jun 2 2011 enwik8.zst
-rw-r----- 1 tao tao 58813316 Oct 25 10:17 lz4.sansdict.rac
-rw-r----- 1 tao tao 38185178 Oct 25 10:16 zlib.sansdict.rac
-rw-r----- 1 tao tao 36505786 Oct 25 10:16 zlib.withdict.rac
-rw-r----- 1 tao tao 37820491 Oct 25 10:17 zstd.sansdict.rac
-rw-r----- 1 tao tao 33386395 Oct 25 10:17 zstd.withdict.rac
$ # Check that the decompressed forms all match.
$ cat enwik8 | sha256sum
2b49720ec4d78c3c9fabaee6e4179a5e997302b3a70029f30f2d582218c024a8 -
$ unzip -p enwik8.zip | sha256sum
2b49720ec4d78c3c9fabaee6e4179a5e997302b3a70029f30f2d582218c024a8 -
$ unzstd --stdout enwik8.zst | sha256sum
2b49720ec4d78c3c9fabaee6e4179a5e997302b3a70029f30f2d582218c024a8 -
$ for f in *.rac; do ractool -decode $f | sha256sum; done
2b49720ec4d78c3c9fabaee6e4179a5e997302b3a70029f30f2d582218c024a8 -
2b49720ec4d78c3c9fabaee6e4179a5e997302b3a70029f30f2d582218c024a8 -
2b49720ec4d78c3c9fabaee6e4179a5e997302b3a70029f30f2d582218c024a8 -
2b49720ec4d78c3c9fabaee6e4179a5e997302b3a70029f30f2d582218c024a8 -
2b49720ec4d78c3c9fabaee6e4179a5e997302b3a70029f30f2d582218c024a8 -
$ # Check that the decompressed forms all match.
$ cat enwik8 | sha256sum
2b49720ec4d78c3c9fabaee6e4179a5e997302b3a70029f30f2d582218c024a8 -
$ unzip -p enwik8.zip | sha256sum
2b49720ec4d78c3c9fabaee6e4179a5e997302b3a70029f30f2d582218c024a8 -
$ unzstd --stdout enwik8.zst | sha256sum
2b49720ec4d78c3c9fabaee6e4179a5e997302b3a70029f30f2d582218c024a8 -
$ for f in *.rac; do ractool -decode $f | sha256sum; done
2b49720ec4d78c3c9fabaee6e4179a5e997302b3a70029f30f2d582218c024a8 -
2b49720ec4d78c3c9fabaee6e4179a5e997302b3a70029f30f2d582218c024a8 -
2b49720ec4d78c3c9fabaee6e4179a5e997302b3a70029f30f2d582218c024a8 -
2b49720ec4d78c3c9fabaee6e4179a5e997302b3a70029f30f2d582218c024a8 -
2b49720ec4d78c3c9fabaee6e4179a5e997302b3a70029f30f2d582218c024a8 -
$ # Compare how long it takes to produce 8 bytes from the middle of
$ # the decompressed file, which happens to be the word "Business".
$ time unzip -p enwik8.zip | dd if=/dev/stdin status=none \
> iflag=skip_bytes,count_bytes skip=50000000 count=8
Business
real 0m0.379s
user 0m0.410s
sys 0m0.080s
$ time unzstd --stdout enwik8.zst | dd if=/dev/stdin status=none \
> iflag=skip_bytes,count_bytes skip=50000000 count=8
Business
real 0m0.172s
user 0m0.141s
sys 0m0.103s
$ time ractool -decode -drange=50000000..50000008 zstd.withdict.rac
Business
real 0m0.004s
user 0m0.005s
sys 0m0.001s
$ # Compare how long it takes to produce 8 bytes from the middle of
$ # the decompressed file, which happens to be the word "Business".
$ time unzip -p enwik8.zip | dd if=/dev/stdin status=none \
> iflag=skip_bytes,count_bytes skip=50000000 count=8
Business
real 0m0.379s
user 0m0.410s
sys 0m0.080s
$ time unzstd --stdout enwik8.zst | dd if=/dev/stdin status=none \
> iflag=skip_bytes,count_bytes skip=50000000 count=8
Business
real 0m0.172s
user 0m0.141s
sys 0m0.103s
$ time ractool -decode -drange=50000000..50000008 zstd.withdict.rac
Business
real 0m0.004s
user 0m0.005s
sys 0m0.001s
$ # A RAC file's chunks can be decoded in parallel, unlike ZIP,
$ # substantially reducing the real (wall clock) time taken even
$ # though both of these files use DEFLATE (RFC 1951) compression.
$ #
$ # Comparing the -singlethreaded time suggests that zlib-the-library's
$ # DEFLATE implementation is faster than unzip's.
$ time unzip -p enwik8.zip > /dev/null
real 0m0.711s
user 0m0.690s
sys 0m0.021s
$ time ractool -decode -singlethreaded zlib.withdict.rac > /dev/null
real 0m0.519s
user 0m0.513s
sys 0m0.017s
$ time ractool -decode zlib.withdict.rac > /dev/null
real 0m0.052s
user 0m0.678s
sys 0m0.036s
$ # A RAC file's chunks can be decoded in parallel, unlike ZIP,
$ # substantially reducing the real (wall clock) time taken even
$ # though both of these files use DEFLATE (RFC 1951) compression.
$ #
$ # Comparing the -singlethreaded time suggests that zlib-the-library's
$ # DEFLATE implementation is faster than unzip's.
$ time unzip -p enwik8.zip > /dev/null
real 0m0.711s
user 0m0.690s
sys 0m0.021s
$ time ractool -decode -singlethreaded zlib.withdict.rac > /dev/null
real 0m0.519s
user 0m0.513s
sys 0m0.017s
$ time ractool -decode zlib.withdict.rac > /dev/null
real 0m0.052s
user 0m0.678s
sys 0m0.036s
$ # A similar comparison can be made for Zstandard.
$ time unzstd --stdout enwik8.zst > /dev/null
real 0m0.203s
user 0m0.187s
sys 0m0.016s
$ time ractool -decode -singlethreaded zstd.withdict.rac > /dev/null
real 0m0.235s
user 0m0.206s
sys 0m0.033s
$ time ractool -decode zstd.withdict.rac > /dev/null
real 0m0.037s
user 0m0.374s
sys 0m0.080s
$ # A similar comparison can be made for Zstandard.
$ time unzstd --stdout enwik8.zst > /dev/null
real 0m0.203s
user 0m0.187s
sys 0m0.016s
$ time ractool -decode -singlethreaded zstd.withdict.rac > /dev/null
real 0m0.235s
user 0m0.206s
sys 0m0.033s
$ time ractool -decode zstd.withdict.rac > /dev/null
real 0m0.037s
user 0m0.374s
sys 0m0.080s
$ # For reference, LZ4 numbers.
$ time ractool -decode -singlethreaded lz4.sansdict.rac > /dev/null
real 0m0.072s
user 0m0.053s
sys 0m0.021s
$ time ractool -decode lz4.sansdict.rac > /dev/null
real 0m0.024s
user 0m0.097s
sys 0m0.034s
--------
$ # For reference, LZ4 numbers.
$ time ractool -decode -singlethreaded lz4.sansdict.rac > /dev/null
real 0m0.072s
user 0m0.053s
sys 0m0.021s
$ time ractool -decode lz4.sansdict.rac > /dev/null
real 0m0.024s
user 0m0.097s
sys 0m0.034s
--------
*/
package main
+262 -204
View File
@@ -5,20 +5,34 @@ below. Higher is better.
"Mimic" tests check that Wuffs' output mimics (i.e. exactly matches) other
libraries' output. "Mimic" benchmarks give the numbers for those other
libraries, as shipped with Debian. These were measured on a Debian Testing
system as of October 2019, which meant these compiler versions:
libraries, as shipped with Debian. These were measured on a Debian Bullseye
system as of September 2022, which meant these compiler versions:
- clang/llvm 8.0.1
- gcc 9.2.1
- clang/llvm 11.0.1
- gcc 10.2.1
and these "mimic" library versions, all written in C:
and these popular "mimic" library versions, all written in C:
- libgif 5.1.4
- zlib 1.2.11
- libbz2 1.0.8
- libgif 5.1.9
- libpng 1.6.37
- zlib 1.2.11 (we'll call this "ztl" or "zlib the library", as opposed to "zlib
the format")
Unless otherwise stated, the numbers below were measured on an Intel x86\_64
Broadwell, and were taken as of Wuffs git commit ffdce5ef "Have bench-rust-gif
process animated / RGBA images".
and these alternative "mimic" library versions, again all written in C:
- [libdeflate](https://github.com/ebiggers/libdeflate) 1.7.1
- [libspng](https://github.com/randy408/libspng) 0.7.3
- [lodepng](https://github.com/lvandeve/lodepng) 20220717
- [miniz](https://github.com/richgel999/miniz) 2.2.0
- [stb](https://github.com/nothings/stb) 2.27
Unless otherwise stated, the numbers below were taken as of Wuffs git commit
315b2e52 "wuffs gen -version=0.3.0-rc.1", the first Wuffs v0.3 release
candidate. As for the CPU model:
$ cat /proc/cpuinfo | grep model.name | uniq
model name: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
## Reproducing
@@ -89,65 +103,110 @@ power management can be controlled with:
The `1k`, `10k`, etc. numbers are approximately how many bytes are hashed.
name speed vs_mimic
name speed vs_mimic
wuffs_adler32_10k/clang8 2.41GB/s 0.84x
wuffs_adler32_100k/clang8 2.42GB/s 0.84x
wuffs_adler32_10k/clang11 22.3 GB/s 6.4x
wuffs_adler32_100k/clang11 26.4 GB/s 7.5x
wuffs_adler32_10k/gcc9 3.24GB/s 1.13x
wuffs_adler32_100k/gcc9 3.24GB/s 1.12x
wuffs_adler32_10k/gcc10 21.9 GB/s 6.3x
wuffs_adler32_100k/gcc10 22.4 GB/s 6.4x
mimic_adler32_10k 2.87GB/s 1.00x
mimic_adler32_100k 2.90GB/s 1.00x
mimicztl_adler32_10k 3.50 GB/s 1.0x
mimicztl_adler32_100k 3.52 GB/s 1.0x
mimiclibdeflate_adler32_10k 50.4 GB/s 14.4x
mimiclibdeflate_adler32_100k 49.4 GB/s 14.0x
# Bzip2
The `1k`, `10k`, etc. numbers are approximately how many bytes there are in the
decoded output.
name speed vs_mimic
wuffs_bzip2_decode_10k/clang11 63.0 MB/s 1.86x
wuffs_bzip2_decode_100k/clang11 48.9 MB/s 1.62x
wuffs_bzip2_decode_10k/gcc10 61.1 MB/s 1.81x
wuffs_bzip2_decode_100k/gcc10 49.1 MB/s 1.62x
mimic_bzip2_decode_10k 33.8 MB/s 1.00x
mimic_bzip2_decode_100k 30.2 MB/s 1.00x
# CRC-32
The `1k`, `10k`, etc. numbers are approximately how many bytes are hashed.
name speed vs_mimic
name speed vs_mimic
wuffs_crc32_ieee_10k/clang8 2.85GB/s 2.11x
wuffs_crc32_ieee_100k/clang8 2.87GB/s 2.13x
wuffs_crc32_ieee_10k/clang11 14.7 GB/s 9.1x
wuffs_crc32_ieee_100k/clang11 21.6 GB/s 13.3x
wuffs_crc32_ieee_10k/gcc9 3.38GB/s 2.50x
wuffs_crc32_ieee_100k/gcc9 3.40GB/s 2.52x
wuffs_crc32_ieee_10k/gcc10 14.9 GB/s 9.2x
wuffs_crc32_ieee_100k/gcc10 23.8 GB/s 14.7x
mimic_crc32_ieee_10k 1.35GB/s 1.00x
mimic_crc32_ieee_100k 1.35GB/s 1.00x
mimicztl_crc32_ieee_10k 1.62 GB/s 1.0x
mimicztl_crc32_ieee_100k 1.62 GB/s 1.0x
mimiclibdeflate_crc32_ieee_10k 24.6 GB/s 15.2x
mimiclibdeflate_crc32_ieee_100k 25.4 GB/s 15.7x
# Deflate
The `1k`, `10k`, etc. numbers are approximately how many bytes there in the
The `1k`, `10k`, etc. numbers are approximately how many bytes there are in the
decoded output.
The `full_init` vs `part_init` suffixes are whether
[`WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED`](/doc/note/initialization.md#partial-zero-initialization)
is unset or set.
name speed vs_mimic
name speed vs_mimic
wuffs_deflate_decode_1k_full_init/clang8 160MB/s 0.74x
wuffs_deflate_decode_1k_part_init/clang8 199MB/s 0.92x
wuffs_deflate_decode_10k_full_init/clang8 255MB/s 0.94x
wuffs_deflate_decode_10k_part_init/clang8 263MB/s 0.97x
wuffs_deflate_decode_100k_just_one_read/clang8 306MB/s 0.93x
wuffs_deflate_decode_100k_many_big_reads/clang8 250MB/s 0.98x
wuffs_deflate_decode_1k_full_init/clang11 195 MB/s 0.81x
wuffs_deflate_decode_1k_part_init/clang11 226 MB/s 0.93x
wuffs_deflate_decode_10k_full_init/clang11 409 MB/s 1.41x
wuffs_deflate_decode_10k_part_init/clang11 418 MB/s 1.47x
wuffs_deflate_decode_100k_just_one_read/clang11 521 MB/s 1.48x
wuffs_deflate_decode_100k_many_big_reads/clang11 330 MB/s 1.19x
wuffs_deflate_decode_1k_full_init/gcc9 164MB/s 0.76x
wuffs_deflate_decode_1k_part_init/gcc9 207MB/s 0.95x
wuffs_deflate_decode_10k_full_init/gcc9 247MB/s 0.91x
wuffs_deflate_decode_10k_part_init/gcc9 254MB/s 0.94x
wuffs_deflate_decode_100k_just_one_read/gcc9 333MB/s 1.01x
wuffs_deflate_decode_100k_many_big_reads/gcc9 261MB/s 1.02x
wuffs_deflate_decode_1k_full_init/gcc10 183 MB/s 0.76x
wuffs_deflate_decode_1k_part_init/gcc10 217 MB/s 0.90x
wuffs_deflate_decode_10k_full_init/gcc10 402 MB/s 1.39x
wuffs_deflate_decode_10k_part_init/gcc10 414 MB/s 1.43x
wuffs_deflate_decode_100k_just_one_read/gcc10 522 MB/s 1.48x
wuffs_deflate_decode_100k_many_big_reads/gcc10 330 MB/s 1.19x
mimic_deflate_decode_1k 217MB/s 1.00x
mimic_deflate_decode_10k 270MB/s 1.00x
mimic_deflate_decode_100k_just_one_read 329MB/s 1.00x
mimic_deflate_decode_100k_many_big_reads 256MB/s 1.00x
mimicztl_deflate_decode_1k_full_init 241 MB/s 1.00x
mimicztl_deflate_decode_10k_full_init 289 MB/s 1.00x
mimicztl_deflate_decode_100k_just_one_read 352 MB/s 1.00x
mimicztl_deflate_decode_100k_many_big_reads 277 MB/s 1.00x
32-bit ARMv7 (2012 era Samsung Exynos 5 Chromebook), Debian Stretch (2017):
mimiclibdeflate_deflate_decode_1k_full_init 326 MB/s 1.35x
mimiclibdeflate_deflate_decode_10k_full_init 503 MB/s 1.74x
mimiclibdeflate_deflate_decode_100k_just_one_read 507 MB/s 1.44x
mimicminiz_deflate_decode_1k_full_init 204 MB/s 0.85x
mimicminiz_deflate_decode_10k_full_init 252 MB/s 0.87x
mimicminiz_deflate_decode_100k_just_one_read 287 MB/s 0.82x
go_deflate_decode_1k_full_init 71 MB/s 0.29x
go_deflate_decode_10k_full_init 120 MB/s 0.42x
go_deflate_decode_100k_just_one_read 135 MB/s 0.38x
rust_deflate_decode_1k_full_init 165 MB/s 0.68x
rust_deflate_decode_10k_full_init 259 MB/s 0.90x
rust_deflate_decode_100k_just_one_read 272 MB/s 0.77x
To reproduce the libdeflate or miniz numbers, look in
`test/c/mimiclib/deflate-gzip-zlib.c`. For Go 1.19, run `go run main.go` in
`script/bench-go-deflate`. For Rust 1.48 / flate2 1.0.24 / miniz\_oxide 0.5.3,
run `cargo run --release` in `script/bench-rust-deflate`.
Historical (Wuffs v0.2; 2019) numbers for 32-bit ARMv7 (2012 era Samsung Exynos
5 Chromebook), Debian Stretch (2017):
name speed vs_mimic
@@ -171,63 +230,6 @@ is unset or set.
mimic_deflate_decode_100k_many_big_reads 90.0MB/s 1.00x
## Deflate (C, miniz)
For comparison, here are [miniz](https://github.com/richgel999/miniz) 2.1.0's
numbers.
name speed vs_mimic
miniz_deflate_decode_1k/clang8 174MB/s 0.80x
miniz_deflate_decode_10k/clang8 245MB/s 0.91x
miniz_deflate_decode_100k_just_one_read/clang8 309MB/s 0.94x
miniz_deflate_decode_1k/gcc9 158MB/s 0.73x
miniz_deflate_decode_10k/gcc9 221MB/s 0.82x
miniz_deflate_decode_100k_just_one_read/gcc9 250MB/s 0.76x
To reproduce these numbers, look in `test/c/mimiclib/deflate-gzip-zlib.c`.
## Deflate (Go)
For comparison, here are Go 1.12.10's numbers, using Go's standard library's
`compress/flate` package.
name speed vs_mimic
go_deflate_decode_1k 45.4MB/s 0.21x
go_deflate_decode_10k 82.5MB/s 0.31x
go_deflate_decode_100k 94.0MB/s 0.29x
To reproduce these numbers:
git clone https://github.com/google/wuffs.git
cd wuffs/script/bench-go-deflate/
go run main.go
## Deflate (Rust)
For comparison, here are Rust 1.37.0's numbers, using the
[alexcrichton/flate2-rs](https://github.com/alexcrichton/flate2-rs) and
[Frommi/miniz_oxide](https://github.com/Frommi/miniz_oxide) crates, which [this
file](https://github.com/sile/libflate/blob/77a1004edf6518a0badab7ce8837bc5338ff9bc3/README.md#an-informal-benchmark)
suggests is the fastest pure-Rust Deflate decoder.
name speed vs_mimic
rust_deflate_decode_1k 104MB/s 0.48x
rust_deflate_decode_10k 202MB/s 0.75x
rust_deflate_decode_100k 218MB/s 0.66x
To reproduce these numbers:
git clone https://github.com/google/wuffs.git
cd wuffs/script/bench-rust-deflate/
cargo run --release
# GIF
The `1k`, `10k`, etc. numbers are approximately how many pixels there are in
@@ -245,42 +247,67 @@ is unset or set.
The libgif library doesn't export any API for decode-to-BGRA or decode-to-RGBA,
so there are no mimic numbers to compare to for the `bgra` suffix.
name speed vs_mimic
name speed vs_mimic
wuffs_gif_decode_1k_bw/clang8 461MB/s 3.18x
wuffs_gif_decode_1k_color_full_init/clang8 141MB/s 1.85x
wuffs_gif_decode_1k_color_part_init/clang8 189MB/s 2.48x
wuffs_gif_decode_10k_bgra/clang8 743MB/s n/a
wuffs_gif_decode_10k_indexed/clang8 200MB/s 2.11x
wuffs_gif_decode_20k/clang8 245MB/s 2.50x
wuffs_gif_decode_100k_artificial/clang8 531MB/s 3.43x
wuffs_gif_decode_100k_realistic/clang8 218MB/s 2.27x
wuffs_gif_decode_1000k_full_init/clang8 221MB/s 2.25x
wuffs_gif_decode_1000k_part_init/clang8 221MB/s 2.25x
wuffs_gif_decode_anim_screencap/clang8 1.07GB/s 6.01x
wuffs_gif_decode_1k_bw/clang11 758 MB/s 4.38x
wuffs_gif_decode_1k_color_full_init/clang11 176 MB/s 1.96x
wuffs_gif_decode_1k_color_part_init/clang11 213 MB/s 2.37x
wuffs_gif_decode_10k_bgra/clang11 786 MB/s n/a
wuffs_gif_decode_10k_indexed/clang11 208 MB/s 1.98x
wuffs_gif_decode_20k/clang11 262 MB/s 2.47x
wuffs_gif_decode_100k_artificial/clang11 580 MB/s 3.52x
wuffs_gif_decode_100k_realistic/clang11 225 MB/s 2.18x
wuffs_gif_decode_1000k_full_init/clang11 229 MB/s 2.16x
wuffs_gif_decode_1000k_part_init/clang11 229 MB/s 2.16x
wuffs_gif_decode_anim_screencap/clang11 1.31 GB/s 6.58x
wuffs_gif_decode_1k_bw/gcc9 478MB/s 3.30x
wuffs_gif_decode_1k_color_full_init/gcc9 148MB/s 1.94x
wuffs_gif_decode_1k_color_part_init/gcc9 194MB/s 2.54x
wuffs_gif_decode_10k_bgra/gcc9 645MB/s n/a
wuffs_gif_decode_10k_indexed/gcc9 203MB/s 2.14x
wuffs_gif_decode_20k/gcc9 244MB/s 2.49x
wuffs_gif_decode_100k_artificial/gcc9 532MB/s 3.43x
wuffs_gif_decode_100k_realistic/gcc9 214MB/s 2.23x
wuffs_gif_decode_1000k_full_init/gcc9 217MB/s 2.21x
wuffs_gif_decode_1000k_part_init/gcc9 218MB/s 2.22x
wuffs_gif_decode_anim_screencap/gcc9 1.11GB/s 6.24x
wuffs_gif_decode_1k_bw/gcc10 659 MB/s 3.80x
wuffs_gif_decode_1k_color_full_init/gcc10 175 MB/s 1.94x
wuffs_gif_decode_1k_color_part_init/gcc10 202 MB/s 2.24x
wuffs_gif_decode_10k_bgra/gcc10 768 MB/s n/a
wuffs_gif_decode_10k_indexed/gcc10 202 MB/s 1.92x
wuffs_gif_decode_20k/gcc10 250 MB/s 2.36x
wuffs_gif_decode_100k_artificial/gcc10 564 MB/s 3.42x
wuffs_gif_decode_100k_realistic/gcc10 217 MB/s 2.11x
wuffs_gif_decode_1000k_full_init/gcc10 221 MB/s 2.08x
wuffs_gif_decode_1000k_part_init/gcc10 221 MB/s 2.08x
wuffs_gif_decode_anim_screencap/gcc10 1.31 GB/s 6.58x
mimic_gif_decode_1k_bw 145MB/s 1.00x
mimic_gif_decode_1k_color 76.3MB/s 1.00x
mimic_gif_decode_10k_indexed 94.9MB/s 1.00x
mimic_gif_decode_20k 98.1MB/s 1.00x
mimic_gif_decode_100k_artificial 155MB/s 1.00x
mimic_gif_decode_100k_realistic 96.1MB/s 1.00x
mimic_gif_decode_1000k 98.4MB/s 1.00x
mimic_gif_decode_anim_screencap 178MB/s 1.00x
mimic_gif_decode_1k_bw 173 MB/s 1.00x
mimic_gif_decode_1k_color_full_init 90 MB/s 1.00x
mimic_gif_decode_10k_indexed 105 MB/s 1.00x
mimic_gif_decode_20k 106 MB/s 1.00x
mimic_gif_decode_100k_artificial 165 MB/s 1.00x
mimic_gif_decode_100k_realistic 103 MB/s 1.00x
mimic_gif_decode_1000k_full_init 106 MB/s 1.00x
mimic_gif_decode_anim_screencap 199 MB/s 1.00x
32-bit ARMv7 (2012 era Samsung Exynos 5 Chromebook), Debian Stretch (2017):
go_gif_decode_1k_bw 167 MB/s 0.97x
go_gif_decode_1k_color_full_init 63 MB/s 0.70x
go_gif_decode_10k_bgra 216 MB/s n/a
go_gif_decode_10k_indexed 92 MB/s 0.88x
go_gif_decode_20k 102 MB/s 0.96x
go_gif_decode_100k_artificial 202 MB/s 1.22x
go_gif_decode_100k_realistic 102 MB/s 0.99x
go_gif_decode_1000k_full_init 103 MB/s 0.97x
go_gif_decode_anim_screencap 237 MB/s 1.19x
rust_gif_decode_1k_bw 362 MB/s 2.09x
rust_gif_decode_1k_color_full_init 113 MB/s 1.26x
rust_gif_decode_10k_bgra 333 MB/s n/a
rust_gif_decode_10k_indexed 101 MB/s 0.96x
rust_gif_decode_20k 119 MB/s 1.12x
rust_gif_decode_100k_artificial 248 MB/s 1.50x
rust_gif_decode_100k_realistic 113 MB/s 1.10x
rust_gif_decode_1000k_full_init 115 MB/s 1.08x
rust_gif_decode_anim_screencap 513 MB/s 2.58x
To reproduce the Go 1.19 numbers, run `go run main.go` in
`script/bench-go-gif`. For Rust 1.48 / gif 0.11.4, run `cargo run --release` in
`script/bench-rust-gif`.
Historical (Wuffs v0.2; 2019) numbers for 32-bit ARMv7 (2012 era Samsung Exynos
5 Chromebook), Debian Stretch (2017):
name speed vs_mimic
@@ -318,106 +345,137 @@ so there are no mimic numbers to compare to for the `bgra` suffix.
mimic_gif_decode_anim_screencap 60.3MB/s 1.00x
## GIF (Go)
For comparison, here are Go 1.12.10's numbers, using Go's standard library's
`image/gif` package.
name speed vs_mimic
go_gif_decode_1k_bw 107MB/s 0.74x
go_gif_decode_1k_color 39.2MB/s 0.51x
go_gif_decode_10k_bgra 117MB/s n/a
go_gif_decode_10k_indexed 57.8MB/s 0.61x
go_gif_decode_20k 67.2MB/s 0.69x
go_gif_decode_100k_artificial 151MB/s 0.97x
go_gif_decode_100k_realistic 67.2MB/s 0.70x
go_gif_decode_1000k 68.1MB/s 0.69x
go_gif_decode_anim_screencap 206MB/s 1.16x
To reproduce these numbers:
git clone https://github.com/google/wuffs.git
cd wuffs/script/bench-go-gif/
go run main.go
## GIF (Rust)
For comparison, here are Rust 1.37.0's numbers, using the
[image-rs/image-gif](https://github.com/image-rs/image-gif) crate, easily the
top `crates.io` result for ["gif"](https://crates.io/search?q=gif).
name speed vs_mimic
rust_gif_decode_1k_bw 89.2MB/s 0.62x
rust_gif_decode_1k_color 20.7MB/s 0.27x
rust_gif_decode_10k_bgra 74.5MB/s n/a
rust_gif_decode_10k_indexed 20.4MB/s 0.21x
rust_gif_decode_20k 28.9MB/s 0.29x
rust_gif_decode_100k_artificial 79.1MB/s 0.51x
rust_gif_decode_100k_realistic 27.9MB/s 0.29x
rust_gif_decode_1000k 27.9MB/s 0.28x
rust_gif_decode_anim_screencap 144MB/s 0.81x
To reproduce these numbers:
git clone https://github.com/google/wuffs.git
cd wuffs/script/bench-rust-gif/
cargo run --release
# Gzip (Deflate + CRC-32)
The `1k`, `10k`, etc. numbers are approximately how many bytes there in the
The `1k`, `10k`, etc. numbers are approximately how many bytes there are in the
decoded output.
name speed vs_mimic
name speed vs_mimic
wuffs_gzip_decode_10k/clang8 238MB/s 1.05x
wuffs_gzip_decode_100k/clang8 273MB/s 1.03x
wuffs_gzip_decode_10k/clang11 420 MB/s 1.71x
wuffs_gzip_decode_100k/clang11 527 MB/s 1.81x
wuffs_gzip_decode_10k/gcc9 239MB/s 1.06x
wuffs_gzip_decode_100k/gcc9 297MB/s 1.12x
wuffs_gzip_decode_10k/gcc10 427 MB/s 1.74x
wuffs_gzip_decode_100k/gcc10 550 MB/s 1.89x
mimic_gzip_decode_10k 226MB/s 1.00x
mimic_gzip_decode_100k 265MB/s 1.00x
mimicztl_gzip_decode_10k 246 MB/s 1.00x
mimicztl_gzip_decode_100k 291 MB/s 1.00x
mimiclibdeflate_gzip_decode_10k 494 MB/s 2.01x
mimiclibdeflate_gzip_decode_100k 496 MB/s 1.70x
# LZW
The `1k`, `10k`, etc. numbers are approximately how many bytes there in the
The `1k`, `10k`, etc. numbers are approximately how many bytes there are in the
decoded output.
The libgif library doesn't export its LZW decoder in its API, so there are no
mimic numbers to compare to.
name speed vs_mimic
name speed vs_mimic
wuffs_lzw_decode_20k/clang8 263MB/s n/a
wuffs_lzw_decode_100k/clang8 438MB/s n/a
wuffs_lzw_decode_20k/clang11 293 MB/s n/a
wuffs_lzw_decode_100k/clang11 489 MB/s n/a
wuffs_lzw_decode_20k/gcc9 266MB/s n/a
wuffs_lzw_decode_100k/gcc9 450MB/s n/a
wuffs_lzw_decode_20k/gcc10 259 MB/s n/a
wuffs_lzw_decode_100k/gcc10 516 MB/s n/a
# PNG
The `1k`, `10k`, etc. numbers are approximately how many bytes there are in the
decoded image. For example, the `test/data/harvesters.*` images are 1165 × 859,
approximately 1000k pixels and hence 4000k bytes at 4 bytes per pixel.
The `full_init` vs `part_init` suffixes are whether
[`WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED`](/doc/note/initialization.md#partial-zero-initialization)
is unset or set.
libpng's "simplified API" doesn't provide a way to ignore the checksum. We copy
the `verify_checksum` numbers for a 1.00x baseline.
name speed vs_mimic
wuffs_png_decode_image_19k_8bpp/clang11 279 MB/s 2.29x
wuffs_png_decode_image_40k_24bpp/clang11 323 MB/s 2.20x
wuffs_png_decode_image_77k_8bpp/clang11 984 MB/s 2.66x
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang11 871 MB/s 3.01x
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang11 837 MB/s 2.90x
wuffs_png_decode_image_4002k_24bpp/clang11 331 MB/s 1.55x
wuffs_png_decode_image_19k_8bpp/gcc10 277 MB/s 2.27x
wuffs_png_decode_image_40k_24bpp/gcc10 343 MB/s 2.33x
wuffs_png_decode_image_77k_8bpp/gcc10 1.00 GB/s 2.70x
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10 914 MB/s 3.16x
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10 870 MB/s 3.01x
wuffs_png_decode_image_4002k_24bpp/gcc10 353 MB/s 1.65x
mimiclibpng_png_decode_image_19k_8bpp 122 MB/s 1.00x
mimiclibpng_png_decode_image_40k_24bpp 147 MB/s 1.00x
mimiclibpng_png_decode_image_77k_8bpp 370 MB/s 1.00x
mimiclibpng_png_decode_image_552k_32bpp_verify_checksum 289 MB/s 1.00x
mimiclibpng_png_decode_image_4002k_24bpp 214 MB/s 1.00x
mimiclibspng_png_decode_image_19k_8bpp 125 MB/s 1.02x
mimiclibspng_png_decode_image_40k_24bpp 155 MB/s 1.05x
mimiclibspng_png_decode_image_77k_8bpp 384 MB/s 1.04x
mimiclibspng_png_decode_image_552k_32bpp_ignore_checksum 461 MB/s 1.60x
mimiclibspng_png_decode_image_552k_32bpp_verify_checksum 392 MB/s 1.36x
mimiclibspng_png_decode_image_4002k_24bpp 225 MB/s 1.05x
mimiclodepng_png_decode_image_19k_8bpp 138 MB/s 1.13x
mimiclodepng_png_decode_image_40k_24bpp 166 MB/s 1.13x
mimiclodepng_png_decode_image_77k_8bpp 404 MB/s 1.09x
mimiclodepng_png_decode_image_552k_32bpp_verify_checksum 258 MB/s 0.89x
mimiclodepng_png_decode_image_4002k_24bpp 165 MB/s 0.77x
mimicstb_png_decode_image_19k_8bpp 150 MB/s 1.23x
mimicstb_png_decode_image_40k_24bpp 166 MB/s 1.13x
mimicstb_png_decode_image_77k_8bpp 443 MB/s 1.20x
mimicstb_png_decode_image_552k_32bpp_ignore_checksum 288 MB/s 1.00x
mimicstb_png_decode_image_4002k_24bpp 163 MB/s 0.76x
go_png_decode_image_19k_8bpp 92 MB/s 0.75x
go_png_decode_image_40k_24bpp 107 MB/s 0.73x
go_png_decode_image_77k_8bpp 207 MB/s 0.56x
go_png_decode_image_552k_32bpp_verify_checksum 246 MB/s 0.85x
go_png_decode_image_4002k_24bpp 116 MB/s 0.54x
rust_png_decode_image_19k_8bpp 187 MB/s 1.53x
rust_png_decode_image_40k_24bpp 260 MB/s 1.77x
rust_png_decode_image_77k_8bpp 330 MB/s 0.89x
rust_png_decode_image_552k_32bpp_verify_checksum 299 MB/s 1.03x
rust_png_decode_image_4002k_24bpp 264 MB/s 1.23x
To reproduce the Go 1.19 numbers, run `go run main.go` in
`script/bench-go-png`. For Rust 1.48 / png 0.17.5 / deflate 1.0.0 /
miniz\_oxide 0.5.3, run `cargo run --release` in `script/bench-rust-png`.
# Zlib (Deflate + Adler-32)
The `1k`, `10k`, etc. numbers are approximately how many bytes there in the
The `1k`, `10k`, etc. numbers are approximately how many bytes there are in the
decoded output.
name speed vs_mimic
name speed vs_mimic
wuffs_zlib_decode_10k/clang8 237MB/s 0.96x
wuffs_zlib_decode_100k/clang8 272MB/s 0.92x
wuffs_zlib_decode_10k/clang11 410 MB/s 1.53x
wuffs_zlib_decode_100k/clang11 505 MB/s 1.56x
wuffs_zlib_decode_10k/gcc9 242MB/s 0.98x
wuffs_zlib_decode_100k/gcc9 294MB/s 0.99x
wuffs_zlib_decode_10k/gcc10 431 MB/s 1.61x
wuffs_zlib_decode_100k/gcc10 548 MB/s 1.70x
mimic_zlib_decode_10k 247MB/s 1.00x
mimic_zlib_decode_100k 296MB/s 1.00x
mimicztl_zlib_decode_10k 268 MB/s 1.00x
mimicztl_zlib_decode_100k 323 MB/s 1.00x
mimiclibdeflate_zlib_decode_10k 497 MB/s 1.85x
mimiclibdeflate_zlib_decode_100k 499 MB/s 1.54x
mimicminiz_zlib_decode_10k 237 MB/s 0.88x
mimicminiz_zlib_decode_100k 272 MB/s 0.84x
---
Updated on December 2019.
Updated on September 2022.
+107 -47
View File
@@ -3,68 +3,128 @@
Binary size measurements of `wuffs genlib` libraries on x86\_64 are below.
Lower is better.
clang8-dynamic:
-rwxr-xr-x 1 tao tao 90488 Oct 19 05:34 libwuffs.so
-rw-r--r-- 1 tao tao 7096 Oct 19 05:34 wuffs-base.lo
-rw-r--r-- 1 tao tao 2192 Oct 19 05:34 wuffs-std-adler32.lo
-rw-r--r-- 1 tao tao 19296 Oct 19 05:34 wuffs-std-crc32.lo
-rw-r--r-- 1 tao tao 20568 Oct 19 05:34 wuffs-std-deflate.lo
-rw-r--r-- 1 tao tao 26720 Oct 19 05:34 wuffs-std-gif.lo
-rw-r--r-- 1 tao tao 6592 Oct 19 05:34 wuffs-std-gzip.lo
-rw-r--r-- 1 tao tao 5808 Oct 19 05:34 wuffs-std-lzw.lo
-rw-r--r-- 1 tao tao 6584 Oct 19 05:34 wuffs-std-zlib.lo
clang11-dynamic:
-rwxr-xr-x 1 tao tao 322264 Jan 26 15:33 libwuffs.so
-rw-r--r-- 1 tao tao 5232 Jan 26 15:32 wuffs-base-core.lo
-rw-r--r-- 1 tao tao 26976 Jan 26 15:32 wuffs-base-floatconv.lo
-rw-r--r-- 1 tao tao 9312 Jan 26 15:32 wuffs-base-intconv.lo
-rw-r--r-- 1 tao tao 7920 Jan 26 15:33 wuffs-base-interfaces.lo
-rw-r--r-- 1 tao tao 3216 Jan 26 15:33 wuffs-base-magic.lo
-rw-r--r-- 1 tao tao 56192 Jan 26 15:33 wuffs-base-pixconv.lo
-rw-r--r-- 1 tao tao 3080 Jan 26 15:33 wuffs-base-utf8.lo
-rw-r--r-- 1 tao tao 4056 Jan 26 15:33 wuffs-std-adler32.lo
-rw-r--r-- 1 tao tao 28600 Jan 26 15:33 wuffs-std-bmp.lo
-rw-r--r-- 1 tao tao 17304 Jan 26 15:33 wuffs-std-bzip2.lo
-rw-r--r-- 1 tao tao 10168 Jan 26 15:33 wuffs-std-cbor.lo
-rw-r--r-- 1 tao tao 22336 Jan 26 15:33 wuffs-std-crc32.lo
-rw-r--r-- 1 tao tao 24816 Jan 26 15:33 wuffs-std-deflate.lo
-rw-r--r-- 1 tao tao 25088 Jan 26 15:33 wuffs-std-gif.lo
-rw-r--r-- 1 tao tao 7408 Jan 26 15:33 wuffs-std-gzip.lo
-rw-r--r-- 1 tao tao 20136 Jan 26 15:33 wuffs-std-json.lo
-rw-r--r-- 1 tao tao 6344 Jan 26 15:33 wuffs-std-lzw.lo
-rw-r--r-- 1 tao tao 9928 Jan 26 15:33 wuffs-std-nie.lo
-rw-r--r-- 1 tao tao 54760 Jan 26 15:33 wuffs-std-png.lo
-rw-r--r-- 1 tao tao 14552 Jan 26 15:33 wuffs-std-tga.lo
-rw-r--r-- 1 tao tao 9080 Jan 26 15:33 wuffs-std-wbmp.lo
-rw-r--r-- 1 tao tao 7224 Jan 26 15:33 wuffs-std-zlib.lo
clang8-static:
-rw-r--r-- 1 tao tao 101560 Oct 19 05:34 libwuffs.a
-rw-r--r-- 1 tao tao 7176 Oct 19 05:34 wuffs-base.o
-rw-r--r-- 1 tao tao 2176 Oct 19 05:34 wuffs-std-adler32.o
-rw-r--r-- 1 tao tao 20296 Oct 19 05:34 wuffs-std-crc32.o
-rw-r--r-- 1 tao tao 20432 Oct 19 05:34 wuffs-std-deflate.o
-rw-r--r-- 1 tao tao 26856 Oct 19 05:34 wuffs-std-gif.o
-rw-r--r-- 1 tao tao 6840 Oct 19 05:34 wuffs-std-gzip.o
-rw-r--r-- 1 tao tao 5776 Oct 19 05:34 wuffs-std-lzw.o
-rw-r--r-- 1 tao tao 6608 Oct 19 05:34 wuffs-std-zlib.o
clang11-static:
-rw-r--r-- 1 tao tao 398014 Jan 26 15:32 libwuffs.a
-rw-r--r-- 1 tao tao 5232 Jan 26 15:32 wuffs-base-core.o
-rw-r--r-- 1 tao tao 27136 Jan 26 15:32 wuffs-base-floatconv.o
-rw-r--r-- 1 tao tao 9912 Jan 26 15:32 wuffs-base-intconv.o
-rw-r--r-- 1 tao tao 7856 Jan 26 15:32 wuffs-base-interfaces.o
-rw-r--r-- 1 tao tao 3112 Jan 26 15:32 wuffs-base-magic.o
-rw-r--r-- 1 tao tao 59000 Jan 26 15:32 wuffs-base-pixconv.o
-rw-r--r-- 1 tao tao 3080 Jan 26 15:32 wuffs-base-utf8.o
-rw-r--r-- 1 tao tao 4088 Jan 26 15:32 wuffs-std-adler32.o
-rw-r--r-- 1 tao tao 29384 Jan 26 15:32 wuffs-std-bmp.o
-rw-r--r-- 1 tao tao 16784 Jan 26 15:32 wuffs-std-bzip2.o
-rw-r--r-- 1 tao tao 10304 Jan 26 15:32 wuffs-std-cbor.o
-rw-r--r-- 1 tao tao 23352 Jan 26 15:32 wuffs-std-crc32.o
-rw-r--r-- 1 tao tao 25344 Jan 26 15:32 wuffs-std-deflate.o
-rw-r--r-- 1 tao tao 25608 Jan 26 15:32 wuffs-std-gif.o
-rw-r--r-- 1 tao tao 7000 Jan 26 15:32 wuffs-std-gzip.o
-rw-r--r-- 1 tao tao 21000 Jan 26 15:32 wuffs-std-json.o
-rw-r--r-- 1 tao tao 6272 Jan 26 15:32 wuffs-std-lzw.o
-rw-r--r-- 1 tao tao 9840 Jan 26 15:32 wuffs-std-nie.o
-rw-r--r-- 1 tao tao 56560 Jan 26 15:32 wuffs-std-png.o
-rw-r--r-- 1 tao tao 14720 Jan 26 15:32 wuffs-std-tga.o
-rw-r--r-- 1 tao tao 8984 Jan 26 15:32 wuffs-std-wbmp.o
-rw-r--r-- 1 tao tao 7064 Jan 26 15:32 wuffs-std-zlib.o
gcc9-dynamic:
-rwxr-xr-x 1 tao tao 94464 Oct 19 05:34 libwuffs.so
-rw-r--r-- 1 tao tao 9784 Oct 19 05:34 wuffs-base.lo
-rw-r--r-- 1 tao tao 2512 Oct 19 05:34 wuffs-std-adler32.lo
-rw-r--r-- 1 tao tao 19568 Oct 19 05:34 wuffs-std-crc32.lo
-rw-r--r-- 1 tao tao 20752 Oct 19 05:34 wuffs-std-deflate.lo
-rw-r--r-- 1 tao tao 27936 Oct 19 05:34 wuffs-std-gif.lo
-rw-r--r-- 1 tao tao 7232 Oct 19 05:34 wuffs-std-gzip.lo
-rw-r--r-- 1 tao tao 6552 Oct 19 05:34 wuffs-std-lzw.lo
-rw-r--r-- 1 tao tao 7360 Oct 19 05:34 wuffs-std-zlib.lo
gcc10-dynamic:
-rwxr-xr-x 1 tao tao 388712 Jan 26 15:33 libwuffs.so
-rw-r--r-- 1 tao tao 5632 Jan 26 15:33 wuffs-base-core.lo
-rw-r--r-- 1 tao tao 26904 Jan 26 15:33 wuffs-base-floatconv.lo
-rw-r--r-- 1 tao tao 8584 Jan 26 15:33 wuffs-base-intconv.lo
-rw-r--r-- 1 tao tao 7664 Jan 26 15:33 wuffs-base-interfaces.lo
-rw-r--r-- 1 tao tao 4448 Jan 26 15:33 wuffs-base-magic.lo
-rw-r--r-- 1 tao tao 109488 Jan 26 15:33 wuffs-base-pixconv.lo
-rw-r--r-- 1 tao tao 3248 Jan 26 15:33 wuffs-base-utf8.lo
-rw-r--r-- 1 tao tao 4624 Jan 26 15:33 wuffs-std-adler32.lo
-rw-r--r-- 1 tao tao 28984 Jan 26 15:33 wuffs-std-bmp.lo
-rw-r--r-- 1 tao tao 18920 Jan 26 15:33 wuffs-std-bzip2.lo
-rw-r--r-- 1 tao tao 10040 Jan 26 15:33 wuffs-std-cbor.lo
-rw-r--r-- 1 tao tao 23056 Jan 26 15:33 wuffs-std-crc32.lo
-rw-r--r-- 1 tao tao 24264 Jan 26 15:33 wuffs-std-deflate.lo
-rw-r--r-- 1 tao tao 29808 Jan 26 15:33 wuffs-std-gif.lo
-rw-r--r-- 1 tao tao 8328 Jan 26 15:33 wuffs-std-gzip.lo
-rw-r--r-- 1 tao tao 20128 Jan 26 15:33 wuffs-std-json.lo
-rw-r--r-- 1 tao tao 7128 Jan 26 15:33 wuffs-std-lzw.lo
-rw-r--r-- 1 tao tao 11960 Jan 26 15:33 wuffs-std-nie.lo
-rw-r--r-- 1 tao tao 68440 Jan 26 15:33 wuffs-std-png.lo
-rw-r--r-- 1 tao tao 15736 Jan 26 15:33 wuffs-std-tga.lo
-rw-r--r-- 1 tao tao 10440 Jan 26 15:33 wuffs-std-wbmp.lo
-rw-r--r-- 1 tao tao 7744 Jan 26 15:33 wuffs-std-zlib.lo
gcc9-static:
-rw-r--r-- 1 tao tao 106120 Oct 19 05:34 libwuffs.a
-rw-r--r-- 1 tao tao 9784 Oct 19 05:34 wuffs-base.o
-rw-r--r-- 1 tao tao 2448 Oct 19 05:34 wuffs-std-adler32.o
-rw-r--r-- 1 tao tao 19488 Oct 19 05:34 wuffs-std-crc32.o
-rw-r--r-- 1 tao tao 20632 Oct 19 05:34 wuffs-std-deflate.o
-rw-r--r-- 1 tao tao 27528 Oct 19 05:34 wuffs-std-gif.o
-rw-r--r-- 1 tao tao 7144 Oct 19 05:34 wuffs-std-gzip.o
-rw-r--r-- 1 tao tao 6448 Oct 19 05:34 wuffs-std-lzw.o
-rw-r--r-- 1 tao tao 7248 Oct 19 05:34 wuffs-std-zlib.o
gcc10-static:
-rw-r--r-- 1 tao tao 480206 Jan 26 15:33 libwuffs.a
-rw-r--r-- 1 tao tao 5632 Jan 26 15:33 wuffs-base-core.o
-rw-r--r-- 1 tao tao 27008 Jan 26 15:33 wuffs-base-floatconv.o
-rw-r--r-- 1 tao tao 8768 Jan 26 15:33 wuffs-base-intconv.o
-rw-r--r-- 1 tao tao 7560 Jan 26 15:33 wuffs-base-interfaces.o
-rw-r--r-- 1 tao tao 4448 Jan 26 15:33 wuffs-base-magic.o
-rw-r--r-- 1 tao tao 109408 Jan 26 15:33 wuffs-base-pixconv.o
-rw-r--r-- 1 tao tao 3824 Jan 26 15:33 wuffs-base-utf8.o
-rw-r--r-- 1 tao tao 4680 Jan 26 15:33 wuffs-std-adler32.o
-rw-r--r-- 1 tao tao 29512 Jan 26 15:33 wuffs-std-bmp.o
-rw-r--r-- 1 tao tao 19000 Jan 26 15:33 wuffs-std-bzip2.o
-rw-r--r-- 1 tao tao 10400 Jan 26 15:33 wuffs-std-cbor.o
-rw-r--r-- 1 tao tao 23112 Jan 26 15:33 wuffs-std-crc32.o
-rw-r--r-- 1 tao tao 24936 Jan 26 15:33 wuffs-std-deflate.o
-rw-r--r-- 1 tao tao 30232 Jan 26 15:33 wuffs-std-gif.o
-rw-r--r-- 1 tao tao 8424 Jan 26 15:33 wuffs-std-gzip.o
-rw-r--r-- 1 tao tao 21456 Jan 26 15:33 wuffs-std-json.o
-rw-r--r-- 1 tao tao 7144 Jan 26 15:33 wuffs-std-lzw.o
-rw-r--r-- 1 tao tao 12168 Jan 26 15:33 wuffs-std-nie.o
-rw-r--r-- 1 tao tao 71504 Jan 26 15:33 wuffs-std-png.o
-rw-r--r-- 1 tao tao 16184 Jan 26 15:33 wuffs-std-tga.o
-rw-r--r-- 1 tao tao 10520 Jan 26 15:33 wuffs-std-wbmp.o
-rw-r--r-- 1 tao tao 7904 Jan 26 15:33 wuffs-std-zlib.o
## Comparison
Below are some standard C libraries shipped as part of Debian Testing as of
October 2019. The numbers aren't directly comparable, as these libraries have a
Below are some standard C libraries shipped as part of Debian 11 Bullseye as of
January 2023. The numbers aren't directly comparable, as these libraries have a
richer API, especially in providing an encoder and not just a decoder. Still,
it is a reference point for e.g. Wuffs (adler32 + crc32 + deflate + gzip +
zlib) vs libz and Wuffs (gif + lzw) vs libgif.
dynamic:
-rw-r--r-- 1 root root 113088 Aug 6 16:44 /lib/x86_64-linux-gnu/libz.so.1.2.11
-rw-r--r-- 1 root root 34656 Jun 5 2018 /usr/lib/x86_64-linux-gnu/libgif.so.7.0.0
-rw-r--r-- 1 root root 74688 Jul 20 2020 /lib/x86_64-linux-gnu/libbz2.so.1.0.4
-rw-r--r-- 1 root root 38752 Dec 21 2020 /lib/x86_64-linux-gnu/libgif.so.7.1.0
-rw-r--r-- 1 root root 231344 Sep 16 2020 /lib/x86_64-linux-gnu/libpng16.so.16.37.0
-rw-r--r-- 1 root root 113088 Aug 24 04:54 /lib/x86_64-linux-gnu/libz.so.1.2.11
static:
-rw-r--r-- 1 root root 50800 Jun 5 2018 /usr/lib/x86_64-linux-gnu/libgif.a
-rw-r--r-- 1 root root 143250 Aug 6 16:44 /usr/lib/x86_64-linux-gnu/libz.a
-rw-r--r-- 1 root root 80690 Jul 20 2020 /lib/x86_64-linux-gnu/libbz2.a
-rw-r--r-- 1 root root 51940 Dec 21 2020 /lib/x86_64-linux-gnu/libgif.a
-rw-r--r-- 1 root root 374338 Sep 16 2020 /lib/x86_64-linux-gnu/libpng16.a
-rw-r--r-- 1 root root 144866 Aug 24 04:54 /lib/x86_64-linux-gnu/libz.a
---
Updated on October 2019.
Updated on January 2023.
+12 -3
View File
@@ -1,7 +1,16 @@
# Changelog
## Work In Progress
## 2023-01-26 version 0.3.0
The headline feature is that we have a production quality PNG decoder. It's
also [the fastest, safest PNG decoder in the
world](https://nigeltao.github.io/blog/2021/fastest-safest-png-decoder.html).
There's also a [memory-safe, zero-allocation JSON
decoder](https://nigeltao.github.io/blog/2020/jsonptr.html).
The dot points below probably aren't of interest unless you're upgrading from
Wuffs version 0.2.
- Added `0b` prefixed binary numbers.
- Added `WUFFS_BASE__PIXEL_BLEND__SRC_OVER`.
@@ -14,6 +23,7 @@
- Added `cpu_arch`.
- Added `doc/logo`.
- Added `endwhile` syntax.
- Added `example/bzcat`.
- Added `example/cbor-to-json`.
- Added `example/convert-to-nia`.
- Added `example/imageviewer`.
@@ -37,7 +47,6 @@
- Added double-curly blocks.
- Added interfaces.
- Added iterate advance parameter.
- Added preprocessor.
- Added single-quoted strings.
- Added slice `uintptr_low_12_bits` method.
- Added tokens.
@@ -156,4 +165,4 @@ Wuffs version 0.1.
---
Updated on January 2020.
Updated on January 2023.
+1 -4
View File
@@ -2,11 +2,8 @@
Short term:
- [Image decode API for color spaces and gamma
correction.](https://github.com/google/wuffs/issues/39)
- [Image decode API for Region of
Interest.](https://github.com/google/wuffs/issues/40)
- [Decode APNG.](https://github.com/google/wuffs/issues/41)
- [Decode JPEG.](https://github.com/google/wuffs/issues/42)
- [Decode LZ4.](https://github.com/google/wuffs/issues/43)
- [Decode RAC.](https://github.com/google/wuffs/issues/22)
@@ -41,4 +38,4 @@ Long term:
---
Updated on March 2021.
Updated on October 2022.
+1 -1
View File
@@ -78,7 +78,7 @@ for a C compiler $CC, such as clang or gcc.
#endif
#define WORK_BUFFER_ARRAY_SIZE \
WUFFS_GZIP__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE
WUFFS_BZIP2__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE
uint8_t g_dst_buffer_array[DST_BUFFER_ARRAY_SIZE];
uint8_t g_src_buffer_array[SRC_BUFFER_ARRAY_SIZE];
+6 -4
View File
@@ -385,10 +385,8 @@ flush_dst() {
if (n == 0) {
break;
}
ssize_t i = fwrite(g_dst.reader_pointer(), 1, n, stdout);
if (i >= 0) {
g_dst.meta.ri += i;
}
size_t i = fwrite(g_dst.reader_pointer(), 1, n, stdout);
g_dst.meta.ri += i;
if (i < n) {
return "main: error writing to stdout";
}
@@ -788,6 +786,10 @@ compute_exit_code(std::string status_msg) {
// (other non-zero exit codes). Specifically, exit code 2 for internal
// invariant violation, exit code 139 (which is 128 + SIGSEGV on x86_64
// linux) for a segmentation fault (e.g. null pointer dereference).
size_t i = status_msg.find('=');
if (i != std::string::npos) {
status_msg = status_msg.substr(0, i);
}
return (status_msg.find("internal error:") != std::string::npos) ? 2 : 1;
}
+6 -4
View File
@@ -215,10 +215,8 @@ flush_dst() {
if (n == 0) {
break;
}
ssize_t i = fwrite(g_dst.reader_pointer(), 1, n, stdout);
if (i >= 0) {
g_dst.meta.ri += i;
}
size_t i = fwrite(g_dst.reader_pointer(), 1, n, stdout);
g_dst.meta.ri += i;
if (i < n) {
return "main: error writing to stdout";
}
@@ -383,6 +381,10 @@ compute_exit_code(std::string status_msg) {
// (other non-zero exit codes). Specifically, exit code 2 for internal
// invariant violation, exit code 139 (which is 128 + SIGSEGV on x86_64
// linux) for a segmentation fault (e.g. null pointer dereference).
size_t i = status_msg.find('=');
if (i != std::string::npos) {
status_msg = status_msg.substr(0, i);
}
return (status_msg.find("internal error:") != std::string::npos) ? 2 : 1;
}
+5 -1
View File
@@ -479,7 +479,7 @@ class Callbacks : public wuffs_aux::DecodeJsonCallbacks {
top.has_map_key = false;
auto iter = jmap.find(top.map_key);
if (iter != jmap.end()) {
return "main: duplicate key: " + top.map_key;
return "main: duplicate key: key=" + top.map_key;
}
jmap.insert(iter, JsonMap::value_type(std::move(top.map_key),
std::move(jvalue)));
@@ -593,6 +593,10 @@ compute_exit_code(std::string status_msg) {
// (other non-zero exit codes). Specifically, exit code 2 for internal
// invariant violation, exit code 139 (which is 128 + SIGSEGV on x86_64
// linux) for a segmentation fault (e.g. null pointer dereference).
size_t i = status_msg.find('=');
if (i != std::string::npos) {
status_msg = status_msg.substr(0, i);
}
return (status_msg.find("internal error:") != std::string::npos) ? 2 : 1;
}
+16 -10
View File
@@ -76,15 +76,16 @@ const (
//
// At the start of a function, these pointers are initialized from an
// io_buffer's fields (ptr, ri, wi, len). For an io_reader:
// - io0_etc = ptr
// - io1_etc = ptr + ri
// - iop_etc = ptr + ri
// - io2_etc = ptr + wi
// - io0_etc = ptr
// - io1_etc = ptr + ri
// - iop_etc = ptr + ri
// - io2_etc = ptr + wi
//
// and for an io_writer:
// - io0_etc = ptr
// - io1_etc = ptr + wi
// - iop_etc = ptr + wi
// - io2_etc = ptr + len
// - io0_etc = ptr
// - io1_etc = ptr + wi
// - iop_etc = ptr + wi
// - io2_etc = ptr + len
const (
io0Prefix = "io0_" // Base.
io1Prefix = "io1_" // Lower bound.
@@ -674,6 +675,7 @@ func (g *gen) genIncludes(b *buffer) error {
b.writes("#if defined(WUFFS_IMPLEMENTATION) && !defined(WUFFS_CONFIG__MODULES)\n")
b.writes("#define WUFFS_CONFIG__MODULES\n")
b.printf("#define WUFFS_CONFIG__MODULE__%s\n", g.PKGNAME)
b.writes("#define WUFFS_NONMONOLITHIC\n")
b.writes("#endif\n\n")
usesList := []string(nil)
@@ -709,7 +711,10 @@ func (g *gen) genIncludes(b *buffer) error {
}
func (g *gen) genHeader(b *buffer) error {
b.writes("\n")
module := "!defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__" + g.PKGNAME +
") || defined(WUFFS_NONMONOLITHIC)"
b.printf("#if %s\n\n", module)
b.writes("// ---------------- Status Codes\n\n")
wroteStatus := false
@@ -813,6 +818,7 @@ func (g *gen) genHeader(b *buffer) error {
}
b.writes("#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)\n\n")
b.printf("#endif // %s\n", module)
return nil
}
@@ -872,7 +878,7 @@ func (g *gen) genImpl(b *buffer) error {
return err
}
b.printf("#endif // %s\n\n", module)
b.printf("#endif // %s\n", module)
return nil
}
+3 -3
View File
@@ -125,7 +125,7 @@ func (g *gen) writeInitialLoadDerivedVar(b *buffer, n *a.Field) error {
b.printf("%s%s* %s%s WUFFS_BASE__POTENTIALLY_UNUSED = NULL;\n", c, elem, io1Prefix, preName)
b.printf("%s%s* %s%s WUFFS_BASE__POTENTIALLY_UNUSED = NULL;\n", c, elem, io2Prefix, preName)
b.printf("if (%s) {\n", preName)
b.printf("if (%s && %s->data.ptr) {\n", preName, preName)
b.printf("%s%s = %s->data.ptr;\n", io0Prefix, preName, preName)
b.printf("%s%s = %s%s + %s->%s;\n", io1Prefix, preName, io0Prefix, preName, preName, i1)
@@ -149,8 +149,8 @@ func (g *gen) writeFinalSaveDerivedVar(b *buffer, n *a.Field) error {
}
preName := aPrefix + n.Name().Str(g.tm)
b.printf("if (%s) {\n%s->%s = ((size_t)(%s%s - %s->data.ptr));\n}\n",
preName, preName, i1, iopPrefix, preName, preName)
b.printf("if (%s && %s->data.ptr) {\n%s->%s = ((size_t)(%s%s - %s->data.ptr));\n}\n",
preName, preName, preName, i1, iopPrefix, preName, preName)
return nil
}
+82 -82
View File
@@ -328,12 +328,12 @@ func (n *Raw) SetPackage(tm *t.Map, pkg t.ID) error {
const MaxExprDepth = 255
// Expr is an expression, such as "i", "+j" or "k + l[m(n, o)].p":
// - ID0: <0|operator|IDOpenParen|IDOpenBracket|IDDotDot|IDDot>
// - ID2: <0|literal|ident>
// - LHS: <nil|Expr>
// - MHS: <nil|Expr>
// - RHS: <nil|Expr|TypeExpr>
// - List0: <Arg|Expr> function call args, assoc. op args or list members.
// - ID0: <0|operator|IDOpenParen|IDOpenBracket|IDDotDot|IDDot>
// - ID2: <0|literal|ident>
// - LHS: <nil|Expr>
// - MHS: <nil|Expr>
// - RHS: <nil|Expr|TypeExpr>
// - List0: <Arg|Expr> function call args, assoc. op args or list members.
//
// A zero ID0 means an identifier or literal in ID2, like `foo`, `42` or a
// status literal like `"#foo"`.
@@ -468,10 +468,10 @@ func NewExpr(flags Flags, operator t.ID, ident t.ID, lhs *Node, mhs *Node, rhs *
// Assert is "assert RHS via ID2(args)", "choose etc", "pre etc", "inv etc" or
// "post etc":
// - ID0: <IDAssert|IDChoose|IDPre|IDInv|IDPost>
// - ID2: <"-string literal> reason
// - RHS: <Expr>
// - List0: <Arg> reason arguments
// - ID0: <IDAssert|IDChoose|IDPre|IDInv|IDPost>
// - ID2: <"-string literal> reason
// - RHS: <Expr>
// - List0: <Arg> reason arguments
type Assert Node
func (n *Assert) AsNode() *Node { return (*Node)(n) }
@@ -513,8 +513,8 @@ func NewAssert(keyword t.ID, condition *Expr, reason t.ID, args []*Node) *Assert
}
// Arg is "name:value".
// - ID2: <ident> name
// - RHS: <Expr> value
// - ID2: <ident> name
// - RHS: <Expr> value
type Arg Node
func (n *Arg) AsNode() *Node { return (*Node)(n) }
@@ -530,9 +530,9 @@ func NewArg(name t.ID, value *Expr) *Arg {
}
// Assign is "LHS = RHS" or "LHS op= RHS" or "RHS":
// - ID0: operator
// - LHS: <nil|Expr>
// - RHS: <Expr>
// - ID0: operator
// - LHS: <nil|Expr>
// - RHS: <Expr>
type Assign Node
func (n *Assign) AsNode() *Node { return (*Node)(n) }
@@ -550,8 +550,8 @@ func NewAssign(operator t.ID, lhs *Expr, rhs *Expr) *Assign {
}
// Var is "var ID2 LHS":
// - ID2: name
// - LHS: <TypeExpr>
// - ID2: name
// - LHS: <TypeExpr>
type Var Node
func (n *Var) AsNode() *Node { return (*Node)(n) }
@@ -569,9 +569,9 @@ func NewVar(name t.ID, xType *TypeExpr) *Var {
}
// Field is a "name : type" struct field:
// - FlagsPrivateData is the initializer need not explicitly memset to zero.
// - ID2: name
// - LHS: <TypeExpr>
// - FlagsPrivateData is the initializer need not explicitly memset to zero.
// - ID2: name
// - LHS: <TypeExpr>
type Field Node
func (n *Field) AsNode() *Node { return (*Node)(n) }
@@ -590,11 +590,11 @@ func NewField(flags Flags, name t.ID, xType *TypeExpr) *Field {
// IOManip is "io_bind (io:LHS, data:MHS, history_position:RHS) { List2 }" or
// "io_limit (io:LHS, limit:MHS) { List2 }":
// - ID0: <IDIOBind|IDIOLimit>
// - LHS: <Expr>
// - MHS: <Expr>
// - RHS: <Expr>
// - List2: <Statement> body
// - ID0: <IDIOBind|IDIOLimit>
// - LHS: <Expr>
// - MHS: <Expr>
// - RHS: <Expr>
// - List2: <Statement> body
type IOManip Node
func (n *IOManip) AsNode() *Node { return (*Node)(n) }
@@ -617,16 +617,16 @@ func NewIOManip(keyword t.ID, io *Expr, arg1 *Expr, historyPosition *Expr, body
// Iterate is
// "iterate.ID1 (assigns)(length:ID2, advance:ID0, unroll:LHS), List1 { List2 } else RHS":
// - FlagsHasBreak is the iterate has an explicit break
// - FlagsHasContinue is the iterate has an explicit continue
// - ID0: advance
// - ID1: <0|label>
// - ID2: length
// - LHS: <Expr> unroll
// - RHS: <nil|Iterate>
// - List0: <Assign> assigns
// - List1: <Assert> asserts
// - List2: <Statement> body
// - FlagsHasBreak is the iterate has an explicit break
// - FlagsHasContinue is the iterate has an explicit continue
// - ID0: advance
// - ID1: <0|label>
// - ID2: length
// - LHS: <Expr> unroll
// - RHS: <nil|Iterate>
// - List0: <Assign> assigns
// - List1: <Assert> asserts
// - List2: <Statement> body
type Iterate Node
func (n *Iterate) AsNode() *Node { return (*Node)(n) }
@@ -661,12 +661,12 @@ func NewIterate(label t.ID, assigns []*Node, length t.ID, advance t.ID, unroll t
}
// While is "while.ID1 MHS, List1 { List2 } endwhile.ID1":
// - FlagsHasBreak is the while has an explicit break
// - FlagsHasContinue is the while has an explicit continue
// - ID1: <0|label>
// - MHS: <Expr>
// - List1: <Assert> asserts
// - List2: <Statement> body
// - FlagsHasBreak is the while has an explicit break
// - FlagsHasContinue is the while has an explicit continue
// - ID1: <0|label>
// - MHS: <Expr>
// - List1: <Assert> asserts
// - List2: <Statement> body
//
// TODO: should we be able to unroll while loops too?
type While Node
@@ -699,10 +699,10 @@ func NewWhile(label t.ID, condition *Expr, asserts []*Node) *While {
}
// If is "if MHS { List2 } else RHS" or "if MHS { List2 } else { List1 }":
// - MHS: <Expr>
// - RHS: <nil|If>
// - List1: <Statement> if-false body
// - List2: <Statement> if-true body
// - MHS: <Expr>
// - RHS: <nil|If>
// - List1: <Statement> if-false body
// - List2: <Statement> if-true body
type If Node
func (n *If) AsNode() *Node { return (*Node)(n) }
@@ -722,8 +722,8 @@ func NewIf(condition *Expr, bodyIfTrue []*Node, bodyIfFalse []*Node, elseIf *If)
}
// Choose is "choose ID2: List0":
// - ID2: name
// - List0: <Expr> method names.
// - ID2: name
// - List0: <Expr> method names.
type Choose Node
func (n *Choose) AsNode() *Node { return (*Node)(n) }
@@ -739,9 +739,9 @@ func NewChoose(name t.ID, args []*Node) *Choose {
}
// Ret is "return LHS" or "yield LHS":
// - FlagsReturnsError LHS is an error status
// - ID0: <IDReturn|IDYield>
// - LHS: <Expr>
// - FlagsReturnsError LHS is an error status
// - ID0: <IDReturn|IDYield>
// - LHS: <Expr>
type Ret Node
func (n *Ret) AsNode() *Node { return (*Node)(n) }
@@ -760,8 +760,8 @@ func NewRet(keyword t.ID, value *Expr) *Ret {
}
// Jump is "break" or "continue", with an optional label, "break.label":
// - ID0: <IDBreak|IDContinue>
// - ID1: <0|label>
// - ID0: <IDBreak|IDContinue>
// - ID1: <0|label>
type Jump Node
func (n *Jump) AsNode() *Node { return (*Node)(n) }
@@ -784,12 +784,12 @@ const MaxTypeExprDepth = 63
// TypeExpr is a type expression, such as "base.u32", "base.u32[..= 8]", "foo",
// "pkg.bar", "ptr T", "array[8] T", "slice T" or "table T":
// - ID0: <0|IDArray|IDFunc|IDNptr|IDPtr|IDSlice|IDTable>
// - ID1: <0|pkg>
// - ID2: <0|type name>
// - LHS: <nil|Expr>
// - MHS: <nil|Expr>
// - RHS: <nil|TypeExpr>
// - ID0: <0|IDArray|IDFunc|IDNptr|IDPtr|IDSlice|IDTable>
// - ID1: <0|pkg>
// - ID2: <0|type name>
// - LHS: <nil|Expr>
// - MHS: <nil|Expr>
// - RHS: <nil|TypeExpr>
//
// An IDNptr or IDPtr ID0 means "nptr RHS" or "ptr RHS". RHS is the inner type.
//
@@ -958,14 +958,14 @@ func NewTypeExpr(decorator t.ID, pkg t.ID, name t.ID, alenRecvMin *Node, max *Ex
const MaxBodyDepth = 255
// Func is "func ID2.ID0(LHS)(RHS) { List2 }":
// - FlagsPublic is "pub" vs "pri"
// - ID0: funcName
// - ID1: <0|receiverPkg> (set by calling SetPackage)
// - ID2: <0|receiverName>
// - LHS: <Struct> in-parameters
// - RHS: <Struct> out-parameters
// - List1: <Assert> asserts
// - List2: <Statement> body
// - FlagsPublic is "pub" vs "pri"
// - ID0: funcName
// - ID1: <0|receiverPkg> (set by calling SetPackage)
// - ID2: <0|receiverName>
// - LHS: <Struct> in-parameters
// - RHS: <Struct> out-parameters
// - List1: <Assert> asserts
// - List2: <Statement> body
type Func Node
func (n *Func) AsNode() *Node { return (*Node)(n) }
@@ -1033,9 +1033,9 @@ func NewFunc(flags Flags, filename string, line uint32, receiverName t.ID, funcN
}
// Status is "error (RHS) ID2" or "suspension (RHS) ID2":
// - FlagsPublic is "pub" vs "pri"
// - ID1: <0|pkg> (set by calling SetPackage)
// - ID2: message
// - FlagsPublic is "pub" vs "pri"
// - ID1: <0|pkg> (set by calling SetPackage)
// - ID2: message
type Status Node
func (n *Status) AsNode() *Node { return (*Node)(n) }
@@ -1055,11 +1055,11 @@ func NewStatus(flags Flags, filename string, line uint32, message t.ID) *Status
}
// Const is "const ID2 LHS = RHS":
// - FlagsPublic is "pub" vs "pri"
// - ID1: <0|pkg> (set by calling SetPackage)
// - ID2: name
// - LHS: <TypeExpr>
// - RHS: <Expr>
// - FlagsPublic is "pub" vs "pri"
// - ID1: <0|pkg> (set by calling SetPackage)
// - ID2: name
// - LHS: <TypeExpr>
// - RHS: <Expr>
type Const Node
func (n *Const) AsNode() *Node { return (*Node)(n) }
@@ -1087,12 +1087,12 @@ func NewConst(flags Flags, filename string, line uint32, name t.ID, xType *TypeE
const MaxImplements = 63
// Struct is "struct ID2? implements List0 (List1)":
// - FlagsPublic is "pub" vs "pri"
// - FlagsClassy is "ID2" vs "ID2?"
// - ID1: <0|pkg> (set by calling SetPackage)
// - ID2: name
// - List0: <TypeExpr> implements
// - List1: <Field> fields
// - FlagsPublic is "pub" vs "pri"
// - FlagsClassy is "ID2" vs "ID2?"
// - ID1: <0|pkg> (set by calling SetPackage)
// - ID2: name
// - List0: <TypeExpr> implements
// - List1: <Field> fields
//
// The question mark indicates a classy struct - one that supports methods,
// especially coroutines.
@@ -1120,7 +1120,7 @@ func NewStruct(flags Flags, filename string, line uint32, name t.ID, implements
}
// Use is "use ID2":
// - ID2: <"-string literal> package path
// - ID2: <"-string literal> package path
type Use Node
func (n *Use) AsNode() *Node { return (*Node)(n) }
@@ -1138,7 +1138,7 @@ func NewUse(filename string, line uint32, path t.ID) *Use {
}
// File is a file of source code:
// - List0: <Const|Func|Status|Struct|Use> top-level declarations
// - List0: <Const|Func|Status|Struct|Use> top-level declarations
type File Node
func (n *File) AsNode() *Node { return (*Node)(n) }
+15 -12
View File
@@ -201,16 +201,16 @@ type Token struct {
}
// nBuiltInIDs is the number of built-in IDs. The packing is:
// - 0x00 is invalid.
// - 0x01 ..= 0x0F are squiggly punctuation, such as ";", "." and "?".
// - 0x10 ..= 0x1F are squiggly bookends, such as "(", ")" and "]".
// - 0x20 ..= 0x3F are squiggly assignments, such as "=" and "+=".
// - 0x40 ..= 0x6F are operators, such as "+", "==" and "not".
// - 0x70 ..= 0xAF are x-ops (disambiguation forms): unary vs binary "+".
// - 0xB0 ..= 0xCF are keywords, such as "if" and "return".
// - 0xD0 ..= 0xDF are type modifiers, such as "ptr" and "slice".
// - 0xE0 ..= 0xFF are literals, such as "ok" and "true".
// - 0x100 ..= 0x3FF are identifiers, such as "bool", "u32" and "read_u8".
// - 0x00 is invalid.
// - 0x01 ..= 0x0F are squiggly punctuation, such as ";", "." and "?".
// - 0x10 ..= 0x1F are squiggly bookends, such as "(", ")" and "]".
// - 0x20 ..= 0x3F are squiggly assignments, such as "=" and "+=".
// - 0x40 ..= 0x6F are operators, such as "+", "==" and "not".
// - 0x70 ..= 0xAF are x-ops (disambiguation forms): unary vs binary "+".
// - 0xB0 ..= 0xCF are keywords, such as "if" and "return".
// - 0xD0 ..= 0xDF are type modifiers, such as "ptr" and "slice".
// - 0xE0 ..= 0xFF are literals, such as "ok" and "true".
// - 0x100 ..= 0x3FF are identifiers, such as "bool", "u32" and "read_u8".
//
// Squiggly means a sequence of non-alpha-numeric bytes, such as "+" and "&=".
const (
@@ -1299,9 +1299,12 @@ func init() {
// addXForms modifies table so that, if table[x] == y, then table[y] = y.
//
// For example, for the unaryForms table, the explicit entries are like:
// IDPlus: IDXUnaryPlus,
//
// IDPlus: IDXUnaryPlus,
//
// and this function implicitly addes entries like:
// IDXUnaryPlus: IDXUnaryPlus,
//
// IDXUnaryPlus: IDXUnaryPlus,
func addXForms(table *[nBuiltInSymbolicIDs]ID) {
implicitEntries := [nBuiltInSymbolicIDs]bool{}
for _, y := range table {
+41 -41
View File
@@ -27,57 +27,57 @@
// repository was 80 times faster than `clang-format`, even without a column
// limit:
//
// $ wc release/c/wuffs-v0.2.c
// 11858 35980 431885 release/c/wuffs-v0.2.c
// $ time dumbindent < release/c/wuffs-v0.2.c > /dev/null
// real 0m0.008s
// user 0m0.005s
// sys 0m0.005s
// $ time clang-format-9 < release/c/wuffs-v0.2.c > /dev/null
// real 0m0.668s
// user 0m0.618s
// sys 0m0.032s
// $ time clang-format-9 -style='{ColumnLimit: 0}' < release/c/wuffs-v0.2.c > /dev/null
// real 0m0.641s
// user 0m0.585s
// sys 0m0.037s
// $ wc release/c/wuffs-v0.2.c
// 11858 35980 431885 release/c/wuffs-v0.2.c
// $ time dumbindent < release/c/wuffs-v0.2.c > /dev/null
// real 0m0.008s
// user 0m0.005s
// sys 0m0.005s
// $ time clang-format-9 < release/c/wuffs-v0.2.c > /dev/null
// real 0m0.668s
// user 0m0.618s
// sys 0m0.032s
// $ time clang-format-9 -style='{ColumnLimit: 0}' < release/c/wuffs-v0.2.c > /dev/null
// real 0m0.641s
// user 0m0.585s
// sys 0m0.037s
//
// Apart from some rare and largely uninteresting exceptions, the dumbindent
// algorithm only considers:
//
// ∙ '{' and '}' curly braces,
// ∙ '(' and ')' round parentheses,
// ∙ '\n' line breaks,
// ∙ ' ' spaces and '\t' tabs that start or end a line, and
// ∙ strings, comments and preprocessor directives (in order to ignore any of
// the above special characters within them),
// ∙ '{' and '}' curly braces,
// ∙ '(' and ')' round parentheses,
// ∙ '\n' line breaks,
// ∙ ' ' spaces and '\t' tabs that start or end a line, and
// ∙ strings, comments and preprocessor directives (in order to ignore any of
// the above special characters within them),
//
// Everything else is an opaque byte. Consider this input:
//
// for (i = 0; i < 3; i++) {
// j = 0; // Ignore { in a comment.
// if (i < j) { foo(); }
// u = (v +
// w);
// }
// for (i = 0; i < 3; i++) {
// j = 0; // Ignore { in a comment.
// if (i < j) { foo(); }
// u = (v +
// w);
// }
//
// From the algorithm's point of view, this input is equivalent to:
//
// ....(.................).{
// .................................
// ...(.....).{....()..}
// ....(...
// .);
// }
// ....(.................).{
// .................................
// ...(.....).{....()..}
// ....(...
// .);
// }
//
// The formatted output (using the default of 2 spaces per indent level) is:
//
// ....(.................).{
// .................................
// ...(.....).{....()..}
// ....(...
// .);
// }
// ....(.................).{
// .................................
// ...(.....).{....()..}
// ....(...
// .);
// }
//
// Dumbindent adjusts lines horizontally (indenting) but not vertically (it
// does not break or un-break lines, or collapse consecutive blank lines),
@@ -103,9 +103,9 @@
//
// Similarly, dumbindent will not correct this mis-indentation:
//
// if (condition)
// goto fail;
// goto fail;
// if (condition)
// goto fail;
// goto fail;
//
// Instead, when automatically or manually generating the input for dumbindent,
// it is recommended to always emit curly braces (again, similar to `gofmt`
+14 -14
View File
@@ -130,23 +130,23 @@ func (b *bitstream) take(nBits uint32) int32 {
// 4, 4)" example from RFC 1951 section 3.2.2, the huffman struct is
// initialized by calling:
//
// h.construct([]uint32{
// 'A': 3, 'B': 3, 'C': 3, 'D': 3, 'E': 3, 'F': 2, 'G': 4, 'H': 4,
// })
// h.construct([]uint32{
// 'A': 3, 'B': 3, 'C': 3, 'D': 3, 'E': 3, 'F': 2, 'G': 4, 'H': 4,
// })
//
// which results in:
//
// huffman{
// counts: [maxCodeBits + 1]uint32{
// 2: 1, 3: 5, 4: 2,
// },
// symbols: [maxNumCodes]int32{
// 0: 'F', 1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E', 6: 'G', 7: 'H',
// },
// lookUpTable: [256]uint32{
// etc,
// },
// }
// huffman{
// counts: [maxCodeBits + 1]uint32{
// 2: 1, 3: 5, 4: 2,
// },
// symbols: [maxNumCodes]int32{
// 0: 'F', 1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E', 6: 'G', 7: 'H',
// },
// lookUpTable: [256]uint32{
// etc,
// },
// }
//
// Continuing the example from the RFC, decoding "1110" from the bitstream will
// produce the 'G' symbol.
+31 -28
View File
@@ -1057,18 +1057,19 @@ func orOneNegOneNonNeg(neg IntRange, non IntRange) (z IntRange) {
// possible xx in x and yy in y.
//
// Algorithm:
// // If the two intervals overlap, the result is the minimum of the two
// // intervals' maxima.
// //
// // This overlaps code path is just an optimization.
// if overlaps(x, y) {
// return min(xMax, yMax)
// }
// xFlip = bitFillRight(bitFillRight(xMax & ~xMin) & xMax & ~yMax)
// xResult = yMax & ((xMax & ~xFlip) | (xFlip >> 1))
// yFlip = bitFillRight(bitFillRight(yMax & ~yMin) & yMax & ~xMax)
// yResult = xMax & ((yMax & ~yFlip) | (yFlip >> 1))
// return max(xResult, yResult)
//
// // If the two intervals overlap, the result is the minimum of the two
// // intervals' maxima.
// //
// // This overlaps code path is just an optimization.
// if overlaps(x, y) {
// return min(xMax, yMax)
// }
// xFlip = bitFillRight(bitFillRight(xMax & ~xMin) & xMax & ~yMax)
// xResult = yMax & ((xMax & ~xFlip) | (xFlip >> 1))
// yFlip = bitFillRight(bitFillRight(yMax & ~yMin) & yMax & ~xMax)
// yResult = xMax & ((yMax & ~yFlip) | (yFlip >> 1))
// return max(xResult, yResult)
//
// If xMin and yMin are both zero, the overlaps branch is taken.
//
@@ -1189,13 +1190,15 @@ func (x IntRange) andMax(y IntRange) *big.Int {
// possible xx in x and yy in y.
//
// Algorithm:
// droppable = bitFillRight((xMax & ~xMin) | (yMax & ~yMin))
// available = xMax & yMax & droppable
// return xMax | yMax | (bitFillRight(available) >> 1)
//
// droppable = bitFillRight((xMax & ~xMin) | (yMax & ~yMin))
// available = xMax & yMax & droppable
// return xMax | yMax | (bitFillRight(available) >> 1)
//
// If xMin and yMin are both zero, this simplifies to:
// available = xMax & yMax
// return xMax | yMax | (bitFillRight(available) >> 1)
//
// available = xMax & yMax
// return xMax | yMax | (bitFillRight(available) >> 1)
func (x IntRange) orMax(y IntRange) *big.Int {
if x[0].Sign() == 0 && y[0].Sign() == 0 {
i := big.NewInt(0)
@@ -1257,17 +1260,17 @@ func (x IntRange) orMax(y IntRange) *big.Int {
}
// bitFillRight modifies i to round up to the next power of 2 minus 1:
// - If i is +0 then bitFillRight(i) sets i to 0.
// - If i is +1 then bitFillRight(i) sets i to 1.
// - If i is +2 then bitFillRight(i) sets i to 3.
// - If i is +3 then bitFillRight(i) sets i to 3.
// - If i is +4 then bitFillRight(i) sets i to 7.
// - If i is +5 then bitFillRight(i) sets i to 7.
// - If i is +6 then bitFillRight(i) sets i to 7.
// - If i is +7 then bitFillRight(i) sets i to 7.
// - If i is +8 then bitFillRight(i) sets i to 15.
// - If i is +9 then bitFillRight(i) sets i to 15.
// - Etc.
// - If i is +0 then bitFillRight(i) sets i to 0.
// - If i is +1 then bitFillRight(i) sets i to 1.
// - If i is +2 then bitFillRight(i) sets i to 3.
// - If i is +3 then bitFillRight(i) sets i to 3.
// - If i is +4 then bitFillRight(i) sets i to 7.
// - If i is +5 then bitFillRight(i) sets i to 7.
// - If i is +6 then bitFillRight(i) sets i to 7.
// - If i is +7 then bitFillRight(i) sets i to 7.
// - If i is +8 then bitFillRight(i) sets i to 15.
// - If i is +9 then bitFillRight(i) sets i to 15.
// - Etc.
func bitFillRight(i *big.Int) {
if s := i.Sign(); s < 0 {
panic("pre-condition failure")
+40 -4
View File
@@ -21,7 +21,7 @@ import (
"github.com/google/wuffs/lib/litonlylzma"
)
func ExampleRoundTrip() {
func ExampleRoundTripLZMA() {
original := []byte("Hello world.\n")
compressed, err := litonlylzma.FileFormatLZMA.Encode(nil, original)
if err != nil {
@@ -31,15 +31,51 @@ func ExampleRoundTrip() {
if err != nil {
log.Fatalf("Decode: %v", err)
}
for i, c := range compressed {
if i > 0 {
if (i & 15) > 0 {
fmt.Printf(" ")
}
fmt.Printf("%02X", c)
if ((i & 15) == 15) || ((i + 1) == len(compressed)) {
fmt.Println()
}
}
fmt.Printf("\n%s\n", recovered)
fmt.Printf("%s", recovered)
// Output:
// 5D 00 10 00 00 0D 00 00 00 00 00 00 00 00 24 19 49 86 E7 D5 E5 E2 56 ED 6A E6 0E 81 FE B8 00 00
// 5D 00 10 00 00 0D 00 00 00 00 00 00 00 00 24 19
// 49 86 E7 D5 E5 E2 56 ED 6A E6 0E 81 FE B8 00 00
// Hello world.
}
func ExampleRoundTripXz() {
original := []byte("Hello world.\n")
compressed, err := litonlylzma.FileFormatXz.Encode(nil, original)
if err != nil {
log.Fatalf("Encode: %v", err)
}
recovered, _, err := litonlylzma.FileFormatXz.Decode(nil, compressed)
if err != nil {
log.Fatalf("Decode: %v", err)
}
for i, c := range compressed {
if (i & 15) > 0 {
fmt.Printf(" ")
}
fmt.Printf("%02X", c)
if ((i & 15) == 15) || ((i + 1) == len(compressed)) {
fmt.Println()
}
}
fmt.Printf("%s", recovered)
// Output:
// FD 37 7A 58 5A 00 00 01 69 22 DE 36 02 00 21 01
// 00 00 00 00 37 27 97 D6 01 00 0C 48 65 6C 6C 6F
// 20 77 6F 72 6C 64 2E 0A 00 00 00 00 8E F8 31 35
// 00 01 21 0D 75 DC A8 D2 90 42 99 0D 01 00 00 00
// 00 01 59 5A
// Hello world.
}
+390 -102
View File
@@ -14,39 +14,45 @@
// ----------------
// Package litonlylzma provides a decoder and encoder for Literal Only LZMA, a
// subset of the LZMA compressed file format.
// Package litonlylzma provides a decoder and encoder for Literal Only LZMA (or
// Literal Only Xz), a subset of the LZMA (or Xz) compressed file formats.
//
// Subset means that the Encode method's output is a valid LZMA file and can be
// decompressed by the tools available at https://www.7-zip.org/sdk.html (and
// available as /usr/bin/lzma on a Debian system).
// Subset means that:
// - the Encode methods' output is a valid LZMA/Xz file and can be
// decompressed by the tools available at https://www.7-zip.org/sdk.html or
// https://tukaani.org/xz/ (and available as /usr/bin/lzma or /usr/bin/xz
// on a Debian system).
// - the Decode methods supports the Encode methods' output but they do not
// support the full set of valid LZMA/Xz files.
// - this codec's compression ratios are not as good as full LZMA/Xz
// (although compression times are much faster). Moderate compression is
// still achieved, through range coding, but there are no Lempel Ziv
// back-references.
//
// Subset also means that this codec's compression ratios are not as good as
// full-LZMA (although compression times are much faster). Moderate compression
// is still achieved, through range coding, but there are no Lempel Ziv
// back-references. The main benefit, compared to full-LZMA, is that this
// implementation is much simpler and hence easier to study. It is only a few
// hundred lines of code.
// The main benefit, compared to full LZMA/Xz, is that this implementation is
// much simpler and hence easier to study. It is around 800 lines of code.
//
// Example compression numbers on a small English text file (at
// https://github.com/google/wuffs/blob/main/test/data/romeo.txt):
// - romeo.txt is 942 bytes (100%).
// - romeo.txt.litonlylzma is 659 bytes (70%).
// - romeo.txt.xz is 644 bytes (68%).
// - romeo.txt.lzma is 598 bytes (63%).
// - romeo.txt.bz2 is 568 bytes (60%).
// - romeo.txt.zst is 559 bytes (59%).
// - romeo.txt.gz is 558 bytes (59%).
// - romeo.txt is 942 bytes (100%).
// - romeo.txt.litonlyxz is 708 bytes (75%).
// - romeo.txt.litonlylzma is 659 bytes (70%).
// - romeo.txt.xz is 644 bytes (68%).
// - romeo.txt.lzma is 598 bytes (63%).
// - romeo.txt.bz2 is 568 bytes (60%).
// - romeo.txt.zst is 559 bytes (59%).
// - romeo.txt.gz is 558 bytes (59%).
//
// Example compression numbers on a large archive of source code (at
// https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.1.tar.xz):
// - linux-5.0.1.tar is 863313920 bytes (100%).
// - linux-5.0.1.tar.litonlylzma is 449726070 bytes (52%).
// - linux-5.0.1.tar.gz is 164575959 bytes (19%).
// - linux-5.0.1.tar.zst is 156959897 bytes (18%).
// - linux-5.0.1.tar.bz2 is 125873134 bytes (15%).
// - linux-5.0.1.tar.xz is 108233572 bytes (13%).
// - linux-5.0.1.tar.lzma is 108216601 bytes (13%).
// - linux-5.0.1.tar is 863313920 bytes (100%).
// - linux-5.0.1.tar.litonlyxz is 454480932 bytes (53%).
// - linux-5.0.1.tar.litonlylzma is 449726070 bytes (52%).
// - linux-5.0.1.tar.gz is 164575959 bytes (19%).
// - linux-5.0.1.tar.zst is 156959897 bytes (18%).
// - linux-5.0.1.tar.bz2 is 125873134 bytes (15%).
// - linux-5.0.1.tar.xz is 108233572 bytes (13%).
// - linux-5.0.1.tar.lzma is 108216601 bytes (13%).
//
// The various tools (/usr/bin/gzip, /usr/bin/xz, etc) were all ran with their
// default settings, not their "maximum compression" settings. This is why the
@@ -55,13 +61,16 @@ package litonlylzma
import (
"errors"
"hash/crc32"
)
var (
// ErrUnsupportedLZMAData is potentially returned by Decode.
// ErrUnsupportedXxxData is potentially returned by Decode.
ErrUnsupportedLZMAData = errors.New("litonlylzma: unsupported LZMA data")
ErrUnsupportedXzData = errors.New("litonlylzma: unsupported Xz data")
errInvalidLZMAData = errors.New("litonlylzma: invalid LZMA data")
errInvalidXzData = errors.New("litonlylzma: invalid Xz data")
errUnexpectedEOF = errors.New("litonlylzma: unexpected EOF")
errUnsupportedFileFormat = errors.New("litonlylzma: unsupported FileFormat")
)
@@ -79,13 +88,30 @@ const (
pbMask = (1 << pb) - 1
)
// lzmaHeader5 is the first 5 bytes of the LZMA header using the hard-coded
// configuration for the subset-of-LZMA that this package supports. 0x5D
// encodes the (lc, lp, pb) triple and the next four bytes hold the u32le
// dictionary size. 0x1000 is LZMA's minimum dictionary size, although our
// lzmaHeader5 is the first 5 bytes of an LZMA file using the hard-coded
// configuration for the subset-of-LZMA that this package supports.
//
// 0x5D encodes the (lc, lp, pb) triple and the next four bytes hold the u32le
// dictionary size. 0x00001000 is LZMA's minimum dictionary size, although our
// subset-of-LZMA does not use a dictionary (also called a "sliding window").
const lzmaHeader5 = "\x5D\x00\x10\x00\x00"
// xzHeader24 is the first 24 bytes of an Xz file using the hard-coded
// configuration for the subset-of-Xz that this package supports.
const xzHeader24 = "" +
"\xFD\x37\x7A\x58\x5A\x00" + // Stream Header Magic Bytes.
// ----
"\x00\x01" + // Stream Flags (0x01 means CRC-32).
"\x69\x22\xDE\x36" + // CRC-32 of the previous 2 bytes.
// ----
"\x02" + // Block Header Size (0x02 * 4 = 8 bytes).
"\x00" + // Block Flags.
"\x21" + // Filter ID (0x21 means LZMA2).
"\x01" + // Size of Filter Properties (size of the next line).
"\x00" + // Filter Properties (0x00 means an 0x1000 dictionary size).
"\x00\x00\x00" + // Padding to 4-byte alignment.
"\x37\x27\x97\xD6" // CRC-32 of the previous 8 bytes.
// rangeDecoder and rangeEncoder hold the state for range coding (also known as
// arithmetic coding, roughly speaking). "range" is a keyword in Go, so in this
// implementation, what's traditionally called the "range" fields are called
@@ -120,13 +146,13 @@ const lzmaHeader5 = "\x5D\x00\x10\x00\x00"
// digit is stashed as the pendingHead field. low is set to 8872, width is set
// to (46055 - 38872) = 7183 and we progress until the width drops below 1000,
// causing a 'zoom in' event. There are three cases:
// - if low is less than 9000 (but starts with an '8'), we can emit the '3'
// with confidence (and then stash '8' in the pendingHead field).
// - if low overflows 9999, we can emit the '4' with confidence (and then stash
// low's 'thousands digit' in the pendingHead field).
// - if low is in 9000 ..= 9999 then we could still be unsure. Keep the '3'
// pending but extend it so that there are two pending digits: '39'. If this
// occurs again: '399', and so on.
// - if low is less than 9000 (but starts with an '8'), we can emit the '3'
// with confidence (and then stash '8' in the pendingHead field).
// - if low overflows 9999, we can emit the '4' with confidence (and then
// stash low's 'thousands digit' in the pendingHead field).
// - if low is in 9000 ..= 9999 then we could still be unsure. Keep the '3'
// pending but extend it so that there are two pending digits: '39'. If
// this occurs again: '399', and so on.
//
// In all three cases, 'zooming in' causes us to shift out the most significant
// digit of the low field. This method is therefore named shiftLow here, the
@@ -260,39 +286,39 @@ func (p *prob) encodeBit(rEnc *rangeEncoder, bitValue uint32) {
// byteProbs hold probabilities for coding 8 bits (1 byte) of data. It is a 256
// element array such that:
// - The 0th element is unused.
// - The 1st element holds the probability that the 7th bit (the highest, most
// significant bit) is 0.
// - The 2nd element holds the probability that the 6th bit is 0, conditional
// on the high bit being 0.
// - The 3rd element holds the probability that the 6th bit is 0, conditional
// on the high bit being 1.
// - The 4th element holds the probability that the 5th bit is 0, conditional
// on the high two bits being 00.
// - The 5th element holds the probability that the 5th bit is 0, conditional
// on the high two bits being 01.
// - The 6th element holds the probability that the 5th bit is 0, conditional
// on the high two bits being 10.
// - The 7th element holds the probability that the 5th bit is 0, conditional
// on the high two bits being 11.
// - The 8th element holds the probability that the 4th bit is 0, conditional
// on the high three bits being 000.
// - etc
// - The 255th element holds the probability that the 0th bit (the lowest,
// least significant bit) is 0, conditional on the high seven bits being
// 1111111.
// - The 0th element is unused.
// - The 1st element holds the probability that the 7th bit (the highest, most
// significant bit) is 0.
// - The 2nd element holds the probability that the 6th bit is 0, conditional
// on the high bit being 0.
// - The 3rd element holds the probability that the 6th bit is 0, conditional
// on the high bit being 1.
// - The 4th element holds the probability that the 5th bit is 0, conditional
// on the high two bits being 00.
// - The 5th element holds the probability that the 5th bit is 0, conditional
// on the high two bits being 01.
// - The 6th element holds the probability that the 5th bit is 0, conditional
// on the high two bits being 10.
// - The 7th element holds the probability that the 5th bit is 0, conditional
// on the high two bits being 11.
// - The 8th element holds the probability that the 4th bit is 0, conditional
// on the high three bits being 000.
// - etc
// - The 255th element holds the probability that the 0th bit (the lowest,
// least significant bit) is 0, conditional on the high seven bits being
// 1111111.
//
// Put another way, the 256 elements' value of N, as in "it's a probability for
// the Nth bit", looks like this (when arranged in 8 rows of 32 elements):
//
// u7665555444444443333333333333333
// 22222222222222222222222222222222
// 11111111111111111111111111111111
// 11111111111111111111111111111111
// 00000000000000000000000000000000
// 00000000000000000000000000000000
// 00000000000000000000000000000000
// 00000000000000000000000000000000
// u7665555444444443333333333333333
// 22222222222222222222222222222222
// 11111111111111111111111111111111
// 11111111111111111111111111111111
// 00000000000000000000000000000000
// 00000000000000000000000000000000
// 00000000000000000000000000000000
// 00000000000000000000000000000000
//
// The 'u' means that the 0th element is unused.
type byteProbs [0x100]prob
@@ -320,7 +346,7 @@ func (p *byteProbs) encodeByte(rEnc *rangeEncoder, byteValue byte) {
}
// FileFormat is a compressed file format, either the original LZMA format
// itself or something that builds on or varies that.
// itself or something like Xz that builds on or varies that.
//
// Each valid FileFormatXxx value does not distinguish between the full file
// format (as spoken by numerous Xxx software tools) and the subset-of-Xxx
@@ -328,26 +354,27 @@ func (p *byteProbs) encodeByte(rEnc *rangeEncoder, byteValue byte) {
// produce compressed data that is valid full-LZMA (and is also valid
// subset-of-LZMA). FileFormatLZMA.Decode can decode subset-of-LZMA (but not
// full-LZMA).
//
// This package currently defines only one valid FileFormatXxx value:
// FileFormatLZMA. Future versions of this package could define e.g.
// FileFormatLZMA2 or FileFormatXz such that FileFormatXz.Encode would produce
// valid full-XZ data: a valid XZ file (that could be decoded by official XZ
// tools) that used the LZMA compression filter, but elected not to use the
// full capabilities of that filter (using LZ literals only, not matches).
type FileFormat uint32
const (
FileFormatInvalid = FileFormat(0)
FileFormatLZMA = FileFormat(1)
FileFormatXz = FileFormat(2)
)
// Decode converts src from the Literal Only LZMA compressed file format,
func (f FileFormat) String() string {
switch f {
case FileFormatLZMA:
return "FileFormatLZMA"
case FileFormatXz:
return "FileFormatXz"
}
return "FileFormatInvalid"
}
// Decode converts src from the Literal Only LZMA/Xz compressed file format,
// appending the decoding to dst.
//
// f should be FileFormatLZMA but future versions of this package may support
// other file formats.
//
// It is valid to pass a nil dst, like the way it's valid to pass nil to the
// built-in append function.
//
@@ -356,14 +383,19 @@ const (
// It can also return partial results. The appendedDst and remainingSrc return
// values may be non-zero even if retErr is non-zero.
//
// It returns ErrUnsupportedLZMAData if the source bytes look like LZMA
// formatted data that is outside the subset-of-LZMA that this package
// implements.
// It returns ErrUnsupportedXxxData if the source bytes look like Xxx formatted
// data that is outside the subset-of-Xxx that this package implements.
func (f FileFormat) Decode(dst []byte, src []byte) (appendedDst []byte, remainingSrc []byte, retErr error) {
if f != FileFormatLZMA {
return dst, nil, errUnsupportedFileFormat
switch f {
case FileFormatLZMA:
return decodeLZMA(dst, src)
case FileFormatXz:
return decodeXz(dst, src)
}
return nil, nil, errUnsupportedFileFormat
}
func decodeLZMA(dst []byte, src []byte) (appendedDst []byte, remainingSrc []byte, retErr error) {
// LZMA consists of a 13 byte header and then at least a 5 byte payload
// (range coded data). The 13 byte header is:
// - 1 byte for the (lc, lp, pb) triple with max values (8, 4, 4),
@@ -371,12 +403,7 @@ func (f FileFormat) Decode(dst []byte, src []byte) (appendedDst []byte, remainin
// - 8 bytes i64le uncompressed size.
if (len(src) < 18) || (src[0] >= (9 * 5 * 5)) {
return dst, nil, errInvalidLZMAData
} else if (src[0] != lzmaHeader5[0]) ||
(src[1] != lzmaHeader5[1]) ||
(src[2] != lzmaHeader5[2]) ||
(src[3] != lzmaHeader5[3]) ||
(src[4] != lzmaHeader5[4]) ||
(src[13] != 0x00) {
} else if string(src[:5]) != lzmaHeader5 {
return dst, nil, ErrUnsupportedLZMAData
}
@@ -390,12 +417,151 @@ func (f FileFormat) Decode(dst []byte, src []byte) (appendedDst []byte, remainin
return dst, nil, ErrUnsupportedLZMAData
}
return decodeRaw(dst, src[13:], size, ErrUnsupportedLZMAData)
}
func decodeXz(dst []byte, src []byte) (appendedDst []byte, remainingSrc []byte, retErr error) {
originalDstLen := len(dst)
originalSrcLen := len(src)
// Decode the headers.
if (len(src) < 24) || (string(src[:6]) != xzHeader24[:6]) {
return dst, src, errInvalidXzData
} else if string(src[6:24]) != xzHeader24[6:24] {
return dst, src, ErrUnsupportedXzData
}
src = src[24:]
// Decode the payload as multiple chunks.
for {
if len(src) == 0 {
return dst, src, errInvalidXzData
} else if src[0] == 0x00 { // No more chunks.
src = src[1:]
break
} else if src[0] == 0x01 { // Independent uncompressed chunk.
if len(src) < 3 {
return dst, src, errInvalidXzData
}
uncompressedSize := (uint32(src[1]) << 8) + (uint32(src[2]) << 0) + 1
src = src[3:]
if uint64(uncompressedSize) > uint64(len(src)) {
return dst, src, errInvalidXzData
}
dst = append(dst, src[:uncompressedSize]...)
src = src[uncompressedSize:]
} else if src[0] == 0xE0 { // Independent LZMA chunk.
if len(src) < 6 {
return dst, src, errInvalidXzData
} else if src[5] != 0x5D { // Like lzmaHeader5[0], this encodes lc=3, lp=0, pb=2.
return dst, src, ErrUnsupportedXzData
}
uncompressedSize := (uint32(src[1]) << 8) + (uint32(src[2]) << 0) + 1
compressedSize := (uint32(src[3]) << 8) + (uint32(src[4]) << 0) + 1
src = src[6:]
if uint64(compressedSize) > uint64(len(src)) {
return dst, src, errInvalidXzData
}
lenSrc := len(src)
dst, src, retErr = decodeRaw(dst, src, uint64(uncompressedSize), ErrUnsupportedXzData)
if retErr != nil {
return dst, src, retErr
} else if lenSrc != (len(src) + int(compressedSize)) {
return dst, src, errInvalidXzData
}
} else {
return dst, src, ErrUnsupportedXzData
}
}
unpaddedSizeWant := uint64((originalSrcLen - 12) - len(src) + 4)
for i := unpaddedSizeWant & 3; (i & 3) != 0; i++ {
if (len(src) == 0) || (src[0] != 0x00) {
return dst, src, errInvalidXzData
}
src = src[1:]
}
if len(src) < 4 {
return dst, src, errInvalidXzData
}
checksum := crc32.ChecksumIEEE(dst[originalDstLen:])
if (src[0] != uint8(checksum>>0)) ||
(src[1] != uint8(checksum>>8)) ||
(src[2] != uint8(checksum>>16)) ||
(src[3] != uint8(checksum>>24)) {
return dst, src, errInvalidXzData
}
src = src[4:]
// Decode the index.
srcCheckpoint1 := src
if (len(src) < 2) || (src[0] != 0x00) || (src[1] != 0x01) {
return dst, src, errInvalidXzData
}
src = src[2:]
src, unpaddedSizeHave, ok := decodeUvarint(src)
if !ok || (unpaddedSizeHave != unpaddedSizeWant) {
return dst, src, errInvalidXzData
}
src, uncompressedSize, ok := decodeUvarint(src)
if !ok || (uncompressedSize != uint64(len(dst)-originalDstLen)) {
return dst, src, errInvalidXzData
}
for i := (len(srcCheckpoint1) - len(src)) & 3; (i & 3) != 0; i++ {
if (len(src) == 0) || (src[0] != 0x00) {
return dst, src, errInvalidXzData
}
src = src[1:]
}
backwardSize := (len(srcCheckpoint1) - len(src)) >> 2
if len(src) < 4 {
return dst, src, errInvalidXzData
}
checksum = crc32.ChecksumIEEE(srcCheckpoint1[:len(srcCheckpoint1)-len(src)])
if (src[0] != uint8(checksum>>0)) ||
(src[1] != uint8(checksum>>8)) ||
(src[2] != uint8(checksum>>16)) ||
(src[3] != uint8(checksum>>24)) {
return dst, src, errInvalidXzData
}
src = src[4:]
// Decode the footer.
if len(src) < 12 {
return dst, src, errInvalidXzData
}
checksum = crc32.ChecksumIEEE(src[4:10])
if (src[0] != uint8(checksum>>0)) || // Checksum.
(src[1] != uint8(checksum>>8)) ||
(src[2] != uint8(checksum>>16)) ||
(src[3] != uint8(checksum>>24)) ||
(src[4] != uint8(backwardSize>>0)) || // Backward Size.
(src[5] != uint8(backwardSize>>8)) ||
(src[6] != uint8(backwardSize>>16)) ||
(src[7] != uint8(backwardSize>>24)) ||
(src[8] != xzHeader24[6]) || // Stream Flags again.
(src[9] != xzHeader24[7]) ||
(src[10] != 0x59) || // Stream Footer Magic Bytes.
(src[11] != 0x5A) {
return dst, src, errInvalidXzData
}
return dst, src[12:], nil
}
func decodeRaw(dst []byte, src []byte, size uint64, errUnsupported error) (appendedDst []byte, remainingSrc []byte, retErr error) {
if (len(src) < 5) || (src[0] != 0x00) {
return dst, src, errUnsupported
}
rDec := rangeDecoder{
src: src[18:],
bits: (uint32(src[14]) << 24) |
(uint32(src[15]) << 16) |
(uint32(src[16]) << 8) |
(uint32(src[17]) << 0),
src: src[5:],
bits: (uint32(src[1]) << 24) |
(uint32(src[2]) << 16) |
(uint32(src[3]) << 8) |
(uint32(src[4]) << 0),
width: 0xFFFF_FFFF,
}
@@ -412,12 +578,12 @@ func (f FileFormat) Decode(dst []byte, src []byte) (appendedDst []byte, remainin
curr := byte(0)
for ; size > 0; size-- {
if bitValue, err := posProbs[pos&pbMask].decodeBit(&rDec); err != nil {
return dst, nil, err
return dst, rDec.src, err
} else if bitValue != 0 {
// A full-LZMA decoder would implement Lempel Ziv matches (or the
// End of Stream marker) here. Our simpler subset-of-LZMA decoder
// only uses literals.
return dst, rDec.src, ErrUnsupportedLZMAData
return dst, rDec.src, errUnsupported
}
i := (pos & lpMask) << lc
@@ -433,26 +599,141 @@ func (f FileFormat) Decode(dst []byte, src []byte) (appendedDst []byte, remainin
return dst, rDec.src, nil
}
func decodeUvarint(src []byte) (remainingSrc []byte, x uint64, ok bool) {
for i := uint32(0); (i < 63) && (len(src) > 0); i += 7 {
s := src[0]
src = src[1:]
x |= uint64(s&0x7F) << i
if (s & 0x80) == 0 {
return src, x, true
}
}
return src, 0, false
}
// Encode converts src to the Literal Only LZMA compressed file format,
// appending the encoding to dst.
//
// f should be FileFormatLZMA but future versions of this package may support
// other file formats.
//
// It is valid to pass a nil dst, like the way it's valid to pass nil to the
// built-in append function.
func (f FileFormat) Encode(dst []byte, src []byte) (appendedDst []byte, retErr error) {
if f != FileFormatLZMA {
return nil, errUnsupportedFileFormat
switch f {
case FileFormatLZMA:
return encodeLZMA(dst, src)
case FileFormatXz:
return encodeXz(dst, src)
}
return nil, errUnsupportedFileFormat
}
func encodeLZMA(dst []byte, src []byte) (appendedDst []byte, retErr error) {
dst = append(dst, lzmaHeader5...)
size := len(src)
for i := 0; i < 8; i++ {
dst = append(dst, byte(size))
size >>= 8
}
return encodeRaw(dst, src), nil
}
func encodeXz(dst []byte, src []byte) (appendedDst []byte, retErr error) {
// Encode the headers (12 byte stream header then 12 byte block header).
// The block's unpaddedSize calculation ignores the stream header.
dstLen0 := len(dst) + 12
dst = append(dst, xzHeader24...)
// Encode the payload as multiple chunks.
//
// Later XZ chunks can depend on earlier ones (and doing so can help
// compression ratios) but for simplicity, this encoder emits independent
// chunks. Each chunk's maximum compressed and uncompressed size are both
// equal to 0x10000 = 65536 bytes, roughly speaking. The encoder partitions
// the src into 65536 byte sub-slices. If a sub-slice's LZMA-compressed
// form would be longer, the encoder emits an uncompressed chunk instead.
rawLZMA := []byte(nil)
for remaining := src; len(remaining) > 0; {
srcChunk := []byte(nil)
if len(remaining) > 0x10000 {
srcChunk, remaining = remaining[:0x10000], remaining[0x10000:]
} else {
srcChunk, remaining = remaining, nil
}
rawLZMA = encodeRaw(rawLZMA[:0], srcChunk)
if (len(srcChunk) + 3) <= (len(rawLZMA) + 6) {
dst = append(dst,
0x01, // Independent uncompressed chunk.
uint8((len(srcChunk)-1)>>8),
uint8((len(srcChunk)-1)>>0),
)
dst = append(dst, srcChunk...)
} else {
dst = append(dst,
0xE0, // Independent LZMA chunk.
uint8((len(srcChunk)-1)>>8),
uint8((len(srcChunk)-1)>>0),
uint8((len(rawLZMA)-1)>>8),
uint8((len(rawLZMA)-1)>>0),
0x5D, // Like lzmaHeader5[0], this encodes lc=3, lp=0, pb=2.
)
dst = append(dst, rawLZMA...)
}
}
dst = append(dst, 0x00) // No more chunks.
unpaddedSize := uint64(len(dst)-dstLen0) + 4 // +4 for the upcoming checksum.
for 0 != 3&(len(dst)-dstLen0) {
dst = append(dst, 0x00) // Padding
}
checksum := crc32.ChecksumIEEE(src)
dst = append(dst,
uint8(checksum>>0),
uint8(checksum>>8),
uint8(checksum>>16),
uint8(checksum>>24),
)
// Encode the index.
dstLen1 := len(dst)
dst = append(dst,
0x00, // Index Indicator.
0x01, // Number of Records.
)
dst = encodeUvarint(dst, unpaddedSize)
dst = encodeUvarint(dst, uint64(len(src)))
for 0 != 3&(len(dst)-dstLen1) {
dst = append(dst, 0x00) // Padding
}
backwardSize := (len(dst) - dstLen1) >> 2
checksum = crc32.ChecksumIEEE(dst[dstLen1:])
dst = append(dst,
uint8(checksum>>0),
uint8(checksum>>8),
uint8(checksum>>16),
uint8(checksum>>24),
)
// Encode the footer.
dstLen2 := len(dst)
dst = append(dst,
0, 0, 0, 0, // Space for the checksum.
uint8(backwardSize>>0), // Backward Size.
uint8(backwardSize>>8),
uint8(backwardSize>>16),
uint8(backwardSize>>24),
xzHeader24[6], // Stream Flags again.
xzHeader24[7],
0x59, // Stream Footer Magic Bytes.
0x5A,
)
checksum = crc32.ChecksumIEEE(dst[dstLen2+4 : dstLen2+10])
dst[dstLen2+0] = uint8(checksum >> 0)
dst[dstLen2+1] = uint8(checksum >> 8)
dst[dstLen2+2] = uint8(checksum >> 16)
dst[dstLen2+3] = uint8(checksum >> 24)
return dst, nil
}
func encodeRaw(dst []byte, src []byte) (appendedDst []byte) {
rEnc := rangeEncoder{
dst: dst,
width: 0xFFFF_FFFF,
@@ -487,5 +768,12 @@ func (f FileFormat) Encode(dst []byte, src []byte) (appendedDst []byte, retErr e
rEnc.shiftLow()
}
return rEnc.dst, nil
return rEnc.dst
}
func encodeUvarint(dst []byte, x uint64) []byte {
for ; x >= 0x80; x >>= 7 {
dst = append(dst, byte(x)|0x80)
}
return append(dst, byte(x))
}
+16 -9
View File
@@ -43,16 +43,23 @@ func testRoundTrip(tt *testing.T, filename string) {
original = o
}
compressed, err := FileFormatLZMA.Encode(nil, original)
if err != nil {
tt.Fatalf("Encode: %v", err)
fileFormats := [...]FileFormat{
FileFormatLZMA,
FileFormatXz,
}
recovered, _, err := FileFormatLZMA.Decode(nil, compressed)
if err != nil {
tt.Fatalf("Decode: %v", err)
}
if !bytes.Equal(original, recovered) {
tt.Fatalf("round trip produced different bytes")
for _, f := range fileFormats {
compressed, err := f.Encode(nil, original)
if err != nil {
tt.Fatalf("%v.Encode: %v", f, err)
}
recovered, _, err := f.Decode(nil, compressed)
if err != nil {
tt.Fatalf("%v.Decode: %v", f, err)
}
if !bytes.Equal(original, recovered) {
tt.Fatalf("%v: round trip produced different bytes", f)
}
}
}
+236 -176
View File
@@ -6344,6 +6344,8 @@ struct wuffs_base__token_decoder__struct {
} // extern "C"
#endif
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__ADLER32) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
// ---------------- Public Consts
@@ -6526,6 +6528,10 @@ struct wuffs_adler32__hasher__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__ADLER32) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__BMP) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_bmp__error__bad_header[];
@@ -6874,6 +6880,10 @@ struct wuffs_bmp__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__BMP) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__BZIP2) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_bzip2__error__bad_huffman_code_over_subscribed[];
@@ -7138,6 +7148,10 @@ struct wuffs_bzip2__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__BZIP2) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__CBOR) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_cbor__error__bad_input[];
@@ -7363,6 +7377,10 @@ struct wuffs_cbor__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__CBOR) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__CRC32) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
// ---------------- Public Consts
@@ -7544,6 +7562,10 @@ struct wuffs_crc32__ieee_hasher__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__CRC32) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__DEFLATE) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_deflate__error__bad_huffman_code_over_subscribed[];
@@ -7814,6 +7836,10 @@ struct wuffs_deflate__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__DEFLATE) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__LZW) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_lzw__error__bad_code[];
@@ -8049,6 +8075,10 @@ struct wuffs_lzw__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__LZW) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__GIF) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_gif__error__bad_extension_label[];
@@ -8471,6 +8501,10 @@ struct wuffs_gif__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__GIF) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__GZIP) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_gzip__error__bad_checksum[];
@@ -8683,6 +8717,10 @@ struct wuffs_gzip__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__GZIP) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__JSON) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_json__error__bad_c0_control_code[];
@@ -8951,6 +8989,10 @@ struct wuffs_json__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__JSON) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__NIE) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_nie__error__bad_header[];
@@ -9269,6 +9311,10 @@ struct wuffs_nie__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__NIE) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__ZLIB) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_zlib__note__dictionary_required[];
@@ -9510,6 +9556,10 @@ struct wuffs_zlib__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__ZLIB) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__PNG) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_png__error__bad_animation_sequence_number[];
@@ -9980,6 +10030,10 @@ struct wuffs_png__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__PNG) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__TGA) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_tga__error__bad_header[];
@@ -10325,6 +10379,10 @@ struct wuffs_tga__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__TGA) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__WBMP) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_wbmp__error__bad_header[];
@@ -10648,6 +10706,8 @@ struct wuffs_wbmp__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__WBMP) || defined(WUFFS_NONMONOLITHIC)
#if defined(__cplusplus) && defined(WUFFS_BASE__HAVE_UNIQUE_PTR)
// ---------------- Auxiliary - Base
@@ -22698,7 +22758,7 @@ wuffs_bmp__decoder__decode_image_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -23573,7 +23633,7 @@ wuffs_bmp__decoder__decode_image_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -23615,7 +23675,7 @@ wuffs_bmp__decoder__decode_frame_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -23682,7 +23742,7 @@ wuffs_bmp__decoder__decode_frame_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -23729,7 +23789,7 @@ wuffs_bmp__decoder__decode_frame(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -23866,7 +23926,7 @@ wuffs_bmp__decoder__decode_frame(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -23899,7 +23959,7 @@ wuffs_bmp__decoder__swizzle_none(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -23969,7 +24029,7 @@ wuffs_bmp__decoder__swizzle_none(
ok:
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -24006,7 +24066,7 @@ wuffs_bmp__decoder__swizzle_rle(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -24231,7 +24291,7 @@ wuffs_bmp__decoder__swizzle_rle(
ok:
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -24268,7 +24328,7 @@ wuffs_bmp__decoder__swizzle_bitfields(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -24371,7 +24431,7 @@ wuffs_bmp__decoder__swizzle_bitfields(
ok:
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -24404,7 +24464,7 @@ wuffs_bmp__decoder__swizzle_low_bit_depth(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -24539,7 +24599,7 @@ wuffs_bmp__decoder__swizzle_low_bit_depth(
ok:
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -24742,7 +24802,7 @@ wuffs_bmp__decoder__read_palette(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -24856,7 +24916,7 @@ wuffs_bmp__decoder__read_palette(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -25174,7 +25234,7 @@ wuffs_bzip2__decoder__transform_io(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -25388,7 +25448,7 @@ wuffs_bzip2__decoder__transform_io(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -25418,7 +25478,7 @@ wuffs_bzip2__decoder__prepare_block(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -25712,7 +25772,7 @@ wuffs_bzip2__decoder__prepare_block(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -25735,7 +25795,7 @@ wuffs_bzip2__decoder__read_code_lengths(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -25840,7 +25900,7 @@ wuffs_bzip2__decoder__read_code_lengths(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -26013,7 +26073,7 @@ wuffs_bzip2__decoder__flush_fast(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -26066,7 +26126,7 @@ wuffs_bzip2__decoder__flush_fast(
if (v_block_size <= 900000) {
self->private_impl.f_block_size = v_block_size;
}
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
@@ -26093,7 +26153,7 @@ wuffs_bzip2__decoder__flush_slow(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -26187,7 +26247,7 @@ wuffs_bzip2__decoder__flush_slow(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
@@ -26222,7 +26282,7 @@ wuffs_bzip2__decoder__decode_huffman_fast(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -26317,7 +26377,7 @@ wuffs_bzip2__decoder__decode_huffman_fast(
ok:
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -26346,7 +26406,7 @@ wuffs_bzip2__decoder__decode_huffman_slow(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -26450,7 +26510,7 @@ wuffs_bzip2__decoder__decode_huffman_slow(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -26647,7 +26707,7 @@ wuffs_cbor__decoder__decode_tokens(
wuffs_base__token* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -26660,7 +26720,7 @@ wuffs_cbor__decoder__decode_tokens(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -27184,10 +27244,10 @@ wuffs_cbor__decoder__decode_tokens(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -28681,7 +28741,7 @@ wuffs_deflate__decoder__transform_io(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -28740,7 +28800,7 @@ wuffs_deflate__decoder__transform_io(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
@@ -28768,7 +28828,7 @@ wuffs_deflate__decoder__decode_blocks(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -28897,7 +28957,7 @@ wuffs_deflate__decoder__decode_blocks(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -28920,7 +28980,7 @@ wuffs_deflate__decoder__decode_uncompressed(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -28933,7 +28993,7 @@ wuffs_deflate__decoder__decode_uncompressed(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -29016,10 +29076,10 @@ wuffs_deflate__decoder__decode_uncompressed(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -29103,7 +29163,7 @@ wuffs_deflate__decoder__init_dynamic_huffman(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -29324,7 +29384,7 @@ wuffs_deflate__decoder__init_dynamic_huffman(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -29617,7 +29677,7 @@ wuffs_deflate__decoder__decode_huffman_bmi2(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -29630,7 +29690,7 @@ wuffs_deflate__decoder__decode_huffman_bmi2(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -29791,10 +29851,10 @@ wuffs_deflate__decoder__decode_huffman_bmi2(
}
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -29830,7 +29890,7 @@ wuffs_deflate__decoder__decode_huffman_fast32(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -29843,7 +29903,7 @@ wuffs_deflate__decoder__decode_huffman_fast32(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -30049,10 +30109,10 @@ wuffs_deflate__decoder__decode_huffman_fast32(
}
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -30094,7 +30154,7 @@ wuffs_deflate__decoder__decode_huffman_fast64__choosy_default(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -30107,7 +30167,7 @@ wuffs_deflate__decoder__decode_huffman_fast64__choosy_default(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -30268,10 +30328,10 @@ wuffs_deflate__decoder__decode_huffman_fast64__choosy_default(
}
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -30311,7 +30371,7 @@ wuffs_deflate__decoder__decode_huffman_slow(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -30324,7 +30384,7 @@ wuffs_deflate__decoder__decode_huffman_slow(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -30603,10 +30663,10 @@ wuffs_deflate__decoder__decode_huffman_slow(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -30895,7 +30955,7 @@ wuffs_lzw__decoder__read_from(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -31037,7 +31097,7 @@ wuffs_lzw__decoder__read_from(
self->private_impl.f_bits = v_bits;
self->private_impl.f_n_bits = v_n_bits;
self->private_impl.f_output_wi = v_output_wi;
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -31059,7 +31119,7 @@ wuffs_lzw__decoder__write_to(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -31104,7 +31164,7 @@ wuffs_lzw__decoder__write_to(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
@@ -31562,7 +31622,7 @@ wuffs_gif__decoder__tell_me_more(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -31662,7 +31722,7 @@ wuffs_gif__decoder__tell_me_more(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -31828,7 +31888,7 @@ wuffs_gif__decoder__decode_frame_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -31947,7 +32007,7 @@ wuffs_gif__decoder__decode_frame_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -31972,7 +32032,7 @@ wuffs_gif__decoder__skip_frame(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -32047,7 +32107,7 @@ wuffs_gif__decoder__skip_frame(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -32162,7 +32222,7 @@ wuffs_gif__decoder__decode_up_to_id_part1(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -32238,7 +32298,7 @@ wuffs_gif__decoder__decode_up_to_id_part1(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -32260,7 +32320,7 @@ wuffs_gif__decoder__decode_header(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -32311,7 +32371,7 @@ wuffs_gif__decoder__decode_header(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -32337,7 +32397,7 @@ wuffs_gif__decoder__decode_lsd(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -32513,7 +32573,7 @@ wuffs_gif__decoder__decode_lsd(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -32534,7 +32594,7 @@ wuffs_gif__decoder__decode_extension(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -32606,7 +32666,7 @@ wuffs_gif__decoder__decode_extension(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -32627,7 +32687,7 @@ wuffs_gif__decoder__skip_blocks(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -32674,7 +32734,7 @@ wuffs_gif__decoder__skip_blocks(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -32700,7 +32760,7 @@ wuffs_gif__decoder__decode_ae(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -32897,7 +32957,7 @@ wuffs_gif__decoder__decode_ae(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -32920,7 +32980,7 @@ wuffs_gif__decoder__decode_gc(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -33027,7 +33087,7 @@ wuffs_gif__decoder__decode_gc(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -33046,7 +33106,7 @@ wuffs_gif__decoder__decode_id_part0(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -33194,7 +33254,7 @@ wuffs_gif__decoder__decode_id_part0(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -33223,7 +33283,7 @@ wuffs_gif__decoder__decode_id_part1(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -33365,7 +33425,7 @@ wuffs_gif__decoder__decode_id_part1(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -33403,7 +33463,7 @@ wuffs_gif__decoder__decode_id_part2(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -33593,7 +33653,7 @@ wuffs_gif__decoder__decode_id_part2(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -33920,7 +33980,7 @@ wuffs_gzip__decoder__transform_io(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -33933,7 +33993,7 @@ wuffs_gzip__decoder__transform_io(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -34204,10 +34264,10 @@ wuffs_gzip__decoder__transform_io(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -34697,7 +34757,7 @@ wuffs_json__decoder__decode_tokens(
wuffs_base__token* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -34710,7 +34770,7 @@ wuffs_json__decoder__decode_tokens(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -35640,10 +35700,10 @@ wuffs_json__decoder__decode_tokens(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -35667,7 +35727,7 @@ wuffs_json__decoder__decode_number(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -35782,7 +35842,7 @@ wuffs_json__decoder__decode_number(
goto label__goto_done__break;
}
label__goto_done__break:;
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
return (v_n | v_floating_point);
@@ -35802,7 +35862,7 @@ wuffs_json__decoder__decode_digits(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -35832,7 +35892,7 @@ wuffs_json__decoder__decode_digits(
if (v_n == a_n) {
v_n |= 256;
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
return v_n;
@@ -35854,7 +35914,7 @@ wuffs_json__decoder__decode_leading(
wuffs_base__token* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -35867,7 +35927,7 @@ wuffs_json__decoder__decode_leading(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -35937,10 +35997,10 @@ wuffs_json__decoder__decode_leading(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -35964,7 +36024,7 @@ wuffs_json__decoder__decode_comment(
wuffs_base__token* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -35977,7 +36037,7 @@ wuffs_json__decoder__decode_comment(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -36119,10 +36179,10 @@ wuffs_json__decoder__decode_comment(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -36145,7 +36205,7 @@ wuffs_json__decoder__decode_inf_nan(
wuffs_base__token* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -36158,7 +36218,7 @@ wuffs_json__decoder__decode_inf_nan(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -36276,10 +36336,10 @@ wuffs_json__decoder__decode_inf_nan(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -36302,7 +36362,7 @@ wuffs_json__decoder__decode_trailer(
wuffs_base__token* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -36315,7 +36375,7 @@ wuffs_json__decoder__decode_trailer(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -36414,10 +36474,10 @@ wuffs_json__decoder__decode_trailer(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -36597,7 +36657,7 @@ wuffs_nie__decoder__decode_image_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -36781,7 +36841,7 @@ wuffs_nie__decoder__decode_image_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -36823,7 +36883,7 @@ wuffs_nie__decoder__decode_frame_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -36890,7 +36950,7 @@ wuffs_nie__decoder__decode_frame_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -37026,7 +37086,7 @@ wuffs_nie__decoder__swizzle(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -37078,7 +37138,7 @@ wuffs_nie__decoder__swizzle(
ok:
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -37504,7 +37564,7 @@ wuffs_zlib__decoder__transform_io(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -37517,7 +37577,7 @@ wuffs_zlib__decoder__transform_io(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -37701,10 +37761,10 @@ wuffs_zlib__decoder__transform_io(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -39636,7 +39696,7 @@ wuffs_png__decoder__decode_image_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -39928,7 +39988,7 @@ wuffs_png__decoder__decode_image_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -39953,7 +40013,7 @@ wuffs_png__decoder__decode_ihdr(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -40132,7 +40192,7 @@ wuffs_png__decoder__decode_ihdr(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -40301,7 +40361,7 @@ wuffs_png__decoder__decode_other_chunk(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -40521,7 +40581,7 @@ wuffs_png__decoder__decode_other_chunk(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -40540,7 +40600,7 @@ wuffs_png__decoder__decode_actl(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -40634,7 +40694,7 @@ wuffs_png__decoder__decode_actl(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -40655,7 +40715,7 @@ wuffs_png__decoder__decode_chrm(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -40931,7 +40991,7 @@ wuffs_png__decoder__decode_chrm(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -40950,7 +41010,7 @@ wuffs_png__decoder__decode_exif(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -40972,7 +41032,7 @@ wuffs_png__decoder__decode_exif(
ok:
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -40996,7 +41056,7 @@ wuffs_png__decoder__decode_fctl(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -41309,7 +41369,7 @@ wuffs_png__decoder__decode_fctl(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -41328,7 +41388,7 @@ wuffs_png__decoder__decode_gama(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -41390,7 +41450,7 @@ wuffs_png__decoder__decode_gama(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -41411,7 +41471,7 @@ wuffs_png__decoder__decode_iccp(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -41479,7 +41539,7 @@ wuffs_png__decoder__decode_iccp(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -41502,7 +41562,7 @@ wuffs_png__decoder__decode_plte(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -41582,7 +41642,7 @@ wuffs_png__decoder__decode_plte(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -41601,7 +41661,7 @@ wuffs_png__decoder__decode_srgb(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -41643,7 +41703,7 @@ wuffs_png__decoder__decode_srgb(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -41666,7 +41726,7 @@ wuffs_png__decoder__decode_trns(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -41828,7 +41888,7 @@ wuffs_png__decoder__decode_trns(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -41869,7 +41929,7 @@ wuffs_png__decoder__decode_frame_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -42119,7 +42179,7 @@ wuffs_png__decoder__decode_frame_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -42143,7 +42203,7 @@ wuffs_png__decoder__skip_frame(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -42274,7 +42334,7 @@ wuffs_png__decoder__skip_frame(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -42321,7 +42381,7 @@ wuffs_png__decoder__decode_frame(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -42544,7 +42604,7 @@ wuffs_png__decoder__decode_frame(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -42580,7 +42640,7 @@ wuffs_png__decoder__decode_pass(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -42886,7 +42946,7 @@ wuffs_png__decoder__decode_pass(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -43069,7 +43129,7 @@ wuffs_png__decoder__tell_me_more(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -43082,7 +43142,7 @@ wuffs_png__decoder__tell_me_more(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -43533,10 +43593,10 @@ wuffs_png__decoder__tell_me_more(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -44094,7 +44154,7 @@ wuffs_tga__decoder__decode_image_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -44523,7 +44583,7 @@ wuffs_tga__decoder__decode_image_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -44565,7 +44625,7 @@ wuffs_tga__decoder__decode_frame_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -44632,7 +44692,7 @@ wuffs_tga__decoder__decode_frame_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -44698,7 +44758,7 @@ wuffs_tga__decoder__decode_frame(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -44980,7 +45040,7 @@ wuffs_tga__decoder__decode_frame(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -45328,7 +45388,7 @@ wuffs_wbmp__decoder__decode_image_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -45424,7 +45484,7 @@ wuffs_wbmp__decoder__decode_image_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -45466,7 +45526,7 @@ wuffs_wbmp__decoder__decode_frame_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -45533,7 +45593,7 @@ wuffs_wbmp__decoder__decode_frame_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -45590,7 +45650,7 @@ wuffs_wbmp__decoder__decode_frame(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -45702,7 +45762,7 @@ wuffs_wbmp__decoder__decode_frame(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
+241 -181
View File
@@ -85,15 +85,15 @@ extern "C" {
// each major.minor branch, the commit count should increase monotonically.
//
// WUFFS_VERSION was overridden by "wuffs gen -version" based on revision
// fac934b27259f37191285a8d9d1d9629ed2d9f5d committed on 2022-06-29.
// c698d81b4d6868f3c5e26d2d7c3b39fe97209ec0 committed on 2023-01-26.
#define WUFFS_VERSION 0x000030000
#define WUFFS_VERSION_MAJOR 0
#define WUFFS_VERSION_MINOR 3
#define WUFFS_VERSION_PATCH 0
#define WUFFS_VERSION_PRE_RELEASE_LABEL "rc.1"
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_COUNT 3360
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_DATE 20220629
#define WUFFS_VERSION_STRING "0.3.0-rc.1+3360.20220629"
#define WUFFS_VERSION_PRE_RELEASE_LABEL ""
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_COUNT 3374
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_DATE 20230126
#define WUFFS_VERSION_STRING "0.3.0+3374.20230126"
// ---------------- Configuration
@@ -6345,6 +6345,8 @@ struct wuffs_base__token_decoder__struct {
} // extern "C"
#endif
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__ADLER32) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
// ---------------- Public Consts
@@ -6527,6 +6529,10 @@ struct wuffs_adler32__hasher__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__ADLER32) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__BMP) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_bmp__error__bad_header[];
@@ -6875,6 +6881,10 @@ struct wuffs_bmp__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__BMP) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__BZIP2) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_bzip2__error__bad_huffman_code_over_subscribed[];
@@ -7139,6 +7149,10 @@ struct wuffs_bzip2__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__BZIP2) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__CBOR) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_cbor__error__bad_input[];
@@ -7364,6 +7378,10 @@ struct wuffs_cbor__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__CBOR) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__CRC32) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
// ---------------- Public Consts
@@ -7545,6 +7563,10 @@ struct wuffs_crc32__ieee_hasher__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__CRC32) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__DEFLATE) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_deflate__error__bad_huffman_code_over_subscribed[];
@@ -7815,6 +7837,10 @@ struct wuffs_deflate__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__DEFLATE) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__LZW) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_lzw__error__bad_code[];
@@ -8050,6 +8076,10 @@ struct wuffs_lzw__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__LZW) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__GIF) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_gif__error__bad_extension_label[];
@@ -8472,6 +8502,10 @@ struct wuffs_gif__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__GIF) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__GZIP) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_gzip__error__bad_checksum[];
@@ -8684,6 +8718,10 @@ struct wuffs_gzip__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__GZIP) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__JSON) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_json__error__bad_c0_control_code[];
@@ -8952,6 +8990,10 @@ struct wuffs_json__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__JSON) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__NIE) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_nie__error__bad_header[];
@@ -9270,6 +9312,10 @@ struct wuffs_nie__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__NIE) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__ZLIB) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_zlib__note__dictionary_required[];
@@ -9511,6 +9557,10 @@ struct wuffs_zlib__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__ZLIB) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__PNG) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_png__error__bad_animation_sequence_number[];
@@ -9981,6 +10031,10 @@ struct wuffs_png__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__PNG) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__TGA) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_tga__error__bad_header[];
@@ -10326,6 +10380,10 @@ struct wuffs_tga__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__TGA) || defined(WUFFS_NONMONOLITHIC)
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__WBMP) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
extern const char wuffs_wbmp__error__bad_header[];
@@ -10649,6 +10707,8 @@ struct wuffs_wbmp__decoder__struct {
#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__WBMP) || defined(WUFFS_NONMONOLITHIC)
#if defined(__cplusplus) && defined(WUFFS_BASE__HAVE_UNIQUE_PTR)
// ---------------- Auxiliary - Base
@@ -22699,7 +22759,7 @@ wuffs_bmp__decoder__decode_image_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -23574,7 +23634,7 @@ wuffs_bmp__decoder__decode_image_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -23616,7 +23676,7 @@ wuffs_bmp__decoder__decode_frame_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -23683,7 +23743,7 @@ wuffs_bmp__decoder__decode_frame_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -23730,7 +23790,7 @@ wuffs_bmp__decoder__decode_frame(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -23867,7 +23927,7 @@ wuffs_bmp__decoder__decode_frame(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -23900,7 +23960,7 @@ wuffs_bmp__decoder__swizzle_none(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -23970,7 +24030,7 @@ wuffs_bmp__decoder__swizzle_none(
ok:
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -24007,7 +24067,7 @@ wuffs_bmp__decoder__swizzle_rle(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -24232,7 +24292,7 @@ wuffs_bmp__decoder__swizzle_rle(
ok:
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -24269,7 +24329,7 @@ wuffs_bmp__decoder__swizzle_bitfields(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -24372,7 +24432,7 @@ wuffs_bmp__decoder__swizzle_bitfields(
ok:
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -24405,7 +24465,7 @@ wuffs_bmp__decoder__swizzle_low_bit_depth(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -24540,7 +24600,7 @@ wuffs_bmp__decoder__swizzle_low_bit_depth(
ok:
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -24743,7 +24803,7 @@ wuffs_bmp__decoder__read_palette(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -24857,7 +24917,7 @@ wuffs_bmp__decoder__read_palette(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -25175,7 +25235,7 @@ wuffs_bzip2__decoder__transform_io(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -25389,7 +25449,7 @@ wuffs_bzip2__decoder__transform_io(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -25419,7 +25479,7 @@ wuffs_bzip2__decoder__prepare_block(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -25713,7 +25773,7 @@ wuffs_bzip2__decoder__prepare_block(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -25736,7 +25796,7 @@ wuffs_bzip2__decoder__read_code_lengths(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -25841,7 +25901,7 @@ wuffs_bzip2__decoder__read_code_lengths(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -26014,7 +26074,7 @@ wuffs_bzip2__decoder__flush_fast(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -26067,7 +26127,7 @@ wuffs_bzip2__decoder__flush_fast(
if (v_block_size <= 900000) {
self->private_impl.f_block_size = v_block_size;
}
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
@@ -26094,7 +26154,7 @@ wuffs_bzip2__decoder__flush_slow(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -26188,7 +26248,7 @@ wuffs_bzip2__decoder__flush_slow(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
@@ -26223,7 +26283,7 @@ wuffs_bzip2__decoder__decode_huffman_fast(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -26318,7 +26378,7 @@ wuffs_bzip2__decoder__decode_huffman_fast(
ok:
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -26347,7 +26407,7 @@ wuffs_bzip2__decoder__decode_huffman_slow(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -26451,7 +26511,7 @@ wuffs_bzip2__decoder__decode_huffman_slow(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -26648,7 +26708,7 @@ wuffs_cbor__decoder__decode_tokens(
wuffs_base__token* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -26661,7 +26721,7 @@ wuffs_cbor__decoder__decode_tokens(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -27185,10 +27245,10 @@ wuffs_cbor__decoder__decode_tokens(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -28682,7 +28742,7 @@ wuffs_deflate__decoder__transform_io(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -28741,7 +28801,7 @@ wuffs_deflate__decoder__transform_io(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
@@ -28769,7 +28829,7 @@ wuffs_deflate__decoder__decode_blocks(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -28898,7 +28958,7 @@ wuffs_deflate__decoder__decode_blocks(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -28921,7 +28981,7 @@ wuffs_deflate__decoder__decode_uncompressed(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -28934,7 +28994,7 @@ wuffs_deflate__decoder__decode_uncompressed(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -29017,10 +29077,10 @@ wuffs_deflate__decoder__decode_uncompressed(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -29104,7 +29164,7 @@ wuffs_deflate__decoder__init_dynamic_huffman(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -29325,7 +29385,7 @@ wuffs_deflate__decoder__init_dynamic_huffman(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -29618,7 +29678,7 @@ wuffs_deflate__decoder__decode_huffman_bmi2(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -29631,7 +29691,7 @@ wuffs_deflate__decoder__decode_huffman_bmi2(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -29792,10 +29852,10 @@ wuffs_deflate__decoder__decode_huffman_bmi2(
}
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -29831,7 +29891,7 @@ wuffs_deflate__decoder__decode_huffman_fast32(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -29844,7 +29904,7 @@ wuffs_deflate__decoder__decode_huffman_fast32(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -30050,10 +30110,10 @@ wuffs_deflate__decoder__decode_huffman_fast32(
}
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -30095,7 +30155,7 @@ wuffs_deflate__decoder__decode_huffman_fast64__choosy_default(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -30108,7 +30168,7 @@ wuffs_deflate__decoder__decode_huffman_fast64__choosy_default(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -30269,10 +30329,10 @@ wuffs_deflate__decoder__decode_huffman_fast64__choosy_default(
}
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -30312,7 +30372,7 @@ wuffs_deflate__decoder__decode_huffman_slow(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -30325,7 +30385,7 @@ wuffs_deflate__decoder__decode_huffman_slow(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -30604,10 +30664,10 @@ wuffs_deflate__decoder__decode_huffman_slow(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -30896,7 +30956,7 @@ wuffs_lzw__decoder__read_from(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -31038,7 +31098,7 @@ wuffs_lzw__decoder__read_from(
self->private_impl.f_bits = v_bits;
self->private_impl.f_n_bits = v_n_bits;
self->private_impl.f_output_wi = v_output_wi;
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -31060,7 +31120,7 @@ wuffs_lzw__decoder__write_to(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -31105,7 +31165,7 @@ wuffs_lzw__decoder__write_to(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
@@ -31563,7 +31623,7 @@ wuffs_gif__decoder__tell_me_more(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -31663,7 +31723,7 @@ wuffs_gif__decoder__tell_me_more(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -31829,7 +31889,7 @@ wuffs_gif__decoder__decode_frame_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -31948,7 +32008,7 @@ wuffs_gif__decoder__decode_frame_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -31973,7 +32033,7 @@ wuffs_gif__decoder__skip_frame(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -32048,7 +32108,7 @@ wuffs_gif__decoder__skip_frame(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -32163,7 +32223,7 @@ wuffs_gif__decoder__decode_up_to_id_part1(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -32239,7 +32299,7 @@ wuffs_gif__decoder__decode_up_to_id_part1(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -32261,7 +32321,7 @@ wuffs_gif__decoder__decode_header(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -32312,7 +32372,7 @@ wuffs_gif__decoder__decode_header(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -32338,7 +32398,7 @@ wuffs_gif__decoder__decode_lsd(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -32514,7 +32574,7 @@ wuffs_gif__decoder__decode_lsd(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -32535,7 +32595,7 @@ wuffs_gif__decoder__decode_extension(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -32607,7 +32667,7 @@ wuffs_gif__decoder__decode_extension(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -32628,7 +32688,7 @@ wuffs_gif__decoder__skip_blocks(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -32675,7 +32735,7 @@ wuffs_gif__decoder__skip_blocks(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -32701,7 +32761,7 @@ wuffs_gif__decoder__decode_ae(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -32898,7 +32958,7 @@ wuffs_gif__decoder__decode_ae(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -32921,7 +32981,7 @@ wuffs_gif__decoder__decode_gc(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -33028,7 +33088,7 @@ wuffs_gif__decoder__decode_gc(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -33047,7 +33107,7 @@ wuffs_gif__decoder__decode_id_part0(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -33195,7 +33255,7 @@ wuffs_gif__decoder__decode_id_part0(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -33224,7 +33284,7 @@ wuffs_gif__decoder__decode_id_part1(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -33366,7 +33426,7 @@ wuffs_gif__decoder__decode_id_part1(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -33404,7 +33464,7 @@ wuffs_gif__decoder__decode_id_part2(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -33594,7 +33654,7 @@ wuffs_gif__decoder__decode_id_part2(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -33921,7 +33981,7 @@ wuffs_gzip__decoder__transform_io(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -33934,7 +33994,7 @@ wuffs_gzip__decoder__transform_io(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -34205,10 +34265,10 @@ wuffs_gzip__decoder__transform_io(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -34698,7 +34758,7 @@ wuffs_json__decoder__decode_tokens(
wuffs_base__token* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -34711,7 +34771,7 @@ wuffs_json__decoder__decode_tokens(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -35641,10 +35701,10 @@ wuffs_json__decoder__decode_tokens(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -35668,7 +35728,7 @@ wuffs_json__decoder__decode_number(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -35783,7 +35843,7 @@ wuffs_json__decoder__decode_number(
goto label__goto_done__break;
}
label__goto_done__break:;
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
return (v_n | v_floating_point);
@@ -35803,7 +35863,7 @@ wuffs_json__decoder__decode_digits(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -35833,7 +35893,7 @@ wuffs_json__decoder__decode_digits(
if (v_n == a_n) {
v_n |= 256;
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
return v_n;
@@ -35855,7 +35915,7 @@ wuffs_json__decoder__decode_leading(
wuffs_base__token* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -35868,7 +35928,7 @@ wuffs_json__decoder__decode_leading(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -35938,10 +35998,10 @@ wuffs_json__decoder__decode_leading(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -35965,7 +36025,7 @@ wuffs_json__decoder__decode_comment(
wuffs_base__token* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -35978,7 +36038,7 @@ wuffs_json__decoder__decode_comment(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -36120,10 +36180,10 @@ wuffs_json__decoder__decode_comment(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -36146,7 +36206,7 @@ wuffs_json__decoder__decode_inf_nan(
wuffs_base__token* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -36159,7 +36219,7 @@ wuffs_json__decoder__decode_inf_nan(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -36277,10 +36337,10 @@ wuffs_json__decoder__decode_inf_nan(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -36303,7 +36363,7 @@ wuffs_json__decoder__decode_trailer(
wuffs_base__token* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
wuffs_base__token* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -36316,7 +36376,7 @@ wuffs_json__decoder__decode_trailer(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -36415,10 +36475,10 @@ wuffs_json__decoder__decode_trailer(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -36598,7 +36658,7 @@ wuffs_nie__decoder__decode_image_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -36782,7 +36842,7 @@ wuffs_nie__decoder__decode_image_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -36824,7 +36884,7 @@ wuffs_nie__decoder__decode_frame_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -36891,7 +36951,7 @@ wuffs_nie__decoder__decode_frame_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -37027,7 +37087,7 @@ wuffs_nie__decoder__swizzle(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -37079,7 +37139,7 @@ wuffs_nie__decoder__swizzle(
ok:
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -37505,7 +37565,7 @@ wuffs_zlib__decoder__transform_io(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -37518,7 +37578,7 @@ wuffs_zlib__decoder__transform_io(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -37702,10 +37762,10 @@ wuffs_zlib__decoder__transform_io(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -39637,7 +39697,7 @@ wuffs_png__decoder__decode_image_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -39929,7 +39989,7 @@ wuffs_png__decoder__decode_image_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -39954,7 +40014,7 @@ wuffs_png__decoder__decode_ihdr(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -40133,7 +40193,7 @@ wuffs_png__decoder__decode_ihdr(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -40302,7 +40362,7 @@ wuffs_png__decoder__decode_other_chunk(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -40522,7 +40582,7 @@ wuffs_png__decoder__decode_other_chunk(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -40541,7 +40601,7 @@ wuffs_png__decoder__decode_actl(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -40635,7 +40695,7 @@ wuffs_png__decoder__decode_actl(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -40656,7 +40716,7 @@ wuffs_png__decoder__decode_chrm(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -40932,7 +40992,7 @@ wuffs_png__decoder__decode_chrm(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -40951,7 +41011,7 @@ wuffs_png__decoder__decode_exif(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -40973,7 +41033,7 @@ wuffs_png__decoder__decode_exif(
ok:
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -40997,7 +41057,7 @@ wuffs_png__decoder__decode_fctl(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -41310,7 +41370,7 @@ wuffs_png__decoder__decode_fctl(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -41329,7 +41389,7 @@ wuffs_png__decoder__decode_gama(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -41391,7 +41451,7 @@ wuffs_png__decoder__decode_gama(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -41412,7 +41472,7 @@ wuffs_png__decoder__decode_iccp(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -41480,7 +41540,7 @@ wuffs_png__decoder__decode_iccp(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -41503,7 +41563,7 @@ wuffs_png__decoder__decode_plte(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -41583,7 +41643,7 @@ wuffs_png__decoder__decode_plte(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -41602,7 +41662,7 @@ wuffs_png__decoder__decode_srgb(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -41644,7 +41704,7 @@ wuffs_png__decoder__decode_srgb(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -41667,7 +41727,7 @@ wuffs_png__decoder__decode_trns(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -41829,7 +41889,7 @@ wuffs_png__decoder__decode_trns(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -41870,7 +41930,7 @@ wuffs_png__decoder__decode_frame_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -42120,7 +42180,7 @@ wuffs_png__decoder__decode_frame_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -42144,7 +42204,7 @@ wuffs_png__decoder__skip_frame(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -42275,7 +42335,7 @@ wuffs_png__decoder__skip_frame(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -42322,7 +42382,7 @@ wuffs_png__decoder__decode_frame(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -42545,7 +42605,7 @@ wuffs_png__decoder__decode_frame(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -42581,7 +42641,7 @@ wuffs_png__decoder__decode_pass(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -42887,7 +42947,7 @@ wuffs_png__decoder__decode_pass(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -43070,7 +43130,7 @@ wuffs_png__decoder__tell_me_more(
uint8_t* io0_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io1_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
uint8_t* io2_a_dst WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
io0_a_dst = a_dst->data.ptr;
io1_a_dst = io0_a_dst + a_dst->meta.wi;
iop_a_dst = io1_a_dst;
@@ -43083,7 +43143,7 @@ wuffs_png__decoder__tell_me_more(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -43534,10 +43594,10 @@ wuffs_png__decoder__tell_me_more(
goto exit;
exit:
if (a_dst) {
if (a_dst && a_dst->data.ptr) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
}
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -44095,7 +44155,7 @@ wuffs_tga__decoder__decode_image_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -44524,7 +44584,7 @@ wuffs_tga__decoder__decode_image_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -44566,7 +44626,7 @@ wuffs_tga__decoder__decode_frame_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -44633,7 +44693,7 @@ wuffs_tga__decoder__decode_frame_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -44699,7 +44759,7 @@ wuffs_tga__decoder__decode_frame(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -44981,7 +45041,7 @@ wuffs_tga__decoder__decode_frame(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -45329,7 +45389,7 @@ wuffs_wbmp__decoder__decode_image_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -45425,7 +45485,7 @@ wuffs_wbmp__decoder__decode_image_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -45467,7 +45527,7 @@ wuffs_wbmp__decoder__decode_frame_config(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -45534,7 +45594,7 @@ wuffs_wbmp__decoder__decode_frame_config(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
@@ -45591,7 +45651,7 @@ wuffs_wbmp__decoder__decode_frame(
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
if (a_src) {
if (a_src && a_src->data.ptr) {
io0_a_src = a_src->data.ptr;
io1_a_src = io0_a_src + a_src->meta.ri;
iop_a_src = io1_a_src;
@@ -45703,7 +45763,7 @@ wuffs_wbmp__decoder__decode_frame(
goto exit;
exit:
if (a_src) {
if (a_src && a_src->data.ptr) {
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
}
+1 -1
View File
@@ -365,7 +365,7 @@ type bitVector []uint8
// zig packs a pair of non-negative integers (i, j) into a single unique
// non-negative integer, in a zig-zagging pattern:
//
// i=0 i=1 i=2 i=3 i=4 etc
// . i=0 i=1 i=2 i=3 i=4 etc
// j=0: 0 1 3 6 10 ...
// j=1: 2 4 7 11 16 ...
// j=2: 5 8 12 17 23 ...