Attempted fix for systems where sizeof(int) < sizeof(void*)

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21770 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2005-10-04 11:54:03 +00:00
parent 839793e442
commit 32da350755
7 changed files with 43 additions and 28 deletions

View file

@ -1,3 +1,13 @@
2005-10-04 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSTcpPort.m:
* Source/NSCallBacks.m:
* Source/NSMessagePort.m:
* Source/NSMessagePortNameServer.m:
* Source/NSSocketPort.m:
* Source/win32/GSRunLoopCtxt.m:
Attempt to deal with systems where sizeof(int) < sizeof(void*)
2005-10-01 David Ayers <d.ayers@inode.at>
* Source/NSString: (dataUsingEncoding:allowLossyConversion:):

View file

@ -1596,7 +1596,7 @@ static unsigned wordAlign;
- (void) getFds: (SOCKET*)fds count: (int*)count
{
NSMapEnumerator me;
SOCKET sock;
void *sock;
GSTcpHandle *handle;
id recvSelf;
@ -1623,11 +1623,11 @@ static unsigned wordAlign;
*/
recvSelf = GS_GC_HIDE(self);
me = NSEnumerateMapTable(handles);
while (NSNextMapEnumeratorPair(&me, (void*)&sock, (void*)&handle))
while (NSNextMapEnumeratorPair(&me, &sock, (void**)&handle))
{
if (handle->recvPort == recvSelf)
{
fds[(*count)++] = sock;
fds[(*count)++] = (SOCKET)sock;
}
}
NSEndMapTableEnumeration(&me);
@ -1638,6 +1638,7 @@ static unsigned wordAlign;
{
NSMapEnumerator me;
SOCKET sock;
void *dummy;
#ifndef BROKEN_SO_REUSEADDR
int opt = 1;
#endif
@ -1648,7 +1649,7 @@ static unsigned wordAlign;
* Enumerate all our socket handles, and look for one with port.
*/
me = NSEnumerateMapTable(handles);
while (NSNextMapEnumeratorPair(&me, (void*)&sock, (void*)&handle))
while (NSNextMapEnumeratorPair(&me, &dummy, (void**)&handle))
{
if ([handle recvPort] == recvPort)
{
@ -1663,7 +1664,8 @@ static unsigned wordAlign;
* Not found ... create a new handle.
*/
handle = nil;
if ((sock = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == INVALID_SOCKET)
sock = socket(AF_INET, SOCK_STREAM, PF_UNSPEC);
if (sock == INVALID_SOCKET)
{
NSLog(@"unable to create socket - %s", GSLastErrorStr(errno));
}

View file

@ -67,7 +67,7 @@ _NS_int_release(void *table, void* i)
NSString *
_NS_int_describe(void *table, void* i)
{
return [NSString stringWithFormat: @"%d", i];
return [NSString stringWithFormat: @"%d", (int)i];
}
/** For owned `void *' **/

View file

@ -1150,7 +1150,7 @@ static Class messagePortClass;
static void clean_up_sockets(void)
{
NSMessagePort *port;
NSData *name;
NSData *name;
NSMapEnumerator mEnum;
BOOL unknownThread = GSRegisterCurrentThread();
CREATE_AUTORELEASE_POOL(arp);
@ -1385,8 +1385,8 @@ static int unique_index = 0;
- (void) getFds: (int*)fds count: (int*)count
{
NSMapEnumerator me;
int sock;
GSMessageHandle *handle;
void *sock;
GSMessageHandle *handle;
id recvSelf;
M_LOCK(myLock);
@ -1412,11 +1412,11 @@ static int unique_index = 0;
*/
recvSelf = GS_GC_HIDE(self);
me = NSEnumerateMapTable(handles);
while (NSNextMapEnumeratorPair(&me, (void*)&sock, (void*)&handle))
while (NSNextMapEnumeratorPair(&me, &sock, (void**)&handle))
{
if (handle->recvPort == recvSelf)
{
fds[(*count)++] = sock;
fds[(*count)++] = (int)sock;
}
}
NSEndMapTableEnumeration(&me);
@ -1426,7 +1426,7 @@ static int unique_index = 0;
- (id) conversation: (NSPort*)recvPort
{
NSMapEnumerator me;
int sock;
void *dummy;
GSMessageHandle *handle = nil;
M_LOCK(myLock);
@ -1434,7 +1434,7 @@ static int unique_index = 0;
* Enumerate all our socket handles, and look for one with port.
*/
me = NSEnumerateMapTable(handles);
while (NSNextMapEnumeratorPair(&me, (void*)&sock, (void*)&handle))
while (NSNextMapEnumeratorPair(&me, &dummy, (void**)&handle))
{
if ([handle recvPort] == recvPort)
{
@ -1454,6 +1454,7 @@ static int unique_index = 0;
{
NSMapEnumerator me;
int sock;
void *dummy;
#ifndef BROKEN_SO_REUSEADDR
int opt = 1;
#endif
@ -1464,7 +1465,7 @@ static int unique_index = 0;
* Enumerate all our socket handles, and look for one with port.
*/
me = NSEnumerateMapTable(handles);
while (NSNextMapEnumeratorPair(&me, (void*)&sock, (void*)&handle))
while (NSNextMapEnumeratorPair(&me, &dummy, (void**)&handle))
{
if ([handle recvPort] == recvPort)
{
@ -1479,7 +1480,8 @@ static int unique_index = 0;
* Not found ... create a new handle.
*/
handle = nil;
if ((sock = socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC)) < 0)
sock = socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC);
if (sock < 0)
{
NSLog(@"unable to create socket - %s", GSLastErrorStr(errno));
}

View file

@ -80,8 +80,8 @@ static NSMapTable portToNamesMap;
static void clean_up_names(void)
{
NSMapEnumerator mEnum;
NSMessagePort *port;
NSString *name;
NSMessagePort *port;
NSString *name;
BOOL unknownThread = GSRegisterCurrentThread();
CREATE_AUTORELEASE_POOL(arp);

View file

@ -1794,7 +1794,7 @@ static unsigned wordAlign;
- (void) getFds: (int*)fds count: (int*)count
{
NSMapEnumerator me;
WSAEVENT event;
void *event;
SOCKET fd;
GSTcpHandle *handle;
id recvSelf;
@ -1822,7 +1822,7 @@ static unsigned wordAlign;
*/
recvSelf = GS_GC_HIDE(self);
me = NSEnumerateMapTable(events);
while (NSNextMapEnumeratorPair(&me, (void*)&event, (void*)&fd))
while (NSNextMapEnumeratorPair(&me, &event, (void**)&fd))
{
handle = (GSTcpHandle*)NSMapGet(handles, (void*)(gsaddr)fd);
if (handle->recvPort == recvSelf && handle->inReplyMode == NO)
@ -1837,7 +1837,7 @@ static unsigned wordAlign;
- (void) getFds: (int*)fds count: (int*)count
{
NSMapEnumerator me;
SOCKET sock;
void *sock;
GSTcpHandle *handle;
id recvSelf;
@ -1864,11 +1864,11 @@ static unsigned wordAlign;
*/
recvSelf = GS_GC_HIDE(self);
me = NSEnumerateMapTable(handles);
while (NSNextMapEnumeratorPair(&me, (void*)&sock, (void*)&handle))
while (NSNextMapEnumeratorPair(&me, &sock, (void**)&handle))
{
if (handle->recvPort == recvSelf)
{
fds[(*count)++] = sock;
fds[(*count)++] = (SOCKET)sock;
}
}
NSEndMapTableEnumeration(&me);
@ -1879,7 +1879,7 @@ static unsigned wordAlign;
- (id) conversation: (NSPort*)recvPort
{
NSMapEnumerator me;
SOCKET sock;
void *dummy;
GSTcpHandle *handle = nil;
M_LOCK(myLock);
@ -1887,7 +1887,7 @@ static unsigned wordAlign;
* Enumerate all our socket handles, and look for one with port.
*/
me = NSEnumerateMapTable(handles);
while (NSNextMapEnumeratorPair(&me, (void*)&sock, (void*)&handle))
while (NSNextMapEnumeratorPair(&me, &dummy, (void**)&handle))
{
if ([handle recvPort] == recvPort)
{
@ -1907,6 +1907,7 @@ static unsigned wordAlign;
{
NSMapEnumerator me;
SOCKET sock;
void *dummy;
#ifndef BROKEN_SO_REUSEADDR
int opt = 1;
#endif
@ -1917,7 +1918,7 @@ static unsigned wordAlign;
* Enumerate all our socket handles, and look for one with port.
*/
me = NSEnumerateMapTable(handles);
while (NSNextMapEnumeratorPair(&me, (void*)&sock, (void*)&handle))
while (NSNextMapEnumeratorPair(&me, &dummy, (void**)&handle))
{
if ([handle recvPort] == recvPort)
{

View file

@ -135,7 +135,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
HANDLE *handleArray;
int num_handles;
unsigned i;
HANDLE handle;
void *handle;
int wait_timeout;
DWORD wait_return;
BOOL do_wait;
@ -215,9 +215,9 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
hEnum = NSEnumerateMapTable(handleMap);
i = 0;
while (NSNextMapEnumeratorPair(&hEnum, (void**)&handle, (void**)&watcher))
while (NSNextMapEnumeratorPair(&hEnum, &handle, (void**)&watcher))
{
handleArray[i++] = handle;
handleArray[i++] = (HANDLE)handle;
}
do_wait = YES;