Skip to content

Commit

Permalink
Use regular ints
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTF committed Feb 6, 2025
1 parent 1fd94cf commit f42bdf1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/parser/SparqlParserHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ std::string ParserAndVisitor::unescapeUnicodeSequences(std::string input) {
input.size()};
std::string output;
size_t lastPos = 0;
UChar32 highSurrogate = '\0';
UChar32 highSurrogate = 0;

auto throwError = [](bool condition, const std::string& message) {
if (!condition) {
Expand Down Expand Up @@ -75,28 +75,28 @@ std::string ParserAndVisitor::unescapeUnicodeSequences(std::string input) {
throwError(!isFullCodePoint,
"Surrogates should not be encoded as full code points.");
throwError(
highSurrogate == '\0',
highSurrogate == 0,
"A high surrogate cannot be followed by another high surrogate.");
highSurrogate = codePoint;
continue;
} else if (U16_IS_TRAIL(codePoint)) {
throwError(!isFullCodePoint,
"Surrogates should not be encoded as full code points.");
throwError(highSurrogate != '\0',
throwError(highSurrogate != 0,
"A low surrogate cannot be the first surrogate.");
codePoint = U16_GET_SUPPLEMENTARY(highSurrogate, codePoint);
highSurrogate = '\0';
highSurrogate = 0;
} else {
throwError(
highSurrogate == '\0',
highSurrogate == 0,
"A high surrogate cannot be followed by a regular code point.");
}

icu::UnicodeString helper{codePoint};
helper.toUTF8String(output);
}

throwError(highSurrogate == '\0',
throwError(highSurrogate == 0,
"A high surrogate must be followed by a low surrogate.");

output += input.substr(lastPos);
Expand Down

0 comments on commit f42bdf1

Please sign in to comment.