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:
CaS 2003-03-23 07:06:27 +00:00
parent 04e888af0a
commit cc098b74c2
38 changed files with 812 additions and 295 deletions

View file

@ -1,7 +1,7 @@
Announcement
************
The GNUstep Base Library, version 1.5.2, is now available.
The GNUstep Base Library, version 1.6.0, is now available.
What is the GNUstep Base Library?
=================================
@ -19,11 +19,11 @@ portion of the OpenStep standard (the Foundation library).
There is more information available at the GNUstep homepage at
`http://www.gnustep.org'.
Note that versions that have a odd minor release number are unstable
releases (like 1.5.2), which even minor release numbers (1.4.1) are
stable releases.
Note that versions that have a odd minor release number (the second
number, y, in x.y.z) are unstable releases (like 1.5.2), which even
minor release numbers (1.4.1) are stable releases.
Noteworthy changes in version `1.5.2'
Noteworthy changes in version `1.6.0'
=====================================
* More MinGW support
@ -41,7 +41,7 @@ Noteworthy changes in version `1.5.2'
Where can you get it? How can you compile it?
==============================================
The gnustep-base-1.5.2.tar.gz distribution file has been placed on
The gnustep-base-1.6.0.tar.gz distribution file has been placed on
`ftp.gnustep.org' in `pub/gnustep/core'.
Please log bug reports on the GNUstep project page

136
ChangeLog
View file

@ -1,3 +1,139 @@
2003-03-23 Richard Frith-Macdonald <rfm@gnu.org>
* Completed merge of changes from 1.6.0 branch.
2003-03-17 Adam Fedor <fedor@gnu.org>
* Version 1.6.0
2003-03-17 Adam Fedor <fedor@gnu.org>
* Testing/LoadMe.m (afterLoad): Use description, not name.
* Testing/nsfilemanager.m: Print some output. Clean up.
* Testing/scanner.m, nstimezone.m, release.m: Idem.
* config/config.vsprintf, config/config.vasprintf: Rewrite to
properly call a variable argument function.
2003-03-14 Adam Fedor <fedor@Eldorado.local.>
* Testing/nsarray.m (compare): Un-nest function.
* Source/NSProcessInfo.m (-operatingSystem): Add darwin.
2003-03-13 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSFileManager.m: ([-isDeletableFileAtPath:]) Fix for the
case where the path is a file in the current directory.
2003-03-11 Adam Fedor <fedor@gnu.org>
* configure.ac: Fix some typos (Reported by
Alexander Malmberg <alexander@malmberg.org>).
2003-03-07 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/gnustep/base/NSSet.h: Added a few non-openstep declarations
* Source/GSCompatibility.m: OAppend() sort dictionary keys even if
locale is nil.
2003-03-06 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSData.m: Fix reference to zone of deallocated object.
Bug reported by Roland Schwingel
* Source/NSFileManager.m: Fix typo (using logical or rather than
bitwise or) in call to access()
Bug reported by Roland Schwingel
2003-02-17 <woudshoo@agilisys.com>
* GNUmakefile (GNUSTEP_TARGET_INSTALL_PREFIX)
(GNUSTEP_TARGET_LOCAL_ROOT, GNUSTEP_TARGET_NETWORK_ROOT): On
mingw32 replace / with \\057 to avoid the msys shell translating /
with \.
2003-03-04 Richard Frith-Macdonald <rfm@gnu.org>
* config/config.vasprintf.c:
* config/config.vsprintf.c: Correct the number of arguments passed
so that modern compilers don't fail on these files. A compiler
failure is seen by configure as the same as a runtime failure, and
configure would infer incorrect runtime behavior!
2003-03-01 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSSerializer.m: Fix crash when deserializing a corrupt or
truncated archive ... raise exception rather than segfaulting.
Added code to recognize newer versions of the serialiser format and
give up if they are encountered and cannot be handled.
* Source/GSTcpPort.m: Added code to recognise newer versions of the
port format and give up if they are encountered and cannot be handled.
This allows for the addition of decent versioning in later formats.
2003-02-28 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/AGSParser.m: Fix to understand __attribute__() in declaration.
2003-02-27 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/AGSIndex.m: Convert nil content to empty strings before use.
* Tools/AGSHtml.m: ditto ... prevent some crashes.
2003-02-24 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSProcessInfo.m (_gnu_process_args): Tidied patch and add
code to print error and abort if argv is null under unixy systems.
2003-02-24 Tom Koelman <tkoelman@xs4all.nl>
* Source/NSProcessInfo.m (_gnu_process_args): If argv is 0 (e.g.
on MingW) set executable name using module name info.
2003-02-23 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUser.m: Don't prepend HOMEDRIVE to HOMEPATH if HOMEPATH
already contains a drive letter.
2003-02-22 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSObjCRuntime.m: GSObjCSetValue() correct to call
([unableToSetNilForKey:]) when it should.
* Source/NSDecimalNumber.m: Override initialisers from NSNumber to
create NSDecimalNumber objects ... bug report by David Ayers.
2003-02-21 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSDistributedNotificationCenter.m: ([_connect]) make the
connection to the server usable from any thread.
2003-02-19 Adam Fedor <fedor@gnu.org>
* Source/NSKeyValueCoding.m ([NSObject -handleQueryWithUnboundKey:]):
Raise NSUnknownKeyException.
([NSObject -handleTakeValue:forUnboundKey:]): Idem.
2003-02-18 Adam Fedor <fedor@gnu.org>
* Source/GSFFIInvocation.m (GSFFIInvocationCallback): Cast
invocation to access ivars correctly. Check validReturn.
2003-02-18 Tom Koelman <tkoelman@xs4all.nl>
* Source/NSProcessInfo.m (_gnu_process_args): If argv is 0 (e.g.
on MingW) set executable name to empty string.
2003-02-17 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSString.m: (fillHole) fix memory overrun (read only) and
argument order errors (in code not normally compiled) spotted by
Manuel Guesdon.
2003-03-23 Richard Frith-Macdonald <rfm@gnu.org>
* Start merged of changes from 1.6.0 branch.
2003-03-20 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSMime.m: (_unfoldHeader) Check that input pointer doesn't

View file

@ -22,7 +22,8 @@ portion of the OpenStep standard (the Foundation library).
There is more information available at the GNUstep homepage
at @samp{http://www.gnustep.org}.
Note that versions that have a odd minor release number are unstable
Note that versions that have a odd minor release number (the second number,
y, in x.y.z) are unstable
releases (like 1.5.2), which even minor release numbers (1.4.1) are stable
releases.

View file

@ -9,7 +9,7 @@ The currently released version of the library is
@samp{@value{GNUSTEP-BASE-VERSION}}.
@end ifclear
@section Noteworthy changes in version @samp{1.5.2}
@section Noteworthy changes in version @samp{1.6.0}
@itemize @bullet
@item More MinGW support

View file

@ -33,6 +33,8 @@
#ifndef STRICT_OPENSTEP
GS_EXPORT NSString* const NSUnknownKeyException;
@interface NSObject (NSKeyValueCoding)
+ (BOOL) accessInstanceVariablesDirectly;

View file

@ -38,12 +38,17 @@
+ (id) setWithArray: (NSArray*)objects;
+ (id) setWithObject: (id)anObject;
+ (id) setWithObjects: (id)firstObject, ...;
#ifndef STRICT_OPENSTEP
+ (id) setWithObjects: (id*)objects
count: (unsigned)count;
#endif
+ (id) setWithSet: (NSSet*)aSet;
- (NSArray*) allObjects;
- (id) anyObject;
- (BOOL) containsObject: (id)anObject;
- (unsigned) count;
- (NSString*) description;
- (NSString*) descriptionWithLocale: (NSDictionary*)locale;
- (id) initWithArray: (NSArray*)other;
@ -61,6 +66,10 @@
- (void) makeObjectsPerform: (SEL)aSelector;
- (void) makeObjectsPerform: (SEL)aSelector withObject: (id)argument;
#ifndef STRICT_OPENSTEP
- (void) makeObjectsPerformSelector: (SEL)aSelector;
- (void) makeObjectsPerformSelector: (SEL)aSelector withObject: (id)argument;
#endif
- (id) member: (id)anObject;
- (NSEnumerator*) objectEnumerator;

4
NEWS
View file

@ -1,9 +1,9 @@
News
****
The currently released version of the library is `1.5.2'.
The currently released version of the library is `1.6.0'.
Noteworthy changes in version `1.5.2'
Noteworthy changes in version `1.6.0'
=====================================
* More MinGW support

View file

@ -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
{

View file

@ -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="";\

View file

@ -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)

View file

@ -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++)
{

View file

@ -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. */

View file

@ -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;

View file

@ -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.
*/

View file

@ -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

View file

@ -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;
}

View file

@ -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);

View file

@ -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.

View file

@ -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
}
}

View file

@ -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

View file

@ -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;

View file

@ -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
{

View file

@ -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];

View file

@ -21,7 +21,7 @@
- afterLoad
{
printf("%s's instance variable is %i\n", [self name], var);
printf("%s's instance variable is %i\n", [self description], var);
return self;
}

View file

@ -4,6 +4,11 @@
#include <Foundation/NSString.h>
#include <Foundation/NSException.h>
int compare(id elem1, id elem2, void* context)
{
return (int)[elem1 performSelector:@selector(compare:) withObject:elem2];
}
int
main()
{
@ -129,11 +134,6 @@ main()
}
{
int compare(id elem1, id elem2, void* context)
{
return (int)[elem1 performSelector:@selector(compare:) withObject:elem2];
}
// Deriving new arrays
NSRange r = NSMakeRange(0, 3);

View file

@ -3,7 +3,6 @@
#include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSString.h>
#include <Foundation/NSTimeZone.h>
#include <Foundation/GSCategories.h>
#ifdef __MS_WIN32__
int _MB_init_runtime()

View file

@ -1,5 +1,7 @@
#include <Foundation/Foundation.h>
static int errors = 0;
@interface Handler : NSObject
- (BOOL) fileManager: (NSFileManager*)manager
shouldProceedAfterError: (NSString*)error;
@ -12,12 +14,14 @@ willProcessPath: (NSString*)path;
shouldProceedAfterError: (NSString*)error
{
NSLog(@"Error - %@", error);
errors++;
return NO;
}
- (BOOL) fileManager: (NSFileManager*)manager
willProcessPath: (NSString*)path
{
NSLog(@"Processing %@", path);
errors++;
return NO;
}
@end
@ -39,6 +43,7 @@ main ()
if ([mgr copyPath: src toPath: dst handler: handler] == NO)
{
NSLog(@"Copy %@ to %@ failed", src, dst);
errors++;
}
}
@ -48,10 +53,13 @@ main ()
if ([mgr removeFileAtPath: src handler: handler] == NO)
{
NSLog(@"Remove %@ failed", src);
errors++;
}
}
RELEASE(arp);
if (errors == 0)
printf("Tests passed\n");
exit (0);
}

View file

@ -953,5 +953,6 @@ main (int argc, char **argv)
runtest (testScanUpToString);
runtest (testScanCharactersFromSet);
runtest (testScanUpToCharactersFromSet);
printf("Finished Tests\n");
return 0;
}

View file

@ -1,6 +1,7 @@
/* Test time zone code. */
#include <stdio.h>
#include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSDate.h>
#include <Foundation/NSDictionary.h>
@ -10,6 +11,7 @@ int
main ()
{
id detail;
CREATE_AUTORELEASE_POOL(pool);
printf("time zones for PST:\n%s\n",
[[[[NSTimeZone abbreviationMap] objectForKey: @"PST"] description] UTF8String]);
@ -17,5 +19,6 @@ main ()
[[[NSTimeZone timeZoneArray] description] UTF8String]);
printf("local time zone:\n%s\n",
[[[NSTimeZone localTimeZone] description] UTF8String]);
RELEASE(pool);
return 0;
}

View file

@ -138,5 +138,6 @@ main ()
}
#endif
printf("Tests finished\n");
exit (0);
}

View file

@ -775,6 +775,7 @@ static NSMutableSet *textNodes = nil;
if (val == nil)
{
val = text;
if (val == nil) val = @"";
}
[buf appendString: [self makeAnchor: val ofType: @"label" name: @""]];
}
@ -844,6 +845,7 @@ static NSMutableSet *textNodes = nil;
{
NSString *content = [t content];
if (content == nil) content = @"";
str = [str stringByAppendingString: content];
}
t = [t next];
@ -1180,6 +1182,7 @@ static NSMutableSet *textNodes = nil;
if (val == nil)
{
val = text;
if (val == nil) val = @"";
}
[buf appendString:
[self makeAnchor: val ofType: @"label" name: text]];
@ -1219,6 +1222,7 @@ static NSMutableSet *textNodes = nil;
{
NSString *content = [t content];
if (content == nil) content = @"";
str = [str stringByAppendingString: content];
}
t = [t next];
@ -1333,6 +1337,7 @@ static NSMutableSet *textNodes = nil;
{
NSString *content = [t content];
if (content == nil) content = @"";
sel = [sel stringByAppendingString: content];
if (hadArg == YES)
{
@ -1356,7 +1361,10 @@ static NSMutableSet *textNodes = nil;
{
if ([t type] == XML_TEXT_NODE)
{
str = [str stringByAppendingString: [t content]];
NSString *content = [t content];
if (content == nil) content = @"";
str = [str stringByAppendingString: content];
}
t = [t next];
}
@ -1991,6 +1999,7 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
{
NSString *str = [node content];
if (str == nil) str = @"";
[buf appendString: str];
}
else if ([node type] == XML_ENTITY_REF_NODE)
@ -2043,6 +2052,7 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
{
NSString *text = [[node firstChild] content];
if (text == nil) text = @"";
[buf appendString: indent];
[buf appendString: @"<dd>"];
[buf appendString: [self protocolRef: text]];

View file

@ -274,6 +274,7 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
{
NSMutableDictionary *d;
NSString *k;
NSString *c;
d = [refs objectForKey: @"contents"];
if (d == nil)
@ -285,7 +286,9 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
k = [NSString stringWithFormat: @"%03u%03u%03u%03u",
chap, sect, ssect, sssect];
[d setObject: [[children content] stringByTrimmingSpaces] forKey: k];
c = [[children content] stringByTrimmingSpaces];
if (c == nil) c = @"";
[d setObject: c forKey: k];
children = nil;
}
else if ([name isEqual: @"ivariable"] == YES)
@ -303,6 +306,7 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
NSString *val;
text = [[children content] stringByTrimmingSpaces];
if (text == nil) text = @"";
children = nil;
all = [refs objectForKey: name];
if (all == nil)
@ -352,8 +356,11 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
{
if ([t type] == XML_TEXT_NODE)
{
sel = [sel stringByAppendingString:
[[t content] stringByTrimmingSpaces]];
NSString *s;
s = [[t content] stringByTrimmingSpaces];
if (s == nil) s = @"";
sel = [sel stringByAppendingString: s];
}
t = [t next];
}
@ -416,6 +423,7 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
else if ([name isEqual: @"title"] == YES)
{
NSMutableDictionary *d;
NSString *s;
d = [refs objectForKey: @"title"];
if (d == nil)
@ -425,8 +433,9 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
RELEASE(d);
}
[d setObject: [[children content] stringByTrimmingSpaces]
forKey: base];
s = [[children content] stringByTrimmingSpaces];
if (s == nil) s = @"";
[d setObject: s forKey: base];
children = nil;
}
else

View file

@ -1344,6 +1344,31 @@
}
}
if (buffer[pos] == '_')
{
NSString *ident = [self parseIdentifier];
if ([ident isEqualToString: @"__attribute__"] == YES)
{
[self skipSpaces];
if (pos < length && buffer[pos] == '(')
{
[self skipBlock];
[self skipSpaces];
}
}
else
{
[self log: @"Underscore is not from __attribute__"];
goto fail;
}
if (pos >= length)
{
[self log: @"Unexpected end of declaration"];
goto fail;
}
}
if (buffer[pos] == ';')
{
[self skipStatement];

View file

@ -6,8 +6,8 @@ GCC_VERSION=2.8.0
# The version number of this release.
MAJOR_VERSION=1
MINOR_VERSION=5
SUBMINOR_VERSION=2
MINOR_VERSION=6
SUBMINOR_VERSION=0
GNUSTEP_BASE_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION}
VERSION=${GNUSTEP_BASE_VERSION}

View file

@ -1,10 +1,23 @@
/* Exit with status 0 if vasprintf returns the length of the string printed.
Some systems return a pointer to the string instead. */
#include <stdio.h>
#include <stdarg.h>
int main ()
static int func(const char *fmt, ...)
{
va_list ap;
char *buf;
if (vasprintf (&buf, "1234") == 4)
int result;
va_start(ap, fmt);
result = vasprintf(&buf, fmt, ap);
va_end(ap);
return result;
}
int main()
{
if (func("1234", 0) == 4)
exit (0);
exit (-1);
}

View file

@ -1,10 +1,23 @@
/* Exit with status 0 if vsprintf returns the length of the string printed.
Some systems return a pointer to the string instead. */
#include <stdio.h>
#include <stdarg.h>
int main ()
static int func(const char *fmt, ...)
{
va_list ap;
char buf[128];
if (vsprintf (buf, "1234") == 4)
int result;
va_start(ap, fmt);
result = vsprintf(buf, fmt, ap);
va_end(ap);
return result;
}
int main()
{
if (func("1234", 0) == 4)
exit (0);
exit (-1);
}

6
configure vendored
View file

@ -2656,7 +2656,7 @@ fi
# The following one is so that headers of custom libraries into
# $GNUSTEP_HDIR are used before the standard ones
#
CPPFLAGS="$CPPFLAGS -I $GNUSTEP_HDIR"
CPPFLAGS="$CPPFLAGS -I$GNUSTEP_HDIR"
LDFLAGS="$LDFLAGS -L$GNUSTEP_LDIR/$LIBRARY_COMBO -L$GNUSTEP_LDIR"
#--------------------------------------------------------------------
@ -6020,7 +6020,7 @@ else
# 64-bit ints not supported - but we need a dummy type for byte-swapping
# of 64-bit values arriving from another system.
GS_SINT64="struct { gsu8 a8; }"
GS_SINT64="struct { gsu8 a9; }"
GS_SINT64="struct { gsu8 a8; }"
GS_HAVE_I64=0
fi
fi
@ -6099,7 +6099,7 @@ if test $ac_cv_sizeof_long = 4; then
else
if test $ac_cv_sizeof_long = 8; then
_GSC_S_LNG=_GSC_I64
v else
else
if test $ac_cv_sizeof_long = 16; then
_GSC_S_LNG=_GSC_I128
fi

View file

@ -369,7 +369,7 @@ if test $ac_cv_sizeof_long = 4; then
else
if test $ac_cv_sizeof_long = 8; then
_GSC_S_LNG=_GSC_I64
v else
else
if test $ac_cv_sizeof_long = 16; then
_GSC_S_LNG=_GSC_I128
fi