Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid warnings with MSVC (#12762) #12775

Merged
merged 1 commit into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/google/protobuf/has_bits.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class HasBits {
}

void Or(const HasBits<doublewords>& rhs) {
for (size_t i = 0; i < doublewords; i++) has_bits_[i] |= rhs[i];
for (size_t i = 0; i < doublewords; i++) has_bits_[i] |= rhs.has_bits_[i];
}

bool empty() const;
Expand Down
7 changes: 4 additions & 3 deletions src/google/protobuf/string_block.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,11 @@ inline size_t StringBlock::NextSize(StringBlock* block) {
}

inline StringBlock* StringBlock::Emplace(void* p, size_t n, StringBlock* next) {
ABSL_DCHECK_EQ(n, NextSize(next));
uint32_t doubled = static_cast<uint32_t>(n) * 2;
const auto count = static_cast<uint32_t>(n);
ABSL_DCHECK_EQ(count, NextSize(next));
uint32_t doubled = count * 2;
uint32_t next_size = next ? std::min(doubled, max_size()) : min_size();
return new (p) StringBlock(next, false, RoundedSize(n), next_size);
return new (p) StringBlock(next, false, RoundedSize(count), next_size);
}

inline StringBlock* StringBlock::New(StringBlock* next) {
Expand Down