Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
Import fixes for sanitizer reported issues
Browse files Browse the repository at this point in the history
See discussion in bitcoin/bitcoin#22646.

Co-authored-by: MarcoFalke <[email protected]>
  • Loading branch information
fanquake and MarcoFalke committed Oct 8, 2021
1 parent c390ac3 commit 7d3b975
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/univalue_read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ enum jtokentype getJsonToken(std::string& tokenVal, unsigned int& consumed,
}

else {
writer.push_back(*raw);
writer.push_back(static_cast<unsigned char>(*raw));
raw++;
}
}
Expand All @@ -244,7 +244,7 @@ enum jtokentype getJsonToken(std::string& tokenVal, unsigned int& consumed,
}
}

enum expect_bits {
enum expect_bits : unsigned {
EXP_OBJ_NAME = (1U << 0),
EXP_COLON = (1U << 1),
EXP_ARR_VALUE = (1U << 2),
Expand Down
4 changes: 2 additions & 2 deletions lib/univalue_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ static std::string json_escape(const std::string& inS)
outS.reserve(inS.size() * 2);

for (unsigned int i = 0; i < inS.size(); i++) {
unsigned char ch = inS[i];
unsigned char ch = static_cast<unsigned char>(inS[i]);
const char *escStr = escapes[ch];

if (escStr)
outS += escStr;
else
outS += ch;
outS += static_cast<char>(ch);
}

return outS;
Expand Down

0 comments on commit 7d3b975

Please sign in to comment.