Skip to content

Fix: correct CFStream memory-stream status and error reporting - #145

Open
DTW-Thalion wants to merge 1 commit into
gnustep:masterfrom
DTW-Thalion:fix-cfstream-memory-status-error
Open

Fix: correct CFStream memory-stream status and error reporting#145
DTW-Thalion wants to merge 1 commit into
gnustep:masterfrom
DTW-Thalion:fix-cfstream-memory-status-error

Conversation

@DTW-Thalion

Copy link
Copy Markdown
Contributor

Four corrections to the memory-backed CFReadStream and CFWriteStream, each verified against Apple CoreFoundation.

CFReadStreamGetStatus returns kCFStreamStatusAtEnd once a stream is fully consumed instead of staying Open; a new atEnd flag is set when a read or CFReadStreamGetBuffer reaches the end of the buffer.

CFReadStreamHasBytesAvailable returns false before the stream is opened and after it is closed, rather than always consulting the buffer.

CFWriteStreamWrite on a fixed-capacity buffer that cannot hold the data fails with -1, sets the Error status and reports POSIX ENOMEM, instead of silently truncating the write.

CFStreamGetError reports domain 0 for a stream with no error, instead of kCFStreamErrorDomainPOSIX.

The tests read_atend.m, read_unopened.m, write_overflow.m and no_error.m fail before these changes and pass after.

@DTW-Thalion
DTW-Thalion force-pushed the fix-cfstream-memory-status-error branch from 6fce08e to d0192c0 Compare July 24, 2026 15:22
@DTW-Thalion DTW-Thalion reopened this Jul 24, 2026
@DTW-Thalion DTW-Thalion reopened this Jul 27, 2026
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.

1 participant