Merge pull request #32 from CKegel/warning_fixes

Correct NSInteger warnings
This commit is contained in:
Ariel Abreu 2023-10-17 00:05:27 -04:00 committed by GitHub
commit e01bcde594
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 41 additions and 41 deletions

View File

@ -130,7 +130,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
else
result = [_fetchRequest _countInContext: _context];
NSLog(@"%@ being asked about its count and saying %lu; %@ %@\n", self,
result, _context, _fetchRequest);
(unsigned long) result, _context, _fetchRequest);
return result;
}

View File

@ -245,7 +245,7 @@
[NSApp hideOtherApplications: self];
}
- (int) extendPowerOffBy: (int) milliseconds {
- (NSInteger) extendPowerOffBy: (NSInteger) milliseconds {
return 0;
}

View File

@ -354,8 +354,8 @@ static void CGPathConverter(void *info, const CGPathElement *element) {
- (NSBezierPathElement) elementAtIndex: (int) index {
if (index >= _numberOfElements)
[NSException raise: NSInvalidArgumentException
format: @"index (%d) >= numberOfElements (%d)", index,
_numberOfElements];
format: @"index (%d) >= numberOfElements (%lu)", index,
(unsigned long) _numberOfElements];
return _elements[index];
}
@ -385,8 +385,8 @@ static int numberOfPointsForOperator(int op) {
if (index >= _numberOfElements)
[NSException raise: NSInvalidArgumentException
format: @"index (%d) >= numberOfElements (%d)", index,
_numberOfElements];
format: @"index (%d) >= numberOfElements (%lu)", index,
(unsigned long) _numberOfElements];
for (i = 0; i < index; i++)
pi += numberOfPointsForOperator(_elements[i]);
@ -1037,8 +1037,8 @@ static inline CGFloat degreesToRadians(CGFloat degrees) {
if (index >= _numberOfElements)
[NSException raise: NSInvalidArgumentException
format: @"index (%d) >= numberOfElements (%d)", index,
_numberOfElements];
format: @"index (%d) >= numberOfElements (%lu)", index,
(unsigned long) _numberOfElements];
for (i = 0; i < index; i++)
pi += numberOfPointsForOperator(_elements[i]);

View File

@ -197,7 +197,7 @@ static const CGFloat kImageMargin = 2.;
// in synch with the bare _state of NSCell
} else {
NSInteger version = [coder versionForClassName: @"NSButtonCell"];
NSLog(@"NSButtonCell version is %d\n", version);
NSLog(@"NSButtonCell version is %ld\n", (long) version);
unichar keyEquivModMask;
if (version <= 16) {
if ([(NSUnarchiver *) coder systemVersion] > 82) {

View File

@ -284,9 +284,9 @@ typedef NS_OPTIONS(unsigned int, NSCellAppleFlags2) {
if (version < 54)
[NSException raise: NSInvalidArgumentException
format: @"%@ can not initWithCoder:%@ for version %ld",
[self class], [coder class], version];
[self class], [coder class], (long) version];
NSLog(@"NSCell version is %d\n", version);
NSLog(@"NSCell version is %ld\n", (long) version);
[coder decodeValuesOfObjCTypes: "ii", &flags, &flags2];
/*
@ -442,7 +442,7 @@ typedef NS_OPTIONS(unsigned int, NSCellAppleFlags2) {
else
return 0;
} else
return (abs(_state) > 0) ? 1 : 0;
return (ABS(_state) > 0) ? 1 : 0;
}
- target {
@ -716,7 +716,7 @@ typedef NS_OPTIONS(unsigned int, NSCellAppleFlags2) {
else
_state = 0;
} else
_state = (abs(value) > 0) ? 1 : 0;
_state = (ABS(value) > 0) ? 1 : 0;
}
- (NSControlStateValue) nextState {
@ -1297,7 +1297,7 @@ static NSString *NSStringFromCellType(NSCellType type) {
default:
break;
}
return [NSString stringWithFormat: @"Unknown: %d", type];
return [NSString stringWithFormat: @"Unknown: %lu", (unsigned long) type];
}
- (NSString *) description {

View File

@ -95,7 +95,7 @@ static NSMutableDictionary *cellClassDictionary = nil;
[_aux setTarget: [keyed decodeObjectForKey: @"NSControlTarget"]];
} else {
NSInteger version = [coder versionForClassName: @"NSControl"];
NSLog(@"NSControl version is %d\n", version);
NSLog(@"NSControl version is %ld\n", (long) version);
if (version <= 16) {
NSInteger tag;

View File

@ -226,9 +226,9 @@ static void drawRoundedSelection(NSRect rect) {
fromDate: [self dateValue]];
NSString *month =
[NSString stringWithFormat: @"%d", [components month]];
NSString *day = [NSString stringWithFormat: @"%d", [components day]];
NSString *year = [NSString stringWithFormat: @"%d", [components year]];
[NSString stringWithFormat: @"%ld", (long) [components month]];
NSString *day = [NSString stringWithFormat: @"%ld", (long) [components day]];
NSString *year = [NSString stringWithFormat: @"%ld", (long) [components year]];
[attributes
setObject: [NSNumber numberWithUnsignedInteger: [components

View File

@ -243,7 +243,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
- (NSString *) description {
return [NSString
stringWithFormat:
@"<NSEvent: type=%lu loc=(%f,%f) time=%f flags=0x%X "
@"<NSEvent: type=%lu loc=(%f,%f) time=%f flags=0x%lX "
@"win=%p winNum=%lu>",
(unsigned long) [self type], [self locationInWindow].x,
[self locationInWindow].y, [self timestamp],

View File

@ -376,7 +376,7 @@ static NSLock *_cacheLock = nil;
} else {
NSInteger version = [coder versionForClassName: @"NSFont"];
NSLog(@"NSFont version is %d\n", version);
NSLog(@"NSFont version is %ld\n", (long) version);
unsigned int fFlags = 0;
bool f2;

View File

@ -347,9 +347,9 @@ static NSMutableArray *_registeredClasses = nil;
return [NSString
stringWithFormat:
@"<%@[%p] size: { %f, %f } colorSpace: %@ (%dx%d @ "
@"%d bps) alpha: %@ opaque: %@>",
@"%ld bps) alpha: %@ opaque: %@>",
[self class], self, _size.width, _size.height,
_colorSpaceName, _pixelsWide, _pixelsHigh, _bitsPerSample,
_colorSpaceName, _pixelsWide, _pixelsHigh, (long) _bitsPerSample,
_hasAlpha ? @"YES" : @"NO", _isOpaque ? @"YES" : @"NO"];
}

View File

@ -56,8 +56,8 @@ static void *NSMultipleValueBinderWholeArrayChangeContext;
valueForKeyPath: _valueKeyPath]
forKey: path];
} @catch (id e) {
NSLog(@"exception %@ while setting value for key path %@ for row %i", e,
_valueKeyPath, row);
NSLog(@"exception %@ while setting value for key path %@ for row %ld", e,
_valueKeyPath, (long) row);
}
}

View File

@ -43,9 +43,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
}
- (id) description {
return [NSString stringWithFormat: @"%@ - %@ (%f) [%d]",
return [NSString stringWithFormat: @"%@ - %@ (%f) [%ld]",
[super description], _label, _width,
_tag];
(long) _tag];
}
- (void) dealloc {

View File

@ -74,9 +74,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
if (column < 0 || column >= [[_tableView tableColumns] count]) {
[NSException raise: NSInternalInconsistencyException
format: @"headerRectOfColumn: invalid index %d (valid {%d, "
@"%d})",
column, 0, [tableColumns count]];
format: @"headerRectOfColumn: invalid index %ld (valid {%d, "
@"%lu})",
(long) column, 0, (unsigned long) [tableColumns count]];
}
headerRect.size.width =

View File

@ -400,8 +400,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
if (column < 0 || column >= [_tableColumns count]) {
[NSException raise: NSInternalInconsistencyException
format: @"rectOfColumn: invalid index %d (valid {%d, %d})",
column, 0, [_tableColumns count]];
format: @"rectOfColumn: invalid index %ld (valid {%d, %lu})",
(long) column, 0, (unsigned long) [_tableColumns count]];
}
rect.origin.x = 0.;
@ -1110,8 +1110,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
if ([indexSet firstIndex] != NSNotFound &&
([indexSet firstIndex] < 0 || [indexSet lastIndex] >= numberOfRows))
[NSException raise: NSInternalInconsistencyException
format: @"Index set %@ out of range (valid are 0 to %d).",
indexSet, numberOfRows];
format: @"Index set %@ out of range (valid are 0 to %ld).",
indexSet, (long) numberOfRows];
_rowHeights = realloc(_rowHeights, sizeof(CGFloat) * numberOfRows);

View File

@ -67,7 +67,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[[keyed decodeObjectForKey: @"NSPlaceholderString"] retain];
} else {
NSInteger version = [coder versionForClassName: @"NSTextFieldCell"];
NSLog(@"NSTextFieldCell version is %d\n", version);
NSLog(@"NSTextFieldCell version is %ld\n", (long) version);
if (version > 40) {
uint8_t flags;
[coder decodeValuesOfObjCTypes: "c@@", &flags, &_backgroundColor,

View File

@ -69,8 +69,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
{
NSDictionary *result;
NSAssert2(location <= [self length], @"index %d beyond length %d", location,
[self length]);
NSAssert2(location <= [self length], @"index %lu beyond length %lu", (unsigned long) location,
(unsigned long) [self length]);
if ((result = NSRangeEntryAtIndex(_rangeToAttributes, location,
effectiveRangep)) == nil)

View File

@ -1321,7 +1321,7 @@ NSString *const NSAllRomanInputSourcesLocaleIdentifier =
}
delta -= (upstream ? range.location : NSMaxRange(range));
delta = abs(delta);
delta = ABS(delta);
if (upstream && range.location > 0) {
range.location -= delta;

View File

@ -287,7 +287,7 @@ typedef struct __VFlags {
format: @"%@ can not initWithCoder:%@", [self class],
[coder class]];
NSLog(@"NSView version is %d\n", version);
NSLog(@"NSView version is %ld\n", (long) version);
union {
_VFlags vf;
@ -295,7 +295,7 @@ typedef struct __VFlags {
} vflags;
vflags.value = 0;
NSLog(@"NSView version is %d\n", version);
NSLog(@"NSView version is %ld\n", (long) version);
if (version <= 16) {
float dummy;

View File

@ -127,7 +127,7 @@ typedef NSUInteger NSWorkspaceIconCreationOptions;
- (NSDictionary *) activeApplication;
- (void) hideOtherApplications;
- (int) extendPowerOffBy: (int) milliseconds;
- (NSInteger) extendPowerOffBy: (NSInteger) milliseconds;
- (BOOL) setIcon: (NSImage *) image
forFile: (NSString *) fullPath

View File

@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
_imageName = [[keyed decodeObjectForKey: @"NSImageName"] retain];
} else {
NSInteger version = [coder versionForClassName: @"NSButtonImageSource"];
NSLog(@"NSButtonImageSource version is %d\n", version);
NSLog(@"NSButtonImageSource version is %ld\n", (long) version);
if (version == 1) {
_imageName = [[coder decodeObject] retain];