Mostly tidying

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4465 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-06-24 19:30:29 +00:00
parent 4d85cbdec2
commit 24f59ea2a0
46 changed files with 1406 additions and 1020 deletions

View file

@ -1,3 +1,52 @@
Thu Jun 24 20:30:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/include/GSIMap.h: Tweaks to avoid compiler warnings.
* Source/include/NSNotification.h: ditto.
* Source/propList.h: ditto.
* Source/Collection.m: ditto.
* Source/TcpPort.m: ditto.
* Source/UnixFileHandle.m: ditto.
* Source/NSArchiver.m: ditto.
* Source/NSArchiver.m: ditto.
* Source/NSCalendarDate.m: ditto.
* Source/NSCoder.m: ditto.
* Source/NSConcreteValue.m: ditto.
* Source/NSConnection.m: ditto.
* Source/NSData.m: ditto.
* Source/NSDate.m: ditto.
* Source/NSDictionary.m: ditto.
* Source/NSDistributedNotificationCenter.m: ditto.
* Source/NSGAttributedString.m: ditto.
* Source/NSGCountedSet.m: ditto.
* Source/NSGCString.m: ditto.
* Source/NSGDictionary.m: ditto.
* Source/NSHost.m: ditto.
* Source/NSLock.m: ditto.
* Source/NSNotificationCenter.m: ditto.
* Source/NSNotificationQueue.m: ditto.
* Source/NSNumber.m: ditto.
* Source/NSObjCRuntime.m: ditto.
* Source/NSObject.m: ditto.
* Source/NSPage.m: ditto.
* Source/NSPortNameServer.m: ditto.
* Source/NSScanner.m: ditto.
* Source/NSSerializer.m: ditto.
* Source/NSString.m: ditto.
* Source/NSTask.m: ditto.
* Source/NSTimeZone.m: ditto.
* Source/NSThread.m: ditto.
* Source/NSUnarchiver.m: ditto.
* Source/NSURL.m: ditto.
* Source/NSURLHandle.m: ditto.
* Source/NSUserDefaults.m: ditto.
* Source/NSZone.m: ditto.
* Tools/gdomap.c: ditto.
* Tools/gdnc.m: ditto.
* Tools/plparse.m: ditto.
* Tools/sfparse.m: ditto.
* Tools/pldes.m: ditto.
* Tools/plser.m: ditto.
1999-06-24 Adam Fedor <fedor@gnu.org> 1999-06-24 Adam Fedor <fedor@gnu.org>
* Source/include/GSIArray.h (GSIArrayRemoveLastItem): New function. * Source/include/GSIArray.h (GSIArrayRemoveLastItem): New function.

View file

@ -741,7 +741,7 @@ GSIMapEmptyMap(GSIMapTable map)
map->zone = 0; map->zone = 0;
} }
static INLINE GSIMapTable static INLINE void
GSIMapInitWithZoneAndCapacity(GSIMapTable map, NSZone *zone, size_t capacity) GSIMapInitWithZoneAndCapacity(GSIMapTable map, NSZone *zone, size_t capacity)
{ {
map->zone = zone; map->zone = zone;

View file

@ -58,11 +58,7 @@
@interface NSNotificationCenter : NSObject <GCFinalization> @interface NSNotificationCenter : NSObject <GCFinalization>
{ {
void *wildcard; /* Observations matching anything. */ void *table;
NSMapTable *nameless; /* Observations matching objects. */
void *named; /* Observations matching names. */
NSMapTable *observers; /* Observations keyed by observer. */
NSLock *_lock;
} }
+ (NSNotificationCenter*) defaultCenter; + (NSNotificationCenter*) defaultCenter;
@ -86,4 +82,28 @@
@end @end
#ifndef NO_GNUSTEP
@interface NSNotification (GNUstep)
- (id) initWithName: (NSString*)name
object: (id)object
userInfo: (NSDictionary*)user_info;
@end
@interface NSNotificationCenter (GNUstep)
/*
* Extensions for maximising posting performance - these options are
* NOT adjustable for the default notification center.
*
* You can disable locking in a multi-threaded program if you KNOW that only
* one thread will ever use the notification center.
*
* You can turn on 'immutability' if you KNOW that the posting of a
* notification will never result in an attempt to modify the center.
* In this case, the center can optimise delivery of notifications.
*/
- (BOOL) setImmutableInPost: (BOOL)flag;
- (BOOL) setLockingDisabled: (BOOL)flag;
@end
#endif
#endif /*__NSNotification_h_GNUSTEP_BASE_INCLUDE */ #endif /*__NSNotification_h_GNUSTEP_BASE_INCLUDE */

View file

@ -537,7 +537,7 @@
been -shallowCopy'ed can cause major memory leakage. */ been -shallowCopy'ed can cause major memory leakage. */
- copyAs: (id <Collecting>)aCollectionClass - copyAs: (id <Collecting>)aCollectionClass
{ {
id newColl = [self emptyCopyAs:aCollectionClass]; id newColl = [self emptyCopyAs: (Class)aCollectionClass];
id o; id o;
FOR_COLLECTION(self, o) FOR_COLLECTION(self, o)

View file

@ -26,9 +26,9 @@
/* /*
* Setup for inline operation of pointer map tables. * Setup for inline operation of pointer map tables.
*/ */
#define GSI_MAP_RETAIN_KEY(X) X #define GSI_MAP_RETAIN_KEY(X)
#define GSI_MAP_RELEASE_KEY(X) #define GSI_MAP_RELEASE_KEY(X)
#define GSI_MAP_RETAIN_VAL(X) X #define GSI_MAP_RETAIN_VAL(X)
#define GSI_MAP_RELEASE_VAL(X) #define GSI_MAP_RELEASE_VAL(X)
#define GSI_MAP_HASH(X) ((X).uint) #define GSI_MAP_HASH(X) ((X).uint)
#define GSI_MAP_EQUAL(X,Y) ((X).uint == (Y).uint) #define GSI_MAP_EQUAL(X,Y) ((X).uint == (Y).uint)
@ -248,8 +248,6 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
- (void) encodeValueOfObjCType: (const char*)type - (void) encodeValueOfObjCType: (const char*)type
at: (const void*)buf at: (const void*)buf
{ {
uchar info;
switch (*type) switch (*type)
{ {
case _C_ID: case _C_ID:
@ -884,8 +882,6 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
- (void) resetArchiver - (void) resetArchiver
{ {
char buf[strlen(PREFIX)+33];
if (clsMap) if (clsMap)
{ {
GSIMapCleanMap(clsMap); GSIMapCleanMap(clsMap);

View file

@ -751,7 +751,7 @@
BOOL mtag = NO, dtag = NO, ycent = NO; BOOL mtag = NO, dtag = NO, ycent = NO;
BOOL mname = NO, dname = NO; BOOL mname = NO, dname = NO;
double s; double s;
int yd = 0, md = 0, dd = 0, mnd = 0, sd = 0, dom = -1, dow = -1, doy = -1; int yd = 0, md = 0, mnd = 0, sd = 0, dom = -1, dow = -1, doy = -1;
int hd = 0, nhd; int hd = 0, nhd;
int i, j, k, z; int i, j, k, z;

View file

@ -24,6 +24,7 @@
#include <config.h> #include <config.h>
#include <base/preface.h> #include <base/preface.h>
#include <base/behavior.h>
#include <Foundation/NSData.h> #include <Foundation/NSData.h>
#include <Foundation/NSCoder.h> #include <Foundation/NSCoder.h>
#include <Foundation/NSSerialization.h> #include <Foundation/NSSerialization.h>
@ -148,8 +149,8 @@
va_start(ap, types); va_start(ap, types);
while (*types) while (*types)
{ {
[self encodeValueOfObjCType:types (*imp)(self, @selector(encodeValueOfObjCType:at:), types,
at:va_arg(ap, void*)]; va_arg(ap, void*));
types = objc_skip_typespec(types); types = objc_skip_typespec(types);
} }
va_end(ap); va_end(ap);
@ -173,7 +174,6 @@
{ {
unsigned count; unsigned count;
const char *type = @encode(unsigned char); const char *type = @encode(unsigned char);
int i;
unsigned char *where; unsigned char *where;
unsigned char *array; unsigned char *array;
IMP imp = [self methodForSelector:@selector(decodeValueOfObjCType:at:)]; IMP imp = [self methodForSelector:@selector(decodeValueOfObjCType:at:)];

View file

@ -104,8 +104,6 @@
- (BOOL) isEqualToValue: (NSValue*)aValue - (BOOL) isEqualToValue: (NSValue*)aValue
{ {
const char* type;
if (fastClass(aValue) != fastClass(self)) if (fastClass(aValue) != fastClass(self))
return NO; return NO;
if (strcmp(objctype, ((NSConcreteValue*)aValue)->objctype) != 0) if (strcmp(objctype, ((NSConcreteValue*)aValue)->objctype) != 0)

View file

@ -187,7 +187,7 @@ static unsigned local_object_counter = 0;
@interface NSConnection (Private) @interface NSConnection (Private)
- _superInit; - _superInit;
- (void) handlePortMessage: (NSPortMessage*)msg; - (void) handlePortMessage: (NSPortMessage*)msg;
+ setDebug: (int)val; + (void) setDebug: (int)val;
@end @end
#define proxiesHashGate refGate #define proxiesHashGate refGate
@ -219,18 +219,6 @@ compare_ints (const void *k1, const void *k2)
return !(k1 - k2); return !(k1 - k2);
} }
static int
type_get_number_of_arguments (const char *type)
{
int i = 0;
while (*type)
{
type = objc_skip_argspec (type);
i += 1;
}
return i - 1;
}
/* class defaults */ /* class defaults */
static id default_receive_port_class; static id default_receive_port_class;
static id default_send_port_class; static id default_send_port_class;
@ -1124,7 +1112,7 @@ static int messages_received_count;
return self; return self;
} }
+ setDebug: (int)val + (void) setDebug: (int)val
{ {
debug_connection = val; debug_connection = val;
} }
@ -2040,7 +2028,6 @@ static int messages_received_count;
{ {
id op; id op;
id ip; id ip;
unsigned int i;
id result; id result;
int seq_num = [self _newMsgNumber]; int seq_num = [self _newMsgNumber];

View file

@ -1028,6 +1028,7 @@ failure:
fromZone: (NSZone*)zone fromZone: (NSZone*)zone
{ {
[self subclassResponsibility: _cmd]; [self subclassResponsibility: _cmd];
return nil;
} }
- (void) deserializeTypeTag: (unsigned char*)tag - (void) deserializeTypeTag: (unsigned char*)tag
@ -2261,8 +2262,6 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
- (id) initWithBytes: (const void*)aBuffer length: (unsigned)bufferSize - (id) initWithBytes: (const void*)aBuffer length: (unsigned)bufferSize
{ {
struct shmid_ds buf;
shmid = -1; shmid = -1;
if (aBuffer && bufferSize) if (aBuffer && bufferSize)
{ {
@ -2453,7 +2452,6 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
- (id) initWithCoder: (NSCoder*)aCoder - (id) initWithCoder: (NSCoder*)aCoder
{ {
unsigned l; unsigned l;
void *b;
[aCoder decodeValueOfObjCType: @encode(unsigned long) at: &l]; [aCoder decodeValueOfObjCType: @encode(unsigned long) at: &l];
if (l) if (l)
@ -2929,8 +2927,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
- (id) initWithCapacity: (unsigned)bufferSize - (id) initWithCapacity: (unsigned)bufferSize
{ {
struct shmid_ds buf; int e;
int e;
shmid = shmget(IPC_PRIVATE, bufferSize, IPC_CREAT|VM_ACCESS); shmid = shmget(IPC_PRIVATE, bufferSize, IPC_CREAT|VM_ACCESS);
if (shmid == -1) /* Created memory? */ if (shmid == -1) /* Created memory? */
@ -2992,9 +2989,8 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
{ {
if (size != capacity) if (size != capacity)
{ {
void *tmp; void *tmp;
struct shmid_ds buf; int newid;
int newid;
newid = shmget(IPC_PRIVATE, size, IPC_CREAT|VM_ACCESS); newid = shmget(IPC_PRIVATE, size, IPC_CREAT|VM_ACCESS);
if (newid == -1) /* Created memory? */ if (newid == -1) /* Created memory? */

View file

@ -192,8 +192,8 @@ GSTimeNow()
+ (id) dateWithNaturalLanguageString: (NSString*)string + (id) dateWithNaturalLanguageString: (NSString*)string
{ {
[self dateWithNaturalLanguageString: string return [self dateWithNaturalLanguageString: string
locale: nil]; locale: nil];
} }
+ (id) dateWithNaturalLanguageString: (NSString*)string + (id) dateWithNaturalLanguageString: (NSString*)string
@ -222,7 +222,6 @@ GSTimeNow()
int modYear = 0; int modYear = 0;
int modDay = 0; int modDay = 0;
int D, M, Y; int D, M, Y;
int modWeek;
int h = 12; int h = 12;
int m = 0; int m = 0;
int s = 0; int s = 0;
@ -366,7 +365,6 @@ GSTimeNow()
unsigned c = [ymw count]; unsigned c = [ymw count];
NSString *yname = [ymw objectAtIndex: 0]; NSString *yname = [ymw objectAtIndex: 0];
NSString *mname = c > 1 ? [ymw objectAtIndex: 1] : nil; NSString *mname = c > 1 ? [ymw objectAtIndex: 1] : nil;
NSString *wname = c > 2 ? [ymw objectAtIndex: 2] : nil;
NSArray *early = [locale objectForKey: NSEarlierTimeDesignations]; NSArray *early = [locale objectForKey: NSEarlierTimeDesignations];
NSArray *later = [locale objectForKey: NSLaterTimeDesignations]; NSArray *later = [locale objectForKey: NSLaterTimeDesignations];
@ -1242,10 +1240,11 @@ GSTimeNow()
return self; return self;
} }
- (id) allocWithZone: (NSZone*)z + (id) allocWithZone: (NSZone*)z
{ {
[NSException raise: NSInternalInconsistencyException [NSException raise: NSInternalInconsistencyException
format: @"Attempt to allocate fixed date"]; format: @"Attempt to allocate fixed date"];
return nil;
} }
- (id) copyWithZone: (NSZone*)z - (id) copyWithZone: (NSZone*)z

View file

@ -166,11 +166,10 @@ static Class NSMutableDictionary_concrete_class;
return [self count]; return [self count];
} }
- initWithObjects: (NSArray*)objects forKeys: (NSArray*)keys - (id) initWithObjects: (NSArray*)objects forKeys: (NSArray*)keys
{ {
int objectCount = [objects count]; int objectCount = [objects count];
id os[objectCount], ks[objectCount]; id os[objectCount], ks[objectCount];
int i;
if (objectCount != [keys count]) if (objectCount != [keys count])
{ {
@ -465,7 +464,7 @@ compareIt(id o1, id o2, void* context)
return (int)[o1 performSelector: f->s withObject: o2]; return (int)[o1 performSelector: f->s withObject: o2];
} }
- (NSArray*)keysSortedByValueUsingSelector: (SEL)comp - (NSArray*) keysSortedByValueUsingSelector: (SEL)comp
{ {
struct foo info; struct foo info;
id k; id k;
@ -474,6 +473,7 @@ compareIt(id o1, id o2, void* context)
info.s = comp; info.s = comp;
info.i = [self methodForSelector: @selector(objectForKey:)]; info.i = [self methodForSelector: @selector(objectForKey:)];
k = [[self allKeys] sortedArrayUsingFunction: compareIt context: &info]; k = [[self allKeys] sortedArrayUsingFunction: compareIt context: &info];
return k;
} }
- (NSArray*) objectsForKeys: (NSArray*)keys notFoundMarker: (id)marker - (NSArray*) objectsForKeys: (NSArray*)keys notFoundMarker: (id)marker

View file

@ -52,7 +52,7 @@ NSString *NSLocalNotificationCenterType =
@interface NSDistributedNotificationCenter (Private) @interface NSDistributedNotificationCenter (Private)
- (void) _connect; - (void) _connect;
- (id) _invalidated: (NSNotification*)notification; - (void) _invalidated: (NSNotification*)notification;
- (void) postNotificationName: (NSString*)name - (void) postNotificationName: (NSString*)name
object: (NSString*)object object: (NSString*)object
userInfo: (NSData*)info userInfo: (NSData*)info
@ -369,7 +369,7 @@ NSLog(@"Connection to GDNC server established.\n");
} }
} }
- (id) _invalidated: (NSNotification*)notification - (void) _invalidated: (NSNotification*)notification
{ {
id connection = [notification object]; id connection = [notification object];

View file

@ -494,7 +494,7 @@ _attributesAtIndexEffectiveRange(
- (void) replaceCharactersInRange: (NSRange)range - (void) replaceCharactersInRange: (NSRange)range
withString: (NSString*)aString withString: (NSString*)aString
{ {
unsigned tmpLength, arrayIndex, arraySize, cnt, location, moveLocations; unsigned tmpLength, arrayIndex, arraySize, cnt, moveLocations;
NSRange effectiveRange; NSRange effectiveRange;
NSDictionary *attrs; NSDictionary *attrs;
unsigned afterRangeLoc; unsigned afterRangeLoc;

View file

@ -929,7 +929,7 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
return obj; return obj;
} }
- mutableCopyWithZone: (NSZone*)z - (id) mutableCopyWithZone: (NSZone*)z
{ {
NSGMutableCString *obj; NSGMutableCString *obj;
@ -944,6 +944,7 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
obj->_hash = _hash; obj->_hash = _hash;
} }
} }
return obj;
} }
- (void) deleteCharactersInRange: (NSRange)range - (void) deleteCharactersInRange: (NSRange)range

View file

@ -31,7 +31,7 @@
#include <Foundation/NSPortCoder.h> #include <Foundation/NSPortCoder.h>
#define GSI_MAP_RETAIN_VAL(X) X #define GSI_MAP_RETAIN_VAL(X)
#define GSI_MAP_RELEASE_VAL(X) #define GSI_MAP_RELEASE_VAL(X)
#define GSI_MAP_KTYPES GSUNION_OBJ #define GSI_MAP_KTYPES GSUNION_OBJ
#define GSI_MAP_VTYPES GSUNION_INT #define GSI_MAP_VTYPES GSUNION_INT

View file

@ -30,6 +30,7 @@
#include <Foundation/NSException.h> #include <Foundation/NSException.h>
#include <Foundation/NSPortCoder.h> #include <Foundation/NSPortCoder.h>
#include <base/behavior.h>
#include <base/fast.x> #include <base/fast.x>
/* /*

View file

@ -39,6 +39,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h>
#endif /* __WIN32__ */ #endif /* __WIN32__ */
static NSLock *_hostCacheLock = nil; static NSLock *_hostCacheLock = nil;

View file

@ -199,8 +199,6 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
// Acquiring and release the lock // Acquiring and release the lock
- (void) lockWhenCondition: (int)value - (void) lockWhenCondition: (int)value
{ {
int result;
CHECK_RECURSIVE_CONDITION_LOCK (mutex); CHECK_RECURSIVE_CONDITION_LOCK (mutex);
if (objc_mutex_lock (mutex) == -1) if (objc_mutex_lock (mutex) == -1)

File diff suppressed because it is too large Load diff

View file

@ -97,7 +97,7 @@ currentList()
@implementation NotificationQueueList @implementation NotificationQueueList
+ (void)registerQueue: (NSNotificationQueue*)q + (void) registerQueue: (NSNotificationQueue*)q
{ {
NotificationQueueList* list; NotificationQueueList* list;
NotificationQueueList* elem; NotificationQueueList* elem;
@ -116,7 +116,8 @@ currentList()
if (list->queue == q) if (list->queue == q)
return; /* Queue already registered. */ return; /* Queue already registered. */
elem = NSAllocateObject(self, 0, NSDefaultMallocZone()); elem = (NotificationQueueList*)NSAllocateObject(self, 0,
NSDefaultMallocZone());
elem->queue = q; elem->queue = q;
list->next = elem; list->next = elem;
} }

View file

@ -22,6 +22,7 @@
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <string.h>
#include <config.h> #include <config.h>
#include <base/preface.h> #include <base/preface.h>
#include <base/fast.x> #include <base/fast.x>

View file

@ -70,6 +70,7 @@ NSGetSizeAndAlignment(const char *typePtr, unsigned *sizep, unsigned *alignp)
*sizep = info.size; *sizep = info.size;
if (alignp) if (alignp)
*alignp = info.align; *alignp = info.align;
return typePtr;
} }
BOOL BOOL

View file

@ -42,6 +42,8 @@
#include <base/fast.x> #include <base/fast.x>
extern BOOL __objc_responds_to(id, SEL);
fastCls _fastCls; /* Structure to cache classes. */ fastCls _fastCls; /* Structure to cache classes. */
fastImp _fastImp; /* Structure to cache methods. */ fastImp _fastImp; /* Structure to cache methods. */
@ -352,6 +354,9 @@ fastZone(NSObject *object)
inline NSObject * inline NSObject *
NSAllocateObject (Class aClass, unsigned extraBytes, NSZone *zone) NSAllocateObject (Class aClass, unsigned extraBytes, NSZone *zone)
{ {
#ifndef NDEBUG
extern void GSDebugAllocationAdd(Class);
#endif
id new = nil; id new = nil;
int size = aClass->instance_size + extraBytes + sizeof(struct obj_layout); int size = aClass->instance_size + extraBytes + sizeof(struct obj_layout);
if (CLS_ISCLASS (aClass)) if (CLS_ISCLASS (aClass))
@ -378,6 +383,9 @@ NSAllocateObject (Class aClass, unsigned extraBytes, NSZone *zone)
inline void inline void
NSDeallocateObject(NSObject *anObject) NSDeallocateObject(NSObject *anObject)
{ {
#ifndef NDEBUG
extern void GSDebugAllocationRemove(Class);
#endif
if ((anObject!=nil) && CLS_ISCLASS(((id)anObject)->class_pointer)) if ((anObject!=nil) && CLS_ISCLASS(((id)anObject)->class_pointer))
{ {
obj o = &((obj)anObject)[-1]; obj o = &((obj)anObject)[-1];

View file

@ -98,6 +98,10 @@ NSRoundUpToMultipleOfPageSize (unsigned bytes)
return ((bytes % a) ? ((bytes / a + 1) * a) : bytes); return ((bytes % a) ? ((bytes / a + 1) * a) : bytes);
} }
#if __linux__
#include <sys/sysinfo.h>
#endif
unsigned unsigned
NSRealMemoryAvailable () NSRealMemoryAvailable ()
{ {

View file

@ -39,6 +39,7 @@
#include <Foundation/NSTimer.h> #include <Foundation/NSTimer.h>
#include <Foundation/NSPortNameServer.h> #include <Foundation/NSPortNameServer.h>
#include <base/TcpPort.h> #include <base/TcpPort.h>
#include <arpa/inet.h>
/* /*
* Protocol definition stuff for talking to gdomap process. * Protocol definition stuff for talking to gdomap process.
@ -278,7 +279,7 @@ static NSPortNameServer *defaultServer = nil;
#ifndef HAVE_INET_ATON #ifndef HAVE_INET_ATON
svrs->s_addr = inet_addr("127.0.0.1"); svrs->s_addr = inet_addr("127.0.0.1");
#else #else
inet_aton("127.0.0.1", &svrs->s_addr); inet_aton("127.0.0.1", (struct in_addr *)&svrs->s_addr);
#endif #endif
} }
@ -549,6 +550,7 @@ static NSPortNameServer *defaultServer = nil;
NS_ENDHANDLER NS_ENDHANDLER
[self _close]; [self _close];
[serverLock unlock]; [serverLock unlock];
return YES;
} }
- (void) removePortForName: (NSString*)name - (void) removePortForName: (NSString*)name

View file

@ -510,7 +510,7 @@
if ((scanLocation < len) && ((c == 'e') || (c == 'E'))) if ((scanLocation < len) && ((c == 'e') || (c == 'E')))
{ {
int expval; int expval;
int expScanLocation = scanLocation;
scanLocation++; scanLocation++;
if ([self _scanInt: &expval]) if ([self _scanInt: &expval])
{ {

View file

@ -46,9 +46,9 @@
/* /*
* Setup for inline operation of string map tables. * Setup for inline operation of string map tables.
*/ */
#define GSI_MAP_RETAIN_KEY(X) X #define GSI_MAP_RETAIN_KEY(X)
#define GSI_MAP_RELEASE_KEY(X) #define GSI_MAP_RELEASE_KEY(X)
#define GSI_MAP_RETAIN_VAL(X) X #define GSI_MAP_RETAIN_VAL(X)
#define GSI_MAP_RELEASE_VAL(X) #define GSI_MAP_RELEASE_VAL(X)
#define GSI_MAP_HASH(X) [(X).obj hash] #define GSI_MAP_HASH(X) [(X).obj hash]
#define GSI_MAP_EQUAL(X,Y) [(X).obj isEqualToString: (Y).obj] #define GSI_MAP_EQUAL(X,Y) [(X).obj isEqualToString: (Y).obj]
@ -58,7 +58,7 @@
/* /*
* Setup for inline operation of string arrays. * Setup for inline operation of string arrays.
*/ */
#define GSI_ARRAY_RETAIN(X) X #define GSI_ARRAY_RETAIN(X)
#define GSI_ARRAY_RELEASE(X) #define GSI_ARRAY_RELEASE(X)
#define GSI_ARRAY_TYPES GSUNION_OBJ #define GSI_ARRAY_TYPES GSUNION_OBJ
@ -149,7 +149,7 @@ endSerializerInfo(_NSSerializerInfo* info)
GSIMapEmptyMap(&info->map); GSIMapEmptyMap(&info->map);
} }
static id static void
serializeToInfo(id object, _NSSerializerInfo* info) serializeToInfo(id object, _NSSerializerInfo* info)
{ {
Class c = fastClass(object); Class c = fastClass(object);

View file

@ -616,11 +616,9 @@ handle_printf_atsign (FILE *stream,
- (id) initWithContentsOfFile: (NSString*)path - (id) initWithContentsOfFile: (NSString*)path
{ {
unsigned char *buff;
NSStringEncoding enc; NSStringEncoding enc;
id d = [NSData dataWithContentsOfFile: path]; id d = [NSData dataWithContentsOfFile: path];
const unsigned char *test=[d bytes]; const unsigned char *test=[d bytes];
unsigned len = [d length];
if (d == nil) return nil; if (d == nil) return nil;
if (test && (((test[0]==0xFF) && (test[1]==0xFE)) || ((test[1]==0xFF) && (test[0]==0xFE)))) if (test && (((test[0]==0xFF) && (test[1]==0xFE)) || ((test[1]==0xFF) && (test[0]==0xFE))))
@ -1130,7 +1128,6 @@ handle_printf_atsign (FILE *stream,
forRange: (NSRange)aRange forRange: (NSRange)aRange
{ {
unichar thischar; unichar thischar;
BOOL done;
unsigned start, end, len; unsigned start, end, len;
len = [self length]; len = [self length];
@ -1139,50 +1136,54 @@ handle_printf_atsign (FILE *stream,
start = aRange.location; start = aRange.location;
if (startIndex) if (startIndex)
if (start==0) {
*startIndex=0; if (start==0)
else {
{ *startIndex=0;
start--; }
while (start > 0) else
{ {
BOOL done = NO; start--;
while (start > 0)
{
BOOL done = NO;
thischar = [self characterAtIndex: start]; thischar = [self characterAtIndex: start];
switch(thischar) switch(thischar)
{ {
case (unichar)0x000A: case (unichar)0x000A:
case (unichar)0x000D: case (unichar)0x000D:
case (unichar)0x2028: case (unichar)0x2028:
case (unichar)0x2029: case (unichar)0x2029:
done = YES; done = YES;
break; break;
default: default:
start--; start--;
break; break;
}; };
if (done) if (done)
break; break;
}; };
if (start == 0) if (start == 0)
{ {
thischar = [self characterAtIndex: start]; thischar = [self characterAtIndex: start];
switch(thischar) switch(thischar)
{ {
case (unichar)0x000A: case (unichar)0x000A:
case (unichar)0x000D: case (unichar)0x000D:
case (unichar)0x2028: case (unichar)0x2028:
case (unichar)0x2029: case (unichar)0x2029:
start++; start++;
break; break;
default: default:
break; break;
}; };
} }
else else
start++; start++;
*startIndex = start; *startIndex = start;
}; }
}
if (lineEndIndex || contentsEndIndex) if (lineEndIndex || contentsEndIndex)
{ {
@ -1759,7 +1760,6 @@ handle_printf_atsign (FILE *stream,
- (NSString*) stringByExpandingTildeInPath - (NSString*) stringByExpandingTildeInPath
{ {
unichar *s;
NSString *homedir; NSString *homedir;
NSRange first_slash_range; NSRange first_slash_range;

View file

@ -37,8 +37,11 @@
#include <Foundation/NSNotification.h> #include <Foundation/NSNotification.h>
#include <Foundation/NSNotificationQueue.h> #include <Foundation/NSNotificationQueue.h>
#include <Foundation/NSTask.h> #include <Foundation/NSTask.h>
#include <Foundation/NSLock.h>
#include <Foundation/NSDebug.h> #include <Foundation/NSDebug.h>
#include <string.h>
#include <unistd.h>
#include <sys/signal.h> #include <sys/signal.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@ -548,7 +551,7 @@ extern char *objc_find_executable(const char *name);
} }
chdir(path); chdir(path);
execve(executable, args, envl); execve(executable, (char**)args, (char**)envl);
exit(-1); exit(-1);
} }
else else

View file

@ -26,6 +26,7 @@
#include <config.h> #include <config.h>
#include <base/preface.h> #include <base/preface.h>
#include <unistd.h>
#include <Foundation/NSThread.h> #include <Foundation/NSThread.h>
#include <Foundation/NSLock.h> #include <Foundation/NSLock.h>
#include <Foundation/NSString.h> #include <Foundation/NSString.h>

View file

@ -729,7 +729,7 @@ decode (const void *ptr)
detail = [[NSConcreteTimeZoneDetail alloc] detail = [[NSConcreteTimeZoneDetail alloc]
initWithTimeZone: zone initWithTimeZone: zone
withAbbrev: abbrevsArray[types[i].abbr_idx] withAbbrev: abbrevsArray[(int)types[i].abbr_idx]
withOffset: types[i].offset withOffset: types[i].offset
withDST: (types[i].isdst > 0)]; withDST: (types[i].isdst > 0)];
[detailsArray addObject: detail]; [detailsArray addObject: detail];

View file

@ -1,7 +1,7 @@
/* NSUrl.m - Class NSURL /* NSUrl.m - Class NSURL
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@sbuilders.com>
Date: Jan 1999 Date: Jan 1999
This file is part of the GNUstep Library. This file is part of the GNUstep Library.
@ -22,7 +22,7 @@
*/ */
/* /*
Note from Manuel Guesdon: Note from Manuel Guesdon:
* I've made some test to compare apple NSURL results * I've made some test to compare apple NSURL results
and GNUstep NSURL results but as there this class is not very documented, some and GNUstep NSURL results but as there this class is not very documented, some
function may be incorrect function may be incorrect
@ -52,448 +52,449 @@ NSString* NSURLPartKey_fragment=@"fragment";
NSString* NSURLPartKey_parameterString=@"parameterString"; NSString* NSURLPartKey_parameterString=@"parameterString";
NSString* NSURLPartKey_query=@"query"; NSString* NSURLPartKey_query=@"query";
//=================================================================================== //=============================================================================
@implementation NSURL @implementation NSURL
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
+(id)fileURLWithPath:(NSString*)_path + (id) fileURLWithPath: (NSString*)_path
{ {
return [[[NSURL alloc] initFileURLWithPath:_path] return [[[NSURL alloc] initFileURLWithPath: _path]
autorelease]; autorelease];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
+(id)URLWithString:(NSString*)_urlString + (id)URLWithString: (NSString*)_urlString
{ {
return [[[NSURL alloc] initWithString:_urlString] return [[[NSURL alloc] initWithString: _urlString]
autorelease]; autorelease];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
+(id)URLWithString:(NSString*)_urlString + (id)URLWithString: (NSString*)_urlString
relativeToURL:(NSURL*)_baseURL relativeToURL: (NSURL*)_baseURL
{ {
return [[[NSURL alloc] initWithString:_urlString return [[[NSURL alloc] initWithString: _urlString
relativeToURL:_baseURL] relativeToURL: _baseURL]
autorelease]; autorelease];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(id)initWithScheme:(NSString*)_scheme - (id) initWithScheme: (NSString*)_scheme
host:(NSString*)_host host: (NSString*)_host
path:(NSString*)_path path: (NSString*)_path
{ {
NSString* _urlString=nil; NSString* _urlString=nil;
if (_host) if (_host)
_urlString=[NSString stringWithFormat:@"%@://%@",_scheme,_host]; _urlString=[NSString stringWithFormat: @"%@: //%@",_scheme,_host];
else else
_urlString=[NSString stringWithFormat:@"%@:",_scheme]; _urlString=[NSString stringWithFormat: @"%@: ",_scheme];
if (_path) if (_path)
_urlString=[_urlString stringByAppendingString:_path]; _urlString=[_urlString stringByAppendingString: _path];
self=[self initWithString:_urlString]; self=[self initWithString: _urlString];
return self; return self;
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//Non Standard Function //Non Standard Function
-(id)initWithScheme:(NSString*)_scheme - (id) initWithScheme: (NSString*)_scheme
host:(NSString*)_host host: (NSString*)_host
port:(NSNumber*)_port port: (NSNumber*)_port
path:(NSString*)_path path: (NSString*)_path
{ {
NSString* tmpHost=nil; NSString* tmpHost=nil;
if (_port) if (_port)
tmpHost=[NSString stringWithFormat:@"%@:%@",_host,_port]; tmpHost=[NSString stringWithFormat: @"%@: %@",_host,_port];
else else
tmpHost=_host; tmpHost=_host;
self=[self initWithScheme:_scheme self=[self initWithScheme: _scheme
host:tmpHost host: tmpHost
path:_path]; path: _path];
return self; return self;
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//Do a initWithScheme:NSFileScheme host:nil path:_path //Do a initWithScheme: NSFileScheme host: nil path: _path
-(id)initFileURLWithPath:(NSString*)_path - (id) initFileURLWithPath: (NSString*)_path
{ {
self=[self initWithScheme:NSURLFileScheme self=[self initWithScheme: NSURLFileScheme
host:nil host: nil
path:_path]; path: _path];
return self; return self;
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// urlString is escaped // urlString is escaped
-(id)initWithString:(NSString*)_urlString - (id) initWithString: (NSString*)_urlString
{ {
self=[self init]; self=[self init];
ASSIGNCOPY(urlString,_urlString); ASSIGNCOPY(urlString,_urlString);
return self; return self;
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//urlString!=nil //urlString!=nil
// urlString is escaped // urlString is escaped
-(id)initWithString:(NSString*)_urlString - (id) initWithString: (NSString*)_urlString
relativeToURL:(NSURL*)_baseURL relativeToURL: (NSURL*)_baseURL
{ {
self=[self init]; self=[self init];
ASSIGNCOPY(urlString,_urlString); ASSIGNCOPY(urlString,_urlString);
ASSIGNCOPY(baseURL,_baseURL); ASSIGNCOPY(baseURL,_baseURL);
return self; return self;
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)dealloc - (void) dealloc
{ {
DESTROY(urlString); DESTROY(urlString);
DESTROY(baseURL); DESTROY(baseURL);
[super dealloc]; [super dealloc];
} }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(id)copyWithZone: (NSZone*)zone - (id) copyWithZone: (NSZone*)zone
{ {
if (NSShouldRetainWithZone(self, zone) == NO) if (NSShouldRetainWithZone(self, zone) == NO)
return [[isa allocWithZone: zone] initWithString:urlString return [[isa allocWithZone: zone] initWithString: urlString
relativeToURL:baseURL]; relativeToURL: baseURL];
else else
return [self retain]; return [self retain];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)encodeWithCoder:(NSCoder*)aCoder - (void) encodeWithCoder: (NSCoder*)aCoder
{ {
[super encodeWithCoder: aCoder]; [super encodeWithCoder: aCoder];
[aCoder encodeObject:urlString]; [aCoder encodeObject: urlString];
[aCoder encodeObject:baseURL]; [aCoder encodeObject: baseURL];
//FIXME? clients ? //FIXME? clients ?
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(id)initWithCoder: (NSCoder*)aCoder - (id) initWithCoder: (NSCoder*)aCoder
{ {
self = [super initWithCoder: aCoder]; self = [super initWithCoder: aCoder];
[aCoder decodeValueOfObjCType: @encode(id) at:&urlString]; [aCoder decodeValueOfObjCType: @encode(id) at: &urlString];
[aCoder decodeValueOfObjCType: @encode(id) at:&baseURL]; [aCoder decodeValueOfObjCType: @encode(id) at: &baseURL];
//FIXME? clients ? //FIXME? clients ?
return self; return self;
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSString*)description - (NSString*) description
{ {
NSString* dscr=urlString; NSString* dscr=urlString;
if (baseURL) if (baseURL)
dscr=[dscr stringByAppendingFormat:@" -- %@",baseURL]; dscr=[dscr stringByAppendingFormat: @" -- %@",baseURL];
return dscr; return dscr;
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Non Standard Function // Non Standard Function
-(NSString*)baseURLAbsolutePart - (NSString*) baseURLAbsolutePart
{ {
if (baseURL) if (baseURL)
{ {
NSString* suffix=[baseURL path]; NSString* suffix=[baseURL path];
NSString* tmp=nil; NSString* tmp=nil;
if ([baseURL query]) if ([baseURL query])
suffix=[suffix stringByAppendingFormat:@"?%@",[baseURL query]]; suffix=[suffix stringByAppendingFormat: @"?%@",[baseURL query]];
// /test?aa=bb&cc=dd -- http://user:passwd@www.gnustep.org:80/apache // /test?aa=bb&cc=dd -- http: //user: passwd@www.gnustep.org: 80/apache
// ==> http://user:passwd@www.gnustep.org:80/ // ==> http: //user: passwd@www.gnustep.org: 80/
tmp=[[baseURL absoluteString]stringWithoutSuffix:suffix]; tmp=[[baseURL absoluteString]stringWithoutSuffix: suffix];
// ==> http://user:passwd@www.gnustep.org:80 // ==> http: //user: passwd@www.gnustep.org: 80
if ([tmp hasSuffix:@"/"]) if ([tmp hasSuffix: @"/"])
tmp=[tmp stringWithoutSuffix:@"/"]; tmp=[tmp stringWithoutSuffix: @"/"];
return tmp; return tmp;
} }
else else
return @""; return @"";
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSString*)absoluteString - (NSString*) absoluteString
{ {
NSString* absString=nil; NSString* absString=nil;
if (baseURL) if (baseURL)
{ {
// /test?aa=bb&cc=dd -- http://user:passwd@www.gnustep.org:80/apache // /test?aa=bb&cc=dd -- http: //user: passwd@www.gnustep.org: 80/apache
// ==> http://user:passwd@www.gnustep.org:80 // ==> http: //user: passwd@www.gnustep.org: 80
absString=[self baseURLAbsolutePart]; absString=[self baseURLAbsolutePart];
if ([urlString hasPrefix:@"/"]) if ([urlString hasPrefix: @"/"])
absString=[absString stringByAppendingString:urlString]; absString=[absString stringByAppendingString: urlString];
else else
absString=[absString stringByAppendingFormat:@"/%@",urlString]; absString=[absString stringByAppendingFormat: @"/%@",urlString];
} }
else else
absString=urlString; absString=urlString;
return absString; return absString;
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSString*)relativeString - (NSString*) relativeString
{ {
return urlString; return urlString;
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSURL*)baseURL - (NSURL*) baseURL
{ {
return baseURL; return baseURL;
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSURL*)absoluteURL - (NSURL*) absoluteURL
{ {
if (!baseURL) if (!baseURL)
return self; return self;
else else
return [NSURL URLWithString:[self absoluteString]]; return [NSURL URLWithString: [self absoluteString]];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSString*)scheme - (NSString*) scheme
{ {
NSString* scheme=nil; NSString* scheme=nil;
NSString* absoluteString=[self absoluteString]; NSString* absoluteString=[self absoluteString];
NSRange range=[absoluteString rangeOfString:@"://"]; NSRange range=[absoluteString rangeOfString: @": //"];
if (range.length>0) if (range.length>0)
scheme=[absoluteString substringToIndex:range.location]; scheme=[absoluteString substringToIndex: range.location];
return scheme; return scheme;
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSString*)resourceSpecifier - (NSString*) resourceSpecifier
{ {
NSString* absoluteString=[self absoluteString]; NSString* absoluteString=[self absoluteString];
NSRange range=[absoluteString rangeOfString:@"://"]; NSRange range=[absoluteString rangeOfString: @": //"];
if (range.length>0) if (range.length>0)
return [absoluteString substringFromIndex:range.location+1]; return [absoluteString substringFromIndex: range.location+1];
else else
return absoluteString; return absoluteString;
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//Non Standard Function //Non Standard Function
-(NSDictionary*)explode - (NSDictionary*) explode
{ {
NSMutableDictionary* elements=nil; NSMutableDictionary* elements=nil;
NSString* resourceSpecifier=[self resourceSpecifier]; NSString* resourceSpecifier=[self resourceSpecifier];
if ([resourceSpecifier hasPrefix:@"//"]) if ([resourceSpecifier hasPrefix: @"//"])
{ {
int index=2; int index=2;
NSRange range; NSRange range;
elements=[[NSMutableDictionary new] autorelease]; elements=[[NSMutableDictionary new] autorelease];
if (![[self scheme] isEqualToString:NSURLFileScheme]) if (![[self scheme] isEqualToString: NSURLFileScheme])
{ {
range=[resourceSpecifier rangeOfString:@"/" range=[resourceSpecifier rangeOfString: @"/"
options:0 options: 0
range:NSMakeRange(index,[resourceSpecifier length]-index)]; range: NSMakeRange(index,[resourceSpecifier length]-index)];
if (range.length>0) if (range.length>0)
{ {
NSString* userPasswordHostPort=[resourceSpecifier substringWithRange:NSMakeRange(index,range.location-index)]; NSString* userPasswordHostPort=[resourceSpecifier substringWithRange: NSMakeRange(index,range.location-index)];
NSString* userPassword=nil; NSString* userPassword=nil;
NSString* hostPort=nil; NSString* hostPort=nil;
index=range.location; index=range.location;
range=[userPasswordHostPort rangeOfString:@"@"]; range=[userPasswordHostPort rangeOfString: @"@"];
if (range.length>0) if (range.length>0)
{ {
if (range.location>0) if (range.location>0)
userPassword=[userPasswordHostPort substringToIndex:range.location]; userPassword=[userPasswordHostPort substringToIndex: range.location];
if (range.location+1<[userPasswordHostPort length]) if (range.location+1<[userPasswordHostPort length])
hostPort=[userPasswordHostPort substringFromIndex:range.location+1]; hostPort=[userPasswordHostPort substringFromIndex: range.location+1];
} }
else else
hostPort=userPasswordHostPort; hostPort=userPasswordHostPort;
if (userPassword) if (userPassword)
{ {
range=[userPassword rangeOfString:@":"]; range=[userPassword rangeOfString: @": "];
if (range.length>0) if (range.length>0)
{ {
if (range.location>0) if (range.location>0)
[elements setObject:[userPassword substringToIndex:range.location] [elements setObject: [userPassword substringToIndex: range.location]
forKey:NSURLPartKey_user]; forKey: NSURLPartKey_user];
if (range.location+1<[userPassword length]) if (range.location+1<[userPassword length])
[elements setObject:[userPassword substringFromIndex:range.location+1] [elements setObject: [userPassword substringFromIndex: range.location+1]
forKey:NSURLPartKey_password]; forKey: NSURLPartKey_password];
} }
else else
[elements setObject:userPassword [elements setObject: userPassword
forKey:NSURLPartKey_user]; forKey: NSURLPartKey_user];
}; }
if (hostPort) if (hostPort)
{ {
range=[hostPort rangeOfString:@":"]; range=[hostPort rangeOfString: @": "];
if (range.length>0) if (range.length>0)
{ {
if (range.location>0) if (range.location>0)
[elements setObject:[hostPort substringToIndex:range.location] [elements setObject: [hostPort substringToIndex: range.location]
forKey:NSURLPartKey_host]; forKey: NSURLPartKey_host];
if (range.location+1<[hostPort length]) if (range.location+1<[hostPort length])
[elements setObject:[NSNumber valueFromString: [elements setObject: [NSNumber valueFromString:
[hostPort substringFromIndex:range.location+1]] [hostPort substringFromIndex: range.location+1]]
forKey:NSURLPartKey_port]; forKey: NSURLPartKey_port];
} }
else else
[elements setObject:hostPort [elements setObject: hostPort
forKey:NSURLPartKey_host]; forKey: NSURLPartKey_host];
}; };
}; }
} }
else else
index--; //To Take a / index--; //To Take a /
range=[resourceSpecifier rangeOfString:@"?" range=[resourceSpecifier rangeOfString: @"?"
options:0 options: 0
range:NSMakeRange(index,[resourceSpecifier length]-index)]; range: NSMakeRange(index,[resourceSpecifier length]-index)];
if (range.length>0) if (range.length>0)
{ {
if (range.location>0) if (range.location>0)
[elements setObject:[resourceSpecifier substringWithRange:NSMakeRange(index,range.location-index)] [elements setObject: [resourceSpecifier substringWithRange: NSMakeRange(index,range.location-index)]
forKey:NSURLPartKey_path]; forKey: NSURLPartKey_path];
if (range.location+1<[resourceSpecifier length]) if (range.location+1<[resourceSpecifier length])
[elements setObject:[resourceSpecifier substringFromIndex:range.location+1] [elements setObject: [resourceSpecifier substringFromIndex: range.location+1]
forKey:NSURLPartKey_query]; forKey: NSURLPartKey_query];
} }
else else
[elements setObject:[resourceSpecifier substringFromIndex:index] [elements setObject: [resourceSpecifier substringFromIndex: index]
forKey:NSURLPartKey_path]; forKey: NSURLPartKey_path];
} }
else else
{ {
[NSException raise:NSGenericException [NSException raise: NSGenericException
format:@"'%@' is a bad URL",self]; format: @"'%@' is a bad URL",self];
}; }
return elements; return elements;
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSString*)host - (NSString*) host
{ {
return [[self explode] objectForKey:NSURLPartKey_host]; return [[self explode] objectForKey: NSURLPartKey_host];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSNumber*)port; - (NSNumber*) port;
{ {
return [[self explode] objectForKey:NSURLPartKey_port]; return [[self explode] objectForKey: NSURLPartKey_port];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSString*)user; - (NSString*) user;
{ {
return [[self explode] objectForKey:NSURLPartKey_user]; return [[self explode] objectForKey: NSURLPartKey_user];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSString*)password; - (NSString*) password;
{ {
return [[self explode] objectForKey:NSURLPartKey_password]; return [[self explode] objectForKey: NSURLPartKey_password];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSString*)path; - (NSString*) path;
{ {
return [[self explode] objectForKey:NSURLPartKey_path]; return [[self explode] objectForKey: NSURLPartKey_path];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSString*)fragment; - (NSString*) fragment;
{ {
return [[self explode] objectForKey:NSURLPartKey_fragment]; return [[self explode] objectForKey: NSURLPartKey_fragment];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSString*)parameterString; - (NSString*) parameterString;
{ {
return [[self explode] objectForKey:NSURLPartKey_parameterString]; return [[self explode] objectForKey: NSURLPartKey_parameterString];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSString*)query; - (NSString*) query;
{ {
return [[self explode] objectForKey:NSURLPartKey_query]; return [[self explode] objectForKey: NSURLPartKey_query];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSString*)relativePath - (NSString*) relativePath
{ {
//FIXME? //FIXME?
return [self path]; return [self path];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(BOOL)isFileURL - (BOOL) isFileURL
{ {
return [[self scheme] isEqualToString:NSURLFileScheme]; return [[self scheme] isEqualToString: NSURLFileScheme];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSURL*)standardizedURL - (NSURL*) standardizedURL
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return nil;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void) URLHandle:(NSURLHandle*)sender - (void) URLHandle: (NSURLHandle*)sender
resourceDataDidBecomeAvailable:(NSData*)newData resourceDataDidBecomeAvailable: (NSData*)newData
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)URLHandleResourceDidBeginLoading:(NSURLHandle*)sender - (void)URLHandleResourceDidBeginLoading: (NSURLHandle*)sender
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)URLHandleResourceDidFinishLoading:(NSURLHandle*)sender - (void)URLHandleResourceDidFinishLoading: (NSURLHandle*)sender
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)URLHandleResourceDidCancelLoading:(NSURLHandle*)sender - (void)URLHandleResourceDidCancelLoading: (NSURLHandle*)sender
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void) URLHandle:(NSURLHandle*)sender - (void) URLHandle: (NSURLHandle*)sender
resourceDidFailLoadingWithReason:(NSString*)reason resourceDidFailLoadingWithReason: (NSString*)reason
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//FIXME: delete these fn when NSURL will be validated //FIXME: delete these fn when NSURL will be validated
+(void)test + (void) test
{ {
NSURL* url2; NSURL* url2;
NSURL* url3; NSURL* url3;
NSURL* url=[NSURL URLWithString:@"http://user:passwd@www.gnustep.org:80/apache"]; NSURL* url=[NSURL URLWithString: @"http: //user: passwd@www.gnustep.org: 80/apache"];
url2=[NSURL URLWithString:@"/test?aa=bb&cc=dd" relativeToURL:url]; url2=[NSURL URLWithString: @"/test?aa=bb&cc=dd" relativeToURL: url];
url3=[NSURL URLWithString:@"test?aa=bb&cc=dd" relativeToURL:url]; url3=[NSURL URLWithString: @"test?aa=bb&cc=dd" relativeToURL: url];
NSLog(@"===url==="); NSLog(@"===url===");
[NSURL testPrint:url]; [NSURL testPrint: url];
NSLog(@"===url2==="); NSLog(@"===url2===");
[NSURL testPrint:url2]; [NSURL testPrint: url2];
NSLog(@"===url3==="); NSLog(@"===url3===");
[NSURL testPrint:url3]; [NSURL testPrint: url3];
}; }
+(void)testPrint:(NSURL*)url + (void) testPrint: (NSURL*)url
{ {
id _baseURL=nil; id _baseURL=nil;
id _urlString=nil; id _urlString=nil;
@ -521,92 +522,97 @@ NSString* NSURLPartKey_query=@"query";
NSLog(@"*scheme: %@",[url scheme]); NSLog(@"*scheme: %@",[url scheme]);
NSLog(@"*resourceSpecifier: %@",[url resourceSpecifier]); NSLog(@"*resourceSpecifier: %@",[url resourceSpecifier]);
NSLog(@"*description: %@",[url description]); NSLog(@"*description: %@",[url description]);
}; }
@end @end
//=================================================================================== //=============================================================================
@implementation NSURL (NSURLLoading) @implementation NSURL (NSURLLoading)
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSData*)resourceDataUsingCache:(BOOL)shouldUseCache - (NSData*) resourceDataUsingCache: (BOOL)shouldUseCache
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return nil;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)loadResourceDataNotifyingClient:(id)client - (void) loadResourceDataNotifyingClient: (id)client
usingCache:(BOOL)shouldUseCache usingCache: (BOOL)shouldUseCache
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSURLHandle*)URLHandleUsingCache:(BOOL)shouldUseCache - (NSURLHandle*)URLHandleUsingCache: (BOOL)shouldUseCache
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return nil;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(BOOL)setResourceData:(NSData*)data - (BOOL) setResourceData: (NSData*)data
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return NO;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(id)propertyForKey:(NSString*)propertyKey - (id) propertyForKey: (NSString*)propertyKey
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return nil;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(BOOL)setProperty:(id)property - (BOOL) setProperty: (id)property
forKey:(NSString*)propertyKey; forKey: (NSString*)propertyKey;
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return NO;
}
@end @end
//=================================================================================== //=============================================================================
@implementation NSObject (NSURLClient) @implementation NSObject (NSURLClient)
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void) URL:(NSURL*)sender - (void) URL: (NSURL*)sender
resourceDataDidBecomeAvailable:(NSData*)newBytes resourceDataDidBecomeAvailable: (NSData*)newBytes
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)URLResourceDidFinishLoading:(NSURL*)sender - (void) URLResourceDidFinishLoading: (NSURL*)sender
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)URLResourceDidCancelLoading:(NSURL*)sender - (void) URLResourceDidCancelLoading: (NSURL*)sender
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void) URL:(NSURL*)sender - (void) URL: (NSURL*)sender
resourceDidFailLoadingWithReason:(NSString*)reason resourceDidFailLoadingWithReason: (NSString*)reason
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
@end @end

View file

@ -1,7 +1,7 @@
/* NSURLHandle.h - Class NSURLHandle /* NSURLHandle.h - Class NSURLHandle
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@sbuilders.com> Written by: Manuel Guesdon <mguesdon@sbuilders.com>
Date: Jan 1999 Date: Jan 1999
This file is part of the GNUstep Library. This file is part of the GNUstep Library.
@ -22,7 +22,7 @@
*/ */
/* /*
Note from Manuel Guesdon: Note from Manuel Guesdon:
* functions are not implemented. If someone has documentation or ideas on * functions are not implemented. If someone has documentation or ideas on
how it should work... how it should work...
*/ */
@ -36,171 +36,184 @@ how it should work...
#include <Foundation/NSURLHandle.h> #include <Foundation/NSURLHandle.h>
#include <Foundation/NSURL.h> #include <Foundation/NSURL.h>
//=================================================================================== //=============================================================================
@implementation NSURLHandle @implementation NSURLHandle
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
+(void)registerURLHandleClass:(Class)_urlHandleSubclass + (void) registerURLHandleClass: (Class)_urlHandleSubclass
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
+(Class)URLHandleClassForURL:(NSURL*)_url + (Class)URLHandleClassForURL: (NSURL*)_url
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return 0;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(id)initWithURL:(NSURL*)_url - (id) initWithURL: (NSURL*)_url
cached:(BOOL)_cached cached: (BOOL)_cached
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return nil;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSURLHandleStatus)status - (NSURLHandleStatus) status
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return (NSURLHandleStatus)0;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSString*)failureReason - (NSString*) failureReason
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return nil;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)addClient:(id <NSURLHandleClient>)_client - (void) addClient: (id <NSURLHandleClient>)_client
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)removeClient:(id <NSURLHandleClient>)_client - (void) removeClient: (id <NSURLHandleClient>)_client
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)loadInBackground - (void) loadInBackground
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)cancelLoadInBackground - (void) cancelLoadInBackground
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSData*)resourceData - (NSData*) resourceData
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return nil;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSData*)availableResourceData - (NSData*) availableResourceData
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return nil;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)flushCachedData - (void) flushCachedData
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)backgroundLoadDidFailWithReason:(NSString*)reason - (void) backgroundLoadDidFailWithReason: (NSString*)reason
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)didLoadBytes:(NSData*)newData - (void) didLoadBytes: (NSData*)newData
loadComplete:(BOOL)_loadComplete loadComplete: (BOOL)_loadComplete
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
+(BOOL)canInitWithURL:(NSURL*)_url + (BOOL) canInitWithURL: (NSURL*)_url
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return NO;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
+(NSURLHandle*)cachedHandleForURL:(NSURL*)_url + (NSURLHandle*) cachedHandleForURL: (NSURL*)_url
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return nil;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(id)propertyForKey:(NSString*)propertyKey - (id) propertyForKey: (NSString*)propertyKey
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return nil;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(id)propertyForKeyIfAvailable:(NSString*)propertyKey - (id) propertyForKeyIfAvailable: (NSString*)propertyKey
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return nil;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(BOOL)writeProperty:(id)propertyValue - (BOOL) writeProperty: (id)propertyValue
forKey:(NSString*)propertyKey forKey: (NSString*)propertyKey
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return NO;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(BOOL)writeData:(NSData*)data - (BOOL) writeData: (NSData*)data
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return NO;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(NSData*)loadInForeground - (NSData*) loadInForeground
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; return nil;
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)beginLoadInBackground - (void) beginLoadInBackground
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------
-(void)endLoadInBackground - (void) endLoadInBackground
{ {
//FIXME //FIXME
[self notImplemented: _cmd]; [self notImplemented: _cmd];
}; }
@end @end

View file

@ -30,7 +30,7 @@
/* /*
* Setup for inline operation of arrays. * Setup for inline operation of arrays.
*/ */
#define GSI_ARRAY_RETAIN(X) X #define GSI_ARRAY_RETAIN(X)
#define GSI_ARRAY_RELEASE(X) #define GSI_ARRAY_RELEASE(X)
#define GSI_ARRAY_TYPES GSUNION_OBJ|GSUNION_SEL|GSUNION_STR #define GSI_ARRAY_TYPES GSUNION_OBJ|GSUNION_SEL|GSUNION_STR
@ -718,7 +718,6 @@ mapClassName(NSUnarchiverObjectInfo *info)
else else
{ {
unsigned size; unsigned size;
NSData *dat;
if (GSIArrayCount(ptrMap) != xref) if (GSIArrayCount(ptrMap) != xref)
{ {
@ -744,8 +743,6 @@ mapClassName(NSUnarchiverObjectInfo *info)
case _GSC_CHARPTR: case _GSC_CHARPTR:
{ {
char *str;
typeCheck(*type, _GSC_CHARPTR); typeCheck(*type, _GSC_CHARPTR);
/* /*
* Special case - a zero crossref value size is a nil pointer. * Special case - a zero crossref value size is a nil pointer.
@ -766,8 +763,6 @@ mapClassName(NSUnarchiverObjectInfo *info)
} }
else else
{ {
int length;
if (xref != GSIArrayCount(ptrMap)) if (xref != GSIArrayCount(ptrMap))
{ {
[NSException raise: NSInternalInconsistencyException [NSException raise: NSInternalInconsistencyException
@ -970,8 +965,7 @@ mapClassName(NSUnarchiverObjectInfo *info)
[NSException raise: NSInternalInconsistencyException [NSException raise: NSInternalInconsistencyException
format: @"Decoding data object with unknown type"]; format: @"Decoding data object with unknown type"];
} }
else return [NSData data];
return [NSData data];
} }
/* /*

View file

@ -677,7 +677,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
} }
} }
if (wantRead == NO) if (wantRead == NO)
return; return YES;
} }
/* /*

View file

@ -1576,7 +1576,6 @@ NSCreateZone (size_t start, size_t gran, BOOL canFree)
ffree_zone *zone; ffree_zone *zone;
ff_block *block; ff_block *block;
ff_block *chunk; ff_block *chunk;
ff_block *header;
ff_block *tailer; ff_block *tailer;
zone = objc_malloc(sizeof(ffree_zone)); zone = objc_malloc(sizeof(ffree_zone));
@ -1704,10 +1703,10 @@ NSZoneRealloc (NSZone *zone, void *ptr, size_t size)
inline void inline void
NSRecycleZone (NSZone *zone) NSRecycleZone (NSZone *zone)
{ {
if (zone == 0) if (zone == 0)
zone == NSDefaultMallocZone(); zone = NSDefaultMallocZone();
(zone->recycle)(zone); (zone->recycle)(zone);
} }
inline void inline void

View file

@ -57,6 +57,7 @@
#include <sys/param.h> /* for MAXHOSTNAMELEN */ #include <sys/param.h> /* for MAXHOSTNAMELEN */
#include <netinet/in.h> /* for inet_ntoa() */ #include <netinet/in.h> /* for inet_ntoa() */
#include <fcntl.h> #include <fcntl.h>
#include <arpa/inet.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/file.h> #include <sys/file.h>
@ -1207,7 +1208,7 @@ static NSMapTable* port_number_2_port;
#ifndef HAVE_INET_ATON #ifndef HAVE_INET_ATON
p->_listening_address.sin_addr.s_addr = inet_addr("127.0.0.1"); p->_listening_address.sin_addr.s_addr = inet_addr("127.0.0.1");
#else #else
inet_aton("127.0.0.1", &p->_listening_address.sin_addr.s_addr); inet_aton("127.0.0.1", &p->_listening_address.sin_addr);
#endif #endif
} }
else else
@ -1247,7 +1248,6 @@ static NSMapTable* port_number_2_port;
fromPort: (int)portn fromPort: (int)portn
{ {
TcpInPort* p = [self newForReceivingFromPortNumber: portn]; TcpInPort* p = [self newForReceivingFromPortNumber: portn];
struct sockaddr_in sin;
if (p) { if (p) {
[[NSPortNameServer defaultPortNameServer] registerPort: p [[NSPortNameServer defaultPortNameServer] registerPort: p
@ -1808,7 +1808,7 @@ static NSMapTable *out_port_bag = NULL;
|| (p->_remote_in_port_address.sin_addr.s_addr || (p->_remote_in_port_address.sin_addr.s_addr
!= sockaddr->sin_addr.s_addr)) != sockaddr->sin_addr.s_addr))
{ {
NSString *od = [p description]; // NSString *od = [p description];
NSMapRemove (out_port_bag, (void*)p); NSMapRemove (out_port_bag, (void*)p);
memcpy (&(p->_remote_in_port_address), memcpy (&(p->_remote_in_port_address),

View file

@ -519,10 +519,12 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
isStandardFile = NO; isStandardFile = NO;
if ((e = fcntl(desc, F_GETFL, 0)) >= 0) if ((e = fcntl(desc, F_GETFL, 0)) >= 0)
if (e & NBLK_OPT) {
wasNonBlocking = YES; if (e & NBLK_OPT)
else wasNonBlocking = YES;
wasNonBlocking = NO; else
wasNonBlocking = NO;
}
isNonBlocking = wasNonBlocking; isNonBlocking = wasNonBlocking;
descriptor = desc; descriptor = desc;
@ -1222,7 +1224,6 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
struct sockaddr_in buf; struct sockaddr_in buf;
int desc; int desc;
int blen = sizeof(buf); int blen = sizeof(buf);
NSFileHandle* hdl;
desc = accept(descriptor, (struct sockaddr*)&buf, &blen); desc = accept(descriptor, (struct sockaddr*)&buf, &blen);
if (desc < 0) if (desc < 0)

View file

@ -156,7 +156,7 @@ static BOOL skipSpace(pldata *pld)
if (c == '/' && pld->pos < pld->end - 1) if (c == '/' && pld->pos < pld->end - 1)
{ {
/* /*
* Check for comments beginning '//' or '/*' * Check for comments beginning '/' followed by '/' or '*'
*/ */
if (pld->ptr[pld->pos + 1] == '/') if (pld->ptr[pld->pos + 1] == '/')
{ {

View file

@ -31,6 +31,8 @@
#include <Foundation/NSUserDefaults.h> #include <Foundation/NSUserDefaults.h>
#include <Foundation/NSDistributedNotificationCenter.h> #include <Foundation/NSDistributedNotificationCenter.h>
#include <unistd.h>
#include "gdnc.h" #include "gdnc.h"
@interface GDNCNotification : NSObject @interface GDNCNotification : NSObject
@ -390,6 +392,7 @@
} }
NSMapRemove(connections, connection); NSMapRemove(connections, connection);
} }
return nil;
} }
- (void) registerClient: (id<GDNCClient>)client - (void) registerClient: (id<GDNCClient>)client

View file

@ -33,6 +33,7 @@
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <string.h> /* for strchr() */ #include <string.h> /* for strchr() */
#include <ctype.h> /* for strchr() */
#ifndef __WIN32__ #ifndef __WIN32__
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h> #include <sys/resource.h>
@ -451,7 +452,7 @@ map_by_port(unsigned p, unsigned char t)
{ {
if (debug > 2) if (debug > 2)
{ {
fprintf(stderr, "Found port %d with name %.*s\n", fprintf(stderr, "Found port %d with name %s\n",
map[index]->port, map[index]->name); map[index]->port, map[index]->name);
} }
return map[index]; return map[index];
@ -700,7 +701,7 @@ dump_stats()
fprintf(stderr, "tcp messages waiting for send - %d\n", tcp_pending); fprintf(stderr, "tcp messages waiting for send - %d\n", tcp_pending);
fprintf(stderr, "udp messages waiting for send - %d\n", udp_pending); fprintf(stderr, "udp messages waiting for send - %d\n", udp_pending);
fprintf(stderr, "size of name-to-port map - %d\n", map_used); fprintf(stderr, "size of name-to-port map - %d\n", map_used);
fprintf(stderr, "number of known name servers - %d\n", prb_used); fprintf(stderr, "number of known name servers - %ld\n", prb_used);
fprintf(stderr, "TCP %d read, %d sent\n", tcp_read, tcp_sent); fprintf(stderr, "TCP %d read, %d sent\n", tcp_read, tcp_sent);
fprintf(stderr, "UDP %d read, %d sent\n", udp_read, udp_sent); fprintf(stderr, "UDP %d read, %d sent\n", udp_read, udp_sent);
} }
@ -1544,7 +1545,6 @@ handle_io()
else if (rval == 0) else if (rval == 0)
{ {
long now = time(0); long now = time(0);
int i;
/* /*
* Let's handle a timeout. * Let's handle a timeout.
@ -1706,7 +1706,7 @@ handle_request(int desc)
{ {
fprintf(stderr, "request type '%c' from chan %d", type, desc); fprintf(stderr, "request type '%c' from chan %d", type, desc);
} }
fprintf(stderr, " - name: '%.*s' port: %d\n", size, buf, port); fprintf(stderr, " - name: '%.*s' port: %ld\n", size, buf, port);
} }
if (ptype != GDO_TCP_GDO && ptype != GDO_TCP_FOREIGN && if (ptype != GDO_TCP_GDO && ptype != GDO_TCP_FOREIGN &&
@ -1819,7 +1819,7 @@ handle_request(int desc)
{ {
if (debug > 1) if (debug > 1)
{ {
fprintf(stderr, "re-register from %d to %d\n", fprintf(stderr, "re-register from %d to %ld\n",
m->port, port); m->port, port);
} }
m->port = port; m->port = port;
@ -2970,7 +2970,7 @@ printf(
fprintf(stderr, "Registration will take place locally.\n"); fprintf(stderr, "Registration will take place locally.\n");
} }
doregister(optarg, port, ptype); doregister(optarg, port, ptype);
return; return 0;
case 'T': case 'T':
if (strcmp(optarg, "tcp_gdo") == 0) if (strcmp(optarg, "tcp_gdo") == 0)

View file

@ -33,7 +33,6 @@ int
main(int argc, char** argv) main(int argc, char** argv)
{ {
NSAutoreleasePool *pool = [NSAutoreleasePool new]; NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSUserDefaults *defs;
NSProcessInfo *proc; NSProcessInfo *proc;
NSArray *args; NSArray *args;
unsigned i; unsigned i;

View file

@ -31,7 +31,6 @@ int
main(int argc, char** argv) main(int argc, char** argv)
{ {
NSAutoreleasePool *pool = [NSAutoreleasePool new]; NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSUserDefaults *defs;
NSProcessInfo *proc; NSProcessInfo *proc;
NSArray *args; NSArray *args;
unsigned i; unsigned i;

View file

@ -33,7 +33,6 @@ int
main(int argc, char** argv) main(int argc, char** argv)
{ {
NSAutoreleasePool *pool = [NSAutoreleasePool new]; NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSUserDefaults *defs;
NSProcessInfo *proc; NSProcessInfo *proc;
NSArray *args; NSArray *args;
unsigned i; unsigned i;

View file

@ -31,7 +31,6 @@ int
main(int argc, char** argv) main(int argc, char** argv)
{ {
NSAutoreleasePool *pool = [NSAutoreleasePool new]; NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSUserDefaults *defs;
NSProcessInfo *proc; NSProcessInfo *proc;
NSArray *args; NSArray *args;
unsigned i; unsigned i;