This looks wrong, compressor::buflen() will be the # bytes in the compressor buffer at the time of calling..
Might work coincidentally, if size is less than compressors internal buffer size..

You should be returning fileio->size() I think - i.e. the physical size of the file written.