Skip to content

Commit c696b23

Browse files
committed
Pass char32_t by value instead of by reference
1 parent 6271fda commit c696b23

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

include/cpp/encoding/Utf16.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ namespace cpp
99
static bool isEncoded(const String& string);
1010

1111
static int getByteCount(const null&);
12-
static int getByteCount(const char32_t& codepoint);
12+
static int getByteCount(char32_t codepoint);
1313
static int64_t getByteCount(const String& string);
1414

1515
static int getCharCount(const null&);
16-
static int getCharCount(const char32_t& codepoint);
16+
static int getCharCount(char32_t codepoint);
1717
static int64_t getCharCount(const String& string);
1818

1919
static int encode(const null&, const cpp::marshal::View<uint8_t>& buffer);
20-
static int encode(const char32_t& codepoint, const cpp::marshal::View<uint8_t>& buffer);
20+
static int encode(char32_t codepoint, const cpp::marshal::View<uint8_t>& buffer);
2121
static int64_t encode(const String& string, const cpp::marshal::View<uint8_t>& buffer);
2222

2323
static char32_t codepoint(const cpp::marshal::View<uint8_t>& buffer);

include/cpp/encoding/Utf8.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ namespace cpp
77
struct Utf8 final
88
{
99
static int getByteCount(const null&);
10-
static int getByteCount(const char32_t& codepoint);
10+
static int getByteCount(char32_t codepoint);
1111
static int64_t getByteCount(const String& string);
1212

1313
static int getCharCount(const null&);
14-
static int getCharCount(const char32_t& codepoint);
14+
static int getCharCount(char32_t codepoint);
1515
static int64_t getCharCount(const String& string);
1616

1717
static int encode(const null&, const cpp::marshal::View<uint8_t>& buffer);
18-
static int encode(const char32_t& codepoint, const cpp::marshal::View<uint8_t>& buffer);
18+
static int encode(char32_t codepoint, const cpp::marshal::View<uint8_t>& buffer);
1919
static int64_t encode(const String& string, const cpp::marshal::View<uint8_t>& buffer);
2020
static Array<uint8_t> encode(const String& string);
2121

src/cpp/encoding/Encodings.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ int cpp::encoding::Utf8::getByteCount(const null&)
9393
return 0;
9494
}
9595

96-
int cpp::encoding::Utf8::getByteCount(const char32_t& codepoint)
96+
int cpp::encoding::Utf8::getByteCount(char32_t codepoint)
9797
{
9898
if (codepoint <= 0x7F)
9999
{
@@ -152,7 +152,7 @@ int cpp::encoding::Utf8::getCharCount(const null&)
152152
return 0;
153153
}
154154

155-
int cpp::encoding::Utf8::getCharCount(const char32_t& codepoint)
155+
int cpp::encoding::Utf8::getCharCount(char32_t codepoint)
156156
{
157157
return getByteCount(codepoint) / sizeof(char);
158158
}
@@ -271,7 +271,7 @@ Array<uint8_t> cpp::encoding::Utf8::encode(const String& string)
271271
#endif
272272
}
273273

274-
int cpp::encoding::Utf8::encode(const char32_t& codepoint, const cpp::marshal::View<uint8_t>& buffer)
274+
int cpp::encoding::Utf8::encode(char32_t codepoint, const cpp::marshal::View<uint8_t>& buffer)
275275
{
276276
if (codepoint <= 0x7F)
277277
{
@@ -494,7 +494,7 @@ int cpp::encoding::Utf16::getByteCount(const null&)
494494
return 0;
495495
}
496496

497-
int cpp::encoding::Utf16::getByteCount(const char32_t& codepoint)
497+
int cpp::encoding::Utf16::getByteCount(char32_t codepoint)
498498
{
499499
return codepoint <= 0xFFFF ? 2 : 4;
500500
}
@@ -528,7 +528,7 @@ int cpp::encoding::Utf16::getCharCount(const null&)
528528
return 0;
529529
}
530530

531-
int cpp::encoding::Utf16::getCharCount(const char32_t& codepoint)
531+
int cpp::encoding::Utf16::getCharCount(char32_t codepoint)
532532
{
533533
return getByteCount(codepoint) / sizeof(char16_t);
534534
}
@@ -599,7 +599,7 @@ int64_t cpp::encoding::Utf16::encode(const String& string, const cpp::marshal::V
599599
}
600600
}
601601

602-
int cpp::encoding::Utf16::encode(const char32_t& codepoint, const cpp::marshal::View<uint8_t>& buffer)
602+
int cpp::encoding::Utf16::encode(char32_t codepoint, const cpp::marshal::View<uint8_t>& buffer)
603603
{
604604
if (codepoint < 0xD800)
605605
{

0 commit comments

Comments
 (0)