[MPlayer-dev-eng] values of mpctx->eof

Jehan Pagès jehan.marmottard at gmail.com
Thu Apr 8 06:29:22 CEST 2010


Hi,

while I was browsing mplayer.c, I could see that mpctx->eof had values
from mp_core.h:

#define PT_NEXT_ENTRY 1
#define PT_PREV_ENTRY -1
#define PT_NEXT_SRC 2
#define PT_PREV_SRC -2
#define PT_UP_NEXT 3
#define PT_UP_PREV -3
#define PT_STOP 4

Fine, meaningfull names.
Then I saw in a lot of places in mplayer.c that mpctx->eof was given
numerical values instead, for instance (among many more):

     if (mpctx->sh_video->vf_initialized < 0) {
      mp_msg(MSGT_CPLAYER,MSGL_FATAL, MSGTR_NotInitializeVOPorVO);
      mpctx->eof = 1; goto goto_next_file;
      }
      if (frame_time < 0)
      mpctx->eof = 1;

So I was going to fix all these occurrences of using numerical values
instead of the meaningfull macros (which is far better for
understanding the code).
Then I saw some very strange tests like this:

if(mpctx->eof == PT_NEXT_ENTRY || mpctx->eof == PT_PREV_ENTRY) {
    mpctx->eof = mpctx->eof == PT_NEXT_ENTRY ? 1 : -1;

It's like we check the values (twice!), then we set them... to the
same values they already were (in numerical form, which is absolutely
same as setting the macro for a compiler point of view). So is it just
all crazy code or is there something I don't understand here?
No because before going further and removing such insanities from the
code, I wanted to be sure they were really insanities (either I am the
insane one). Then I can send you a patch.
Bye.

Jehan



More information about the MPlayer-dev-eng mailing list