Merge from HEAD.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/NibCompatibility@22927 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2006-05-15 00:49:06 +00:00
parent b464e5a838
commit 8fe86ac8e1
21 changed files with 16785 additions and 8364 deletions

View file

@ -1,7 +1,28 @@
2006-01-10 00:11 Gregory John Casamento <greg_casamento@yahoo.com>
2006-05-12 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSKeyedUnarchiver.m: Added private method replaceObject:
withObject:.
* Source/GSString.m: validate UTF-16 data when producing a Cstring
* Source/NSCharacterSetData.h: Add code plane 16 (private use)
* Source/NSCharacterSet.m: Fix to support code plane 16
* Source/GSString.m: Attempt to fix error making a mutable copy of
an 8bit string when the external Cstring encoding is not the same as
the internal one. Use new initWithBytes... method specifying the
encoding used in those cases.
2006-05-11 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Foundation/NSBundle.h: add ([bundleWithIdentifier:])
* Source/NSBundle.m: implement ([bundleWithIdentifier:]) and prevent
loading of multiple bundles with the same non-nil identifier.
Use standardised path as cache key to prevent same bundle being
loaded multiple times via symlinks etc.
* Source/NSMessagePortNameServer.m: Fixup for names which contain bad
characters for in a filename.
* Source/win32/NSMessagePortNameServerWin32.m: ditto
2006-05-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSMime.m: Check for content-length specified as
zero, and mark parsing as complete without attempting to read body.
2006-05-09 Nicolas Roard <nicolas@roard.com>
@ -95,7 +116,6 @@
* Resources/Languages/Ukrainian: New file
* Resources/Languages/UkrainianRussian: Removed wrong file
>>>>>>> .merge-right.r22881
2006-04-24 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSCalendarDate.m: Avoid a couple of minor rounding errors
@ -143,7 +163,6 @@
* Source/NSPropertyList.m (BinaryPLGenerator - storeCount:):
Corrected line forgotten when applying last patch.
>>>>>>> .merge-right.r22807
2006-04-04 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSXML.m: ([GSSAXHandler-dealloc]) fix memory leak.
@ -603,7 +622,6 @@
* Source/Additions/GSCategories.m: Fix MD5 digest for 64bit CPU
>>>>>>> .merge-right.r22748
2006-02-12 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSIndexPath.m: new
@ -640,7 +658,6 @@
* Source/NSDistributedLock.m: ([description]) implemented
>>>>>>> .merge-right.r22474
2006-01-20 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSAutoreleasePool.m: ([addObject:]) fix error in check for
@ -726,6 +743,11 @@
* configure.ac: Ensure uintptr_t and intptr_t exist
* configure: regenerate
2006-01-10 00:11 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSKeyedUnarchiver.m: Added private method replaceObject:
withObject:.
2006-01-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/mframe.m:

View file

@ -135,18 +135,24 @@ GS_EXPORT NSString* const NSLoadedClasses;
* <p>Return the bundle to which aClass belongs. If aClass was loaded
* from a bundle, return the bundle; if it belongs to a framework
* (either a framework linked into the application, or loaded
* dynamically), return the framework; in all other cases, return the
* dynamically), return the framework; if it belongs to a library,
* return the bundle for that library; in all other cases, return the
* main bundle.
* </p>
* <p>Please note that GNUstep supports plain shared libraries, while the
* openstep standard, and other openstep-like systems, do not; the
* behaviour when aClass belongs to a plain shared library is at the
* moment still under investigation -- you should consider it
* undefined since it might be changed. :-)
* behaviour when aClass belongs to a plain shared library is to return
* a bundle for that library, but might be changed. :-)
* </p>
*/
+ (NSBundle*) bundleForClass: (Class)aClass;
/** Returns the bundle for the specified identifier (see -bundleIdentifier)
* as long as the bundle has already been loaded. This never causes a
* bundle to be loaded.
*/
+ (NSBundle*) bundleWithIdentifier: (NSString*)identifier;
/** Return a bundle for the path at path. If path doesn't exist or is
* not readable, return nil. If you want the main bundle of an
* application or a tool, it's better if you use +mainBundle. */
@ -183,9 +189,12 @@ GS_EXPORT NSString* const NSLoadedClasses;
* On MacOS-X using a bundle initialised with a relative path will cause
* a crash if the current working directory is changed between the point
* at which the bundle was initialised and that at which it is used.<br />
* If path is nil or can't be accessed, initWithPath: reallocates the
* If path is nil or can't be accessed, initWithPath: deallocates the
* receiver and returns nil.<br />
* If a bundle for that path already existed, it is returned in place
* of the receiver (and the receiver is deallocated).<br />
* If the -bundleIdentifier is not nil, and a bundle with the same
* identifier already exists, the existing bundle is returned in place
* of the receiver (and the receiver is deallocated).
*/
- (id) initWithPath: (NSString*)path;
@ -280,11 +289,11 @@ GS_EXPORT NSString* const NSLoadedClasses;
- (NSString*) resourcePath;
/** Returns the full path to the plug-in subdirectory of the bundle. */
- (NSString *)builtInPlugInsPath;
- (NSString *) builtInPlugInsPath;
/** Returns the bundle identifier, as defined by the CFBundleIdentifier
key in the infoDictionary */
- (NSString *)bundleIdentifier;
- (NSString *) bundleIdentifier;
/** Returns the bundle version. */
- (unsigned) bundleVersion;
@ -298,6 +307,7 @@ GS_EXPORT NSString* const NSLoadedClasses;
* used to locate resources given environment and user preferences.
*/
+ (NSArray *) preferredLocalizationsFromArray: (NSArray *)localizationsArray;
/**
* Returns subarray of given array containing those localizations that are
* used to locate resources given environment given user preferences (which
@ -306,6 +316,9 @@ GS_EXPORT NSString* const NSLoadedClasses;
+ (NSArray *) preferredLocalizationsFromArray: (NSArray *)localizationsArray
forPreferences: (NSArray *)preferencesArray;
/**
* Returns a boolean indicating whether code for the bundle has been loaded.
*/
- (BOOL) isLoaded;
/**

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -19,7 +19,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>The MIME parsing system</title>
<chapter>
@ -1413,6 +1414,7 @@ wordData(NSString *word)
if (flags.inBody == 1)
{
NSDictionary *info;
GSMimeHeader *hdr;
info = [[document headersNamed: @"http"] lastObject];
if (info != nil)
@ -1436,6 +1438,17 @@ wordData(NSString *word)
}
}
}
/*
* If there is a zero content length, parsing is complete.
*/
hdr = [document headerNamed: @"content-length"];
if (hdr != nil && [[hdr value] intValue] == 0)
{
[document setContent: @""];
flags.inBody = 0;
flags.complete = 1;
return NO; // No more data needed
}
}
}

View file

@ -941,48 +941,58 @@ canBeConvertedToEncoding_u(GSStr self, NSStringEncoding enc)
unsigned c = self->_count;
BOOL result = YES;
if (c > 0 && enc != NSUTF8StringEncoding && enc != NSUnicodeStringEncoding)
if (c > 0)
{
if (enc == NSISOLatin1StringEncoding)
if (enc == NSUTF8StringEncoding || enc == NSUnicodeStringEncoding)
{
unsigned i;
/*
* If all the unicode characters are in the 0 to 255 range
* they are all latin1.
*/
for (i = 0; i < self->_count; i++)
if (GSUnicode(self->_contents.u, c, 0, 0) != c)
{
if (self->_contents.u[i] > 255)
{
result = NO;
break;
}
}
}
else if (enc == NSASCIIStringEncoding)
{
unsigned i;
/*
* If all the unicode characters are in the 0 to 127 range
* they are all ascii.
*/
for (i = 0; i < self->_count; i++)
{
if (self->_contents.u[i] > 127)
{
result = NO;
break;
}
return NO;
}
}
else
{
unsigned dummy = 0; // Hold returned length.
if (enc == NSISOLatin1StringEncoding)
{
unsigned i;
result = GSFromUnicode(0, &dummy, self->_contents.u, c, enc,
0, GSUniStrict);
/*
* If all the unicode characters are in the 0 to 255 range
* they are all latin1.
*/
for (i = 0; i < self->_count; i++)
{
if (self->_contents.u[i] > 255)
{
result = NO;
break;
}
}
}
else if (enc == NSASCIIStringEncoding)
{
unsigned i;
/*
* If all the unicode characters are in the 0 to 127 range
* they are all ascii.
*/
for (i = 0; i < self->_count; i++)
{
if (self->_contents.u[i] > 127)
{
result = NO;
break;
}
}
}
else
{
unsigned dummy = 0; // Hold returned length.
result = GSFromUnicode(0, &dummy, self->_contents.u, c, enc,
0, GSUniStrict);
}
}
}
return result;
@ -1130,8 +1140,15 @@ cString_u(GSStr self, NSStringEncoding enc)
}
else if (enc == NSUnicodeStringEncoding)
{
unichar *tmp = (unichar*)NSZoneMalloc(NSDefaultMallocZone(), (c + 1)*2);
unichar *tmp;
unsigned l;
if ((l = GSUnicode(self->_contents.u, c, 0, 0)) != c)
{
[NSException raise: NSCharacterConversionException
format: @"NSString is not legal UTF-16 at %u", l];
}
tmp = (unichar*)NSZoneMalloc(NSDefaultMallocZone(), (c + 1)*2);
memcpy(tmp, self->_contents.u, c*2);
tmp[c] = 0;
[NSData dataWithBytesNoCopy: tmp length: (c + 1)*2 freeWhenDone: YES];
@ -1207,8 +1224,7 @@ cStringLength_u(GSStr self, NSStringEncoding enc)
{
unsigned l = 0;
if (GSFromUnicode(0, &l, self->_contents.u, c, enc, 0, GSUniStrict)
== NO)
if (GSFromUnicode(0, &l, self->_contents.u, c, enc, 0, GSUniStrict) == NO)
{
[NSException raise: NSCharacterConversionException
format: @"Can't get cStringLength from Unicode string."];
@ -2665,7 +2681,9 @@ transmute(GSStr self, NSString *aString)
obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0,
NSDefaultMallocZone());
obj = [obj initWithCString: (char*)_contents.c length: _count];
obj = [obj initWithBytes: (char*)_contents.c
length: _count
encoding: intEnc];
return obj;
}
@ -3546,6 +3564,158 @@ agree, create a new GSUnicodeInlineString otherwise.
return [self initWithCapacity: 0];
}
- (id) initWithBytes: (const void*)bytes
length: (unsigned int)length
encoding: (NSStringEncoding)encoding
{
void *chars = NSZoneMalloc(NSDefaultMallocZone(), length);
memcpy(chars, bytes, length);
return [self initWithBytesNoCopy: chars
length: length
encoding: encoding
freeWhenDone: YES];
}
- (id) initWithBytesNoCopy: (const void*)bytes
length: (unsigned int)length
encoding: (NSStringEncoding)encoding
freeWhenDone: (BOOL)flag
{
BOOL isASCII = NO;
BOOL isLatin1 = NO;
if (encoding != intEnc && GSIsByteEncoding(encoding) == YES)
{
unsigned i;
for (i = 0; i < length; i++)
{
if (((unsigned char*)bytes)[i] > 127)
{
if (encoding == NSASCIIStringEncoding)
{
RELEASE(self);
if (flag == YES && bytes != 0)
{
NSZoneFree(NSZoneFromPointer(bytes), bytes);
}
return nil; // Invalid data
}
break;
}
}
if (i == length)
{
/*
* This is actually ASCII data ... so we can just stor it as if
* in the internal 8bit encoding scheme.
*/
encoding = intEnc;
}
}
if (encoding == intEnc)
{
_count = length;
_capacity = length;
_contents.c = bytes;
_flags.wide = 0;
_flags.free = flag;
#if GS_WITH_GC
_zone = GSAtomicMallocZone();
#else
_zone = NSZoneFromPointer(bytes);
#endif
return self;
}
/*
* Any remaining encoding needs to be converted to UTF-16.
*/
if (encoding != NSUnicodeStringEncoding)
{
unichar *u = 0;
unsigned l = 0;
if (GSToUnicode(&u, &l, (unsigned char*)bytes, length, encoding,
GSObjCZone(self), 0) == NO)
{
RELEASE(self);
if (flag == YES && bytes != 0)
{
NSZoneFree(NSZoneFromPointer(bytes), bytes);
}
return nil; // Invalid data
}
if (flag == YES && bytes != 0)
{
NSZoneFree(NSZoneFromPointer(bytes), bytes);
}
bytes = u;
length = l * sizeof(unichar);
flag = YES;
}
length /= sizeof(unichar);
if (GSUnicode(bytes, length, &isASCII, &isLatin1) != length)
{
RELEASE(self);
if (flag == YES && bytes != 0)
{
NSZoneFree(NSZoneFromPointer(bytes), bytes);
}
return nil; // Invalid data
}
if (isASCII == YES
|| (intEnc == NSISOLatin1StringEncoding && isLatin1 == YES))
{
unsigned char *buf;
#if GS_WITH_GC
_zone = GSAtomicMallocZone();
#else
_zone = NSDefaultMallocZone();
#endif
buf = NSZoneMalloc(_zone, length);
_count = length;
_capacity = length;
_contents.c = buf;
_flags.wide = 0;
_flags.free = 1;
while (length-- > 0)
{
buf[length] = ((unichar*)bytes)[length];
}
if (flag == YES && bytes != 0)
{
NSZoneFree(NSZoneFromPointer(bytes), bytes);
}
}
else
{
_count = length;
_capacity = length;
_contents.u = bytes;
_flags.wide = 1;
if (flag == YES && bytes != 0)
{
#if GS_WITH_GC
_zone = GSAtomicMallocZone();
#else
_zone = NSZoneFromPointer(bytes);
#endif
_flags.free = 1;
}
else
{
_zone = 0;
}
}
return self;
}
- (id) initWithCapacity: (unsigned)capacity
{
if (capacity < 2)
@ -3569,110 +3739,20 @@ agree, create a new GSUnicodeInlineString otherwise.
length: (unsigned int)length
freeWhenDone: (BOOL)flag
{
BOOL isASCII;
BOOL isLatin1;
if (GSUnicode(chars, length, &isASCII, &isLatin1) != length)
{
RELEASE(self);
if (flag == YES && chars != 0)
{
NSZoneFree(NSZoneFromPointer(chars), chars);
}
return nil; // Invalid data
}
if (isASCII == YES
|| (intEnc == NSISOLatin1StringEncoding && isLatin1 == YES))
{
unsigned char *buf;
#if GS_WITH_GC
_zone = GSAtomicMallocZone();
#else
_zone = NSDefaultMallocZone();
#endif
buf = NSZoneMalloc(_zone, length);
_count = length;
_capacity = length;
_contents.c = buf;
_flags.wide = 0;
_flags.free = 1;
while (length-- > 0)
{
buf[length] = (unsigned char)chars[length];
}
if (flag == YES && chars != 0)
{
NSZoneFree(NSZoneFromPointer(chars), chars);
}
}
else
{
_count = length;
_capacity = length;
_contents.u = chars;
_flags.wide = 1;
if (flag == YES && chars != 0)
{
#if GS_WITH_GC
_zone = GSAtomicMallocZone();
#else
_zone = NSZoneFromPointer(chars);
#endif
_flags.free = 1;
}
else
{
_zone = 0;
}
}
return self;
return [self initWithBytesNoCopy: (void*)chars
length: length*sizeof(unichar)
encoding: NSUnicodeStringEncoding
freeWhenDone: flag];
}
- (id) initWithCStringNoCopy: (char*)chars
length: (unsigned int)length
freeWhenDone: (BOOL)flag
{
if (defEnc != intEnc)
{
unichar *u = 0;
unsigned l = 0;
if (GSToUnicode(&u, &l, (unsigned char*)chars, length, defEnc,
GSObjCZone(self), 0) == NO)
{
DESTROY(self);
}
else
{
self = [self initWithCharactersNoCopy: u length: l freeWhenDone: YES];
}
if (flag == YES && chars != 0)
{
NSZoneFree(NSZoneFromPointer(chars), chars);
}
return self;
}
if (flag == YES && chars != 0)
{
#if GS_WITH_GC
_zone = GSAtomicMallocZone();
#else
_zone = NSZoneFromPointer(chars);
#endif
_flags.free = 1;
}
else
{
_zone = 0;
}
_count = length;
_capacity = length;
_contents.c = (unsigned char*)chars;
_flags.wide = 0;
return self;
return [self initWithBytesNoCopy: (void*)chars
length: length
encoding: defEnc
freeWhenDone: flag];
}
- (id) initWithFormat: (NSString*)format
@ -3779,7 +3859,9 @@ agree, create a new GSUnicodeInlineString otherwise.
if (_flags.wide == 1)
obj = [obj initWithCharacters: _contents.u length: _count];
else
obj = [obj initWithCString: (char*)_contents.c length: _count];
obj = [obj initWithBytes: (char*)_contents.c
length: _count
encoding: intEnc];
return obj;
}
@ -3792,7 +3874,9 @@ agree, create a new GSUnicodeInlineString otherwise.
if (_flags.wide == 1)
obj = [obj initWithCharacters: _contents.u length: _count];
else
obj = [obj initWithCString: (char*)_contents.c length: _count];
obj = [obj initWithBytes: (char*)_contents.c
length: _count
encoding: intEnc];
return obj;
}

View file

@ -73,6 +73,7 @@ typedef enum {
/* Class variables - We keep track of all the bundles */
static NSBundle *_mainBundle = nil;
static NSMapTable *_bundles = NULL;
static NSMapTable *_byIdentifier = NULL;
/* Store the working directory at startup */
static NSString *_launchDirectory = nil;
@ -1076,8 +1077,27 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
return AUTORELEASE([[self alloc] initWithPath: path]);
}
+ (NSBundle*) bundleWithIdentifier: (NSString*)identifier
{
NSBundle *bundle = nil;
[load_lock lock];
if (_byIdentifier)
{
bundle = (NSBundle *)NSMapGet(_byIdentifier, identifier);
if (bundle != nil)
{
RETAIN(bundle); /* retain - look as if we were alloc'ed */
}
}
[load_lock unlock];
return AUTORELEASE(bundle);
}
- (id) initWithPath: (NSString*)path
{
NSString *identifier;
self = [super init];
if (!path || [path length] == 0)
@ -1099,17 +1119,19 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
path = [[[NSFileManager defaultManager] currentDirectoryPath]
stringByAppendingPathComponent: path];
}
if ([path hasPrefix: @"~"] == YES)
{
path = [path stringByExpandingTildeInPath];
}
/*
* Standardize the path so we can be sure that cache lookup is consistent.
*/
path = [path stringByStandardizingPath];
/* Check if we were already initialized for this directory */
[load_lock lock];
if (_bundles)
{
NSBundle* bundle = (NSBundle *)NSMapGet(_bundles, path);
if (bundle)
NSBundle *bundle = (NSBundle *)NSMapGet(_bundles, path);
if (bundle != nil)
{
RETAIN(bundle); /* retain - look as if we were alloc'ed */
[load_lock unlock];
@ -1144,11 +1166,31 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
_bundleType = (unsigned int)NSBUNDLE_BUNDLE;
}
identifier = [self bundleIdentifier];
[load_lock lock];
if (!_bundles)
{
_bundles = NSCreateMapTable(NSObjectMapKeyCallBacks,
NSNonOwnedPointerMapValueCallBacks, 0);
NSNonOwnedPointerMapValueCallBacks, 0);
}
if (!_byIdentifier)
{
_byIdentifier = NSCreateMapTable(NSObjectMapKeyCallBacks,
NSNonOwnedPointerMapValueCallBacks, 0);
}
if (identifier != nil)
{
NSBundle *bundle = (NSBundle *)NSMapGet(_byIdentifier, identifier);
if (bundle != nil)
{
RETAIN(bundle); /* retain - look as if we were alloc'ed */
[load_lock unlock];
[self dealloc];
return bundle;
}
NSMapInsert(_byIdentifier, identifier, self);
}
NSMapInsert(_bundles, _path, self);
[load_lock unlock];
@ -1158,10 +1200,28 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
- (void) dealloc
{
if ([self isLoaded] == YES && self != _mainBundle
&& self ->_bundleType != NSBUNDLE_LIBRARY)
{
/*
* Prevent unloading of bundles where code has been loaded ...
* the objc runtime does not currently support unloading of
* dynamically loaded code, so we want to prevent a bundle
* being loaded twice.
*/
RETAIN(self);
return;
}
if (_path != nil)
{
NSString *identifier = [self bundleIdentifier];
[load_lock lock];
NSMapRemove(_bundles, _path);
if (identifier != nil)
{
NSMapRemove(_byIdentifier, identifier);
}
[load_lock unlock];
RELEASE(_path);
}
@ -1287,7 +1347,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
[load_lock lock];
if (!_codeLoaded)
if (_codeLoaded == NO)
{
NSString *object;
NSEnumerator *classEnumerator;
@ -1961,7 +2021,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
- (NSString*) bundleIdentifier
{
return [[self infoDictionary] objectForKey:@"CFBundleIdentifier"];
return [[self infoDictionary] objectForKey: @"CFBundleIdentifier"];
}
- (unsigned) bundleVersion

View file

@ -42,10 +42,10 @@
#include "NSCharacterSetData.h"
//PENDING: may want to make these less likely to conflict
#define UNICODE_SIZE 65536
#define UNICODE_MAX 1048576
#define UNICODE_SIZE 63336
#define UNICODE_MAX 1114112
#define BITMAP_SIZE 8192
#define BITMAP_MAX 131072
#define BITMAP_MAX 139264
#ifndef SETBIT
#define SETBIT(a,i) ((a) |= 1<<(i))
@ -83,7 +83,7 @@
- (NSData*) bitmapRepresentation
{
unsigned i = 16;
unsigned i = 17;
while (i > 0 && [self hasMemberInPlane: i-1] == NO)
{
@ -128,7 +128,7 @@
{
unsigned bit;
if (aPlane >= 16)
if (aPlane > 16)
{
return NO;
}
@ -203,6 +203,13 @@
{
unsigned byte = aCharacter/8;
if (aCharacter >= UNICODE_MAX)
{
[NSException raise: NSInvalidArgumentException
format: @"[%@-%@] argument (0x%08x) is too large",
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
aCharacter];
}
if (byte < _length && ISSET(_data[byte], aCharacter % 8))
{
return YES;
@ -298,7 +305,7 @@
- (NSData*) bitmapRepresentation
{
unsigned i = 16;
unsigned i = 17;
while (i > 0 && [self hasMemberInPlane: i-1] == NO)
{
@ -824,7 +831,7 @@ static Class abstractMutableClass = nil;
oImp = (BOOL (*)(id,SEL,unichar))
[anObject methodForSelector: @selector(characterIsMember:)];
for (p = 0; p < 16; p++)
for (p = 0; p <= 16; p++)
{
if ([self hasMemberInPlane: p] == YES)
{
@ -872,6 +879,13 @@ static Class abstractMutableClass = nil;
{
int plane = (aCharacter >> 16);
if (aCharacter >= UNICODE_MAX)
{
[NSException raise: NSInvalidArgumentException
format: @"[%@-%@] argument (0x%08x) is too large",
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
aCharacter];
}
if (plane == 0)
{
unichar u = (unichar)(aCharacter & 0xffff);

File diff suppressed because it is too large Load diff

View file

@ -35,6 +35,7 @@
#include "Foundation/NSFileManager.h"
#include "Foundation/NSValue.h"
#include "Foundation/NSThread.h"
#include "GNUstepBase/GSMime.h"
#include "GSPortPrivate.h"
@ -143,7 +144,16 @@ static void clean_up_names(void)
{
static NSString *base_path = nil;
NSString *path;
NSData *data;
/*
* Make sure name is representable as a filename ... assume base64 encoded
* strings are valid on all filesystems.
*/
data = [name dataUsingEncoding: NSUTF8StringEncoding];
data = [GSMimeDocument encodeBase64: data];
name = [[NSString alloc] initWithData: data encoding: NSASCIIStringEncoding];
AUTORELEASE(name);
[serverLock lock];
if (!base_path)
{
@ -304,14 +314,15 @@ static void clean_up_names(void)
if ([[self class] _livePort: path])
{
NSDebugLLog(@"NSMessagePort", @"fail, is a live port");
NSDebugLLog(@"NSMessagePort", @"fail, is a live port (%@)", name);
return NO;
}
fd = open([path fileSystemRepresentation], O_CREAT|O_EXCL|O_WRONLY, 0600);
if (fd < 0)
{
NSDebugLLog(@"NSMessagePort", @"fail, can't open file (%m)");
NSDebugLLog(@"NSMessagePort", @"fail, can't open file (%@) for %@",
path, name);
return NO;
}

View file

@ -37,6 +37,8 @@
#include "Foundation/NSThread.h"
#include "Foundation/NSUserDefaults.h"
#include "GNUstepBase/GSMime.h"
#include "GSPortPrivate.h"
#define UNISTR(X) \
@ -227,6 +229,16 @@ OutputDebugStringW(L"");
+ (NSString *) _translate: (NSString *)name
{
NSData *data;
/*
* Make sure name is representable in the registry ...
* assume base64 encoded strings are valid.
*/
data = [name dataUsingEncoding: NSUTF8StringEncoding];
data = [GSMimeDocument encodeBase64: data];
name = [[NSString alloc] initWithData: data encoding: NSASCIIStringEncoding];
AUTORELEASE(name);
return name;
}