From 0419df4b2d3e2b234de9c72fa16605ad0f89ae31 Mon Sep 17 00:00:00 2001 From: David Given Date: Wed, 13 Aug 2025 23:00:08 +0200 Subject: [PATCH] Another archival checkin... --- lib/config/proto.cc | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/config/proto.cc b/lib/config/proto.cc index 773927bd..399a3d76 100644 --- a/lib/config/proto.cc +++ b/lib/config/proto.cc @@ -178,7 +178,7 @@ static ProtoField resolveProtoPath( if (!field) fail(); - return std::make_tuple(message, field, -1); + return std::make_tuple(message, field, index); } ProtoField makeProtoPath( @@ -221,7 +221,7 @@ static int32_t parseEnum( const auto* enumvalue = enumfield->FindValueByName(value); if (!enumvalue) error("unrecognised enum value '{}'", value); - return enumvalue->index(); + return enumvalue->number(); } template @@ -280,7 +280,7 @@ void setProtoFieldFromString(ProtoField& protoField, const std::string& value) reflection->GetMutableRepeatedFieldRef( message, field), index, - (uint32_t)toUInt64(value)); + (uint32_t)toUint64(value)); break; case google::protobuf::FieldDescriptor::TYPE_UINT64: @@ -288,7 +288,7 @@ void setProtoFieldFromString(ProtoField& protoField, const std::string& value) reflection->GetMutableRepeatedFieldRef( message, field), index, - toUInt64(value)); + toUint64(value)); break; case google::protobuf::FieldDescriptor::TYPE_STRING: @@ -308,8 +308,11 @@ void setProtoFieldFromString(ProtoField& protoField, const std::string& value) break; case google::protobuf::FieldDescriptor::TYPE_ENUM: - reflection->SetRepeatedEnum( - message, field, index, parseEnum(field, value)); + updateRepeatedField( + reflection->GetMutableRepeatedFieldRef( + message, field), + index, + parseEnum(field, value)); break; case google::protobuf::FieldDescriptor::TYPE_MESSAGE: @@ -320,11 +323,6 @@ void setProtoFieldFromString(ProtoField& protoField, const std::string& value) value); break; } - if (field->containing_oneof() && value.empty()) - { - reflection->MutableRepeatedMessage(message, field, index); - break; - } /* fall through */ default: error("can't set this config value type"); @@ -369,7 +367,7 @@ void setProtoFieldFromString(ProtoField& protoField, const std::string& value) break; case google::protobuf::FieldDescriptor::TYPE_ENUM: - reflection->SetEnum(message, field, parseEnum(field, value)); + reflection->SetEnumValue(message, field, parseEnum(field, value)); break; case google::protobuf::FieldDescriptor::TYPE_MESSAGE: