diff --git a/ChangeLog b/ChangeLog index d3ad78966..5976fe3ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,150 @@ +2009-02-23 Richard Frith-Macdonald + + * Source/NSIndexPath.m: + * Source/GSSocketStream.h: + * Source/NSTimeZone.m: + * Source/NSNetServices.m: + * Source/NSURLCredential.m: + * Source/GSSocketStream.m: + * Source/NSURLAuthenticationChallenge.m: + * Source/NSCalendarDate.m: + * Source/NSPropertyList.m: + * Source/GSConcreteValueTemplate.m: + * Source/NSAffineTransform.m: + * Source/NSConcretePointerFunctions.h: + * Source/NSPathUtilities.m: + * Source/NSScanner.m: + * Source/NSProcessInfo.m: + * Source/NSDistributedNotificationCenter.m: + * Source/NSNotificationQueue.m: + * Source/NSGeometry.m: + * Source/NSConcretePointerFunctions.m: + * Source/NSRunLoop.m: + * Source/NSAttributedString.m: + * Source/NSUndoManager.m: + * Source/NSMethodSignature.m: + * Source/NSUserDefaults.m: + * Source/NSArray.m: + * Source/GSStream.h: + * Source/GSStream.m: + * Source/NSKeyedArchiver.m: + * Source/NSDebug.m: + * Source/unix/NSStream.m: + * Source/NSKeyedUnarchiver.m: + * Source/NSURLDownload.m: + * Source/NSPredicate.m: + * Source/NSAssertionHandler.m: + * Source/NSZone.m: + * Source/NSPort.m: + * Source/GSPrivate.h: + * Source/win32/NSStream.m: + * Source/NSInvocation.m: + * Source/NSFileManager.m: + * Source/NSURLResponse.m: + * Source/NSURLCache.m: + * Source/NSCoder.m: + * Source/NSException.m: + * Source/NSCopyObject.m: + * Source/NSURL.m: + * Source/NSString.m: + * Source/NSObject.m: + * Source/NSDecimalNumber.m: + * Source/cifframe.m: + * Source/Additions/GCArray.m: + * Source/Additions/GSXML.m: + * Source/Additions/GCDictionary.m: + * Source/Additions/GSCategories.m: + * Source/Additions/GSMime.m: + * Source/NSNumber.m: + * Source/NSDecimal.m: + * Source/GSString.m: + * Source/NSThread.m: + * Source/NSHTTPCookie.m: + * Source/NSData.m: + * Source/NSProxy.m: + * Source/NSURLProtectionSpace.m: + * Source/NSError.m: + * Source/NSDictionary.m: + * Source/NSURLRequest.m: + * Source/NSValue.m: + * Source/NSCountedSet.m: + * Source/NSIndexSet.m: + * Source/GSFileHandle.m: + * Source/NSLock.m: + * Source/NSSet.m: + * Source/NSArchiver.m: + * Source/NSXMLParser.m: + * Source/GSURLPrivate.h: + * Headers/Foundation/NSTimeZone.h: + * Headers/Foundation/NSNetServices.h: + * Headers/Foundation/NSCoder.h: + * Headers/Foundation/NSException.h: + * Headers/Foundation/NSHTTPCookieStorage.h: + * Headers/Foundation/NSURLAuthenticationChallenge.h: + * Headers/Foundation/NSCompoundPredicate.h: + * Headers/Foundation/NSObject.h: + * Headers/Foundation/NSSpellServer.h: + * Headers/Foundation/NSString.h: + * Headers/Foundation/NSCalendarDate.h: + * Headers/Foundation/NSDecimalNumber.h: + * Headers/Foundation/NSURLHandle.h: + * Headers/Foundation/NSPropertyList.h: + * Headers/Foundation/NSAffineTransform.h: + * Headers/Foundation/NSPathUtilities.h: + * Headers/Foundation/NSScanner.h: + * Headers/Foundation/NSProcessInfo.h: + * Headers/Foundation/NSDistributedNotificationCenter.h: + * Headers/Foundation/NSStream.h: + * Headers/Foundation/NSComparisonPredicate.h: + * Headers/Foundation/NSGeometry.h: + * Headers/Foundation/NSNotificationQueue.h: + * Headers/Foundation/NSRunLoop.h: + * Headers/Foundation/NSDecimal.h: + * Headers/Foundation/NSAttributedString.h: + * Headers/Foundation/NSUndoManager.h: + * Headers/Foundation/NSMethodSignature.h: + * Headers/Foundation/NSUserDefaults.h: + * Headers/Foundation/NSThread.h: + * Headers/Foundation/NSData.h: + * Headers/Foundation/NSHTTPCookie.h: + * Headers/Foundation/NSArray.h: + * Headers/Foundation/NSObjCRuntime.h: + * Headers/Foundation/NSProxy.h: + * Headers/Foundation/NSURLProtectionSpace.h: + * Headers/Foundation/NSKeyedArchiver.h: + * Headers/Foundation/NSDebug.h: + * Headers/Foundation/NSError.h: + * Headers/Foundation/NSURLDownload.h: + * Headers/Foundation/NSKeyValueObserving.h: + * Headers/Foundation/NSDictionary.h: + * Headers/Foundation/NSURLRequest.h: + * Headers/Foundation/NSZone.h: + * Headers/Foundation/NSValue.h: + * Headers/Foundation/NSIndexSet.h: + * Headers/Foundation/NSPort.h: + * Headers/Foundation/NSLock.h: + * Headers/Foundation/NSSet.h: + * Headers/Foundation/NSExpression.h: + * Headers/Foundation/NSInvocation.h: + * Headers/Foundation/NSFileManager.h: + * Headers/Foundation/NSXMLParser.h: + * Headers/Foundation/NSURLResponse.h: + * Headers/Foundation/NSIndexPath.h: + * Headers/Foundation/NSURLCache.h: + * Headers/Additions/GNUstepBase/GSXML.h: + * Headers/Additions/GNUstepBase/GSCategories.h: + * Headers/Additions/GNUstepBase/GSMime.h: + * Headers/Additions/GNUstepBase/GSFileHandle.h: + * Tools/gdnc.h: + * Tools/gdnc.m: + Conversion of everything to use the new MacOS-X 10.5 API where return + values and arguments use the NSInteger, NSUInteger, and CGFloat types. + For now, as suggesed by David, the proper 10.5 behavior is turned off + and those types are equivalent to the types used by the old API. + Edit Headers/Foundation/NSObjCRuntime.h to turn on the new behavior + where the integer types are the same size as a pointer, and the float + type is actually a double on 64bit processors. + 2009-02-23 Richard Frith-Macdonald * Source/NSPortCoder.m: diff --git a/Headers/Additions/GNUstepBase/GSCategories.h b/Headers/Additions/GNUstepBase/GSCategories.h index 52b934f9a..d376de27d 100644 --- a/Headers/Additions/GNUstepBase/GSCategories.h +++ b/Headers/Additions/GNUstepBase/GSCategories.h @@ -207,7 +207,7 @@ typedef enum _NSGNUstepStringEncoding */ @interface NSCalendarDate (GSCategories) -- (int) weekOfYear; +- (NSInteger) weekOfYear; @end @interface NSData (GSCategories) @@ -216,10 +216,10 @@ typedef enum _NSGNUstepStringEncoding - (NSData*) md5Digest; - (BOOL) uudecodeInto: (NSMutableData*)decoded name: (NSString**)namePtr - mode: (int*)modePtr; + mode: (NSInteger*)modePtr; - (BOOL) uuencodeInto: (NSMutableData*)encoded name: (NSString*)name - mode: (int)mode; + mode: (NSInteger)mode; @end @interface NSString (GSCategories) @@ -275,11 +275,11 @@ typedef enum _NSGNUstepStringEncoding @interface NSArray (GSCompatibility) - (id) initWithArray: (NSArray*)array copyItems: (BOOL)shouldCopy; -- (unsigned) insertionPosition: (id)item - usingFunction: (NSComparisonResult (*)(id, id, void *))sorter - context: (void *)context; -- (unsigned) insertionPosition: (id)item - usingSelector: (SEL)comp; +- (NSUInteger) insertionPosition: (id)item + usingFunction: (NSComparisonResult (*)(id, id, void *))sorter + context: (void *)context; +- (NSUInteger) insertionPosition: (id)item + usingSelector: (SEL)comp; @end @interface NSAttributedString (GSCategories) @@ -293,7 +293,7 @@ typedef enum _NSGNUstepStringEncoding @end @interface NSDistantObject (GSCompatibility) -+ (void) setDebug: (int)val; ++ (void) setDebug: (NSInteger)val; @end @interface NSFileHandle(GSCompatibility) diff --git a/Headers/Additions/GNUstepBase/GSFileHandle.h b/Headers/Additions/GNUstepBase/GSFileHandle.h index c9ccf5e32..fb8826782 100644 --- a/Headers/Additions/GNUstepBase/GSFileHandle.h +++ b/Headers/Additions/GNUstepBase/GSFileHandle.h @@ -92,7 +92,7 @@ - (void) setNonBlocking: (BOOL)flag; - (void) postReadNotification; - (void) postWriteNotification; -- (int) read: (void*)buf length: (int)len; +- (NSInteger) read: (void*)buf length: (NSUInteger)len; - (void) receivedEvent: (void*)data type: (RunLoopEventType)type extra: (void*)extra @@ -101,7 +101,7 @@ - (BOOL) useCompression; - (void) watchReadDescriptorForModes: (NSArray*)modes; - (void) watchWriteDescriptor; -- (int) write: (const void*)buf length: (int)len; +- (NSInteger) write: (const void*)buf length: (NSUInteger)len; @end diff --git a/Headers/Additions/GNUstepBase/GSMime.h b/Headers/Additions/GNUstepBase/GSMime.h index 149041288..bd729e86c 100644 --- a/Headers/Additions/GNUstepBase/GSMime.h +++ b/Headers/Additions/GNUstepBase/GSMime.h @@ -62,7 +62,7 @@ extern "C" { } - (BOOL) atEnd; - (BOOL) decodeData: (const void*)sData - length: (unsigned)length + length: (NSUInteger)length intoData: (NSMutableData*)dData; - (void) setAtEnd: (BOOL)flag; @end diff --git a/Headers/Additions/GNUstepBase/GSXML.h b/Headers/Additions/GNUstepBase/GSXML.h index a0f73360a..1fcd62b55 100644 --- a/Headers/Additions/GNUstepBase/GSXML.h +++ b/Headers/Additions/GNUstepBase/GSXML.h @@ -119,15 +119,15 @@ extern "C" { id _parent; } -+ (NSString*) descriptionFromType: (int)type; -+ (int) typeFromDescription: (NSString*)desc; ++ (NSString*) descriptionFromType: (NSInteger)type; ++ (NSInteger) typeFromDescription: (NSString*)desc; - (NSString*) href; - (void*) lib; - (GSXMLNamespace*) next; - (NSString*) prefix; -- (int) type; +- (NSInteger) type; - (NSString*) typeDescription; @end @@ -140,8 +140,8 @@ extern "C" { id _parent; } -+ (NSString*) descriptionFromType: (int)type; -+ (int) typeFromDescription: (NSString*)desc; ++ (NSString*) descriptionFromType: (NSInteger)type; ++ (NSInteger) typeFromDescription: (NSString*)desc; - (NSDictionary*) attributes; - (NSString*) content; @@ -177,7 +177,7 @@ extern "C" { - (NSMutableDictionary*) propertiesAsDictionaryWithKeyTransformationSel: (SEL)keyTransformSel; - (void) setObject: (NSString*)value forKey:(NSString*)key; -- (int) type; +- (NSInteger) type; - (NSString*) typeDescription; - (void) setNamespace: (GSXMLNamespace *)space; @@ -209,10 +209,10 @@ extern "C" { + (NSString*) xmlEncodingStringForStringEncoding: (NSStringEncoding)encoding; - (void) abortParsing; -- (int) columnNumber; +- (NSInteger) columnNumber; - (GSXMLDocument*) document; - (BOOL) doValidityChecking: (BOOL)yesno; -- (int) errNo; +- (NSInteger) errNo; - (BOOL) getWarnings: (BOOL)yesno; - (id) initWithSAXHandler: (GSSAXHandler*)handler; - (id) initWithSAXHandler: (GSSAXHandler*)handler @@ -223,7 +223,7 @@ extern "C" { withData: (NSData*)data; - (BOOL) keepBlanks: (BOOL)yesno; -- (int) lineNumber; +- (NSInteger) lineNumber; - (NSString*) messages; - (BOOL) parse; - (BOOL) parse: (NSData*)data; @@ -256,8 +256,8 @@ extern "C" { /** */ - (void) attributeDecl: (NSString*)nameElement name: (NSString*)name - type: (int)type - typeDefValue: (int)defType + type: (NSInteger)type + typeDefValue: (NSInteger)defType defaultValue: (NSString*)value; /** */ - (void) characters: (NSString*)name; @@ -267,7 +267,7 @@ extern "C" { - (void) comment: (NSString*) value; /** */ - (void) elementDecl: (NSString*)name - type: (int)type; + type: (NSInteger)type; /** */ - (void) endDocument; /** */ @@ -278,35 +278,35 @@ extern "C" { href: (NSString*)href; /** */ - (void) entityDecl: (NSString*)name - type: (int)type + type: (NSInteger)type public: (NSString*)publicId system: (NSString*)systemId content: (NSString*)content; - (void) error: (NSString*)e; - (void) error: (NSString*)e - colNumber: (int)colNumber - lineNumber: (int)lineNumber; + colNumber: (NSInteger)colNumber + lineNumber: (NSInteger)lineNumber; - (BOOL) externalSubset: (NSString*)name externalID: (NSString*)externalID systemID: (NSString*)systemID; - (void) fatalError: (NSString*)e; - (void) fatalError: (NSString*)e - colNumber: (int)colNumber - lineNumber: (int)lineNumber; + colNumber: (NSInteger)colNumber + lineNumber: (NSInteger)lineNumber; - (void*) getEntity: (NSString*)name; - (void*) getParameterEntity: (NSString*)name; /** */ - (void) globalNamespace: (NSString*)name href: (NSString*)href prefix: (NSString*)prefix; -- (int) hasExternalSubset; -- (int) hasInternalSubset; +- (NSInteger) hasExternalSubset; +- (NSInteger) hasInternalSubset; /** */ - (void) ignoreWhitespace: (NSString*)ch; - (BOOL) internalSubset: (NSString*)name externalID: (NSString*)externalID systemID: (NSString*)systemID; -- (int) isStandalone; +- (NSInteger) isStandalone; - (NSString*) loadEntity: (NSString*)publicId at: (NSString*)location; /** */ @@ -340,8 +340,8 @@ extern "C" { notationName: (NSString*)notation; - (void) warning: (NSString*)e; - (void) warning: (NSString*)e - colNumber: (int)colNumber - lineNumber: (int)lineNumber; + colNumber: (NSInteger)colNumber + lineNumber: (NSInteger)lineNumber; @end @@ -432,11 +432,11 @@ extern "C" { * For XPath queries returning a node set. */ @interface GSXPathNodeSet : GSXPathObject -- (unsigned int) count; -- (unsigned int) length; +- (NSUInteger) count; +- (NSUInteger) length; /** Please note that index starts from 0. */ -- (GSXMLNode *) nodeAtIndex: (unsigned)index; +- (GSXMLNode *) nodeAtIndex: (NSUInteger)index; @end @interface GSXMLDocument (XSLT) @@ -571,7 +571,8 @@ extern "C" { * as a string.
* This method is intended for use by applications acting as XMLRPC servers. */ -- (NSString*) buildResponseWithFaultCode: (int)code andString: (NSString*)s; +- (NSString*) buildResponseWithFaultCode: (NSInteger)code + andString: (NSString*)s; /** * Builds an XMLRPC response with the specified array of parameters and @@ -624,7 +625,7 @@ extern "C" { */ - (id) makeMethodCall: (NSString*)method params: (NSArray*)params - timeout: (int)seconds; + timeout: (NSInteger)seconds; /** * Parses XML data containing an XMLRPC method call.
@@ -681,7 +682,7 @@ extern "C" { */ - (BOOL) sendMethodCall: (NSString*)method params: (NSArray*)params - timeout: (int)seconds; + timeout: (NSInteger)seconds; /** * Specify whether to generate compact XML (omit indentation and other white diff --git a/Headers/Foundation/NSAffineTransform.h b/Headers/Foundation/NSAffineTransform.h index ee747dedb..e293e5102 100644 --- a/Headers/Foundation/NSAffineTransform.h +++ b/Headers/Foundation/NSAffineTransform.h @@ -33,12 +33,12 @@ #import typedef struct { - float m11; - float m12; - float m21; - float m22; - float tX; - float tY; + CGFloat m11; + CGFloat m12; + CGFloat m21; + CGFloat m22; + CGFloat tX; + CGFloat tY; } NSAffineTransformStruct; @interface NSAffineTransform : NSObject @@ -56,15 +56,15 @@ typedef struct { - (id) initWithTransform: (NSAffineTransform*)aTransform; - (void) invert; - (void) prependTransform: (NSAffineTransform*)aTransform; -- (void) rotateByDegrees: (float)angle; -- (void) rotateByRadians: (float)angleRad; -- (void) scaleBy: (float)scale; -- (void) scaleXBy: (float)scaleX yBy: (float)scaleY; +- (void) rotateByDegrees: (CGFloat)angle; +- (void) rotateByRadians: (CGFloat)angleRad; +- (void) scaleBy: (CGFloat)scale; +- (void) scaleXBy: (CGFloat)scaleX yBy: (CGFloat)scaleY; - (void) setTransformStruct: (NSAffineTransformStruct)val; - (NSPoint) transformPoint: (NSPoint)aPoint; - (NSSize) transformSize: (NSSize)aSize; - (NSAffineTransformStruct) transformStruct; -- (void) translateXBy: (float)tranX yBy: (float)tranY; +- (void) translateXBy: (CGFloat)tranX yBy: (CGFloat)tranY; @end #endif /* __NSAffineTransform_h_GNUSTEP_BASE_INCLUDE */ diff --git a/Headers/Foundation/NSArray.h b/Headers/Foundation/NSArray.h index 25e7b30f4..c242c3dfb 100644 --- a/Headers/Foundation/NSArray.h +++ b/Headers/Foundation/NSArray.h @@ -48,18 +48,18 @@ extern "C" { #endif + (id) arrayWithObject: (id)anObject; + (id) arrayWithObjects: (id)firstObject, ...; -+ (id) arrayWithObjects: (id*)objects count: (unsigned)count; ++ (id) arrayWithObjects: (id*)objects count: (NSUInteger)count; - (NSArray*) arrayByAddingObject: (id)anObject; - (NSArray*) arrayByAddingObjectsFromArray: (NSArray*)anotherArray; - (BOOL) containsObject: anObject; -- (unsigned) count; // Primitive +- (NSUInteger) count; // Primitive - (void) getObjects: (id*)aBuffer; - (void) getObjects: (id*)aBuffer range: (NSRange)aRange; -- (unsigned) indexOfObject: (id)anObject; -- (unsigned) indexOfObject: (id)anObject inRange: (NSRange)aRange; -- (unsigned) indexOfObjectIdenticalTo: (id)anObject; -- (unsigned) indexOfObjectIdenticalTo: (id)anObject inRange: (NSRange)aRange; +- (NSUInteger) indexOfObject: (id)anObject; +- (NSUInteger) indexOfObject: (id)anObject inRange: (NSRange)aRange; +- (NSUInteger) indexOfObjectIdenticalTo: (id)anObject; +- (NSUInteger) indexOfObjectIdenticalTo: (id)anObject inRange: (NSRange)aRange; - (id) init; - (id) initWithArray: (NSArray*)array; #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) @@ -70,10 +70,10 @@ extern "C" { - (id) initWithContentsOfURL: (NSURL*)aURL; #endif - (id) initWithObjects: firstObject, ...; -- (id) initWithObjects: (id*)objects count: (unsigned)count; // Primitive +- (id) initWithObjects: (id*)objects count: (NSUInteger)count; // Primitive - (id) lastObject; -- (id) objectAtIndex: (unsigned)index; // Primitive +- (id) objectAtIndex: (NSUInteger)index; // Primitive #if OS_API_VERSION(100400, GS_API_LATEST) - (NSArray *) objectsAtIndexes: (NSIndexSet *)indexes; #endif @@ -108,7 +108,7 @@ extern "C" { - (NSString*) description; - (NSString*) descriptionWithLocale: (NSDictionary*)locale; - (NSString*) descriptionWithLocale: (NSDictionary*)locale - indent: (unsigned int)level; + indent: (NSUInteger)level; - (BOOL) writeToFile: (NSString*)path atomically: (BOOL)useAuxiliaryFile; #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) @@ -120,22 +120,22 @@ extern "C" { @interface NSMutableArray : NSArray -+ (id) arrayWithCapacity: (unsigned)numItems; ++ (id) arrayWithCapacity: (NSUInteger)numItems; - (void) addObject: (id)anObject; // Primitive - (void) addObjectsFromArray: (NSArray*)otherArray; #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) -- (void) exchangeObjectAtIndex: (unsigned int)i1 - withObjectAtIndex: (unsigned int)i2; +- (void) exchangeObjectAtIndex: (NSUInteger)i1 + withObjectAtIndex: (NSUInteger)i2; #endif -- (id) initWithCapacity: (unsigned)numItems; // Primitive -- (void) insertObject: (id)anObject atIndex: (unsigned)index; // Primitive +- (id) initWithCapacity: (NSUInteger)numItems; // Primitive +- (void) insertObject: (id)anObject atIndex: (NSUInteger)index; // Primitive #if OS_API_VERSION(100400, GS_API_LATEST) - (void) insertObjects: (NSArray *)objects atIndexes: (NSIndexSet *)indexes; #endif -- (void) removeObjectAtIndex: (unsigned)index; // Primitive +- (void) removeObjectAtIndex: (NSUInteger)index; // Primitive - (void) removeObjectsAtIndexes: (NSIndexSet *)indexes; -- (void) replaceObjectAtIndex: (unsigned)index +- (void) replaceObjectAtIndex: (NSUInteger)index withObject: (id)anObject; // Primitive #if OS_API_VERSION(100400, GS_API_LATEST) - (void) replaceObjectsAtIndexes: (NSIndexSet *)indexes @@ -156,8 +156,8 @@ extern "C" { - (void) removeObjectIdenticalTo: (id)anObject inRange: (NSRange)aRange; - (void) removeObjectsInArray: (NSArray*)otherArray; - (void) removeObjectsInRange: (NSRange)aRange; -- (void) removeObjectsFromIndices: (unsigned*)indices - numIndices: (unsigned)count; +- (void) removeObjectsFromIndices: (NSUInteger*)indices + numIndices: (NSUInteger)count; - (void) sortUsingFunction: (NSComparisonResult (*)(id,id,void*))compare context: (void*)context; @@ -185,11 +185,11 @@ extern "C" { * The selector version works the same - returning NSOrderedAscending if * the receiver is 'less than' the item in the array. */ -- (unsigned) insertionPosition: (id)item - usingFunction: (NSComparisonResult (*)(id, id, void *))sorter - context: (void *)context; -- (unsigned) insertionPosition: (id)item - usingSelector: (SEL)comp; +- (NSUInteger) insertionPosition: (id)item + usingFunction: (NSComparisonResult (*)(id, id, void *))sorter + context: (void *)context; +- (NSUInteger) insertionPosition: (id)item + usingSelector: (SEL)comp; @end #if defined(__cplusplus) diff --git a/Headers/Foundation/NSAttributedString.h b/Headers/Foundation/NSAttributedString.h index 872561d3f..fc59405ac 100644 --- a/Headers/Foundation/NSAttributedString.h +++ b/Headers/Foundation/NSAttributedString.h @@ -71,19 +71,19 @@ extern "C" { - (id) initWithString: (NSString*)aString attributes: (NSDictionary*)attributes; //Retrieving character information -- (unsigned int) length; +- (NSUInteger) length; - (NSString*) string; //Primitive method! //Retrieving attribute information -- (NSDictionary*) attributesAtIndex: (unsigned int)index +- (NSDictionary*) attributesAtIndex: (NSUInteger)index effectiveRange: (NSRange*)aRange; //Primitive method! -- (NSDictionary*) attributesAtIndex: (unsigned int)index +- (NSDictionary*) attributesAtIndex: (NSUInteger)index longestEffectiveRange: (NSRange*)aRange inRange: (NSRange)rangeLimit; - (id) attribute: (NSString*)attributeName - atIndex: (unsigned int)index + atIndex: (NSUInteger)index effectiveRange: (NSRange*)aRange; -- (id) attribute: (NSString*)attributeName atIndex: (unsigned int)index +- (id) attribute: (NSString*)attributeName atIndex: (NSUInteger)index longestEffectiveRange: (NSRange*)aRange inRange: (NSRange)rangeLimit; //Comparing attributed strings @@ -115,7 +115,7 @@ extern "C" { //Changing characters and attributes - (void) appendAttributedString: (NSAttributedString*)attributedString; - (void) insertAttributedString: (NSAttributedString*)attributedString - atIndex: (unsigned int)index; + atIndex: (NSUInteger)index; - (void) replaceCharactersInRange: (NSRange)aRange withAttributedString: (NSAttributedString*)attributedString; - (void) replaceCharactersInRange: (NSRange)aRange diff --git a/Headers/Foundation/NSCalendarDate.h b/Headers/Foundation/NSCalendarDate.h index 22bb51657..6a7e195a9 100644 --- a/Headers/Foundation/NSCalendarDate.h +++ b/Headers/Foundation/NSCalendarDate.h @@ -46,12 +46,12 @@ extern "C" { + (id) dateWithString: (NSString*)description calendarFormat: (NSString*)format locale: (NSDictionary*)dictionary; -+ (id) dateWithYear: (int)year - month: (unsigned int)month - day: (unsigned int)day - hour: (unsigned int)hour - minute: (unsigned int)minute - second: (unsigned int)second ++ (id) dateWithYear: (NSInteger)year + month: (NSUInteger)month + day: (NSUInteger)day + hour: (NSUInteger)hour + minute: (NSUInteger)minute + second: (NSUInteger)second timeZone: (NSTimeZone*)aTimeZone; // Initializing an NSCalendar Date @@ -61,32 +61,32 @@ extern "C" { - (id) initWithString: (NSString*)description calendarFormat: (NSString*)fmt locale: (NSDictionary*)locale; -- (id) initWithYear: (int)year - month: (unsigned int)month - day: (unsigned int)day - hour: (unsigned int)hour - minute: (unsigned int)minute - second: (unsigned int)second +- (id) initWithYear: (NSInteger)year + month: (NSUInteger)month + day: (NSUInteger)day + hour: (NSUInteger)hour + minute: (NSUInteger)minute + second: (NSUInteger)second timeZone: (NSTimeZone*)aTimeZone; // Retrieving Date Elements -- (int) dayOfCommonEra; -- (int) dayOfMonth; -- (int) dayOfWeek; -- (int) dayOfYear; -- (int) hourOfDay; -- (int) minuteOfHour; -- (int) monthOfYear; -- (int) secondOfMinute; -- (int) yearOfCommonEra; +- (NSInteger) dayOfCommonEra; +- (NSInteger) dayOfMonth; +- (NSInteger) dayOfWeek; +- (NSInteger) dayOfYear; +- (NSInteger) hourOfDay; +- (NSInteger) minuteOfHour; +- (NSInteger) monthOfYear; +- (NSInteger) secondOfMinute; +- (NSInteger) yearOfCommonEra; // Providing Adjusted Dates -- (NSCalendarDate*) addYear: (int)year - month: (int)month - day: (int)day - hour: (int)hour - minute: (int)minute - second: (int)second; +- (NSCalendarDate*) addYear: (NSInteger)year + month: (NSInteger)month + day: (NSInteger)day + hour: (NSInteger)hour + minute: (NSInteger)minute + second: (NSInteger)second; // Getting String Descriptions of Dates - (NSString*) description; @@ -126,17 +126,17 @@ extern "C" { * last day of the year is a monday tuesday or wednesday, these days are * part of week 1 of the next year. */ -- (int) weekOfYear; +- (NSInteger) weekOfYear; @end @interface NSCalendarDate (GregorianDate) -- (int) lastDayOfGregorianMonth: (int)month year: (int)year; -- (int) absoluteGregorianDay: (int)day month: (int)month year: (int)year; -- (void) gregorianDateFromAbsolute: (int)d - day: (int*)day - month: (int*)month - year: (int*)year; +- (NSInteger) lastDayOfGregorianMonth: (NSInteger)month year: (NSInteger)year; +- (NSInteger) absoluteGregorianDay: (NSInteger)day month: (NSInteger)month year: (NSInteger)year; +- (void) gregorianDateFromAbsolute: (NSInteger)d + day: (NSInteger*)day + month: (NSInteger*)month + year: (NSInteger*)year; @end @@ -145,19 +145,19 @@ extern "C" { #if OS_API_VERSION(GS_API_OPENSTEP, GS_API_MACOSX) @interface NSCalendarDate (OPENSTEP) -- (NSCalendarDate*) dateByAddingYears: (int)years - months: (int)months - days: (int)days - hours: (int)hours - minutes: (int)minutes - seconds: (int)seconds; +- (NSCalendarDate*) dateByAddingYears: (NSInteger)years + months: (NSInteger)months + days: (NSInteger)days + hours: (NSInteger)hours + minutes: (NSInteger)minutes + seconds: (NSInteger)seconds; -- (void) years: (int*)years - months: (int*)months - days: (int*)days - hours: (int*)hours - minutes: (int*)minutes - seconds: (int*)seconds +- (void) years: (NSInteger*)years + months: (NSInteger*)months + days: (NSInteger*)days + hours: (NSInteger*)hours + minutes: (NSInteger*)minutes + seconds: (NSInteger*)seconds sinceDate: (NSDate*)date; @end #endif diff --git a/Headers/Foundation/NSCoder.h b/Headers/Foundation/NSCoder.h index 68ab08173..116058a1c 100644 --- a/Headers/Foundation/NSCoder.h +++ b/Headers/Foundation/NSCoder.h @@ -57,7 +57,7 @@ extern "C" { * well. */ - (void) encodeArrayOfObjCType: (const char*)type - count: (unsigned)count + count: (NSUInteger)count at: (const void*)array; /** @@ -72,7 +72,7 @@ extern "C" { /** * Stores bytes directly into archive. */ -- (void) encodeBytes: (void*)d length: (unsigned)l; +- (void) encodeBytes: (void*)d length: (NSUInteger)l; /** * Encode object if it is/will be encoded unconditionally by this coder, @@ -141,13 +141,13 @@ extern "C" { * well. Objects will be retained and you must release them. */ - (void) decodeArrayOfObjCType: (const char*)type - count: (unsigned)count + count: (NSUInteger)count at: (void*)address; /** * Retrieve bytes directly from archive. */ -- (void*) decodeBytesWithReturnedLength: (unsigned*)l; +- (void*) decodeBytesWithReturnedLength: (NSUInteger*)l; /** * Decode an instance of [NSData]. @@ -257,7 +257,7 @@ extern "C" { * -encodeBytes:length:forKey: */ - (const uint8_t*) decodeBytesForKey: (NSString*)aKey - returnedLength: (unsigned*)alength; + returnedLength: (NSUInteger*)alength; /** * Returns a double value associated with aKey. This value must previously @@ -313,7 +313,7 @@ extern "C" { * and associates the encoded value with aKey. */ - (void) encodeBytes: (const uint8_t*)aPointer - length: (unsigned)length + length: (NSUInteger)length forKey: (NSString*)aKey; /** @@ -333,17 +333,17 @@ extern "C" { - (void) encodeFloat: (float)aFloat forKey: (NSString*)aKey; /** - * Encodes anInteger and associates the encoded value with aKey. + * Encodes an int and associates the encoded value with aKey. */ - (void) encodeInt: (int)anInteger forKey: (NSString*)aKey; /** - * Encodes anInteger and associates the encoded value with aKey. + * Encodes 32 bit integer and associates the encoded value with aKey. */ - (void) encodeInt32: (int32_t)anInteger forKey: (NSString*)aKey; /** - * Encodes anInteger and associates the encoded value with aKey. + * Encodes a 64 bit integer and associates the encoded value with aKey. */ - (void) encodeInt64: (int64_t)anInteger forKey: (NSString*)aKey; @@ -355,12 +355,12 @@ extern "C" { #if OS_API_VERSION(100500, GS_API_LATEST) /** - * Encodes anInteger and associates the encoded value with key. + * Encodes an NSInteger and associates the encoded value with key. */ - (void) encodeInteger: (NSInteger)anInteger forKey: (NSString *)key; /** - * Decodes an integer associated with the key. + * Decodes an NSInteger associated with the key. */ - (NSInteger) decodeIntegerForKey: (NSString *)key; #endif diff --git a/Headers/Foundation/NSComparisonPredicate.h b/Headers/Foundation/NSComparisonPredicate.h index d452ed743..67102c420 100644 --- a/Headers/Foundation/NSComparisonPredicate.h +++ b/Headers/Foundation/NSComparisonPredicate.h @@ -73,7 +73,7 @@ typedef enum _NSPredicateOperatorType { NSComparisonPredicateModifier _modifier; SEL _selector; - unsigned _options; + NSUInteger _options; NSPredicateOperatorType _type; @public NSExpression *_left; @@ -87,7 +87,7 @@ typedef enum _NSPredicateOperatorType rightExpression: (NSExpression *)right modifier: (NSComparisonPredicateModifier)modifier type: (NSPredicateOperatorType)type - options: (unsigned) opts; + options: (NSUInteger) opts; - (NSComparisonPredicateModifier) comparisonPredicateModifier; - (SEL) customSelector; @@ -98,9 +98,9 @@ typedef enum _NSPredicateOperatorType rightExpression: (NSExpression *)right modifier: (NSComparisonPredicateModifier)modifier type: (NSPredicateOperatorType)type - options: (unsigned) opts; + options: (NSUInteger) opts; - (NSExpression *) leftExpression; -- (unsigned) options; +- (NSUInteger) options; - (NSPredicateOperatorType) predicateOperatorType; - (NSExpression *) rightExpression; diff --git a/Headers/Foundation/NSCompoundPredicate.h b/Headers/Foundation/NSCompoundPredicate.h index eb2cb6adc..a92e879e9 100644 --- a/Headers/Foundation/NSCompoundPredicate.h +++ b/Headers/Foundation/NSCompoundPredicate.h @@ -34,12 +34,13 @@ extern "C" { #endif -typedef enum _NSCompoundPredicateType +enum { NSNotPredicateType = 0, NSAndPredicateType, NSOrPredicateType -} NSCompoundPredicateType; +}; +typedef NSUInteger NSCompoundPredicateType; @interface NSCompoundPredicate : NSPredicate { diff --git a/Headers/Foundation/NSData.h b/Headers/Foundation/NSData.h index 386a0e5d3..e1bf611a1 100644 --- a/Headers/Foundation/NSData.h +++ b/Headers/Foundation/NSData.h @@ -56,12 +56,12 @@ enum { + (id) data; + (id) dataWithBytes: (const void*)bytes - length: (unsigned int)length; + length: (NSUInteger)length; + (id) dataWithBytesNoCopy: (void*)bytes - length: (unsigned int)length; + length: (NSUInteger)length; #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) + (id) dataWithBytesNoCopy: (void*)aBuffer - length: (unsigned int)bufferSize + length: (NSUInteger)bufferSize freeWhenDone: (BOOL)shouldFree; #endif + (id) dataWithContentsOfFile: (NSString*)path; @@ -71,12 +71,12 @@ enum { #endif + (id) dataWithData: (NSData*)data; - (id) initWithBytes: (const void*)aBuffer - length: (unsigned int)bufferSize; + length: (NSUInteger)bufferSize; - (id) initWithBytesNoCopy: (void*)aBuffer - length: (unsigned int)bufferSize; + length: (NSUInteger)bufferSize; #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) - (id) initWithBytesNoCopy: (void*)aBuffer - length: (unsigned int)bufferSize + length: (NSUInteger)bufferSize freeWhenDone: (BOOL)shouldFree; #endif - (id) initWithContentsOfFile: (NSString*)path; @@ -92,7 +92,7 @@ enum { - (NSString*) description; - (void) getBytes: (void*)buffer; - (void) getBytes: (void*)buffer - length: (unsigned int)length; + length: (NSUInteger)length; - (void) getBytes: (void*)buffer range: (NSRange)aRange; - (NSData*) subdataWithRange: (NSRange)aRange; @@ -100,7 +100,7 @@ enum { // Querying a Data Object - (BOOL) isEqualToData: (NSData*)other; -- (unsigned int) length; +- (NSUInteger) length; // Storing Data @@ -284,8 +284,8 @@ enum { #define _GSC_CID 0x17 /* Class encoded as id */ @interface NSData (GNUstepExtensions) -+ (id) dataWithShmID: (int)anID length: (unsigned int) length; -+ (id) dataWithSharedBytes: (const void*)bytes length: (unsigned int) length; ++ (id) dataWithShmID: (int)anID length: (NSUInteger) length; ++ (id) dataWithSharedBytes: (const void*)bytes length: (NSUInteger) length; /* * -deserializeTypeTag:andCrossRef:atCursor: @@ -300,21 +300,21 @@ enum { @interface NSMutableData : NSData -+ (id) dataWithCapacity: (unsigned int)numBytes; -+ (id) dataWithLength: (unsigned int)length; -- (id) initWithCapacity: (unsigned int)capacity; -- (id) initWithLength: (unsigned int)length; ++ (id) dataWithCapacity: (NSUInteger)numBytes; ++ (id) dataWithLength: (NSUInteger)length; +- (id) initWithCapacity: (NSUInteger)capacity; +- (id) initWithLength: (NSUInteger)length; // Adjusting Capacity -- (void) increaseLengthBy: (unsigned int)extraLength; -- (void) setLength: (unsigned int)size; +- (void) increaseLengthBy: (NSUInteger)extraLength; +- (void) setLength: (NSUInteger)size; - (void*) mutableBytes; // Appending Data - (void) appendBytes: (const void*)aBuffer - length: (unsigned int)bufferSize; + length: (NSUInteger)bufferSize; - (void) appendData: (NSData*)other; // Modifying Data @@ -324,7 +324,7 @@ enum { #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) - (void) replaceBytesInRange: (NSRange)aRange withBytes: (const void*)bytes - length: (unsigned int)length; + length: (NSUInteger)length; #endif - (void) resetBytesInRange: (NSRange)aRange; - (void) setData: (NSData*)data; @@ -353,8 +353,8 @@ enum { * Capacity management - GNUstep gives you control over the size of * the data buffer as well as the 'length' of valid data in it. */ -- (unsigned int) capacity; -- (id) setCapacity: (unsigned int)newCapacity; +- (NSUInteger) capacity; +- (id) setCapacity: (NSUInteger)newCapacity; - (int) shmID; /* Shared memory ID for data buffer (if any) */ diff --git a/Headers/Foundation/NSDebug.h b/Headers/Foundation/NSDebug.h index 2e2130b8e..ada62be0a 100644 --- a/Headers/Foundation/NSDebug.h +++ b/Headers/Foundation/NSDebug.h @@ -453,19 +453,19 @@ GS_EXPORT BOOL NSDeallocateZombies; * Retrieve stack information. Use caution: uses built-in gcc functions * and currently only works up to 100 frames. */ -GS_EXPORT void *NSFrameAddress(int offset); +GS_EXPORT void *NSFrameAddress(NSUInteger offset); /** * Retrieve stack information. Use caution: uses built-in gcc functions * and currently only works up to 100 frames. */ -GS_EXPORT void *NSReturnAddress(int offset); +GS_EXPORT void *NSReturnAddress(NSUInteger offset); /** * Retrieve stack information. Use caution: uses built-in gcc functions * and currently only works up to 100 frames. */ -GS_EXPORT unsigned NSCountFrames(void); +GS_EXPORT NSUInteger NSCountFrames(void); #if defined(__cplusplus) } diff --git a/Headers/Foundation/NSDecimal.h b/Headers/Foundation/NSDecimal.h index fccc7b769..b3fac8458 100644 --- a/Headers/Foundation/NSDecimal.h +++ b/Headers/Foundation/NSDecimal.h @@ -50,12 +50,13 @@ extern "C" { * .5 rounds to make last remaining digit even). See the * [(NSDecimalNumberBehaviors)] protocol. */ -typedef enum { +enum { NSRoundPlain, /* Round .5 up */ NSRoundDown, NSRoundUp, NSRoundBankers /* Make last digit even */ -} NSRoundingMode; +}; +typedef NSUInteger NSRoundingMode; /** * Enumerated type for specifying a decimal calculation error. Can be one of @@ -73,13 +74,14 @@ typedef enum { * The caller tried to divide by 0. * */ -typedef enum { +enum { NSCalculationNoError = 0, NSCalculationLossOfPrecision, NSCalculationUnderflow, /* result became zero */ NSCalculationOverflow, NSCalculationDivideByZero -} NSCalculationError; +}; +typedef NSUInteger NSCalculationError; /** * Give a precision of at least 38 decimal digits @@ -149,7 +151,8 @@ NSDecimalCompare(const NSDecimal *leftOperand, const NSDecimal *rightOperand); * but can be the same as number. */ GS_EXPORT void -NSDecimalRound(NSDecimal *result, const NSDecimal *number, int scale, NSRoundingMode mode); +NSDecimalRound(NSDecimal *result, const NSDecimal *number, NSInteger scale, + NSRoundingMode mode); /** * Sets the exponents of n1 and n2 equal to one another, adjusting mantissas @@ -201,7 +204,8 @@ NSDecimalDivide(NSDecimal *result, const NSDecimal *l, const NSDecimal *rr, NSRo * n or power. */ GS_EXPORT NSCalculationError -NSDecimalPower(NSDecimal *result, const NSDecimal *n, unsigned power, NSRoundingMode mode); +NSDecimalPower(NSDecimal *result, const NSDecimal *n, NSUInteger power, + NSRoundingMode mode); /** * Multiplies n by 10^power and returns result to 38-digit precision. See the diff --git a/Headers/Foundation/NSDecimalNumber.h b/Headers/Foundation/NSDecimalNumber.h index 5744829bb..9afe71f85 100644 --- a/Headers/Foundation/NSDecimalNumber.h +++ b/Headers/Foundation/NSDecimalNumber.h @@ -362,33 +362,35 @@ extern "C" { * behavior for rounding/precision/error handling. */ - (NSDecimalNumber *)decimalNumberByMultiplyingByPowerOf10:(short)power - withBehavior:(id )behavior; + withBehavior:(id )behavior; /** * Raises self to given positive integer power and returns new result, using * +defaultBehavior for rounding/precision/error handling. */ -- (NSDecimalNumber *)decimalNumberByRaisingToPower:(unsigned)power; +- (NSDecimalNumber *)decimalNumberByRaisingToPower:(NSUInteger)power; /** * Raises self to given positive integer power and returns new result, using * given behavior for rounding/precision/error handling. */ -- (NSDecimalNumber *)decimalNumberByRaisingToPower:(unsigned)power - withBehavior:(id )behavior; +- (NSDecimalNumber *)decimalNumberByRaisingToPower:(NSUInteger)power + withBehavior:(id )behavior; /** * Subtracts decimalNumber from self and returns new result, using * +defaultBehavior for rounding/precision/error handling. */ -- (NSDecimalNumber *)decimalNumberBySubtracting:(NSDecimalNumber *)decimalNumber; +- (NSDecimalNumber *)decimalNumberBySubtracting: + (NSDecimalNumber *)decimalNumber; /** * Subtracts decimalNumber from self and returns new result, using given * behavior for rounding/precision/error handling. */ -- (NSDecimalNumber *)decimalNumberBySubtracting:(NSDecimalNumber *)decimalNumber - withBehavior:(id )behavior; +- (NSDecimalNumber *)decimalNumberBySubtracting: + (NSDecimalNumber *)decimalNumber + withBehavior:(id )behavior; /** * Returns rounded version of underlying decimal. diff --git a/Headers/Foundation/NSDictionary.h b/Headers/Foundation/NSDictionary.h index 6f2b8bfd1..71347564c 100644 --- a/Headers/Foundation/NSDictionary.h +++ b/Headers/Foundation/NSDictionary.h @@ -45,18 +45,18 @@ extern "C" { + (id) dictionaryWithObjects: (NSArray*)objects forKeys: (NSArray*)keys; + (id) dictionaryWithObjects: (id*)objects forKeys: (id*)keys - count: (unsigned)count; + count: (NSUInteger)count; + (id) dictionaryWithObjectsAndKeys: (id)firstObject, ...; - (NSArray*) allKeys; - (NSArray*) allKeysForObject: (id)anObject; - (NSArray*) allValues; -- (unsigned) count; // Primitive +- (NSUInteger) count; // Primitive - (NSString*) description; - (NSString*) descriptionInStringsFileFormat; - (NSString*) descriptionWithLocale: (NSDictionary*)locale; - (NSString*) descriptionWithLocale: (NSDictionary*)locale - indent: (unsigned int)level; + indent: (NSUInteger)level; - (id) init; - (id) initWithContentsOfFile: (NSString*)path; @@ -69,7 +69,7 @@ extern "C" { - (id) initWithObjectsAndKeys: (id)firstObject, ...; - (id) initWithObjects: (id*)objects forKeys: (id*)keys - count: (unsigned)count; // Primitive + count: (NSUInteger)count; // Primitive - (BOOL) isEqualToDictionary: (NSDictionary*)other; - (NSEnumerator*) keyEnumerator; // Primitive @@ -87,10 +87,10 @@ extern "C" { @interface NSMutableDictionary: NSDictionary -+ (id) dictionaryWithCapacity: (unsigned)numItems; ++ (id) dictionaryWithCapacity: (NSUInteger)numItems; - (void) addEntriesFromDictionary: (NSDictionary*)otherDictionary; -- (id) initWithCapacity: (unsigned)numItems; // Primitive +- (id) initWithCapacity: (NSUInteger)numItems; // Primitive - (void) removeAllObjects; - (void) removeObjectForKey: (id)aKey; // Primitive - (void) removeObjectsForKeys: (NSArray*)keyArray; diff --git a/Headers/Foundation/NSDistributedNotificationCenter.h b/Headers/Foundation/NSDistributedNotificationCenter.h index 4c4c7a7ba..3fa1d8c5c 100644 --- a/Headers/Foundation/NSDistributedNotificationCenter.h +++ b/Headers/Foundation/NSDistributedNotificationCenter.h @@ -50,12 +50,13 @@ extern "C" { } */ -typedef enum { +enum { NSNotificationSuspensionBehaviorDrop = 1, NSNotificationSuspensionBehaviorCoalesce = 2, NSNotificationSuspensionBehaviorHold = 3, NSNotificationSuspensionBehaviorDeliverImmediately = 4 -} NSNotificationSuspensionBehavior; +}; +typedef NSUInteger NSNotificationSuspensionBehavior; /** * Type for [NSDistributedNotificationCenter+notificationCenterForType:] - diff --git a/Headers/Foundation/NSError.h b/Headers/Foundation/NSError.h index 5c31d9d22..b553133c5 100644 --- a/Headers/Foundation/NSError.h +++ b/Headers/Foundation/NSError.h @@ -126,14 +126,14 @@ GS_EXPORT NSString* const NSCocoaErrorDomain; * -initWithDomain:code:userInfo: */ + (id) errorWithDomain: (NSString*)aDomain - code: (int)aCode + code: (NSInteger)aCode userInfo: (NSDictionary*)aDictionary; /** * Return the error code ... which is not globally unique, just unique for * a particular domain. */ -- (int) code; +- (NSInteger) code; /** * Return the domain for this instance. @@ -145,7 +145,7 @@ GS_EXPORT NSString* const NSCocoaErrorDomain; * The domain must be non-nil. */ - (id) initWithDomain: (NSString*)aDomain - code: (int)aCode + code: (NSInteger)aCode userInfo: (NSDictionary*)aDictionary; /** diff --git a/Headers/Foundation/NSException.h b/Headers/Foundation/NSException.h index 66fd1e03c..1b9ee7f88 100644 --- a/Headers/Foundation/NSException.h +++ b/Headers/Foundation/NSException.h @@ -357,13 +357,13 @@ GS_EXPORT void _NSRemoveHandler( NSHandler *handler ); - (void) handleFailureInFunction: (NSString*)functionName file: (NSString*)fileName - lineNumber: (int)line + lineNumber: (NSInteger)line description: (NSString*)format,...; - (void) handleFailureInMethod: (SEL)aSelector object: object file: (NSString*)fileName - lineNumber: (int)line + lineNumber: (NSInteger)line description: (NSString*)format,...; @end diff --git a/Headers/Foundation/NSExpression.h b/Headers/Foundation/NSExpression.h index ff96a46a3..b0f3552c6 100644 --- a/Headers/Foundation/NSExpression.h +++ b/Headers/Foundation/NSExpression.h @@ -38,14 +38,15 @@ extern "C" { @class NSMutableDictionary; @class NSString; -typedef enum _NSExpressionType +enum { NSConstantValueExpressionType=0, NSEvaluatedObjectExpressionType, NSVariableExpressionType, NSKeyPathExpressionType, NSFunctionExpressionType -} NSExpressionType; +}; +typedef NSUInteger NSExpressionType; @interface NSExpression : NSObject { diff --git a/Headers/Foundation/NSFileManager.h b/Headers/Foundation/NSFileManager.h index ea5479a4f..362728e75 100644 --- a/Headers/Foundation/NSFileManager.h +++ b/Headers/Foundation/NSFileManager.h @@ -268,7 +268,7 @@ extern "C" { * with unicode strings. */ - (NSString*) stringWithFileSystemRepresentation: (const GSNativeChar*)string - length: (unsigned int)len; + length: (NSUInteger)len; - (NSArray*) subpathsAtPath: (NSString*)path; @@ -465,9 +465,9 @@ GS_EXPORT NSString* const NSFileSystemFreeNodes; - (unsigned long) fileGroupOwnerAccountID; - (NSString*) fileGroupOwnerAccountName; - (NSDate*) fileModificationDate; -- (unsigned long) filePosixPermissions; -- (unsigned long) fileSystemNumber; -- (unsigned long) fileSystemFileNumber; +- (NSUInteger) filePosixPermissions; +- (NSUInteger) fileSystemNumber; +- (NSUInteger) fileSystemFileNumber; @end #if defined(__cplusplus) diff --git a/Headers/Foundation/NSGeometry.h b/Headers/Foundation/NSGeometry.h index 835a8d3c3..5caa43c64 100644 --- a/Headers/Foundation/NSGeometry.h +++ b/Headers/Foundation/NSGeometry.h @@ -52,15 +52,15 @@ extern "C" { /** { - float x; - float y; + CGFloat x; + CGFloat y; }

Represents a 2-d cartesian position.

*/ typedef struct _NSPoint NSPoint; struct _NSPoint { - float x; - float y; + CGFloat x; + CGFloat y; }; #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) @@ -72,15 +72,15 @@ typedef NSPoint *NSPointPointer; /** { - float width; - float height; + CGFloat width; + CGFloat height; }

Floating point rectangle size.

*/ typedef struct _NSSize NSSize; struct _NSSize { - float width; - float height; + CGFloat width; + CGFloat height; }; #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) @@ -111,6 +111,13 @@ typedef NSRect *NSRectArray; typedef NSRect *NSRectPointer; #endif +enum +{ + NSMinXEdge = 0, + NSMinYEdge = 1, + NSMaxXEdge = 2, + NSMaxYEdge = 3 +}; /** Sides of a rectangle. { @@ -121,13 +128,7 @@ typedef NSRect *NSRectPointer; } */ -typedef enum _NSRectEdge -{ - NSMinXEdge = 0, - NSMinYEdge = 1, - NSMaxXEdge = 2, - NSMaxYEdge = 3 -} NSRectEdge; +typedef NSUInteger NSRectEdge; /** Point at 0,0 */ static const NSPoint NSZeroPoint __attribute__((unused)) = {0.0,0.0}; @@ -156,11 +157,11 @@ static const NSSize NSZeroSize __attribute__((unused)) = {0.0,0.0}; /** Create Basic Structures... **/ GS_GEOM_SCOPE NSPoint -NSMakePoint(float x, float y) GS_GEOM_ATTR; +NSMakePoint(CGFloat x, CGFloat y) GS_GEOM_ATTR; /** Returns an NSPoint having x-coordinate X and y-coordinate Y. */ GS_GEOM_SCOPE NSPoint -NSMakePoint(float x, float y) +NSMakePoint(CGFloat x, CGFloat y) { NSPoint point; @@ -170,11 +171,11 @@ NSMakePoint(float x, float y) } GS_GEOM_SCOPE NSSize -NSMakeSize(float w, float h) GS_GEOM_ATTR; +NSMakeSize(CGFloat w, CGFloat h) GS_GEOM_ATTR; /** Returns an NSSize having width w and height h. */ GS_GEOM_SCOPE NSSize -NSMakeSize(float w, float h) +NSMakeSize(CGFloat w, CGFloat h) { NSSize size; @@ -184,11 +185,11 @@ NSMakeSize(float w, float h) } GS_GEOM_SCOPE NSRect -NSMakeRect(float x, float y, float w, float h) GS_GEOM_ATTR; +NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h) GS_GEOM_ATTR; /** Returns an NSRect having point of origin (x, y) and size {w, h}. */ GS_GEOM_SCOPE NSRect -NSMakeRect(float x, float y, float w, float h) +NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h) { NSRect rect; @@ -201,81 +202,81 @@ NSMakeRect(float x, float y, float w, float h) /** Get a Rectangle's Coordinates... **/ -GS_GEOM_SCOPE float +GS_GEOM_SCOPE CGFloat NSMaxX(NSRect aRect) GS_GEOM_ATTR; /** Returns the greatest x-coordinate value still inside aRect. */ -GS_GEOM_SCOPE float +GS_GEOM_SCOPE CGFloat NSMaxX(NSRect aRect) { return aRect.origin.x + aRect.size.width; } -GS_GEOM_SCOPE float +GS_GEOM_SCOPE CGFloat NSMaxY(NSRect aRect) GS_GEOM_ATTR; /** Returns the greatest y-coordinate value still inside aRect. */ -GS_GEOM_SCOPE float +GS_GEOM_SCOPE CGFloat NSMaxY(NSRect aRect) { return aRect.origin.y + aRect.size.height; } -GS_GEOM_SCOPE float +GS_GEOM_SCOPE CGFloat NSMidX(NSRect aRect) GS_GEOM_ATTR; /** Returns the x-coordinate of aRect's middle point. */ -GS_GEOM_SCOPE float +GS_GEOM_SCOPE CGFloat NSMidX(NSRect aRect) { return aRect.origin.x + (aRect.size.width / 2.0); } -GS_GEOM_SCOPE float +GS_GEOM_SCOPE CGFloat NSMidY(NSRect aRect) GS_GEOM_ATTR; /** Returns the y-coordinate of aRect's middle point. */ -GS_GEOM_SCOPE float +GS_GEOM_SCOPE CGFloat NSMidY(NSRect aRect) { return aRect.origin.y + (aRect.size.height / 2.0); } -GS_GEOM_SCOPE float +GS_GEOM_SCOPE CGFloat NSMinX(NSRect aRect) GS_GEOM_ATTR; /** Returns the least x-coordinate value still inside aRect. */ -GS_GEOM_SCOPE float +GS_GEOM_SCOPE CGFloat NSMinX(NSRect aRect) { return aRect.origin.x; } -GS_GEOM_SCOPE float +GS_GEOM_SCOPE CGFloat NSMinY(NSRect aRect) GS_GEOM_ATTR; /** Returns the least y-coordinate value still inside aRect. */ -GS_GEOM_SCOPE float +GS_GEOM_SCOPE CGFloat NSMinY(NSRect aRect) { return aRect.origin.y; } -GS_GEOM_SCOPE float +GS_GEOM_SCOPE CGFloat NSWidth(NSRect aRect) GS_GEOM_ATTR; /** Returns aRect's width. */ -GS_GEOM_SCOPE float +GS_GEOM_SCOPE CGFloat NSWidth(NSRect aRect) { return aRect.size.width; } -GS_GEOM_SCOPE float +GS_GEOM_SCOPE CGFloat NSHeight(NSRect aRect) GS_GEOM_ATTR; /** Returns aRect's height. */ -GS_GEOM_SCOPE float +GS_GEOM_SCOPE CGFloat NSHeight(NSRect aRect) { return aRect.size.height; @@ -295,12 +296,12 @@ NSIsEmptyRect(NSRect aRect) /** Modify a Copy of a Rectangle... **/ GS_GEOM_SCOPE NSRect -NSOffsetRect(NSRect aRect, float dx, float dy) GS_GEOM_ATTR; +NSOffsetRect(NSRect aRect, CGFloat dx, CGFloat dy) GS_GEOM_ATTR; /** Returns the rectangle obtained by translating aRect * horizontally by dx and vertically by dy. */ GS_GEOM_SCOPE NSRect -NSOffsetRect(NSRect aRect, float dx, float dy) +NSOffsetRect(NSRect aRect, CGFloat dx, CGFloat dy) { NSRect rect = aRect; @@ -310,7 +311,7 @@ NSOffsetRect(NSRect aRect, float dx, float dy) } GS_GEOM_SCOPE NSRect -NSInsetRect(NSRect aRect, float dX, float dY) GS_GEOM_ATTR; +NSInsetRect(NSRect aRect, CGFloat dX, CGFloat dY) GS_GEOM_ATTR; /** Returns the rectangle obtained by moving each of aRect's * horizontal sides inward by dy and each of aRect's vertical @@ -319,7 +320,7 @@ NSInsetRect(NSRect aRect, float dX, float dY) GS_GEOM_ATTR; * a rectanglew with nagative width or height, strange as that seems. */ GS_GEOM_SCOPE NSRect -NSInsetRect(NSRect aRect, float dX, float dY) +NSInsetRect(NSRect aRect, CGFloat dX, CGFloat dY) { NSRect rect; @@ -337,7 +338,7 @@ GS_EXPORT void NSDivideRect(NSRect aRect, NSRect *slice, NSRect *remainder, - float amount, + CGFloat amount, NSRectEdge edge); /** Returns a rectangle obtained by expanding aRect minimally diff --git a/Headers/Foundation/NSHTTPCookie.h b/Headers/Foundation/NSHTTPCookie.h index 870c9fed0..9d792ce49 100644 --- a/Headers/Foundation/NSHTTPCookie.h +++ b/Headers/Foundation/NSHTTPCookie.h @@ -243,7 +243,7 @@ extern NSString * const NSHTTPCookieVersion; /** Obtain cookie version */ * Returns 0 for an unversioned Netscape style cookie or a * positive integer for a versioned cookie. */ -- (unsigned) version; +- (NSUInteger) version; @end diff --git a/Headers/Foundation/NSHTTPCookieStorage.h b/Headers/Foundation/NSHTTPCookieStorage.h index 441349b0e..eac4c5026 100644 --- a/Headers/Foundation/NSHTTPCookieStorage.h +++ b/Headers/Foundation/NSHTTPCookieStorage.h @@ -38,17 +38,18 @@ extern "C" { @class NSHTTPCookie; @class NSURL; +enum { + NSHTTPCookieAcceptPolicyAlways, + NSHTTPCookieAcceptPolicyNever, + NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain +}; /** * NSHTTPCookieAcceptPolicyAlways Accept all cookies * NSHTTPCookieAcceptPolicyNever Reject all cookies * NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain Accept cookies * only from the main document domain */ -typedef enum { - NSHTTPCookieAcceptPolicyAlways, - NSHTTPCookieAcceptPolicyNever, - NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain -} NSHTTPCookieAcceptPolicy; +typedef NSUInteger NSHTTPCookieAcceptPolicy; /** * Posted to the distributed notification center when the cookie diff --git a/Headers/Foundation/NSIndexPath.h b/Headers/Foundation/NSIndexPath.h index b2891ae74..70875a195 100644 --- a/Headers/Foundation/NSIndexPath.h +++ b/Headers/Foundation/NSIndexPath.h @@ -44,20 +44,20 @@ extern "C" { */ @interface NSIndexPath : NSObject { - unsigned _hash; - unsigned _length; - unsigned *_indexes; + NSUInteger _hash; + NSUInteger _length; + NSUInteger *_indexes; } /** * Return a path containing the single value anIndex. */ -+ (id) indexPathWithIndex: (unsigned)anIndex; ++ (id) indexPathWithIndex: (NSUInteger)anIndex; /** * Return a path containing all the indexes in the supplied array. */ -+ (id) indexPathWithIndexes: (unsigned*)indexes length: (unsigned)length; ++ (id) indexPathWithIndexes: (NSUInteger*)indexes length: (NSUInteger)length; /** * Compares other with the receiver.
@@ -71,18 +71,18 @@ extern "C" { /** * Copies all index values from the receiver into aBuffer. */ -- (void) getIndexes: (unsigned*)aBuffer; +- (void) getIndexes: (NSUInteger*)aBuffer; /** * Return the index at the specified position or NSNotFound if there * is no index at the specified position. */ -- (unsigned) indexAtPosition: (unsigned)position; +- (NSUInteger) indexAtPosition: (NSUInteger)position; /** * Return path formed by adding anIndex to the receiver. */ -- (NSIndexPath *) indexPathByAddingIndex: (unsigned)anIndex; +- (NSIndexPath *) indexPathByAddingIndex: (NSUInteger)anIndex; /** * Return path formed by removing the last index from the receiver. @@ -93,18 +93,18 @@ extern "C" { * Returns the shared instance containing the specified index, creating it * and destroying the receiver if necessary. */ -- (id) initWithIndex: (unsigned)anIndex; +- (id) initWithIndex: (NSUInteger)anIndex; /** * Returns the shared instance containing the specified index array, * creating it and destroying the receiver if necessary. */ -- (id) initWithIndexes: (unsigned*)indexes length: (unsigned)length; +- (id) initWithIndexes: (NSUInteger*)indexes length: (NSUInteger)length; /** * Returns the number of index values present in the receiver. */ -- (unsigned) length; +- (NSUInteger) length; @end diff --git a/Headers/Foundation/NSIndexSet.h b/Headers/Foundation/NSIndexSet.h index 4fc0eca24..c104e84cd 100644 --- a/Headers/Foundation/NSIndexSet.h +++ b/Headers/Foundation/NSIndexSet.h @@ -57,7 +57,7 @@ extern "C" { * Return a set containing the single value anIndex, or returns nil if * anIndex is NSNotFound. */ -+ (id) indexSetWithIndex: (unsigned int)anIndex; ++ (id) indexSetWithIndex: (NSUInteger)anIndex; /** * Return a set containing all the values in aRange, or returns nil if @@ -68,7 +68,7 @@ extern "C" { /** * Returns YES if the receiver contains anIndex, NO otherwise. */ -- (BOOL) containsIndex: (unsigned int)anIndex; +- (BOOL) containsIndex: (NSUInteger)anIndex; /** * Returns YES if the receiver contains all the index values present @@ -85,7 +85,7 @@ extern "C" { /** * Returns the number of index values present in the receiver. */ -- (unsigned int) count; +- (NSUInteger) count; #if OS_API_VERSION(100500,GS_API_LATEST) /** Not implemented @@ -98,7 +98,7 @@ extern "C" { * Returns the first index value in the receiver or NSNotFound if the * receiver is empty. */ -- (unsigned int) firstIndex; +- (NSUInteger) firstIndex; /** * Copies index values into aBuffer until there are no index values left or @@ -109,39 +109,39 @@ extern "C" { * If aRange is a null pointer, this method attempts to get all * index values from the set (and of course no range can be returned in it). */ -- (unsigned int) getIndexes: (unsigned int*)aBuffer - maxCount: (unsigned int)aCount - inIndexRange: (NSRangePointer)aRange; +- (NSUInteger) getIndexes: (NSUInteger*)aBuffer + maxCount: (NSUInteger)aCount + inIndexRange: (NSRangePointer)aRange; /** * Return the first index value in the receiver which is greater than * anIndex. */ -- (unsigned int) indexGreaterThanIndex: (unsigned int)anIndex; +- (NSUInteger) indexGreaterThanIndex: (NSUInteger)anIndex; /** * Return the first index value in the receiver which is greater than * or equal to anIndex. */ -- (unsigned int) indexGreaterThanOrEqualToIndex: (unsigned int)anIndex; +- (NSUInteger) indexGreaterThanOrEqualToIndex: (NSUInteger)anIndex; /** * Return the first index value in the receiver which is less than * anIndex. */ -- (unsigned int) indexLessThanIndex: (unsigned int)anIndex; +- (NSUInteger) indexLessThanIndex: (NSUInteger)anIndex; /** * Return the first index value in the receiver which is less than * or equal to anIndex. */ -- (unsigned int) indexLessThanOrEqualToIndex: (unsigned int)anIndex; +- (NSUInteger) indexLessThanOrEqualToIndex: (NSUInteger)anIndex; /** * Initialise the receiver to contain anIndex. Returns the initialised * object or nil if anIndex is NSNotFound. */ -- (id) initWithIndex: (unsigned int)anIndex; +- (id) initWithIndex: (NSUInteger)anIndex; /** * Initialise the receiver to contain all index values in aRange. @@ -169,7 +169,7 @@ extern "C" { * Returns the last index value in the receiver or NSNotFound if the * receiver is empty. */ -- (unsigned int) lastIndex; +- (NSUInteger) lastIndex; @end @@ -178,7 +178,7 @@ extern "C" { /** * Adds anIndex to the set of indexes stored in the receiver. */ -- (void) addIndex: (unsigned int)anIndex; +- (void) addIndex: (NSUInteger)anIndex; /** * Adds all the indexes from aSet to the set of indexes stored in the receiver. @@ -198,7 +198,7 @@ extern "C" { /** * Removes anIndex from the set of indexes stored in the receiver. */ -- (void) removeIndex: (unsigned int)anIndex; +- (void) removeIndex: (NSUInteger)anIndex; /** * Removes all the indexes in aSet from the set of indexes @@ -219,7 +219,8 @@ extern "C" { * If amount is positive, a 'hole' will be left in the index range after * anIndex. */ -- (void) shiftIndexesStartingAtIndex: (unsigned int)anIndex by: (int)amount; +- (void) shiftIndexesStartingAtIndex: (NSUInteger)anIndex + by: (NSInteger)amount; @end diff --git a/Headers/Foundation/NSInvocation.h b/Headers/Foundation/NSInvocation.h index 7393574a6..ba2c253d4 100644 --- a/Headers/Foundation/NSInvocation.h +++ b/Headers/Foundation/NSInvocation.h @@ -61,11 +61,11 @@ extern "C" { * Accessing message elements. */ - (void) getArgument: (void*)buffer - atIndex: (int)index; + atIndex: (NSInteger)index; - (void) getReturnValue: (void*)buffer; - (SEL) selector; - (void) setArgument: (void*)buffer - atIndex: (int)index; + atIndex: (NSInteger)index; - (void) setReturnValue: (void*)buffer; - (void) setSelector: (SEL)aSelector; - (void) setTarget: (id)anObject; diff --git a/Headers/Foundation/NSKeyValueObserving.h b/Headers/Foundation/NSKeyValueObserving.h index 97c9e6b06..4f216145b 100644 --- a/Headers/Foundation/NSKeyValueObserving.h +++ b/Headers/Foundation/NSKeyValueObserving.h @@ -39,28 +39,31 @@ extern "C" { @class NSSet; @class NSString; -typedef enum { +enum { NSKeyValueObservingOptionNew = 1, NSKeyValueObservingOptionOld = 2 #if OS_API_VERSION(100500,GS_API_LATEST) , NSKeyValueObservingOptionInitial = 4, NSKeyValueObservingOptionPrior = 8 #endif -} NSKeyValueObservingOptions; +}; +typedef NSUInteger NSKeyValueObservingOptions; -typedef enum { +enum { NSKeyValueChangeSetting = 1, NSKeyValueChangeInsertion = 2, NSKeyValueChangeRemoval = 3, NSKeyValueChangeReplacement = 4 -} NSKeyValueChange; +}; +typedef NSUInteger NSKeyValueChange; -typedef enum { +enum { NSKeyValueUnionSetMutation = 1, NSKeyValueMinusSetMutation = 2, NSKeyValueIntersectSetMutation = 3, NSKeyValueSetSetMutation = 4 -} NSKeyValueSetMutationKind; +}; +typedef NSUInteger NSKeyValueSetMutationKind; GS_EXPORT NSString *const NSKeyValueChangeIndexesKey; GS_EXPORT NSString *const NSKeyValueChangeKindKey; diff --git a/Headers/Foundation/NSKeyedArchiver.h b/Headers/Foundation/NSKeyedArchiver.h index 8c4df5559..447259901 100644 --- a/Headers/Foundation/NSKeyedArchiver.h +++ b/Headers/Foundation/NSKeyedArchiver.h @@ -121,7 +121,7 @@ extern "C" { * and associates the encoded value with aKey. */ - (void) encodeBytes: (const uint8_t*)aPointer - length: (unsigned)length + length: (NSUInteger)length forKey: (NSString*)aKey; /** @@ -298,7 +298,7 @@ extern "C" { * -encodeBytes:length:forKey: */ - (const uint8_t*) decodeBytesForKey: (NSString*)aKey - returnedLength: (unsigned*)length; + returnedLength: (NSUInteger*)length; /** * Returns a double value associated with aKey. This value must previously diff --git a/Headers/Foundation/NSLock.h b/Headers/Foundation/NSLock.h index fe5da4bbc..de7335f01 100644 --- a/Headers/Foundation/NSLock.h +++ b/Headers/Foundation/NSLock.h @@ -115,12 +115,12 @@ extern "C" { /** * Initialize lock with given condition. */ -- (id) initWithCondition: (int)value; +- (id) initWithCondition: (NSInteger)value; /** * Return the current condition of the lock. */ -- (int) condition; +- (NSInteger) condition; /* * Acquiring and releasing the lock. @@ -130,12 +130,12 @@ extern "C" { * Acquire lock when it is available and the internal condition is equal to * value. Blocks until this occurs. */ -- (void) lockWhenCondition: (int)value; +- (void) lockWhenCondition: (NSInteger)value; /** * Relinquish the lock, setting internal condition to value. */ -- (void) unlockWithCondition: (int)value; +- (void) unlockWithCondition: (NSInteger)value; /** * Try to acquire lock regardless of condition and return immediately, YES if @@ -147,7 +147,7 @@ extern "C" { * Try to acquire lock if condition is equal to value and return immediately * in any case, YES if succeeded, NO if not. */ -- (BOOL) tryLockWhenCondition: (int)value; +- (BOOL) tryLockWhenCondition: (NSInteger)value; /* * Acquiring the lock with a date condition. @@ -162,7 +162,7 @@ extern "C" { * Try to acquire lock, when internal condition is equal to condition_to_meet, * and return before limit, YES if succeeded, NO if not. */ -- (BOOL) lockWhenCondition: (int)condition_to_meet +- (BOOL) lockWhenCondition: (NSInteger)condition_to_meet beforeDate: (NSDate*)limitDate; /** diff --git a/Headers/Foundation/NSMethodSignature.h b/Headers/Foundation/NSMethodSignature.h index 40066e8a8..acf9ac3f3 100644 --- a/Headers/Foundation/NSMethodSignature.h +++ b/Headers/Foundation/NSMethodSignature.h @@ -88,8 +88,8 @@ typedef struct { @interface NSMethodSignature : NSObject { const char *_methodTypes; - unsigned _argFrameLength; - unsigned _numArgs; + NSUInteger _argFrameLength; + NSUInteger _numArgs; #if OS_API_VERSION(GS_API_NONE, GS_API_MACOSX) NSArgumentInfo *_info; #else @@ -108,14 +108,14 @@ typedef struct { * Returns full information on given argument. Indices start at 0. Provide * -1 to get info on return value. */ -- (NSArgumentInfo) argumentInfoAtIndex: (unsigned)index; +- (NSArgumentInfo) argumentInfoAtIndex: (NSUInteger)index; #endif /** * Number of bytes that the full set of arguments occupies on the stack, which * is platform(hardware)-dependent. */ -- (unsigned) frameLength; +- (NSUInteger) frameLength; /** * Returns Objective-C @encode(...) compatible string. Arguments @@ -123,7 +123,7 @@ typedef struct { * self (type id, at position 0) and * _cmd (type SEL, at position 1). */ -- (const char*) getArgumentTypeAtIndex: (unsigned)index; +- (const char*) getArgumentTypeAtIndex: (NSUInteger)index; /** * Pertains to distributed objects; method is asynchronous when invoked and @@ -135,7 +135,7 @@ typedef struct { * Number of bytes that the return value occupies on the stack, which is * platform(hardware)-dependent. */ -- (unsigned) methodReturnLength; +- (NSUInteger) methodReturnLength; /** * Returns Objective-C @encode(...) compatible string. Arguments @@ -149,7 +149,7 @@ typedef struct { * Returns number of arguments to method, including the implicit * self and _cmd. */ -- (unsigned) numberOfArguments; +- (NSUInteger) numberOfArguments; @end diff --git a/Headers/Foundation/NSNetServices.h b/Headers/Foundation/NSNetServices.h index 5cf81e60d..b4f96f792 100644 --- a/Headers/Foundation/NSNetServices.h +++ b/Headers/Foundation/NSNetServices.h @@ -33,8 +33,17 @@ extern "C" { #endif -typedef enum +enum { + NSNetServicesUnknownError = -72000L, + NSNetServicesCollisionError = -72001L, + NSNetServicesNotFoundError = -72002L, + NSNetServicesActivityInProgress = -72003L, + NSNetServicesBadArgumentError = -72004L, + NSNetServicesCancelledError = -72005L, + NSNetServicesInvalidError = -72006L, + NSNetServicesTimeoutError = -72007L +}; /** * * @@ -80,15 +89,7 @@ typedef enum * * */ - NSNetServicesUnknownError = -72000L, - NSNetServicesCollisionError = -72001L, - NSNetServicesNotFoundError = -72002L, - NSNetServicesActivityInProgress = -72003L, - NSNetServicesBadArgumentError = -72004L, - NSNetServicesCancelledError = -72005L, - NSNetServicesInvalidError = -72006L, - NSNetServicesTimeoutError = -72007L -} NSNetServicesError; +typedef NSUInteger NSNetServicesError; enum { NSNetServiceNoAutoRename = 1 << 0 @@ -140,7 +141,7 @@ GS_EXPORT NSString * const NSNetServicesErrorDomain; - (id) initWithDomain: (NSString *) domain type: (NSString *) type name: (NSString *) name - port: (int) port; + port: (NSInteger) port; - (void) removeFromRunLoop: (NSRunLoop *) aRunLoop forMode: (NSString *) mode; diff --git a/Headers/Foundation/NSNotificationQueue.h b/Headers/Foundation/NSNotificationQueue.h index a20efd7ec..58a6bf205 100644 --- a/Headers/Foundation/NSNotificationQueue.h +++ b/Headers/Foundation/NSNotificationQueue.h @@ -73,11 +73,12 @@ extern "C" { } */ -typedef enum { +enum { NSPostWhenIdle = 1, NSPostASAP = 2, NSPostNow = 3 -} NSPostingStyle; +}; +typedef NSUInteger NSPostingStyle; /** * Enumeration of possible ways to combine notifications when dealing with @@ -90,11 +91,12 @@ typedef enum { } */ -typedef enum { +enum { NSNotificationNoCoalescing = 0, NSNotificationCoalescingOnName = 1, NSNotificationCoalescingOnSender = 2, -} NSNotificationCoalescing; +}; +typedef NSUInteger NSNotificationCoalescing; /* * NSNotificationQueue class @@ -121,14 +123,14 @@ struct _NSNotificationQueueList; /* Inserting and Removing Notifications From a Queue */ - (void) dequeueNotificationsMatching: (NSNotification*)notification - coalesceMask: (unsigned int)coalesceMask; + coalesceMask: (NSUInteger)coalesceMask; - (void) enqueueNotification: (NSNotification*)notification postingStyle: (NSPostingStyle)postingStyle; - (void) enqueueNotification: (NSNotification*)notification postingStyle: (NSPostingStyle)postingStyle - coalesceMask: (unsigned int)coalesceMask + coalesceMask: (NSUInteger)coalesceMask forModes: (NSArray*)modes; @end diff --git a/Headers/Foundation/NSObjCRuntime.h b/Headers/Foundation/NSObjCRuntime.h index d0739d438..e9223a32c 100644 --- a/Headers/Foundation/NSObjCRuntime.h +++ b/Headers/Foundation/NSObjCRuntime.h @@ -34,14 +34,31 @@ /* These typedefs must be in place before GSObjCRuntime.h is imported. */ + + +#define GS_64BIT_OLD 1 // Temporarily disable new OSX 10.5 64bit API + + +#if defined(GS_64BIT_OLD) + +typedef int NSInteger; +typedef unsigned int NSUInteger; +typedef float CGFloat; + +#else /* GS_64BIT_OLD */ + typedef intptr_t NSInteger; typedef uintptr_t NSUInteger; -#if GS_SIZEOF_VOIDP == 8 -typedef double CGFloat; +#if GS_SIZEOF_VOIDP == 8 +#define CGFLOAT_IS_DBL 1 +typedef double CGFloat; #else -typedef float CGFloat; +typedef float CGFloat; #endif +#endif /* GS_64BIT_OLD */ + + #define NSINTEGER_DEFINED 1 #import diff --git a/Headers/Foundation/NSObject.h b/Headers/Foundation/NSObject.h index 6b884ff38..a3639fa3b 100644 --- a/Headers/Foundation/NSObject.h +++ b/Headers/Foundation/NSObject.h @@ -68,7 +68,7 @@ extern "C" { - (BOOL) isKindOfClass: (Class)aClass; /** See [NSObject-isKindOfClass:] */ - (BOOL) isMemberOfClass: (Class)aClass;/** See [NSObject-isMemberOfClass:] */ - (BOOL) isProxy; /** See [NSObject-isProxy] */ -- (unsigned) hash; /** See [NSObject-hash] */ +- (NSUInteger) hash; /** See [NSObject-hash] */ - (id) self; /** See [NSObject-self] */ - (id) performSelector: (SEL)aSelector; /** See [NSObject-performSelector:] */ /** See [NSObject-performSelector:withObject:] */ @@ -85,7 +85,7 @@ extern "C" { - (id) retain; /** See [NSObject-retain] */ - (id) autorelease /** See [NSObject-autorelease] */; - (oneway void) release; /** See [NSObject-release] */ -- (unsigned) retainCount; /** See [NSObject-retainCount] */ +- (NSUInteger) retainCount; /** See [NSObject-retainCount] */ - (NSZone*) zone; /** See [NSObject-zone] */ - (NSString*) description; /** See [NSObject-description] */ @end @@ -195,9 +195,9 @@ extern "C" { + (BOOL) isSubclassOfClass: (Class)aClass; + (id) new; + (void) poseAsClass: (Class)aClassObject; -+ (id) setVersion: (int)aVersion; ++ (id) setVersion: (NSInteger)aVersion; + (Class) superclass; -+ (int) version; ++ (NSInteger) version; - (id) autorelease; - (id) awakeAfterUsingCoder: (NSCoder*)aDecoder; @@ -210,7 +210,7 @@ extern "C" { - (NSString*) description; - (void) doesNotRecognizeSelector: (SEL)aSelector; - (void) forwardInvocation: (NSInvocation*)anInvocation; -- (unsigned) hash; +- (NSUInteger) hash; - (id) init; - (BOOL) isEqual: anObject; - (BOOL) isKindOfClass: (Class)aClass; @@ -230,7 +230,7 @@ extern "C" { - (id) replacementObjectForCoder: (NSCoder*)anEncoder; - (BOOL) respondsToSelector: (SEL)aSelector; - (id) retain; -- (unsigned) retainCount; +- (NSUInteger) retainCount; - (id) self; - (Class) superclass; - (NSZone*) zone; @@ -244,7 +244,7 @@ extern "C" { * This function is used by the [NSObject+allocWithZone:] method. */ GS_EXPORT NSObject * -NSAllocateObject(Class aClass, unsigned extraBytes, NSZone *zone); +NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone); /** * Used to release the memory used by an object.
@@ -262,7 +262,7 @@ NSDeallocateObject(NSObject *anObject); * [(NSCopying)-copyWithZone:] method. */ GS_EXPORT NSObject * -NSCopyObject(NSObject *anObject, unsigned extraBytes, NSZone *zone); +NSCopyObject(NSObject *anObject, NSUInteger extraBytes, NSZone *zone); /** * Returns a flag to indicate whether anObject should be retained or @@ -276,7 +276,7 @@ NSShouldRetainWithZone(NSObject *anObject, NSZone *requestedZone); GS_EXPORT BOOL NSDecrementExtraRefCountWasZero(id anObject); -GS_EXPORT unsigned +GS_EXPORT NSUInteger NSExtraRefCount(id anObject); GS_EXPORT void diff --git a/Headers/Foundation/NSPathUtilities.h b/Headers/Foundation/NSPathUtilities.h index 5f8092942..d82b492d7 100644 --- a/Headers/Foundation/NSPathUtilities.h +++ b/Headers/Foundation/NSPathUtilities.h @@ -107,40 +107,7 @@ GS_EXPORT NSString *NSHomeDirectory(void); GS_EXPORT NSString *NSHomeDirectoryForUser(NSString *loginName); #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) -/** - * Enumeration of possible requested directory type specifiers for - * NSSearchPathForDirectoriesInDomains() function. On a traditional - * GNUstep filesystem layout these correspond to the subdirectories - * that may be found in the various domains, such as "Library" - * and "Applications". In a different filesystem layout these - * directories might be located anywhere on disk. - -{ - NSApplicationDirectory, - NSDemoApplicationDirectory, - NSDeveloperApplicationDirectory, - NSAdminApplicationDirectory, - NSLibraryDirectory, - NSDeveloperDirectory, - NSUserDirectory, - NSDocumentationDirectory, - NSDocumentDirectory, - NSCoreServiceDirectory, - NSDesktopDirectory, - NSCachesDirectory, - NSApplicationSupportDirectory - NSAllApplicationsDirectory, - NSAllLibrariesDirectory, - GSLibrariesDirectory, - GSToolsDirectory, - GSAdminToolsDirectory, - GSFontsDirectory, - GSFrameworksDirectory, - GSWebApplicationsDirectory -} - - */ -typedef enum +enum { NSApplicationDirectory = 1, /** Applications */ NSDemoApplicationDirectory, /** Demos */ @@ -178,21 +145,56 @@ typedef enum GSFrameworksDirectory, /** frameworks */ GSWebApplicationsDirectory, /** web applications (GSWeb or SOPE) */ GSAdminToolsDirectory /** admin non-gui programs */ - } NSSearchPathDirectory; - +}; /** - * Mask type for NSSearchPathForDirectoriesInDomains() function. A bitwise OR - * of one or more of NSUserDomainMask, NSLocalDomainMask, - * NSNetworkDomainMask, NSSystemDomainMask, NSAllDomainsMask. + * Enumeration of possible requested directory type specifiers for + * NSSearchPathForDirectoriesInDomains() function. On a traditional + * GNUstep filesystem layout these correspond to the subdirectories + * that may be found in the various domains, such as "Library" + * and "Applications". In a different filesystem layout these + * directories might be located anywhere on disk. + +{ + NSApplicationDirectory, + NSDemoApplicationDirectory, + NSDeveloperApplicationDirectory, + NSAdminApplicationDirectory, + NSLibraryDirectory, + NSDeveloperDirectory, + NSUserDirectory, + NSDocumentationDirectory, + NSDocumentDirectory, + NSCoreServiceDirectory, + NSDesktopDirectory, + NSCachesDirectory, + NSApplicationSupportDirectory + NSAllApplicationsDirectory, + NSAllLibrariesDirectory, + GSLibrariesDirectory, + GSToolsDirectory, + GSAdminToolsDirectory, + GSFontsDirectory, + GSFrameworksDirectory, + GSWebApplicationsDirectory +} + */ -typedef enum +typedef NSUInteger NSSearchPathDirectory; + +enum { NSUserDomainMask = 1, /** The user's personal items */ NSLocalDomainMask = 2, /** Local for all users on the machine */ NSNetworkDomainMask = 4, /** Public for all users on network */ NSSystemDomainMask = 8, /** Standard GNUstep items */ NSAllDomainsMask = 0x0ffff, /** all domains */ -} NSSearchPathDomainMask; +}; +/** + * Mask type for NSSearchPathForDirectoriesInDomains() function. A bitwise OR + * of one or more of NSUserDomainMask, NSLocalDomainMask, + * NSNetworkDomainMask, NSSystemDomainMask, NSAllDomainsMask. + */ +typedef NSUInteger NSSearchPathDomainMask; /** * Returns an array of search paths to look at for resources.
diff --git a/Headers/Foundation/NSPort.h b/Headers/Foundation/NSPort.h index 5f6362589..467611042 100644 --- a/Headers/Foundation/NSPort.h +++ b/Headers/Foundation/NSPort.h @@ -91,7 +91,7 @@ extern "C" { /** * NSMachPort compatibility method. */ -+ (NSPort*) portWithMachPort: (int)machPort; ++ (NSPort*) portWithMachPort: (NSInteger)machPort; /** * Returns the object that received messages will be passed off to. @@ -112,12 +112,12 @@ extern "C" { /** * NSMachPort compatibility method. */ -- (id) initWithMachPort: (int)machPort; +- (id) initWithMachPort: (NSInteger)machPort; /** * NSMachPort compatibility. */ -- (int) machPort; +- (NSInteger) machPort; /** * Mark port as invalid, deregister with listeners and cease further network @@ -151,16 +151,16 @@ extern "C" { * Returns amount of space used for header info at beginning of messages. * Subclasses should override (this implementation returns 0). */ -- (unsigned) reservedSpaceLength; +- (NSUInteger) reservedSpaceLength; /** * Internal method for sending message, for use by subclasses. */ - (BOOL) sendBeforeDate: (NSDate*)when - msgid: (int)msgid + msgid: (NSInteger)msgid components: (NSMutableArray*)components from: (NSPort*)receivingPort - reserved: (unsigned)length; + reserved: (NSUInteger)length; /** * Internal method for sending message, for use by subclasses. @@ -168,7 +168,7 @@ extern "C" { - (BOOL) sendBeforeDate: (NSDate*)when components: (NSMutableArray*)components from: (NSPort*)receivingPort - reserved: (unsigned)length; + reserved: (NSUInteger)length; #endif @end diff --git a/Headers/Foundation/NSProcessInfo.h b/Headers/Foundation/NSProcessInfo.h index 49d3e9ed8..2c9568349 100644 --- a/Headers/Foundation/NSProcessInfo.h +++ b/Headers/Foundation/NSProcessInfo.h @@ -141,7 +141,7 @@ enum { * GSCygwinOperatingSystem - cygwin unix-like environment * */ -- (unsigned int) operatingSystem; +- (NSUInteger) operatingSystem; /** * Return a human readable string representing the operating system type.
diff --git a/Headers/Foundation/NSPropertyList.h b/Headers/Foundation/NSPropertyList.h index f79f5ca2c..c79f01fc0 100644 --- a/Headers/Foundation/NSPropertyList.h +++ b/Headers/Foundation/NSPropertyList.h @@ -39,46 +39,47 @@ extern "C" { @class NSData, NSString; +enum { + NSPropertyListImmutable = 0, + NSPropertyListMutableContainers, + NSPropertyListMutableContainersAndLeaves +}; /** * Describes the mutability to use when generating objects during * deserialisation of a property list. - */ -typedef enum { - NSPropertyListImmutable = 0, -/** NSPropertyListImmutable + * + * NSPropertyListImmutable * all objects in created list are immutable - */ - NSPropertyListMutableContainers, -/** NSPropertyListMutableContainers - * dictionaries and arrays are mutable - */ - NSPropertyListMutableContainersAndLeaves -/** NSPropertyListMutableContainersAndLeaves + * NSPropertyListMutableContainers * dictionaries, arrays, strings and data objects are mutable + * */ -} NSPropertyListMutabilityOptions; +typedef NSUInteger NSPropertyListMutabilityOptions; -/** - * Specifies the serialisation format for a serialised property list. - */ -typedef enum { +enum { NSPropertyListOpenStepFormat = 1, -/** NSPropertyListOpenStepFormat - * the most human-readable format */ NSPropertyListXMLFormat_v1_0 = 100, -/** NSPropertyListXMLFormat_v1_0 - * portable and readable */ NSPropertyListBinaryFormat_v1_0 = 200, -/** NSPropertyListBinaryFormat_v1_0 - * the standard format on macos-x */ NSPropertyListGNUstepFormat = 1000, -/** NSPropertyListGNUstepFormat - * extension of OpenStep format */ NSPropertyListGNUstepBinaryFormat, -/** NSPropertyListGNUstepBinaryFormat - * efficient, hardware independent */ -} NSPropertyListFormat; +}; +/** + * Specifies the serialisation format for a serialised property list. + * + * NSPropertyListOpenStepFormat + * the most human-readable format + * NSPropertyListXMLFormat_v1_0 + * portable and readable + * NSPropertyListBinaryFormat_v1_0 + * the standard format on macos-x + * NSPropertyListGNUstepFormat + * extension of OpenStep format + * NSPropertyListGNUstepBinaryFormat + * efficient, hardware independent + * + */ +typedef NSUInteger NSPropertyListFormat; /** *

The NSPropertyListSerialization class provides facilities for diff --git a/Headers/Foundation/NSProxy.h b/Headers/Foundation/NSProxy.h index 3dea63da9..25d576c80 100644 --- a/Headers/Foundation/NSProxy.h +++ b/Headers/Foundation/NSProxy.h @@ -35,9 +35,9 @@ extern "C" { @interface NSProxy { @public - Class isa; + Class isa; @private - unsigned int _retain_count; + NSUInteger _retain_count; } + (id) alloc; @@ -55,7 +55,7 @@ extern "C" { + (void) release; + (BOOL) respondsToSelector: (SEL)aSelector; + (id) retain; -+ (unsigned int) retainCount; ++ (NSUInteger) retainCount; - (id) autorelease; - (Class) class; @@ -63,7 +63,7 @@ extern "C" { - (void) dealloc; - (NSString*) description; - (void) forwardInvocation: (NSInvocation*)anInvocation; -- (unsigned int) hash; +- (NSUInteger) hash; - (id) init; - (BOOL) isEqual: (id)anObject; - (BOOL) isKindOfClass: (Class)aClass; @@ -73,7 +73,7 @@ extern "C" { - (void) release; - (BOOL) respondsToSelector: (SEL)aSelector; - (id) retain; -- (unsigned int) retainCount; +- (NSUInteger) retainCount; - (id) self; - (Class) superclass; - (NSZone*) zone; diff --git a/Headers/Foundation/NSRunLoop.h b/Headers/Foundation/NSRunLoop.h index 782817ff9..0a8f94303 100644 --- a/Headers/Foundation/NSRunLoop.h +++ b/Headers/Foundation/NSRunLoop.h @@ -88,7 +88,7 @@ GS_EXPORT NSString * const NSDefaultRunLoopMode; - (void) performSelector: (SEL)aSelector target: (id)target argument: (id)argument - order: (unsigned int)order + order: (NSUInteger)order modes: (NSArray*)modes; - (void) removePort: (NSPort*)port diff --git a/Headers/Foundation/NSScanner.h b/Headers/Foundation/NSScanner.h index 0aac501b7..12bfb24a4 100644 --- a/Headers/Foundation/NSScanner.h +++ b/Headers/Foundation/NSScanner.h @@ -44,7 +44,7 @@ extern "C" { NSCharacterSet *_charactersToBeSkipped; BOOL (*_skipImp)(NSCharacterSet*, SEL, unichar); NSDictionary *_locale; - unsigned int _scanLocation; + NSUInteger _scanLocation; unichar _decimal; BOOL _caseSensitive; BOOL _isUnicode; @@ -65,8 +65,8 @@ extern "C" { /* * Configuring an NSScanner */ -- (unsigned) scanLocation; -- (void) setScanLocation: (unsigned int)anIndex; +- (NSUInteger) scanLocation; +- (void) setScanLocation: (NSUInteger)anIndex; - (BOOL) caseSensitive; - (void) setCaseSensitive: (BOOL)flag; diff --git a/Headers/Foundation/NSSet.h b/Headers/Foundation/NSSet.h index cfa6e396b..354c70856 100644 --- a/Headers/Foundation/NSSet.h +++ b/Headers/Foundation/NSSet.h @@ -46,14 +46,14 @@ extern "C" { + (id) setWithObjects: (id)firstObject, ...; #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) + (id) setWithObjects: (id*)objects - count: (unsigned)count; + count: (NSUInteger)count; #endif + (id) setWithSet: (NSSet*)aSet; - (NSArray*) allObjects; - (id) anyObject; - (BOOL) containsObject: (id)anObject; -- (unsigned) count; +- (NSUInteger) count; - (NSString*) description; - (NSString*) descriptionWithLocale: (NSDictionary*)locale; @@ -61,7 +61,7 @@ extern "C" { - (id) initWithArray: (NSArray*)other; - (id) initWithObjects: (id)firstObject, ...; - (id) initWithObjects: (id*)objects - count: (unsigned)count; + count: (NSUInteger)count; - (id) initWithSet: (NSSet*)other; - (id) initWithSet: (NSSet*)other copyItems: (BOOL)flag; @@ -87,11 +87,11 @@ extern "C" { @interface NSMutableSet: NSSet -+ (id) setWithCapacity: (unsigned)numItems; ++ (id) setWithCapacity: (NSUInteger)numItems; - (void) addObject: (id)anObject; - (void) addObjectsFromArray: (NSArray*)array; -- (id) initWithCapacity: (unsigned)numItems; +- (id) initWithCapacity: (NSUInteger)numItems; - (void) intersectSet: (NSSet*)other; - (void) minusSet: (NSSet*)other; - (void) removeAllObjects; @@ -104,7 +104,7 @@ extern "C" { @interface NSCountedSet : NSMutableSet -- (unsigned int) countForObject: (id)anObject; +- (NSUInteger) countForObject: (id)anObject; @end @@ -125,7 +125,7 @@ extern "C" { * been added once - and are therefore simply wasting space. *

*/ -- (void) purge: (int)level; +- (void) purge: (NSInteger)level; /** *

@@ -175,13 +175,13 @@ id GSUnique(id anObject); * set by removing any objec whose count is less than or equal to that given. * */ -void GSUPurge(unsigned count); +void GSUPurge(NSUInteger count); /* * GSUSet() can be used to artificially set the count for a particular object * Setting the count to zero will remove the object from the global set. */ -id GSUSet(id anObject, unsigned count); +id GSUSet(id anObject, NSUInteger count); #endif /* GS_API_NONE */ diff --git a/Headers/Foundation/NSSpellServer.h b/Headers/Foundation/NSSpellServer.h index b6b5bb864..d69ba604c 100644 --- a/Headers/Foundation/NSSpellServer.h +++ b/Headers/Foundation/NSSpellServer.h @@ -109,7 +109,7 @@ GS_EXPORT NSString *const NSGrammarUserDescription; - (NSRange) spellServer: (NSSpellServer *)sender findMisspelledWordInString: (NSString *)stringToCheck language: (NSString *)language - wordCount: (int *)wordCount + wordCount: (NSInteger *)wordCount countOnly: (BOOL)countOnly; /** diff --git a/Headers/Foundation/NSStream.h b/Headers/Foundation/NSStream.h index 77d77e996..120f217ac 100644 --- a/Headers/Foundation/NSStream.h +++ b/Headers/Foundation/NSStream.h @@ -33,7 +33,7 @@ extern "C" { #endif -typedef enum { +enum { NSStreamStatusNotOpen = 0, NSStreamStatusOpening = 1, NSStreamStatusOpen = 2, @@ -42,16 +42,18 @@ typedef enum { NSStreamStatusAtEnd = 5, NSStreamStatusClosed = 6, NSStreamStatusError = 7 -} NSStreamStatus; +}; +typedef NSUInteger NSStreamStatus; -typedef enum { +enum { NSStreamEventNone = 0, NSStreamEventOpenCompleted = 1, NSStreamEventHasBytesAvailable = 2, NSStreamEventHasSpaceAvailable = 4, NSStreamEventErrorOccurred = 8, NSStreamEventEndEncountered = 16 -} NSStreamEvent; +}; +typedef NSUInteger NSStreamEvent; @class NSError; @class NSHost; @@ -70,7 +72,7 @@ typedef enum { * object for a socket connection with the specified port on host. */ + (void) getStreamsToHost: (NSHost *)host - port: (int)port + port: (NSInteger)port inputStream: (NSInputStream **)inputStream outputStream: (NSOutputStream **)outputStream; @@ -162,7 +164,7 @@ typedef enum { * Returns a pointer to the read buffer in buffer and, by reference, the number * of bytes available in len. */ -- (BOOL) getBuffer: (uint8_t **)buffer length: (unsigned int *)len; +- (BOOL) getBuffer: (uint8_t **)buffer length: (NSUInteger *)len; /** * Returns YES if the receiver has bytes available to read. @@ -185,7 +187,7 @@ typedef enum { /** * Reads up to len bytes into buffer, returning the actual number of bytes read. */ -- (int) read: (uint8_t *)buffer maxLength: (unsigned int)len; +- (NSInteger) read: (uint8_t *)buffer maxLength: (NSUInteger)len; @end @@ -199,7 +201,7 @@ typedef enum { * Creates and returns an initialized NSOutputStream object * that can write to buffer, up to a maximum of capacity bytes. */ -+ (id) outputStreamToBuffer: (uint8_t *)buffer capacity: (unsigned int)capacity; ++ (id) outputStreamToBuffer: (uint8_t *)buffer capacity: (NSUInteger)capacity; /** * Creates and returns an initialized NSOutputStream object @@ -224,7 +226,7 @@ typedef enum { * Returns an initialized NSOutputStream object that can write to buffer, * up to a maximum of capacity bytes. */ -- (id) initToBuffer: (uint8_t *)buffer capacity: (unsigned int)capacity; +- (id) initToBuffer: (uint8_t *)buffer capacity: (NSUInteger)capacity; /** * Returns an initialized NSOutputStream object for writing to the file @@ -243,7 +245,7 @@ typedef enum { * Writes the contents of buffer, up to a maximum of len bytes, * to the receiver. */ -- (int) write: (const uint8_t *)buffer maxLength: (unsigned int)len; +- (NSInteger) write: (const uint8_t *)buffer maxLength: (NSUInteger)len; @end @@ -280,7 +282,7 @@ typedef enum { /** * Createe a ip (ipv6) server stream */ -+ (id) serverStreamToAddr: (NSString*)addr port: (int)port; ++ (id) serverStreamToAddr: (NSString*)addr port: (NSInteger)port; /** * Create a local (unix domain or named pipe) server stream @@ -299,7 +301,7 @@ typedef enum { /** * the designated initializer for a ip (ipv6) server stream */ -- (id) initToAddr: (NSString*)addr port: (int)port; +- (id) initToAddr: (NSString*)addr port: (NSInteger)port; /** * the designated initializer for a local (unix domain or named pipe) diff --git a/Headers/Foundation/NSString.h b/Headers/Foundation/NSString.h index def45b570..0d11b2bb7 100644 --- a/Headers/Foundation/NSString.h +++ b/Headers/Foundation/NSString.h @@ -240,13 +240,13 @@ typedef NSUInteger NSStringEncodingConversionOptions; + (id) string; + (id) stringWithCharacters: (const unichar*)chars - length: (unsigned int)length; + length: (NSUInteger)length; #if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION(010200,GS_API_LATEST) + (id) stringWithCString: (const char*)byteString encoding: (NSStringEncoding)encoding; #endif + (id) stringWithCString: (const char*)byteString - length: (unsigned int)length; + length: (NSUInteger)length; + (id) stringWithCString: (const char*)byteString; + (id) stringWithFormat: (NSString*)format,...; + (id) stringWithContentsOfFile:(NSString *)path; @@ -255,10 +255,10 @@ typedef NSUInteger NSStringEncodingConversionOptions; - (id) init; #if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION(010200,GS_API_LATEST) - (id) initWithBytes: (const void*)bytes - length: (unsigned int)length + length: (NSUInteger)length encoding: (NSStringEncoding)encoding; - (id) initWithBytesNoCopy: (void*)bytes - length: (unsigned int)length + length: (NSUInteger)length encoding: (NSStringEncoding)encoding freeWhenDone: (BOOL)flag; #endif @@ -271,15 +271,15 @@ typedef NSUInteger NSStringEncodingConversionOptions; error: (NSError**)error; #endif - (id) initWithCharactersNoCopy: (unichar*)chars - length: (unsigned int)length + length: (NSUInteger)length freeWhenDone: (BOOL)flag; - (id) initWithCharacters: (const unichar*)chars - length: (unsigned int)length; + length: (NSUInteger)length; - (id) initWithCStringNoCopy: (char*)byteString - length: (unsigned int)length + length: (NSUInteger)length freeWhenDone: (BOOL)flag; - (id) initWithCString: (const char*)byteString - length: (unsigned int)length; + length: (NSUInteger)length; - (id) initWithCString: (const char*)byteString; - (id) initWithString: (NSString*)string; - (id) initWithFormat: (NSString*)format, ...; @@ -291,10 +291,10 @@ typedef NSUInteger NSStringEncodingConversionOptions; - (id) init; // Getting a String's Length -- (unsigned int) length; +- (NSUInteger) length; // Accessing Characters -- (unichar) characterAtIndex: (unsigned int)index; +- (unichar) characterAtIndex: (NSUInteger)index; - (void) getCharacters: (unichar*)buffer; - (void) getCharacters: (unichar*)buffer range: (NSRange)aRange; @@ -305,26 +305,26 @@ typedef NSUInteger NSStringEncodingConversionOptions; // Dividing Strings into Substrings - (NSArray*) componentsSeparatedByString: (NSString*)separator; -- (NSString*) substringFromIndex: (unsigned int)index; +- (NSString*) substringFromIndex: (NSUInteger)index; - (NSString*) substringFromRange: (NSRange)aRange; -- (NSString*) substringToIndex: (unsigned int)index; +- (NSString*) substringToIndex: (NSUInteger)index; // Finding Ranges of Characters and Substrings - (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet; - (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet - options: (unsigned int)mask; + options: (NSUInteger)mask; - (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet - options: (unsigned int)mask + options: (NSUInteger)mask range: (NSRange)aRange; - (NSRange) rangeOfString: (NSString*)string; - (NSRange) rangeOfString: (NSString*)string - options: (unsigned int)mask; + options: (NSUInteger)mask; - (NSRange) rangeOfString: (NSString*)aString - options: (unsigned int)mask + options: (NSUInteger)mask range: (NSRange)aRange; // Determining Composed Character Sequences -- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (unsigned int)anIndex; +- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (NSUInteger)anIndex; // Converting String Contents into a Property List - (id)propertyList; @@ -333,19 +333,19 @@ typedef NSUInteger NSStringEncodingConversionOptions; // Identifying and Comparing Strings - (NSComparisonResult) compare: (NSString*)aString; - (NSComparisonResult) compare: (NSString*)aString - options: (unsigned int)mask; + options: (NSUInteger)mask; - (NSComparisonResult) compare: (NSString*)aString - options: (unsigned int)mask + options: (NSUInteger)mask range: (NSRange)aRange; - (BOOL) hasPrefix: (NSString*)aString; - (BOOL) hasSuffix: (NSString*)aString; - (BOOL) isEqual: (id)anObject; - (BOOL) isEqualToString: (NSString*)aString; -- (unsigned int) hash; +- (NSUInteger) hash; // Getting a Shared Prefix - (NSString*) commonPrefixWithString: (NSString*)aString - options: (unsigned int)mask; + options: (NSUInteger)mask; // Changing Case - (NSString*) capitalizedString; @@ -359,21 +359,21 @@ typedef NSUInteger NSStringEncodingConversionOptions; #if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION(010200,GS_API_LATEST) - (const char*) cStringUsingEncoding: (NSStringEncoding)encoding; - (BOOL) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength encoding: (NSStringEncoding)encoding; - (id) initWithCString: (const char*)byteString encoding: (NSStringEncoding)encoding; -- (unsigned) lengthOfBytesUsingEncoding: (NSStringEncoding)encoding; -- (unsigned) maximumLengthOfBytesUsingEncoding: (NSStringEncoding)encoding; +- (NSUInteger) lengthOfBytesUsingEncoding: (NSStringEncoding)encoding; +- (NSUInteger) maximumLengthOfBytesUsingEncoding: (NSStringEncoding)encoding; #endif #endif -- (unsigned int) cStringLength; +- (NSUInteger) cStringLength; - (void) getCString: (char*)buffer; - (void) getCString: (char*)buffer - maxLength: (unsigned int)maxLength; + maxLength: (NSUInteger)maxLength; - (void) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength range: (NSRange)aRange remainingRange: (NSRange*)leftoverRange; @@ -401,10 +401,10 @@ typedef NSUInteger NSStringEncodingConversionOptions; * completions. Returns 0 if no match found, else a positive number that is * only accurate if outputArray was non-nil. */ -- (unsigned int) completePathIntoString: (NSString**)outputName - caseSensitive: (BOOL)flag - matchesIntoArray: (NSArray**)outputArray - filterTypes: (NSArray*)filterTypes; +- (NSUInteger) completePathIntoString: (NSString**)outputName + caseSensitive: (BOOL)flag + matchesIntoArray: (NSArray**)outputArray + filterTypes: (NSArray*)filterTypes; /** * Converts the receiver to a C string path expressed in the character @@ -432,7 +432,7 @@ typedef NSUInteger NSStringEncodingConversionOptions; * perform the conversion. */ - (BOOL) getFileSystemRepresentation: (GSNativeChar*)buffer - maxLength: (unsigned int)size; + maxLength: (NSUInteger)size; /** * Returns a string containing the last path component of the receiver.
@@ -661,7 +661,7 @@ typedef NSUInteger NSStringEncodingConversionOptions; - (NSString*) substringWithRange: (NSRange)aRange; - (NSComparisonResult) caseInsensitiveCompare: (NSString*)aString; - (NSComparisonResult) compare: (NSString*)string - options: (unsigned int)mask + options: (NSUInteger)mask range: (NSRange)compareRange locale: (NSDictionary*)dict; - (NSComparisonResult) localizedCompare: (NSString *)string; @@ -672,16 +672,16 @@ typedef NSUInteger NSStringEncodingConversionOptions; - (double) doubleValue; + (NSStringEncoding*) availableStringEncodings; + (NSString*) localizedNameOfStringEncoding: (NSStringEncoding)encoding; -- (void) getLineStart: (unsigned int *)startIndex - end: (unsigned int *)lineEndIndex - contentsEnd: (unsigned int *)contentsEndIndex +- (void) getLineStart: (NSUInteger *)startIndex + end: (NSUInteger *)lineEndIndex + contentsEnd: (NSUInteger *)contentsEndIndex forRange: (NSRange)aRange; - (NSRange) lineRangeForRange: (NSRange)aRange; - (const char*) lossyCString; - (NSString*) stringByAddingPercentEscapesUsingEncoding: (NSStringEncoding)e; -- (NSString*) stringByPaddingToLength: (unsigned int)newLength +- (NSString*) stringByPaddingToLength: (NSUInteger)newLength withString: (NSString*)padString - startingAtIndex: (unsigned int)padIndex; + startingAtIndex: (NSUInteger)padIndex; - (NSString*) stringByReplacingPercentEscapesUsingEncoding: (NSStringEncoding)e; - (NSString*) stringByTrimmingCharactersInSet: (NSCharacterSet*)aSet; - (const char *)UTF8String; @@ -723,27 +723,27 @@ typedef NSUInteger NSStringEncodingConversionOptions; // Creating Temporary Strings + (id) string; + (id) stringWithCharacters: (const unichar*)characters - length: (unsigned int)length; + length: (NSUInteger)length; + (id) stringWithCString: (const char*)byteString - length: (unsigned int)length; + length: (NSUInteger)length; + (id) stringWithCString: (const char*)byteString; + (id) stringWithFormat: (NSString*)format,...; + (id) stringWithContentsOfFile: (NSString*)path; -+ (NSMutableString*) stringWithCapacity: (unsigned int)capacity; ++ (NSMutableString*) stringWithCapacity: (NSUInteger)capacity; // Initializing Newly Allocated Strings -- (id) initWithCapacity: (unsigned int)capacity; +- (id) initWithCapacity: (NSUInteger)capacity; // Modify A String - (void) appendFormat: (NSString*)format, ...; - (void) appendString: (NSString*)aString; - (void) deleteCharactersInRange: (NSRange)range; -- (void) insertString: (NSString*)aString atIndex: (unsigned int)loc; +- (void) insertString: (NSString*)aString atIndex: (NSUInteger)loc; - (void) replaceCharactersInRange: (NSRange)range withString: (NSString*)aString; -- (unsigned int) replaceOccurrencesOfString: (NSString*)replace +- (NSUInteger) replaceOccurrencesOfString: (NSString*)replace withString: (NSString*)by - options: (unsigned int)opts + options: (NSUInteger)opts range: (NSRange)searchRange; - (void) setString: (NSString*)aString; diff --git a/Headers/Foundation/NSThread.h b/Headers/Foundation/NSThread.h index d2c6f0513..afdc7a1d3 100644 --- a/Headers/Foundation/NSThread.h +++ b/Headers/Foundation/NSThread.h @@ -56,7 +56,7 @@ extern "C" { id _arg; SEL _selector; NSString *_name; - unsigned _stackSize; + NSUInteger _stackSize; BOOL _cancelled; BOOL _active; BOOL _finished; @@ -190,11 +190,11 @@ extern "C" { /** Sets the size of the receiver's stack. */ -- (void) setStackSize: (unsigned)stackSize; +- (void) setStackSize: (NSUInteger)stackSize; /** Returns the size of the receiver's stack. */ -- (unsigned) stackSize; +- (NSUInteger) stackSize; /** Starts the receiver executing. */ diff --git a/Headers/Foundation/NSTimeZone.h b/Headers/Foundation/NSTimeZone.h index 095aeca02..2db89f416 100644 --- a/Headers/Foundation/NSTimeZone.h +++ b/Headers/Foundation/NSTimeZone.h @@ -39,7 +39,7 @@ extern "C" { //Creating and Initializing an NSTimeZone + (NSTimeZone*) localTimeZone; -+ (NSTimeZone*) timeZoneForSecondsFromGMT: (int)seconds; ++ (NSTimeZone*) timeZoneForSecondsFromGMT: (NSInteger)seconds; + (NSTimeZone*) timeZoneWithName: (NSString*)aTimeZoneName; //Managing Time Zones @@ -72,8 +72,8 @@ extern "C" { - (BOOL) isDaylightSavingTimeForDate: (NSDate*)aDate; - (BOOL) isEqualToTimeZone: (NSTimeZone*)aTimeZone; - (NSString*) name; -- (int) secondsFromGMT; -- (int) secondsFromGMTForDate: (NSDate*)aDate; +- (NSInteger) secondsFromGMT; +- (NSInteger) secondsFromGMTForDate: (NSDate*)aDate; #endif #if OS_API_VERSION(100500,GS_API_LATEST) @@ -118,7 +118,7 @@ GS_EXPORT NSString * const NSSystemTimeZoneDidChangeNotification; @interface NSTimeZoneDetail : NSTimeZone - (BOOL) isDaylightSavingTimeZone; - (NSString*) timeZoneAbbreviation; -- (int) timeZoneSecondsFromGMT; +- (NSInteger) timeZoneSecondsFromGMT; @end #endif diff --git a/Headers/Foundation/NSURLAuthenticationChallenge.h b/Headers/Foundation/NSURLAuthenticationChallenge.h index e01769d05..98174e5a3 100644 --- a/Headers/Foundation/NSURLAuthenticationChallenge.h +++ b/Headers/Foundation/NSURLAuthenticationChallenge.h @@ -116,7 +116,7 @@ extern "C" { */ - (id) initWithProtectionSpace: (NSURLProtectionSpace *)space proposedCredential: (NSURLCredential *)credential - previousFailureCount: (int)previousFailureCount + previousFailureCount: (NSInteger)previousFailureCount failureResponse: (NSURLResponse *)response error: (NSError *)error sender: (id)sender; @@ -124,7 +124,7 @@ extern "C" { /** * Returns the count of failed authentication attempts. */ -- (int) previousFailureCount; +- (NSInteger) previousFailureCount; /** * Returns a proposed credential to answer the challenge.
diff --git a/Headers/Foundation/NSURLCache.h b/Headers/Foundation/NSURLCache.h index ce878f3ff..8116344a2 100644 --- a/Headers/Foundation/NSURLCache.h +++ b/Headers/Foundation/NSURLCache.h @@ -137,32 +137,32 @@ typedef enum * Returns the current size (butes) of the data stored in the on-disk * cache. */ -- (unsigned) currentDiskUsage; +- (NSUInteger) currentDiskUsage; /** * Returns the current size (butes) of the data stored in the in-memory * cache. */ -- (unsigned) currentMemoryUsage; +- (NSUInteger) currentMemoryUsage; /** * Returns the disk capacity (in bytes) of the cache. */ -- (unsigned) diskCapacity; +- (NSUInteger) diskCapacity; /** * Returns the receiver initialised with the specified capacities * (in bytes) and using the specified location on disk for persistent * storage. */ -- (id) initWithMemoryCapacity: (unsigned)memoryCapacity - diskCapacity: (unsigned)diskCapacity +- (id) initWithMemoryCapacity: (NSUInteger)memoryCapacity + diskCapacity: (NSUInteger)diskCapacity diskPath: (NSString *)path; /** * Returns the memory capacity (in bytes) of the cache. */ -- (unsigned) memoryCapacity; +- (NSUInteger) memoryCapacity; /** * Empties the cache. @@ -178,12 +178,12 @@ typedef enum /** * Sets the disk capacity (in bytes) truncating cache contents if necessary. */ -- (void) setDiskCapacity: (unsigned)diskCapacity; +- (void) setDiskCapacity: (NSUInteger)diskCapacity; /** * Sets the memory capacity (in bytes) truncating cache contents if necessary. */ -- (void) setMemoryCapacity: (unsigned)memoryCapacity; +- (void) setMemoryCapacity: (NSUInteger)memoryCapacity; /** * Stores cachedResponse in the cache, keyed on request.
diff --git a/Headers/Foundation/NSURLDownload.h b/Headers/Foundation/NSURLDownload.h index d3586084f..af8e4b710 100644 --- a/Headers/Foundation/NSURLDownload.h +++ b/Headers/Foundation/NSURLDownload.h @@ -168,7 +168,7 @@ extern "C" { * Called when some data has been received. */ - (void) download: (NSURLDownload *)download - didReceiveDataOfLength: (unsigned)length; + didReceiveDataOfLength: (NSUInteger)length; /** * Called when a response is received.
diff --git a/Headers/Foundation/NSURLHandle.h b/Headers/Foundation/NSURLHandle.h index 7c9ee092e..543d98d85 100644 --- a/Headers/Foundation/NSURLHandle.h +++ b/Headers/Foundation/NSURLHandle.h @@ -128,13 +128,14 @@ GS_EXPORT NSString * const GSHTTPPropertyPasswordKey; } */ -typedef enum +enum { NSURLHandleNotLoaded = 0, NSURLHandleLoadSucceeded, NSURLHandleLoadInProgress, NSURLHandleLoadFailed -} NSURLHandleStatus; +}; +typedef NSUInteger NSURLHandleStatus; /** * A protocol to which clients of a handle must conform in order to diff --git a/Headers/Foundation/NSURLProtectionSpace.h b/Headers/Foundation/NSURLProtectionSpace.h index ddd5375ec..3625b6583 100644 --- a/Headers/Foundation/NSURLProtectionSpace.h +++ b/Headers/Foundation/NSURLProtectionSpace.h @@ -80,7 +80,7 @@ extern NSString * const NSURLAuthenticationMethodHTTPDigest; * within the host, for others it may be nil. */ - (id) initWithHost: (NSString *)host - port: (int)port + port: (NSInteger)port protocol: (NSString *)protocol realm: (NSString *)realm authenticationMethod: (NSString *)authenticationMethod; @@ -91,7 +91,7 @@ authenticationMethod: (NSString *)authenticationMethod; * host and a protocol. */ - (id) initWithProxyHost: (NSString *)host - port: (int)port + port: (NSInteger)port type: (NSString *)type realm: (NSString *)realm authenticationMethod: (NSString *)authenticationMethod; @@ -105,7 +105,7 @@ authenticationMethod: (NSString *)authenticationMethod; /** * Returns the port set for this receiver or zero if none was set. */ -- (int) port; +- (NSInteger) port; /** * Returns the protocol of the receiver or nil if it is a proxy. diff --git a/Headers/Foundation/NSURLRequest.h b/Headers/Foundation/NSURLRequest.h index bfc7a3f70..6226d6638 100644 --- a/Headers/Foundation/NSURLRequest.h +++ b/Headers/Foundation/NSURLRequest.h @@ -41,6 +41,13 @@ extern "C" { @class NSString; @class NSURL; +enum +{ + NSURLRequestUseProtocolCachePolicy, + NSURLRequestReloadIgnoringCacheData, + NSURLRequestReturnCacheDataElseLoad, + NSURLRequestReturnCacheDataDontLoad, +}; /** * * NSURLRequestUseProtocolCachePolicy @@ -67,13 +74,7 @@ extern "C" { * * */ -typedef enum -{ - NSURLRequestUseProtocolCachePolicy, - NSURLRequestReloadIgnoringCacheData, - NSURLRequestReturnCacheDataElseLoad, - NSURLRequestReturnCacheDataDontLoad, -} NSURLRequestCachePolicy; +typedef NSUInteger NSURLRequestCachePolicy; /** diff --git a/Headers/Foundation/NSURLResponse.h b/Headers/Foundation/NSURLResponse.h index 33f80fe0c..62ba21237 100644 --- a/Headers/Foundation/NSURLResponse.h +++ b/Headers/Foundation/NSURLResponse.h @@ -63,7 +63,7 @@ extern "C" { */ - (id) initWithURL: (NSURL *)URL MIMEType: (NSString *)MIMEType - expectedContentLength: (int)length + expectedContentLength: (NSInteger)length textEncodingName: (NSString *)name; /** @@ -107,7 +107,7 @@ extern "C" { /** * Returns a string representation of a status code. */ -+ (NSString *) localizedStringForStatusCode: (int)statusCode; ++ (NSString *) localizedStringForStatusCode: (NSInteger)statusCode; /** * Returns a dictionary containing all the HTTP header fields. @@ -117,7 +117,7 @@ extern "C" { /** * Returns the HTTP status code for the response. */ -- (int) statusCode; +- (NSInteger) statusCode; @end diff --git a/Headers/Foundation/NSUndoManager.h b/Headers/Foundation/NSUndoManager.h index 59535f093..d3eea7376 100644 --- a/Headers/Foundation/NSUndoManager.h +++ b/Headers/Foundation/NSUndoManager.h @@ -106,12 +106,12 @@ GS_EXPORT NSString* const NSUndoManagerWillUndoChangeNotification; - (void) enableUndoRegistration; - (void) endUndoGrouping; - (void) forwardInvocation: (NSInvocation*)anInvocation; -- (int) groupingLevel; +- (NSInteger) groupingLevel; - (BOOL) groupsByEvent; - (BOOL) isRedoing; - (BOOL) isUndoing; - (BOOL) isUndoRegistrationEnabled; -- (unsigned int) levelsOfUndo; +- (NSUInteger) levelsOfUndo; - (id) prepareWithInvocationTarget: (id)target; - (void) redo; - (NSString*) redoActionName; @@ -125,7 +125,7 @@ GS_EXPORT NSString* const NSUndoManagerWillUndoChangeNotification; - (NSArray*) runLoopModes; - (void) setActionName: (NSString*)name; - (void) setGroupsByEvent: (BOOL)flag; -- (void) setLevelsOfUndo: (unsigned)num; +- (void) setLevelsOfUndo: (NSUInteger)num; - (void) setRunLoopModes: (NSArray*)newModes; - (void) undo; - (NSString*) undoActionName; diff --git a/Headers/Foundation/NSUserDefaults.h b/Headers/Foundation/NSUserDefaults.h index 34d22d91b..6963a5621 100644 --- a/Headers/Foundation/NSUserDefaults.h +++ b/Headers/Foundation/NSUserDefaults.h @@ -331,7 +331,7 @@ GS_EXPORT NSString* const GSLocale; * and returns its integer value or 0 if it is not representable * as an integer. */ -- (int) integerForKey: (NSString*)defaultName; +- (NSInteger) integerForKey: (NSString*)defaultName; /** * Looks up a value for a specified default using. @@ -381,7 +381,7 @@ GS_EXPORT NSString* const GSLocale; * Calls -setObject:forKey: to make the change by storing an intege * [NSNumber] instance. */ -- (void) setInteger: (int)value forKey: (NSString*)defaultName; +- (void) setInteger: (NSInteger)value forKey: (NSString*)defaultName; /** * Sets a copy of an object value for defaultName in the diff --git a/Headers/Foundation/NSValue.h b/Headers/Foundation/NSValue.h index fccd9281f..d3baa34aa 100644 --- a/Headers/Foundation/NSValue.h +++ b/Headers/Foundation/NSValue.h @@ -322,6 +322,29 @@ extern "C" { * Returns whether receiver and otherNumber represent the same numerical value. */ - (BOOL) isEqualToNumber: (NSNumber*)otherNumber; + + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST) +/** Return a number intialised with NSInteger. + */ ++ (NSNumber*) numberWithInteger: (NSInteger)value; +/** Return a number intialised with NSUInteger. + */ ++ (NSNumber*) numberWithUnsignedInteger: (NSUInteger)value; +/** Initialise the receiver with NSInteger content. + */ +- (id) initWithInteger: (NSInteger)value; +/** Initialise the receiver with NSUInteger content. + */ +- (id) initWithUnsignedInteger: (NSUInteger)value; +/** Return the contents of the receiver as NSInteger. + */ +- (NSInteger) integerValue; +/** Return the contents of the receiver as NSUInteger. + */ +- (NSUInteger) unsignedIntegerValue; +#endif + @end #if OS_API_VERSION(GS_API_NONE, GS_API_NONE) diff --git a/Headers/Foundation/NSXMLParser.h b/Headers/Foundation/NSXMLParser.h index 1a4a3daf8..0f33865a0 100644 --- a/Headers/Foundation/NSXMLParser.h +++ b/Headers/Foundation/NSXMLParser.h @@ -154,12 +154,12 @@ GS_EXPORT NSString* const NSXMLParserErrorDomain; /** * Returns the current column number of the document being parsed. */ -- (int) columnNumber; +- (NSInteger) columnNumber; /** * Returns the current line number of the document being parsed. */ -- (int) lineNumber; +- (NSInteger) lineNumber; /** * Returns the public identifier of the external entity in the @@ -308,7 +308,7 @@ GS_EXPORT NSString* const NSXMLParserErrorDomain; /* * Provide the same error codes as MacOS-X, even if we don't use them all. */ -typedef enum { +enum { NSXMLParserInternalError = 1, NSXMLParserOutOfMemoryError = 2, NSXMLParserDocumentStartError = 3, @@ -402,7 +402,8 @@ typedef enum { NSXMLParserURIFragmentError = 92, NSXMLParserNoDTDError = 94, NSXMLParserDelegateAbortedParseError = 512 -} NSXMLParserError; +}; +typedef NSUInteger NSXMLParserError; #if defined(__cplusplus) } diff --git a/Headers/Foundation/NSZone.h b/Headers/Foundation/NSZone.h index 8457d0ce6..5dd6f310d 100644 --- a/Headers/Foundation/NSZone.h +++ b/Headers/Foundation/NSZone.h @@ -101,7 +101,7 @@ struct _NSZone }; GS_EXPORT NSZone* -NSCreateZone (size_t start, size_t gran, BOOL canFree); +NSCreateZone (NSUInteger start, NSUInteger gran, BOOL canFree); GS_EXPORT NSZone* NSDefaultMallocZone (void); @@ -117,7 +117,7 @@ NSZoneFromPointer (void *ptr); * default zone, in which case NULL is returned. */ GS_EXPORT void* -NSZoneMalloc (NSZone *zone, size_t size); +NSZoneMalloc (NSZone *zone, NSUInteger size); /** * Allocates and returns cleared memory for elems items of size bytes, in the @@ -127,7 +127,7 @@ NSZoneMalloc (NSZone *zone, size_t size); * default zone, in which case NULL is returned. */ GS_EXPORT void* -NSZoneCalloc (NSZone *zone, size_t elems, size_t bytes); +NSZoneCalloc (NSZone *zone, NSUInteger elems, NSUInteger bytes); /** * Reallocates the chunk of memory in zone pointed to by ptr to a new one of @@ -137,7 +137,7 @@ NSZoneCalloc (NSZone *zone, size_t elems, size_t bytes); * default zone, in which case NULL is returned. */ GS_EXPORT void* -NSZoneRealloc (NSZone *zone, void *ptr, size_t size); +NSZoneRealloc (NSZone *zone, void *ptr, NSUInteger size); /** * Return memory for an entire zone to system. In fact, this will not be done @@ -221,7 +221,7 @@ NSZoneStats (NSZone *zone); * Try to do some logging if possible. */ void* -GSOutOfMemory(size_t size, BOOL retry); +GSOutOfMemory(NSUInteger size, BOOL retry); /** * Returns the default zone used for memory allocation, created at startup. diff --git a/Source/Additions/GCArray.m b/Source/Additions/GCArray.m index ed830bbb7..866d7386f 100644 --- a/Source/Additions/GCArray.m +++ b/Source/Additions/GCArray.m @@ -80,14 +80,14 @@ static Class gcClass = 0; return result; } -- (unsigned int) count +- (NSUInteger) count { return _count; } - (void) dealloc { - unsigned int c = _count; + NSUInteger c = _count; [GCObject gcObjectWillBeDeallocated: (GCObject*)self]; if ([GCObject gcIsCollecting]) @@ -114,7 +114,7 @@ static Class gcClass = 0; - (void) gcDecrementRefCountOfContainedObjects { - unsigned int c = _count; + NSUInteger c = _count; gc.flags.visited = 0; while (c-- > 0) @@ -134,7 +134,7 @@ static Class gcClass = 0; } else { - unsigned int c = _count; + NSUInteger c = _count; gc.flags.visited = 1; while (c-- > 0) @@ -149,7 +149,7 @@ static Class gcClass = 0; } } -- (id) initWithObjects: (id*)objects count: (unsigned int)count +- (id) initWithObjects: (id*)objects count: (NSUInteger)count { _contents = NSZoneMalloc([self zone], count * (sizeof(id) + sizeof(BOOL))); _isGCObject = (BOOL*)&_contents[count]; @@ -174,7 +174,7 @@ static Class gcClass = 0; - (id) initWithArray: (NSArray*)anotherArray { - unsigned int count = [anotherArray count]; + NSUInteger count = [anotherArray count]; _contents = NSZoneMalloc([self zone], count * (sizeof(id) + sizeof(BOOL))); _isGCObject = (BOOL*)&_contents[count]; @@ -208,7 +208,7 @@ static Class gcClass = 0; return [[GCMutableArray allocWithZone: zone] initWithArray: self]; } -- (id) objectAtIndex: (unsigned int)index +- (id) objectAtIndex: (NSUInteger)index { if (index >= _count) { @@ -272,7 +272,7 @@ static Class gcClass = 0; - (id) initWithArray: (NSArray*)anotherArray { - unsigned int count = [anotherArray count]; + NSUInteger count = [anotherArray count]; self = [self initWithCapacity: count]; if (self != nil) @@ -287,7 +287,7 @@ static Class gcClass = 0; return self; } -- (id) initWithCapacity: (unsigned int)aNumItems +- (id) initWithCapacity: (NSUInteger)aNumItems { if (aNumItems < 1) { @@ -301,7 +301,7 @@ static Class gcClass = 0; return self; } -- (id) initWithObjects: (id *)objects count: (unsigned int)count +- (id) initWithObjects: (id *)objects count: (NSUInteger)count { self = [self initWithCapacity: count]; if (self != nil) @@ -325,9 +325,9 @@ static Class gcClass = 0; return self; } -- (void) insertObject: (id)anObject atIndex: (unsigned int)index +- (void) insertObject: (id)anObject atIndex: (NSUInteger)index { - unsigned int i; + NSUInteger i; if (anObject == nil) { @@ -381,14 +381,14 @@ static Class gcClass = 0; [self removeObjectsInRange: NSMakeRange(0, _count)]; } -- (void) removeObjectAtIndex: (unsigned int)index +- (void) removeObjectAtIndex: (NSUInteger)index { [self removeObjectsInRange: NSMakeRange(index, 1)]; } - (void) removeObjectsInRange: (NSRange)range { - unsigned int i; + NSUInteger i; if (NSMaxRange(range) > _count) { @@ -413,7 +413,7 @@ static Class gcClass = 0; _count -= range.length; } -- (void) replaceObjectAtIndex: (unsigned int)index withObject: (id)anObject +- (void) replaceObjectAtIndex: (NSUInteger)index withObject: (id)anObject { if (anObject == nil) { diff --git a/Source/Additions/GCDictionary.m b/Source/Additions/GCDictionary.m index 7bb481f0f..751db6dac 100644 --- a/Source/Additions/GCDictionary.m +++ b/Source/Additions/GCDictionary.m @@ -170,7 +170,7 @@ static Class gcClass = 0; return [[GCDictionary allocWithZone: zone] initWithDictionary: self]; } -- (unsigned int) count +- (NSUInteger) count { return NSCountMapTable(_map); } @@ -239,7 +239,7 @@ static Class gcClass = 0; { id keys = [dictionary keyEnumerator]; id key; - unsigned int size = ([dictionary count] * 4) / 3; + NSUInteger size = ([dictionary count] * 4) / 3; NSZone *z = NSDefaultMallocZone(); _map = NSCreateMapTableWithZone(GCInfoMapKeyCallBacks, @@ -266,9 +266,9 @@ static Class gcClass = 0; - (id) initWithObjects: (id*)objects forKeys: (id*)keys - count: (unsigned int)count + count: (NSUInteger)count { - unsigned int size = (count * 4) / 3; + NSUInteger size = (count * 4) / 3; NSZone *z = NSDefaultMallocZone(); _map = NSCreateMapTableWithZone(GCInfoMapKeyCallBacks, @@ -368,9 +368,9 @@ static Class gcClass = 0; return [self initWithCapacity: 0]; } -- (id) initWithCapacity: (unsigned int)aNumItems +- (id) initWithCapacity: (NSUInteger)aNumItems { - unsigned int size = (aNumItems * 4) / 3; + NSUInteger size = (aNumItems * 4) / 3; _map = NSCreateMapTableWithZone(GCInfoMapKeyCallBacks, GCInfoValueCallBacks, size, [self zone]); diff --git a/Source/Additions/GSCategories.m b/Source/Additions/GSCategories.m index 5532743db..ba9c8bde5 100644 --- a/Source/Additions/GSCategories.m +++ b/Source/Additions/GSCategories.m @@ -34,7 +34,7 @@ @implementation NSArray (GSCategories) -- (unsigned) insertionPosition: (id)item +- (NSUInteger) insertionPosition: (id)item usingFunction: (NSComparisonResult (*)(id, id, void *))sorter context: (void *)context { @@ -91,7 +91,7 @@ return index; } -- (unsigned) insertionPosition: (id)item +- (NSUInteger) insertionPosition: (id)item usingSelector: (SEL)comp { unsigned count = [self count]; @@ -178,10 +178,10 @@ * last day of the year is a monday tuesday or wednesday, these days are * part of week 1 of the next year. */ -- (int) weekOfYear +- (NSInteger) weekOfYear { - int dayOfWeek = [self dayOfWeek]; - int dayOfYear; + NSInteger dayOfWeek = [self dayOfWeek]; + NSInteger dayOfYear; /* * Whether a week is considered to be in a year or not depends on its @@ -825,7 +825,7 @@ static void MD5Transform (uint32_t buf[4], uint32_t const in[16]) /* * The header is a line of the form 'begin mode filename' */ - sprintf((char*)buf, "begin %03o ", mode); + sprintf((char*)buf, "begin %03o ", (int)mode); [encoded appendBytes: buf length: strlen((const char*)buf)]; [encoded appendData: [name dataUsingEncoding: NSASCIIStringEncoding]]; [encoded appendBytes: "\n" length: 1]; @@ -1172,7 +1172,7 @@ strerror_r(int eno, char *buf, int len) if (length > 0) { unsigned start = 0; - unichar (*caiImp)(NSString*, SEL, unsigned int); + unichar (*caiImp)(NSString*, SEL, NSUInteger); SEL caiSel = @selector(characterAtIndex:); caiImp = (unichar (*)())[self methodForSelector: caiSel]; @@ -1199,7 +1199,7 @@ strerror_r(int eno, char *buf, int len) if (length > 0) { unsigned end = length; - unichar (*caiImp)(NSString*, SEL, unsigned int); + unichar (*caiImp)(NSString*, SEL, NSUInteger); SEL caiSel = @selector(characterAtIndex:); caiImp = (unichar (*)())[self methodForSelector: caiSel]; @@ -1231,7 +1231,7 @@ strerror_r(int eno, char *buf, int len) { unsigned start = 0; unsigned end = length; - unichar (*caiImp)(NSString*, SEL, unsigned int); + unichar (*caiImp)(NSString*, SEL, NSUInteger); SEL caiSel = @selector(characterAtIndex:); caiImp = (unichar (*)())[self methodForSelector: caiSel]; @@ -1385,7 +1385,7 @@ strerror_r(int eno, char *buf, int len) if (length > 0) { unsigned start = 0; - unichar (*caiImp)(NSString*, SEL, unsigned int); + unichar (*caiImp)(NSString*, SEL, NSUInteger); SEL caiSel = @selector(characterAtIndex:); caiImp = (unichar (*)())[self methodForSelector: caiSel]; @@ -1410,7 +1410,7 @@ strerror_r(int eno, char *buf, int len) if (length > 0) { unsigned end = length; - unichar (*caiImp)(NSString*, SEL, unsigned int); + unichar (*caiImp)(NSString*, SEL, NSUInteger); SEL caiSel = @selector(characterAtIndex:); caiImp = (unichar (*)())[self methodForSelector: caiSel]; diff --git a/Source/Additions/GSMime.m b/Source/Additions/GSMime.m index c0bb8d586..29e80b461 100644 --- a/Source/Additions/GSMime.m +++ b/Source/Additions/GSMime.m @@ -389,7 +389,7 @@ wordData(NSString *word) * Return YES on success, NO if there is an error. */ - (BOOL) decodeData: (const void*)sData - length: (unsigned)length + length: (NSUInteger)length intoData: (NSMutableData*)dData { unsigned size = [dData length]; @@ -417,7 +417,7 @@ wordData(NSString *word) @end @implementation GSMimeBase64DecoderContext - (BOOL) decodeData: (const void*)sData - length: (unsigned)length + length: (NSUInteger)length intoData: (NSMutableData*)dData { unsigned size = [dData length]; @@ -517,7 +517,7 @@ wordData(NSString *word) @end @implementation GSMimeQuotedDecoderContext - (BOOL) decodeData: (const void*)sData - length: (unsigned)length + length: (NSUInteger)length intoData: (NSMutableData*)dData { unsigned size = [dData length]; @@ -618,7 +618,7 @@ wordData(NSString *word) @implementation GSMimeUUCodingContext - (BOOL) decodeData: (const void*)sData - length: (unsigned)length + length: (NSUInteger)length intoData: (NSMutableData*)dData { [super decodeData: sData length: length intoData: dData]; @@ -3676,7 +3676,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold, @interface GSMimeDocument (Private) -- (unsigned) _indexOfHeaderNamed: (NSString*)name; +- (NSUInteger) _indexOfHeaderNamed: (NSString*)name; @end /** @@ -5743,7 +5743,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold, * NB. The supplied name must be lowercase.
* This method is for internal use */ -- (unsigned) _indexOfHeaderNamed: (NSString*)name +- (NSUInteger) _indexOfHeaderNamed: (NSString*)name { unsigned count = [headers count]; unsigned index; diff --git a/Source/Additions/GSXML.m b/Source/Additions/GSXML.m index 03dbdbe7d..ff4496d83 100644 --- a/Source/Additions/GSXML.m +++ b/Source/Additions/GSXML.m @@ -225,7 +225,7 @@ static NSMapTable *attrNames = 0; } } -+ (int) typeFromDescription: (NSString*)desc ++ (NSInteger) typeFromDescription: (NSString*)desc { NSMapEnumerator enumerator; NSString *val; @@ -236,22 +236,22 @@ static NSMapTable *attrNames = 0; { if ([desc isEqual: val] == YES) { - return (int)(intptr_t)key; + return (NSInteger)(intptr_t)key; } } return -1; } -+ (NSString*) descriptionFromType: (int)type ++ (NSString*) descriptionFromType: (NSInteger)type { NSString *desc = (NSString*)NSMapGet(attrNames, (void*)(intptr_t)type); return desc; } -- (int) type +- (NSInteger) type { - return (int)((xmlAttrPtr)(lib))->atype; + return (NSInteger)((xmlAttrPtr)(lib))->atype; } - (NSString*) typeDescription @@ -400,9 +400,9 @@ static NSMapTable *attrNames = 0; return UTF8Str(((xmlDocPtr)(lib))->encoding); } -- (unsigned) hash +- (NSUInteger) hash { - return (((unsigned)(uintptr_t)lib) >> 3); + return (((NSUInteger)(intptr_t)lib) >> 3); } - (id) init @@ -553,7 +553,7 @@ static NSMapTable *nsNames = 0; /** * Return the string representation of the specified numeric type. */ -+ (NSString*) descriptionFromType: (int)type ++ (NSString*) descriptionFromType: (NSInteger)type { NSString *desc = (NSString*)NSMapGet(nsNames, (void*)(intptr_t)type); @@ -582,7 +582,7 @@ static NSMapTable *nsNames = 0; * XML_LOCAL_NAMESPACE * */ -+ (int) typeFromDescription: (NSString*)desc ++ (NSInteger) typeFromDescription: (NSString*)desc { NSMapEnumerator enumerator; NSString *val; @@ -593,7 +593,7 @@ static NSMapTable *nsNames = 0; { if ([desc isEqual: val] == YES) { - return (int)(intptr_t)key; + return (NSInteger)(intptr_t)key; } } return -1; @@ -610,9 +610,9 @@ static NSMapTable *nsNames = 0; [super dealloc]; } -- (unsigned) hash +- (NSUInteger) hash { - return (((unsigned)(uintptr_t)lib) >> 3); + return (((NSUInteger)(intptr_t)lib) >> 3); } /** @@ -676,9 +676,9 @@ static NSMapTable *nsNames = 0; /** * Return type of namespace */ -- (int) type +- (NSInteger) type { - return (int)((xmlNsPtr)(lib))->type; + return (NSInteger)((xmlNsPtr)(lib))->type; } /** @@ -731,7 +731,7 @@ static NSMapTable *nodeNames = 0; /** * Return the string constant value for the node type given. */ -+ (NSString*) descriptionFromType: (int)type ++ (NSString*) descriptionFromType: (NSInteger)type { NSString *desc = (NSString*)NSMapGet(nodeNames, (void*)(intptr_t)type); @@ -810,7 +810,7 @@ static NSMapTable *nodeNames = 0; * XML_ENTITY_DECL * */ -+ (int) typeFromDescription: (NSString*)desc ++ (NSInteger) typeFromDescription: (NSString*)desc { NSMapEnumerator enumerator; NSString *val; @@ -821,7 +821,7 @@ static NSMapTable *nodeNames = 0; { if ([desc isEqual: val] == YES) { - return (int)(intptr_t)key; + return (NSInteger)(intptr_t)key; } } return -1; @@ -894,11 +894,11 @@ static NSMapTable *nodeNames = 0; { return UTF8Str(ptr->content); } - if ((int)ptr->type == XML_TEXT_NODE) + if ((NSInteger)ptr->type == XML_TEXT_NODE) { return @""; } - else if ((int)ptr->type == XML_ELEMENT_NODE) + else if ((NSInteger)ptr->type == XML_ELEMENT_NODE) { ptr = ptr->children; if (ptr != NULL) @@ -1070,9 +1070,9 @@ static NSMapTable *nodeNames = 0; } } -- (unsigned) hash +- (NSUInteger) hash { - return (((unsigned)(uintptr_t)lib) >> 3); + return (((NSUInteger)(intptr_t)lib) >> 3); } - (id) init @@ -1089,7 +1089,7 @@ static NSMapTable *nodeNames = 0; */ - (BOOL) isElement { - if ((int)((xmlNodePtr)(lib))->type == XML_ELEMENT_NODE) + if ((NSInteger)((xmlNodePtr)(lib))->type == XML_ELEMENT_NODE) { return YES; } @@ -1116,7 +1116,7 @@ static NSMapTable *nodeNames = 0; */ - (BOOL) isText { - if ((int)((xmlNodePtr)(lib))->type == XML_TEXT_NODE) + if ((NSInteger)((xmlNodePtr)(lib))->type == XML_TEXT_NODE) { return YES; } @@ -1531,9 +1531,9 @@ static NSMapTable *nodeNames = 0; * use this method and compare the return value with a value you previously * obtained using the +typeFromDescription: method. */ -- (int) type +- (NSInteger) type { - return (int)((xmlNodePtr)(lib))->type; + return (NSInteger)((xmlNodePtr)(lib))->type; } /** @@ -1847,7 +1847,7 @@ static NSString *endMarker = @"At end of incremental parse"; /** * If executed during a parse operation, returns the current column number. */ -- (int) columnNumber +- (NSInteger) columnNumber { return xmlSAX2GetColumnNumber(lib); } @@ -1891,7 +1891,7 @@ static NSString *endMarker = @"At end of incremental parse"; /** * Return error code for last parse operation. */ -- (int) errNo +- (NSInteger) errNo { return ((xmlParserCtxtPtr)lib)->errNo; } @@ -2057,7 +2057,7 @@ static NSString *endMarker = @"At end of incremental parse"; /** * If executed during a parse operation, returns the current line number. */ -- (int) lineNumber +- (NSInteger) lineNumber { return xmlSAX2GetLineNumber(lib); } @@ -3043,7 +3043,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) /** * Called to detemrine if the document is standalone. */ -- (int) isStandalone +- (NSInteger) isStandalone { return 1; } @@ -3166,7 +3166,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) * An entity definition has been parsed. */ - (void) entityDecl: (NSString*)name - type: (int)type + type: (NSInteger)type public: (NSString*)publicId system: (NSString*)systemId content: (NSString*)content @@ -3178,8 +3178,8 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) */ - (void) attributeDecl: (NSString*)nameElement name: (NSString*)name - type: (int)type - typeDefValue: (int)defType + type: (NSInteger)type + typeDefValue: (NSInteger)defType defaultValue: (NSString*)value { } @@ -3188,7 +3188,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) * An element definition has been parsed. */ - (void) elementDecl: (NSString*)name - type: (int)type + type: (NSInteger)type { } @@ -3246,8 +3246,8 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) * Called when a warning message needs to be output. */ - (void) warning: (NSString*)e - colNumber: (int)colNumber - lineNumber: (int)lineNumber + colNumber: (NSInteger)colNumber + lineNumber: (NSInteger)lineNumber { e = [NSString stringWithFormat: @"at line: %d column: %d ... %@", lineNumber, colNumber, e]; @@ -3258,8 +3258,8 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) * Called when an error message needs to be output. */ - (void) error: (NSString*)e - colNumber: (int)colNumber - lineNumber: (int)lineNumber + colNumber: (NSInteger)colNumber + lineNumber: (NSInteger)lineNumber { e = [NSString stringWithFormat: @"at line: %d column: %d ... %@", lineNumber, colNumber, e]; @@ -3270,8 +3270,8 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) * Called when a fatal error message needs to be output. */ - (void) fatalError: (NSString*)e - colNumber: (int)colNumber - lineNumber: (int)lineNumber + colNumber: (NSInteger)colNumber + lineNumber: (NSInteger)lineNumber { e = [NSString stringWithFormat: @"at line: %d column: %d ... %@", lineNumber, colNumber, e]; @@ -3281,7 +3281,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) /** * Called to find out whether there is an internal subset. */ -- (int) hasInternalSubset +- (NSInteger) hasInternalSubset { return 0; } @@ -3299,7 +3299,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) /** * Called to find out whether there is an external subset. */ -- (int) hasExternalSubset +- (NSInteger) hasExternalSubset { return 0; } @@ -3688,7 +3688,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) /** * Returns the number of nodes in the receiver. */ -- (unsigned int) count +- (NSUInteger) count { if (xmlXPathNodeSetIsEmpty (((xmlXPathObject*)_lib)->nodesetval)) { @@ -3700,7 +3700,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) /** * Deprecated */ -- (unsigned int) length +- (NSUInteger) length { if (xmlXPathNodeSetIsEmpty (((xmlXPathObject*)_lib)->nodesetval)) { @@ -3714,7 +3714,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) * Returns the node from the receiver at the specified index, or nil * if no such node exists. */ -- (GSXMLNode *) nodeAtIndex: (unsigned)index +- (GSXMLNode *) nodeAtIndex: (NSUInteger)index { if (xmlXPathNodeSetIsEmpty (((xmlXPathObject*)_lib)->nodesetval)) { @@ -3726,7 +3726,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...) GSXMLNode *n; node = xmlXPathNodeSetItem (((xmlXPathObject*)_lib)->nodesetval, - (int)index); + (NSInteger)index); n = [GSXMLNode alloc]; n = [n _initFrom: node parent: self]; return AUTORELEASE(n); @@ -4441,43 +4441,43 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use */ @interface NSArray (GSXMLRPC) - (void) appendToXMLRPC: (NSMutableString*)str - indent: (unsigned)indent + indent: (NSUInteger)indent for: (GSXMLRPC*)rpc; @end @interface NSData (GSXMLRPC) - (void) appendToXMLRPC: (NSMutableString*)str - indent: (unsigned)indent + indent: (NSUInteger)indent for: (GSXMLRPC*)rpc; @end @interface NSDate (GSXMLRPC) - (void) appendToXMLRPC: (NSMutableString*)str - indent: (unsigned)indent + indent: (NSUInteger)indent for: (GSXMLRPC*)rpc; @end @interface NSDictionary (GSXMLRPC) - (void) appendToXMLRPC: (NSMutableString*)str - indent: (unsigned)indent + indent: (NSUInteger)indent for: (GSXMLRPC*)rpc; @end @interface NSObject (GSXMLRPC) - (void) appendToXMLRPC: (NSMutableString*)str - indent: (unsigned)indent + indent: (NSUInteger)indent for: (GSXMLRPC*)rpc; @end @interface NSNumber (GSXMLRPC) - (void) appendToXMLRPC: (NSMutableString*)str - indent: (unsigned)indent + indent: (NSUInteger)indent for: (GSXMLRPC*)rpc; @end @interface NSString (GSXMLRPC) - (void) appendToXMLRPC: (NSMutableString*)str - indent: (unsigned)indent + indent: (NSUInteger)indent for: (GSXMLRPC*)rpc; @end @@ -4528,7 +4528,7 @@ static void indentation(unsigned level, NSMutableString *str) @implementation NSArray (GSXMLRPC) - (void) appendToXMLRPC: (NSMutableString*)str - indent: (unsigned)indent + indent: (NSUInteger)indent for: (GSXMLRPC*)rpc { unsigned i; @@ -4564,7 +4564,7 @@ static void indentation(unsigned level, NSMutableString *str) @implementation NSData (GSXMLRPC) - (void) appendToXMLRPC: (NSMutableString*)str - indent: (unsigned)indent + indent: (NSUInteger)indent for: (GSXMLRPC*)rpc { NSData *d; @@ -4581,7 +4581,7 @@ static void indentation(unsigned level, NSMutableString *str) @implementation NSDate (GSXMLRPC) - (void) appendToXMLRPC: (NSMutableString*)str - indent: (unsigned)indent + indent: (NSUInteger)indent for: (GSXMLRPC*)rpc { NSString *s; @@ -4597,7 +4597,7 @@ static void indentation(unsigned level, NSMutableString *str) @implementation NSDictionary (GSXMLRPC) - (void) appendToXMLRPC: (NSMutableString*)str - indent: (unsigned)indent + indent: (NSUInteger)indent for: (GSXMLRPC*)rpc { NSEnumerator *kEnum = [self keyEnumerator]; @@ -4638,7 +4638,7 @@ static void indentation(unsigned level, NSMutableString *str) @implementation NSNumber (GSXMLRPC) - (void) appendToXMLRPC: (NSMutableString*)str - indent: (unsigned)indent + indent: (NSUInteger)indent for: (GSXMLRPC*)rpc { const char *t = [self objCType]; @@ -4674,7 +4674,7 @@ static void indentation(unsigned level, NSMutableString *str) @implementation NSObject (GSXMLRPC) - (void) appendToXMLRPC: (NSMutableString*)str - indent: (unsigned)indent + indent: (NSUInteger)indent for: (GSXMLRPC*)rpc { [[self description] appendToXMLRPC: str indent: indent for: rpc]; @@ -4683,7 +4683,7 @@ static void indentation(unsigned level, NSMutableString *str) @implementation NSString (GSXMLRPC) - (void) appendToXMLRPC: (NSMutableString*)str - indent: (unsigned)indent + indent: (NSUInteger)indent for: (GSXMLRPC*)rpc { BOOL compact = [rpc compact]; @@ -4990,7 +4990,7 @@ static void indentation(unsigned level, NSMutableString *str) return str; } -- (NSString*) buildResponseWithFaultCode: (int)code andString: (NSString*)s +- (NSString*) buildResponseWithFaultCode: (NSInteger)code andString: (NSString*)s { NSMutableString *str = [NSMutableString stringWithCapacity: 1024]; NSDictionary *fault; @@ -5140,7 +5140,7 @@ static void indentation(unsigned level, NSMutableString *str) - (id) makeMethodCall: (NSString*)method params: (NSArray*)params - timeout: (int)seconds + timeout: (NSInteger)seconds { NS_DURING { @@ -5322,7 +5322,7 @@ static void indentation(unsigned level, NSMutableString *str) - (BOOL) sendMethodCall: (NSString*)method params: (NSArray*)params - timeout: (int)seconds + timeout: (NSInteger)seconds { NSData *data; diff --git a/Source/GSConcreteValueTemplate.m b/Source/GSConcreteValueTemplate.m index caabf1261..d34922a69 100644 --- a/Source/GSConcreteValueTemplate.m +++ b/Source/GSConcreteValueTemplate.m @@ -182,7 +182,7 @@ return NO; } -- (unsigned) hash +- (NSUInteger) hash { #if TYPE_ORDER == 0 return [data hash]; @@ -199,7 +199,7 @@ hash += val.c[i]; return hash; #elif TYPE_ORDER == 2 - return (unsigned)(uintptr_t)data; + return (NSUInteger)(uintptr_t)data; #elif TYPE_ORDER == 3 return (data.length ^ data.location); #elif TYPE_ORDER == 4 diff --git a/Source/GSFileHandle.m b/Source/GSFileHandle.m index fd1c989c2..fe30db491 100644 --- a/Source/GSFileHandle.m +++ b/Source/GSFileHandle.m @@ -110,7 +110,7 @@ static NSString* NotificationKey = @"NSFileHandleNotificationKey"; * Encapsulates low level read operation to get data from the operating * system. */ -- (int) read: (void*)buf length: (int)len +- (NSInteger) read: (void*)buf length: (NSUInteger)len { #if USE_ZLIB if (gzDescriptor != 0) @@ -134,7 +134,7 @@ static NSString* NotificationKey = @"NSFileHandleNotificationKey"; * Encapsulates low level write operation to send data to the operating * system. */ -- (int) write: (const void*)buf length: (int)len +- (NSInteger) write: (const void*)buf length: (NSUInteger)len { #if USE_ZLIB if (gzDescriptor != 0) diff --git a/Source/GSPrivate.h b/Source/GSPrivate.h index f38c9e4ac..58f62627f 100644 --- a/Source/GSPrivate.h +++ b/Source/GSPrivate.h @@ -233,11 +233,11 @@ typedef enum { NSData *_d; // Only valid after initWithCoder: } - (const void*) bytes; -- (unsigned) count; +- (NSUInteger) count; - (void) encodeWithCoder: (NSCoder*)aCoder; - (id) initWithCoder: (NSCoder*)aCoder; -- (id) initWithObjCType: (const char*)t count: (int)c at: (const void*)a; -- (unsigned) size; +- (id) initWithObjCType: (const char*)t count: (NSInteger)c at: (const void*)a; +- (NSUInteger) size; - (const char*) type; @end @@ -508,9 +508,9 @@ GSPrivateUnloadModule(FILE *errorStream, unsigned size; void *buffer; } -+ (GSCodeBuffer*) memoryWithSize: (unsigned)_size; ++ (GSCodeBuffer*) memoryWithSize: (NSUInteger)_size; - (void*) buffer; -- (id) initWithSize: (unsigned)_size; +- (id) initWithSize: (NSUInteger)_size; - (void) protect; @end diff --git a/Source/GSSocketStream.h b/Source/GSSocketStream.h index 705eb6d90..1a757c1d6 100644 --- a/Source/GSSocketStream.h +++ b/Source/GSSocketStream.h @@ -90,8 +90,8 @@ SOCKIVARS * Set the socket addres from string information. */ - (BOOL) _setSocketAddress: (NSString*)address - port: (int)port - family: (int)family; + port: (NSInteger)port + family: (NSInteger)family; /* Return the socket */ @@ -110,15 +110,15 @@ SOCKIVARS @interface GSSocketInputStream (AddedBehaviors) - (struct sockaddr*) _address; - (void) _setAddress: (struct sockaddr*)address; -- (int) _read: (uint8_t *)buffer maxLength: (unsigned int)len; +- (NSInteger) _read: (uint8_t *)buffer maxLength: (NSUInteger)len; - (void) _setClosing: (BOOL)passive; - (void) _setHandler: (id)h; - (void) _setPassive: (BOOL)passive; - (void) _setSibling: (GSSocketStream*)sibling; - (void) _setSock: (SOCKET)sock; - (BOOL) _setSocketAddress: (NSString*)address - port: (int)port - family: (int)family; + port: (NSInteger)port + family: (NSInteger)family; - (SOCKET) _sock; @end @@ -127,7 +127,7 @@ SOCKIVARS /** * the designated initializer */ -- (id) initToAddr: (NSString*)addr port: (int)port; +- (id) initToAddr: (NSString*)addr port: (NSInteger)port; @end @@ -137,7 +137,7 @@ SOCKIVARS /** * the designated initializer */ -- (id) initToAddr: (NSString*)addr port: (int)port; +- (id) initToAddr: (NSString*)addr port: (NSInteger)port; @end @@ -158,10 +158,10 @@ SOCKIVARS - (void) _setSibling: (GSSocketStream*)sibling; - (void) _setSock: (SOCKET)sock; - (BOOL) _setSocketAddress: (NSString*)address - port: (int)port - family: (int)family; + port: (NSInteger)port + family: (NSInteger)family; - (SOCKET) _sock; -- (int) _write: (const uint8_t *)buffer maxLength: (unsigned int)len; +- (NSInteger) _write: (const uint8_t *)buffer maxLength: (NSUInteger)len; @end @interface GSInetOutputStream : GSSocketOutputStream @@ -169,7 +169,7 @@ SOCKIVARS /** * the designated initializer */ -- (id) initToAddr: (NSString*)addr port: (int)port; +- (id) initToAddr: (NSString*)addr port: (NSInteger)port; @end @@ -178,7 +178,7 @@ SOCKIVARS /** * the designated initializer */ -- (id) initToAddr: (NSString*)addr port: (int)port; +- (id) initToAddr: (NSString*)addr port: (NSInteger)port; @end @@ -214,8 +214,8 @@ SOCKIVARS - (void) _setSibling: (GSSocketStream*)sibling; - (void) _setSock: (SOCKET)sock; - (BOOL) _setSocketAddress: (NSString*)address - port: (int)port - family: (int)family; + port: (NSInteger)port + family: (NSInteger)family; - (SOCKET) _sock; @end diff --git a/Source/GSSocketStream.m b/Source/GSSocketStream.m index 3bf756d45..4482052cb 100644 --- a/Source/GSSocketStream.m +++ b/Source/GSSocketStream.m @@ -103,9 +103,9 @@ GSPrivateSockaddrLength(struct sockaddr *addr) - (void) bye; /* Close down the handled session. */ - (BOOL) handshake; /* A handshake/hello is in progress. */ - (void) hello; /* Start up the session handshake. */ -- (int) read: (uint8_t *)buffer maxLength: (unsigned int)len; +- (NSInteger) read: (uint8_t *)buffer maxLength: (NSUInteger)len; - (void) stream: (NSStream*)stream handleEvent: (NSStreamEvent)event; -- (int) write: (const uint8_t *)buffer maxLength: (unsigned int)len; +- (NSInteger) write: (const uint8_t *)buffer maxLength: (NSUInteger)len; @end @@ -150,7 +150,7 @@ GSPrivateSockaddrLength(struct sockaddr *addr) return ostream; } -- (int) read: (uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) read: (uint8_t *)buffer maxLength: (NSUInteger)len { [self subclassResponsibility: _cmd]; return 0; @@ -161,7 +161,7 @@ GSPrivateSockaddrLength(struct sockaddr *addr) [self subclassResponsibility: _cmd]; } -- (int) write: (const uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) write: (const uint8_t *)buffer maxLength: (NSUInteger)len { [self subclassResponsibility: _cmd]; return 0; @@ -524,7 +524,7 @@ static gnutls_anon_client_credentials_t anoncred; return ostream; } -- (int) read: (uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) read: (uint8_t *)buffer maxLength: (NSUInteger)len { return gnutls_record_recv (session, buffer, len); } @@ -576,7 +576,7 @@ static gnutls_anon_client_credentials_t anoncred; } } -- (int) write: (const uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) write: (const uint8_t *)buffer maxLength: (NSUInteger)len { return gnutls_record_send (session, buffer, len); } @@ -797,7 +797,7 @@ static NSString * const GSSOCKSAckConn = @"GSSOCKSAckConn"; address = [[NSString alloc] initWithUTF8String: (char*)inet_ntoa(addr->sin_addr)]; port = [[NSString alloc] initWithFormat: @"%d", - (int)GSSwapBigI16ToHost(addr->sin_port)]; + (NSInteger)GSSwapBigI16ToHost(addr->sin_port)]; /* Now reconfigure the streams so they will actually connect * to the socks proxy server. @@ -812,7 +812,7 @@ static NSString * const GSSOCKSAckConn = @"GSSOCKSAckConn"; return self; } -- (int) read: (uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) read: (uint8_t *)buffer maxLength: (NSUInteger)len { return [istream _read: buffer maxLength: len]; } @@ -1202,7 +1202,7 @@ static NSString * const GSSOCKSAckConn = @"GSSOCKSAckConn"; } } -- (int) write: (const uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) write: (const uint8_t *)buffer maxLength: (NSUInteger)len { return [ostream _write: buffer maxLength: len]; } @@ -1402,7 +1402,7 @@ setNonBlocking(SOCKET fd) return result; } -- (int) _read: (uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) _read: (uint8_t *)buffer maxLength: (NSUInteger)len { [self subclassResponsibility: _cmd]; return -1; @@ -1432,8 +1432,8 @@ setNonBlocking(SOCKET fd) } - (BOOL) _setSocketAddress: (NSString*)address - port: (int)port - family: (int)family + port: (NSInteger)port + family: (NSInteger)family { uint16_t p = (uint16_t)port; @@ -1578,7 +1578,7 @@ setNonBlocking(SOCKET fd) return _sock; } -- (int) _write: (const uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) _write: (const uint8_t *)buffer maxLength: (NSUInteger)len { [self subclassResponsibility: _cmd]; return -1; @@ -1745,7 +1745,7 @@ setNonBlocking(SOCKET fd) _sock = INVALID_SOCKET; } -- (int) read: (uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) read: (uint8_t *)buffer maxLength: (NSUInteger)len { if (buffer == 0) { @@ -1764,7 +1764,7 @@ setNonBlocking(SOCKET fd) return [_handler read: buffer maxLength: len]; } -- (int) _read: (uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) _read: (uint8_t *)buffer maxLength: (NSUInteger)len { int readLen; @@ -2010,7 +2010,7 @@ setNonBlocking(SOCKET fd) } } -- (int) _write: (const uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) _write: (const uint8_t *)buffer maxLength: (NSUInteger)len { int writeLen; @@ -2218,7 +2218,7 @@ setNonBlocking(SOCKET fd) _sock = INVALID_SOCKET; } -- (int) write: (const uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) write: (const uint8_t *)buffer maxLength: (NSUInteger)len { if (buffer == 0) { @@ -2599,7 +2599,7 @@ setNonBlocking(SOCKET fd) @implementation GSInetInputStream -- (id) initToAddr: (NSString*)addr port: (int)port +- (id) initToAddr: (NSString*)addr port: (NSInteger)port { if ((self = [super init]) != nil) { @@ -2616,7 +2616,7 @@ setNonBlocking(SOCKET fd) @implementation GSInet6InputStream #if defined(AF_INET6) -- (id) initToAddr: (NSString*)addr port: (int)port +- (id) initToAddr: (NSString*)addr port: (NSInteger)port { if ((self = [super init]) != nil) { @@ -2629,7 +2629,7 @@ setNonBlocking(SOCKET fd) } #else -- (id) initToAddr: (NSString*)addr port: (int)port +- (id) initToAddr: (NSString*)addr port: (NSInteger)port { RELEASE(self); return nil; @@ -2639,7 +2639,7 @@ setNonBlocking(SOCKET fd) @implementation GSInetOutputStream -- (id) initToAddr: (NSString*)addr port: (int)port +- (id) initToAddr: (NSString*)addr port: (NSInteger)port { if ((self = [super init]) != nil) { @@ -2656,7 +2656,7 @@ setNonBlocking(SOCKET fd) @implementation GSInet6OutputStream #if defined(AF_INET6) -- (id) initToAddr: (NSString*)addr port: (int)port +- (id) initToAddr: (NSString*)addr port: (NSInteger)port { if ((self = [super init]) != nil) { @@ -2669,7 +2669,7 @@ setNonBlocking(SOCKET fd) } #else -- (id) initToAddr: (NSString*)addr port: (int)port +- (id) initToAddr: (NSString*)addr port: (NSInteger)port { RELEASE(self); return nil; @@ -2689,7 +2689,7 @@ setNonBlocking(SOCKET fd) return [GSInetOutputStream class]; } -- (id) initToAddr: (NSString*)addr port: (int)port +- (id) initToAddr: (NSString*)addr port: (NSInteger)port { if ((self = [super init]) != nil) { @@ -2719,7 +2719,7 @@ setNonBlocking(SOCKET fd) return [GSInet6OutputStream class]; } -- (id) initToAddr: (NSString*)addr port: (int)port +- (id) initToAddr: (NSString*)addr port: (NSInteger)port { if ([super init] != nil) { @@ -2735,7 +2735,7 @@ setNonBlocking(SOCKET fd) return self; } #else -- (id) initToAddr: (NSString*)addr port: (int)port +- (id) initToAddr: (NSString*)addr port: (NSInteger)port { RELEASE(self); return nil; diff --git a/Source/GSStream.h b/Source/GSStream.h index a82e3b40c..54147e6af 100644 --- a/Source/GSStream.h +++ b/Source/GSStream.h @@ -114,7 +114,7 @@ IVARS /** Reset events in mask to allow them to be sent again. */ -- (void) _resetEvents: (int)mask; +- (void) _resetEvents: (NSUInteger)mask; /** * Place the stream in all the scheduled runloops. diff --git a/Source/GSStream.m b/Source/GSStream.m index f02a4981c..b0eb8fbec 100644 --- a/Source/GSStream.m +++ b/Source/GSStream.m @@ -347,7 +347,7 @@ static RunLoopEventType typeForStream(NSStream *aStream) return; } -- (void) _resetEvents: (int)mask +- (void) _resetEvents: (NSUInteger)mask { return; } @@ -408,7 +408,7 @@ static RunLoopEventType typeForStream(NSStream *aStream) _currentStatus = NSStreamStatusError; } -- (void) _resetEvents: (int)mask +- (void) _resetEvents: (NSUInteger)mask { _events &= ~mask; } @@ -708,7 +708,7 @@ static RunLoopEventType typeForStream(NSStream *aStream) [super dealloc]; } -- (int) read: (uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) read: (uint8_t *)buffer maxLength: (NSUInteger)len { unsigned long dataSize; unsigned long copySize; @@ -753,7 +753,7 @@ static RunLoopEventType typeForStream(NSStream *aStream) return copySize; } -- (BOOL) getBuffer: (uint8_t **)buffer length: (unsigned int *)len +- (BOOL) getBuffer: (uint8_t **)buffer length: (NSUInteger *)len { unsigned long dataSize = [_data length]; @@ -793,7 +793,7 @@ static RunLoopEventType typeForStream(NSStream *aStream) @implementation GSBufferOutputStream -- (id) initToBuffer: (uint8_t *)buffer capacity: (unsigned int)capacity +- (id) initToBuffer: (uint8_t *)buffer capacity: (NSUInteger)capacity { if ((self = [super init]) != nil) { @@ -804,7 +804,7 @@ static RunLoopEventType typeForStream(NSStream *aStream) return self; } -- (int) write: (const uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) write: (const uint8_t *)buffer maxLength: (NSUInteger)len { if (buffer == 0) { @@ -876,7 +876,7 @@ static RunLoopEventType typeForStream(NSStream *aStream) [super dealloc]; } -- (int) write: (const uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) write: (const uint8_t *)buffer maxLength: (NSUInteger)len { if (buffer == 0) { @@ -946,7 +946,7 @@ static RunLoopEventType typeForStream(NSStream *aStream) class_ivar_set_gcinvisible (self, "delegate", YES); } -+ (id) serverStreamToAddr: (NSString*)addr port: (int)port ++ (id) serverStreamToAddr: (NSString*)addr port: (NSInteger)port { GSServerStream *s; @@ -962,7 +962,7 @@ static RunLoopEventType typeForStream(NSStream *aStream) return AUTORELEASE([[GSLocalServerStream alloc] initToAddr: addr]); } -- (id) initToAddr: (NSString*)addr port: (int)port +- (id) initToAddr: (NSString*)addr port: (NSInteger)port { RELEASE(self); // try inet first, then inet6 diff --git a/Source/GSString.m b/Source/GSString.m index b8cd25207..91aa5b12a 100644 --- a/Source/GSString.m +++ b/Source/GSString.m @@ -343,7 +343,7 @@ static void getCString_u(GSStr self, char *buffer, unsigned int maxLength, return self; // placeholders never get released. } -- (unichar) characterAtIndex: (unsigned)index +- (unichar) characterAtIndex: (NSUInteger)index { [NSException raise: NSInternalInconsistencyException format: @"attempt to use uninitialised string"]; @@ -367,7 +367,7 @@ static void getCString_u(GSStr self, char *buffer, unsigned int maxLength, * Remove any BOM and perform byte swapping if required. */ static void -fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree, +fixBOM(unsigned char **bytes, NSUInteger*length, BOOL *shouldFree, NSStringEncoding encoding) { unsigned char *b = *bytes; @@ -459,7 +459,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree, } - (id) initWithBytes: (const void*)bytes - length: (unsigned int)length + length: (NSUInteger)length encoding: (NSStringEncoding)encoding { void *chars = 0; @@ -499,7 +499,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree, } - (id) initWithBytesNoCopy: (void*)bytes - length: (unsigned int)length + length: (NSUInteger)length encoding: (NSStringEncoding)encoding freeWhenDone: (BOOL)flag { @@ -656,7 +656,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree, } - (id) initWithCharacters: (const unichar*)chars - length: (unsigned)length + length: (NSUInteger)length { return [self initWithBytes: (const void*)chars length: length * sizeof(unichar) @@ -664,7 +664,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree, } - (id) initWithCharactersNoCopy: (unichar*)chars - length: (unsigned)length + length: (NSUInteger)length freeWhenDone: (BOOL)flag { return [self initWithBytesNoCopy: (void*)chars @@ -674,7 +674,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree, } - (id) initWithCString: (const char*)chars - length: (unsigned)length + length: (NSUInteger)length { return [self initWithBytes: (const void*)chars length: length @@ -682,7 +682,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree, } - (id) initWithCStringNoCopy: (char*)chars - length: (unsigned)length + length: (NSUInteger)length freeWhenDone: (BOOL)flag { return [self initWithBytesNoCopy: (void*)chars @@ -841,7 +841,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree, return (id)me; } -- (unsigned) length +- (NSUInteger) length { [NSException raise: NSInternalInconsistencyException format: @"attempt to use uninitialised string"]; @@ -2736,7 +2736,7 @@ transmute(GSStr self, NSString *aString) } - (id) initWithBytes: (const void*)chars - length: (unsigned int)length + length: (NSUInteger)length encoding: (NSStringEncoding)encoding { if (length > 0) @@ -2753,7 +2753,7 @@ transmute(GSStr self, NSString *aString) } - (id) initWithBytesNoCopy: (void*)chars - length: (unsigned int)length + length: (NSUInteger)length encoding: (NSStringEncoding)encoding freeWhenDone: (BOOL)flag { @@ -2767,7 +2767,7 @@ transmute(GSStr self, NSString *aString) } - (id) initWithCharacters: (const unichar*)chars - length: (unsigned int)length + length: (NSUInteger)length { return [self initWithBytes: chars length: length * sizeof(unichar) @@ -2775,7 +2775,7 @@ transmute(GSStr self, NSString *aString) } - (id) initWithCharactersNoCopy: (unichar*)chars - length: (unsigned int)length + length: (NSUInteger)length freeWhenDone: (BOOL)flag { return [self initWithBytesNoCopy: chars @@ -2800,7 +2800,7 @@ transmute(GSStr self, NSString *aString) } - (id) initWithCString: (const char*)chars - length: (unsigned int)length + length: (NSUInteger)length { return [self initWithBytes: chars length: length @@ -2808,7 +2808,7 @@ transmute(GSStr self, NSString *aString) } - (id) initWithCStringNoCopy: (char*)chars - length: (unsigned int)length + length: (NSUInteger)length freeWhenDone: (BOOL)flag { return [self initWithBytesNoCopy: chars @@ -2843,13 +2843,13 @@ transmute(GSStr self, NSString *aString) return canBeConvertedToEncoding_c((GSStr)self, enc); } -- (unichar) characterAtIndex: (unsigned int)index +- (unichar) characterAtIndex: (NSUInteger)index { return characterAtIndex_c((GSStr)self, index); } - (NSComparisonResult) compare: (NSString*)aString - options: (unsigned int)mask + options: (NSUInteger)mask range: (NSRange)aRange { GS_RANGE_CHECK(aRange, _count); @@ -2874,7 +2874,7 @@ transmute(GSStr self, NSString *aString) return cString_c((GSStr)self, encoding); } -- (unsigned int) cStringLength +- (NSUInteger) cStringLength { return cStringLength_c((GSStr)self, externalEncoding); } @@ -2937,20 +2937,20 @@ transmute(GSStr self, NSString *aString) } - (void) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength { getCString_c((GSStr)self, buffer, maxLength, (NSRange){0, _count}, 0); } - (BOOL) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength encoding: (NSStringEncoding)encoding { return getCStringE_c((GSStr)self, buffer, maxLength, encoding); } - (void) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength range: (NSRange)aRange remainingRange: (NSRange*)leftoverRange { @@ -2958,7 +2958,7 @@ transmute(GSStr self, NSString *aString) getCString_c((GSStr)self, buffer, maxLength, aRange, leftoverRange); } -- (unsigned) hash +- (NSUInteger) hash { if (self->_flags.hash == 0) { @@ -2967,7 +2967,7 @@ transmute(GSStr self, NSString *aString) return self->_flags.hash; } -- (int) intValue +- (NSInteger) intValue { return intValue_c((GSStr)self); } @@ -2982,12 +2982,12 @@ transmute(GSStr self, NSString *aString) return isEqual_c((GSStr)self, anObject); } -- (unsigned int) length +- (NSUInteger) length { return _count; } -- (unsigned int) lengthOfBytesUsingEncoding: (NSStringEncoding)encoding +- (NSUInteger) lengthOfBytesUsingEncoding: (NSStringEncoding)encoding { return cStringLength_c((GSStr)self, encoding); } @@ -3020,13 +3020,13 @@ transmute(GSStr self, NSString *aString) return obj; } -- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (unsigned)anIndex +- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (NSUInteger)anIndex { return rangeOfSequence_c((GSStr)self, anIndex); } - (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet - options: (unsigned)mask + options: (NSUInteger)mask range: (NSRange)aRange { GS_RANGE_CHECK(aRange, _count); @@ -3034,7 +3034,7 @@ transmute(GSStr self, NSString *aString) } - (NSRange) rangeOfString: (NSString*)aString - options: (unsigned)mask + options: (NSUInteger)mask range: (NSRange)aRange { GS_RANGE_CHECK(aRange, _count); @@ -3067,7 +3067,7 @@ transmute(GSStr self, NSString *aString) } // private method for Unicode level 3 implementation -- (int) _baseLength +- (NSInteger) _baseLength { return _count; } @@ -3173,13 +3173,13 @@ agree, create a new GSCInlineString otherwise. return canBeConvertedToEncoding_u((GSStr)self, enc); } -- (unichar) characterAtIndex: (unsigned int)index +- (unichar) characterAtIndex: (NSUInteger)index { return characterAtIndex_u((GSStr)self, index); } - (NSComparisonResult) compare: (NSString*)aString - options: (unsigned int)mask + options: (NSUInteger)mask range: (NSRange)aRange { GS_RANGE_CHECK(aRange, _count); @@ -3204,7 +3204,7 @@ agree, create a new GSCInlineString otherwise. return cString_u((GSStr)self, encoding); } -- (unsigned int) cStringLength +- (NSUInteger) cStringLength { return cStringLength_u((GSStr)self, externalEncoding); } @@ -3268,19 +3268,19 @@ agree, create a new GSCInlineString otherwise. } - (void) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength { getCString_u((GSStr)self, buffer, maxLength, (NSRange){0, _count}, 0); } - (BOOL) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength encoding: (NSStringEncoding)encoding { return getCStringE_u((GSStr)self, buffer, maxLength, encoding); } - (void) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength range: (NSRange)aRange remainingRange: (NSRange*)leftoverRange { @@ -3289,7 +3289,7 @@ agree, create a new GSCInlineString otherwise. getCString_u((GSStr)self, buffer, maxLength, aRange, leftoverRange); } -- (unsigned) hash +- (NSUInteger) hash { if (self->_flags.hash == 0) { @@ -3298,7 +3298,7 @@ agree, create a new GSCInlineString otherwise. return self->_flags.hash; } -- (int) intValue +- (NSInteger) intValue { return intValue_u((GSStr)self); } @@ -3313,12 +3313,12 @@ agree, create a new GSCInlineString otherwise. return isEqual_u((GSStr)self, anObject); } -- (unsigned int) length +- (NSUInteger) length { return _count; } -- (unsigned int) lengthOfBytesUsingEncoding: (NSStringEncoding)encoding +- (NSUInteger) lengthOfBytesUsingEncoding: (NSStringEncoding)encoding { return cStringLength_u((GSStr)self, encoding); } @@ -3351,13 +3351,13 @@ agree, create a new GSCInlineString otherwise. return obj; } -- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (unsigned)anIndex +- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (NSUInteger)anIndex { return rangeOfSequence_u((GSStr)self, anIndex); } - (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet - options: (unsigned)mask + options: (NSUInteger)mask range: (NSRange)aRange { GS_RANGE_CHECK(aRange, _count); @@ -3365,7 +3365,7 @@ agree, create a new GSCInlineString otherwise. } - (NSRange) rangeOfString: (NSString*)aString - options: (unsigned)mask + options: (NSUInteger)mask range: (NSRange)aRange { GS_RANGE_CHECK(aRange, _count); @@ -3398,7 +3398,7 @@ agree, create a new GSCInlineString otherwise. } // private method for Unicode level 3 implementation -- (int) _baseLength +- (NSInteger) _baseLength { unsigned int count = 0; unsigned int blen = 0; @@ -3571,7 +3571,7 @@ agree, create a new GSUnicodeInlineString otherwise. return canBeConvertedToEncoding_c((GSStr)self, enc); } -- (unichar) characterAtIndex: (unsigned int)index +- (unichar) characterAtIndex: (NSUInteger)index { if (_flags.wide == 1) return characterAtIndex_u((GSStr)self, index); @@ -3580,7 +3580,7 @@ agree, create a new GSUnicodeInlineString otherwise. } - (NSComparisonResult) compare: (NSString*)aString - options: (unsigned int)mask + options: (NSUInteger)mask range: (NSRange)aRange { GS_RANGE_CHECK(aRange, _count); @@ -3647,7 +3647,7 @@ agree, create a new GSUnicodeInlineString otherwise. return cString_c((GSStr)self, encoding); } -- (unsigned int) cStringLength +- (NSUInteger) cStringLength { if (_flags.wide == 1) return cStringLength_u((GSStr)self, externalEncoding); @@ -3773,7 +3773,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } - (void) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength { if (_flags.wide == 1) getCString_u((GSStr)self, buffer, maxLength, (NSRange){0, _count}, 0); @@ -3782,7 +3782,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } - (BOOL) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength encoding: (NSStringEncoding)encoding { if (_flags.wide == 1) @@ -3792,7 +3792,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } - (void) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength range: (NSRange)aRange remainingRange: (NSRange*)leftoverRange { @@ -3807,7 +3807,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } } -- (unsigned) hash +- (NSUInteger) hash { if (self->_flags.hash == 0) { @@ -3822,7 +3822,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } - (id) initWithBytes: (const void*)bytes - length: (unsigned int)length + length: (NSUInteger)length encoding: (NSStringEncoding)encoding { unsigned char *chars = 0; @@ -3978,7 +3978,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } - (id) initWithBytesNoCopy: (void*)bytes - length: (unsigned int)length + length: (NSUInteger)length encoding: (NSStringEncoding)encoding freeWhenDone: (BOOL)flag { @@ -3992,7 +3992,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); return self; } -- (id) initWithCapacity: (unsigned)capacity +- (id) initWithCapacity: (NSUInteger)capacity { if (capacity < 2) { @@ -4012,7 +4012,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } - (id) initWithCharactersNoCopy: (unichar*)chars - length: (unsigned int)length + length: (NSUInteger)length freeWhenDone: (BOOL)flag { return [self initWithBytesNoCopy: (void*)chars @@ -4022,7 +4022,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } - (id) initWithCStringNoCopy: (char*)chars - length: (unsigned int)length + length: (NSUInteger)length freeWhenDone: (BOOL)flag { return [self initWithBytesNoCopy: (void*)chars @@ -4061,7 +4061,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); return self; } -- (int) intValue +- (NSInteger) intValue { if (_flags.wide == 1) return intValue_u((GSStr)self); @@ -4085,12 +4085,12 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); return isEqual_c((GSStr)self, anObject); } -- (unsigned int) length +- (NSUInteger) length { return _count; } -- (unsigned int) lengthOfBytesUsingEncoding: (NSStringEncoding)encoding +- (NSUInteger) lengthOfBytesUsingEncoding: (NSStringEncoding)encoding { if (_flags.wide == 1) return cStringLength_u((GSStr)self, encoding); @@ -4161,7 +4161,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); return obj; } -- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (unsigned)anIndex +- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (NSUInteger)anIndex { if (_flags.wide == 1) return rangeOfSequence_u((GSStr)self, anIndex); @@ -4170,7 +4170,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } - (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet - options: (unsigned)mask + options: (NSUInteger)mask range: (NSRange)aRange { GS_RANGE_CHECK(aRange, _count); @@ -4181,7 +4181,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } - (NSRange) rangeOfString: (NSString*)aString - options: (unsigned)mask + options: (NSUInteger)mask range: (NSRange)aRange { GS_RANGE_CHECK(aRange, _count); @@ -4237,7 +4237,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } else if (offset > 0) { - makeHole((GSStr)self, NSMaxRange(aRange), (unsigned int)offset); + makeHole((GSStr)self, NSMaxRange(aRange), (NSUInteger)offset); } if (length > 0) @@ -4320,7 +4320,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); other = transmute((GSStr)self, aString); if (_count < len) { - makeHole((GSStr)self, _count, (unsigned int)(len - _count)); + makeHole((GSStr)self, _count, (NSUInteger)(len - _count)); } else { @@ -4466,7 +4466,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } // private method for Unicode level 3 implementation -- (int) _baseLength +- (NSInteger) _baseLength { if (_flags.wide == 1) { @@ -4503,13 +4503,13 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); return [_parent canBeConvertedToEncoding: enc]; } -- (unichar) characterAtIndex: (unsigned int)index +- (unichar) characterAtIndex: (NSUInteger)index { return [_parent characterAtIndex: index]; } - (NSComparisonResult) compare: (NSString*)aString - options: (unsigned int)mask + options: (NSUInteger)mask range: (NSRange)aRange { return [_parent compare: aString options: mask range: aRange]; @@ -4525,7 +4525,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); return [_parent cStringUsingEncoding]; } -- (unsigned int) cStringLength +- (NSUInteger) cStringLength { return [_parent cStringLength]; } @@ -4583,20 +4583,20 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } - (void) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength { [_parent getCString: buffer maxLength: maxLength]; } - (BOOL) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength encoding: (NSStringEncoding)encoding { return [_parent getCString: buffer maxLength: maxLength encoding: encoding]; } - (void) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength range: (NSRange)aRange remainingRange: (NSRange*)leftoverRange { @@ -4606,7 +4606,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); remainingRange: leftoverRange]; } -- (unsigned) hash +- (NSUInteger) hash { return [_parent hash]; } @@ -4627,12 +4627,12 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); return [_parent isEqualToString: anObject]; } -- (unsigned int) length +- (NSUInteger) length { return [_parent length]; } -- (unsigned int) lengthOfBytesUsingEncoding +- (NSUInteger) lengthOfBytesUsingEncoding { return [_parent lengthOfBytesUsingEncoding]; } @@ -4642,18 +4642,18 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); return [_parent lossyCString]; } -- (unsigned int) maximumLengthOfBytesUsingEncoding +- (NSUInteger) maximumLengthOfBytesUsingEncoding { return [_parent maximumLengthOfBytesUsingEncoding]; } -- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (unsigned)anIndex +- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (NSUInteger)anIndex { return [_parent rangeOfComposedCharacterSequenceAtIndex: anIndex]; } - (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet - options: (unsigned)mask + options: (NSUInteger)mask range: (NSRange)aRange { GS_RANGE_CHECK(aRange, ((GSStr)_parent)->_count); @@ -4661,7 +4661,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } - (NSRange) rangeOfString: (NSString*)aString - options: (unsigned)mask + options: (NSUInteger)mask range: (NSRange)aRange { GS_RANGE_CHECK(aRange, ((GSStr)_parent)->_count); @@ -4699,7 +4699,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); return canBeConvertedToEncoding_c((GSStr)_parent, enc); } -- (unichar) characterAtIndex: (unsigned int)index +- (unichar) characterAtIndex: (NSUInteger)index { if (((GSStr)_parent)->_flags.wide == 1) return characterAtIndex_u((GSStr)_parent, index); @@ -4708,7 +4708,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } - (NSComparisonResult) compare: (NSString*)aString - options: (unsigned int)mask + options: (NSUInteger)mask range: (NSRange)aRange { GS_RANGE_CHECK(aRange, ((GSStr)_parent)->_count); @@ -4742,7 +4742,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); return cString_c((GSStr)_parent, encoding); } -- (unsigned int) cStringLength +- (NSUInteger) cStringLength { if (((GSStr)_parent)->_flags.wide == 1) return cStringLength_u((GSStr)_parent, externalEncoding); @@ -4799,7 +4799,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } } -- (unsigned) hash +- (NSUInteger) hash { if (((GSStr)_parent)->_flags.hash == 0) { @@ -4824,12 +4824,12 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); return isEqual_c((GSStr)_parent, anObject); } -- (unsigned int) length +- (NSUInteger) length { return ((GSStr)_parent)->_count; } -- (unsigned int) lengthOfBytesUsingEncoding: (NSStringEncoding)encoding +- (NSUInteger) lengthOfBytesUsingEncoding: (NSStringEncoding)encoding { if (((GSStr)_parent)->_flags.wide == 1) return cStringLength_u((GSStr)_parent, encoding); @@ -4845,12 +4845,12 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); return lossyCString_c((GSStr)_parent); } -- (unsigned int) maximumLengthOfBytesUsingEncoding +- (NSUInteger) maximumLengthOfBytesUsingEncoding { return [_parent maximumLengthOfBytesUsingEncoding]; } -- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (unsigned)anIndex +- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (NSUInteger)anIndex { if (((GSStr)_parent)->_flags.wide == 1) return rangeOfSequence_u((GSStr)_parent, anIndex); @@ -4859,7 +4859,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } - (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet - options: (unsigned)mask + options: (NSUInteger)mask range: (NSRange)aRange { GS_RANGE_CHECK(aRange, ((GSStr)_parent)->_count); @@ -4870,7 +4870,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } - (NSRange) rangeOfString: (NSString*)aString - options: (unsigned)mask + options: (NSUInteger)mask range: (NSRange)aRange { GS_RANGE_CHECK(aRange, ((GSStr)_parent)->_count); @@ -4930,7 +4930,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); #define _self ((GSStr)self) - (id) initWithBytes: (const void*)bytes - length: (unsigned int)length + length: (NSUInteger)length encoding: (NSStringEncoding)encoding { [NSException raise: NSGenericException @@ -4939,7 +4939,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); } - (id) initWithBytesNoCopy: (void*)bytes - length: (unsigned int)length + length: (NSUInteger)length encoding: (NSStringEncoding)encoding freeWhenDone: (BOOL)flag { @@ -4998,7 +4998,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException); * Return a 28-bit hash value for the string contents - this * MUST match the algorithm used by the NSString base class. */ -- (unsigned) hash +- (NSUInteger) hash { unsigned ret = 0; unsigned len = _self->_count; diff --git a/Source/GSURLPrivate.h b/Source/GSURLPrivate.h index 386bef504..b9b037886 100644 --- a/Source/GSURLPrivate.h +++ b/Source/GSURLPrivate.h @@ -65,7 +65,7 @@ @interface NSURLResponse (Private) - (void) _setHeaders: (id)headers; -- (void) _setStatusCode: (int)code text: (NSString*)text; +- (void) _setStatusCode: (NSInteger)code text: (NSString*)text; - (void) _setValue: (NSString *)value forHTTPHeaderField: (NSString *)field; - (NSString*) _valueForHTTPHeaderField: (NSString*)field; @end diff --git a/Source/NSAffineTransform.m b/Source/NSAffineTransform.m index 59a97edd5..2fcc6b362 100644 --- a/Source/NSAffineTransform.m +++ b/Source/NSAffineTransform.m @@ -55,7 +55,7 @@ */ -static const float pi = 3.1415926535897932384626434; +static const CGFloat pi = 3.1415926535897932384626434; #if 0 #define valid(o) NSAssert((o->_isIdentity && o->A==1.0 && o->B==0.0 && o->C==0.0 && o->D==1.0) || (o->_isFlipY && o->A==1.0 && o->B==0.0 && o->C==0.0 && o->D==-1.0) || !(o->_isIdentity||o->_isFlipY), NSInternalInconsistencyException) @@ -227,8 +227,8 @@ static NSAffineTransformStruct identityTransform = { */ - (void) invert { - float newA, newB, newC, newD, newTX, newTY; - float det; + CGFloat newA, newB, newC, newD, newTX, newTY; + CGFloat det; if (_isIdentity) { @@ -345,7 +345,7 @@ static NSAffineTransformStruct identityTransform = { * with the transformation matrix of the receiver are rotated counter-clockwise * by the number of degrees specified by angle. */ -- (void) rotateByDegrees: (float)angle +- (void) rotateByDegrees: (CGFloat)angle { [self rotateByRadians: pi * angle / 180]; } @@ -355,12 +355,12 @@ static NSAffineTransformStruct identityTransform = { * with the transformation matrix of the receiver are rotated counter-clockwise * by the number of radians specified by angle. */ -- (void) rotateByRadians: (float)angleRad +- (void) rotateByRadians: (CGFloat)angleRad { if (angleRad != 0.0) { - float sine; - float cosine; + CGFloat sine; + CGFloat cosine; NSAffineTransformStruct rotm; sine = sin (angleRad); @@ -381,7 +381,7 @@ static NSAffineTransformStruct identityTransform = { * Scales the transformation matrix of the reciever by the factor specified * by scale. */ -- (void) scaleBy: (float)scale +- (void) scaleBy: (CGFloat)scale { NSAffineTransformStruct scam = identityTransform; @@ -397,7 +397,7 @@ static NSAffineTransformStruct identityTransform = { * Scales the X axis of the receiver's transformation matrix * by scaleX and the Y axis of the transformation matrix by scaleY. */ -- (void) scaleXBy: (float)scaleX yBy: (float)scaleY +- (void) scaleXBy: (CGFloat)scaleX yBy: (CGFloat)scaleY { if (_isIdentity && scaleX == 1.0) { @@ -537,7 +537,7 @@ static NSAffineTransformStruct identityTransform = { * Points transformed by the reciever's matrix after this operation will * be shifted in position based on the specified translation. */ -- (void) translateXBy: (float)tranX yBy: (float)tranY +- (void) translateXBy: (CGFloat)tranX yBy: (CGFloat)tranY { if (_isIdentity) { @@ -579,9 +579,9 @@ static NSAffineTransformStruct identityTransform = { { NSAffineTransformStruct replace; - [aCoder decodeArrayOfObjCType: @encode(float) + [aCoder decodeArrayOfObjCType: @encode(CGFloat) count: 6 - at: (float*)&replace]; + at: (CGFloat*)&replace]; [self setTransformStruct: replace]; return self; } @@ -591,9 +591,9 @@ static NSAffineTransformStruct identityTransform = { NSAffineTransformStruct replace; replace = [self transformStruct]; - [aCoder encodeArrayOfObjCType: @encode(float) + [aCoder encodeArrayOfObjCType: @encode(CGFloat) count: 6 - at: (float*)&replace]; + at: (CGFloat*)&replace]; } @end /* NSAffineTransform */ diff --git a/Source/NSArchiver.m b/Source/NSArchiver.m index 147d50f06..56c794b4a 100644 --- a/Source/NSArchiver.m +++ b/Source/NSArchiver.m @@ -237,9 +237,10 @@ static Class NSMutableDataMallocClass; } - (void) encodeArrayOfObjCType: (const char*)type - count: (unsigned)count + count: (NSUInteger)count at: (const void*)buf { + unsigned c = count; unsigned i; unsigned offset = 0; unsigned size = objc_sizeof_type(type); @@ -272,9 +273,9 @@ static Class NSMutableDataMallocClass; if (_initialPass == NO) { (*_tagImp)(_dst, tagSel, _GSC_ARY_B); - (*_serImp)(_dst, serSel, &count, @encode(unsigned), nil); + (*_serImp)(_dst, serSel, &c, @encode(unsigned), nil); } - for (i = 0; i < count; i++) + for (i = 0; i < c; i++) { (*_eValImp)(self, eValSel, type, (char*)buf + offset); offset += size; @@ -283,10 +284,10 @@ static Class NSMutableDataMallocClass; else if (_initialPass == NO) { (*_tagImp)(_dst, tagSel, _GSC_ARY_B); - (*_serImp)(_dst, serSel, &count, @encode(unsigned), nil); + (*_serImp)(_dst, serSel, &c, @encode(unsigned), nil); (*_tagImp)(_dst, tagSel, info); - for (i = 0; i < count; i++) + for (i = 0; i < c; i++) { (*_serImp)(_dst, serSel, (char*)buf + offset, type, nil); offset += size; @@ -305,7 +306,7 @@ static Class NSMutableDataMallocClass; case _C_ARY_B: { - int count = atoi(++type); + unsigned count = atoi(++type); while (isdigit(*type)) { diff --git a/Source/NSArray.m b/Source/NSArray.m index 3688506b6..f92dd427a 100644 --- a/Source/NSArray.m +++ b/Source/NSArray.m @@ -269,7 +269,7 @@ static SEL rlSel; * Returns an autoreleased array containing the specified * objects, preserving order. */ -+ (id) arrayWithObjects: (id*)objects count: (unsigned)count ++ (id) arrayWithObjects: (id*)objects count: (NSUInteger)count { return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()] initWithObjects: objects count: count]); @@ -380,7 +380,7 @@ static SEL rlSel; /** * Returns the number of elements contained in the receiver. */ -- (unsigned) count +- (NSUInteger) count { [self subclassResponsibility: _cmd]; return 0; @@ -467,7 +467,7 @@ static SEL rlSel; /** * Returns the same value as -count */ -- (unsigned) hash +- (NSUInteger) hash { return [self count]; } @@ -476,7 +476,7 @@ static SEL rlSel; * Returns the index of the specified object in the receiver, or * NSNotFound if the object is not present. */ -- (unsigned) indexOfObjectIdenticalTo: (id)anObject +- (NSUInteger) indexOfObjectIdenticalTo: (id)anObject { unsigned c = [self count]; @@ -496,7 +496,7 @@ static SEL rlSel; * Returns the index of the specified object in the range of the receiver, * or NSNotFound if the object is not present. */ -- (unsigned) indexOfObjectIdenticalTo: anObject inRange: (NSRange)aRange +- (NSUInteger) indexOfObjectIdenticalTo: anObject inRange: (NSRange)aRange { unsigned i, e = aRange.location + aRange.length, c = [self count]; IMP get = [self methodForSelector: oaiSel]; @@ -514,7 +514,7 @@ static SEL rlSel; * which is equal to anObject (using anObject's [NSObject-isEqual:] method). * Returns NSNotFound on failure. */ -- (unsigned) indexOfObject: (id)anObject +- (NSUInteger) indexOfObject: (id)anObject { unsigned c = [self count]; @@ -537,7 +537,7 @@ static SEL rlSel; * which is equal to anObject (using anObject's [NSObject-isEqual:] method). * Returns NSNotFound on failure. */ -- (unsigned) indexOfObject: (id)anObject inRange: (NSRange)aRange +- (NSUInteger) indexOfObject: (id)anObject inRange: (NSRange)aRange { unsigned i, e = aRange.location + aRange.length, c = [self count]; IMP get = [self methodForSelector: oaiSel]; @@ -835,7 +835,7 @@ static SEL rlSel; * and needs to be re-implemented in subclasses in order to have all * other initialisers work. */ -- (id) initWithObjects: (id*)objects count: (unsigned)count +- (id) initWithObjects: (id*)objects count: (NSUInteger)count { self = [self init]; return self; @@ -870,7 +870,7 @@ static SEL rlSel; * Returns the object at the specified index. * Raises an exception of the index is beyond the array. */ -- (id) objectAtIndex: (unsigned)index +- (id) objectAtIndex: (NSUInteger)index { [self subclassResponsibility: _cmd]; return nil; @@ -1224,7 +1224,7 @@ compare(id elem1, id elem2, void* context) * they appear in the receiver. */ - (NSString*) descriptionWithLocale: (NSDictionary*)locale - indent: (unsigned int)level + indent: (NSUInteger)level { NSString *result = nil; @@ -1633,7 +1633,7 @@ compare(id elem1, id elem2, void* context) * and needs to be re-implemented in subclasses in order to have all * other initialisers work. */ -- (id) initWithCapacity: (unsigned)numItems +- (id) initWithCapacity: (NSUInteger)numItems { self = [self init]; return self; @@ -1652,8 +1652,8 @@ compare(id elem1, id elem2, void* context) * Swaps the positions of two objects in the array. Raises an exception * if either array index is out of bounds. */ -- (void) exchangeObjectAtIndex: (unsigned int)i1 - withObjectAtIndex: (unsigned int)i2 +- (void) exchangeObjectAtIndex: (NSUInteger)i1 + withObjectAtIndex: (NSUInteger)i2 { id tmp = [self objectAtIndex: i1]; @@ -1668,7 +1668,7 @@ compare(id elem1, id elem2, void* context) * Raises an exception if given an array index which is too large.
* The object is retained by the array. */ -- (void) replaceObjectAtIndex: (unsigned)index withObject: (id)anObject +- (void) replaceObjectAtIndex: (NSUInteger)index withObject: (id)anObject { [self subclassResponsibility: _cmd]; } @@ -1727,7 +1727,7 @@ compare(id elem1, id elem2, void* context) * The size of the array increases by one.
* The object is retained by the array. */ -- (void) insertObject: anObject atIndex: (unsigned)index +- (void) insertObject: anObject atIndex: (NSUInteger)index { [self subclassResponsibility: _cmd]; } @@ -1756,7 +1756,7 @@ compare(id elem1, id elem2, void* context) * The size of the array decreases by one.
* Raises an exception if given an array index which is too large.
*/ -- (void) removeObjectAtIndex: (unsigned)index +- (void) removeObjectAtIndex: (NSUInteger)index { [self subclassResponsibility: _cmd]; } @@ -1765,7 +1765,7 @@ compare(id elem1, id elem2, void* context) * Creates an autoreleased mutable array able to store at least numItems. * See the -initWithCapacity: method. */ -+ (id) arrayWithCapacity: (unsigned)numItems ++ (id) arrayWithCapacity: (NSUInteger)numItems { return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()] initWithCapacity: numItems]); @@ -1774,7 +1774,7 @@ compare(id elem1, id elem2, void* context) /** * Override our superclass's designated initializer to go our's */ -- (id) initWithObjects: (id*)objects count: (unsigned)count +- (id) initWithObjects: (id*)objects count: (NSUInteger)count { self = [self initWithCapacity: count]; if (count > 0) @@ -2037,8 +2037,8 @@ compare(id elem1, id elem2, void* context) */ - (void) removeObjectsAtIndexes: (NSIndexSet *)indexes { - unsigned count = [indexes count]; - unsigned indexArray[count]; + NSUInteger count = [indexes count]; + NSUInteger indexArray[count]; [indexes getIndexes: indexArray maxCount: count @@ -2054,15 +2054,15 @@ compare(id elem1, id elem2, void* context) * removed in such a way that the removal is safe irrespective * of the order in which they are specified in the indices array. */ -- (void) removeObjectsFromIndices: (unsigned*)indices - numIndices: (unsigned)count +- (void) removeObjectsFromIndices: (NSUInteger*)indices + numIndices: (NSUInteger)count { if (count > 0) { unsigned to = 0; unsigned from = 0; unsigned i; - GS_BEGINITEMBUF(sorted, count, unsigned int); + GS_BEGINITEMBUF(sorted, count, NSUInteger); while (from < count) { diff --git a/Source/NSAssertionHandler.m b/Source/NSAssertionHandler.m index 04dfd8cee..5a1162d8d 100644 --- a/Source/NSAssertionHandler.m +++ b/Source/NSAssertionHandler.m @@ -89,7 +89,7 @@ static NSString *dict_key = @"NSAssertionHandler"; */ - (void) handleFailureInFunction: (NSString*)functionName file: (NSString*)fileName - lineNumber: (int)line + lineNumber: (NSInteger)line description: (NSString*)format,... { id message; @@ -116,7 +116,7 @@ static NSString *dict_key = @"NSAssertionHandler"; - (void) handleFailureInMethod: (SEL) aSelector object: object file: (NSString *) fileName - lineNumber: (int) line + lineNumber: (NSInteger) line description: (NSString *) format,... { id message; diff --git a/Source/NSAttributedString.m b/Source/NSAttributedString.m index 6c0b16f99..52474f70e 100644 --- a/Source/NSAttributedString.m +++ b/Source/NSAttributedString.m @@ -163,7 +163,7 @@ static Class GSMutableAttributedStringClass; { attrs = [self attributesAtIndex: index effectiveRange: &r]; index = NSMaxRange(r); - [aCoder encodeValueOfObjCType: @encode(unsigned int) at: &index]; + [aCoder encodeValueOfObjCType: @encode(unsigned) at: &index]; [aCoder encodeObject: attrs]; } } @@ -191,7 +191,7 @@ static Class GSMutableAttributedStringClass; unsigned index; NSDictionary *attrs; - [aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &index]; + [aDecoder decodeValueOfObjCType: @encode(unsigned) at: &index]; attrs = [aDecoder decodeObject]; if (index == length) { @@ -208,7 +208,7 @@ static Class GSMutableAttributedStringClass; [m setAttributes: attrs range: r]; while (index < length) { - [aDecoder decodeValueOfObjCType: @encode(unsigned int) + [aDecoder decodeValueOfObjCType: @encode(unsigned) at: &index]; attrs = [aDecoder decodeObject]; r = NSMakeRange(last, index - last); @@ -306,7 +306,7 @@ static Class GSMutableAttributedStringClass; /** * Return length of the underlying string. */ -- (unsigned int) length +- (NSUInteger) length { return [[self string] length]; } @@ -327,7 +327,7 @@ static Class GSMutableAttributedStringClass; * and values still hold. This may not be the maximum range, depending * on the implementation. */ -- (NSDictionary*) attributesAtIndex: (unsigned int)index +- (NSDictionary*) attributesAtIndex: (NSUInteger)index effectiveRange: (NSRange*)aRange { [self subclassResponsibility: _cmd];/* Primitive method! */ @@ -339,7 +339,7 @@ static Class GSMutableAttributedStringClass; * is non-nil, this gets filled with the range over which the attribute-value * set is the same as at index, clipped to rangeLimit. */ -- (NSDictionary*) attributesAtIndex: (unsigned int)index +- (NSDictionary*) attributesAtIndex: (NSUInteger)index longestEffectiveRange: (NSRange*)aRange inRange: (NSRange)rangeLimit { @@ -394,7 +394,7 @@ static Class GSMutableAttributedStringClass; * may not be the maximum range, depending on the implementation. */ - (id) attribute: (NSString*)attributeName - atIndex: (unsigned int)index + atIndex: (NSUInteger)index effectiveRange: (NSRange*)aRange { NSDictionary *tmpDictionary; @@ -424,7 +424,7 @@ static Class GSMutableAttributedStringClass; * applies, clipped to rangeLimit. */ - (id) attribute: (NSString*)attributeName - atIndex: (unsigned int)index + atIndex: (NSUInteger)index longestEffectiveRange: (NSRange*)aRange inRange: (NSRange)rangeLimit { @@ -639,7 +639,7 @@ static Class GSMutableAttributedStringClass; unsigned index; NSDictionary *attrs; - [aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &index]; + [aDecoder decodeValueOfObjCType: @encode(unsigned) at: &index]; attrs = [aDecoder decodeObject]; if (index == length) { @@ -654,7 +654,7 @@ static Class GSMutableAttributedStringClass; [self setAttributes: attrs range: r]; while (index < length) { - [aDecoder decodeValueOfObjCType: @encode(unsigned int) + [aDecoder decodeValueOfObjCType: @encode(unsigned) at: &index]; attrs = [aDecoder decodeObject]; r = NSMakeRange(last, index - last); @@ -865,7 +865,7 @@ static Class GSMutableAttributedStringClass; * Inserts attributed string within this one, preserving attributes. */ - (void) insertAttributedString: (NSAttributedString*)attributedString - atIndex: (unsigned int)index + atIndex: (NSUInteger)index { [self replaceCharactersInRange: NSMakeRange(index,0) withAttributedString: attributedString]; @@ -979,12 +979,12 @@ static Class GSMutableAttributedStringClass; GSNOSUPERDEALLOC; } -- (unsigned int) length +- (NSUInteger) length { return [[_owner string] length]; } -- (unichar) characterAtIndex: (unsigned int)index +- (unichar) characterAtIndex: (NSUInteger)index { return [[_owner string] characterAtIndex: index]; } @@ -1004,7 +1004,7 @@ static Class GSMutableAttributedStringClass; return [[_owner string] cString]; } -- (unsigned int) cStringLength +- (NSUInteger) cStringLength { return [[_owner string] cStringLength]; } @@ -1019,7 +1019,7 @@ static Class GSMutableAttributedStringClass; return [[_owner string] smallestEncoding]; } -- (int) _baseLength +- (NSInteger) _baseLength { return [[_owner string] _baseLength]; } diff --git a/Source/NSCalendarDate.m b/Source/NSCalendarDate.m index fc9a6de37..a80dda492 100644 --- a/Source/NSCalendarDate.m +++ b/Source/NSCalendarDate.m @@ -148,8 +148,8 @@ abbrev(NSTimeZone *tz, NSDate *d) } } -static inline unsigned int -lastDayOfGregorianMonth(unsigned month, unsigned year) +static inline NSUInteger +lastDayOfGregorianMonth(NSUInteger month, NSUInteger year) { switch (month) { @@ -167,8 +167,8 @@ lastDayOfGregorianMonth(unsigned month, unsigned year) } } -static inline unsigned -absoluteGregorianDay(unsigned day, unsigned month, unsigned year) +static inline NSUInteger +absoluteGregorianDay(NSUInteger day, NSUInteger month, NSUInteger year) { if (month > 1) { @@ -198,12 +198,12 @@ dayOfCommonEra(NSTimeInterval when) when /= 86400.0; // Offset by Gregorian reference when += GREGORIAN_REFERENCE; - r = (int)when; + r = (NSInteger)when; return r; } static void -gregorianDateFromAbsolute(int abs, int *day, int *month, int *year) +gregorianDateFromAbsolute(NSInteger abs, int *day, int *month, int *year) { // Search forward year by year from approximate year *year = abs/366; @@ -259,7 +259,7 @@ GSBreakTime(NSTimeInterval when, int *year, int *month, int *day, // Offset by Gregorian reference a += GREGORIAN_REFERENCE; // result is the day of common era. - dayOfEra = (int)a; + dayOfEra = (NSInteger)a; // Calculate year, month, and day gregorianDateFromAbsolute(dayOfEra, day, month, year); @@ -269,17 +269,17 @@ GSBreakTime(NSTimeInterval when, int *year, int *month, int *day, d *= 86400; a = abs(d - when); b = a / 3600; - *hour = (int)b; + *hour = (NSInteger)b; h = *hour; h = h * 3600; b = a - h; b = b / 60; - *minute = (int)b; + *minute = (NSInteger)b; m = *minute; m = m * 60; c = a - h - m; - *second = (int)c; - *mil = (int)((a - h - m - c) * 1000.0 + 0.5); + *second = (NSInteger)c; + *mil = (NSInteger)((a - h - m - c) * 1000.0 + 0.5); } /** @@ -391,12 +391,12 @@ GSTimeNow(void) * Creates and returns an NSCalendarDate from the specified values * by calling -initWithYear:month:day:hour:minute:second:timeZone: */ -+ (id) dateWithYear: (int)year - month: (unsigned int)month - day: (unsigned int)day - hour: (unsigned int)hour - minute: (unsigned int)minute - second: (unsigned int)second ++ (id) dateWithYear: (NSInteger)year + month: (NSUInteger)month + day: (NSUInteger)day + hour: (NSUInteger)hour + minute: (NSUInteger)minute + second: (NSUInteger)second timeZone: (NSTimeZone *)aTimeZone { NSCalendarDate *d = [[self alloc] initWithYear: year @@ -769,14 +769,14 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error) [fd setLength: (formatLen + sLen - 2) * sizeof(unichar)]; format = (unichar*)[fd mutableBytes]; - for (i = formatLen-1; i > (int)pos; i--) + for (i = formatLen-1; i > (NSInteger)pos; i--) { format[i+sLen-2] = format[i]; } } else { - for (i = pos+1; i < (int)formatLen; i++) + for (i = pos+1; i < (NSInteger)formatLen; i++) { format[i+sLen-2] = format[i]; } @@ -1422,12 +1422,12 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error) * * */ -- (id) initWithYear: (int)year - month: (unsigned int)month - day: (unsigned int)day - hour: (unsigned int)hour - minute: (unsigned int)minute - second: (unsigned int)second +- (id) initWithYear: (NSInteger)year + month: (NSUInteger)month + day: (NSUInteger)day + hour: (NSUInteger)hour + minute: (NSUInteger)minute + second: (NSUInteger)second timeZone: (NSTimeZone *)aTimeZone { unsigned int c; @@ -1533,7 +1533,7 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error) * Return the day number (ie number of days since the start of) in the * 'common' era of the receiving date. The era starts at 1 A.D. */ -- (int) dayOfCommonEra +- (NSInteger) dayOfCommonEra { NSTimeInterval when; @@ -1544,7 +1544,7 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error) /** * Return the month (1 to 31) of the receiving date. */ -- (int) dayOfMonth +- (NSInteger) dayOfMonth { int m, d, y; NSTimeInterval when; @@ -1567,7 +1567,7 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error) * 6 is saturday * */ -- (int) dayOfWeek +- (NSInteger) dayOfWeek { int d; NSTimeInterval when; @@ -1588,7 +1588,7 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error) /** * Return the day of the year (1 to 366) of the receiving date. */ -- (int) dayOfYear +- (NSInteger) dayOfYear { int m, d, y, days, i; NSTimeInterval when; @@ -1605,7 +1605,7 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error) /** * Return the hour of the day (0 to 23) of the receiving date. */ -- (int) hourOfDay +- (NSInteger) hourOfDay { int h; double a, d; @@ -1617,7 +1617,7 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error) d *= 86400; a = abs(d - (_seconds_since_ref + offset(_time_zone, self))); a = a / 3600; - h = (int)a; + h = (NSInteger)a; // There is a small chance of getting // it right at the stroke of midnight @@ -1630,7 +1630,7 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error) /** * Return the minute of the hour (0 to 59) of the receiving date. */ -- (int) minuteOfHour +- (NSInteger) minuteOfHour { int h, m; double a, b, d; @@ -1642,11 +1642,11 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error) d *= 86400; a = abs(d - (_seconds_since_ref + offset(_time_zone, self))); b = a / 3600; - h = (int)b; + h = (NSInteger)b; h = h * 3600; b = a - h; b = b / 60; - m = (int)b; + m = (NSInteger)b; return m; } @@ -1654,7 +1654,7 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error) /** * Return the month of the year (1 to 12) of the receiving date. */ -- (int) monthOfYear +- (NSInteger) monthOfYear { int m, d, y; NSTimeInterval when; @@ -1668,7 +1668,7 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error) /** * Return the second of the minute (0 to 59) of the receiving date. */ -- (int) secondOfMinute +- (NSInteger) secondOfMinute { int h, m, s; double a, b, c, d; @@ -1680,14 +1680,14 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error) d *= 86400; a = abs(d - (_seconds_since_ref + offset(_time_zone, self))); b = a / 3600; - h = (int)b; + h = (NSInteger)b; h = h * 3600; b = a - h; b = b / 60; - m = (int)b; + m = (NSInteger)b; m = m * 60; c = a - h - m; - s = (int)c; + s = (NSInteger)c; return s; } @@ -1696,7 +1696,7 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error) * Return the year of the 'common' era of the receiving date. * The era starts at 1 A.D. */ -- (int) yearOfCommonEra +- (NSInteger) yearOfCommonEra { int m, d, y; NSTimeInterval when; @@ -1712,12 +1712,12 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error) * Its use is deprecated ... it simply calls * -dateByAddingYears:months:days:hours:minutes:seconds: */ -- (NSCalendarDate*) addYear: (int)year - month: (int)month - day: (int)day - hour: (int)hour - minute: (int)minute - second: (int)second +- (NSCalendarDate*) addYear: (NSInteger)year + month: (NSInteger)month + day: (NSInteger)day + hour: (NSInteger)hour + minute: (NSInteger)minute + second: (NSInteger)second { return [self dateByAddingYears: year months: month @@ -1989,7 +1989,7 @@ static void Grow(DescriptionInfo *info, unsigned size) s = fabs(s); s -= floor(s); s *= 1000.0; - v = (int)(s + 0.5); + v = (NSInteger)(s + 0.5); } Grow(info, 3); info->t[info->offset+2] = (v%10) + '0'; @@ -2402,7 +2402,7 @@ static void Grow(DescriptionInfo *info, unsigned size) /** * Returns the number of the last day of the month in the specified year. */ -- (int) lastDayOfGregorianMonth: (int)month year: (int)year +- (NSInteger) lastDayOfGregorianMonth: (NSInteger)month year: (NSInteger)year { return lastDayOfGregorianMonth(month, year); } @@ -2411,7 +2411,9 @@ static void Grow(DescriptionInfo *info, unsigned size) * Returns the number of days since the start of the era for the specified * day, month, and year. */ -- (int) absoluteGregorianDay: (int)day month: (int)month year: (int)year +- (NSInteger) absoluteGregorianDay: (NSInteger)day + month: (NSInteger)month + year: (NSInteger)year { return absoluteGregorianDay(day, month, year); } @@ -2420,12 +2422,17 @@ static void Grow(DescriptionInfo *info, unsigned size) * Given a day number since the start of the era, returns the date as a * day, month, and year. */ -- (void) gregorianDateFromAbsolute: (int)d - day: (int *)day - month: (int *)month - year: (int *)year +- (void) gregorianDateFromAbsolute: (NSInteger)d + day: (NSInteger *)day + month: (NSInteger *)month + year: (NSInteger *)year { - gregorianDateFromAbsolute(d, day, month, year); + int dd, mm, yy; + + gregorianDateFromAbsolute(d, &dd, &mm, &yy); + *day = dd; + *month = mm; + *year = yy; } @end @@ -2446,12 +2453,12 @@ static void Grow(DescriptionInfo *info, unsigned size) * savings time changes so that it preserves expected clock time. *

*/ -- (NSCalendarDate*) dateByAddingYears: (int)years - months: (int)months - days: (int)days - hours: (int)hours - minutes: (int)minutes - seconds: (int)seconds +- (NSCalendarDate*) dateByAddingYears: (NSInteger)years + months: (NSInteger)months + days: (NSInteger)days + hours: (NSInteger)hours + minutes: (NSInteger)minutes + seconds: (NSInteger)seconds { NSCalendarDate *c; NSTimeInterval s; @@ -2603,12 +2610,12 @@ static void Grow(DescriptionInfo *info, unsigned size) * hours is null, then the value returned in minutes will be increased * by 60. */ -- (void) years: (int*)years - months: (int*)months - days: (int*)days - hours: (int*)hours - minutes: (int*)minutes - seconds: (int*)seconds +- (void) years: (NSInteger*)years + months: (NSInteger*)months + days: (NSInteger*)days + hours: (NSInteger*)hours + minutes: (NSInteger*)minutes + seconds: (NSInteger*)seconds sinceDate: (NSDate*)date { NSCalendarDate *start; diff --git a/Source/NSCoder.m b/Source/NSCoder.m index 1122b0880..4b4b0abbf 100644 --- a/Source/NSCoder.m +++ b/Source/NSCoder.m @@ -74,7 +74,7 @@ // Encoding Data - (void) encodeArrayOfObjCType: (const char*)type - count: (unsigned)count + count: (NSUInteger)count at: (const void*)array { unsigned i; @@ -99,7 +99,7 @@ [self encodeObject: anObject]; } -- (void) encodeBytes: (void*)d length: (unsigned)l +- (void) encodeBytes: (void*)d length: (NSUInteger)l { const char *type = @encode(unsigned char); const unsigned char *where = (const unsigned char*)d; @@ -169,7 +169,7 @@ // Decoding Data - (void) decodeArrayOfObjCType: (const char*)type - count: (unsigned)count + count: (NSUInteger)count at: (void*)address { unsigned i; @@ -185,9 +185,9 @@ } } -- (void*) decodeBytesWithReturnedLength: (unsigned*)l +- (void*) decodeBytesWithReturnedLength: (NSUInteger*)l { - unsigned count; + unsigned int count; const char *type = @encode(unsigned char); unsigned char *where; unsigned char *array; @@ -196,8 +196,8 @@ imp = [self methodForSelector: @selector(decodeValueOfObjCType:at:)]; (*imp)(self, @selector(decodeValueOfObjCType:at:), - @encode(unsigned), &count); - *l = count; + @encode(unsigned int), &count); + *l = (NSUInteger)count; array = NSZoneMalloc(NSDefaultMallocZone(), count); where = array; while (count-- > 0) @@ -291,7 +291,7 @@ // Getting a Version -- (unsigned int) systemVersion +- (unsigned) systemVersion { return (((GNUSTEP_BASE_MAJOR_VERSION * 100) + GNUSTEP_BASE_MINOR_VERSION) * 100) + GNUSTEP_BASE_SUBMINOR_VERSION; @@ -318,7 +318,7 @@ } - (const uint8_t*) decodeBytesForKey: (NSString*)aKey - returnedLength: (unsigned*)alength + returnedLength: (NSUInteger*)alength { [self subclassResponsibility: _cmd]; return 0; @@ -372,7 +372,7 @@ } - (void) encodeBytes: (const uint8_t*)aPointer - length: (unsigned)length + length: (NSUInteger)length forKey: (NSString*)aKey { [self subclassResponsibility: _cmd]; @@ -429,7 +429,7 @@ { return _a; } -- (unsigned) count +- (NSUInteger) count { return _c; } @@ -465,7 +465,7 @@ return self; } -- (id) initWithObjCType: (const char*)t count: (int)c at: (const void*)a +- (id) initWithObjCType: (const char*)t count: (NSInteger)c at: (const void*)a { _t[0] = *t; _t[1] = '\0'; @@ -489,7 +489,7 @@ } } -- (unsigned) size +- (NSUInteger) size { return _s; } diff --git a/Source/NSConcretePointerFunctions.h b/Source/NSConcretePointerFunctions.h index aa8cc4be0..759b1eff7 100644 --- a/Source/NSConcretePointerFunctions.h +++ b/Source/NSConcretePointerFunctions.h @@ -101,7 +101,7 @@ pointerFunctionsHash(PFInfo *PF, void *item) { if (PF->hashFunction != 0) return (*PF->hashFunction)(item, PF->sizeFunction); - return (NSUInteger)item; + return (NSUInteger)(uintptr_t)item; } diff --git a/Source/NSConcretePointerFunctions.m b/Source/NSConcretePointerFunctions.m index 12d6b6d51..d723916e3 100644 --- a/Source/NSConcretePointerFunctions.m +++ b/Source/NSConcretePointerFunctions.m @@ -117,7 +117,7 @@ equalString(const void *item1, const void *item2, static NSUInteger hashDirect(const void *item, NSUInteger (*size)(const void *item)) { - return (NSUInteger)item; + return (NSUInteger)(uintptr_t)item; } static NSUInteger @@ -142,7 +142,7 @@ hashMemory(const void *item, NSUInteger (*size)(const void *item)) static NSUInteger hashShifted(const void *item, NSUInteger (*size)(const void *item)) { - return ((NSUInteger)item) >> 2; + return ((NSUInteger)(uintptr_t)item) >> 2; } static NSUInteger diff --git a/Source/NSCopyObject.m b/Source/NSCopyObject.m index 9d130656f..a0ecfd4b0 100644 --- a/Source/NSCopyObject.m +++ b/Source/NSCopyObject.m @@ -29,7 +29,7 @@ #include "GNUstepBase/preface.h" #include "Foundation/NSObject.h" -NSObject *NSCopyObject(NSObject *anObject, unsigned extraBytes, NSZone *zone) +NSObject *NSCopyObject(NSObject *anObject, NSUInteger extraBytes, NSZone *zone) { id copy = NSAllocateObject(((id)anObject)->class_pointer, extraBytes, zone); memcpy(copy, anObject, diff --git a/Source/NSCountedSet.m b/Source/NSCountedSet.m index a745b82cd..d55cb43b7 100644 --- a/Source/NSCountedSet.m +++ b/Source/NSCountedSet.m @@ -97,7 +97,7 @@ static Class NSCountedSet_concrete_class; * specified object (as determined by the [-isEqual:] method) has * been added to the set and not removed from it. */ -- (unsigned int) countForObject: (id)anObject +- (NSUInteger) countForObject: (id)anObject { [self subclassResponsibility: _cmd]; return 0; @@ -209,7 +209,7 @@ static Class NSCountedSet_concrete_class; return self; } -- (void) purge: (int)level +- (void) purge: (NSInteger)level { if (level > 0) { @@ -232,7 +232,7 @@ static Class NSCountedSet_concrete_class; { unsigned c = (*cImp)(self, @selector(countForObject:), obj); - if (c <= (unsigned int)level) + if (c <= (NSUInteger)level) { while (c-- > 0) { @@ -270,7 +270,7 @@ static Class NSCountedSet_concrete_class; * purge the set even when uniquing is turned off. */ void -GSUPurge(unsigned count) +GSUPurge(NSUInteger count) { if (uniqueLock != nil) { @@ -292,10 +292,10 @@ GSUPurge(unsigned count) * alter the set even when uniquing is turned off. */ id -GSUSet(id anObject, unsigned count) +GSUSet(id anObject, NSUInteger count) { id found; - unsigned i; + NSUInteger i; if (uniqueLock != nil) { diff --git a/Source/NSData.m b/Source/NSData.m index 85fce5454..1645f08db 100644 --- a/Source/NSData.m +++ b/Source/NSData.m @@ -276,7 +276,7 @@ failure: */ @interface NSDataStatic : NSData { - unsigned length; + NSUInteger length; void *bytes; } @end @@ -290,14 +290,14 @@ failure: @interface NSMutableDataMalloc : NSMutableData { - unsigned length; + NSUInteger length; void *bytes; NSZone *zone; - unsigned capacity; - unsigned growth; + NSUInteger capacity; + NSUInteger growth; } /* Increase capacity to at least the specified minimum value. */ -- (void) _grow: (unsigned int)minimum; +- (void) _grow: (NSUInteger)minimum; @end #ifdef HAVE_MMAP @@ -310,14 +310,14 @@ failure: { int shmid; } -- (id) initWithShmID: (int)anId length: (unsigned int)bufferSize; +- (id) initWithShmID: (int)anId length: (NSUInteger)bufferSize; @end @interface NSMutableDataShared : NSMutableDataMalloc { int shmid; } -- (id) initWithShmID: (int)anId length: (unsigned int)bufferSize; +- (id) initWithShmID: (int)anId length: (NSUInteger)bufferSize; @end #endif @@ -381,7 +381,7 @@ failure: * and with the specified length. Invokes -initWithBytes:length: */ + (id) dataWithBytes: (const void*)bytes - length: (unsigned int)length + length: (NSUInteger)length { NSData *d; @@ -396,7 +396,7 @@ failure: * -initWithBytesNoCopy:length:freeWhenDone: with YES */ + (id) dataWithBytesNoCopy: (void*)bytes - length: (unsigned int)length + length: (NSUInteger)length { NSData *d; @@ -411,7 +411,7 @@ failure: * -initWithBytesNoCopy:length:freeWhenDone: */ + (id) dataWithBytesNoCopy: (void*)aBuffer - length: (unsigned int)bufferSize + length: (NSUInteger)bufferSize freeWhenDone: (BOOL)shouldFree { NSData *d; @@ -509,7 +509,7 @@ failure: * to initialise the receiver. Returns the result. */ - (id) initWithBytes: (const void*)aBuffer - length: (unsigned int)bufferSize + length: (NSUInteger)bufferSize { void *ptr = 0; @@ -538,7 +538,7 @@ failure: * be the receiver). */ - (id) initWithBytesNoCopy: (void*)aBuffer - length: (unsigned int)bufferSize + length: (NSUInteger)bufferSize { return [self initWithBytesNoCopy: aBuffer length: bufferSize @@ -556,7 +556,7 @@ failure: * leaks or crashes. */ - (id) initWithBytesNoCopy: (void*)aBuffer - length: (unsigned int)bufferSize + length: (NSUInteger)bufferSize freeWhenDone: (BOOL)shouldFree { [self subclassResponsibility: _cmd]; @@ -680,7 +680,7 @@ failure: * If length is greater than the size of the receiver, only the available * bytes are copied. */ -- (void) getBytes: (void*)buffer length: (unsigned int)length +- (void) getBytes: (void*)buffer length: (NSUInteger)length { NSUInteger l = [self length]; @@ -736,7 +736,7 @@ failure: return [NSData dataWithBytesNoCopy: buffer length: aRange.length]; } -- (unsigned int) hash +- (NSUInteger) hash { unsigned char buf[64]; unsigned l = [self length]; @@ -780,7 +780,7 @@ failure: */ - (BOOL) isEqualToData: (NSData*)other { - unsigned int len; + NSUInteger len; if (other == self) { return YES; @@ -795,7 +795,7 @@ failure: /** * Returns the number of bytes of data encapsulated by the receiver. */ -- (unsigned int) length +- (NSUInteger) length { /* This is left to concrete subclasses to implement. */ [self subclassResponsibility: _cmd]; @@ -815,7 +815,7 @@ failure: - (BOOL) writeToFile: (NSString*)path atomically: (BOOL)useAuxiliaryFile { #if defined(__MINGW32__) - unsigned int length = [path length]; + NSUInteger length = [path length]; unichar wthePath[length + 100]; unichar wtheRealPath[length + 100]; #else @@ -1570,7 +1570,7 @@ failure: /** * New instance with given shared memory ID. */ -+ (id) dataWithShmID: (int)anID length: (unsigned int)length ++ (id) dataWithShmID: (int)anID length: (NSUInteger)length { #ifdef HAVE_SHMCTL NSDataShared *d; @@ -1587,7 +1587,7 @@ failure: /** * New instance with given bytes in shared memory. */ -+ (id) dataWithSharedBytes: (const void*)bytes length: (unsigned int)length ++ (id) dataWithSharedBytes: (const void*)bytes length: (NSUInteger)length { NSData *d; @@ -1601,7 +1601,7 @@ failure: return AUTORELEASE(d); } -+ (id) dataWithStaticBytes: (const void*)bytes length: (unsigned int)length ++ (id) dataWithStaticBytes: (const void*)bytes length: (NSUInteger)length { NSDataStatic *d; @@ -1693,7 +1693,7 @@ failure: } + (id) dataWithBytes: (const void*)bytes - length: (unsigned int)length + length: (NSUInteger)length { NSData *d; @@ -1703,7 +1703,7 @@ failure: } + (id) dataWithBytesNoCopy: (void*)bytes - length: (unsigned int)length + length: (NSUInteger)length { NSData *d; @@ -1716,7 +1716,7 @@ failure: * New instance with buffer of given numBytes with length of valid data set * to zero. Note that capacity will be automatically increased as necessary. */ -+ (id) dataWithCapacity: (unsigned int)numBytes ++ (id) dataWithCapacity: (NSUInteger)numBytes { NSMutableData *d; @@ -1769,7 +1769,7 @@ failure: * valid data is set to zero. Note that buffer will be automatically * increased as necessary. */ -+ (id) dataWithLength: (unsigned int)length ++ (id) dataWithLength: (NSUInteger)length { NSMutableData *d; @@ -1821,7 +1821,7 @@ failure: * data is initially set to zero. * */ -- (id) initWithCapacity: (unsigned int)capacity +- (id) initWithCapacity: (NSUInteger)capacity { [self subclassResponsibility: _cmd]; return nil; @@ -1829,18 +1829,20 @@ failure: - (id) initWithCoder: (NSCoder*)aCoder { - unsigned l; - if ([aCoder allowsKeyedCoding]) { const uint8_t *data; + NSUInteger l; + data = [aCoder decodeBytesForKey: @"NS.data" - returnedLength: &l]; + returnedLength: &l]; self = [self initWithBytes: data length: l]; } else { + unsigned l; + [aCoder decodeValueOfObjCType: @encode(unsigned int) at: &l]; if (l) { @@ -1857,7 +1859,8 @@ failure: if (b == 0) { - NSLog(@"[NSDataMalloc -initWithCoder:] unable to get %lu bytes", l); + NSLog(@"[NSDataMalloc -initWithCoder:] unable to get %u bytes", + l); RELEASE(self); return nil; } @@ -1876,7 +1879,7 @@ failure: * Initialize with buffer of capacity equal to length, and with the length * of valid data set to length. Data is set to zero. */ -- (id) initWithLength: (unsigned int)length +- (id) initWithLength: (NSUInteger)length { [self subclassResponsibility: _cmd]; return nil; @@ -1887,7 +1890,7 @@ failure: * Increases buffer length by given number of bytes, filling the new space * with zeros. */ -- (void) increaseLengthBy: (unsigned int)extraLength +- (void) increaseLengthBy: (NSUInteger)extraLength { [self setLength: [self length]+extraLength]; } @@ -1903,7 +1906,7 @@ failure: * if you write a subclass of NSMutableData. *

*/ -- (void) setLength: (unsigned int)size +- (void) setLength: (NSUInteger)size { [self subclassResponsibility: _cmd]; } @@ -1939,7 +1942,7 @@ failure: * necessary. */ - (void) appendBytes: (const void*)aBuffer - length: (unsigned int)bufferSize + length: (NSUInteger)bufferSize { unsigned oldLength = [self length]; void* buffer; @@ -1996,7 +1999,7 @@ failure: */ - (void) replaceBytesInRange: (NSRange)aRange withBytes: (const void*)bytes - length: (unsigned int)length + length: (NSUInteger)length { unsigned size = [self length]; unsigned end = NSMaxRange(aRange); @@ -2316,7 +2319,7 @@ failure: /** * New instance with given shared memory ID. */ -+ (id) dataWithShmID: (int)anID length: (unsigned int)length ++ (id) dataWithShmID: (int)anID length: (NSUInteger)length { #ifdef HAVE_SHMCTL NSDataShared *d; @@ -2333,7 +2336,7 @@ failure: /** * New instance with given bytes in shared memory. */ -+ (id) dataWithSharedBytes: (const void*)bytes length: (unsigned int)length ++ (id) dataWithSharedBytes: (const void*)bytes length: (NSUInteger)length { NSData *d; @@ -2350,7 +2353,7 @@ failure: /** * Returns current capacity of data buffer. */ -- (unsigned int) capacity +- (NSUInteger) capacity { [self subclassResponsibility: _cmd]; return 0; @@ -2360,7 +2363,7 @@ failure: * Sets current capacity of data buffer. Unlike [-setLength:], this will * shrink the buffer if requested. */ -- (id) setCapacity: (unsigned int)newCapacity +- (id) setCapacity: (NSUInteger)newCapacity { [self subclassResponsibility: _cmd]; return nil; @@ -2467,7 +2470,7 @@ failure: } - (id) initWithBytesNoCopy: (void*)aBuffer - length: (unsigned int)bufferSize + length: (NSUInteger)bufferSize freeWhenDone: (BOOL)shouldFree { bytes = aBuffer; @@ -2494,7 +2497,7 @@ failure: memcpy(buffer, bytes + aRange.location, aRange.length); } -- (unsigned int) length +- (NSUInteger) length { return length; } @@ -2893,7 +2896,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) } - (id) initWithBytesNoCopy: (void*)aBuffer - length: (unsigned int)bufferSize + length: (NSUInteger)bufferSize freeWhenDone: (BOOL)shouldFree { if (shouldFree == NO) @@ -3026,7 +3029,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) [super dealloc]; } -- (id) initWithBytes: (const void*)aBuffer length: (unsigned int)bufferSize +- (id) initWithBytes: (const void*)aBuffer length: (NSUInteger)bufferSize { shmid = -1; if (aBuffer && bufferSize) @@ -3056,7 +3059,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) return self; } -- (id) initWithShmID: (int)anId length: (unsigned int)bufferSize +- (id) initWithShmID: (int)anId length: (NSUInteger)bufferSize { struct shmid_ds buf; @@ -3141,7 +3144,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) [super dealloc]; } -- (id) initWithBytes: (const void*)aBuffer length: (unsigned int)bufferSize +- (id) initWithBytes: (const void*)aBuffer length: (NSUInteger)bufferSize { self = [self initWithCapacity: bufferSize]; if (self) @@ -3156,7 +3159,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) } - (id) initWithBytesNoCopy: (void*)aBuffer - length: (unsigned int)bufferSize + length: (NSUInteger)bufferSize freeWhenDone: (BOOL)shouldFree { if (aBuffer == 0) @@ -3192,7 +3195,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) * Initialize with buffer capable of holding size bytes. * */ -- (id) initWithCapacity: (unsigned int)size +- (id) initWithCapacity: (NSUInteger)size { #if GS_WITH_GC zone = GSAtomicMallocZone(); @@ -3225,7 +3228,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) * Initialize with buffer capable of holding size bytes. Buffer is zeroed * out. */ -- (id) initWithLength: (unsigned int)size +- (id) initWithLength: (NSUInteger)size { self = [self initWithCapacity: size]; if (self) @@ -3256,7 +3259,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) } - (void) appendBytes: (const void*)aBuffer - length: (unsigned int)bufferSize + length: (NSUInteger)bufferSize { unsigned oldLength = length; unsigned minimum = length + bufferSize; @@ -3269,12 +3272,12 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) length = minimum; } -- (unsigned int) capacity +- (NSUInteger) capacity { return capacity; } -- (void) _grow: (unsigned int)minimum +- (void) _grow: (NSUInteger)minimum { if (minimum > capacity) { @@ -3600,7 +3603,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) } } -- (id) setCapacity: (unsigned int)size +- (id) setCapacity: (NSUInteger)size { if (size != capacity) { @@ -3669,7 +3672,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) memcpy(bytes, [data bytes], length); } -- (void) setLength: (unsigned int)size +- (void) setLength: (NSUInteger)size { if (size > capacity) { @@ -3724,7 +3727,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) [super dealloc]; } -- (id) initWithBytes: (const void*)aBuffer length: (unsigned int)bufferSize +- (id) initWithBytes: (const void*)aBuffer length: (NSUInteger)bufferSize { self = [self initWithCapacity: bufferSize]; if (self) @@ -3736,7 +3739,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) return self; } -- (id) initWithCapacity: (unsigned int)bufferSize +- (id) initWithCapacity: (NSUInteger)bufferSize { shmid = shmget(IPC_PRIVATE, bufferSize, IPC_CREAT|VM_ACCESS); if (shmid == -1) /* Created memory? */ @@ -3764,7 +3767,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) return self; } -- (id) initWithShmID: (int)anId length: (unsigned int)bufferSize +- (id) initWithShmID: (int)anId length: (NSUInteger)bufferSize { struct shmid_ds buf; @@ -3798,7 +3801,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos) return self; } -- (id) setCapacity: (unsigned int)size +- (id) setCapacity: (NSUInteger)size { if (size != capacity) { diff --git a/Source/NSDebug.m b/Source/NSDebug.m index 348e045d9..c8b8c4cf3 100644 --- a/Source/NSDebug.m +++ b/Source/NSDebug.m @@ -918,7 +918,7 @@ recover(int sig) } void * -NSFrameAddress(int offset) +NSFrameAddress(NSUInteger offset) { jbuf_type *env; @@ -978,7 +978,7 @@ NSFrameAddress(int offset) return env->addr; } -unsigned NSCountFrames(void) +NSUInteger NSCountFrames(void) { jbuf_type *env; @@ -1038,11 +1038,11 @@ done: signal(SIGBUS, env->bus); } - return (unsigned)(uintptr_t)env->addr; + return (uintptr_t)env->addr; } void * -NSReturnAddress(int offset) +NSReturnAddress(NSUInteger offset) { jbuf_type *env; diff --git a/Source/NSDecimal.m b/Source/NSDecimal.m index e608d0028..98f1ceced 100644 --- a/Source/NSDecimal.m +++ b/Source/NSDecimal.m @@ -378,7 +378,7 @@ GSDecimalNormalize(GSDecimal *n1, GSDecimal *n2, NSRoundingMode mode) l = MIN(NSDecimalMaxDigit - n1->length, n1->exponent - n2->exponent); for (i = 0; i < l; i++) { - n1->cMantissa[(int)n1->length] = 0; + n1->cMantissa[(NSInteger)n1->length] = 0; n1->length++; } n1->exponent = n2->exponent; @@ -751,7 +751,7 @@ NSDecimalDivide(NSDecimal *result, const NSDecimal *l, const NSDecimal *rr, } NSCalculationError -NSDecimalPower(NSDecimal *result, const NSDecimal *n, unsigned power, NSRoundingMode mode) +NSDecimalPower(NSDecimal *result, const NSDecimal *n, NSUInteger power, NSRoundingMode mode) { NSCalculationError error = NSCalculationNoError; unsigned int e = power; @@ -1320,7 +1320,7 @@ NSDecimalCompare(const NSDecimal *leftOperand, const NSDecimal *rightOperand) } void -NSDecimalRound(NSDecimal *result, const NSDecimal *number, int scale, +NSDecimalRound(NSDecimal *result, const NSDecimal *number, NSInteger scale, NSRoundingMode mode) { NSDecimalCopy(result, number); @@ -1565,7 +1565,7 @@ GSSimpleDivide(NSDecimal *result, const NSDecimal *l, const NSDecimal *r, if (n1.exponent) { // Put back zeros removed by compacting - n1.cMantissa[(int)n1.length] = 0; + n1.cMantissa[(NSInteger)n1.length] = 0; n1.length++; n1.exponent--; } @@ -1577,7 +1577,7 @@ GSSimpleDivide(NSDecimal *result, const NSDecimal *l, const NSDecimal *r, if (n1.length || l->cMantissa[used]) { // only add 0 if there is already something - n1.cMantissa[(int)n1.length] = l->cMantissa[used]; + n1.cMantissa[(NSInteger)n1.length] = l->cMantissa[used]; n1.length++; } used++; @@ -1591,7 +1591,7 @@ GSSimpleDivide(NSDecimal *result, const NSDecimal *l, const NSDecimal *r, break; } // Borrow one digit - n1.cMantissa[(int)n1.length] = 0; + n1.cMantissa[(NSInteger)n1.length] = 0; n1.length++; result->exponent--; } diff --git a/Source/NSDecimalNumber.m b/Source/NSDecimalNumber.m index 415fd5025..d2c688ba2 100644 --- a/Source/NSDecimalNumber.m +++ b/Source/NSDecimalNumber.m @@ -476,7 +476,7 @@ static NSDecimalNumber *one; return [self initWithBytes: &d objCType: "d"]; } -- (id) initWithInt: (signed int)value +- (id) initWithInt: (int)value { if (value < 0) { @@ -547,7 +547,7 @@ static NSDecimalNumber *one; isNegative: NO]; } -- (id) initWithUnsignedInt: (unsigned int)value +- (id) initWithUnsignedInt: (NSUInteger)value { return [self initWithMantissa: value exponent: 0 @@ -769,13 +769,13 @@ static NSDecimalNumber *one; return [NSDecimalNumber decimalNumberWithDecimal: result]; } -- (NSDecimalNumber*) decimalNumberByRaisingToPower: (unsigned)power +- (NSDecimalNumber*) decimalNumberByRaisingToPower: (NSUInteger)power { return [self decimalNumberByRaisingToPower: power withBehavior: [isa defaultBehavior]]; } -- (NSDecimalNumber*) decimalNumberByRaisingToPower: (unsigned)power +- (NSDecimalNumber*) decimalNumberByRaisingToPower: (NSUInteger)power withBehavior: (id )behavior { NSDecimal result; diff --git a/Source/NSDictionary.m b/Source/NSDictionary.m index f601f5a55..8c3d70948 100644 --- a/Source/NSDictionary.m +++ b/Source/NSDictionary.m @@ -174,7 +174,7 @@ static SEL appSel; */ - (id) initWithObjects: (id*)objects forKeys: (id*)keys - count: (unsigned)count + count: (NSUInteger)count { self = [self init]; return self; @@ -184,7 +184,7 @@ static SEL appSel; * Returns an unsigned integer which is the number of elements * stored in the dictionary. */ -- (unsigned) count +- (NSUInteger) count { [self subclassResponsibility: _cmd]; return 0; @@ -405,13 +405,13 @@ static SEL appSel; */ + (id) dictionaryWithObjects: (id*)objects forKeys: (id*)keys - count: (unsigned)count + count: (NSUInteger)count { return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()] initWithObjects: objects forKeys: keys count: count]); } -- (unsigned) hash +- (NSUInteger) hash { return [self count]; } @@ -877,7 +877,7 @@ compareIt(id o1, id o2, void* context) struct foo *f = (struct foo*)context; o1 = (*f->i)(f->d, @selector(objectForKey:), o1); o2 = (*f->i)(f->d, @selector(objectForKey:), o2); - return (int)(intptr_t)[o1 performSelector: f->s withObject: o2]; + return (NSInteger)(intptr_t)[o1 performSelector: f->s withObject: o2]; } /** @@ -1081,7 +1081,7 @@ compareIt(id o1, id o2, void* context) * items are listed is undefined. */ - (NSString*) descriptionWithLocale: (NSDictionary*)locale - indent: (unsigned int)level + indent: (NSUInteger)level { NSMutableString *result = nil; @@ -1185,7 +1185,7 @@ compareIt(id o1, id o2, void* context) * and needs to be re-implemented in subclasses in order to have all * other initialisers work. */ -- (id) initWithCapacity: (unsigned)numItems +- (id) initWithCapacity: (NSUInteger)numItems { self = [self init]; return self; @@ -1218,7 +1218,7 @@ compareIt(id o1, id o2, void* context) * added, this can avoid the reallocate-and-copy process if the size of the * ultimate contents is known in advance. */ -+ (id) dictionaryWithCapacity: (unsigned)numItems ++ (id) dictionaryWithCapacity: (NSUInteger)numItems { return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()] initWithCapacity: numItems]); @@ -1233,7 +1233,7 @@ compareIt(id o1, id o2, void* context) */ - (id) initWithObjects: (id*)objects forKeys: (id*)keys - count: (unsigned)count + count: (NSUInteger)count { self = [self initWithCapacity: count]; if (self != nil) diff --git a/Source/NSDistributedNotificationCenter.m b/Source/NSDistributedNotificationCenter.m index 0a613cc78..9de33e699 100644 --- a/Source/NSDistributedNotificationCenter.m +++ b/Source/NSDistributedNotificationCenter.m @@ -1,5 +1,5 @@ /** - Copyright (C) 1998-2003 Free Software Foundation, Inc. + Copyright (C) 1998-2009 Free Software Foundation, Inc. Written by: Richard Frith-Macdonald Created: October 1998 @@ -55,7 +55,7 @@ object: (NSString*)object userInfo: (NSData*)info selector: (NSString*)aSelector - to: (NSUInteger)observer; + to: (uint64_t)observer; @end /** @@ -339,12 +339,12 @@ static NSDistributedNotificationCenter *netCenter = nil; NS_DURING { [self _connect]; - [(id)_remote addObserver: (NSUInteger)anObserver - selector: NSStringFromSelector(aSelector) - name: notificationName - object: anObject - suspensionBehavior: suspensionBehavior - for: (id)self]; + [(id)_remote addObserver: (uint64_t)anObserver + selector: NSStringFromSelector(aSelector) + name: notificationName + object: anObject + suspensionBehavior: suspensionBehavior + for: (id)self]; } NS_HANDLER { @@ -465,10 +465,10 @@ static NSDistributedNotificationCenter *netCenter = nil; NS_DURING { [self _connect]; - [(id)_remote removeObserver: (NSUInteger)anObserver - name: notificationName - object: anObject - for: (id)self]; + [(id)_remote removeObserver: (uint64_t)anObserver + name: notificationName + object: anObject + for: (id)self]; } NS_HANDLER { @@ -519,7 +519,7 @@ static NSDistributedNotificationCenter *netCenter = nil; * in the source where the '@protocol()' directive is used. */ @interface NSDistributedNotificationCenterDummy : NSObject -- (void) addObserver: (NSUInteger)anObserver +- (void) addObserver: (uint64_t)anObserver selector: (NSString*)aSelector name: (NSString*)notificationname object: (NSString*)anObject @@ -531,7 +531,7 @@ static NSDistributedNotificationCenter *netCenter = nil; deliverImmediately: (BOOL)deliverImmediately for: (id)client; - (void) registerClient: (id)client; -- (void) removeObserver: (NSUInteger)anObserver +- (void) removeObserver: (uint64_t)anObserver name: (NSString*)notificationname object: (NSString*)anObject for: (id)client; @@ -541,7 +541,7 @@ static NSDistributedNotificationCenter *netCenter = nil; @end @implementation NSDistributedNotificationCenterDummy -- (void) addObserver: (NSUInteger)anObserver +- (void) addObserver: (uint64_t)anObserver selector: (NSString*)aSelector name: (NSString*)notificationname object: (NSString*)anObject @@ -559,7 +559,7 @@ static NSDistributedNotificationCenter *netCenter = nil; - (void) registerClient: (id)client { } -- (void) removeObserver: (NSUInteger)anObserver +- (void) removeObserver: (uint64_t)anObserver name: (NSString*)notificationname object: (NSString*)anObject for: (id)client @@ -804,7 +804,7 @@ static NSDistributedNotificationCenter *netCenter = nil; object: (NSString*)object userInfo: (NSData*)info selector: (NSString*)aSelector - to: (NSUInteger)observer + to: (uint64_t)observer { id userInfo; NSNotification *notification; diff --git a/Source/NSError.m b/Source/NSError.m index 58aa56381..dcdbe7080 100644 --- a/Source/NSError.m +++ b/Source/NSError.m @@ -50,7 +50,7 @@ NSString* const NSCocoaErrorDomain = @"NSCocoaErrorDomain"; @implementation NSError + (id) errorWithDomain: (NSString*)aDomain - code: (int)aCode + code: (NSInteger)aCode userInfo: (NSDictionary*)aDictionary { NSError *e = [self allocWithZone: NSDefaultMallocZone()]; @@ -59,7 +59,7 @@ NSString* const NSCocoaErrorDomain = @"NSCocoaErrorDomain"; return AUTORELEASE(e); } -- (int) code +- (NSInteger) code { return _code; } @@ -133,7 +133,7 @@ NSString* const NSCocoaErrorDomain = @"NSCocoaErrorDomain"; } - (id) initWithDomain: (NSString*)aDomain - code: (int)aCode + code: (NSInteger)aCode userInfo: (NSDictionary*)aDictionary { if (aDomain == nil) diff --git a/Source/NSException.m b/Source/NSException.m index 6dc60e771..7deebd0b9 100644 --- a/Source/NSException.m +++ b/Source/NSException.m @@ -42,8 +42,6 @@ #include -static NSUncaughtExceptionHandler *_NSUncaughtExceptionHandler; - #define _e_info (((id*)_reserved)[0]) #define _e_stack (((id*)_reserved)[1]) @@ -60,8 +58,8 @@ typedef struct { @defs(NSThread) } *TInfo; - (NSString*) description; - (NSEnumerator*) enumerator; - (NSMutableArray*) frames; -- (id) frameAt: (unsigned)index; -- (unsigned) frameCount; +- (id) frameAt: (NSUInteger)index; +- (NSUInteger) frameCount; - (id) initWithAddresses: (NSArray*)stack; - (NSEnumerator*) reverseEnumerator; @@ -152,8 +150,8 @@ GSPrivateBaseAddress(void *addr, void **base) address: (void*)address file: (NSString*)file function: (NSString*)function - line: (int)lineNo; -- (int) lineNumber; + line: (NSInteger)lineNo; +- (NSInteger) lineNumber; - (GSBinaryFileInfo*) module; @end @@ -216,7 +214,7 @@ GSPrivateBaseAddress(void *addr, void **base) address: (void*)address file: (NSString*)file function: (NSString*)function - line: (int)lineNo + line: (NSInteger)lineNo { _module = RETAIN(module); _address = address; @@ -227,7 +225,7 @@ GSPrivateBaseAddress(void *addr, void **base) return self; } -- (int) lineNumber +- (NSInteger) lineNumber { return _lineNo; } @@ -552,12 +550,12 @@ GSListModules() return [frames objectEnumerator]; } -- (id) frameAt: (unsigned)index +- (id) frameAt: (NSUInteger)index { return [frames objectAtIndex: index]; } -- (unsigned) frameCount +- (NSUInteger) frameCount { return [frames count]; } @@ -724,6 +722,10 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception) _terminate(); } +static NSUncaughtExceptionHandler *_NSUncaughtExceptionHandler + = _NSFoundationUncaughtExceptionHandler; + +#if defined(_NATIVE_OBJC_EXCEPTIONS) && defined(HAVE_UNEXPECTED) static void callUncaughtHandler(id value) { @@ -733,6 +735,8 @@ callUncaughtHandler(id value) } _NSFoundationUncaughtExceptionHandler(value); } +#endif + @implementation NSException diff --git a/Source/NSFileManager.m b/Source/NSFileManager.m index 976fa55da..ded208aab 100644 --- a/Source/NSFileManager.m +++ b/Source/NSFileManager.m @@ -2015,7 +2015,7 @@ static NSStringEncoding defaultEncoding; (const GSNativeChar*)[path cStringUsingEncoding: defaultEncoding]; } - (NSString*) stringWithFileSystemRepresentation: (const GSNativeChar*)string - length: (unsigned int)len + length: (NSUInteger)len { return AUTORELEASE([[NSString allocWithZone: NSDefaultMallocZone()] initWithBytes: string length: len encoding: defaultEncoding]); @@ -2450,7 +2450,7 @@ static inline void gsedRelease(GSEnumeratedDirectory X) * Return the file posix permissions attribute (or NSNotFound if * the attribute is not present in the dictionary). */ -- (unsigned long) filePosixPermissions +- (NSUInteger) filePosixPermissions { NSNumber *n = [self objectForKey: NSFilePosixPermissions]; @@ -2458,14 +2458,14 @@ static inline void gsedRelease(GSEnumeratedDirectory X) { return NSNotFound; } - return [n unsignedLongValue]; + return [n unsignedIntegerValue]; } /** * Return the file system number attribute (or NSNotFound if * the attribute is not present in the dictionary). */ -- (unsigned long) fileSystemNumber +- (NSUInteger) fileSystemNumber { NSNumber *n = [self objectForKey: NSFileSystemNumber]; @@ -2473,14 +2473,14 @@ static inline void gsedRelease(GSEnumeratedDirectory X) { return NSNotFound; } - return [n unsignedLongValue]; + return [n unsignedIntegerValue]; } /** * Return the file system file identification number attribute * or NSNotFound if the attribute is not present in the dictionary). */ -- (unsigned long) fileSystemFileNumber +- (NSUInteger) fileSystemFileNumber { NSNumber *n = [self objectForKey: NSFileSystemFileNumber]; @@ -2488,7 +2488,7 @@ static inline void gsedRelease(GSEnumeratedDirectory X) { return NSNotFound; } - return [n unsignedLongValue]; + return [n unsignedIntegerValue]; } @end diff --git a/Source/NSGeometry.m b/Source/NSGeometry.m index 9527f78e9..460fd084e 100644 --- a/Source/NSGeometry.m +++ b/Source/NSGeometry.m @@ -49,7 +49,7 @@ static Class NSScannerClass = 0; static SEL scanFloatSel; static SEL scanStringSel; static SEL scannerSel; -static BOOL (*scanFloatImp)(NSScanner*, SEL, float*); +static BOOL (*scanFloatImp)(NSScanner*, SEL, CGFloat*); static BOOL (*scanStringImp)(NSScanner*, SEL, NSString*, NSString**); static id (*scannerImp)(Class, SEL, NSString*); @@ -60,10 +60,17 @@ setupCache(void) { NSStringClass = [NSString class]; NSScannerClass = [NSScanner class]; - scanFloatSel = @selector(scanFloat:); + if (sizeof(CGFloat) == sizeof(double)) + { + scanFloatSel = @selector(scanDouble:); + } + else + { + scanFloatSel = @selector(scanFloat:); + } scanStringSel = @selector(scanString:intoString:); scannerSel = @selector(scannerWithString:); - scanFloatImp = (BOOL (*)(NSScanner*, SEL, float*)) + scanFloatImp = (BOOL (*)(NSScanner*, SEL, CGFloat*)) [NSScannerClass instanceMethodForSelector: scanFloatSel]; scanStringImp = (BOOL (*)(NSScanner*, SEL, NSString*, NSString**)) [NSScannerClass instanceMethodForSelector: scanStringSel]; @@ -101,7 +108,7 @@ void NSDivideRect(NSRect aRect, NSRect *slice, NSRect *remainder, - float amount, + CGFloat amount, NSRectEdge edge) { static NSRect sRect; diff --git a/Source/NSHTTPCookie.m b/Source/NSHTTPCookie.m index 4fdd62ed2..427255433 100644 --- a/Source/NSHTTPCookie.m +++ b/Source/NSHTTPCookie.m @@ -164,9 +164,9 @@ typedef struct { return [this->_properties objectForKey: NSHTTPCookieValue]; } -- (unsigned) version +- (NSUInteger) version { - return [[this->_properties objectForKey: NSHTTPCookieVersion] intValue]; + return [[this->_properties objectForKey: NSHTTPCookieVersion] integerValue]; } @end diff --git a/Source/NSIndexPath.m b/Source/NSIndexPath.m index 9b6598af3..a3406355a 100644 --- a/Source/NSIndexPath.m +++ b/Source/NSIndexPath.m @@ -23,14 +23,15 @@ */ -#include -#include -#include -#include -#include -#include -#include -#include +#include "Foundation/NSObject.h" +#include "Foundation/NSByteOrder.h" +#include "Foundation/NSData.h" +#include "Foundation/NSException.h" +#include "Foundation/NSHashTable.h" +#include "Foundation/NSIndexPath.h" +#include "Foundation/NSKeyedArchiver.h" +#include "Foundation/NSLock.h" +#include "Foundation/NSZone.h" #include "GNUstepBase/GSLock.h" static NSLock *lock = nil; @@ -50,12 +51,12 @@ static NSIndexPath *dummy = nil; return [super allocWithZone: aZone]; } -+ (id) indexPathWithIndex: (unsigned)anIndex ++ (id) indexPathWithIndex: (NSUInteger)anIndex { return [self indexPathWithIndexes: &anIndex length: 1]; } -+ (id) indexPathWithIndexes: (unsigned*)indexes length: (unsigned)length ++ (id) indexPathWithIndexes: (NSUInteger*)indexes length: (NSUInteger)length { id o = [self allocWithZone: NSDefaultMallocZone()]; @@ -80,10 +81,10 @@ static NSIndexPath *dummy = nil; { if (other != self) { - unsigned olength = other->_length; - unsigned *oindexes = other->_indexes; - unsigned end = (_length > olength) ? _length : olength; - unsigned pos; + NSUInteger olength = other->_length; + NSUInteger *oindexes = other->_indexes; + NSUInteger end = (_length > olength) ? _length : olength; + NSUInteger pos; for (pos = 0; pos < end; pos++) { @@ -133,7 +134,7 @@ static NSIndexPath *dummy = nil; - (NSString*) description { NSMutableString *m = [[super description] mutableCopy]; - unsigned i; + NSUInteger i; [m appendFormat: @"%u indexes [", _length]; for (i = 0; i < _length; i++) @@ -152,19 +153,19 @@ static NSIndexPath *dummy = nil; { if ([aCoder allowsKeyedCoding] == YES) { - [aCoder encodeInt: (int)_length forKey: @"NSIndexPathLength"]; + [aCoder encodeInt: (NSInteger)_length forKey: @"NSIndexPathLength"]; if (_length == 1) { - [aCoder encodeInt: (int)_indexes[0] forKey: @"NSIndexPathValue"]; + [aCoder encodeInt: (NSInteger)_indexes[0] forKey: @"NSIndexPathValue"]; } else if (_length > 1) { NSMutableData *m; - unsigned *buf; - unsigned i; + NSUInteger *buf; + NSUInteger i; m = [NSMutableData new]; - [m setLength: _length * sizeof(unsigned)]; + [m setLength: _length * sizeof(NSUInteger)]; buf = [m mutableBytes]; for (i = 0; i < _length; i++) { @@ -176,27 +177,27 @@ static NSIndexPath *dummy = nil; } else { - [aCoder encodeValueOfObjCType: @encode(unsigned) at: &_length]; + [aCoder encodeValueOfObjCType: @encode(NSUInteger) at: &_length]; if (_length > 0) { - [aCoder encodeArrayOfObjCType: @encode(unsigned) + [aCoder encodeArrayOfObjCType: @encode(NSUInteger) count: _length at: _indexes]; } } } -- (void) getIndexes: (unsigned*)aBuffer +- (void) getIndexes: (NSUInteger*)aBuffer { - memcpy(aBuffer, _indexes, _length * sizeof(unsigned)); + memcpy(aBuffer, _indexes, _length * sizeof(NSUInteger)); } -- (unsigned) hash +- (NSUInteger) hash { return _hash; } -- (unsigned) indexAtPosition: (unsigned)position +- (NSUInteger) indexAtPosition: (NSUInteger)position { if (position >= _length) { @@ -208,9 +209,9 @@ static NSIndexPath *dummy = nil; /** * Return path formed by adding the index to the receiver. */ -- (NSIndexPath *) indexPathByAddingIndex: (unsigned)anIndex +- (NSIndexPath *) indexPathByAddingIndex: (NSUInteger)anIndex { - unsigned buffer[_length + 1]; + NSUInteger buffer[_length + 1]; [self getIndexes: buffer]; buffer[_length] = anIndex; @@ -233,81 +234,83 @@ static NSIndexPath *dummy = nil; { if ([aCoder allowsKeyedCoding] == YES) { - unsigned length; - unsigned index; + NSUInteger length; + NSUInteger index; - length = (unsigned)[aCoder decodeIntForKey: @"NSIndexPathLength"]; + length = [aCoder decodeIntegerForKey: @"NSIndexPathLength"]; if (length == 1) { - index = (unsigned)[aCoder decodeIntForKey: @"NSIndexPathValue"]; + index = [aCoder decodeIntegerForKey: @"NSIndexPathValue"]; self = [self initWithIndex: index]; } else if (length > 1) { // FIXME ... not MacOS-X NSMutableData *d = [aCoder decodeObjectForKey: @"NSIndexPathData"]; - unsigned l = [d length]; - unsigned s = l / length; - unsigned i; + NSUInteger l = [d length]; + NSUInteger s = l / length; + NSUInteger i; + void *src = [d mutableBytes]; + NSUInteger *dst; - if (s == sizeof(unsigned)) + if (s == sizeof(NSUInteger)) { - unsigned *ptr = (unsigned*)[d mutableBytes]; - - for (i = 0; i < _length; i++) - { - ptr[i] = NSSwapBigIntToHost(ptr[i]); - } - self = [self initWithIndexes: ptr length: length]; - } + dst = (NSUInteger*)src; + } else { - unsigned *buf; + dst = (NSUInteger*)NSZoneMalloc(NSDefaultMallocZone(), + length * sizeof(NSUInteger)); + } - buf = (unsigned*)NSZoneMalloc(NSDefaultMallocZone(), - length * sizeof(unsigned)); - if (s == sizeof(long)) - { - long *ptr = (long*)[d mutableBytes]; + if (s == sizeof(long)) + { + long *ptr = (long*)src; - for (i = 0; i < _length; i++) - { - buf[i] = (unsigned)NSSwapBigLongToHost(ptr[i]); - } - } - else if (s == sizeof(short)) - { - short *ptr = (short*)[d mutableBytes]; + for (i = 0; i < _length; i++) + { + dst[i] = (NSUInteger)NSSwapBigLongToHost(ptr[i]); + } + } + else if (s == sizeof(short)) + { + short *ptr = (short*)src; - for (i = 0; i < _length; i++) - { - buf[i] = (unsigned)NSSwapBigShortToHost(ptr[i]); - } - } - else if (s == sizeof(long long)) - { - long long *ptr = (long long*)[d mutableBytes]; + for (i = 0; i < _length; i++) + { + dst[i] = (NSUInteger)NSSwapBigShortToHost(ptr[i]); + } + } + else if (s == sizeof(long long)) + { + long long *ptr = (long long*)src; - for (i = 0; i < _length; i++) - { - buf[i] = (unsigned)NSSwapBigLongLongToHost(ptr[i]); - } - } - else - { - [NSException raise: NSGenericException format: - @"Unable to decode unsigned integers of size %u", s]; - } - self = [self initWithIndexes: buf length: length]; - NSZoneFree(NSDefaultMallocZone(), buf); + for (i = 0; i < _length; i++) + { + dst[i] = (NSUInteger)NSSwapBigLongLongToHost(ptr[i]); + } + } + else + { + if ((void*)dst != src) + { + NSZoneFree(NSDefaultMallocZone(), dst); + } + [NSException raise: NSGenericException format: + @"Unable to decode unsigned integers of size %u", s]; + } + self = [self initWithIndexes: dst length: length]; + if ((void*)dst != src) + { + NSZoneFree(NSDefaultMallocZone(), dst); } } } else { - unsigned length; + NSUInteger length; - [aCoder decodeValueOfObjCType: @encode(unsigned) at: &length]; + [aCoder decodeValueOfObjCType: @encode(NSUInteger) at: &length]; if (length == 0) { RELEASE(self); @@ -315,15 +318,15 @@ static NSIndexPath *dummy = nil; } else { - unsigned buf[16]; - unsigned *indexes = buf; + NSUInteger buf[16]; + NSUInteger *indexes = buf; if (length > 16) { indexes = NSZoneMalloc(NSDefaultMallocZone(), - length * sizeof(unsigned)); + length * sizeof(NSUInteger)); } - [aCoder decodeArrayOfObjCType: @encode(unsigned) + [aCoder decodeArrayOfObjCType: @encode(NSUInteger) count: length at: indexes]; self = [self initWithIndexes: indexes length: length]; @@ -336,7 +339,7 @@ static NSIndexPath *dummy = nil; return self; } -- (id) initWithIndex: (unsigned)anIndex +- (id) initWithIndex: (NSUInteger)anIndex { return [self initWithIndexes: &anIndex length: 1]; } @@ -345,11 +348,11 @@ static NSIndexPath *dummy = nil; * Initialise the receiver to contain the specified indexes.
* May return an existing index path. */ -- (id) initWithIndexes: (unsigned*)indexes length: (unsigned)length +- (id) initWithIndexes: (NSUInteger*)indexes length: (NSUInteger)length { NSIndexPath *found; - unsigned h = 0; - unsigned i; + NSUInteger h = 0; + NSUInteger i; if (_length != 0) { @@ -377,8 +380,8 @@ static NSIndexPath *dummy = nil; _hash = dummy->_hash; _length = dummy->_length; _indexes = NSZoneMalloc(NSDefaultMallocZone(), - _length * sizeof(unsigned)); - memcpy(_indexes, dummy->_indexes, _length * sizeof(unsigned)); + _length * sizeof(NSUInteger)); + memcpy(_indexes, dummy->_indexes, _length * sizeof(NSUInteger)); NSHashInsert(shared, self); } else @@ -406,8 +409,8 @@ static NSIndexPath *dummy = nil; } else { - unsigned *oindexes = ((NSIndexPath*)other)->_indexes; - unsigned pos = _length; + NSUInteger *oindexes = ((NSIndexPath*)other)->_indexes; + NSUInteger pos = _length; while (pos-- > 0) { @@ -420,7 +423,7 @@ static NSIndexPath *dummy = nil; return YES; } -- (unsigned) length +- (NSUInteger) length { return _length; } diff --git a/Source/NSIndexSet.m b/Source/NSIndexSet.m index ffb076dcc..514c7a880 100644 --- a/Source/NSIndexSet.m +++ b/Source/NSIndexSet.m @@ -44,9 +44,9 @@ static void sanity(GSIArray array) { if (array != 0) { - unsigned c = GSIArrayCount(array); - unsigned i; - unsigned last = 0; + NSUInteger c = GSIArrayCount(array); + NSUInteger i; + NSUInteger last = 0; for (i = 0; i < c; i++) { @@ -70,11 +70,11 @@ static void sanity(GSIArray array) * index greater than the argument (or a position beyond the end of the * array). */ -static unsigned posForIndex(GSIArray array, unsigned index) +static NSUInteger posForIndex(GSIArray array, NSUInteger index) { - unsigned int upper = GSIArrayCount(array); - unsigned int lower = 0; - unsigned int pos; + NSUInteger upper = GSIArrayCount(array); + NSUInteger lower = 0; + NSUInteger pos; /* * Binary search for an item equal to the one to be inserted. @@ -116,7 +116,7 @@ static unsigned posForIndex(GSIArray array, unsigned index) return AUTORELEASE(o); } -+ (id) indexSetWithIndex: (unsigned int)anIndex ++ (id) indexSetWithIndex: (NSUInteger)anIndex { id o = [self allocWithZone: NSDefaultMallocZone()]; @@ -132,9 +132,9 @@ static unsigned posForIndex(GSIArray array, unsigned index) return AUTORELEASE(o); } -- (BOOL) containsIndex: (unsigned int)anIndex +- (BOOL) containsIndex: (NSUInteger)anIndex { - unsigned pos; + NSUInteger pos; NSRange r; if (_array == 0 || GSIArrayCount(_array) == 0 @@ -148,11 +148,11 @@ static unsigned posForIndex(GSIArray array, unsigned index) - (BOOL) containsIndexes: (NSIndexSet*)aSet { - unsigned count = _other ? GSIArrayCount(_other) : 0; + NSUInteger count = _other ? GSIArrayCount(_other) : 0; if (count > 0) { - unsigned i; + NSUInteger i; for (i = 0; i < count; i++) { @@ -169,7 +169,7 @@ static unsigned posForIndex(GSIArray array, unsigned index) - (BOOL) containsIndexesInRange: (NSRange)aRange { - unsigned pos; + NSUInteger pos; NSRange r; if (NSNotFound - aRange.length < aRange.location) @@ -210,7 +210,7 @@ static unsigned posForIndex(GSIArray array, unsigned index) } } -- (unsigned int) count +- (NSUInteger) count { if (_array == 0 || GSIArrayCount(_array) == 0) { @@ -218,9 +218,9 @@ static unsigned posForIndex(GSIArray array, unsigned index) } else { - unsigned count = GSIArrayCount(_array); - unsigned total = 0; - unsigned i = 0; + NSUInteger count = GSIArrayCount(_array); + NSUInteger total = 0; + NSUInteger i = 0; while (i < count) { @@ -239,9 +239,9 @@ static unsigned posForIndex(GSIArray array, unsigned index) } else { - unsigned count = GSIArrayCount(_array); - unsigned total = 0; - unsigned i = 0; + NSUInteger count = GSIArrayCount(_array); + NSUInteger total = 0; + NSUInteger i = 0; while (i < count) { @@ -269,8 +269,8 @@ static unsigned posForIndex(GSIArray array, unsigned index) - (NSString*) description { NSMutableString *m; - unsigned c = (_array == 0) ? 0 : GSIArrayCount(_array); - unsigned i; + NSUInteger c = (_array == 0) ? 0 : GSIArrayCount(_array); + NSUInteger i; if (c == 0) { @@ -299,7 +299,7 @@ static unsigned posForIndex(GSIArray array, unsigned index) - (void) encodeWithCoder: (NSCoder*)aCoder { - unsigned rangeCount = 0; + NSUInteger rangeCount = 0; if (_array != 0) { @@ -312,7 +312,7 @@ static unsigned posForIndex(GSIArray array, unsigned index) } else { - [aCoder encodeValueOfObjCType: @encode(unsigned int) + [aCoder encodeValueOfObjCType: @encode(NSUInteger) at: &rangeCount]; } @@ -332,21 +332,21 @@ static unsigned posForIndex(GSIArray array, unsigned index) } else { - [aCoder encodeValueOfObjCType: @encode(unsigned int) + [aCoder encodeValueOfObjCType: @encode(NSUInteger) at: &r.location]; - [aCoder encodeValueOfObjCType: @encode(unsigned int) + [aCoder encodeValueOfObjCType: @encode(NSUInteger) at: &r.length]; } } else { NSMutableData *m = [NSMutableData dataWithCapacity: rangeCount*2]; - unsigned i; + NSUInteger i; for (i = 0; i < rangeCount; i++) { NSRange r; - unsigned v; + NSUInteger v; uint8_t b; r = GSIArrayItemAtIndex(_array, i).ext; @@ -392,7 +392,7 @@ static unsigned posForIndex(GSIArray array, unsigned index) } } -- (unsigned int) firstIndex +- (NSUInteger) firstIndex { if (_array == 0 || GSIArrayCount(_array) == 0) { @@ -401,12 +401,12 @@ static unsigned posForIndex(GSIArray array, unsigned index) return GSIArrayItemAtIndex(_array, 0).ext.location; } -- (unsigned int) getIndexes: (unsigned int*)aBuffer - maxCount: (unsigned int)aCount - inIndexRange: (NSRangePointer)aRange +- (NSUInteger) getIndexes: (NSUInteger*)aBuffer + maxCount: (NSUInteger)aCount + inIndexRange: (NSRangePointer)aRange { - unsigned pos; - unsigned i = 0; + NSUInteger pos; + NSUInteger i = 0; NSRange r; NSRange fullRange; @@ -439,7 +439,7 @@ static unsigned posForIndex(GSIArray array, unsigned index) r = GSIArrayItemAtIndex(_array, pos).ext; if (aRange->location < r.location) { - unsigned skip = r.location - aRange->location; + NSUInteger skip = r.location - aRange->location; if (skip > aRange->length) { @@ -465,14 +465,14 @@ static unsigned posForIndex(GSIArray array, unsigned index) return i; } -- (unsigned int) hash +- (NSUInteger) hash { return [self count]; } -- (unsigned int) indexGreaterThanIndex: (unsigned int)anIndex +- (NSUInteger) indexGreaterThanIndex: (NSUInteger)anIndex { - unsigned pos; + NSUInteger pos; NSRange r; if (anIndex++ == NSNotFound) @@ -492,9 +492,9 @@ static unsigned posForIndex(GSIArray array, unsigned index) return r.location; } -- (unsigned int) indexGreaterThanOrEqualToIndex: (unsigned int)anIndex +- (NSUInteger) indexGreaterThanOrEqualToIndex: (NSUInteger)anIndex { - unsigned pos; + NSUInteger pos; NSRange r; if (anIndex == NSNotFound) @@ -514,9 +514,9 @@ static unsigned posForIndex(GSIArray array, unsigned index) return r.location; } -- (unsigned int) indexLessThanIndex: (unsigned int)anIndex +- (NSUInteger) indexLessThanIndex: (NSUInteger)anIndex { - unsigned pos; + NSUInteger pos; NSRange r; if (anIndex-- == 0) @@ -541,9 +541,9 @@ static unsigned posForIndex(GSIArray array, unsigned index) return NSMaxRange(r) - 1; } -- (unsigned int) indexLessThanOrEqualToIndex: (unsigned int)anIndex +- (NSUInteger) indexLessThanOrEqualToIndex: (NSUInteger)anIndex { - unsigned pos; + NSUInteger pos; NSRange r; if (_array == 0 || GSIArrayCount(_array) == 0 @@ -571,7 +571,7 @@ static unsigned posForIndex(GSIArray array, unsigned index) - (id) initWithCoder: (NSCoder*)aCoder { - unsigned rangeCount = 0; + NSUInteger rangeCount = 0; if ([aCoder allowsKeyedCoding]) { @@ -582,7 +582,7 @@ static unsigned posForIndex(GSIArray array, unsigned index) } else { - [aCoder decodeValueOfObjCType: @encode(unsigned int) + [aCoder decodeValueOfObjCType: @encode(NSUInteger) at: &rangeCount]; } @@ -592,8 +592,8 @@ static unsigned posForIndex(GSIArray array, unsigned index) } else if (rangeCount == 1) { - unsigned len = 0; - unsigned loc = 0; + NSUInteger len = 0; + NSUInteger loc = 0; if ([aCoder allowsKeyedCoding]) { @@ -608,9 +608,9 @@ static unsigned posForIndex(GSIArray array, unsigned index) } else { - [aCoder decodeValueOfObjCType: @encode(unsigned int) + [aCoder decodeValueOfObjCType: @encode(NSUInteger) at: &loc]; - [aCoder decodeValueOfObjCType: @encode(unsigned int) + [aCoder decodeValueOfObjCType: @encode(NSUInteger) at: &len]; } self = [self initWithIndexesInRange: NSMakeRange(loc, len)]; @@ -620,8 +620,8 @@ static unsigned posForIndex(GSIArray array, unsigned index) NSMutableIndexSet *other = [NSMutableIndexSet new]; NSData *data = nil; const uint8_t *bytes; - unsigned length; - unsigned index = 0; + NSUInteger length; + NSUInteger index = 0; if ([aCoder allowsKeyedCoding]) { @@ -639,9 +639,9 @@ static unsigned posForIndex(GSIArray array, unsigned index) while (index < length) { NSRange range; - unsigned offset; - unsigned value; - unsigned next; + NSUInteger offset; + NSUInteger value; + NSUInteger next; for (offset = 0; index + offset < length; offset++) { @@ -697,7 +697,7 @@ static unsigned posForIndex(GSIArray array, unsigned index) return self; } -- (id) initWithIndex: (unsigned int)anIndex +- (id) initWithIndex: (NSUInteger)anIndex { if (anIndex == NSNotFound) { @@ -742,11 +742,11 @@ static unsigned posForIndex(GSIArray array, unsigned index) } else { - unsigned count = _other ? GSIArrayCount(_other) : 0; + NSUInteger count = _other ? GSIArrayCount(_other) : 0; if (count > 0) { - unsigned i; + NSUInteger i; #if GS_WITH_GC _data = (GSIArray)NSAllocateCollectable(sizeof(GSIArray_t), @@ -767,8 +767,8 @@ static unsigned posForIndex(GSIArray array, unsigned index) - (BOOL) intersectsIndexesInRange: (NSRange)aRange { - unsigned p1; - unsigned p2; + NSUInteger p1; + NSUInteger p2; if (NSNotFound - aRange.length < aRange.location) { @@ -813,7 +813,7 @@ static unsigned posForIndex(GSIArray array, unsigned index) - (BOOL) isEqualToIndexSet: (NSIndexSet*)aSet { - unsigned count = _other ? GSIArrayCount(_other) : 0; + NSUInteger count = _other ? GSIArrayCount(_other) : 0; if (count != (_array ? GSIArrayCount(_array) : 0)) { @@ -821,7 +821,7 @@ static unsigned posForIndex(GSIArray array, unsigned index) } if (count > 0) { - unsigned i; + NSUInteger i; for (i = 0; i < count; i++) { @@ -837,7 +837,7 @@ static unsigned posForIndex(GSIArray array, unsigned index) return YES; } -- (unsigned int) lastIndex +- (NSUInteger) lastIndex { if (_array == 0 || GSIArrayCount(_array) == 0) { @@ -861,18 +861,18 @@ static unsigned posForIndex(GSIArray array, unsigned index) #undef _other #define _other ((GSIArray)(((NSMutableIndexSet*)aSet)->_data)) -- (void) addIndex: (unsigned int)anIndex +- (void) addIndex: (NSUInteger)anIndex { [self addIndexesInRange: NSMakeRange(anIndex, 1)]; } - (void) addIndexes: (NSIndexSet*)aSet { - unsigned count = _other ? GSIArrayCount(_other) : 0; + NSUInteger count = _other ? GSIArrayCount(_other) : 0; if (count > 0) { - unsigned i; + NSUInteger i; for (i = 0; i < count; i++) { @@ -885,7 +885,7 @@ static unsigned posForIndex(GSIArray array, unsigned index) - (void) addIndexesInRange: (NSRange)aRange { - unsigned pos; + NSUInteger pos; if (NSNotFound - aRange.length < aRange.location) { @@ -991,18 +991,18 @@ static unsigned posForIndex(GSIArray array, unsigned index) } } -- (void) removeIndex: (unsigned int)anIndex +- (void) removeIndex: (NSUInteger)anIndex { [self removeIndexesInRange: NSMakeRange(anIndex, 1)]; } - (void) removeIndexes: (NSIndexSet*)aSet { - unsigned count = _other ? GSIArrayCount(_other) : 0; + NSUInteger count = _other ? GSIArrayCount(_other) : 0; if (count > 0) { - unsigned i; + NSUInteger i; for (i = 0; i < count; i++) { @@ -1015,7 +1015,7 @@ static unsigned posForIndex(GSIArray array, unsigned index) - (void) removeIndexesInRange: (NSRange)aRange { - unsigned pos; + NSUInteger pos; NSRange r; if (NSNotFound - aRange.length < aRange.location) @@ -1126,12 +1126,12 @@ static unsigned posForIndex(GSIArray array, unsigned index) SANITY(); } -- (void) shiftIndexesStartingAtIndex: (unsigned int)anIndex by: (int)amount +- (void) shiftIndexesStartingAtIndex: (NSUInteger)anIndex by: (NSInteger)amount { if (amount != 0 && _array != 0 && GSIArrayCount(_array) > 0) { - unsigned c; - unsigned pos; + NSUInteger c; + NSUInteger pos; if (amount > 0) { @@ -1238,9 +1238,9 @@ static unsigned posForIndex(GSIArray array, unsigned index) @implementation NSIndexSet (NSCharacterSet) /* Extra method to let NSCharacterSet play with index sets more efficiently. */ -- (unsigned int) _gapGreaterThanIndex: (unsigned int)anIndex +- (NSUInteger) _gapGreaterThanIndex: (NSUInteger)anIndex { - unsigned pos; + NSUInteger pos; NSRange r; if (anIndex++ == NSNotFound) @@ -1290,7 +1290,7 @@ static unsigned posForIndex(GSIArray array, unsigned index) [super dealloc]; } -- (id) _initWithBytes: (const void*)bytes length: (unsigned)length +- (id) _initWithBytes: (const void*)bytes length: (NSUInteger)length { NSAssert(length % sizeof(NSRange) == 0, NSInvalidArgumentException); length /= sizeof(NSRange); diff --git a/Source/NSInvocation.m b/Source/NSInvocation.m index 371089a47..5a1a7e2b4 100644 --- a/Source/NSInvocation.m +++ b/Source/NSInvocation.m @@ -62,7 +62,7 @@ @implementation GSCodeBuffer -+ (GSCodeBuffer*) memoryWithSize: (unsigned)_size ++ (GSCodeBuffer*) memoryWithSize: (NSUInteger)_size { return [[[self alloc] initWithSize: _size] autorelease]; } @@ -87,7 +87,7 @@ [super dealloc]; } -- (id) initWithSize: (unsigned)_size +- (id) initWithSize: (NSUInteger)_size { #if defined(HAVE_MMAP) #if defined(HAVE_MPROTECT) @@ -365,9 +365,9 @@ _arg_addr(NSInvocation *inv, int index) * so the actual method arguments start at index 2. */ - (void) getArgument: (void*)buffer - atIndex: (int)index + atIndex: (NSInteger)index { - if ((unsigned)index >= _numArgs) + if ((NSUInteger)index >= _numArgs) { [NSException raise: NSInvalidArgumentException format: @"bad invocation argument index"]; @@ -439,9 +439,9 @@ _arg_addr(NSInvocation *inv, int index) * receiver is retained by it. */ - (void) setArgument: (void*)buffer - atIndex: (int)index + atIndex: (NSInteger)index { - if ((unsigned)index >= _numArgs) + if ((NSUInteger)index >= _numArgs) { [NSException raise: NSInvalidArgumentException format: @"bad invocation argument index"]; @@ -999,19 +999,19 @@ _arg_addr(NSInvocation *inv, int index) CASE_TYPE(_C_SEL, SEL); CASE_TYPE(_C_LNG, long); CASE_TYPE(_C_ULNG, unsigned long); - CASE_TYPE(_C_INT, int); - CASE_TYPE(_C_UINT, unsigned int); + CASE_TYPE(_C_INT, NSInteger); + CASE_TYPE(_C_UINT, NSUInteger); case _C_SHT: - *(short*)datum = (short)va_arg(ap, int); + *(short*)datum = (short)va_arg(ap, NSInteger); break; case _C_USHT: - *(unsigned short*)datum = (unsigned short)va_arg(ap, int); + *(unsigned short*)datum = (unsigned short)va_arg(ap, NSInteger); break; case _C_CHR: - *(char*)datum = (char)va_arg(ap, int); + *(char*)datum = (char)va_arg(ap, NSInteger); break; case _C_UCHR: - *(unsigned char*)datum = (unsigned char)va_arg(ap, int); + *(unsigned char*)datum = (unsigned char)va_arg(ap, NSInteger); break; case _C_FLT: *(float*)datum = (float)va_arg(ap, double); @@ -1025,7 +1025,7 @@ _arg_addr(NSInvocation *inv, int index) /* FIXME: This only appears on sparc and ppc machines so far. structures appear to be aligned on word boundaries. Hopefully there is a more general way to figure this out */ - size = (size= _numArgs) { @@ -67,12 +67,12 @@ return _info[index+1]; } -- (unsigned) frameLength +- (NSUInteger) frameLength { return _argFrameLength; } -- (const char*) getArgumentTypeAtIndex: (unsigned)index +- (const char*) getArgumentTypeAtIndex: (NSUInteger)index { if (index >= _numArgs) { @@ -95,7 +95,7 @@ return (_info[0].qual & _F_ONEWAY) ? YES : NO; } -- (unsigned) methodReturnLength +- (NSUInteger) methodReturnLength { if (_info == 0) { @@ -113,7 +113,7 @@ return _info[0].type; } -- (unsigned) numberOfArguments +- (NSUInteger) numberOfArguments { return _numArgs; } diff --git a/Source/NSNetServices.m b/Source/NSNetServices.m index c50a3d7af..489ac9f35 100644 --- a/Source/NSNetServices.m +++ b/Source/NSNetServices.m @@ -370,7 +370,7 @@ static void DNSSD_API * */ -- (void) searchForDomain: (int) aFlag +- (void) searchForDomain: (NSInteger) aFlag { DNSServiceErrorType err = kDNSServiceErr_NoError; Browser *browser; @@ -1899,7 +1899,7 @@ static void DNSSD_API - (id) initWithDomain: (NSString *) domain type: (NSString *) type name: (NSString *) name - port: (int) port + port: (NSInteger) port { INTERNALTRACE; diff --git a/Source/NSNotificationQueue.m b/Source/NSNotificationQueue.m index ba539b247..668c9d319 100644 --- a/Source/NSNotificationQueue.m +++ b/Source/NSNotificationQueue.m @@ -392,7 +392,7 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification, * not posted. */ - (void) dequeueNotificationsMatching: (NSNotification*)notification - coalesceMask: (unsigned int)coalesceMask + coalesceMask: (NSUInteger)coalesceMask { NSNotificationQueueRegistration *item; NSNotificationQueueRegistration *next; @@ -507,7 +507,7 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification, */ - (void) enqueueNotification: (NSNotification*)notification postingStyle: (NSPostingStyle)postingStyle - coalesceMask: (unsigned int)coalesceMask + coalesceMask: (NSUInteger)coalesceMask forModes: (NSArray*)modes { if (coalesceMask != NSNotificationNoCoalescing) diff --git a/Source/NSNumber.m b/Source/NSNumber.m index 62ec6d874..242544964 100644 --- a/Source/NSNumber.m +++ b/Source/NSNumber.m @@ -166,6 +166,8 @@ static Class shortNumberClass; static Class uShortNumberClass; static Class intNumberClass; static Class uIntNumberClass; +static Class integerNumberClass; +static Class uIntegerNumberClass; static Class longNumberClass; static Class uLongNumberClass; static Class longLongNumberClass; @@ -232,6 +234,22 @@ static Class doubleNumberClass; doubleNumberClass = [NSDoubleNumber class]; GSNumberInfoFromObject(AUTORELEASE([doubleNumberClass alloc])); + if (sizeof(NSInteger) == sizeof(int)) + { + integerNumberClass = intNumberClass; + uIntegerNumberClass = uIntNumberClass; + } + else if (sizeof(NSInteger) == sizeof(long)) + { + integerNumberClass = longNumberClass; + uIntegerNumberClass = uLongNumberClass; + } + else + { + integerNumberClass = longLongNumberClass; + uIntegerNumberClass = uLongLongNumberClass; + } + /* * cache bool values. */ @@ -437,6 +455,30 @@ static Class doubleNumberClass; return AUTORELEASE(theObj); } ++ (NSNumber*) numberWithInteger: (NSInteger)value +{ + NSNumber *theObj = nil; + + // if class is NSNumber, replace by appropriate object + if (self == abstractClass) + { + if (value <= GS_SMALL && value >= -GS_SMALL) + { + return smallIntegers[value + GS_SMALL]; + } + theObj = (NSNumber*)NSAllocateObject(integerNumberClass, 0, + NSDefaultMallocZone()); + theObj = [theObj initWithBytes: &value objCType: NULL]; + } + else // alloc class and init with object intWithXX method + { + theObj = [[self allocWithZone: NSDefaultMallocZone()] + initWithInteger: value]; + } + + return AUTORELEASE(theObj); +} + + (NSNumber*) numberWithLong: (signed long)value { NSNumber *theObj = nil; @@ -557,6 +599,30 @@ static Class doubleNumberClass; return AUTORELEASE(theObj); } ++ (NSNumber*) numberWithUnsignedInteger: (NSUInteger)value +{ + NSNumber *theObj = nil; + + // if class is NSNumber, replace by appropriate object + if (self == abstractClass) + { + if (value <= GS_SMALL) + { + return smallIntegers[value + GS_SMALL]; + } + theObj = (NSNumber*)NSAllocateObject(uIntegerNumberClass, 0, + NSDefaultMallocZone()); + theObj = [theObj initWithBytes: &value objCType: NULL]; + } + else // alloc class and init with object intWithXX method + { + theObj = [[self allocWithZone: NSDefaultMallocZone()] + initWithUnsignedInteger: value]; + } + + return AUTORELEASE(theObj); +} + + (NSNumber*) numberWithUnsignedLong: (unsigned long)value { NSNumber *theObj = nil; @@ -695,6 +761,19 @@ static Class doubleNumberClass; return self; } +- (id) initWithInteger: (NSInteger)value +{ + RELEASE(self); + if (value <= GS_SMALL && value >= -GS_SMALL) + { + return RETAIN(smallIntegers[value + GS_SMALL]); + } + self = (NSNumber*)NSAllocateObject(integerNumberClass, 0, + NSDefaultMallocZone()); + self = [self initWithBytes: &value objCType: NULL]; + return self; +} + - (id) initWithLong: (signed long)value { RELEASE(self); @@ -760,6 +839,19 @@ static Class doubleNumberClass; return self; } +- (id) initWithUnsignedInteger: (NSUInteger)value +{ + RELEASE(self); + if (value <= GS_SMALL) + { + return RETAIN(smallIntegers[value + GS_SMALL]); + } + self = (NSNumber*)NSAllocateObject(uIntegerNumberClass, 0, + NSDefaultMallocZone()); + self = [self initWithBytes: &value objCType: NULL]; + return self; +} + - (id) initWithUnsignedLong: (unsigned long)value { RELEASE(self); @@ -1450,6 +1542,116 @@ static Class doubleNumberClass; return 0; } +- (NSInteger) integerValue +{ + if (GSObjCClass(self) == abstractClass) + [NSException raise: NSInternalInconsistencyException + format: @"get integerValue from abstract NSNumber"]; + else + { + GSNumberInfo *info = GSNumberInfoFromObject(self); + + switch (info->typeLevel) + { + case 0: + { + BOOL oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 1: + { + signed char oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 2: + { + unsigned char oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 3: + { + signed short oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 4: + { + unsigned short oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 5: + { + signed int oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 6: + { + unsigned int oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 7: + { + signed long oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 8: + { + unsigned long oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 9: + { + signed long long oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 10: + { + unsigned long long oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 11: + { + float oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 12: + { + double oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + default: + [NSException raise: NSInvalidArgumentException + format: @"unknown number type value for get"]; + } + } + return 0; +} + - (signed long long) longLongValue { if (GSObjCClass(self) == abstractClass) @@ -2005,6 +2207,116 @@ static Class doubleNumberClass; return 0; } +- (NSUInteger) unsignedIntegerValue +{ + if (GSObjCClass(self) == abstractClass) + [NSException raise: NSInternalInconsistencyException + format: @"get unsignedIntegerValue from abstract NSNumber"]; + else + { + GSNumberInfo *info = GSNumberInfoFromObject(self); + + switch (info->typeLevel) + { + case 0: + { + BOOL oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 1: + { + signed char oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 2: + { + unsigned char oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 3: + { + signed short oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 4: + { + unsigned short oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 5: + { + signed int oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 6: + { + unsigned int oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 7: + { + signed long oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 8: + { + unsigned long oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 9: + { + signed long long oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 10: + { + unsigned long long oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 11: + { + float oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + case 12: + { + double oData; + + (*(info->getValue))(self, @selector(getValue:), &oData); + return oData; + } + default: + [NSException raise: NSInvalidArgumentException + format: @"unknown number type value for get"]; + } + } + return 0; +} + - (unsigned long long) unsignedLongLongValue { if (GSObjCClass(self) == abstractClass) diff --git a/Source/NSObject.m b/Source/NSObject.m index e02d9935e..959302af4 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -324,7 +324,7 @@ static objc_mutex_t allocationLocks[LOCKCOUNT] = { 0 }; static inline objc_mutex_t GSAllocationLockForObject(id p) { - unsigned i = ((((unsigned)(uintptr_t)p) >> ALIGNBITS) & LOCKMASK); + NSUInteger i = ((((NSUInteger)(uintptr_t)p) >> ALIGNBITS) & LOCKMASK); return allocationLocks[i]; } @@ -344,7 +344,7 @@ static inline objc_mutex_t GSAllocationLockForObject(id p) */ typedef struct obj_layout_unpadded { #if defined(REFCNT_LOCAL) - unsigned retained; + NSUInteger retained; #endif #if defined(CACHE_ZONE) NSZone *zone; @@ -359,7 +359,7 @@ typedef struct obj_layout_unpadded { */ struct obj_layout { #if defined(REFCNT_LOCAL) - unsigned retained; + NSUInteger retained; #endif #if defined(CACHE_ZONE) NSZone *zone; @@ -406,8 +406,8 @@ NSDecrementExtraRefCountWasZero(id anObject) #if !GS_WITH_GC if (double_release_check_enabled) { - unsigned release_count; - unsigned retain_count = [anObject retainCount]; + NSUInteger release_count; + NSUInteger retain_count = [anObject retainCount]; release_count = [autorelease_class autoreleaseCountForObject: anObject]; if (release_count >= retain_count) [NSException raise: NSGenericException @@ -486,7 +486,7 @@ NSDecrementExtraRefCountWasZero(id anObject) } else { - (node->value.uint)--; + (node->value.uNSInteger)--; } objc_mutex_unlock(allocationLock); } @@ -497,14 +497,14 @@ NSDecrementExtraRefCountWasZero(id anObject) { return YES; } - if ((node->value.uint) == 0) + if ((node->value.uNSInteger) == 0) { GSIMapRemoveKey((GSIMapTable)&retain_counts, (GSIMapKey)anObject); return YES; } else { - --(node->value.uint); + --(node->value.uNSInteger); } } #endif @@ -517,7 +517,7 @@ NSDecrementExtraRefCountWasZero(id anObject) * from 0 to the maximum unsigned integer value minus one).
* The retain count for an object is this value plus one. */ -inline unsigned +inline NSUInteger NSExtraRefCount(id anObject) { #if GS_WITH_GC @@ -527,7 +527,7 @@ NSExtraRefCount(id anObject) return ((obj)anObject)[-1].retained; #else GSIMapNode node; - unsigned ret; + NSUInteger ret; if (allocationLock != 0) { @@ -620,14 +620,14 @@ NSIncrementExtraRefCount(id anObject) node = GSIMapNodeForKey(&retain_counts, (GSIMapKey)anObject); if (node != 0) { - if ((node->value.uint) == UINT_MAX - 1) + if ((node->value.uNSInteger) == UINT_MAX - 1) { objc_mutex_unlock(allocationLock); [NSException raise: NSInternalInconsistencyException format: @"NSIncrementExtraRefCount() asked to increment too far"]; } - (node->value.uint)++; + (node->value.uNSInteger)++; } else { @@ -640,13 +640,13 @@ NSIncrementExtraRefCount(id anObject) node = GSIMapNodeForKey(&retain_counts, (GSIMapKey)anObject); if (node != 0) { - if ((node->value.uint) == UINT_MAX - 1) + if ((node->value.uNSInteger) == UINT_MAX - 1) { [NSException raise: NSInternalInconsistencyException format: @"NSIncrementExtraRefCount() asked to increment too far"]; } - (node->value.uint)++; + (node->value.uNSInteger)++; } else { @@ -684,7 +684,7 @@ GSFinalize(void* object, void* data) } inline NSObject * -NSAllocateObject(Class aClass, unsigned extraBytes, NSZone *zone) +NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone) { id new; int size; @@ -764,7 +764,7 @@ GSObjCZone(NSObject *object) #endif /* defined(CACHE_ZONE) */ inline NSObject * -NSAllocateObject (Class aClass, unsigned extraBytes, NSZone *zone) +NSAllocateObject (Class aClass, NSUInteger extraBytes, NSZone *zone) { #ifndef NDEBUG extern void GSDebugAllocationAdd(Class c, id o); @@ -836,7 +836,7 @@ GSObjCZone(NSObject *object) } inline NSObject * -NSAllocateObject (Class aClass, unsigned extraBytes, NSZone *zone) +NSAllocateObject (Class aClass, NSUInteger extraBytes, NSZone *zone) { id new; int size; @@ -1050,7 +1050,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) if (allocationLock == 0) { #if defined(REFCNT_LOCAL) && !defined(GSATOMICREAD) - unsigned i; + NSUInteger i; for (i = 0; i < LOCKCOUNT; i++) { @@ -1108,7 +1108,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) } #else /* HAVE_SIGACTION */ { - void (*handler)(int); + void (*handler)(NSInteger); handler = signal(SIGPIPE, SIG_IGN); if (handler != SIG_DFL) @@ -1508,7 +1508,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) for (proto_list = ((struct objc_class*)self)->protocols; proto_list; proto_list = proto_list->next) { - unsigned int i; + NSUInteger i; for (i = 0; i < proto_list->count; i++) { @@ -1638,7 +1638,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) while (found == NO && protocols != 0) { - unsigned i = 0; + NSUInteger i = 0; while (found == NO && i < protocols->count) { @@ -1824,8 +1824,8 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) #if GS_WITH_GC == 0 if (double_release_check_enabled) { - unsigned release_count; - unsigned retain_count = [self retainCount]; + NSUInteger release_count; + NSUInteger retain_count = [self retainCount]; release_count = [autorelease_class autoreleaseCountForObject:self]; if (release_count > retain_count) [NSException @@ -1863,7 +1863,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) * The default implementation returns a value based on the address * of the instance. */ -- (unsigned) hash +- (NSUInteger) hash { /* * Ideally we would shift left to lose any zero bits produced by the @@ -1872,7 +1872,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) * In the absence of detailed information, pick a reasonable value * assuming the object will be aligned to an eight byte boundary. */ - return (unsigned)(uintptr_t)self >> 3; + return (NSUInteger)(uintptr_t)self >> 3; } /** @@ -2108,7 +2108,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) * By convention, objects which should (or can) never be deallocated * return the maximum unsigned integer value. */ -- (unsigned) retainCount +- (NSUInteger) retainCount { #if GS_WITH_GC return UINT_MAX; @@ -2122,7 +2122,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) * the maximum unsigned integer value, as classes can not be deallocated * the retain count mechanism is a dummy system for them. */ -+ (unsigned) retainCount ++ (NSUInteger) retainCount { return UINT_MAX; } @@ -2168,7 +2168,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) * a number assigned by the Objective C compiler if [NSObject -setVersion] has * not been called. */ -+ (int) version ++ (NSInteger) version { return class_get_version(self); } @@ -2176,7 +2176,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) /** * Sets the version number of the receiving class. Should be nonnegative. */ -+ (id) setVersion: (int)aVersion ++ (id) setVersion: (NSInteger)aVersion { if (aVersion < 0) [NSException raise: NSInvalidArgumentException @@ -2387,13 +2387,13 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) * level information. */ - (NSString*) descriptionWithLocale: (NSDictionary*)aLocale - indent: (unsigned)level + indent: (NSUInteger)level { return [self descriptionWithLocale: aLocale]; } + (NSString*) descriptionWithLocale: (NSDictionary*)aLocale - indent: (unsigned)level + indent: (NSUInteger)level { return [self descriptionWithLocale: aLocale]; } @@ -2489,7 +2489,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) return 0; } -+ (int) streamVersion: (TypedStream*)aStream ++ (NSInteger) streamVersion: (TypedStream*)aStream { #ifndef NeXT_RUNTIME if (aStream->mode == OBJC_READONLY) @@ -2611,7 +2611,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) } - (void) forwardInvocation: (NSInvocation*)anInvocation { - unsigned size = [[anInvocation methodSignature] methodReturnLength]; + NSUInteger size = [[anInvocation methodSignature] methodReturnLength]; unsigned char v[size]; memset(v, '\0', size); diff --git a/Source/NSPathUtilities.m b/Source/NSPathUtilities.m index b86d7bb07..fdd0180f7 100644 --- a/Source/NSPathUtilities.m +++ b/Source/NSPathUtilities.m @@ -722,13 +722,13 @@ GNUstepConfig(NSDictionary *newConfig) "The file '%S' is writable by someone other than" " its owner (permissions 0%lo).\nIgnoring it.\n", [defs fileSystemRepresentation], - [attributes filePosixPermissions]); + (long)[attributes filePosixPermissions]); #else fprintf(stderr, "The file '%s' is writable by someone other than" " its owner (permissions 0%lo).\nIgnoring it.\n", [defs fileSystemRepresentation], - [attributes filePosixPermissions]); + (long)[attributes filePosixPermissions]); #endif d = nil; } @@ -1039,7 +1039,7 @@ ParseConfigurationFile(NSString *fileName, NSMutableDictionary *dict, fprintf(stderr, "The file '%s' is writable by someone other than" " its owner (permissions 0%lo).\nIgnoring it.\n", [fileName fileSystemRepresentation], - [attributes filePosixPermissions]); + (long)[attributes filePosixPermissions]); #endif return NO; } diff --git a/Source/NSPort.m b/Source/NSPort.m index 4f4e7443f..c36f20d24 100644 --- a/Source/NSPort.m +++ b/Source/NSPort.m @@ -103,7 +103,7 @@ static Class NSPort_concrete_class; return AUTORELEASE([self new]); } -+ (NSPort*) portWithMachPort: (int)machPort ++ (NSPort*) portWithMachPort: (NSInteger)machPort { return AUTORELEASE([[self alloc] initWithMachPort: machPort]); } @@ -141,7 +141,7 @@ static Class NSPort_concrete_class; return self; } -- (id) initWithMachPort: (int)machPort +- (id) initWithMachPort: (NSInteger)machPort { [self shouldNotImplement: _cmd]; return nil; @@ -167,7 +167,7 @@ static Class NSPort_concrete_class; return _is_valid; } -- (int) machPort +- (NSInteger) machPort { [self shouldNotImplement: _cmd]; return 0; @@ -221,7 +221,7 @@ static Class NSPort_concrete_class; [aLoop removePort: self forMode: aMode]; } -- (unsigned) reservedSpaceLength +- (NSUInteger) reservedSpaceLength { [self subclassResponsibility: _cmd]; return 0; @@ -230,7 +230,7 @@ static Class NSPort_concrete_class; - (BOOL) sendBeforeDate: (NSDate*)when components: (NSMutableArray*)components from: (NSPort*)receivingPort - reserved: (unsigned) length + reserved: (NSUInteger)length { return [self sendBeforeDate: when msgid: 0 @@ -240,10 +240,10 @@ static Class NSPort_concrete_class; } - (BOOL) sendBeforeDate: (NSDate*)when - msgid: (int)msgid + msgid: (NSInteger)msgid components: (NSMutableArray*)components from: (NSPort*)receivingPort - reserved: (unsigned)length + reserved: (NSUInteger)length { [self subclassResponsibility: _cmd]; return YES; diff --git a/Source/NSPredicate.m b/Source/NSPredicate.m index 6cfb17943..6caa2aa72 100644 --- a/Source/NSPredicate.m +++ b/Source/NSPredicate.m @@ -184,13 +184,13 @@ case 'c': ptr++; [arr addObject: [NSNumber numberWithChar: - (char)va_arg(args, int)]]; + (char)va_arg(args, NSInteger)]]; break; case 'C': ptr++; [arr addObject: [NSNumber numberWithShort: - (short)va_arg(args, int)]]; + (short)va_arg(args, NSInteger)]]; break; case 'd': @@ -198,7 +198,7 @@ case 'i': ptr++; [arr addObject: [NSNumber numberWithInt: - va_arg(args, int)]]; + va_arg(args, NSInteger)]]; break; case 'o': @@ -209,7 +209,7 @@ case 'X': ptr++; [arr addObject: [NSNumber numberWithUnsignedInt: - va_arg(args, unsigned int)]]; + va_arg(args, NSUInteger)]]; break; case 'e': @@ -230,12 +230,12 @@ if (c == 'i') { [arr addObject: [NSNumber numberWithShort: - (short)va_arg(args, int)]]; + (short)va_arg(args, NSInteger)]]; } if (c == 'u') { [arr addObject: [NSNumber numberWithUnsignedShort: - (unsigned short)va_arg(args, int)]]; + (unsigned short)va_arg(args, NSInteger)]]; } } break; @@ -616,7 +616,7 @@ rightExpression: (NSExpression *)right modifier: (NSComparisonPredicateModifier)modifier type: (NSPredicateOperatorType)type - options: (unsigned)opts + options: (NSUInteger)opts { return AUTORELEASE([[self alloc] initWithLeftExpression: left rightExpression: right @@ -643,7 +643,7 @@ rightExpression: (NSExpression *)right modifier: (NSComparisonPredicateModifier)modifier type: (NSPredicateOperatorType)type - options: (unsigned)opts + options: (NSUInteger)opts { if ((self = [super init]) != nil) { @@ -678,7 +678,7 @@ return _left; } -- (unsigned) options +- (NSUInteger) options { return _options; } diff --git a/Source/NSProcessInfo.m b/Source/NSProcessInfo.m index b0c349b23..ecc906bcb 100644 --- a/Source/NSProcessInfo.m +++ b/Source/NSProcessInfo.m @@ -572,7 +572,7 @@ static char **_gnu_noobjc_env = NULL; // Read commandline proc_file_name = (char*)objc_malloc(sizeof(char) * 2048); - sprintf(proc_file_name, "/proc/%d/psinfo", (int) getpid()); + sprintf(proc_file_name, "/proc/%d/psinfo", (int)getpid()); ifp = fopen(proc_file_name, "r"); if (ifp == NULL) @@ -681,7 +681,7 @@ static char **_gnu_noobjc_env = NULL; // Read commandline proc_file_name = (char *)objc_malloc(sizeof(char) * 2048); - sprintf(proc_file_name, "/proc/%d/cmdline", (int) getpid()); + sprintf(proc_file_name, "/proc/%d/cmdline", (int)getpid()); /* * We read the /proc file thrice. @@ -1147,7 +1147,7 @@ static void determineOperatingSystem() } } -- (unsigned int) operatingSystem +- (NSUInteger) operatingSystem { if (_operatingSystem == 0) { diff --git a/Source/NSPropertyList.m b/Source/NSPropertyList.m index 4eeacd74e..e5cbaa184 100644 --- a/Source/NSPropertyList.m +++ b/Source/NSPropertyList.m @@ -372,7 +372,7 @@ extern BOOL GSScanDouble(unichar*, unsigned, double*); - (id) initWithData: (NSData*)plData mutability: (NSPropertyListMutabilityOptions)m; - (id) rootObject; -- (id) objectAtIndex: (unsigned)index; +- (id) objectAtIndex: (NSUInteger)index; @end @@ -3019,7 +3019,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml, return [self objectAtIndex: 0]; } -- (id) objectAtIndex: (unsigned)index +- (id) objectAtIndex: (NSUInteger)index { unsigned char next; unsigned counter = [self offsetForIndex: index]; diff --git a/Source/NSProxy.m b/Source/NSProxy.m index 8ae4899df..498d52aba 100644 --- a/Source/NSProxy.m +++ b/Source/NSProxy.m @@ -201,7 +201,7 @@ extern BOOL __objc_responds_to(id, SEL); /** * Returns the maximum unsigned integer value. */ -+ (unsigned int) retainCount ++ (NSUInteger) retainCount { return UINT_MAX; } @@ -304,7 +304,7 @@ extern BOOL __objc_responds_to(id, SEL); /** * Returns the address of the receiver ... so it can be stored in a dictionary. */ -- (unsigned int) hash +- (NSUInteger) hash { /* * Ideally we would shift left to lose any zero bits produced by the @@ -313,7 +313,7 @@ extern BOOL __objc_responds_to(id, SEL); * In the absence of detailed information, pick a reasonable value * assuming the object will be aligned to an eight byte boundary. */ - return ((unsigned)(uintptr_t)self)>>3; + return ((NSUInteger)(uintptr_t)self)>>3; } /** @@ -550,7 +550,7 @@ extern BOOL __objc_responds_to(id, SEL); /** * Return the retain count for the receiver. */ -- (unsigned int) retainCount +- (NSUInteger) retainCount { return _retain_count + 1; } diff --git a/Source/NSRunLoop.m b/Source/NSRunLoop.m index f5c8eacfe..29ea7e1fa 100644 --- a/Source/NSRunLoop.m +++ b/Source/NSRunLoop.m @@ -72,7 +72,7 @@ NSString * const NSDefaultRunLoopMode = @"NSDefaultRunLoopMode"; static NSDate *theFuture = nil; @interface NSObject (OptionalPortRunLoop) -- (void) getFds: (int*)fds count: (int*)count; +- (void) getFds: (NSInteger*)fds count: (NSInteger*)count; @end @@ -95,7 +95,7 @@ static NSDate *theFuture = nil; - (id) initWithSelector: (SEL)aSelector target: (id)target argument: (id)argument - order: (unsigned int)order; + order: (NSUInteger)order; @end @implementation GSRunLoopPerformer @@ -115,7 +115,7 @@ static NSDate *theFuture = nil; - (id) initWithSelector: (SEL)aSelector target: (id)aTarget argument: (id)anArgument - order: (unsigned int)theOrder + order: (NSUInteger)theOrder { self = [super init]; if (self) @@ -1408,7 +1408,7 @@ static inline BOOL timerInvalidated(NSTimer *t) - (void) performSelector: (SEL)aSelector target: (id)target argument: (id)argument - order: (unsigned int)order + order: (NSUInteger)order modes: (NSArray*)modes { unsigned count = [modes count]; diff --git a/Source/NSScanner.m b/Source/NSScanner.m index 91f72dbac..bb2788c7c 100644 --- a/Source/NSScanner.m +++ b/Source/NSScanner.m @@ -339,7 +339,7 @@ typedef struct { if (value) { if (overflow - || (num > (negative ? (unsigned int)INT_MIN : (unsigned int)INT_MAX))) + || (num > (negative ? (NSUInteger)INT_MIN : (NSUInteger)INT_MAX))) *value = negative ? INT_MIN: INT_MAX; else if (negative) *value = -num; @@ -373,8 +373,8 @@ typedef struct { * Scan an unsigned int of the given radix into value. * Internal version used by scanRadixUnsignedInt: and scanHexInt: . */ -- (BOOL) scanUnsignedInt_: (unsigned int *)value - radix: (unsigned int)radix +- (BOOL) scanUnsignedInt_: (unsigned int*)value + radix: (NSUInteger)radix gotDigits: (BOOL)gotDigits { unsigned int num = 0; @@ -462,7 +462,7 @@ typedef struct { *
* Scans past any excess digits */ -- (BOOL) scanRadixUnsignedInt: (unsigned int *)value +- (BOOL) scanRadixUnsignedInt: (unsigned int*)value { unsigned int radix; BOOL gotDigits = NO; @@ -512,7 +512,7 @@ typedef struct { *
* Scans past any excess digits */ -- (BOOL) scanHexInt: (unsigned int *)value +- (BOOL) scanHexInt: (unsigned int*)value { unsigned int saveScanLocation = _scanLocation; @@ -1020,7 +1020,7 @@ typedef struct { * scanning the string. This is the position at which the next scan * operation will begin. */ -- (unsigned) scanLocation +- (NSUInteger) scanLocation { return _scanLocation; } @@ -1031,7 +1031,7 @@ typedef struct { * Raises an NSRangeException if index is beyond the end of the * scanned string. */ -- (void) setScanLocation: (unsigned int)anIndex +- (void) setScanLocation: (NSUInteger)anIndex { if (_scanLocation <= myLength()) _scanLocation = anIndex; @@ -1219,7 +1219,7 @@ GSScanInt(unichar *buf, unsigned length, int *result) if (result) { if (overflow - || (num > (negative ? (unsigned int)INT_MIN : (unsigned int)INT_MAX))) + || (num > (negative ? (NSUInteger)INT_MIN : (NSUInteger)INT_MAX))) *result = negative ? INT_MIN: INT_MAX; else if (negative) *result = -num; @@ -1230,7 +1230,7 @@ GSScanInt(unichar *buf, unsigned length, int *result) } /** - * Scan in a double value in the standard locale ('.' as decimal point).
+ * Scan in a double value in the standard locale ('.' as decimal poNSInteger).
* Return YES on success, NO on failure.
* The value pointed to by result is unmodified on failure.
* No value is returned in result if it is a null pointer. @@ -1247,7 +1247,7 @@ GSScanDouble(unichar *buf, unsigned length, double *result) unsigned pos = 0; /* Skip whitespace */ - while (pos < length && isspace((int)buf[pos])) + while (pos < length && isspace((NSInteger)buf[pos])) { pos++; } diff --git a/Source/NSSet.m b/Source/NSSet.m index 8ff6be919..91c9da389 100644 --- a/Source/NSSet.m +++ b/Source/NSSet.m @@ -113,7 +113,7 @@ static Class NSMutableSet_concrete_class; * New set containing (unique elements of) objects. */ + (id) setWithObjects: (id*)objects - count: (unsigned)count + count: (NSUInteger)count { return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()] initWithObjects: objects count: count]); @@ -162,7 +162,7 @@ static Class NSMutableSet_concrete_class; /** * Returns the number of objects stored in the set. */ -- (unsigned) count +- (NSUInteger) count { [self subclassResponsibility: _cmd]; return 0; @@ -317,7 +317,7 @@ static Class NSMutableSet_concrete_class; * other initialisers work. */ - (id) initWithObjects: (id*)objects - count: (unsigned)count + count: (NSUInteger)count { self = [self init]; return self; @@ -480,7 +480,7 @@ static Class NSMutableSet_concrete_class; return (([self member: anObject]) ? YES : NO); } -- (unsigned) hash +- (NSUInteger) hash { return [self count]; } @@ -922,7 +922,7 @@ static Class NSMutableSet_concrete_class; /** * New autoreleased instance with given capacity. */ -+ (id) setWithCapacity: (unsigned)numItems ++ (id) setWithCapacity: (NSUInteger)numItems { return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()] initWithCapacity: numItems]); @@ -955,7 +955,7 @@ static Class NSMutableSet_concrete_class; * and needs to be re-implemented in subclasses in order to have all * other initialisers work. */ -- (id) initWithCapacity: (unsigned)numItems +- (id) initWithCapacity: (NSUInteger)numItems { self = [self init]; return self; @@ -979,7 +979,7 @@ static Class NSMutableSet_concrete_class; } - (id) initWithObjects: (id*)objects - count: (unsigned)count + count: (NSUInteger)count { self = [self initWithCapacity: count]; if (self != nil) diff --git a/Source/NSString.m b/Source/NSString.m index acaf859e5..ac21a4586 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -457,7 +457,7 @@ static unsigned rootOf(NSString *s, unsigned l) } -/* Convert a high-low surrogate pair into Unicode scalar code-point */ +/* Convert a high-low surrogate pair into Unicode scalar code-poNSInteger*/ static inline uint32_t surrogatePairValue(unichar high, unichar low) { @@ -493,7 +493,7 @@ static const unichar byteOrderMarkSwapped = 0xFFFE; #if ! PRINTF_ATSIGN_VA_LIST static int -arginfo_func (const struct printf_info *info, size_t n, int *argtypes) +arginfo_func (const struct printf_info *info, size_t n, NSInteger*argtypes) { *argtypes = PA_POINTER; return 1; @@ -708,7 +708,7 @@ handle_printf_atsign (FILE *stream, * Create a string of unicode characters. */ + (id) stringWithCharacters: (const unichar*)chars - length: (unsigned int)length + length: (NSUInteger)length { NSString *obj; @@ -753,7 +753,7 @@ handle_printf_atsign (FILE *stream, * (Characters will be converted to unicode representation internally.) */ + (id) stringWithCString: (const char*)byteString - length: (unsigned int)length + length: (NSUInteger)length { NSString *obj; @@ -882,7 +882,7 @@ handle_printf_atsign (FILE *stream, * is released and nil is returned. */ - (id) initWithBytes: (const void*)bytes - length: (unsigned int)length + length: (NSUInteger)length encoding: (NSStringEncoding)encoding { if (length == 0) @@ -925,7 +925,7 @@ handle_printf_atsign (FILE *stream, * this initialiser in order to have all other functionality.

*/ - (id) initWithBytesNoCopy: (void*)bytes - length: (unsigned int)length + length: (NSUInteger)length encoding: (NSStringEncoding)encoding freeWhenDone: (BOOL)flag { @@ -939,7 +939,7 @@ handle_printf_atsign (FILE *stream, * this instance is deallocated.

*/ - (id) initWithCharactersNoCopy: (unichar*)chars - length: (unsigned int)length + length: (NSUInteger)length freeWhenDone: (BOOL)flag { return [self initWithBytesNoCopy: chars @@ -953,7 +953,7 @@ handle_printf_atsign (FILE *stream, * of null bytes. Copies the string and frees copy when deallocated.

*/ - (id) initWithCharacters: (const unichar*)chars - length: (unsigned int)length + length: (NSUInteger)length { return [self initWithBytes: chars length: length * sizeof(unichar) @@ -967,7 +967,7 @@ handle_printf_atsign (FILE *stream, * when this instance is deallocated.

*/ - (id) initWithCStringNoCopy: (char*)byteString - length: (unsigned int)length + length: (NSUInteger)length freeWhenDone: (BOOL)flag { return [self initWithBytesNoCopy: byteString @@ -994,7 +994,7 @@ handle_printf_atsign (FILE *stream, * presence of null bytes. Characters converted to unicode based on the * default C encoding. Copies the string.

*/ -- (id) initWithCString: (const char*)byteString length: (unsigned int)length +- (id) initWithCString: (const char*)byteString length: (NSUInteger)length { return [self initWithBytes: byteString length: length @@ -1378,7 +1378,7 @@ handle_printf_atsign (FILE *stream, * Returns the number of Unicode characters in this string, including the * individual characters of composed character sequences, */ -- (unsigned int) length +- (NSUInteger) length { [self subclassResponsibility: _cmd]; return 0; @@ -1390,7 +1390,7 @@ handle_printf_atsign (FILE *stream, * Returns unicode character at index. unichar is an unsigned * short. Thus, a 16-bit character is returned. */ -- (unichar) characterAtIndex: (unsigned int)index +- (unichar) characterAtIndex: (NSUInteger)index { [self subclassResponsibility: _cmd]; return (unichar)0; @@ -1419,11 +1419,11 @@ handle_printf_atsign (FILE *stream, { unsigned l = [self length]; unsigned i; - unichar (*caiImp)(NSString*, SEL, unsigned int); + unichar (*caiImp)(NSString*, SEL, NSUInteger); GS_RANGE_CHECK(aRange, l); - caiImp = (unichar (*)(NSString*,SEL,unsigned)) + caiImp = (unichar (*)(NSString*,SEL,NSUInteger)) [self methodForSelector: caiSel]; for (i = 0; i < aRange.length; i++) @@ -1621,7 +1621,7 @@ handle_printf_atsign (FILE *stream, * If the supplied index is greater than or equal to the length of the * receiver an exception is raised. */ -- (NSString*) substringFromIndex: (unsigned int)index +- (NSString*) substringFromIndex: (NSUInteger)index { return [self substringWithRange: ((NSRange){index, [self length]-index})]; } @@ -1634,7 +1634,7 @@ handle_printf_atsign (FILE *stream, * If the supplied index is greater than the length of the receiver * an exception is raised. */ -- (NSString*) substringToIndex: (unsigned int)index +- (NSString*) substringToIndex: (NSUInteger)index { return [self substringWithRange: ((NSRange){0,index})];; } @@ -1698,7 +1698,7 @@ handle_printf_atsign (FILE *stream, * string). */ - (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet - options: (unsigned int)mask + options: (NSUInteger)mask { NSRange all = NSMakeRange(0, [self length]); @@ -1717,7 +1717,7 @@ handle_printf_atsign (FILE *stream, * string). Search only carried out within aRange. */ - (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet - options: (unsigned int)mask + options: (NSUInteger)mask range: (NSRange)aRange { unsigned int i; @@ -1725,7 +1725,7 @@ handle_printf_atsign (FILE *stream, unsigned int stop; int step; NSRange range; - unichar (*cImp)(id, SEL, unsigned int); + unichar (*cImp)(id, SEL, NSUInteger); BOOL (*mImp)(id, SEL, unichar); i = [self length]; @@ -1742,7 +1742,7 @@ handle_printf_atsign (FILE *stream, range.location = NSNotFound; range.length = 0; - cImp = (unichar(*)(id,SEL,unsigned int)) + cImp = (unichar(*)(id,SEL,NSUInteger)) [self methodForSelector: caiSel]; mImp = (BOOL(*)(id,SEL,unichar)) [aSet methodForSelector: cMemberSel]; @@ -1783,7 +1783,7 @@ handle_printf_atsign (FILE *stream, * set to the range of the whole of the receiver. */ - (NSRange) rangeOfString: (NSString*)string - options: (unsigned int)mask + options: (NSUInteger)mask { NSRange all = NSMakeRange(0, [self length]); @@ -1817,7 +1817,7 @@ handle_printf_atsign (FILE *stream, * string. Options should be OR'd together using '|'. */ - (NSRange) rangeOfString: (NSString *)aString - options: (unsigned int)mask + options: (NSUInteger)mask range: (NSRange)aRange { GS_RANGE_CHECK(aRange, [self length]); @@ -1834,7 +1834,7 @@ handle_printf_atsign (FILE *stream, return NSMakeRange(0, 0); // FIXME } -- (unsigned int) indexOfString: (NSString *)substring +- (NSUInteger) indexOfString: (NSString *)substring { NSRange range = {0, [self length]}; @@ -1842,8 +1842,8 @@ handle_printf_atsign (FILE *stream, return range.length ? range.location : NSNotFound; } -- (unsigned int) indexOfString: (NSString*)substring - fromIndex: (unsigned int)index +- (NSUInteger) indexOfString: (NSString*)substring + fromIndex: (NSUInteger)index { NSRange range = {index, [self length] - index}; @@ -1858,18 +1858,18 @@ handle_printf_atsign (FILE *stream, * character sequence anIndex (note indices start from 0), returns the full * range of this sequence. */ -- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (unsigned int)anIndex +- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (NSUInteger)anIndex { unsigned start; unsigned end; unsigned length = [self length]; unichar ch; - unichar (*caiImp)(NSString*, SEL, unsigned int); + unichar (*caiImp)(NSString*, SEL, NSUInteger); NSCharacterSet *nbSet = [NSCharacterSet nonBaseCharacterSet]; if (anIndex >= length) [NSException raise: NSRangeException format:@"Invalid location."]; - caiImp = (unichar (*)(NSString*,SEL,unsigned)) + caiImp = (unichar (*)(NSString*,SEL,NSUInteger)) [self methodForSelector: caiSel]; for (start = anIndex; start > 0; start--) @@ -1909,7 +1909,7 @@ handle_printf_atsign (FILE *stream, * sequences may be used to express the same character.

*/ - (NSComparisonResult) compare: (NSString*)aString - options: (unsigned int)mask + options: (NSUInteger)mask { return [self compare: aString options: mask range: ((NSRange){0, [self length]})]; @@ -1926,7 +1926,7 @@ handle_printf_atsign (FILE *stream, */ // xxx Should implement full POSIX.2 collate - (NSComparisonResult) compare: (NSString*)aString - options: (unsigned int)mask + options: (NSUInteger)mask range: (NSRange)aRange { GS_RANGE_CHECK(aRange, [self length]); @@ -2002,7 +2002,7 @@ handle_printf_atsign (FILE *stream, * for other purposes in a bitfield in the concrete string subclasses, so we * must not use the full unsigned integer. */ -- (unsigned int) hash +- (NSUInteger) hash { unsigned ret = 0; unsigned len = [self length]; @@ -2060,7 +2060,7 @@ handle_printf_atsign (FILE *stream, * the same character. */ - (NSString*) commonPrefixWithString: (NSString*)aString - options: (unsigned int)mask + options: (NSUInteger)mask { if (mask & NSLiteralSearch) { @@ -2103,12 +2103,12 @@ handle_printf_atsign (FILE *stream, } else { - unichar (*scImp)(NSString*, SEL, unsigned int); - unichar (*ocImp)(NSString*, SEL, unsigned int); + unichar (*scImp)(NSString*, SEL, NSUInteger); + unichar (*ocImp)(NSString*, SEL, NSUInteger); void (*sgImp)(NSString*, SEL, unichar*, NSRange) = 0; void (*ogImp)(NSString*, SEL, unichar*, NSRange) = 0; - NSRange (*srImp)(NSString*, SEL, unsigned int) = 0; - NSRange (*orImp)(NSString*, SEL, unsigned int) = 0; + NSRange (*srImp)(NSString*, SEL, NSUInteger) = 0; + NSRange (*orImp)(NSString*, SEL, NSUInteger) = 0; BOOL gotRangeImps = NO; BOOL gotFetchImps = NO; NSRange sRange; @@ -2123,9 +2123,9 @@ handle_printf_atsign (FILE *stream, if (!oLength) return IMMUTABLE(aString); - scImp = (unichar (*)(NSString*,SEL,unsigned)) + scImp = (unichar (*)(NSString*,SEL,NSUInteger)) [self methodForSelector: caiSel]; - ocImp = (unichar (*)(NSString*,SEL,unsigned)) + ocImp = (unichar (*)(NSString*,SEL,NSUInteger)) [aString methodForSelector: caiSel]; while ((sIndex < sLength) && (oIndex < oLength)) @@ -2204,8 +2204,8 @@ handle_printf_atsign (FILE *stream, */ - (NSRange) lineRangeForRange: (NSRange)aRange { - unsigned startIndex; - unsigned lineEndIndex; + NSUInteger startIndex; + NSUInteger lineEndIndex; [self getLineStart: &startIndex end: &lineEndIndex @@ -2236,14 +2236,14 @@ handle_printf_atsign (FILE *stream, * arguments to be null pointers (in which case no value is returned in that * argument). */ -- (void) getLineStart: (unsigned int *)startIndex - end: (unsigned int *)lineEndIndex - contentsEnd: (unsigned int *)contentsEndIndex +- (void) getLineStart: (NSUInteger*)startIndex + end: (NSUInteger*)lineEndIndex + contentsEnd: (NSUInteger*)contentsEndIndex forRange: (NSRange)aRange { unichar thischar; unsigned start, end, len, termlen; - unichar (*caiImp)(NSString*, SEL, unsigned int); + unichar (*caiImp)(NSString*, SEL, NSUInteger); len = [self length]; GS_RANGE_CHECK(aRange, len); @@ -2603,7 +2603,7 @@ handle_printf_atsign (FILE *stream, * specified encoding (without adding a nul character terminator).
* Returns 0 if the conversion is not possible. */ -- (unsigned) lengthOfBytesUsingEncoding: (NSStringEncoding)encoding +- (NSUInteger) lengthOfBytesUsingEncoding: (NSStringEncoding)encoding { NSData *d; @@ -2616,7 +2616,7 @@ handle_printf_atsign (FILE *stream, * specified encoding (without adding a nul character terminator). This may * be larger than the actual number of bytes needed. */ -- (unsigned) maximumLengthOfBytesUsingEncoding: (NSStringEncoding)encoding +- (NSUInteger) maximumLengthOfBytesUsingEncoding: (NSStringEncoding)encoding { if (encoding == NSUnicodeStringEncoding) return [self length] * 2; @@ -2669,7 +2669,7 @@ handle_printf_atsign (FILE *stream, * information loss, the results are unpredictable. Check * -canBeConvertedToEncoding: first. */ -- (unsigned int) cStringLength +- (NSUInteger) cStringLength { NSData *d; @@ -2694,7 +2694,7 @@ handle_printf_atsign (FILE *stream, * Use -getCString:maxLength:encoding: instead. */ - (void) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength { [self getCString: buffer maxLength: maxLength range: ((NSRange){0, [self length]}) @@ -2720,7 +2720,7 @@ handle_printf_atsign (FILE *stream, * twelve if NSUnicodeStringEncoding is requested. */ - (BOOL) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength encoding: (NSStringEncoding)encoding { if (encoding == NSUnicodeStringEncoding) @@ -2765,7 +2765,7 @@ handle_printf_atsign (FILE *stream, * Use -getCString:maxLength:encoding: instead. */ - (void) getCString: (char*)buffer - maxLength: (unsigned int)maxLength + maxLength: (NSUInteger)maxLength range: (NSRange)aRange remainingRange: (NSRange*)leftoverRange { @@ -3047,10 +3047,10 @@ handle_printf_atsign (FILE *stream, return NSUnicodeStringEncoding; } -- (unsigned int) completePathIntoString: (NSString**)outputName - caseSensitive: (BOOL)flag - matchesIntoArray: (NSArray**)outputArray - filterTypes: (NSArray*)filterTypes +- (NSUInteger) completePathIntoString: (NSString**)outputName + caseSensitive: (BOOL)flag + matchesIntoArray: (NSArray**)outputArray + filterTypes: (NSArray*)filterTypes { NSString *basePath = [self stringByDeletingLastPathComponent]; NSString *lastComp = [self lastPathComponent]; @@ -3131,7 +3131,7 @@ static NSFileManager *fm = nil; } - (BOOL) getFileSystemRepresentation: (GSNativeChar*)buffer - maxLength: (unsigned int)size + maxLength: (NSUInteger)size { const unichar *ptr; unsigned i; @@ -3172,7 +3172,7 @@ static NSFileManager *fm = nil; } - (BOOL) getFileSystemRepresentation: (GSNativeChar*)buffer - maxLength: (unsigned int)size + maxLength: (NSUInteger)size { const char* ptr; @@ -3675,9 +3675,9 @@ static NSFileManager *fm = nil; * as required). The first character from padString to be appended * is specified by padIndex.
*/ -- (NSString*) stringByPaddingToLength: (unsigned int)newLength +- (NSString*) stringByPaddingToLength: (NSUInteger)newLength withString: (NSString*)padString - startingAtIndex: (unsigned int)padIndex + startingAtIndex: (NSUInteger)padIndex { unsigned length = [self length]; unsigned padLength; @@ -4024,7 +4024,7 @@ static NSFileManager *fm = nil; { NSMutableString *s; NSRange r; - unichar (*caiImp)(NSString*, SEL, unsigned int); + unichar (*caiImp)(NSString*, SEL, NSUInteger); unsigned int l = [self length]; unichar c; unsigned root; @@ -4193,7 +4193,7 @@ static NSFileManager *fm = nil; } if (length > 0) { - unichar (*caiImp)(NSString*, SEL, unsigned int); + unichar (*caiImp)(NSString*, SEL, NSUInteger); BOOL (*mImp)(id, SEL, unichar); unichar letter; @@ -4239,7 +4239,7 @@ static NSFileManager *fm = nil; if (len > 0) { unsigned int count = 0; - unichar (*caiImp)(NSString*, SEL, unsigned int); + unichar (*caiImp)(NSString*, SEL, NSUInteger); caiImp = (unichar (*)())[self methodForSelector: caiSel]; while (count < len) @@ -4458,7 +4458,7 @@ static NSFileManager *fm = nil; * IGNORE the locale.

*/ - (NSComparisonResult) compare: (NSString *)string - options: (unsigned int)mask + options: (NSUInteger)mask range: (NSRange)compareRange locale: (NSDictionary *)dict { @@ -4559,7 +4559,7 @@ static NSFileManager *fm = nil; { unsigned count = [self length]; - [aCoder encodeValueOfObjCType: @encode(unsigned int) at: &count]; + [aCoder encodeValueOfObjCType: @encode(unsigned) at: &count]; if (count > 0) { NSStringEncoding enc = NSUnicodeStringEncoding; @@ -4590,7 +4590,7 @@ static NSFileManager *fm = nil; { unsigned count; - [aCoder decodeValueOfObjCType: @encode(unsigned int) at: &count]; + [aCoder decodeValueOfObjCType: @encode(unsigned) at: &count]; if (count > 0) { @@ -4807,7 +4807,7 @@ static NSFileManager *fm = nil; /** * Constructs an empty string with initial buffer size of capacity. */ -+ (NSMutableString*) stringWithCapacity: (unsigned int)capacity ++ (NSMutableString*) stringWithCapacity: (NSUInteger)capacity { return AUTORELEASE([[GSMutableStringClass allocWithZone: NSDefaultMallocZone()] initWithCapacity: capacity]); @@ -4818,7 +4818,7 @@ static NSFileManager *fm = nil; */ // Inefficient implementation. + (id) stringWithCharacters: (const unichar*)characters - length: (unsigned int)length + length: (NSUInteger)length { return AUTORELEASE([[GSMutableStringClass allocWithZone: NSDefaultMallocZone()] initWithCharacters: characters length: length]); @@ -4852,7 +4852,7 @@ static NSFileManager *fm = nil; * (Characters will be converted to unicode representation internally.) */ + (id) stringWithCString: (const char*)byteString - length: (unsigned int)length + length: (NSUInteger)length { return AUTORELEASE([[GSMutableStringClass allocWithZone: NSDefaultMallocZone()] initWithCString: byteString length: length]); @@ -4878,14 +4878,14 @@ static NSFileManager *fm = nil; * and needs to be re-implemented in subclasses in order to have all * other initialisers work. */ -- (id) initWithCapacity: (unsigned int)capacity +- (id) initWithCapacity: (NSUInteger)capacity { self = [self init]; return self; } - (id) initWithCharactersNoCopy: (unichar*)chars - length: (unsigned int)length + length: (NSUInteger)length freeWhenDone: (BOOL)flag { if ((self = [self initWithCapacity: length]) != nil && length > 0) @@ -4903,7 +4903,7 @@ static NSFileManager *fm = nil; } - (id) initWithCStringNoCopy: (char*)chars - length: (unsigned int)length + length: (NSUInteger)length freeWhenDone: (BOOL)flag { if ((self = [self initWithCapacity: length]) != nil && length > 0) @@ -4967,7 +4967,7 @@ static NSFileManager *fm = nil; /** * Modifies this instance by inserting aString at loc. */ -- (void) insertString: (NSString*)aString atIndex: (unsigned int)loc +- (void) insertString: (NSString*)aString atIndex: (NSUInteger)loc { NSRange range = {loc, 0}; [self replaceCharactersInRange: range withString: aString]; @@ -4994,10 +4994,10 @@ static NSFileManager *fm = nil; * Raises NSRangeException if part of searchRange is beyond the end * of the receiver. */ -- (unsigned int) replaceOccurrencesOfString: (NSString*)replace - withString: (NSString*)by - options: (unsigned int)opts - range: (NSRange)searchRange +- (NSUInteger) replaceOccurrencesOfString: (NSString*)replace + withString: (NSString*)by + options: (NSUInteger)opts + range: (NSRange)searchRange { NSRange range; unsigned int count = 0; diff --git a/Source/NSThread.m b/Source/NSThread.m index b533976fd..5f9a15c3c 100644 --- a/Source/NSThread.m +++ b/Source/NSThread.m @@ -207,12 +207,12 @@ GSSleepUntilIntervalSinceReferenceDate(NSTimeInterval when) while (delay > 0) { #ifdef HAVE_USLEEP - usleep ((int)(delay*1000000)); + usleep ((NSInteger)(delay*1000000)); #else #if defined(__MINGW32__) Sleep (delay*1000); #else - sleep ((int)delay); + sleep ((NSInteger)delay); #endif #endif delay = when - GSTimeNow(); @@ -826,7 +826,7 @@ pthread_detach(pthread_self()); ASSIGN(_name, aName); } -- (void) setStackSize: (unsigned)stackSize +- (void) setStackSize: (NSUInteger)stackSize { _stackSize = stackSize; #if !defined(HAVE_SETRLIMIT) || !defined(RLIMIT_STACK) @@ -834,7 +834,7 @@ pthread_detach(pthread_self()); #endif } -- (unsigned) stackSize +- (NSUInteger) stackSize { return _stackSize; } diff --git a/Source/NSTimeZone.m b/Source/NSTimeZone.m index 52dc64fa5..e698ff41f 100644 --- a/Source/NSTimeZone.m +++ b/Source/NSTimeZone.m @@ -252,10 +252,10 @@ decode (const void *ptr) #if defined(WORDS_BIGENDIAN) && SIZEOF_INT == 4 #if NEED_WORD_ALIGNMENT int value; - memcpy(&value, ptr, sizeof(int)); + memcpy(&value, ptr, sizeof(NSInteger)); return value; #else - return *(const int *) ptr; + return *(const NSInteger*) ptr; #endif #else /* defined(WORDS_BIGENDIAN) && SIZEOF_INT == 4 */ const unsigned char *p = ptr; @@ -292,7 +292,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type) int offset; // Offset from UTC in seconds. } -- (id) initWithOffset: (int)anOffset name: (NSString*)aName; +- (id) initWithOffset: (NSInteger)anOffset name: (NSString*)aName; @end @interface NSLocalTimeZone : NSTimeZone @@ -308,7 +308,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type) - (id) initWithTimeZone: (NSTimeZone*)aZone withAbbrev: (NSString*)anAbbrev - withOffset: (int)anOffset + withOffset: (NSInteger)anOffset withDST: (BOOL)isDST; @end @@ -379,7 +379,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type) if (zone == nil) { unichar c; - unsigned i; + int i; if ((length == 3 && ([name isEqualToString: @"GMT"] == YES @@ -567,12 +567,12 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type) return self; } -- (int) secondsFromGMT +- (NSInteger) secondsFromGMT { return [[NSTimeZoneClass defaultTimeZone] secondsFromGMT]; } -- (int) secondsFromGMTForDate: (NSDate*)aDate +- (NSInteger) secondsFromGMTForDate: (NSDate*)aDate { return [[NSTimeZoneClass defaultTimeZone] secondsFromGMTForDate: aDate]; } @@ -634,7 +634,7 @@ static NSMapTable *absolutes = 0; [aCoder encodeObject: name]; } -- (id) initWithOffset: (int)anOffset name: (NSString*)aName +- (id) initWithOffset: (NSInteger)anOffset name: (NSString*)aName { GSAbsTimeZone *z; int extra; @@ -729,7 +729,7 @@ static NSMapTable *absolutes = 0; return name; } -- (int) secondsFromGMTForDate: (NSDate*)aDate +- (NSInteger) secondsFromGMTForDate: (NSDate*)aDate { return offset; } @@ -769,7 +769,7 @@ static NSMapTable *absolutes = 0; - (id) initWithTimeZone: (NSTimeZone*)aZone withAbbrev: (NSString*)anAbbrev - withOffset: (int)anOffset + withOffset: (NSInteger)anOffset withDST: (BOOL)isDST { timeZone = RETAIN(aZone); @@ -804,12 +804,12 @@ static NSMapTable *absolutes = 0; return [timeZone timeZoneDetailForDate: date]; } -- (int) timeZoneSecondsFromGMT +- (NSInteger) timeZoneSecondsFromGMT { return offset; } -- (int) timeZoneSecondsFromGMTForDate: (NSDate*)aDate +- (NSInteger) timeZoneSecondsFromGMTForDate: (NSDate*)aDate { return offset; } @@ -871,12 +871,12 @@ static NSMapTable *absolutes = 0; return self; } -- (int) timeZoneSecondsFromGMT +- (NSInteger) timeZoneSecondsFromGMT { return zone->offset; } -- (int) timeZoneSecondsFromGMTForDate: (NSDate*)aDate +- (NSInteger) timeZoneSecondsFromGMTForDate: (NSDate*)aDate { return zone->offset; } @@ -1686,7 +1686,7 @@ static NSMapTable *absolutes = 0; * Time zones with an offset of more than +/- 18 hours are disallowed, * and nil is returned. */ -+ (NSTimeZone*) timeZoneForSecondsFromGMT: (int)seconds ++ (NSTimeZone*) timeZoneForSecondsFromGMT: (NSInteger)seconds { NSTimeZone *zone; @@ -1902,7 +1902,7 @@ static NSMapTable *absolutes = 0; * from Greenwich Mean Time at the current date and time.
* Invokes -secondsFromGMTForDate: */ -- (int) secondsFromGMT +- (NSInteger) secondsFromGMT { return [self secondsFromGMTForDate: [NSDate date]]; } @@ -1913,7 +1913,7 @@ static NSMapTable *absolutes = 0; * If the time zone uses daylight savings time, the returned value * will vary at different times of year. */ -- (int) secondsFromGMTForDate: (NSDate*)aDate +- (NSInteger) secondsFromGMTForDate: (NSDate*)aDate { NSTimeZoneDetail *detail; int offset; @@ -2012,7 +2012,7 @@ static NSMapTable *absolutes = 0; /** * DEPRECATED: Class is no longer used. */ -- (int) timeZoneSecondsFromGMT +- (NSInteger) timeZoneSecondsFromGMT { [self subclassResponsibility: _cmd]; return 0; @@ -2139,8 +2139,8 @@ lastDayOfGregorianMonth(int month, int year) /* IMPORT from NSCalendar date */ void -GSBreakTime(NSTimeInterval when, int *year, int *month, int *day, - int *hour, int *minute, int *second, int *mil); +GSBreakTime(NSTimeInterval when, NSInteger*year, NSInteger*month, NSInteger*day, + NSInteger*hour, NSInteger*minute, NSInteger*second, NSInteger*mil); @implementation GSWindowsTimeZone @@ -2403,7 +2403,7 @@ GSBreakTime(NSTimeInterval when, int *year, int *month, int *day, } } - dow = ((int)((when / 86400.0) + GREGORIAN_REFERENCE)) % 7; + dow = ((NSInteger)((when / 86400.0) + GREGORIAN_REFERENCE)) % 7; if (dow < 0) dow += 7; @@ -2493,7 +2493,7 @@ GSBreakTime(NSTimeInterval when, int *year, int *month, int *day, } } -- (int) secondsFromGMTForDate: (NSDate*)aDate +- (NSInteger) secondsFromGMTForDate: (NSDate*)aDate { if ([self isDaylightSavingTimeForDate: aDate]) return -Bias*60 - DaylightBias*60; @@ -2823,7 +2823,7 @@ newDetailInZoneForType(GSTimeZone *zone, TypeInfo *type) return timeZoneName; } -- (int) secondsFromGMTForDate: (NSDate*)aDate +- (NSInteger) secondsFromGMTForDate: (NSDate*)aDate { TypeInfo *type = chop([aDate timeIntervalSince1970], self); diff --git a/Source/NSURL.m b/Source/NSURL.m index d7c24684b..cf20e6454 100644 --- a/Source/NSURL.m +++ b/Source/NSURL.m @@ -1144,7 +1144,7 @@ static unsigned urlAlign; [aCoder encodeObject: _baseURL]; } -- (unsigned int) hash +- (NSUInteger) hash { return [[self absoluteString] hash]; } diff --git a/Source/NSURLAuthenticationChallenge.m b/Source/NSURLAuthenticationChallenge.m index e54dfc78a..5d6ffd735 100644 --- a/Source/NSURLAuthenticationChallenge.m +++ b/Source/NSURLAuthenticationChallenge.m @@ -91,7 +91,7 @@ typedef struct { - (id) initWithProtectionSpace: (NSURLProtectionSpace *)space proposedCredential: (NSURLCredential *)credential - previousFailureCount: (int)previousFailureCount + previousFailureCount: (NSInteger)previousFailureCount failureResponse: (NSURLResponse *)response error: (NSError *)error sender: (id)sender @@ -108,7 +108,7 @@ typedef struct { return self; } -- (int) previousFailureCount +- (NSInteger) previousFailureCount { return this->previousFailureCount; } diff --git a/Source/NSURLCache.m b/Source/NSURLCache.m index 01cdc1071..4aa0150d1 100644 --- a/Source/NSURLCache.m +++ b/Source/NSURLCache.m @@ -101,23 +101,23 @@ static NSURLCache *shared = nil; return [this->memory objectForKey: request]; } -- (unsigned) currentDiskUsage +- (NSUInteger) currentDiskUsage { return this->diskUsage; } -- (unsigned) currentMemoryUsage +- (NSUInteger) currentMemoryUsage { return this->memoryUsage; } -- (unsigned) diskCapacity +- (NSUInteger) diskCapacity { return this->diskCapacity; } -- (id) initWithMemoryCapacity: (unsigned)memoryCapacity - diskCapacity: (unsigned)diskCapacity +- (id) initWithMemoryCapacity: (NSUInteger)memoryCapacity + diskCapacity: (NSUInteger)diskCapacity diskPath: (NSString *)path { if ((self = [super init]) != nil) @@ -132,7 +132,7 @@ static NSURLCache *shared = nil; return self; } -- (unsigned) memoryCapacity +- (NSUInteger) memoryCapacity { return this->memoryCapacity; } @@ -157,13 +157,13 @@ static NSURLCache *shared = nil; } } -- (void) setDiskCapacity: (unsigned)diskCapacity +- (void) setDiskCapacity: (NSUInteger)diskCapacity { [self notImplemented: _cmd]; // FIXME } -- (void) setMemoryCapacity: (unsigned)memoryCapacity +- (void) setMemoryCapacity: (NSUInteger)memoryCapacity { [self notImplemented: _cmd]; // FIXME diff --git a/Source/NSURLCredential.m b/Source/NSURLCredential.m index 71e158fee..39566cbd4 100644 --- a/Source/NSURLCredential.m +++ b/Source/NSURLCredential.m @@ -91,7 +91,7 @@ typedef struct { return this->hasPassword; } -- (unsigned) hash +- (NSUInteger) hash { return [this->user hash]; } diff --git a/Source/NSURLDownload.m b/Source/NSURLDownload.m index 9a2ccdd83..f75738ba3 100644 --- a/Source/NSURLDownload.m +++ b/Source/NSURLDownload.m @@ -163,7 +163,7 @@ typedef struct { } - (void) download: (NSURLDownload *)download - didReceiveDataOfLength: (unsigned)length + didReceiveDataOfLength: (NSUInteger)length { } diff --git a/Source/NSURLProtectionSpace.m b/Source/NSURLProtectionSpace.m index b1dda83cb..269adecf4 100644 --- a/Source/NSURLProtectionSpace.m +++ b/Source/NSURLProtectionSpace.m @@ -108,7 +108,7 @@ typedef struct { [super dealloc]; } -- (unsigned) hash +- (NSUInteger) hash { return [[self host] hash] + [self port] + [[self realm] hash] + [[self protocol] hash] @@ -121,7 +121,7 @@ typedef struct { } - (id) initWithHost: (NSString *)host - port: (int)port + port: (NSInteger)port protocol: (NSString *)protocol realm: (NSString *)realm authenticationMethod: (NSString *)authenticationMethod @@ -158,7 +158,7 @@ authenticationMethod: (NSString *)authenticationMethod } - (id) initWithProxyHost: (NSString *)host - port: (int)port + port: (NSInteger)port type: (NSString *)type realm: (NSString *)realm authenticationMethod: (NSString *)authenticationMethod @@ -250,7 +250,7 @@ authenticationMethod: (NSString *)authenticationMethod return this->isProxy; } -- (int) port +- (NSInteger) port { return this->port; } diff --git a/Source/NSURLRequest.m b/Source/NSURLRequest.m index 985232ce1..aa232695d 100644 --- a/Source/NSURLRequest.m +++ b/Source/NSURLRequest.m @@ -162,7 +162,7 @@ typedef struct { return self; } -- (unsigned) hash +- (NSUInteger) hash { return [this->URL hash]; } diff --git a/Source/NSURLResponse.m b/Source/NSURLResponse.m index 0b62f97e8..ad5701256 100644 --- a/Source/NSURLResponse.m +++ b/Source/NSURLResponse.m @@ -120,7 +120,7 @@ typedef struct { v = [contentType parameterForKey: @"charset"]; ASSIGNCOPY(this->textEncodingName, v); } -- (void) _setStatusCode: (int)code text: (NSString*)text +- (void) _setStatusCode: (NSInteger)code text: (NSString*)text { this->statusCode = code; ASSIGNCOPY(this->statusText, text); @@ -233,7 +233,7 @@ typedef struct { */ - (id) initWithURL: (NSURL *)URL MIMEType: (NSString *)MIMEType - expectedContentLength: (int)length + expectedContentLength: (NSInteger)length textEncodingName: (NSString *)name { if ((self = [super init]) != nil) @@ -320,7 +320,7 @@ typedef struct { @implementation NSHTTPURLResponse -+ (NSString *) localizedStringForStatusCode: (int)statusCode ++ (NSString *) localizedStringForStatusCode: (NSInteger)statusCode { // FIXME ... put real responses in here return [NSString stringWithFormat: @"%d", statusCode]; @@ -331,7 +331,7 @@ typedef struct { return AUTORELEASE([this->headers copy]); } -- (int) statusCode +- (NSInteger) statusCode { return this->statusCode; } diff --git a/Source/NSUndoManager.m b/Source/NSUndoManager.m index 08b632164..e29f81d92 100644 --- a/Source/NSUndoManager.m +++ b/Source/NSUndoManager.m @@ -476,7 +476,7 @@ * groupings which can be nested, not the number of of groups on either * the undo or redo stack. */ -- (int) groupingLevel +- (NSInteger) groupingLevel { PrivateUndoGroup *g = (PrivateUndoGroup*)_group; int level = 0; @@ -552,7 +552,7 @@ * The default value is 0 meaning the number is only limited by * memory availability. */ -- (unsigned int) levelsOfUndo +- (NSUInteger) levelsOfUndo { return _levelsOfUndo; } @@ -853,7 +853,7 @@ * When set to 0 the stack size is limited by the range of a unsigned int, * available memory. */ -- (void) setLevelsOfUndo: (unsigned)num +- (void) setLevelsOfUndo: (NSUInteger)num { _levelsOfUndo = num; if (num > 0) diff --git a/Source/NSUserDefaults.m b/Source/NSUserDefaults.m index 0d4c7c0c8..b3a8e2880 100644 --- a/Source/NSUserDefaults.m +++ b/Source/NSUserDefaults.m @@ -985,14 +985,14 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */ return 0.0; } -- (int) integerForKey: (NSString*)defaultName +- (NSInteger) integerForKey: (NSString*)defaultName { id obj = [self objectForKey: defaultName]; if (obj != nil && ([obj isKindOfClass: NSStringClass] || [obj isKindOfClass: NSNumberClass])) { - return [obj intValue]; + return [obj integerValue]; } return 0; } @@ -1075,9 +1075,9 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */ [self setObject: n forKey: defaultName]; } -- (void) setInteger: (int)value forKey: (NSString*)defaultName +- (void) setInteger: (NSInteger)value forKey: (NSString*)defaultName { - NSNumber *n = [NSNumberClass numberWithInt: value]; + NSNumber *n = [NSNumberClass numberWithInteger: value]; [self setObject: n forKey: defaultName]; } diff --git a/Source/NSValue.m b/Source/NSValue.m index 32d7dacb5..210eaad96 100644 --- a/Source/NSValue.m +++ b/Source/NSValue.m @@ -482,8 +482,8 @@ static NSLock *placeholderLock; } else { - NSData *d; - unsigned cursor = 0; + NSData *d; + unsigned cursor = 0; /* * For performance, decode small values directly onto the stack, @@ -521,7 +521,7 @@ static NSLock *placeholderLock; else { static NSData *d = nil; - unsigned cursor = 0; + unsigned cursor = 0; if (d == nil) { diff --git a/Source/NSXMLParser.m b/Source/NSXMLParser.m index d20297a2f..5e98d3619 100644 --- a/Source/NSXMLParser.m +++ b/Source/NSXMLParser.m @@ -543,12 +543,12 @@ static NSNull *null = nil; @end @implementation NSXMLParser (NSXMLParserLocatorAdditions) -- (int) columnNumber +- (NSInteger) columnNumber { return [myParser columnNumber]; } -- (int) lineNumber +- (NSInteger) lineNumber { return [myParser lineNumber]; } @@ -672,7 +672,7 @@ typedef struct { @defs(NSXMLParser) } *xp; this->abort = YES; } -- (int) columnNumber +- (NSInteger) columnNumber { return this->column; } @@ -725,7 +725,7 @@ typedef struct { @defs(NSXMLParser) } *xp; return self; } -- (int) lineNumber +- (NSInteger) lineNumber { return this->line; } diff --git a/Source/NSZone.m b/Source/NSZone.m index a969ddfa9..e4247c42f 100644 --- a/Source/NSZone.m +++ b/Source/NSZone.m @@ -102,7 +102,7 @@ * Try to do some logging if possible. */ void * -GSOutOfMemory(size_t size, BOOL retry) +GSOutOfMemory(NSUInteger size, BOOL retry) { fprintf(stderr, "GSOutOfMemory ... wanting %lu bytes.\n", (unsigned long)size); @@ -1598,7 +1598,7 @@ static void rnfree (NSZone *zone, void *ptr); * pointers is kept and must reach zero before freeing the zone. */ NSZone* -NSCreateZone (size_t start, size_t gran, BOOL canFree) +NSCreateZone (NSUInteger start, NSUInteger gran, BOOL canFree) { size_t i, startsize, granularity; NSZone *newZone; @@ -1719,7 +1719,7 @@ NSCreateZone (size_t start, size_t gran, BOOL canFree) * allocate and no more can be obtained from system. */ void* -NSZoneCalloc (NSZone *zone, size_t elems, size_t bytes) +NSZoneCalloc (NSZone *zone, NSUInteger elems, NSUInteger bytes) { return memset(NSZoneMalloc(zone, elems*bytes), 0, elems*bytes); } @@ -1840,7 +1840,7 @@ NSReallocateCollectable(void *ptr, NSUInteger size, NSUInteger options) #if GS_WITH_GC NSZone* -NSCreateZone (size_t start, size_t gran, BOOL canFree) +NSCreateZone (NSUInteger start, NSUInteger gran, BOOL canFree) { return &default_zone; } @@ -1926,13 +1926,13 @@ GSAssignZeroingWeakPointer(void **destination, void *source) } void* -NSZoneMalloc (NSZone *zone, size_t size) +NSZoneMalloc (NSZone *zone, NSUInteger size) { return NSZoneCalloc(zone, 1, size); } void* -NSZoneCalloc (NSZone *zone, size_t elems, size_t bytes) +NSZoneCalloc (NSZone *zone, NSUInteger elems, NSUInteger bytes) { size_t size = elems * bytes; void *ptr; @@ -1957,7 +1957,7 @@ NSZoneCalloc (NSZone *zone, size_t elems, size_t bytes) } void* -NSZoneRealloc (NSZone *zone, void *ptr, size_t size) +NSZoneRealloc (NSZone *zone, void *ptr, NSUInteger size) { if (GC_base(ptr) != 0) { @@ -2015,7 +2015,7 @@ GSAssignZeroingWeakPointer(void **destination, void *source) } void* -NSZoneMalloc (NSZone *zone, size_t size) +NSZoneMalloc (NSZone *zone, NSUInteger size) { if (!zone) zone = NSDefaultMallocZone(); @@ -2023,7 +2023,7 @@ NSZoneMalloc (NSZone *zone, size_t size) } void* -NSZoneRealloc (NSZone *zone, void *ptr, size_t size) +NSZoneRealloc (NSZone *zone, void *ptr, NSUInteger size) { if (!zone) zone = NSDefaultMallocZone(); diff --git a/Source/cifframe.m b/Source/cifframe.m index b1a69d335..51caafbcc 100644 --- a/Source/cifframe.m +++ b/Source/cifframe.m @@ -199,7 +199,7 @@ cifframe_from_info (NSArgumentInfo *info, int numargs, void **retval) * more to the buffer size prevents writing outside the allocated * memory by the ffi stuff. */ - full += 8; + full += 64; cframe = buf = NSZoneCalloc(NSDefaultMallocZone(), full, 1); if (cframe && retval) { diff --git a/Source/unix/NSStream.m b/Source/unix/NSStream.m index c0c54d559..3d08f2f80 100644 --- a/Source/unix/NSStream.m +++ b/Source/unix/NSStream.m @@ -104,7 +104,7 @@ [super dealloc]; } -- (int) read: (uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) read: (uint8_t *)buffer maxLength: (NSUInteger)len { int readLen; @@ -139,7 +139,7 @@ return readLen; } -- (BOOL) getBuffer: (uint8_t **)buffer length: (unsigned int *)len +- (BOOL) getBuffer: (uint8_t **)buffer length: (NSUInteger *)len { return NO; } @@ -240,7 +240,7 @@ [super dealloc]; } -- (int) write: (const uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) write: (const uint8_t *)buffer maxLength: (NSUInteger)len { int writeLen; @@ -349,7 +349,7 @@ @implementation NSStream + (void) getStreamsToHost: (NSHost *)host - port: (int)port + port: (NSInteger)port inputStream: (NSInputStream **)inputStream outputStream: (NSOutputStream **)outputStream { @@ -501,7 +501,7 @@ return AUTORELEASE([[GSFileInputStream alloc] initWithFileAtPath: path]); } -- (BOOL) getBuffer: (uint8_t **)buffer length: (unsigned int *)len +- (BOOL) getBuffer: (uint8_t **)buffer length: (NSUInteger *)len { [self subclassResponsibility: _cmd]; return NO; @@ -525,7 +525,7 @@ return [[GSFileInputStream alloc] initWithFileAtPath: path]; } -- (int) read: (uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) read: (uint8_t *)buffer maxLength: (NSUInteger)len { [self subclassResponsibility: _cmd]; return -1; @@ -535,7 +535,7 @@ @implementation NSOutputStream -+ (id) outputStreamToBuffer: (uint8_t *)buffer capacity: (unsigned int)capacity ++ (id) outputStreamToBuffer: (uint8_t *)buffer capacity: (NSUInteger)capacity { return AUTORELEASE([[GSBufferOutputStream alloc] initToBuffer: buffer capacity: capacity]); @@ -558,7 +558,7 @@ return NO; } -- (id) initToBuffer: (uint8_t *)buffer capacity: (unsigned int)capacity +- (id) initToBuffer: (uint8_t *)buffer capacity: (NSUInteger)capacity { RELEASE(self); return [[GSBufferOutputStream alloc] initToBuffer: buffer capacity: capacity]; @@ -577,7 +577,7 @@ return [[GSDataOutputStream alloc] init]; } -- (int) write: (const uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) write: (const uint8_t *)buffer maxLength: (NSUInteger)len { [self subclassResponsibility: _cmd]; return -1; diff --git a/Source/win32/NSStream.m b/Source/win32/NSStream.m index 4826b9bc4..f4499594f 100644 --- a/Source/win32/NSStream.m +++ b/Source/win32/NSStream.m @@ -145,7 +145,7 @@ [super dealloc]; } -- (BOOL) getBuffer: (uint8_t **)buffer length: (unsigned int *)len +- (BOOL) getBuffer: (uint8_t **)buffer length: (NSUInteger *)len { return NO; } @@ -199,7 +199,7 @@ return [super propertyForKey: key]; } -- (int) read: (uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) read: (uint8_t *)buffer maxLength: (NSUInteger)len { DWORD readLen; @@ -230,7 +230,7 @@ { [self _setStatus: NSStreamStatusAtEnd]; } - return (int)readLen; + return (NSInteger)readLen; } @@ -302,7 +302,7 @@ [super dealloc]; } -- (BOOL) getBuffer: (uint8_t **)buffer length: (unsigned int *)len +- (BOOL) getBuffer: (uint8_t **)buffer length: (NSUInteger *)len { if (offset < length) { @@ -414,7 +414,7 @@ } } -- (int) read: (uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) read: (uint8_t *)buffer maxLength: (NSUInteger)len { NSStreamStatus myStatus; @@ -617,7 +617,7 @@ return [super propertyForKey: key]; } -- (int) write: (const uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) write: (const uint8_t *)buffer maxLength: (NSUInteger)len { DWORD writeLen; @@ -648,7 +648,7 @@ [self _recordError]; return -1; } - return (int)writeLen; + return (NSInteger)writeLen; } - (void) _dispatch @@ -796,7 +796,7 @@ } } -- (int) write: (const uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) write: (const uint8_t *)buffer maxLength: (NSUInteger)len { NSStreamStatus myStatus = [self streamStatus]; @@ -936,7 +936,7 @@ @implementation NSStream + (void) getStreamsToHost: (NSHost *)host - port: (int)port + port: (NSInteger)port inputStream: (NSInputStream **)inputStream outputStream: (NSOutputStream **)outputStream { @@ -1203,7 +1203,7 @@ done: return AUTORELEASE([[GSFileInputStream alloc] initWithFileAtPath: path]); } -- (BOOL) getBuffer: (uint8_t **)buffer length: (unsigned int *)len +- (BOOL) getBuffer: (uint8_t **)buffer length: (NSUInteger *)len { [self subclassResponsibility: _cmd]; return NO; @@ -1227,7 +1227,7 @@ done: return [[GSFileInputStream alloc] initWithFileAtPath: path]; } -- (int) read: (uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) read: (uint8_t *)buffer maxLength: (NSUInteger)len { [self subclassResponsibility: _cmd]; return -1; @@ -1242,7 +1242,7 @@ done: return AUTORELEASE([[GSDataOutputStream alloc] init]); } -+ (id) outputStreamToBuffer: (uint8_t *)buffer capacity: (unsigned int)capacity ++ (id) outputStreamToBuffer: (uint8_t *)buffer capacity: (NSUInteger)capacity { return AUTORELEASE([[GSBufferOutputStream alloc] initToBuffer: buffer capacity: capacity]); @@ -1260,7 +1260,7 @@ done: return NO; } -- (id) initToBuffer: (uint8_t *)buffer capacity: (unsigned int)capacity +- (id) initToBuffer: (uint8_t *)buffer capacity: (NSUInteger)capacity { RELEASE(self); return [[GSBufferOutputStream alloc] initToBuffer: buffer capacity: capacity]; @@ -1279,7 +1279,7 @@ done: return [[GSDataOutputStream alloc] init]; } -- (int) write: (const uint8_t *)buffer maxLength: (unsigned int)len +- (NSInteger) write: (const uint8_t *)buffer maxLength: (NSUInteger)len { [self subclassResponsibility: _cmd]; return -1; diff --git a/Tools/gdnc.h b/Tools/gdnc.h index 32f4a9de6..773870596 100644 --- a/Tools/gdnc.h +++ b/Tools/gdnc.h @@ -26,11 +26,11 @@ object: (NSString*)object userInfo: (NSData*)info selector: (NSString*)aSelector - to: (NSUInteger)observer; + to: (uint64_t)observer; @end @protocol GDNCProtocol -- (void) addObserver: (NSUInteger)anObserver +- (void) addObserver: (uint64_t)anObserver selector: (NSString*)aSelector name: (NSString*)notificationname object: (NSString*)anObject @@ -45,7 +45,7 @@ - (void) registerClient: (id)client; -- (void) removeObserver: (NSUInteger)anObserver +- (void) removeObserver: (uint64_t)anObserver name: (NSString*)notificationname object: (NSString*)anObject for: (id)client; diff --git a/Tools/gdnc.m b/Tools/gdnc.m index 34774367a..da35d0d1d 100644 --- a/Tools/gdnc.m +++ b/Tools/gdnc.m @@ -160,14 +160,14 @@ ihandler(int sig) object: (NSString*)object userInfo: (NSData*)info selector: (NSString*)aSelector - to: (NSUInteger)observer; + to: (uint64_t)observer; @end @implementation NSDistributedNotificationCenterGDNCDummy - (oneway void) postNotificationName: (NSString*)name object: (NSString*)object userInfo: (NSData*)info selector: (NSString*)aSelector - to: (NSUInteger)observer + to: (uint64_t)observer { return; } @@ -246,7 +246,7 @@ ihandler(int sig) @interface GDNCObserver : NSObject { @public - NSUInteger observer; + uint64_t observer; NSString *notificationName; NSString *notificationObject; NSString *selector; @@ -284,7 +284,7 @@ ihandler(int sig) NSMutableDictionary *observersForObjects; } -- (void) addObserver: (NSUInteger)anObserver +- (void) addObserver: (uint64_t)anObserver selector: (NSString*)aSelector name: (NSString*)notificationName object: (NSString*)anObject @@ -306,7 +306,7 @@ ihandler(int sig) - (void) removeObserversForClients: (NSMapTable*)clients; -- (void) removeObserver: (NSUInteger)anObserver +- (void) removeObserver: (uint64_t)anObserver name: (NSString*)notificationName object: (NSString*)notificationObject for: (id)client; @@ -505,7 +505,7 @@ ihandler(int sig) return self; } -- (void) addObserver: (NSUInteger)anObserver +- (void) addObserver: (uint64_t)anObserver selector: (NSString*)aSelector name: (NSString*)notificationName object: (NSString*)anObject @@ -869,7 +869,7 @@ ihandler(int sig) } } -- (void) removeObserver: (NSUInteger)anObserver +- (void) removeObserver: (uint64_t)anObserver name: (NSString*)notificationName object: (NSString*)notificationObject for: (id)client