fix - build with Werror=range-loop-construct

This commit is contained in:
Tim Felgentreff 2021-07-15 05:29:53 +02:00
parent c0ad6b9e56
commit 8df93b407d
2 changed files with 5 additions and 5 deletions

View file

@ -827,7 +827,7 @@ public:
msg.serialize32NativeByteOrder((uint32_t) extendedInfoNames.size());
extendedInfoNames.push_back(username);
msg.serialize(username.c_str());
for (const auto key : defaultUserKeys) {
for (const auto& key : defaultUserKeys) {
msg.serialize(key.c_str());
}
msg.flush(getTCPSocket());
@ -1062,7 +1062,7 @@ public:
void setCurrentChannel(std::string name) {
this->currentChannel = name;
bool unlisted = true;
for (const auto c : channelList) {
for (const auto& c : channelList) {
if (c == name) {
unlisted = false;
break;
@ -1207,7 +1207,7 @@ public:
this->channelList = channels;
if (SetChannels != NULL) {
SetChannels->pushPreamble();
for (const auto value : channels) {
for (const auto& value : channels) {
SetChannels->pushString(value);
}
SetChannels->run();

View file

@ -107,7 +107,7 @@ void LuaCallback::pushString(const std::string &s)
*/
void LuaCallback::pushTable(std::initializer_list<std::pair<std::string, std::variant<std::string, int>>> list) {
lua_createtable(Lua, 0, list.size());
for (const auto entry : list) {
for (const auto& entry : list) {
if (std::holds_alternative<std::string>(entry.second)) {
lua_pushstring(Lua, std::get<std::string>(entry.second).c_str());
} else {
@ -123,7 +123,7 @@ void LuaCallback::pushTable(std::initializer_list<std::pair<std::string, std::va
*/
void LuaCallback::pushTable(std::map<std::string, std::variant<std::string, int>> map) {
lua_createtable(Lua, 0, map.size());
for (const auto entry : map) {
for (const auto& entry : map) {
if (std::holds_alternative<std::string>(entry.second)) {
lua_pushstring(Lua, std::get<std::string>(entry.second).c_str());
} else {