-
Notifications
You must be signed in to change notification settings - Fork 806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finish NSFileHandle's stubbed methods #2477
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]; | ||
static StrongId<NSFileHandle> nullDeviceHandle{ woc::TakeOwnership, [_NSFileHandleNullDevice new] }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TakeOwnership LIIIIIIVESSSSSSSSS
@Status Caveat | ||
@Notes NSFileHandle only supports file URLs. | ||
*/ | ||
+ (instancetype)fileHandleForReadingFromURL:(NSURL*)url error:(NSError* _Nullable*)error { | ||
return [NSFileHandle _fileHandleForURl:url error:error openType:_NSFileOpenModeRead]; | ||
return [NSFileHandle _fileHandleForURL:url error:error openType:_NSFileOpenModeRead]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😱
if (file == nil) { | ||
[self release]; | ||
return nil; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: empty space after curly brace.
_SH_DENYNO, | ||
_S_IREAD | _S_IWRITE); | ||
default: | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super duper ultra nit: no implied int
@@ -28,6 +28,10 @@ | |||
NSString* const NSFileHandleNotificationDataItem = @"NSFileHandleNotificationDataItem"; | |||
NSString* const NSFileHandleOperationException = @"NSFileHandleOperationException"; | |||
NSString* const NSFileHandleNotificationMonitorModes = @"NSFileHandleNotificationMonitorModes"; | |||
NSString* const NSFileHandleConnectionAcceptedNotification = @"NSFileHandleConnectionAccepted"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to "fix" these strings if they are not the right values already?
@@ -175,37 +121,103 @@ + (instancetype)fileHandleForUpdatingAtPath:(NSString*)file { | |||
} | |||
|
|||
/** | |||
@Status Stub | |||
@Notes | |||
@Status Caveat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The header was updated 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh I can't see things today, my bad :(
@@ -175,37 +121,103 @@ + (instancetype)fileHandleForUpdatingAtPath:(NSString*)file { | |||
} | |||
|
|||
/** | |||
@Status Stub | |||
@Notes | |||
@Status Caveat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.