File: 0005-explicit-std-string.patch

package info (click to toggle)
zbackup 1.5-4
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 868 kB
  • sloc: cpp: 6,957; ansic: 468; python: 207; makefile: 10
file content (62 lines) | stat: -rw-r--r-- 2,404 bytes parent folder | download
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
57
58
59
60
61
62
Apparently previous gcc versions
coerced these to std::string before
trying to concatenate or throw. Now it's
trying with std::basic_string_view
and string_view which doesn't support
concatenate operator+ or
automatic coerce to string.

config.cc:602:41: error: no match for ‘operator+’ (operand types are ‘absl::lts_20250512::string_view’ {aka ‘std::basic_string_view<char>’} and ‘const char [2]’)
message.cc:34:46: error: no matching function for call to ‘Message::exCantParse::exCantParse(absl::lts_20250512::string_view)’

diff -pNaru5 a/config.cc b/config.cc
--- a/config.cc	2020-06-07 11:35:57.000000000 -0400
+++ b/config.cc	2025-05-31 12:44:44.663683101 -0400
@@ -597,11 +597,11 @@ bool Config::validateProto( const string
           storageDescriptor->field( j );
 
         dPrintf( "Field: %s - %d - %d\n", field->name().c_str(),
             field->label(), field->type());
 
-        string option = storage->name() + "." + field->name();
+        string option = string(storage->name()) + "." + string(field->name());
 
         if ( !config.parseOrValidate( option.c_str(), Storable, true ) )
         {
           fprintf( stderr, "Invalid option specified: %s\n",
                    option.c_str() );
diff -pNaru5 a/message.cc b/message.cc
--- a/message.cc	2020-06-07 11:35:57.000000000 -0400
+++ b/message.cc	2025-05-31 12:48:02.149898094 -0400
@@ -16,11 +16,11 @@ void serialize( MessageLite const & mess
 void serialize( MessageLite const & message, CodedOutputStream & cos )
 {
   cos.WriteVarint32( message.ByteSize() );
   message.SerializeWithCachedSizes( &cos );
   if ( cos.HadError() )
-    throw exCantSerialize( message.GetTypeName() );
+    throw exCantSerialize( std::string(message.GetTypeName()) );
 }
 
 void parse( MessageLite & message, ZeroCopyInputStream & stream )
 {
   CodedInputStream cis( &stream );
@@ -29,16 +29,16 @@ void parse( MessageLite & message, ZeroC
 
 void parse( MessageLite & message, CodedInputStream & cis )
 {
   uint32_t v;
   if ( !cis.ReadVarint32( &v ) )
-    throw exCantParse( message.GetTypeName() );
+    throw exCantParse( std::string(message.GetTypeName()) );
 
   CodedInputStream::Limit limit = cis.PushLimit( v );
 
   if( !message.ParseFromCodedStream( &cis ) )
-    throw exCantParse( message.GetTypeName() );
+    throw exCantParse( std::string(message.GetTypeName()) );
 
   cis.PopLimit( limit );
 }
 
 }