Minor tidyup

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@8120 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 2000-11-15 11:40:00 +00:00
parent 3f338dcbe2
commit 5a65c79ae3
3 changed files with 55 additions and 31 deletions

View file

@ -1,3 +1,8 @@
2000-11-15 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSBundle.m: Minor tidying to avoid compiler warnings.
* Source/NSFileManager.m: ditto
Tue Nov 14 23:44:14 2000 Adam Fedor <fedor@yogi.doc.com> Tue Nov 14 23:44:14 2000 Adam Fedor <fedor@yogi.doc.com>
* Source/GSString.m: Add limits.h (for Solaris) * Source/GSString.m: Add limits.h (for Solaris)

View file

@ -318,25 +318,33 @@ _bundle_load_callback(Class theClass, Category *theCategory)
{ {
NSBundle *bundle = nil; NSBundle *bundle = nil;
NSString *className; NSString *className;
NSString *path, *bundlePath = nil, *lastComponent; #if LINKER_GETSYMBOL
NSString *libName, *frameworkVersion = nil; NSString *path;
NSString *bundlePath = nil;
NSString *lastComponent;
NSString *libName;
NSString *frameworkVersion = nil;
BOOL isFramework = NO; BOOL isFramework = NO;
#endif
NSCAssert(_loadingBundle, NSInternalInconsistencyException); NSCAssert(_loadingBundle, NSInternalInconsistencyException);
if (theClass) if (theClass != 0)
{
className = NSStringFromClass(theClass); className = NSStringFromClass(theClass);
}
else else
{
className = [NSString stringWithCString: theCategory->class_name]; className = [NSString stringWithCString: theCategory->class_name];
}
#if !LINKER_GETSYMBOL #if LINKER_GETSYMBOL
if ([NSBundle _addFrameworkFromClass: theClass] == YES)
return;
#else
path = objc_get_symbol_path(theClass, theCategory); path = objc_get_symbol_path(theClass, theCategory);
if (lastSymbolPath && [lastSymbolPath isEqual: path] == YES) if (lastSymbolPath && [lastSymbolPath isEqual: path] == YES)
{
isFramework = YES; isFramework = YES;
}
else else
{ {
NSString *s; NSString *s;
@ -378,10 +386,14 @@ _bundle_load_callback(Class theClass, Category *theCategory)
if (len > 3) if (len > 3)
{ {
for (i = 3; i < len; i++) for (i = 3; i < len; i++)
{
if (cString[i] == '.') if (cString[i] == '.')
{
break; break;
}
}
if (i-3) if (i > 3)
{ {
NSString *name; NSString *name;
@ -424,28 +436,29 @@ _bundle_load_callback(Class theClass, Category *theCategory)
if (isFramework == YES) if (isFramework == YES)
{ {
if (_bundles) if (_bundles != nil)
{
bundle = (NSBundle *)NSMapGet(_bundles, bundlePath); bundle = (NSBundle *)NSMapGet(_bundles, bundlePath);
}
if (!bundle && _releasedBundles) if (bundle != nil && _releasedBundles != 0)
{ {
bundle = (NSBundle *)NSMapGet(_releasedBundles, bundlePath); bundle = (NSBundle *)NSMapGet(_releasedBundles, bundlePath);
if (bundle) if (bundle != nil)
{ {
NSMapInsert(_bundles, bundlePath, bundle); NSMapInsert(_bundles, bundlePath, bundle);
NSMapRemove(_releasedBundles, bundlePath); NSMapRemove(_releasedBundles, bundlePath);
} }
} }
if (!bundle) if (bundle != nil)
{ {
bundle = [NSBundle bundleWithPath: bundlePath]; bundle = [NSBundle bundleWithPath: bundlePath];
bundle->_bundleType = NSBUNDLE_FRAMEWORK; bundle->_bundleType = NSBUNDLE_FRAMEWORK;
bundle->_codeLoaded = YES; bundle->_codeLoaded = YES;
bundle->_frameworkVersion = RETAIN(frameworkVersion); bundle->_frameworkVersion = RETAIN(frameworkVersion);
bundle->_bundleClasses = RETAIN([NSMutableArray bundle->_bundleClasses
arrayWithCapacity: 2]); = RETAIN([NSMutableArray arrayWithCapacity: 2]);
} }
ASSIGN(lastFrameworkBundle, bundle); ASSIGN(lastFrameworkBundle, bundle);
@ -456,24 +469,31 @@ _bundle_load_callback(Class theClass, Category *theCategory)
{ {
bundle = lastFrameworkBundle; bundle = lastFrameworkBundle;
if (lastFrameworkName) if (lastFrameworkName != nil)
{ {
if ([className isEqual: lastFrameworkName] == YES) if ([className isEqual: lastFrameworkName] == YES)
{ {
bundle->_frameworkVersion = RETAIN([theClass frameworkVersion]); bundle->_frameworkVersion = RETAIN([theClass frameworkVersion]);
DESTROY(lastFrameworkName); DESTROY(lastFrameworkName);
} }
} }
} }
else else
#endif {
bundle = _loadingBundle; bundle = _loadingBundle;
}
#else
if ([NSBundle _addFrameworkFromClass: theClass] == YES)
return;
bundle = _loadingBundle;
#endif
/* Don't store categories */ /* Don't store categories */
if (!theCategory) if (theCategory == 0)
[(NSMutableArray *)[bundle _bundleClasses] addObject: [NSValue {
valueWithNonretainedObject: (id)theClass]]; [(NSMutableArray *)[bundle _bundleClasses] addObject:
[NSValue valueWithNonretainedObject: (id)theClass]];
}
} }

View file

@ -1129,7 +1129,6 @@ static NSFileManager* defaultManager = nil;
NSMutableArray *content; NSMutableArray *content;
IMP nxtImp; IMP nxtImp;
IMP addImp; IMP addImp;
NSDictionary *attr;
BOOL is_dir; BOOL is_dir;
/* /*