diff --git a/ChangeLog b/ChangeLog index 82280ea3b..f2eaa2ea2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,23 @@ -2012-01-21 Eric Wasylishen +2012-01-23 Fred Kiefer + + * Source/NSToolbarFrameworkPrivate.h, + * Headers/AppKit/NSMatrix.h: Remove duplicated method declarations. + * TextConverters/RTF/RTFProducer.h: Change docDict to NSDictionary. + * Source/GSTheme.m, + * Source/GSWindowDecorationView.m: Add missing type cast. + * Headers/AppKit/NSCell.h, + * Source/NSCell.m, + * Source/NSButtonCell.m: Change _contents to id. + * Source/GSNibLoading.m: Add missing import. + * Source/NSPasteboard.m: Declare release as oneway. + * Source/GSNibLoader.m: Change class to NSKeyedUnarchiver. + * Source/GSXibLoader.m: Use correct printf type specifier. + * Headers/AppKit/NSBitmapImageRep.h, + * Source/NSBitmapImageRep.m: Change _imageData to NSData. + Fix clang compiler warnings as reported by Sebastian Reitenbach + . + +2012-01-21 Eric Wasylishen * Source/NSView.m (-setBounds:, -setBoundsOrigin:, -setBoundsSize:): Revert a portion of r32955 which I committed last april but I now diff --git a/Headers/AppKit/NSBitmapImageRep.h b/Headers/AppKit/NSBitmapImageRep.h index 5352a2c64..aa5716dd8 100644 --- a/Headers/AppKit/NSBitmapImageRep.h +++ b/Headers/AppKit/NSBitmapImageRep.h @@ -133,7 +133,7 @@ APPKIT_EXPORT NSString *NSImageEXIFData; // No GNUstep support yet; for reading NSMutableDictionary *_properties; BOOL _isPlanar; unsigned char **_imagePlanes; - NSMutableData *_imageData; + NSData *_imageData; #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) NSBitmapFormat _format; #else diff --git a/Headers/AppKit/NSCell.h b/Headers/AppKit/NSCell.h index 7cb888791..fb811b515 100644 --- a/Headers/AppKit/NSCell.h +++ b/Headers/AppKit/NSCell.h @@ -144,7 +144,7 @@ typedef enum { @interface NSCell : NSObject { // Attributes - NSString *_contents; + id _contents; NSImage *_cell_image; NSFont *_font; id _object_value; diff --git a/Headers/AppKit/NSMatrix.h b/Headers/AppKit/NSMatrix.h index 86c554665..a06a07134 100644 --- a/Headers/AppKit/NSMatrix.h +++ b/Headers/AppKit/NSMatrix.h @@ -290,7 +290,6 @@ typedef enum _NSMatrixMode { to: (id)anObject forAllCells: (BOOL)flag; - (void) sendDoubleAction; -- (void) setErrorAction: (SEL)aSelector; /* * Handling Event and Action Messages diff --git a/Source/GSNibLoader.m b/Source/GSNibLoader.m index eb0301048..0759df8fa 100644 --- a/Source/GSNibLoader.m +++ b/Source/GSNibLoader.m @@ -70,7 +70,7 @@ { if (data != nil) { - NSUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] + NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData: data]; if (unarchiver != nil) { diff --git a/Source/GSNibLoading.m b/Source/GSNibLoading.m index bd7e105a7..21cdff475 100644 --- a/Source/GSNibLoading.m +++ b/Source/GSNibLoading.m @@ -66,6 +66,7 @@ #import "AppKit/NSNib.h" #import "AppKit/NSScreen.h" #import "AppKit/NSSound.h" +#import "AppKit/NSToolbar.h" #import "GNUstepGUI/GSInstantiator.h" #import "GSGuiPrivate.h" diff --git a/Source/GSTheme.m b/Source/GSTheme.m index 996ad4061..0644fa14f 100644 --- a/Source/GSTheme.m +++ b/Source/GSTheme.m @@ -670,7 +670,7 @@ typedef struct { } if (_extraColors[elementState] == nil) { - _extraColors[elementState] = [null retain]; + _extraColors[elementState] = (id)[null retain]; } } if (_extraColors[elementState] != (id)null) diff --git a/Source/GSWindowDecorationView.m b/Source/GSWindowDecorationView.m index 503d26190..4fd79efd9 100644 --- a/Source/GSWindowDecorationView.m +++ b/Source/GSWindowDecorationView.m @@ -558,7 +558,7 @@ static inline NSRect RectWithSizeScaledByFactor(NSRect aRect, CGFloat factor) [RETAIN(v) removeFromSuperviewWithoutNeedingDisplay]; [self changeWindowHeight: -(menubarHeight)]; - return AUTORELEASE(v); + return (NSMenuView *)AUTORELEASE(v); } } diff --git a/Source/GSXibLoader.m b/Source/GSXibLoader.m index 7405a64a5..731182a4d 100644 --- a/Source/GSXibLoader.m +++ b/Source/GSXibLoader.m @@ -714,7 +714,7 @@ } properties = [self propertiesForObjectID: [obj objectID]]; - NSDebugLLog(@"XIB", @"object %d props %@", [obj objectID], properties); + NSDebugLLog(@"XIB", @"object %ld props %@", (long)[obj objectID], properties); //value = [properties objectForKey: @"windowTemplate.maxSize"]; //value = [properties objectForKey: @"CustomClassName"]; diff --git a/Source/NSBitmapImageRep.m b/Source/NSBitmapImageRep.m index b50578e4c..5780c7072 100644 --- a/Source/NSBitmapImageRep.m +++ b/Source/NSBitmapImageRep.m @@ -519,26 +519,27 @@ } else { - unsigned char* bits; - long length; + unsigned char *bits; + NSUInteger length; unsigned int i; // No image data was given, allocate it. - length = (long)((_isPlanar) ? _numColors : 1) * _bytesPerRow * + length = (NSUInteger)((_isPlanar) ? _numColors : 1) * _bytesPerRow * _pixelsHigh * sizeof(unsigned char); + // Create a mutable data object although we never use it as such _imageData = [[NSMutableData alloc] initWithLength: length]; - bits = [_imageData mutableBytes]; + bits = (unsigned char *)[_imageData bytes]; _imagePlanes[0] = bits; if (_isPlanar) { - for (i=1; i < _numColors; i++) - _imagePlanes[i] = bits + i*_bytesPerRow * _pixelsHigh; - for (i= _numColors; i < MAX_PLANES; i++) + for (i = 1; i < _numColors; i++) + _imagePlanes[i] = bits + i * _bytesPerRow * _pixelsHigh; + for (i = _numColors; i < MAX_PLANES; i++) _imagePlanes[i] = NULL; } else { - for (i= 1; i < MAX_PLANES; i++) + for (i = 1; i < MAX_PLANES; i++) _imagePlanes[i] = NULL; } } @@ -1766,21 +1767,21 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width, } else { - unsigned char* bits; + unsigned char *bits; unsigned int i; - bits = [copy->_imageData mutableBytes]; + bits = (unsigned char *)[copy->_imageData bytes]; copy->_imagePlanes[0] = bits; if (_isPlanar) { - for (i=1; i < _numColors; i++) - copy->_imagePlanes[i] = bits + i*_bytesPerRow * _pixelsHigh; - for (i= _numColors; i < MAX_PLANES; i++) + for (i = 1; i < _numColors; i++) + copy->_imagePlanes[i] = bits + i * _bytesPerRow * _pixelsHigh; + for (i = _numColors; i < MAX_PLANES; i++) copy->_imagePlanes[i] = NULL; } else { - for (i= 1; i < MAX_PLANES; i++) + for (i = 1; i < MAX_PLANES; i++) copy->_imagePlanes[i] = NULL; } } diff --git a/Source/NSButtonCell.m b/Source/NSButtonCell.m index 3d049296d..7c24f4208 100644 --- a/Source/NSButtonCell.m +++ b/Source/NSButtonCell.m @@ -215,7 +215,7 @@ typedef struct _GSButtonCellFlags if (_cell.contents_is_attributed_string == NO) { // If we have a formatter this is also the string of the _object_value - return _contents; + return (NSString *)_contents; } else { diff --git a/Source/NSCell.m b/Source/NSCell.m index db0647d44..7fcf58912 100644 --- a/Source/NSCell.m +++ b/Source/NSCell.m @@ -324,7 +324,7 @@ static NSColor *dtxtCol; if (_cell.contents_is_attributed_string == NO) { // If we have a formatter this is also the string of the _object_value - return _contents; + return (NSString *)_contents; } else { @@ -2991,26 +2991,55 @@ static NSColor *dtxtCol; contents = [_formatter editingStringForObjectValue: _object_value]; if (contents == nil) { - contents = _contents; + // We cannot call the stringValue method as this will call + // validateEditing in NSActionCell subclasses + if (nil == _contents) + { + contents = @""; + } + + if (_cell.contents_is_attributed_string == NO) + { + contents = (NSString *)_contents; + } + else + { + contents = [(NSAttributedString *)_contents string]; + } } if (![contents isEqualToString: [textObject string]]) [textObject setText: contents]; } else { + NSString *contents; + + if (nil == _contents) + { + contents = @""; + } + if (_cell.contents_is_attributed_string == NO) { - if (![_contents isEqualToString:[textObject string]]) - [textObject setText: _contents]; + contents = (NSString *)_contents; } else { - // FIXME what about attribute changes? - NSRange range = NSMakeRange(0, [[textObject string] length]); - if (![[(NSAttributedString *)_contents string] isEqualToString: - [textObject string]]) - [textObject replaceCharactersInRange: range - withAttributedString: (NSAttributedString *)_contents]; + contents = [(NSAttributedString *)_contents string]; + } + if (![contents isEqualToString: [textObject string]]) + { + if (_cell.contents_is_attributed_string == NO) + { + [textObject setText: contents]; + } + else + { + // FIXME what about attribute changes? + NSRange range = NSMakeRange(0, [[textObject string] length]); + [textObject replaceCharactersInRange: range + withAttributedString: (NSAttributedString *)_contents]; + } } } } diff --git a/Source/NSPasteboard.m b/Source/NSPasteboard.m index 0f6c54fd9..a5e988e69 100644 --- a/Source/NSPasteboard.m +++ b/Source/NSPasteboard.m @@ -638,7 +638,7 @@ static NSString *namePrefix = @"NSTypedFilenamesPboardType:"; - (id) initWithCoder: (NSCoder*)aCoder { - NSPasteboard *p; + NSPasteboard *p = nil; id val = [aCoder decodeObject]; if ([val isKindOfClass: [NSData class]] == YES) @@ -656,8 +656,8 @@ static NSString *namePrefix = @"NSTypedFilenamesPboardType:"; p = [NSPasteboard pasteboardByFilteringTypesInPasteboard: val]; } - ASSIGN(self, p); - return self; + RELEASE(self); + return RETAIN(p); } /** @@ -1499,7 +1499,7 @@ static NSMapTable *mimeMap = NULL; * is the pasteboards dictionary, remove us from that dictionary * as well. */ -- (void) release +- (oneway void) release { if ([self retainCount] == 2) { diff --git a/Source/NSToolbarFrameworkPrivate.h b/Source/NSToolbarFrameworkPrivate.h index ea8e70cab..d19db026d 100644 --- a/Source/NSToolbarFrameworkPrivate.h +++ b/Source/NSToolbarFrameworkPrivate.h @@ -90,9 +90,6 @@ atIndex: (int)index broadcast: (BOOL)broadcast; - (void) _insertPassivelyItem: (NSToolbarItem *)item atIndex: (int)newIndex; -- (void) _moveItemFromIndex: (int)index - toIndex: (int)newIndex - broadcast: (BOOL)broacast; - (void) _performRemoveItem: (NSToolbarItem *)item; // Used by drag setup - (NSToolbar *) _toolbarModel; - (void) _validate: (NSWindow *)observedWindow; diff --git a/TextConverters/RTF/RTFProducer.h b/TextConverters/RTF/RTFProducer.h index 72883d705..948a5ab58 100644 --- a/TextConverters/RTF/RTFProducer.h +++ b/TextConverters/RTF/RTFProducer.h @@ -47,7 +47,7 @@ NSAttributedString *text; NSMutableDictionary *fontDict; NSMutableDictionary *colorDict; - NSMutableDictionary *docDict; + NSDictionary *docDict; NSMutableArray *attachments; NSColor *fgColor;