It was my observation, in some compressor, that ungetc() was used, which
in the C specification/implementation allows to modify the input stream.
Since this function was used in an illegal/unspecified way, to put back
more than one byte, I designed my own stream with a larger unget buffer.
This model removed the need for checks for a pushed-back byte, by simply
decrementing the input pointer, and placing the byte into the file
buffer (with configurable underrun size). Another model would simply
ignore tha ungetc() argument, or verify that the push-back byte equals
the byte in the buffer, so that only the buffer pointer has to be updated.
That's why I think that the use of standard library functions can
introduce unwanted security risks, like the non-const property of some
pointer. And last not least, that's one of the reasons why C is not my
favorite programming language ;-)