[MPlayer-users] [PATCH] make cache2.c readable

Denis Vlasenko vda.linux at googlemail.com
Wed Aug 23 13:05:39 CEST 2006


> Imho, it is easy to read this code when using *good* syntax 
> highlightning (which displays pointer and logical operators with 
> different colors).

Are -> and > in different color in your editor?

What if my ssh client does not support colors?

> I think you can't change code to fit your own  
> preferences.

I do not fit code to my own preferences. My preferences are:
8 char wide tab stops, lines wrapped at 80 chars, spaces around
operators (mostly) and after commas, enums instead of
#define CONST 66

However, I did not apply "my" style in the patch I sent.
I looked at the existing code and tried to figure out
what style is used there, then apply it over entire file.

I did add spaces around <, >, >= etc because I thought that

if(space>s->buffer_size-pos) space=s->buffer_size-pos;

is *hard to read*. Why should reader waste his time trying to find >
there? We should encourage, not preclude peer review.
IOCCC is there ------> http://www.ioccc.org/

> > and (b) long lines 
> > simply scroll off out of the window in my editor.
> 
> Maybe you should try word-wrap feature? I hope, your editor supports it 
> properly.

Like this?

    // wait until cache is filled at least prefill_init %
    mp_msg(MSGT_CACHE,MSGL_V,"CACHE_PRE_INIT: %"PRId64" [%"PRId64"] %"PRId64"
pre:%d  eof:%d  \n",

(int64_t)s->min_filepos,(int64_t)s->read_filepos,(int64_t)s->max_filepos,min,s->
eof);
    while(s->read_filepos<s->min_filepos || s->max_filepos-s->read_filepos<min){
        mp_msg(MSGT_CACHE,MSGL_STATUS,MSGTR_CacheFill,

100.0*(float)(s->max_filepos-s->read_filepos)/(float)(s->buffer_size),
            (int64_t)s->max_filepos-s->read_filepos
        );


Please let me know which changes from my patch,
_if any_, were acceptable.
--
vda



More information about the MPlayer-users mailing list