Fixed a printf format problem on the upnp_tv_device.c from both

upnp/sample/tvdevie and upnp/sample/tvcombo directories. The variable
port was a short int instead of an unsigned short and it was beeing
print as a negative value.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@332 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez
2008-03-09 02:10:18 +00:00
parent 0b39b2ad6c
commit 3846fcc9ba
5 changed files with 100 additions and 64 deletions

View File

@@ -2,6 +2,12 @@
Version 1.6.6 Version 1.6.6
******************************************************************************* *******************************************************************************
2008-03-08 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Fixed a printf format problem on the upnp_tv_device.c from both
upnp/sample/tvdevie and upnp/sample/tvcombo directories. The variable
port was a short int instead of an unsigned short and it was beeing
print as a negative value.
2008-03-08 Marcelo Jimenez <mroberto(at)users.sourceforge.net> 2008-03-08 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* SF Bug Tracker [ 1902668 ] Cannot compile on MSVC * SF Bug Tracker [ 1902668 ] Cannot compile on MSVC
Submitted By Luke Kim - nereusuj Submitted By Luke Kim - nereusuj

View File

@@ -1354,7 +1354,7 @@ TvCtrlPointStart( print_string printFunctionPtr,
{ {
ithread_t timer_thread; ithread_t timer_thread;
int rc; int rc;
short int port = 0; unsigned short port = 0;
char *ip_address = NULL; char *ip_address = NULL;
SampleUtil_Initialize( printFunctionPtr ); SampleUtil_Initialize( printFunctionPtr );
@@ -1362,8 +1362,11 @@ TvCtrlPointStart( print_string printFunctionPtr,
ithread_mutex_init( &DeviceListMutex, 0 ); ithread_mutex_init( &DeviceListMutex, 0 );
SampleUtil_Print( "Intializing UPnP with ipaddress=%s port=%d", SampleUtil_Print(
"Initializing UPnP Sdk with\n"
"\tipaddress = %s port = %u\n",
ip_address, port ); ip_address, port );
rc = UpnpInit( ip_address, port ); rc = UpnpInit( ip_address, port );
if( UPNP_E_SUCCESS != rc ) { if( UPNP_E_SUCCESS != rc ) {
SampleUtil_Print( "WinCEStart: UpnpInit() Error: %d", rc ); SampleUtil_Print( "WinCEStart: UpnpInit() Error: %d", rc );
@@ -1371,12 +1374,17 @@ TvCtrlPointStart( print_string printFunctionPtr,
//return TV_ERROR; //return TV_ERROR;
} }
if( NULL == ip_address ) if( NULL == ip_address ) {
ip_address = UpnpGetServerIpAddress(); ip_address = UpnpGetServerIpAddress();
if( 0 == port ) }
if( 0 == port ) {
port = UpnpGetServerPort(); port = UpnpGetServerPort();
}
SampleUtil_Print( "UPnP Initialized (%s:%d)", ip_address, port ); SampleUtil_Print(
"UPnP Initialized\n"
"\tipaddress= %s port = %u\n",
ip_address, port );
SampleUtil_Print( "Registering Control Point" ); SampleUtil_Print( "Registering Control Point" );
rc = UpnpRegisterClient( TvCtrlPointCallbackEventHandler, rc = UpnpRegisterClient( TvCtrlPointCallbackEventHandler,

View File

@@ -1958,8 +1958,9 @@ TvDeviceStart( char *ip_address,
SampleUtil_Initialize( pfun ); SampleUtil_Initialize( pfun );
SampleUtil_Print SampleUtil_Print(
( "Initializing UPnP Sdk with \n \t ipaddress = %s port = %d\n", "Initializing UPnP Sdk with\n"
"\tipaddress = %s port = %u\n",
ip_address, port ); ip_address, port );
if( ( ret = UpnpInit( ip_address, port ) ) != UPNP_E_SUCCESS ) { if( ( ret = UpnpInit( ip_address, port ) ) != UPNP_E_SUCCESS ) {
@@ -1976,14 +1977,18 @@ TvDeviceStart( char *ip_address,
port = UpnpGetServerPort(); port = UpnpGetServerPort();
} }
SampleUtil_Print( "UPnP Initialized\n \t ipaddress= %s port = %d\n", SampleUtil_Print(
"UPnP Initialized\n"
"\tipaddress= %s port = %u\n",
ip_address, port ); ip_address, port );
if( desc_doc_name == NULL ) if( desc_doc_name == NULL ) {
desc_doc_name = "tvcombodesc.xml"; desc_doc_name = "tvcombodesc.xml";
}
if( web_dir_path == NULL ) if( web_dir_path == NULL ) {
web_dir_path = DEFAULT_WEB_DIR; web_dir_path = DEFAULT_WEB_DIR;
}
snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address, snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address,
port, desc_doc_name ); port, desc_doc_name );
@@ -1999,8 +2004,9 @@ TvDeviceStart( char *ip_address,
return ret; return ret;
} }
SampleUtil_Print SampleUtil_Print(
( "Registering the RootDevice\n\t with desc_doc_url: %s\n", "Registering the RootDevice\n"
"\t with desc_doc_url: %s\n",
desc_doc_url ); desc_doc_url );
if( ( ret = UpnpRegisterRootDevice( desc_doc_url, if( ( ret = UpnpRegisterRootDevice( desc_doc_url,
@@ -2011,9 +2017,9 @@ TvDeviceStart( char *ip_address,
UpnpFinish(); UpnpFinish();
return ret; return ret;
} else { } else {
SampleUtil_Print( "RootDevice Registered\n" ); SampleUtil_Print(
"RootDevice Registered\n"
SampleUtil_Print( "Initializing State Table\n" ); "Initializing State Table\n");
TvDeviceStateTableInit( desc_doc_url ); TvDeviceStateTableInit( desc_doc_url );
SampleUtil_Print("State Table Initialized\n"); SampleUtil_Print("State Table Initialized\n");
@@ -2029,3 +2035,4 @@ TvDeviceStart( char *ip_address,
} }
return UPNP_E_SUCCESS; return UPNP_E_SUCCESS;
} }

View File

@@ -1354,7 +1354,7 @@ TvCtrlPointStart( print_string printFunctionPtr,
{ {
ithread_t timer_thread; ithread_t timer_thread;
int rc; int rc;
short int port = 0; unsigned short port = 0;
char *ip_address = NULL; char *ip_address = NULL;
SampleUtil_Initialize( printFunctionPtr ); SampleUtil_Initialize( printFunctionPtr );
@@ -1362,8 +1362,11 @@ TvCtrlPointStart( print_string printFunctionPtr,
ithread_mutex_init( &DeviceListMutex, 0 ); ithread_mutex_init( &DeviceListMutex, 0 );
SampleUtil_Print( "Initializing UPnP with ipaddress=%s port=%d", SampleUtil_Print(
"Initializing UPnP Sdk with\n"
"\tipaddress = %s port = %u\n",
ip_address, port ); ip_address, port );
rc = UpnpInit( ip_address, port ); rc = UpnpInit( ip_address, port );
if( UPNP_E_SUCCESS != rc ) { if( UPNP_E_SUCCESS != rc ) {
SampleUtil_Print( "WinCEStart: UpnpInit() Error: %d", rc ); SampleUtil_Print( "WinCEStart: UpnpInit() Error: %d", rc );
@@ -1371,12 +1374,17 @@ TvCtrlPointStart( print_string printFunctionPtr,
return TV_ERROR; return TV_ERROR;
} }
if( NULL == ip_address ) if( NULL == ip_address ) {
ip_address = UpnpGetServerIpAddress(); ip_address = UpnpGetServerIpAddress();
if( 0 == port ) }
if( 0 == port ) {
port = UpnpGetServerPort(); port = UpnpGetServerPort();
}
SampleUtil_Print( "UPnP Initialized (%s:%d)", ip_address, port ); SampleUtil_Print(
"UPnP Initialized\n"
"\tipaddress= %s port = %u\n",
ip_address, port );
SampleUtil_Print( "Registering Control Point" ); SampleUtil_Print( "Registering Control Point" );
rc = UpnpRegisterClient( TvCtrlPointCallbackEventHandler, rc = UpnpRegisterClient( TvCtrlPointCallbackEventHandler,

View File

@@ -1960,8 +1960,9 @@ TvDeviceStart( char *ip_address,
SampleUtil_Initialize( pfun ); SampleUtil_Initialize( pfun );
SampleUtil_Print SampleUtil_Print(
( "Initializing UPnP Sdk with \n \t ipaddress = %s port = %d\n", "Initializing UPnP Sdk with\n"
"\tipaddress = %s port = %u\n",
ip_address, port ); ip_address, port );
if( ( ret = UpnpInit( ip_address, port ) ) != UPNP_E_SUCCESS ) { if( ( ret = UpnpInit( ip_address, port ) ) != UPNP_E_SUCCESS ) {
@@ -1976,14 +1977,18 @@ TvDeviceStart( char *ip_address,
port = UpnpGetServerPort(); port = UpnpGetServerPort();
SampleUtil_Print( "UPnP Initialized\n \t ipaddress= %s port = %d\n", SampleUtil_Print(
"UPnP Initialized\n"
"\tipaddress= %s port = %u\n",
ip_address, port ); ip_address, port );
if( desc_doc_name == NULL ) if( desc_doc_name == NULL ) {
desc_doc_name = "tvdevicedesc.xml"; desc_doc_name = "tvdevicedesc.xml";
}
if( web_dir_path == NULL ) if( web_dir_path == NULL ) {
web_dir_path = DEFAULT_WEB_DIR; web_dir_path = DEFAULT_WEB_DIR;
}
snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address, snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address,
port, desc_doc_name ); port, desc_doc_name );
@@ -1999,8 +2004,9 @@ TvDeviceStart( char *ip_address,
return ret; return ret;
} }
SampleUtil_Print SampleUtil_Print(
( "Registering the RootDevice\n\t with desc_doc_url: %s\n", "Registering the RootDevice\n"
"\t with desc_doc_url: %s\n",
desc_doc_url ); desc_doc_url );
if( ( ret = UpnpRegisterRootDevice( desc_doc_url, if( ( ret = UpnpRegisterRootDevice( desc_doc_url,
@@ -2011,9 +2017,9 @@ TvDeviceStart( char *ip_address,
UpnpFinish(); UpnpFinish();
return ret; return ret;
} else { } else {
SampleUtil_Print( "RootDevice Registered\n" ); SampleUtil_Print(
"RootDevice Registered\n"
SampleUtil_Print( "Initializing State Table\n" ); "Initializing State Table\n");
TvDeviceStateTableInit( desc_doc_url ); TvDeviceStateTableInit( desc_doc_url );
SampleUtil_Print("State Table Initialized\n"); SampleUtil_Print("State Table Initialized\n");
@@ -2029,3 +2035,4 @@ TvDeviceStart( char *ip_address,
} }
return UPNP_E_SUCCESS; return UPNP_E_SUCCESS;
} }