From 8658db87db26c7c752e36bc4b525f691286e8abb Mon Sep 17 00:00:00 2001 From: rfm Date: Mon, 17 Nov 2008 13:45:32 +0000 Subject: [PATCH] Applied patch #6677 git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27080 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 40 +++++++++++++++++++++++- Source/Additions/GSXML.m | 2 +- Source/GSFFCallInvocation.m | 3 +- Source/GSFFIInvocation.m | 3 +- Source/GSFormat.m | 2 +- Source/GSHTTPURLHandle.m | 5 ++- Source/GSSocketStream.m | 21 ++++++++----- Source/GSString.m | 18 +++++------ Source/NSArray.m | 2 +- Source/NSCharacterSet.m | 1 + Source/NSConnection.m | 2 +- Source/NSDebug.m | 2 ++ Source/NSDecimalNumber.m | 4 +-- Source/NSDistributedNotificationCenter.m | 16 +++++----- Source/NSKeyValueMutableArray.m | 14 ++++----- Source/NSMessagePort.m | 2 +- Source/NSNumberFormatter.m | 2 +- Source/NSObject.m | 6 ++-- Source/NSPredicate.m | 2 +- Source/NSPropertyList.m | 2 +- Source/NSProxy.m | 2 +- Source/NSRunLoop.m | 4 +-- Source/NSSet.m | 4 +-- Source/NSSocketPort.m | 14 ++++----- Source/NSString.m | 2 +- Source/NSTask.m | 4 +-- Source/NSURL.m | 2 +- Source/cifframe.m | 2 +- Source/inet_ntop.c | 5 +-- Source/mframe.m | 4 +-- Source/win32/GSFileHandle.m | 12 +++---- Source/win32/GSRunLoopCtxt.m | 6 ++-- Source/win32/NSMessagePort.m | 8 ++--- Source/win32/NSMessagePortNameServer.m | 10 +++--- Source/win32/NSUserDefaults.m | 2 +- 35 files changed, 142 insertions(+), 88 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ba9cade0..6243dc60c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,42 @@ -2008-10-15 Richard Frith-Macdonald +2008-11-07 Roland Schwingel + + * Source/GSSocketStream.m: + * Source/NSPropertyList.m: + * Source/NSDistributedNotificationCenter.m: + * Source/NSSocketPort.m: + * Source/NSRunLoop.m: + * Source/GSFFCallInvocation.m: + * Source/NSArray.m: + * Source/inet_ntop.c: + * Source/NSDebug.m: + * Source/NSPredicate.m: + * Source/GSHTTPURLHandle.m: + * Source/GSFFIInvocation.m: + * Source/NSMessagePort.m: + * Source/win32/GSFileHandle.m: + * Source/win32/NSUserDefaults.m: + * Source/win32/NSMessagePort.m: + * Source/win32/GSRunLoopCtxt.m: + * Source/win32/NSMessagePortNameServer.m: + * Source/NSKeyValueMutableArray.m: + * Source/NSURL.m: + * Source/mframe.m: + * Source/NSObject.m: + * Source/NSString.m: + * Source/NSDecimalNumber.m: + * Source/cifframe.m: + * Source/Additions/GSXML.m: + * Source/GSString.m: + * Source/NSConnection.m: + * Source/NSProxy.m: + * Source/GSFormat.m: + * Source/NSSet.m: + * Source/NSTask.m: + * Source/NSCharacterSet.m: + * Source/NSNumberFormatter.m: + Cosmetic changes plus a couple of fixes for 64bit mswindows. + +2008-11-15 Richard Frith-Macdonald * Source/NSProcessInfo.m: Remove useless sysctl command. * Source/NSMessagePort.m: Ensure port is not deallocated while diff --git a/Source/Additions/GSXML.m b/Source/Additions/GSXML.m index 03a95cdfa..9e3998b42 100644 --- a/Source/Additions/GSXML.m +++ b/Source/Additions/GSXML.m @@ -2413,7 +2413,7 @@ loadEntityFunction(void *ctx, entityId = (eid != 0) ? (id)UTF8Str(eid) : nil; location = UTF8Str(url); components = [location pathComponents]; - local = [NSMutableString string]; + local = (NSMutableString *) [NSMutableString string]; /* * Build a local filename by replacing path separator characters with diff --git a/Source/GSFFCallInvocation.m b/Source/GSFFCallInvocation.m index e5c5effc2..cc9cd0b9a 100644 --- a/Source/GSFFCallInvocation.m +++ b/Source/GSFFCallInvocation.m @@ -182,7 +182,8 @@ static const char *gs_subtypes(const char *type, int *result) /* return the index'th subtype */ -static const char *gs_subtype(const char *type, int index) +static __attribute__((unused)) +const char *gs_subtype(const char *type, int index) { int count = 0; diff --git a/Source/GSFFIInvocation.m b/Source/GSFFIInvocation.m index 87ece6f9a..0499ceaea 100644 --- a/Source/GSFFIInvocation.m +++ b/Source/GSFFIInvocation.m @@ -204,7 +204,8 @@ static IMP gs_objc_msg_forward2 (id receiver, SEL sel) return (IMP)cclosure; } -static IMP gs_objc_msg_forward (SEL sel) +static __attribute__ ((__unused__)) +IMP gs_objc_msg_forward (SEL sel) { return gs_objc_msg_forward2 (nil, sel); } diff --git a/Source/GSFormat.m b/Source/GSFormat.m index 9435d501e..c954cc488 100644 --- a/Source/GSFormat.m +++ b/Source/GSFormat.m @@ -1671,7 +1671,7 @@ NSDictionary *locale) { /* If the pointer is not NULL, write it as a %#x spec. */ base = 16; - number.word = (unsigned long int) ptr; + number.word = (size_t) ptr; is_negative = 0; alt = 1; group = 0; diff --git a/Source/GSHTTPURLHandle.m b/Source/GSHTTPURLHandle.m index f585e0ada..a3c885c0c 100644 --- a/Source/GSHTTPURLHandle.m +++ b/Source/GSHTTPURLHandle.m @@ -1397,8 +1397,11 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data) } if (sock == nil) { + #ifdef _WIN32 + extern int __declspec(dllimport) errno; + #else extern int errno; - + #endif /* * Tell superclass that the load failed - let it do housekeeping. */ diff --git a/Source/GSSocketStream.m b/Source/GSSocketStream.m index 6b5399005..90e394173 100644 --- a/Source/GSSocketStream.m +++ b/Source/GSSocketStream.m @@ -52,6 +52,11 @@ # endif #endif +#ifdef _WIN32 +extern const char *inet_ntop(int, const void *, char *, size_t); +extern int inet_pton(int , const char *, void *); +#endif + unsigned GSPrivateSockaddrLength(struct sockaddr *addr) { @@ -1264,7 +1269,7 @@ setNonBlocking(SOCKET fd) case AF_INET: { struct sockaddr_in sin; - unsigned size = sizeof(sin); + socklen_t size = sizeof(sin); if ([key isEqualToString: GSStreamLocalAddressKey]) { @@ -1304,7 +1309,7 @@ setNonBlocking(SOCKET fd) case AF_INET6: { struct sockaddr_in6 sin; - unsigned size = sizeof(sin); + socklen_t size = sizeof(sin); if ([key isEqualToString: GSStreamLocalAddressKey]) { @@ -1445,7 +1450,7 @@ setNonBlocking(SOCKET fd) case AF_LOCAL: { struct sockaddr_un peer; - const char *c_addr; + const char *c_addr; c_addr = [address fileSystemRepresentation]; memset(&peer, '\0', sizeof(peer)); @@ -1737,7 +1742,7 @@ setNonBlocking(SOCKET fd) else { #if defined(__MINGW32__) - readLen = recv([self _sock], buffer, len, 0); + readLen = recv([self _sock], (char*) buffer, (socklen_t) len, 0); #else readLen = read([self _sock], buffer, len); #endif @@ -1826,7 +1831,7 @@ setNonBlocking(SOCKET fd) [self _unschedule]; if (error == 0) { - unsigned len = sizeof(error); + socklen_t len = sizeof(error); getReturn = getsockopt(_sock, SOL_SOCKET, SO_ERROR, (char*)&error, &len); @@ -1983,9 +1988,9 @@ setNonBlocking(SOCKET fd) } #if defined(__MINGW32__) - writeLen = send([self _sock], buffer, len, 0); + writeLen = send([self _sock], (char*) buffer, (socklen_t) len, 0); #else - writeLen = write([self _sock], buffer, len); + writeLen = write([self _sock], buffer, (socklen_t) len); #endif if (socketError(writeLen)) @@ -2231,7 +2236,7 @@ setNonBlocking(SOCKET fd) [self _unschedule]; if (error == 0) { - unsigned len = sizeof(error); + socklen_t len = sizeof(error); getReturn = getsockopt(_sock, SOL_SOCKET, SO_ERROR, (char*)&error, &len); diff --git a/Source/GSString.m b/Source/GSString.m index d6ddf9819..ecf47fdac 100644 --- a/Source/GSString.m +++ b/Source/GSString.m @@ -876,7 +876,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree, * peculiar to its memory management (shrinking, growing, and converting). */ -static inline char* +static inline const char* UTF8String_c(GSStr self) { unsigned char *r; @@ -922,10 +922,10 @@ UTF8String_c(GSStr self) NSZoneFree(NSDefaultMallocZone(), u); } - return (char*)r; + return (const char*)r; } -static inline char* +static inline const char* UTF8String_u(GSStr self) { unsigned c = self->_count; @@ -945,7 +945,7 @@ UTF8String_u(GSStr self) [NSException raise: NSCharacterConversionException format: @"Can't get UTF8 from Unicode string."]; } - return (char*)r; + return (const char*)r; } } @@ -1184,7 +1184,7 @@ compare_u(GSStr self, NSString *aString, unsigned mask, NSRange aRange) return strCompUsNs((id)self, aString, mask, aRange); } -static inline char* +static inline const char* cString_c(GSStr self, NSStringEncoding enc) { unsigned char *r; @@ -1245,10 +1245,10 @@ cString_c(GSStr self, NSStringEncoding enc) NSZoneFree(NSDefaultMallocZone(), u); } - return (char*)r; + return (const char*)r; } -static inline char* +static inline const char* cString_u(GSStr self, NSStringEncoding enc) { unsigned c = self->_count; @@ -1273,7 +1273,7 @@ cString_u(GSStr self, NSStringEncoding enc) [NSDataClass dataWithBytesNoCopy: tmp length: (c + 1)*2 freeWhenDone: YES]; - return (char*)tmp; + return (const char*)tmp; } else { @@ -1286,7 +1286,7 @@ cString_u(GSStr self, NSStringEncoding enc) [NSException raise: NSCharacterConversionException format: @"Can't get cString from Unicode string."]; } - return (char*)r; + return (const char*)r; } } diff --git a/Source/NSArray.m b/Source/NSArray.m index 96401c1f1..929d3c021 100644 --- a/Source/NSArray.m +++ b/Source/NSArray.m @@ -1357,7 +1357,7 @@ compare(id elem1, id elem2, void* context) - (id) valueForKeyPath: (NSString*)path { - id result; + id result = nil; if ([path hasPrefix: @"@"]) { diff --git a/Source/NSCharacterSet.m b/Source/NSCharacterSet.m index 916bf2e3a..6d52d0753 100644 --- a/Source/NSCharacterSet.m +++ b/Source/NSCharacterSet.m @@ -1250,6 +1250,7 @@ static Class concreteMutableClass = nil; NSRange r; BOOL findingLocation = YES; + r.location = 0; indexes = [NSMutableIndexSet new]; for (i = 0; i < length; i++) { diff --git a/Source/NSConnection.m b/Source/NSConnection.m index 68b691002..f1d059b68 100644 --- a/Source/NSConnection.m +++ b/Source/NSConnection.m @@ -2754,7 +2754,7 @@ static void callEncoder (DOContext *ctxt) */ - (NSPortCoder*) _getReplyRmc: (int)sn { - NSPortCoder *rmc; + NSPortCoder *rmc = nil; GSIMapNode node = 0; NSDate *timeout_date = nil; NSTimeInterval last_interval = 0.0001; diff --git a/Source/NSDebug.m b/Source/NSDebug.m index 8a2dbfcc0..f2460a870 100644 --- a/Source/NSDebug.m +++ b/Source/NSDebug.m @@ -877,8 +877,10 @@ case a: env->addr = __builtin_return_address(a + 1); break; #if defined(__MINGW32__) #include +#ifndef SIGBUS #define SIGBUS SIGILL #endif +#endif typedef struct { jmp_buf buf; diff --git a/Source/NSDecimalNumber.m b/Source/NSDecimalNumber.m index 63d68be15..1e9b08998 100644 --- a/Source/NSDecimalNumber.m +++ b/Source/NSDecimalNumber.m @@ -250,8 +250,8 @@ static NSDecimalNumber *one; */ - (id) initWithBytes: (const void*)value objCType: (const char*)type { - unsigned long long val; - long long llval; + unsigned long long val = 0ll; + long long llval = 0ll; NSDecimal decimal; BOOL negative, llvalSet; diff --git a/Source/NSDistributedNotificationCenter.m b/Source/NSDistributedNotificationCenter.m index 77b8ee617..8ab27d2f1 100644 --- a/Source/NSDistributedNotificationCenter.m +++ b/Source/NSDistributedNotificationCenter.m @@ -53,7 +53,7 @@ object: (NSString*)object userInfo: (NSData*)info selector: (NSString*)aSelector - to: (unsigned long)observer; + to: (size_t)observer; @end /** @@ -337,7 +337,7 @@ static NSDistributedNotificationCenter *netCenter = nil; NS_DURING { [self _connect]; - [(id)_remote addObserver: (unsigned long)anObserver + [(id)_remote addObserver: (size_t)anObserver selector: NSStringFromSelector(aSelector) name: notificationName object: anObject @@ -463,7 +463,7 @@ static NSDistributedNotificationCenter *netCenter = nil; NS_DURING { [self _connect]; - [(id)_remote removeObserver: (unsigned long)anObserver + [(id)_remote removeObserver: (size_t)anObserver name: notificationName object: anObject for: (id)self]; @@ -517,7 +517,7 @@ static NSDistributedNotificationCenter *netCenter = nil; * in the source where the '@protocol()' directive is used. */ @interface NSDistributedNotificationCenterDummy : NSObject -- (void) addObserver: (unsigned long)anObserver +- (void) addObserver: (size_t)anObserver selector: (NSString*)aSelector name: (NSString*)notificationname object: (NSString*)anObject @@ -529,7 +529,7 @@ static NSDistributedNotificationCenter *netCenter = nil; deliverImmediately: (BOOL)deliverImmediately for: (id)client; - (void) registerClient: (id)client; -- (void) removeObserver: (unsigned long)anObserver +- (void) removeObserver: (size_t)anObserver name: (NSString*)notificationname object: (NSString*)anObject for: (id)client; @@ -539,7 +539,7 @@ static NSDistributedNotificationCenter *netCenter = nil; @end @implementation NSDistributedNotificationCenterDummy -- (void) addObserver: (unsigned long)anObserver +- (void) addObserver: (size_t)anObserver selector: (NSString*)aSelector name: (NSString*)notificationname object: (NSString*)anObject @@ -557,7 +557,7 @@ static NSDistributedNotificationCenter *netCenter = nil; - (void) registerClient: (id)client { } -- (void) removeObserver: (unsigned long)anObserver +- (void) removeObserver: (size_t)anObserver name: (NSString*)notificationname object: (NSString*)anObject for: (id)client @@ -802,7 +802,7 @@ static NSDistributedNotificationCenter *netCenter = nil; object: (NSString*)object userInfo: (NSData*)info selector: (NSString*)aSelector - to: (unsigned long)observer + to: (size_t)observer { id userInfo; NSNotification *notification; diff --git a/Source/NSKeyValueMutableArray.m b/Source/NSKeyValueMutableArray.m index 47a1fedf4..00118b110 100644 --- a/Source/NSKeyValueMutableArray.m +++ b/Source/NSKeyValueMutableArray.m @@ -221,7 +221,7 @@ - (void) removeObjectAtIndex: (unsigned)index { - NSIndexSet *indexes; + NSIndexSet *indexes = nil; if (!otherChangeInProgress) { @@ -242,7 +242,7 @@ - (void) insertObject: (id)anObject atIndex: (unsigned)index { - NSIndexSet *indexes; + NSIndexSet *indexes = nil; if (!otherChangeInProgress) { @@ -264,7 +264,7 @@ - (void) replaceObjectAtIndex: (unsigned)index withObject: (id)anObject { - NSIndexSet *indexes; + NSIndexSet *indexes = nil; BOOL triggerNotifications = !otherChangeInProgress; if (triggerNotifications) @@ -332,7 +332,7 @@ - (void) removeObjectAtIndex: (unsigned)index { - NSIndexSet *indexes; + NSIndexSet *indexes = nil; NSMutableArray *temp; if (!otherChangeInProgress) @@ -359,7 +359,7 @@ - (void) insertObject: (id)anObject atIndex: (unsigned)index { - NSIndexSet *indexes; + NSIndexSet *indexes = nil; NSMutableArray *temp; if (!otherChangeInProgress) @@ -386,7 +386,7 @@ - (void) replaceObjectAtIndex: (unsigned)index withObject: (id)anObject { - NSIndexSet *indexes; + NSIndexSet *indexes = nil; NSMutableArray *temp; if (!otherChangeInProgress) @@ -432,7 +432,7 @@ char cKey[size + 2]; char *cKeyPtr = &cKey[0]; const char *type = 0; - BOOL found; + BOOL found = NO; int offset; cKey[0] = '_'; diff --git a/Source/NSMessagePort.m b/Source/NSMessagePort.m index c43eb3a23..a18077316 100644 --- a/Source/NSMessagePort.m +++ b/Source/NSMessagePort.m @@ -1452,7 +1452,7 @@ typedef struct { me = NSEnumerateMapTable(handles); while (NSNextMapEnumeratorPair(&me, &dummy, (void**)&handle)) { - if ([handle recvPort] == recvPort) + if ((NSPort*) [handle recvPort] == recvPort) { RETAIN(handle); NSEndMapTableEnumeration(&me); diff --git a/Source/NSNumberFormatter.m b/Source/NSNumberFormatter.m index 4926cc076..7331a024d 100644 --- a/Source/NSNumberFormatter.m +++ b/Source/NSNumberFormatter.m @@ -517,7 +517,7 @@ NSString *prefix; NSString *suffix; NSString *wholeString; - NSString *fracPad; + NSString *fracPad = nil; NSString *fracPartString; NSMutableString *intPartString; NSMutableString *formattedNumber; diff --git a/Source/NSObject.m b/Source/NSObject.m index 1b2a50528..e7b112cb2 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -28,9 +28,10 @@ /* On some versions of mingw we need to work around bad function declarations * by defining them away and doing the declarations ourself later. */ +#ifndef _WIN64 #define InterlockedIncrement BadInterlockedIncrement #define InterlockedDecrement BadInterlockedDecrement - +#endif #include "config.h" #include "GNUstepBase/preface.h" @@ -211,11 +212,12 @@ static void GSLogZombie(id o, SEL sel) #if defined(REFCNT_LOCAL) #if defined(__MINGW32__) - +#ifndef _WIN64 #undef InterlockedIncrement #undef InterlockedDecrement LONG WINAPI InterlockedIncrement(LONG volatile *); LONG WINAPI InterlockedDecrement(LONG volatile *); +#endif /* Set up atomic read, increment and decrement for mswindows */ diff --git a/Source/NSPredicate.m b/Source/NSPredicate.m index 1cafe30c7..bb07ba0a5 100644 --- a/Source/NSPredicate.m +++ b/Source/NSPredicate.m @@ -1589,7 +1589,7 @@ - (NSPredicate *) parse { - NSPredicate *r; + NSPredicate *r = nil; NS_DURING { diff --git a/Source/NSPropertyList.m b/Source/NSPropertyList.m index 3d7c45488..6f3a31885 100644 --- a/Source/NSPropertyList.m +++ b/Source/NSPropertyList.m @@ -1730,7 +1730,7 @@ PString(NSString *obj, NSMutableData *output) static void XString(NSString* obj, NSMutableData *output) { - static char *hexdigits = "0123456789ABCDEF"; + static const char *hexdigits = "0123456789ABCDEF"; unsigned end; end = [obj length]; diff --git a/Source/NSProxy.m b/Source/NSProxy.m index e6e2f25a5..8ae4899df 100644 --- a/Source/NSProxy.m +++ b/Source/NSProxy.m @@ -275,7 +275,7 @@ extern BOOL __objc_responds_to(id, SEL); - (NSString*) description { return [NSString stringWithFormat: @"<%s %lx>", - GSClassNameFromObject(self), (unsigned long)self]; + GSClassNameFromObject(self), (size_t)self]; } /** diff --git a/Source/NSRunLoop.m b/Source/NSRunLoop.m index 3a471b786..c58e069d2 100644 --- a/Source/NSRunLoop.m +++ b/Source/NSRunLoop.m @@ -862,7 +862,7 @@ static inline BOOL timerInvalidated(NSTimer *t) NSTimeInterval now; NSDate *earliest = nil; BOOL recheck = YES; - NSTimeInterval ei; + NSTimeInterval ei = 0; NSTimer *t; NSTimeInterval ti; unsigned i; @@ -1089,7 +1089,7 @@ static inline BOOL timerInvalidated(NSTimer *t) beforeDate: (NSDate*)limit_date { GSRunLoopCtxt *context; - NSTimeInterval ti; + NSTimeInterval ti = 0; int timeout_ms; NSString *savedMode = _currentMode; CREATE_AUTORELEASE_POOL(arp); diff --git a/Source/NSSet.m b/Source/NSSet.m index 98d7c5a19..9c39a982d 100644 --- a/Source/NSSet.m +++ b/Source/NSSet.m @@ -445,7 +445,7 @@ static Class NSMutableSet_concrete_class; id e = [self objectEnumerator]; unsigned i; unsigned c = [self count]; - NSArray *result; + NSArray *result = nil; GS_BEGINIDBUF(k, c); for (i = 0; i < c; i++) @@ -630,7 +630,7 @@ static Class NSMutableSet_concrete_class; - (id) valueForKeyPath: (NSString*)path { - id result; + id result = (id) nil; if ([path hasPrefix: @"@"]) { diff --git a/Source/NSSocketPort.m b/Source/NSSocketPort.m index 0d4f69247..08e06105c 100644 --- a/Source/NSSocketPort.m +++ b/Source/NSSocketPort.m @@ -698,7 +698,7 @@ static Class runLoopClass; #if defined(__MINGW32__) - (int) eventHandle { - return (int)event; + return (int) (size_t) event; } #endif @@ -1102,7 +1102,7 @@ static Class runLoopClass; if (state == GS_H_TRYCON) /* Connection attempt. */ { int res = 0; - unsigned len = sizeof(res); + socklen_t len = sizeof(res); if (getsockopt(desc, SOL_SOCKET, SO_ERROR, (char*)&res, &len) != 0) { @@ -1541,7 +1541,7 @@ static Class tcpPortClass; forceAddress: (NSString*)addr listener: (BOOL)shouldListen { - unsigned i; + socklen_t slen; NSSocketPort *port = nil; NSHost *thisHost = [NSHost localHost]; NSMapTable *thePorts; @@ -1629,7 +1629,7 @@ static Class tcpPortClass; /* * Need size of buffer for getsockbyname() later. */ - i = sizeof(sockaddr); + slen = sizeof(sockaddr); if (addrOk == NO) { @@ -1672,7 +1672,7 @@ static Class tcpPortClass; (void) close(desc); DESTROY(port); } - else if (getsockname(desc, (struct sockaddr*)&sockaddr, &i) + else if (getsockname(desc, (struct sockaddr*)&sockaddr, &slen) == SOCKET_ERROR) { NSLog(@"unable to get socket name - %@", [NSError _last]); @@ -1935,7 +1935,7 @@ static Class tcpPortClass; me = NSEnumerateMapTable(handles); while (NSNextMapEnumeratorPair(&me, &dummy, (void**)&handle)) { - if ([handle recvPort] == recvPort) + if ((NSPort*) [handle recvPort] == recvPort) { RETAIN(handle); NSEndMapTableEnumeration(&me); @@ -2158,7 +2158,7 @@ static Class tcpPortClass; #endif { struct sockaddr_in sockAddr; - unsigned size = sizeof(sockAddr); + size_t size = sizeof(sockAddr); desc = accept(listener, (struct sockaddr*)&sockAddr, &size); if (desc == INVALID_SOCKET) diff --git a/Source/NSString.m b/Source/NSString.m index 1d04af25c..20d9ced66 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -4610,7 +4610,7 @@ static NSFileManager *fm = nil; } else { - self = [self initWithBytesNoCopy: "" + self = [self initWithBytesNoCopy: (char *)"" length: 0 encoding: NSASCIIStringEncoding freeWhenDone: NO]; diff --git a/Source/NSTask.m b/Source/NSTask.m index 849e51c1b..6e151f791 100644 --- a/Source/NSTask.m +++ b/Source/NSTask.m @@ -1004,7 +1004,7 @@ static DWORD WINAPI _threadFunction(LPVOID t) NSConcreteWindowsTask *task; [tasksLock lock]; - task = (NSConcreteWindowsTask*)NSMapGet(activeTasks, (void*)taskId); + task = (NSConcreteWindowsTask*)NSMapGet(activeTasks, (void*)(intptr_t) taskId); [tasksLock unlock]; if (task == nil) { @@ -1216,7 +1216,7 @@ quotedFromString(NSString *aString) ASSIGN(_launchPath, lpath); // Actual path used. [tasksLock lock]; - NSMapInsert(activeTasks, (void*)_taskId, (void*)self); + NSMapInsert(activeTasks, (void*)(intptr_t) _taskId, (void*)self); [tasksLock unlock]; /* * Create thread to watch for termination of process. diff --git a/Source/NSURL.m b/Source/NSURL.m index 25a243f7b..e6a917ef3 100644 --- a/Source/NSURL.m +++ b/Source/NSURL.m @@ -978,7 +978,7 @@ static unsigned urlAlign; { buf->user = 0; buf->password = 0; - buf->host = "localhost"; + buf->host = (char*) "localhost"; buf->port = 0; buf->isGeneric = YES; } diff --git a/Source/cifframe.m b/Source/cifframe.m index 78e3a7596..78dd09461 100644 --- a/Source/cifframe.m +++ b/Source/cifframe.m @@ -708,7 +708,7 @@ cifframe_do_call (DOContext *ctxt, /* The selector for the message we're sending to the TARGET. */ SEL selector; /* The OBJECT's Method(_t) pointer for the SELECTOR. */ - GSMethod meth; + GSMethod meth = 0; /* The OBJECT's implementation of the SELECTOR. */ IMP method_implementation; /* Type qualifier flags; see . */ diff --git a/Source/inet_ntop.c b/Source/inet_ntop.c index b74cbc9a7..20b3ebee5 100644 --- a/Source/inet_ntop.c +++ b/Source/inet_ntop.c @@ -46,7 +46,7 @@ */ static const char *inet_ntop4(const u_char *src, char *dst, size_t size); -static const char *inet_ntop6(const u_char *src, char *dst, size_t size); +static __attribute__((unused)) const char *inet_ntop6(const u_char *src, char *dst, size_t size); /* char * * inet_ntop(af, src, dst, size) @@ -114,7 +114,8 @@ inet_ntop4(src, dst, size) * author: * Paul Vixie, 1996. */ -static const char * +static __attribute__((unused)) +const char * inet_ntop6(src, dst, size) const u_char *src; char *dst; diff --git a/Source/mframe.m b/Source/mframe.m index 720c8eeaf..f44735cba 100644 --- a/Source/mframe.m +++ b/Source/mframe.m @@ -820,7 +820,7 @@ mframe_do_call (DOContext *ctxt, /* The selector for the message we're sending to the TARGET. */ SEL selector; /* The OBJECT's Method(_t) pointer for the SELECTOR. */ - GSMethod meth; + GSMethod meth = 0; /* The OBJECT's implementation of the SELECTOR. */ IMP method_implementation; /* The number bytes for holding arguments passed on the stack. */ @@ -909,7 +909,7 @@ mframe_do_call (DOContext *ctxt, @"Will search for arbitrary signature.", object, GSNameFromClass(GSObjCIsClass(object) - ? object : GSObjCClass(object)), + ? object : (id) GSObjCClass(object)), GSNameFromSelector(selector)); type = GSTypesFromSelector(selector); } diff --git a/Source/win32/GSFileHandle.m b/Source/win32/GSFileHandle.m index ca58636f3..018037e99 100644 --- a/Source/win32/GSFileHandle.m +++ b/Source/win32/GSFileHandle.m @@ -888,7 +888,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; #endif SOCKET net; struct sockaddr_in sin; - unsigned int size = sizeof(sin); + int size = sizeof(sin); if (getAddr(a, s, p, &sin) == NO) { @@ -1924,7 +1924,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; { struct sockaddr_in buf; SOCKET desc; - unsigned int blen = sizeof(buf); + int blen = sizeof(buf); desc = accept((SOCKET)_get_osfhandle(descriptor), (struct sockaddr*)&buf, &blen); @@ -1941,7 +1941,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; { // Accept attempt completed. GSFileHandle *h; struct sockaddr_in sin; - unsigned int size = sizeof(sin); + int size = sizeof(sin); int status; /* @@ -2045,7 +2045,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; { // Connection attempt completed. int result; int rval; - unsigned len = sizeof(result); + int len = sizeof(result); rval = getsockopt((SOCKET)_get_osfhandle(descriptor), SOL_SOCKET, SO_ERROR, (char*)&result, &len); @@ -2293,7 +2293,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; { NSString *str = nil; struct sockaddr_in sin; - unsigned size = sizeof(sin); + int size = sizeof(sin); if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == SOCKET_ERROR) { @@ -2310,7 +2310,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; { NSString *str = nil; struct sockaddr_in sin; - unsigned size = sizeof(sin); + int size = sizeof(sin); if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == SOCKET_ERROR) { diff --git a/Source/win32/GSRunLoopCtxt.m b/Source/win32/GSRunLoopCtxt.m index 861a1a6cc..33f3575f4 100644 --- a/Source/win32/GSRunLoopCtxt.m +++ b/Source/win32/GSRunLoopCtxt.m @@ -331,7 +331,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks = switch (info->type) { case ET_HANDLE: - handle = (HANDLE)(int)info->data; + handle = (HANDLE)(size_t)info->data; NSMapInsert(handleMap, (void*)handle, info); num_handles++; break; @@ -355,13 +355,13 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks = while (port_handle_count--) { NSMapInsert(handleMap, - (void*)port_handle_array[port_handle_count], info); + (void*)(size_t) port_handle_array[port_handle_count], info); num_handles++; } } break; case ET_WINMSG: - handle = (HANDLE)(int)info->data; + handle = (HANDLE)(size_t)info->data; NSMapInsert(winMsgMap, (void*)handle, info); num_winMsgs++; break; diff --git a/Source/win32/NSMessagePort.m b/Source/win32/NSMessagePort.m index 08187213f..b0a66b2b0 100644 --- a/Source/win32/NSMessagePort.m +++ b/Source/win32/NSMessagePort.m @@ -50,7 +50,7 @@ #include #include -extern int errno; +extern __declspec(dllimport) int errno; #define UNISTR(X) \ ((const unichar*)[(X) cStringUsingEncoding: NSUnicodeStringEncoding]) @@ -596,8 +596,8 @@ static Class messagePortClass = 0; GSPortItemHeader *pih; unsigned off = 0; unsigned len; - unsigned rId; - unsigned nItems; + unsigned rId = 0; + unsigned nItems = 0; NSMessagePort *rPort = nil; NSMutableArray *rItems = nil; @@ -971,7 +971,7 @@ again: from: (NSPort*)receivingPort reserved: (unsigned)length { - NSMutableData *h; + NSMutableData *h = nil; NSMutableData *first; BOOL sent = NO; unsigned c; diff --git a/Source/win32/NSMessagePortNameServer.m b/Source/win32/NSMessagePortNameServer.m index c3b68f935..09a5e899c 100644 --- a/Source/win32/NSMessagePortNameServer.m +++ b/Source/win32/NSMessagePortNameServer.m @@ -46,7 +46,7 @@ #define UNISTR(X) \ ((const unichar*)[(X) cStringUsingEncoding: NSUnicodeStringEncoding]) -extern int errno; +extern __declspec(dllimport) int errno; static NSRecursiveLock *serverLock = nil; static NSMessagePortNameServer *defaultServer = nil; @@ -112,7 +112,7 @@ static void clean_up_names(void) HKEY_CURRENT_USER, UNISTR(registry), 0, - L"", + (LPWSTR) L"", REG_OPTION_VOLATILE, STANDARD_RIGHTS_WRITE|STANDARD_RIGHTS_READ|KEY_SET_VALUE |KEY_QUERY_VALUE|KEY_NOTIFY, @@ -227,7 +227,7 @@ OutputDebugStringW(L""); return nil; } - mailslotName = [NSString stringWithUTF8String: ptr]; + mailslotName = [NSString stringWithUTF8String: (const char *) ptr]; if (ptr != buf) { objc_free(ptr); @@ -338,7 +338,7 @@ OutputDebugStringW(L""); } n = [[self class] _translate: name]; - str = [[(NSMessagePort*)port name] UTF8String]; + str = (const unsigned char *) [[(NSMessagePort*)port name] UTF8String]; rc = RegSetValueExW( key, @@ -346,7 +346,7 @@ OutputDebugStringW(L""); 0, REG_BINARY, str, - strlen(str)+1); + strlen((const char*) str)+1); NSDebugLLog(@"NSMessagePortNameServer", @"Set port '%s' for %@", str, n); if (rc == ERROR_SUCCESS) { diff --git a/Source/win32/NSUserDefaults.m b/Source/win32/NSUserDefaults.m index 24688bf30..c38fb739f 100644 --- a/Source/win32/NSUserDefaults.m +++ b/Source/win32/NSUserDefaults.m @@ -553,7 +553,7 @@ struct NSUserDefaultsWin32_DomainInfo rc = RegCreateKeyExW(HKEY_CURRENT_USER, UNISTR(dPath), 0, - L"", + (LPWSTR) L"", REG_OPTION_NON_VOLATILE, STANDARD_RIGHTS_WRITE|STANDARD_RIGHTS_READ|KEY_SET_VALUE |KEY_QUERY_VALUE,