NS{In,Out}putStream: Use CF{Read,Write}StreamCopyError

Not only is this simpler and more convenient, but this is also more
correct. With the old behavior, we were always returning an error, even
when no error was present (it was returned with code=0).
This commit is contained in:
Ariel Abreu 2023-10-13 09:48:04 -04:00
parent a18cdf61b4
commit 571cb49a5b
No known key found for this signature in database
GPG Key ID: 5B88AAAF4280706F
2 changed files with 2 additions and 4 deletions

View File

@ -143,8 +143,7 @@
- (NSError *)streamError
{
CFStreamError err = CFReadStreamGetError((CFReadStreamRef)self);
return [(NSError *)_CFErrorFromStreamError(kCFAllocatorDefault, &err) autorelease];
return [CFReadStreamCopyError((CFReadStreamRef)self) autorelease];
}
- (NSStreamStatus)streamStatus

View File

@ -135,8 +135,7 @@
- (NSError *)streamError
{
CFStreamError err = CFWriteStreamGetError((CFWriteStreamRef)self);
return [(NSError *)_CFErrorFromStreamError(kCFAllocatorDefault, &err) autorelease];
return [CFWriteStreamCopyError((CFWriteStreamRef)self) autorelease];
}
- (NSStreamStatus)streamStatus