Minor fixes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2975 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1998-09-10 04:48:50 +00:00
parent 098425e3e0
commit 7b485d9c07
8 changed files with 54 additions and 22 deletions

View file

@ -1,3 +1,14 @@
Thu Sep 10 06:05:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* src/NSFileHandle.m: Implemented [(-waitForDataInBackground])
* src/UnixFileHandle.m: Implemented [(-waitForDataInBackground])
* src/include/NSFileHandle.h: Added [(-waitForDataInBackground])
* src/externs.m: Fixed error in hash callbacks name.
* src/Set.m: Fixed error in hash callbacks name.
* src/include/NSHashTable.h: Fixed error in hash callbacks name.
* src/NSRunLoop.m: minor efficiency hack - don't use autoreleasing
arrray construction methods when we are going to retain immediately.
Fri Sep 04 08:05:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* src/NSUserDefaults.m: ([-setObjectsforKey:], [-removeObjectForKey:])

View file

@ -65,6 +65,8 @@
- (void)readInBackgroundAndNotify;
- (void)readToEndOfFileInBackgroundAndNotifyForModes:(NSArray*)modes;
- (void)readToEndOfFileInBackgroundAndNotify;
- (void)waitForDataInBackgroundAndNotifyForModes:(NSArray*)modes;
- (void)waitForDataInBackgroundAndNotify;
// Seeking within a file
@ -83,6 +85,7 @@
// Notification names.
extern NSString* NSFileHandleConnectionAcceptedNotification;
extern NSString* NSFileHandleDataAvailableNotification;
extern NSString* NSFileHandleReadCompletionNotification;
extern NSString* NSFileHandleReadToEndOfFileCompletionNotification;

View file

@ -72,7 +72,7 @@ extern const NSHashTableCallBacks NSNonOwnedPointerHashCallBacks;
extern const NSHashTableCallBacks NSNonRetainedObjectHashCallBacks;
/* For sets of objects; similar to NSSet. */
extern const NSHashTableCallBacks NSObjectsHashCallBacks;
extern const NSHashTableCallBacks NSObjectHashCallBacks;
/* For sets of pointers with transfer of ownership upon insertion. */
extern const NSHashTableCallBacks NSOwnedPointerHashCallBacks;

View file

@ -196,6 +196,16 @@ static Class NSFileHandle_concrete_class = nil;
[self subclassResponsibility:_cmd];
}
- (void)waitForDataInBackgroundAndNotifyForModes:(NSArray*)modes
{
[self subclassResponsibility:_cmd];
}
- (void)waitForDataInBackgroundAndNotify
{
[self subclassResponsibility:_cmd];
}
// Seeking within a file
@ -250,6 +260,8 @@ NSString* NSFileHandleNotificationMonitorModes =
NSString* NSFileHandleConnectionAcceptedNotification =
@"NSFileHandleConnectionAcceptedNotification";
NSString* NSFileHandleDataAvailableNotification =
@"NSFileHandleDataAvailableNotification";
NSString* NSFileHandleReadCompletionNotification =
@"NSFileHandleReadCompletionNotification";
NSString* NSFileHandleReadToEndOfFileCompletionNotification =

View file

@ -750,8 +750,8 @@ static int debug_run_loop = 0;
NSObjectMapValueCallBacks, 0);
_mode_2_watchers = NSCreateMapTable (NSObjectMapKeyCallBacks,
NSObjectMapValueCallBacks, 0);
_performers = [[NSMutableArray arrayWithCapacity:8] retain];
_timedPerformers = [[NSMutableArray arrayWithCapacity:8] retain];
_performers = [[NSMutableArray alloc] initWithCapacity:8];
_timedPerformers = [[NSMutableArray alloc] initWithCapacity:8];
return self;
}

View file

@ -46,7 +46,7 @@
/* This is the designated initializer of this class */
- initWithCapacity: (unsigned)cap
{
_contents_hash = NSCreateHashTable(NSObjectsHashCallBacks, cap);
_contents_hash = NSCreateHashTable(NSObjectHashCallBacks, cap);
return self;
}
@ -64,7 +64,7 @@
- _initCollectionWithCoder: aCoder
{
[super _initCollectionWithCoder:aCoder];
_contents_hash = NSCreateHashTable(NSObjectsHashCallBacks,
_contents_hash = NSCreateHashTable(NSObjectHashCallBacks,
DEFAULT_SET_CAPACITY);
return self;
}
@ -74,7 +74,7 @@
{
Set *copy = [super emptyCopy];
copy->_contents_hash =
NSCreateHashTable (NSObjectsHashCallBacks, 0);
NSCreateHashTable (NSObjectHashCallBacks, 0);
return copy;
}

View file

@ -645,22 +645,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
else
{
int count;
fd_set fds;
fd_set dummy;
int rval;
/*
* Check that channel is readable.
*/
FD_ZERO(&fds);
FD_ZERO(&dummy);
FD_SET(descriptor, &fds);
if (select(descriptor+1, &fds, &dummy, &dummy, 0) < 0)
{
[NSException raise: NSFileHandleOperationException
format: @"failed to use select() on descriptor - %s",
strerror(errno)];
}
/*
* Determine number of bytes readable on descriptor.
*/
@ -824,6 +809,24 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
return [self readToEndOfFileInBackgroundAndNotifyForModes:nil];
}
- (void)waitForDataInBackgroundAndNotifyForModes:(NSArray*)modes
{
[self checkRead];
readPos = 0;
[readInfo release];
readInfo = [[NSMutableDictionary dictionaryWithCapacity:4] retain];
[readInfo setObject:NSFileHandleDataAvailableNotification
forKey:NotificationKey];
[readInfo setObject:[NSMutableData dataWithCapacity:0]
forKey:NSFileHandleNotificationDataItem];
[self watchReadDescriptorForModes:modes];
}
- (void)waitForDataInBackgroundAndNotify
{
return [self waitForDataInBackgroundAndNotifyForModes:nil];
}
// Seeking within a file
- (unsigned long long)offsetInFile
@ -1165,6 +1168,9 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
}
[self postReadNotification];
}
else if (operation == NSFileHandleDataAvailableNotification) {
[self postReadNotification];
}
else {
NSMutableData* item;
int length;

View file

@ -265,7 +265,7 @@ const NSHashTableCallBacks NSNonRetainedObjectHashCallBacks =
(NSHT_describe_func_t) _NS_non_retained_id_describe
};
const NSHashTableCallBacks NSObjectsHashCallBacks =
const NSHashTableCallBacks NSObjectHashCallBacks =
{
(NSHT_hash_func_t) _NS_id_hash,
(NSHT_isEqual_func_t) _NS_id_is_equal,