mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 19:01:15 +00:00
Fix issues pointed out by fred
This commit is contained in:
parent
d3c1fd9724
commit
4ebc932cb3
4 changed files with 14 additions and 14 deletions
|
@ -31,7 +31,7 @@
|
|||
#import <Foundation/NSError.h>
|
||||
#import <Foundation/NSConnection.h>
|
||||
#import <Foundation/NSDistributedNotificationCenter.h>
|
||||
|
||||
#import "GSFastEnumeration.h"
|
||||
#import "AppKit/NSWorkspace.h"
|
||||
|
||||
id _speechRecognitionServer = nil;
|
||||
|
@ -67,11 +67,9 @@ BOOL _serverLaunchTested = NO;
|
|||
- (void) processNotification: (NSNotification *)note
|
||||
{
|
||||
NSString *word = (NSString *)[note object];
|
||||
NSEnumerator *en = [_commands objectEnumerator];
|
||||
id obj = nil;
|
||||
|
||||
word = [word lowercaseString];
|
||||
while ((obj = [en nextObject]) != nil)
|
||||
FOR_IN(NSString*, obj, _commands)
|
||||
{
|
||||
if ([[obj lowercaseString] isEqualToString: word])
|
||||
{
|
||||
|
@ -79,6 +77,7 @@ BOOL _serverLaunchTested = NO;
|
|||
didRecognizeCommand: word];
|
||||
}
|
||||
}
|
||||
END_FOR_IN(_commands);
|
||||
}
|
||||
|
||||
// Initialize
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
/**
|
||||
* GSSpeechRecognitionEngine is an abstract speech server. One concrete subclass should
|
||||
* be implemented for each speech engine. Currently, only one may be compiled
|
||||
* in to the speech server at any given time. This limitation may be removed
|
||||
* be implemented for each speech recognition engine. Currently, only one may be compiled
|
||||
* into the speech recognition server at any given time. This limitation may be removed
|
||||
* in future if pluggable speech engines are considered beneficial.
|
||||
*/
|
||||
@interface GSSpeechRecognitionEngine : NSObject
|
||||
|
|
|
@ -30,8 +30,13 @@ static GSSpeechRecognitionServer *sharedInstance;
|
|||
|
||||
- (id)init
|
||||
{
|
||||
if (nil == (self = [super init])) { return nil; }
|
||||
if (nil == (self = [super init]))
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
_engine = [GSSpeechRecognitionEngine defaultSpeechRecognitionEngine];
|
||||
|
||||
if (nil == _engine)
|
||||
{
|
||||
[self release];
|
||||
|
@ -41,6 +46,7 @@ static GSSpeechRecognitionServer *sharedInstance;
|
|||
{
|
||||
NSLog(@"Got engine %@", _engine);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,13 +11,7 @@ static int clients;
|
|||
+ (void)initialize
|
||||
{
|
||||
server = [GSSpeechRecognitionServer sharedServer];
|
||||
|
||||
RETAIN(server);
|
||||
if (server != nil)
|
||||
{
|
||||
clients++;
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(connectionDied:)
|
||||
|
@ -33,6 +27,7 @@ static int clients;
|
|||
{
|
||||
NSEnumerator *e = [[[aNotification object] localObjects] objectEnumerator];
|
||||
NSObject *o = nil;
|
||||
|
||||
for (o = [e nextObject] ; nil != o ; o = [e nextObject])
|
||||
{
|
||||
if ([o isKindOfClass: self])
|
||||
|
@ -59,8 +54,8 @@ static int clients;
|
|||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
clients++;
|
||||
NSLog(@"self = %@",self);
|
||||
RETAIN(server);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue