Remove dead assignments found by static code analysis.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32022 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2011-02-09 22:20:00 +00:00
parent f48dfb5072
commit 475f2d07aa
15 changed files with 44 additions and 42 deletions

View file

@ -1,3 +1,20 @@
2011-02-09 Fred Kiefer <FredKiefer@gmx.de>
* Source/GSInfoPanel.m,
* Source/GSTextStorage.m,
* Source/GSThemeInspector.m,
* Source/NSBrowser.m,
* Source/NSImage.m,
* Source/NSMenuView.m,
* Source/NSPageLayout.m,
* Source/NSSpellChecker.m,
* Source/NSStringDrawing.m,
* Source/NSTableHeaderView.m,
* Source/NSTableView.m,
* Source/NSWindow.m,
* Tools/gclose.m,
* Tools/make_services.m: Remove dead assignments found by static code analysis.
2011-02-09 Richard Frith-Macdonald <rfm@gnu.org> 2011-02-09 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSEvent.m: Avoid unneccessary creation/destruction of NSDate * Source/NSEvent.m: Avoid unneccessary creation/destruction of NSDate

View file

@ -691,7 +691,6 @@ new_label (NSString *value)
f = [themeLabel frame]; f = [themeLabel frame];
f.origin.x = (width - f.size.width) / 2; f.origin.x = (width - f.size.width) / 2;
f.origin.y = tmp_b - 5 - f.size.height; f.origin.y = tmp_b - 5 - f.size.height;
tmp_b = f.origin.y;
[cv addSubview: themeLabel]; [cv addSubview: themeLabel];
[themeLabel setFrame: f]; [themeLabel setFrame: f];
[themeLabel setTarget: [GSTheme class]]; [themeLabel setTarget: [GSTheme class]];

View file

@ -694,7 +694,6 @@ SANITY();
if (NSMaxRange(effectiveRange) > afterRangeLoc) if (NSMaxRange(effectiveRange) > afterRangeLoc)
{ {
range.length = NSMaxRange(effectiveRange) - range.location; range.length = NSMaxRange(effectiveRange) - range.location;
afterRangeLoc = NSMaxRange(range);
} }
} }
else if (effectiveRange.location > beginRangeLoc) else if (effectiveRange.location > beginRangeLoc)
@ -782,7 +781,6 @@ changeInLength: 0];
unsigned arrayIndex = 0; unsigned arrayIndex = 0;
unsigned arraySize; unsigned arraySize;
NSRange effectiveRange = NSMakeRange(0, NSNotFound); NSRange effectiveRange = NSMakeRange(0, NSNotFound);
NSDictionary *attrs;
GSTextInfo *info; GSTextInfo *info;
int moveLocations; int moveLocations;
unsigned start; unsigned start;
@ -825,8 +823,8 @@ SANITY();
start = range.location - 1; start = range.location - 1;
else else
start = range.location; start = range.location;
attrs = _attributesAtIndexEffectiveRange(start, &effectiveRange, _attributesAtIndexEffectiveRange(start, &effectiveRange,
tmpLength, _infoArray, &arrayIndex); tmpLength, _infoArray, &arrayIndex);
moveLocations = [aString length] - range.length; moveLocations = [aString length] - range.length;
@ -876,8 +874,8 @@ SANITY();
*/ */
if ((moveLocations + range.length) == 0) if ((moveLocations + range.length) == 0)
{ {
attrs = _attributesAtIndexEffectiveRange(start, &effectiveRange, _attributesAtIndexEffectiveRange(start, &effectiveRange,
tmpLength, _infoArray, &arrayIndex); tmpLength, _infoArray, &arrayIndex);
arrayIndex++; arrayIndex++;
if (effectiveRange.location == range.location if (effectiveRange.location == range.location

View file

@ -79,7 +79,6 @@ static GSThemeInspector *sharedInspector = nil;
- (id) init - (id) init
{ {
NSRect frame; NSRect frame;
NSView *content;
frame.size = NSMakeSize(272,388); frame.size = NSMakeSize(272,388);
frame.origin = NSZeroPoint; frame.origin = NSZeroPoint;
@ -90,7 +89,7 @@ static GSThemeInspector *sharedInspector = nil;
defer: NO]; defer: NO];
[self setReleasedWhenClosed: NO]; [self setReleasedWhenClosed: NO];
content = [self contentView];
return self; return self;
} }

View file

@ -2399,7 +2399,6 @@ static NSTextFieldCell *titleCell;
} }
if (selectedColumn == -1) if (selectedColumn == -1)
{ {
selectedColumn = 0;
matrix = [self matrixInColumn: 0]; matrix = [self matrixInColumn: 0];
if ([[matrix cells] count]) if ([[matrix cells] count])
@ -2772,10 +2771,9 @@ static NSTextFieldCell *titleCell;
else else
{ {
int colCount; int colCount;
id dummy;
// Here to keep compatibility with old version // Here to keep compatibility with old version
dummy = [aDecoder decodeObject]; [aDecoder decodeObject];
_browserCellPrototype = RETAIN([aDecoder decodeObject]); _browserCellPrototype = RETAIN([aDecoder decodeObject]);
_browserMatrixClass = NSClassFromString ((NSString *)[aDecoder decodeObject]); _browserMatrixClass = NSClassFromString ((NSString *)[aDecoder decodeObject]);

View file

@ -1448,14 +1448,17 @@ Fallback for backends other than Cairo. */
{ {
NSImageRep* rep; NSImageRep* rep;
NSMutableArray *breps; NSMutableArray *breps;
NSSize dres;
NSEnumerator *enumerator = [reps objectEnumerator]; NSEnumerator *enumerator = [reps objectEnumerator];
/*
NSSize dres;
NSValue *resolution = [deviceDescription objectForKey: NSDeviceResolution]; NSValue *resolution = [deviceDescription objectForKey: NSDeviceResolution];
if (resolution) if (resolution)
dres = [resolution sizeValue]; dres = [resolution sizeValue];
else else
dres = NSMakeSize(0, 0); dres = NSMakeSize(0, 0);
*/
breps = [NSMutableArray array]; breps = [NSMutableArray array];
while ((rep = [enumerator nextObject]) != nil) while ((rep = [enumerator nextObject]) != nil)
@ -1757,10 +1760,8 @@ Fallback for backends other than Cairo. */
} }
if ([coder containsValueForKey: @"NSImageFlags"]) if ([coder containsValueForKey: @"NSImageFlags"])
{ {
int flags;
//FIXME //FIXME
flags = [coder decodeIntForKey: @"NSImageFlags"]; //int flags = [coder decodeIntForKey: @"NSImageFlags"];
} }
if ([coder containsValueForKey: @"NSReps"]) if ([coder containsValueForKey: @"NSReps"])
{ {

View file

@ -1512,7 +1512,6 @@ static NSMapTable *viewInfo = 0;
{ {
[self setHighlightedItemIndex: -1]; [self setHighlightedItemIndex: -1];
[[[[NSApp mainWindow] menu] attachedMenu] close]; [[[[NSApp mainWindow] menu] attachedMenu] close];
shouldFinish = YES;
return NO; return NO;
} }
@ -1671,7 +1670,6 @@ static NSMapTable *viewInfo = 0;
if (space == 2) if (space == 2)
{ {
[anAttachedMenu close]; [anAttachedMenu close];
shouldFinish = YES;
return NO; return NO;
} }
} }
@ -1679,7 +1677,6 @@ static NSMapTable *viewInfo = 0;
if (self != [[[NSApp mainWindow] menu] menuRepresentation]) if (self != [[[NSApp mainWindow] menu] menuRepresentation])
{ {
[self setHighlightedItemIndex: -1]; [self setHighlightedItemIndex: -1];
shouldFinish = YES;
return [[[[NSApp mainWindow] menu] menuRepresentation] return [[[[NSApp mainWindow] menu] menuRepresentation]
trackWithEvent: original]; trackWithEvent: original];
} }

View file

@ -29,9 +29,10 @@
Boston, MA 02110-1301, USA. Boston, MA 02110-1301, USA.
*/ */
#import <Foundation/NSDebug.h>
#import <Foundation/NSDecimalNumber.h>
#import <Foundation/NSDictionary.h> #import <Foundation/NSDictionary.h>
#import <Foundation/NSNumberFormatter.h> #import <Foundation/NSNumberFormatter.h>
#import <Foundation/NSDecimalNumber.h>
#import <Foundation/NSUserDefaults.h> #import <Foundation/NSUserDefaults.h>
#import "AppKit/NSApplication.h" #import "AppKit/NSApplication.h"
#import "AppKit/NSFont.h" #import "AppKit/NSFont.h"
@ -609,7 +610,7 @@ enum {
defaults = [NSUserDefaults standardUserDefaults]; defaults = [NSUserDefaults standardUserDefaults];
string = [defaults objectForKey: @"NSMeasurementUnit"]; string = [defaults objectForKey: @"NSMeasurementUnit"];
NSLog(@"NSMeasurementUnit is %@", string); NSDebugLLog(@"NSPageLayout", @"NSMeasurementUnit is %@", string);
if (string == nil) //default to cm, most of the world is metric... if (string == nil) //default to cm, most of the world is metric...
{ {
@ -777,13 +778,10 @@ enum {
- (void)readPrintInfo - (void)readPrintInfo
{ {
NSPrinter *printer;
NSString *paperName; NSString *paperName;
NSNumber *scaleNumber; NSNumber *scaleNumber;
NSLog(@"readPrintInfo: %@", [[_printInfo dictionary] description]); NSDebugLLog(@"NSPageLayout", @"readPrintInfo: %@", [[_printInfo dictionary] description]);
printer = [_printInfo printer];
[self syncInterface]; [self syncInterface];
@ -909,32 +907,32 @@ enum {
[[_printInfo dictionary] setObject: scaleNumber [[_printInfo dictionary] setObject: scaleNumber
forKey: NSPrintScalingFactor]; forKey: NSPrintScalingFactor];
NSLog(@"writePrintInfo: %@", [[_printInfo dictionary] description]); NSDebugLLog(@"NSPageLayout", @"writePrintInfo: %@", [[_printInfo dictionary] description]);
} }
//NSTextField delegate handlers //NSTextField delegate handlers
-(void) textDidBeginEditing:(NSNotification*) notification -(void) textDidBeginEditing:(NSNotification*) notification
{ {
NSLog(@"textDidBeginEditing: %@", [notification description]); NSDebugLLog(@"NSPageLayout", @"textDidBeginEditing: %@", [notification description]);
} }
-(void) textDidEndEditing:(NSNotification*) notification -(void) textDidEndEditing:(NSNotification*) notification
{ {
NSLog(@"textDidEndEditing: %@", [notification description]); NSDebugLLog(@"NSPageLayout", @"textDidEndEditing: %@", [notification description]);
} }
-(void) textDidChange:(NSNotification*) notification -(void) textDidChange:(NSNotification*) notification
{ {
NSLog(@"textDidChange: %@", [notification description]); NSDebugLLog(@"NSPageLayout", @"textDidChange: %@", [notification description]);
} }
-(void) controlTextDidChange:(NSNotification*) notification -(void) controlTextDidChange:(NSNotification*) notification
{ {
NSLog(@"controlTextDidChange: %@", [notification description]); NSDebugLLog(@"NSPageLayout", @"controlTextDidChange: %@", [notification description]);
} }

View file

@ -578,14 +578,13 @@ inSpellDocumentWithTag:(int)tag
- _forget: (id)sender - _forget: (id)sender
{ {
NSString *word = [_wordField stringValue]; NSString *word = [_wordField stringValue];
BOOL result = NO;
// Call the server and remove the word from the learned // Call the server and remove the word from the learned
// list. // list.
NS_DURING NS_DURING
{ {
result = [[self _serverProxy] _forgetWord: word [[self _serverProxy] _forgetWord: word
inDictionary: _language]; inDictionary: _language];
} }
NS_HANDLER NS_HANDLER
{ {

View file

@ -274,7 +274,6 @@ static int cache_lookup_string(NSString *string, NSDictionary *attributes,
{ {
cache_t *c; cache_t *c;
int ci, hit; int ci, hit;
NSTextStorage *textStorage;
NSLayoutManager *layoutManager; NSLayoutManager *layoutManager;
NSTextContainer *textContainer; NSTextContainer *textContainer;
@ -311,7 +310,6 @@ static int cache_lookup_string(NSString *string, NSDictionary *attributes,
} }
c = &cache[ci]; c = &cache[ci];
textStorage = c->textStorage;
layoutManager = c->layoutManager; layoutManager = c->layoutManager;
textContainer = c->textContainer; textContainer = c->textContainer;
@ -331,7 +329,6 @@ static int cache_lookup_attributed_string(NSAttributedString *string,
{ {
cache_t *c; cache_t *c;
int ci, hit; int ci, hit;
NSTextStorage *textStorage;
NSLayoutManager *layoutManager; NSLayoutManager *layoutManager;
NSTextContainer *textContainer; NSTextContainer *textContainer;
@ -352,7 +349,6 @@ static int cache_lookup_attributed_string(NSAttributedString *string,
c = &cache[ci]; c = &cache[ci];
textStorage = c->textStorage;
layoutManager = c->layoutManager; layoutManager = c->layoutManager;
textContainer = c->textContainer; textContainer = c->textContainer;

View file

@ -643,7 +643,6 @@
{ {
NSHighlightRect(highlightRect); NSHighlightRect(highlightRect);
[_window flushWindow]; [_window flushWindow];
lit = NO;
} }
[self unlockFocus]; [self unlockFocus];
} }

View file

@ -910,6 +910,10 @@ static void computeNewSelection
} }
} }
} }
if (notified == YES)
{
[tv _postSelectionIsChangingNotification];
}
} }
else else
{ {

View file

@ -4110,7 +4110,6 @@ resetCursorRectsForView(NSView *theView)
} }
ASSIGN(_lastDragView, v); ASSIGN(_lastDragView, v);
_f.accepts_drag = GSViewAcceptsDrag(v, dragInfo); _f.accepts_drag = GSViewAcceptsDrag(v, dragInfo);
action = NSDragOperationNone;
} }
if (_f.accepts_drag) if (_f.accepts_drag)
{ {

View file

@ -56,7 +56,7 @@ main(int argc, char** argv, char **env_c)
if ([arg isEqualToString: @"-NSHost"]) if ([arg isEqualToString: @"-NSHost"])
{ {
// skip since this is handled above... // skip since this is handled above...
arg = [argEnumerator nextObject]; [argEnumerator nextObject];
} }
else // no option specified else // no option specified
{ {

View file

@ -95,7 +95,6 @@ main(int argc, char** argv, char **env_c)
NSData *data; NSData *data;
NSProcessInfo *proc; NSProcessInfo *proc;
NSFileManager *mgr; NSFileManager *mgr;
NSDictionary *env;
NSMutableDictionary *services; NSMutableDictionary *services;
NSArray *args; NSArray *args;
NSString *usrRoot; NSString *usrRoot;
@ -136,7 +135,6 @@ main(int argc, char** argv, char **env_c)
extensionsMap = [NSMutableDictionary dictionaryWithCapacity: 64]; extensionsMap = [NSMutableDictionary dictionaryWithCapacity: 64];
schemesMap = [NSMutableDictionary dictionaryWithCapacity: 64]; schemesMap = [NSMutableDictionary dictionaryWithCapacity: 64];
env = [proc environment];
args = [proc arguments]; args = [proc arguments];
for (index = 1; index < [args count]; index++) for (index = 1; index < [args count]; index++)