Skip to content

Commit

Permalink
Convert a few remaining C-style casts (for char) too static_cast
Browse files Browse the repository at this point in the history
(cherry-picked from commit ce85c17)
  • Loading branch information
Vultraz committed Oct 7, 2018
1 parent 5250d97 commit ee619b9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/build_info.cpp
Expand Up @@ -76,7 +76,7 @@ std::string format_version(const SDL_version& v)
std::string format_openssl_patch_level(uint8_t p)
{
return p <= 26
? std::string(1, 'a' + char(p) - 1)
? std::string(1, 'a' + static_cast<char>(p) - 1)
: "patch" + std::to_string(p);
}

Expand Down
6 changes: 3 additions & 3 deletions src/config.cpp
Expand Up @@ -1247,22 +1247,22 @@ std::ostream& operator<<(std::ostream& outstream, const config& cfg)
}

for(int j = 0; j < i - 1; j++) {
outstream << char(9);
outstream << static_cast<char>(9);
}

outstream << val.first << " = " << val.second << '\n';
}

for(const config::any_child& child : cfg.all_children_range()) {
for(int j = 0; j < i - 1; ++j) {
outstream << char(9);
outstream << static_cast<char>(9);
}

outstream << "[" << child.key << "]\n";
outstream << child.cfg;

for(int j = 0; j < i - 1; ++j) {
outstream << char(9);
outstream << static_cast<char>(9);
}

outstream << "[/" << child.key << "]\n";
Expand Down
8 changes: 4 additions & 4 deletions src/tstring.cpp
Expand Up @@ -275,8 +275,8 @@ t_string_base::t_string_base(const std::string& string, const std::string& textd
id = idi->second;
}

value_ += char(id & 0xff);
value_ += char(id >> 8);
value_ += static_cast<char>(id & 0xff);
value_ += static_cast<char>(id >> 8);
value_ += string;
}

Expand Down Expand Up @@ -304,8 +304,8 @@ t_string_base::t_string_base(const std::string& sing, const std::string& pl, int
id = idi->second;
}

value_ += char(id & 0xff);
value_ += char(id >> 8);
value_ += static_cast<char>(id & 0xff);
value_ += static_cast<char>(id >> 8);
value_ += sing;
value_ += PLURAL_PART;

Expand Down

0 comments on commit ee619b9

Please sign in to comment.