Browse Source

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

yoda 3 years ago
parent
commit
86ac2045bf

+ 2 - 2
library/cpp/getopt/small/last_getopt_support.h

@@ -111,7 +111,7 @@ namespace NLastGetopt {
         private:
             TpTarget* Target_;
             const TpFunc Func_;
- 
+
         public:
             TStoreMappedResultFunctor(TpTarget* target, const TpFunc& func)
                 : Target_(target)
@@ -123,7 +123,7 @@ namespace NLastGetopt {
                 *Target_ = Func_(val);
             }
         };
- 
+
         template <typename T, typename TpVal = T>
         class TStoreValueFunctor {
             T* Target;

+ 14 - 14
library/cpp/getopt/ut/last_getopt_ut.cpp

@@ -437,23 +437,23 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
     }
 
     Y_UNIT_TEST(TestStoreValue) {
-        int a = 0, b = 0; 
-        size_t c = 0; 
-        EHasArg e = NO_ARGUMENT; 
- 
+        int a = 0, b = 0;
+        size_t c = 0;
+        EHasArg e = NO_ARGUMENT;
+
         TOptsNoDefault opts;
-        opts.AddLongOption('a', "alpha").NoArgument().StoreValue(&a, 42); 
-        opts.AddLongOption('b', "beta").NoArgument().StoreValue(&b, 24); 
-        opts.AddLongOption('e', "enum").NoArgument().StoreValue(&e, REQUIRED_ARGUMENT).StoreValue(&c, 12345); 
- 
+        opts.AddLongOption('a', "alpha").NoArgument().StoreValue(&a, 42);
+        opts.AddLongOption('b', "beta").NoArgument().StoreValue(&b, 24);
+        opts.AddLongOption('e', "enum").NoArgument().StoreValue(&e, REQUIRED_ARGUMENT).StoreValue(&c, 12345);
+
         TOptsParseResultTestWrapper r(&opts, V({"cmd", "-a", "-e"}));
- 
-        UNIT_ASSERT_VALUES_EQUAL(42, a); 
-        UNIT_ASSERT_VALUES_EQUAL(0, b); 
-        UNIT_ASSERT(e == REQUIRED_ARGUMENT); 
+
+        UNIT_ASSERT_VALUES_EQUAL(42, a);
+        UNIT_ASSERT_VALUES_EQUAL(0, b);
+        UNIT_ASSERT(e == REQUIRED_ARGUMENT);
         UNIT_ASSERT_VALUES_EQUAL(12345u, c);
-    } 
- 
+    }
+
     Y_UNIT_TEST(TestSetFlag) {
         bool a = false, b = true, c = false, d = true;
 

+ 48 - 48
library/cpp/on_disk/chunks/chunked_helpers.cpp

@@ -9,59 +9,59 @@ TBlob GetBlock(const TBlob& blob, size_t index) {
     size_t begin = (const char*)reader.GetBlock(index) - (const char*)blob.Data();
     return blob.SubBlob(begin, begin + reader.GetBlockLen(index));
 }
- 
-/*************************** TNamedChunkedDataReader ***************************/ 
- 
+
+/*************************** TNamedChunkedDataReader ***************************/
+
 static const char* NamedChunkedDataMagic = "NamedChunkedData";
- 
+
 TNamedChunkedDataReader::TNamedChunkedDataReader(const TBlob& blob)
     : TChunkedDataReader(blob)
-{ 
-    if (TChunkedDataReader::GetBlocksCount() < 1) 
-        throw yexception() << "Too few blocks"; 
- 
-    size_t block = TChunkedDataReader::GetBlocksCount() - 1; 
-    size_t magicLen = strlen(NamedChunkedDataMagic); 
-    if (GetBlockLen(block) < magicLen || memcmp(GetBlock(block), NamedChunkedDataMagic, magicLen) != 0) 
-        throw yexception() << "Not a valid named chunked data file"; 
- 
+{
+    if (TChunkedDataReader::GetBlocksCount() < 1)
+        throw yexception() << "Too few blocks";
+
+    size_t block = TChunkedDataReader::GetBlocksCount() - 1;
+    size_t magicLen = strlen(NamedChunkedDataMagic);
+    if (GetBlockLen(block) < magicLen || memcmp(GetBlock(block), NamedChunkedDataMagic, magicLen) != 0)
+        throw yexception() << "Not a valid named chunked data file";
+
     TMemoryInput input(static_cast<const char*>(GetBlock(block)) + magicLen, GetBlockLen(block) - magicLen);
-    Load(&input, Names); 
- 
-    size_t index = 0; 
+    Load(&input, Names);
+
+    size_t index = 0;
     for (TVector<TString>::const_iterator it = Names.begin(); it != Names.end(); ++it, ++index) {
-        if (!it->empty()) 
-            NameToIndex[*it] = index; 
-    } 
-} 
- 
-/*************************** TNamedChunkedDataWriter ***************************/ 
- 
+        if (!it->empty())
+            NameToIndex[*it] = index;
+    }
+}
+
+/*************************** TNamedChunkedDataWriter ***************************/
+
 TNamedChunkedDataWriter::TNamedChunkedDataWriter(IOutputStream& slave)
-    : TChunkedDataWriter(slave) 
-{ 
-} 
- 
+    : TChunkedDataWriter(slave)
+{
+}
+
 TNamedChunkedDataWriter::~TNamedChunkedDataWriter() {
-} 
- 
-void TNamedChunkedDataWriter::NewBlock() { 
-    NewBlock(""); 
-} 
- 
+}
+
+void TNamedChunkedDataWriter::NewBlock() {
+    NewBlock("");
+}
+
 void TNamedChunkedDataWriter::NewBlock(const TString& name) {
-    if (!name.empty()) { 
-        if (NameToIndex.count(name) != 0) 
-            throw yexception() << "Block name is not unique"; 
-        NameToIndex[name] = Names.size(); 
-    } 
-    Names.push_back(name); 
-    TChunkedDataWriter::NewBlock(); 
-} 
- 
-void TNamedChunkedDataWriter::WriteFooter() { 
-    NewBlock(""); 
-    Write(NamedChunkedDataMagic); 
-    Save(this, Names); 
-    TChunkedDataWriter::WriteFooter(); 
-} 
+    if (!name.empty()) {
+        if (NameToIndex.count(name) != 0)
+            throw yexception() << "Block name is not unique";
+        NameToIndex[name] = Names.size();
+    }
+    Names.push_back(name);
+    TChunkedDataWriter::NewBlock();
+}
+
+void TNamedChunkedDataWriter::WriteFooter() {
+    NewBlock("");
+    Write(NamedChunkedDataMagic);
+    Save(this, Names);
+    TChunkedDataWriter::WriteFooter();
+}

+ 17 - 17
library/cpp/on_disk/chunks/chunked_helpers.h

@@ -453,34 +453,34 @@ void WriteBlock(TChunkedDataWriter& writer, T& t) {
     t.Save(writer);
 }
 
-// Extends TChunkedDataWriter, allowing user to name blocks with arbitrary strings. 
-class TNamedChunkedDataWriter: public TChunkedDataWriter { 
+// Extends TChunkedDataWriter, allowing user to name blocks with arbitrary strings.
+class TNamedChunkedDataWriter: public TChunkedDataWriter {
 public:
     TNamedChunkedDataWriter(IOutputStream& slave);
     ~TNamedChunkedDataWriter() override;
- 
+
     // Start a new unnamed block, overrides TChunkedDataReader::NewBlock().
     void NewBlock();
- 
+
     // Start a new block with given name (possibly empty, in which case block is unnamed).
     // Throws an exception if name is a duplicate.
     void NewBlock(const TString& name);
- 
+
     void WriteFooter();
- 
+
 private:
     TVector<TString> Names;
     THashMap<TString, size_t> NameToIndex;
-}; 
- 
+};
+
 class TNamedChunkedDataReader: public TChunkedDataReader {
 public:
     TNamedChunkedDataReader(const TBlob& blob);
- 
+
     inline bool HasBlock(const char* name) const {
         return NameToIndex.find(name) != NameToIndex.end();
     }
- 
+
     inline size_t GetIndexByName(const char* name) const {
         THashMap<TString, size_t>::const_iterator it = NameToIndex.find(name);
         if (it == NameToIndex.end())
@@ -488,31 +488,31 @@ public:
         else
             return it->second;
     }
- 
+
     // Returns number of blocks written to the file by user of TNamedChunkedDataReader.
     inline size_t GetBlocksCount() const {
         // Last block is for internal usage
         return TChunkedDataReader::GetBlocksCount() - 1;
     }
- 
+
     inline const char* GetBlockName(size_t index) const {
         Y_ASSERT(index < GetBlocksCount());
         return Names[index].data();
     }
- 
+
     inline const void* GetBlockByName(const char* name) const {
         return GetBlock(GetIndexByName(name));
     }
- 
+
     inline size_t GetBlockLenByName(const char* name) const {
         return GetBlockLen(GetIndexByName(name));
     }
- 
+
     inline TBlob GetBlobByName(const char* name) const {
         size_t id = GetIndexByName(name);
         return TBlob::NoCopy(GetBlock(id), GetBlockLen(id));
     }
- 
+
     inline bool GetBlobByName(const char* name, TBlob& blob) const {
         THashMap<TString, size_t>::const_iterator it = NameToIndex.find(name);
         if (it == NameToIndex.end())
@@ -524,7 +524,7 @@ public:
 private:
     TVector<TString> Names;
     THashMap<TString, size_t> NameToIndex;
-}; 
+};
 
 template <class T>
 struct TSaveLoadVectorNonPodElement {

+ 25 - 25
library/cpp/testing/unittest/utmain.cpp

@@ -537,8 +537,8 @@ private:
 
 const char* const TColoredProcessor::ForkCorrectExitMsg = "--END--";
 
-class TEnumeratingProcessor: public ITestSuiteProcessor { 
-public: 
+class TEnumeratingProcessor: public ITestSuiteProcessor {
+public:
     TEnumeratingProcessor(bool verbose, IOutputStream& stream) noexcept
         : Verbose_(verbose)
         , Stream_(stream)
@@ -546,8 +546,8 @@ public:
     }
 
     ~TEnumeratingProcessor() override {
-    } 
- 
+    }
+
     bool CheckAccess(TString name, size_t /*num*/) override {
         if (Verbose_) {
             return true;
@@ -559,14 +559,14 @@ public:
 
     bool CheckAccessTest(TString suite, const char* name) override {
         Stream_ << suite << "::" << name << "\n";
-        return false; 
-    } 
+        return false;
+    }
 
 private:
     bool Verbose_;
     IOutputStream& Stream_;
-}; 
- 
+};
+
 #ifdef _win_
 class TWinEnvironment {
 public:
@@ -602,29 +602,29 @@ static const TWinEnvironment Instance;
 
 static int DoList(bool verbose, IOutputStream& stream) {
     TEnumeratingProcessor eproc(verbose, stream);
-    TTestFactory::Instance().SetProcessor(&eproc); 
-    TTestFactory::Instance().Execute(); 
-    return 0; 
-} 
- 
-static int DoUsage(const char* progname) { 
-    Cout << "Usage: " << progname << " [options] [[+|-]test]...\n\n" 
-         << "Options:\n" 
-         << "  -h, --help            print this help message\n" 
-         << "  -l, --list            print a list of available tests\n" 
+    TTestFactory::Instance().SetProcessor(&eproc);
+    TTestFactory::Instance().Execute();
+    return 0;
+}
+
+static int DoUsage(const char* progname) {
+    Cout << "Usage: " << progname << " [options] [[+|-]test]...\n\n"
+         << "Options:\n"
+         << "  -h, --help            print this help message\n"
+         << "  -l, --list            print a list of available tests\n"
          << "  -A --list-verbose        print a list of available subtests\n"
          << "  --print-before-test   print each test name before running it\n"
          << "  --print-before-suite  print each test suite name before running it\n"
-         << "  --show-fails          print a list of all failed tests at the end\n" 
+         << "  --show-fails          print a list of all failed tests at the end\n"
          << "  --dont-show-fails     do not print a list of all failed tests at the end\n"
          << "  --continue-on-fail    print a message and continue running test suite instead of break\n"
          << "  --print-times         print wall clock duration of each test\n"
          << "  --fork-tests          run each test in a separate process\n"
          << "  --trace-path          path to the trace file to be generated\n"
          << "  --trace-path-append   path to the trace file to be appended\n";
-    return 0; 
-} 
- 
+    return 0;
+}
+
 #if defined(_linux_) && defined(CLANG_COVERAGE)
 extern "C" int __llvm_profile_write_file(void);
 
@@ -679,9 +679,9 @@ int NUnitTest::RunMain(int argc, char** argv) {
             const char* name = argv[i];
 
             if (name && *name) {
-                if (strcmp(name, "--help") == 0 || strcmp(name, "-h") == 0) { 
-                    return DoUsage(argv[0]); 
-                } else if (strcmp(name, "--list") == 0 || strcmp(name, "-l") == 0) { 
+                if (strcmp(name, "--help") == 0 || strcmp(name, "-h") == 0) {
+                    return DoUsage(argv[0]);
+                } else if (strcmp(name, "--list") == 0 || strcmp(name, "-l") == 0) {
                     listTests = LIST;
                 } else if (strcmp(name, "--list-verbose") == 0 || strcmp(name, "-A") == 0) {
                     listTests = LIST_VERBOSE;

+ 2 - 2
tools/archiver/main.cpp

@@ -326,8 +326,8 @@ static inline TString Fix(TString f) {
     return f;
 }
 
-static bool Quiet = false; 
- 
+static bool Quiet = false;
+
 static inline void Append(IOutputStream& w, const TString& fname, const TString& rname) {
     TMappedFileInput in(fname);
 

+ 4 - 4
util/digest/city.cpp

@@ -1,5 +1,5 @@
-#ifndef NO_CITYHASH 
- 
+#ifndef NO_CITYHASH
+
 // Copyright (c) 2011 Google, Inc.
 
 // Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -309,7 +309,7 @@ uint128 CityHash128(const char* s, size_t len) noexcept {
         return CityHash128WithSeed(s, len, uint128(k0, k1));
     }
 }
- 
+
 // TODO(yazevnul): move this function to unittests
 void TestCompilationOfCityHashTemplates() {
     TStringBuf s;
@@ -320,4 +320,4 @@ void TestCompilationOfCityHashTemplates() {
     CityHash128WithSeed(s, uint128(1, 2));
 }
 
-#endif 
+#endif

+ 16 - 16
util/generic/ptr.h

@@ -610,7 +610,7 @@ struct THash<TIntrusivePtr<T, Ops>>: THash<const T*> {
     }
 };
 
-// Behaves like TIntrusivePtr but returns const T* to prevent user from accidentally modifying the referenced object. 
+// Behaves like TIntrusivePtr but returns const T* to prevent user from accidentally modifying the referenced object.
 template <class T, class Ops>
 class TIntrusiveConstPtr: public TPointerBase<TIntrusiveConstPtr<T, Ops>, const T> {
 public:
@@ -620,17 +620,17 @@ public:
         Ops();
         Ref();
     }
- 
+
     inline ~TIntrusiveConstPtr() {
         UnRef();
     }
- 
+
     inline TIntrusiveConstPtr(const TIntrusiveConstPtr& p) noexcept
         : T_(p.T_)
     {
         Ref();
     }
- 
+
     inline TIntrusiveConstPtr(TIntrusiveConstPtr&& p) noexcept
         : T_(nullptr)
     {
@@ -642,7 +642,7 @@ public:
     {
         p.T_ = nullptr;
     }
- 
+
     template <class U, class = TGuardConversion<T, U>>
     inline TIntrusiveConstPtr(const TIntrusiveConstPtr<U>& p) noexcept
         : T_(p.T_)
@@ -659,10 +659,10 @@ public:
 
     inline TIntrusiveConstPtr& operator=(TIntrusiveConstPtr p) noexcept {
         p.Swap(*this);
- 
+
         return *this;
     }
- 
+
     // Effectively replace both:
     // Reset(const TIntrusiveConstPtr&)
     // Reset(TIntrusiveConstPtr&&)
@@ -677,15 +677,15 @@ public:
     inline const T* Get() const noexcept {
         return T_;
     }
- 
+
     inline void Swap(TIntrusiveConstPtr& r) noexcept {
         DoSwap(T_, r.T_);
     }
- 
+
     inline void Drop() noexcept {
         TIntrusiveConstPtr(nullptr).Swap(*this);
     }
- 
+
     inline long RefCount() const noexcept {
         return T_ ? Ops::RefCount(T_) : 0;
     }
@@ -700,22 +700,22 @@ private:
     inline void Ref() noexcept {
         if (T_ != nullptr) {
             Ops::Ref(T_);
-        } 
+        }
     }
- 
+
     inline void UnRef() noexcept {
         if (T_ != nullptr) {
             Ops::UnRef(T_);
-        } 
+        }
     }
- 
+
 private:
     T* T_;
 
     template <class U, class O>
     friend class TIntrusiveConstPtr;
-}; 
- 
+};
+
 template <class T, class Ops>
 struct THash<TIntrusiveConstPtr<T, Ops>>: THash<const T*> {
     using THash<const T*>::operator();

+ 1 - 1
util/generic/string_ut.h

@@ -901,7 +901,7 @@ public:
         } catch (...) {
             Cerr << hash_val << Endl;
             throw;
-        }*/ 
+        }*/
 
         s2.assign(Data._0123456(), 2, 2);
         UNIT_ASSERT(s2 == Data._23());

+ 17 - 17
util/system/execpath.cpp

@@ -18,10 +18,10 @@
     #include <unistd.h>
 #endif
 
-#include <util/folder/dirut.h> 
-#include <util/generic/singleton.h> 
+#include <util/folder/dirut.h>
+#include <util/generic/singleton.h>
 #include <util/generic/function.h>
-#include <util/generic/yexception.h> 
+#include <util/generic/yexception.h>
 #include <util/memory/tempbuf.h>
 #include <util/stream/file.h>
 #include <util/stream/pipe.h>
@@ -102,31 +102,31 @@ static inline bool FreeBSDGuessExecBasePath(const TString& guessBasePath, TStrin
 
 static TString GetExecPathImpl() {
 #if defined(_solaris_)
-    return execname(); 
+    return execname();
 #elif defined(_darwin_)
     TTempBuf execNameBuf;
     for (size_t i = 0; i < 2; ++i) {
         std::remove_pointer_t<TFunctionArg<decltype(_NSGetExecutablePath), 1>> bufsize = execNameBuf.Size();
-        int r = _NSGetExecutablePath(execNameBuf.Data(), &bufsize); 
-        if (r == 0) { 
-            return execNameBuf.Data(); 
+        int r = _NSGetExecutablePath(execNameBuf.Data(), &bufsize);
+        if (r == 0) {
+            return execNameBuf.Data();
         } else if (r == -1) {
             execNameBuf = TTempBuf(bufsize);
         }
-    } 
+    }
     ythrow yexception() << "GetExecPathImpl() failed";
 #elif defined(_win_)
     TTempBuf execNameBuf;
-    for (;;) { 
+    for (;;) {
         DWORD r = GetModuleFileName(nullptr, execNameBuf.Data(), execNameBuf.Size());
         if (r == execNameBuf.Size()) {
             execNameBuf = TTempBuf(execNameBuf.Size() * 2);
         } else if (r == 0) {
             ythrow yexception() << "GetExecPathImpl() failed: " << LastSystemErrorText();
         } else {
-            return execNameBuf.Data(); 
+            return execNameBuf.Data();
         }
-    } 
+    }
 #elif defined(_linux_) || defined(_cygwin_)
     TString path("/proc/self/exe");
     return NFs::ReadLink(path);
@@ -135,26 +135,26 @@ static TString GetExecPathImpl() {
     TString execPath = FreeBSDGetExecPath();
     if (GoodPath(execPath)) {
         return execPath;
-    } 
+    }
     if (FreeBSDGuessExecPath(FreeBSDGetArgv0(), execPath)) {
         return execPath;
-    } 
+    }
     if (FreeBSDGuessExecPath(getenv("_"), execPath)) {
         return execPath;
-    } 
+    }
     if (FreeBSDGuessExecBasePath(getenv("PWD"), execPath)) {
         return execPath;
     }
     if (FreeBSDGuessExecBasePath(NFs::CurrentWorkingDirectory(), execPath)) {
         return execPath;
     }
- 
+
     ythrow yexception() << "can not resolve exec path";
 #else
     #error dont know how to implement GetExecPath on this platform
 #endif
-} 
- 
+}
+
 static bool GetPersistentExecPathImpl(TString& to) {
 #if defined(_solaris_)
     to = TString("/proc/self/object/a.out");