Skip to content

Commit 46aeafb

Browse files
committed
Fix compile errors
Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
1 parent 167309b commit 46aeafb

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/display-x11.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ void process_surface_events(conky::display_output_x11 *surface,
814814
int pending = XPending(display);
815815
if (pending == 0) return;
816816

817-
DBGP2("Processing %d X11 events...", pending);
817+
// DBGP2("Processing %d X11 events...", pending);
818818

819819
/* handle X events */
820820
while (XPending(display) != 0) {
@@ -835,7 +835,7 @@ void process_surface_events(conky::display_output_x11 *surface,
835835
if (cookie != nullptr) { free(cookie); }
836836
}
837837

838-
DBGP2("Done processing %d events.", pending);
838+
// DBGP2("Done processing %d events.", pending);
839839
}
840840

841841
void display_output_x11::sigterm_cleanup() {

src/netlink-conky.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ void nle_err_format(const char *desc, int error) {
1717
NORM_ERR("%s; error %d (%s)", desc, index, NLE_ERROR_MSG[index]);
1818
}
1919
}
20+
21+
// Has to be a macro because we want to return from outer scope
2022
#define CHECK_RESPONSE(response, msg) \
2123
(response < 0) { nle_err_format(msg, response); } \
2224
if (response < 0)
@@ -69,12 +71,10 @@ template <typename T, typename Tuple>
6971
auto push_front(const T &t, const Tuple &tuple) {
7072
return std::tuple_cat(std::make_tuple(t), tuple);
7173
}
72-
7374
template <typename Tuple, std::size_t... Is>
7475
auto copy_tail_impl(const Tuple &tuple, std::index_sequence<Is...>) {
7576
return std::make_tuple(std::get<1 + Is>(tuple)...);
7677
}
77-
7878
template <typename Tuple>
7979
auto copy_tail(const Tuple &tuple) {
8080
return copy_tail_impl(
@@ -90,9 +90,10 @@ int nl_task<R, Args...>::valid_handler(struct nl_msg *msg, void *arg) {
9090
NORM_ERR("no arguments provided to callback");
9191
return NL_STOP;
9292
}
93-
std::promise<R> promise = std::move(std::get<0>(args));
93+
std::promise<R> promise = std::move(std::get<0>(*args));
9494
callback_result<R> result = std::apply(
95-
task->processor, std::tuple_cat(std::make_tuple(msg), copy_tail(args)));
95+
task->processor, std::tuple_cat(std::make_tuple(msg), copy_tail(*args)));
96+
DBGP2("SETTING P %lx", &promise);
9697
promise.set_value(result.value);
9798
return result.action;
9899
}
@@ -145,9 +146,9 @@ std::optional<R> nl_task<R, Args...>::send_message(struct nl_sock *sock,
145146
std::promise<R> result_promise;
146147
auto result_future = result_promise.get_future();
147148

148-
this->arguments.store(
149-
std::make_tuple(std::move(result_promise), Args(args)...),
150-
std::memory_order_release);
149+
auto value = std::make_tuple(std::move(result_promise),
150+
Args(args)...); // FIXME: leaked
151+
this->arguments.store(&value, std::memory_order_release);
151152

152153
struct nl_msg *msg = nlmsg_alloc();
153154
if (!msg) {
@@ -234,9 +235,9 @@ callback_result<interface_result> interface_callback(struct nl_msg *msg,
234235
static_cast<struct genlmsghdr *>(nlmsg_data(nlmsg_hdr(msg)));
235236
struct nlattr *tb_msg[NL80211_ATTR_MAX + 1];
236237
const char *indent = "";
237-
DBGP2("INTERFACE %d", nla_get_u32(tb_msg[NL80211_ATTR_WIPHY]));
238238
nla_parse(tb_msg, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
239239
genlmsg_attrlen(gnlh, 0), NULL);
240+
DBGP2("INTERFACE %d", nla_get_u32(tb_msg[NL80211_ATTR_WIPHY]));
240241
DBGP2("B");
241242
if (tb_msg[NL80211_ATTR_MAC]) {
242243
DBGP2("By");
@@ -246,12 +247,11 @@ callback_result<interface_result> interface_callback(struct nl_msg *msg,
246247
DBGP2("C");
247248

248249
if (tb_msg[NL80211_ATTR_SSID]) {
249-
DBGP2("Cy, %lx", &ns->essid);
250250
ns->essid = "temp";
251251
ns->essid = ssid_to_utf8(
252252
nla_len(tb_msg[NL80211_ATTR_SSID]),
253253
static_cast<uint8_t *>(nla_data(tb_msg[NL80211_ATTR_SSID])));
254-
DBGP2("Cd");
254+
DBGP2("Cd %s", ns->essid.c_str());
255255
}
256256

257257
DBGP2("D");

0 commit comments

Comments
 (0)