sharplispers / chipz Goto Github PK
View Code? Open in Web Editor NEWA Common Lisp library for decompressing deflate, zlib, gzip, and bzip2 data
License: BSD 3-Clause "New" or "Revised" License
A Common Lisp library for decompressing deflate, zlib, gzip, and bzip2 data
License: BSD 3-Clause "New" or "Revised" License
I'm not sure what the protocol is for something like this, could someone place this into ultralisp?
If it is something I can do via a mirroring fork, then I'll do it. If a sharplisper member is empowered to do so then I request that it be so.
And if there is good reason to avoid it, I'm all ears.
cheers
Hello,
i tried the following code with an error :
From linux shell :
:~> echo "huge" | bzip2 - > huge.bz2
:~> file huge.bz2
huge.bz2: bzip2 compressed data, block size = 900k
Lisp Code (according to the doc) :
(with-open-file (stream "huge.bz2" :element-type '(unsigned-byte 8))
(chipz:decompress nil 'chipz:bzip2 stream))
Error (SIMPLE-ERROR) during printing: #<CHIPZ:INVALID-BZIP2-DATA {1006A7BB43}>
With a little help from comp.lang.lisp, i think there is an error in the bzip2.lisp file.
In the following function :
(bzip2-selector1 (state)
(declare (type bzip2-state state))
(let ((n-groups (ensure-and-read-bits 3 state)))
(unless (<= 3 n-groups 6)
(error 'invalid-bzip2-data))
(setf (bzip2-state-n-groups state) n-groups)
(transition-to bzip2-selector2)))
the n-groups value is tested between 3 and 6.
But in the C code version (decompress.c v1.0.6) the test is between 2 and 6.
if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR);
(line 288)
With 2 instead of 3, no more error in the test.
Thanks
Following has a reasonable chance (30%+) of triggering EOF
error from chipz
:
(ql:quickload '(chipz salza2))
(let* ((d (map-into (make-array (expt 2 8) :element-type '(unsigned-byte 8))
(lambda () (random 255))))
(v (salza2:compress-data d 'salza2:deflate-compressor)))
(with-simple-restart (continue "continue")
(let ((x (time (chipz:decompress nil 'chipz:deflate v))))
(assert (equalp d x)))))
Not completely sure it is chipz
rather than salza2
, but other decompressors don't seem to object to the same data.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.