diff --git a/include/modules/network.hpp b/include/modules/network.hpp index fef64a4c..4e81c998 100644 --- a/include/modules/network.hpp +++ b/include/modules/network.hpp @@ -17,8 +17,8 @@ class Network : public ALabel { ~Network(); auto update() -> void; private: - static uint64_t netlinkRequest(int, void*, uint32_t, uint32_t groups = 0); - static uint64_t netlinkResponse(int, void*, uint32_t, uint32_t groups = 0); + static int netlinkRequest(int, void*, uint32_t, uint32_t groups = 0); + static int netlinkResponse(int, void*, uint32_t, uint32_t groups = 0); static int scanCb(struct nl_msg*, void*); void disconnected(); @@ -33,7 +33,7 @@ class Network : public ALabel { int ifid_; sa_family_t family_; int sock_fd_; - struct sockaddr_nl nladdr_ = {0}; + struct sockaddr_nl nladdr_ = {}; struct nl_sock* sk_ = nullptr; int nl80211_id_; diff --git a/src/ALabel.cpp b/src/ALabel.cpp index 0e6bbee5..2d1ea5e8 100644 --- a/src/ALabel.cpp +++ b/src/ALabel.cpp @@ -24,7 +24,7 @@ auto waybar::ALabel::update() -> void // Nothing here } -bool waybar::ALabel::handleToggle(GdkEventButton* const& ev) +bool waybar::ALabel::handleToggle(GdkEventButton* const& /*ev*/) { alt = !alt; if (alt) { diff --git a/src/main.cpp b/src/main.cpp index 6646e031..85e120ed 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -13,7 +13,7 @@ int main(int argc, char* argv[]) try { waybar::Client c(argc, argv); waybar::client = &c; - std::signal(SIGUSR1, [] (int signal) { + std::signal(SIGUSR1, [] (int /*signal*/) { for (auto& bar : waybar::client->bars) { (*bar).toggle(); } diff --git a/src/modules/cpu.cpp b/src/modules/cpu.cpp index 50f77768..6f826e3e 100644 --- a/src/modules/cpu.cpp +++ b/src/modules/cpu.cpp @@ -13,7 +13,7 @@ waybar::modules::Cpu::Cpu(const Json::Value& config) auto waybar::modules::Cpu::update() -> void { - struct sysinfo info = {0}; + struct sysinfo info = {}; if (sysinfo(&info) == 0) { float f_load = 1.f / (1u << SI_LOAD_SHIFT); uint16_t load = info.loads[0] * f_load * 100 / get_nprocs(); diff --git a/src/modules/memory.cpp b/src/modules/memory.cpp index d3d9877f..4c09bdfa 100644 --- a/src/modules/memory.cpp +++ b/src/modules/memory.cpp @@ -13,7 +13,7 @@ waybar::modules::Memory::Memory(const Json::Value& config) auto waybar::modules::Memory::update() -> void { - struct sysinfo info = {0}; + struct sysinfo info = {}; if (sysinfo(&info) == 0) { auto total = info.totalram * info.mem_unit; auto freeram = info.freeram * info.mem_unit; diff --git a/src/modules/network.cpp b/src/modules/network.cpp index 44f2916c..71f82151 100644 --- a/src/modules/network.cpp +++ b/src/modules/network.cpp @@ -165,7 +165,7 @@ int waybar::modules::Network::getExternalInterface() * consume responses till NLMSG_DONE/NLMSG_ERROR is encountered). */ do { - uint64_t len = netlinkResponse(sock_fd_, resp, route_buffer_size); + auto len = netlinkResponse(sock_fd_, resp, route_buffer_size); if (len < 0) { goto out; } @@ -228,7 +228,7 @@ int waybar::modules::Network::getExternalInterface() break; } for (uint32_t i = 0; i < dstlen; i += 1) { - c |= *(unsigned char *)(RTA_DATA(attr) + i); + c |= *((unsigned char *)RTA_DATA(attr) + i); } has_destination = (c == 0); break; @@ -255,10 +255,10 @@ out: return ifidx; } -uint64_t waybar::modules::Network::netlinkRequest(int fd, void *req, +int waybar::modules::Network::netlinkRequest(int fd, void *req, uint32_t reqlen, uint32_t groups) { - struct sockaddr_nl sa = {0}; + struct sockaddr_nl sa = {}; sa.nl_family = AF_NETLINK; sa.nl_groups = groups; struct iovec iov = { req, reqlen }; @@ -266,11 +266,11 @@ uint64_t waybar::modules::Network::netlinkRequest(int fd, void *req, return sendmsg(fd, &msg, 0); } -uint64_t waybar::modules::Network::netlinkResponse(int fd, void *resp, +int waybar::modules::Network::netlinkResponse(int fd, void *resp, uint32_t resplen, uint32_t groups) { - uint64_t ret; - struct sockaddr_nl sa = {0}; + int ret; + struct sockaddr_nl sa = {}; sa.nl_family = AF_NETLINK; sa.nl_groups = groups; struct iovec iov = { resp, resplen };