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

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Jul 5 19:17:41 CEST 2010


On Mon, Jul 05, 2010 at 06:51:55PM +0200, Dan Oscarsson wrote:
> 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.

Fine by me, any objections?
(I'd welcome anyone bored enough to give it a quick test and apply it).


More information about the MPlayer-dev-eng mailing list