udoprog/c10t

gzstream empty check not working correctly when bulit with zlib

evildeeds opened this issue · 0 comments

The symptoms are that the parse routine ends up throwing an exception about the stream not being empty despite that there is no more data to read.

For me, c10t works excellent for rendering maps. However player names cannot be rendered since there are no OK players to render, still data in buffer and therefore are not queued for rendering.

The gzstream empty check relies on the function gzeof, however gzeof will only claim eof after attempting to read past the end of file which causes the player parsing to fail because the parser has not attempted to read past the end of file yet.

http://www.gzip.org/zlib/manual.html#gzeof

Arguably there is something wrong with my map files, however these are old server maps I intended to package with multiple different map renderings, including with player positions.

// edit
By gzstream, I meant the gzfile_buffer class. Sorry for the confusion.