Removed dead assignments found by static code analyser.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32551 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2011-03-13 15:26:20 +00:00
parent 0a2f6bd2df
commit b7d056ae43
15 changed files with 52 additions and 58 deletions

View file

@ -1,3 +1,23 @@
2011-03-13 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSWorkspace.m (-iconForFile:): Remove unused local variable.
* Source/GSGormLoading.m (gmodel_class): Remove useless assignment.
* Source/NSTextBlock.m
(-drawBackgroundWithFrame:...layoutManager:): Use the correct variables.
* Source/NSRulerMarker.m (-trackMouse:adding:): Remove unused variable.
* ColorPickers/GSNamedColorPicker.m (-setColor:): Add missing
implementation.
* ColorPickers/GSStandardColorPicker.m (-_showNewPicker:),
* Source/GSToolbarCustomizationPalette.m (-layout),
* Source/NSTableView.m (-sizeToFit),
* Source/NSApplication.m (-finishLaunching),
* Source/GSGormLoading.m (GSNibContainer-awakeWithContext:),
* Source/NSMenu.m (-sizeToFit),
* Source/NSSplitView.m (-mouseDown:),
* Source/NSBrowser.m (-setLastColumn:),
* Source/NSPrintOperation.m (-deliverResult):
Removed dead assignments found by static code analyser.
2011-03-12 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSMatrix.m (_shiftModifier:): Use correct column index

View file

@ -24,8 +24,8 @@
Boston, MA 02110-1301, USA.
*/
#include <Foundation/Foundation.h>
#include <AppKit/AppKit.h>
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
@interface GSNamedColorPicker: NSColorPicker <NSColorPickingCustom>
{
@ -106,12 +106,24 @@
NSColor *c = [color colorUsingColorSpaceName: NSNamedColorSpace];
NSString *list;
NSString *name;
unsigned int index;
if (c == nil)
return;
list = [c catalogNameComponent];
name = [c colorNameComponent];
// Select the correspondig entries in the lists
index = [self comboBox: cb
indexOfItemWithStringValue: list];
if (index == NSNotFound)
return;
[cb selectItemAtIndex: index];
index = [[currentList allKeys] indexOfObject: name];
if (index == NSNotFound)
return;
[browser selectRow: index inColumn: 0];
}
- (void) loadViews

View file

@ -26,15 +26,15 @@
Boston, MA 02110-1301, USA.
*/
#include <Foundation/Foundation.h>
#include <AppKit/AppKit.h>
#include <GNUstepGUI/GSVbox.h>
#include <GNUstepGUI/GSHbox.h>
#include "GSRGBColorPicker.h"
#include "GSHSBColorPicker.h"
#include "GSCMYKColorPicker.h"
#include "GSGrayColorPicker.h"
#include "GSStandardColorPicker.h"
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#import <GNUstepGUI/GSVbox.h>
#import <GNUstepGUI/GSHbox.h>
#import "GSRGBColorPicker.h"
#import "GSHSBColorPicker.h"
#import "GSCMYKColorPicker.h"
#import "GSGrayColorPicker.h"
#import "GSStandardColorPicker.h"
@implementation GSStandardColorPicker
@ -238,20 +238,10 @@
- (void) _showNewPicker: (id) sender
{
NSView *currentView;
//NSLog(@"Old View size %@", NSStringFromRect([currentView frame]));
currentPicker = [pickers objectAtIndex: [sender selectedColumn]];
[currentPicker setColor: [_colorPanel color]];
//NSLog(@"Base View size %@", NSStringFromRect([baseView frame]));
/* [baseView putView: [currentPicker provideNewView: NO]
atRow: 0
column: 0
withMargins: 0];*/
[pickerBox setContentView: [currentPicker provideNewView: NO]];
currentView = [currentPicker provideNewView: NO];
//NSLog(@"New View size %@", NSStringFromRect([currentView frame]));
// Show the new image
[imageCell setImage: [[sender selectedCell] image]];
}

View file

@ -59,7 +59,6 @@ Class gmodel_class(void)
path = [path stringByAppendingPathComponent: @"libgmodel.bundle"];
if ([[NSFileManager defaultManager] fileExistsAtPath: path])
break;
path = nil;
}
NSCAssert(path != nil, @"Unable to load gmodel bundle");
NSDebugLog(@"Loading gmodel from %@", path);

View file

@ -142,8 +142,6 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
// Add these objects with there old names as the code expects them
context = AUTORELEASE([context mutableCopyWithZone: [context zone]]);
obj = [context objectForKey: NSNibTopLevelObjects];
obj = [context objectForKey: NSNibOwner];
isAwake = YES;
/*

View file

@ -152,9 +152,7 @@
}
NS_HANDLER
{
BOOL result;
result = NSRunAlertPanel(_(@"Preview"),
NSRunAlertPanel(_(@"Preview"),
_(@"Problem running the preview application '%@' perhaps you need to set your NSPreviewApp user default"),
_(@"Dismiss"), nil, nil, preview);
}

View file

@ -100,7 +100,6 @@
float vAccumulator = 0.0;
NSEnumerator *e = [[self subviews] objectEnumerator];
NSView *layoutedView = nil;
int lastRow = 0;
int index = 0;
// Loop over all subviews
@ -132,12 +131,11 @@
maxHeight -= vAccumulator;
hAccumulator = 0.0;
vAccumulator = height;
lastRow = index;
}
[layoutedView setFrameOrigin: NSMakePoint(hAccumulator,
maxHeight - vAccumulator)];
[layoutedView setAutoresizingMask:NSViewMinYMargin];
[layoutedView setAutoresizingMask:NSViewMinYMargin];
hAccumulator += width;
index++;
}

View file

@ -1152,7 +1152,7 @@ static NSSize scaledIconSizeForSize(NSSize imageSize)
if ((files = [self _openFiles]) != nil)
{
NSEnumerator *en = [files objectEnumerator];
filePath = nil;
while ((filePath = (NSString *)[en nextObject]) != nil)
{
[_listener application: self openFile: filePath];

View file

@ -939,7 +939,7 @@ static NSTextFieldCell *titleCell;
*/
- (void) setLastColumn: (int)column
{
int i, count, num;
int i, count;
NSBrowserColumn *bc;
NSScrollView *sc;
@ -958,7 +958,6 @@ static NSTextFieldCell *titleCell;
// Unloads columns.
count = [_browserColumns count];
num = [self numberOfVisibleColumns];
for (i = column + 1; i < count; ++i)
{

View file

@ -1483,14 +1483,12 @@ static BOOL menuBarVisible = YES;
NSRect oldWindowFrame;
NSRect newWindowFrame;
NSRect menuFrame;
NSSize size;
[_view sizeToFit];
menuFrame = [_view frame];
size = menuFrame.size;
// Main
// Main
oldWindowFrame = [_aWindow frame];
newWindowFrame = [NSWindow frameRectForContentRect: menuFrame
styleMask: [_aWindow styleMask]];

View file

@ -35,10 +35,6 @@
#import "AppKit/NSWindow.h"
#import "AppKit/NSCursor.h"
@interface NSRulerView (GNUstepInternal)
- (NSRect)_markersRect;
@end
@implementation NSRulerMarker
- (id)initWithRulerView:(NSRulerView *)aRulerView
@ -238,7 +234,6 @@
NSPoint mousePositionInWindow;
NSPoint previousMousePositionInWindow;
NSPoint mouseOffset;
NSRect markersRect;
float location;
NSRect drawRect;
NSRect bounds = [_rulerView bounds];
@ -270,7 +265,6 @@
[_rulerView lockFocus];
/* cache some values */
markersRect = [_rulerView _markersRect];
flipped = [_rulerView isFlipped];
window = [_rulerView window];

View file

@ -721,7 +721,6 @@ static NSNotificationCenter *nc = nil;
{
[_dividerColor set];
NSHighlightRect(oldRect);
lit = NO;
}
[self unlockFocus];
}

View file

@ -4522,7 +4522,6 @@ This method is deprecated, use -columnIndexesInRect:. */
NSTableColumn *tb;
int i, j;
float remainingWidth;
float availableWidth;
columnSorting *columnInfo;
float *currentWidth;
float *maxWidth;
@ -4531,10 +4530,8 @@ This method is deprecated, use -columnIndexesInRect:. */
int numberOfCurrentColumns = 0;
float previousPoint;
float nextPoint;
float difference;
float toAddToCurrentColumns;
if ((_super_view == nil) || (_numberOfColumns == 0))
return;
@ -4550,9 +4547,8 @@ This method is deprecated, use -columnIndexesInRect:. */
isResizable = NSZoneMalloc(NSDefaultMallocZone(),
sizeof(BOOL) * _numberOfColumns);
availableWidth = NSMaxX([self convertRect: [_super_view bounds]
remainingWidth = NSMaxX([self convertRect: [_super_view bounds]
fromView: _super_view]);
remainingWidth = availableWidth;
/*
* We store the minWidth and the maxWidth of every column
@ -4718,10 +4714,6 @@ This method is deprecated, use -columnIndexesInRect:. */
}
}
difference = availableWidth - remainingWidth;
_tilingDisabled = NO;
NSZoneFree(NSDefaultMallocZone(), columnInfo);
NSZoneFree(NSDefaultMallocZone(), currentWidth);

View file

@ -327,9 +327,9 @@
[_borderColorForEdge[NSMaxYEdge] set];
NSRectFill(NSMakeRect(rect.origin.x, rect.origin.y + rect.size.height + maxy, rect.size.width, maxy));
[_borderColorForEdge[NSMaxXEdge] set];
NSRectFill(NSMakeRect(rect.origin.x + rect.size.width, rect.origin.y, minx, rect.size.height));
NSRectFill(NSMakeRect(rect.origin.x + rect.size.width, rect.origin.y, maxx, rect.size.height));
[_borderColorForEdge[NSMinYEdge] set];
NSRectFill(NSMakeRect(rect.origin.x, rect.origin.y - maxy, rect.size.width, maxy));
NSRectFill(NSMakeRect(rect.origin.x, rect.origin.y - maxy, rect.size.width, miny));
// FIXME: how do we handle the corners of differenly sized and colored borders?
// Do we have to fill trapezoids?
}

View file

@ -1247,15 +1247,12 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
fileType = [attributes objectForKey: NSFileType];
if ([fileType isEqual: NSFileTypeDirectory] == YES)
{
NSString *iconPath = nil;
BOOL isApplication = NO;
NSString *iconPath = nil;
if ([pathExtension isEqualToString: @"app"]
|| [pathExtension isEqualToString: @"debug"]
|| [pathExtension isEqualToString: @"profile"])
{
isApplication = YES;
image = [self appIconForApp: fullPath];
if (image == nil)