mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Merged in 1.6.0 branch
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16228 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c4b26f8afa
commit
5c49ef401a
38 changed files with 812 additions and 295 deletions
|
@ -47,6 +47,8 @@
|
|||
#include <gnustep/base/GSObjCRuntime.h>
|
||||
#include <string.h>
|
||||
|
||||
@class NSNull;
|
||||
|
||||
/** Deprecated ... use GSObjCFindVariable() */
|
||||
BOOL
|
||||
GSFindInstanceVariable(id obj, const char *name,
|
||||
|
@ -1102,6 +1104,12 @@ void
|
|||
GSObjCSetValue(NSObject *self, NSString *key, id val, SEL sel,
|
||||
const char *type, unsigned size, int offset)
|
||||
{
|
||||
static NSNull *null = nil;
|
||||
|
||||
if (null == nil)
|
||||
{
|
||||
null = [NSNull new];
|
||||
}
|
||||
if (sel != 0)
|
||||
{
|
||||
NSMethodSignature *sig = [self methodSignatureForSelector: sel];
|
||||
|
@ -1117,6 +1125,10 @@ GSObjCSetValue(NSObject *self, NSString *key, id val, SEL sel,
|
|||
{
|
||||
[self handleTakeValue: val forUnboundKey: key];
|
||||
}
|
||||
else if ((val == nil || val == null) && *type != _C_ID && *type != _C_CLASS)
|
||||
{
|
||||
[self unableToSetNilForKey: key];
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (*type)
|
||||
|
@ -1130,8 +1142,7 @@ GSObjCSetValue(NSObject *self, NSString *key, id val, SEL sel,
|
|||
{
|
||||
id *ptr = (id *)((char *)self + offset);
|
||||
|
||||
[*ptr autorelease];
|
||||
*ptr = [v retain];
|
||||
ASSIGN(*ptr, v);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -130,6 +130,7 @@ Base_AGSDOC_FLAGS = \
|
|||
-VariablesTemplate TypesAndConstants \
|
||||
-WordMap '{\
|
||||
FOUNDATION_EXPORT=extern;FOUNDATION_STATIC_INLINE="";\
|
||||
GS_STATIC_INLINE="";\
|
||||
GS_GEOM_SCOPE=extern;GS_GEOM_ATTR="";\
|
||||
GS_EXPORT=extern;GS_DECLARE="";\
|
||||
GS_RANGE_SCOPE=extern;GS_RANGE_ATTR="";\
|
||||
|
|
|
@ -57,11 +57,11 @@ libgnustep-baseadd_SUBPROJECTS=Additions
|
|||
ifeq ($(GNUSTEP_TARGET_OS), mingw32)
|
||||
|
||||
GNUSTEP_TARGET_INSTALL_PREFIX := \
|
||||
$(shell echo $(GNUSTEP_SYSTEM_ROOT) | sed 's|^[a-zA-Z]:/|/|')
|
||||
$(shell echo $(GNUSTEP_SYSTEM_ROOT) | sed 's|^[a-zA-Z]:/|/|' | sed 's|/|\\\\057|g')
|
||||
GNUSTEP_TARGET_LOCAL_ROOT := \
|
||||
$(shell echo $(GNUSTEP_LOCAL_ROOT) | sed 's|^[a-zA-Z]:/|/|')
|
||||
$(shell echo $(GNUSTEP_LOCAL_ROOT) | sed 's|^[a-zA-Z]:/|/|' | sed 's|/|\\\\057|g')
|
||||
GNUSTEP_TARGET_NETWORK_ROOT := \
|
||||
$(shell echo $(GNUSTEP_NETWORK_ROOT) | sed 's|^[a-zA-Z]:/|/|')
|
||||
$(shell echo $(GNUSTEP_NETWORK_ROOT) | sed 's|^[a-zA-Z]:/|/|' | sed 's|/|\\\\057|g')
|
||||
DEFS= -DGNUSTEP_INSTALL_PREFIX=$(GNUSTEP_TARGET_INSTALL_PREFIX) \
|
||||
-DGNUSTEP_LOCAL_ROOT=$(GNUSTEP_TARGET_LOCAL_ROOT) \
|
||||
-DGNUSTEP_NETWORK_ROOT=$(GNUSTEP_TARGET_NETWORK_ROOT) \
|
||||
|
@ -70,6 +70,7 @@ DEFS= -DGNUSTEP_INSTALL_PREFIX=$(GNUSTEP_TARGET_INSTALL_PREFIX) \
|
|||
-DGNUSTEP_TARGET_OS=\"$(GNUSTEP_TARGET_OS)\" \
|
||||
-DLIBRARY_COMBO=\"$(LIBRARY_COMBO)\"
|
||||
|
||||
|
||||
else
|
||||
|
||||
GNUSTEP_INSTALL_PREFIX=$(GNUSTEP_SYSTEM_ROOT)
|
||||
|
|
|
@ -755,16 +755,112 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
|
|||
unsigned numKeys = [keyArray count];
|
||||
NSString *plists[numKeys];
|
||||
NSString *keys[numKeys];
|
||||
BOOL canCompare = YES;
|
||||
Class lastClass = 0;
|
||||
|
||||
[keyArray getObjects: keys];
|
||||
|
||||
for (i = 0; i < numKeys; i++)
|
||||
{
|
||||
if (GSObjCClass(keys[i]) == lastClass)
|
||||
continue;
|
||||
if ([keys[i] respondsToSelector: @selector(compare:)] == NO)
|
||||
{
|
||||
canCompare = NO;
|
||||
break;
|
||||
}
|
||||
lastClass = GSObjCClass(keys[i]);
|
||||
}
|
||||
|
||||
if (canCompare == YES)
|
||||
{
|
||||
#define STRIDE_FACTOR 3
|
||||
unsigned c,d, stride;
|
||||
BOOL found;
|
||||
NSComparisonResult (*comp)(id, SEL, id) = 0;
|
||||
unsigned int count = numKeys;
|
||||
#ifdef GSWARN
|
||||
BOOL badComparison = NO;
|
||||
#endif
|
||||
|
||||
stride = 1;
|
||||
while (stride <= count)
|
||||
{
|
||||
stride = stride * STRIDE_FACTOR + 1;
|
||||
}
|
||||
lastClass = 0;
|
||||
while (stride > (STRIDE_FACTOR - 1))
|
||||
{
|
||||
// loop to sort for each value of stride
|
||||
stride = stride / STRIDE_FACTOR;
|
||||
for (c = stride; c < count; c++)
|
||||
{
|
||||
found = NO;
|
||||
if (stride > c)
|
||||
{
|
||||
break;
|
||||
}
|
||||
d = c - stride;
|
||||
while (!found)
|
||||
{
|
||||
id a = keys[d + stride];
|
||||
id b = keys[d];
|
||||
Class x;
|
||||
NSComparisonResult r;
|
||||
|
||||
x = GSObjCClass(a);
|
||||
if (x != lastClass)
|
||||
{
|
||||
lastClass = x;
|
||||
comp = (NSComparisonResult (*)(id, SEL, id))
|
||||
[a methodForSelector: @selector(compare:)];
|
||||
}
|
||||
r = (*comp)(a, @selector(compare:), b);
|
||||
if (r < 0)
|
||||
{
|
||||
#ifdef GSWARN
|
||||
if (r != NSOrderedAscending)
|
||||
{
|
||||
badComparison = YES;
|
||||
}
|
||||
#endif
|
||||
keys[d + stride] = b;
|
||||
keys[d] = a;
|
||||
if (stride > d)
|
||||
{
|
||||
break;
|
||||
}
|
||||
d -= stride;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef GSWARN
|
||||
if (r != NSOrderedDescending
|
||||
&& r != NSOrderedSame)
|
||||
{
|
||||
badComparison = YES;
|
||||
}
|
||||
#endif
|
||||
found = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef GSWARN
|
||||
if (badComparison == YES)
|
||||
{
|
||||
NSWarnFLog(@"Detected bad return value from comparison");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
for (i = 0; i < numKeys; i++)
|
||||
{
|
||||
plists[i] = (*myObj)(obj, objSel, keys[i]);
|
||||
}
|
||||
|
||||
if (loc == nil)
|
||||
{
|
||||
for (i = 0; i < numKeys; i++)
|
||||
{
|
||||
plists[i] = (*myObj)(obj, objSel, keys[i]);
|
||||
}
|
||||
|
||||
Append(@"{", dest);
|
||||
for (i = 0; i < numKeys; i++)
|
||||
{
|
||||
|
@ -777,108 +873,6 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
|
|||
}
|
||||
else
|
||||
{
|
||||
BOOL canCompare = YES;
|
||||
Class lastClass = 0;
|
||||
|
||||
for (i = 0; i < numKeys; i++)
|
||||
{
|
||||
if (GSObjCClass(keys[i]) == lastClass)
|
||||
continue;
|
||||
if ([keys[i] respondsToSelector: @selector(compare:)] == NO)
|
||||
{
|
||||
canCompare = NO;
|
||||
break;
|
||||
}
|
||||
lastClass = GSObjCClass(keys[i]);
|
||||
}
|
||||
|
||||
if (canCompare == YES)
|
||||
{
|
||||
#define STRIDE_FACTOR 3
|
||||
unsigned c,d, stride;
|
||||
BOOL found;
|
||||
NSComparisonResult (*comp)(id, SEL, id) = 0;
|
||||
unsigned int count = numKeys;
|
||||
#ifdef GSWARN
|
||||
BOOL badComparison = NO;
|
||||
#endif
|
||||
|
||||
stride = 1;
|
||||
while (stride <= count)
|
||||
{
|
||||
stride = stride * STRIDE_FACTOR + 1;
|
||||
}
|
||||
lastClass = 0;
|
||||
while (stride > (STRIDE_FACTOR - 1))
|
||||
{
|
||||
// loop to sort for each value of stride
|
||||
stride = stride / STRIDE_FACTOR;
|
||||
for (c = stride; c < count; c++)
|
||||
{
|
||||
found = NO;
|
||||
if (stride > c)
|
||||
{
|
||||
break;
|
||||
}
|
||||
d = c - stride;
|
||||
while (!found)
|
||||
{
|
||||
id a = keys[d + stride];
|
||||
id b = keys[d];
|
||||
Class x;
|
||||
NSComparisonResult r;
|
||||
|
||||
x = GSObjCClass(a);
|
||||
if (x != lastClass)
|
||||
{
|
||||
lastClass = x;
|
||||
comp = (NSComparisonResult (*)(id, SEL, id))
|
||||
[a methodForSelector: @selector(compare:)];
|
||||
}
|
||||
r = (*comp)(a, @selector(compare:), b);
|
||||
if (r < 0)
|
||||
{
|
||||
#ifdef GSWARN
|
||||
if (r != NSOrderedAscending)
|
||||
{
|
||||
badComparison = YES;
|
||||
}
|
||||
#endif
|
||||
keys[d + stride] = b;
|
||||
keys[d] = a;
|
||||
if (stride > d)
|
||||
{
|
||||
break;
|
||||
}
|
||||
d -= stride;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef GSWARN
|
||||
if (r != NSOrderedDescending
|
||||
&& r != NSOrderedSame)
|
||||
{
|
||||
badComparison = YES;
|
||||
}
|
||||
#endif
|
||||
found = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef GSWARN
|
||||
if (badComparison == YES)
|
||||
{
|
||||
NSWarnFLog(@"Detected bad return value from comparison");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
for (i = 0; i < numKeys; i++)
|
||||
{
|
||||
plists[i] = (*myObj)(obj, objSel, keys[i]);
|
||||
}
|
||||
|
||||
Append(@"{\n", dest);
|
||||
for (i = 0; i < numKeys; i++)
|
||||
{
|
||||
|
|
|
@ -41,6 +41,8 @@ typedef struct _NSInvocation_t {
|
|||
/* Function that implements the actual forwarding */
|
||||
typedef void (*ffi_closure_fun) (ffi_cif*,void*,void**,void*);
|
||||
|
||||
typedef void (*f_fun) ();
|
||||
|
||||
void GSFFIInvocationCallback(ffi_cif*, void*, void **, void*);
|
||||
|
||||
/*
|
||||
|
@ -267,7 +269,7 @@ GSFFIInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
NSInvocation_t *inv = (NSInvocation_t*)_inv;
|
||||
|
||||
/* Do it */
|
||||
ffi_call(inv->_cframe, imp, (inv->_retval),
|
||||
ffi_call(inv->_cframe, (f_fun)imp, (inv->_retval),
|
||||
((cifframe_t *)inv->_cframe)->values);
|
||||
|
||||
/* Don't decode the return value here (?) */
|
||||
|
@ -412,10 +414,11 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
|
|||
this since the return value (retp) really belongs to the closure
|
||||
not the invocation so it will be demallocd at the end of this call
|
||||
*/
|
||||
if ([sig methodReturnType] && *[sig methodReturnType] == _C_ID)
|
||||
if ([sig methodReturnType] && *[sig methodReturnType] == _C_ID
|
||||
&& ((NSInvocation_t *)invocation)->_validReturn == YES)
|
||||
{
|
||||
AUTORELEASE(*(id *)retp);
|
||||
invocation->_validReturn = NO;
|
||||
((NSInvocation_t *)invocation)->_validReturn = NO;
|
||||
}
|
||||
|
||||
/* We need to (re)encode the return type for it's trip back. */
|
||||
|
|
|
@ -1053,14 +1053,14 @@ fillHole(ivars self, unsigned index, unsigned size)
|
|||
|
||||
if (self->_flags.wide == 1)
|
||||
{
|
||||
for (i = index; i <= self->_count; i++)
|
||||
for (i = index; i < self->_count; i++)
|
||||
{
|
||||
self->_contents.u[i] = self->_contents.u[i+size];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = index; i <= self->_count; i++)
|
||||
for (i = index; i < self->_count; i++)
|
||||
{
|
||||
self->_contents.c[i] = self->_contents.c[i+size];
|
||||
}
|
||||
|
@ -1069,14 +1069,14 @@ fillHole(ivars self, unsigned index, unsigned size)
|
|||
#else
|
||||
if (self->_flags.wide == 1)
|
||||
{
|
||||
memcpy(self->_contents.u + index + size,
|
||||
self->_contents.u + index,
|
||||
memcpy(self->_contents.u + index,
|
||||
self->_contents.u + index + size,
|
||||
sizeof(unichar)*(self->_count - index));
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(self->_contents.c + index + size,
|
||||
self->_contents.c + index, (self->_count - index));
|
||||
memcpy(self->_contents.c + index,
|
||||
self->_contents.c + index + size, (self->_count - index));
|
||||
}
|
||||
#endif // STABLE_MEMCPY
|
||||
self->_flags.hash = 0;
|
||||
|
|
|
@ -288,6 +288,12 @@ decodePort(NSData *data, NSString *defaultAddress)
|
|||
length = GSSwapBigI32ToHost(pih->length);
|
||||
pi = (GSPortInfo*)&pih[1];
|
||||
pnum = GSSwapBigI16ToHost(pi->num);
|
||||
if (strncmp(pi->addr, "VER", 3) == 0)
|
||||
{
|
||||
NSLog(@"Remote version of GNUstep at %s:%d is more recent than this one",
|
||||
pi->addr, pnum);
|
||||
return nil;
|
||||
}
|
||||
addr = [NSString stringWithCString: pi->addr];
|
||||
|
||||
NSDebugFLLog(@"NSPort", @"Decoded port as '%@:%d'", addr, pnum);
|
||||
|
@ -1028,6 +1034,13 @@ static Class runLoopClass;
|
|||
|
||||
rType = GSP_NONE; /* ready for a new item */
|
||||
p = decodePort(rData, defaultAddress);
|
||||
if (p == nil)
|
||||
{
|
||||
NSLog(@"%@ - unable to decode remote port", self);
|
||||
DO_UNLOCK(myLock);
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* Set up to read another item header.
|
||||
*/
|
||||
|
|
|
@ -77,9 +77,6 @@ endif
|
|||
ifeq ($(GNUSTEP_TARGET_OS),cygwin)
|
||||
libgnustep-base_LIBRARIES_DEPEND_UPON += -lobjc
|
||||
endif
|
||||
ifeq ($(findstring darwin, $(GNUSTEP_TARGET_OS)), darwin)
|
||||
libgnustep-base_LIBRARIES_DEPEND_UPON += -flat_namespace
|
||||
endif
|
||||
ifeq ($(shared),yes)
|
||||
libgnustep-base_LIBRARIES_DEPEND_UPON += $(CONFIG_SYSTEM_LIBS)
|
||||
endif
|
||||
|
|
|
@ -634,8 +634,9 @@ failure:
|
|||
- (id) initWithContentsOfMappedFile: (NSString *)path
|
||||
{
|
||||
#ifdef HAVE_MMAP
|
||||
NSZone *z = GSObjCZone(self);
|
||||
RELEASE(self);
|
||||
self = [NSDataMappedFile allocWithZone: GSObjCZone(self)];
|
||||
self = [NSDataMappedFile allocWithZone: z];
|
||||
return [self initWithContentsOfMappedFile: path];
|
||||
#else
|
||||
return [self initWithContentsOfFile: path];
|
||||
|
@ -2813,7 +2814,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
if (shmid == -1) /* Created memory? */
|
||||
{
|
||||
NSLog(@"[-initWithBytes:length:] shared mem get failed for %u - %s",
|
||||
bufferSize, GSLastErrorStr(errno));
|
||||
bufferSize, GSLastErrorStr(errno));
|
||||
RELEASE(self);
|
||||
self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
return [self initWithBytes: aBuffer length: bufferSize];
|
||||
|
@ -3476,12 +3477,23 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
struct shmid_ds buf;
|
||||
|
||||
if (shmctl(shmid, IPC_STAT, &buf) < 0)
|
||||
NSLog(@"[NSMutableDataShared -dealloc] shared memory control failed - %s", GSLastErrorStr(errno));
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -dealloc] shared memory "
|
||||
@"control failed - %s", GSLastErrorStr(errno));
|
||||
}
|
||||
else if (buf.shm_nattch == 1)
|
||||
if (shmctl(shmid, IPC_RMID, &buf) < 0) /* Mark for deletion. */
|
||||
NSLog(@"[NSMutableDataShared -dealloc] shared memory delete failed - %s", GSLastErrorStr(errno));
|
||||
{
|
||||
if (shmctl(shmid, IPC_RMID, &buf) < 0) /* Mark for deletion. */
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -dealloc] shared memory "
|
||||
@"delete failed - %s", GSLastErrorStr(errno));
|
||||
}
|
||||
}
|
||||
if (shmdt(bytes) < 0)
|
||||
NSLog(@"[NSMutableDataShared -dealloc] shared memory detach failed - %s", GSLastErrorStr(errno));
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -dealloc] shared memory "
|
||||
@"detach failed - %s", GSLastErrorStr(errno));
|
||||
}
|
||||
bytes = 0;
|
||||
length = 0;
|
||||
capacity = 0;
|
||||
|
@ -3509,7 +3521,8 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
shmid = shmget(IPC_PRIVATE, bufferSize, IPC_CREAT|VM_ACCESS);
|
||||
if (shmid == -1) /* Created memory? */
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory get failed for %u - %s", bufferSize, GSLastErrorStr(errno));
|
||||
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory "
|
||||
@"get failed for %u - %s", bufferSize, GSLastErrorStr(errno));
|
||||
RELEASE(self);
|
||||
self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
return [self initWithCapacity: bufferSize];
|
||||
|
@ -3519,7 +3532,8 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
e = errno;
|
||||
if (bytes == (void*)-1)
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory attach failed for %u - %s", bufferSize, GSLastErrorStr(e));
|
||||
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory "
|
||||
@"attach failed for %u - %s", bufferSize, GSLastErrorStr(e));
|
||||
bytes = 0;
|
||||
RELEASE(self);
|
||||
self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
|
@ -3538,20 +3552,23 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
shmid = anId;
|
||||
if (shmctl(shmid, IPC_STAT, &buf) < 0)
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -initWithShmID:length:] shared memory control failed - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"[NSMutableDataShared -initWithShmID:length:] shared memory "
|
||||
@"control failed - %s", GSLastErrorStr(errno));
|
||||
RELEASE(self); /* Unable to access memory. */
|
||||
return nil;
|
||||
}
|
||||
if (buf.shm_segsz < bufferSize)
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -initWithShmID:length:] shared memory segment too small");
|
||||
NSLog(@"[NSMutableDataShared -initWithShmID:length:] shared memory "
|
||||
@"segment too small");
|
||||
RELEASE(self); /* Memory segment too small. */
|
||||
return nil;
|
||||
}
|
||||
bytes = shmat(shmid, 0, 0);
|
||||
if (bytes == (void*)-1)
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -initWithShmID:length:] shared memory attach failed - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"[NSMutableDataShared -initWithShmID:length:] shared memory "
|
||||
@"attach failed - %s", GSLastErrorStr(errno));
|
||||
bytes = 0;
|
||||
RELEASE(self); /* Unable to attach to memory. */
|
||||
return nil;
|
||||
|
@ -3571,32 +3588,49 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
|
||||
newid = shmget(IPC_PRIVATE, size, IPC_CREAT|VM_ACCESS);
|
||||
if (newid == -1) /* Created memory? */
|
||||
[NSException raise: NSMallocException
|
||||
format: @"Unable to create shared memory segment - %s.",
|
||||
GSLastErrorStr(errno)];
|
||||
{
|
||||
[NSException raise: NSMallocException
|
||||
format: @"Unable to create shared memory segment (size:%u) - %s.",
|
||||
size, GSLastErrorStr(errno)];
|
||||
}
|
||||
tmp = shmat(newid, 0, 0);
|
||||
if ((int)tmp == -1) /* Attached memory? */
|
||||
[NSException raise: NSMallocException
|
||||
format: @"Unable to attach to shared memory segment."];
|
||||
{
|
||||
[NSException raise: NSMallocException
|
||||
format: @"Unable to attach to shared memory segment."];
|
||||
}
|
||||
memcpy(tmp, bytes, length);
|
||||
if (bytes)
|
||||
{
|
||||
struct shmid_ds buf;
|
||||
|
||||
if (shmctl(shmid, IPC_STAT, &buf) < 0)
|
||||
NSLog(@"[NSMutableDataShared -setCapacity:] shared memory control failed - %s", GSLastErrorStr(errno));
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -setCapacity:] shared memory "
|
||||
@"control failed - %s", GSLastErrorStr(errno));
|
||||
}
|
||||
else if (buf.shm_nattch == 1)
|
||||
if (shmctl(shmid, IPC_RMID, &buf) < 0) /* Mark for deletion. */
|
||||
NSLog(@"[NSMutableDataShared -setCapacity:] shared memory delete failed - %s", GSLastErrorStr(errno));
|
||||
{
|
||||
if (shmctl(shmid, IPC_RMID, &buf) < 0) /* Mark for deletion. */
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -setCapacity:] shared memory "
|
||||
@"delete failed - %s", GSLastErrorStr(errno));
|
||||
}
|
||||
}
|
||||
if (shmdt(bytes) < 0) /* Detach memory. */
|
||||
NSLog(@"[NSMutableDataShared -setCapacity:] shared memory detach failed - %s", GSLastErrorStr(errno));
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -setCapacity:] shared memory "
|
||||
@"detach failed - %s", GSLastErrorStr(errno));
|
||||
}
|
||||
}
|
||||
bytes = tmp;
|
||||
shmid = newid;
|
||||
capacity = size;
|
||||
}
|
||||
if (size < length)
|
||||
length = size;
|
||||
{
|
||||
length = size;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -271,6 +271,140 @@ static NSDecimalNumber *one;
|
|||
return [self initWithDecimal: decimal];
|
||||
}
|
||||
|
||||
- (id) initWithBool: (BOOL)value
|
||||
{
|
||||
return [self initWithMantissa: (value == YES) ? 1 : 0
|
||||
exponent: 0
|
||||
isNegative: NO];
|
||||
}
|
||||
|
||||
- (id) initWithChar: (signed char)value
|
||||
{
|
||||
if (value < 0)
|
||||
{
|
||||
return [self initWithMantissa: -value
|
||||
exponent: 0
|
||||
isNegative: YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
return [self initWithMantissa: value
|
||||
exponent: 0
|
||||
isNegative: NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithDouble: (double)value
|
||||
{
|
||||
return [self initWithBytes: &value objCType: "d"];
|
||||
}
|
||||
|
||||
- (id) initWithFloat: (float)value
|
||||
{
|
||||
double d = (double)value;
|
||||
|
||||
return [self initWithBytes: &d objCType: "d"];
|
||||
}
|
||||
|
||||
- (id) initWithInt: (signed int)value
|
||||
{
|
||||
if (value < 0)
|
||||
{
|
||||
return [self initWithMantissa: -value
|
||||
exponent: 0
|
||||
isNegative: YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
return [self initWithMantissa: value
|
||||
exponent: 0
|
||||
isNegative: NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithLong: (signed long)value
|
||||
{
|
||||
if (value < 0)
|
||||
{
|
||||
return [self initWithMantissa: -value
|
||||
exponent: 0
|
||||
isNegative: YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
return [self initWithMantissa: value
|
||||
exponent: 0
|
||||
isNegative: NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithLongLong: (signed long long)value
|
||||
{
|
||||
if (value < 0)
|
||||
{
|
||||
return [self initWithMantissa: -value
|
||||
exponent: 0
|
||||
isNegative: YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
return [self initWithMantissa: value
|
||||
exponent: 0
|
||||
isNegative: NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithShort: (signed short)value
|
||||
{
|
||||
if (value < 0)
|
||||
{
|
||||
return [self initWithMantissa: -value
|
||||
exponent: 0
|
||||
isNegative: YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
return [self initWithMantissa: value
|
||||
exponent: 0
|
||||
isNegative: NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithUnsignedChar: (unsigned char)value
|
||||
{
|
||||
return [self initWithMantissa: value
|
||||
exponent: 0
|
||||
isNegative: NO];
|
||||
}
|
||||
|
||||
- (id) initWithUnsignedInt: (unsigned int)value
|
||||
{
|
||||
return [self initWithMantissa: value
|
||||
exponent: 0
|
||||
isNegative: NO];
|
||||
}
|
||||
|
||||
- (id) initWithUnsignedLong: (unsigned long)value
|
||||
{
|
||||
return [self initWithMantissa: value
|
||||
exponent: 0
|
||||
isNegative: NO];
|
||||
}
|
||||
|
||||
- (id) initWithUnsignedLongLong: (unsigned long long)value
|
||||
{
|
||||
return [self initWithMantissa: value
|
||||
exponent: 0
|
||||
isNegative: NO];
|
||||
}
|
||||
|
||||
- (id) initWithUnsignedShort: (unsigned short)value
|
||||
{
|
||||
return [self initWithMantissa: value
|
||||
exponent: 0
|
||||
isNegative: NO];
|
||||
}
|
||||
|
||||
- (NSString*) descriptionWithLocale: (NSDictionary*)locale
|
||||
{
|
||||
return NSDecimalString(&data, locale);
|
||||
|
|
|
@ -484,6 +484,10 @@ static NSDistributedNotificationCenter *netCenter = nil;
|
|||
|
||||
@implementation NSDistributedNotificationCenter (Private)
|
||||
|
||||
/**
|
||||
* Establish a connection to the server. This method should only be called
|
||||
* when protected by the centres lock, so that it is thread-safe.
|
||||
*/
|
||||
- (void) _connect
|
||||
{
|
||||
if (_remote == nil)
|
||||
|
@ -574,6 +578,12 @@ static NSDistributedNotificationCenter *netCenter = nil;
|
|||
Protocol *p = @protocol(GDNCProtocol);
|
||||
|
||||
[_remote setProtocolForProxy: p];
|
||||
|
||||
/*
|
||||
* Ensure that this center can be used safely from different
|
||||
* threads.
|
||||
*/
|
||||
[c enableMultipleThreads];
|
||||
|
||||
/*
|
||||
* Ask to be told if the connection goes away.
|
||||
|
|
|
@ -1243,10 +1243,14 @@ static NSFileManager* defaultManager = nil;
|
|||
}
|
||||
return (res & FILE_ATTRIBUTE_READONLY) ? NO : YES;
|
||||
#else
|
||||
cpath = [self fileSystemRepresentationWithPath:
|
||||
[path stringByDeletingLastPathComponent]];
|
||||
path = [path stringByDeletingLastPathComponent];
|
||||
if ([path length] == 0)
|
||||
{
|
||||
path = @".";
|
||||
}
|
||||
cpath = [self fileSystemRepresentationWithPath: path];
|
||||
|
||||
return (access(cpath, X_OK || W_OK) != 0);
|
||||
return (access(cpath, X_OK | W_OK) == 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
#include <Foundation/NSKeyValueCoding.h>
|
||||
#include <Foundation/NSNull.h>
|
||||
|
||||
/** An exception for an unknown key */
|
||||
NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
|
||||
|
||||
/**
|
||||
* This describes an informal protocol for key-value coding.
|
||||
|
@ -58,19 +60,31 @@
|
|||
|
||||
- (id) handleQueryWithUnboundKey: (NSString*)aKey
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"%@ -- %@ 0x%x: Unable to find value for key \"%@\"",
|
||||
NSStringFromSelector(_cmd), NSStringFromClass([self class]), self, aKey];
|
||||
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
self,
|
||||
@"NSTargetObjectUserInfoKey",
|
||||
aKey,
|
||||
@"NSUnknownUserInfoKey",
|
||||
nil];
|
||||
NSException *exp = [NSException exceptionWithName: NSUnknownKeyException
|
||||
reason: @"Unable to find value for key"
|
||||
userInfo: dict];
|
||||
[exp raise];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) handleTakeValue: (id)anObject forUnboundKey: (NSString*)aKey
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"%@ -- %@ 0x%x: Unable set value \"%@\" for key \"%@\"",
|
||||
NSStringFromSelector(_cmd), NSStringFromClass([self class]),
|
||||
self, anObject, aKey];
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
anObject,
|
||||
@"NSTargetObjectUserInfoKey",
|
||||
aKey,
|
||||
@"NSUnknownUserInfoKey",
|
||||
nil];
|
||||
NSException *exp = [NSException exceptionWithName: NSUnknownKeyException
|
||||
reason: @"Unable to set value for key"
|
||||
userInfo: dict];
|
||||
[exp raise];
|
||||
}
|
||||
|
||||
- (id) storedValueForKey: (NSString*)aKey
|
||||
|
|
|
@ -178,31 +178,70 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
{
|
||||
free(_gnu_arg_zero);
|
||||
}
|
||||
_gnu_arg_zero = (char*)malloc(strlen(argv[0]) + 1);
|
||||
strcpy(_gnu_arg_zero, argv[0]);
|
||||
|
||||
if (argv != 0)
|
||||
{
|
||||
_gnu_arg_zero = (char*)malloc(strlen(argv[0]) + 1);
|
||||
strcpy(_gnu_arg_zero, argv[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef __MINGW__
|
||||
char *buffer;
|
||||
int buffer_size = 0;
|
||||
int needed_size = 0;
|
||||
|
||||
while (needed_size == buffer_size)
|
||||
{
|
||||
buffer_size = buffer_size + 256;
|
||||
buffer = (char*)malloc(buffer_size);
|
||||
needed_size = GetModuleFileNameA(NULL, buffer, buffer_size);
|
||||
if (needed_size < buffer_size)
|
||||
{
|
||||
_gnu_arg_zero = buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
#else
|
||||
fprintf(stderr, "Error: for some reason, argv == NULL "
|
||||
"during GNUstep base initialization\n");
|
||||
abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Getting the process name */
|
||||
IF_NO_GC(RELEASE(_gnu_processName));
|
||||
_gnu_processName = [[NSString stringWithCString: argv[0]] lastPathComponent];
|
||||
_gnu_processName
|
||||
= [[NSString stringWithCString: _gnu_arg_zero] lastPathComponent];
|
||||
IF_NO_GC(RETAIN(_gnu_processName));
|
||||
|
||||
|
||||
/* Copy the argument list */
|
||||
{
|
||||
NSString *str;
|
||||
NSMutableSet *mySet;
|
||||
id obj_argv[argc];
|
||||
int added = 0;
|
||||
int added = 1;
|
||||
|
||||
mySet = [NSMutableSet new];
|
||||
for (i = 0; i < argc; i++)
|
||||
|
||||
/* Copy the zero'th argument to the argument list */
|
||||
str = [NSString stringWithCString: _gnu_arg_zero];
|
||||
obj_argv[0] = str;
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
NSString *str = [NSString stringWithCString: argv[i]];
|
||||
str = [NSString stringWithCString: argv[i]];
|
||||
|
||||
if ([str hasPrefix: @"--GNU-Debug="])
|
||||
[mySet addObject: [str substringFromIndex: 12]];
|
||||
else
|
||||
obj_argv[added++] = str;
|
||||
}
|
||||
|
||||
IF_NO_GC(RELEASE(_gnu_arguments));
|
||||
_gnu_arguments = [[NSArray alloc] initWithObjects: obj_argv count: added];
|
||||
IF_NO_GC(RELEASE(_debug_set));
|
||||
|
@ -710,6 +749,10 @@ int main(int argc, char *argv[], char *env[])
|
|||
{
|
||||
os = NSBeOperatingSystem;
|
||||
}
|
||||
else if ([n hasPrefix: @"darwin"] == YES)
|
||||
{
|
||||
os = NSMACHOperatingSystem;
|
||||
}
|
||||
else if ([n hasPrefix: @"solaris"] == YES)
|
||||
{
|
||||
os = NSSolarisOperatingSystem;
|
||||
|
|
|
@ -410,10 +410,8 @@ static BOOL shouldBeCompact = NO;
|
|||
* Variables to cache class information.
|
||||
*/
|
||||
static BOOL uniquing = NO; /* Make incoming strings unique */
|
||||
static Class IACls = 0; /* Immutable Array */
|
||||
static Class MACls = 0; /* Mutable Array */
|
||||
static Class DCls = 0; /* Data */
|
||||
static Class IDCls = 0; /* Immutable Dictionary */
|
||||
static Class MDCls = 0; /* Mutable Dictionary */
|
||||
static Class USCls = 0; /* Unicode String */
|
||||
static Class CSCls = 0; /* C String */
|
||||
|
@ -433,29 +431,57 @@ static SEL deiSel;
|
|||
static SEL csInitSel;
|
||||
static SEL usInitSel;
|
||||
static SEL dInitSel;
|
||||
static SEL iaInitSel;
|
||||
static SEL maInitSel;
|
||||
static SEL idInitSel;
|
||||
static SEL mdInitSel;
|
||||
static SEL maAddSel;
|
||||
static SEL mdSetSel;
|
||||
static IMP csInitImp;
|
||||
static IMP usInitImp;
|
||||
static IMP dInitImp;
|
||||
static IMP iaInitImp;
|
||||
static IMP maInitImp;
|
||||
static IMP idInitImp;
|
||||
static IMP mdInitImp;
|
||||
static IMP maAddImp;
|
||||
static IMP mdSetImp;
|
||||
|
||||
static void
|
||||
static BOOL
|
||||
initDeserializerInfo(_NSDeserializerInfo* info, NSData *d, unsigned *c, BOOL m)
|
||||
{
|
||||
unsigned char u;
|
||||
|
||||
info->data = d;
|
||||
info->cursor = c;
|
||||
info->mutable = m;
|
||||
info->debImp = (void (*)())[d methodForSelector: debSel];
|
||||
info->deiImp = (unsigned int (*)())[d methodForSelector: deiSel];
|
||||
(*info->debImp)(d, debSel, &info->didUnique, 1, c);
|
||||
(*info->debImp)(d, debSel, &u, 1, c);
|
||||
if (u == 0 || u == 1)
|
||||
{
|
||||
info->didUnique = u; // Old (current) format
|
||||
}
|
||||
else
|
||||
{
|
||||
if (u == 'G')
|
||||
{
|
||||
const unsigned char *b = [d bytes];
|
||||
unsigned int l = [d length];
|
||||
|
||||
if (*c + 11 < l && memcmp(&b[*c-1], "GNUstepSer", 10) == 0)
|
||||
{
|
||||
*c += 9;
|
||||
(*info->debImp)(d, debSel, &u, 1, c);
|
||||
NSLog(@"Serialised data version %d not supported ..."
|
||||
@" try another version of GNUstep");
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
NSLog(@"Bad serialised data");
|
||||
return NO;
|
||||
}
|
||||
if (info->didUnique)
|
||||
GSIArrayInitWithZoneAndCapacity(&info->array, NSDefaultMallocZone(), 16);
|
||||
{
|
||||
GSIArrayInitWithZoneAndCapacity(&info->array, NSDefaultMallocZone(), 16);
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -565,42 +591,31 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
|||
case ST_MARRAY:
|
||||
size = (*info->deiImp)(info->data, deiSel, info->cursor);
|
||||
{
|
||||
id objects[size];
|
||||
id a;
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
a = NSAllocateObject(MACls, 0, NSDefaultMallocZone());
|
||||
a = (*maInitImp)(a, maInitSel, size);
|
||||
if (a != nil)
|
||||
{
|
||||
objects[i] = deserializeFromInfo(info);
|
||||
if (objects[i] == nil)
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
#if !GS_WITH_GC
|
||||
while (i > 0)
|
||||
id o = deserializeFromInfo(info);
|
||||
|
||||
if (o == nil)
|
||||
{
|
||||
[objects[--i] release];
|
||||
RELEASE(a);
|
||||
return nil;
|
||||
}
|
||||
#endif
|
||||
objc_free(objects);
|
||||
return nil;
|
||||
(*maAddImp)(a, maAddSel, o);
|
||||
RELEASE(o);
|
||||
}
|
||||
if (code != ST_MARRAY && info->mutable == NO)
|
||||
{
|
||||
[a makeImmutableCopyOnFail: NO];
|
||||
}
|
||||
}
|
||||
if (code == ST_MARRAY || info->mutable)
|
||||
{
|
||||
a = NSAllocateObject(MACls, 0, NSDefaultMallocZone());
|
||||
a = (*maInitImp)(a, maInitSel, objects, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
a = NSAllocateObject(IACls, sizeof(id)*size,
|
||||
NSDefaultMallocZone());
|
||||
a = (*iaInitImp)(a, iaInitSel, objects, size);
|
||||
}
|
||||
#if !GS_WITH_GC
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
[objects[i] release];
|
||||
}
|
||||
#endif
|
||||
return a;
|
||||
}
|
||||
|
||||
|
@ -608,56 +623,46 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
|||
case ST_MDICT:
|
||||
size = (*info->deiImp)(info->data, deiSel, info->cursor);
|
||||
{
|
||||
id keys[size];
|
||||
id objects[size];
|
||||
id d;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
d = NSAllocateObject(MDCls, 0, NSDefaultMallocZone());
|
||||
d = (*mdInitImp)(d, mdInitSel, size);
|
||||
if (d != nil)
|
||||
{
|
||||
keys[i] = deserializeFromInfo(info);
|
||||
if (keys[i] == nil)
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
#if !GS_WITH_GC
|
||||
while (i > 0)
|
||||
id k = deserializeFromInfo(info);
|
||||
|
||||
if (k == nil)
|
||||
{
|
||||
[keys[--i] release];
|
||||
[objects[i] release];
|
||||
RELEASE(d);
|
||||
return nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
id o = deserializeFromInfo(info);
|
||||
|
||||
if (o == nil)
|
||||
{
|
||||
RELEASE(k);
|
||||
RELEASE(d);
|
||||
return nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
(*mdSetImp)(d, mdSetSel, o, k);
|
||||
RELEASE(k);
|
||||
RELEASE(o);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return nil;
|
||||
}
|
||||
objects[i] = deserializeFromInfo(info);
|
||||
if (objects[i] == nil)
|
||||
if (code != ST_MDICT && info->mutable == NO)
|
||||
{
|
||||
#if !GS_WITH_GC
|
||||
[keys[i] release];
|
||||
while (i > 0)
|
||||
{
|
||||
[keys[--i] release];
|
||||
[objects[i] release];
|
||||
}
|
||||
#endif
|
||||
return nil;
|
||||
[d makeImmutableCopyOnFail: NO];
|
||||
}
|
||||
}
|
||||
if (code == ST_MDICT || info->mutable)
|
||||
{
|
||||
d = NSAllocateObject(MDCls, 0, NSDefaultMallocZone());
|
||||
d = (*mdInitImp)(d, mdInitSel, objects, keys, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
d = NSAllocateObject(IDCls, 0, NSDefaultMallocZone());
|
||||
d = (*idInitImp)(d, idInitSel, objects, keys, size);
|
||||
}
|
||||
#if !GS_WITH_GC
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
[keys[i] release];
|
||||
[objects[i] release];
|
||||
}
|
||||
#endif
|
||||
return d;
|
||||
}
|
||||
|
||||
|
@ -728,8 +733,15 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
|||
_NSDeserializerProxy *proxy;
|
||||
|
||||
proxy = (_NSDeserializerProxy*)NSAllocateObject(self,0,NSDefaultMallocZone());
|
||||
initDeserializerInfo(&proxy->info, RETAIN(d), c, m);
|
||||
return AUTORELEASE(proxy);
|
||||
if (initDeserializerInfo(&proxy->info, RETAIN(d), c, m) == YES)
|
||||
{
|
||||
return AUTORELEASE(proxy);
|
||||
}
|
||||
else
|
||||
{
|
||||
DESTROY(proxy);
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
|
@ -784,24 +796,22 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
|||
csInitSel = @selector(initWithCStringNoCopy:length:freeWhenDone:);
|
||||
usInitSel = @selector(initWithCharactersNoCopy:length:freeWhenDone:);
|
||||
dInitSel = @selector(initWithBytesNoCopy:length:);
|
||||
iaInitSel = @selector(initWithObjects:count:);
|
||||
maInitSel = @selector(initWithObjects:count:);
|
||||
idInitSel = @selector(initWithObjects:forKeys:count:);
|
||||
mdInitSel = @selector(initWithObjects:forKeys:count:);
|
||||
IACls = [GSInlineArray class];
|
||||
maInitSel = @selector(initWithCapacity:);
|
||||
mdInitSel = @selector(initWithCapacity:);
|
||||
maAddSel = @selector(addObject:);
|
||||
mdSetSel = @selector(setObject:forKey:);
|
||||
MACls = [GSMutableArray class];
|
||||
DCls = [NSDataMalloc class];
|
||||
IDCls = [GSDictionary class];
|
||||
MDCls = [GSMutableDictionary class];
|
||||
USCls = [GSUnicodeString class];
|
||||
CSCls = [GSCString class];
|
||||
csInitImp = [CSCls instanceMethodForSelector: csInitSel];
|
||||
usInitImp = [USCls instanceMethodForSelector: usInitSel];
|
||||
dInitImp = [DCls instanceMethodForSelector: dInitSel];
|
||||
iaInitImp = [IACls instanceMethodForSelector: iaInitSel];
|
||||
maInitImp = [MACls instanceMethodForSelector: maInitSel];
|
||||
idInitImp = [IDCls instanceMethodForSelector: idInitSel];
|
||||
mdInitImp = [MDCls instanceMethodForSelector: mdInitSel];
|
||||
maAddImp = [MACls instanceMethodForSelector: maAddSel];
|
||||
mdSetImp = [MDCls instanceMethodForSelector: mdSetSel];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -817,10 +827,16 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
|||
return nil;
|
||||
}
|
||||
NSAssert(cursor != 0, NSInvalidArgumentException);
|
||||
initDeserializerInfo(&info, data, cursor, flag);
|
||||
o = deserializeFromInfo(&info);
|
||||
endDeserializerInfo(&info);
|
||||
return AUTORELEASE(o);
|
||||
if (initDeserializerInfo(&info, data, cursor, flag) == YES)
|
||||
{
|
||||
o = deserializeFromInfo(&info);
|
||||
endDeserializerInfo(&info);
|
||||
return AUTORELEASE(o);
|
||||
}
|
||||
else
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
+ (id) deserializePropertyListFromData: (NSData*)data
|
||||
|
@ -834,10 +850,16 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
|||
{
|
||||
return nil;
|
||||
}
|
||||
initDeserializerInfo(&info, data, &cursor, flag);
|
||||
o = deserializeFromInfo(&info);
|
||||
endDeserializerInfo(&info);
|
||||
return AUTORELEASE(o);
|
||||
if (initDeserializerInfo(&info, data, &cursor, flag) == YES)
|
||||
{
|
||||
o = deserializeFromInfo(&info);
|
||||
endDeserializerInfo(&info);
|
||||
return AUTORELEASE(o);
|
||||
}
|
||||
else
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
+ (id) deserializePropertyListLazilyFromData: (NSData*)data
|
||||
|
@ -855,10 +877,16 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
|||
_NSDeserializerInfo info;
|
||||
id o;
|
||||
|
||||
initDeserializerInfo(&info, data, cursor, flag);
|
||||
o = deserializeFromInfo(&info);
|
||||
endDeserializerInfo(&info);
|
||||
return AUTORELEASE(o);
|
||||
if (initDeserializerInfo(&info, data, cursor, flag) == YES)
|
||||
{
|
||||
o = deserializeFromInfo(&info);
|
||||
endDeserializerInfo(&info);
|
||||
return AUTORELEASE(o);
|
||||
}
|
||||
else
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -280,7 +280,7 @@ NSHomeDirectoryForUser(NSString *loginName)
|
|||
/* The environment variable HOMEPATH holds the home directory
|
||||
for the user on Windows NT; Win95 has no concept of home. */
|
||||
s = GSStringFromWin32EnvironmentVariable("HOMEPATH");
|
||||
if (s != nil)
|
||||
if (s != nil && ([s length] < 2 || [s characterAtIndex: 1] != ':'))
|
||||
{
|
||||
s = [GSStringFromWin32EnvironmentVariable("HOMEDRIVE")
|
||||
stringByAppendingString: s];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue