[vlc-devel] commit: Recover from documented undefined value return on gnu platforms. ( JP Dinger )

git version control git at videolan.org
Sun Jul 12 15:55:43 CEST 2009


vlc | branch: 1.0-bugfix | JP Dinger <jpd at videolan.org> | Sun Jul 12 16:54:38 2009 +0300| [fcd3fd76e06cf06e258593b47b04c142f76e9f3f] | committer: Rémi Denis-Courmont 

Recover from documented undefined value return on gnu platforms.

(cherry picked from commit 06633533198483253082b7be9046204889d841f7)

Conflicts:

	src/input/item.c

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fcd3fd76e06cf06e258593b47b04c142f76e9f3f
---

 src/input/item.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/input/item.c b/src/input/item.c
index 35ec086..17c08dd 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -16,9 +16,9 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #ifdef HAVE_CONFIG_H
@@ -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 */
     if( !p_i->psz_name )
     {
+        int r;
         vlc_url_t url;
         vlc_UrlParse( &url, psz_uri, 0 );
         if( url.psz_protocol )
         {
             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_path ? url.psz_path : "" );
             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_path ? url.psz_path : "" );
         }
         else
         {
             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 : "" );
             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 : "" );
         }
         vlc_UrlClean( &url );
+        if( -1==r )
+            p_i->psz_name=NULL; /* recover from undefined value */
 
         /* Make the name more readable */
         if( p_i->psz_name )




More information about the vlc-devel mailing list