27
27
28
28
namespace google {
29
29
namespace protobuf {
30
- #if GOOGLE_PROTOBUF_VERSION < 4025000
30
+ #if GOOGLE_PROTOBUF_VERSION <= 4025000
31
31
32
32
template <typename T>
33
33
const T* DownCastMessage (const Message* message) {
@@ -40,7 +40,7 @@ T* DownCastMessage(Message* message) {
40
40
return const_cast <T*>(DownCastMessage<T>(message_const));
41
41
}
42
42
43
- #elif GOOGLE_PROTOBUF_VERSION < 5029000
43
+ #elif GOOGLE_PROTOBUF_VERSION <= 5028000
44
44
45
45
template <typename T>
46
46
const T* DownCastMessage (const Message* message) {
@@ -63,7 +63,7 @@ namespace protobuf = google::protobuf;
63
63
inline bool RequiresUtf8Validation (
64
64
const google::protobuf::FieldDescriptor& descriptor) {
65
65
// commit d8c2501b43c1b56e3efa74048a18f8ce06ba07fe of >= v3.22.0
66
- #if GOOGLE_PROTOBUF_VERSION >= 4022000
66
+ #if GOOGLE_PROTOBUF_VERSION > 3021005
67
67
return descriptor.requires_utf8_validation ();
68
68
#else
69
69
return descriptor.type () == google::protobuf::FieldDescriptor::TYPE_STRING &&
@@ -74,7 +74,7 @@ inline bool RequiresUtf8Validation(
74
74
75
75
inline bool HasPresence (const google::protobuf::FieldDescriptor& descriptor) {
76
76
// commit bb30225f06c36399757dc698b409d5f79738e8d1 of >=3.12.0
77
- #if GOOGLE_PROTOBUF_VERSION >= 3012000
77
+ #if GOOGLE_PROTOBUF_VERSION > 3011004
78
78
return descriptor.has_presence ();
79
79
#else
80
80
// NOTE: This mimics Protobuf 3.21.12 ("3021012")
@@ -89,20 +89,22 @@ inline bool HasPresence(const google::protobuf::FieldDescriptor& descriptor) {
89
89
90
90
inline void PrepareTextParser (google::protobuf::TextFormat::Parser& parser) {
91
91
// commit d8c2501b43c1b56e3efa74048a18f8ce06ba07fe of >=3.8.0
92
- #if GOOGLE_PROTOBUF_VERSION >= 3008000
92
+ #if GOOGLE_PROTOBUF_VERSION > 3006001
93
93
parser.SetRecursionLimit (100 );
94
+ #endif
95
+ #if GOOGLE_PROTOBUF_VERSION > 3007000
94
96
parser.AllowUnknownField (true );
95
97
#endif
96
98
}
97
99
98
100
constexpr bool TextParserCanSetRecursionLimit () {
99
101
// commit d8c2501b43c1b56e3efa74048a18f8ce06ba07fe of >=3.8.0
100
- return GOOGLE_PROTOBUF_VERSION >= 3008000 ;
102
+ return GOOGLE_PROTOBUF_VERSION > 3006001 ;
101
103
}
102
104
103
105
constexpr bool TextParserCanAllowUnknownField () {
104
106
// commit 176f7db11d8242b36a3ea6abb1cc436fca5bf75d of >=3.8.0
105
- return GOOGLE_PROTOBUF_VERSION >= 3008000 ;
107
+ return GOOGLE_PROTOBUF_VERSION > 3007000 ;
106
108
}
107
109
108
110
} // namespace protobuf_mutator
0 commit comments