diff options
author | diver <diver@yandex-team.ru> | 2022-02-10 16:48:07 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:07 +0300 |
commit | e20e2b362f0232ed5a389db887e6e27e7763af18 (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /library | |
parent | 7629e1f9ef7f9d2a3c345c97e6a4e5a4b32ee786 (diff) | |
download | ydb-e20e2b362f0232ed5a389db887e6e27e7763af18.tar.gz |
Restoring authorship annotation for <diver@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library')
-rw-r--r-- | library/cpp/binsaver/bin_saver.h | 40 | ||||
-rw-r--r-- | library/cpp/binsaver/ut/binsaver_ut.cpp | 84 | ||||
-rw-r--r-- | library/cpp/binsaver/ut/ya.make | 16 | ||||
-rw-r--r-- | library/cpp/compproto/compproto_ut.cpp | 36 | ||||
-rw-r--r-- | library/cpp/deprecated/split/delim_string_iter.h | 50 | ||||
-rw-r--r-- | library/cpp/deprecated/split/delim_string_iter_ut.cpp | 14 | ||||
-rw-r--r-- | library/cpp/getopt/small/modchooser.cpp | 4 | ||||
-rw-r--r-- | library/cpp/getopt/ut/last_getopt_ut.cpp | 20 | ||||
-rw-r--r-- | library/cpp/on_disk/chunks/reader.cpp | 6 | ||||
-rw-r--r-- | library/cpp/on_disk/chunks/reader.h | 6 | ||||
-rw-r--r-- | library/cpp/packedtypes/packed.h | 10 | ||||
-rw-r--r-- | library/cpp/protobuf/util/pb_io.cpp | 22 | ||||
-rw-r--r-- | library/cpp/protobuf/util/pb_io.h | 8 | ||||
-rw-r--r-- | library/cpp/regex/pire/ut/regexp_ut.cpp | 24 |
14 files changed, 170 insertions, 170 deletions
diff --git a/library/cpp/binsaver/bin_saver.h b/library/cpp/binsaver/bin_saver.h index 88759d9049..412424889f 100644 --- a/library/cpp/binsaver/bin_saver.h +++ b/library/cpp/binsaver/bin_saver.h @@ -66,22 +66,22 @@ private: void CallObjectSerialize(T* p, NBinSaverInternals::TOverloadPriority<2>) { // highest priority - will be resolved first if enabled // Note: p->operator &(*this) would lead to infinite recursion p->T::operator&(*this); - } - + } + template <class T, typename = decltype(std::declval<T&>() & std::declval<IBinSaver&>())> void CallObjectSerialize(T* p, NBinSaverInternals::TOverloadPriority<1>) { // lower priority - will be resolved second if enabled - (*p) & (*this); - } - + (*p) & (*this); + } + template <class T> void CallObjectSerialize(T* p, NBinSaverInternals::TOverloadPriority<0>) { // lower priority - will be resolved last -#if (!defined(_MSC_VER)) - // In MSVC __has_trivial_copy returns false to enums, primitive types and arrays. +#if (!defined(_MSC_VER)) + // In MSVC __has_trivial_copy returns false to enums, primitive types and arrays. static_assert(__has_trivial_copy(T), "Class is nontrivial copyable, you must define operator&, see"); #endif - DataChunk(p, sizeof(T)); - } - + DataChunk(p, sizeof(T)); + } + // vector template <class T, class TA> void DoVector(TVector<T, TA>& data) { @@ -327,7 +327,7 @@ public: } template <class T1, class TA> int Add(const chunk_id, TVector<T1, TA>* pVec) { - if (HasNonTrivialSerializer<T1>(0u)) + if (HasNonTrivialSerializer<T1>(0u)) DoVector(*pVec); else DoDataVector(*pVec); @@ -371,7 +371,7 @@ public: template <class T1> int Add(const chunk_id, TArray2D<T1>* pArr) { - if (HasNonTrivialSerializer<T1>(0u)) + if (HasNonTrivialSerializer<T1>(0u)) Do2DArray(*pArr); else Do2DArrayData(*pArr); @@ -403,7 +403,7 @@ public: template <class T1, size_t N> int Add(const chunk_id, std::array<T1, N>* pData) { - if (HasNonTrivialSerializer<T1>(0u)) { + if (HasNonTrivialSerializer<T1>(0u)) { for (size_t i = 0; i < N; ++i) Add(1, &(*pData)[i]); } else { @@ -494,11 +494,11 @@ public: void AddPolymorphicBase(chunk_id, IObjectBase* pObject) { (*pObject) & (*this); } - + template <class T1, class T2> void DoPtr(TPtrBase<T1, T2>* pData) { - if (pData && pData->Get()) { - } + if (pData && pData->Get()) { + } if (IsReading()) pData->Set(CastToUserObject(LoadObject(), (T1*)nullptr)); else @@ -536,14 +536,14 @@ public: } template <class T, typename = decltype(std::declval<T&>() & std::declval<IBinSaver&>())> - static bool HasNonTrivialSerializer(ui32) { - return true; + static bool HasNonTrivialSerializer(ui32) { + return true; } template <class T> - static bool HasNonTrivialSerializer(...) { + static bool HasNonTrivialSerializer(...) { return sizeof(std::declval<IBinSaver*>()->Add(0, std::declval<T*>())) != 1; - } + } public: IBinSaver(IBinaryStream& stream, bool _bRead, bool stableOutput = false) diff --git a/library/cpp/binsaver/ut/binsaver_ut.cpp b/library/cpp/binsaver/ut/binsaver_ut.cpp index 218937d244..37eba5406f 100644 --- a/library/cpp/binsaver/ut/binsaver_ut.cpp +++ b/library/cpp/binsaver/ut/binsaver_ut.cpp @@ -3,42 +3,42 @@ #include <library/cpp/binsaver/bin_saver.h> #include <library/cpp/binsaver/ut_util/ut_util.h> #include <library/cpp/testing/unittest/registar.h> - -#include <util/stream/buffer.h> + +#include <util/stream/buffer.h> #include <util/generic/map.h> - -struct TBinarySerializable { - ui32 Data = 0; -}; - -struct TNonBinarySerializable { - ui32 Data = 0; + +struct TBinarySerializable { + ui32 Data = 0; +}; + +struct TNonBinarySerializable { + ui32 Data = 0; TString StrData; -}; - -struct TCustomSerializer { - ui32 Data = 0; +}; + +struct TCustomSerializer { + ui32 Data = 0; TString StrData; - SAVELOAD(StrData, Data); -}; - -struct TCustomOuterSerializer { - ui32 Data = 0; + SAVELOAD(StrData, Data); +}; + +struct TCustomOuterSerializer { + ui32 Data = 0; TString StrData; -}; - +}; + void operator&(TCustomOuterSerializer& s, IBinSaver& f); - -struct TCustomOuterSerializerTmpl { - ui32 Data = 0; + +struct TCustomOuterSerializerTmpl { + ui32 Data = 0; TString StrData; -}; - +}; + struct TCustomOuterSerializerTmplDerived: public TCustomOuterSerializerTmpl { - ui32 Data = 0; + ui32 Data = 0; TString StrData; -}; - +}; + struct TMoveOnlyType { ui32 Data = 0; @@ -62,11 +62,11 @@ struct TTypeWithArray { template <typename T, typename = std::enable_if_t<std::is_base_of<TCustomOuterSerializerTmpl, T>::value>> int operator&(T& s, IBinSaver& f); - + static bool operator==(const TBlob& l, const TBlob& r) { return TStringBuf(l.AsCharPtr(), l.Size()) == TStringBuf(r.AsCharPtr(), r.Size()); } - + Y_UNIT_TEST_SUITE(BinSaver){ Y_UNIT_TEST(HasTrivialSerializer){ UNIT_ASSERT(!IBinSaver::HasNonTrivialSerializer<TBinarySerializable>(0u)); @@ -77,12 +77,12 @@ UNIT_ASSERT(IBinSaver::HasNonTrivialSerializer<TCustomOuterSerializerTmpl>(0u)); UNIT_ASSERT(IBinSaver::HasNonTrivialSerializer<TCustomOuterSerializerTmplDerived>(0u)); UNIT_ASSERT(IBinSaver::HasNonTrivialSerializer<TVector<TCustomSerializer>>(0u)); } - - + + Y_UNIT_TEST(TestStroka) { TestBinSaverSerialization(TString("QWERTY")); } - + Y_UNIT_TEST(TestMoveOnlyType) { TestBinSaverSerializationToBuffer(TMoveOnlyType()); } @@ -104,11 +104,11 @@ Y_UNIT_TEST(TestMaps) { TestBinSaverSerialization(THashMap<TString, ui32>{{"A", 1}, {"B", 2}, {"C", 3}}); TestBinSaverSerialization(TMap<TString, ui32>{{"A", 1}, {"B", 2}, {"C", 3}}); } - + Y_UNIT_TEST(TestBlob) { TestBinSaverSerialization(TBlob::FromStringSingleThreaded("qwerty")); } - + Y_UNIT_TEST(TestVariant) { { using T = std::variant<TString, int>; @@ -140,15 +140,15 @@ Y_UNIT_TEST(TestPod) { TestBinSaverSerialization(custom); TestBinSaverSerialization(TVector<TPod>{custom}); } - + Y_UNIT_TEST(TestSubPod) { struct TPod { struct TSub { ui32 X = 10; bool operator==(const TSub& other) const { return X == other.X; - } - }; + } + }; TVector<TSub> B; int operator&(IBinSaver& f) { f.Add(0, &B); @@ -165,7 +165,7 @@ Y_UNIT_TEST(TestSubPod) { custom.B = {sub}; TestBinSaverSerialization(TVector<TPod>{custom}); } - + Y_UNIT_TEST(TestMemberAndOpIsMain) { struct TBase { TString S; @@ -175,7 +175,7 @@ Y_UNIT_TEST(TestMemberAndOpIsMain) { } virtual ~TBase() = default; }; - + struct TDerived: public TBase { int A = 0; int operator&(IBinSaver& f)override { @@ -187,11 +187,11 @@ Y_UNIT_TEST(TestMemberAndOpIsMain) { return A == other.A && S == other.S; } }; - + TDerived obj; obj.S = "TString"; obj.A = 42; - + TestBinSaverSerialization(obj); } } diff --git a/library/cpp/binsaver/ut/ya.make b/library/cpp/binsaver/ut/ya.make index d0b48e78aa..43dc20bff7 100644 --- a/library/cpp/binsaver/ut/ya.make +++ b/library/cpp/binsaver/ut/ya.make @@ -1,11 +1,11 @@ UNITTEST_FOR(library/cpp/binsaver) - -OWNER(gulin) - -SRCS( - binsaver_ut.cpp -) - + +OWNER(gulin) + +SRCS( + binsaver_ut.cpp +) + PEERDIR(library/cpp/binsaver/ut_util) -END() +END() diff --git a/library/cpp/compproto/compproto_ut.cpp b/library/cpp/compproto/compproto_ut.cpp index 7380fb6cc2..9393be967a 100644 --- a/library/cpp/compproto/compproto_ut.cpp +++ b/library/cpp/compproto/compproto_ut.cpp @@ -34,15 +34,15 @@ struct TTestParams { template <typename X> void TestSaveLoadMeta(NCompProto::TMetaInfo<X>& src) { - TStringStream ss; - src.Save(ss); + TStringStream ss; + src.Save(ss); TString data = ss.Str(); - NCompProto::TMetaInfo<X> loadedMeta(data); - ss = TStringStream(); - loadedMeta.Save(ss); - UNIT_ASSERT_EQUAL(ss.Str(), data); -} - + NCompProto::TMetaInfo<X> loadedMeta(data); + ss = TStringStream(); + loadedMeta.Save(ss); + UNIT_ASSERT_EQUAL(ss.Str(), data); +} + template <typename TDecompressor, template <typename, typename> class TSerialize> void TestWithParams(const TString& metainfo, const ECompMode mode, const TTestParams& params) { using namespace NCompProto; @@ -59,7 +59,7 @@ void TestWithParams(const TString& metainfo, const ECompMode mode, const TTestPa } else { meta.Reset(new TMetaInfo<THuff>(stream)); } - TestSaveLoadMeta(*meta.Get()); + TestSaveLoadMeta(*meta.Get()); TBitBuffer buffer; TSerialize<THuff, TBitBuffer>::Serialize(*meta, buffer, params); @@ -120,7 +120,7 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) { scalar clicks id 0 default const 0\n\ scalar shows id 1 default const 0\n\ end\n\ - scalar extra id 31 default const 0\n\ + scalar extra id 31 default const 0\n\ end\n"; struct TRegInfo { @@ -131,7 +131,7 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) { struct TData { ui32 Clicks; ui32 Shows; - ui32 Extra; + ui32 Extra; TMap<ui32, TRegInfo> RegClicks; }; @@ -149,7 +149,7 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) { data[i].Clicks = PseudoRandom(16) + 100; data[i].Shows = PseudoRandom(500) * PseudoRandom(16); - data[i].Extra = PseudoRandom(500) + (1UL << 31); // test also saving of big values + data[i].Extra = PseudoRandom(500) + (1UL << 31); // test also saving of big values meta.SetScalar(0, data[i].Clicks, functor); meta.SetScalar(1, data[i].Shows, functor); @@ -166,7 +166,7 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) { regClicks.EndElement(functor); } regClicks.EndRepeated(functor); - meta.SetScalar(31, data[i].Extra, functor); + meta.SetScalar(31, data[i].Extra, functor); meta.EndElement(functor); } meta.EndRepeated(functor); @@ -224,8 +224,8 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) { UNIT_ASSERT_EQUAL(val, Elem->Clicks); if (index == 1) UNIT_ASSERT_EQUAL(val, Elem->Shows); - if (index == 31) - UNIT_ASSERT_EQUAL(val, Elem->Extra); + if (index == 31) + UNIT_ASSERT_EQUAL(val, Elem->Extra); } IDecompressor& GetDecompressor(size_t index) { if (index == 2) { @@ -323,7 +323,7 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) { case InDataElem: State = OutDataElem; ++DataInd; - break; + break; case InRegClicks: ++RegIter; break; @@ -339,8 +339,8 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) { UNIT_ASSERT_EQUAL(val, data[DataInd].Clicks); if (index == 1) UNIT_ASSERT_EQUAL(val, data[DataInd].Shows); - if (index == 31) - UNIT_ASSERT_EQUAL(val, data[DataInd].Extra); + if (index == 31) + UNIT_ASSERT_EQUAL(val, data[DataInd].Extra); break; case InRegClicks: if (index == 0) diff --git a/library/cpp/deprecated/split/delim_string_iter.h b/library/cpp/deprecated/split/delim_string_iter.h index ccdcbb5b45..8e4ca171a0 100644 --- a/library/cpp/deprecated/split/delim_string_iter.h +++ b/library/cpp/deprecated/split/delim_string_iter.h @@ -9,7 +9,7 @@ #include <iterator> class TDelimStringIter { -public: +public: using value_type = TStringBuf; using difference_type = ptrdiff_t; using pointer = const TStringBuf*; @@ -23,14 +23,14 @@ public: inline TDelimStringIter(TStringBuf str, TStringBuf delim) : IsValid(true) - , Str(str) + , Str(str) , Delim(delim) { - UpdateCurrent(); + UpdateCurrent(); } inline TDelimStringIter() - : IsValid(false) + : IsValid(false) { } @@ -40,12 +40,12 @@ public: // NOTE: this is a potentially unsafe operation (no overrun check) inline TDelimStringIter& operator++() { - if (Current.end() != Str.end()) { - Str.Skip(Current.length() + Delim.length()); - UpdateCurrent(); + if (Current.end() != Str.end()) { + Str.Skip(Current.length() + Delim.length()); + UpdateCurrent(); } else { - Str.Clear(); - Current.Clear(); + Str.Clear(); + Current.Clear(); IsValid = false; } return *this; @@ -58,26 +58,26 @@ public: } inline bool operator==(const TDelimStringIter& rhs) const { - return (IsValid == rhs.IsValid) && (!IsValid || (Current.begin() == rhs.Current.begin())); + return (IsValid == rhs.IsValid) && (!IsValid || (Current.begin() == rhs.Current.begin())); } inline bool operator!=(const TDelimStringIter& rhs) const { - return !(*this == rhs); + return !(*this == rhs); } inline TStringBuf operator*() const { - return Current; + return Current; } inline const TStringBuf* operator->() const { - return &Current; - } - + return &Current; + } + // Get & advance template <class T> inline bool TryNext(T& t) { if (IsValid) { - t = FromString<T>(Current); + t = FromString<T>(Current); operator++(); return true; } else { @@ -95,26 +95,26 @@ public: template <class T> inline T GetNext() { - T res; - Next(res); - return res; - } - + T res; + Next(res); + return res; + } + inline const char* GetBegin() const { - return Current.begin(); + return Current.begin(); } inline const char* GetEnd() const { - return Current.end(); + return Current.end(); } inline bool Valid() const { return IsValid; } - // contents from next token to the end of string + // contents from next token to the end of string inline TStringBuf Cdr() const { - return Str.SubStr(Current.length() + Delim.length()); + return Str.SubStr(Current.length() + Delim.length()); } inline TDelimStringIter IterEnd() const { diff --git a/library/cpp/deprecated/split/delim_string_iter_ut.cpp b/library/cpp/deprecated/split/delim_string_iter_ut.cpp index fece177f4d..18a8b2a160 100644 --- a/library/cpp/deprecated/split/delim_string_iter_ut.cpp +++ b/library/cpp/deprecated/split/delim_string_iter_ut.cpp @@ -10,7 +10,7 @@ static void AssertStringSplit(const TString& str, const TString& delim, const TV for (const auto& expectedString : expected) { UNIT_ASSERT(it.Valid()); UNIT_ASSERT(bool(it)); - UNIT_ASSERT_STRINGS_EQUAL(it->ToString(), expectedString); + UNIT_ASSERT_STRINGS_EQUAL(it->ToString(), expectedString); ++it; } UNIT_ASSERT(!it.Valid()); @@ -30,14 +30,14 @@ Y_UNIT_TEST_SUITE(TDelimStrokaIterTestSuite) { Y_UNIT_TEST(NoDelimitersPresent) { AssertStringSplit("This string could be yours", "\t", {"This string could be yours"}); } - + Y_UNIT_TEST(Cdr) { TDelimStringIter it("a\tc\t", "\t"); - UNIT_ASSERT_STRINGS_EQUAL(*it, "a"); - UNIT_ASSERT_STRINGS_EQUAL(it.Cdr(), "c\t"); - ++it; - UNIT_ASSERT_STRINGS_EQUAL(it.Cdr(), ""); - } + UNIT_ASSERT_STRINGS_EQUAL(*it, "a"); + UNIT_ASSERT_STRINGS_EQUAL(it.Cdr(), "c\t"); + ++it; + UNIT_ASSERT_STRINGS_EQUAL(it.Cdr(), ""); + } Y_UNIT_TEST(ForIter) { TVector<TStringBuf> expected = {"1", "", "3@4", ""}; diff --git a/library/cpp/getopt/small/modchooser.cpp b/library/cpp/getopt/small/modchooser.cpp index 5595ed8d95..2fa5cfd070 100644 --- a/library/cpp/getopt/small/modchooser.cpp +++ b/library/cpp/getopt/small/modchooser.cpp @@ -181,7 +181,7 @@ int TModChooser::Run(const int argc, const char** argv) const { } if (modeName == "-h" || modeName == "--help" || modeName == "-?") { - PrintHelp(argv[0]); + PrintHelp(argv[0]); return 0; } if (VersionHandler && (modeName == "-v" || modeName == "--version")) { @@ -200,7 +200,7 @@ int TModChooser::Run(const int argc, const char** argv) const { if (modeIter == Modes.end()) { Cerr << "Unknown mode " << modeName.Quote() << "." << Endl; - PrintHelp(argv[0]); + PrintHelp(argv[0]); return 1; } diff --git a/library/cpp/getopt/ut/last_getopt_ut.cpp b/library/cpp/getopt/ut/last_getopt_ut.cpp index 64b46c7da6..c99a1d053d 100644 --- a/library/cpp/getopt/ut/last_getopt_ut.cpp +++ b/library/cpp/getopt/ut/last_getopt_ut.cpp @@ -591,19 +591,19 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { } Y_UNIT_TEST(TestCustomCmdLineDescr) { - TOpts opts; - const char* prog = "my_program"; + TOpts opts; + const char* prog = "my_program"; TString customDescr = "<FILE|TABLE> USER [OPTIONS]"; - int argc = 2; + int argc = 2; const char* cmd[] = {prog}; - opts.SetCmdLineDescr(customDescr); - TOptsParser parser(&opts, argc, cmd); - TStringStream out; - parser.PrintUsage(out); - // find custom usage + opts.SetCmdLineDescr(customDescr); + TOptsParser parser(&opts, argc, cmd); + TStringStream out; + parser.PrintUsage(out); + // find custom usage UNIT_ASSERT(out.Str().find(customDescr) != TString::npos); - } - + } + Y_UNIT_TEST(TestColorPrint) { TOpts opts; const char* prog = "my_program"; diff --git a/library/cpp/on_disk/chunks/reader.cpp b/library/cpp/on_disk/chunks/reader.cpp index 4ae7f843ee..6e28cbf367 100644 --- a/library/cpp/on_disk/chunks/reader.cpp +++ b/library/cpp/on_disk/chunks/reader.cpp @@ -47,6 +47,6 @@ TChunkedDataReader::TChunkedDataReader(const TBlob& blob) { } } -TBlob TChunkedDataReader::GetBlob(size_t index) const { - return TBlob::NoCopy(GetBlock(index), GetBlockLen(index)); -} +TBlob TChunkedDataReader::GetBlob(size_t index) const { + return TBlob::NoCopy(GetBlock(index), GetBlockLen(index)); +} diff --git a/library/cpp/on_disk/chunks/reader.h b/library/cpp/on_disk/chunks/reader.h index 34690a5847..c5fe783319 100644 --- a/library/cpp/on_disk/chunks/reader.h +++ b/library/cpp/on_disk/chunks/reader.h @@ -28,16 +28,16 @@ public: return Lengths[index]; } - + TBlob GetBlob(size_t index) const; - + template <typename T> TArrayRef<const T> GetRegion(size_t index) const { size_t len = GetBlockLen(index); Y_ENSURE(len % sizeof(T) == 0, "wrong data padding"); return TArrayRef<const T>(reinterpret_cast<const T*>(GetBlock(index)), len / sizeof(T)); } - + inline size_t GetBlocksCount() const { return Offsets.size(); } diff --git a/library/cpp/packedtypes/packed.h b/library/cpp/packedtypes/packed.h index 1e1619ce04..88cff26ae2 100644 --- a/library/cpp/packedtypes/packed.h +++ b/library/cpp/packedtypes/packed.h @@ -89,10 +89,10 @@ void Y_FORCE_INLINE UnPackUI32(TStream& in, ui32& v) { UNPACK_28(v, in, TInputStream2Traits<TStream>::TTraits, size); (void)size; } - + template <class TStream> ui32 Y_FORCE_INLINE UnPackUI32(TStream& in) { - ui32 res; - UnPackUI32(in, res); - return res; -} + ui32 res; + UnPackUI32(in, res); + return res; +} diff --git a/library/cpp/protobuf/util/pb_io.cpp b/library/cpp/protobuf/util/pb_io.cpp index 6528db53e0..6270ee0624 100644 --- a/library/cpp/protobuf/util/pb_io.cpp +++ b/library/cpp/protobuf/util/pb_io.cpp @@ -26,7 +26,7 @@ namespace NProtoBuf { ythrow yexception() << "can't parse " << m.GetTypeName() << " from base64-encoded string"; } } - + bool TryParseFromBase64String(const TStringBuf dataBase64, Message& m, bool allowUneven) { try { ParseFromBase64String(dataBase64, m, allowUneven); @@ -35,7 +35,7 @@ namespace NProtoBuf { return false; } } - + void SerializeToBase64String(const Message& m, TString& dataBase64) { TString rawData; if (!m.SerializeToString(&rawData)) { @@ -82,17 +82,17 @@ namespace NProtoBuf { } int operator&(NProtoBuf::Message& m, IBinSaver& f) { - TStringStream ss; - if (f.IsReading()) { - f.Add(0, &ss.Str()); + TStringStream ss; + if (f.IsReading()) { + f.Add(0, &ss.Str()); m.ParseFromArcadiaStream(&ss); - } else { + } else { m.SerializeToArcadiaStream(&ss); - f.Add(0, &ss.Str()); - } - return 0; -} - + f.Add(0, &ss.Str()); + } + return 0; +} + void SerializeToTextFormat(const NProtoBuf::Message& m, IOutputStream& out) { NProtoBuf::io::TCopyingOutputStreamAdaptor adaptor(&out); diff --git a/library/cpp/protobuf/util/pb_io.h b/library/cpp/protobuf/util/pb_io.h index 9c336382c7..493c84cb5f 100644 --- a/library/cpp/protobuf/util/pb_io.h +++ b/library/cpp/protobuf/util/pb_io.h @@ -4,10 +4,10 @@ #include <util/generic/flags.h> struct IBinSaver; - + namespace google { namespace protobuf { - class Message; + class Message; } } @@ -41,9 +41,9 @@ namespace NProtoBuf { bool MergePartialFromString(NProtoBuf::Message& m, const TStringBuf serializedProtoMessage); bool MergeFromString(NProtoBuf::Message& m, const TStringBuf serializedProtoMessage); } - + int operator&(NProtoBuf::Message& m, IBinSaver& f); - + // Write a textual representation of the given message to the given file. void SerializeToTextFormat(const NProtoBuf::Message& m, const TString& fileName); void SerializeToTextFormat(const NProtoBuf::Message& m, IOutputStream& out); diff --git a/library/cpp/regex/pire/ut/regexp_ut.cpp b/library/cpp/regex/pire/ut/regexp_ut.cpp index 651e986cef..e7206de9ad 100644 --- a/library/cpp/regex/pire/ut/regexp_ut.cpp +++ b/library/cpp/regex/pire/ut/regexp_ut.cpp @@ -141,21 +141,21 @@ Y_UNIT_TEST_SUITE(TRegExp) { } Y_UNIT_TEST(Capture6) { - TCapturingFsm fsm("(/to-match-with)"); - TSearcher searcher(fsm); - searcher.Search("/some/table/path/to-match-with"); - UNIT_ASSERT(searcher.Captured()); + TCapturingFsm fsm("(/to-match-with)"); + TSearcher searcher(fsm); + searcher.Search("/some/table/path/to-match-with"); + UNIT_ASSERT(searcher.Captured()); UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("/to-match-with")); - } - + } + Y_UNIT_TEST(Capture7) { - TCapturingFsm fsm("(pref.*suff)"); - TSearcher searcher(fsm); - searcher.Search("ala pref bla suff cla"); - UNIT_ASSERT(searcher.Captured()); + TCapturingFsm fsm("(pref.*suff)"); + TSearcher searcher(fsm); + searcher.Search("ala pref bla suff cla"); + UNIT_ASSERT(searcher.Captured()); //UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("pref bla suff")); - } - + } + Y_UNIT_TEST(CaptureXA) { TCapturingFsm fsm(".*(xa).*"); |