Finish NSFileHandle's stubbed methods#2477
Conversation
This commit marks roughly half of NSFileHandle's APIs NotInPlan. WinSock deals in opaque handles which cannot be used with open/close/seek/tell/read/write, so most of NSFileHandle's APIs cannot be supported with the POSIX File Descriptor interface. The background APIs are better suited to use with a socket than with a file, so until somebody asks for socket support, we will mark them unplanned. File handles cannot be coded except through IPC coders, but WinObjC does not have any IPC coders. Fixes microsoft#2367.
| @Status Interoperable | ||
| */ | ||
| + (NSFileHandle*)fileHandleWithNullDevice { | ||
| return [[_NSFileHandleNullDevice new] autorelease]; |
There was a problem hiding this comment.
TakeOwnership LIIIIIIVESSSSSSSSS
| @Notes NSFileHandle only supports file URLs. | ||
| */ | ||
| + (instancetype)fileHandleForReadingFromURL:(NSURL*)url error:(NSError* _Nullable*)error { | ||
| return [NSFileHandle _fileHandleForURl:url error:error openType:_NSFileOpenModeRead]; |
| - (instancetype)_initWithFileAtPath:(NSString*)file openType:(_NSFileOpenMode)type { | ||
| if (file == nil) { | ||
| [self release]; | ||
| return nil; |
There was a problem hiding this comment.
nit: empty space after curly brace.
| O_RDWR | _O_CREAT | O_APPEND | _O_BINARY, | ||
| _SH_DENYNO, | ||
| _S_IREAD | _S_IWRITE); | ||
| default: |
There was a problem hiding this comment.
Since this is internal, should we fail if we get an invalid type?
| - (void)waitForDataInBackgroundAndNotifyForModes:(NSArray*)modes STUB_METHOD; | ||
| @property (readonly) int fileDescriptor; | ||
| @property (readonly, copy) NSData* availableData; | ||
| @property (readonly) unsigned long long offsetInFile; |
There was a problem hiding this comment.
super duper ultra nit: no implied int
| NSString* const NSFileHandleNotificationDataItem = @"NSFileHandleNotificationDataItem"; | ||
| NSString* const NSFileHandleOperationException = @"NSFileHandleOperationException"; | ||
| NSString* const NSFileHandleNotificationMonitorModes = @"NSFileHandleNotificationMonitorModes"; | ||
| NSString* const NSFileHandleConnectionAcceptedNotification = @"NSFileHandleConnectionAccepted"; |
There was a problem hiding this comment.
Do we want to "fix" these strings if they are not the right values already?
|
|
||
| /** | ||
| @Status Stub | ||
| @Notes |
There was a problem hiding this comment.
The header file must be updated too, to remove the STUB_* macros (and add NOTINPLAN_* macros where applicable.
There was a problem hiding this comment.
Ugh I can't see things today, my bad :(
|
|
||
| /** | ||
| @Status Stub | ||
| @Notes |
There was a problem hiding this comment.
Ugh I can't see things today, my bad :(
This commit marks roughly half of NSFileHandle's APIs NotInPlan.
WinSock deals in opaque handles which cannot be used with
open/close/seek/tell/read/write, so most of NSFileHandle's APIs cannot
be supported with the POSIX File Descriptor interface.
The background APIs are better suited to use with a socket than with a
file, so until somebody asks for socket support, we will mark them
unplanned.
File handles cannot be coded except through IPC coders, but WinObjC does
not have any IPC coders.
Fixes #2367.