Fix possible uninitialised variable

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23497 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-09-14 05:00:15 +00:00
parent 5eef626c6b
commit 10de682166
2 changed files with 63 additions and 58 deletions

View file

@ -190,8 +190,8 @@ static NSNotificationCenter *nc = nil;
[self setFrame: frame display: YES]; [self setFrame: frame display: YES];
[self orderOut: self]; [self orderOut: self];
if(_pendingParentWindow != nil && if (_pendingParentWindow != nil
_pendingParentWindow != _parentWindow) && _pendingParentWindow != _parentWindow)
{ {
[self setParentWindow: _pendingParentWindow]; [self setParentWindow: _pendingParentWindow];
ASSIGN(_pendingParentWindow, nil); ASSIGN(_pendingParentWindow, nil);
@ -280,7 +280,7 @@ static NSNotificationCenter *nc = nil;
if (_parentWindow != nil) if (_parentWindow != nil)
{ {
NSRect frame = [self frameFromParentWindowFrame]; // : [_parentWindow frame]]; NSRect frame = [self frameFromParentWindowFrame];
[self setFrame: frame display: YES]; [self setFrame: frame display: YES];
// add observers.... // add observers....
@ -401,10 +401,9 @@ static NSNotificationCenter *nc = nil;
if (_state != NSDrawerOpenState) if (_state != NSDrawerOpenState)
return; return;
if ((_delegate != nil) && if ((_delegate != nil)
([_delegate respondsToSelector: && ([_delegate respondsToSelector: @selector(drawerShouldClose:)])
@selector(drawerShouldClose:)]) && && ![_delegate drawerShouldClose: self])
![_delegate drawerShouldClose: self])
return; return;
_state = NSDrawerClosingState; _state = NSDrawerClosingState;
@ -433,14 +432,13 @@ static NSNotificationCenter *nc = nil;
- (void) openOnEdge: (NSRectEdge)edge - (void) openOnEdge: (NSRectEdge)edge
{ {
if ((_state != NSDrawerClosedState) || if ((_state != NSDrawerClosedState)
([self parentWindow] == nil)) || ([self parentWindow] == nil))
return; return;
if ((_delegate != nil) && if ((_delegate != nil)
([_delegate respondsToSelector: && ([_delegate respondsToSelector: @selector(drawerShouldOpen:)])
@selector(drawerShouldOpen:)]) && && ![_delegate drawerShouldOpen: self])
![_delegate drawerShouldOpen: self])
return; return;
_state = NSDrawerOpeningState; _state = NSDrawerOpeningState;
@ -496,8 +494,8 @@ static NSNotificationCenter *nc = nil;
size.height = _maxContentSize.height; size.height = _maxContentSize.height;
// Check with delegate // Check with delegate
if ((_delegate != nil) && if ((_delegate != nil)
([_delegate respondsToSelector: && ([_delegate respondsToSelector:
@selector(drawerWillResizeContents:toSize:)])) @selector(drawerWillResizeContents:toSize:)]))
{ {
size = [_delegate drawerWillResizeContents: self size = [_delegate drawerWillResizeContents: self
@ -655,7 +653,7 @@ static NSNotificationCenter *nc = nil;
{ {
if ((self = [super initWithCoder: aDecoder]) != nil) if ((self = [super initWithCoder: aDecoder]) != nil)
{ {
NSWindow *parentWindow; NSWindow *parentWindow = nil;
if ([aDecoder allowsKeyedCoding]) if ([aDecoder allowsKeyedCoding])
{ {
@ -685,12 +683,15 @@ static NSNotificationCenter *nc = nil;
{ {
_contentSize = [aDecoder decodeSize]; _contentSize = [aDecoder decodeSize];
ASSIGN(_delegate, [aDecoder decodeObject]); ASSIGN(_delegate, [aDecoder decodeObject]);
[aDecoder decodeValueOfObjCType: @encode(float) at: &_leadingOffset]; [aDecoder decodeValueOfObjCType: @encode(float)
at: &_leadingOffset];
_maxContentSize = [aDecoder decodeSize]; _maxContentSize = [aDecoder decodeSize];
_minContentSize = [aDecoder decodeSize]; _minContentSize = [aDecoder decodeSize];
parentWindow = [aDecoder decodeObject]; parentWindow = [aDecoder decodeObject];
[aDecoder decodeValueOfObjCType: @encode(unsigned) at: &_preferredEdge]; [aDecoder decodeValueOfObjCType: @encode(unsigned)
[aDecoder decodeValueOfObjCType: @encode(float) at: &_trailingOffset]; at: &_preferredEdge];
[aDecoder decodeValueOfObjCType: @encode(float)
at: &_trailingOffset];
} }
else else
{ {

View file

@ -167,19 +167,22 @@
if (help) if (help)
{ {
NSString *file; NSString *file = nil;
if ([[help pathExtension] length] == 0) if ([[help pathExtension] length] == 0)
{ {
file = [mb pathForHelpResource: [help stringByAppendingPathExtension: @"rtfd"]]; file = [mb pathForHelpResource:
[help stringByAppendingPathExtension: @"rtfd"]];
if (file == nil) if (file == nil)
{ {
file = [mb pathForHelpResource: [help stringByAppendingPathExtension: @"rtf"]]; file = [mb pathForHelpResource:
[help stringByAppendingPathExtension: @"rtf"]];
} }
} }
if (file) { if (file)
{
[[NSWorkspace sharedWorkspace] openFile: file]; [[NSWorkspace sharedWorkspace] openFile: file];
return; return;
} }
@ -304,10 +307,11 @@ static BOOL _gnu_contextHelpActive = NO;
if (contextHelp) if (contextHelp)
{ {
GSHelpManagerPanel *helpPanel = [GSHelpManagerPanel sharedHelpManagerPanel]; GSHelpManagerPanel *helpPanel;
// FIXME: We should position the window at point! // FIXME: We should position the window at point!
// runModalForWindow will centre the window. // runModalForWindow will centre the window.
helpPanel = [GSHelpManagerPanel sharedHelpManagerPanel];
[helpPanel setHelpText: contextHelp]; [helpPanel setHelpText: contextHelp];
[NSApp runModalForWindow: helpPanel]; [NSApp runModalForWindow: helpPanel];
return YES; return YES;