diff options
author | Robert Tari <robert@tari.in> | 2021-12-16 13:06:08 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2022-02-08 18:30:04 +0100 |
commit | 7f380782f57089b97a04125f18d61da05292d2ba (patch) | |
tree | 598701a52e7dda0954f62ee17432bc337967b8c4 /src/actions.cpp | |
parent | b7df5a9578ab32ac3c67fc8e0c0490d8bb286fb1 (diff) | |
download | ayatana-indicator-datetime-7f380782f57089b97a04125f18d61da05292d2ba.tar.gz ayatana-indicator-datetime-7f380782f57089b97a04125f18d61da05292d2ba.tar.bz2 ayatana-indicator-datetime-7f380782f57089b97a04125f18d61da05292d2ba.zip |
Fix cppcheck errors/warnings
Diffstat (limited to 'src/actions.cpp')
-rw-r--r-- | src/actions.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/actions.cpp b/src/actions.cpp index 315340a..c184aef 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -1,5 +1,6 @@ /* * Copyright 2013 Canonical Ltd. + * Copyright 2021 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -15,11 +16,12 @@ * * Authors: * Charles Kerr <charles.kerr@canonical.com> + * Robert Tari <robert@tari.in> */ #include <datetime/actions.h> #include <datetime/utils.h> // split_settings_location() - +#include <algorithm> #include <glib.h> #include <gio/gio.h> @@ -50,16 +52,18 @@ DateTime datetime_from_timet_variant(GVariant* v) bool lookup_appointment_by_uid(const std::shared_ptr<State>& state, const gchar* uid, Appointment& setme) { - for(const auto& appt : state->calendar_upcoming->appointments().get()) + bool bRet = false; + + std::for_each(state->calendar_upcoming->appointments().get().begin(), state->calendar_upcoming->appointments().get().end(), [uid, &setme, &bRet](const Appointment& appt) { if (appt.uid == uid) { setme = appt; - return true; + bRet = true; } - } + }); - return false; + return bRet; } void on_appointment_activated (GSimpleAction*, GVariant *vdata, gpointer gself) |