use MS macro to get winsock functions instead of eponymous posix ones.

With this change, play over IP works again!
This commit is contained in:
ehouse 2006-03-21 03:47:15 +00:00
parent eef7b20544
commit eca8fa28b0
3 changed files with 21 additions and 18 deletions

View file

@ -152,7 +152,7 @@ static XP_Bool
sendAll( CeSocketWrapper* self, XP_U8* buf, XP_U16 len )
{
for ( ; ; ) {
int nSent = send( self->socket, buf, len, 0 ); /* flags? */
int nSent = MS(send)( self->socket, buf, len, 0 ); /* flags? */
if ( nSent == SOCKET_ERROR ) {
return XP_FALSE;
} else if ( nSent == len ) {
@ -189,7 +189,7 @@ connectSocket( CeSocketWrapper* self )
/* first look up the ip address */
if ( self->addrRec.u.ip_relay.ipAddr == 0 ) {
struct hostent* ent;
ent = gethostbyname( self->addrRec.u.ip_relay.hostName );
ent = MS(gethostbyname)( self->addrRec.u.ip_relay.hostName );
if ( ent != NULL ) {
XP_U32 tmp;
XP_MEMCPY( &tmp, &ent->h_addr_list[0][0],
@ -201,7 +201,7 @@ connectSocket( CeSocketWrapper* self )
}
if ( self->addrRec.u.ip_relay.ipAddr != 0 ) {
sock = socket( AF_INET, SOCK_STREAM, IPPROTO_IP );
sock = MS(socket)( AF_INET, SOCK_STREAM, IPPROTO_IP );
XP_LOGF( "got socket %d", sock );
if ( sock != INVALID_SOCKET ) {
@ -211,7 +211,7 @@ connectSocket( CeSocketWrapper* self )
name.sin_port = XP_HTONS( self->addrRec.u.ip_relay.port );
name.sin_addr.S_un.S_addr = XP_HTONL(self->addrRec.u.ip_relay.ipAddr);
if ( SOCKET_ERROR != connect( sock, (struct sockaddr *)&name,
if ( SOCKET_ERROR != MS(connect)( sock, (struct sockaddr *)&name,
sizeof(name) ) ) {
self->connState = CE_IP_CONNECTED;
self->socket = sock;
@ -300,14 +300,14 @@ read_bytes_blocking( CeSocketWrapper* self, XP_U8* buf, XP_U16 len )
/* There also needs to be a pipe in here for interrupting */
FD_SET( self->socket, &readSet );
sres = select( 0, /* nFds is ignored on wince */
sres = MS(select)( 0, /* nFds is ignored on wince */
&readSet, NULL, NULL, /* others not interesting */
NULL ); /* no timeout */
XP_LOGF( "back from select: got %d", sres );
if ( sres == 0 ) {
break;
} else if ( sres == 1 && FD_ISSET( self->socket, &readSet ) ) {
int nRead = recv( self->socket, buf, len, 0 );
int nRead = MS(recv)( self->socket, buf, len, 0 );
if ( nRead > 0 ) {
XP_LOGF( "read %d bytes", nRead );
XP_ASSERT( nRead <= len );

View file

@ -15,20 +15,19 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Derived from code generated by M$'s eVC++.
*/
/* This file should eventually go away as changes move up into the linux dev
* tools
*/
#ifndef _DEBHACKS_H_
#define _DEBHACKS_H_
#ifdef USE_DEB_HACKS
#define MS(func) M$_##func
#define DH(func) debhack_##func
typedef struct DH(WIN32_FIND_DATA) {
DWORD dwFileAttributes;
FILETIME dh_ftCreationTime;
@ -44,13 +43,8 @@ DWORD DH(GetCurrentThreadId)(void);
BOOL DH(SetEvent)(HANDLE);
BOOL DH(ResetEvent)(HANDLE);
LRESULT debhack_CommandBar_InsertButton(HWND hwnd, WPARAM button,
LPARAM lparam );
void debhack_CommandBar_Destroy( HWND hwnd );
#else
#define MS(func) func
#define DH(func) func
#endif

View file

@ -117,6 +117,15 @@ XP_U16 wince_snprintf( XP_UCHAR* buf, XP_U16 len, XP_UCHAR* format, ... );
#define XP_LD "%ld"
/* The pocketpc sdk on linux renames certain functions to avoid conflicts
with same-named posix symbols. */
#if defined __GNUC__ && defined _WIN32_WCE
# define MS(func) M$_##func
#else
# define MS(func) func
#endif
#ifdef CPLUS
}
#endif