Skip to content
Open
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
5 changes: 3 additions & 2 deletions src/google/protobuf/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -698,11 +698,12 @@ struct KeyNode : NodeBase {
// random iteration order.
inline map_index_t Hash(absl::string_view k, void* salt) {
const uintptr_t salt_int = reinterpret_cast<uintptr_t>(salt);
return absl::HashOf(k, absl::rotr(salt_int, k.size()));
return static_cast<map_index_t>(
absl::HashOf(k, absl::rotr(salt_int, k.size())));
}
inline map_index_t Hash(uint64_t k, void* salt) {
const uintptr_t salt_int = reinterpret_cast<uintptr_t>(salt);
return absl::HashOf(k, absl::rotr(salt_int, k));
return static_cast<map_index_t>(absl::HashOf(k, absl::rotr(salt_int, k)));
}

// KeyMapBase is a chaining hash map.
Expand Down
16 changes: 8 additions & 8 deletions src/google/protobuf/micro_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,20 @@ class PROTOBUF_EXPORT MicroString {

void SetExternalBuffer(absl::string_view buffer) {
payload = const_cast<char*>(buffer.data());
size = buffer.size();
size = static_cast<uint32_t>(buffer.size());
}

void SetInitialSize(size_t size) {
PoisonMemoryRegion(owned_head() + size, capacity - size);
this->size = size;
void SetInitialSize(size_t new_size) {
PoisonMemoryRegion(owned_head() + new_size, capacity - new_size);
this->size = static_cast<uint32_t>(new_size);
}

void Unpoison() { UnpoisonMemoryRegion(owned_head(), capacity); }

void ChangeSize(size_t new_size) {
PoisonMemoryRegion(owned_head() + new_size, capacity - new_size);
UnpoisonMemoryRegion(owned_head(), new_size);
size = new_size;
size = static_cast<uint32_t>(new_size);
}
};

Expand All @@ -108,9 +108,9 @@ class PROTOBUF_EXPORT MicroString {
const char* data() const { return reinterpret_cast<const char*>(this + 1); }
absl::string_view view() const { return {data(), size}; }

void SetInitialSize(uint8_t size) {
PoisonMemoryRegion(data() + size, capacity - size);
this->size = size;
void SetInitialSize(uint8_t new_size) {
PoisonMemoryRegion(data() + new_size, capacity - new_size);
this->size = new_size;
}

void Unpoison() { UnpoisonMemoryRegion(data(), capacity); }
Expand Down
7 changes: 4 additions & 3 deletions src/google/protobuf/repeated_ptr_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -2152,16 +2152,17 @@ class RustRepeatedMessageHelper {
}

static void Reserve(RepeatedPtrFieldBase& field, size_t additional) {
field.ReserveWithArena(field.GetArena(), field.size() + additional);
field.ReserveWithArena(field.GetArena(),
static_cast<int>(field.size() + additional));
}

static const MessageLite& At(const RepeatedPtrFieldBase& field,
size_t index) {
return field.at<GenericTypeHandler<MessageLite>>(index);
return field.at<GenericTypeHandler<MessageLite>>(static_cast<int>(index));
}

static MessageLite& At(RepeatedPtrFieldBase& field, size_t index) {
return field.at<GenericTypeHandler<MessageLite>>(index);
return field.at<GenericTypeHandler<MessageLite>>(static_cast<int>(index));
}
};

Expand Down
Loading