aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/protobuf/patches/dont-use-string-view.patch
blob: 084341c464f5dddf6300409e2bfa61b5d5a2c099 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
commit 4a6dd4d9aeb3e3f9c033d092c86d5be63ca8cba9
author: nechda
date: 2024-08-08T14:02:13+03:00

    [PROTOBUF] Dont use string_view

--- contrib/libs/protobuf/src/google/protobuf/arenastring.cc	(e2819444222a1e9154b9c7b701eff6427206db7c)
+++ contrib/libs/protobuf/src/google/protobuf/arenastring.cc	(4a6dd4d9aeb3e3f9c033d092c86d5be63ca8cba9)
@@ -115,7 +115,7 @@ TaggedStringPtr CreateArenaString(Arena& arena, absl::string_view s) {
 
 }  // namespace
 
-void ArenaStringPtr::Set(absl::string_view value, Arena* arena) {
+void ArenaStringPtr::Set(const TProtoStringType& value, Arena* arena) {
   ScopedCheckPtrInvariants check(&tagged_ptr_);
   if (IsDefault()) {
     // If we're not on an arena, skip straight to a true string to avoid
--- contrib/libs/protobuf/src/google/protobuf/arenastring.h	(e2819444222a1e9154b9c7b701eff6427206db7c)
+++ contrib/libs/protobuf/src/google/protobuf/arenastring.h	(4a6dd4d9aeb3e3f9c033d092c86d5be63ca8cba9)
@@ -259,7 +259,7 @@ struct PROTOBUF_EXPORT ArenaStringPtr {
   // instance known to not carry any heap allocated value.
   inline void InitAllocated(TProtoStringType* str, Arena* arena);
 
-  void Set(absl::string_view value, Arena* arena);
+  void Set(const TProtoStringType& value, Arena* arena);
   void Set(TProtoStringType&& value, Arena* arena);
   template <typename... OverloadDisambiguator>
   void Set(const TProtoStringType& value, Arena* arena);
@@ -410,15 +410,15 @@ inline void ArenaStringPtr::InitAllocated(TProtoStringType* str, Arena* arena) {
 }
 
 inline void ArenaStringPtr::Set(const char* s, Arena* arena) {
-  Set(absl::string_view{s}, arena);
+  Set(TProtoStringType{s}, arena);
 }
 
 inline void ArenaStringPtr::Set(const char* s, size_t n, Arena* arena) {
-  Set(absl::string_view{s, n}, arena);
+  Set(TProtoStringType(s, s + n), arena);
 }
 
 inline void ArenaStringPtr::SetBytes(absl::string_view value, Arena* arena) {
-  Set(value, arena);
+  Set(TProtoStringType(value.data(), value.size()), arena);
 }
 
 template <>
@@ -439,7 +439,7 @@ inline void ArenaStringPtr::SetBytes(const char* s, Arena* arena) {
 }
 
 inline void ArenaStringPtr::SetBytes(const void* p, size_t n, Arena* arena) {
-  Set(absl::string_view{static_cast<const char*>(p), n}, arena);
+  Set(TProtoStringType(static_cast<const char*>(p), static_cast<const char*>(p) + n), arena);
 }
 
 // Make sure rhs_arena allocated rhs, and lhs_arena allocated lhs.