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:
Fred Kiefer 2011-02-09 22:20:00 +00:00
parent ff39f70ab1
commit 906201acf6
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>
* Source/NSEvent.m: Avoid unneccessary creation/destruction of NSDate

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -29,9 +29,10 @@
Boston, MA 02110-1301, USA.
*/
#import <Foundation/NSDebug.h>
#import <Foundation/NSDecimalNumber.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSNumberFormatter.h>
#import <Foundation/NSDecimalNumber.h>
#import <Foundation/NSUserDefaults.h>
#import "AppKit/NSApplication.h"
#import "AppKit/NSFont.h"
@ -609,7 +610,7 @@ enum {
defaults = [NSUserDefaults standardUserDefaults];
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...
{
@ -777,13 +778,10 @@ enum {
- (void)readPrintInfo
{
NSPrinter *printer;
NSString *paperName;
NSNumber *scaleNumber;
NSLog(@"readPrintInfo: %@", [[_printInfo dictionary] description]);
printer = [_printInfo printer];
NSDebugLLog(@"NSPageLayout", @"readPrintInfo: %@", [[_printInfo dictionary] description]);
[self syncInterface];
@ -909,32 +907,32 @@ enum {
[[_printInfo dictionary] setObject: scaleNumber
forKey: NSPrintScalingFactor];
NSLog(@"writePrintInfo: %@", [[_printInfo dictionary] description]);
NSDebugLLog(@"NSPageLayout", @"writePrintInfo: %@", [[_printInfo dictionary] description]);
}
//NSTextField delegate handlers
-(void) textDidBeginEditing:(NSNotification*) notification
{
NSLog(@"textDidBeginEditing: %@", [notification description]);
NSDebugLLog(@"NSPageLayout", @"textDidBeginEditing: %@", [notification description]);
}
-(void) textDidEndEditing:(NSNotification*) notification
{
NSLog(@"textDidEndEditing: %@", [notification description]);
NSDebugLLog(@"NSPageLayout", @"textDidEndEditing: %@", [notification description]);
}
-(void) textDidChange:(NSNotification*) notification
{
NSLog(@"textDidChange: %@", [notification description]);
NSDebugLLog(@"NSPageLayout", @"textDidChange: %@", [notification description]);
}
-(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
{
NSString *word = [_wordField stringValue];
BOOL result = NO;
// Call the server and remove the word from the learned
// list.
NS_DURING
{
result = [[self _serverProxy] _forgetWord: word
inDictionary: _language];
[[self _serverProxy] _forgetWord: word
inDictionary: _language];
}
NS_HANDLER
{

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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