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

View file

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