Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 688338601
  • Loading branch information
evalon32 authored and copybara-github committed Oct 22, 2024
1 parent 6d5391f commit 7804c79
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 32 deletions.
60 changes: 29 additions & 31 deletions mediapipe/framework/tool/template_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -513,15 +513,16 @@ class TemplateParser::Parser::ParserImpl {

if (field == NULL) {
if (!allow_unknown_field_ && !allow_unknown_extension_) {
ReportError("Extension \"" + field_name +
"\" is not defined or "
"is not an extension of \"" +
descriptor->full_name() + "\".");
ReportError(absl::StrCat("Extension \"", field_name,
"\" is not defined or "
"is not an extension of \"",
descriptor->full_name(), "\"."));
return false;
} else {
ReportWarning("Ignoring extension \"" + field_name +
"\" which is not defined or is not an extension of \"" +
descriptor->full_name() + "\".");
ReportWarning(absl::StrCat(
"Ignoring extension \"", field_name,
"\" which is not defined or is not an extension of \"",
descriptor->full_name(), "\"."));
}
}
} else {
Expand Down Expand Up @@ -569,12 +570,14 @@ class TemplateParser::Parser::ParserImpl {

if (field == NULL && !reserved_field) {
if (!allow_unknown_field_) {
ReportError("Message type \"" + descriptor->full_name() +
"\" has no field named \"" + field_name + "\".");
ReportError(absl::StrCat("Message type \"", descriptor->full_name(),
"\" has no field named \"", field_name,
"\"."));
return false;
} else {
ReportWarning("Message type \"" + descriptor->full_name() +
"\" has no field named \"" + field_name + "\".");
ReportWarning(absl::StrCat("Message type \"", descriptor->full_name(),
"\" has no field named \"", field_name,
"\"."));
}
}
}
Expand Down Expand Up @@ -610,13 +613,10 @@ class TemplateParser::Parser::ParserImpl {
if (oneof != NULL && reflection->HasOneof(*message, oneof)) {
const FieldDescriptor* other_field =
reflection->GetOneofFieldDescriptor(*message, oneof);
ReportError("Field \"" + field_name +
"\" is specified along with "
"field \"" +
other_field->name() +
"\", another member "
"of oneof \"" +
oneof->name() + "\".");
ReportError(absl::StrCat(
"Field \"", field_name, "\" is specified along with field \"",
other_field->name(), "\", another member of oneof \"",
oneof->name(), "\"."));
return false;
}
}
Expand Down Expand Up @@ -846,8 +846,9 @@ class TemplateParser::Parser::ParserImpl {
} else if (value == "false" || value == "False" || value == "f") {
SET_FIELD(Bool, false);
} else {
ReportError("Invalid value for boolean field \"" + field->name() +
"\". Value: \"" + value + "\".");
ReportError(absl::StrCat("Invalid value for boolean field \"",
field->name(), "\". Value: \"", value,
"\"."));
return false;
}
}
Expand Down Expand Up @@ -883,16 +884,13 @@ class TemplateParser::Parser::ParserImpl {
SET_FIELD(EnumValue, int_value);
return true;
} else if (!allow_unknown_enum_) {
ReportError("Unknown enumeration value of \"" + value +
"\" for "
"field \"" +
field->name() + "\".");
ReportError(absl::StrCat("Unknown enumeration value of \"", value,
"\" for field \"", field->name(), "\"."));
return false;
} else {
ReportWarning("Unknown enumeration value of \"" + value +
"\" for "
"field \"" +
field->name() + "\".");
ReportWarning(absl::StrCat("Unknown enumeration value of \"", value,
"\" for field \"", field->name(),
"\"."));
return true;
}
}
Expand Down Expand Up @@ -1240,9 +1238,9 @@ class TemplateParser::Parser::ParserImpl {
value->AppendPartialToString(serialized_value);
} else {
if (!value->IsInitialized()) {
ReportError(
"Value of type \"" + value_descriptor->full_name() +
"\" stored in google.protobuf.Any has missing required fields");
ReportError(absl::StrCat(
"Value of type \"", value_descriptor->full_name(),
"\" stored in google.protobuf.Any has missing required fields"));
return false;
}
value->AppendToString(serialized_value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ JNIEXPORT void JNICALL PACKET_GETTER_METHOD(nativeGetProto)(JNIEnv* env,
if (!ThrowIfError(env, status)) {
// Convert type_name and value to Java data.
const auto& proto_message = mediapipe_packet.GetProtoMessageLite();
std::string type_name = proto_message.GetTypeName();
std::string type_name(proto_message.GetTypeName());
jstring j_type_name = env->NewStringUTF(type_name.c_str());
std::string proto_bytes;
proto_message.SerializeToString(&proto_bytes);
Expand Down

0 comments on commit 7804c79

Please sign in to comment.