> On Nov 28, 2018, at 13:19, Marton Balint <c...@passwd.hu> wrote: > > > > On Wed, 28 Nov 2018, Rodger Combs wrote: > >> pb->eof_reached is set on error, so we need to check pb->error, >> even after checking pb->eof_reached or avio_feof(pb), or else we >> can end up returning AVERROR_EOF instead of the actual error code. > > Why eof_reached is set in the first place on error? Why does avio_feof() > return nonzero if we are not at the end of file? That is strictly against its > documentation.
Looks like it's been like that since at least 2002. It's probably because a lot of code that loops on e.g. avio_r8 checks for EOF, but doesn't explicitly check for error, so if errors didn't set the EOF flag, they'd just loop forever. Either way, that code needs to be updated to return errors properly, so I don't think removing the EOF-on-error behavior is helpful (it'd just make existing problem cases worse). > > Seems like a fine mess, let's think about how we will resolve this in a > generic way. I don't think this can really be resolved generically, since all the places that currently just return AVERROR_EOF in this case will need updating to read the error from AVIOContext regardless. > > Thanks, > Marton > _______________________________________________ > ffmpeg-devel mailing list > firstname.lastname@example.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel _______________________________________________ ffmpeg-devel mailing list email@example.com http://ffmpeg.org/mailman/listinfo/ffmpeg-devel