[MPlayer-dev-eng] [PATCH 1/4] String handling audit/cleanup take 2
Nicholas Kain
njkain at gmail.com
Wed Mar 7 11:48:32 CET 2007
> The +1 is a bugfix and will be applied. About the rest it's the same as
> in realrtsp: buffer was just created with the right size, why checkit
> again while writing into it?
It was just changed to make it a little easier on people who might
check the code for correctness later. If the functionally equivalent
changes are unwanted, they can just be dropped. I personally
like them because it makes code review a lot easier, but it's
not a big issue.
> > npkt++;
> > } else
> > line = strdup(src_line);
> > @@ -526,12 +526,9 @@ parse_smil(play_tree_parser_t* p) {
> > mp_msg(MSGT_PLAYTREE,MSGL_V,"Error parsing this source
> > line %s\n",line); continue;
> > }
> > - if (s_end-s_start> 511) {
> > - mp_msg(MSGT_PLAYTREE,MSGL_V,"Cannot store such a large
> > source %s\n",line);
> > - continue;
> > - }
> > - strncpy(source,s_start,s_end-s_start);
> > - source[(s_end-s_start)]='\0'; // Null terminate
> > + size = s_end-s_start+1;
> > + source = malloc(size);
> > + strlcpy(source,s_start,size);
>
> Probably ok, but that's an unrelated functional change (remove the
> 512 bytes line limit). this may be desiderable since i have a sample
> with a smil file on a single line (unsupported for other reasons atm).
Yeah, if there's an instance there this change causes breakage,
it can just be dropped. I only converted it to use malloc() because
it seemed to be an easy fix/improvement to make while I was
there.
More information about the MPlayer-dev-eng
mailing list