fix some compiler warnings

This commit is contained in:
gfgtdf 2020-03-15 21:35:58 +01:00
parent f9790bcb5d
commit 9fdf618624
3 changed files with 5 additions and 4 deletions

View file

@ -487,7 +487,7 @@ public:
std::vector<std::string> split = utils::parenthetical_split(string_.as_string(), ',');
std::vector<variant> items;
items.reserve(split.size());
for(const std::string s : split) {
for(const std::string& s : split) {
items.emplace_back(s);
}

View file

@ -680,7 +680,7 @@ bool server::is_login_allowed(socket_ptr socket, const simple_wml::node* const l
}
// Check if the username is allowed.
for(const std::string d : disallowed_names_) {
for(const std::string& d : disallowed_names_) {
if(utils::wildcard_string_match(utf8::lowercase(username), utf8::lowercase(d))) {
async_send_error(socket, "The nickname '" + username + "' is reserved and cannot be used by players",
MP_NAME_RESERVED_ERROR);
@ -1651,7 +1651,7 @@ void server::handle_player_in_game(socket_ptr socket, std::shared_ptr<simple_wml
const std::string mods = m["active_mods"].to_string();
if(mods != "") {
for(const std::string mod : utils::split(mods, ',')){
for(const std::string& mod : utils::split(mods, ',')){
user_handler_->db_insert_modification_info(uuid_, g.db_id(), mod);
}
}

View file

@ -864,7 +864,8 @@ static Mix_Chunk* load_chunk(const std::string& file, channel_group group)
sound_cache_iterator it;
sound_cache_chunk temp_chunk(file); // search the sound cache on this key
it_bgn = sound_cache.begin(), it_end = sound_cache.end();
it_bgn = sound_cache.begin();
it_end = sound_cache.end();
it = std::find(it_bgn, it_end, temp_chunk);
if(it != it_end) {