git-hulk commented on code in PR #3459:
URL: https://github.com/apache/kvrocks/pull/3459#discussion_r3214198046
##########
src/commands/cmd_geo.cc:
##########
@@ -88,13 +88,26 @@ class CommandGeoBase : public Commander {
return conversion;
}
- static size_t GetReturnedItemsCount(size_t result_length, int count) {
- if (count == 0) {
+ static Status ParseCount(std::string_view raw_count, size_t *count) {
+ auto signed_count = ParseInt<int64_t>(raw_count, 10);
+ if (!signed_count) {
+ return {Status::RedisParseErr, errValueNotInteger};
+ }
+
+ if (*signed_count <= 0) {
+ return {Status::RedisParseErr, "COUNT must be > 0"};
+ }
+
+ *count = static_cast<size_t>(*signed_count);
Review Comment:
```suggestion
auto signed_count = GET_OR_RET(ParseInt<int64_t>(raw_count, {0,
INT64_MAX}, 10));
*count = static_cast<size_t>(signed_count);
```
--
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]