From: Mikko Rasa Date: Sun, 27 Nov 2022 14:27:36 +0000 (+0200) Subject: Use lambdas for comparison functions X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=3c5bbaeadb33d288c0f9e487b52904b7ed7e4319;p=libs%2Fgui.git Use lambdas for comparison functions --- diff --git a/source/graphics/imageloader.cpp b/source/graphics/imageloader.cpp index 6403366..55d2dfb 100644 --- a/source/graphics/imageloader.cpp +++ b/source/graphics/imageloader.cpp @@ -58,7 +58,9 @@ ImageLoader *ImageLoader::open_io(IO::Seekable &io) if(registry.changed) { registry.changed = false; - sort(registry.loaders, signature_size_compare); + sort(registry.loaders, [](RegisterBase *r1, RegisterBase *r2){ + return r1->get_signature_size()get_signature_size(); + }); } if(registry.loaders.empty()) @@ -131,11 +133,6 @@ ImageLoader::Registry &ImageLoader::get_registry() return registry; } -bool ImageLoader::signature_size_compare(RegisterBase *r1, RegisterBase *r2) -{ - return r1->get_signature_size()get_signature_size(); -} - ImageLoader::Registry::~Registry() { diff --git a/source/graphics/imageloader.h b/source/graphics/imageloader.h index 53c9e7b..64a7410 100644 --- a/source/graphics/imageloader.h +++ b/source/graphics/imageloader.h @@ -85,8 +85,6 @@ public: static void register_loader(); private: static Registry &get_registry(); - - static bool signature_size_compare(RegisterBase *, RegisterBase *); }; template diff --git a/source/graphics/x11/display.cpp b/source/graphics/x11/display.cpp index 60c2182..482e1c3 100644 --- a/source/graphics/x11/display.cpp +++ b/source/graphics/x11/display.cpp @@ -61,15 +61,6 @@ inline Rotation rotation_to_sys(Msp::Graphics::VideoRotation r) default: return RR_Rotate_0; } } - -inline bool monitor_x_compare(const Msp::Graphics::Monitor &m1, const Msp::Graphics::Monitor &m2) -{ - if(m1.desktop_settings.mode && !m2.desktop_settings.mode) - return true; - if(!m1.desktop_settings.mode && m2.desktop_settings.mode) - return false; - return m1.desktop_settings.x