diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2019-10-14 09:08:18 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc@jeanmougin.fr> | 2019-10-14 09:08:18 +0000 |
| commit | f96f3b13bee80f996b79ede672ed8c691c433e74 (patch) | |
| tree | 7a5e07a32d5b50015b8b23ca5a96b7e13135dadd /src/proj_pt.h | |
| parent | operators should return by value (diff) | |
| download | inkscape-f96f3b13bee80f996b79ede672ed8c691c433e74.tar.gz inkscape-f96f3b13bee80f996b79ede672ed8c691c433e74.zip | |
Prevent returning references to local variable
Diffstat (limited to 'src/proj_pt.h')
| -rw-r--r-- | src/proj_pt.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/proj_pt.h b/src/proj_pt.h index 9b7a17abc..1d1ec473d 100644 --- a/src/proj_pt.h +++ b/src/proj_pt.h @@ -50,7 +50,7 @@ public: /*** For convenience, we define addition/subtraction etc. as "affine" operators (i.e., the result for finite points is the same as if the affine points were added ***/ - inline Pt2 &operator+(Pt2 &rhs) const { + inline Pt2 operator+(Pt2 &rhs) const { Pt2 result (*this); result.normalize(); rhs.normalize(); @@ -60,7 +60,7 @@ public: return result; } - inline Pt2 &operator-(Pt2 &rhs) const { + inline Pt2 operator-(Pt2 &rhs) const { Pt2 result (*this); result.normalize(); rhs.normalize(); @@ -70,7 +70,7 @@ public: return result; } - inline Pt2 &operator*(double const s) const { + inline Pt2 operator*(double const s) const { Pt2 result (*this); result.normalize(); for ( unsigned i = 0 ; i < 2 ; ++i ) { @@ -107,7 +107,7 @@ public: /*** For convenience, we define addition/subtraction etc. as "affine" operators (i.e., the result for finite points is the same as if the affine points were added ***/ - inline Pt3 &operator+(Pt3 &rhs) const { + inline Pt3 operator+(Pt3 &rhs) const { Pt3 result(*this); result.normalize(); rhs.normalize(); @@ -117,7 +117,7 @@ public: return result; } - inline Pt3 &operator-(Pt3 &rhs) const { + inline Pt3 operator-(Pt3 &rhs) const { Pt3 result (*this); result.normalize(); rhs.normalize(); @@ -127,7 +127,7 @@ public: return result; } - inline Pt3 &operator*(double const s) const { + inline Pt3 operator*(double const s) const { Pt3 result (*this); result.normalize(); for ( unsigned i = 0 ; i < 3 ; ++i ) { |
