To decompress a gzip compressed file I had to provide a buffer that is one byte larger than indicated by the size field in the trailer of the file. Otherwise the library would return TINF_OK instead of TINF_DONE. The decompressed file size matched the trailer size field and the last byte was basically unneeded as far as I can tell. My code, including the size calculation, is based on the tgunzip code, using a chunk size of 1.
I have not looked into the source code to trace it, just wanted to let you know.