Skip to content

Commit

Permalink
Fix compiler warnings (#335)
Browse files Browse the repository at this point in the history
* Update configure.ac with new libtool macro

* Fix compiler warnings

* also fix maybe-uninitialized warning

Co-authored-by: Charles-Henri Bruyand <[email protected]>
  • Loading branch information
neilcook and chbruyand authored May 12, 2021
1 parent 5da14e9 commit fa0ab51
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions common/perf-stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ Json perfStatsToJson()
Json commandStatsToJson()
{
Json::object jattrs;
for (const auto i : command_stats) {
for (const auto& i : command_stats) {
jattrs.insert(std::make_pair(i, getCommandStat(i)));
}
return jattrs;
Expand All @@ -236,7 +236,7 @@ Json commandStatsToJson()
Json customStatsToJson()
{
Json::object jattrs;
for (const auto i : custom_stats) {
for (const auto& i : custom_stats) {
jattrs.insert(std::make_pair(i, getCustomStat(i)));
}
return jattrs;
Expand Down
2 changes: 1 addition & 1 deletion common/webhook.hh
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public:
const WHConfigMap& addConfigKeys(const WHConfigMap& new_cfg)
{
std::lock_guard<std::mutex> lock(mutex);
for (const auto i : new_cfg) {
for (const auto& i : new_cfg) {
config_keys.insert(std::make_pair(i.first, i.second));
}
return config_keys;
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([wforce], [2.4.1-alpha1])
AC_INIT([wforce],[2.4.1-alpha1])
AM_INIT_AUTOMAKE([foreign dist-bzip2 parallel-tests 1.11 subdir-objects])
AM_SILENT_RULES([yes])
AC_CONFIG_MACRO_DIR([m4])
Expand Down Expand Up @@ -47,7 +47,7 @@ AS_IF([test "x$YAMLCPP_LIBS" = "x"], [
AC_MSG_ERROR([yaml-cpp not found, yaml-cpp support is required])
])
AM_CONDITIONAL([LIBSYSTEMD],[test "$HAVE_LIBSYSTEMD" = "1"])
AC_PROG_LIBTOOL
LT_INIT
# We need readline
WFORCE_CHECK_READLINE
# Boost-specific checks
Expand Down
6 changes: 3 additions & 3 deletions wforce/wforce-lua.cc
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ vector<std::function<void(void)>> setupLua(bool client, bool multi_lua, LuaConte
c_lua.writeFunction("showAddrByName", [](std::shared_ptr<WFResolver> resolvp, string name) {
std::vector<std::string> retvec = resolvp->lookup_address_by_name(name, 1);
boost::format fmt("%s %s\n");
for (const auto s : retvec) {
for (const auto& s : retvec) {
g_outputBuffer += (fmt % name % s).str();
}
});
Expand All @@ -506,7 +506,7 @@ vector<std::function<void(void)>> setupLua(bool client, bool multi_lua, LuaConte
c_lua.writeFunction("showNameByAddr", [](std::shared_ptr<WFResolver> resolvp, ComboAddress address) {
std::vector<std::string> retvec = resolvp->lookup_name_by_address(address, 1);
boost::format fmt("%s %s\n");
for (const auto s : retvec) {
for (const auto& s : retvec) {
g_outputBuffer += (fmt % address.toString() % s).str();
}
});
Expand All @@ -519,7 +519,7 @@ vector<std::function<void(void)>> setupLua(bool client, bool multi_lua, LuaConte
c_lua.writeFunction("showRBL", [](std::shared_ptr<WFResolver> resolvp, ComboAddress address, string rblname) {
std::vector<std::string> retvec = resolvp->lookupRBL(address, rblname, 1);
boost::format fmt("%s\n");
for (const auto s : retvec) {
for (const auto& s : retvec) {
g_outputBuffer += (fmt % s).str();
}
});
Expand Down
6 changes: 3 additions & 3 deletions wforce/wforce.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ try
sock.setKeepAlive();

for(;;) {
uint16_t len;
uint16_t len{0};
if(!getMsgLen(fd, &len))
break;
char msg[len];
Expand Down Expand Up @@ -294,7 +294,7 @@ void doClient(ComboAddress server, const std::string& command)
string msg=sodEncryptSym(command, g_key, writingNonce);
putMsgLen(fd, msg.length());
writen2(fd, msg);
uint16_t len;
uint16_t len{0};
getMsgLen(fd, &len);
char resp[len];
readn2(fd, resp, len);
Expand Down Expand Up @@ -336,7 +336,7 @@ void doClient(ComboAddress server, const std::string& command)
string msg=sodEncryptSym(line, g_key, writingNonce);
putMsgLen(fd, msg.length());
writen2(fd, msg);
uint16_t len;
uint16_t len{0};
getMsgLen(fd, &len);
char resp[len];
readn2(fd, resp, len);
Expand Down

0 comments on commit fa0ab51

Please sign in to comment.