Skip to content

Commit

Permalink
Fix uninitialized variable warnings in descriptor.cc (protocolbuffers…
Browse files Browse the repository at this point in the history
…#8931)

* Fix uninitialized variable use warnings in descriptor.cc AllocateFieldNames and AllocRawInternal

* Fix missing-field-initializers warning
  • Loading branch information
Sil3ntStorm authored Aug 30, 2021
1 parent ef6a9b2 commit c87e1ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/google/protobuf/descriptor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ class TableArena {
size = RoundUp(size);

Block* to_relocate = nullptr;
Block* to_use;
Block* to_use = nullptr;

for (size_t i = 0; i < kSmallSizes.size(); ++i) {
if (small_size_blocks_[i] != nullptr && size <= kSmallSizes[i]) {
Expand Down Expand Up @@ -1720,7 +1720,7 @@ DescriptorPool::Tables::AllocateFieldNames(const std::string& name,
const int total_count = 2 + (lower_eq_name ? 0 : 1) +
(camel_eq_name ? 0 : 1) +
(json_eq_name || json_eq_camel ? 0 : 1);
FieldNamesResult result;
FieldNamesResult result{nullptr, 0, 0, 0};
// We use std::array to allow handling of the destruction of the strings.
switch (total_count) {
case 2:
Expand Down

0 comments on commit c87e1ae

Please sign in to comment.