mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 09:41:15 +00:00
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:
parent
4d85cbdec2
commit
24f59ea2a0
46 changed files with 1406 additions and 1020 deletions
49
ChangeLog
49
ChangeLog
|
@ -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>
|
||||
|
||||
* Source/include/GSIArray.h (GSIArrayRemoveLastItem): New function.
|
||||
|
|
|
@ -741,7 +741,7 @@ GSIMapEmptyMap(GSIMapTable map)
|
|||
map->zone = 0;
|
||||
}
|
||||
|
||||
static INLINE GSIMapTable
|
||||
static INLINE void
|
||||
GSIMapInitWithZoneAndCapacity(GSIMapTable map, NSZone *zone, size_t capacity)
|
||||
{
|
||||
map->zone = zone;
|
||||
|
|
|
@ -58,11 +58,7 @@
|
|||
|
||||
@interface NSNotificationCenter : NSObject <GCFinalization>
|
||||
{
|
||||
void *wildcard; /* Observations matching anything. */
|
||||
NSMapTable *nameless; /* Observations matching objects. */
|
||||
void *named; /* Observations matching names. */
|
||||
NSMapTable *observers; /* Observations keyed by observer. */
|
||||
NSLock *_lock;
|
||||
void *table;
|
||||
}
|
||||
|
||||
+ (NSNotificationCenter*) defaultCenter;
|
||||
|
@ -86,4 +82,28 @@
|
|||
|
||||
@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 */
|
||||
|
|
|
@ -537,7 +537,7 @@
|
|||
been -shallowCopy'ed can cause major memory leakage. */
|
||||
- copyAs: (id <Collecting>)aCollectionClass
|
||||
{
|
||||
id newColl = [self emptyCopyAs:aCollectionClass];
|
||||
id newColl = [self emptyCopyAs: (Class)aCollectionClass];
|
||||
id o;
|
||||
|
||||
FOR_COLLECTION(self, o)
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
/*
|
||||
* 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_RETAIN_VAL(X) X
|
||||
#define GSI_MAP_RETAIN_VAL(X)
|
||||
#define GSI_MAP_RELEASE_VAL(X)
|
||||
#define GSI_MAP_HASH(X) ((X).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
|
||||
at: (const void*)buf
|
||||
{
|
||||
uchar info;
|
||||
|
||||
switch (*type)
|
||||
{
|
||||
case _C_ID:
|
||||
|
@ -884,8 +882,6 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
|
|||
|
||||
- (void) resetArchiver
|
||||
{
|
||||
char buf[strlen(PREFIX)+33];
|
||||
|
||||
if (clsMap)
|
||||
{
|
||||
GSIMapCleanMap(clsMap);
|
||||
|
|
|
@ -751,7 +751,7 @@
|
|||
BOOL mtag = NO, dtag = NO, ycent = NO;
|
||||
BOOL mname = NO, dname = NO;
|
||||
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 i, j, k, z;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include <config.h>
|
||||
#include <base/preface.h>
|
||||
#include <base/behavior.h>
|
||||
#include <Foundation/NSData.h>
|
||||
#include <Foundation/NSCoder.h>
|
||||
#include <Foundation/NSSerialization.h>
|
||||
|
@ -148,8 +149,8 @@
|
|||
va_start(ap, types);
|
||||
while (*types)
|
||||
{
|
||||
[self encodeValueOfObjCType:types
|
||||
at:va_arg(ap, void*)];
|
||||
(*imp)(self, @selector(encodeValueOfObjCType:at:), types,
|
||||
va_arg(ap, void*));
|
||||
types = objc_skip_typespec(types);
|
||||
}
|
||||
va_end(ap);
|
||||
|
@ -173,7 +174,6 @@
|
|||
{
|
||||
unsigned count;
|
||||
const char *type = @encode(unsigned char);
|
||||
int i;
|
||||
unsigned char *where;
|
||||
unsigned char *array;
|
||||
IMP imp = [self methodForSelector:@selector(decodeValueOfObjCType:at:)];
|
||||
|
|
|
@ -104,8 +104,6 @@
|
|||
|
||||
- (BOOL) isEqualToValue: (NSValue*)aValue
|
||||
{
|
||||
const char* type;
|
||||
|
||||
if (fastClass(aValue) != fastClass(self))
|
||||
return NO;
|
||||
if (strcmp(objctype, ((NSConcreteValue*)aValue)->objctype) != 0)
|
||||
|
|
|
@ -187,7 +187,7 @@ static unsigned local_object_counter = 0;
|
|||
@interface NSConnection (Private)
|
||||
- _superInit;
|
||||
- (void) handlePortMessage: (NSPortMessage*)msg;
|
||||
+ setDebug: (int)val;
|
||||
+ (void) setDebug: (int)val;
|
||||
@end
|
||||
|
||||
#define proxiesHashGate refGate
|
||||
|
@ -219,18 +219,6 @@ compare_ints (const void *k1, const void *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 */
|
||||
static id default_receive_port_class;
|
||||
static id default_send_port_class;
|
||||
|
@ -1124,7 +1112,7 @@ static int messages_received_count;
|
|||
return self;
|
||||
}
|
||||
|
||||
+ setDebug: (int)val
|
||||
+ (void) setDebug: (int)val
|
||||
{
|
||||
debug_connection = val;
|
||||
}
|
||||
|
@ -2040,7 +2028,6 @@ static int messages_received_count;
|
|||
{
|
||||
id op;
|
||||
id ip;
|
||||
unsigned int i;
|
||||
id result;
|
||||
int seq_num = [self _newMsgNumber];
|
||||
|
||||
|
|
|
@ -1028,6 +1028,7 @@ failure:
|
|||
fromZone: (NSZone*)zone
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (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
|
||||
{
|
||||
struct shmid_ds buf;
|
||||
|
||||
shmid = -1;
|
||||
if (aBuffer && bufferSize)
|
||||
{
|
||||
|
@ -2453,7 +2452,6 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
- (id) initWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
unsigned l;
|
||||
void *b;
|
||||
|
||||
[aCoder decodeValueOfObjCType: @encode(unsigned long) at: &l];
|
||||
if (l)
|
||||
|
@ -2929,8 +2927,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
|
||||
- (id) initWithCapacity: (unsigned)bufferSize
|
||||
{
|
||||
struct shmid_ds buf;
|
||||
int e;
|
||||
int e;
|
||||
|
||||
shmid = shmget(IPC_PRIVATE, bufferSize, IPC_CREAT|VM_ACCESS);
|
||||
if (shmid == -1) /* Created memory? */
|
||||
|
@ -2992,9 +2989,8 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
{
|
||||
if (size != capacity)
|
||||
{
|
||||
void *tmp;
|
||||
struct shmid_ds buf;
|
||||
int newid;
|
||||
void *tmp;
|
||||
int newid;
|
||||
|
||||
newid = shmget(IPC_PRIVATE, size, IPC_CREAT|VM_ACCESS);
|
||||
if (newid == -1) /* Created memory? */
|
||||
|
|
|
@ -192,8 +192,8 @@ GSTimeNow()
|
|||
|
||||
+ (id) dateWithNaturalLanguageString: (NSString*)string
|
||||
{
|
||||
[self dateWithNaturalLanguageString: string
|
||||
locale: nil];
|
||||
return [self dateWithNaturalLanguageString: string
|
||||
locale: nil];
|
||||
}
|
||||
|
||||
+ (id) dateWithNaturalLanguageString: (NSString*)string
|
||||
|
@ -222,7 +222,6 @@ GSTimeNow()
|
|||
int modYear = 0;
|
||||
int modDay = 0;
|
||||
int D, M, Y;
|
||||
int modWeek;
|
||||
int h = 12;
|
||||
int m = 0;
|
||||
int s = 0;
|
||||
|
@ -366,7 +365,6 @@ GSTimeNow()
|
|||
unsigned c = [ymw count];
|
||||
NSString *yname = [ymw objectAtIndex: 0];
|
||||
NSString *mname = c > 1 ? [ymw objectAtIndex: 1] : nil;
|
||||
NSString *wname = c > 2 ? [ymw objectAtIndex: 2] : nil;
|
||||
NSArray *early = [locale objectForKey: NSEarlierTimeDesignations];
|
||||
NSArray *later = [locale objectForKey: NSLaterTimeDesignations];
|
||||
|
||||
|
@ -1242,10 +1240,11 @@ GSTimeNow()
|
|||
return self;
|
||||
}
|
||||
|
||||
- (id) allocWithZone: (NSZone*)z
|
||||
+ (id) allocWithZone: (NSZone*)z
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Attempt to allocate fixed date"];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone*)z
|
||||
|
|
|
@ -166,11 +166,10 @@ static Class NSMutableDictionary_concrete_class;
|
|||
return [self count];
|
||||
}
|
||||
|
||||
- initWithObjects: (NSArray*)objects forKeys: (NSArray*)keys
|
||||
- (id) initWithObjects: (NSArray*)objects forKeys: (NSArray*)keys
|
||||
{
|
||||
int objectCount = [objects count];
|
||||
id os[objectCount], ks[objectCount];
|
||||
int i;
|
||||
|
||||
if (objectCount != [keys count])
|
||||
{
|
||||
|
@ -465,7 +464,7 @@ compareIt(id o1, id o2, void* context)
|
|||
return (int)[o1 performSelector: f->s withObject: o2];
|
||||
}
|
||||
|
||||
- (NSArray*)keysSortedByValueUsingSelector: (SEL)comp
|
||||
- (NSArray*) keysSortedByValueUsingSelector: (SEL)comp
|
||||
{
|
||||
struct foo info;
|
||||
id k;
|
||||
|
@ -474,6 +473,7 @@ compareIt(id o1, id o2, void* context)
|
|||
info.s = comp;
|
||||
info.i = [self methodForSelector: @selector(objectForKey:)];
|
||||
k = [[self allKeys] sortedArrayUsingFunction: compareIt context: &info];
|
||||
return k;
|
||||
}
|
||||
|
||||
- (NSArray*) objectsForKeys: (NSArray*)keys notFoundMarker: (id)marker
|
||||
|
|
|
@ -52,7 +52,7 @@ NSString *NSLocalNotificationCenterType =
|
|||
|
||||
@interface NSDistributedNotificationCenter (Private)
|
||||
- (void) _connect;
|
||||
- (id) _invalidated: (NSNotification*)notification;
|
||||
- (void) _invalidated: (NSNotification*)notification;
|
||||
- (void) postNotificationName: (NSString*)name
|
||||
object: (NSString*)object
|
||||
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];
|
||||
|
||||
|
|
|
@ -494,7 +494,7 @@ _attributesAtIndexEffectiveRange(
|
|||
- (void) replaceCharactersInRange: (NSRange)range
|
||||
withString: (NSString*)aString
|
||||
{
|
||||
unsigned tmpLength, arrayIndex, arraySize, cnt, location, moveLocations;
|
||||
unsigned tmpLength, arrayIndex, arraySize, cnt, moveLocations;
|
||||
NSRange effectiveRange;
|
||||
NSDictionary *attrs;
|
||||
unsigned afterRangeLoc;
|
||||
|
|
|
@ -929,7 +929,7 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
|
|||
return obj;
|
||||
}
|
||||
|
||||
- mutableCopyWithZone: (NSZone*)z
|
||||
- (id) mutableCopyWithZone: (NSZone*)z
|
||||
{
|
||||
NSGMutableCString *obj;
|
||||
|
||||
|
@ -944,6 +944,7 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
|
|||
obj->_hash = _hash;
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
- (void) deleteCharactersInRange: (NSRange)range
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#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_KTYPES GSUNION_OBJ
|
||||
#define GSI_MAP_VTYPES GSUNION_INT
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSPortCoder.h>
|
||||
|
||||
#include <base/behavior.h>
|
||||
#include <base/fast.x>
|
||||
|
||||
/*
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif /* __WIN32__ */
|
||||
|
||||
static NSLock *_hostCacheLock = nil;
|
||||
|
|
|
@ -199,8 +199,6 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
|
|||
// Acquiring and release the lock
|
||||
- (void) lockWhenCondition: (int)value
|
||||
{
|
||||
int result;
|
||||
|
||||
CHECK_RECURSIVE_CONDITION_LOCK (mutex);
|
||||
|
||||
if (objc_mutex_lock (mutex) == -1)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -97,7 +97,7 @@ currentList()
|
|||
|
||||
@implementation NotificationQueueList
|
||||
|
||||
+ (void)registerQueue: (NSNotificationQueue*)q
|
||||
+ (void) registerQueue: (NSNotificationQueue*)q
|
||||
{
|
||||
NotificationQueueList* list;
|
||||
NotificationQueueList* elem;
|
||||
|
@ -116,7 +116,8 @@ currentList()
|
|||
if (list->queue == q)
|
||||
return; /* Queue already registered. */
|
||||
|
||||
elem = NSAllocateObject(self, 0, NSDefaultMallocZone());
|
||||
elem = (NotificationQueueList*)NSAllocateObject(self, 0,
|
||||
NSDefaultMallocZone());
|
||||
elem->queue = q;
|
||||
list->next = elem;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <config.h>
|
||||
#include <base/preface.h>
|
||||
#include <base/fast.x>
|
||||
|
|
|
@ -70,6 +70,7 @@ NSGetSizeAndAlignment(const char *typePtr, unsigned *sizep, unsigned *alignp)
|
|||
*sizep = info.size;
|
||||
if (alignp)
|
||||
*alignp = info.align;
|
||||
return typePtr;
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
|
||||
#include <base/fast.x>
|
||||
|
||||
extern BOOL __objc_responds_to(id, SEL);
|
||||
|
||||
fastCls _fastCls; /* Structure to cache classes. */
|
||||
fastImp _fastImp; /* Structure to cache methods. */
|
||||
|
||||
|
@ -352,6 +354,9 @@ fastZone(NSObject *object)
|
|||
inline NSObject *
|
||||
NSAllocateObject (Class aClass, unsigned extraBytes, NSZone *zone)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
extern void GSDebugAllocationAdd(Class);
|
||||
#endif
|
||||
id new = nil;
|
||||
int size = aClass->instance_size + extraBytes + sizeof(struct obj_layout);
|
||||
if (CLS_ISCLASS (aClass))
|
||||
|
@ -378,6 +383,9 @@ NSAllocateObject (Class aClass, unsigned extraBytes, NSZone *zone)
|
|||
inline void
|
||||
NSDeallocateObject(NSObject *anObject)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
extern void GSDebugAllocationRemove(Class);
|
||||
#endif
|
||||
if ((anObject!=nil) && CLS_ISCLASS(((id)anObject)->class_pointer))
|
||||
{
|
||||
obj o = &((obj)anObject)[-1];
|
||||
|
|
|
@ -98,6 +98,10 @@ NSRoundUpToMultipleOfPageSize (unsigned bytes)
|
|||
return ((bytes % a) ? ((bytes / a + 1) * a) : bytes);
|
||||
}
|
||||
|
||||
#if __linux__
|
||||
#include <sys/sysinfo.h>
|
||||
#endif
|
||||
|
||||
unsigned
|
||||
NSRealMemoryAvailable ()
|
||||
{
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <Foundation/NSTimer.h>
|
||||
#include <Foundation/NSPortNameServer.h>
|
||||
#include <base/TcpPort.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
/*
|
||||
* Protocol definition stuff for talking to gdomap process.
|
||||
|
@ -278,7 +279,7 @@ static NSPortNameServer *defaultServer = nil;
|
|||
#ifndef HAVE_INET_ATON
|
||||
svrs->s_addr = inet_addr("127.0.0.1");
|
||||
#else
|
||||
inet_aton("127.0.0.1", &svrs->s_addr);
|
||||
inet_aton("127.0.0.1", (struct in_addr *)&svrs->s_addr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -549,6 +550,7 @@ static NSPortNameServer *defaultServer = nil;
|
|||
NS_ENDHANDLER
|
||||
[self _close];
|
||||
[serverLock unlock];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) removePortForName: (NSString*)name
|
||||
|
|
|
@ -510,7 +510,7 @@
|
|||
if ((scanLocation < len) && ((c == 'e') || (c == 'E')))
|
||||
{
|
||||
int expval;
|
||||
int expScanLocation = scanLocation;
|
||||
|
||||
scanLocation++;
|
||||
if ([self _scanInt: &expval])
|
||||
{
|
||||
|
|
|
@ -46,9 +46,9 @@
|
|||
/*
|
||||
* 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_RETAIN_VAL(X) X
|
||||
#define GSI_MAP_RETAIN_VAL(X)
|
||||
#define GSI_MAP_RELEASE_VAL(X)
|
||||
#define GSI_MAP_HASH(X) [(X).obj hash]
|
||||
#define GSI_MAP_EQUAL(X,Y) [(X).obj isEqualToString: (Y).obj]
|
||||
|
@ -58,7 +58,7 @@
|
|||
/*
|
||||
* 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_TYPES GSUNION_OBJ
|
||||
|
||||
|
@ -149,7 +149,7 @@ endSerializerInfo(_NSSerializerInfo* info)
|
|||
GSIMapEmptyMap(&info->map);
|
||||
}
|
||||
|
||||
static id
|
||||
static void
|
||||
serializeToInfo(id object, _NSSerializerInfo* info)
|
||||
{
|
||||
Class c = fastClass(object);
|
||||
|
|
|
@ -616,11 +616,9 @@ handle_printf_atsign (FILE *stream,
|
|||
|
||||
- (id) initWithContentsOfFile: (NSString*)path
|
||||
{
|
||||
unsigned char *buff;
|
||||
NSStringEncoding enc;
|
||||
id d = [NSData dataWithContentsOfFile: path];
|
||||
const unsigned char *test=[d bytes];
|
||||
unsigned len = [d length];
|
||||
|
||||
if (d == nil) return nil;
|
||||
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
|
||||
{
|
||||
unichar thischar;
|
||||
BOOL done;
|
||||
unsigned start, end, len;
|
||||
|
||||
len = [self length];
|
||||
|
@ -1139,50 +1136,54 @@ handle_printf_atsign (FILE *stream,
|
|||
start = aRange.location;
|
||||
|
||||
if (startIndex)
|
||||
if (start==0)
|
||||
*startIndex=0;
|
||||
else
|
||||
{
|
||||
start--;
|
||||
while (start > 0)
|
||||
{
|
||||
BOOL done = NO;
|
||||
{
|
||||
if (start==0)
|
||||
{
|
||||
*startIndex=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
start--;
|
||||
while (start > 0)
|
||||
{
|
||||
BOOL done = NO;
|
||||
|
||||
thischar = [self characterAtIndex: start];
|
||||
switch(thischar)
|
||||
{
|
||||
case (unichar)0x000A:
|
||||
case (unichar)0x000D:
|
||||
case (unichar)0x2028:
|
||||
case (unichar)0x2029:
|
||||
done = YES;
|
||||
break;
|
||||
default:
|
||||
start--;
|
||||
break;
|
||||
};
|
||||
if (done)
|
||||
break;
|
||||
};
|
||||
if (start == 0)
|
||||
{
|
||||
thischar = [self characterAtIndex: start];
|
||||
switch(thischar)
|
||||
{
|
||||
case (unichar)0x000A:
|
||||
case (unichar)0x000D:
|
||||
case (unichar)0x2028:
|
||||
case (unichar)0x2029:
|
||||
start++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
else
|
||||
start++;
|
||||
*startIndex = start;
|
||||
};
|
||||
thischar = [self characterAtIndex: start];
|
||||
switch(thischar)
|
||||
{
|
||||
case (unichar)0x000A:
|
||||
case (unichar)0x000D:
|
||||
case (unichar)0x2028:
|
||||
case (unichar)0x2029:
|
||||
done = YES;
|
||||
break;
|
||||
default:
|
||||
start--;
|
||||
break;
|
||||
};
|
||||
if (done)
|
||||
break;
|
||||
};
|
||||
if (start == 0)
|
||||
{
|
||||
thischar = [self characterAtIndex: start];
|
||||
switch(thischar)
|
||||
{
|
||||
case (unichar)0x000A:
|
||||
case (unichar)0x000D:
|
||||
case (unichar)0x2028:
|
||||
case (unichar)0x2029:
|
||||
start++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
else
|
||||
start++;
|
||||
*startIndex = start;
|
||||
}
|
||||
}
|
||||
|
||||
if (lineEndIndex || contentsEndIndex)
|
||||
{
|
||||
|
@ -1759,7 +1760,6 @@ handle_printf_atsign (FILE *stream,
|
|||
|
||||
- (NSString*) stringByExpandingTildeInPath
|
||||
{
|
||||
unichar *s;
|
||||
NSString *homedir;
|
||||
NSRange first_slash_range;
|
||||
|
||||
|
|
|
@ -37,8 +37,11 @@
|
|||
#include <Foundation/NSNotification.h>
|
||||
#include <Foundation/NSNotificationQueue.h>
|
||||
#include <Foundation/NSTask.h>
|
||||
#include <Foundation/NSLock.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -548,7 +551,7 @@ extern char *objc_find_executable(const char *name);
|
|||
}
|
||||
|
||||
chdir(path);
|
||||
execve(executable, args, envl);
|
||||
execve(executable, (char**)args, (char**)envl);
|
||||
exit(-1);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <config.h>
|
||||
#include <base/preface.h>
|
||||
#include <unistd.h>
|
||||
#include <Foundation/NSThread.h>
|
||||
#include <Foundation/NSLock.h>
|
||||
#include <Foundation/NSString.h>
|
||||
|
|
|
@ -729,7 +729,7 @@ decode (const void *ptr)
|
|||
|
||||
detail = [[NSConcreteTimeZoneDetail alloc]
|
||||
initWithTimeZone: zone
|
||||
withAbbrev: abbrevsArray[types[i].abbr_idx]
|
||||
withAbbrev: abbrevsArray[(int)types[i].abbr_idx]
|
||||
withOffset: types[i].offset
|
||||
withDST: (types[i].isdst > 0)];
|
||||
[detailsArray addObject: detail];
|
||||
|
|
518
Source/NSURL.m
518
Source/NSURL.m
|
@ -1,7 +1,7 @@
|
|||
/* NSUrl.m - Class NSURL
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jan 1999
|
||||
|
||||
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
|
||||
and GNUstep NSURL results but as there this class is not very documented, some
|
||||
function may be incorrect
|
||||
|
@ -52,448 +52,449 @@ NSString* NSURLPartKey_fragment=@"fragment";
|
|||
NSString* NSURLPartKey_parameterString=@"parameterString";
|
||||
NSString* NSURLPartKey_query=@"query";
|
||||
|
||||
//===================================================================================
|
||||
//=============================================================================
|
||||
@implementation NSURL
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
+(id)fileURLWithPath:(NSString*)_path
|
||||
//-----------------------------------------------------------------------------
|
||||
+ (id) fileURLWithPath: (NSString*)_path
|
||||
{
|
||||
return [[[NSURL alloc] initFileURLWithPath:_path]
|
||||
return [[[NSURL alloc] initFileURLWithPath: _path]
|
||||
autorelease];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
+(id)URLWithString:(NSString*)_urlString
|
||||
//-----------------------------------------------------------------------------
|
||||
+ (id)URLWithString: (NSString*)_urlString
|
||||
{
|
||||
return [[[NSURL alloc] initWithString:_urlString]
|
||||
return [[[NSURL alloc] initWithString: _urlString]
|
||||
autorelease];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
+(id)URLWithString:(NSString*)_urlString
|
||||
relativeToURL:(NSURL*)_baseURL
|
||||
//-----------------------------------------------------------------------------
|
||||
+ (id)URLWithString: (NSString*)_urlString
|
||||
relativeToURL: (NSURL*)_baseURL
|
||||
{
|
||||
return [[[NSURL alloc] initWithString:_urlString
|
||||
relativeToURL:_baseURL]
|
||||
return [[[NSURL alloc] initWithString: _urlString
|
||||
relativeToURL: _baseURL]
|
||||
autorelease];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(id)initWithScheme:(NSString*)_scheme
|
||||
host:(NSString*)_host
|
||||
path:(NSString*)_path
|
||||
//-----------------------------------------------------------------------------
|
||||
- (id) initWithScheme: (NSString*)_scheme
|
||||
host: (NSString*)_host
|
||||
path: (NSString*)_path
|
||||
{
|
||||
NSString* _urlString=nil;
|
||||
if (_host)
|
||||
_urlString=[NSString stringWithFormat:@"%@://%@",_scheme,_host];
|
||||
_urlString=[NSString stringWithFormat: @"%@: //%@",_scheme,_host];
|
||||
else
|
||||
_urlString=[NSString stringWithFormat:@"%@:",_scheme];
|
||||
_urlString=[NSString stringWithFormat: @"%@: ",_scheme];
|
||||
if (_path)
|
||||
_urlString=[_urlString stringByAppendingString:_path];
|
||||
self=[self initWithString:_urlString];
|
||||
_urlString=[_urlString stringByAppendingString: _path];
|
||||
self=[self initWithString: _urlString];
|
||||
return self;
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
//Non Standard Function
|
||||
-(id)initWithScheme:(NSString*)_scheme
|
||||
host:(NSString*)_host
|
||||
port:(NSNumber*)_port
|
||||
path:(NSString*)_path
|
||||
- (id) initWithScheme: (NSString*)_scheme
|
||||
host: (NSString*)_host
|
||||
port: (NSNumber*)_port
|
||||
path: (NSString*)_path
|
||||
{
|
||||
NSString* tmpHost=nil;
|
||||
if (_port)
|
||||
tmpHost=[NSString stringWithFormat:@"%@:%@",_host,_port];
|
||||
tmpHost=[NSString stringWithFormat: @"%@: %@",_host,_port];
|
||||
else
|
||||
tmpHost=_host;
|
||||
self=[self initWithScheme:_scheme
|
||||
host:tmpHost
|
||||
path:_path];
|
||||
self=[self initWithScheme: _scheme
|
||||
host: tmpHost
|
||||
path: _path];
|
||||
return self;
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
//Do a initWithScheme:NSFileScheme host:nil path:_path
|
||||
-(id)initFileURLWithPath:(NSString*)_path
|
||||
//-----------------------------------------------------------------------------
|
||||
//Do a initWithScheme: NSFileScheme host: nil path: _path
|
||||
- (id) initFileURLWithPath: (NSString*)_path
|
||||
{
|
||||
self=[self initWithScheme:NSURLFileScheme
|
||||
host:nil
|
||||
path:_path];
|
||||
self=[self initWithScheme: NSURLFileScheme
|
||||
host: nil
|
||||
path: _path];
|
||||
return self;
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// urlString is escaped
|
||||
-(id)initWithString:(NSString*)_urlString
|
||||
- (id) initWithString: (NSString*)_urlString
|
||||
{
|
||||
self=[self init];
|
||||
ASSIGNCOPY(urlString,_urlString);
|
||||
return self;
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
//urlString!=nil
|
||||
// urlString is escaped
|
||||
-(id)initWithString:(NSString*)_urlString
|
||||
relativeToURL:(NSURL*)_baseURL
|
||||
- (id) initWithString: (NSString*)_urlString
|
||||
relativeToURL: (NSURL*)_baseURL
|
||||
{
|
||||
self=[self init];
|
||||
ASSIGNCOPY(urlString,_urlString);
|
||||
ASSIGNCOPY(baseURL,_baseURL);
|
||||
return self;
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)dealloc
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) dealloc
|
||||
{
|
||||
DESTROY(urlString);
|
||||
DESTROY(baseURL);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(id)copyWithZone: (NSZone*)zone
|
||||
//-----------------------------------------------------------------------------
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
if (NSShouldRetainWithZone(self, zone) == NO)
|
||||
return [[isa allocWithZone: zone] initWithString:urlString
|
||||
relativeToURL:baseURL];
|
||||
return [[isa allocWithZone: zone] initWithString: urlString
|
||||
relativeToURL: baseURL];
|
||||
else
|
||||
return [self retain];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)encodeWithCoder:(NSCoder*)aCoder
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
[aCoder encodeObject:urlString];
|
||||
[aCoder encodeObject:baseURL];
|
||||
[aCoder encodeObject: urlString];
|
||||
[aCoder encodeObject: baseURL];
|
||||
//FIXME? clients ?
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(id)initWithCoder: (NSCoder*)aCoder
|
||||
//-----------------------------------------------------------------------------
|
||||
- (id) initWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
self = [super initWithCoder: aCoder];
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at:&urlString];
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at:&baseURL];
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &urlString];
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &baseURL];
|
||||
//FIXME? clients ?
|
||||
return self;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(NSString*)description
|
||||
//-----------------------------------------------------------------------------
|
||||
- (NSString*) description
|
||||
{
|
||||
NSString* dscr=urlString;
|
||||
if (baseURL)
|
||||
dscr=[dscr stringByAppendingFormat:@" -- %@",baseURL];
|
||||
dscr=[dscr stringByAppendingFormat: @" -- %@",baseURL];
|
||||
return dscr;
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Non Standard Function
|
||||
-(NSString*)baseURLAbsolutePart
|
||||
- (NSString*) baseURLAbsolutePart
|
||||
{
|
||||
if (baseURL)
|
||||
{
|
||||
NSString* suffix=[baseURL path];
|
||||
NSString* tmp=nil;
|
||||
if ([baseURL query])
|
||||
suffix=[suffix stringByAppendingFormat:@"?%@",[baseURL query]];
|
||||
// /test?aa=bb&cc=dd -- http://user:passwd@www.gnustep.org:80/apache
|
||||
// ==> http://user:passwd@www.gnustep.org:80/
|
||||
tmp=[[baseURL absoluteString]stringWithoutSuffix:suffix];
|
||||
suffix=[suffix stringByAppendingFormat: @"?%@",[baseURL query]];
|
||||
// /test?aa=bb&cc=dd -- http: //user: passwd@www.gnustep.org: 80/apache
|
||||
// ==> http: //user: passwd@www.gnustep.org: 80/
|
||||
tmp=[[baseURL absoluteString]stringWithoutSuffix: suffix];
|
||||
|
||||
// ==> http://user:passwd@www.gnustep.org:80
|
||||
if ([tmp hasSuffix:@"/"])
|
||||
tmp=[tmp stringWithoutSuffix:@"/"];
|
||||
// ==> http: //user: passwd@www.gnustep.org: 80
|
||||
if ([tmp hasSuffix: @"/"])
|
||||
tmp=[tmp stringWithoutSuffix: @"/"];
|
||||
return tmp;
|
||||
}
|
||||
else
|
||||
return @"";
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(NSString*)absoluteString
|
||||
//-----------------------------------------------------------------------------
|
||||
- (NSString*) absoluteString
|
||||
{
|
||||
NSString* absString=nil;
|
||||
if (baseURL)
|
||||
{
|
||||
// /test?aa=bb&cc=dd -- http://user:passwd@www.gnustep.org:80/apache
|
||||
// ==> http://user:passwd@www.gnustep.org:80
|
||||
// /test?aa=bb&cc=dd -- http: //user: passwd@www.gnustep.org: 80/apache
|
||||
// ==> http: //user: passwd@www.gnustep.org: 80
|
||||
absString=[self baseURLAbsolutePart];
|
||||
|
||||
if ([urlString hasPrefix:@"/"])
|
||||
absString=[absString stringByAppendingString:urlString];
|
||||
if ([urlString hasPrefix: @"/"])
|
||||
absString=[absString stringByAppendingString: urlString];
|
||||
else
|
||||
absString=[absString stringByAppendingFormat:@"/%@",urlString];
|
||||
absString=[absString stringByAppendingFormat: @"/%@",urlString];
|
||||
}
|
||||
else
|
||||
absString=urlString;
|
||||
return absString;
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(NSString*)relativeString
|
||||
//-----------------------------------------------------------------------------
|
||||
- (NSString*) relativeString
|
||||
{
|
||||
return urlString;
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(NSURL*)baseURL
|
||||
//-----------------------------------------------------------------------------
|
||||
- (NSURL*) baseURL
|
||||
{
|
||||
return baseURL;
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(NSURL*)absoluteURL
|
||||
//-----------------------------------------------------------------------------
|
||||
- (NSURL*) absoluteURL
|
||||
{
|
||||
if (!baseURL)
|
||||
return self;
|
||||
else
|
||||
return [NSURL URLWithString:[self absoluteString]];
|
||||
};
|
||||
return [NSURL URLWithString: [self absoluteString]];
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(NSString*)scheme
|
||||
//-----------------------------------------------------------------------------
|
||||
- (NSString*) scheme
|
||||
{
|
||||
NSString* scheme=nil;
|
||||
NSString* absoluteString=[self absoluteString];
|
||||
NSRange range=[absoluteString rangeOfString:@"://"];
|
||||
NSRange range=[absoluteString rangeOfString: @": //"];
|
||||
if (range.length>0)
|
||||
scheme=[absoluteString substringToIndex:range.location];
|
||||
scheme=[absoluteString substringToIndex: range.location];
|
||||
return scheme;
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(NSString*)resourceSpecifier
|
||||
//-----------------------------------------------------------------------------
|
||||
- (NSString*) resourceSpecifier
|
||||
{
|
||||
NSString* absoluteString=[self absoluteString];
|
||||
NSRange range=[absoluteString rangeOfString:@"://"];
|
||||
NSRange range=[absoluteString rangeOfString: @": //"];
|
||||
if (range.length>0)
|
||||
return [absoluteString substringFromIndex:range.location+1];
|
||||
return [absoluteString substringFromIndex: range.location+1];
|
||||
else
|
||||
return absoluteString;
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
//Non Standard Function
|
||||
-(NSDictionary*)explode
|
||||
- (NSDictionary*) explode
|
||||
{
|
||||
NSMutableDictionary* elements=nil;
|
||||
NSString* resourceSpecifier=[self resourceSpecifier];
|
||||
if ([resourceSpecifier hasPrefix:@"//"])
|
||||
if ([resourceSpecifier hasPrefix: @"//"])
|
||||
{
|
||||
int index=2;
|
||||
NSRange range;
|
||||
elements=[[NSMutableDictionary new] autorelease];
|
||||
if (![[self scheme] isEqualToString:NSURLFileScheme])
|
||||
if (![[self scheme] isEqualToString: NSURLFileScheme])
|
||||
{
|
||||
range=[resourceSpecifier rangeOfString:@"/"
|
||||
options:0
|
||||
range:NSMakeRange(index,[resourceSpecifier length]-index)];
|
||||
range=[resourceSpecifier rangeOfString: @"/"
|
||||
options: 0
|
||||
range: NSMakeRange(index,[resourceSpecifier length]-index)];
|
||||
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* hostPort=nil;
|
||||
index=range.location;
|
||||
range=[userPasswordHostPort rangeOfString:@"@"];
|
||||
range=[userPasswordHostPort rangeOfString: @"@"];
|
||||
if (range.length>0)
|
||||
{
|
||||
if (range.location>0)
|
||||
userPassword=[userPasswordHostPort substringToIndex:range.location];
|
||||
userPassword=[userPasswordHostPort substringToIndex: range.location];
|
||||
if (range.location+1<[userPasswordHostPort length])
|
||||
hostPort=[userPasswordHostPort substringFromIndex:range.location+1];
|
||||
hostPort=[userPasswordHostPort substringFromIndex: range.location+1];
|
||||
}
|
||||
else
|
||||
hostPort=userPasswordHostPort;
|
||||
if (userPassword)
|
||||
{
|
||||
range=[userPassword rangeOfString:@":"];
|
||||
range=[userPassword rangeOfString: @": "];
|
||||
if (range.length>0)
|
||||
{
|
||||
if (range.location>0)
|
||||
[elements setObject:[userPassword substringToIndex:range.location]
|
||||
forKey:NSURLPartKey_user];
|
||||
[elements setObject: [userPassword substringToIndex: range.location]
|
||||
forKey: NSURLPartKey_user];
|
||||
if (range.location+1<[userPassword length])
|
||||
[elements setObject:[userPassword substringFromIndex:range.location+1]
|
||||
forKey:NSURLPartKey_password];
|
||||
[elements setObject: [userPassword substringFromIndex: range.location+1]
|
||||
forKey: NSURLPartKey_password];
|
||||
}
|
||||
else
|
||||
[elements setObject:userPassword
|
||||
forKey:NSURLPartKey_user];
|
||||
};
|
||||
[elements setObject: userPassword
|
||||
forKey: NSURLPartKey_user];
|
||||
}
|
||||
|
||||
if (hostPort)
|
||||
{
|
||||
range=[hostPort rangeOfString:@":"];
|
||||
range=[hostPort rangeOfString: @": "];
|
||||
if (range.length>0)
|
||||
{
|
||||
if (range.location>0)
|
||||
[elements setObject:[hostPort substringToIndex:range.location]
|
||||
forKey:NSURLPartKey_host];
|
||||
[elements setObject: [hostPort substringToIndex: range.location]
|
||||
forKey: NSURLPartKey_host];
|
||||
if (range.location+1<[hostPort length])
|
||||
[elements setObject:[NSNumber valueFromString:
|
||||
[hostPort substringFromIndex:range.location+1]]
|
||||
forKey:NSURLPartKey_port];
|
||||
[elements setObject: [NSNumber valueFromString:
|
||||
[hostPort substringFromIndex: range.location+1]]
|
||||
forKey: NSURLPartKey_port];
|
||||
}
|
||||
else
|
||||
[elements setObject:hostPort
|
||||
forKey:NSURLPartKey_host];
|
||||
[elements setObject: hostPort
|
||||
forKey: NSURLPartKey_host];
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
else
|
||||
index--; //To Take a /
|
||||
range=[resourceSpecifier rangeOfString:@"?"
|
||||
options:0
|
||||
range:NSMakeRange(index,[resourceSpecifier length]-index)];
|
||||
range=[resourceSpecifier rangeOfString: @"?"
|
||||
options: 0
|
||||
range: NSMakeRange(index,[resourceSpecifier length]-index)];
|
||||
if (range.length>0)
|
||||
{
|
||||
if (range.location>0)
|
||||
[elements setObject:[resourceSpecifier substringWithRange:NSMakeRange(index,range.location-index)]
|
||||
forKey:NSURLPartKey_path];
|
||||
[elements setObject: [resourceSpecifier substringWithRange: NSMakeRange(index,range.location-index)]
|
||||
forKey: NSURLPartKey_path];
|
||||
if (range.location+1<[resourceSpecifier length])
|
||||
[elements setObject:[resourceSpecifier substringFromIndex:range.location+1]
|
||||
forKey:NSURLPartKey_query];
|
||||
[elements setObject: [resourceSpecifier substringFromIndex: range.location+1]
|
||||
forKey: NSURLPartKey_query];
|
||||
}
|
||||
else
|
||||
[elements setObject:[resourceSpecifier substringFromIndex:index]
|
||||
forKey:NSURLPartKey_path];
|
||||
[elements setObject: [resourceSpecifier substringFromIndex: index]
|
||||
forKey: NSURLPartKey_path];
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise:NSGenericException
|
||||
format:@"'%@' is a bad URL",self];
|
||||
};
|
||||
[NSException raise: NSGenericException
|
||||
format: @"'%@' is a bad URL",self];
|
||||
}
|
||||
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?
|
||||
return [self path];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(BOOL)isFileURL
|
||||
//-----------------------------------------------------------------------------
|
||||
- (BOOL) isFileURL
|
||||
{
|
||||
return [[self scheme] isEqualToString:NSURLFileScheme];
|
||||
};
|
||||
return [[self scheme] isEqualToString: NSURLFileScheme];
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(NSURL*)standardizedURL
|
||||
//-----------------------------------------------------------------------------
|
||||
- (NSURL*) standardizedURL
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return nil;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void) URLHandle:(NSURLHandle*)sender
|
||||
resourceDataDidBecomeAvailable:(NSData*)newData
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) URLHandle: (NSURLHandle*)sender
|
||||
resourceDataDidBecomeAvailable: (NSData*)newData
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)URLHandleResourceDidBeginLoading:(NSURLHandle*)sender
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void)URLHandleResourceDidBeginLoading: (NSURLHandle*)sender
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)URLHandleResourceDidFinishLoading:(NSURLHandle*)sender
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void)URLHandleResourceDidFinishLoading: (NSURLHandle*)sender
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)URLHandleResourceDidCancelLoading:(NSURLHandle*)sender
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void)URLHandleResourceDidCancelLoading: (NSURLHandle*)sender
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void) URLHandle:(NSURLHandle*)sender
|
||||
resourceDidFailLoadingWithReason:(NSString*)reason
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) URLHandle: (NSURLHandle*)sender
|
||||
resourceDidFailLoadingWithReason: (NSString*)reason
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
//FIXME: delete these fn when NSURL will be validated
|
||||
+(void)test
|
||||
+ (void) test
|
||||
{
|
||||
NSURL* url2;
|
||||
NSURL* url3;
|
||||
NSURL* url=[NSURL URLWithString:@"http://user:passwd@www.gnustep.org:80/apache"];
|
||||
url2=[NSURL URLWithString:@"/test?aa=bb&cc=dd" relativeToURL:url];
|
||||
url3=[NSURL URLWithString:@"test?aa=bb&cc=dd" relativeToURL:url];
|
||||
NSURL* url=[NSURL URLWithString: @"http: //user: passwd@www.gnustep.org: 80/apache"];
|
||||
url2=[NSURL URLWithString: @"/test?aa=bb&cc=dd" relativeToURL: url];
|
||||
url3=[NSURL URLWithString: @"test?aa=bb&cc=dd" relativeToURL: url];
|
||||
NSLog(@"===url===");
|
||||
[NSURL testPrint:url];
|
||||
[NSURL testPrint: url];
|
||||
NSLog(@"===url2===");
|
||||
[NSURL testPrint:url2];
|
||||
[NSURL testPrint: url2];
|
||||
NSLog(@"===url3===");
|
||||
[NSURL testPrint:url3];
|
||||
};
|
||||
[NSURL testPrint: url3];
|
||||
}
|
||||
|
||||
+(void)testPrint:(NSURL*)url
|
||||
+ (void) testPrint: (NSURL*)url
|
||||
{
|
||||
id _baseURL=nil;
|
||||
id _urlString=nil;
|
||||
|
@ -521,92 +522,97 @@ NSString* NSURLPartKey_query=@"query";
|
|||
NSLog(@"*scheme: %@",[url scheme]);
|
||||
NSLog(@"*resourceSpecifier: %@",[url resourceSpecifier]);
|
||||
NSLog(@"*description: %@",[url description]);
|
||||
};
|
||||
}
|
||||
@end
|
||||
|
||||
//===================================================================================
|
||||
//=============================================================================
|
||||
@implementation NSURL (NSURLLoading)
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(NSData*)resourceDataUsingCache:(BOOL)shouldUseCache
|
||||
//-----------------------------------------------------------------------------
|
||||
- (NSData*) resourceDataUsingCache: (BOOL)shouldUseCache
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return nil;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)loadResourceDataNotifyingClient:(id)client
|
||||
usingCache:(BOOL)shouldUseCache
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) loadResourceDataNotifyingClient: (id)client
|
||||
usingCache: (BOOL)shouldUseCache
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(NSURLHandle*)URLHandleUsingCache:(BOOL)shouldUseCache
|
||||
//-----------------------------------------------------------------------------
|
||||
- (NSURLHandle*)URLHandleUsingCache: (BOOL)shouldUseCache
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return nil;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(BOOL)setResourceData:(NSData*)data
|
||||
//-----------------------------------------------------------------------------
|
||||
- (BOOL) setResourceData: (NSData*)data
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return NO;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(id)propertyForKey:(NSString*)propertyKey
|
||||
//-----------------------------------------------------------------------------
|
||||
- (id) propertyForKey: (NSString*)propertyKey
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return nil;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(BOOL)setProperty:(id)property
|
||||
forKey:(NSString*)propertyKey;
|
||||
//-----------------------------------------------------------------------------
|
||||
- (BOOL) setProperty: (id)property
|
||||
forKey: (NSString*)propertyKey;
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
//===================================================================================
|
||||
//=============================================================================
|
||||
@implementation NSObject (NSURLClient)
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void) URL:(NSURL*)sender
|
||||
resourceDataDidBecomeAvailable:(NSData*)newBytes
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) URL: (NSURL*)sender
|
||||
resourceDataDidBecomeAvailable: (NSData*)newBytes
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)URLResourceDidFinishLoading:(NSURL*)sender
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) URLResourceDidFinishLoading: (NSURL*)sender
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)URLResourceDidCancelLoading:(NSURL*)sender
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) URLResourceDidCancelLoading: (NSURL*)sender
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void) URL:(NSURL*)sender
|
||||
resourceDidFailLoadingWithReason:(NSString*)reason
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) URL: (NSURL*)sender
|
||||
resourceDidFailLoadingWithReason: (NSString*)reason
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* NSURLHandle.h - Class NSURLHandle
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
||||
Date: Jan 1999
|
||||
|
||||
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
|
||||
how it should work...
|
||||
*/
|
||||
|
@ -36,171 +36,184 @@ how it should work...
|
|||
#include <Foundation/NSURLHandle.h>
|
||||
#include <Foundation/NSURL.h>
|
||||
|
||||
//===================================================================================
|
||||
//=============================================================================
|
||||
@implementation NSURLHandle
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
+(void)registerURLHandleClass:(Class)_urlHandleSubclass
|
||||
//-----------------------------------------------------------------------------
|
||||
+ (void) registerURLHandleClass: (Class)_urlHandleSubclass
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
+(Class)URLHandleClassForURL:(NSURL*)_url
|
||||
//-----------------------------------------------------------------------------
|
||||
+ (Class)URLHandleClassForURL: (NSURL*)_url
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(id)initWithURL:(NSURL*)_url
|
||||
cached:(BOOL)_cached
|
||||
//-----------------------------------------------------------------------------
|
||||
- (id) initWithURL: (NSURL*)_url
|
||||
cached: (BOOL)_cached
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return nil;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(NSURLHandleStatus)status
|
||||
//-----------------------------------------------------------------------------
|
||||
- (NSURLHandleStatus) status
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return (NSURLHandleStatus)0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(NSString*)failureReason
|
||||
//-----------------------------------------------------------------------------
|
||||
- (NSString*) failureReason
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return nil;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)addClient:(id <NSURLHandleClient>)_client
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) addClient: (id <NSURLHandleClient>)_client
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)removeClient:(id <NSURLHandleClient>)_client
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) removeClient: (id <NSURLHandleClient>)_client
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)loadInBackground
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) loadInBackground
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)cancelLoadInBackground
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) cancelLoadInBackground
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(NSData*)resourceData
|
||||
//-----------------------------------------------------------------------------
|
||||
- (NSData*) resourceData
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return nil;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(NSData*)availableResourceData
|
||||
//-----------------------------------------------------------------------------
|
||||
- (NSData*) availableResourceData
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return nil;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)flushCachedData
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) flushCachedData
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)backgroundLoadDidFailWithReason:(NSString*)reason
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) backgroundLoadDidFailWithReason: (NSString*)reason
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)didLoadBytes:(NSData*)newData
|
||||
loadComplete:(BOOL)_loadComplete
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) didLoadBytes: (NSData*)newData
|
||||
loadComplete: (BOOL)_loadComplete
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
+(BOOL)canInitWithURL:(NSURL*)_url
|
||||
//-----------------------------------------------------------------------------
|
||||
+ (BOOL) canInitWithURL: (NSURL*)_url
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return NO;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
+(NSURLHandle*)cachedHandleForURL:(NSURL*)_url
|
||||
//-----------------------------------------------------------------------------
|
||||
+ (NSURLHandle*) cachedHandleForURL: (NSURL*)_url
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return nil;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(id)propertyForKey:(NSString*)propertyKey
|
||||
//-----------------------------------------------------------------------------
|
||||
- (id) propertyForKey: (NSString*)propertyKey
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return nil;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(id)propertyForKeyIfAvailable:(NSString*)propertyKey
|
||||
//-----------------------------------------------------------------------------
|
||||
- (id) propertyForKeyIfAvailable: (NSString*)propertyKey
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return nil;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(BOOL)writeProperty:(id)propertyValue
|
||||
forKey:(NSString*)propertyKey
|
||||
//-----------------------------------------------------------------------------
|
||||
- (BOOL) writeProperty: (id)propertyValue
|
||||
forKey: (NSString*)propertyKey
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return NO;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(BOOL)writeData:(NSData*)data
|
||||
//-----------------------------------------------------------------------------
|
||||
- (BOOL) writeData: (NSData*)data
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return NO;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(NSData*)loadInForeground
|
||||
//-----------------------------------------------------------------------------
|
||||
- (NSData*) loadInForeground
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
return nil;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)beginLoadInBackground
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) beginLoadInBackground
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
-(void)endLoadInBackground
|
||||
//-----------------------------------------------------------------------------
|
||||
- (void) endLoadInBackground
|
||||
{
|
||||
//FIXME
|
||||
[self notImplemented: _cmd];
|
||||
};
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
/*
|
||||
* 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_TYPES GSUNION_OBJ|GSUNION_SEL|GSUNION_STR
|
||||
|
||||
|
@ -718,7 +718,6 @@ mapClassName(NSUnarchiverObjectInfo *info)
|
|||
else
|
||||
{
|
||||
unsigned size;
|
||||
NSData *dat;
|
||||
|
||||
if (GSIArrayCount(ptrMap) != xref)
|
||||
{
|
||||
|
@ -744,8 +743,6 @@ mapClassName(NSUnarchiverObjectInfo *info)
|
|||
|
||||
case _GSC_CHARPTR:
|
||||
{
|
||||
char *str;
|
||||
|
||||
typeCheck(*type, _GSC_CHARPTR);
|
||||
/*
|
||||
* Special case - a zero crossref value size is a nil pointer.
|
||||
|
@ -766,8 +763,6 @@ mapClassName(NSUnarchiverObjectInfo *info)
|
|||
}
|
||||
else
|
||||
{
|
||||
int length;
|
||||
|
||||
if (xref != GSIArrayCount(ptrMap))
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
|
@ -970,8 +965,7 @@ mapClassName(NSUnarchiverObjectInfo *info)
|
|||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Decoding data object with unknown type"];
|
||||
}
|
||||
else
|
||||
return [NSData data];
|
||||
return [NSData data];
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -677,7 +677,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
|
|||
}
|
||||
}
|
||||
if (wantRead == NO)
|
||||
return;
|
||||
return YES;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1576,7 +1576,6 @@ NSCreateZone (size_t start, size_t gran, BOOL canFree)
|
|||
ffree_zone *zone;
|
||||
ff_block *block;
|
||||
ff_block *chunk;
|
||||
ff_block *header;
|
||||
ff_block *tailer;
|
||||
|
||||
zone = objc_malloc(sizeof(ffree_zone));
|
||||
|
@ -1704,10 +1703,10 @@ NSZoneRealloc (NSZone *zone, void *ptr, size_t size)
|
|||
inline void
|
||||
NSRecycleZone (NSZone *zone)
|
||||
{
|
||||
if (zone == 0)
|
||||
zone == NSDefaultMallocZone();
|
||||
if (zone == 0)
|
||||
zone = NSDefaultMallocZone();
|
||||
|
||||
(zone->recycle)(zone);
|
||||
(zone->recycle)(zone);
|
||||
}
|
||||
|
||||
inline void
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include <sys/param.h> /* for MAXHOSTNAMELEN */
|
||||
#include <netinet/in.h> /* for inet_ntoa() */
|
||||
#include <fcntl.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
|
@ -1207,7 +1208,7 @@ static NSMapTable* port_number_2_port;
|
|||
#ifndef HAVE_INET_ATON
|
||||
p->_listening_address.sin_addr.s_addr = inet_addr("127.0.0.1");
|
||||
#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
|
||||
}
|
||||
else
|
||||
|
@ -1247,7 +1248,6 @@ static NSMapTable* port_number_2_port;
|
|||
fromPort: (int)portn
|
||||
{
|
||||
TcpInPort* p = [self newForReceivingFromPortNumber: portn];
|
||||
struct sockaddr_in sin;
|
||||
|
||||
if (p) {
|
||||
[[NSPortNameServer defaultPortNameServer] registerPort: p
|
||||
|
@ -1808,7 +1808,7 @@ static NSMapTable *out_port_bag = NULL;
|
|||
|| (p->_remote_in_port_address.sin_addr.s_addr
|
||||
!= sockaddr->sin_addr.s_addr))
|
||||
{
|
||||
NSString *od = [p description];
|
||||
// NSString *od = [p description];
|
||||
|
||||
NSMapRemove (out_port_bag, (void*)p);
|
||||
memcpy (&(p->_remote_in_port_address),
|
||||
|
|
|
@ -519,10 +519,12 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
isStandardFile = NO;
|
||||
|
||||
if ((e = fcntl(desc, F_GETFL, 0)) >= 0)
|
||||
if (e & NBLK_OPT)
|
||||
wasNonBlocking = YES;
|
||||
else
|
||||
wasNonBlocking = NO;
|
||||
{
|
||||
if (e & NBLK_OPT)
|
||||
wasNonBlocking = YES;
|
||||
else
|
||||
wasNonBlocking = NO;
|
||||
}
|
||||
|
||||
isNonBlocking = wasNonBlocking;
|
||||
descriptor = desc;
|
||||
|
@ -1222,7 +1224,6 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
struct sockaddr_in buf;
|
||||
int desc;
|
||||
int blen = sizeof(buf);
|
||||
NSFileHandle* hdl;
|
||||
|
||||
desc = accept(descriptor, (struct sockaddr*)&buf, &blen);
|
||||
if (desc < 0)
|
||||
|
|
|
@ -156,7 +156,7 @@ static BOOL skipSpace(pldata *pld)
|
|||
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] == '/')
|
||||
{
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSDistributedNotificationCenter.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "gdnc.h"
|
||||
|
||||
@interface GDNCNotification : NSObject
|
||||
|
@ -390,6 +392,7 @@
|
|||
}
|
||||
NSMapRemove(connections, connection);
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) registerClient: (id<GDNCClient>)client
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <string.h> /* for strchr() */
|
||||
#include <ctype.h> /* for strchr() */
|
||||
#ifndef __WIN32__
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
|
@ -451,7 +452,7 @@ map_by_port(unsigned p, unsigned char t)
|
|||
{
|
||||
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);
|
||||
}
|
||||
return map[index];
|
||||
|
@ -700,7 +701,7 @@ dump_stats()
|
|||
fprintf(stderr, "tcp messages waiting for send - %d\n", tcp_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, "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, "UDP %d read, %d sent\n", udp_read, udp_sent);
|
||||
}
|
||||
|
@ -1544,7 +1545,6 @@ handle_io()
|
|||
else if (rval == 0)
|
||||
{
|
||||
long now = time(0);
|
||||
int i;
|
||||
|
||||
/*
|
||||
* 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, " - 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 &&
|
||||
|
@ -1819,7 +1819,7 @@ handle_request(int desc)
|
|||
{
|
||||
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;
|
||||
|
@ -2970,7 +2970,7 @@ printf(
|
|||
fprintf(stderr, "Registration will take place locally.\n");
|
||||
}
|
||||
doregister(optarg, port, ptype);
|
||||
return;
|
||||
return 0;
|
||||
|
||||
case 'T':
|
||||
if (strcmp(optarg, "tcp_gdo") == 0)
|
||||
|
|
|
@ -33,7 +33,6 @@ int
|
|||
main(int argc, char** argv)
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSUserDefaults *defs;
|
||||
NSProcessInfo *proc;
|
||||
NSArray *args;
|
||||
unsigned i;
|
||||
|
|
|
@ -31,7 +31,6 @@ int
|
|||
main(int argc, char** argv)
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSUserDefaults *defs;
|
||||
NSProcessInfo *proc;
|
||||
NSArray *args;
|
||||
unsigned i;
|
||||
|
|
|
@ -33,7 +33,6 @@ int
|
|||
main(int argc, char** argv)
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSUserDefaults *defs;
|
||||
NSProcessInfo *proc;
|
||||
NSArray *args;
|
||||
unsigned i;
|
||||
|
|
|
@ -31,7 +31,6 @@ int
|
|||
main(int argc, char** argv)
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSUserDefaults *defs;
|
||||
NSProcessInfo *proc;
|
||||
NSArray *args;
|
||||
unsigned i;
|
||||
|
|
Loading…
Reference in a new issue