You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/12/06 14:39:06 UTC

[GitHub] [incubator-kvrocks] torwig commented on a diff in pull request #1159: Fix cppcoreguidelines-narrowing-conversions warning reported by clang-tidy

torwig commented on code in PR #1159:
URL: https://github.com/apache/incubator-kvrocks/pull/1159#discussion_r1041060529


##########
src/types/redis_zset.cc:
##########
@@ -142,7 +142,7 @@ rocksdb::Status ZSet::Card(const Slice &user_key, int *ret) {
   ZSetMetadata metadata(false);
   rocksdb::Status s = GetMetadata(ns_key, &metadata);
   if (!s.ok()) return s.IsNotFound() ? rocksdb::Status::OK() : s;
-  *ret = metadata.size;
+  *ret = static_cast<int>(metadata.size);

Review Comment:
   Since the size of of type `uint32_t`, I'm wondering what will happen if `metadata.size` has a value more than INT32_MAX and we cast it here to `int` variable?
   This question is related not only to this particular line but to many other across the codebase, and they also are present in this PR.



-- 
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: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org