diff options
author | lsurn <lsurn@yandex-team.ru> | 2022-02-10 16:49:33 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:33 +0300 |
commit | d8825989a7621fc7275e8cfdba16b4f699fb6359 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library | |
parent | 45e70bb2432018a4704845621cd9ddd2ceab6ffb (diff) | |
download | ydb-d8825989a7621fc7275e8cfdba16b4f699fb6359.tar.gz |
Restoring authorship annotation for <lsurn@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library')
-rw-r--r-- | library/cpp/charset/recyr.hh | 2 | ||||
-rw-r--r-- | library/cpp/containers/atomizer/atomizer.h | 2 | ||||
-rw-r--r-- | library/cpp/http/misc/httpcodes.cpp | 4 | ||||
-rw-r--r-- | library/cpp/mime/types/mime.cpp | 34 | ||||
-rw-r--r-- | library/cpp/packedtypes/longs_ut.cpp | 6 | ||||
-rw-r--r-- | library/cpp/regex/pcre/regexp.cpp | 72 | ||||
-rw-r--r-- | library/cpp/regex/pcre/regexp.h | 18 |
7 files changed, 69 insertions, 69 deletions
diff --git a/library/cpp/charset/recyr.hh b/library/cpp/charset/recyr.hh index 72619201b7..5ec8734bcf 100644 --- a/library/cpp/charset/recyr.hh +++ b/library/cpp/charset/recyr.hh @@ -1,7 +1,7 @@ #pragma once #include <cstdlib> - + #include <util/charset/recode_result.h> #include <util/generic/ptr.h> #include <util/generic/yexception.h> diff --git a/library/cpp/containers/atomizer/atomizer.h b/library/cpp/containers/atomizer/atomizer.h index 53a17378af..5e40f47ab9 100644 --- a/library/cpp/containers/atomizer/atomizer.h +++ b/library/cpp/containers/atomizer/atomizer.h @@ -144,7 +144,7 @@ public: std::pair<iterator, bool> ins = insert_copy(key, ui32(size() + 1)); if (ins.second) { // new? if (pool.Begin() != old_begin) // repoint? - for (typename TOrder::iterator ptr = order.begin(); ptr != order.end(); ++ptr) + for (typename TOrder::iterator ptr = order.begin(); ptr != order.end(); ++ptr) if (old_begin <= (*ptr).first && (*ptr).first < old_end) // from old pool? (*ptr).first += pool.Begin() - old_begin; order.push_back(std::pair<const char*, T>((*ins.first).first, atom_data ? *atom_data : T())); diff --git a/library/cpp/http/misc/httpcodes.cpp b/library/cpp/http/misc/httpcodes.cpp index c778b614d3..ad8c80ac1e 100644 --- a/library/cpp/http/misc/httpcodes.cpp +++ b/library/cpp/http/misc/httpcodes.cpp @@ -107,7 +107,7 @@ TStringBuf HttpCodeStrEx(int code) noexcept { return TStringBuf("431 Request Header Fields Too Large"); case HTTP_UNAVAILABLE_FOR_LEGAL_REASONS: return TStringBuf("451 Unavailable For Legal Reason"); - + case HTTP_INTERNAL_SERVER_ERROR: return TStringBuf("500 Internal server error"); case HTTP_NOT_IMPLEMENTED: @@ -138,4 +138,4 @@ TStringBuf HttpCodeStrEx(int code) noexcept { default: return TStringBuf("000 Unknown HTTP code"); } -} +} diff --git a/library/cpp/mime/types/mime.cpp b/library/cpp/mime/types/mime.cpp index 84681d9e4d..706d776b24 100644 --- a/library/cpp/mime/types/mime.cpp +++ b/library/cpp/mime/types/mime.cpp @@ -8,10 +8,10 @@ #include <cctype> -/* +/* * MIME types - */ - + */ + class TMimeTypes { // Constructor public: @@ -165,29 +165,29 @@ const char* TMimeTypes::StrByMime(MimeTypes mime) const { } const char* mimetypeByExt(const char* fname, const char* check_ext) { - const char* ext_p; + const char* ext_p; if (fname == nullptr || *fname == 0 || (ext_p = strrchr(fname, '.')) == nullptr || strlen(ext_p) - 1 > TMimeTypes::MAX_EXT_LEN) { return nullptr; - } - + } + char ext[TMimeTypes::MAX_EXT_LEN + 1]; - size_t i; - ext_p++; + size_t i; + ext_p++; for (i = 0; i < TMimeTypes::MAX_EXT_LEN && ext_p[i]; i++) ext[i] = (char)tolower(ext_p[i]); - ext[i] = 0; - + ext[i] = 0; + if (check_ext != nullptr) { - if (strcmp(ext, check_ext) == 0) - return check_ext; - else + if (strcmp(ext, check_ext) == 0) + return check_ext; + else return nullptr; - } - + } + return Singleton<TMimeTypes>()->StrByExt(ext); -} - +} + MimeTypes mimeByStr(const char* mimeStr) { return Singleton<TMimeTypes>()->MimeByStr(mimeStr); } diff --git a/library/cpp/packedtypes/longs_ut.cpp b/library/cpp/packedtypes/longs_ut.cpp index e7f0263d93..8b06c934d2 100644 --- a/library/cpp/packedtypes/longs_ut.cpp +++ b/library/cpp/packedtypes/longs_ut.cpp @@ -1,19 +1,19 @@ #include "longs.h" #include <library/cpp/testing/unittest/registar.h> - + #include <library/cpp/digest/old_crc/crc.h> #include <util/string/util.h> #include <util/stream/output.h> #include <util/system/hi_lo.h> - + Y_UNIT_TEST_SUITE(TLongsTest) { Y_UNIT_TEST(TestLongs) { i16 x16 = 40; i64 x64 = 40; i64 y64; TString s; - + s += Sprintf("x16=0x%x\n", (int)x16); s += Sprintf("LO_8(x16)=0x%x HI_8(x16)=0x%x\n\n", (int)Lo8(x16), (int)Hi8(x16)); diff --git a/library/cpp/regex/pcre/regexp.cpp b/library/cpp/regex/pcre/regexp.cpp index a1a40cb3d7..575c09cee4 100644 --- a/library/cpp/regex/pcre/regexp.cpp +++ b/library/cpp/regex/pcre/regexp.cpp @@ -193,8 +193,8 @@ private: bool TRegExBase::IsCompiled() const { return Impl && Impl->IsCompiled(); -} - +} + TRegExBase::TRegExBase(const char* re, int cflags) { if (re) { Compile(re, cflags); @@ -206,8 +206,8 @@ TRegExBase::TRegExBase(const TString& re, int cflags) { } TRegExBase::~TRegExBase() { -} - +} + void TRegExBase::Compile(const TString& re, int cflags) { Impl = new TRegExBaseImpl(re, cflags); } @@ -216,20 +216,20 @@ int TRegExBase::Exec(const char* str, regmatch_t pmatch[], int eflags, int nmatc if (!Impl) ythrow yexception() << "!Regular expression is not compiled"; return Impl->Exec(str, pmatch, eflags, nmatches); -} - +} + int TRegExBase::GetCompileOptions() const { if (!Impl) ythrow yexception() << "!Regular expression is not compiled"; return Impl->CompileOptions; -} - +} + TString TRegExBase::GetRegExpr() const { if (!Impl) ythrow yexception() << "!Regular expression is not compiled"; return Impl->RegExpr; -} - +} + TRegExMatch::TRegExMatch(const char* re, int cflags) : TRegExBase(re, cflags) { @@ -255,21 +255,21 @@ TString TRegExSubst::Replace(const char* str, int eflags) { TString s; if (BrfsCount) { if (Exec(str, PMatch, eflags) == 0) { - int i; + int i; for (i = 0; i < BrfsCount; i++) { s += TString(Replacement, Brfs[i].Beg, Brfs[i].End - Brfs[i].Beg); if (Brfs[i].Refer >= 0 && Brfs[i].Refer < NMATCHES) s += TString(str, PMatch[Brfs[i].Refer].rm_so, int(PMatch[Brfs[i].Refer].rm_eo - PMatch[Brfs[i].Refer].rm_so)); - } + } s += TString(Replacement, Brfs[i].Beg, Brfs[i].End - Brfs[i].Beg); - } - } else { + } + } else { s = Replacement; - } - return s; -} - -//*** + } + return s; +} + +//*** // ��� ������������ ������ aaa.$1.$$$$.$2.bbb.$$$ccc Brfs ����� �����: // {beg = 0, end = 4, Refer = 1} => "aaa." + $1_match // {beg = 6, end = 8, Refer = -1} => ".$" @@ -279,39 +279,39 @@ TString TRegExSubst::Replace(const char* str, int eflags) { // {beg = 21, end = 22, Refer = -1} => "$" // {beg = 22, end = 25, Refer = -1} => "ccc" // {beg = 0, end = 0, Refer = 0} -//*** +//*** int TRegExSubst::ParseReplacement(const char* repl) { Replacement = repl; if (!Replacement || *Replacement == 0) - return 0; + return 0; char* pos = (char*)Replacement; char* pos1 = nullptr; char* pos2 = nullptr; - int i = 0; + int i = 0; while (pos && *pos && i < NMATCHES) { - pos1 = strchr(pos, '$'); + pos1 = strchr(pos, '$'); Brfs[i].Refer = -1; - pos2 = pos1; - if (pos1) { - pos2 = pos1 + 1; + pos2 = pos1; + if (pos1) { + pos2 = pos1 + 1; while (IsAsciiDigit(*pos2)) - pos2++; + pos2++; if (pos2 > pos1 + 1) { Brfs[i].Refer = atol(TString(Replacement, pos1 + 1 - Replacement, pos2 - (pos1 + 1)).data()); - } else { - pos1++; + } else { + pos1++; if (*pos2 == '$') - pos2++; + pos2++; Brfs[i].Refer = -1; - } - } + } + } Brfs[i].Beg = int(pos - (char*)Replacement); Brfs[i].End = (pos1 == nullptr ? (int)strlen(Replacement) : int(pos1 - Replacement)); - pos = pos2; - i++; - } + pos = pos2; + i++; + } Brfs[i].Beg = Brfs[i].End = 0; Brfs[i].Refer = -1; BrfsCount = i; return BrfsCount; -} +} diff --git a/library/cpp/regex/pcre/regexp.h b/library/cpp/regex/pcre/regexp.h index 340cf9e45e..bc610bd2f3 100644 --- a/library/cpp/regex/pcre/regexp.h +++ b/library/cpp/regex/pcre/regexp.h @@ -1,6 +1,6 @@ #pragma once - -#include <sys/types.h> + +#include <sys/types.h> #include <util/system/defaults.h> #include <util/generic/string.h> @@ -11,7 +11,7 @@ //THIS CODE LOOKS LIKE A TRASH, BUT WORKS. -#define NMATCHES 100 +#define NMATCHES 100 #define REGEXP_GLOBAL 0x0080 // use this if you want to find all occurences class TRegExBaseImpl; @@ -31,22 +31,22 @@ public: bool IsCompiled() const; int GetCompileOptions() const; TString GetRegExpr() const; -}; - +}; + class TRegExMatch: public TRegExBase { public: TRegExMatch(const char* regExpr = nullptr, int cflags = REG_NOSUB | REG_EXTENDED); TRegExMatch(const TString& regExpr, int cflags = REG_NOSUB | REG_EXTENDED); - + bool Match(const char* str) const; }; - + struct TBackReferences { int Beg; int End; int Refer; }; - + class TRegExSubst: public TRegExBase { private: const char* Replacement; @@ -60,4 +60,4 @@ public: TString Replace(const char* str, int eflags = 0); int ParseReplacement(const char* replacement); -}; +}; |