News for hackers. Stuff that matters.
Re:Farbfeld – A suckless image format by frign on Friday January 15, 2016 @06:49AM (#10908665)
If you just want to read in the header data, it should be sufficient if you just piped the decompressed data to your "header-checker" like this

bzip2 < giantimage.ff.bz2 | header-checker

Inside the header checker, you just read in the first 16 Bytes ("farbfeld" + width + height), do whatever you like with the data and exit. bzip2 would then receive an SIGPIPE. Up until this point, it would have probably filled the pipe buffer (~16K) with data and then blocked.

Receiving SIGPIPE, I'm certain bzip2(1) will cancel any further decompression attempts.

You see, you could even carry on with your image-processing in case you like the header data and want to proceed. The nice pipe-system already handles that for you. :)

Re:Farbfeld – A suckless image format by kedean on Friday January 15, 2016 @10:59AM (#10910042)
I think what he's saying is that you must decompress the entire thing before you can look at those headers. If all you want is the width and height, you still might have to decompress a gigantic image, which is lots of wasted work and time.
Re:Farbfeld – A suckless image format by bnolsen on Friday January 15, 2016 @02:45PM (#10911604)
i suspect a nogo programmatically, and then bring in windows...
Re:Farbfeld – A suckless image format by majewsky on Friday January 15, 2016 @06:56AM (#10908697)
s/EPIPE/SIGPIPE/, but otherwise, I agree. :)
Re:Farbfeld – A suckless image format by frign on Friday January 15, 2016 @07:08AM (#10908752)
Ah yeah, excuse me please. I've used errno too often today :P It's corrected now.