Skip to content

Commit f126935

Browse files
authored
minor update: use string view as parameter type and remove unnecessary strlen use in the base64 encode method (#96)
Signed-off-by: wbpcode <[email protected]>
1 parent e58b76a commit f126935

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/utils/base64.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class Base64 {
3030
static std::string encode(const char* input, uint64_t length) {
3131
return encode(input, length, true);
3232
}
33-
static std::string encode(const std::string& input) {
34-
return encode(input.c_str(), strlen(input.c_str()));
33+
static std::string encode(std::string_view input) {
34+
return encode(input.data(), input.size());
3535
}
3636
static std::string decodeWithoutPadding(std::string_view input);
3737
};

0 commit comments

Comments
 (0)