aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriseg <iseg@yandex-team.ru>2022-02-10 16:49:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:39 +0300
commitf828a15ab90e9ca8e848f83caf95c95f06be46e7 (patch)
treede25241f7ec727b05ff1e5b9e1336f567f788a44
parent8124e2bb214b063687e0d77c900150c727e16782 (diff)
downloadydb-f828a15ab90e9ca8e848f83caf95c95f06be46e7.tar.gz
Restoring authorship annotation for <iseg@yandex-team.ru>. Commit 1 of 2.
-rw-r--r--library/cpp/charset/codepage.cpp38
-rw-r--r--library/cpp/charset/codepage.h58
-rw-r--r--library/cpp/charset/recyr.hh2
-rw-r--r--library/cpp/containers/atomizer/atomizer.h52
-rw-r--r--library/cpp/containers/str_map/str_map.h58
-rw-r--r--library/cpp/deprecated/mapped_file/mapped_file.cpp2
-rw-r--r--library/cpp/deprecated/mapped_file/mapped_file.h2
-rw-r--r--library/cpp/getopt/small/opt.cpp24
-rw-r--r--library/cpp/http/misc/httpdate.cpp10
-rw-r--r--library/cpp/http/misc/httpdate.h4
-rw-r--r--library/cpp/packedtypes/longs.h104
-rw-r--r--util/charset/unidata.h130
-rw-r--r--util/datetime/base.h10
-rw-r--r--util/generic/strbase.h2
-rw-r--r--util/generic/string.cpp12
-rw-r--r--util/generic/string.h10
-rw-r--r--util/memory/alloc.h2
-rw-r--r--util/str_stl.h6
-rw-r--r--util/stream/file.h2
-rw-r--r--util/string/util.h2
-rw-r--r--util/system/compat.cpp2
-rw-r--r--util/system/compat.h8
-rw-r--r--util/system/defaults.h28
-rw-r--r--util/system/filemap.cpp12
-rw-r--r--util/system/filemap.h12
-rw-r--r--util/system/maxlen.h2
-rw-r--r--util/system/mutex.cpp30
-rw-r--r--util/system/mutex.h8
-rw-r--r--util/system/sys_alloc.h2
-rw-r--r--util/system/tls.h14
-rw-r--r--util/system/yassert.h4
-rw-r--r--util/thread/pool.h6
32 files changed, 329 insertions, 329 deletions
diff --git a/library/cpp/charset/codepage.cpp b/library/cpp/charset/codepage.cpp
index 0431bef31b..8e2df10531 100644
--- a/library/cpp/charset/codepage.cpp
+++ b/library/cpp/charset/codepage.cpp
@@ -64,26 +64,26 @@ char* CodePage::ToUpper(const char* b, char* to) const {
}
int CodePage::stricmp(const char* dst, const char* src) const {
- unsigned char f, l;
- do {
+ unsigned char f, l;
+ do {
f = ToLower(*dst++);
l = ToLower(*src++);
- } while (f && (f == l));
- return f - l;
-}
-
+ } while (f && (f == l));
+ return f - l;
+}
+
int CodePage::strnicmp(const char* dst, const char* src, size_t len) const {
- unsigned char f, l;
- if (len) {
- do {
+ unsigned char f, l;
+ if (len) {
+ do {
f = ToLower(*dst++);
l = ToLower(*src++);
- } while (--len && f && (f == l));
- return f - l;
- }
- return 0;
-}
-
+ } while (--len && f && (f == l));
+ return f - l;
+ }
+ return 0;
+}
+
static const CodePage UNSUPPORTED_CODEPAGE = {
CODES_UNSUPPORTED,
{
@@ -179,7 +179,7 @@ public:
}
}
}
-
+
inline ECharset CharsetByName(TStringBuf name) {
if (!name)
return CODES_UNKNOWN;
@@ -187,15 +187,15 @@ public:
TData::const_iterator it = Data.find(name);
if (it == Data.end())
return CODES_UNKNOWN;
-
+
return it->second;
}
};
ECharset CharsetByName(TStringBuf name) {
return Singleton<TCodePageHash>()->CharsetByName(name);
-}
-
+}
+
ECharset CharsetByNameOrDie(TStringBuf name) {
ECharset result = CharsetByName(name);
if (result == CODES_UNKNOWN)
diff --git a/library/cpp/charset/codepage.h b/library/cpp/charset/codepage.h
index 30a02a4610..22d555b158 100644
--- a/library/cpp/charset/codepage.h
+++ b/library/cpp/charset/codepage.h
@@ -13,19 +13,19 @@
#include <cctype>
-struct CodePage;
-struct Recoder;
-struct Encoder;
-
+struct CodePage;
+struct Recoder;
+struct Encoder;
+
/*****************************************************************\
* struct CodePage *
\*****************************************************************/
-struct CodePage {
+struct CodePage {
ECharset CPEnum; // int MIBEnum;
const char* Names[30]; // name[0] -- preferred mime-name
wchar32 unicode[256];
const char* DefaultChar; //[CCL_NUM]
-
+
bool IsLower(unsigned char ch) const {
return ::IsLower(unicode[ch]);
}
@@ -77,12 +77,12 @@ struct CodePage {
inline unsigned char ToUpper(unsigned char ch) const;
inline unsigned char ToLower(unsigned char ch) const;
inline unsigned char ToTitle(unsigned char ch) const;
-
+
inline int ToDigit(unsigned char ch) const {
return ::ToDigit(unicode[ch]);
}
- static void Initialize();
+ static void Initialize();
inline bool SingleByteCodepage() const {
return DefaultChar != nullptr;
@@ -90,7 +90,7 @@ struct CodePage {
inline bool NativeCodepage() const {
return SingleByteCodepage() || CPEnum == CODES_UTF8;
}
-};
+};
class TCodePageHash;
@@ -151,7 +151,7 @@ inline bool ValidCodepage(ECharset e) {
inline const CodePage* CodePageByCharset(ECharset e) {
return ::NCodepagePrivate::TCodepagesMap::Instance().Get(e);
-}
+}
ECharset CharsetByName(TStringBuf name);
@@ -176,7 +176,7 @@ inline const char* NameByCharsetSafe(ECharset e) {
inline const char* NameByCodePage(const CodePage* CP) {
return CP->Names[0];
}
-
+
inline const CodePage* CodePageByName(const char* name) {
ECharset code = CharsetByName(name);
if (code == CODES_UNKNOWN)
@@ -190,7 +190,7 @@ ECharset EncodingHintByName(const char* name);
/*****************************************************************\
* struct Encoder *
\*****************************************************************/
-struct Encoder {
+struct Encoder {
char* Table[256];
const char* DefaultChar;
@@ -198,7 +198,7 @@ struct Encoder {
if (ch > 0xFFFF)
return 0;
return (unsigned char)Table[(ch >> 8) & 255][ch & 255];
- }
+ }
inline char Tr(wchar32 ch) const {
char code = Code(ch);
@@ -206,11 +206,11 @@ struct Encoder {
code = DefaultChar[NUnicode::CharType(ch)];
Y_ASSERT(code != 0 || ch == 0);
return code;
- }
+ }
inline unsigned char operator[](wchar32 ch) const {
- return Tr(ch);
- }
+ return Tr(ch);
+ }
void Tr(const wchar32* in, char* out, size_t len) const;
void Tr(const wchar32* in, char* out) const;
@@ -220,27 +220,27 @@ struct Encoder {
/*****************************************************************\
* struct Recoder *
\*****************************************************************/
-struct Recoder {
+struct Recoder {
unsigned char Table[257];
void Create(const CodePage& source, const CodePage& target);
void Create(const CodePage& source, const Encoder* wideTarget);
-
+
void Create(const CodePage& page, wchar32 (*mapper)(wchar32));
void Create(const CodePage& page, const Encoder* widePage, wchar32 (*mapper)(wchar32));
inline unsigned char Tr(unsigned char c) const {
- return Table[c];
- }
+ return Table[c];
+ }
inline unsigned char operator[](unsigned char c) const {
- return Table[c];
- }
+ return Table[c];
+ }
void Tr(const char* in, char* out, size_t len) const;
void Tr(const char* in, char* out) const;
void Tr(char* in_out, size_t len) const;
void Tr(char* in_out) const;
-};
-
+};
+
extern const struct Encoder& WideCharToYandex;
const Encoder& EncoderByCharset(ECharset enc);
@@ -276,16 +276,16 @@ inline const Encoder& EncoderByCharset(ECharset enc) {
inline unsigned char CodePage::ToUpper(unsigned char ch) const {
return NCodepagePrivate::TCodePageData::rcdr_to_upper[CPEnum].Table[ch];
-}
+}
inline unsigned char CodePage::ToLower(unsigned char ch) const {
return NCodepagePrivate::TCodePageData::rcdr_to_lower[CPEnum].Table[ch];
-}
+}
inline unsigned char CodePage::ToTitle(unsigned char ch) const {
return NCodepagePrivate::TCodePageData::rcdr_to_title[CPEnum].Table[ch];
-}
-
+}
+
extern const CodePage& csYandex;
-
+
/// these functions change (lowers) [end] position in case of utf-8
/// null character is NOT assumed or written at [*end]
void DecodeUnknownPlane(wchar16* start, wchar16*& end, const ECharset enc4unk);
diff --git a/library/cpp/charset/recyr.hh b/library/cpp/charset/recyr.hh
index 5ec8734bcf..e22ec3b9bc 100644
--- a/library/cpp/charset/recyr.hh
+++ b/library/cpp/charset/recyr.hh
@@ -10,7 +10,7 @@
#include "doccodes.h"
#include "iconv.h"
#include "recyr_int.hh"
-
+
///////////////////////////////////////////////////////////////////////////////////////
// input buf -> output buf //
///////////////////////////////////////////////////////////////////////////////////////
diff --git a/library/cpp/containers/atomizer/atomizer.h b/library/cpp/containers/atomizer/atomizer.h
index 5e40f47ab9..dd8a3d0a5b 100644
--- a/library/cpp/containers/atomizer/atomizer.h
+++ b/library/cpp/containers/atomizer/atomizer.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include <library/cpp/containers/str_map/str_map.h>
#include <util/generic/vector.h>
@@ -14,12 +14,12 @@ class atomizer;
template <class T, class HashFcn = THash<const char*>, class EqualTo = TEqualTo<const char*>>
class super_atomizer;
-template <class HashFcn, class EqualTo>
+template <class HashFcn, class EqualTo>
class atomizer: public string_hash<ui32, HashFcn, EqualTo> {
private:
TVector<const char*> order;
-public:
+public:
using iterator = typename string_hash<ui32, HashFcn, EqualTo>::iterator;
using const_iterator = typename string_hash<ui32, HashFcn, EqualTo>::const_iterator;
using value_type = typename string_hash<ui32, HashFcn, EqualTo>::value_type;
@@ -34,13 +34,13 @@ public:
using string_hash<ui32, HashFcn, EqualTo>::clear_hash;
atomizer() {
- order.reserve(HASH_SIZE_DEFAULT);
- }
+ order.reserve(HASH_SIZE_DEFAULT);
+ }
atomizer(size_type hash_size, pool_size_type pool_size)
: string_hash<ui32, HashFcn, EqualTo>(hash_size, pool_size)
- {
- order.reserve(hash_size);
- }
+ {
+ order.reserve(hash_size);
+ }
~atomizer() = default;
ui32 string_to_atom(const char* key) {
const char* old_begin = pool.Begin();
@@ -49,36 +49,36 @@ public:
if (ins.second) { // new?
if (pool.Begin() != old_begin) // repoint?
for (TVector<const char*>::iterator ptr = order.begin(); ptr != order.end(); ++ptr)
- if (old_begin <= *ptr && *ptr < old_end) // from old pool?
+ if (old_begin <= *ptr && *ptr < old_end) // from old pool?
*ptr += pool.Begin() - old_begin;
- order.push_back((*ins.first).first); // copy of 'key'
- }
+ order.push_back((*ins.first).first); // copy of 'key'
+ }
return (ui32)(*ins.first).second;
- }
-
+ }
+
ui32 perm_string_to_atom(const char* key) {
value_type val(key, ui32(size() + 1));
std::pair<iterator, bool> ins = this->insert(val);
- if (ins.second)
- order.push_back((*ins.first).first); // == copy of 'key'
+ if (ins.second)
+ order.push_back((*ins.first).first); // == copy of 'key'
return (ui32)(*ins.first).second; // == size()+1
- }
+ }
ui32 find_atom(const char* key) const {
const_iterator it = find(key);
- if (it == end())
- return 0; // INVALID_ATOM
- else
+ if (it == end())
+ return 0; // INVALID_ATOM
+ else
return (ui32)(*it).second;
- }
+ }
const char* get_atom_name(ui32 atom) const {
- if (atom && atom <= size())
+ if (atom && atom <= size())
return order[atom - 1];
return nullptr;
- }
+ }
void clear_atomizer() {
- clear_hash();
- order.clear();
- }
+ clear_hash();
+ order.clear();
+ }
void SaveC2N(FILE* f) const { // we write sorted file
for (ui32 i = 0; i < order.size(); i++)
if (order[i])
@@ -197,4 +197,4 @@ public:
clear_hash();
order.clear();
}
-};
+};
diff --git a/library/cpp/containers/str_map/str_map.h b/library/cpp/containers/str_map/str_map.h
index 31b00d1b99..a6d44db7c4 100644
--- a/library/cpp/containers/str_map/str_map.h
+++ b/library/cpp/containers/str_map/str_map.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include <util/memory/segmented_string_pool.h>
#include <util/generic/map.h>
#include <util/generic/hash.h>
@@ -7,14 +7,14 @@
#include <util/str_stl.h> // less<> and equal_to<> for const char*
#include <utility>
#include <util/generic/noncopyable.h>
-
+
template <class T, class HashFcn = THash<const char*>, class EqualTo = TEqualTo<const char*>, class Alloc = std::allocator<const char*>>
class string_hash;
template <class T, class HashFcn = THash<const char*>, class EqualTo = TEqualTo<const char*>>
class segmented_string_hash;
-template <class Map>
+template <class Map>
inline std::pair<typename Map::iterator, bool>
pool_insert(Map* m, const char* key, const typename Map::mapped_type& data, TBuffer& pool) {
std::pair<typename Map::iterator, bool> ins = m->insert(typename Map::value_type(key, data));
@@ -23,23 +23,23 @@ pool_insert(Map* m, const char* key, const typename Map::mapped_type& data, TBuf
const char* old_pool = pool.Begin();
pool.Append(key, buflen);
if (pool.Begin() != old_pool) // repoint?
- for (typename Map::iterator it = m->begin(); it != m->end(); ++it)
- if ((*it).first != key)
+ for (typename Map::iterator it = m->begin(); it != m->end(); ++it)
+ if ((*it).first != key)
const_cast<const char*&>((*it).first) += (pool.Begin() - old_pool);
const_cast<const char*&>((*ins.first).first) = pool.End() - buflen;
- }
- return ins;
-}
-
+ }
+ return ins;
+}
+
#define HASH_SIZE_DEFAULT 100
#define AVERAGEWORD_BUF 10
template <class T, class HashFcn, class EqualTo, class Alloc>
class string_hash: public THashMap<const char*, T, HashFcn, EqualTo, Alloc> {
-protected:
+protected:
TBuffer pool;
-public:
+public:
using yh = THashMap<const char*, T, HashFcn, EqualTo, Alloc>;
using iterator = typename yh::iterator;
using const_iterator = typename yh::const_iterator;
@@ -48,24 +48,24 @@ public:
using pool_size_type = typename yh::size_type;
string_hash() {
pool.Reserve(HASH_SIZE_DEFAULT * AVERAGEWORD_BUF); // reserve here
- }
+ }
string_hash(size_type hash_size, pool_size_type pool_size)
: THashMap<const char*, T, HashFcn, EqualTo, Alloc>(hash_size)
- {
+ {
pool.Reserve(pool_size); // reserve here
- }
-
+ }
+
std::pair<iterator, bool> insert_copy(const char* key, const mapped_type& data) {
- return ::pool_insert(this, key, data, pool);
- }
-
+ return ::pool_insert(this, key, data, pool);
+ }
+
void clear_hash() {
yh::clear();
pool.Clear();
- }
+ }
pool_size_type pool_size() const {
return pool.Size();
- }
+ }
string_hash(const string_hash& sh)
: THashMap<const char*, T, HashFcn, EqualTo, Alloc>()
@@ -98,8 +98,8 @@ public:
I = insert_copy(key, mapped_type()).first;
return (*I).second;
}
-};
-
+};
+
template <class C, class T, class HashFcn, class EqualTo>
class THashWithSegmentedPoolForKeys: protected THashMap<const C*, T, HashFcn, EqualTo>, TNonCopyable {
protected:
@@ -113,7 +113,7 @@ public:
using size_type = typename yh::size_type;
using key_type = typename yh::key_type;
using value_type = typename yh::value_type;
-
+
THashWithSegmentedPoolForKeys(size_type hash_size = HASH_SIZE_DEFAULT, size_t segsize = HASH_SIZE_DEFAULT * AVERAGEWORD_BUF, bool afs = false)
: yh(hash_size)
, pool(segsize)
@@ -177,7 +177,7 @@ public:
template <class T, class HashFcn, class EqualTo>
class segmented_string_hash: public THashWithSegmentedPoolForKeys<char, T, HashFcn, EqualTo> {
-public:
+public:
using Base = THashWithSegmentedPoolForKeys<char, T, HashFcn, EqualTo>;
using iterator = typename Base::iterator;
using const_iterator = typename Base::const_iterator;
@@ -189,17 +189,17 @@ public:
public:
segmented_string_hash(size_type hash_size = HASH_SIZE_DEFAULT, size_t segsize = HASH_SIZE_DEFAULT * AVERAGEWORD_BUF, bool afs = false)
: Base(hash_size, segsize, afs)
- {
- }
+ {
+ }
std::pair<iterator, bool> insert_copy(const char* key, const mapped_type& data) {
return Base::insert_copy(key, strlen(key) + 1, data);
- }
+ }
mapped_type& operator[](const char* key) {
iterator I = Base::find(key);
if (I == Base::end())
I = insert_copy(key, mapped_type()).first;
return (*I).second;
- }
-};
+ }
+};
diff --git a/library/cpp/deprecated/mapped_file/mapped_file.cpp b/library/cpp/deprecated/mapped_file/mapped_file.cpp
index b0e4511299..3884310f7d 100644
--- a/library/cpp/deprecated/mapped_file/mapped_file.cpp
+++ b/library/cpp/deprecated/mapped_file/mapped_file.cpp
@@ -4,7 +4,7 @@
#include <util/system/defaults.h>
#include <util/system/hi_lo.h>
#include <util/system/filemap.h>
-
+
TMappedFile::TMappedFile(TFileMap* map, const char* dbgName) {
Map_ = map;
i64 len = Map_->Length();
diff --git a/library/cpp/deprecated/mapped_file/mapped_file.h b/library/cpp/deprecated/mapped_file/mapped_file.h
index 45859ed65a..5aca2ece4f 100644
--- a/library/cpp/deprecated/mapped_file/mapped_file.h
+++ b/library/cpp/deprecated/mapped_file/mapped_file.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include <util/generic/flags.h>
#include <util/generic/ptr.h>
#include <util/generic/string.h>
diff --git a/library/cpp/getopt/small/opt.cpp b/library/cpp/getopt/small/opt.cpp
index 744501765c..40020680c2 100644
--- a/library/cpp/getopt/small/opt.cpp
+++ b/library/cpp/getopt/small/opt.cpp
@@ -3,9 +3,9 @@
#include <util/system/progname.h>
#include <ctype.h>
-
+
using namespace NLastGetopt;
-
+
namespace {
struct TOptsNoDefault: public TOpts {
TOptsNoDefault(const TStringBuf& optstring = TStringBuf())
@@ -34,15 +34,15 @@ void Opt::Init(int argc, char* argv[], const char* optString, const Ion* longOpt
}
opt->HasArg_ = EHasArg(o->has_arg);
opt->UserValue(o);
- }
+ }
Opts_->AllowSingleDashForLong_ = longOnly;
Opts_->AllowPlusForLong_ = true;
Opts_->AllowUnknownCharOptions_ = isOpen;
Opts_->AllowUnknownLongOptions_ = false;
-
+
OptsParser_.Reset(new TOptsParser(Opts_.Get(), argc, argv));
-}
-
+}
+
Opt::Opt(int argc, char* argv[], const char* optString, const Ion* longOptions, bool longOnly, bool isOpen) {
Init(argc, argv, optString, longOptions, longOnly, isOpen);
}
@@ -65,7 +65,7 @@ int Opt::Get(int* longOptionIndex) {
bool r = OptsParser_->Next();
Ind = (int)OptsParser_->Pos_;
if (!r) {
- return EOF;
+ return EOF;
} else {
Arg = (char*)OptsParser_->CurVal();
if (!OptsParser_->CurOpt()) {
@@ -78,16 +78,16 @@ int Opt::Get(int* longOptionIndex) {
}
char c = OptsParser_->CurOpt()->GetCharOr0();
return c != 0 ? c : ion->val;
- }
- }
+ }
+ }
} catch (const NLastGetopt::TException&) {
GotError_ = true;
if (Err)
Cerr << CurrentExceptionMessage() << Endl;
return '?';
- }
-}
-
+ }
+}
+
void Opt::DummyHelp(IOutputStream& os) {
Opts_->PrintUsage(GetProgramName(), os);
}
diff --git a/library/cpp/http/misc/httpdate.cpp b/library/cpp/http/misc/httpdate.cpp
index 4a3031bbf4..cd80921828 100644
--- a/library/cpp/http/misc/httpdate.cpp
+++ b/library/cpp/http/misc/httpdate.cpp
@@ -12,7 +12,7 @@
* no representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied
* warranty.
-*
+*
* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
@@ -37,10 +37,10 @@
#include <util/system/compat.h> /* stricmp */
#include <util/system/yassert.h>
-#include "httpdate.h"
+#include "httpdate.h"
#include <util/datetime/base.h>
-static const char *wkdays[] = {
+static const char *wkdays[] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
@@ -73,8 +73,8 @@ char* format_http_date(time_t when, char* buf, size_t buflen) {
Y_ASSERT(len > 0 && size_t(len) < buflen);
- return buf;
-}
+ return buf;
+}
TString FormatHttpDate(time_t when) {
char str[64] = {0};
diff --git a/library/cpp/http/misc/httpdate.h b/library/cpp/http/misc/httpdate.h
index 04876f38fe..cf38ca307f 100644
--- a/library/cpp/http/misc/httpdate.h
+++ b/library/cpp/http/misc/httpdate.h
@@ -4,9 +4,9 @@
#include <util/generic/string.h>
#include <ctime>
-
+
#define BAD_DATE ((time_t)-1)
-
+
inline time_t parse_http_date(const TStringBuf& datestring) {
try {
return TInstant::ParseHttpDeprecated(datestring).TimeT();
diff --git a/library/cpp/packedtypes/longs.h b/library/cpp/packedtypes/longs.h
index 084098d705..9601e39c98 100644
--- a/library/cpp/packedtypes/longs.h
+++ b/library/cpp/packedtypes/longs.h
@@ -6,7 +6,7 @@
#define PUT_8(x, buf, shift) WriteUnaligned<ui8>((buf)++, (x) >> (shift))
#define GET_8_OR(x, buf, type, shift) (x) |= (type) * (buf)++ << (shift)
-
+
#if defined(_big_endian_)
#define LO_SHIFT 1
#define HI_SHIFT 0
@@ -29,16 +29,16 @@
#else
#define PUT_32(x, buf, shift) PUT_16(x, buf, shift + 16 * LO_SHIFT), PUT_16(x, buf, shift + 16 * HI_SHIFT)
#define GET_32_OR(x, buf, type, shift) GET_16_OR(x, buf, type, shift + 16 * LO_SHIFT), GET_16_OR(x, buf, type, shift + 16 * HI_SHIFT)
-#endif
-
+#endif
+
#if !defined(_must_align8_)
#define PUT_64(x, buf, shift) WriteUnaligned<ui64>(buf, (x) >> (shift)), (buf) += 8
#define GET_64_OR(x, buf, type, shift) (x) |= (type)ReadUnaligned<ui64>(buf) << (shift), (buf) += 8
#else
#define PUT_64(x, buf, shift) PUT_32(x, buf, shift + 32 * LO_SHIFT), PUT_32(x, buf, shift + 32 * HI_SHIFT)
#define GET_64_OR(x, buf, type, shift) GET_32_OR(x, buf, type, shift + 32 * LO_SHIFT), GET_32_OR(x, buf, type, shift + 32 * HI_SHIFT)
-#endif
-
+#endif
+
struct mem_traits {
static ui8 get_8(const char*& mem) {
ui8 x = 0;
@@ -67,19 +67,19 @@ struct mem_traits {
static int is_good(char*&) {
return 1;
}
-};
-
-/*
-|____|____|____|____|____|____|____|____|____|____|____|____|____|____|8***|****
-|____|____|____|____|____|____|____|____|____|____|____|____|i4**|****|****|****
-|____|____|____|____|____|____|____|____|____|____|ii2*|****|****|****|****|****
-|____|____|____|____|____|____|____|____|iii1|****|****|****|****|****|****|****
-|____|____|____|____|____|____|iiii|8***|****|****|****|****|****|****|****|****
-|____|____|____|____|iiii|i4**|****|****|****|****|****|****|****|****|****|****
-|____|____|iiii|ii2*|****|****|****|****|****|****|****|****|****|****|****|****
-|iiii|iii1|****|****|****|****|****|****|****|****|****|****|****|****|****|****
-*/
-
+};
+
+/*
+|____|____|____|____|____|____|____|____|____|____|____|____|____|____|8***|****
+|____|____|____|____|____|____|____|____|____|____|____|____|i4**|****|****|****
+|____|____|____|____|____|____|____|____|____|____|ii2*|****|****|****|****|****
+|____|____|____|____|____|____|____|____|iii1|****|****|****|****|****|****|****
+|____|____|____|____|____|____|iiii|8***|****|****|****|****|****|****|****|****
+|____|____|____|____|iiii|i4**|****|****|****|****|****|****|****|****|****|****
+|____|____|iiii|ii2*|****|****|****|****|****|****|****|****|****|****|****|****
+|iiii|iii1|****|****|****|****|****|****|****|****|****|****|****|****|****|****
+*/
+
#define PACK1LIM 0x80u
#define PACK2LIM 0x4000u
#define PACK3LIM 0x200000u
@@ -88,7 +88,7 @@ struct mem_traits {
#define PACK6LIM 0x40000000000ull
#define PACK7LIM 0x2000000000000ull
#define PACK8LIM 0x100000000000000ull
-
+
#define MY_14(x) ((ui16)(x) < PACK1LIM ? 1 : 2)
#define MY_28(x) ((ui32)(x) < PACK2LIM ? MY_14(x) : ((ui32)(x) < PACK3LIM ? 3 : 4))
@@ -100,8 +100,8 @@ struct mem_traits {
#define MACRO_END \
} \
while (0)
-#endif
-
+#endif
+
#define PACK_14(x, buf, how, ret) \
MACRO_BEGIN \
if ((ui16)(x) < PACK1LIM) { \
@@ -113,7 +113,7 @@ struct mem_traits {
(ret) = 2; \
} \
MACRO_END
-
+
#define PACK_28(x, buf, how, ret) \
MACRO_BEGIN \
if ((ui32)(x) < PACK2LIM) { \
@@ -130,7 +130,7 @@ struct mem_traits {
how::put_16((ui16)(x), (buf)); \
} \
MACRO_END
-
+
#define PACK_32(x, buf, how, ret) \
MACRO_BEGIN \
if ((ui32)(x) < PACK4LIM) { \
@@ -176,7 +176,7 @@ struct mem_traits {
how::put_32((ui32)(x), buf); \
} \
MACRO_END
-
+
#define DO_UNPACK_14(firstByte, x, buf, how, ret) \
MACRO_BEGIN \
if (firstByte < 0x80) { \
@@ -188,13 +188,13 @@ struct mem_traits {
(ret) = 2; \
} \
MACRO_END
-
+
#define UNPACK_14(x, buf, how, ret) \
MACRO_BEGIN \
ui8 firstByte = how::get_8(buf); \
DO_UNPACK_14(firstByte, x, buf, how, ret); \
MACRO_END
-
+
#define DO_UNPACK_28(firstByte, x, buf, how, ret) \
MACRO_BEGIN \
if (firstByte < 0xC0) { \
@@ -211,13 +211,13 @@ struct mem_traits {
(x) |= how::get_16(buf); \
} \
MACRO_END
-
+
#define UNPACK_28(x, buf, how, ret) \
MACRO_BEGIN \
ui8 firstByte = how::get_8(buf); \
DO_UNPACK_28(firstByte, x, buf, how, ret); \
MACRO_END
-
+
#define DO_UNPACK_32(firstByte, x, buf, how, ret) \
MACRO_BEGIN \
if (firstByte < 0xF0) { \
@@ -267,44 +267,44 @@ struct mem_traits {
(x) |= how::get_32(buf); \
} \
MACRO_END
-
+
#define UNPACK_64(x, buf, how, ret) \
MACRO_BEGIN \
ui8 firstByte = how::get_8(buf); \
DO_UNPACK_64(firstByte, x, buf, how, ret); \
MACRO_END
-
+
inline int in_long(i64& longVal, const char* ptrBuf) {
- int ret;
- UNPACK_64(longVal, ptrBuf, mem_traits, ret);
- return ret;
-}
-
+ int ret;
+ UNPACK_64(longVal, ptrBuf, mem_traits, ret);
+ return ret;
+}
+
inline int out_long(const i64& longVal, char* ptrBuf) {
- int ret;
+ int ret;
PACK_64(longVal, ptrBuf, mem_traits, ret); /*7*/
- return ret;
-}
-
+ return ret;
+}
+
inline int len_long(const i64& longVal) {
- return MY_64(longVal);
-}
-
+ return MY_64(longVal);
+}
+
inline int in_long(i32& longVal, const char* ptrBuf) {
- int ret;
+ int ret;
UNPACK_32(longVal, ptrBuf, mem_traits, ret);
- return ret;
-}
-
+ return ret;
+}
+
inline int out_long(const i32& longVal, char* ptrBuf) {
- int ret;
+ int ret;
PACK_32(longVal, ptrBuf, mem_traits, ret);
- return ret;
-}
-
+ return ret;
+}
+
inline int len_long(const i32& longVal) {
- return MY_32(longVal);
-}
+ return MY_32(longVal);
+}
template <typename T, typename C>
inline const C* Unpack32(T& x, const C* src) {
diff --git a/util/charset/unidata.h b/util/charset/unidata.h
index 400d314186..32014a8fa0 100644
--- a/util/charset/unidata.h
+++ b/util/charset/unidata.h
@@ -1,9 +1,9 @@
#pragma once
-
+
#include "unicode_table.h"
#include <util/system/defaults.h> // wchar32, ui64, ULL()
-
+
enum WC_TYPE { // TODO move no NUnicode
Lu_UPPER = 1, // 'Ъ'
Ll_LOWER = 2, // 'ъ'
@@ -17,35 +17,35 @@ enum WC_TYPE { // TODO move no NUnicode
Lo_LEADING = 10, // '?'
Lo_VOWEL = 11, // '?'
Lo_TRAILING = 12, // '?'
-
+
Mn_NONSPACING = 13, // '`'
Me_ENCLOSING = 14, // '`'
Mc_SPACING = 15, // '`'
-
+
Nd_DIGIT = 16, // '9' // convert to digit
Nl_LETTER = 17, // 'X' // X,V,C,L,I ...
- Nl_IDEOGRAPH = 18, // '?'
+ Nl_IDEOGRAPH = 18, // '?'
No_OTHER = 19, // '9'
-
+
Zs_SPACE = 20, // ' ' [\40\240] SPACE ... NO-BREAK SPACE (00A0)
Zs_ZWSPACE = 21, // ' ' // nothing ?
Zl_LINE = 22, // '\n'
- Zp_PARAGRAPH = 23, // '\n'
-
+ Zp_PARAGRAPH = 23, // '\n'
+
Cc_ASCII = 24, // '\x1A' // can not happen
Cc_SPACE = 25, // '\x1A' // can not happen
- Cc_SEPARATOR = 26, // '\x1A' // can not happen
-
+ Cc_SEPARATOR = 26, // '\x1A' // can not happen
+
Cf_FORMAT = 27, // '\x1A' // nothing ?
Cf_JOIN = 28, // '\x1A' // nothing ?
Cf_BIDI = 29, // '\x1A' // nothing ?
Cf_ZWNBSP = 30, // '\x1A' // nothing ?
-
+
Cn_UNASSIGNED = 0, // '?'
Co_PRIVATE = 0, // '?'
Cs_LOW = 31, // '?'
Cs_HIGH = 32, // '?'
-
+
Pd_DASH = 33, // '-'
Pd_HYPHEN = 34, // '-' [-] HYPHEN-MINUS
Ps_START = 35, // '(' [([{] LEFT PARENTHESIS ... LEFT CURLY BRACKET
@@ -60,7 +60,7 @@ enum WC_TYPE { // TODO move no NUnicode
Po_TERMINAL = 44, // '.' [!,.:;?] EXCLAMATION MARK ... QUESTION MARK
Po_EXTENDER = 45, // '-' [№] MIDDLE DOT (00B7)
Po_HYPHEN = 46, // '-'
-
+
Sm_MATH = 47, // '=' [+<=>|~] PLUS SIGN ... TILDE
Sm_MINUS = 48, // '-'
Sc_CURRENCY = 49, // '$' [$] DOLLAR SIGN
@@ -75,25 +75,25 @@ enum WC_TYPE { // TODO move no NUnicode
CCL_NUM = 57,
CCL_MASK = 0x3F,
-
+
IS_ASCII_XDIGIT = 1 << 6,
IS_DIGIT = 1 << 7,
IS_NONBREAK = 1 << 8,
-
+
IS_PRIVATE = 1 << 9,
-
+
IS_COMPAT = 1 << 10,
IS_CANON = 1 << 11,
-
+
NFD_QC = 1 << 12,
NFC_QC = 1 << 13,
NFKD_QC = 1 << 14,
NFKC_QC = 1 << 15,
-
+
BIDI_OFFSET = 16,
SVAL_OFFSET = 22,
-};
-
+};
+
const size_t DEFCHAR_BUF = 58; // CCL_NUM + 1
#define SHIFT(i) (ULL(1) << (i))
@@ -144,17 +144,17 @@ namespace NUnicode {
}
}
-// all usefull properties
+// all usefull properties
inline bool IsComposed(wchar32 ch) {
return NUnicode::NPrivate::CharInfo(ch) & (IS_COMPAT | IS_CANON);
-}
+}
inline bool IsCanonComposed(wchar32 ch) {
return NUnicode::NPrivate::CharInfo(ch) & IS_CANON;
-}
+}
inline bool IsCompatComposed(wchar32 ch) {
return NUnicode::NPrivate::CharInfo(ch) & IS_COMPAT;
-}
+}
inline bool IsWhitespace(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cc_SPACE) | SHIFT(Zs_SPACE) | SHIFT(Zs_ZWSPACE) | SHIFT(Zl_LINE) | SHIFT(Zp_PARAGRAPH));
@@ -164,42 +164,42 @@ inline bool IsAsciiCntrl(wchar32 ch) {
}
inline bool IsBidiCntrl(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cf_BIDI));
-}
+}
inline bool IsJoinCntrl(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cf_JOIN));
-}
+}
inline bool IsFormatCntrl(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cf_FORMAT));
-}
+}
inline bool IsIgnorableCntrl(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cf_FORMAT) | SHIFT(Cf_JOIN) | SHIFT(Cf_BIDI) | SHIFT(Cf_ZWNBSP));
-}
+}
inline bool IsCntrl(wchar32 ch) {
return NUnicode::CharHasType(ch,
SHIFT(Cf_FORMAT) | SHIFT(Cf_JOIN) | SHIFT(Cf_BIDI) | SHIFT(Cf_ZWNBSP) |
SHIFT(Cc_ASCII) | SHIFT(Cc_SPACE) | SHIFT(Cc_SEPARATOR));
-}
+}
inline bool IsZerowidth(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cf_FORMAT) | SHIFT(Cf_JOIN) | SHIFT(Cf_BIDI) | SHIFT(Cf_ZWNBSP) | SHIFT(Zs_ZWSPACE));
-}
+}
inline bool IsLineSep(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Zl_LINE));
-}
+}
inline bool IsParaSep(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Zp_PARAGRAPH));
-}
+}
inline bool IsDash(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Pd_DASH) | SHIFT(Pd_HYPHEN) | SHIFT(Sm_MINUS));
-}
+}
inline bool IsHyphen(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Pd_HYPHEN) | SHIFT(Po_HYPHEN));
-}
+}
inline bool IsQuotation(wchar32 ch) {
return NUnicode::CharHasType(ch,
SHIFT(Po_QUOTE) | SHIFT(Ps_QUOTE) | SHIFT(Pe_QUOTE) | SHIFT(Pi_QUOTE) |
SHIFT(Pf_QUOTE) | SHIFT(Po_SINGLE_QUOTE) | SHIFT(Ps_SINGLE_QUOTE) |
SHIFT(Pe_SINGLE_QUOTE) | SHIFT(Pi_SINGLE_QUOTE) | SHIFT(Pf_SINGLE_QUOTE));
-}
+}
inline bool IsSingleQuotation(wchar32 ch) {
return NUnicode::CharHasType(ch,
@@ -209,100 +209,100 @@ inline bool IsSingleQuotation(wchar32 ch) {
inline bool IsTerminal(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Po_TERMINAL));
-}
+}
inline bool IsPairedPunct(wchar32 ch) {
return NUnicode::CharHasType(ch,
SHIFT(Ps_START) | SHIFT(Pe_END) | SHIFT(Ps_QUOTE) | SHIFT(Pe_QUOTE) |
SHIFT(Pi_QUOTE) | SHIFT(Pf_QUOTE) | SHIFT(Ps_SINGLE_QUOTE) |
SHIFT(Pe_SINGLE_QUOTE) | SHIFT(Pi_SINGLE_QUOTE) | SHIFT(Pf_SINGLE_QUOTE));
-}
+}
inline bool IsLeftPunct(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Ps_START) | SHIFT(Ps_QUOTE) | SHIFT(Ps_SINGLE_QUOTE));
-}
+}
inline bool IsRightPunct(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Pe_END) | SHIFT(Pe_QUOTE) | SHIFT(Pe_SINGLE_QUOTE));
-}
+}
inline bool IsCombining(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Mc_SPACING) | SHIFT(Mn_NONSPACING) | SHIFT(Me_ENCLOSING));
-}
+}
inline bool IsNonspacing(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Mn_NONSPACING) | SHIFT(Me_ENCLOSING));
-}
+}
inline bool IsAlphabetic(wchar32 ch) {
return NUnicode::CharHasType(ch,
SHIFT(Lu_UPPER) | SHIFT(Ll_LOWER) | SHIFT(Lt_TITLE) | SHIFT(Lm_EXTENDER) | SHIFT(Lm_LETTER) | SHIFT(Lo_OTHER) | SHIFT(Nl_LETTER));
-}
+}
inline bool IsIdeographic(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Lo_IDEOGRAPH) | SHIFT(Nl_IDEOGRAPH));
-}
+}
inline bool IsKatakana(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Lo_KATAKANA));
-}
+}
inline bool IsHiragana(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Lo_HIRAGANA));
-}
+}
inline bool IsHangulLeading(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Lo_LEADING));
-}
+}
inline bool IsHangulVowel(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Lo_VOWEL));
-}
+}
inline bool IsHangulTrailing(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Lo_TRAILING));
-}
+}
inline bool IsHexdigit(wchar32 ch) {
return NUnicode::NPrivate::CharInfo(ch) & IS_ASCII_XDIGIT;
-}
+}
inline bool IsDecdigit(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Nd_DIGIT));
-}
+}
inline bool IsNumeric(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Nd_DIGIT) | SHIFT(Nl_LETTER) | SHIFT(Nl_IDEOGRAPH) | SHIFT(No_OTHER));
-}
+}
inline bool IsCurrency(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Sc_CURRENCY));
-}
+}
inline bool IsMath(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Sm_MATH));
-}
+}
inline bool IsSymbol(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Sm_MATH) | SHIFT(Sm_MINUS) | SHIFT(Sc_CURRENCY) | SHIFT(Sk_MODIFIER) | SHIFT(So_OTHER));
-}
+}
inline bool IsLowSurrogate(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cs_LOW));
-}
+}
inline bool IsHighSurrogate(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cs_HIGH));
-}
+}
inline bool IsNonbreak(wchar32 ch) {
return NUnicode::NPrivate::CharInfo(ch) & IS_NONBREAK;
-}
+}
inline bool IsPrivate(wchar32 ch) {
return (NUnicode::NPrivate::CharInfo(ch) & IS_PRIVATE) && !NUnicode::CharHasType(ch, SHIFT(Cs_HIGH));
-}
+}
inline bool IsUnassigned(wchar32 ch) {
return (NUnicode::CharType(ch) == 0) && !(NUnicode::NPrivate::CharInfo(ch) & IS_PRIVATE);
-}
+}
inline bool IsPrivateHighSurrogate(wchar32 ch) {
return NUnicode::CharHasType(ch, SHIFT(Cs_HIGH)) && (NUnicode::NPrivate::CharInfo(ch) & IS_PRIVATE);
-}
+}
-// transformations
+// transformations
inline wchar32 ToLower(wchar32 ch) {
return static_cast<wchar32>(ch + NUnicode::NPrivate::CharProperty(ch).Lower);
-}
+}
inline wchar32 ToUpper(wchar32 ch) {
return static_cast<wchar32>(ch + NUnicode::NPrivate::CharProperty(ch).Upper);
-}
+}
inline wchar32 ToTitle(wchar32 ch) {
return static_cast<wchar32>(ch + NUnicode::NPrivate::CharProperty(ch).Title);
-}
+}
inline int ToDigit(wchar32 ch) {
ui32 i = NUnicode::NPrivate::CharInfo(ch);
return (i & IS_DIGIT) ? static_cast<int>(i >> SVAL_OFFSET) : -1;
-}
+}
// BIDI properties
diff --git a/util/datetime/base.h b/util/datetime/base.h
index 5e902b8f63..2034c2ca8c 100644
--- a/util/datetime/base.h
+++ b/util/datetime/base.h
@@ -44,18 +44,18 @@ class TDateTimeParseException: public yexception {
};
const int DATE_BUF_LEN = 4 + 2 + 2 + 1; // [YYYYMMDD*]
-
+
constexpr long seconds(const struct tm& theTm) {
return 60 * (60 * theTm.tm_hour + theTm.tm_min) + theTm.tm_sec;
-}
-
+}
+
void sprint_gm_date(char* buf, time_t when, long* sec = nullptr);
bool sscan_date(const char* date, struct tm& theTm);
-
+
const int DATE_8601_LEN = 21; // strlen("YYYY-MM-DDThh:mm:ssZ") = 20 + '\0'
size_t FormatDate8601(char* buf, size_t len, time_t when);
-
+
inline void sprint_date8601(char* buf, time_t when) {
buf[FormatDate8601(buf, 64, when)] = 0;
}
diff --git a/util/generic/strbase.h b/util/generic/strbase.h
index ab39fc7537..432cc515ff 100644
--- a/util/generic/strbase.h
+++ b/util/generic/strbase.h
@@ -12,7 +12,7 @@
#include <util/system/yassert.h>
#include <contrib/libs/libc_compat/string.h>
-
+
#include <cctype>
#include <cstring>
#include <string>
diff --git a/util/generic/string.cpp b/util/generic/string.cpp
index 3c655f1f66..b505b03a3f 100644
--- a/util/generic/string.cpp
+++ b/util/generic/string.cpp
@@ -1,5 +1,5 @@
#include "string.h"
-
+
#include <util/string/ascii.h>
#include <util/system/sanitizers.h>
#include <util/system/sys_alloc.h>
@@ -26,17 +26,17 @@ bool TBasicString<char, std::char_traits<char>>::to_lower(size_t pos, size_t n)
template <>
bool TBasicString<char, std::char_traits<char>>::to_upper(size_t pos, size_t n) {
return Transform([](size_t, char c) { return AsciiToUpper(c); }, pos, n);
-}
-
+}
+
template <>
bool TBasicString<char, std::char_traits<char>>::to_title(size_t pos, size_t n) {
if (n == 0) {
return false;
- }
+ }
bool changed = to_upper(pos, 1);
return to_lower(pos + 1, n - 1) || changed;
-}
-
+}
+
template <>
TUtf16String&
TBasicString<wchar16, std::char_traits<wchar16>>::AppendAscii(const ::TStringBuf& s) {
diff --git a/util/generic/string.h b/util/generic/string.h
index 8cd8aa6917..685bd1febc 100644
--- a/util/generic/string.h
+++ b/util/generic/string.h
@@ -19,7 +19,7 @@
#include "strbase.h"
#include "strbuf.h"
#include "string_hash.h"
-
+
#if defined(address_sanitizer_enabled) || defined(thread_sanitizer_enabled)
#include "hide_ptr.h"
#endif
@@ -306,7 +306,7 @@ public:
return ConstRef().c_str();
}
- // ~~~ STL compatible method to obtain data pointer ~~~
+ // ~~~ STL compatible method to obtain data pointer ~~~
iterator begin() {
return &*MutRef().begin();
}
@@ -314,7 +314,7 @@ public:
iterator vend() {
return &*MutRef().end();
}
-
+
reverse_iterator rbegin() {
return reverse_iterator(vend());
}
@@ -1092,7 +1092,7 @@ public:
return *this;
}
-
+
TBasicString& replace(size_t pos, size_t n, const TCharType* s, size_t len) Y_NOEXCEPT {
MutRef().replace(pos, n, s, len);
@@ -1116,7 +1116,7 @@ public:
return *this;
}
-
+
void swap(TBasicString& s) noexcept {
#ifdef TSTRING_IS_STD_STRING
std::swap(Storage_, s.Storage_);
diff --git a/util/memory/alloc.h b/util/memory/alloc.h
index d59575aef5..c2f2a4cd72 100644
--- a/util/memory/alloc.h
+++ b/util/memory/alloc.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include <memory>
template <class Allocator, class T>
diff --git a/util/str_stl.h b/util/str_stl.h
index f1e137181d..10c574f118 100644
--- a/util/str_stl.h
+++ b/util/str_stl.h
@@ -29,7 +29,7 @@ namespace std {
using is_transparent = void;
};
}
-
+
namespace NHashPrivate {
template <class T, bool needNumericHashing>
struct THashHelper {
@@ -78,8 +78,8 @@ struct hash<const char*>: ::NHashPrivate::TStringHash<char> {
template <>
struct THash<TStringBuf>: ::NHashPrivate::TStringHash<char> {
-};
-
+};
+
template <>
struct hash<TString>: ::NHashPrivate::TStringHash<char> {
};
diff --git a/util/stream/file.h b/util/stream/file.h
index c1cf4f591d..df1ac6b390 100644
--- a/util/stream/file.h
+++ b/util/stream/file.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include "fwd.h"
#include "input.h"
#include "output.h"
diff --git a/util/string/util.h b/util/string/util.h
index 0d77a5042b..ebee2e8664 100644
--- a/util/string/util.h
+++ b/util/string/util.h
@@ -1,5 +1,5 @@
#pragma once
-
+
//THIS FILE A COMPAT STUB HEADER
#include <cstring>
diff --git a/util/system/compat.cpp b/util/system/compat.cpp
index 18fbfa296a..5fe6332b82 100644
--- a/util/system/compat.cpp
+++ b/util/system/compat.cpp
@@ -8,7 +8,7 @@
#include <cstring>
#include <cstdarg>
#include <cstdlib>
-
+
#include <util/generic/string.h>
#ifdef _win_
diff --git a/util/system/compat.h b/util/system/compat.h
index c53dbcca17..679f51084a 100644
--- a/util/system/compat.h
+++ b/util/system/compat.h
@@ -1,11 +1,11 @@
#pragma once
-
+
#include "defaults.h"
#include <cstdarg>
#include <csignal>
-
+
#if defined(_unix_)
#include <unistd.h>
#endif
@@ -14,10 +14,10 @@
#include <process.h>
#endif
-extern "C" {
+extern "C" {
#if defined(_win_)
using pid_t = int;
-
+
inline unsigned int alarm(unsigned int /*seconds*/) {
return 0; // no alarm is currently set :)
}
diff --git a/util/system/defaults.h b/util/system/defaults.h
index dcd7abea38..300448e7d7 100644
--- a/util/system/defaults.h
+++ b/util/system/defaults.h
@@ -14,10 +14,10 @@
#include <new>
#endif
-// low and high parts of integers
+// low and high parts of integers
#if !defined(_win_)
#include <sys/param.h>
-#endif
+#endif
#if defined(BSD) || defined(_android_)
@@ -42,20 +42,20 @@
#else
#define _little_endian_
#endif
-
-// alignment
+
+// alignment
#if (defined(_sun_) && !defined(__i386__)) || defined(_hpux_) || defined(__alpha__) || defined(__ia64__) || defined(WHATEVER_THAT_NEEDS_ALIGNING_QUADS)
#define _must_align8_
-#endif
-
+#endif
+
#if (defined(_sun_) && !defined(__i386__)) || defined(_hpux_) || defined(__alpha__) || defined(__ia64__) || defined(WHATEVER_THAT_NEEDS_ALIGNING_LONGS)
#define _must_align4_
-#endif
-
+#endif
+
#if (defined(_sun_) && !defined(__i386__)) || defined(_hpux_) || defined(__alpha__) || defined(__ia64__) || defined(WHATEVER_THAT_NEEDS_ALIGNING_SHORTS)
#define _must_align2_
-#endif
-
+#endif
+
#if defined(__GNUC__)
#define alias_hack __attribute__((__may_alias__))
#endif
@@ -66,13 +66,13 @@
#include "types.h"
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
#define PRAGMA(x) _Pragma(#x)
#define RCSID(idstr) PRAGMA(comment(exestr, idstr))
-#else
+#else
#define RCSID(idstr) static const char rcsid[] = idstr
-#endif
-
+#endif
+
#include "compiler.h"
#ifdef _win_
diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp
index 7454a4cb94..fc125cc9bf 100644
--- a/util/system/filemap.cpp
+++ b/util/system/filemap.cpp
@@ -6,7 +6,7 @@
#include <util/generic/buffer.h>
#include <util/generic/yexception.h>
#include <util/generic/singleton.h>
-
+
#if defined(_win_)
#include "winint.h"
#elif defined(_unix_)
@@ -28,8 +28,8 @@
#endif
#else
#error todo
-#endif
-
+#endif
+
#include <util/generic/utility.h>
#include <util/system/sanitizers.h>
#include "filemap.h"
@@ -254,7 +254,7 @@ public:
result.Ptr = PtrStart_ ? static_cast<caddr_t>(PtrStart_) + base : nullptr;
}
#endif
-#endif
+#endif
if (result.Ptr != nullptr || size == 0) { // allow map of size 0
result.Size = size;
} else {
@@ -284,8 +284,8 @@ public:
}
#endif
}
-#endif
-
+#endif
+
void SetSequential() {
#if defined(_unix_)
if (!(Mode_ & oNotGreedy) && Length_) {
diff --git a/util/system/filemap.h b/util/system/filemap.h
index 11be64bff4..bbcabc4ec0 100644
--- a/util/system/filemap.h
+++ b/util/system/filemap.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include "file.h"
#include "align.h"
#include "yassert.h"
@@ -47,7 +47,7 @@ struct TMemoryMapCommon {
Reset();
}
};
-
+
enum EOpenModeFlag {
oRdOnly = 1,
oRdWr = 2,
@@ -105,7 +105,7 @@ private:
class TImpl;
TSimpleIntrusivePtr<TImpl> Impl_;
};
-
+
class TFileMap: public TMemoryMapCommon {
public:
TFileMap(const TMemoryMap& map) noexcept;
@@ -141,7 +141,7 @@ public:
inline i64 Length() const noexcept {
return Map_.Length();
}
-
+
inline bool IsOpen() const noexcept {
return Map_.IsOpen();
}
@@ -182,7 +182,7 @@ private:
TMemoryMap Map_;
TMapResult Region_;
};
-
+
template <class T>
class TFileMappedArray {
private:
@@ -325,7 +325,7 @@ private:
bool Shared_ = false;
#ifdef _win_
void* Mapping_ = nullptr;
-#endif
+#endif
};
template <class T>
diff --git a/util/system/maxlen.h b/util/system/maxlen.h
index e1ff7f5008..a522914401 100644
--- a/util/system/maxlen.h
+++ b/util/system/maxlen.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include <cstdlib>
// http://support.microsoft.com/kb/208427
diff --git a/util/system/mutex.cpp b/util/system/mutex.cpp
index 4041402db9..9b36c272a5 100644
--- a/util/system/mutex.cpp
+++ b/util/system/mutex.cpp
@@ -7,14 +7,14 @@
#include "winint.h"
#else
#include <pthread.h>
-#endif
-
+#endif
+
class TMutex::TImpl {
public:
inline TImpl() {
#if defined(_win_)
InitializeCriticalSection(&Obj);
-#else
+#else
struct T {
pthread_mutexattr_t Attr;
@@ -43,25 +43,25 @@ public:
if (result != 0) {
ythrow yexception() << "mutex init failed(" << LastSystemErrorText(result) << ")";
}
-#endif
+#endif
}
-
+
inline ~TImpl() {
#if defined(_win_)
DeleteCriticalSection(&Obj);
-#else
+#else
int result = pthread_mutex_destroy(&Obj);
Y_VERIFY(result == 0, "mutex destroy failure (%s)", LastSystemErrorText(result));
-#endif
+#endif
}
inline void Acquire() noexcept {
#if defined(_win_)
EnterCriticalSection(&Obj);
-#else
+#else
int result = pthread_mutex_lock(&Obj);
Y_VERIFY(result == 0, "mutex lock failure (%s)", LastSystemErrorText(result));
-#endif
+#endif
}
#if defined(_win_)
@@ -90,22 +90,22 @@ public:
inline bool TryAcquire() noexcept {
#if defined(_win_)
return TryEnterCriticalSectionInt(&Obj);
-#else
+#else
int result = pthread_mutex_trylock(&Obj);
if (result == 0 || result == EBUSY) {
return result == 0;
}
Y_FAIL("mutex trylock failure (%s)", LastSystemErrorText(result));
-#endif
+#endif
}
inline void Release() noexcept {
#if defined(_win_)
LeaveCriticalSection(&Obj);
-#else
+#else
int result = pthread_mutex_unlock(&Obj);
Y_VERIFY(result == 0, "mutex unlock failure (%s)", LastSystemErrorText(result));
-#endif
+#endif
}
inline void* Handle() const noexcept {
@@ -123,8 +123,8 @@ private:
TMutex::TMutex()
: Impl_(new TImpl())
{
-}
-
+}
+
TMutex::TMutex(TMutex&&) = default;
TMutex::~TMutex() = default;
diff --git a/util/system/mutex.h b/util/system/mutex.h
index 032630d134..4d11fc9c7a 100644
--- a/util/system/mutex.h
+++ b/util/system/mutex.h
@@ -1,16 +1,16 @@
#pragma once
-
+
#include "guard.h"
#include "defaults.h"
#include <util/generic/ptr.h>
#include <util/generic/noncopyable.h>
-
+
class TFakeMutex: public TNonCopyable {
public:
inline void Acquire() noexcept {
}
-
+
inline bool TryAcquire() noexcept {
return true;
}
@@ -32,7 +32,7 @@ public:
~TFakeMutex() = default;
};
-
+
class TMutex {
public:
TMutex();
diff --git a/util/system/sys_alloc.h b/util/system/sys_alloc.h
index 4221a28f8c..3698960e8a 100644
--- a/util/system/sys_alloc.h
+++ b/util/system/sys_alloc.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include <util/system/compiler.h>
#include <cstdlib>
diff --git a/util/system/tls.h b/util/system/tls.h
index 3c4f56dbeb..17d58e3a0c 100644
--- a/util/system/tls.h
+++ b/util/system/tls.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include "defaults.h"
#include <util/generic/ptr.h>
@@ -176,7 +176,7 @@ namespace NTls {
}
};
- template <class T>
+ template <class T>
class TValue: public TMoveOnly {
class TConstructor {
public:
@@ -227,12 +227,12 @@ namespace NTls {
: Constructor_(new TCopyConstructor<T1>(value))
, Key_(Dtor)
{
- }
+ }
template <class T1>
inline T& operator=(const T1& val) {
return Get() = val;
- }
+ }
inline operator const T&() const {
return Get();
@@ -275,7 +275,7 @@ namespace NTls {
}
return val;
- }
+ }
private:
static void Dtor(void* ptr) {
@@ -283,12 +283,12 @@ namespace NTls {
((T*)ptr)->~T();
::NPrivate::FillWithTrash(ptr, sizeof(T));
- }
+ }
private:
THolder<TConstructor> Constructor_;
TKey Key_;
- };
+ };
}
template <class T>
diff --git a/util/system/yassert.h b/util/system/yassert.h
index 529823440c..8d54977cc9 100644
--- a/util/system/yassert.h
+++ b/util/system/yassert.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include "defaults.h"
#include "src_root.h"
#include "backtrace.h"
@@ -21,7 +21,7 @@
#endif
#include <cassert>
#endif
-
+
#if !defined(_MSC_VER)
#if defined(__has_builtin) && __has_builtin(__debugbreak)
// Do nothing, use __debugbreak builtin
diff --git a/util/thread/pool.h b/util/thread/pool.h
index d1ea3a67cb..d7d9202cd8 100644
--- a/util/thread/pool.h
+++ b/util/thread/pool.h
@@ -9,7 +9,7 @@
#include <util/generic/ptr.h>
#include <util/generic/noncopyable.h>
#include <functional>
-
+
class TDuration;
struct IObjectInQueue {
@@ -25,8 +25,8 @@ struct IObjectInQueue {
* parameter.
*/
virtual void Process(void* threadSpecificResource) = 0;
-};
-
+};
+
/**
* Mighty class to add 'Pool' method to derived classes.
* Useful only for creators of new queue classes.