From 7f380782f57089b97a04125f18d61da05292d2ba Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Thu, 16 Dec 2021 13:06:08 +0100 Subject: Fix cppcheck errors/warnings --- src/actions.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/actions.cpp') 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 + * Robert Tari */ #include #include // split_settings_location() - +#include #include #include @@ -50,16 +52,18 @@ DateTime datetime_from_timet_variant(GVariant* v) bool lookup_appointment_by_uid(const std::shared_ptr& 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) -- cgit v1.2.3