diff --git a/ChangeLog b/ChangeLog index b36a1d78..4dbe2a25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,7 @@ Michael Voigt 2009-02-20 Stephane Letz * Add InitConnection and InitRendering methods in JackNetSlaveInterface, better packet type checking in JackNetSlaveInterface::SyncRecv. + * Change fMulticastIP handling in JackNetInterface. 2009-02-17 Stephane Letz diff --git a/common/JackNetAdapter.cpp b/common/JackNetAdapter.cpp index 9a90503b..e1f16bde 100644 --- a/common/JackNetAdapter.cpp +++ b/common/JackNetAdapter.cpp @@ -34,7 +34,6 @@ namespace Jack //we can't call JackNetSlaveInterface constructor with some parameters before //because we don't have full parametering right now //parameters will be parsed from the param list, and then JackNetSlaveInterface will be filled with proper values - fMulticastIP = new char[16]; strcpy ( fMulticastIP, DEFAULT_MULTICAST_IP ); uint port = DEFAULT_PORT; GetHostName ( fParams.fName, JACK_CLIENT_NAME_SIZE ); @@ -60,10 +59,10 @@ namespace Jack switch ( param->character ) { case 'a' : - if ( strlen ( param->value.str ) < 16 ) - strcpy ( fMulticastIP, param->value.str ); + if (strlen (param->value.str) < 32) + strcpy(fMulticastIP, param->value.str); else - jack_error ( "Can't use multicast address %s, using default %s", param->value.ui, DEFAULT_MULTICAST_IP ); + jack_error("Can't use multicast address %s, using default %s", param->value.ui, DEFAULT_MULTICAST_IP); break; case 'p' : fSocket.SetPort ( param->value.ui ); diff --git a/common/JackNetInterface.cpp b/common/JackNetInterface.cpp index 37faaa9a..bf238c53 100644 --- a/common/JackNetInterface.cpp +++ b/common/JackNetInterface.cpp @@ -36,7 +36,6 @@ namespace Jack JackNetInterface::JackNetInterface() : fSocket() { - fMulticastIP = NULL; fTxBuffer = NULL; fRxBuffer = NULL; fNetAudioCaptureBuffer = NULL; @@ -47,7 +46,7 @@ namespace Jack JackNetInterface::JackNetInterface ( const char* multicast_ip, int port ) : fSocket ( multicast_ip, port ) { - fMulticastIP = strdup ( multicast_ip ); + strcpy(fMulticastIP, multicast_ip); fTxBuffer = NULL; fRxBuffer = NULL; fNetAudioCaptureBuffer = NULL; @@ -59,7 +58,7 @@ namespace Jack JackNetInterface::JackNetInterface ( session_params_t& params, JackNetSocket& socket, const char* multicast_ip ) : fSocket ( socket ) { fParams = params; - fMulticastIP = strdup ( multicast_ip ); + strcpy(fMulticastIP, multicast_ip); fTxBuffer = NULL; fRxBuffer = NULL; fNetAudioCaptureBuffer = NULL; @@ -75,7 +74,6 @@ namespace Jack fSocket.Close(); delete[] fTxBuffer; delete[] fRxBuffer; - delete[] fMulticastIP; delete fNetAudioCaptureBuffer; delete fNetAudioPlaybackBuffer; delete fNetMidiCaptureBuffer; diff --git a/common/JackNetInterface.h b/common/JackNetInterface.h index eaf0a3ef..40617a16 100644 --- a/common/JackNetInterface.h +++ b/common/JackNetInterface.h @@ -34,7 +34,7 @@ namespace Jack protected: session_params_t fParams; JackNetSocket fSocket; - char* fMulticastIP; + char fMulticastIP[32]; uint fNSubProcess; //headers diff --git a/common/JackNetManager.cpp b/common/JackNetManager.cpp index 6ed7c21c..a30b77e6 100644 --- a/common/JackNetManager.cpp +++ b/common/JackNetManager.cpp @@ -474,7 +474,7 @@ namespace Jack fManagerClient = client; fManagerName = jack_get_client_name ( fManagerClient ); - fMulticastIP = DEFAULT_MULTICAST_IP; + strcpy(fMulticastIP, DEFAULT_MULTICAST_IP); fSocket.SetPort ( DEFAULT_PORT ); fGlobalID = 0; fRunning = true; @@ -487,7 +487,10 @@ namespace Jack switch ( param->character ) { case 'a' : - fMulticastIP = strdup ( param->value.str ); + if (strlen (param->value.str) < 32) + strcpy(fMulticastIP, param->value.str); + else + jack_error("Can't use multicast address %s, using default %s", param->value.ui, DEFAULT_MULTICAST_IP); break; case 'p': fSocket.SetPort ( param->value.ui ); diff --git a/common/JackNetManager.h b/common/JackNetManager.h index 2b91d791..a9cb8a37 100644 --- a/common/JackNetManager.h +++ b/common/JackNetManager.h @@ -101,7 +101,7 @@ namespace Jack jack_client_t* fManagerClient; const char* fManagerName; - const char* fMulticastIP; + char fMulticastIP[32]; JackNetSocket fSocket; pthread_t fManagerThread; master_list_t fMasterList;