aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorvmordovin <vmordovin@yandex-team.ru>2022-02-10 16:48:14 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:14 +0300
commit7c7f9bbcf57e15838d15afa94b31d8254b5d7776 (patch)
tree17073f853e6b3a1a95708e8aa0ea12fa42a717e7 /library/cpp
parent466f96709329ff77ded50177df94d1893a226c00 (diff)
downloadydb-7c7f9bbcf57e15838d15afa94b31d8254b5d7776.tar.gz
Restoring authorship annotation for <vmordovin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/charset/codepage.cpp6
-rw-r--r--library/cpp/charset/codepage.h4
-rw-r--r--library/cpp/dns/cache.cpp10
-rw-r--r--library/cpp/dns/thread.cpp2
-rw-r--r--library/cpp/dns/ut/dns_ut.cpp26
-rw-r--r--library/cpp/enumbitset/enumbitset.h4
-rw-r--r--library/cpp/http/io/headers.h2
-rw-r--r--library/cpp/http/io/stream.cpp28
-rw-r--r--library/cpp/http/io/stream.h6
-rw-r--r--library/cpp/http/io/stream_ut.cpp100
-rw-r--r--library/cpp/http/misc/httpreqdata.cpp36
-rw-r--r--library/cpp/http/misc/httpreqdata.h50
-rw-r--r--library/cpp/http/server/http_ex.cpp8
-rw-r--r--library/cpp/http/server/http_ex.h30
-rw-r--r--library/cpp/streams/bzip2/bzip2.cpp18
-rw-r--r--library/cpp/streams/lz/lz.cpp4
-rw-r--r--library/cpp/streams/lzma/lzma.cpp6
-rw-r--r--library/cpp/threading/atomic/bool.cpp2
-rw-r--r--library/cpp/threading/atomic/bool.h54
-rw-r--r--library/cpp/threading/atomic/bool_ut.cpp56
-rw-r--r--library/cpp/threading/atomic/ut/ya.make16
-rw-r--r--library/cpp/threading/atomic/ya.make18
-rw-r--r--library/cpp/threading/task_scheduler/task_scheduler_ut.cpp106
-rw-r--r--library/cpp/ya.make2
24 files changed, 297 insertions, 297 deletions
diff --git a/library/cpp/charset/codepage.cpp b/library/cpp/charset/codepage.cpp
index 0431bef31b..c42fc3160b 100644
--- a/library/cpp/charset/codepage.cpp
+++ b/library/cpp/charset/codepage.cpp
@@ -180,7 +180,7 @@ public:
}
}
- inline ECharset CharsetByName(TStringBuf name) {
+ inline ECharset CharsetByName(TStringBuf name) {
if (!name)
return CODES_UNKNOWN;
@@ -192,11 +192,11 @@ public:
}
};
-ECharset CharsetByName(TStringBuf name) {
+ECharset CharsetByName(TStringBuf name) {
return Singleton<TCodePageHash>()->CharsetByName(name);
}
-ECharset CharsetByNameOrDie(TStringBuf name) {
+ECharset CharsetByNameOrDie(TStringBuf name) {
ECharset result = CharsetByName(name);
if (result == CODES_UNKNOWN)
ythrow yexception() << "CharsetByNameOrDie: unknown charset '" << name << "'";
diff --git a/library/cpp/charset/codepage.h b/library/cpp/charset/codepage.h
index 30a02a4610..f6fc72e29c 100644
--- a/library/cpp/charset/codepage.h
+++ b/library/cpp/charset/codepage.h
@@ -153,10 +153,10 @@ inline const CodePage* CodePageByCharset(ECharset e) {
return ::NCodepagePrivate::TCodepagesMap::Instance().Get(e);
}
-ECharset CharsetByName(TStringBuf name);
+ECharset CharsetByName(TStringBuf name);
// Same as CharsetByName, but throws yexception() if name is invalid
-ECharset CharsetByNameOrDie(TStringBuf name);
+ECharset CharsetByNameOrDie(TStringBuf name);
inline ECharset CharsetByCodePage(const CodePage* CP) {
return CP->CPEnum;
diff --git a/library/cpp/dns/cache.cpp b/library/cpp/dns/cache.cpp
index 05c14e82fc..08ac929a9f 100644
--- a/library/cpp/dns/cache.cpp
+++ b/library/cpp/dns/cache.cpp
@@ -98,14 +98,14 @@ namespace {
//3. replace host to alias, if exist
if (A_.size()) {
TReadGuard guard(LA_);
- TStringBuf names[] = {"*", host};
+ TStringBuf names[] = {"*", host};
for (const auto& name : names) {
- TAliases::const_iterator it = A_.find(name);
+ TAliases::const_iterator it = A_.find(name);
- if (it != A_.end()) {
- host = it->second;
- }
+ if (it != A_.end()) {
+ host = it->second;
+ }
}
}
diff --git a/library/cpp/dns/thread.cpp b/library/cpp/dns/thread.cpp
index 8b27d2d527..fbe33d5c84 100644
--- a/library/cpp/dns/thread.cpp
+++ b/library/cpp/dns/thread.cpp
@@ -52,7 +52,7 @@ namespace {
TString Host;
ui16 Port;
- TManualEvent E;
+ TManualEvent E;
TNetworkAddressPtr Result;
IErrorRef Error;
};
diff --git a/library/cpp/dns/ut/dns_ut.cpp b/library/cpp/dns/ut/dns_ut.cpp
index aae05a742c..fc5a356b57 100644
--- a/library/cpp/dns/ut/dns_ut.cpp
+++ b/library/cpp/dns/ut/dns_ut.cpp
@@ -1,6 +1,6 @@
#include <library/cpp/testing/unittest/registar.h>
#include <library/cpp/dns/cache.h>
-#include <util/network/address.h>
+#include <util/network/address.h>
Y_UNIT_TEST_SUITE(TestDNS) {
using namespace NDns;
@@ -8,18 +8,18 @@ Y_UNIT_TEST_SUITE(TestDNS) {
Y_UNIT_TEST(TestMagic) {
UNIT_ASSERT_EXCEPTION(CachedThrResolve(TResolveInfo("?", 80)), yexception);
}
-
+
Y_UNIT_TEST(TestAsteriskAlias) {
- AddHostAlias("*", "localhost");
- const TResolvedHost* rh = CachedThrResolve(TResolveInfo("yandex.ru", 80));
- UNIT_ASSERT(rh != nullptr);
-
+ AddHostAlias("*", "localhost");
+ const TResolvedHost* rh = CachedThrResolve(TResolveInfo("yandex.ru", 80));
+ UNIT_ASSERT(rh != nullptr);
+
const TNetworkAddress& addr = rh->Addr;
- for (TNetworkAddress::TIterator ai = addr.Begin(); ai != addr.End(); ai++) {
- if (ai->ai_family == AF_INET || ai->ai_family == AF_INET6) {
- NAddr::TAddrInfo info(&*ai);
- UNIT_ASSERT(IsLoopback(info));
- }
- }
- }
+ for (TNetworkAddress::TIterator ai = addr.Begin(); ai != addr.End(); ai++) {
+ if (ai->ai_family == AF_INET || ai->ai_family == AF_INET6) {
+ NAddr::TAddrInfo info(&*ai);
+ UNIT_ASSERT(IsLoopback(info));
+ }
+ }
+ }
}
diff --git a/library/cpp/enumbitset/enumbitset.h b/library/cpp/enumbitset/enumbitset.h
index 41864c3a04..7857af1438 100644
--- a/library/cpp/enumbitset/enumbitset.h
+++ b/library/cpp/enumbitset/enumbitset.h
@@ -305,7 +305,7 @@ public:
return ret;
}
- void FromString(TStringBuf s) {
+ void FromString(TStringBuf s) {
static const size_t chunkSize = sizeof(typename TParent::TChunk) * 8;
static const size_t numDig = chunkSize / 4;
static const size_t highChunkBits = (BitsetSize + chunkSize - 1) % chunkSize + 1;
@@ -326,7 +326,7 @@ public:
}
// TODO: Get rid of exceptions at all
- bool TryFromString(TStringBuf s) {
+ bool TryFromString(TStringBuf s) {
try {
FromString(s);
} catch (...) {
diff --git a/library/cpp/http/io/headers.h b/library/cpp/http/io/headers.h
index a71793d1c6..1ce789faf9 100644
--- a/library/cpp/http/io/headers.h
+++ b/library/cpp/http/io/headers.h
@@ -112,7 +112,7 @@ public:
/// Записывает все заголовки контейнера в поток.
/// @details Каждый заголовк записывается в виде "имя параметра: значение\r\n".
void OutTo(IOutputStream* stream) const;
-
+
/// Обменивает наборы заголовков двух контейнеров.
void Swap(THttpHeaders& headers) noexcept {
Headers_.swap(headers.Headers_);
diff --git a/library/cpp/http/io/stream.cpp b/library/cpp/http/io/stream.cpp
index 6689be684f..2e4c6b3f2e 100644
--- a/library/cpp/http/io/stream.cpp
+++ b/library/cpp/http/io/stream.cpp
@@ -200,10 +200,10 @@ public:
return ContentEncoded_;
}
- inline bool HasContent() const noexcept {
- return HasContentLength_ || ChunkedInput_;
- }
-
+ inline bool HasContent() const noexcept {
+ return HasContentLength_ || ChunkedInput_;
+ }
+
inline bool HasExpect100Continue() const noexcept {
return Expect100Continue_;
}
@@ -273,15 +273,15 @@ private:
}
}
- inline bool IsRequest() const {
+ inline bool IsRequest() const {
return strnicmp(FirstLine().data(), "get", 3) == 0 ||
strnicmp(FirstLine().data(), "post", 4) == 0 ||
strnicmp(FirstLine().data(), "put", 3) == 0 ||
strnicmp(FirstLine().data(), "patch", 5) == 0 ||
strnicmp(FirstLine().data(), "head", 4) == 0 ||
strnicmp(FirstLine().data(), "delete", 6) == 0;
- }
-
+ }
+
inline void BuildInputChain() {
TParsedHeaders p;
@@ -344,7 +344,7 @@ private:
Buffered_.Reset(&Cnull);
Input_ = Streams_.Add(new TMultiInput(&Buffered_, Slave_));
- if (IsRequest() || HasContentLength_) {
+ if (IsRequest() || HasContentLength_) {
/*
* TODO - we have other cases
*/
@@ -448,10 +448,10 @@ bool THttpInput::ContentEncoded() const noexcept {
return Impl_->ContentEncoded();
}
-bool THttpInput::HasContent() const noexcept {
- return Impl_->HasContent();
-}
-
+bool THttpInput::HasContent() const noexcept {
+ return Impl_->HasContent();
+}
+
bool THttpInput::HasExpect100Continue() const noexcept {
return Impl_->HasExpect100Continue();
}
@@ -663,7 +663,7 @@ private:
static inline size_t ParseHttpVersion(const TString& s) {
if (s.empty()) {
ythrow THttpParseException() << "malformed http stream";
- }
+ }
size_t parsed_version = 0;
@@ -804,7 +804,7 @@ private:
return ret;
}
-
+
inline void RebuildStream() {
bool keepAlive = false;
const TCompressionCodecFactory::TEncoderConstructor* encoder = nullptr;
diff --git a/library/cpp/http/io/stream.h b/library/cpp/http/io/stream.h
index 78ca4fc814..a552b36218 100644
--- a/library/cpp/http/io/stream.h
+++ b/library/cpp/http/io/stream.h
@@ -81,9 +81,9 @@ public:
/// показывает объём запакованных данных, а из THttpInput мы будем вычитывать уже распакованные.
bool ContentEncoded() const noexcept;
- /// Returns true if Content-Length or Transfer-Encoding header received
- bool HasContent() const noexcept;
-
+ /// Returns true if Content-Length or Transfer-Encoding header received
+ bool HasContent() const noexcept;
+
bool HasExpect100Continue() const noexcept;
private:
diff --git a/library/cpp/http/io/stream_ut.cpp b/library/cpp/http/io/stream_ut.cpp
index 1ea35df675..9737467bfc 100644
--- a/library/cpp/http/io/stream_ut.cpp
+++ b/library/cpp/http/io/stream_ut.cpp
@@ -1,5 +1,5 @@
#include "stream.h"
-#include "chunk.h"
+#include "chunk.h"
#include <library/cpp/http/server/http_ex.h>
@@ -331,23 +331,23 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
httpOut.Flush();
UNIT_ASSERT_VALUES_EQUAL(checkStr.size(), str.size());
}
-
+
TString MakeHttpOutputBody(const char* body, bool encodingEnabled) {
TString str;
TStringOutput strOut(str);
{
TBufferedOutput bufOut(&strOut, 8192);
THttpOutput httpOut(&bufOut);
-
+
httpOut.EnableKeepAlive(true);
httpOut.EnableCompression(true);
httpOut.EnableBodyEncoding(encodingEnabled);
-
+
httpOut << "POST / HTTP/1.1\r\n";
httpOut << "Host: yandex.ru\r\n";
httpOut << "Content-Encoding: gzip\r\n";
httpOut << "\r\n";
-
+
UNIT_ASSERT_VALUES_EQUAL(str.size(), 0u);
httpOut << body;
}
@@ -376,29 +376,29 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
TString str;
TStringOutput strOut(str);
TBufferedOutput bufOut(&strOut, 8192);
- THttpOutput httpOut(&bufOut);
-
- httpOut.EnableKeepAlive(true);
- httpOut.EnableCompression(true);
-
+ THttpOutput httpOut(&bufOut);
+
+ httpOut.EnableKeepAlive(true);
+ httpOut.EnableCompression(true);
+
const char* header = "GET / HTTP/1.1\r\nHost: yandex.ru\r\n\r\n";
httpOut << header;
-
+
unsigned curLen = str.size();
const char* body = "<html>Hello</html>";
- httpOut << body;
+ httpOut << body;
UNIT_ASSERT_VALUES_EQUAL(curLen, str.size());
httpOut.Finish();
UNIT_ASSERT_VALUES_EQUAL(curLen + strlen(body), str.size());
- }
-
+ }
+
Y_UNIT_TEST(TestMultilineHeaders) {
const char* headerLine0 = "HTTP/1.1 200 OK";
const char* headerLine1 = "Content-Language: en";
const char* headerLine2 = "Vary: Accept-Encoding, ";
const char* headerLine3 = "\tAccept-Language";
const char* headerLine4 = "Content-Length: 18";
-
+
TString endLine("\r\n");
TString r;
r += headerLine0 + endLine;
@@ -564,53 +564,53 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
UNIT_ASSERT_VALUES_EQUAL(httpInput.ReadAll(), "GGLOL");
}
}
-
+
Y_UNIT_TEST(TestInputHasContent) {
- {
- TStringStream request;
+ {
+ TStringStream request;
request << "POST / HTTP/1.1\r\n"
"Host: yandex.ru\r\n"
"\r\n";
- request << "HTTPDATA";
-
- TStringInput input(request.Str());
- THttpInput httpInput(&input);
-
- UNIT_ASSERT(!httpInput.HasContent());
- UNIT_ASSERT_VALUES_EQUAL(httpInput.ReadAll(), "");
- }
-
- {
- TStringStream request;
+ request << "HTTPDATA";
+
+ TStringInput input(request.Str());
+ THttpInput httpInput(&input);
+
+ UNIT_ASSERT(!httpInput.HasContent());
+ UNIT_ASSERT_VALUES_EQUAL(httpInput.ReadAll(), "");
+ }
+
+ {
+ TStringStream request;
request << "POST / HTTP/1.1\r\n"
"Host: yandex.ru\r\n"
"Content-Length: 8"
"\r\n\r\n";
- request << "HTTPDATA";
-
- TStringInput input(request.Str());
- THttpInput httpInput(&input);
-
- UNIT_ASSERT(httpInput.HasContent());
- UNIT_ASSERT_VALUES_EQUAL(httpInput.ReadAll(), "HTTPDATA");
- }
-
- {
- TStringStream request;
+ request << "HTTPDATA";
+
+ TStringInput input(request.Str());
+ THttpInput httpInput(&input);
+
+ UNIT_ASSERT(httpInput.HasContent());
+ UNIT_ASSERT_VALUES_EQUAL(httpInput.ReadAll(), "HTTPDATA");
+ }
+
+ {
+ TStringStream request;
request << "POST / HTTP/1.1\r\n"
"Host: yandex.ru\r\n"
"Transfer-Encoding: chunked"
"\r\n\r\n";
- request << "8\r\nHTTPDATA\r\n0\r\n";
-
- TStringInput input(request.Str());
- THttpInput httpInput(&input);
-
- UNIT_ASSERT(httpInput.HasContent());
- UNIT_ASSERT_VALUES_EQUAL(httpInput.ReadAll(), "HTTPDATA");
- }
- }
-
+ request << "8\r\nHTTPDATA\r\n0\r\n";
+
+ TStringInput input(request.Str());
+ THttpInput httpInput(&input);
+
+ UNIT_ASSERT(httpInput.HasContent());
+ UNIT_ASSERT_VALUES_EQUAL(httpInput.ReadAll(), "HTTPDATA");
+ }
+ }
+
Y_UNIT_TEST(TestHttpInputHeadRequest) {
class THeadOnlyInput: public IInputStream {
public:
diff --git a/library/cpp/http/misc/httpreqdata.cpp b/library/cpp/http/misc/httpreqdata.cpp
index f6951f68cd..216afec6ff 100644
--- a/library/cpp/http/misc/httpreqdata.cpp
+++ b/library/cpp/http/misc/httpreqdata.cpp
@@ -2,7 +2,7 @@
#include <util/stream/mem.h>
-TBaseServerRequestData::TBaseServerRequestData(SOCKET s)
+TBaseServerRequestData::TBaseServerRequestData(SOCKET s)
: Addr(nullptr)
, Host()
, Port()
@@ -14,7 +14,7 @@ TBaseServerRequestData::TBaseServerRequestData(SOCKET s)
{
}
-TBaseServerRequestData::TBaseServerRequestData(const char* qs, SOCKET s)
+TBaseServerRequestData::TBaseServerRequestData(const char* qs, SOCKET s)
: Addr(nullptr)
, Host()
, Port()
@@ -27,21 +27,21 @@ TBaseServerRequestData::TBaseServerRequestData(const char* qs, SOCKET s)
{
}
-void TBaseServerRequestData::AppendQueryString(const char* str, size_t length) {
+void TBaseServerRequestData::AppendQueryString(const char* str, size_t length) {
if (Y_UNLIKELY(Search)) {
Y_ASSERT(strlen(Search) == SearchLength);
- ModifiedQueryString.Reserve(SearchLength + length + 2);
- ModifiedQueryString.Assign(Search, SearchLength);
+ ModifiedQueryString.Reserve(SearchLength + length + 2);
+ ModifiedQueryString.Assign(Search, SearchLength);
if (SearchLength > 0 && Search[SearchLength - 1] != '&' &&
length > 0 && str[0] != '&') {
- ModifiedQueryString.Append('&');
+ ModifiedQueryString.Append('&');
}
- ModifiedQueryString.Append(str, length);
+ ModifiedQueryString.Append(str, length);
} else {
- ModifiedQueryString.Reserve(length + 1);
- ModifiedQueryString.Assign(str, length);
+ ModifiedQueryString.Reserve(length + 1);
+ ModifiedQueryString.Assign(str, length);
}
- ModifiedQueryString.Append('\0');
+ ModifiedQueryString.Append('\0');
Search = ModifiedQueryString.data();
SearchLength = ModifiedQueryString.size() - 1; // ignore terminator
}
@@ -54,7 +54,7 @@ void TBaseServerRequestData::SetRemoteAddr(TStringBuf addr) {
Addr = AddrData;
}
-const char* TBaseServerRequestData::RemoteAddr() const {
+const char* TBaseServerRequestData::RemoteAddr() const {
if (!Addr) {
*AddrData = 0;
GetRemoteAddr(Socket, AddrData, sizeof(AddrData));
@@ -89,7 +89,7 @@ TString TBaseServerRequestData::HeaderByIndex(size_t n) const noexcept {
return TString(i->first) + TStringBuf(": ") + i->second;
}
-const char* TBaseServerRequestData::Environment(const char* key) const {
+const char* TBaseServerRequestData::Environment(const char* key) const {
if (stricmp(key, "REMOTE_ADDR") == 0) {
const char* ip = HeaderIn("X-Real-IP");
if (ip)
@@ -107,7 +107,7 @@ const char* TBaseServerRequestData::Environment(const char* key) const {
return nullptr;
}
-void TBaseServerRequestData::Clear() {
+void TBaseServerRequestData::Clear() {
HeadersIn_.clear();
Addr = Path = Search = nullptr;
OrigSearch = {};
@@ -115,11 +115,11 @@ void TBaseServerRequestData::Clear() {
Host.clear();
Port.clear();
CurPage.remove();
- ParseBuf.Clear();
+ ParseBuf.Clear();
BeginTime = MicroSeconds();
}
-const char* TBaseServerRequestData::GetCurPage() const {
+const char* TBaseServerRequestData::GetCurPage() const {
if (!CurPage && Host) {
CurPage = "http://";
CurPage += Host;
@@ -136,10 +136,10 @@ const char* TBaseServerRequestData::GetCurPage() const {
return CurPage.data();
}
-bool TBaseServerRequestData::Parse(const char* origReq) {
+bool TBaseServerRequestData::Parse(const char* origReq) {
size_t origReqLength = strlen(origReq);
- ParseBuf.Assign(origReq, origReqLength + 1);
- char* req = ParseBuf.Data();
+ ParseBuf.Assign(origReq, origReqLength + 1);
+ char* req = ParseBuf.Data();
while (*req == ' ' || *req == '\t')
req++;
diff --git a/library/cpp/http/misc/httpreqdata.h b/library/cpp/http/misc/httpreqdata.h
index 16e59c4d78..d4a12cf8cf 100644
--- a/library/cpp/http/misc/httpreqdata.h
+++ b/library/cpp/http/misc/httpreqdata.h
@@ -13,19 +13,19 @@
#include <util/system/yassert.h>
#include <util/generic/string.h>
#include <util/datetime/base.h>
-#include <util/generic/buffer.h>
+#include <util/generic/buffer.h>
using THttpHeadersContainer = THashMap<TString, TString, TCIOps, TCIOps>;
-class TBaseServerRequestData {
+class TBaseServerRequestData {
public:
- TBaseServerRequestData(SOCKET s = INVALID_SOCKET);
- TBaseServerRequestData(const char* qs, SOCKET s = INVALID_SOCKET);
+ TBaseServerRequestData(SOCKET s = INVALID_SOCKET);
+ TBaseServerRequestData(const char* qs, SOCKET s = INVALID_SOCKET);
void SetHost(const TString& host, ui16 port) {
- Host = host;
- Port = ToString(port);
- }
+ Host = host;
+ Port = ToString(port);
+ }
const TString& ServerName() const {
return Host;
@@ -100,26 +100,26 @@ private:
SOCKET Socket;
ui64 BeginTime;
mutable TString CurPage;
- TBuffer ParseBuf;
- TBuffer ModifiedQueryString;
-};
+ TBuffer ParseBuf;
+ TBuffer ModifiedQueryString;
+};
class TServerRequestData: public TBaseServerRequestData {
public:
- TServerRequestData(SOCKET s = INVALID_SOCKET)
- : TBaseServerRequestData(s)
- {
- }
- TServerRequestData(const char* qs, SOCKET s = INVALID_SOCKET)
- : TBaseServerRequestData(qs, s)
- {
- Scan();
- }
-
- void Scan() {
- CgiParam.Scan(QueryStringBuf());
- }
-
-public:
+ TServerRequestData(SOCKET s = INVALID_SOCKET)
+ : TBaseServerRequestData(s)
+ {
+ }
+ TServerRequestData(const char* qs, SOCKET s = INVALID_SOCKET)
+ : TBaseServerRequestData(qs, s)
+ {
+ Scan();
+ }
+
+ void Scan() {
+ CgiParam.Scan(QueryStringBuf());
+ }
+
+public:
TCgiParameters CgiParam;
};
diff --git a/library/cpp/http/server/http_ex.cpp b/library/cpp/http/server/http_ex.cpp
index e07db22bfc..d90049387a 100644
--- a/library/cpp/http/server/http_ex.cpp
+++ b/library/cpp/http/server/http_ex.cpp
@@ -4,10 +4,10 @@
#include <util/generic/cast.h>
#include <util/stream/null.h>
-bool THttpClientRequestExtension::Parse(char* req, TBaseServerRequestData& rd) {
- rd.SetSocket(Socket());
+bool THttpClientRequestExtension::Parse(char* req, TBaseServerRequestData& rd) {
+ rd.SetSocket(Socket());
- if (!rd.Parse(req)) {
+ if (!rd.Parse(req)) {
Output() << "HTTP/1.1 403 Forbidden\r\n"
"Content-Type: text/plain\r\n"
"Content-Length: 39\r\n"
@@ -20,7 +20,7 @@ bool THttpClientRequestExtension::Parse(char* req, TBaseServerRequestData& rd) {
return true;
}
-bool THttpClientRequestExtension::ProcessHeaders(TBaseServerRequestData& rd, TBlob& postData) {
+bool THttpClientRequestExtension::ProcessHeaders(TBaseServerRequestData& rd, TBlob& postData) {
for (const auto& header : ParsedHeaders) {
rd.AddHeader(header.first, header.second);
}
diff --git a/library/cpp/http/server/http_ex.h b/library/cpp/http/server/http_ex.h
index 1ef43ea4fd..ba982796d3 100644
--- a/library/cpp/http/server/http_ex.h
+++ b/library/cpp/http/server/http_ex.h
@@ -5,24 +5,24 @@
#include <library/cpp/http/misc/httpreqdata.h>
class THttpClientRequestExtension: public TClientRequest {
-public:
- bool Parse(char* req, TBaseServerRequestData& rd);
- bool ProcessHeaders(TBaseServerRequestData& rd, TBlob& postData);
-};
+public:
+ bool Parse(char* req, TBaseServerRequestData& rd);
+ bool ProcessHeaders(TBaseServerRequestData& rd, TBlob& postData);
+};
-template <class TRequestData>
+template <class TRequestData>
class THttpClientRequestExtImpl: public THttpClientRequestExtension {
protected:
- bool Parse(char* req) {
- return THttpClientRequestExtension::Parse(req, RD);
- }
- bool ProcessHeaders() {
- return THttpClientRequestExtension::ProcessHeaders(RD, Buf);
- }
+ bool Parse(char* req) {
+ return THttpClientRequestExtension::Parse(req, RD);
+ }
+ bool ProcessHeaders() {
+ return THttpClientRequestExtension::ProcessHeaders(RD, Buf);
+ }
-protected:
- TRequestData RD;
+protected:
+ TRequestData RD;
TBlob Buf;
};
-
-using THttpClientRequestEx = THttpClientRequestExtImpl<TServerRequestData>;
+
+using THttpClientRequestEx = THttpClientRequestExtImpl<TServerRequestData>;
diff --git a/library/cpp/streams/bzip2/bzip2.cpp b/library/cpp/streams/bzip2/bzip2.cpp
index bccc5c6807..d2c02e3bae 100644
--- a/library/cpp/streams/bzip2/bzip2.cpp
+++ b/library/cpp/streams/bzip2/bzip2.cpp
@@ -182,23 +182,23 @@ TBZipCompress::~TBZipCompress() {
}
void TBZipCompress::DoWrite(const void* buf, size_t size) {
- if (!Impl_) {
+ if (!Impl_) {
ythrow TBZipCompressError() << "can not write to finished bzip stream";
- }
-
+ }
+
Impl_->Write(buf, size);
}
void TBZipCompress::DoFlush() {
if (Impl_) {
- Impl_->Flush();
- }
+ Impl_->Flush();
+ }
}
void TBZipCompress::DoFinish() {
- THolder<TImpl> impl(Impl_.Release());
-
+ THolder<TImpl> impl(Impl_.Release());
+
if (impl) {
- impl->Finish();
- }
+ impl->Finish();
+ }
}
diff --git a/library/cpp/streams/lz/lz.cpp b/library/cpp/streams/lz/lz.cpp
index b65bb3ed96..e743797968 100644
--- a/library/cpp/streams/lz/lz.cpp
+++ b/library/cpp/streams/lz/lz.cpp
@@ -41,12 +41,12 @@ public:
*/
static_assert(sizeof(TCompressor::signature) - 1 == SIGNATURE_SIZE, "expect sizeof(TCompressor::signature) - 1 == SIGNATURE_SIZE");
Slave_->Write(TCompressor::signature, sizeof(TCompressor::signature) - 1);
-
+
/*
* save version
*/
this->Save((ui32)1);
-
+
/*
* save block size
*/
diff --git a/library/cpp/streams/lzma/lzma.cpp b/library/cpp/streams/lzma/lzma.cpp
index f1942fa546..011b450436 100644
--- a/library/cpp/streams/lzma/lzma.cpp
+++ b/library/cpp/streams/lzma/lzma.cpp
@@ -495,10 +495,10 @@ void TLzmaCompress::DoWrite(const void* buf, size_t len) {
}
void TLzmaCompress::DoFinish() {
- THolder<TImpl> impl(Impl_.Release());
-
+ THolder<TImpl> impl(Impl_.Release());
+
if (impl) {
- impl->Finish();
+ impl->Finish();
}
}
diff --git a/library/cpp/threading/atomic/bool.cpp b/library/cpp/threading/atomic/bool.cpp
index 37917e01f1..9dd6d2cc7e 100644
--- a/library/cpp/threading/atomic/bool.cpp
+++ b/library/cpp/threading/atomic/bool.cpp
@@ -1 +1 @@
-#include "bool.h"
+#include "bool.h"
diff --git a/library/cpp/threading/atomic/bool.h b/library/cpp/threading/atomic/bool.h
index d52544e762..13b5e5356a 100644
--- a/library/cpp/threading/atomic/bool.h
+++ b/library/cpp/threading/atomic/bool.h
@@ -1,36 +1,36 @@
#pragma once
-#include <util/system/atomic.h>
-
-namespace NAtomic {
- class TBool {
- public:
- TBool() noexcept = default;
-
- TBool(bool val) noexcept
- : Val_(val)
- {
- }
-
+#include <util/system/atomic.h>
+
+namespace NAtomic {
+ class TBool {
+ public:
+ TBool() noexcept = default;
+
+ TBool(bool val) noexcept
+ : Val_(val)
+ {
+ }
+
TBool(const TBool& src) noexcept {
AtomicSet(Val_, AtomicGet(src.Val_));
}
- operator bool() const noexcept {
- return AtomicGet(Val_);
- }
-
+ operator bool() const noexcept {
+ return AtomicGet(Val_);
+ }
+
const TBool& operator=(bool val) noexcept {
- AtomicSet(Val_, val);
- return *this;
- }
-
+ AtomicSet(Val_, val);
+ return *this;
+ }
+
const TBool& operator=(const TBool& src) noexcept {
- AtomicSet(Val_, AtomicGet(src.Val_));
- return *this;
- }
-
- private:
- TAtomic Val_ = 0;
- };
+ AtomicSet(Val_, AtomicGet(src.Val_));
+ return *this;
+ }
+
+ private:
+ TAtomic Val_ = 0;
+ };
}
diff --git a/library/cpp/threading/atomic/bool_ut.cpp b/library/cpp/threading/atomic/bool_ut.cpp
index 9481f41d8d..4f417e090f 100644
--- a/library/cpp/threading/atomic/bool_ut.cpp
+++ b/library/cpp/threading/atomic/bool_ut.cpp
@@ -1,31 +1,31 @@
-#include "bool.h"
-
+#include "bool.h"
+
#include <library/cpp/testing/unittest/registar.h>
-
+
Y_UNIT_TEST_SUITE(AtomicBool) {
Y_UNIT_TEST(ReadWrite) {
- NAtomic::TBool v;
-
- UNIT_ASSERT_VALUES_EQUAL((bool)v, false);
-
- v = true;
-
- UNIT_ASSERT_VALUES_EQUAL((bool)v, true);
-
- v = false;
-
- UNIT_ASSERT_VALUES_EQUAL((bool)v, false);
-
- NAtomic::TBool v2;
-
- UNIT_ASSERT(v == v2);
-
- v2 = true;
-
- UNIT_ASSERT(v != v2);
-
- v = v2;
-
- UNIT_ASSERT(v == v2);
- }
-}
+ NAtomic::TBool v;
+
+ UNIT_ASSERT_VALUES_EQUAL((bool)v, false);
+
+ v = true;
+
+ UNIT_ASSERT_VALUES_EQUAL((bool)v, true);
+
+ v = false;
+
+ UNIT_ASSERT_VALUES_EQUAL((bool)v, false);
+
+ NAtomic::TBool v2;
+
+ UNIT_ASSERT(v == v2);
+
+ v2 = true;
+
+ UNIT_ASSERT(v != v2);
+
+ v = v2;
+
+ UNIT_ASSERT(v == v2);
+ }
+}
diff --git a/library/cpp/threading/atomic/ut/ya.make b/library/cpp/threading/atomic/ut/ya.make
index 3c555685df..2cdf002704 100644
--- a/library/cpp/threading/atomic/ut/ya.make
+++ b/library/cpp/threading/atomic/ut/ya.make
@@ -1,9 +1,9 @@
UNITTEST_FOR(library/cpp/threading/atomic)
-
-OWNER(vmordovin)
-
-SRCS(
- bool_ut.cpp
-)
-
-END()
+
+OWNER(vmordovin)
+
+SRCS(
+ bool_ut.cpp
+)
+
+END()
diff --git a/library/cpp/threading/atomic/ya.make b/library/cpp/threading/atomic/ya.make
index c3a3ef8a76..6d7989bff0 100644
--- a/library/cpp/threading/atomic/ya.make
+++ b/library/cpp/threading/atomic/ya.make
@@ -1,9 +1,9 @@
-LIBRARY()
-
-OWNER(vmordovin)
-
-SRCS(
- bool.cpp
-)
-
-END()
+LIBRARY()
+
+OWNER(vmordovin)
+
+SRCS(
+ bool.cpp
+)
+
+END()
diff --git a/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp b/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp
index 3b5203194a..d94e4bfeab 100644
--- a/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp
+++ b/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp
@@ -1,86 +1,86 @@
-#include <algorithm>
+#include <algorithm>
#include <library/cpp/testing/unittest/registar.h>
-
+
#include <util/stream/output.h>
#include <util/system/atomic.h>
#include <util/generic/vector.h>
-
+
#include "task_scheduler.h"
-
-class TTaskSchedulerTest: public TTestBase {
- UNIT_TEST_SUITE(TTaskSchedulerTest);
- UNIT_TEST(Test);
- UNIT_TEST_SUITE_END();
-
+
+class TTaskSchedulerTest: public TTestBase {
+ UNIT_TEST_SUITE(TTaskSchedulerTest);
+ UNIT_TEST(Test);
+ UNIT_TEST_SUITE_END();
+
class TCheckTask: public TTaskScheduler::IRepeatedTask {
- public:
+ public:
TCheckTask(const TDuration& delay)
: Start_(Now())
, Delay_(delay)
- {
+ {
AtomicIncrement(ScheduledTaskCounter_);
- }
-
+ }
+
~TCheckTask() override {
- }
-
+ }
+
bool Process() override {
const TDuration delay = Now() - Start_;
-
+
if (delay < Delay_) {
AtomicIncrement(BadTimeoutCounter_);
- }
-
+ }
+
AtomicIncrement(ExecutedTaskCounter_);
return false;
- }
-
- static bool AllTaskExecuted() {
+ }
+
+ static bool AllTaskExecuted() {
return AtomicGet(ScheduledTaskCounter_) == AtomicGet(ExecutedTaskCounter_);
- }
-
- static size_t BadTimeoutCount() {
+ }
+
+ static size_t BadTimeoutCount() {
return AtomicGet(BadTimeoutCounter_);
- }
-
- private:
+ }
+
+ private:
TInstant Start_;
TDuration Delay_;
static TAtomic BadTimeoutCounter_;
static TAtomic ScheduledTaskCounter_;
static TAtomic ExecutedTaskCounter_;
- };
-
- public:
- inline void Test() {
- ScheduleCheckTask(200);
- ScheduleCheckTask(100);
- ScheduleCheckTask(1000);
- ScheduleCheckTask(10000);
- ScheduleCheckTask(5000);
-
+ };
+
+ public:
+ inline void Test() {
+ ScheduleCheckTask(200);
+ ScheduleCheckTask(100);
+ ScheduleCheckTask(1000);
+ ScheduleCheckTask(10000);
+ ScheduleCheckTask(5000);
+
Scheduler_.Start();
-
- usleep(1000000);
-
- UNIT_ASSERT_EQUAL(TCheckTask::BadTimeoutCount(), 0);
- UNIT_ASSERT(TCheckTask::AllTaskExecuted());
- }
-
- private:
- void ScheduleCheckTask(size_t delay) {
+
+ usleep(1000000);
+
+ UNIT_ASSERT_EQUAL(TCheckTask::BadTimeoutCount(), 0);
+ UNIT_ASSERT(TCheckTask::AllTaskExecuted());
+ }
+
+ private:
+ void ScheduleCheckTask(size_t delay) {
TDuration d = TDuration::MicroSeconds(delay);
Scheduler_.Add(new TCheckTask(d), d);
- }
-
- private:
+ }
+
+ private:
TTaskScheduler Scheduler_;
-};
-
+};
+
TAtomic TTaskSchedulerTest::TCheckTask::BadTimeoutCounter_ = 0;
TAtomic TTaskSchedulerTest::TCheckTask::ScheduledTaskCounter_ = 0;
TAtomic TTaskSchedulerTest::TCheckTask::ExecutedTaskCounter_ = 0;
-
-UNIT_TEST_SUITE_REGISTRATION(TTaskSchedulerTest);
+
+UNIT_TEST_SUITE_REGISTRATION(TTaskSchedulerTest);
diff --git a/library/cpp/ya.make b/library/cpp/ya.make
index 8c1193b007..8a338d3b9a 100644
--- a/library/cpp/ya.make
+++ b/library/cpp/ya.make
@@ -398,7 +398,7 @@ RECURSE(
vowpalwabbit/tools
vowpalwabbit/ut
watchdog
- watchdog/timeout/ut
+ watchdog/timeout/ut
wordlistreader
xml
xmlrpc