mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
msys 64bit tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39933 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e43c12542a
commit
9592363863
5 changed files with 51 additions and 43 deletions
|
@ -1,38 +1,39 @@
|
|||
|
||||
#ifdef __clang__
|
||||
#define FOR_IN(type, var, collection) \
|
||||
for (type var in collection)\
|
||||
{
|
||||
for (type var in collection)\
|
||||
{
|
||||
#define END_FOR_IN(collection) }
|
||||
#else
|
||||
void objc_enumerationMutation(id);
|
||||
#define FOR_IN(type, var, c) \
|
||||
do\
|
||||
{\
|
||||
type var;\
|
||||
NSFastEnumerationState gs_##c##_enumState = { 0 };\
|
||||
id gs_##c##_items[16];\
|
||||
unsigned long gs_##c##_limit = \
|
||||
[c countByEnumeratingWithState: &gs_##c##_enumState \
|
||||
objects: gs_##c##_items \
|
||||
count: 16];\
|
||||
if (gs_##c##_limit)\
|
||||
{\
|
||||
unsigned long gs_startMutations = *gs_##c##_enumState.mutationsPtr;\
|
||||
do {\
|
||||
unsigned long gs_##c##counter = 0;\
|
||||
do {\
|
||||
if (gs_startMutations != *gs_##c##_enumState.mutationsPtr)\
|
||||
{\
|
||||
objc_enumerationMutation(c);\
|
||||
}\
|
||||
var = gs_##c##_enumState.itemsPtr[gs_##c##counter++];\
|
||||
type var;\
|
||||
NSFastEnumerationState gs_##c##_enumState = { 0 };\
|
||||
id gs_##c##_items[16];\
|
||||
unsigned long gs_##c##_limit = \
|
||||
[c countByEnumeratingWithState: &gs_##c##_enumState \
|
||||
objects: gs_##c##_items \
|
||||
count: 16];\
|
||||
if (gs_##c##_limit)\
|
||||
{\
|
||||
unsigned long gs_startMutations = *gs_##c##_enumState.mutationsPtr;\
|
||||
do {\
|
||||
unsigned long gs_##c##counter = 0;\
|
||||
do {\
|
||||
if (gs_startMutations != *gs_##c##_enumState.mutationsPtr)\
|
||||
{\
|
||||
objc_enumerationMutation(c);\
|
||||
}\
|
||||
var = gs_##c##_enumState.itemsPtr[gs_##c##counter++];\
|
||||
|
||||
#define END_FOR_IN(c) \
|
||||
} while (gs_##c##counter < gs_##c##_limit);\
|
||||
} while ((gs_##c##_limit = [c countByEnumeratingWithState: &gs_##c##_enumState\
|
||||
objects: gs_##c##_items\
|
||||
count: 16]));\
|
||||
}\
|
||||
} while (gs_##c##counter < gs_##c##_limit);\
|
||||
} while ((gs_##c##_limit \
|
||||
= [c countByEnumeratingWithState: &gs_##c##_enumState\
|
||||
objects: gs_##c##_items\
|
||||
count: 16]));\
|
||||
}\
|
||||
} while(0);
|
||||
#endif
|
||||
|
|
|
@ -58,6 +58,9 @@
|
|||
#ifdef _WIN32
|
||||
extern const char *inet_ntop(int, const void *, char *, size_t);
|
||||
extern int inet_pton(int , const char *, void *);
|
||||
#define OPTLEN int
|
||||
#else
|
||||
#define OPTLEN socklen_t
|
||||
#endif
|
||||
|
||||
unsigned
|
||||
|
@ -1492,14 +1495,14 @@ setNonBlocking(SOCKET fd)
|
|||
memset(&sin, '\0', size);
|
||||
if ([key isEqualToString: GSStreamLocalAddressKey])
|
||||
{
|
||||
if (getsockname(s, (struct sockaddr*)&sin, &size) != -1)
|
||||
if (getsockname(s, (struct sockaddr*)&sin, (OPTLEN*)&size) != -1)
|
||||
{
|
||||
result = GSPrivateSockaddrHost(&sin);
|
||||
}
|
||||
}
|
||||
else if ([key isEqualToString: GSStreamLocalPortKey])
|
||||
{
|
||||
if (getsockname(s, (struct sockaddr*)&sin, &size) != -1)
|
||||
if (getsockname(s, (struct sockaddr*)&sin, (OPTLEN*)&size) != -1)
|
||||
{
|
||||
result = [NSString stringWithFormat: @"%d",
|
||||
(int)GSPrivateSockaddrPort(&sin)];
|
||||
|
@ -1507,14 +1510,14 @@ setNonBlocking(SOCKET fd)
|
|||
}
|
||||
else if ([key isEqualToString: GSStreamRemoteAddressKey])
|
||||
{
|
||||
if (getpeername(s, (struct sockaddr*)&sin, &size) != -1)
|
||||
if (getpeername(s, (struct sockaddr*)&sin, (OPTLEN*)&size) != -1)
|
||||
{
|
||||
result = GSPrivateSockaddrHost(&sin);
|
||||
}
|
||||
}
|
||||
else if ([key isEqualToString: GSStreamRemotePortKey])
|
||||
{
|
||||
if (getpeername(s, (struct sockaddr*)&sin, &size) != -1)
|
||||
if (getpeername(s, (struct sockaddr*)&sin, (OPTLEN*)&size) != -1)
|
||||
{
|
||||
result = [NSString stringWithFormat: @"%d",
|
||||
(int)GSPrivateSockaddrPort(&sin)];
|
||||
|
@ -1997,7 +2000,7 @@ setNonBlocking(SOCKET fd)
|
|||
socklen_t len = sizeof(error);
|
||||
|
||||
getReturn = getsockopt(_sock, SOL_SOCKET, SO_ERROR,
|
||||
(char*)&error, &len);
|
||||
(char*)&error, (OPTLEN*)&len);
|
||||
}
|
||||
|
||||
if (getReturn >= 0 && error == 0
|
||||
|
@ -2079,7 +2082,8 @@ setNonBlocking(SOCKET fd)
|
|||
|
||||
IF_NO_GC([[self retain] autorelease];)
|
||||
[self _unschedule];
|
||||
result = getsockopt([self _sock], SOL_SOCKET, SO_ERROR, &error, &len);
|
||||
result = getsockopt([self _sock], SOL_SOCKET, SO_ERROR,
|
||||
&error, (OPTLEN*)&len);
|
||||
|
||||
if (result >= 0 && !error)
|
||||
{ // finish up the opening
|
||||
|
@ -2434,7 +2438,7 @@ setNonBlocking(SOCKET fd)
|
|||
socklen_t len = sizeof(error);
|
||||
|
||||
getReturn = getsockopt(_sock, SOL_SOCKET, SO_ERROR,
|
||||
(char*)&error, &len);
|
||||
(char*)&error, (OPTLEN*)&len);
|
||||
}
|
||||
|
||||
if (getReturn >= 0 && error == 0
|
||||
|
@ -2514,8 +2518,8 @@ setNonBlocking(SOCKET fd)
|
|||
|
||||
IF_NO_GC([[self retain] autorelease];)
|
||||
[self _schedule];
|
||||
result
|
||||
= getsockopt((intptr_t)_loopID, SOL_SOCKET, SO_ERROR, &error, &len);
|
||||
result = getsockopt((intptr_t)_loopID, SOL_SOCKET, SO_ERROR,
|
||||
&error, (OPTLEN*)&len);
|
||||
if (result >= 0 && !error)
|
||||
{ // finish up the opening
|
||||
myEvent = NSStreamEventOpenCompleted;
|
||||
|
@ -2634,7 +2638,7 @@ setNonBlocking(SOCKET fd)
|
|||
int status = 1;
|
||||
|
||||
setsockopt([self _sock], SOL_SOCKET, SO_REUSEADDR,
|
||||
(char *)&status, sizeof(status));
|
||||
(char *)&status, (OPTLEN)sizeof(status));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2702,7 +2706,7 @@ setNonBlocking(SOCKET fd)
|
|||
socklen_t len = sizeof(buf);
|
||||
int acceptReturn;
|
||||
|
||||
acceptReturn = accept([self _sock], addr, &len);
|
||||
acceptReturn = accept([self _sock], addr, (OPTLEN*)&len);
|
||||
_events &= ~NSStreamEventHasBytesAvailable;
|
||||
if (socketError(acceptReturn))
|
||||
{ // test for real error
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#import "Foundation/NSData.h"
|
||||
#import "Foundation/NSURL.h"
|
||||
#import "Foundation/NSValue.h"
|
||||
#import "Foundation/NSSet.h"
|
||||
#import "GNUstepBase/NSString+GNUstepBase.h"
|
||||
#import "GNUstepBase/NSTask+GNUstepBase.h"
|
||||
|
||||
|
|
|
@ -656,7 +656,7 @@ static HANDLE hProcess = 0;
|
|||
if (0 == hModule)
|
||||
{
|
||||
fprintf(stderr, "Failed to load kernel32.dll with error: %d\n",
|
||||
GetLastError());
|
||||
(int)GetLastError());
|
||||
[traceLock unlock];
|
||||
return self;
|
||||
}
|
||||
|
@ -665,7 +665,7 @@ static HANDLE hProcess = 0;
|
|||
if (0 == capture)
|
||||
{
|
||||
fprintf(stderr, "Failed to find RtlCaptureStackBackTrace: %d\n",
|
||||
GetLastError());
|
||||
(int)GetLastError());
|
||||
[traceLock unlock];
|
||||
return self;
|
||||
}
|
||||
|
@ -673,7 +673,7 @@ static HANDLE hProcess = 0;
|
|||
if (0 == hModule)
|
||||
{
|
||||
fprintf(stderr, "Failed to load dbghelp.dll with error: %d\n",
|
||||
GetLastError());
|
||||
(int)GetLastError());
|
||||
[traceLock unlock];
|
||||
return self;
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ static HANDLE hProcess = 0;
|
|||
if (0 == optSym)
|
||||
{
|
||||
fprintf(stderr, "Failed to find SymSetOptions: %d\n",
|
||||
GetLastError());
|
||||
(int)GetLastError());
|
||||
[traceLock unlock];
|
||||
return self;
|
||||
}
|
||||
|
@ -691,7 +691,7 @@ static HANDLE hProcess = 0;
|
|||
if (0 == initSym)
|
||||
{
|
||||
fprintf(stderr, "Failed to find SymInitialize: %d\n",
|
||||
GetLastError());
|
||||
(int)GetLastError());
|
||||
[traceLock unlock];
|
||||
return self;
|
||||
}
|
||||
|
@ -700,7 +700,7 @@ static HANDLE hProcess = 0;
|
|||
if (0 == fromSym)
|
||||
{
|
||||
fprintf(stderr, "Failed to find SymFromAddr: %d\n",
|
||||
GetLastError());
|
||||
(int)GetLastError());
|
||||
[traceLock unlock];
|
||||
return self;
|
||||
}
|
||||
|
@ -711,7 +711,7 @@ static HANDLE hProcess = 0;
|
|||
if (!(initSym)(hProcess, NULL, TRUE))
|
||||
{
|
||||
fprintf(stderr, "SymInitialize failed with error: %d\n",
|
||||
GetLastError());
|
||||
(int)GetLastError());
|
||||
fromSym = 0;
|
||||
[traceLock unlock];
|
||||
return self;
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
#if defined(_WIN32)
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
extern const char *inet_ntop(int, const void *, char *, size_t);
|
||||
extern int inet_pton(int , const char *, void *);
|
||||
#else
|
||||
#include <netdb.h>
|
||||
#include <sys/param.h>
|
||||
|
|
Loading…
Reference in a new issue