Open tmpvar opened 6 years ago
Sounds good to me: does this also fix the issue where endsolid
would trigger a second description
?
Actually, would it be possible to merge this and #3? I'd imagine there are more consuming libraries that'd be tripped up by an embedded null in the description than ones that would want to read past it.
I think with this fix we avoid the situation where the ascii codepath is followed (including emitting events) until it finally figures out that it's actually ascii or binary. The fix in #3 is specifically for the ascii codepath (we probably don't expect \0
chars in the ascii version), but if we properly detect that the file is binary we can throw away all of the pending ascii events and restart on the binary path.
I'll add some more testing to make sure description is only emitted once for this case, but I'm pretty confident that had to do with the ascii path emitting one description and then the binary path emitting another.
The behavior for looking ahead to determine if the file is actually ascii was actually emitting data before we made that determination. This fixes that by adding a queue that holds on to all ascii emissions (mainly
description
, but the other types are covered as well) until we encounter afacet
string.cc @stuartpb