Fix Utf8Decoder operator== handling of the last code point in the input #1316
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working on diagnostics for #1210 I observed that we were printing the caret ^ in the wrong place when it goes after the input.
The way this works is we form the line of text to print, then decode the unicode encoding units, and when we hit the target, we stop and print ^:
vcpkg-tool/src/vcpkg/base/parse.cpp
Lines 51 to 68 in 5b8f9c4
however, if the intended location for the ^ is the "end" of the line, we hit this bug:
vcpkg-tool/src/vcpkg/base/unicode.cpp
Line 273 in 5b8f9c4
The iterator only compares the last_ pointers, but both the "points at the last code point in the input" and "points to the end of the input" state set
next_ == last_
. See:vcpkg-tool/src/vcpkg/base/unicode.cpp
Lines 222 to 226 in 5b8f9c4
This means that the points to the end and points one past the end iterator compare equal, so the loop in parse.cpp stops one position too early.
Also adds a bunch of testing for this specific case, for other parts of Utf8Decoder, adds a way to parse the first code point without failing, makes all the operators 'hidden friends', and removes localized strings for bugs-in-vcpkg-itself.