vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Tue Aug 21 22:48:35 2012 +0300| [283669aa5a738317149f0b775e25b7d59cf7dad2] | committer: Rémi Denis-Courmont
ftp: add callback to parse server responses > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=283669aa5a738317149f0b775e25b7d59cf7dad2 --- modules/access/ftp.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/access/ftp.c b/modules/access/ftp.c index 532cdd0..106cc89 100644 --- a/modules/access/ftp.c +++ b/modules/access/ftp.c @@ -159,8 +159,9 @@ static int ftp_SendCommand( vlc_object_t *obj, access_sys_t *sys, These strings are not part of the requests, except in the case \377\377, where the request contains one \377. */ -static int ftp_RecvCommand( vlc_object_t *obj, access_sys_t *sys, - int *restrict codep, char **restrict strp ) +static int ftp_RecvAnswer( vlc_object_t *obj, access_sys_t *sys, + int *restrict codep, char **restrict strp, + void (*cb)(void *, const char *), void *opaque ) { if( codep != NULL ) *codep = 500; @@ -198,6 +199,8 @@ static int ftp_RecvCommand( vlc_object_t *obj, access_sys_t *sys, } done = !strncmp( resp, line, 4 ); + if( !done ) + cb( opaque, line ); free( line ); } while( !done ); @@ -215,6 +218,17 @@ error: return -1; } +static void DummyLine( void *data, const char *str ) +{ + (void) data; (void) str; +} + +static int ftp_RecvCommand( vlc_object_t *obj, access_sys_t *sys, + int *restrict codep, char **restrict strp ) +{ + return ftp_RecvAnswer( obj, sys, codep, strp, DummyLine, NULL ); +} + static int ftp_StartStream( vlc_object_t *, access_sys_t *, uint64_t ); static int ftp_StopStream ( vlc_object_t *, access_sys_t * ); _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
