-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Stream::readBytesUntil() with non-ASCII terminator #7053
base: master
Are you sure you want to change the base?
Conversation
Looks like a reasonable change. However, two questions:
|
No because in this case we're comparing an
Maybe. This was more of a superstition thing to be honest (out-of-range conversion to a signed type is not undefined behavior, but other out-of-range issues are so I generally prefer to play it safe), but maybe you're right that it makes more sense to compare two chars.
I'd rather add a cast than create an extra variable (which may or may not get optimized away); it feels like a smaller and simpler change, don't you think? |
It's certainly simpler, yes. I don't really have a strong preference either way. |
OK, then I think I'll just replace the |
Better to amend, that keeps the history cleaner after merging. |
Allow Stream::readBytesUntil() and Stream::readStringUntil() use a negative value(i.e. a non-ASCII char) as a terminator. Replaces `[int] == [char]` comparisons with `(char)[int] == [char]`. Solves #1148
45232b2
to
6c6f538
Compare
Allow Stream::readBytesUntil() and Stream::readStringUntil() use a negative value as a terminator (i.e. a non-ASCII char).
Replaces
[int] == [char]
comparisons with[int] == (unsigned char)[char]
.This should solve #1148, although I admit I haven't tested it.
(I was bored and decided to solve old issues)