Skip to content

Commit

Permalink
rename variables as suggested
Browse files Browse the repository at this point in the history
  • Loading branch information
Sil3ntStorm committed Aug 30, 2021
1 parent f406179 commit 6875152
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/google/protobuf/compiler/cpp/cpp_service.cc
Expand Up @@ -241,12 +241,12 @@ void ServiceGenerator::GenerateCallMethod(io::Printer* printer) {

for (int i = 0; i < descriptor_->method_count(); i++) {
const MethodDescriptor* method = descriptor_->method(i);
Formatter format_Loop(printer, vars_);
InitMethodVariables(method, options_, &format_Loop);
Formatter format_method(printer, vars_);
InitMethodVariables(method, options_, &format_method);

// Note: down_cast does not work here because it only works on pointers,
// not references.
format_Loop(
format_method(
" case $1$:\n"
" $name$(controller,\n"
" ::$proto_ns$::internal::DownCast<const $input_type$*>(\n"
Expand Down
12 changes: 6 additions & 6 deletions src/google/protobuf/util/internal/protostream_objectsource.cc
Expand Up @@ -265,16 +265,16 @@ util::StatusOr<uint32_t> ProtoStreamObjectSource::RenderMap(
std::string map_key;
for (uint32_t tag = stream_->ReadTag(); tag != 0;
tag = stream_->ReadTag()) {
const google::protobuf::Field* field_loop =
const google::protobuf::Field* map_entry_field =
FindAndVerifyField(*field_type, tag);
if (field_loop == nullptr) {
if (map_entry_field == nullptr) {
WireFormat::SkipField(stream_, tag, nullptr);
continue;
}
// Map field numbers are key = 1 and value = 2
if (field_loop->number() == 1) {
map_key = ReadFieldValueAsString(*field_loop);
} else if (field_loop->number() == 2) {
if (map_entry_field->number() == 1) {
map_key = ReadFieldValueAsString(*map_entry_field);
} else if (map_entry_field->number() == 2) {
if (map_key.empty()) {
// An absent map key is treated as the default.
const google::protobuf::Field* key_field =
Expand All @@ -286,7 +286,7 @@ util::StatusOr<uint32_t> ProtoStreamObjectSource::RenderMap(
}
ASSIGN_OR_RETURN(map_key, MapKeyDefaultValueAsString(*key_field));
}
RETURN_IF_ERROR(RenderField(field_loop, map_key, ow));
RETURN_IF_ERROR(RenderField(map_entry_field, map_key, ow));
} else {
// The Type info for this map entry is incorrect. It should contain
// exactly two fields with field number 1 and 2.
Expand Down

0 comments on commit 6875152

Please sign in to comment.