Hey all! I'm currently working on a project using zlib and bzlib, and I'm currently slightly stomped by the fact that both define the input buffer in their stream structure as non-const. Generally, I'd assume that the input buffer is never changed (by any of the compression/decompression functions), and that it should thus be defined as a const pointer. My wrappers for them assume the same, of course.
I've read the zlib manual, and there is some obscure function which uses the input buffer as temporary storage (restoring it on exit), but at least for the code paths I'm taking (the standard deflate/inflate), I'm pretty confident after skimming through the sources that they don't modify the input buffer and don't call into the function that does modify it (and thus a const_cast<> to set it up is perfectly okay). For bzlib, I'm less sure, as the sources are somewhat convoluted, and I probably didn't find all references to the input buffer in the code paths I checked. Before I go and test whether bzlib modifies the input buffer for temporaries (by simply passing it data in a RO segment and checking whether I get a SIGSEGV), is there anyone out there who's hit the same "problem" before and might shed some more insight whether I'll have to copy the data before setting it up in a stream structure as input? Thanks for any reply! -- Heiko Wundram Product & Application Development _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"