Fix uninitialized variable warnings in descriptor.cc (#8931)

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

* Fix missing-field-initializers warning
pull/8939/head
Sil3ntStorm 3 years ago committed by GitHub
parent ef6a9b2854
commit c87e1ae597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/google/protobuf/descriptor.cc

@ -794,7 +794,7 @@ class TableArena {
size = RoundUp(size); size = RoundUp(size);
Block* to_relocate = nullptr; Block* to_relocate = nullptr;
Block* to_use; Block* to_use = nullptr;
for (size_t i = 0; i < kSmallSizes.size(); ++i) { for (size_t i = 0; i < kSmallSizes.size(); ++i) {
if (small_size_blocks_[i] != nullptr && size <= kSmallSizes[i]) { if (small_size_blocks_[i] != nullptr && size <= kSmallSizes[i]) {
@ -1720,7 +1720,7 @@ DescriptorPool::Tables::AllocateFieldNames(const std::string& name,
const int total_count = 2 + (lower_eq_name ? 0 : 1) + const int total_count = 2 + (lower_eq_name ? 0 : 1) +
(camel_eq_name ? 0 : 1) + (camel_eq_name ? 0 : 1) +
(json_eq_name || json_eq_camel ? 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. // We use std::array to allow handling of the destruction of the strings.
switch (total_count) { switch (total_count) {
case 2: case 2:

Loading…
Cancel
Save