From 097a99aa01cbc317d94e38a0e1655466e1a72c1a Mon Sep 17 00:00:00 2001 From: rfm Date: Tue, 2 Dec 2008 23:06:49 +0000 Subject: [PATCH] Fix bug #24990 git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27194 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 3 ++ Tools/make_services.m | 115 ++++++++++++++++++++++-------------------- 2 files changed, 62 insertions(+), 56 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4d3a84c2d..e5852c10d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,9 @@ * Tools/gsnd/GNUmakefile: * Images/GNUmakefile: 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 diff --git a/Tools/make_services.m b/Tools/make_services.m index e5f420fee..8ff4e9e81 100644 --- a/Tools/make_services.m +++ b/Tools/make_services.m @@ -13,16 +13,16 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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. - If not, see or write to the - Free Software Foundation, 51 Franklin Street, Fifth Floor, + If not, see or write to the + Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @@ -177,12 +177,12 @@ main(int argc, char** argv, char **env_c) { validateEntry(svcs, file); } - else if (verbose >= 0) + else if (verbose > 0) { NSLog(@"bad info - %@", file); } } - else if (verbose >= 0) + else if (verbose > 0) { NSLog(@"bad info - %@", file); } @@ -201,7 +201,7 @@ main(int argc, char** argv, char **env_c) usrRoot = [usrRoot stringByAppendingPathComponent: @"Services"]; if (CheckDirectory(usrRoot) == NO) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"couldn't create %@", usrRoot); [pool release]; exit(EXIT_FAILURE); @@ -258,7 +258,7 @@ main(int argc, char** argv, char **env_c) data = [NSSerializer serializePropertyList: fullMap]; if ([data writeToFile: str atomically: YES] == NO) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"couldn't write %@", str); [pool release]; exit(EXIT_FAILURE); @@ -282,7 +282,7 @@ main(int argc, char** argv, char **env_c) data = [NSSerializer serializePropertyList: applicationMap]; if ([data writeToFile: str atomically: YES] == NO) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"couldn't write %@", str); [pool release]; exit(EXIT_FAILURE); @@ -317,7 +317,7 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app) { if ([o0 isKindOfClass: aClass] == NO) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"bad app NSTypes (not an array) - %@", app); return; } @@ -332,7 +332,7 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app) if ([o1 isKindOfClass: dClass] == NO) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"bad app NSTypes (type not a dictionary) - %@", app); return; } @@ -341,7 +341,7 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app) */ t = (NSDictionary*)o1; o1 = [t objectForKey: @"NSUnixExtensions"]; - + if(o1 == nil) { o1 = [t objectForKey: @"CFBundleTypeExtensions"]; @@ -352,7 +352,7 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app) } if ([o1 isKindOfClass: aClass] == NO) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"bad app NSType (extensions not an array) - %@", app); return; } @@ -366,7 +366,7 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app) e = [[a1 objectAtIndex: j] lowercaseString]; if ([e length] == 0) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"Illegal (nul) extension ignored for - %@", app); return; } @@ -398,7 +398,7 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app) } if ([o0 isKindOfClass: dClass] == NO) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"bad app NSExtensions (not a dictionary) - %@", app); return; } @@ -413,7 +413,7 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app) if ([tmp isKindOfClass: dClass] == NO) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"bad app NSExtensions (value isn't a dictionary) - %@", app); continue; @@ -430,6 +430,7 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app) } } +#if 0 // UNUSED static void scanDirectory(NSMutableDictionary *services, NSString *path) { @@ -472,7 +473,7 @@ scanDirectory(NSMutableDictionary *services, NSString *path) * this name, we skip this one - the first one takes * precedence. */ - if (verbose >= 0) + if (verbose > 0) NSLog(@"duplicate app (%@) at '%@' and '%@'", name, oldPath, newPath); continue; @@ -501,12 +502,12 @@ scanDirectory(NSMutableDictionary *services, NSString *path) addExtensionsForApplication(info, name); } - else if (verbose >= 0) + else if (verbose > 0) { NSLog(@"bad app info - %@", newPath); } } - else if (verbose >= 0) + else if (verbose > 0) { NSLog(@"bad application - %@", newPath); } @@ -536,17 +537,17 @@ scanDirectory(NSMutableDictionary *services, NSString *path) [services setObject: entry forKey: newPath]; } } - else if (verbose >= 0) + else if (verbose > 0) { NSLog(@"missing info - %@", newPath); } } - else if (verbose >= 0) + else if (verbose > 0) { NSLog(@"bad service info - %@", newPath); } } - else if (verbose >= 0) + else if (verbose > 0) { NSLog(@"bad services bundle - %@", newPath); } @@ -563,6 +564,7 @@ scanDirectory(NSMutableDictionary *services, NSString *path) } [arp release]; } +#endif static void scanApplications(NSMutableDictionary *services, NSString *path) @@ -606,7 +608,7 @@ scanApplications(NSMutableDictionary *services, NSString *path) * this name, we skip this one - the first one takes * precedence. */ - if (verbose >= 0) + if (verbose > 0) NSLog(@"duplicate app (%@) at '%@' and '%@'", name, oldPath, newPath); continue; @@ -635,12 +637,12 @@ scanApplications(NSMutableDictionary *services, NSString *path) addExtensionsForApplication(info, name); } - else if (verbose >= 0) + else if (verbose > 0) { NSLog(@"bad app info - %@", newPath); } } - else if (verbose >= 0) + else if (verbose > 0) { 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); } @@ -750,17 +752,17 @@ scanServices(NSMutableDictionary *services, NSString *path) [services setObject: entry forKey: newPath]; } } - else if (verbose >= 0) + else if (verbose > 0) { NSLog(@"missing info - %@", newPath); } } - else if (verbose >= 0) + else if (verbose > 0) { NSLog(@"bad service info - %@", newPath); } } - else if (verbose >= 0) + else if (verbose > 0) { NSLog(@"bad services bundle - %@", newPath); } @@ -787,7 +789,7 @@ validateEntry(id svcs, NSString *path) if ([svcs isKindOfClass: aClass] == NO) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"NSServices entry not an array - %@", path); return nil; } @@ -810,7 +812,7 @@ validateEntry(id svcs, NSString *path) [newServices addObject: newService]; } } - else if (verbose >= 0) + else if (verbose > 0) { NSLog(@"NSServices entry %u not a dictionary - %@", pos, path); @@ -847,7 +849,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos) @"string", @"NSDeviceDependent", @"array", @"NSLanguages", @"string", @"NSSpellChecker", - nil]; + nil]; [fields retain]; } @@ -864,7 +866,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos) if (type == nil) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"NSServices entry %u spurious field (%@)- %@", pos, k, path); } else @@ -874,7 +876,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos) { if ([obj isKindOfClass: sClass] == NO) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"NSServices entry %u field %@ is not a string " @"- %@", pos, k, path); return nil; @@ -887,7 +889,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos) if ([obj isKindOfClass: aClass] == NO) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"NSServices entry %u field %@ is not an array " @"- %@", pos, k, path); return nil; @@ -895,7 +897,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos) a = (NSArray*)obj; if ([a count] == 0) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"NSServices entry %u field %@ is an empty array " @"- %@", pos, k, path); } @@ -907,7 +909,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos) { if ([[a objectAtIndex: i] isKindOfClass: sClass] == NO) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"NSServices entry %u field %@ element %u is " @"not a string - %@", pos, k, i, path); return nil; @@ -922,7 +924,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos) if ([obj isKindOfClass: dClass] == NO) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"NSServices entry %u field %@ is not a dictionary " @"- %@", pos, k, path); return nil; @@ -930,7 +932,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos) d = (NSDictionary*)obj; if ([d objectForKey: @"default"] == nil) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"NSServices entry %u field %@ has no default value " @"- %@", pos, k, path); } @@ -942,7 +944,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos) { if ([obj isKindOfClass: sClass] == NO) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"NSServices entry %u field %@ contains " @"non-string value - %@", pos, k, path); return nil; @@ -976,14 +978,14 @@ validateService(NSDictionary *service, NSString *path, unsigned pos) && [str isEqualToString: @"NSMapFile"] == NO && [str isEqualToString: @"NSIdentity"] == NO) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"NSServices entry %u bad input mechanism - %@", pos, path); return nil; } } else if ([result objectForKey: @"NSPortName"] == nil) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"NSServices entry %u NSPortName missing - %@", pos, path); return nil; } @@ -992,8 +994,9 @@ validateService(NSDictionary *service, NSString *path, unsigned pos) ret = [result objectForKey: @"NSReturnTypes"]; if ([snd count] == 0 || [ret count] == 0) { - if (verbose >= 0) - NSLog(@"NSServices entry %u types empty or missing - %@", pos, path); + if (verbose > 0) + NSLog(@"NSServices entry %u types empty or missing - %@", + pos, path); return nil; } else @@ -1023,7 +1026,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos) } if (notPresent == NO) { - if (verbose) + if (verbose > 0) { 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 (verbose >= 0) + if (verbose > 0) NSLog(@"NSServices entry %u NSPortName missing - %@", pos, path); return nil; } if ([result objectForKey: @"NSSendTypes"] == nil && [result objectForKey: @"NSReturnTypes"] == nil) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"NSServices entry %u types missing - %@", pos, path); return nil; } if ((item = [result objectForKey: @"NSMenuItem"]) == nil) { - if (verbose >= 0) + if (verbose > 0) NSLog(@"NSServices entry %u NSMenuItem missing - %@", pos, path); return nil; } @@ -1081,7 +1084,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos) } if (used == NO) { - if (verbose) + if (verbose > 0) { 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 (verbose >= 0) + if (verbose > 0) NSLog(@"NSServices entry %u NSMenuItem missing - %@", pos, path); return nil; } @@ -1125,7 +1128,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos) } if (used == NO) { - if (verbose) + if (verbose > 0) { 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 (verbose >= 0) - NSLog(@"NSServices entry %u NSLanguages missing - %@", pos, path); + if (verbose > 0) + NSLog(@"NSServices entry NSLanguages missing - %@", path); return nil; } /* @@ -1161,7 +1164,7 @@ validateService(NSDictionary *service, NSString *path, unsigned pos) } if (used == NO) { - if (verbose) + if (verbose > 0) { NSLog(@"Ignoring entry %u in %@ -\n%@", pos, path, result); } @@ -1170,11 +1173,11 @@ validateService(NSDictionary *service, NSString *path, unsigned pos) } else { - if (verbose >= 0) + if (verbose > 0) NSLog(@"NSServices entry %u unknown service/filter - %@", pos, path); return nil; } - + return result; }