PragmaTwice commented on code in PR #2343:
URL: https://github.com/apache/kvrocks/pull/2343#discussion_r1622178210
##########
src/common/string_util.cc:
##########
@@ -377,4 +377,14 @@ std::string EscapeString(std::string_view s) {
return str;
}
+std::string StringNext(std::string s) {
+ for (auto iter = s.rbegin(); iter != s.rend(); ++iter) {
+ if (*iter != char(0xff)) {
+ (*iter)++;
+ break;
+ }
+ }
+ return s;
Review Comment:
I think the semantics is different between append 0x00 and last char plus 1.
##########
src/common/string_util.cc:
##########
@@ -377,4 +377,14 @@ std::string EscapeString(std::string_view s) {
return str;
}
+std::string StringNext(std::string s) {
+ for (auto iter = s.rbegin(); iter != s.rend(); ++iter) {
+ if (*iter != char(0xff)) {
+ (*iter)++;
+ break;
+ }
+ }
+ return s;
Review Comment:
I think the semantics is different between appending 0x00 and last char plus
1.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]