Convert a few remaining C-style casts (for char) too static_cast

(cherry-picked from commit ce85c170200aee86ebd0b7a98ef7102a03e62dd5)
This commit is contained in:
Charles Dang 2018-07-13 15:48:20 +11:00
parent 5250d970b3
commit ee619b999f
3 changed files with 8 additions and 8 deletions

View File

@ -76,7 +76,7 @@ std::string format_version(const SDL_version& v)
std::string format_openssl_patch_level(uint8_t p) std::string format_openssl_patch_level(uint8_t p)
{ {
return p <= 26 return p <= 26
? std::string(1, 'a' + char(p) - 1) ? std::string(1, 'a' + static_cast<char>(p) - 1)
: "patch" + std::to_string(p); : "patch" + std::to_string(p);
} }

View File

@ -1247,7 +1247,7 @@ std::ostream& operator<<(std::ostream& outstream, const config& cfg)
} }
for(int j = 0; j < i - 1; j++) { for(int j = 0; j < i - 1; j++) {
outstream << char(9); outstream << static_cast<char>(9);
} }
outstream << val.first << " = " << val.second << '\n'; outstream << val.first << " = " << val.second << '\n';
@ -1255,14 +1255,14 @@ std::ostream& operator<<(std::ostream& outstream, const config& cfg)
for(const config::any_child& child : cfg.all_children_range()) { for(const config::any_child& child : cfg.all_children_range()) {
for(int j = 0; j < i - 1; ++j) { for(int j = 0; j < i - 1; ++j) {
outstream << char(9); outstream << static_cast<char>(9);
} }
outstream << "[" << child.key << "]\n"; outstream << "[" << child.key << "]\n";
outstream << child.cfg; outstream << child.cfg;
for(int j = 0; j < i - 1; ++j) { for(int j = 0; j < i - 1; ++j) {
outstream << char(9); outstream << static_cast<char>(9);
} }
outstream << "[/" << child.key << "]\n"; outstream << "[/" << child.key << "]\n";

View File

@ -275,8 +275,8 @@ t_string_base::t_string_base(const std::string& string, const std::string& textd
id = idi->second; id = idi->second;
} }
value_ += char(id & 0xff); value_ += static_cast<char>(id & 0xff);
value_ += char(id >> 8); value_ += static_cast<char>(id >> 8);
value_ += string; value_ += string;
} }
@ -304,8 +304,8 @@ t_string_base::t_string_base(const std::string& sing, const std::string& pl, int
id = idi->second; id = idi->second;
} }
value_ += char(id & 0xff); value_ += static_cast<char>(id & 0xff);
value_ += char(id >> 8); value_ += static_cast<char>(id >> 8);
value_ += sing; value_ += sing;
value_ += PLURAL_PART; value_ += PLURAL_PART;