From 6604d0a974fa1e386935d2ccdc08a630538476d4 Mon Sep 17 00:00:00 2001 From: Marcelo Roberto Jimenez Date: Fri, 10 Sep 2010 19:02:31 -0300 Subject: [PATCH] SF Patch Tracker [ 2854711 ] Patch for Solaris10 compilation and usage Submitted By: zephyrus ( zephyrus00jp ) Patch for Solaris10 compilation and usage. (cherry picked from commit 5755ac022f9ed7b11a356854c0ab15c838df6a45) --- ChangeLog | 6 ++++++ upnp/sample/common/sample_util.c | 18 +++++++++--------- upnp/sample/tvcombo/upnp_tv_ctrlpt.c | 3 ++- upnp/sample/tvcombo/upnp_tv_device.c | 8 +++++--- upnp/sample/tvctrlpt/upnp_tv_ctrlpt.c | 8 +++++--- 5 files changed, 27 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index d9704aa..2e8f78b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,12 @@ Version 1.8.0 ******************************************************************************* +2010-09-10 Chandra Penke + * SF Patch Tracker [ 2854711 ] Patch for Solaris10 compilation and usage + Submitted By: zephyrus ( zephyrus00jp ) + + Patch for Solaris10 compilation and usage. + 2010-09-10 Chandra Penke Add support for conditionally enabling ipv6. diff --git a/upnp/sample/common/sample_util.c b/upnp/sample/common/sample_util.c index 0cbb4e1..a607553 100644 --- a/upnp/sample/common/sample_util.c +++ b/upnp/sample/common/sample_util.c @@ -43,7 +43,8 @@ #endif -int initialize = 1; +static int initialize_init = 1; +static int initialize_register = 1; /*! Function pointers to use for displaying formatted strings. * Set on Initialization of device. */ @@ -67,7 +68,7 @@ ithread_mutex_t display_mutex; ******************************************************************************/ int SampleUtil_Initialize(print_string print_function) { - if (initialize) { + if (initialize_init) { ithread_mutexattr_t attr; ithread_mutexattr_init(&attr); @@ -80,7 +81,7 @@ int SampleUtil_Initialize(print_string print_function) gPrintFun = print_function; ithread_mutex_unlock(&display_mutex); - initialize = 0; + initialize_init = 0; } else { SampleUtil_Print("***** SampleUtil_Initialize was called multiple times!\n"); abort(); @@ -99,12 +100,9 @@ int SampleUtil_Initialize(print_string print_function) ******************************************************************************/ int SampleUtil_RegisterUpdateFunction(state_update update_function) { - /* Intialize only once. */ - static int initialize = 1; - - if (initialize) { + if (initialize_register) { gStateUpdateFun = update_function; - initialize = 0; + initialize_register = 0; } return UPNP_E_SUCCESS; @@ -123,7 +121,9 @@ int SampleUtil_Finish() { ithread_mutex_destroy(&display_mutex); gPrintFun = NULL; - initialize = 1; + gStateUpdateFun = NULL; + initialize_init = 1; + initialize_register = 1; return UPNP_E_SUCCESS; } diff --git a/upnp/sample/tvcombo/upnp_tv_ctrlpt.c b/upnp/sample/tvcombo/upnp_tv_ctrlpt.c index a1745b4..45c3c3b 100644 --- a/upnp/sample/tvcombo/upnp_tv_ctrlpt.c +++ b/upnp/sample/tvcombo/upnp_tv_ctrlpt.c @@ -1317,7 +1317,8 @@ int TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionP SampleUtil_Print( "Initializing UPnP Sdk with\n" "\tipaddress = %s port = %u\n", - ip_address, port); + ip_address ? ip_address : "{NULL}", + port); rc = UpnpInit(ip_address, port); if (rc != UPNP_E_SUCCESS) { diff --git a/upnp/sample/tvcombo/upnp_tv_device.c b/upnp/sample/tvcombo/upnp_tv_device.c index 08c898e..ddad4c9 100644 --- a/upnp/sample/tvcombo/upnp_tv_device.c +++ b/upnp/sample/tvcombo/upnp_tv_device.c @@ -1856,7 +1856,8 @@ TvDeviceStart( char *ip_address, SampleUtil_Print( "Initializing UPnP Sdk with\n" "\tipaddress = %s port = %u\n", - ip_address, port ); + ip_address ? ip_address : "{NULL}", + port); ret = UpnpInit( ip_address, port ); if( ret != UPNP_E_SUCCESS ) { @@ -1870,8 +1871,9 @@ TvDeviceStart( char *ip_address, SampleUtil_Print( "UPnP Initialized\n" - "\tipaddress= %s port = %u\n", - ip_address, port ); + "\tipaddress = %s port = %u\n", + ip_address ? ip_address : "{NULL}", + port); if( desc_doc_name == NULL ) { desc_doc_name = "tvcombodesc.xml"; diff --git a/upnp/sample/tvctrlpt/upnp_tv_ctrlpt.c b/upnp/sample/tvctrlpt/upnp_tv_ctrlpt.c index 3c0e4d6..116f291 100644 --- a/upnp/sample/tvctrlpt/upnp_tv_ctrlpt.c +++ b/upnp/sample/tvctrlpt/upnp_tv_ctrlpt.c @@ -1341,7 +1341,8 @@ int TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionP SampleUtil_Print( "Initializing UPnP Sdk with\n" "\tipaddress = %s port = %u\n", - ip_address, port); + ip_address ? ip_address : "{NULL}", + port); rc = UpnpInit(ip_address, port); if (rc != UPNP_E_SUCCESS) { @@ -1358,8 +1359,9 @@ int TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionP SampleUtil_Print( "UPnP Initialized\n" - "\tipaddress= %s port = %u\n", - ip_address, port); + "\tipaddress = %s port = %u\n", + ip_address ? ip_address : "{NULL}", + port); SampleUtil_Print("Registering Control Point"); rc = UpnpRegisterClient(TvCtrlPointCallbackEventHandler,