Просмотр исходного кода

Restoring authorship annotation for <diver@yandex-team.ru>. Commit 2 of 2.

diver 3 лет назад
Родитель
Сommit
e20e2b362f

+ 17 - 17
contrib/libs/pire/pire/fsm.cpp

@@ -981,28 +981,28 @@ public:
 		mNewFsm.Connect(from, to, letter);
 	}
 	typedef bool Result;
- 
-	Result Success() { 
-		Fsm::Outputs oldOutputs; 
-		// remove redundant outputs 
-		oldOutputs.swap(mNewFsm.outputs); 
-		for (size_t from = 0; from < mNewFsm.Size(); ++from) { 
+
+	Result Success() {
+		Fsm::Outputs oldOutputs;
+		// remove redundant outputs
+		oldOutputs.swap(mNewFsm.outputs);
+		for (size_t from = 0; from < mNewFsm.Size(); ++from) {
 			auto fromOutput = oldOutputs.find(from);
-			if (fromOutput == oldOutputs.end()) 
-				continue; 
+			if (fromOutput == oldOutputs.end())
+				continue;
 			const auto& newTransitionsRow = mNewFsm.m_transitions[from];
 			for (auto&& row : newTransitionsRow) {
 				for (auto&& stateIt : row.second) {
 					auto toOutput = fromOutput->second.find(stateIt);
-					if (toOutput != fromOutput->second.end()) { 
-						mNewFsm.outputs[from].insert(*toOutput); 
-					} 
-				} 
-			} 
-		} 
-		return true; 
-	} 
- 
+					if (toOutput != fromOutput->second.end()) {
+						mNewFsm.outputs[from].insert(*toOutput);
+					}
+				}
+			}
+		}
+		return true;
+	}
+
 	Result Failure() { return false; }
 
 	Fsm& Output() { return mNewFsm; }

+ 20 - 20
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)

+ 42 - 42
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);
 }
 }

+ 8 - 8
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()

+ 18 - 18
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)

+ 25 - 25
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 {

+ 7 - 7
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", ""};

+ 2 - 2
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;
     }
 

+ 10 - 10
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";

+ 3 - 3
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));
+}

Некоторые файлы не были показаны из-за большого количества измененных файлов