Merge of Mac OS X patch from Stéphane Corthésy (davelopper),

SF Bug Tracker [ 1686420 ] Modifications for MacOSX.
Some of the proposed changes were already done by Rene Hexel's patch.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@213 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez 2007-08-06 02:07:41 +00:00
parent 491f5ffef6
commit 67b51187b9
9 changed files with 130 additions and 115 deletions

View File

@ -2,6 +2,11 @@
Version 1.6.0 Version 1.6.0
******************************************************************************* *******************************************************************************
2007-08-05 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Merge of Mac OS X patch from Stéphane Corthésy (davelopper),
SF Bug Tracker [ 1686420 ] Modifications for MacOSX.
Some of the proposed changes were already done by Rene Hexel's patch.
2007-06-10 Marcelo Jimenez <mroberto(at)users.sourceforge.net> 2007-06-10 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* More fixes to Mac OS X and NetBSD from Rene Hexel: * More fixes to Mac OS X and NetBSD from Rene Hexel:
[pupnp-devel] NetBSD & Mac OS X packages and patches [pupnp-devel] NetBSD & Mac OS X packages and patches

1
THANKS
View File

@ -31,6 +31,7 @@ exempt of errors.
- Paul Vixie - Paul Vixie
- Rene Hexel - Rene Hexel
- Siva Chandran - Siva Chandran
- Stéphane Corthésy
- Timothy Redaelli - Timothy Redaelli
- Titus Winters - Titus Winters

View File

@ -31,7 +31,7 @@
#include "LinkedList.h" #include "LinkedList.h"
#include <sys/param.h> #include <sys/param.h>
#if (defined(BSD) && BSD >= 199306) #if (defined(BSD) && BSD >= 199306) || defined(__OSX__)
#include <stdlib.h> #include <stdlib.h>
#else #else
#include <malloc.h> #include <malloc.h>

View File

@ -93,8 +93,10 @@ SetPolicyType( PolicyType in )
#ifdef __CYGWIN__ #ifdef __CYGWIN__
/* TODO not currently working... */ /* TODO not currently working... */
return 0; return 0;
#else #elif defined(__OSX__)
#ifdef WIN32 setpriority(PRIO_PROCESS, 0, 0);
return 0;
#elif defined(WIN32)
return sched_setscheduler( 0, in); return sched_setscheduler( 0, in);
#elif defined(_POSIX_PRIORITY_SCHEDULING) && _POSIX_PRIORITY_SCHEDULING > 0 #elif defined(_POSIX_PRIORITY_SCHEDULING) && _POSIX_PRIORITY_SCHEDULING > 0
struct sched_param current; struct sched_param current;
@ -105,7 +107,6 @@ SetPolicyType( PolicyType in )
#else #else
return 0; return 0;
#endif #endif
#endif
} }
/**************************************************************************** /****************************************************************************
@ -364,7 +365,7 @@ static void SetSeed() {
ftime( &t ); ftime( &t );
#if defined(WIN32) #if defined(WIN32)
srand( ( unsigned int )t.millitm + (unsigned int)ithread_get_current_thread_id().p ); srand( ( unsigned int )t.millitm + (unsigned int)ithread_get_current_thread_id().p );
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__) || defined(__OSX__)
srand( ( unsigned int )t.millitm + (unsigned int)ithread_get_current_thread_id() ); srand( ( unsigned int )t.millitm + (unsigned int)ithread_get_current_thread_id() );
#elif defined(__linux__) #elif defined(__linux__)
srand( ( unsigned int )t.millitm + ithread_get_current_thread_id() ); srand( ( unsigned int )t.millitm + ithread_get_current_thread_id() );

View File

@ -32,7 +32,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#include <sys/param.h> #include <sys/param.h>
#if (defined(BSD) && BSD >= 199306) #if (defined(BSD) && BSD >= 199306) || defined(__OSX__)
#include <stdlib.h> #include <stdlib.h>
#else #else
#include <malloc.h> #include <malloc.h>

View File

@ -1362,7 +1362,7 @@ 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 with ipaddress=%s port=%d",
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 ) {

View File

@ -44,7 +44,7 @@ struct ErrorString {
}; };
//Intializing the array of error structures. // Initializing the array of error structures.
struct ErrorString ErrorMessages[] = { {UPNP_E_SUCCESS, "UPNP_E_SUCCESS"}, struct ErrorString ErrorMessages[] = { {UPNP_E_SUCCESS, "UPNP_E_SUCCESS"},
{UPNP_E_INVALID_HANDLE, "UPNP_E_INVALID_HANDLE"}, {UPNP_E_INVALID_HANDLE, "UPNP_E_INVALID_HANDLE"},
{UPNP_E_INVALID_PARAM, "UPNP_E_INVALID_PARAM"}, {UPNP_E_INVALID_PARAM, "UPNP_E_INVALID_PARAM"},
@ -581,4 +581,5 @@ UpnpCreatePropertySet( IN int NumArg,
return PropSet; return PropSet;
} }
#endif #endif // EXCLUDE_DOM == 0

View File

@ -555,7 +555,7 @@ parse_hostport( const char *in,
int begin_port; int begin_port;
int hostport_size = 0; int hostport_size = 0;
int host_size = 0; int host_size = 0;
#ifndef WIN32 #if !defined(WIN32) && !defined(__OSX__)
char temp_hostbyname_buff[BUFFER_SIZE]; char temp_hostbyname_buff[BUFFER_SIZE];
struct hostent h_buf; struct hostent h_buf;
#endif #endif
@ -628,20 +628,28 @@ parse_hostport( const char *in,
#if defined(WIN32) || defined(__CYGWIN__) #if defined(WIN32) || defined(__CYGWIN__)
h = gethostbyname(temp_host_name); h = gethostbyname(temp_host_name);
#elif defined(SPARC_SOLARIS) #elif defined(SPARC_SOLARIS)
errCode = gethostbyname_r( temp_host_name, errCode = gethostbyname_r(
temp_host_name,
&h, &h,
temp_hostbyname_buff, temp_hostbyname_buff,
BUFFER_SIZE, &errcode ); BUFFER_SIZE, &errcode );
#elif defined(__FreeBSD__) && __FreeBSD_version < 601103 #elif defined(__FreeBSD__) && __FreeBSD_version < 601103
h = lwres_gethostbyname_r( temp_host_name, h = lwres_gethostbyname_r(
temp_host_name,
&h_buf, &h_buf,
temp_hostbyname_buff, temp_hostbyname_buff,
BUFFER_SIZE, &errcode ); BUFFER_SIZE, &errcode );
if ( h == NULL ) { if ( h == NULL ) {
errCode = 1; errCode = 1;
} }
#elif defined(__OSX__)
h = gethostbyname(temp_host_name);
if ( h == NULL ) {
errCode = 1;
}
#elif defined(__linux__) #elif defined(__linux__)
errCode = gethostbyname_r( temp_host_name, errCode = gethostbyname_r(
temp_host_name,
&h_buf, &h_buf,
temp_hostbyname_buff, temp_hostbyname_buff,
BUFFER_SIZE, &h, &errcode ); BUFFER_SIZE, &h, &errcode );
@ -673,7 +681,6 @@ parse_hostport( const char *in,
} }
} }
#endif #endif
if( errCode == 0 ) { if( errCode == 0 ) {
if( h ) { if( h ) {
if( ( h->h_addrtype == AF_INET ) && ( h->h_length == 4 ) ) { if( ( h->h_addrtype == AF_INET ) && ( h->h_length == 4 ) ) {

View File

@ -105,7 +105,7 @@ main (int argc, char* argv[])
* Test library initialisation * Test library initialisation
*/ */
printf ("\n"); printf ("\n");
printf ("Intializing UPnP ... \n"); printf ("Initializing UPnP ... \n");
rc = UpnpInit (NULL, 0); rc = UpnpInit (NULL, 0);
if ( UPNP_E_SUCCESS == rc ) { if ( UPNP_E_SUCCESS == rc ) {
const char* ip_address = UpnpGetServerIpAddress(); const char* ip_address = UpnpGetServerIpAddress();