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

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

gulin 3 лет назад
Родитель
Сommit
c807aae441

+ 1 - 1
contrib/libs/crcutil/crc32c_sse4.cc

@@ -313,7 +313,7 @@ bool Crc32cSSE4::IsSSE42Available() {
 #if defined(_MSC_VER)
   int cpu_info[4];
   __cpuid(cpu_info, 1);
-  return ((cpu_info[2] & (1 << 20)) != 0);
+  return ((cpu_info[2] & (1 << 20)) != 0); 
 #elif defined(__GNUC__) && (HAVE_AMD64 || HAVE_I386)
   // Not using "cpuid.h" intentionally: it is missing from
   // too many installations.

+ 1 - 1
contrib/libs/pire/pire/scanners/multi.h

@@ -41,7 +41,7 @@
 #include "common.h"
 
 namespace Pire {
-
+ 
 namespace Impl {
 
 	inline static ssize_t SignExtend(i32 i) { return i; }

+ 13 - 13
library/cpp/binsaver/bin_saver.cpp

@@ -28,16 +28,16 @@ void IBinSaver::StoreObject(IObjectBase* pObject) {
             if (pFound != PtrIds->end())
                 id = pFound->second;
             else {
-                id = PtrIds->ysize() + 1;
+                id = PtrIds->ysize() + 1; 
                 PtrIds->insert(std::make_pair(pObject, id));
             }
         }
-        ptrId = id;
+        ptrId = id; 
     }
 
     DataChunk(&ptrId, sizeof(ptrId));
-    if (!Objects.Get())
-        Objects.Reset(new CObjectsHash);
+    if (!Objects.Get()) 
+        Objects.Reset(new CObjectsHash); 
     if (ptrId != 0 && Objects->find(ptrId) == Objects->end()) {
         ObjectQueue.push_back(pObject);
         (*Objects)[ptrId];
@@ -51,13 +51,13 @@ void IBinSaver::StoreObject(IObjectBase* pObject) {
 }
 
 IObjectBase* IBinSaver::LoadObject() {
-    ui64 ptrId = 0;
-    DataChunk(&ptrId, sizeof(ptrId));
-    if (ptrId != 0) {
-        if (!Objects.Get())
-            Objects.Reset(new CObjectsHash);
-        CObjectsHash::iterator pFound = Objects->find(ptrId);
-        if (pFound != Objects->end())
+    ui64 ptrId = 0; 
+    DataChunk(&ptrId, sizeof(ptrId)); 
+    if (ptrId != 0) { 
+        if (!Objects.Get()) 
+            Objects.Reset(new CObjectsHash); 
+        CObjectsHash::iterator pFound = Objects->find(ptrId); 
+        if (pFound != Objects->end()) 
             return pFound->second;
         int typeId;
         DataChunk(&typeId, sizeof(typeId));
@@ -67,7 +67,7 @@ IObjectBase* IBinSaver::LoadObject() {
             fprintf(stderr, "IBinSaver: trying to load unregistered object\n");
             abort();
         }
-        (*Objects)[ptrId] = pObj;
+        (*Objects)[ptrId] = pObj; 
         ObjectQueue.push_back(pObj);
         return pObj;
     }
@@ -75,7 +75,7 @@ IObjectBase* IBinSaver::LoadObject() {
 }
 
 IBinSaver::~IBinSaver() {
-    for (size_t i = 0; i < ObjectQueue.size(); ++i) {
+    for (size_t i = 0; i < ObjectQueue.size(); ++i) { 
         AddPolymorphicBase(1, ObjectQueue[i]);
     }
 }

+ 32 - 32
library/cpp/binsaver/bin_saver.h

@@ -5,9 +5,9 @@
 
 #include <library/cpp/containers/2d_array/2d_array.h>
 
-#include <util/generic/hash_set.h>
+#include <util/generic/hash_set.h> 
 #include <util/generic/buffer.h>
-#include <util/generic/list.h>
+#include <util/generic/list.h> 
 #include <util/generic/maybe.h>
 #include <util/generic/bitmap.h>
 #include <util/generic/variant.h>
@@ -19,11 +19,11 @@
 #include <bitset>
 #include <list>
 #include <string>
-
-#ifdef _MSC_VER
+ 
+#ifdef _MSC_VER 
 #pragma warning(disable : 4127)
-#endif
-
+#endif 
+ 
 enum ESaverMode {
     SAVER_MODE_READ = 1,
     SAVER_MODE_WRITE = 2,
@@ -47,7 +47,7 @@ struct IBinSaver {
 public:
     typedef unsigned char chunk_id;
     typedef ui32 TStoredSize; // changing this will break compatibility
-
+ 
 private:
     // This overload is required to avoid infinite recursion when overriding serialization in derived classes:
     // struct B {
@@ -206,7 +206,7 @@ private:
         }
     }
 
-    // 2D array
+    // 2D array 
     template <class T>
     void Do2DArray(TArray2D<T>& a) {
         int nXSize = a.GetXSize(), nYSize = a.GetYSize();
@@ -227,7 +227,7 @@ private:
         if (nXSize * nYSize > 0)
             DataChunk(&a[0][0], sizeof(T) * nXSize * nYSize);
     }
-    // strings
+    // strings 
     template <class TStringType>
     void DataChunkStr(TStringType& data, i64 elemSize) {
         if (bRead) {
@@ -263,8 +263,8 @@ private:
             else
                 File.Write(ptr, size);
         }
-    }
-
+    } 
+ 
     // storing/loading pointers to objects
     void StoreObject(IObjectBase* pObject);
     IObjectBase* LoadObject();
@@ -279,7 +279,7 @@ private:
     TAutoPtr<PtrIdHash> PtrIds;
 
     typedef THashMap<ui64, TPtr<IObjectBase>> CObjectsHash;
-    TAutoPtr<CObjectsHash> Objects;
+    TAutoPtr<CObjectsHash> Objects; 
 
     TVector<IObjectBase*> ObjectQueue;
 
@@ -295,19 +295,19 @@ public:
     template <class T>
     char Add(const chunk_id, T* p) {
         CallObjectSerialize(p, NBinSaverInternals::TOverloadPriority<2>());
-        return 0;
+        return 0; 
     }
     int Add(const chunk_id, std::string* pStr) {
         DataChunkString(*pStr);
-        return 0;
+        return 0; 
     }
     int Add(const chunk_id, TString* pStr) {
         DataChunkStroka(*pStr);
-        return 0;
+        return 0; 
     }
     int Add(const chunk_id, TUtf16String* pStr) {
         DataChunkWtroka(*pStr);
-        return 0;
+        return 0; 
     }
     int Add(const chunk_id, TBlob* blob) {
         if (bRead) {
@@ -328,10 +328,10 @@ public:
     template <class T1, class TA>
     int Add(const chunk_id, TVector<T1, TA>* pVec) {
         if (HasNonTrivialSerializer<T1>(0u))
-            DoVector(*pVec);
-        else
+            DoVector(*pVec); 
+        else 
             DoDataVector(*pVec);
-        return 0;
+        return 0; 
     }
 
     template <class T, int N>
@@ -351,12 +351,12 @@ public:
     template <class T1, class T2, class T3, class T4, class T5>
     int Add(const chunk_id, THashMap<T1, T2, T3, T4, T5>* pHash) {
         DoAnyMap(*pHash);
-        return 0;
+        return 0; 
     }
     template <class T1, class T2, class T3, class T4, class T5>
     int Add(const chunk_id, THashMultiMap<T1, T2, T3, T4, T5>* pHash) {
         DoAnyMultiMap(*pHash);
-        return 0;
+        return 0; 
     }
     template <class K, class L, class A>
     int Add(const chunk_id, TSet<K, L, A>* pSet) {
@@ -366,16 +366,16 @@ public:
     template <class T1, class T2, class T3, class T4>
     int Add(const chunk_id, THashSet<T1, T2, T3, T4>* pHash) {
         DoAnySet(*pHash);
-        return 0;
+        return 0; 
     }
 
     template <class T1>
     int Add(const chunk_id, TArray2D<T1>* pArr) {
         if (HasNonTrivialSerializer<T1>(0u))
-            Do2DArray(*pArr);
-        else
+            Do2DArray(*pArr); 
+        else 
             Do2DArrayData(*pArr);
-        return 0;
+        return 0; 
     }
     template <class T1>
     int Add(const chunk_id, TList<T1>* pList) {
@@ -392,13 +392,13 @@ public:
         int i = 1;
         for (typename TList<T1>::iterator k = data.begin(); k != data.end(); ++k, ++i)
             Add(i + 2, &(*k));
-        return 0;
+        return 0; 
     }
     template <class T1, class T2>
     int Add(const chunk_id, std::pair<T1, T2>* pData) {
         Add(1, &(pData->first));
         Add(2, &(pData->second));
-        return 0;
+        return 0; 
     }
 
     template <class T1, size_t N>
@@ -538,8 +538,8 @@ public:
     template <class T, typename = decltype(std::declval<T&>() & std::declval<IBinSaver&>())>
     static bool HasNonTrivialSerializer(ui32) {
         return true;
-    }
-
+    } 
+ 
     template <class T>
     static bool HasNonTrivialSerializer(...) {
         return sizeof(std::declval<IBinSaver*>()->Add(0, std::declval<T*>())) != 1;
@@ -552,7 +552,7 @@ public:
         , StableOutput(stableOutput)
     {
     }
-    virtual ~IBinSaver();
+    virtual ~IBinSaver(); 
     bool IsValid() const {
         return File.IsValid();
     }
@@ -586,8 +586,8 @@ struct TRegisterSaveLoadType {
     BASIC_REGISTER_CLASS(name)           \
     static TRegisterSaveLoadType<name> init##name##N(N);
 
-// using TObj/TRef on forward declared templ class will not work
-// but multiple registration with same id is allowed
+// using TObj/TRef on forward declared templ class will not work 
+// but multiple registration with same id is allowed 
 #define REGISTER_SAVELOAD_TEMPL1_CLASS(N, className, T) \
     static TRegisterSaveLoadType<className<T>> init##className##T##N(N);
 

+ 23 - 23
library/cpp/binsaver/blob_io.h

@@ -1,27 +1,27 @@
-#pragma once
+#pragma once 
 
 #include "bin_saver.h"
 #include "buffered_io.h"
 
-#include <util/memory/blob.h>
-
+#include <util/memory/blob.h> 
+ 
 class TYaBlobStream: public IBinaryStream {
-    TBlob Blob;
+    TBlob Blob; 
     i64 Pos;
-
+ 
     int WriteImpl(const void*, int) override {
         Y_ASSERT(0);
-        return 0;
-    }
+        return 0; 
+    } 
     int ReadImpl(void* userBuffer, int size) override {
-        if (size == 0)
-            return 0;
+        if (size == 0) 
+            return 0; 
         i64 res = Min<i64>(Blob.Length() - Pos, size);
-        if (res)
-            memcpy(userBuffer, ((const char*)Blob.Data()) + Pos, res);
-        Pos += res;
-        return res;
-    }
+        if (res) 
+            memcpy(userBuffer, ((const char*)Blob.Data()) + Pos, res); 
+        Pos += res; 
+        return res; 
+    } 
     bool IsValid() const override {
         return true;
     }
@@ -29,19 +29,19 @@ class TYaBlobStream: public IBinaryStream {
         return false;
     }
 
-public:
+public: 
     TYaBlobStream(const TBlob& blob)
         : Blob(blob)
         , Pos(0)
     {
     }
-};
-
+}; 
+ 
 template <class T>
 inline void SerializeBlob(const TBlob& data, T& c) {
-    TYaBlobStream f(data);
-    {
-        IBinSaver bs(f, true);
-        bs.Add(1, &c);
-    }
-}
+    TYaBlobStream f(data); 
+    { 
+        IBinSaver bs(f, true); 
+        bs.Add(1, &c); 
+    } 
+} 

+ 2 - 2
library/cpp/binsaver/buffered_io.h

@@ -1,9 +1,9 @@
 #pragma once
 
-#include <util/system/yassert.h>
+#include <util/system/yassert.h> 
 #include <util/generic/utility.h>
 #include <util/generic/ylimits.h>
-#include <string.h>
+#include <string.h> 
 
 struct IBinaryStream {
     virtual ~IBinaryStream() = default;

+ 4 - 4
library/cpp/binsaver/class_factory.h

@@ -1,9 +1,9 @@
 #pragma once
 
 #include <typeinfo>
-#include <util/generic/hash.h>
+#include <util/generic/hash.h> 
 #include <util/generic/vector.h>
-#include <util/ysafeptr.h>
+#include <util/ysafeptr.h> 
 
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -86,8 +86,8 @@ void TClassFactory<T>::RegisterTypeBase(int nTypeID, newFunc func, VFT vft) {
 
         if (typeid(o1v) != typeid(o2v)) {
             fprintf(stderr, "IBinSaver: Type ID 0x%08X has been already used\n", nTypeID);
-            abort();
-        }
+            abort(); 
+        } 
     }
 
     CTypeIndexHash::iterator typeIndexIt = typeIndex.find(vft);

+ 15 - 15
library/cpp/binsaver/mem_io.h

@@ -54,7 +54,7 @@ namespace NMemIoInternals {
                 IBinSaver bs(f, bRead, stableOutput);
                 bs.Add(1, &c);
             }
-        } else {
+        } else { 
             if (bRead) {
                 Y_ASSERT(data->size() == sizeof(T));
                 c = *reinterpret_cast<T*>(&(*data)[0]);
@@ -62,7 +62,7 @@ namespace NMemIoInternals {
                 data->yresize(sizeof(T));
                 *reinterpret_cast<T*>(&(*data)[0]) = c;
             }
-        }
+        } 
     }
 
     ////////////////////////////////////////////////////////////////////////////
@@ -70,11 +70,11 @@ namespace NMemIoInternals {
         TVector<TVector<char>>& Data;
         i64 Block, Pos;
         bool ShrinkOnRead;
-
+ 
         enum {
             MAX_BLOCK_SIZE = 1024 * 1024 // Aligned with cache size
         };
-
+ 
     public:
         THugeMemoryStream(TVector<TVector<char>>* data, bool shrinkOnRead = false)
             : Data(*data)
@@ -115,19 +115,19 @@ namespace NMemIoInternals {
                     Pos = 0;
                     Data.resize(Block + 1);
                     newSize = Pos + size;
-                }
+                } 
                 Data[Block].yresize(newSize);
-            }
+            } 
             if (size) {
                 memcpy(&Data[Block][Pos], userData, size);
             }
             Pos += size;
             return sizeArg;
-        }
+        } 
         int ReadImpl(void* userDataArg, int sizeArg) override {
             if (sizeArg == 0)
                 return 0;
-
+ 
             char* userData = (char*)userDataArg;
             i64 size = sizeArg;
             i64 rv = 0;
@@ -155,11 +155,11 @@ namespace NMemIoInternals {
                     memcpy(userData, &Data[Block][Pos], size);
                     Pos += size;
                     rv += size;
-                    return rv;
-                }
-            }
+                    return rv; 
+                } 
+            } 
             return rv;
-        }
+        } 
     };
 
     template <class T>
@@ -174,7 +174,7 @@ namespace NMemIoInternals {
         }
     }
 }
-
+ 
 template <class T>
 inline void SerializeMem(const TVector<char>& data, T& c) {
     if (IBinSaver::HasNonTrivialSerializer<T>(0u)) {
@@ -183,8 +183,8 @@ inline void SerializeMem(const TVector<char>& data, T& c) {
     } else {
         Y_ASSERT(data.size() == sizeof(T));
         c = *reinterpret_cast<const T*>(&data[0]);
-    }
-}
+    } 
+} 
 
 template <class T, class D>
 inline void SerializeToMem(D* data, T& c, bool stableOutput = false) {

+ 9 - 9
library/cpp/binsaver/ya.make

@@ -1,18 +1,18 @@
-LIBRARY()
-
+LIBRARY() 
+ 
 OWNER(gulin)
 
-SRCS(
+SRCS( 
     class_factory.h
     bin_saver.cpp
     blob_io.cpp
     buffered_io.cpp
     mem_io.cpp
     util_stream_io.cpp
-)
-
-PEERDIR(
+) 
+ 
+PEERDIR( 
     library/cpp/containers/2d_array
-)
-
-END()
+) 
+ 
+END() 

+ 1 - 1
library/cpp/containers/2d_array/2d_array.cpp

@@ -1 +1 @@
-#include "2d_array.h"
+#include "2d_array.h" 

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