-
Robert Edmonds authored
protobuf 30.x changes various APIs to return string_view's rather than string&'s. This broke protobuf-c, since we were relying on the implicit construction of strings from string&'s in various places. This commit explicitly constructs strings from the string_view's returned by the protobuf 30.x API when we need to store an owned string (e.g. in a hash map). This maintains compatibility with older versions of protobuf such as 3.21 in Debian/Ubuntu while extending compatibility to the latest protobuf 30.x. Without this commit we get lots of errors like this when compiling against protobuf 30.x: protoc-gen-c/c_field.cc:119:43: error: no match for 'operator=' (operand types are 'std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >::mapped_type' {aka 'std::__cxx11::basic_string<char>'} and 'google::protobuf::internal::DescriptorStringView' {aka 'absl::debian7::string_view'})9f1e80e2