diff --git a/mediapipe/tasks/ios/test/vision/utils/sources/parse_proto_utils.cc b/mediapipe/tasks/ios/test/vision/utils/sources/parse_proto_utils.cc index c0c1e1f4d..8e161c8c4 100644 --- a/mediapipe/tasks/ios/test/vision/utils/sources/parse_proto_utils.cc +++ b/mediapipe/tasks/ios/test/vision/utils/sources/parse_proto_utils.cc @@ -1,4 +1,4 @@ -/* Copyright 2022 The MediaPipe Authors. +/* Copyright 2023 The MediaPipe Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,20 +21,22 @@ limitations under the License. namespace mediapipe::tasks::ios::test::vision::utils { namespace { - using ::google::protobuf::TextFormat; - } +using ::google::protobuf::TextFormat; +} // anonymous namespace - absl::Status get_proto_from_pbtxt(const std::string file_path, google::protobuf::Message& proto) { - - std::ifstream file_input_stream(file_path); - if(!file_input_stream.is_open()) return absl::InvalidArgumentError( - "Cannot read input file."); - - std::stringstream strings_stream ; - strings_stream << file_input_stream.rdbuf(); +absl::Status get_proto_from_pbtxt(const std::string file_path, + google::protobuf::Message& proto) { + std::ifstream file_input_stream(file_path); + if (!file_input_stream.is_open()) + return absl::InvalidArgumentError("Cannot read input file."); - return TextFormat::ParseFromString(strings_stream.str(), &proto) ? absl::OkStatus() : absl::InvalidArgumentError( - "Cannot read a valid proto from the input file."); - } + std::stringstream strings_stream; + strings_stream << file_input_stream.rdbuf(); + + return TextFormat::ParseFromString(strings_stream.str(), &proto) + ? absl::OkStatus() + : absl::InvalidArgumentError( + "Cannot read a valid proto from the input file."); +} } // namespace mediapipe::tasks::ios::test::vision::utils diff --git a/mediapipe/tasks/ios/test/vision/utils/sources/parse_proto_utils.h b/mediapipe/tasks/ios/test/vision/utils/sources/parse_proto_utils.h index 5ea59796b..89119305b 100644 --- a/mediapipe/tasks/ios/test/vision/utils/sources/parse_proto_utils.h +++ b/mediapipe/tasks/ios/test/vision/utils/sources/parse_proto_utils.h @@ -1,4 +1,4 @@ -/* Copyright 2022 The MediaPipe Authors. +/* Copyright 2023 The MediaPipe Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,7 +22,8 @@ limitations under the License. #include "google/protobuf/text_format.h" namespace mediapipe::tasks::ios::test::vision::utils { - absl::Status get_proto_from_pbtxt(const std::string file_path, google::protobuf::Message& proto); +absl::Status get_proto_from_pbtxt(const std::string file_path, + google::protobuf::Message& proto); } // namespace mediapipe::tasks::ios::test::vision::utils #endif // MEDIAPIPE_TASKS_IOS_TEST_VISION_UTILS_H_