#include "network.h"
#include "charset.h"
-#include <errno.h> /* ENOMEM */
+#include <ctype.h>
+#include <errno.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
static void FreeSDP( sdp_t *p_sdp );
/* Detect multicast addresses */
-static int ismult( char * );
+static vlc_bool_t ismult( char * );
#define FREE( p ) \
if( p ) { free( p ); (p) = NULL; }
{
char *psz_local, *psz_in, *psz_out;
size_t ret, i_in, i_out;
+ vlc_bool_t b_warn = VLC_FALSE;
if( psz_unicode == NULL )
return NULL;
&psz_in, &i_in, &psz_out, &i_out);
if( i_in )
{
- *psz_in = '\0';
- msg_Warn( p_sd, "after \"%s\" : %s", strerror( errno ),
- psz_unicode );
*psz_in = '?';
+ b_warn = VLC_TRUE;
}
else
if( ret == (size_t)(-1) )
}
}
while( i_in );
+
+ if( b_warn )
+ msg_Warn( p_sd, "in \"%s\" : %s", psz_unicode,
+ strerror( errno ) );
+
*psz_out = '\0';
return psz_local;
}
/***********************************************************************
* ismult: returns true if we have a multicast address
***********************************************************************/
-static int ismult( char *psz_uri )
+static vlc_bool_t ismult( char *psz_uri )
{
char *psz_end;
int i_value;
- i_value = strtol( psz_uri, &psz_end, 0 );
-
/* IPv6 */
if( psz_uri[0] == '[')
{
if( strncasecmp( &psz_uri[1], "FF0" , 3) ||
- strncasecmp( &psz_uri[2], "FF0" , 3))
+ ( !isalnum( psz_uri[1]) && strncasecmp( &psz_uri[2], "FF0" , 3) ) )
return( VLC_TRUE );
else
return( VLC_FALSE );
}
+
+ i_value = strtol( psz_uri, &psz_end, 0 );
if( *psz_end != '.' ) { return( VLC_FALSE ); }
- return( i_value < 224 ? VLC_FALSE : VLC_TRUE );
+ return ( ( i_value < 224 ) || ( i_value >= 240 ) ) ? VLC_FALSE : VLC_TRUE;
}
static int InitSocket( services_discovery_t *p_sd, char *psz_address,