From c09663d2cb3ba57639e412488f1c58ebe76b04d8 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sun, 13 Sep 2015 19:43:44 +0200 Subject: [PATCH] Return reference to this in operator=() This is the recommendede signature of assignment operators and was found by cppcheck. --- src/insets/InsetGraphicsParams.cpp | 5 +++-- src/insets/InsetGraphicsParams.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/insets/InsetGraphicsParams.cpp b/src/insets/InsetGraphicsParams.cpp index 15d6cad7a4..e158e81d98 100644 --- a/src/insets/InsetGraphicsParams.cpp +++ b/src/insets/InsetGraphicsParams.cpp @@ -50,12 +50,13 @@ InsetGraphicsParams::InsetGraphicsParams(InsetGraphicsParams const & igp) } -void InsetGraphicsParams::operator=(InsetGraphicsParams const & params) +InsetGraphicsParams & InsetGraphicsParams::operator=(InsetGraphicsParams const & params) { // Are we assigning the object into itself? if (this == ¶ms) - return; + return *this; copy(params); + return *this; } diff --git a/src/insets/InsetGraphicsParams.h b/src/insets/InsetGraphicsParams.h index 78d2ebf410..4fa54d7c69 100644 --- a/src/insets/InsetGraphicsParams.h +++ b/src/insets/InsetGraphicsParams.h @@ -68,7 +68,7 @@ public: /// InsetGraphicsParams(InsetGraphicsParams const &); /// - void operator=(InsetGraphicsParams const &); + InsetGraphicsParams & operator=(InsetGraphicsParams const &); /// Save the parameters in the LyX format stream. /// Buffer is needed to figure out if a figure is embedded. void Write(std::ostream & os, Buffer const & buf) const; -- 2.39.2