git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27194 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2008-12-02 23:06:49 +00:00
parent 71dba184a5
commit 097a99aa01
2 changed files with 62 additions and 56 deletions

View file

@ -16,6 +16,9 @@
* Tools/gsnd/GNUmakefile: * Tools/gsnd/GNUmakefile:
* Images/GNUmakefile: * Images/GNUmakefile:
Fix bug #24672 Fix bug #24672
* Tools/make_services.m:
Fix bug #24990 ... was reporting debug output which should only have
appeared when running in verbose mode.
2008-12-02 02:31-EST Gregory John Casamento <greg_casamento@yahoo.com> 2008-12-02 02:31-EST Gregory John Casamento <greg_casamento@yahoo.com>

View file

@ -13,16 +13,16 @@
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3 as published by the Free Software Foundation; either version 3
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU General Public
License along with this library; see the file COPYING. License along with this library; see the file COPYING.
If not, see <http://www.gnu.org/licenses/> or write to the If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor, Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. Boston, MA 02110-1301, USA.
*/ */
@ -177,12 +177,12 @@ main(int argc, char** argv, char **env_c)
{ {
validateEntry(svcs, file); validateEntry(svcs, file);
} }
else if (verbose >= 0) else if (verbose > 0)
{ {
NSLog(@"bad info - %@", file); NSLog(@"bad info - %@", file);
} }
} }
else if (verbose >= 0) else if (verbose > 0)
{ {
NSLog(@"bad info - %@", file); NSLog(@"bad info - %@", file);
} }
@ -201,7 +201,7 @@ main(int argc, char** argv, char **env_c)
usrRoot = [usrRoot stringByAppendingPathComponent: @"Services"]; usrRoot = [usrRoot stringByAppendingPathComponent: @"Services"];
if (CheckDirectory(usrRoot) == NO) if (CheckDirectory(usrRoot) == NO)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"couldn't create %@", usrRoot); NSLog(@"couldn't create %@", usrRoot);
[pool release]; [pool release];
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -258,7 +258,7 @@ main(int argc, char** argv, char **env_c)
data = [NSSerializer serializePropertyList: fullMap]; data = [NSSerializer serializePropertyList: fullMap];
if ([data writeToFile: str atomically: YES] == NO) if ([data writeToFile: str atomically: YES] == NO)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"couldn't write %@", str); NSLog(@"couldn't write %@", str);
[pool release]; [pool release];
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -282,7 +282,7 @@ main(int argc, char** argv, char **env_c)
data = [NSSerializer serializePropertyList: applicationMap]; data = [NSSerializer serializePropertyList: applicationMap];
if ([data writeToFile: str atomically: YES] == NO) if ([data writeToFile: str atomically: YES] == NO)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"couldn't write %@", str); NSLog(@"couldn't write %@", str);
[pool release]; [pool release];
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -317,7 +317,7 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app)
{ {
if ([o0 isKindOfClass: aClass] == NO) if ([o0 isKindOfClass: aClass] == NO)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"bad app NSTypes (not an array) - %@", app); NSLog(@"bad app NSTypes (not an array) - %@", app);
return; return;
} }
@ -332,7 +332,7 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app)
if ([o1 isKindOfClass: dClass] == NO) if ([o1 isKindOfClass: dClass] == NO)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"bad app NSTypes (type not a dictionary) - %@", app); NSLog(@"bad app NSTypes (type not a dictionary) - %@", app);
return; return;
} }
@ -341,7 +341,7 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app)
*/ */
t = (NSDictionary*)o1; t = (NSDictionary*)o1;
o1 = [t objectForKey: @"NSUnixExtensions"]; o1 = [t objectForKey: @"NSUnixExtensions"];
if(o1 == nil) if(o1 == nil)
{ {
o1 = [t objectForKey: @"CFBundleTypeExtensions"]; o1 = [t objectForKey: @"CFBundleTypeExtensions"];
@ -352,7 +352,7 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app)
} }
if ([o1 isKindOfClass: aClass] == NO) if ([o1 isKindOfClass: aClass] == NO)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"bad app NSType (extensions not an array) - %@", app); NSLog(@"bad app NSType (extensions not an array) - %@", app);
return; return;
} }
@ -366,7 +366,7 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app)
e = [[a1 objectAtIndex: j] lowercaseString]; e = [[a1 objectAtIndex: j] lowercaseString];
if ([e length] == 0) if ([e length] == 0)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"Illegal (nul) extension ignored for - %@", app); NSLog(@"Illegal (nul) extension ignored for - %@", app);
return; return;
} }
@ -398,7 +398,7 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app)
} }
if ([o0 isKindOfClass: dClass] == NO) if ([o0 isKindOfClass: dClass] == NO)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"bad app NSExtensions (not a dictionary) - %@", app); NSLog(@"bad app NSExtensions (not a dictionary) - %@", app);
return; return;
} }
@ -413,7 +413,7 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app)
if ([tmp isKindOfClass: dClass] == NO) if ([tmp isKindOfClass: dClass] == NO)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"bad app NSExtensions (value isn't a dictionary) - %@", NSLog(@"bad app NSExtensions (value isn't a dictionary) - %@",
app); app);
continue; continue;
@ -430,6 +430,7 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app)
} }
} }
#if 0 // UNUSED
static void static void
scanDirectory(NSMutableDictionary *services, NSString *path) scanDirectory(NSMutableDictionary *services, NSString *path)
{ {
@ -472,7 +473,7 @@ scanDirectory(NSMutableDictionary *services, NSString *path)
* this name, we skip this one - the first one takes * this name, we skip this one - the first one takes
* precedence. * precedence.
*/ */
if (verbose >= 0) if (verbose > 0)
NSLog(@"duplicate app (%@) at '%@' and '%@'", NSLog(@"duplicate app (%@) at '%@' and '%@'",
name, oldPath, newPath); name, oldPath, newPath);
continue; continue;
@ -501,12 +502,12 @@ scanDirectory(NSMutableDictionary *services, NSString *path)
addExtensionsForApplication(info, name); addExtensionsForApplication(info, name);
} }
else if (verbose >= 0) else if (verbose > 0)
{ {
NSLog(@"bad app info - %@", newPath); NSLog(@"bad app info - %@", newPath);
} }
} }
else if (verbose >= 0) else if (verbose > 0)
{ {
NSLog(@"bad application - %@", newPath); NSLog(@"bad application - %@", newPath);
} }
@ -536,17 +537,17 @@ scanDirectory(NSMutableDictionary *services, NSString *path)
[services setObject: entry forKey: newPath]; [services setObject: entry forKey: newPath];
} }
} }
else if (verbose >= 0) else if (verbose > 0)
{ {
NSLog(@"missing info - %@", newPath); NSLog(@"missing info - %@", newPath);
} }
} }
else if (verbose >= 0) else if (verbose > 0)
{ {
NSLog(@"bad service info - %@", newPath); NSLog(@"bad service info - %@", newPath);
} }
} }
else if (verbose >= 0) else if (verbose > 0)
{ {
NSLog(@"bad services bundle - %@", newPath); NSLog(@"bad services bundle - %@", newPath);
} }
@ -563,6 +564,7 @@ scanDirectory(NSMutableDictionary *services, NSString *path)
} }
[arp release]; [arp release];
} }
#endif
static void static void
scanApplications(NSMutableDictionary *services, NSString *path) scanApplications(NSMutableDictionary *services, NSString *path)
@ -606,7 +608,7 @@ scanApplications(NSMutableDictionary *services, NSString *path)
* this name, we skip this one - the first one takes * this name, we skip this one - the first one takes
* precedence. * precedence.
*/ */
if (verbose >= 0) if (verbose > 0)
NSLog(@"duplicate app (%@) at '%@' and '%@'", NSLog(@"duplicate app (%@) at '%@' and '%@'",
name, oldPath, newPath); name, oldPath, newPath);
continue; continue;
@ -635,12 +637,12 @@ scanApplications(NSMutableDictionary *services, NSString *path)
addExtensionsForApplication(info, name); addExtensionsForApplication(info, name);
} }
else if (verbose >= 0) else if (verbose > 0)
{ {
NSLog(@"bad app info - %@", newPath); NSLog(@"bad app info - %@", newPath);
} }
} }
else if (verbose >= 0) else if (verbose > 0)
{ {
NSLog(@"bad application - %@", newPath); NSLog(@"bad application - %@", newPath);
} }
@ -702,7 +704,7 @@ scanDynamic(NSMutableDictionary *services, NSString *path)
} }
} }
} }
else if (verbose >= 0) else if (verbose > 0)
{ {
NSLog(@"bad app info - %@", infPath); NSLog(@"bad app info - %@", infPath);
} }
@ -750,17 +752,17 @@ scanServices(NSMutableDictionary *services, NSString *path)
[services setObject: entry forKey: newPath]; [services setObject: entry forKey: newPath];
} }
} }
else if (verbose >= 0) else if (verbose > 0)
{ {
NSLog(@"missing info - %@", newPath); NSLog(@"missing info - %@", newPath);
} }
} }
else if (verbose >= 0) else if (verbose > 0)
{ {
NSLog(@"bad service info - %@", newPath); NSLog(@"bad service info - %@", newPath);
} }
} }
else if (verbose >= 0) else if (verbose > 0)
{ {
NSLog(@"bad services bundle - %@", newPath); NSLog(@"bad services bundle - %@", newPath);
} }
@ -787,7 +789,7 @@ validateEntry(id svcs, NSString *path)
if ([svcs isKindOfClass: aClass] == NO) if ([svcs isKindOfClass: aClass] == NO)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry not an array - %@", path); NSLog(@"NSServices entry not an array - %@", path);
return nil; return nil;
} }
@ -810,7 +812,7 @@ validateEntry(id svcs, NSString *path)
[newServices addObject: newService]; [newServices addObject: newService];
} }
} }
else if (verbose >= 0) else if (verbose > 0)
{ {
NSLog(@"NSServices entry %u not a dictionary - %@", NSLog(@"NSServices entry %u not a dictionary - %@",
pos, path); pos, path);
@ -847,7 +849,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
@"string", @"NSDeviceDependent", @"string", @"NSDeviceDependent",
@"array", @"NSLanguages", @"array", @"NSLanguages",
@"string", @"NSSpellChecker", @"string", @"NSSpellChecker",
nil]; nil];
[fields retain]; [fields retain];
} }
@ -864,7 +866,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
if (type == nil) if (type == nil)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u spurious field (%@)- %@", pos, k, path); NSLog(@"NSServices entry %u spurious field (%@)- %@", pos, k, path);
} }
else else
@ -874,7 +876,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
{ {
if ([obj isKindOfClass: sClass] == NO) if ([obj isKindOfClass: sClass] == NO)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u field %@ is not a string " NSLog(@"NSServices entry %u field %@ is not a string "
@"- %@", pos, k, path); @"- %@", pos, k, path);
return nil; return nil;
@ -887,7 +889,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
if ([obj isKindOfClass: aClass] == NO) if ([obj isKindOfClass: aClass] == NO)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u field %@ is not an array " NSLog(@"NSServices entry %u field %@ is not an array "
@"- %@", pos, k, path); @"- %@", pos, k, path);
return nil; return nil;
@ -895,7 +897,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
a = (NSArray*)obj; a = (NSArray*)obj;
if ([a count] == 0) if ([a count] == 0)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u field %@ is an empty array " NSLog(@"NSServices entry %u field %@ is an empty array "
@"- %@", pos, k, path); @"- %@", pos, k, path);
} }
@ -907,7 +909,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
{ {
if ([[a objectAtIndex: i] isKindOfClass: sClass] == NO) if ([[a objectAtIndex: i] isKindOfClass: sClass] == NO)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u field %@ element %u is " NSLog(@"NSServices entry %u field %@ element %u is "
@"not a string - %@", pos, k, i, path); @"not a string - %@", pos, k, i, path);
return nil; return nil;
@ -922,7 +924,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
if ([obj isKindOfClass: dClass] == NO) if ([obj isKindOfClass: dClass] == NO)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u field %@ is not a dictionary " NSLog(@"NSServices entry %u field %@ is not a dictionary "
@"- %@", pos, k, path); @"- %@", pos, k, path);
return nil; return nil;
@ -930,7 +932,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
d = (NSDictionary*)obj; d = (NSDictionary*)obj;
if ([d objectForKey: @"default"] == nil) if ([d objectForKey: @"default"] == nil)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u field %@ has no default value " NSLog(@"NSServices entry %u field %@ has no default value "
@"- %@", pos, k, path); @"- %@", pos, k, path);
} }
@ -942,7 +944,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
{ {
if ([obj isKindOfClass: sClass] == NO) if ([obj isKindOfClass: sClass] == NO)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u field %@ contains " NSLog(@"NSServices entry %u field %@ contains "
@"non-string value - %@", pos, k, path); @"non-string value - %@", pos, k, path);
return nil; return nil;
@ -976,14 +978,14 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
&& [str isEqualToString: @"NSMapFile"] == NO && [str isEqualToString: @"NSMapFile"] == NO
&& [str isEqualToString: @"NSIdentity"] == NO) && [str isEqualToString: @"NSIdentity"] == NO)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u bad input mechanism - %@", pos, path); NSLog(@"NSServices entry %u bad input mechanism - %@", pos, path);
return nil; return nil;
} }
} }
else if ([result objectForKey: @"NSPortName"] == nil) else if ([result objectForKey: @"NSPortName"] == nil)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u NSPortName missing - %@", pos, path); NSLog(@"NSServices entry %u NSPortName missing - %@", pos, path);
return nil; return nil;
} }
@ -992,8 +994,9 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
ret = [result objectForKey: @"NSReturnTypes"]; ret = [result objectForKey: @"NSReturnTypes"];
if ([snd count] == 0 || [ret count] == 0) if ([snd count] == 0 || [ret count] == 0)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u types empty or missing - %@", pos, path); NSLog(@"NSServices entry %u types empty or missing - %@",
pos, path);
return nil; return nil;
} }
else else
@ -1023,7 +1026,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
} }
if (notPresent == NO) if (notPresent == NO)
{ {
if (verbose) if (verbose > 0)
{ {
NSLog(@"Ignoring duplicate %u in %@ -\n%@", pos, path, result); NSLog(@"Ignoring duplicate %u in %@ -\n%@", pos, path, result);
} }
@ -1039,20 +1042,20 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
if ([result objectForKey: @"NSPortName"] == nil) if ([result objectForKey: @"NSPortName"] == nil)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u NSPortName missing - %@", pos, path); NSLog(@"NSServices entry %u NSPortName missing - %@", pos, path);
return nil; return nil;
} }
if ([result objectForKey: @"NSSendTypes"] == nil if ([result objectForKey: @"NSSendTypes"] == nil
&& [result objectForKey: @"NSReturnTypes"] == nil) && [result objectForKey: @"NSReturnTypes"] == nil)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u types missing - %@", pos, path); NSLog(@"NSServices entry %u types missing - %@", pos, path);
return nil; return nil;
} }
if ((item = [result objectForKey: @"NSMenuItem"]) == nil) if ((item = [result objectForKey: @"NSMenuItem"]) == nil)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u NSMenuItem missing - %@", pos, path); NSLog(@"NSServices entry %u NSMenuItem missing - %@", pos, path);
return nil; return nil;
} }
@ -1081,7 +1084,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
} }
if (used == NO) if (used == NO)
{ {
if (verbose) if (verbose > 0)
{ {
NSLog(@"Ignoring entry %u in %@ -\n%@", pos, path, result); NSLog(@"Ignoring entry %u in %@ -\n%@", pos, path, result);
} }
@ -1097,7 +1100,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
if ((item = [result objectForKey: @"NSMenuItem"]) == nil) if ((item = [result objectForKey: @"NSMenuItem"]) == nil)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u NSMenuItem missing - %@", pos, path); NSLog(@"NSServices entry %u NSMenuItem missing - %@", pos, path);
return nil; return nil;
} }
@ -1125,7 +1128,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
} }
if (used == NO) if (used == NO)
{ {
if (verbose) if (verbose > 0)
{ {
NSLog(@"Ignoring entry %u in %@ -\n%@", pos, path, result); NSLog(@"Ignoring entry %u in %@ -\n%@", pos, path, result);
} }
@ -1140,8 +1143,8 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
if ((item = [result objectForKey: @"NSLanguages"]) == nil) if ((item = [result objectForKey: @"NSLanguages"]) == nil)
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u NSLanguages missing - %@", pos, path); NSLog(@"NSServices entry NSLanguages missing - %@", path);
return nil; return nil;
} }
/* /*
@ -1161,7 +1164,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
} }
if (used == NO) if (used == NO)
{ {
if (verbose) if (verbose > 0)
{ {
NSLog(@"Ignoring entry %u in %@ -\n%@", pos, path, result); NSLog(@"Ignoring entry %u in %@ -\n%@", pos, path, result);
} }
@ -1170,11 +1173,11 @@ validateService(NSDictionary *service, NSString *path, unsigned pos)
} }
else else
{ {
if (verbose >= 0) if (verbose > 0)
NSLog(@"NSServices entry %u unknown service/filter - %@", pos, path); NSLog(@"NSServices entry %u unknown service/filter - %@", pos, path);
return nil; return nil;
} }
return result; return result;
} }