[MPlayer-dev-eng] [PATCH] mp_msg - avoid having status line overwrite messages

Dan Oscarsson Dan.Oscarsson at tieto.com
Mon Jul 5 18:51:55 CEST 2010


tis 2010-06-29 klockan 16:39 +0200 skrev Reimar Döffinger:
> On Tue, Jun 29, 2010 at 08:28:46AM +0200, Dan Oscarsson wrote:
> > On 2010-06-28 at 19:34 +0200 Reimar Döffinger wrote:
> > > >      if (header)
> > > >          print_msg_module(stream, mod);
> > > >      set_msg_color(stream, lev);
> > > >      header = tmp[strlen(tmp)-1] == '\n' || tmp[strlen(tmp)-1] == '\r';
> > > > +    statusline = tmp[strlen(tmp)-1] == '\r' && lev == MSGL_STATUS;
> > > 
> > > Why the check for '\r'? I'm quite unhappy about those strlen-usages, they
> > > break quite badly if someone ever tries to print an empty string...
> > 
> > Because if \r have been output, next line will overwrite current line.
> 
> Ok, let me simplify my question:
> What breaks if you just use
> statusline = lev == MSGL_STATUS;

Attached is my patch without the check for \r.

For the common usage it works fine. If I do grep on MSGL_STATUS I see
that there are some outputs that ends in new line. Those output lines
may get an extra new line but should not break otherwise.
I am not sure that most of those lines should have MSGL_STATUS on them.

   Dan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mp_msg.diff
Type: text/x-patch
Size: 796 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20100705/6de85989/attachment.bin>


More information about the MPlayer-dev-eng mailing list