]> git.lyx.org Git - features.git/commitdiff
Return reference to this in operator=()
authorGeorg Baum <baum@lyx.org>
Sun, 13 Sep 2015 17:43:44 +0000 (19:43 +0200)
committerGeorg Baum <baum@lyx.org>
Sun, 13 Sep 2015 17:43:44 +0000 (19:43 +0200)
This is the recommendede signature of assignment operators and was found by
cppcheck.

src/insets/InsetGraphicsParams.cpp
src/insets/InsetGraphicsParams.h

index 15d6cad7a4a1324173a414e0ce4a71df4e9d8c0b..e158e81d98546d4af50a3fee97acbc053b738d91 100644 (file)
@@ -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 == &params)
-               return;
+               return *this;
        copy(params);
+       return *this;
 }
 
 
index 78d2ebf4107c52c1324d03607adb81ddd13aca4c..4fa54d7c6938fe33f581a0819670aa2d2a72ecf6 100644 (file)
@@ -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;