Fix clang compiler warnings as reported by Sebastian Reitenbach

<sebastia@l00-bugdead-prods.de>.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34608 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2012-01-23 14:27:58 +00:00
parent 81b8b6a826
commit e278d9956c
15 changed files with 87 additions and 41 deletions

View file

@ -1,4 +1,23 @@
2012-01-21 Eric Wasylishen <ewasylishen@gmail.com> 2012-01-23 Fred Kiefer <FredKiefer@gmx.de>
* 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
<sebastia@l00-bugdead-prods.de>.
2012-01-21 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSView.m (-setBounds:, -setBoundsOrigin:, -setBoundsSize:): * Source/NSView.m (-setBounds:, -setBoundsOrigin:, -setBoundsSize:):
Revert a portion of r32955 which I committed last april but I now Revert a portion of r32955 which I committed last april but I now

View file

@ -133,7 +133,7 @@ APPKIT_EXPORT NSString *NSImageEXIFData; // No GNUstep support yet; for reading
NSMutableDictionary *_properties; NSMutableDictionary *_properties;
BOOL _isPlanar; BOOL _isPlanar;
unsigned char **_imagePlanes; unsigned char **_imagePlanes;
NSMutableData *_imageData; NSData *_imageData;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
NSBitmapFormat _format; NSBitmapFormat _format;
#else #else

View file

@ -144,7 +144,7 @@ typedef enum {
@interface NSCell : NSObject <NSCopying, NSCoding> @interface NSCell : NSObject <NSCopying, NSCoding>
{ {
// Attributes // Attributes
NSString *_contents; id _contents;
NSImage *_cell_image; NSImage *_cell_image;
NSFont *_font; NSFont *_font;
id _object_value; id _object_value;

View file

@ -290,7 +290,6 @@ typedef enum _NSMatrixMode {
to: (id)anObject to: (id)anObject
forAllCells: (BOOL)flag; forAllCells: (BOOL)flag;
- (void) sendDoubleAction; - (void) sendDoubleAction;
- (void) setErrorAction: (SEL)aSelector;
/* /*
* Handling Event and Action Messages * Handling Event and Action Messages

View file

@ -70,7 +70,7 @@
{ {
if (data != nil) if (data != nil)
{ {
NSUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc]
initForReadingWithData: data]; initForReadingWithData: data];
if (unarchiver != nil) if (unarchiver != nil)
{ {

View file

@ -66,6 +66,7 @@
#import "AppKit/NSNib.h" #import "AppKit/NSNib.h"
#import "AppKit/NSScreen.h" #import "AppKit/NSScreen.h"
#import "AppKit/NSSound.h" #import "AppKit/NSSound.h"
#import "AppKit/NSToolbar.h"
#import "GNUstepGUI/GSInstantiator.h" #import "GNUstepGUI/GSInstantiator.h"
#import "GSGuiPrivate.h" #import "GSGuiPrivate.h"

View file

@ -670,7 +670,7 @@ typedef struct {
} }
if (_extraColors[elementState] == nil) if (_extraColors[elementState] == nil)
{ {
_extraColors[elementState] = [null retain]; _extraColors[elementState] = (id)[null retain];
} }
} }
if (_extraColors[elementState] != (id)null) if (_extraColors[elementState] != (id)null)

View file

@ -558,7 +558,7 @@ static inline NSRect RectWithSizeScaledByFactor(NSRect aRect, CGFloat factor)
[RETAIN(v) removeFromSuperviewWithoutNeedingDisplay]; [RETAIN(v) removeFromSuperviewWithoutNeedingDisplay];
[self changeWindowHeight: -(menubarHeight)]; [self changeWindowHeight: -(menubarHeight)];
return AUTORELEASE(v); return (NSMenuView *)AUTORELEASE(v);
} }
} }

View file

@ -714,7 +714,7 @@
} }
properties = [self propertiesForObjectID: [obj objectID]]; 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: @"windowTemplate.maxSize"];
//value = [properties objectForKey: @"CustomClassName"]; //value = [properties objectForKey: @"CustomClassName"];

View file

@ -519,26 +519,27 @@
} }
else else
{ {
unsigned char* bits; unsigned char *bits;
long length; NSUInteger length;
unsigned int i; unsigned int i;
// No image data was given, allocate it. // No image data was given, allocate it.
length = (long)((_isPlanar) ? _numColors : 1) * _bytesPerRow * length = (NSUInteger)((_isPlanar) ? _numColors : 1) * _bytesPerRow *
_pixelsHigh * sizeof(unsigned char); _pixelsHigh * sizeof(unsigned char);
// Create a mutable data object although we never use it as such
_imageData = [[NSMutableData alloc] initWithLength: length]; _imageData = [[NSMutableData alloc] initWithLength: length];
bits = [_imageData mutableBytes]; bits = (unsigned char *)[_imageData bytes];
_imagePlanes[0] = bits; _imagePlanes[0] = bits;
if (_isPlanar) if (_isPlanar)
{ {
for (i=1; i < _numColors; i++) for (i = 1; i < _numColors; i++)
_imagePlanes[i] = bits + i*_bytesPerRow * _pixelsHigh; _imagePlanes[i] = bits + i * _bytesPerRow * _pixelsHigh;
for (i= _numColors; i < MAX_PLANES; i++) for (i = _numColors; i < MAX_PLANES; i++)
_imagePlanes[i] = NULL; _imagePlanes[i] = NULL;
} }
else else
{ {
for (i= 1; i < MAX_PLANES; i++) for (i = 1; i < MAX_PLANES; i++)
_imagePlanes[i] = NULL; _imagePlanes[i] = NULL;
} }
} }
@ -1766,21 +1767,21 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
} }
else else
{ {
unsigned char* bits; unsigned char *bits;
unsigned int i; unsigned int i;
bits = [copy->_imageData mutableBytes]; bits = (unsigned char *)[copy->_imageData bytes];
copy->_imagePlanes[0] = bits; copy->_imagePlanes[0] = bits;
if (_isPlanar) if (_isPlanar)
{ {
for (i=1; i < _numColors; i++) for (i = 1; i < _numColors; i++)
copy->_imagePlanes[i] = bits + i*_bytesPerRow * _pixelsHigh; copy->_imagePlanes[i] = bits + i * _bytesPerRow * _pixelsHigh;
for (i= _numColors; i < MAX_PLANES; i++) for (i = _numColors; i < MAX_PLANES; i++)
copy->_imagePlanes[i] = NULL; copy->_imagePlanes[i] = NULL;
} }
else else
{ {
for (i= 1; i < MAX_PLANES; i++) for (i = 1; i < MAX_PLANES; i++)
copy->_imagePlanes[i] = NULL; copy->_imagePlanes[i] = NULL;
} }
} }

View file

@ -215,7 +215,7 @@ typedef struct _GSButtonCellFlags
if (_cell.contents_is_attributed_string == NO) if (_cell.contents_is_attributed_string == NO)
{ {
// If we have a formatter this is also the string of the _object_value // If we have a formatter this is also the string of the _object_value
return _contents; return (NSString *)_contents;
} }
else else
{ {

View file

@ -324,7 +324,7 @@ static NSColor *dtxtCol;
if (_cell.contents_is_attributed_string == NO) if (_cell.contents_is_attributed_string == NO)
{ {
// If we have a formatter this is also the string of the _object_value // If we have a formatter this is also the string of the _object_value
return _contents; return (NSString *)_contents;
} }
else else
{ {
@ -2991,26 +2991,55 @@ static NSColor *dtxtCol;
contents = [_formatter editingStringForObjectValue: _object_value]; contents = [_formatter editingStringForObjectValue: _object_value];
if (contents == nil) 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]]) if (![contents isEqualToString: [textObject string]])
[textObject setText: contents]; [textObject setText: contents];
} }
else else
{ {
NSString *contents;
if (nil == _contents)
{
contents = @"";
}
if (_cell.contents_is_attributed_string == NO) if (_cell.contents_is_attributed_string == NO)
{ {
if (![_contents isEqualToString:[textObject string]]) contents = (NSString *)_contents;
[textObject setText: _contents];
} }
else else
{ {
// FIXME what about attribute changes? contents = [(NSAttributedString *)_contents string];
NSRange range = NSMakeRange(0, [[textObject string] length]); }
if (![[(NSAttributedString *)_contents string] isEqualToString: if (![contents isEqualToString: [textObject string]])
[textObject string]]) {
[textObject replaceCharactersInRange: range if (_cell.contents_is_attributed_string == NO)
withAttributedString: (NSAttributedString *)_contents]; {
[textObject setText: contents];
}
else
{
// FIXME what about attribute changes?
NSRange range = NSMakeRange(0, [[textObject string] length]);
[textObject replaceCharactersInRange: range
withAttributedString: (NSAttributedString *)_contents];
}
} }
} }
} }

View file

@ -638,7 +638,7 @@ static NSString *namePrefix = @"NSTypedFilenamesPboardType:";
- (id) initWithCoder: (NSCoder*)aCoder - (id) initWithCoder: (NSCoder*)aCoder
{ {
NSPasteboard *p; NSPasteboard *p = nil;
id val = [aCoder decodeObject]; id val = [aCoder decodeObject];
if ([val isKindOfClass: [NSData class]] == YES) if ([val isKindOfClass: [NSData class]] == YES)
@ -656,8 +656,8 @@ static NSString *namePrefix = @"NSTypedFilenamesPboardType:";
p = [NSPasteboard pasteboardByFilteringTypesInPasteboard: val]; p = [NSPasteboard pasteboardByFilteringTypesInPasteboard: val];
} }
ASSIGN(self, p); RELEASE(self);
return self; return RETAIN(p);
} }
/** /**
@ -1499,7 +1499,7 @@ static NSMapTable *mimeMap = NULL;
* is the pasteboards dictionary, remove us from that dictionary * is the pasteboards dictionary, remove us from that dictionary
* as well. * as well.
*/ */
- (void) release - (oneway void) release
{ {
if ([self retainCount] == 2) if ([self retainCount] == 2)
{ {

View file

@ -90,9 +90,6 @@
atIndex: (int)index atIndex: (int)index
broadcast: (BOOL)broadcast; broadcast: (BOOL)broadcast;
- (void) _insertPassivelyItem: (NSToolbarItem *)item atIndex: (int)newIndex; - (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 - (void) _performRemoveItem: (NSToolbarItem *)item; // Used by drag setup
- (NSToolbar *) _toolbarModel; - (NSToolbar *) _toolbarModel;
- (void) _validate: (NSWindow *)observedWindow; - (void) _validate: (NSWindow *)observedWindow;

View file

@ -47,7 +47,7 @@
NSAttributedString *text; NSAttributedString *text;
NSMutableDictionary *fontDict; NSMutableDictionary *fontDict;
NSMutableDictionary *colorDict; NSMutableDictionary *colorDict;
NSMutableDictionary *docDict; NSDictionary *docDict;
NSMutableArray *attachments; NSMutableArray *attachments;
NSColor *fgColor; NSColor *fgColor;