]> git.sesse.net Git - vlc/blobdiff - modules/demux/playlist/shoutcast.c
(p?)gettext -> vlc_\1gettext
[vlc] / modules / demux / playlist / shoutcast.c
index e967fd347b79562ca6f926113ff7523550571189..e5257de3dd1d61b001f0f744e7b36e9367017d6e 100644 (file)
@@ -224,17 +224,16 @@ static int DemuxGenre( demux_t *p_demux )
                 if( !psz_eltname ) return -1;
                 if( !strcmp( psz_eltname, "genre" ) )
                 {
-                    char *psz_mrl = malloc( strlen( SHOUTCAST_BASE_URL )
-                            + strlen( "?genre=" ) + strlen( psz_name ) + 1 );
-                    sprintf( psz_mrl, SHOUTCAST_BASE_URL "?genre=%s",
-                             psz_name );
-                    p_input = input_item_NewExt( p_demux, psz_mrl,
-                                                psz_name, 0, NULL, -1 );
-                    input_item_CopyOptions( p_sys->p_current_input,
-                                                p_input );
-                    free( psz_mrl );
-                    input_item_AddSubItem( p_sys->p_current_input, p_input );
-                    vlc_gc_decref( p_input );
+                    char* psz_mrl;
+                    if( asprintf( &psz_mrl, SHOUTCAST_BASE_URL "?genre=%s",
+                             psz_name ) != -1 )
+                    {
+                        p_input = input_item_New( p_demux, psz_mrl, psz_name );
+                        input_item_CopyOptions( p_sys->p_current_input, p_input );
+                        free( psz_mrl );
+                        input_item_AddSubItem( p_sys->p_current_input, p_input );
+                        vlc_gc_decref( p_input );
+                    }
                     FREENULL( psz_name );
                 }
                 FREENULL( psz_eltname );
@@ -318,9 +317,9 @@ static int DemuxStation( demux_t *p_demux )
                             xml_ReaderValue( p_sys->p_xml_reader );
                         if( !psz_attrname || !psz_attrvalue )
                         {
-                            free(psz_eltname);
-                            FREENULL(psz_attrname);
-                            FREENULL(psz_attrvalue);
+                            free( psz_eltname );
+                            free( psz_attrname );
+                            free( psz_attrvalue );
                             return -1;
                         }
 
@@ -344,9 +343,9 @@ static int DemuxStation( demux_t *p_demux )
                             xml_ReaderValue( p_sys->p_xml_reader );
                         if( !psz_attrname || !psz_attrvalue )
                         {
-                            free(psz_eltname);
-                            FREENULL(psz_attrname);
-                            FREENULL(psz_attrvalue);
+                            free( psz_eltname );
+                            free( psz_attrname );
+                            free( psz_attrvalue );
                             return -1;
                         }
 
@@ -369,7 +368,7 @@ static int DemuxStation( demux_t *p_demux )
                         free( psz_attrvalue );
                     }
                 }
-                free(psz_eltname);
+                free( psz_eltname );
                 break;
 
             case XML_READER_TEXT:
@@ -388,33 +387,29 @@ static int DemuxStation( demux_t *p_demux )
                     if( psz_rt || psz_load )
                     {
                         /* tv */
-                        psz_mrl = malloc( strlen( SHOUTCAST_TV_TUNEIN_URL )
-                                          + strlen( psz_id ) + 1 );
-                        sprintf( psz_mrl, SHOUTCAST_TV_TUNEIN_URL "%s",
-                                 psz_id );
+                        if( asprintf( &psz_mrl, SHOUTCAST_TV_TUNEIN_URL "%s",
+                                 psz_id ) == -1)
+                            psz_mrl = NULL;
                     }
                     else
                     {
                         /* radio */
-                        psz_mrl = malloc( strlen( SHOUTCAST_TUNEIN_BASE_URL )
-                            + strlen( psz_base ) + strlen( "?id=" )
-                            + strlen( psz_id ) + 1 );
-                        sprintf( psz_mrl, SHOUTCAST_TUNEIN_BASE_URL "%s?id=%s",
-                             psz_base, psz_id );
+                        if( asprintf( &psz_mrl, SHOUTCAST_TUNEIN_BASE_URL "%s?id=%s",
+                             psz_base, psz_id ) == -1 )
+                            psz_mrl = NULL;
                     }
-                    p_input = input_item_NewExt( p_demux, psz_mrl,
-                                                psz_name , 0, NULL, -1 );
+                    p_input = input_item_New( p_demux, psz_mrl, psz_name );
+                    input_item_CopyOptions( p_sys->p_current_input, p_input );
                     free( psz_mrl );
 
-                    input_item_CopyOptions( p_sys->p_current_input,
-                                                p_input );
-
-#define SADD_INFO( type, field ) if( field ) { input_item_AddInfo( \
-                    p_input, _("Shoutcast"), _(type), "%s", field ) ; }
-                    SADD_INFO( "Mime type", psz_mt );
-                    SADD_INFO( "Bitrate", psz_br );
-                    SADD_INFO( "Listeners", psz_lc );
-                    SADD_INFO( "Load", psz_load );
+#define SADD_INFO( type, field ) \
+                    if( field ) \
+                        input_item_AddInfo( p_input, _("Shoutcast"), \
+                                            vlc_gettext(type), "%s", field )
+                    SADD_INFO( N_("Mime"), psz_mt );
+                    SADD_INFO( N_("Bitrate"), psz_br );
+                    SADD_INFO( N_("Listeners"), psz_lc );
+                    SADD_INFO( N_("Load"), psz_load );
                     if( psz_genre )
                         input_item_SetGenre( p_input, psz_genre );
                     if( psz_ct )