[vlc-devel] [PATCH 4/9] raop: Implement options for password
jpd at videolan.org
jpd at videolan.org
Mon Jul 27 10:37:30 CEST 2009
On Sun, Jul 26, 2009 at 12:01:48AM +0200, Michael Hanselmann wrote:
> On Fri, Jul 24, 2009 at 11:41 AM, <jpd at videolan.org> wrote:
> > On Fri, Jul 24, 2009 at 11:24:59AM +0200, Michael Hanselmann wrote:
> >> So, the strsep(3) call in my patch just replaces the first occurence
> >> of "\r" or "\n" after the password.
> >
> > Right. But you would only need "\n" if the file is opened in "text"
> > mode. And in that case, strlen()-1 would do equally well to find the
> > newline if it's there.
>
> It's not equally well. The function should just return the first line,
> not just remove the last newline.
Isn't that, minus the removing of the newline, what fgets() does anyway?
> + psz_newline = index(ps_buffer, '\n');
> + if ( psz_newline != NULL )
> + *psz_newline = '\0';
That works, too. Now if fgets would return the number of characters read
you could dispense with the strlen/index entirely, but alas, it doesn't.
More information about the vlc-devel
mailing list