Skip to content

Commit 25bdbc2

Browse files
committed
fix grpc: fix conversion compilation error in proto_json.cpp
commit_hash:5f05d9ccdffe094b3b25dbfc0727f0b82d85b598
1 parent bf4fe17 commit 25bdbc2

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

grpc/src/ugrpc/proto_json.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,20 @@ void FromJsonStringImpl(
3636
google::protobuf::Message& output,
3737
const google::protobuf::util::JsonParseOptions& options
3838
) {
39-
#if GOOGLE_PROTOBUF_VERSION >= 4022000
39+
#if defined(ARCADIA_ROOT)
40+
// JSON utils use y_absl::string_view.
41+
const auto status = google::protobuf::util::JsonStringToMessage(
42+
y_absl::string_view(json_string.data(), json_string.size()), &output, options
43+
);
44+
#elif GOOGLE_PROTOBUF_VERSION >= 4022000
4045
// JSON utils use absl::string_view.
41-
const auto status =
42-
google::protobuf::util::JsonStringToMessage({json_string.data(), json_string.size()}, &output, options);
46+
const auto status = google::protobuf::util::JsonStringToMessage(
47+
absl::string_view(json_string.data(), json_string.size()), &output, options
48+
);
4349
#else
4450
// JSON utils use StringPiece.
4551
const auto status = google::protobuf::util::JsonStringToMessage(
46-
{json_string.data(), static_cast<std::ptrdiff_t>(json_string.size())}, &output, options
52+
google::protobuf::StringPiece(json_string.data(), json_string.size()), &output, options
4753
);
4854
#endif
4955

0 commit comments

Comments
 (0)