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:
parent
0b39b2ad6c
commit
3846fcc9ba
@ -2,6 +2,12 @@
|
||||
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>
|
||||
* SF Bug Tracker [ 1902668 ] Cannot compile on MSVC
|
||||
Submitted By Luke Kim - nereusuj
|
||||
|
@ -1354,7 +1354,7 @@ TvCtrlPointStart( print_string printFunctionPtr,
|
||||
{
|
||||
ithread_t timer_thread;
|
||||
int rc;
|
||||
short int port = 0;
|
||||
unsigned short port = 0;
|
||||
char *ip_address = NULL;
|
||||
|
||||
SampleUtil_Initialize( printFunctionPtr );
|
||||
@ -1362,34 +1362,42 @@ TvCtrlPointStart( print_string printFunctionPtr,
|
||||
|
||||
ithread_mutex_init( &DeviceListMutex, 0 );
|
||||
|
||||
SampleUtil_Print( "Intializing UPnP with ipaddress=%s port=%d",
|
||||
ip_address, port );
|
||||
SampleUtil_Print(
|
||||
"Initializing UPnP Sdk with\n"
|
||||
"\tipaddress = %s port = %u\n",
|
||||
ip_address, port );
|
||||
|
||||
rc = UpnpInit( ip_address, port );
|
||||
if( UPNP_E_SUCCESS != rc ) {
|
||||
SampleUtil_Print( "WinCEStart: UpnpInit() Error: %d", rc );
|
||||
//UpnpFinish( );
|
||||
//UpnpFinish();
|
||||
//return TV_ERROR;
|
||||
}
|
||||
|
||||
if( NULL == ip_address )
|
||||
ip_address = UpnpGetServerIpAddress( );
|
||||
if( 0 == port )
|
||||
port = UpnpGetServerPort( );
|
||||
if( NULL == ip_address ) {
|
||||
ip_address = UpnpGetServerIpAddress();
|
||||
}
|
||||
if( 0 == port ) {
|
||||
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" );
|
||||
rc = UpnpRegisterClient( TvCtrlPointCallbackEventHandler,
|
||||
&ctrlpt_handle, &ctrlpt_handle );
|
||||
if( UPNP_E_SUCCESS != rc ) {
|
||||
SampleUtil_Print( "Error registering CP: %d", rc );
|
||||
UpnpFinish( );
|
||||
UpnpFinish();
|
||||
return TV_ERROR;
|
||||
}
|
||||
|
||||
SampleUtil_Print( "Control Point Registered" );
|
||||
|
||||
TvCtrlPointRefresh( );
|
||||
TvCtrlPointRefresh();
|
||||
|
||||
// start a timer thread
|
||||
ithread_create( &timer_thread, NULL, TvCtrlPointTimerLoop, NULL );
|
||||
|
@ -1958,32 +1958,37 @@ TvDeviceStart( char *ip_address,
|
||||
|
||||
SampleUtil_Initialize( pfun );
|
||||
|
||||
SampleUtil_Print
|
||||
( "Initializing UPnP Sdk with \n \t ipaddress = %s port = %d\n",
|
||||
ip_address, port );
|
||||
SampleUtil_Print(
|
||||
"Initializing UPnP Sdk with\n"
|
||||
"\tipaddress = %s port = %u\n",
|
||||
ip_address, port );
|
||||
|
||||
if( ( ret = UpnpInit( ip_address, port ) ) != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Error with UpnpInit -- %d\n", ret );
|
||||
UpnpFinish( );
|
||||
UpnpFinish();
|
||||
return ret;
|
||||
}
|
||||
|
||||
if( ip_address == NULL ) {
|
||||
ip_address = UpnpGetServerIpAddress( );
|
||||
ip_address = UpnpGetServerIpAddress();
|
||||
}
|
||||
|
||||
if( port == 0 ) {
|
||||
port = UpnpGetServerPort( );
|
||||
port = UpnpGetServerPort();
|
||||
}
|
||||
|
||||
SampleUtil_Print( "UPnP Initialized\n \t ipaddress= %s port = %d\n",
|
||||
ip_address, port );
|
||||
SampleUtil_Print(
|
||||
"UPnP Initialized\n"
|
||||
"\tipaddress= %s port = %u\n",
|
||||
ip_address, port );
|
||||
|
||||
if( desc_doc_name == NULL )
|
||||
if( desc_doc_name == NULL ) {
|
||||
desc_doc_name = "tvcombodesc.xml";
|
||||
}
|
||||
|
||||
if( web_dir_path == NULL )
|
||||
if( web_dir_path == NULL ) {
|
||||
web_dir_path = DEFAULT_WEB_DIR;
|
||||
}
|
||||
|
||||
snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address,
|
||||
port, desc_doc_name );
|
||||
@ -1995,37 +2000,39 @@ TvDeviceStart( char *ip_address,
|
||||
SampleUtil_Print
|
||||
( "Error specifying webserver root directory -- %s: %d\n",
|
||||
web_dir_path, ret );
|
||||
UpnpFinish( );
|
||||
UpnpFinish();
|
||||
return ret;
|
||||
}
|
||||
|
||||
SampleUtil_Print
|
||||
( "Registering the RootDevice\n\t with desc_doc_url: %s\n",
|
||||
desc_doc_url );
|
||||
SampleUtil_Print(
|
||||
"Registering the RootDevice\n"
|
||||
"\t with desc_doc_url: %s\n",
|
||||
desc_doc_url );
|
||||
|
||||
if( ( ret = UpnpRegisterRootDevice( desc_doc_url,
|
||||
TvDeviceCallbackEventHandler,
|
||||
&device_handle, &device_handle ) )
|
||||
!= UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Error registering the rootdevice : %d\n", ret );
|
||||
UpnpFinish( );
|
||||
UpnpFinish();
|
||||
return ret;
|
||||
} else {
|
||||
SampleUtil_Print( "RootDevice Registered\n" );
|
||||
|
||||
SampleUtil_Print( "Initializing State Table\n" );
|
||||
SampleUtil_Print(
|
||||
"RootDevice Registered\n"
|
||||
"Initializing State Table\n");
|
||||
TvDeviceStateTableInit( desc_doc_url );
|
||||
SampleUtil_Print( "State Table Initialized\n" );
|
||||
SampleUtil_Print("State Table Initialized\n");
|
||||
|
||||
if( ( ret =
|
||||
UpnpSendAdvertisement( device_handle, default_advr_expire ) )
|
||||
!= UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Error sending advertisements : %d\n", ret );
|
||||
UpnpFinish( );
|
||||
UpnpFinish();
|
||||
return ret;
|
||||
}
|
||||
|
||||
SampleUtil_Print( "Advertisements Sent\n" );
|
||||
SampleUtil_Print("Advertisements Sent\n");
|
||||
}
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1354,7 +1354,7 @@ TvCtrlPointStart( print_string printFunctionPtr,
|
||||
{
|
||||
ithread_t timer_thread;
|
||||
int rc;
|
||||
short int port = 0;
|
||||
unsigned short port = 0;
|
||||
char *ip_address = NULL;
|
||||
|
||||
SampleUtil_Initialize( printFunctionPtr );
|
||||
@ -1362,34 +1362,42 @@ TvCtrlPointStart( print_string printFunctionPtr,
|
||||
|
||||
ithread_mutex_init( &DeviceListMutex, 0 );
|
||||
|
||||
SampleUtil_Print( "Initializing UPnP with ipaddress=%s port=%d",
|
||||
ip_address, port );
|
||||
SampleUtil_Print(
|
||||
"Initializing UPnP Sdk with\n"
|
||||
"\tipaddress = %s port = %u\n",
|
||||
ip_address, port );
|
||||
|
||||
rc = UpnpInit( ip_address, port );
|
||||
if( UPNP_E_SUCCESS != rc ) {
|
||||
SampleUtil_Print( "WinCEStart: UpnpInit() Error: %d", rc );
|
||||
UpnpFinish( );
|
||||
UpnpFinish();
|
||||
return TV_ERROR;
|
||||
}
|
||||
|
||||
if( NULL == ip_address )
|
||||
ip_address = UpnpGetServerIpAddress( );
|
||||
if( 0 == port )
|
||||
port = UpnpGetServerPort( );
|
||||
if( NULL == ip_address ) {
|
||||
ip_address = UpnpGetServerIpAddress();
|
||||
}
|
||||
if( 0 == port ) {
|
||||
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" );
|
||||
rc = UpnpRegisterClient( TvCtrlPointCallbackEventHandler,
|
||||
&ctrlpt_handle, &ctrlpt_handle );
|
||||
if( UPNP_E_SUCCESS != rc ) {
|
||||
SampleUtil_Print( "Error registering CP: %d", rc );
|
||||
UpnpFinish( );
|
||||
UpnpFinish();
|
||||
return TV_ERROR;
|
||||
}
|
||||
|
||||
SampleUtil_Print( "Control Point Registered" );
|
||||
|
||||
TvCtrlPointRefresh( );
|
||||
TvCtrlPointRefresh();
|
||||
|
||||
// start a timer thread
|
||||
ithread_create( &timer_thread, NULL, TvCtrlPointTimerLoop, NULL );
|
||||
|
@ -1960,30 +1960,35 @@ TvDeviceStart( char *ip_address,
|
||||
|
||||
SampleUtil_Initialize( pfun );
|
||||
|
||||
SampleUtil_Print
|
||||
( "Initializing UPnP Sdk with \n \t ipaddress = %s port = %d\n",
|
||||
ip_address, port );
|
||||
SampleUtil_Print(
|
||||
"Initializing UPnP Sdk with\n"
|
||||
"\tipaddress = %s port = %u\n",
|
||||
ip_address, port );
|
||||
|
||||
if( ( ret = UpnpInit( ip_address, port ) ) != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Error with UpnpInit -- %d\n", ret );
|
||||
UpnpFinish( );
|
||||
UpnpFinish();
|
||||
return ret;
|
||||
}
|
||||
|
||||
if( ip_address == NULL ) {
|
||||
ip_address = UpnpGetServerIpAddress( );
|
||||
ip_address = UpnpGetServerIpAddress();
|
||||
}
|
||||
|
||||
port = UpnpGetServerPort( );
|
||||
port = UpnpGetServerPort();
|
||||
|
||||
SampleUtil_Print( "UPnP Initialized\n \t ipaddress= %s port = %d\n",
|
||||
ip_address, port );
|
||||
SampleUtil_Print(
|
||||
"UPnP Initialized\n"
|
||||
"\tipaddress= %s port = %u\n",
|
||||
ip_address, port );
|
||||
|
||||
if( desc_doc_name == NULL )
|
||||
if( desc_doc_name == NULL ) {
|
||||
desc_doc_name = "tvdevicedesc.xml";
|
||||
}
|
||||
|
||||
if( web_dir_path == NULL )
|
||||
if( web_dir_path == NULL ) {
|
||||
web_dir_path = DEFAULT_WEB_DIR;
|
||||
}
|
||||
|
||||
snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address,
|
||||
port, desc_doc_name );
|
||||
@ -1995,37 +2000,39 @@ TvDeviceStart( char *ip_address,
|
||||
SampleUtil_Print
|
||||
( "Error specifying webserver root directory -- %s: %d\n",
|
||||
web_dir_path, ret );
|
||||
UpnpFinish( );
|
||||
UpnpFinish();
|
||||
return ret;
|
||||
}
|
||||
|
||||
SampleUtil_Print
|
||||
( "Registering the RootDevice\n\t with desc_doc_url: %s\n",
|
||||
desc_doc_url );
|
||||
SampleUtil_Print(
|
||||
"Registering the RootDevice\n"
|
||||
"\t with desc_doc_url: %s\n",
|
||||
desc_doc_url );
|
||||
|
||||
if( ( ret = UpnpRegisterRootDevice( desc_doc_url,
|
||||
TvDeviceCallbackEventHandler,
|
||||
&device_handle, &device_handle ) )
|
||||
!= UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Error registering the rootdevice : %d\n", ret );
|
||||
UpnpFinish( );
|
||||
UpnpFinish();
|
||||
return ret;
|
||||
} else {
|
||||
SampleUtil_Print( "RootDevice Registered\n" );
|
||||
|
||||
SampleUtil_Print( "Initializing State Table\n" );
|
||||
SampleUtil_Print(
|
||||
"RootDevice Registered\n"
|
||||
"Initializing State Table\n");
|
||||
TvDeviceStateTableInit( desc_doc_url );
|
||||
SampleUtil_Print( "State Table Initialized\n" );
|
||||
SampleUtil_Print("State Table Initialized\n");
|
||||
|
||||
if( ( ret =
|
||||
UpnpSendAdvertisement( device_handle, default_advr_expire ) )
|
||||
!= UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Error sending advertisements : %d\n", ret );
|
||||
UpnpFinish( );
|
||||
UpnpFinish();
|
||||
return ret;
|
||||
}
|
||||
|
||||
SampleUtil_Print( "Advertisements Sent\n" );
|
||||
SampleUtil_Print("Advertisements Sent\n");
|
||||
}
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user