updated protobuf to 3.18.1

This commit is contained in:
Sven Czarnian
2021-10-10 20:51:05 +02:00
parent ea460b1aaf
commit 7d69203486
69 changed files with 6374 additions and 3669 deletions

View File

@@ -35,6 +35,8 @@
#include <google/protobuf/stubs/common.h>
#include <algorithm>
namespace google {
namespace protobuf {
@@ -48,6 +50,18 @@ inline void STLStringResizeUninitialized(std::string* s, size_t new_size) {
s->resize(new_size);
}
// As above, but we make sure to follow amortized growth in which we always
// increase the capacity by at least a constant factor >1.
inline void STLStringResizeUninitializedAmortized(std::string* s,
size_t new_size) {
const size_t cap = s->capacity();
if (new_size > cap) {
// Make sure to always grow by at least a factor of 2x.
s->reserve(std::max(new_size, 2 * cap));
}
STLStringResizeUninitialized(s, new_size);
}
// Return a mutable char* pointing to a string's internal buffer,
// which may not be null-terminated. Writing through this pointer will
// modify the string.