aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf
diff options
context:
space:
mode:
authorswarmer <swarmer@yandex-team.ru>2022-02-10 16:46:31 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:31 +0300
commit317da38588b7898a99fd9168571408123350012b (patch)
tree25eebc31526019ad39a6c1b13f492963d97ba439 /library/cpp/protobuf
parent3b2241461d41d41ba1a706b0750c4f0f55c344f6 (diff)
downloadydb-317da38588b7898a99fd9168571408123350012b.tar.gz
Restoring authorship annotation for <swarmer@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/protobuf')
-rw-r--r--library/cpp/protobuf/util/pb_io.cpp20
-rw-r--r--library/cpp/protobuf/util/pb_io.h6
-rw-r--r--library/cpp/protobuf/util/pb_io_ut.cpp64
3 files changed, 45 insertions, 45 deletions
diff --git a/library/cpp/protobuf/util/pb_io.cpp b/library/cpp/protobuf/util/pb_io.cpp
index 6270ee0624..58b4960f9c 100644
--- a/library/cpp/protobuf/util/pb_io.cpp
+++ b/library/cpp/protobuf/util/pb_io.cpp
@@ -69,16 +69,16 @@ namespace NProtoBuf {
return result;
}
- bool MergePartialFromString(NProtoBuf::Message& m, const TStringBuf serializedProtoMessage) {
- google::protobuf::io::CodedInputStream input(reinterpret_cast<const ui8*>(serializedProtoMessage.data()), serializedProtoMessage.size());
- bool ok = m.MergePartialFromCodedStream(&input);
- ok = ok && input.ConsumedEntireMessage();
- return ok;
- }
-
- bool MergeFromString(NProtoBuf::Message& m, const TStringBuf serializedProtoMessage) {
- return MergePartialFromString(m, serializedProtoMessage) && m.IsInitialized();
- }
+ bool MergePartialFromString(NProtoBuf::Message& m, const TStringBuf serializedProtoMessage) {
+ google::protobuf::io::CodedInputStream input(reinterpret_cast<const ui8*>(serializedProtoMessage.data()), serializedProtoMessage.size());
+ bool ok = m.MergePartialFromCodedStream(&input);
+ ok = ok && input.ConsumedEntireMessage();
+ return ok;
+ }
+
+ bool MergeFromString(NProtoBuf::Message& m, const TStringBuf serializedProtoMessage) {
+ return MergePartialFromString(m, serializedProtoMessage) && m.IsInitialized();
+ }
}
int operator&(NProtoBuf::Message& m, IBinSaver& f) {
diff --git a/library/cpp/protobuf/util/pb_io.h b/library/cpp/protobuf/util/pb_io.h
index 493c84cb5f..aad964555b 100644
--- a/library/cpp/protobuf/util/pb_io.h
+++ b/library/cpp/protobuf/util/pb_io.h
@@ -37,9 +37,9 @@ namespace NProtoBuf {
bool TrySerializeToBase64String(const Message& m, TString& dataBase64);
const TString ShortUtf8DebugString(const Message& message);
-
- bool MergePartialFromString(NProtoBuf::Message& m, const TStringBuf serializedProtoMessage);
- bool MergeFromString(NProtoBuf::Message& m, const TStringBuf serializedProtoMessage);
+
+ bool MergePartialFromString(NProtoBuf::Message& m, const TStringBuf serializedProtoMessage);
+ bool MergeFromString(NProtoBuf::Message& m, const TStringBuf serializedProtoMessage);
}
int operator&(NProtoBuf::Message& m, IBinSaver& f);
diff --git a/library/cpp/protobuf/util/pb_io_ut.cpp b/library/cpp/protobuf/util/pb_io_ut.cpp
index 875d6dc602..2b93d64b5d 100644
--- a/library/cpp/protobuf/util/pb_io_ut.cpp
+++ b/library/cpp/protobuf/util/pb_io_ut.cpp
@@ -383,36 +383,36 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) {
UNIT_ASSERT(NProtoBuf::IsEqual(message, GetCorrectMessage()));
}
}
-
- Y_UNIT_TEST(TestMergeFromString) {
- NProtobufUtilUt::TMergeTest message;
- NProtobufUtilUt::TMergeTest messageFirstHalf;
- NProtobufUtilUt::TMergeTest messageSecondHalf;
-
- for (ui32 v = ~0; v != 0; v >>= 1) {
- message.AddMergeInt(v);
- (v > 0xffff ? messageFirstHalf : messageSecondHalf).AddMergeInt(v);
- }
-
- const TString full = message.SerializeAsString();
-
- {
- NProtobufUtilUt::TMergeTest m1;
- UNIT_ASSERT(NProtoBuf::MergeFromString(m1, full));
- UNIT_ASSERT(NProtoBuf::IsEqual(message, m1));
- }
- {
- NProtobufUtilUt::TMergeTest m2;
- TStringBuf s0 = TStringBuf(full).SubStr(0, 3);
- TStringBuf s1 = TStringBuf(full).SubStr(3);
- // объединение результатов двух MergePartialFromString не эквивалентно вызову MergePartialFromString от объединения строк
- UNIT_ASSERT(!(NProtoBuf::MergePartialFromString(m2, s0) && NProtoBuf::MergePartialFromString(m2, s1)));
- }
- {
- NProtobufUtilUt::TMergeTest m3;
- UNIT_ASSERT(NProtoBuf::MergePartialFromString(m3, messageFirstHalf.SerializeAsString()));
- UNIT_ASSERT(NProtoBuf::MergeFromString(m3, messageSecondHalf.SerializeAsString()));
- UNIT_ASSERT(NProtoBuf::IsEqual(message, m3));
- }
- }
+
+ Y_UNIT_TEST(TestMergeFromString) {
+ NProtobufUtilUt::TMergeTest message;
+ NProtobufUtilUt::TMergeTest messageFirstHalf;
+ NProtobufUtilUt::TMergeTest messageSecondHalf;
+
+ for (ui32 v = ~0; v != 0; v >>= 1) {
+ message.AddMergeInt(v);
+ (v > 0xffff ? messageFirstHalf : messageSecondHalf).AddMergeInt(v);
+ }
+
+ const TString full = message.SerializeAsString();
+
+ {
+ NProtobufUtilUt::TMergeTest m1;
+ UNIT_ASSERT(NProtoBuf::MergeFromString(m1, full));
+ UNIT_ASSERT(NProtoBuf::IsEqual(message, m1));
+ }
+ {
+ NProtobufUtilUt::TMergeTest m2;
+ TStringBuf s0 = TStringBuf(full).SubStr(0, 3);
+ TStringBuf s1 = TStringBuf(full).SubStr(3);
+ // объединение результатов двух MergePartialFromString не эквивалентно вызову MergePartialFromString от объединения строк
+ UNIT_ASSERT(!(NProtoBuf::MergePartialFromString(m2, s0) && NProtoBuf::MergePartialFromString(m2, s1)));
+ }
+ {
+ NProtobufUtilUt::TMergeTest m3;
+ UNIT_ASSERT(NProtoBuf::MergePartialFromString(m3, messageFirstHalf.SerializeAsString()));
+ UNIT_ASSERT(NProtoBuf::MergeFromString(m3, messageSecondHalf.SerializeAsString()));
+ UNIT_ASSERT(NProtoBuf::IsEqual(message, m3));
+ }
+ }
}