Skip to content

Conversation

hmelder
Copy link
Member

@hmelder hmelder commented Jun 10, 2025

As part of Apple's ongoing improvements for interoperability between Swift and Foundation, a significant part of NSFileHandle was deprecated in favour of methods that write out errors.

This pull request implements the following new APIs:

- (BOOL) writeData: (NSData *) data 
             error: (NSError **) error;
- (NSData *) readDataUpToLength: (NSUInteger) length 
                          error: (NSError **) error;
- (NSData *) readDataToEndOfFileAndReturnError: (NSError **) error;

Refactors GSFileHandle to return errors in private helper methods, and fixes some declaration differences between Apple's Foundation and GNUstep.

hmelder added 6 commits June 10, 2025 17:39
Apple deprecated a significant part of the NSFileHandle API in favour of
new methods that write out errors instead of throwing an exception.

This is likely due to interoperability with Swift.
Implements new private methods to correctly implement the new
set of APIs that return errors instead of exceptions.
Length was previously unsigned int, but is NSUInteger in Apple's
implementation.
@hmelder hmelder requested a review from rfm as a code owner June 10, 2025 10:59
@hmelder
Copy link
Member Author

hmelder commented Jun 10, 2025

hmmh seems like the CI is broken again...

@hmelder
Copy link
Member Author

hmelder commented Jun 10, 2025

Seems like libdispatch master is currently broken swiftlang/swift-corelibs-libdispatch#880

@rfm
Copy link
Contributor

rfm commented Jun 14, 2025

This looks fine.

@rfm rfm closed this Jun 14, 2025
@rfm rfm reopened this Jun 14, 2025
@rfm rfm merged commit 9189207 into master Jun 14, 2025
6 of 10 checks passed
@triplef triplef deleted the file-handle-refactor branch June 23, 2025 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants