Skip to content

Commit c04efac

Browse files
authored
refactor: prefer passing by reference instead of copy (synfig#3637)
1 parent ca3b1dd commit c04efac

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

synfig-core/src/synfig/color/color.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ using namespace synfig;
5353
/* === M E T H O D S ======================================================= */
5454

5555
ColorReal
56-
Color::hex2real(String s)
56+
Color::hex2real(const String& s)
5757
{
5858
std::istringstream i(s);
5959
int n;
@@ -76,7 +76,7 @@ Color::real2hex(ColorReal c)
7676
}
7777

7878
void
79-
Color::set_hex(String& str)
79+
Color::set_hex(const String& str)
8080
{
8181
value_type r, g, b;
8282
String hex;

synfig-core/src/synfig/color/color.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class Color
111111
const value_type& get_alpha()const { return get_a(); }
112112

113113
//! Converts a 2 character hex string \a s (00-ff) into a ColorReal (0.0-1.0)
114-
static ColorReal hex2real(String s);
114+
static ColorReal hex2real(const String& s);
115115

116116
//! Converts a ColorReal \a c (0.0-1.0) into a 2 character hex string (00-ff)
117117
static const String real2hex(ColorReal c);
@@ -120,7 +120,7 @@ class Color
120120
inline const String get_hex()const;
121121

122122
//! Sets the color's R, G, and B from a 3 or 6 character hex string
123-
void set_hex(String& hex);
123+
void set_hex(const String& hex);
124124

125125
//! Sets the RED component to \a x
126126
Color& set_r(const value_type& x) { r_ = x; return *this; }

0 commit comments

Comments
 (0)