Commit 0678f194 authored by Gildas Bazin's avatar Gildas Bazin

* src/playlist/info.c: get rid of the #ifdef HAVE_VASPRINTF now that we have it in our small libc.
* modules/control/http.c: fixed parsing in uri_extract_value().
parent 7ae61fab
......@@ -2,7 +2,7 @@
* http.c : http mini-server ;)
*****************************************************************************
* Copyright (C) 2001-2004 VideoLAN
* $Id: http.c,v 1.46 2004/01/17 15:17:02 gbazin Exp $
* $Id: http.c,v 1.47 2004/01/17 16:24:14 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Laurent Aimar <fenrir@via.ecp.fr>
......@@ -2381,9 +2381,16 @@ static int http_get( httpd_file_callback_args_t *p_args,
static char *uri_extract_value( char *psz_uri, char *psz_name,
char *psz_value, int i_value_max )
{
char *p;
char *p = psz_uri;
while( (p = strstr( p, psz_name )) )
{
/* Verify that we are dealing with a post/get argument */
if( p == psz_uri || *(p - 1) == '&' || *(p - 1) == '\n' )
break;
p++;
}
p = strstr( psz_uri, psz_name );
if( p )
{
int i_len;
......
......@@ -2,7 +2,7 @@
* info.c : Playlist info management
*****************************************************************************
* Copyright (C) 1999-2004 VideoLAN
* $Id: info.c,v 1.4 2004/01/15 19:23:14 sigmunau Exp $
* $Id: info.c,v 1.5 2004/01/17 16:24:14 gbazin Exp $
*
* Authors: Clment Stenac <zorglub@videolan.org>
*
......@@ -266,20 +266,7 @@ int playlist_AddInfo( playlist_t *p_playlist, int i_item,
}
va_start( args, psz_format );
/* Convert our message to a string */
#if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN) && !defined(SYS_BEOS)
vasprintf( &psz_value, psz_format, args );
#else
psz_value = (char*)malloc( strlen(psz_format) + INTF_MAX_MSG_SIZE );
if( psz_value == NULL )
{
msg_Err( p_playlist, "out of memory" );
return VLC_EGENERIC;
}
vsprintf( psz_value, psz_format, args );
#endif
va_end( args );
i_ret = playlist_AddItemInfo( p_item , psz_cat , psz_name , psz_value );
......@@ -340,20 +327,7 @@ int playlist_AddItemInfo( playlist_item_t *p_item,
}
va_start( args, psz_format );
/* Convert our message to a string */
#if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN) && !defined(SYS_BEOS)
vasprintf( &p_info->psz_value, psz_format, args );
#else
p_info->psz_value =
(char*) malloc( strlen(psz_format) + INTF_MAX_MSG_SIZE );
if( p_info->psz_value == NULL )
{
return -1;
}
vsprintf( p_info->psz_value, psz_format, args );
#endif
va_end( args );
/* If this is new, insert it */
......@@ -418,28 +392,11 @@ int playlist_AddOption( playlist_t *p_playlist, int i_item,
p_info->psz_name = strdup( "option" );
va_start( args, psz_format );
/* Convert our message to a string */
#if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN) && !defined(SYS_BEOS)
vasprintf( &p_info->psz_value, psz_format, args );
#else
p_info->psz_value =
(char*) malloc( strlen(psz_format) + INTF_MAX_MSG_SIZE );
if( p_info->psz_value == NULL )
{
msg_Err( p_playlist, "out of memory" );
return -1;
}
vsprintf( p_info->psz_value, psz_format, args );
#endif
va_end( args );
INSERT_ELEM( p_cat->pp_infos, p_cat->i_infos, p_cat->i_infos, p_info );
INSERT_ELEM( p_cat->pp_infos ,
p_cat->i_infos,
p_cat->i_infos,
p_info );
return 0;
}
......@@ -451,7 +408,7 @@ int playlist_AddOption( playlist_t *p_playlist, int i_item,
* \return 0 on success
*/
int playlist_AddItemOption( playlist_item_t *p_item,
const char *psz_format, ... )
const char *psz_format, ... )
{
va_list args;
item_info_t *p_info = NULL;
......@@ -467,28 +424,14 @@ int playlist_AddItemOption( playlist_item_t *p_item,
{
return -1;
}
p_info->psz_name = strdup( "option" );
va_start( args, psz_format );
/* Convert our message to a string */
#if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN) && !defined(SYS_BEOS)
vasprintf( &p_info->psz_value, psz_format, args );
#else
p_info->psz_value =
(char*) malloc( strlen(psz_format) + INTF_MAX_MSG_SIZE );
if( p_info->psz_value == NULL )
{
return -1;
}
vsprintf( p_info->psz_value, psz_format, args );
#endif
va_end( args );
INSERT_ELEM( p_cat->pp_infos,
p_cat->i_infos,
p_cat->i_infos,
p_info );
INSERT_ELEM( p_cat->pp_infos, p_cat->i_infos, p_cat->i_infos, p_info );
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment