From af684ade5284733d7fffe36e915d7f63d21f7b2d Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Mon, 12 Jun 2023 18:36:22 +0100 Subject: [PATCH] Return constant reference from ProgressBar::get_text() get_text() only performs const access on the ProgressBar object so return the member string by constant reference. Previously done for other string returning getters, even though the value is assigned to a variable and doesn't save anything: 1f6e81295b5190a0a67daf9e85b4206faafb725e Return constant reference from OperationDetail::get_description() (!94) --- include/ProgressBar.h | 2 +- src/ProgressBar.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/ProgressBar.h b/include/ProgressBar.h index 649eea34..63d70677 100644 --- a/include/ProgressBar.h +++ b/include/ProgressBar.h @@ -41,7 +41,7 @@ public: void stop(); bool running() const; double get_fraction() const; - Glib::ustring get_text() const; + const Glib::ustring& get_text() const; private: ProgressBar( const ProgressBar & src ); // Not implemented copy constructor diff --git a/src/ProgressBar.cc b/src/ProgressBar.cc index 03ea45ea..25b8f774 100644 --- a/src/ProgressBar.cc +++ b/src/ProgressBar.cc @@ -68,7 +68,8 @@ double ProgressBar::get_fraction() const return m_fraction; } -Glib::ustring ProgressBar::get_text() const + +const Glib::ustring& ProgressBar::get_text() const { return m_text; }