Fix up previously applied patch

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16331 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2003-04-02 17:09:52 +00:00
parent 18dbed39ca
commit c91cd5da12
5 changed files with 60 additions and 45 deletions

View file

@ -1,3 +1,14 @@
2003-04-02 Stephane Corthesy <stephane@sente.ch>
* Source/Additions/GSCompatibility.m: Fix up incorrectly applied
patch.
* Source/Additions/Unicode.m (GSEncodingName): Don't define if
NeXT_Foundation_Library.
2003-04-02 Adam Fedor <fedor@gnu.org>
* Headers/gnustep/base/Foundation.h: Revert previous change
22003-04-02 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSXML.m: ([-content]) fix to produce string

View file

@ -90,6 +90,5 @@
#include <Foundation/NSUserDefaults.h>
#include <Foundation/NSValue.h>
#include <Foundation/NSZone.h>
#include <gnustep/base/GSCategories.h>
#endif /* __Foundation_h_GNUSTEP_BASE_INCLUDE */

View file

@ -201,6 +201,7 @@ GS_EXPORT BOOL GSDebugSet(NSString *level);
GS_EXPORT NSArray *NSStandardLibraryPaths();
GS_EXPORT NSString *GetEncodingName(NSStringEncoding availableEncodingValue);
GS_EXPORT NSString *GSEncodingName(NSStringEncoding availableEncodingValue);
GS_EXPORT NSMutableDictionary *GSCurrentThreadDictionary();

View file

@ -33,13 +33,13 @@ NSRecursiveLock *gnustep_global_lock = NULL;
NSString *GetEncodingName(NSStringEncoding availableEncodingValue)
{
// Deprecated
return GSEncodingName(availableEncodingValue);
// Deprecated
return GSEncodingName(availableEncodingValue);
}
NSString *GSEncodingName(NSStringEncoding availableEncodingValue)
{
return (NSString *)CFStringGetNameOfEncoding(CFStringConvertNSStringEncodingToEncoding(availableEncodingValue));
return (NSString *)CFStringGetNameOfEncoding(CFStringConvertNSStringEncodingToEncoding(availableEncodingValue));
}
NSMutableDictionary *GSCurrentThreadDictionary()
@ -218,47 +218,6 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
}
else
{
}
@end
@implementation NSBundle(GSCompatibility)
// In NSBundle.m
+ (NSString *) pathForGNUstepResource: (NSString *)name
ofType: (NSString *)ext
inDirectory: (NSString *)bundlePath
{
NSString *path = nil;
NSString *bundle_path = nil;
NSArray *paths;
NSBundle *bundle;
NSEnumerator *enumerator;
/* Gather up the paths */
// Originally, looks up in GSLibrariesDirectory, i.e. "Libraries"
paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
NSAllDomainsMask, YES);
enumerator = [paths objectEnumerator];
while ((path == nil) && (bundle_path = [enumerator nextObject]))
{
bundle = [self bundleWithPath: bundle_path];
path = [bundle pathForResource: name
ofType: ext
inDirectory: bundlePath];
}
// New for OSX: looks in framework
if(path == nil){
if([bundlePath hasPrefix:@"Resources/"])
bundlePath = [bundlePath substringFromIndex:10];
path = [[NSBundle bundleForClass:[GCObject class]] pathForResource: name
ofType: ext
inDirectory: bundlePath];
}
return path;
return NO;
}
}
@ -358,6 +317,8 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
return [[[NSString alloc] initWithCString: (char*)inet_ntoa(sin.sin_addr)]
autorelease];
}
@end
@ -467,3 +428,44 @@ selector ? sel_get_name(selector) : "(null)",
}
@end
@implementation NSBundle(GSCompatibility)
// In NSBundle.m
+ (NSString *) pathForGNUstepResource: (NSString *)name
ofType: (NSString *)ext
inDirectory: (NSString *)bundlePath
{
NSString *path = nil;
NSString *bundle_path = nil;
NSArray *paths;
NSBundle *bundle;
NSEnumerator *enumerator;
/* Gather up the paths */
// Originally, looks up in GSLibrariesDirectory, i.e. "Libraries"
paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
NSAllDomainsMask, YES);
enumerator = [paths objectEnumerator];
while ((path == nil) && (bundle_path = [enumerator nextObject]))
{
bundle = [self bundleWithPath: bundle_path];
path = [bundle pathForResource: name
ofType: ext
inDirectory: bundlePath];
}
// New for OSX: looks in gnustep framework
if(path == nil){
if([bundlePath hasPrefix:@"Resources/"])
bundlePath = [bundlePath substringFromIndex:10];
path = [[NSBundle bundleForClass:[GCObject class]] pathForResource: name
ofType: ext
inDirectory: bundlePath];
}
return path;
}
@end

View file

@ -593,6 +593,7 @@ GSIsByteEncoding(NSStringEncoding encoding)
/**
* Returns the standard name for the specified encoding.
*/
#ifndef NeXT_Foundation_LIBRARY
NSString*
GSEncodingName(NSStringEncoding encoding)
{
@ -602,6 +603,7 @@ GSEncodingName(NSStringEncoding encoding)
}
return [NSString stringWithCString: encodingTable[encoding]->ename];
}
#endif
/**
* <strong>deprecated</strong> Use GSEncodingName()