Fix bugprone-string-integer-assignment warnings

* mdns.cpp:153:20: warning: an integer is interpreted as a character code
  when assigning it to a string; if this is intended, cast the integer to
  the appropriate character type; if you want a string representation, use
  the appropriate conversion facility [bugprone-string-integer-assignment]

Test: WITH_TIDY=1 make
Change-Id: Id9a790ac31722c6ee8886703939977b913ce95fe
This commit is contained in:
Chih-Hung Hsieh 2020-03-09 14:22:16 -07:00
parent cc642ec725
commit 5d13645bfe

View file

@ -150,11 +150,11 @@ static std::string RandomAlphaNumString(size_t len) {
for (size_t i = 0; i < len; ++i) {
uint8_t val = dist(mt);
if (val < 10) {
ret += '0' + val;
ret += static_cast<char>('0' + val);
} else if (val < 36) {
ret += 'A' + (val - 10);
ret += static_cast<char>('A' + (val - 10));
} else {
ret += 'a' + (val - 36);
ret += static_cast<char>('a' + (val - 36));
}
}
return ret;