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

Commit 1352543

Browse files
fanquakeMarcoFalke
andcommitted
Import fixes for sanitizer reported issues
See discussion in bitcoin/bitcoin#22646. Co-authored-by: MarcoFalke <[email protected]>
1 parent d5fb869 commit 1352543

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/univalue_read.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ enum jtokentype getJsonToken(std::string& tokenVal, unsigned int& consumed,
227227
}
228228

229229
else {
230-
writer.push_back(*raw);
230+
writer.push_back(static_cast<unsigned char>(*raw));
231231
raw++;
232232
}
233233
}
@@ -244,7 +244,7 @@ enum jtokentype getJsonToken(std::string& tokenVal, unsigned int& consumed,
244244
}
245245
}
246246

247-
enum expect_bits {
247+
enum expect_bits : unsigned {
248248
EXP_OBJ_NAME = (1U << 0),
249249
EXP_COLON = (1U << 1),
250250
EXP_ARR_VALUE = (1U << 2),

lib/univalue_write.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ static std::string json_escape(const std::string& inS)
1313
outS.reserve(inS.size() * 2);
1414

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

1919
if (escStr)
2020
outS += escStr;
2121
else
22-
outS += ch;
22+
outS += static_cast<char>(ch);
2323
}
2424

2525
return outS;

0 commit comments

Comments
 (0)