This is a bit more verbose, and transition back & forth between perl &
C types in e.g. perl -> compress -> _compress is a bit silly, ideally
"compress" would just call a shared C function.
But this is just an as-is port of what it's doing now which avoids
hardcoding library constants in the *.pm, this could also be done with
ExtUtils::Constant, but whatever.
This leaves the mode() function unported, but it's not used
anywhere (WIP code?) and in any case could also be easily ported over.
Quim Rovira [Tue, 16 Aug 2016 21:40:55 +0000 (23:40 +0200)]
Use typemaps instead of manually managing the SVs
Ævar suggested that using typemaps quite a bit of code could be cleaned
up and have some of the default sanity checks for free (see generated C
code in Brotli.c).
This also allows removing some of the perl sub wrappers, althought there
are some more cleanups that could be done on that, and the impact is
arguably low-to-none.
Quim Rovira [Sun, 14 Aug 2016 09:38:41 +0000 (11:38 +0200)]
Add tests for compression, and a CLI tool for manual testing.
I changed the names of the tests, so that compress round-trip runs
after the uncompress tests.
Also added a cli tool that tries to follow the official /bro/ cli tool,
but it's use is mostly for validation and testing, and is still missing
support for many of the flags (eg. --repeat).
For this, I moved the File::Slurp module to an actual dependency, not
a tests-only dep.
Quim Rovira [Sun, 14 Aug 2016 09:31:10 +0000 (11:31 +0200)]
Initial brotli compressor bindings
This provides both one-shot and streaming support, but I haven't yet
tested this thoroughly in terms of leaks and performance. The code tries
to adhere as much as possible to the rest of the module conventions.
Quim Rovira [Sun, 14 Aug 2016 09:08:20 +0000 (11:08 +0200)]
Use a local temporary buffer for decompression instead of a global.
Allocating the temporary buffer on each call to decompress might be
slightly less efficient, but that would mostly impact streaming
decompression with very small blocks.
Not even sure this change is really worth doing.. it could use some
benchmarking to see if it really makes sense.
Quim Rovira [Sat, 13 Aug 2016 11:29:06 +0000 (13:29 +0200)]
Update use of deprecated brotli decoder APIs
This does not cover the use of BrotliDecompressedSize, and by looking at
the brotli code, it might even be a good idea to just use the streaming
interface right away.