diff options
author | elshiko <elshiko@yandex-team.ru> | 2022-02-10 16:49:20 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:20 +0300 |
commit | 455ab915435b70e433ed91eee2ca84f03122d6cb (patch) | |
tree | 4570335e510c5cb009cca313349e2a29b4c62310 /library/cpp/protobuf | |
parent | 85ad20a00eb9c7d4dcae0debe5172d5f9bc6792f (diff) | |
download | ydb-455ab915435b70e433ed91eee2ca84f03122d6cb.tar.gz |
Restoring authorship annotation for <elshiko@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/protobuf')
-rw-r--r-- | library/cpp/protobuf/util/pb_io.cpp | 6 | ||||
-rw-r--r-- | library/cpp/protobuf/util/pb_io.h | 8 | ||||
-rw-r--r-- | library/cpp/protobuf/util/pb_io_ut.cpp | 20 |
3 files changed, 17 insertions, 17 deletions
diff --git a/library/cpp/protobuf/util/pb_io.cpp b/library/cpp/protobuf/util/pb_io.cpp index 6270ee0624..d0d9b65d89 100644 --- a/library/cpp/protobuf/util/pb_io.cpp +++ b/library/cpp/protobuf/util/pb_io.cpp @@ -21,15 +21,15 @@ namespace NProtoBuf { } }; - void ParseFromBase64String(const TStringBuf dataBase64, Message& m, bool allowUneven) { + void ParseFromBase64String(const TStringBuf dataBase64, Message& m, bool allowUneven) { if (!m.ParseFromString(allowUneven ? Base64DecodeUneven(dataBase64) : Base64StrictDecode(dataBase64))) { ythrow yexception() << "can't parse " << m.GetTypeName() << " from base64-encoded string"; } } - bool TryParseFromBase64String(const TStringBuf dataBase64, Message& m, bool allowUneven) { + bool TryParseFromBase64String(const TStringBuf dataBase64, Message& m, bool allowUneven) { try { - ParseFromBase64String(dataBase64, m, allowUneven); + ParseFromBase64String(dataBase64, m, allowUneven); return true; } catch (const std::exception&) { return false; diff --git a/library/cpp/protobuf/util/pb_io.h b/library/cpp/protobuf/util/pb_io.h index 493c84cb5f..4ca101b28a 100644 --- a/library/cpp/protobuf/util/pb_io.h +++ b/library/cpp/protobuf/util/pb_io.h @@ -21,12 +21,12 @@ class IOutputStream; namespace NProtoBuf { /* Parse base64 URL encoded serialized message from string. */ - void ParseFromBase64String(const TStringBuf dataBase64, Message& m, bool allowUneven = false); - bool TryParseFromBase64String(const TStringBuf dataBase64, Message& m, bool allowUneven = false); + void ParseFromBase64String(const TStringBuf dataBase64, Message& m, bool allowUneven = false); + bool TryParseFromBase64String(const TStringBuf dataBase64, Message& m, bool allowUneven = false); template <typename T> - static T ParseFromBase64String(const TStringBuf& dataBase64, bool allowUneven = false) { + static T ParseFromBase64String(const TStringBuf& dataBase64, bool allowUneven = false) { T m; - ParseFromBase64String(dataBase64, m, allowUneven); + ParseFromBase64String(dataBase64, m, allowUneven); return m; } diff --git a/library/cpp/protobuf/util/pb_io_ut.cpp b/library/cpp/protobuf/util/pb_io_ut.cpp index 875d6dc602..cb08001997 100644 --- a/library/cpp/protobuf/util/pb_io_ut.cpp +++ b/library/cpp/protobuf/util/pb_io_ut.cpp @@ -45,8 +45,8 @@ static const TString INCORRECT_ENUM_ID_MESSAGE = static const TString CORRECT_BASE64_MESSAGE = "CCo,"; -static const TString CORRECT_UNEVEN_BASE64_MESSAGE = "CCo"; - +static const TString CORRECT_UNEVEN_BASE64_MESSAGE = "CCo"; + static const TString INCORRECT_BASE64_MESSAGE = "CC"; Y_UNIT_TEST_SUITE(TTestProtoBufIO) { @@ -60,14 +60,14 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) { UNIT_ASSERT(!NProtoBuf::TryParseFromBase64String(INCORRECT_BASE64_MESSAGE, message)); } { - NProtobufUtilUt::TTextTest message; - UNIT_ASSERT(NProtoBuf::TryParseFromBase64String(CORRECT_UNEVEN_BASE64_MESSAGE , message, true)); - } - { - NProtobufUtilUt::TTextTest message; - UNIT_ASSERT(!NProtoBuf::TryParseFromBase64String(CORRECT_UNEVEN_BASE64_MESSAGE , message, false)); - } - { + NProtobufUtilUt::TTextTest message; + UNIT_ASSERT(NProtoBuf::TryParseFromBase64String(CORRECT_UNEVEN_BASE64_MESSAGE , message, true)); + } + { + NProtobufUtilUt::TTextTest message; + UNIT_ASSERT(!NProtoBuf::TryParseFromBase64String(CORRECT_UNEVEN_BASE64_MESSAGE , message, false)); + } + { UNIT_ASSERT_VALUES_EQUAL(CORRECT_BASE64_MESSAGE, NProtoBuf::SerializeToBase64String(GetCorrectMessage())); } { |