Commit fcd3fd76 authored by JP Dinger's avatar JP Dinger Committed by Rémi Denis-Courmont

Recover from documented undefined value return on gnu platforms.

(cherry picked from commit 06633533)

Conflicts:

	src/input/item.c
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent 5ae159ef
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, write to the Free Software * with this program; if not, write to the Free Software Foundation, Inc.,
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
...@@ -379,29 +379,32 @@ void input_item_SetURI( input_item_t *p_i, const char *psz_uri ) ...@@ -379,29 +379,32 @@ void input_item_SetURI( input_item_t *p_i, const char *psz_uri )
/* The name is NULL: fill it with everything except login and password */ /* The name is NULL: fill it with everything except login and password */
if( !p_i->psz_name ) if( !p_i->psz_name )
{ {
int r;
vlc_url_t url; vlc_url_t url;
vlc_UrlParse( &url, psz_uri, 0 ); vlc_UrlParse( &url, psz_uri, 0 );
if( url.psz_protocol ) if( url.psz_protocol )
{ {
if( url.i_port > 0 ) if( url.i_port > 0 )
asprintf( &p_i->psz_name, "%s://%s:%d%s", url.psz_protocol, r=asprintf( &p_i->psz_name, "%s://%s:%d%s", url.psz_protocol,
url.psz_host, url.i_port, url.psz_host, url.i_port,
url.psz_path ? url.psz_path : "" ); url.psz_path ? url.psz_path : "" );
else else
asprintf( &p_i->psz_name, "%s://%s%s", url.psz_protocol, r=asprintf( &p_i->psz_name, "%s://%s%s", url.psz_protocol,
url.psz_host ? url.psz_host : "", url.psz_host ? url.psz_host : "",
url.psz_path ? url.psz_path : "" ); url.psz_path ? url.psz_path : "" );
} }
else else
{ {
if( url.i_port > 0 ) if( url.i_port > 0 )
asprintf( &p_i->psz_name, "%s:%d%s", url.psz_host, url.i_port, r=asprintf( &p_i->psz_name, "%s:%d%s", url.psz_host, url.i_port,
url.psz_path ? url.psz_path : "" ); url.psz_path ? url.psz_path : "" );
else else
asprintf( &p_i->psz_name, "%s%s", url.psz_host, r=asprintf( &p_i->psz_name, "%s%s", url.psz_host,
url.psz_path ? url.psz_path : "" ); url.psz_path ? url.psz_path : "" );
} }
vlc_UrlClean( &url ); vlc_UrlClean( &url );
if( -1==r )
p_i->psz_name=NULL; /* recover from undefined value */
/* Make the name more readable */ /* Make the name more readable */
if( p_i->psz_name ) if( p_i->psz_name )
......
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