esound r514 - trunk



Author: jmouette
Date: Tue Nov 18 20:14:36 2008
New Revision: 514
URL: http://svn.gnome.org/viewvc/esound?rev=514&view=rev

Log:
        * esdlib.c: do not modify host passed to esd_sound_open,
        because that is highly offensive. (Fixes GStreamer using 
        ESPEAKER.) 


Modified:
   trunk/ChangeLog
   trunk/esdlib.c

Modified: trunk/esdlib.c
==============================================================================
--- trunk/esdlib.c	(original)
+++ trunk/esdlib.c	Tue Nov 18 20:14:36 2008
@@ -825,15 +825,22 @@
  * to ESD.
  */
 #define min(a,b) ( ( (a)<(b) ) ? (a) : (b) )
-int esd_open_sound( const char *host )
+int esd_open_sound( const char *rhost )
 {
     int socket_out = -1;
     int len;
     char use_unix = 0;
     char display_host[ 256 ];
     const char *display;
+    char *host = NULL;
 
-    if ( !host ) host = getenv("ESPEAKER");
+    if ( rhost )
+	host = strdup(rhost);
+    else {
+	char *espeaker = getenv("ESPEAKER");
+	if ( espeaker )
+	    host = strdup(espeaker);
+    }
 
     display = getenv( "DISPLAY" );
     if ( !(host && *host) && display ) {
@@ -845,7 +852,8 @@
 	    len = min( len, 255 ); 
 	    strncpy( display_host, display, len );
 	    display_host[ len ] = '\0';
-	    host = display_host;
+	    if ( host ) free(host);
+	    host = strdup(display_host);
 	}
     }
 
@@ -943,6 +951,7 @@
 	close(socket_out); socket_out = -1;
     }
 
+    if ( host ) free(host);
     return socket_out;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]