aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authormvel <mvel@yandex-team.ru>2022-02-10 16:45:41 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:41 +0300
commit43f5a35593ebc9f6bcea619bb170394ea7ae468e (patch)
treee98df59de24d2ef7c77baed9f41e4875a2fef972 /library/cpp
parentbd30392c4cc92487950adc375c07adf52da1d592 (diff)
downloadydb-43f5a35593ebc9f6bcea619bb170394ea7ae468e.tar.gz
Restoring authorship annotation for <mvel@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/balloc/balloc.cpp26
-rw-r--r--library/cpp/balloc/ya.make6
-rw-r--r--library/cpp/blockcodecs/README.md32
-rw-r--r--library/cpp/blockcodecs/codecs_ut.cpp42
-rw-r--r--library/cpp/blockcodecs/core/codecs.cpp46
-rw-r--r--library/cpp/blockcodecs/core/codecs.h22
-rw-r--r--library/cpp/build_info/build_info.h2
-rw-r--r--library/cpp/build_info/sandbox.cpp.in50
-rw-r--r--library/cpp/build_info/sandbox.h22
-rw-r--r--library/cpp/build_info/ya.make8
-rw-r--r--library/cpp/cgiparam/cgiparam.h8
-rw-r--r--library/cpp/charset/recyr.hh106
-rw-r--r--library/cpp/codecs/float_huffman.h14
-rw-r--r--library/cpp/codecs/ut/float_huffman_ut.cpp362
-rw-r--r--library/cpp/codecs/ut/ya.make6
-rw-r--r--library/cpp/codecs/ya.make6
-rw-r--r--library/cpp/compproto/bit.h10
-rw-r--r--library/cpp/compproto/compproto_ut.cpp198
-rw-r--r--library/cpp/compproto/compressor.h10
-rw-r--r--library/cpp/compproto/huff.h14
-rw-r--r--library/cpp/compproto/metainfo.h18
-rw-r--r--library/cpp/compproto/ya.make4
-rw-r--r--library/cpp/deprecated/mapped_file/mapped_file.cpp6
-rw-r--r--library/cpp/deprecated/mapped_file/mapped_file.h2
-rw-r--r--library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp2
-rw-r--r--library/cpp/digest/md5/md5.cpp14
-rw-r--r--library/cpp/digest/md5/md5.h16
-rw-r--r--library/cpp/digest/md5/md5_medium_ut.cpp6
-rw-r--r--library/cpp/digest/md5/md5_ut.cpp28
-rw-r--r--library/cpp/digest/old_crc/crc.h4
-rw-r--r--library/cpp/getopt/last_getopt_demo/demo.cpp10
-rw-r--r--library/cpp/getopt/small/modchooser.cpp24
-rw-r--r--library/cpp/getopt/small/modchooser.h2
-rw-r--r--library/cpp/getopt/ut/last_getopt_ut.cpp78
-rw-r--r--library/cpp/http/fetch/httpheader.h4
-rw-r--r--library/cpp/http/io/compression_ut.cpp8
-rw-r--r--library/cpp/http/io/stream.cpp26
-rw-r--r--library/cpp/http/io/stream_ut.cpp124
-rw-r--r--library/cpp/http/io/ut/ya.make6
-rw-r--r--library/cpp/http/io/ya.make6
-rw-r--r--library/cpp/http/misc/httpreqdata.h10
-rw-r--r--library/cpp/http/misc/httpreqdata_ut.cpp38
-rw-r--r--library/cpp/http/misc/ya.make6
-rw-r--r--library/cpp/http/server/http.cpp30
-rw-r--r--library/cpp/http/server/http.h2
-rw-r--r--library/cpp/http/server/http_ut.cpp102
-rw-r--r--library/cpp/http/server/options.h14
-rw-r--r--library/cpp/http/server/ya.make4
-rw-r--r--library/cpp/ipv6_address/ipv6_address.cpp2
-rw-r--r--library/cpp/json/ut/json_reader_ut.cpp18
-rw-r--r--library/cpp/json/writer/ya.make2
-rw-r--r--library/cpp/lfalloc/lf_allocX64.h6
-rw-r--r--library/cpp/logger/ya.make8
-rw-r--r--library/cpp/messagebus/misc/tokenquota.h4
-rw-r--r--library/cpp/messagebus/network.cpp2
-rw-r--r--library/cpp/on_disk/chunks/reader.cpp12
-rw-r--r--library/cpp/packedtypes/longs.h62
-rw-r--r--library/cpp/packedtypes/packed.h4
-rw-r--r--library/cpp/packedtypes/packed_ut.cpp108
-rw-r--r--library/cpp/streams/lz/lz.cpp14
-rw-r--r--library/cpp/streams/lz/lz_ut.cpp158
-rw-r--r--library/cpp/string_utils/scan/scan.h6
-rw-r--r--library/cpp/testing/unittest/checks.cpp4
-rw-r--r--library/cpp/threading/future/ya.make8
-rw-r--r--library/cpp/unicode/normalization/ut/normalization_ut.cpp42
-rw-r--r--library/cpp/unicode/normalization/ut/ya.make24
-rw-r--r--library/cpp/uri/ya.make6
67 files changed, 1037 insertions, 1037 deletions
diff --git a/library/cpp/balloc/balloc.cpp b/library/cpp/balloc/balloc.cpp
index 4fb8cdfc65..fab489db4c 100644
--- a/library/cpp/balloc/balloc.cpp
+++ b/library/cpp/balloc/balloc.cpp
@@ -200,12 +200,12 @@ void operator delete[](void* p, const std::nothrow_t&) OP_THROWNOTHING {
#endif
}
-extern "C" void* calloc(size_t n, size_t elemSize) {
- const size_t size = n * elemSize;
+extern "C" void* calloc(size_t n, size_t elemSize) {
+ const size_t size = n * elemSize;
- if (elemSize != 0 && size / elemSize != n) {
- return nullptr;
- }
+ if (elemSize != 0 && size / elemSize != n) {
+ return nullptr;
+ }
#if defined(Y_COVER_PTR)
void* result = malloc(size);
@@ -213,7 +213,7 @@ extern "C" void* calloc(size_t n, size_t elemSize) {
void* result = NBalloc::Malloc(size);
#endif
- if (result) {
+ if (result) {
memset(result, 0, size);
}
@@ -231,19 +231,19 @@ extern "C" void cfree(void* ptr) {
#if defined(Y_COVER_PTR)
static inline void* DoRealloc(void* oldPtr, size_t newSize) {
#else
-extern "C" void* realloc(void* oldPtr, size_t newSize) {
+extern "C" void* realloc(void* oldPtr, size_t newSize) {
#endif
- if (!oldPtr) {
+ if (!oldPtr) {
void* result = NBalloc::Malloc(newSize);
return result;
}
if (newSize == 0) {
NBalloc::Free(oldPtr);
- return nullptr;
+ return nullptr;
}
void* newPtr = NBalloc::Malloc(newSize);
- if (!newPtr) {
- return nullptr;
+ if (!newPtr) {
+ return nullptr;
}
NBalloc::TAllocHeader* header = (NBalloc::TAllocHeader*)oldPtr - 1;
const size_t oldSize = header->AllocSize & ~NBalloc::SIGNATURE_MASK;
@@ -253,8 +253,8 @@ extern "C" void* realloc(void* oldPtr, size_t newSize) {
NBalloc::Free(oldPtr);
return newPtr;
}
- NMalloc::AbortFromCorruptedAllocator();
- return nullptr;
+ NMalloc::AbortFromCorruptedAllocator();
+ return nullptr;
}
#if defined(Y_COVER_PTR)
diff --git a/library/cpp/balloc/ya.make b/library/cpp/balloc/ya.make
index 84b634c24e..d4457fbba9 100644
--- a/library/cpp/balloc/ya.make
+++ b/library/cpp/balloc/ya.make
@@ -1,9 +1,9 @@
LIBRARY()
-OWNER(
- ironpeter
+OWNER(
+ ironpeter
g:base
-)
+)
NO_UTIL()
NO_COMPILER_WARNINGS()
diff --git a/library/cpp/blockcodecs/README.md b/library/cpp/blockcodecs/README.md
index b8e9bf16dc..417917a475 100644
--- a/library/cpp/blockcodecs/README.md
+++ b/library/cpp/blockcodecs/README.md
@@ -1,20 +1,20 @@
-This is a simple library for block data compression (this means data is compressed/uncompressed
+This is a simple library for block data compression (this means data is compressed/uncompressed
by whole blocks in memory). It's a lite-version of the `library/cpp/codecs`. Lite here means that it
-provide only well-known compression algorithms, without the possibility of learning.
-
-There are two possible ways to work with it.
-
-Codec by name
-=============
-Use `NBlockCodec::Codec` to obtain the codec by name. The codec can be asked to compress
-or decompress something and in various ways.
-
-To get a full list of codecs there is a function `NBlockCodecs::ListAllCodecs()`.
-
-Streaming
-=========
-Use `stream.h` to obtain simple streams over block codecs (buffer data, compress them by blocks,
-write to the resulting stream).
+provide only well-known compression algorithms, without the possibility of learning.
+
+There are two possible ways to work with it.
+
+Codec by name
+=============
+Use `NBlockCodec::Codec` to obtain the codec by name. The codec can be asked to compress
+or decompress something and in various ways.
+
+To get a full list of codecs there is a function `NBlockCodecs::ListAllCodecs()`.
+
+Streaming
+=========
+Use `stream.h` to obtain simple streams over block codecs (buffer data, compress them by blocks,
+write to the resulting stream).
Using codec plugins
===================
diff --git a/library/cpp/blockcodecs/codecs_ut.cpp b/library/cpp/blockcodecs/codecs_ut.cpp
index f9e876327b..bfe5a23690 100644
--- a/library/cpp/blockcodecs/codecs_ut.cpp
+++ b/library/cpp/blockcodecs/codecs_ut.cpp
@@ -269,27 +269,27 @@ Y_UNIT_TEST_SUITE(TBlockCodecsTest) {
Y_UNIT_TEST(TestStreams19) {
TestStreams(20, 19);
}
-
- Y_UNIT_TEST(TestMaxPossibleDecompressedSize) {
-
- UNIT_ASSERT_VALUES_EQUAL(GetMaxPossibleDecompressedLength(), Max<size_t>());
-
- TVector<char> input(10001, ' ');
- TCodecList codecs = ListAllCodecs();
- SetMaxPossibleDecompressedLength(10000);
-
- for (const auto& codec : codecs) {
- const ICodec* c = Codec(codec);
- TBuffer inputBuffer(input.data(), input.size());
- TBuffer output;
- TBuffer decompressed;
- c->Encode(inputBuffer, output);
- UNIT_ASSERT_EXCEPTION(c->Decode(output, decompressed), yexception);
- }
-
- // restore status quo
- SetMaxPossibleDecompressedLength(Max<size_t>());
- }
+
+ Y_UNIT_TEST(TestMaxPossibleDecompressedSize) {
+
+ UNIT_ASSERT_VALUES_EQUAL(GetMaxPossibleDecompressedLength(), Max<size_t>());
+
+ TVector<char> input(10001, ' ');
+ TCodecList codecs = ListAllCodecs();
+ SetMaxPossibleDecompressedLength(10000);
+
+ for (const auto& codec : codecs) {
+ const ICodec* c = Codec(codec);
+ TBuffer inputBuffer(input.data(), input.size());
+ TBuffer output;
+ TBuffer decompressed;
+ c->Encode(inputBuffer, output);
+ UNIT_ASSERT_EXCEPTION(c->Decode(output, decompressed), yexception);
+ }
+
+ // restore status quo
+ SetMaxPossibleDecompressedLength(Max<size_t>());
+ }
Y_UNIT_TEST(TestListAllCodecs) {
static const TString ALL_CODECS =
diff --git a/library/cpp/blockcodecs/core/codecs.cpp b/library/cpp/blockcodecs/core/codecs.cpp
index 332b671221..21506e812b 100644
--- a/library/cpp/blockcodecs/core/codecs.cpp
+++ b/library/cpp/blockcodecs/core/codecs.cpp
@@ -64,9 +64,9 @@ namespace {
TVector<TCodecPtr> Codecs;
typedef THashMap<TStringBuf, ICodec*> TRegistry;
TRegistry Registry;
-
- // SEARCH-8344: Global decompressed size limiter (to prevent remote DoS)
- size_t MaxPossibleDecompressedLength = Max<size_t>();
+
+ // SEARCH-8344: Global decompressed size limiter (to prevent remote DoS)
+ size_t MaxPossibleDecompressedLength = Max<size_t>();
};
}
@@ -94,25 +94,25 @@ void NBlockCodecs::RegisterAlias(TStringBuf from, TStringBuf to) {
Singleton<TCodecFactory>()->Alias(from, to);
}
-void NBlockCodecs::SetMaxPossibleDecompressedLength(size_t maxPossibleDecompressedLength) {
- Singleton<TCodecFactory>()->MaxPossibleDecompressedLength = maxPossibleDecompressedLength;
-}
-
-size_t NBlockCodecs::GetMaxPossibleDecompressedLength() {
- return Singleton<TCodecFactory>()->MaxPossibleDecompressedLength;
-}
-
-size_t ICodec::GetDecompressedLength(const TData& in) const {
- const size_t len = DecompressedLength(in);
-
- Y_ENSURE(
- len <= NBlockCodecs::GetMaxPossibleDecompressedLength(),
- "Attempt to decompress the block that is larger than maximum possible decompressed length, "
- "see SEARCH-8344 for details. "
- );
- return len;
-}
-
+void NBlockCodecs::SetMaxPossibleDecompressedLength(size_t maxPossibleDecompressedLength) {
+ Singleton<TCodecFactory>()->MaxPossibleDecompressedLength = maxPossibleDecompressedLength;
+}
+
+size_t NBlockCodecs::GetMaxPossibleDecompressedLength() {
+ return Singleton<TCodecFactory>()->MaxPossibleDecompressedLength;
+}
+
+size_t ICodec::GetDecompressedLength(const TData& in) const {
+ const size_t len = DecompressedLength(in);
+
+ Y_ENSURE(
+ len <= NBlockCodecs::GetMaxPossibleDecompressedLength(),
+ "Attempt to decompress the block that is larger than maximum possible decompressed length, "
+ "see SEARCH-8344 for details. "
+ );
+ return len;
+}
+
void ICodec::Encode(const TData& in, TBuffer& out) const {
const size_t maxLen = MaxCompressedLength(in);
@@ -121,7 +121,7 @@ void ICodec::Encode(const TData& in, TBuffer& out) const {
}
void ICodec::Decode(const TData& in, TBuffer& out) const {
- const size_t len = GetDecompressedLength(in);
+ const size_t len = GetDecompressedLength(in);
out.Reserve(len);
out.Resize(Decompress(in, out.Data()));
diff --git a/library/cpp/blockcodecs/core/codecs.h b/library/cpp/blockcodecs/core/codecs.h
index 2fede1f029..9c93c00274 100644
--- a/library/cpp/blockcodecs/core/codecs.h
+++ b/library/cpp/blockcodecs/core/codecs.h
@@ -39,7 +39,7 @@ namespace NBlockCodecs {
struct ICodec {
virtual ~ICodec();
- // main interface
+ // main interface
virtual size_t DecompressedLength(const TData& in) const = 0;
virtual size_t MaxCompressedLength(const TData& in) const = 0;
virtual size_t Compress(const TData& in, void* out) const = 0;
@@ -47,7 +47,7 @@ namespace NBlockCodecs {
virtual TStringBuf Name() const noexcept = 0;
- // some useful helpers
+ // some useful helpers
void Encode(const TData& in, TBuffer& out) const;
void Decode(const TData& in, TBuffer& out) const;
@@ -69,22 +69,22 @@ namespace NBlockCodecs {
return out;
}
- private:
- size_t GetDecompressedLength(const TData& in) const;
+ private:
+ size_t GetDecompressedLength(const TData& in) const;
};
using TCodecPtr = THolder<ICodec>;
const ICodec* Codec(const TStringBuf& name);
- // some aux methods
+ // some aux methods
typedef TVector<TStringBuf> TCodecList;
TCodecList ListAllCodecs();
TString ListAllCodecsAsString();
-
- // SEARCH-8344: Get the size of max possible decompressed block
- size_t GetMaxPossibleDecompressedLength();
- // SEARCH-8344: Globally set the size of max possible decompressed block
- void SetMaxPossibleDecompressedLength(size_t maxPossibleDecompressedLength);
-
+
+ // SEARCH-8344: Get the size of max possible decompressed block
+ size_t GetMaxPossibleDecompressedLength();
+ // SEARCH-8344: Globally set the size of max possible decompressed block
+ void SetMaxPossibleDecompressedLength(size_t maxPossibleDecompressedLength);
+
}
diff --git a/library/cpp/build_info/build_info.h b/library/cpp/build_info/build_info.h
index d8e3843f03..a494870ba3 100644
--- a/library/cpp/build_info/build_info.h
+++ b/library/cpp/build_info/build_info.h
@@ -1,6 +1,6 @@
#pragma once
-#include "sandbox.h"
+#include "sandbox.h"
#include "build_info_static.h"
#if defined(__cplusplus)
diff --git a/library/cpp/build_info/sandbox.cpp.in b/library/cpp/build_info/sandbox.cpp.in
index 071268c197..ac3b2d9004 100644
--- a/library/cpp/build_info/sandbox.cpp.in
+++ b/library/cpp/build_info/sandbox.cpp.in
@@ -1,27 +1,27 @@
#include <library/cpp/build_info/sandbox.h>
#include <library/cpp/string_utils/base64/base64.h>
-#include <util/generic/string.h>
-#include <util/string/subst.h>
-
-extern "C" const char* GetSandboxTaskId() {
- return "@SANDBOX_TASK_ID@";
-}
-
-class TKosherVersionHolder {
-public:
- const char* Version() const {
- if (!Version_) {
- TString version = "@KOSHER_SVN_VERSION@";
- SubstGlobal(version, ".", "=");
- Version_ = Base64Decode(version);
- }
- return Version_.c_str();
- }
-private:
- mutable TString Version_;
-};
-
-// Experimental code for RMDEV-365
-extern "C" const char* GetKosherSvnVersion() {
- return Singleton<TKosherVersionHolder>()->Version();
-}
+#include <util/generic/string.h>
+#include <util/string/subst.h>
+
+extern "C" const char* GetSandboxTaskId() {
+ return "@SANDBOX_TASK_ID@";
+}
+
+class TKosherVersionHolder {
+public:
+ const char* Version() const {
+ if (!Version_) {
+ TString version = "@KOSHER_SVN_VERSION@";
+ SubstGlobal(version, ".", "=");
+ Version_ = Base64Decode(version);
+ }
+ return Version_.c_str();
+ }
+private:
+ mutable TString Version_;
+};
+
+// Experimental code for RMDEV-365
+extern "C" const char* GetKosherSvnVersion() {
+ return Singleton<TKosherVersionHolder>()->Version();
+}
diff --git a/library/cpp/build_info/sandbox.h b/library/cpp/build_info/sandbox.h
index 331340db18..924ff89c8c 100644
--- a/library/cpp/build_info/sandbox.h
+++ b/library/cpp/build_info/sandbox.h
@@ -1,12 +1,12 @@
-#pragma once
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
+#pragma once
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
const char* GetSandboxTaskId();
-const char* GetKosherSvnVersion();
-
-#if defined(__cplusplus)
-}
-#endif
+const char* GetKosherSvnVersion();
+
+#if defined(__cplusplus)
+}
+#endif
diff --git a/library/cpp/build_info/ya.make b/library/cpp/build_info/ya.make
index 1ddbe0d7df..99886a8893 100644
--- a/library/cpp/build_info/ya.make
+++ b/library/cpp/build_info/ya.make
@@ -11,12 +11,12 @@ DEFAULT(KOSHER_SVN_VERSION "")
CREATE_BUILDINFO_FOR(buildinfo_data.h)
-PEERDIR(
+PEERDIR(
library/cpp/string_utils/base64
-)
-
+)
+
SRCS(
- sandbox.cpp.in
+ sandbox.cpp.in
build_info.cpp.in
build_info_static.cpp
)
diff --git a/library/cpp/cgiparam/cgiparam.h b/library/cpp/cgiparam/cgiparam.h
index a153461f8b..87d1ab0ad4 100644
--- a/library/cpp/cgiparam/cgiparam.h
+++ b/library/cpp/cgiparam/cgiparam.h
@@ -21,7 +21,7 @@ public:
TCgiParameters() = default;
explicit TCgiParameters(const TStringBuf cgiParamStr) {
- Scan(cgiParamStr);
+ Scan(cgiParamStr);
}
TCgiParameters(std::initializer_list<std::pair<TString, TString>> il);
@@ -75,9 +75,9 @@ public:
Y_PURE_FUNCTION
bool Has(const TStringBuf name) const noexcept {
- const auto pair = equal_range(name);
- return pair.first != pair.second;
- }
+ const auto pair = equal_range(name);
+ return pair.first != pair.second;
+ }
/// Returns value by name
/**
* @note The returned value is CGI-unescaped.
diff --git a/library/cpp/charset/recyr.hh b/library/cpp/charset/recyr.hh
index 7d05a2e268..5ec8734bcf 100644
--- a/library/cpp/charset/recyr.hh
+++ b/library/cpp/charset/recyr.hh
@@ -4,7 +4,7 @@
#include <util/charset/recode_result.h>
#include <util/generic/ptr.h>
-#include <util/generic/yexception.h>
+#include <util/generic/yexception.h>
#include "codepage.h"
#include "doccodes.h"
@@ -18,32 +18,32 @@ template <class TCharType>
inline RECODE_RESULT RecodeToUnicode(ECharset from, const char* in, TCharType* out, size_t inSize, size_t outSize, size_t& inRead, size_t& outWritten) {
static_assert(sizeof(TCharType) > 1, "expect wide character type");
- return NCodepagePrivate::_recodeToUnicode(from, in, out, inSize, outSize, inRead, outWritten);
+ return NCodepagePrivate::_recodeToUnicode(from, in, out, inSize, outSize, inRead, outWritten);
}
template <class TCharType>
inline RECODE_RESULT RecodeFromUnicode(ECharset to, const TCharType* in, char* out, size_t inSize, size_t outSize, size_t& inRead, size_t& outWritten) {
static_assert(sizeof(TCharType) > 1, "expect wide character type");
- return NCodepagePrivate::_recodeFromUnicode(to, in, out, inSize, outSize, inRead, outWritten);
+ return NCodepagePrivate::_recodeFromUnicode(to, in, out, inSize, outSize, inRead, outWritten);
}
inline RECODE_RESULT RecodeFromUnicode(ECharset to, wchar32 rune, char* out, size_t outSize, size_t& outWritten) {
- return NCodepagePrivate::_recodeFromUnicode(to, rune, out, outSize, outWritten);
+ return NCodepagePrivate::_recodeFromUnicode(to, rune, out, outSize, outWritten);
}
template <class TCharType>
-inline RECODE_RESULT RecodeToUnicode(ECharset from, const char* in, TCharType* out, size_t inSize, size_t outSize) {
- size_t inRead = 0;
- size_t outWritten = 0;
- return RecodeToUnicode(from, in, out, inSize, outSize, inRead, outWritten);
+inline RECODE_RESULT RecodeToUnicode(ECharset from, const char* in, TCharType* out, size_t inSize, size_t outSize) {
+ size_t inRead = 0;
+ size_t outWritten = 0;
+ return RecodeToUnicode(from, in, out, inSize, outSize, inRead, outWritten);
}
template <class TCharType>
-inline RECODE_RESULT RecodeFromUnicode(ECharset to, const TCharType* in, char* out, size_t inSize, size_t outSize) {
- size_t inRead = 0;
- size_t outWritten = 0;
- return RecodeFromUnicode(to, in, out, inSize, outSize, inRead, outWritten);
+inline RECODE_RESULT RecodeFromUnicode(ECharset to, const TCharType* in, char* out, size_t inSize, size_t outSize) {
+ size_t inRead = 0;
+ size_t outWritten = 0;
+ return RecodeFromUnicode(to, in, out, inSize, outSize, inRead, outWritten);
}
inline RECODE_RESULT RecodeFromUnicode(ECharset theEncoding, const wchar16* chars, size_t length,
@@ -58,76 +58,76 @@ inline RECODE_RESULT RecodeFromUnicode(ECharset theEncoding, const wchar16* char
}
inline RECODE_RESULT Recode(ECharset from, ECharset to, const char* in, char* out, size_t inSize, size_t outSize, size_t& inRead, size_t& outWritten) {
- inRead = 0;
- outWritten = 0;
+ inRead = 0;
+ outWritten = 0;
- if (!ValidCodepage(to) || !ValidCodepage(from))
+ if (!ValidCodepage(to) || !ValidCodepage(from))
return RECODE_ERROR;
- if (to == from)
- return NCodepagePrivate::_recodeCopy(in, out, inSize, outSize, inRead, outWritten);
-
- if (NCodepagePrivate::NativeCodepage(from) && NCodepagePrivate::NativeCodepage(to)) {
- if (from == CODES_UTF8)
- return NCodepagePrivate::_recodeFromUTF8(to, in, out, inSize, outSize, inRead, outWritten);
- if (to == CODES_UTF8)
- return NCodepagePrivate::_recodeToUTF8(from, in, out, inSize, outSize, inRead, outWritten);
- if (from == CODES_YANDEX)
- return NCodepagePrivate::_recodeFromYandex(to, in, out, inSize, outSize, inRead, outWritten);
- if (to == CODES_YANDEX)
- return NCodepagePrivate::_recodeToYandex(from, in, out, inSize, outSize, inRead, outWritten);
- } else if (NICONVPrivate::CanConvert(from, to)) {
- return NICONVPrivate::RecodeNoThrow(from, to, in, out, inSize, outSize, inRead, outWritten);
+ if (to == from)
+ return NCodepagePrivate::_recodeCopy(in, out, inSize, outSize, inRead, outWritten);
+
+ if (NCodepagePrivate::NativeCodepage(from) && NCodepagePrivate::NativeCodepage(to)) {
+ if (from == CODES_UTF8)
+ return NCodepagePrivate::_recodeFromUTF8(to, in, out, inSize, outSize, inRead, outWritten);
+ if (to == CODES_UTF8)
+ return NCodepagePrivate::_recodeToUTF8(from, in, out, inSize, outSize, inRead, outWritten);
+ if (from == CODES_YANDEX)
+ return NCodepagePrivate::_recodeFromYandex(to, in, out, inSize, outSize, inRead, outWritten);
+ if (to == CODES_YANDEX)
+ return NCodepagePrivate::_recodeToYandex(from, in, out, inSize, outSize, inRead, outWritten);
+ } else if (NICONVPrivate::CanConvert(from, to)) {
+ return NICONVPrivate::RecodeNoThrow(from, to, in, out, inSize, outSize, inRead, outWritten);
}
- size_t wideSize = inSize * 3;
+ size_t wideSize = inSize * 3;
TArrayHolder<wchar16> wide(new wchar16[wideSize]);
size_t wideRead = 0;
size_t wideWritten = 0;
- RECODE_RESULT res = RecodeToUnicode(from, in, wide.Get(), inSize, wideSize, inRead, wideWritten);
+ RECODE_RESULT res = RecodeToUnicode(from, in, wide.Get(), inSize, wideSize, inRead, wideWritten);
if (res != RECODE_OK)
return res;
- res = RecodeFromUnicode(to, wide.Get(), out, wideWritten, outSize, wideRead, outWritten);
+ res = RecodeFromUnicode(to, wide.Get(), out, wideWritten, outSize, wideRead, outWritten);
return res;
}
-inline RECODE_RESULT Recode(ECharset from, ECharset to, const char* in, char* out, size_t inSize, size_t outSize) {
- size_t inRead = 0;
- size_t outWritten = 0;
- return Recode(from, to, in, out, inSize, outSize, inRead, outWritten);
+inline RECODE_RESULT Recode(ECharset from, ECharset to, const char* in, char* out, size_t inSize, size_t outSize) {
+ size_t inRead = 0;
+ size_t outWritten = 0;
+ return Recode(from, to, in, out, inSize, outSize, inRead, outWritten);
}
/**
* Recode from one charset to another; throw an exception if conversion failed
- * @param[in] from the source character set
- * @param[in] to the target character set
+ * @param[in] from the source character set
+ * @param[in] to the target character set
* @param[in] in the input string buffer
* @param[out] out the output string object if conversion was successful
* @return false if conversion was not attempted (charsets were the same),
* true if successful
*/
inline bool Recode(ECharset from, ECharset to, const TStringBuf& in, TString& out) {
- if (to == from)
+ if (to == from)
return false;
- const size_t inSize = in.length();
- const size_t outSize = SingleByteCodepage(to) ? inSize : 3 * inSize;
+ const size_t inSize = in.length();
+ const size_t outSize = SingleByteCodepage(to) ? inSize : 3 * inSize;
out.clear(); // so we don't copy stuff around when resizing
- out.ReserveAndResize(outSize);
+ out.ReserveAndResize(outSize);
- size_t inRead = 0;
- size_t outWritten = 0;
+ size_t inRead = 0;
+ size_t outWritten = 0;
const RECODE_RESULT res = Recode(from, to, in.data(), out.begin(), inSize, outSize, inRead, outWritten);
Y_ENSURE(RECODE_OK == res, "Recode failed. ");
- if (outWritten > outSize)
+ if (outWritten > outSize)
ythrow yexception() << "Recode overrun the buffer: size="
<< outSize << " need=" << outWritten;
- out.remove(outWritten);
+ out.remove(outWritten);
return true;
}
@@ -136,29 +136,29 @@ inline bool Recode(ECharset from, ECharset to, const TStringBuf& in, TString& ou
///////////////////////////////////////////////////////////////////////////////////////
inline TString Recode(ECharset from, ECharset to, const TString& in) {
TString out;
- return to != from && Recode(from, to, in, out) ? out : in;
+ return to != from && Recode(from, to, in, out) ? out : in;
}
inline TString RecodeToYandex(ECharset from, const TString& in) {
- return Recode(from, CODES_YANDEX, in);
+ return Recode(from, CODES_YANDEX, in);
}
inline TString RecodeFromYandex(ECharset to, const TString& in) {
- return Recode(CODES_YANDEX, to, in);
+ return Recode(CODES_YANDEX, to, in);
}
inline TString RecodeToHTMLEntities(ECharset from, const TString& in) {
RECODE_RESULT res;
- size_t outWritten, inRead;
+ size_t outWritten, inRead;
TString out;
out.resize(in.length() * (4 + 4));
- res = NCodepagePrivate::_recodeToHTMLEntities(from, in.c_str(), out.begin(), in.length(), out.length(), inRead, outWritten);
+ res = NCodepagePrivate::_recodeToHTMLEntities(from, in.c_str(), out.begin(), in.length(), out.length(), inRead, outWritten);
if (res == RECODE_EOOUTPUT) { //input contains many 8-byte characters?
out.resize(in.length() * (4 + 8));
- res = NCodepagePrivate::_recodeToHTMLEntities(from, in.c_str(), out.begin(), in.length(), out.length(), inRead, outWritten);
+ res = NCodepagePrivate::_recodeToHTMLEntities(from, in.c_str(), out.begin(), in.length(), out.length(), inRead, outWritten);
}
if (res != RECODE_OK) {
ythrow yexception() << "Recode to HTML entities failed";
}
- out.resize(outWritten - 1);
+ out.resize(outWritten - 1);
return out;
}
diff --git a/library/cpp/codecs/float_huffman.h b/library/cpp/codecs/float_huffman.h
index 234c101b3e..786a8eae1d 100644
--- a/library/cpp/codecs/float_huffman.h
+++ b/library/cpp/codecs/float_huffman.h
@@ -1,8 +1,8 @@
#pragma once
-
+
#include <util/generic/array_ref.h>
-#include <util/generic/vector.h>
-#include <util/generic/strbuf.h>
+#include <util/generic/vector.h>
+#include <util/generic/strbuf.h>
#include <array>
@@ -12,15 +12,15 @@ namespace NCodecs::NFloatHuff {
class TDecoder {
public:
explicit TDecoder(TStringBuf data);
-
+
TVector<float> DecodeAll(size_t sizeHint = 0);
-
+
// Returns number of decoded floats. May be fewer than requested if the EOS is found.
size_t Decode(TArrayRef<float> dest);
-
+
// Returns the number of skipped values.
size_t Skip(size_t count);
-
+
bool HasMore() const;
private:
diff --git a/library/cpp/codecs/ut/float_huffman_ut.cpp b/library/cpp/codecs/ut/float_huffman_ut.cpp
index e02e3f63a8..3156fb1f46 100644
--- a/library/cpp/codecs/ut/float_huffman_ut.cpp
+++ b/library/cpp/codecs/ut/float_huffman_ut.cpp
@@ -1,202 +1,202 @@
#include <library/cpp/codecs/float_huffman.h>
-
+
#include <library/cpp/testing/unittest/registar.h>
-
-#include <util/stream/format.h>
-#include <util/stream/output.h>
+
+#include <util/stream/format.h>
+#include <util/stream/output.h>
#include <library/cpp/string_utils/base64/base64.h>
-
-namespace fh = NCodecs::NFloatHuff;
-
+
+namespace fh = NCodecs::NFloatHuff;
+
Y_UNIT_TEST_SUITE(FloatHuffmanTest) {
- static const float Factors[] = {
- 0.340582, 0.000974026, 0.487168, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0.411765, 0.921569,
- 0.00390625, 0.109371, 0, 1, 0, 0, 0, 0, 0.523322, 0, 1, 0, 0, 0, 0, 0.285714, 1,
- 0.008253, 1, 0, 0, 0.00993935, 0.450213, 0.000974026, 1, 1, 1, 1, 0, 0, 0.20564,
- 0.97561, 0.913896, 1, 1, 0, 1, 0, 0, 0.5, 0, 0, 0, 0.1, 1, 0, 0, 0, 0, 0, 0.450923,
- 0, 0.5, 0, 0, 0.20564, 0, 0.5, 0, 0, 0.20564, 0, 0, 0.0313726, 0, 1, 1, 1, 0.363636,
- 0.5, 0.686073, 0.45121, 0.00574382, 0.366166, 0.413295, 1, 1, 1, 0, 0, 0, 0, 0.160784,
- 0, 0.937255, 0.537255, 0.133333, 0, 0, 0, 0, 0.00392157, 0, 0.333333, 0.027451, 0.0156863,
- 1, 0.105882, 1, 0.00220908, 0.000112501, 0.0111262, 0.102384, 0.00140808, 0.123581,
- 0.29308, 6.57282e-06, 0.00489498, 2.10209e-05, 0.00140559, 5.907e-06, 0, 0.559322,
- 0.559322, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0.794765, 0,
- 0.352648, 0.225904, 1, 0.047619, 0.0107276, 0.399461, 0.0304838, 0.292932, 0.00969929,
- 0, 0, 0.886904, 0.714693, 0, 0.00223213, 0.000544069, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0.00507403, 0, 0, 0, 0, 0, 0.875, 0, 0, 1, 1, 1, 0, 0.20564, 0, 0.00176048, 0,
- 0.000440121, 0, 0, 0, 0.000974026, 0.487168, 0, 0, 0.533333, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 1, 0, 0, 0.723187, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0.206882, 0.00483367, 0.792983, 0.00126106, 1, 0.0313726, 0.470588,
- 0.254902, 0.188235, 0.188235, 0.388235, 0.164706, 0, 0.870588, 0.843137, 0.635294,
- 0.384314, 0.384314, 0.643137, 0, 0, 0, 0, 0, 0, 0, 0, 0.541176, 0, 0.541176, 0, 0,
- 0.0532634, 1, 0, 0, 0, 0.015044, 1, 0, 1, 1, 1, 0.47451, 0.329412, 0.964706, 0, 0,
- 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0.0941176, 0.970588, 0.970588, 0, 0.970588, 0.97561,
- 0, 0.0431373, 0.47451, 0.329412, 0.964706, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0.231373, 0.00392157, 0, 0, 0, 0.054902, 0, 0,
- 1, 0, 0, 0.0235294, 0, 1, 0, 0, 0, 0, 0.34902, 0.0352941, 0.925379, 0.623681, 0,
- 0.954543, 0, 0, 0.00102756, 0.709804, 0.498039, 0.0901961, 0.631373, 0.847059, 0.270588,
- 0.0156863, 0.133333, 0.980392, 1e-12, 1e-12, 1e-12, 1e-12, 0.497159, 0, 0.407487,
- 0, 0, 0, 0.00392157, 0.00202156, 0.046875, 0.187159, 0.046875, 0.15625, 0.434232,
- 0.15625, 0, 2.95083e-07, 0.20564, 0.20564, 0.97561, 0.913896, 0, 0, 0, 0, 0, 0, 0.00784314,
- 0, 0.695525, 1, 0.07205, 0, 0, 0.176471, 0, 0, 0, 1, 1, 0.98, 0.01, 0.01, 0, 0.00690702,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.29078, 0.29078, 1, 0, 0, 0, 0, 0.192157, 0.188235,
- 0.0941176, 0, 0.0313726, 0, 0.141176, 0.207843, 0.0901961, 0.00784314, 0.0784314,
- 0, 0, 0, 0, 0, 0.203922, 0.0196078, 0.34902, 0.0235294, 0.0980392, 0.164706, 0.133333,
- 0.368627, 0, 0.0941176, 0, 1, 0.313726, 0, 0, 0.433582, 0.384508, 0.0532186, 0.0833333,
- 0.01609, 0, 1, 0, 0, 0, 0.0666667, 0, 0, 0, 0, 1, 0, 0.564706, 0.501961, 0, 0, 0,
- 0, 0, 0.0516447, 0.000173065, 0, 0, 0, 0, 0, 0, 0, 0.996309, 0, 0, 0.00392157, 1,
- 0, 0.01, 0, 0, 0, 0, 0, 0.439505, 0.206882, 0.206882, 0.260891, 0, 0.875, 0, 0, 0,
- 0, 0, 0.185657, 1, 1, 0, 0, 0, 0.0332647, 0.206106, 0.0688878, 0.239216, 0, 0, 0,
- 0, 0.054902, 0, 0.101961, 0.160784, 0.180392, 0, 0.737828, 0, 0, 0.875, 0.0142566,
- 0, 0.662745, 1, 0, 0, 0, 0.225806, 0.99992, 0.631373, 0.00392157, 1, 0, 0.143647,
- 0.00270085, 1, 0.231482, 0.246735, 0.0428062, 0, 0, 1, 0, 0.186441, 0.0115358, 0,
- 0.221762, 0, 0.2, 0, 0.0156863, 0, 0, 0, 0.976471, 0, 0.231373, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0.00392157, 0.00392157, 0.0666667, 0, 0, 0, 0, 0.0117647, 0.580392, 0.98737,
- 1, 1, 1, 0, 0, 0, 0.153, 0.847, 0.931373, 0.94697, 0.94697, 0, 0.946294, 0.408118,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0.99992, 0.97561, 0, 0, 0, 0, 0, 0,
- 0.274677, 0.153017, 0, 0.642356, 0, 0, 0.1, 0, 0, 0, 0, 0.327944, 0.327944, 0, 0,
- 0.815686, 0, 0, 0, 0, 0.206106, 0.439126, 0, 0, 0, 0, 0, 1, 1, 1, 0.00392157, 0.232788,
- 0.232465, 0.999899, 0.00309296, 0.0636097, 0.445954, 0.156863, 0, 0, 0, 0, 0, 0,
- 0.3796, 0.0784, 0.0651664, 0, 0, 0.254902, 0.266667, 1, 0, 0, 0, 0, 0, 0.596073,
- 0.517876, 0.145833, 0.372549, 0, 0.991667, 0.602125, 0.161979, 0, 0, 0, 0, 0.0255146,
- 0.947855, 0, 0, 0, 0, 0, 0, 0, 0, 0.847059, 0.679841, 0, 0.156863, 0, 0, 1, 0, 0,
- 0, 0, 0.969697, 0, 0, 0.564706, 0, 0, 0, 0, 0, 1, 0.0367282, 0.0395228, 0, 0, 0,
+ static const float Factors[] = {
+ 0.340582, 0.000974026, 0.487168, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0.411765, 0.921569,
+ 0.00390625, 0.109371, 0, 1, 0, 0, 0, 0, 0.523322, 0, 1, 0, 0, 0, 0, 0.285714, 1,
+ 0.008253, 1, 0, 0, 0.00993935, 0.450213, 0.000974026, 1, 1, 1, 1, 0, 0, 0.20564,
+ 0.97561, 0.913896, 1, 1, 0, 1, 0, 0, 0.5, 0, 0, 0, 0.1, 1, 0, 0, 0, 0, 0, 0.450923,
+ 0, 0.5, 0, 0, 0.20564, 0, 0.5, 0, 0, 0.20564, 0, 0, 0.0313726, 0, 1, 1, 1, 0.363636,
+ 0.5, 0.686073, 0.45121, 0.00574382, 0.366166, 0.413295, 1, 1, 1, 0, 0, 0, 0, 0.160784,
+ 0, 0.937255, 0.537255, 0.133333, 0, 0, 0, 0, 0.00392157, 0, 0.333333, 0.027451, 0.0156863,
+ 1, 0.105882, 1, 0.00220908, 0.000112501, 0.0111262, 0.102384, 0.00140808, 0.123581,
+ 0.29308, 6.57282e-06, 0.00489498, 2.10209e-05, 0.00140559, 5.907e-06, 0, 0.559322,
+ 0.559322, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0.794765, 0,
+ 0.352648, 0.225904, 1, 0.047619, 0.0107276, 0.399461, 0.0304838, 0.292932, 0.00969929,
+ 0, 0, 0.886904, 0.714693, 0, 0.00223213, 0.000544069, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0.00507403, 0, 0, 0, 0, 0, 0.875, 0, 0, 1, 1, 1, 0, 0.20564, 0, 0.00176048, 0,
+ 0.000440121, 0, 0, 0, 0.000974026, 0.487168, 0, 0, 0.533333, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 1, 0, 0, 0.723187, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0.206882, 0.00483367, 0.792983, 0.00126106, 1, 0.0313726, 0.470588,
+ 0.254902, 0.188235, 0.188235, 0.388235, 0.164706, 0, 0.870588, 0.843137, 0.635294,
+ 0.384314, 0.384314, 0.643137, 0, 0, 0, 0, 0, 0, 0, 0, 0.541176, 0, 0.541176, 0, 0,
+ 0.0532634, 1, 0, 0, 0, 0.015044, 1, 0, 1, 1, 1, 0.47451, 0.329412, 0.964706, 0, 0,
+ 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0.0941176, 0.970588, 0.970588, 0, 0.970588, 0.97561,
+ 0, 0.0431373, 0.47451, 0.329412, 0.964706, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0.231373, 0.00392157, 0, 0, 0, 0.054902, 0, 0,
+ 1, 0, 0, 0.0235294, 0, 1, 0, 0, 0, 0, 0.34902, 0.0352941, 0.925379, 0.623681, 0,
+ 0.954543, 0, 0, 0.00102756, 0.709804, 0.498039, 0.0901961, 0.631373, 0.847059, 0.270588,
+ 0.0156863, 0.133333, 0.980392, 1e-12, 1e-12, 1e-12, 1e-12, 0.497159, 0, 0.407487,
+ 0, 0, 0, 0.00392157, 0.00202156, 0.046875, 0.187159, 0.046875, 0.15625, 0.434232,
+ 0.15625, 0, 2.95083e-07, 0.20564, 0.20564, 0.97561, 0.913896, 0, 0, 0, 0, 0, 0, 0.00784314,
+ 0, 0.695525, 1, 0.07205, 0, 0, 0.176471, 0, 0, 0, 1, 1, 0.98, 0.01, 0.01, 0, 0.00690702,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.29078, 0.29078, 1, 0, 0, 0, 0, 0.192157, 0.188235,
+ 0.0941176, 0, 0.0313726, 0, 0.141176, 0.207843, 0.0901961, 0.00784314, 0.0784314,
+ 0, 0, 0, 0, 0, 0.203922, 0.0196078, 0.34902, 0.0235294, 0.0980392, 0.164706, 0.133333,
+ 0.368627, 0, 0.0941176, 0, 1, 0.313726, 0, 0, 0.433582, 0.384508, 0.0532186, 0.0833333,
+ 0.01609, 0, 1, 0, 0, 0, 0.0666667, 0, 0, 0, 0, 1, 0, 0.564706, 0.501961, 0, 0, 0,
+ 0, 0, 0.0516447, 0.000173065, 0, 0, 0, 0, 0, 0, 0, 0.996309, 0, 0, 0.00392157, 1,
+ 0, 0.01, 0, 0, 0, 0, 0, 0.439505, 0.206882, 0.206882, 0.260891, 0, 0.875, 0, 0, 0,
+ 0, 0, 0.185657, 1, 1, 0, 0, 0, 0.0332647, 0.206106, 0.0688878, 0.239216, 0, 0, 0,
+ 0, 0.054902, 0, 0.101961, 0.160784, 0.180392, 0, 0.737828, 0, 0, 0.875, 0.0142566,
+ 0, 0.662745, 1, 0, 0, 0, 0.225806, 0.99992, 0.631373, 0.00392157, 1, 0, 0.143647,
+ 0.00270085, 1, 0.231482, 0.246735, 0.0428062, 0, 0, 1, 0, 0.186441, 0.0115358, 0,
+ 0.221762, 0, 0.2, 0, 0.0156863, 0, 0, 0, 0.976471, 0, 0.231373, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0.00392157, 0.00392157, 0.0666667, 0, 0, 0, 0, 0.0117647, 0.580392, 0.98737,
+ 1, 1, 1, 0, 0, 0, 0.153, 0.847, 0.931373, 0.94697, 0.94697, 0, 0.946294, 0.408118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0.99992, 0.97561, 0, 0, 0, 0, 0, 0,
+ 0.274677, 0.153017, 0, 0.642356, 0, 0, 0.1, 0, 0, 0, 0, 0.327944, 0.327944, 0, 0,
+ 0.815686, 0, 0, 0, 0, 0.206106, 0.439126, 0, 0, 0, 0, 0, 1, 1, 1, 0.00392157, 0.232788,
+ 0.232465, 0.999899, 0.00309296, 0.0636097, 0.445954, 0.156863, 0, 0, 0, 0, 0, 0,
+ 0.3796, 0.0784, 0.0651664, 0, 0, 0.254902, 0.266667, 1, 0, 0, 0, 0, 0, 0.596073,
+ 0.517876, 0.145833, 0.372549, 0, 0.991667, 0.602125, 0.161979, 0, 0, 0, 0, 0.0255146,
+ 0.947855, 0, 0, 0, 0, 0, 0, 0, 0, 0.847059, 0.679841, 0, 0.156863, 0, 0, 1, 0, 0,
+ 0, 0, 0.969697, 0, 0, 0.564706, 0, 0, 0, 0, 0, 1, 0.0367282, 0.0395228, 0, 0, 0,
0, 0, 0.0470588, 0.141176, 0.054902, 0, 0, 0, 0};
static const size_t FactorCount = Y_ARRAY_SIZE(Factors);
-
- static const ui8 CodedFactors[] = {
- 0x24, 0x06, 0x73, 0xB5, 0xC7, 0x55, 0x7F, 0x3A, 0xB4, 0x70, 0xCB, 0xEF, 0xEE, 0xFE, 0xB3, 0x5B,
- 0x5A, 0x1A, 0x93, 0x5F, 0x5F, 0x13, 0x00, 0x00, 0x10, 0x00, 0x3D, 0xEF, 0xFF, 0xEE, 0x0F, 0xDC,
- 0xF0, 0xAB, 0x3F, 0x37, 0x92, 0x24, 0x5D, 0x5E, 0xDE, 0x1C, 0xF8, 0x12, 0x15, 0x5B, 0x84, 0x51,
- 0x82, 0xE6, 0xF6, 0xB8, 0xEA, 0x4F, 0xC7, 0xDD, 0x7D, 0x2E, 0x4D, 0x4A, 0x21, 0xCA, 0xE0, 0xC4,
- 0x2E, 0xEA, 0xD3, 0xBD, 0x0F, 0x00, 0x00, 0xE0, 0xDA, 0xCC, 0xCC, 0xEC, 0x9F, 0x61, 0xDF, 0xE6,
- 0x01, 0x00, 0x00, 0xCC, 0xA5, 0x49, 0xA9, 0x00, 0x00, 0x00, 0xE6, 0xD2, 0xA4, 0xD4, 0xEA, 0x08,
- 0x08, 0xD0, 0xDD, 0xF9, 0xE7, 0xA2, 0x0B, 0x00, 0x00, 0x40, 0xD8, 0x13, 0x7D, 0xFE, 0x13, 0x9C,
- 0x9B, 0xA8, 0x36, 0xBC, 0x00, 0x90, 0x43, 0x6F, 0x97, 0x67, 0x9B, 0xD3, 0xEE, 0xFE, 0x84, 0x24,
- 0x25, 0x89, 0xC9, 0xBF, 0x3F, 0x58, 0x4C, 0x4C, 0xCA, 0x21, 0x22, 0xBC, 0x39, 0x08, 0x08, 0x08,
- 0x40, 0x7E, 0xAA, 0xAA, 0xCA, 0x75, 0x70, 0x70, 0xE9, 0x08, 0x08, 0xE8, 0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20, 0x1A, 0x81, 0x9A, 0xCA, 0xBF, 0xC8, 0x8D, 0x8D, 0xC2, 0x83, 0x82, 0xA7, 0x2C, 0x28,
+ 0xC8, 0xFE, 0x08, 0xC2, 0x07, 0xC7, 0x27, 0x21, 0xE1, 0xBB, 0x3E, 0xC1, 0x59, 0x68, 0xAA, 0x78,
+ 0xC8, 0x57, 0x5D, 0x60, 0x20, 0xC6, 0x41, 0x42, 0xE8, 0x3A, 0x38, 0xD8, 0x9B, 0xFF, 0xFF, 0xFF,
0xC4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const size_t CodedSize = Y_ARRAY_SIZE(CodedFactors);
- static const TStringBuf CodedFactorsBuf(reinterpret_cast<const char*>(CodedFactors), CodedSize);
-
+ static const TStringBuf CodedFactorsBuf(reinterpret_cast<const char*>(CodedFactors), CodedSize);
+
void FillWithGarbage(float* factors, size_t count) {
void* data = static_cast<void*>(factors);
memset(data, 0xAA, sizeof(float) * count);
}
- // Helper for dumping compressed values
+ // Helper for dumping compressed values
void PrintCompressed(const TVector<ui8>& codedFactors) {
- for (size_t i = 0; i < codedFactors.size(); ++i) {
- if (i % 0x10 == 0)
- Cerr << Endl;
- Cerr << Hex(codedFactors[i]) << ", ";
- }
- Cerr << Endl;
- }
-
- // Helper for dumping decompressed values
+ for (size_t i = 0; i < codedFactors.size(); ++i) {
+ if (i % 0x10 == 0)
+ Cerr << Endl;
+ Cerr << Hex(codedFactors[i]) << ", ";
+ }
+ Cerr << Endl;
+ }
+
+ // Helper for dumping decompressed values
void PrintDecompressed(const TVector<float>& factors) {
- TStringStream result;
- TStringStream line;
-
- for (size_t i = 0; i < factors.size(); ++i) {
- line << factors[i] << ", ";
- if (line.Str().size() > 80) {
- result << line.Str() << Endl;
+ TStringStream result;
+ TStringStream line;
+
+ for (size_t i = 0; i < factors.size(); ++i) {
+ line << factors[i] << ", ";
+ if (line.Str().size() > 80) {
+ result << line.Str() << Endl;
line.Clear();
- }
- }
- Cerr << result.Str() << Endl;
- }
-
+ }
+ }
+ Cerr << result.Str() << Endl;
+ }
+
Y_UNIT_TEST(TestCompress) {
const auto codedFactors = fh::Encode(Factors);
- UNIT_ASSERT_VALUES_EQUAL(codedFactors.size(), CodedSize);
- for (size_t i = 0; i < Min(codedFactors.size(), CodedSize); ++i)
+ UNIT_ASSERT_VALUES_EQUAL(codedFactors.size(), CodedSize);
+ for (size_t i = 0; i < Min(codedFactors.size(), CodedSize); ++i)
UNIT_ASSERT_VALUES_EQUAL((ui8)codedFactors[i], CodedFactors[i]);
- //PrintCompressed(codedFactors);
- }
-
+ //PrintCompressed(codedFactors);
+ }
+
Y_UNIT_TEST(TestSimpleDecompress) {
TVector<float> factors = fh::Decode(CodedFactorsBuf);
- UNIT_ASSERT_VALUES_EQUAL(factors.size(), FactorCount);
- for (size_t i = 0; i < Min(factors.size(), FactorCount); ++i)
- UNIT_ASSERT_VALUES_EQUAL(factors[i], Factors[i]);
- //PrintDecompressed(factors);
- }
-
+ UNIT_ASSERT_VALUES_EQUAL(factors.size(), FactorCount);
+ for (size_t i = 0; i < Min(factors.size(), FactorCount); ++i)
+ UNIT_ASSERT_VALUES_EQUAL(factors[i], Factors[i]);
+ //PrintDecompressed(factors);
+ }
+
Y_UNIT_TEST(TestDecompressInParts) {
- float factors[FactorCount];
+ float factors[FactorCount];
FillWithGarbage(factors, FactorCount);
fh::TDecoder decoder(CodedFactorsBuf);
- const size_t firstPack = 100;
- // unpack first pack
+ const size_t firstPack = 100;
+ // unpack first pack
UNIT_ASSERT_VALUES_EQUAL(decoder.Decode({factors, firstPack}), firstPack);
- // unpack all the rest
+ // unpack all the rest
UNIT_ASSERT_VALUES_EQUAL(decoder.Decode({factors + firstPack, FactorCount - firstPack}), FactorCount - firstPack);
-
+
for (size_t i = 0; i < FactorCount; ++i)
- UNIT_ASSERT_VALUES_EQUAL(factors[i], Factors[i]);
- //PrintDecompressed(factors);
- }
-
+ UNIT_ASSERT_VALUES_EQUAL(factors[i], Factors[i]);
+ //PrintDecompressed(factors);
+ }
+
Y_UNIT_TEST(TestSkip) {
float factors[FactorCount];
FillWithGarbage(factors, FactorCount);
@@ -219,19 +219,19 @@ Y_UNIT_TEST_SUITE(FloatHuffmanTest) {
}
Y_UNIT_TEST(TestDecompressForgedData) {
- // this coredumps without end-of-coded-stream check, see SEARCH-1156 for details
+ // this coredumps without end-of-coded-stream check, see SEARCH-1156 for details
TString brokenBase64Encoded =
- "NLjYltUWs5pqnd3d3f05Li4OAwCAEqrP6mv06jDt7PiAUVu7Y+PiMpuZmdzeM"
- "ArqOLxS2q4FKCII52dktcVs7y0zL+OKgeO9SOzEkFj7uPfFqqoCAAAAAADAtZ"
- "mZ2fdmICAgANQXhi1WVRUAAAAAAAAGjvcWq6oKAAAAAAAAA8d7qe4rV3Nxcd3"
- "d4ZfQZrETm3B+OxxB8bbnTPM5+qtbQ92mJ3fHPGj+iH5+8tzcnJuamry1tWUw"
- "MBD693f07+9+DQQEkIGAgIgPetzN5yEbAGxWpbCNxXK/0JGTKRz2KkIoR7aM";
- UNIT_ASSERT_EXCEPTION(
+ "NLjYltUWs5pqnd3d3f05Li4OAwCAEqrP6mv06jDt7PiAUVu7Y+PiMpuZmdzeM"
+ "ArqOLxS2q4FKCII52dktcVs7y0zL+OKgeO9SOzEkFj7uPfFqqoCAAAAAADAtZ"
+ "mZ2fdmICAgANQXhi1WVRUAAAAAAAAGjvcWq6oKAAAAAAAAA8d7qe4rV3Nxcd3"
+ "d4ZfQZrETm3B+OxxB8bbnTPM5+qtbQ92mJ3fHPGj+iH5+8tzcnJuamry1tWUw"
+ "MBD693f07+9+DQQEkIGAgIgPetzN5yEbAGxWpbCNxXK/0JGTKRz2KkIoR7aM";
+ UNIT_ASSERT_EXCEPTION(
fh::Decode(Base64Decode(brokenBase64Encoded)),
yexception);
- }
+ }
Y_UNIT_TEST(TestDecompressEmpty) {
UNIT_ASSERT_EXCEPTION(fh::Decode({}), yexception);
}
-};
+};
diff --git a/library/cpp/codecs/ut/ya.make b/library/cpp/codecs/ut/ya.make
index 7f3374a359..90841b05ef 100644
--- a/library/cpp/codecs/ut/ya.make
+++ b/library/cpp/codecs/ut/ya.make
@@ -1,9 +1,9 @@
UNITTEST()
-OWNER(
+OWNER(
g:base
- velavokr
-)
+ velavokr
+)
PEERDIR(
library/cpp/string_utils/base64
diff --git a/library/cpp/codecs/ya.make b/library/cpp/codecs/ya.make
index b9bb4e5fc6..7e76fb0c9a 100644
--- a/library/cpp/codecs/ya.make
+++ b/library/cpp/codecs/ya.make
@@ -1,9 +1,9 @@
LIBRARY()
-OWNER(
+OWNER(
g:base
- velavokr
-)
+ velavokr
+)
SRCS(
tls_cache.cpp
diff --git a/library/cpp/compproto/bit.h b/library/cpp/compproto/bit.h
index 9f59481415..6a421b65f7 100644
--- a/library/cpp/compproto/bit.h
+++ b/library/cpp/compproto/bit.h
@@ -1,15 +1,15 @@
#pragma once
-
+
#include <util/generic/array_ref.h>
#include <util/generic/vector.h>
-#include <util/stream/output.h>
+#include <util/stream/output.h>
#include <util/stream/input.h>
-
+
#include "huff.h"
#include "compressor.h"
#include "metainfo.h"
-namespace NCompProto {
+namespace NCompProto {
struct TBitBuffer {
TVector<ui8> Out;
ui64 Position;
@@ -18,7 +18,7 @@ namespace NCompProto {
TBitBuffer() {
Clear();
}
-
+
static ui64 Read(const ui8* out, ui64 position, size_t size) {
const ui8* dst = out + (size_t(position >> 3));
ui64 outCode = *reinterpret_cast<const ui64*>(dst);
diff --git a/library/cpp/compproto/compproto_ut.cpp b/library/cpp/compproto/compproto_ut.cpp
index 0845beecc3..9393be967a 100644
--- a/library/cpp/compproto/compproto_ut.cpp
+++ b/library/cpp/compproto/compproto_ut.cpp
@@ -1,37 +1,37 @@
-#include "huff.h"
-#include "metainfo.h"
-#include "bit.h"
-
+#include "huff.h"
+#include "metainfo.h"
+#include "bit.h"
+
#include <util/generic/vector.h>
#include <util/generic/map.h>
-#include <util/system/protect.h>
-
+#include <util/system/protect.h>
+
#include <library/cpp/testing/unittest/registar.h>
-static ui64 gSeed = 42;
-
-static void FlushPseudoRandom() {
- gSeed = 42;
-}
-
-static ui32 PseudoRandom(ui32 max) {
- // stupid and non-threadsafe, but very predictable chaos generator
- gSeed += 1;
- gSeed *= 419;
- gSeed = gSeed ^ (ui64(max) << 17);
- return gSeed % max;
+static ui64 gSeed = 42;
+
+static void FlushPseudoRandom() {
+ gSeed = 42;
+}
+
+static ui32 PseudoRandom(ui32 max) {
+ // stupid and non-threadsafe, but very predictable chaos generator
+ gSeed += 1;
+ gSeed *= 419;
+ gSeed = gSeed ^ (ui64(max) << 17);
+ return gSeed % max;
+};
+
+enum ECompMode {
+ CM_SINGLEPASS,
+ CM_TWOPASS
+};
+
+struct TTestParams {
+ size_t DataSize;
+ ui32 ValueArraySize;
};
-enum ECompMode {
- CM_SINGLEPASS,
- CM_TWOPASS
-};
-
-struct TTestParams {
- size_t DataSize;
- ui32 ValueArraySize;
-};
-
template <typename X>
void TestSaveLoadMeta(NCompProto::TMetaInfo<X>& src) {
TStringStream ss;
@@ -45,16 +45,16 @@ void TestSaveLoadMeta(NCompProto::TMetaInfo<X>& src) {
template <typename TDecompressor, template <typename, typename> class TSerialize>
void TestWithParams(const TString& metainfo, const ECompMode mode, const TTestParams& params) {
- using namespace NCompProto;
- FlushPseudoRandom();
+ using namespace NCompProto;
+ FlushPseudoRandom();
+
+ TStringInput stream(metainfo);
- TStringInput stream(metainfo);
-
THolder<TMetaInfo<THuff>> meta;
- if (mode == CM_TWOPASS) {
+ if (mode == CM_TWOPASS) {
TMetaInfo<THist> hist(stream);
TEmpty empty;
- TSerialize<THist, TEmpty>::Serialize(hist, empty, params);
+ TSerialize<THist, TEmpty>::Serialize(hist, empty, params);
meta.Reset(new TMetaInfo<THuff>(hist, THistToHuff::Instance()));
} else {
meta.Reset(new TMetaInfo<THuff>(stream));
@@ -62,55 +62,55 @@ void TestWithParams(const TString& metainfo, const ECompMode mode, const TTestPa
TestSaveLoadMeta(*meta.Get());
TBitBuffer buffer;
- TSerialize<THuff, TBitBuffer>::Serialize(*meta, buffer, params);
+ TSerialize<THuff, TBitBuffer>::Serialize(*meta, buffer, params);
ui64 codedSize = buffer.Position;
-
+
TMetaInfo<TTable> decompressor(*meta, THuffToTable::Instance());
-
- // verify that no memory read beyond buffer occurs
- const size_t byteSize = buffer.ByteLength();
+
+ // verify that no memory read beyond buffer occurs
+ const size_t byteSize = buffer.ByteLength();
const size_t PAGESIZEX = 4096;
const size_t busyPages = (byteSize + (PAGESIZEX - 1)) / PAGESIZEX;
- const size_t allPages = busyPages + 1;
+ const size_t allPages = busyPages + 1;
const size_t allocSize = (allPages + 1) * PAGESIZEX;
TVector<ui8> readBuffer(allocSize);
- ui8* start = &readBuffer[0];
+ ui8* start = &readBuffer[0];
ui8* pageStart = reinterpret_cast<ui8*>((size_t(start) + PAGESIZEX) & ~(PAGESIZEX - 1));
- // XX DATA DATA DATA DATA PROT
- // | | | | | pages
- // calculate dataStart so that data ends exactly at the page end
+ // XX DATA DATA DATA DATA PROT
+ // | | | | | pages
+ // calculate dataStart so that data ends exactly at the page end
ui8* dataStart = pageStart + busyPages * PAGESIZEX - byteSize;
ui8* dataEnd = pageStart + busyPages * PAGESIZEX;
ProtectMemory(dataEnd, PAGESIZEX, PM_NONE);
- // memory copying should be performed without any problems
+ // memory copying should be performed without any problems
memcpy(dataStart, buffer.Out.data(), byteSize);
-
+
ui64 position = 0;
TMetaIterator<TDecompressor> instance;
- // we should not read beyond dataEnd here
- instance.Decompress(&decompressor, dataStart, position);
- const ui64 decodedSize = position;
+ // we should not read beyond dataEnd here
+ instance.Decompress(&decompressor, dataStart, position);
+ const ui64 decodedSize = position;
UNIT_ASSERT_EQUAL(codedSize, decodedSize);
- // unprotect memory
+ // unprotect memory
ProtectMemory(dataEnd, PAGESIZEX, PM_READ | PM_WRITE | PM_EXEC);
}
-template <typename TDecompressor, template <typename, typename> class TSerialize>
+template <typename TDecompressor, template <typename, typename> class TSerialize>
void Test(const TString& metainfo, const ECompMode mode) {
- for (size_t ds = 3; ds < 42; ds += (3 + PseudoRandom(5))) {
- for (size_t vas = 5; vas < 42; vas += (4 + PseudoRandom(10))) {
- TTestParams params;
- params.DataSize = ds;
- params.ValueArraySize = vas;
- TestWithParams<TDecompressor, TSerialize>(metainfo, mode, params);
- }
- }
-}
+ for (size_t ds = 3; ds < 42; ds += (3 + PseudoRandom(5))) {
+ for (size_t vas = 5; vas < 42; vas += (4 + PseudoRandom(10))) {
+ TTestParams params;
+ params.DataSize = ds;
+ params.ValueArraySize = vas;
+ TestWithParams<TDecompressor, TSerialize>(metainfo, mode, params);
+ }
+ }
+}
Y_UNIT_TEST_SUITE(CompProtoTestBasic) {
- using namespace NCompProto;
-
+ using namespace NCompProto;
+
const TString metainfo =
"\n\
repeated data id 0\n\
@@ -123,14 +123,14 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) {
scalar extra id 31 default const 0\n\
end\n";
- struct TRegInfo {
- ui32 Clicks;
- ui32 Shows;
+ struct TRegInfo {
+ ui32 Clicks;
+ ui32 Shows;
};
- struct TData {
- ui32 Clicks;
- ui32 Shows;
+ struct TData {
+ ui32 Clicks;
+ ui32 Shows;
ui32 Extra;
TMap<ui32, TRegInfo> RegClicks;
};
@@ -138,30 +138,30 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) {
TVector<TData> data;
template <class TMeta, class TFunctor>
- struct TSerialize {
+ struct TSerialize {
static void Serialize(TMetaInfo<TMeta>& meta, TFunctor& functor, const TTestParams& params) {
- FlushPseudoRandom();
+ FlushPseudoRandom();
meta.BeginSelf(functor);
data.clear();
- data.resize(params.DataSize);
- for (ui32 i = 0; i < params.DataSize; ++i) {
+ data.resize(params.DataSize);
+ for (ui32 i = 0; i < params.DataSize; ++i) {
meta.BeginElement(i, functor);
- data[i].Clicks = PseudoRandom(16) + 100;
- data[i].Shows = PseudoRandom(500) * PseudoRandom(16);
+ data[i].Clicks = PseudoRandom(16) + 100;
+ data[i].Shows = PseudoRandom(500) * PseudoRandom(16);
data[i].Extra = PseudoRandom(500) + (1UL << 31); // test also saving of big values
- meta.SetScalar(0, data[i].Clicks, functor);
- meta.SetScalar(1, data[i].Shows, functor);
+ meta.SetScalar(0, data[i].Clicks, functor);
+ meta.SetScalar(1, data[i].Shows, functor);
TMetaInfo<TMeta>& regClicks = meta.BeginRepeated(2, functor);
- for (ui32 j = 0; j < PseudoRandom(200); j += 1 + PseudoRandom(10)) {
+ for (ui32 j = 0; j < PseudoRandom(200); j += 1 + PseudoRandom(10)) {
regClicks.BeginElement(j, functor);
- TRegInfo& r = data[i].RegClicks[j];
+ TRegInfo& r = data[i].RegClicks[j];
- r.Clicks = PseudoRandom(2);
- r.Shows = PseudoRandom(800) * PseudoRandom(8) + 56;
- regClicks.SetScalar(0, r.Clicks, functor);
- regClicks.SetScalar(1, r.Shows, functor);
+ r.Clicks = PseudoRandom(2);
+ r.Shows = PseudoRandom(800) * PseudoRandom(8) + 56;
+ regClicks.SetScalar(0, r.Clicks, functor);
+ regClicks.SetScalar(1, r.Shows, functor);
regClicks.EndElement(functor);
}
@@ -274,7 +274,7 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) {
case InDataElem:
UNIT_ASSERT_EQUAL(id, 2);
State = InRegClicks;
- RegIter = data[DataInd].RegClicks.begin();
+ RegIter = data[DataInd].RegClicks.begin();
break;
case InRegClicks:
UNIT_ASSERT(0);
@@ -292,7 +292,7 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) {
case InDataElem:
UNIT_ASSERT(0);
case InRegClicks:
- UNIT_ASSERT_EQUAL(RegIter, data[DataInd].RegClicks.end());
+ UNIT_ASSERT_EQUAL(RegIter, data[DataInd].RegClicks.end());
State = InDataElem;
break;
default:
@@ -336,17 +336,17 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) {
UNIT_ASSERT(0);
case InDataElem:
if (index == 0)
- UNIT_ASSERT_EQUAL(val, data[DataInd].Clicks);
+ UNIT_ASSERT_EQUAL(val, data[DataInd].Clicks);
if (index == 1)
- UNIT_ASSERT_EQUAL(val, data[DataInd].Shows);
+ UNIT_ASSERT_EQUAL(val, data[DataInd].Shows);
if (index == 31)
UNIT_ASSERT_EQUAL(val, data[DataInd].Extra);
break;
case InRegClicks:
if (index == 0)
- UNIT_ASSERT_EQUAL(val, RegIter->second.Clicks);
+ UNIT_ASSERT_EQUAL(val, RegIter->second.Clicks);
if (index == 1)
- UNIT_ASSERT_EQUAL(val, RegIter->second.Shows);
+ UNIT_ASSERT_EQUAL(val, RegIter->second.Shows);
break;
default:
UNIT_ASSERT(0);
@@ -355,11 +355,11 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) {
};
Y_UNIT_TEST(VerifyDecompression) {
- Test<TVerifyingDecompressor, TSerialize>(metainfo, CM_SINGLEPASS);
+ Test<TVerifyingDecompressor, TSerialize>(metainfo, CM_SINGLEPASS);
}
Y_UNIT_TEST(VerifyHistDecompression) {
- Test<TVerifyingDecompressor, TSerialize>(metainfo, CM_TWOPASS);
+ Test<TVerifyingDecompressor, TSerialize>(metainfo, CM_TWOPASS);
}
Y_UNIT_TEST(VerifyDecompressionMulti) {
@@ -372,7 +372,7 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) {
}
Y_UNIT_TEST_SUITE(CompProtoTestExtended) {
- using namespace NCompProto;
+ using namespace NCompProto;
const TString metainfo =
"\n\
repeated data id 0\n\
@@ -386,17 +386,17 @@ Y_UNIT_TEST_SUITE(CompProtoTestExtended) {
TVector<std::pair<TVector<ui32>, TVector<ui32>>> data;
template <class TMeta, class TFunctor>
- struct TSerialize {
+ struct TSerialize {
static void Serialize(TMetaInfo<TMeta>& meta, TFunctor& functor, const TTestParams& params) {
- FlushPseudoRandom();
+ FlushPseudoRandom();
meta.BeginSelf(functor);
data.clear();
- data.resize(params.DataSize);
- for (size_t i = 0; i < params.DataSize; ++i) {
+ data.resize(params.DataSize);
+ for (size_t i = 0; i < params.DataSize; ++i) {
meta.BeginElement(i, functor);
TMetaInfo<TMeta>& first = meta.BeginRepeated(2, functor);
data[i].first.resize(params.ValueArraySize);
- for (ui32 j = 0; j < params.ValueArraySize; j++) {
+ for (ui32 j = 0; j < params.ValueArraySize; j++) {
first.BeginElement(j, functor);
ui32 val = PseudoRandom(42 * 42 * 42);
@@ -409,7 +409,7 @@ Y_UNIT_TEST_SUITE(CompProtoTestExtended) {
TMetaInfo<TMeta>& second = meta.BeginRepeated(3, functor);
data[i].second.resize(params.ValueArraySize);
- for (ui32 j = 0; j < params.ValueArraySize; j++) {
+ for (ui32 j = 0; j < params.ValueArraySize; j++) {
second.BeginElement(j, functor);
ui32 val = PseudoRandom(42 * 42 * 42);
@@ -534,10 +534,10 @@ Y_UNIT_TEST_SUITE(CompProtoTestExtended) {
}
};
Y_UNIT_TEST(VerifyDecompression) {
- Test<TVerifyingDecompressor, TSerialize>(metainfo, CM_SINGLEPASS);
+ Test<TVerifyingDecompressor, TSerialize>(metainfo, CM_SINGLEPASS);
}
Y_UNIT_TEST(VerifyHistDecompression) {
- Test<TVerifyingDecompressor, TSerialize>(metainfo, CM_TWOPASS);
+ Test<TVerifyingDecompressor, TSerialize>(metainfo, CM_TWOPASS);
}
}
diff --git a/library/cpp/compproto/compressor.h b/library/cpp/compproto/compressor.h
index d6397269ac..14b335e13c 100644
--- a/library/cpp/compproto/compressor.h
+++ b/library/cpp/compproto/compressor.h
@@ -1,11 +1,11 @@
#pragma once
-#include <util/system/defaults.h>
-
-namespace NCompProto {
+#include <util/system/defaults.h>
+
+namespace NCompProto {
struct TEmpty {
};
-
+
struct TTable {
TTable() {
for (size_t i = 0; i < 64; ++i) {
@@ -70,5 +70,5 @@ namespace NCompProto {
return (((ui32)(code >> PrefLength[index])) & CodeMask[index]) + CodeBase[index];
}
};
-
+
}
diff --git a/library/cpp/compproto/huff.h b/library/cpp/compproto/huff.h
index 11c5f2e074..fa5c139189 100644
--- a/library/cpp/compproto/huff.h
+++ b/library/cpp/compproto/huff.h
@@ -1,14 +1,14 @@
#pragma once
-#include <util/system/defaults.h>
-#include <util/generic/yexception.h>
-#include <util/generic/ptr.h>
-#include <util/generic/vector.h>
-#include <util/generic/algorithm.h>
+#include <util/system/defaults.h>
+#include <util/generic/yexception.h>
+#include <util/generic/ptr.h>
+#include <util/generic/vector.h>
+#include <util/generic/algorithm.h>
#include <utility>
-
+
#include <queue>
-
+
#include "compressor.h"
namespace NCompProto {
diff --git a/library/cpp/compproto/metainfo.h b/library/cpp/compproto/metainfo.h
index 17b708de1d..6e68f86e12 100644
--- a/library/cpp/compproto/metainfo.h
+++ b/library/cpp/compproto/metainfo.h
@@ -1,17 +1,17 @@
#pragma once
-#include <util/system/defaults.h>
-#include <util/generic/yexception.h>
-#include <util/generic/ptr.h>
-#include <util/generic/refcount.h>
-#include <util/stream/input.h>
+#include <util/system/defaults.h>
+#include <util/generic/yexception.h>
+#include <util/generic/ptr.h>
+#include <util/generic/refcount.h>
+#include <util/stream/input.h>
#include <util/stream/str.h>
-
+
#include "compressor.h"
-namespace NCompProto {
+namespace NCompProto {
const size_t MAX_ELEMENTS = 32;
-
+
struct TScalarDefaultValue {
TScalarDefaultValue()
: Type(None)
@@ -300,5 +300,5 @@ namespace NCompProto {
}
}
};
-
+
}
diff --git a/library/cpp/compproto/ya.make b/library/cpp/compproto/ya.make
index a5fc76b80a..60d5cfa08d 100644
--- a/library/cpp/compproto/ya.make
+++ b/library/cpp/compproto/ya.make
@@ -1,7 +1,7 @@
LIBRARY()
-OWNER(ironpeter)
-
+OWNER(ironpeter)
+
SRCS(
bit.h
compressor.h
diff --git a/library/cpp/deprecated/mapped_file/mapped_file.cpp b/library/cpp/deprecated/mapped_file/mapped_file.cpp
index e5ab717f79..b0e4511299 100644
--- a/library/cpp/deprecated/mapped_file/mapped_file.cpp
+++ b/library/cpp/deprecated/mapped_file/mapped_file.cpp
@@ -9,7 +9,7 @@ TMappedFile::TMappedFile(TFileMap* map, const char* dbgName) {
Map_ = map;
i64 len = Map_->Length();
if (Hi32(len) != 0 && sizeof(size_t) <= sizeof(ui32))
- ythrow yexception() << "File '" << dbgName << "' mapping error: " << len << " too large";
+ ythrow yexception() << "File '" << dbgName << "' mapping error: " << len << " too large";
Map_->Map(0, static_cast<size_t>(len));
}
@@ -17,7 +17,7 @@ TMappedFile::TMappedFile(TFileMap* map, const char* dbgName) {
TMappedFile::TMappedFile(const TFile& file, TFileMap::EOpenMode om, const char* dbgName)
: Map_(nullptr)
{
- init(file, om, dbgName);
+ init(file, om, dbgName);
}
void TMappedFile::precharge(size_t off, size_t size) const {
@@ -45,7 +45,7 @@ void TMappedFile::init(const TString& name, size_t length, TFileMap::EOpenMode o
void TMappedFile::init(const TFile& file, TFileMap::EOpenMode om, const char* dbgName) {
THolder<TFileMap> map(new TFileMap(file, om));
- TMappedFile newFile(map.Get(), dbgName);
+ TMappedFile newFile(map.Get(), dbgName);
Y_UNUSED(map.Release());
newFile.swap(*this);
newFile.term();
diff --git a/library/cpp/deprecated/mapped_file/mapped_file.h b/library/cpp/deprecated/mapped_file/mapped_file.h
index 67df94db05..45859ed65a 100644
--- a/library/cpp/deprecated/mapped_file/mapped_file.h
+++ b/library/cpp/deprecated/mapped_file/mapped_file.h
@@ -13,7 +13,7 @@
#include <cstdio>
#include <new>
-/// Deprecated (by pg@), use TFileMap or TMemoryMap instead
+/// Deprecated (by pg@), use TFileMap or TMemoryMap instead
class TMappedFile {
private:
TFileMap* Map_;
diff --git a/library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp b/library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp
index 988b0a9967..afbd5b3358 100644
--- a/library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp
+++ b/library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp
@@ -4,7 +4,7 @@
#include <util/system/fs.h>
Y_UNIT_TEST_SUITE(TMappedFileTest) {
- static const char* FileName_("./mappped_file");
+ static const char* FileName_("./mappped_file");
Y_UNIT_TEST(TestFileMapEmpty) {
TFile file(FileName_, CreateAlways | WrOnly);
file.Close();
diff --git a/library/cpp/digest/md5/md5.cpp b/library/cpp/digest/md5/md5.cpp
index 374f6aeda7..24a5b69eef 100644
--- a/library/cpp/digest/md5/md5.cpp
+++ b/library/cpp/digest/md5/md5.cpp
@@ -1,8 +1,8 @@
-#include "md5.h"
-
+#include "md5.h"
+
#include <library/cpp/string_utils/base64/base64.h>
-#include <util/stream/input.h>
+#include <util/stream/input.h>
#include <util/stream/file.h>
#include <util/string/hex.h>
@@ -99,10 +99,10 @@ void MD5::Init() {
BufferSize = 0;
StreamSize = 0;
/* Load magic initialization constants. */
- State[0] = 0x67452301;
- State[1] = 0xefcdab89;
- State[2] = 0x98badcfe;
- State[3] = 0x10325476;
+ State[0] = 0x67452301;
+ State[1] = 0xefcdab89;
+ State[2] = 0x98badcfe;
+ State[3] = 0x10325476;
}
/*
diff --git a/library/cpp/digest/md5/md5.h b/library/cpp/digest/md5/md5.h
index e1b804d128..2c17aa0518 100644
--- a/library/cpp/digest/md5/md5.h
+++ b/library/cpp/digest/md5/md5.h
@@ -4,7 +4,7 @@
#include <util/generic/strbuf.h>
class IInputStream;
-
+
class MD5 {
public:
MD5() {
@@ -29,12 +29,12 @@ public:
void Pad();
ui8* Final(ui8[16]);
- // buf must be char[33];
- char* End(char* buf);
-
- // buf must be char[25];
- char* End_b64(char* buf);
-
+ // buf must be char[33];
+ char* End(char* buf);
+
+ // buf must be char[25];
+ char* End_b64(char* buf);
+
// 8-byte xor-based mix
ui64 EndHalfMix();
@@ -45,7 +45,7 @@ public:
*
* Return nullptr / empty string if the file does not exist.
*/
- static char* File(const char* filename, char* buf);
+ static char* File(const char* filename, char* buf);
static TString File(const TString& filename);
static char* Data(const void* data, size_t len, char* buf);
diff --git a/library/cpp/digest/md5/md5_medium_ut.cpp b/library/cpp/digest/md5/md5_medium_ut.cpp
index 20067aa62c..a940c5cb66 100644
--- a/library/cpp/digest/md5/md5_medium_ut.cpp
+++ b/library/cpp/digest/md5/md5_medium_ut.cpp
@@ -20,6 +20,6 @@ Y_UNIT_TEST_SUITE(TMD5MediumTest) {
s.to_lower();
UNIT_ASSERT_VALUES_EQUAL(s, "34a5a7ed4f0221310084e21a1e599659");
- }
- }
-}
+ }
+ }
+}
diff --git a/library/cpp/digest/md5/md5_ut.cpp b/library/cpp/digest/md5/md5_ut.cpp
index d92efc9975..1c3e4ad0a9 100644
--- a/library/cpp/digest/md5/md5_ut.cpp
+++ b/library/cpp/digest/md5/md5_ut.cpp
@@ -7,35 +7,35 @@
Y_UNIT_TEST_SUITE(TMD5Test) {
Y_UNIT_TEST(TestMD5) {
- // echo -n 'qwertyuiopqwertyuiopasdfghjklasdfghjkl' | md5sum
+ // echo -n 'qwertyuiopqwertyuiopasdfghjklasdfghjkl' | md5sum
constexpr const char* b = "qwertyuiopqwertyuiopasdfghjklasdfghjkl";
- MD5 r;
- r.Update((const unsigned char*)b, 15);
- r.Update((const unsigned char*)b + 15, strlen(b) - 15);
+ MD5 r;
+ r.Update((const unsigned char*)b, 15);
+ r.Update((const unsigned char*)b + 15, strlen(b) - 15);
- char rs[33];
+ char rs[33];
TString s(r.End(rs));
- s.to_lower();
+ s.to_lower();
UNIT_ASSERT_NO_DIFF(s, TStringBuf("3ac00dd696b966fd74deee3c35a59d8f"));
TString result = r.Calc(TStringBuf(b));
- result.to_lower();
+ result.to_lower();
UNIT_ASSERT_NO_DIFF(result, TStringBuf("3ac00dd696b966fd74deee3c35a59d8f"));
- }
+ }
Y_UNIT_TEST(TestFile) {
TString s = NUnitTest::RandomString(1000000, 1);
const TString tmpFile = "tmp";
- {
+ {
TFixedBufferFileOutput fo(tmpFile);
fo.Write(s.data(), s.size());
- }
+ }
- char fileBuf[100];
- char memBuf[100];
+ char fileBuf[100];
+ char memBuf[100];
TString fileHash = MD5::File(tmpFile.data(), fileBuf);
TString memoryHash = MD5::Data((const unsigned char*)s.data(), s.size(), memBuf);
@@ -47,7 +47,7 @@ Y_UNIT_TEST_SUITE(TMD5Test) {
NFs::Remove(tmpFile);
fileHash = MD5::File(tmpFile);
UNIT_ASSERT_EQUAL(fileHash.size(), 0);
- }
+ }
Y_UNIT_TEST(TestIsMD5) {
UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf()));
@@ -63,4 +63,4 @@ Y_UNIT_TEST_SUITE(TMD5Test) {
UNIT_ASSERT_EQUAL(MD5::CalcHalfMix(""), 7203772011789518145ul);
UNIT_ASSERT_EQUAL(MD5::CalcHalfMix("qwertyuiopqwertyuiopasdfghjklasdfghjkl"), 11753545595885642730ul);
}
-}
+}
diff --git a/library/cpp/digest/old_crc/crc.h b/library/cpp/digest/old_crc/crc.h
index 5ffb93b2fa..4a3ce6d05e 100644
--- a/library/cpp/digest/old_crc/crc.h
+++ b/library/cpp/digest/old_crc/crc.h
@@ -53,9 +53,9 @@ inline ui64 crc64(const void* buf, size_t buflen, ui64 crcinit = CRC64INIT) {
const unsigned char* ptr = (const unsigned char*)buf;
extern const ui64* crctab64;
- while (buflen--) {
+ while (buflen--) {
crcinit = crctab64[((crcinit >> 56) ^ *ptr++)] ^ (crcinit << 8);
- }
+ }
return crcinit;
}
diff --git a/library/cpp/getopt/last_getopt_demo/demo.cpp b/library/cpp/getopt/last_getopt_demo/demo.cpp
index cbdd7ed458..79426a9cc9 100644
--- a/library/cpp/getopt/last_getopt_demo/demo.cpp
+++ b/library/cpp/getopt/last_getopt_demo/demo.cpp
@@ -51,9 +51,9 @@ protected:
// Built-in options.
opts.AddHelpOption('h');
opts.AddCompletionOption("last_getopt_demo");
-
+
// Custom options.
-
+
opts.AddLongOption('V', "version")
.Help("print version and exit")
.IfPresentDisableCompletion()
@@ -62,11 +62,11 @@ protected:
Cerr << "last_getopt_demo 1.0.0" << Endl;
exit(0);
});
-
+
opts.AddLongOption('b', "background")
.Help("go to background immediately after startup")
.StoreTrue(&Background_);
-
+
opts.AddLongOption("timeout")
.RequiredArgument("timeout")
.DefaultValue("60000")
@@ -110,7 +110,7 @@ protected:
.Handler0([this]() {
ImplicitMethod_ = "POST";
});
-
+
opts.AddLongOption("post-file")
.RequiredArgument("file")
.Help("use POST method and send contents of the specified file in the request body (cannot be used with --post-data)")
diff --git a/library/cpp/getopt/small/modchooser.cpp b/library/cpp/getopt/small/modchooser.cpp
index 6d11600a46..2fa5cfd070 100644
--- a/library/cpp/getopt/small/modchooser.cpp
+++ b/library/cpp/getopt/small/modchooser.cpp
@@ -7,9 +7,9 @@
#include <library/cpp/colorizer/colors.h>
#include <util/stream/output.h>
-#include <util/stream/format.h>
+#include <util/stream/format.h>
#include <util/generic/yexception.h>
-#include <util/generic/ptr.h>
+#include <util/generic/ptr.h>
#include <util/string/builder.h>
#include <util/string/join.h>
@@ -99,7 +99,7 @@ void TModChooser::AddMode(const TString& mode, const TMainFunctionPtrV func, con
}
void TModChooser::AddMode(const TString& mode, TMainClass* func, const TString& description, bool hidden, bool noCompletion) {
- if (Modes.FindPtr(mode)) {
+ if (Modes.FindPtr(mode)) {
ythrow yexception() << "TMode '" << mode << "' already exists in TModChooser.";
}
@@ -184,7 +184,7 @@ int TModChooser::Run(const int argc, const char** argv) const {
PrintHelp(argv[0]);
return 0;
}
- if (VersionHandler && (modeName == "-v" || modeName == "--version")) {
+ if (VersionHandler && (modeName == "-v" || modeName == "--version")) {
VersionHandler();
return 0;
}
@@ -199,7 +199,7 @@ int TModChooser::Run(const int argc, const char** argv) const {
}
if (modeIter == Modes.end()) {
- Cerr << "Unknown mode " << modeName.Quote() << "." << Endl;
+ Cerr << "Unknown mode " << modeName.Quote() << "." << Endl;
PrintHelp(argv[0]);
return 1;
}
@@ -280,9 +280,9 @@ TString TModChooser::TMode::FormatFullName(size_t pad) const {
void TModChooser::PrintHelp(const TString& progName) const {
Cerr << Description << Endl << Endl;
Cerr << NColorizer::StdErr().BoldColor() << "Usage" << NColorizer::StdErr().OldColor() << ": " << progName << " MODE [MODE_OPTIONS]" << Endl;
- Cerr << Endl;
+ Cerr << Endl;
Cerr << NColorizer::StdErr().BoldColor() << "Modes" << NColorizer::StdErr().OldColor() << ":" << Endl;
- size_t maxModeLen = 0;
+ size_t maxModeLen = 0;
for (const auto& [name, mode] : Modes) {
if (name != mode->Name)
continue; // this is an alias
@@ -309,11 +309,11 @@ void TModChooser::PrintHelp(const TString& progName) const {
}
}
}
-
- Cerr << Endl;
- Cerr << "To get help for specific mode type '" << progName << " MODE " << ModesHelpOption << "'" << Endl;
- if (VersionHandler)
- Cerr << "To print program version type '" << progName << " --version'" << Endl;
+
+ Cerr << Endl;
+ Cerr << "To get help for specific mode type '" << progName << " MODE " << ModesHelpOption << "'" << Endl;
+ if (VersionHandler)
+ Cerr << "To print program version type '" << progName << " --version'" << Endl;
if (!SvnRevisionOptionDisabled) {
Cerr << "To print svn revision type --svnrevision" << Endl;
}
diff --git a/library/cpp/getopt/small/modchooser.h b/library/cpp/getopt/small/modchooser.h
index 954d8574ca..0a8de6d50b 100644
--- a/library/cpp/getopt/small/modchooser.h
+++ b/library/cpp/getopt/small/modchooser.h
@@ -141,7 +141,7 @@ private:
//! Help option for modes.
TString ModesHelpOption;
- //! Wrappers around all modes.
+ //! Wrappers around all modes.
TVector<THolder<TMainClass>> Wrappers;
//! Modes
diff --git a/library/cpp/getopt/ut/last_getopt_ut.cpp b/library/cpp/getopt/ut/last_getopt_ut.cpp
index 9a06287fec..c99a1d053d 100644
--- a/library/cpp/getopt/ut/last_getopt_ut.cpp
+++ b/library/cpp/getopt/ut/last_getopt_ut.cpp
@@ -145,8 +145,8 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
UNIT_ASSERT_VALUES_EQUAL("/etc", r.GetOrElse("to", "trash"));
UNIT_ASSERT(r.Has("from"));
UNIT_ASSERT(r.Has("to"));
-
- UNIT_ASSERT_EXCEPTION(r.Get("left"), TException);
+
+ UNIT_ASSERT_EXCEPTION(r.Get("left"), TException);
}
Y_UNIT_TEST(TestCharOptions) {
@@ -160,30 +160,30 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
UNIT_ASSERT(!r.Has('h'));
UNIT_ASSERT_VALUES_EQUAL(2u, r.GetFreeArgs().size());
- UNIT_ASSERT_VALUES_EQUAL(2u, r.GetFreeArgCount());
+ UNIT_ASSERT_VALUES_EQUAL(2u, r.GetFreeArgCount());
UNIT_ASSERT_VALUES_EQUAL("/etc", r.GetFreeArgs()[0]);
UNIT_ASSERT_VALUES_EQUAL("/tmp/etc", r.GetFreeArgs()[1]);
}
Y_UNIT_TEST(TestFreeArgs) {
- TOptsNoDefault opts;
- opts.SetFreeArgsNum(1, 3);
+ TOptsNoDefault opts;
+ opts.SetFreeArgsNum(1, 3);
TOptsParseResultTestWrapper r11(&opts, V({"cp", "/etc"}));
TOptsParseResultTestWrapper r12(&opts, V({"cp", "/etc", "/tmp/etc"}));
TOptsParseResultTestWrapper r13(&opts, V({"cp", "/etc", "/tmp/etc", "verbose"}));
-
- UNIT_ASSERT_EXCEPTION(
+
+ UNIT_ASSERT_EXCEPTION(
TOptsParseResultTestWrapper(&opts, V({"cp", "/etc", "/tmp/etc", "verbose", "nosymlink"})),
yexception);
-
- UNIT_ASSERT_EXCEPTION(
+
+ UNIT_ASSERT_EXCEPTION(
TOptsParseResultTestWrapper(&opts, V({"cp"})),
yexception);
-
- opts.SetFreeArgsNum(2);
+
+ opts.SetFreeArgsNum(2);
TOptsParseResultTestWrapper r22(&opts, V({"cp", "/etc", "/var/tmp"}));
- }
-
+ }
+
Y_UNIT_TEST(TestCharOptionsRequiredOptional) {
TOptsNoDefault opts;
opts.AddCharOption('d', REQUIRED_ARGUMENT);
@@ -350,19 +350,19 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
// this test is broken, cause UNIT_ASSERT(false) always throws
return;
- bool exception = false;
- try {
- TOpts opts;
- opts.AddLongOption('x', "one");
- opts.AddLongOption('x', "two");
- UNIT_ASSERT(false);
+ bool exception = false;
+ try {
+ TOpts opts;
+ opts.AddLongOption('x', "one");
+ opts.AddLongOption('x', "two");
+ UNIT_ASSERT(false);
} catch (...) {
- // we should go here, duplicating options are forbidden
- exception = true;
- }
- UNIT_ASSERT(exception);
- }
-
+ // we should go here, duplicating options are forbidden
+ exception = true;
+ }
+ UNIT_ASSERT(exception);
+ }
+
Y_UNIT_TEST(TestPositionWhenNoArgs) {
TOptsParserTester tester;
@@ -527,7 +527,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
// test 'required'
opt_d.Required();
- UNIT_ASSERT_EXCEPTION(
+ UNIT_ASSERT_EXCEPTION(
TOptsParseResultTestWrapper(&opts, V({"cmd"})),
TUsageException);
@@ -563,7 +563,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
opts.AddLongOption("flag2").RequiredArgument().StoreResultT<int>(&uval);
opts.AddLongOption("flag3").RequiredArgument().StoreMappedResult(&fval, (double (*)(double))fabs);
opts.AddLongOption("flag4").RequiredArgument().StoreMappedResult(&fval, (double (*)(double))sqrt);
- UNIT_ASSERT_EXCEPTION(
+ UNIT_ASSERT_EXCEPTION(
TOptsParseResultTestWrapper(&opts, V({"cmd", "--flag3", "-2.0", "--flag1", "-1"})),
yexception);
UNIT_ASSERT_VALUES_EQUAL(uval, 5u);
@@ -575,21 +575,21 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
}
Y_UNIT_TEST(TestTitleAndPrintUsage) {
- TOpts opts;
- const char* prog = "my_program";
+ TOpts opts;
+ const char* prog = "my_program";
TString title = TString("Sample ") + TString(prog).Quote() + " application";
- opts.SetTitle(title);
- int argc = 2;
+ opts.SetTitle(title);
+ int argc = 2;
const char* cmd[] = {prog};
- TOptsParser parser(&opts, argc, cmd);
- TStringStream out;
- parser.PrintUsage(out);
- // find title
+ TOptsParser parser(&opts, argc, cmd);
+ TStringStream out;
+ parser.PrintUsage(out);
+ // find title
UNIT_ASSERT(out.Str().find(title) != TString::npos);
- // find usage
+ // find usage
UNIT_ASSERT(out.Str().find(" " + TString(prog) + " ") != TString::npos);
- }
-
+ }
+
Y_UNIT_TEST(TestCustomCmdLineDescr) {
TOpts opts;
const char* prog = "my_program";
@@ -756,7 +756,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
}
{
- UNIT_ASSERT_EXCEPTION(
+ UNIT_ASSERT_EXCEPTION(
TOptsParseResultTestWrapper(&opts, V({"cmd", "--true"})),
TUsageException);
}
diff --git a/library/cpp/http/fetch/httpheader.h b/library/cpp/http/fetch/httpheader.h
index f14cabe1c8..b2810bbd41 100644
--- a/library/cpp/http/fetch/httpheader.h
+++ b/library/cpp/http/fetch/httpheader.h
@@ -8,8 +8,8 @@
#include <util/system/compat.h>
#include <util/generic/string.h>
#include <util/generic/ylimits.h>
-#include <util/system/maxlen.h>
-
+#include <util/system/maxlen.h>
+
#include <ctime>
#include <cstdio>
#include <cstdlib>
diff --git a/library/cpp/http/io/compression_ut.cpp b/library/cpp/http/io/compression_ut.cpp
index c7568f4eb3..2f3d131f8c 100644
--- a/library/cpp/http/io/compression_ut.cpp
+++ b/library/cpp/http/io/compression_ut.cpp
@@ -9,14 +9,14 @@
Y_UNIT_TEST_SUITE(THttpCompressionTest) {
static const TString DATA = "I'm a teapot";
-
+
Y_UNIT_TEST(TestGetBestCodecs) {
UNIT_ASSERT(TCompressionCodecFactory::Instance().GetBestCodecs().size() > 0);
}
-
+
Y_UNIT_TEST(TestEncoder) {
TStringStream buffer;
-
+
{
auto encoder = TCompressionCodecFactory::Instance().FindEncoder("gzip");
UNIT_ASSERT(encoder);
@@ -27,7 +27,7 @@ Y_UNIT_TEST_SUITE(THttpCompressionTest) {
TZLibDecompress decompressor(&buffer);
UNIT_ASSERT_EQUAL(decompressor.ReadAll(), DATA);
- }
+ }
Y_UNIT_TEST(TestDecoder) {
TStringStream buffer;
diff --git a/library/cpp/http/io/stream.cpp b/library/cpp/http/io/stream.cpp
index 358af13259..6689be684f 100644
--- a/library/cpp/http/io/stream.cpp
+++ b/library/cpp/http/io/stream.cpp
@@ -228,15 +228,15 @@ private:
}
struct TParsedHeaders {
- bool Chunked = false;
- bool KeepAlive = false;
+ bool Chunked = false;
+ bool KeepAlive = false;
TStringBuf LZipped;
};
struct TTrEnc {
inline void operator()(const TStringBuf& s) {
if (s == TStringBuf("chunked")) {
- p->Chunked = true;
+ p->Chunked = true;
}
}
@@ -318,9 +318,9 @@ private:
HEADERCMP(header, "connection") {
// accept header "Connection: Keep-Alive, TE"
if (strnicmp(header.Value().data(), "keep-alive", 10) == 0) {
- p.KeepAlive = true;
+ p.KeepAlive = true;
} else if (stricmp(header.Value().data(), "close") == 0) {
- p.KeepAlive = false;
+ p.KeepAlive = false;
}
}
[[fallthrough]];
@@ -336,7 +336,7 @@ private:
}
}
- if (p.Chunked) {
+ if (p.Chunked) {
ChunkedInput_ = Streams_.Add(new TChunkedInput(&Buffered_, &Trailers_));
Input_ = ChunkedInput_;
} else {
@@ -357,7 +357,7 @@ private:
Input_ = Streams_.Add((*decoder)(Input_).Release());
}
- KeepAlive_ = p.KeepAlive;
+ KeepAlive_ = p.KeepAlive;
}
private:
@@ -474,7 +474,7 @@ class THttpOutput::TImpl {
}
private:
- size_t Length_ = 0;
+ size_t Length_ = 0;
};
enum TState {
@@ -564,7 +564,7 @@ public:
inline void Flush() {
TFlush f;
Streams_.ForEach(f);
- Slave_->Flush(); // see SEARCH-1030
+ Slave_->Flush(); // see SEARCH-1030
}
inline void Finish() {
@@ -574,7 +574,7 @@ public:
TFinish f;
Streams_.ForEach(f);
- Slave_->Finish(); // see SEARCH-1030
+ Slave_->Finish(); // see SEARCH-1030
Finished_ = true;
}
@@ -806,10 +806,10 @@ private:
}
inline void RebuildStream() {
- bool keepAlive = false;
+ bool keepAlive = false;
const TCompressionCodecFactory::TEncoderConstructor* encoder = nullptr;
bool chunked = false;
- bool haveContentLength = false;
+ bool haveContentLength = false;
for (THttpHeaders::TConstIterator h = Headers_.Begin(); h != Headers_.End(); ++h) {
const THttpInputHeader& header = *h;
@@ -822,7 +822,7 @@ private:
} else if (hl == TStringBuf("transfer-encoding")) {
chunked = to_lower(header.Value()) == TStringBuf("chunked");
} else if (hl == TStringBuf("content-length")) {
- haveContentLength = true;
+ haveContentLength = true;
}
}
diff --git a/library/cpp/http/io/stream_ut.cpp b/library/cpp/http/io/stream_ut.cpp
index 51e8177676..1ea35df675 100644
--- a/library/cpp/http/io/stream_ut.cpp
+++ b/library/cpp/http/io/stream_ut.cpp
@@ -15,84 +15,84 @@
#include <util/stream/null.h>
Y_UNIT_TEST_SUITE(THttpStreamTest) {
- class TTestHttpServer: public THttpServer::ICallBack {
- class TRequest: public THttpClientRequestEx {
- public:
- inline TRequest(TTestHttpServer* parent)
- : Parent_(parent)
- {
- }
-
+ class TTestHttpServer: public THttpServer::ICallBack {
+ class TRequest: public THttpClientRequestEx {
+ public:
+ inline TRequest(TTestHttpServer* parent)
+ : Parent_(parent)
+ {
+ }
+
bool Reply(void* /*tsr*/) override {
- if (!ProcessHeaders()) {
+ if (!ProcessHeaders()) {
return true;
- }
+ }
// Check that function will not hang on
Input().ReadAll();
- // "lo" is for "local"
- if (RD.ServerName() == "yandex.lo") {
- // do redirect
+ // "lo" is for "local"
+ if (RD.ServerName() == "yandex.lo") {
+ // do redirect
Output() << "HTTP/1.1 301 Moved permanently\r\n"
"Location: http://www.yandex.lo\r\n"
"\r\n";
- } else if (RD.ServerName() == "www.yandex.lo") {
+ } else if (RD.ServerName() == "www.yandex.lo") {
Output() << "HTTP/1.1 200 Ok\r\n"
"\r\n";
- } else {
- Output() << "HTTP/1.1 200 Ok\r\n\r\n";
+ } else {
+ Output() << "HTTP/1.1 200 Ok\r\n\r\n";
if (Buf.Size()) {
Output().Write(Buf.AsCharPtr(), Buf.Size());
- } else {
- Output() << Parent_->Res_;
- }
- }
- Output().Finish();
-
+ } else {
+ Output() << Parent_->Res_;
+ }
+ }
+ Output().Finish();
+
Parent_->LastRequestSentSize_ = Output().SentSize();
- return true;
- }
-
- private:
- TTestHttpServer* Parent_ = nullptr;
- };
-
- public:
+ return true;
+ }
+
+ private:
+ TTestHttpServer* Parent_ = nullptr;
+ };
+
+ public:
inline TTestHttpServer(const TString& res)
- : Res_(res)
- {
- }
-
+ : Res_(res)
+ {
+ }
+
TClientRequest* CreateClient() override {
- return new TRequest(this);
- }
-
+ return new TRequest(this);
+ }
+
size_t LastRequestSentSize() const {
return LastRequestSentSize_;
}
- private:
+ private:
TString Res_;
size_t LastRequestSentSize_ = 0;
- };
-
+ };
+
Y_UNIT_TEST(TestCodings1) {
UNIT_ASSERT(SupportedCodings().size() > 0);
}
-
+
Y_UNIT_TEST(TestHttpInput) {
TString res = "I'm a teapot";
TPortManager pm;
const ui16 port = pm.GetPort();
-
- TTestHttpServer serverImpl(res);
- THttpServer server(&serverImpl, THttpServer::TOptions(port).EnableKeepAlive(true).EnableCompression(true));
-
- UNIT_ASSERT(server.Start());
-
- TNetworkAddress addr("localhost", port);
+
+ TTestHttpServer serverImpl(res);
+ THttpServer server(&serverImpl, THttpServer::TOptions(port).EnableKeepAlive(true).EnableCompression(true));
+
+ UNIT_ASSERT(server.Start());
+
+ TNetworkAddress addr("localhost", port);
TSocket s(addr);
//TDebugOutput dbg;
@@ -109,7 +109,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
TString r;
r += "GET / HTTP/1.1";
r += "\r\n";
- r += "Host: yandex.lo";
+ r += "Host: yandex.lo";
r += "\r\n";
r += "\r\n";
@@ -125,8 +125,8 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
TransferData(&input, &dbg);
}
- server.Stop();
- }
+ server.Stop();
+ }
Y_UNIT_TEST(TestHttpInputDelete) {
TString res = "I'm a teapot";
@@ -240,26 +240,26 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
TString res = "qqqqqq";
TPortManager pm;
const ui16 port = pm.GetPort();
-
- TTestHttpServer serverImpl(res);
- THttpServer server(&serverImpl, THttpServer::TOptions(port).EnableKeepAlive(true).EnableCompression(true));
-
- UNIT_ASSERT(server.Start());
-
- TNetworkAddress addr("localhost", port);
-
+
+ TTestHttpServer serverImpl(res);
+ THttpServer server(&serverImpl, THttpServer::TOptions(port).EnableKeepAlive(true).EnableCompression(true));
+
+ UNIT_ASSERT(server.Start());
+
+ TNetworkAddress addr("localhost", port);
+
TSocket s(addr);
TNullOutput dbg;
- SendMinimalHttpRequest(s, "www.yandex.lo", "/");
+ SendMinimalHttpRequest(s, "www.yandex.lo", "/");
TSocketInput si(s);
THttpInput input(&si);
- unsigned httpCode = ParseHttpRetCode(input.FirstLine());
+ unsigned httpCode = ParseHttpRetCode(input.FirstLine());
UNIT_ASSERT_VALUES_EQUAL(httpCode, 200u);
TransferData(&input, &dbg);
- server.Stop();
+ server.Stop();
}
Y_UNIT_TEST(TestResponseWithBlanks) {
diff --git a/library/cpp/http/io/ut/ya.make b/library/cpp/http/io/ut/ya.make
index de9aee8fb7..84f6949db3 100644
--- a/library/cpp/http/io/ut/ya.make
+++ b/library/cpp/http/io/ut/ya.make
@@ -2,10 +2,10 @@ UNITTEST_FOR(library/cpp/http/io)
OWNER(g:util)
-PEERDIR(
+PEERDIR(
library/cpp/http/server
-)
-
+)
+
SRCS(
chunk_ut.cpp
compression_ut.cpp
diff --git a/library/cpp/http/io/ya.make b/library/cpp/http/io/ya.make
index d28fe909e3..dcfbd79885 100644
--- a/library/cpp/http/io/ya.make
+++ b/library/cpp/http/io/ya.make
@@ -1,9 +1,9 @@
LIBRARY()
-OWNER(
+OWNER(
g:util
- mvel
-)
+ mvel
+)
PEERDIR(
library/cpp/blockcodecs
diff --git a/library/cpp/http/misc/httpreqdata.h b/library/cpp/http/misc/httpreqdata.h
index c8d6e66dc7..16e59c4d78 100644
--- a/library/cpp/http/misc/httpreqdata.h
+++ b/library/cpp/http/misc/httpreqdata.h
@@ -10,7 +10,7 @@
#include <util/network/address.h>
#include <util/network/socket.h>
#include <util/generic/hash.h>
-#include <util/system/yassert.h>
+#include <util/system/yassert.h>
#include <util/generic/string.h>
#include <util/datetime/base.h>
#include <util/generic/buffer.h>
@@ -47,9 +47,9 @@ public:
return Search;
}
- TStringBuf QueryStringBuf() const {
- return TStringBuf(Search, SearchLength);
- }
+ TStringBuf QueryStringBuf() const {
+ return TStringBuf(Search, SearchLength);
+ }
TStringBuf OrigQueryStringBuf() const {
return OrigSearch;
@@ -93,7 +93,7 @@ private:
TString Port;
char* Path;
char* Search;
- size_t SearchLength; // length of Search
+ size_t SearchLength; // length of Search
TStringBuf OrigSearch;
THttpHeadersContainer HeadersIn_;
mutable char AddrData[INET6_ADDRSTRLEN];
diff --git a/library/cpp/http/misc/httpreqdata_ut.cpp b/library/cpp/http/misc/httpreqdata_ut.cpp
index e1d7156656..e7f16ef27c 100644
--- a/library/cpp/http/misc/httpreqdata_ut.cpp
+++ b/library/cpp/http/misc/httpreqdata_ut.cpp
@@ -1,7 +1,7 @@
-#include "httpreqdata.h"
-
+#include "httpreqdata.h"
+
#include <library/cpp/testing/unittest/registar.h>
-
+
Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
Y_UNIT_TEST(Headers) {
TServerRequestData sd;
@@ -44,13 +44,13 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
Y_UNIT_TEST(ParseScan) {
TServerRequestData rd;
-
+
// Parse parses url without host
UNIT_ASSERT(!rd.Parse(" http://yandex.ru/yandsearch?&gta=fake&haha=da HTTP 1.1 OK"));
-
+
// This should work
UNIT_ASSERT(rd.Parse(" /yandsearch?&gta=fake&haha=da HTTP 1.1 OK"));
-
+
UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), "&gta=fake&haha=da");
UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), rd.OrigQueryStringBuf());
@@ -58,10 +58,10 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
UNIT_ASSERT(rd.CgiParam.Has("gta", "fake"));
UNIT_ASSERT(rd.CgiParam.Has("haha", "da"));
UNIT_ASSERT(!rd.CgiParam.Has("no-param"));
-
+
rd.Clear();
}
-
+
Y_UNIT_TEST(Ctor) {
const TString qs("gta=fake&haha=da");
TServerRequestData rd(qs.c_str());
@@ -73,14 +73,14 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
UNIT_ASSERT(rd.CgiParam.Has("haha"));
UNIT_ASSERT(!rd.CgiParam.Has("no-param"));
}
-
+
Y_UNIT_TEST(HashCut) {
const TString qs("&gta=fake&haha=da");
const TString header = " /yandsearch?" + qs + "#&uberParam=yes&q=? HTTP 1.1 OK";
TServerRequestData rd;
rd.Parse(header.c_str());
-
+
UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), qs);
UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), qs);
@@ -89,36 +89,36 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
UNIT_ASSERT(rd.CgiParam.Has("haha"));
UNIT_ASSERT(!rd.CgiParam.Has("uberParam"));
}
-
+
Y_UNIT_TEST(MisplacedHashCut) {
TServerRequestData rd;
rd.Parse(" /y#ndsearch?&gta=fake&haha=da&uberParam=yes&q=? HTTP 1.1 OK");
-
+
UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), "");
UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), "");
rd.Scan();
UNIT_ASSERT(rd.CgiParam.empty());
}
-
+
Y_UNIT_TEST(CornerCase) {
TServerRequestData rd;
rd.Parse(" /yandsearch?#");
-
+
UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), "");
UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), "");
rd.Scan();
UNIT_ASSERT(rd.CgiParam.empty());
}
-
+
Y_UNIT_TEST(AppendQueryString) {
const TString qs("gta=fake&haha=da");
TServerRequestData rd(qs.c_str());
-
+
UNIT_ASSERT(rd.CgiParam.Has("gta", "fake"));
UNIT_ASSERT(rd.CgiParam.Has("haha", "da"));
-
+
UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), qs);
UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), rd.OrigQueryStringBuf());
@@ -129,7 +129,7 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), qs);
rd.Scan();
-
+
UNIT_ASSERT(rd.CgiParam.Has("gta", "true"));
UNIT_ASSERT(rd.CgiParam.Has("gta", "new"));
}
@@ -151,4 +151,4 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
}
}
-} // TRequestServerDataTest
+} // TRequestServerDataTest
diff --git a/library/cpp/http/misc/ya.make b/library/cpp/http/misc/ya.make
index 298be41adc..fceb3cf79c 100644
--- a/library/cpp/http/misc/ya.make
+++ b/library/cpp/http/misc/ya.make
@@ -1,9 +1,9 @@
LIBRARY()
-OWNER(
+OWNER(
g:util
- mvel
-)
+ mvel
+)
GENERATE_ENUM_SERIALIZATION(httpcodes.h)
diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp
index 6980ccd035..128583bdd7 100644
--- a/library/cpp/http/server/http.cpp
+++ b/library/cpp/http/server/http.cpp
@@ -8,7 +8,7 @@
#include <util/generic/intrlist.h>
#include <util/generic/yexception.h>
#include <util/network/address.h>
-#include <util/network/socket.h>
+#include <util/network/socket.h>
#include <util/network/poller.h>
#include <util/system/atomic.h>
#include <util/system/compat.h> // stricmp, strnicmp, strlwr, strupr, stpcpy
@@ -64,7 +64,7 @@ public:
public:
TSocket Socket_;
NAddr::IRemoteAddrRef ListenerSockAddrRef_;
- THttpServer::TImpl* HttpServ_ = nullptr;
+ THttpServer::TImpl* HttpServ_ = nullptr;
bool Reject_ = false;
TInstant LastUsed;
TInstant AcceptMoment;
@@ -131,7 +131,7 @@ public:
public:
TMutex Mutex_;
TIntrusiveListWithAutoDelete<TClientConnection, TDelete> Conns_;
- TSocketPoller* Poller_ = nullptr;
+ TSocketPoller* Poller_ = nullptr;
const THttpServerOptions& Options;
};
@@ -184,7 +184,7 @@ public:
Poller.Reset(new TSocketPoller());
Connections.Reset(new TConnections(Poller.Get(), Options_));
- // Start the listener thread
+ // Start the listener thread
ListenerRunningOK = false;
// throws on error
@@ -204,7 +204,7 @@ public:
return false;
}
- // Wait until the thread has completely started and return the success indicator
+ // Wait until the thread has completely started and return the success indicator
ListenStartEvent.Wait();
return ListenerRunningOK;
@@ -271,15 +271,15 @@ public:
}
}
}
-
+
size_t GetRequestQueueSize() const {
return Requests->Size();
}
-
+
size_t GetFailQueueSize() const {
return FailRequests->Size();
}
-
+
const IThreadPool& GetRequestQueue() const {
return *Requests;
}
@@ -316,7 +316,7 @@ public:
private:
TSocket S_;
- TImpl* Server_ = nullptr;
+ TImpl* Server_ = nullptr;
NAddr::IRemoteAddrRef SockAddrRef_;
};
@@ -407,7 +407,7 @@ public:
}
TImpl(THttpServer* parent, ICallBack* cb, const TOptions& options, IThreadFactory* factory)
- : TImpl(
+ : TImpl(
parent,
cb,
MakeThreadPool<TSimpleThreadPool>(factory, options.UseElasticQueues, cb, options.RequestsThreadName),
@@ -448,14 +448,14 @@ public:
TSystemEvent ListenStartEvent;
TMtpQueueRef Requests;
TMtpQueueRef FailRequests;
- TAtomic ConnectionCount = 0;
+ TAtomic ConnectionCount = 0;
THolder<TSocketPoller> Poller;
THolder<TConnections> Connections;
- bool ListenerRunningOK = false;
+ bool ListenerRunningOK = false;
int ErrorCode = 0;
TOptions Options_;
- ICallBack* Cb_ = nullptr;
- THttpServer* Parent_ = nullptr;
+ ICallBack* Cb_ = nullptr;
+ THttpServer* Parent_ = nullptr;
TWakeupPollAble WakeupPollAble;
TMutex StopMutex;
@@ -630,7 +630,7 @@ bool TClientRequest::Reply(void* /*ThreadSpecificResource*/) {
}
bool TClientRequest::IsLocal() const {
- return HasLocalAddress(Socket());
+ return HasLocalAddress(Socket());
}
bool TClientRequest::CheckLoopback() {
diff --git a/library/cpp/http/server/http.h b/library/cpp/http/server/http.h
index 37a3dc6146..b292d38f27 100644
--- a/library/cpp/http/server/http.h
+++ b/library/cpp/http/server/http.h
@@ -73,7 +73,7 @@ public:
// shutdown a.s.a.p.
void Stop();
- // graceful shutdown with serving all already open connections
+ // graceful shutdown with serving all already open connections
void Shutdown();
void Wait();
diff --git a/library/cpp/http/server/http_ut.cpp b/library/cpp/http/server/http_ut.cpp
index 64a62cc889..cc62bb988e 100644
--- a/library/cpp/http/server/http_ut.cpp
+++ b/library/cpp/http/server/http_ut.cpp
@@ -36,7 +36,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
}
private:
- TEchoServer* Parent_ = nullptr;
+ TEchoServer* Parent_ = nullptr;
};
public:
@@ -163,7 +163,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
}
TString Execute() {
- TSocket* s = nullptr;
+ TSocket* s = nullptr;
THolder<TSocket> singleReqSocket;
if (KeepAliveConnection) {
if (!KeepAlivedSocket) {
@@ -277,48 +277,48 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
}
}
- ui16 Port = 0;
- bool UseHttpOutput = true;
+ ui16 Port = 0;
+ bool UseHttpOutput = true;
TString Type = "GET";
TString ContentEncoding;
TString Content;
- bool KeepAliveConnection = false;
+ bool KeepAliveConnection = false;
THolder<TSocket> KeepAlivedSocket;
- bool EnableResponseEncoding = false;
+ bool EnableResponseEncoding = false;
TString Hdr;
bool Expect100Continue = false;
};
class TFailingMtpQueue: public TSimpleThreadPool {
- private:
- bool FailOnAdd_ = false;
+ private:
+ bool FailOnAdd_ = false;
- public:
- void SetFailOnAdd(bool fail = true) {
- FailOnAdd_ = fail;
- }
+ public:
+ void SetFailOnAdd(bool fail = true) {
+ FailOnAdd_ = fail;
+ }
[[nodiscard]] bool Add(IObjectInQueue* pObj) override {
- if (FailOnAdd_) {
- return false;
- }
-
+ if (FailOnAdd_) {
+ return false;
+ }
+
return TSimpleThreadPool::Add(pObj);
- }
- TFailingMtpQueue() = default;
+ }
+ TFailingMtpQueue() = default;
TFailingMtpQueue(IThreadFactory* pool)
: TSimpleThreadPool(pool)
- {
- }
- };
-
+ {
+ }
+ };
+
TString TestData(size_t size = 5 * 4096) {
TString res;
- for (size_t i = 0; i < size; ++i) {
+ for (size_t i = 0; i < size; ++i) {
res += (char)i;
}
- return res;
- }
+ return res;
+ }
Y_UNIT_TEST(TestEchoServer) {
TString res = TestData();
@@ -338,7 +338,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
for (bool keepAlive : trueFalse) {
r.KeepAliveConnection = keepAlive;
- // THttpOutput use chunked stream, else use Content-Length
+ // THttpOutput use chunked stream, else use Content-Length
for (bool useHttpOutput : trueFalse) {
r.UseHttpOutput = useHttpOutput;
@@ -367,7 +367,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
server.Stop();
}
}
-
+
Y_UNIT_TEST(TestReusePortEnabled) {
if (!IsReusePortAvailable()) {
return; // skip test
@@ -423,38 +423,38 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
}
Y_UNIT_TEST(TestFailServer) {
- /**
- * Emulate request processing failures
- * Data should be large enough not to fit into socket buffer
- **/
+ /**
+ * Emulate request processing failures
+ * Data should be large enough not to fit into socket buffer
+ **/
TString res = TestData(10 * 1024 * 1024);
TPortManager portManager;
const ui16 port = portManager.GetPort();
- TEchoServer serverImpl(res);
- THttpServer::TOptions options(port);
- options.EnableKeepAlive(true);
- options.EnableCompression(true);
+ TEchoServer serverImpl(res);
+ THttpServer::TOptions options(port);
+ options.EnableKeepAlive(true);
+ options.EnableCompression(true);
using TFailingServerMtpQueue = TThreadPoolBinder<TFailingMtpQueue, THttpServer::ICallBack>;
THttpServer::TMtpQueueRef mainWorkers = new TFailingServerMtpQueue(&serverImpl, SystemThreadFactory());
THttpServer::TMtpQueueRef failWorkers = new TThreadPool(SystemThreadFactory());
- THttpServer server(&serverImpl, mainWorkers, failWorkers, options);
-
- UNIT_ASSERT(server.Start());
- for (size_t i = 0; i < 3; ++i) {
- // should fail on 2nd request
- static_cast<TFailingMtpQueue*>(mainWorkers.Get())->SetFailOnAdd(i == 1);
- TTestRequest r(port);
- r.Content = res;
- r.Type = "POST";
+ THttpServer server(&serverImpl, mainWorkers, failWorkers, options);
+
+ UNIT_ASSERT(server.Start());
+ for (size_t i = 0; i < 3; ++i) {
+ // should fail on 2nd request
+ static_cast<TFailingMtpQueue*>(mainWorkers.Get())->SetFailOnAdd(i == 1);
+ TTestRequest r(port);
+ r.Content = res;
+ r.Type = "POST";
TString resp = r.Execute();
- if (i == 1) {
+ if (i == 1) {
UNIT_ASSERT(resp.Contains("Service Unavailable"));
- } else {
- UNIT_ASSERT_C(resp == res, "diff echo response for request:\n" + r.GetDescription());
- }
- }
- server.Stop();
- }
+ } else {
+ UNIT_ASSERT_C(resp == res, "diff echo response for request:\n" + r.GetDescription());
+ }
+ }
+ server.Stop();
+ }
class TReleaseConnectionServer: public THttpServer::ICallBack {
class TRequest: public THttpClientRequestEx {
diff --git a/library/cpp/http/server/options.h b/library/cpp/http/server/options.h
index 6ff69defd7..38eda0e5e7 100644
--- a/library/cpp/http/server/options.h
+++ b/library/cpp/http/server/options.h
@@ -11,7 +11,7 @@
class THttpServerOptions {
public:
inline THttpServerOptions(ui16 port = 17000) noexcept
- : Port(port)
+ : Port(port)
{
}
@@ -146,8 +146,8 @@ public:
typedef TVector<TAddr> TAddrs;
- bool KeepAliveEnabled = true;
- bool CompressionEnabled = false;
+ bool KeepAliveEnabled = true;
+ bool CompressionEnabled = false;
bool RejectExcessConnections = false;
bool ReusePort = false; // set SO_REUSEPORT socket option
bool ReuseAddress = true; // set SO_REUSEADDR socket option
@@ -157,10 +157,10 @@ public:
const char* ServerName = "YWS/1.0"; // The Web server name to return in HTTP headers
ui32 nThreads = 0; // Thread count for requests processing
ui32 MaxQueueSize = 0; // Max allowed request count in queue
- ui32 nFThreads = 1;
- ui32 MaxFQueueSize = 0;
- ui32 MaxConnections = 100;
- int ListenBacklog = SOMAXCONN;
+ ui32 nFThreads = 1;
+ ui32 MaxFQueueSize = 0;
+ ui32 MaxConnections = 100;
+ int ListenBacklog = SOMAXCONN;
TDuration ClientTimeout;
size_t OutputBufferSize = 0;
ui64 MaxInputContentLength = sizeof(size_t) <= 4 ? 2_GB : 64_GB;
diff --git a/library/cpp/http/server/ya.make b/library/cpp/http/server/ya.make
index a8cf9f2c0e..bae6f33306 100644
--- a/library/cpp/http/server/ya.make
+++ b/library/cpp/http/server/ya.make
@@ -2,8 +2,8 @@ LIBRARY()
OWNER(
pg
- mvel
- kulikov
+ mvel
+ kulikov
g:base
g:middle
)
diff --git a/library/cpp/ipv6_address/ipv6_address.cpp b/library/cpp/ipv6_address/ipv6_address.cpp
index 24f3bde65d..be8fcbae13 100644
--- a/library/cpp/ipv6_address/ipv6_address.cpp
+++ b/library/cpp/ipv6_address/ipv6_address.cpp
@@ -9,7 +9,7 @@
#include <util/network/init.h>
#include <util/string/cast.h>
#include <util/string/split.h>
-#include <util/system/byteorder.h>
+#include <util/system/byteorder.h>
#include <util/ysaveload.h>
#include <array>
diff --git a/library/cpp/json/ut/json_reader_ut.cpp b/library/cpp/json/ut/json_reader_ut.cpp
index e9e9953551..cd31afa0b8 100644
--- a/library/cpp/json/ut/json_reader_ut.cpp
+++ b/library/cpp/json/ut/json_reader_ut.cpp
@@ -372,17 +372,17 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) {
UNIT_ASSERT_EXCEPTION(ReadJsonTree(&in, &value, true), TJsonException);
}
}
-
+
Y_UNIT_TEST(TJsonMemoryLeakTest) {
- // after https://clubs.at.yandex-team.ru/stackoverflow/3691
+ // after https://clubs.at.yandex-team.ru/stackoverflow/3691
TString s = ".";
- NJson::TJsonValue json;
- try {
- TStringInput in(s);
- NJson::ReadJsonTree(&in, &json, true);
- } catch (...) {
- }
- } // TJsonMemoryLeakTest
+ NJson::TJsonValue json;
+ try {
+ TStringInput in(s);
+ NJson::ReadJsonTree(&in, &json, true);
+ } catch (...) {
+ }
+ } // TJsonMemoryLeakTest
Y_UNIT_TEST(TJsonDuplicateKeysWithNullValuesTest) {
const TString json = "{\"\":null,\"\":\"\"}";
diff --git a/library/cpp/json/writer/ya.make b/library/cpp/json/writer/ya.make
index 2c4a9757cb..3989ff3504 100644
--- a/library/cpp/json/writer/ya.make
+++ b/library/cpp/json/writer/ya.make
@@ -8,7 +8,7 @@ OWNER(
PEERDIR(
library/cpp/json/common
-)
+)
SRCS(
json_value.cpp
diff --git a/library/cpp/lfalloc/lf_allocX64.h b/library/cpp/lfalloc/lf_allocX64.h
index b18cccc6c8..fd2a906d6f 100644
--- a/library/cpp/lfalloc/lf_allocX64.h
+++ b/library/cpp/lfalloc/lf_allocX64.h
@@ -1871,11 +1871,11 @@ static const char* LFAlloc_GetParam(const char* param) {
static Y_FORCE_INLINE int LFPosixMemalign(void** memptr, size_t alignment, size_t size) {
if (Y_UNLIKELY(alignment > 4096)) {
const char* error = "Larger alignment are not guaranteed with this implementation\n";
-#ifdef _win_
+#ifdef _win_
OutputDebugStringA(error);
-#endif
+#endif
NMalloc::AbortFromCorruptedAllocator(error);
- }
+ }
size_t bigsize = size;
if (bigsize <= alignment) {
bigsize = alignment;
diff --git a/library/cpp/logger/ya.make b/library/cpp/logger/ya.make
index 1d0ba09257..00a5263cba 100644
--- a/library/cpp/logger/ya.make
+++ b/library/cpp/logger/ya.make
@@ -1,9 +1,9 @@
-OWNER(
- pg
- mvel
+OWNER(
+ pg
+ mvel
g:util
g:base
-)
+)
LIBRARY()
diff --git a/library/cpp/messagebus/misc/tokenquota.h b/library/cpp/messagebus/misc/tokenquota.h
index 375bfa2130..190547fa54 100644
--- a/library/cpp/messagebus/misc/tokenquota.h
+++ b/library/cpp/messagebus/misc/tokenquota.h
@@ -21,9 +21,9 @@ namespace NBus {
, Acquired(0)
, WakeLev(wake < 1 ? Max<size_t>(1, tokens / 2) : 0)
, Tokens_(tokens)
- {
+ {
Y_UNUSED(padd_);
- }
+ }
bool Acquire(TAtomic level = 1, bool force = false) {
level = Max(TAtomicBase(level), TAtomicBase(1));
diff --git a/library/cpp/messagebus/network.cpp b/library/cpp/messagebus/network.cpp
index de1998d257..304bedae5a 100644
--- a/library/cpp/messagebus/network.cpp
+++ b/library/cpp/messagebus/network.cpp
@@ -125,7 +125,7 @@ std::pair<unsigned, TVector<TBindResult>> NBus::BindOnPort(int port, bool reuseP
void NBus::NPrivate::SetSockOptTcpCork(SOCKET s, bool value) {
#ifdef _linux_
CheckedSetSockOpt(s, IPPROTO_TCP, TCP_CORK, (int)value, "TCP_CORK");
-#else
+#else
Y_UNUSED(s);
Y_UNUSED(value);
#endif
diff --git a/library/cpp/on_disk/chunks/reader.cpp b/library/cpp/on_disk/chunks/reader.cpp
index ae54e844a9..6e28cbf367 100644
--- a/library/cpp/on_disk/chunks/reader.cpp
+++ b/library/cpp/on_disk/chunks/reader.cpp
@@ -12,11 +12,11 @@ static inline void ReadAux(const char* data, T* aux, T count, TVector<const char
}
}
-TChunkedDataReader::TChunkedDataReader(const TBlob& blob) {
+TChunkedDataReader::TChunkedDataReader(const TBlob& blob) {
const char* cdata = blob.AsCharPtr();
const size_t size = blob.Size();
- Y_ENSURE(size >= sizeof(ui32), "Empty file with chunks. ");
-
+ Y_ENSURE(size >= sizeof(ui32), "Empty file with chunks. ");
+
ui32 last = ReadUnaligned<ui32>((ui32*)(cdata + size) - 1);
if (last != 0) { // old version file
@@ -29,11 +29,11 @@ TChunkedDataReader::TChunkedDataReader(const TBlob& blob) {
return;
}
- Y_ENSURE(size >= 3 * sizeof(ui64), "Blob size must be >= 3 * sizeof(ui64). ");
-
+ Y_ENSURE(size >= 3 * sizeof(ui64), "Blob size must be >= 3 * sizeof(ui64). ");
+
ui64* aux = (ui64*)(cdata + size);
Version = ReadUnaligned<ui64>(aux - 2);
- Y_ENSURE(Version > 0, "Invalid chunked array version. ");
+ Y_ENSURE(Version > 0, "Invalid chunked array version. ");
ui64 count = ReadUnaligned<ui64>(aux - 3);
diff --git a/library/cpp/packedtypes/longs.h b/library/cpp/packedtypes/longs.h
index 72a868c3f9..084098d705 100644
--- a/library/cpp/packedtypes/longs.h
+++ b/library/cpp/packedtypes/longs.h
@@ -1,7 +1,7 @@
#pragma once
#include <util/system/defaults.h> // _BIDSCLASS _EXPCLASS
-#include <util/system/yassert.h>
+#include <util/system/yassert.h>
#include <util/system/unaligned_mem.h>
#define PUT_8(x, buf, shift) WriteUnaligned<ui8>((buf)++, (x) >> (shift))
@@ -305,43 +305,43 @@ inline int out_long(const i32& longVal, char* ptrBuf) {
inline int len_long(const i32& longVal) {
return MY_32(longVal);
}
-
-template <typename T, typename C>
-inline const C* Unpack32(T& x, const C* src) {
- int pkLen = 0;
- const char* c = reinterpret_cast<const char*>(src);
+
+template <typename T, typename C>
+inline const C* Unpack32(T& x, const C* src) {
+ int pkLen = 0;
+ const char* c = reinterpret_cast<const char*>(src);
Y_UNUSED(pkLen);
UNPACK_32(x, c, mem_traits, pkLen);
Y_ASSERT(pkLen);
- return reinterpret_cast<const C*>(c);
-}
-
-template <typename T, typename C>
-inline const C* Unpack64(T& x, const C* src) {
- int pkLen = 0;
- const char* c = reinterpret_cast<const char*>(src);
+ return reinterpret_cast<const C*>(c);
+}
+
+template <typename T, typename C>
+inline const C* Unpack64(T& x, const C* src) {
+ int pkLen = 0;
+ const char* c = reinterpret_cast<const char*>(src);
Y_UNUSED(pkLen);
- UNPACK_64(x, c, mem_traits, pkLen);
+ UNPACK_64(x, c, mem_traits, pkLen);
Y_ASSERT(pkLen);
- return reinterpret_cast<const C*>(c);
-}
-
-template <typename T, typename C>
-inline C* Pack32(const T& x, C* dest) {
- int pkLen = 0;
+ return reinterpret_cast<const C*>(c);
+}
+
+template <typename T, typename C>
+inline C* Pack32(const T& x, C* dest) {
+ int pkLen = 0;
Y_UNUSED(pkLen);
- char* c = reinterpret_cast<char*>(dest);
+ char* c = reinterpret_cast<char*>(dest);
PACK_32(x, c, mem_traits, pkLen);
Y_ASSERT(pkLen);
- return reinterpret_cast<C*>(c);
-}
-
-template <typename T, typename C>
-inline C* Pack64(const T& x, C* dest) {
- int pkLen = 0;
+ return reinterpret_cast<C*>(c);
+}
+
+template <typename T, typename C>
+inline C* Pack64(const T& x, C* dest) {
+ int pkLen = 0;
Y_UNUSED(pkLen);
- char* c = reinterpret_cast<char*>(dest);
- PACK_64(x, c, mem_traits, pkLen);
+ char* c = reinterpret_cast<char*>(dest);
+ PACK_64(x, c, mem_traits, pkLen);
Y_ASSERT(pkLen);
- return reinterpret_cast<C*>(c);
-}
+ return reinterpret_cast<C*>(c);
+}
diff --git a/library/cpp/packedtypes/packed.h b/library/cpp/packedtypes/packed.h
index 6628b5642d..88cff26ae2 100644
--- a/library/cpp/packedtypes/packed.h
+++ b/library/cpp/packedtypes/packed.h
@@ -69,7 +69,7 @@ void Y_FORCE_INLINE PackUI32(IOutputStream& out, ui32 v) {
char buf[sizeof(ui32)];
char* bufPtr = buf;
size_t size;
- PACK_28(v, bufPtr, mem_traits, size);
+ PACK_28(v, bufPtr, mem_traits, size);
out.Write(buf, size);
}
@@ -86,7 +86,7 @@ struct TInputStream2Traits<TZCMemoryInput> {
template <class TStream>
void Y_FORCE_INLINE UnPackUI32(TStream& in, ui32& v) {
size_t size;
- UNPACK_28(v, in, TInputStream2Traits<TStream>::TTraits, size);
+ UNPACK_28(v, in, TInputStream2Traits<TStream>::TTraits, size);
(void)size;
}
diff --git a/library/cpp/packedtypes/packed_ut.cpp b/library/cpp/packedtypes/packed_ut.cpp
index 9ddf0fe296..70a22cf9c3 100644
--- a/library/cpp/packedtypes/packed_ut.cpp
+++ b/library/cpp/packedtypes/packed_ut.cpp
@@ -2,51 +2,51 @@
#include <library/cpp/testing/unittest/registar.h>
-#include <util/system/defaults.h>
-#include <util/generic/ylimits.h>
+#include <util/system/defaults.h>
+#include <util/generic/ylimits.h>
#include <util/generic/buffer.h>
#include <util/stream/mem.h>
#include <util/stream/buffer.h>
-namespace NPrivate {
+namespace NPrivate {
#if 0
-static ui64 gSeed = 42;
-
-template<typename T>
-static T PseudoRandom(T max = Max<T>()) {
+static ui64 gSeed = 42;
+
+template<typename T>
+static T PseudoRandom(T max = Max<T>()) {
Y_ASSERT(max != 0);
- // stupid and non-threadsafe, but very predictable chaos generator
- gSeed += 1;
- gSeed *= 419;
- gSeed = gSeed ^ (ui64(max) << 17u);
- return gSeed % max;
-};
+ // stupid and non-threadsafe, but very predictable chaos generator
+ gSeed += 1;
+ gSeed *= 419;
+ gSeed = gSeed ^ (ui64(max) << 17u);
+ return gSeed % max;
+};
#endif
}
-
+
Y_UNIT_TEST_SUITE(TPackedTest) {
void TestPackUi32Sub(ui32 v, const TVector<char>& p) {
TBufferOutput out;
PackUI32(out, v);
const TBuffer& buf = out.Buffer();
- UNIT_ASSERT_VALUES_EQUAL(buf.Size(), p.size());
+ UNIT_ASSERT_VALUES_EQUAL(buf.Size(), p.size());
UNIT_ASSERT(!memcmp(buf.Data(), &p[0], buf.Size()));
{
TBufferInput in(buf);
ui32 v2;
UnPackUI32(in, v2);
- UNIT_ASSERT_VALUES_EQUAL(v, v2);
+ UNIT_ASSERT_VALUES_EQUAL(v, v2);
}
{
TZCMemoryInput in(buf.Data(), buf.Size());
ui32 v2;
UnPackUI32(in, v2);
- UNIT_ASSERT_VALUES_EQUAL(v, v2);
+ UNIT_ASSERT_VALUES_EQUAL(v, v2);
}
}
-
+
Y_UNIT_TEST(TestPackUi32) {
ui32 v;
TVector<char> pv;
@@ -87,44 +87,44 @@ Y_UNIT_TEST_SUITE(TPackedTest) {
#endif
TestPackUi32Sub(v, pv);
}
-
-#if 0
+
+#if 0
Y_UNIT_TEST(ReadWrite32) {
- TBuffer buffer(65536);
-
- char* writePtr = buffer.Data();
+ TBuffer buffer(65536);
+
+ char* writePtr = buffer.Data();
TVector<ui32> correctNumbers;
- for (size_t i = 0; i < 1000; ++i) {
- ui32 randNum = NPrivate::PseudoRandom<ui32>();
- correctNumbers.push_back(randNum);
- writePtr = Pack32(randNum, writePtr);
- }
-
- const char* readPtr = buffer.Data();
- for (size_t i = 0; i < correctNumbers.size(); ++i) {
- ui32 value = 0xCCCCCCCC;
- readPtr = Unpack32(value, readPtr);
- UNIT_ASSERT_VALUES_EQUAL(value, correctNumbers[i]);
- }
- }
-
+ for (size_t i = 0; i < 1000; ++i) {
+ ui32 randNum = NPrivate::PseudoRandom<ui32>();
+ correctNumbers.push_back(randNum);
+ writePtr = Pack32(randNum, writePtr);
+ }
+
+ const char* readPtr = buffer.Data();
+ for (size_t i = 0; i < correctNumbers.size(); ++i) {
+ ui32 value = 0xCCCCCCCC;
+ readPtr = Unpack32(value, readPtr);
+ UNIT_ASSERT_VALUES_EQUAL(value, correctNumbers[i]);
+ }
+ }
+
Y_UNIT_TEST(ReadWrite64) {
- TBuffer buffer(65536);
-
- char* writePtr = buffer.Data();
+ TBuffer buffer(65536);
+
+ char* writePtr = buffer.Data();
TVector<ui64> correctNumbers;
- for (size_t i = 0; i < 1000; ++i) {
- ui64 randNum = NPrivate::PseudoRandom<ui64>();
- correctNumbers.push_back(randNum);
- writePtr = Pack64(randNum, writePtr);
- }
-
- const char* readPtr = buffer.Data();
- for (size_t i = 0; i < correctNumbers.size(); ++i) {
- ui64 value = 0xDEADBEEF;
- readPtr = Unpack64(value, readPtr);
- UNIT_ASSERT_VALUES_EQUAL(value, correctNumbers[i]);
- }
- }
-#endif
+ for (size_t i = 0; i < 1000; ++i) {
+ ui64 randNum = NPrivate::PseudoRandom<ui64>();
+ correctNumbers.push_back(randNum);
+ writePtr = Pack64(randNum, writePtr);
+ }
+
+ const char* readPtr = buffer.Data();
+ for (size_t i = 0; i < correctNumbers.size(); ++i) {
+ ui64 value = 0xDEADBEEF;
+ readPtr = Unpack64(value, readPtr);
+ UNIT_ASSERT_VALUES_EQUAL(value, correctNumbers[i]);
+ }
+ }
+#endif
};
diff --git a/library/cpp/streams/lz/lz.cpp b/library/cpp/streams/lz/lz.cpp
index a94d5f1f23..b65bb3ed96 100644
--- a/library/cpp/streams/lz/lz.cpp
+++ b/library/cpp/streams/lz/lz.cpp
@@ -103,7 +103,7 @@ private:
if (len) {
const size_t out = this->Compress((const char*)ptr, len, (char*)Block(), this->AdditionalDataLength());
- // catch compressor buffer overrun (e.g. SEARCH-2043)
+ // catch compressor buffer overrun (e.g. SEARCH-2043)
//Y_VERIFY(out <= this->Hint(this->BlockSize()));
if (out < len || TCompressor::SaveIncompressibleChunks()) {
@@ -377,9 +377,9 @@ public:
}
static inline size_t Hint(size_t len) noexcept {
- // see SEARCH-2043 and, e.g. examples at
- // http://stackoverflow.com/questions/4235019/how-to-get-lzo-to-work-with-a-file-stream
- return len + (len / 16) + 64 + 3;
+ // see SEARCH-2043 and, e.g. examples at
+ // http://stackoverflow.com/questions/4235019/how-to-get-lzo-to-work-with-a-file-stream
+ return len + (len / 16) + 64 + 3;
}
static inline bool SaveIncompressibleChunks() noexcept {
@@ -502,7 +502,7 @@ public:
static const char signature[];
static inline size_t Hint(size_t len) noexcept {
- return Max<size_t>(snappy::MaxCompressedLength(len), 100);
+ return Max<size_t>(snappy::MaxCompressedLength(len), 100);
}
inline size_t Compress(const char* data, size_t len, char* ptr, size_t /*dstMaxSize*/) {
@@ -561,8 +561,8 @@ public:
}
inline bool SaveIncompressibleChunks() const noexcept {
- // we must save incompressible chunks "as is"
- // after compressor run in streaming mode
+ // we must save incompressible chunks "as is"
+ // after compressor run in streaming mode
return Table_->Setting(3);
}
diff --git a/library/cpp/streams/lz/lz_ut.cpp b/library/cpp/streams/lz/lz_ut.cpp
index b3ee24af7b..6876f070fc 100644
--- a/library/cpp/streams/lz/lz_ut.cpp
+++ b/library/cpp/streams/lz/lz_ut.cpp
@@ -4,75 +4,75 @@
#include <library/cpp/resource/resource.h>
#include <util/stream/file.h>
-#include <util/generic/vector.h>
+#include <util/generic/vector.h>
#include <util/system/tempfile.h>
#include <util/generic/singleton.h>
#define LDATA "./ldata"
-#define LDATA_RANDOM "./ldata.random"
+#define LDATA_RANDOM "./ldata.random"
static const TString data = "aa aaa aa aaa aa aaa bb bbb bb bbb bb bbb";
namespace {
- /**
- * Produces well-formed random crap
- **/
+ /**
+ * Produces well-formed random crap
+ **/
TString RandomString(size_t size) {
TString entropy(NResource::Find("/random.data"));
TString result;
- size_t seed = 1;
- size_t j = 0;
- for (size_t i = 0; i < size; ++i) {
- seed *= 3;
- char sym;
- do {
- sym = char((seed ^ i) % 256);
- if (!sym) {
- seed += 1;
- }
- } while (!sym);
+ size_t seed = 1;
+ size_t j = 0;
+ for (size_t i = 0; i < size; ++i) {
+ seed *= 3;
+ char sym;
+ do {
+ sym = char((seed ^ i) % 256);
+ if (!sym) {
+ seed += 1;
+ }
+ } while (!sym);
Y_ASSERT(sym);
j = (j + 1) % entropy.size();
- result += char(sym + entropy[j]);
- }
- return result;
- }
-
+ result += char(sym + entropy[j]);
+ }
+ return result;
+ }
+
TVector<TString> InitRandomData() {
static const TVector<size_t> sizes = {
- 0,
- 1,
- 127,
- 2017,
- 32767,
- };
-
+ 0,
+ 1,
+ 127,
+ 2017,
+ 32767,
+ };
+
TVector<TString> result;
- for (auto size : sizes) {
- result.push_back(RandomString(size));
- }
+ for (auto size : sizes) {
+ result.push_back(RandomString(size));
+ }
result.push_back(NResource::Find("/request.data"));
- return result;
- }
-
+ return result;
+ }
+
TString TestFileName(const TString& d, size_t bufferSize) {
return LDATA_RANDOM + TString(".") + ToString(d.size()) + TString(".") + ToString(bufferSize);
- }
-
+ }
+
struct TRandomData: public TVector<TString> {
inline TRandomData() {
InitRandomData().swap(*this);
}
};
}
-
+
static const TVector<size_t> bufferSizes = {
- 127,
- 1024,
- 32768,
-};
-
-namespace {
+ 127,
+ 1024,
+ 32768,
+};
+
+namespace {
template <TLzqCompress::EVersion Ver, int Level, TLzqCompress::EMode Mode>
struct TLzqCompressX: public TLzqCompress {
inline TLzqCompressX(IOutputStream* out, size_t bufLen)
@@ -83,7 +83,7 @@ namespace {
}
template <class C>
-static inline void TestGoodDataCompress() {
+static inline void TestGoodDataCompress() {
TFixedBufferFileOutput o(LDATA);
C c(&o, 1024);
@@ -99,28 +99,28 @@ static inline void TestGoodDataCompress() {
o.Finish();
}
-template <class C>
+template <class C>
static inline void TestIncompressibleDataCompress(const TString& d, size_t bufferSize) {
TString testFileName = TestFileName(d, bufferSize);
TFixedBufferFileOutput o(testFileName);
- C c(&o, bufferSize);
+ C c(&o, bufferSize);
c.Write(d.data(), d.size());
- c.Finish();
- o.Finish();
-}
-
-template <class C>
-static inline void TestCompress() {
- TestGoodDataCompress<C>();
- for (auto bufferSize : bufferSizes) {
+ c.Finish();
+ o.Finish();
+}
+
+template <class C>
+static inline void TestCompress() {
+ TestGoodDataCompress<C>();
+ for (auto bufferSize : bufferSizes) {
for (auto rd : *Singleton<TRandomData>()) {
- TestIncompressibleDataCompress<C>(rd, bufferSize);
- }
- }
-}
-
+ TestIncompressibleDataCompress<C>(rd, bufferSize);
+ }
+ }
+}
+
template <class D>
-static inline void TestGoodDataDecompress() {
+static inline void TestGoodDataDecompress() {
TTempFile tmpFile(LDATA);
{
@@ -137,29 +137,29 @@ static inline void TestGoodDataDecompress() {
}
}
-template <class D>
+template <class D>
static inline void TestIncompressibleDataDecompress(const TString& d, size_t bufferSize) {
TString testFileName = TestFileName(d, bufferSize);
- TTempFile tmpFile(testFileName);
-
- {
+ TTempFile tmpFile(testFileName);
+
+ {
TFileInput i(testFileName);
- D ld(&i);
-
- UNIT_ASSERT_EQUAL(ld.ReadAll(), d);
- }
-}
-
-template <class D>
-static inline void TestDecompress() {
- TestGoodDataDecompress<D>();
- for (auto bufferSize : bufferSizes) {
+ D ld(&i);
+
+ UNIT_ASSERT_EQUAL(ld.ReadAll(), d);
+ }
+}
+
+template <class D>
+static inline void TestDecompress() {
+ TestGoodDataDecompress<D>();
+ for (auto bufferSize : bufferSizes) {
for (auto rd : *Singleton<TRandomData>()) {
- TestIncompressibleDataDecompress<D>(rd, bufferSize);
- }
- }
-}
-
+ TestIncompressibleDataDecompress<D>(rd, bufferSize);
+ }
+ }
+}
+
class TMixedDecompress: public IInputStream {
public:
TMixedDecompress(IInputStream* input)
diff --git a/library/cpp/string_utils/scan/scan.h b/library/cpp/string_utils/scan/scan.h
index fcadeee89c..703db54321 100644
--- a/library/cpp/string_utils/scan/scan.h
+++ b/library/cpp/string_utils/scan/scan.h
@@ -2,18 +2,18 @@
#include <util/generic/strbuf.h>
-template <bool addAll, char sep, char sepKeyVal, class F>
+template <bool addAll, char sep, char sepKeyVal, class F>
static inline void ScanKeyValue(TStringBuf s, F&& f) {
TStringBuf key, val;
while (!s.empty()) {
- val = s.NextTok(sep);
+ val = s.NextTok(sep);
if (val.empty()) {
continue; // && case
}
- key = val.NextTok(sepKeyVal);
+ key = val.NextTok(sepKeyVal);
if (addAll || val.IsInited()) {
f(key, val); // includes empty keys
diff --git a/library/cpp/testing/unittest/checks.cpp b/library/cpp/testing/unittest/checks.cpp
index ae63a1c064..c5712ae9d2 100644
--- a/library/cpp/testing/unittest/checks.cpp
+++ b/library/cpp/testing/unittest/checks.cpp
@@ -3,8 +3,8 @@
bool CheckExceptionMessage(const char* msg, TString& err) {
static const char* badMsg[] = {
- // Операция успешно завершена [cp1251]
- "\xce\xef\xe5\xf0\xe0\xf6\xe8\xff\x20\xf3\xf1\xef\xe5\xf8\xed\xee\x20\xe7\xe0\xe2\xe5\xf0\xf8\xe5\xed\xe0",
+ // Операция успешно завершена [cp1251]
+ "\xce\xef\xe5\xf0\xe0\xf6\xe8\xff\x20\xf3\xf1\xef\xe5\xf8\xed\xee\x20\xe7\xe0\xe2\xe5\xf0\xf8\xe5\xed\xe0",
"The operation completed successfully",
"No error"};
diff --git a/library/cpp/threading/future/ya.make b/library/cpp/threading/future/ya.make
index f96d746684..6591031f46 100644
--- a/library/cpp/threading/future/ya.make
+++ b/library/cpp/threading/future/ya.make
@@ -16,7 +16,7 @@ SRCS(
)
END()
-
-RECURSE_FOR_TESTS(
- mt_ut
-)
+
+RECURSE_FOR_TESTS(
+ mt_ut
+)
diff --git a/library/cpp/unicode/normalization/ut/normalization_ut.cpp b/library/cpp/unicode/normalization/ut/normalization_ut.cpp
index af46d981cd..54d4940a26 100644
--- a/library/cpp/unicode/normalization/ut/normalization_ut.cpp
+++ b/library/cpp/unicode/normalization/ut/normalization_ut.cpp
@@ -1,32 +1,32 @@
#include <library/cpp/testing/unittest/registar.h>
-
-#include <util/charset/wide.h>
-
+
+#include <util/charset/wide.h>
+
#include <library/cpp/unicode/normalization/normalization.h>
-
+
Y_UNIT_TEST_SUITE(TUnicodeNormalizationTest) {
template <NUnicode::ENormalization NormType>
- void TestInit() {
- NUnicode::TNormalizer<NormType> normalizer;
+ void TestInit() {
+ NUnicode::TNormalizer<NormType> normalizer;
TString s("упячка detected");
TUtf16String w;
UTF8ToWide(s, w);
- normalizer.Normalize(w);
- }
-
+ normalizer.Normalize(w);
+ }
+
Y_UNIT_TEST(TestInitNFD) {
- TestInit<NUnicode::NFD>();
- }
-
+ TestInit<NUnicode::NFD>();
+ }
+
Y_UNIT_TEST(TestInitNFC) {
- TestInit<NUnicode::NFC>();
- }
-
+ TestInit<NUnicode::NFC>();
+ }
+
Y_UNIT_TEST(TestInitNFKD) {
- TestInit<NUnicode::NFKD>();
- }
-
+ TestInit<NUnicode::NFKD>();
+ }
+
Y_UNIT_TEST(TestInitNFKC) {
- TestInit<NUnicode::NFKC>();
- }
-}
+ TestInit<NUnicode::NFKC>();
+ }
+}
diff --git a/library/cpp/unicode/normalization/ut/ya.make b/library/cpp/unicode/normalization/ut/ya.make
index 7e12f1a2f6..a74372d9e1 100644
--- a/library/cpp/unicode/normalization/ut/ya.make
+++ b/library/cpp/unicode/normalization/ut/ya.make
@@ -1,13 +1,13 @@
-UNITTEST()
-
-OWNER(mvel)
-
-PEERDIR(
+UNITTEST()
+
+OWNER(mvel)
+
+PEERDIR(
library/cpp/unicode/normalization
-)
-
-SRCS(
- normalization_ut.cpp
-)
-
-END()
+)
+
+SRCS(
+ normalization_ut.cpp
+)
+
+END()
diff --git a/library/cpp/uri/ya.make b/library/cpp/uri/ya.make
index 19aad4a320..8fc808a6af 100644
--- a/library/cpp/uri/ya.make
+++ b/library/cpp/uri/ya.make
@@ -1,9 +1,9 @@
LIBRARY()
-OWNER(
- mvel
+OWNER(
+ mvel
g:base
-)
+)
SRCS(
assign.cpp