aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorIlnur Khuziev <ilnur.khuziev@yandex.ru>2022-02-10 16:46:13 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:13 +0300
commit736dcd8ca259457a136f2f9f9168c44643914323 (patch)
treeddd46a036d68bfa83aa11b892f31243ea6b068a1 /util
parent9bf2fa2b060c9881d3135c2208c624a1dd546ecc (diff)
downloadydb-736dcd8ca259457a136f2f9f9168c44643914323.tar.gz
Restoring authorship annotation for Ilnur Khuziev <ilnur.khuziev@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/charset/benchmark/to_lower/main.cpp2
-rw-r--r--util/charset/benchmark/utf8_to_wide/main.cpp104
-rw-r--r--util/charset/utf8.h2
-rw-r--r--util/charset/utf8_ut.cpp4
-rw-r--r--util/charset/wide.cpp344
-rw-r--r--util/charset/wide.h240
-rw-r--r--util/charset/wide_sse41.cpp352
-rw-r--r--util/charset/wide_ut.cpp2
-rw-r--r--util/datetime/base_ut.cpp2
-rw-r--r--util/datetime/parser_deprecated_ut.cpp2
-rw-r--r--util/datetime/parser_ut.cpp2
-rw-r--r--util/datetime/uptime_ut.cpp2
-rw-r--r--util/digest/fnv_ut.cpp2
-rw-r--r--util/digest/multi_ut.cpp2
-rw-r--r--util/digest/murmur.h2
-rw-r--r--util/digest/murmur_ut.cpp2
-rw-r--r--util/digest/sequence_ut.cpp2
-rw-r--r--util/draft/date_ut.cpp2
-rw-r--r--util/draft/datetime_ut.cpp2
-rw-r--r--util/draft/holder_vector_ut.cpp2
-rw-r--r--util/draft/memory_ut.cpp2
-rw-r--r--util/folder/dirent_win.c58
-rw-r--r--util/folder/dirut.cpp30
-rw-r--r--util/folder/dirut.h6
-rw-r--r--util/folder/dirut_ut.cpp2
-rw-r--r--util/folder/filelist_ut.cpp2
-rw-r--r--util/folder/fts.cpp134
-rw-r--r--util/folder/fts.h4
-rw-r--r--util/folder/fts_ut.cpp2
-rw-r--r--util/folder/iterator_ut.cpp2
-rw-r--r--util/folder/lstat_win.c26
-rw-r--r--util/folder/path.cpp12
-rw-r--r--util/folder/path_ut.cpp30
-rw-r--r--util/generic/adaptor_ut.cpp2
-rw-r--r--util/generic/algorithm_ut.cpp2
-rw-r--r--util/generic/array_ref_ut.cpp2
-rw-r--r--util/generic/array_size_ut.cpp2
-rw-r--r--util/generic/benchmark/fastclp2/main.cpp2
-rw-r--r--util/generic/benchmark/log2/main.cpp2
-rw-r--r--util/generic/benchmark/rotate_bits/main.cpp2
-rw-r--r--util/generic/benchmark/singleton/main.cpp2
-rw-r--r--util/generic/benchmark/smart_pointers/main.cpp2
-rw-r--r--util/generic/benchmark/sort/main.cpp2
-rw-r--r--util/generic/benchmark/vector_count_ctor/f.cpp2
-rw-r--r--util/generic/benchmark/vector_count_ctor/main.cpp2
-rw-r--r--util/generic/bitmap_ut.cpp2
-rw-r--r--util/generic/bitops.h8
-rw-r--r--util/generic/bitops_ut.cpp2
-rw-r--r--util/generic/buffer.cpp28
-rw-r--r--util/generic/buffer.h2
-rw-r--r--util/generic/buffer_ut.cpp2
-rw-r--r--util/generic/cast_ut.cpp2
-rw-r--r--util/generic/deque_ut.cpp2
-rw-r--r--util/generic/explicit_type_ut.cpp2
-rw-r--r--util/generic/flags_ut.cpp2
-rw-r--r--util/generic/function_ut.cpp2
-rw-r--r--util/generic/guid_ut.cpp2
-rw-r--r--util/generic/hash.h6
-rw-r--r--util/generic/hash_primes_ut.cpp2
-rw-r--r--util/generic/hash_set.h4
-rw-r--r--util/generic/hash_ut.cpp2
-rw-r--r--util/generic/intrlist_ut.cpp2
-rw-r--r--util/generic/is_in_ut.cpp2
-rw-r--r--util/generic/iterator_range_ut.cpp2
-rw-r--r--util/generic/iterator_ut.cpp2
-rw-r--r--util/generic/lazy_value_ut.cpp2
-rw-r--r--util/generic/list_ut.cpp2
-rw-r--r--util/generic/map_ut.cpp2
-rw-r--r--util/generic/mapfindptr_ut.cpp2
-rw-r--r--util/generic/maybe_ut.cpp8
-rw-r--r--util/generic/mem_copy_ut.cpp2
-rw-r--r--util/generic/objects_counter_ut.cpp2
-rw-r--r--util/generic/overloaded_ut.cpp2
-rw-r--r--util/generic/ptr.h8
-rw-r--r--util/generic/ptr_ut.cpp2
-rw-r--r--util/generic/queue_ut.cpp2
-rw-r--r--util/generic/reserve.h18
-rw-r--r--util/generic/scope_ut.cpp2
-rw-r--r--util/generic/serialized_enum_ut.cpp2
-rw-r--r--util/generic/set_ut.cpp2
-rw-r--r--util/generic/singleton.cpp14
-rw-r--r--util/generic/singleton_ut.cpp2
-rw-r--r--util/generic/stack_ut.cpp2
-rw-r--r--util/generic/store_policy_ut.cpp2
-rw-r--r--util/generic/strbase.h14
-rw-r--r--util/generic/strbuf_ut.cpp2
-rw-r--r--util/generic/string.cpp38
-rw-r--r--util/generic/string.h4
-rw-r--r--util/generic/string_transparent_hash_ut.cpp2
-rw-r--r--util/generic/string_ut.cpp360
-rw-r--r--util/generic/string_ut.h104
-rw-r--r--util/generic/typelist_ut.cpp2
-rw-r--r--util/generic/typetraits.h2
-rw-r--r--util/generic/typetraits_ut.cpp2
-rw-r--r--util/generic/utility_ut.cpp2
-rw-r--r--util/generic/va_args_ut.cpp2
-rw-r--r--util/generic/vector.h28
-rw-r--r--util/generic/vector_ut.cpp22
-rw-r--r--util/generic/xrange.h110
-rw-r--r--util/generic/xrange_ut.cpp44
-rw-r--r--util/generic/yexception_ut.cpp2
-rw-r--r--util/generic/ylimits_ut.cpp2
-rw-r--r--util/generic/ymath_ut.cpp2
-rw-r--r--util/memory/addstorage_ut.cpp2
-rw-r--r--util/memory/benchmark/pool/main.cpp2
-rw-r--r--util/memory/blob.cpp10
-rw-r--r--util/memory/blob_ut.cpp2
-rw-r--r--util/memory/pool_ut.cpp2
-rw-r--r--util/memory/smallobj_ut.cpp2
-rw-r--r--util/memory/tempbuf.h16
-rw-r--r--util/memory/tempbuf_ut.cpp2
-rw-r--r--util/network/address_ut.cpp2
-rw-r--r--util/network/endpoint_ut.cpp2
-rw-r--r--util/network/ip_ut.cpp2
-rw-r--r--util/network/poller_ut.cpp2
-rw-r--r--util/network/sock_ut.cpp4
-rw-r--r--util/network/socket_ut.cpp2
-rw-r--r--util/network/ut/ya.make2
-rw-r--r--util/random/benchmark/prng/main.cpp2
-rw-r--r--util/random/common_ops_ut.cpp2
-rw-r--r--util/random/easy_ut.cpp2
-rw-r--r--util/random/entropy_ut.cpp2
-rw-r--r--util/random/fast_ut.cpp2
-rw-r--r--util/random/mersenne_ut.cpp2
-rw-r--r--util/random/normal_ut.cpp2
-rw-r--r--util/random/random_ut.cpp2
-rw-r--r--util/random/shuffle_ut.cpp2
-rw-r--r--util/str_stl.h32
-rw-r--r--util/stream/aligned_ut.cpp2
-rw-r--r--util/stream/buffer_ut.cpp2
-rw-r--r--util/stream/buffered_ut.cpp2
-rw-r--r--util/stream/direct_io_ut.cpp2
-rw-r--r--util/stream/file_ut.cpp2
-rw-r--r--util/stream/format.cpp144
-rw-r--r--util/stream/format.h82
-rw-r--r--util/stream/format_ut.cpp74
-rw-r--r--util/stream/hex_ut.cpp2
-rw-r--r--util/stream/input_ut.cpp2
-rw-r--r--util/stream/ios_ut.cpp2
-rw-r--r--util/stream/labeled_ut.cpp2
-rw-r--r--util/stream/length_ut.cpp2
-rw-r--r--util/stream/mem_ut.cpp2
-rw-r--r--util/stream/multi_ut.cpp2
-rw-r--r--util/stream/output.cpp54
-rw-r--r--util/stream/output.h28
-rw-r--r--util/stream/printf_ut.cpp2
-rw-r--r--util/stream/str.h2
-rw-r--r--util/stream/str_ut.cpp28
-rw-r--r--util/stream/tokenizer_ut.cpp2
-rw-r--r--util/stream/walk_ut.cpp2
-rw-r--r--util/stream/zerocopy_output_ut.cpp2
-rw-r--r--util/stream/zlib_ut.cpp2
-rw-r--r--util/string/ascii_ut.cpp2
-rw-r--r--util/string/benchmark/ascii/main.cpp2
-rw-r--r--util/string/benchmark/cast/main.cpp2
-rw-r--r--util/string/benchmark/float_to_string/main.cpp2
-rw-r--r--util/string/benchmark/join/main.cpp2
-rw-r--r--util/string/benchmark/subst_global/main.cpp2
-rw-r--r--util/string/builder_ut.cpp2
-rw-r--r--util/string/cast_ut.cpp2
-rw-r--r--util/string/escape_ut.cpp2
-rw-r--r--util/string/hex_ut.cpp2
-rw-r--r--util/string/join_ut.cpp2
-rw-r--r--util/string/printf_ut.cpp2
-rw-r--r--util/string/split_ut.cpp2
-rw-r--r--util/string/strip_ut.cpp2
-rw-r--r--util/string/subst.cpp18
-rw-r--r--util/string/subst.h4
-rw-r--r--util/string/subst_ut.cpp2
-rw-r--r--util/string/type.cpp2
-rw-r--r--util/string/type.h4
-rw-r--r--util/string/type_ut.cpp2
-rw-r--r--util/string/util_ut.cpp2
-rw-r--r--util/string/vector_ut.cpp2
-rw-r--r--util/system/align_ut.cpp2
-rw-r--r--util/system/atexit_ut.cpp2
-rw-r--r--util/system/atomic_ut.cpp2
-rw-r--r--util/system/backtrace_ut.cpp2
-rw-r--r--util/system/benchmark/cpu_id/main.cpp2
-rw-r--r--util/system/benchmark/create_destroy_thread/main.cpp2
-rw-r--r--util/system/benchmark/rdtsc/main.cpp2
-rw-r--r--util/system/byteorder_ut.cpp2
-rw-r--r--util/system/compat_ut.cpp2
-rw-r--r--util/system/compiler.h38
-rw-r--r--util/system/compiler_ut.cpp2
-rw-r--r--util/system/condvar_ut.cpp2
-rw-r--r--util/system/context_ut.cpp2
-rw-r--r--util/system/cpu_id.cpp8
-rw-r--r--util/system/cpu_id.h8
-rw-r--r--util/system/cpu_id_ut.cpp30
-rw-r--r--util/system/daemon_ut.cpp2
-rw-r--r--util/system/defaults.h12
-rw-r--r--util/system/direct_io_ut.cpp2
-rw-r--r--util/system/env.cpp18
-rw-r--r--util/system/env_ut.cpp2
-rw-r--r--util/system/error_ut.cpp2
-rw-r--r--util/system/event_ut.cpp2
-rw-r--r--util/system/execpath.cpp2
-rw-r--r--util/system/execpath_ut.cpp4
-rw-r--r--util/system/file_ut.cpp2
-rw-r--r--util/system/filemap.cpp4
-rw-r--r--util/system/filemap.h2
-rw-r--r--util/system/filemap_ut.cpp2
-rw-r--r--util/system/flock_ut.cpp2
-rw-r--r--util/system/fs.cpp128
-rw-r--r--util/system/fs.h142
-rw-r--r--util/system/fs_ut.cpp420
-rw-r--r--util/system/fs_win.cpp68
-rw-r--r--util/system/fs_win.h18
-rw-r--r--util/system/fstat_ut.cpp4
-rw-r--r--util/system/getpid_ut.cpp2
-rw-r--r--util/system/guard_ut.cpp2
-rw-r--r--util/system/hi_lo_ut.cpp2
-rw-r--r--util/system/hostname_ut.cpp2
-rw-r--r--util/system/info_ut.cpp2
-rw-r--r--util/system/interrupt_signals_ut.cpp2
-rw-r--r--util/system/mem_info_ut.cpp2
-rw-r--r--util/system/mincore_ut.cpp2
-rw-r--r--util/system/mlock.cpp28
-rw-r--r--util/system/mlock.h6
-rw-r--r--util/system/mutex_ut.cpp2
-rw-r--r--util/system/nice_ut.cpp2
-rw-r--r--util/system/pipe_ut.cpp2
-rw-r--r--util/system/platform_ut.cpp2
-rw-r--r--util/system/progname_ut.cpp2
-rw-r--r--util/system/rusage_ut.cpp2
-rw-r--r--util/system/rwlock_ut.cpp2
-rw-r--r--util/system/sanitizers_ut.cpp2
-rw-r--r--util/system/shellcommand.cpp2
-rw-r--r--util/system/shellcommand_ut.cpp10
-rw-r--r--util/system/shmat_ut.cpp2
-rw-r--r--util/system/spinlock_ut.cpp2
-rw-r--r--util/system/src_location_ut.cpp2
-rw-r--r--util/system/src_root_ut.cpp4
-rw-r--r--util/system/tempfile_ut.cpp4
-rw-r--r--util/system/thread_ut.cpp2
-rw-r--r--util/system/tls.h2
-rw-r--r--util/system/tls_ut.cpp2
-rw-r--r--util/system/type_name_ut.cpp2
-rw-r--r--util/system/types_ut.cpp2
-rw-r--r--util/system/unaligned_mem_ut.cpp4
-rw-r--r--util/system/user_ut.cpp2
-rw-r--r--util/system/ut/ya.make2
-rw-r--r--util/system/yassert.h4
-rw-r--r--util/system/yassert_ut.cpp2
-rw-r--r--util/thread/factory_ut.cpp2
-rw-r--r--util/thread/lfqueue.h4
-rw-r--r--util/thread/lfqueue_ut.cpp4
-rw-r--r--util/thread/lfstack_ut.cpp4
-rw-r--r--util/thread/pool.cpp2
-rw-r--r--util/thread/pool_ut.cpp2
-rw-r--r--util/thread/singleton_ut.cpp2
-rw-r--r--util/ysaveload_ut.cpp2
253 files changed, 2003 insertions, 2003 deletions
diff --git a/util/charset/benchmark/to_lower/main.cpp b/util/charset/benchmark/to_lower/main.cpp
index e95fdc2371..56599b1770 100644
--- a/util/charset/benchmark/to_lower/main.cpp
+++ b/util/charset/benchmark/to_lower/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/charset/wide.h>
#include <util/generic/singleton.h>
diff --git a/util/charset/benchmark/utf8_to_wide/main.cpp b/util/charset/benchmark/utf8_to_wide/main.cpp
index 09fa567fe5..3a56c34361 100644
--- a/util/charset/benchmark/utf8_to_wide/main.cpp
+++ b/util/charset/benchmark/utf8_to_wide/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/random/fast.h>
#include <util/random/random.h>
@@ -103,59 +103,59 @@ inline size_t UTF8ToWideImplSSE(const char* text, size_t len, TCharType* dest, s
return UTF8ToWideImpl(text, len, dest, written);
}
-static wchar16 WBUF_UTF16[10000000];
-static wchar32 WBUF_UTF32[10000000];
+static wchar16 WBUF_UTF16[10000000];
+static wchar32 WBUF_UTF32[10000000];
-#define UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(impl, length, to) \
- Y_CPU_BENCHMARK(UTF8ToWideASCII##impl##length##to, iface) { \
- const auto& data = *Singleton<RAS##length>(); \
- for (size_t x = 0; x < iface.Iterations(); ++x) { \
- size_t written = 0; \
- Y_DO_NOT_OPTIMIZE_AWAY(UTF8ToWideImpl##impl<false>(data.begin(), data.size(), WBUF_##to, written)); \
- } \
+#define UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(impl, length, to) \
+ Y_CPU_BENCHMARK(UTF8ToWideASCII##impl##length##to, iface) { \
+ const auto& data = *Singleton<RAS##length>(); \
+ for (size_t x = 0; x < iface.Iterations(); ++x) { \
+ size_t written = 0; \
+ Y_DO_NOT_OPTIMIZE_AWAY(UTF8ToWideImpl##impl<false>(data.begin(), data.size(), WBUF_##to, written)); \
+ } \
}
-#define UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(impl, length, to) \
- Y_CPU_BENCHMARK(UTF8ToWideRU##impl##length##to, iface) { \
- const auto& data = *Singleton<RRS##length>(); \
- for (size_t x = 0; x < iface.Iterations(); ++x) { \
- size_t written = 0; \
- Y_DO_NOT_OPTIMIZE_AWAY(UTF8ToWideImpl##impl<false>(data.begin(), data.size(), WBUF_##to, written)); \
- } \
+#define UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(impl, length, to) \
+ Y_CPU_BENCHMARK(UTF8ToWideRU##impl##length##to, iface) { \
+ const auto& data = *Singleton<RRS##length>(); \
+ for (size_t x = 0; x < iface.Iterations(); ++x) { \
+ size_t written = 0; \
+ Y_DO_NOT_OPTIMIZE_AWAY(UTF8ToWideImpl##impl<false>(data.begin(), data.size(), WBUF_##to, written)); \
+ } \
}
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 10, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 10, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1000, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1000, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1000000, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1000000, UTF16);
-
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 10, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 10, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1000, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1000, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1000000, UTF16);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1000000, UTF16);
-
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 10, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 10, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1000, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1000, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1000000, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1000000, UTF32);
-
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 10, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 10, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1000, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1000, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1000000, UTF32);
-UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1000000, UTF32);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1, UTF16);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1, UTF16);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 10, UTF16);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 10, UTF16);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1000, UTF16);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1000, UTF16);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1000000, UTF16);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1000000, UTF16);
+
+UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1, UTF16);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1, UTF16);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 10, UTF16);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 10, UTF16);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1000, UTF16);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1000, UTF16);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1000000, UTF16);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1000000, UTF16);
+
+UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1, UTF32);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1, UTF32);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 10, UTF32);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 10, UTF32);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1000, UTF32);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1000, UTF32);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(Scalar, 1000000, UTF32);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_ASCII(SSE, 1000000, UTF32);
+
+UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1, UTF32);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1, UTF32);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 10, UTF32);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 10, UTF32);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1000, UTF32);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1000, UTF32);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(Scalar, 1000000, UTF32);
+UTF8_TO_WIDE_SCALAR_BENCHMARK_RU(SSE, 1000000, UTF32);
diff --git a/util/charset/utf8.h b/util/charset/utf8.h
index 5039b46ae9..08499ff77f 100644
--- a/util/charset/utf8.h
+++ b/util/charset/utf8.h
@@ -194,7 +194,7 @@ inline RECODE_RESULT SafeReadUTF8Char(wchar32& rune, size_t& rune_len, const uns
//! @param c value of the current character
//! @param p pointer to the current character, it will be changed in case of valid UTF8 byte sequence
//! @param e the end of the character sequence
-Y_FORCE_INLINE RECODE_RESULT ReadUTF8CharAndAdvance(wchar32& rune, const unsigned char*& p, const unsigned char* e) noexcept {
+Y_FORCE_INLINE RECODE_RESULT ReadUTF8CharAndAdvance(wchar32& rune, const unsigned char*& p, const unsigned char* e) noexcept {
Y_ASSERT(p < e); // since p < e then we will check RECODE_EOINPUT only for n > 1 (see calls of this functions)
switch (UTF8RuneLen(*p)) {
case 0:
diff --git a/util/charset/utf8_ut.cpp b/util/charset/utf8_ut.cpp
index 9e68881cca..7f50134624 100644
--- a/util/charset/utf8_ut.cpp
+++ b/util/charset/utf8_ut.cpp
@@ -4,8 +4,8 @@
#include <util/stream/file.h>
#include <util/ysaveload.h>
-#include <library/cpp/testing/unittest/registar.h>
-#include <library/cpp/testing/unittest/env.h>
+#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/env.h>
Y_UNIT_TEST_SUITE(TUtfUtilTest) {
Y_UNIT_TEST(TestUTF8Len) {
diff --git a/util/charset/wide.cpp b/util/charset/wide.cpp
index a287438ddd..7e96349631 100644
--- a/util/charset/wide.cpp
+++ b/util/charset/wide.cpp
@@ -146,8 +146,8 @@ bool IsTitleWord(const TWtringBuf text) noexcept {
return IsLowerWord({p, pe});
}
-template <bool stopOnFirstModification, typename TCharType, typename F>
-static bool ModifySequence(TCharType*& p, const TCharType* const pe, F&& f) {
+template <bool stopOnFirstModification, typename TCharType, typename F>
+static bool ModifySequence(TCharType*& p, const TCharType* const pe, F&& f) {
while (p != pe) {
const auto symbol = ReadSymbol(p, pe);
const auto modified = f(symbol);
@@ -165,8 +165,8 @@ static bool ModifySequence(TCharType*& p, const TCharType* const pe, F&& f) {
return false;
}
-template <bool stopOnFirstModification, typename TCharType, typename F>
-static bool ModifySequence(const TCharType*& p, const TCharType* const pe, TCharType*& out, F&& f) {
+template <bool stopOnFirstModification, typename TCharType, typename F>
+static bool ModifySequence(const TCharType*& p, const TCharType* const pe, TCharType*& out, F&& f) {
while (p != pe) {
const auto symbol = stopOnFirstModification ? ReadSymbol(p, pe) : ReadSymbolAndAdvance(p, pe);
const auto modified = f(symbol);
@@ -193,8 +193,8 @@ static void DetachAndFixPointers(TStringType& text, typename TStringType::value_
pe = p + count;
}
-template <class TStringType, typename F>
-static bool ModifyStringSymbolwise(TStringType& text, size_t pos, size_t count, F&& f) {
+template <class TStringType, typename F>
+static bool ModifyStringSymbolwise(TStringType& text, size_t pos, size_t count, F&& f) {
// TODO(yazevnul): this is done for consistency with `TUtf16String::to_lower` and friends
// at r2914050, maybe worth replacing them with asserts. Also see the same code in `ToTitle`.
pos = pos < text.size() ? pos : text.size();
@@ -225,16 +225,16 @@ bool ToUpper(TUtf16String& text, size_t pos, size_t count) {
return ModifyStringSymbolwise(text, pos, count, f);
}
-bool ToLower(TUtf32String& text, size_t pos, size_t count) {
+bool ToLower(TUtf32String& text, size_t pos, size_t count) {
const auto f = [](const wchar32 s) { return ToLower(s); };
- return ModifyStringSymbolwise(text, pos, count, f);
-}
-
-bool ToUpper(TUtf32String& text, size_t pos, size_t count) {
+ return ModifyStringSymbolwise(text, pos, count, f);
+}
+
+bool ToUpper(TUtf32String& text, size_t pos, size_t count) {
const auto f = [](const wchar32 s) { return ToUpper(s); };
- return ModifyStringSymbolwise(text, pos, count, f);
-}
-
+ return ModifyStringSymbolwise(text, pos, count, f);
+}
+
bool ToTitle(TUtf16String& text, size_t pos, size_t count) {
if (!text) {
return false;
@@ -266,37 +266,37 @@ bool ToTitle(TUtf16String& text, size_t pos, size_t count) {
return false;
}
-bool ToTitle(TUtf32String& text, size_t pos, size_t count) {
- if (!text) {
- return false;
- }
-
- pos = pos < text.size() ? pos : text.size();
- count = count < text.size() - pos ? count : text.size() - pos;
-
+bool ToTitle(TUtf32String& text, size_t pos, size_t count) {
+ if (!text) {
+ return false;
+ }
+
+ pos = pos < text.size() ? pos : text.size();
+ count = count < text.size() - pos ? count : text.size() - pos;
+
const auto toLower = [](const wchar32 s) { return ToLower(s); };
-
- auto* p = const_cast<wchar32*>(text.data() + pos);
- const auto* pe = text.data() + pos + count;
-
- const auto firstSymbol = *p;
- if (firstSymbol == ToTitle(firstSymbol)) {
- p += 1;
- if (ModifySequence<true>(p, pe, toLower)) {
- DetachAndFixPointers(text, p, pe);
- ModifySequence<false>(p, pe, toLower);
- return true;
- }
- } else {
- DetachAndFixPointers(text, p, pe);
- WriteSymbol(ToTitle(ReadSymbol(p, pe)), p); // also moves `p` forward
- ModifySequence<false>(p, pe, toLower);
- return true;
- }
-
- return false;
-}
-
+
+ auto* p = const_cast<wchar32*>(text.data() + pos);
+ const auto* pe = text.data() + pos + count;
+
+ const auto firstSymbol = *p;
+ if (firstSymbol == ToTitle(firstSymbol)) {
+ p += 1;
+ if (ModifySequence<true>(p, pe, toLower)) {
+ DetachAndFixPointers(text, p, pe);
+ ModifySequence<false>(p, pe, toLower);
+ return true;
+ }
+ } else {
+ DetachAndFixPointers(text, p, pe);
+ WriteSymbol(ToTitle(ReadSymbol(p, pe)), p); // also moves `p` forward
+ ModifySequence<false>(p, pe, toLower);
+ return true;
+ }
+
+ return false;
+}
+
TUtf16String ToLowerRet(TUtf16String text, size_t pos, size_t count) {
ToLower(text, pos, count);
return text;
@@ -312,21 +312,21 @@ TUtf16String ToTitleRet(TUtf16String text, size_t pos, size_t count) {
return text;
}
-TUtf32String ToLowerRet(TUtf32String text, size_t pos, size_t count) {
- ToLower(text, pos, count);
- return text;
-}
-
-TUtf32String ToUpperRet(TUtf32String text, size_t pos, size_t count) {
- ToUpper(text, pos, count);
- return text;
-}
-
-TUtf32String ToTitleRet(TUtf32String text, size_t pos, size_t count) {
- ToTitle(text, pos, count);
- return text;
-}
-
+TUtf32String ToLowerRet(TUtf32String text, size_t pos, size_t count) {
+ ToLower(text, pos, count);
+ return text;
+}
+
+TUtf32String ToUpperRet(TUtf32String text, size_t pos, size_t count) {
+ ToUpper(text, pos, count);
+ return text;
+}
+
+TUtf32String ToTitleRet(TUtf32String text, size_t pos, size_t count) {
+ ToTitle(text, pos, count);
+ return text;
+}
+
bool ToLower(const wchar16* text, size_t length, wchar16* out) noexcept {
// TODO(yazevnul): get rid of `text == out` case (it is probably used only in lemmer) and then
// we can declare text and out as `__restrict__`
@@ -408,87 +408,87 @@ bool ToTitle(wchar16* text, size_t length) noexcept {
return ToLower(text, textEnd - text) || firstSymbol != firstSymbolTitle;
}
-bool ToLower(const wchar32* text, size_t length, wchar32* out) noexcept {
- // TODO(yazevnul): get rid of `text == out` case (it is probably used only in lemmer) and then
- // we can declare text and out as `__restrict__`
- Y_ASSERT(text == out || !(out >= text && out < text + length));
+bool ToLower(const wchar32* text, size_t length, wchar32* out) noexcept {
+ // TODO(yazevnul): get rid of `text == out` case (it is probably used only in lemmer) and then
+ // we can declare text and out as `__restrict__`
+ Y_ASSERT(text == out || !(out >= text && out < text + length));
const auto f = [](const wchar32 s) { return ToLower(s); };
- const auto* p = text;
- const auto* const pe = text + length;
- if (ModifySequence<true>(p, pe, out, f)) {
- ModifySequence<false>(p, pe, out, f);
- return true;
- }
- return false;
-}
-
-bool ToUpper(const wchar32* text, size_t length, wchar32* out) noexcept {
- Y_ASSERT(text == out || !(out >= text && out < text + length));
+ const auto* p = text;
+ const auto* const pe = text + length;
+ if (ModifySequence<true>(p, pe, out, f)) {
+ ModifySequence<false>(p, pe, out, f);
+ return true;
+ }
+ return false;
+}
+
+bool ToUpper(const wchar32* text, size_t length, wchar32* out) noexcept {
+ Y_ASSERT(text == out || !(out >= text && out < text + length));
const auto f = [](const wchar32 s) { return ToUpper(s); };
- const auto* p = text;
- const auto* const pe = text + length;
- if (ModifySequence<true>(p, pe, out, f)) {
- ModifySequence<false>(p, pe, out, f);
- return true;
- }
- return false;
-}
-
-bool ToTitle(const wchar32* text, size_t length, wchar32* out) noexcept {
- if (!length) {
- return false;
- }
-
- Y_ASSERT(text == out || !(out >= text && out < text + length));
-
- const auto* const textEnd = text + length;
- const auto firstSymbol = ReadSymbolAndAdvance(text, textEnd);
- const auto firstSymbolTitle = ToTitle(firstSymbol);
-
- WriteSymbol(firstSymbolTitle, out);
-
- return ToLower(text, textEnd - text, out) || firstSymbol != firstSymbolTitle;
-}
-
-bool ToLower(wchar32* text, size_t length) noexcept {
+ const auto* p = text;
+ const auto* const pe = text + length;
+ if (ModifySequence<true>(p, pe, out, f)) {
+ ModifySequence<false>(p, pe, out, f);
+ return true;
+ }
+ return false;
+}
+
+bool ToTitle(const wchar32* text, size_t length, wchar32* out) noexcept {
+ if (!length) {
+ return false;
+ }
+
+ Y_ASSERT(text == out || !(out >= text && out < text + length));
+
+ const auto* const textEnd = text + length;
+ const auto firstSymbol = ReadSymbolAndAdvance(text, textEnd);
+ const auto firstSymbolTitle = ToTitle(firstSymbol);
+
+ WriteSymbol(firstSymbolTitle, out);
+
+ return ToLower(text, textEnd - text, out) || firstSymbol != firstSymbolTitle;
+}
+
+bool ToLower(wchar32* text, size_t length) noexcept {
const auto f = [](const wchar32 s) { return ToLower(s); };
- const auto* const textEnd = text + length;
- if (ModifySequence<true>(text, textEnd, f)) {
- ModifySequence<false>(text, textEnd, f);
- return true;
- }
- return false;
-}
-
-bool ToUpper(wchar32* text, size_t length) noexcept {
+ const auto* const textEnd = text + length;
+ if (ModifySequence<true>(text, textEnd, f)) {
+ ModifySequence<false>(text, textEnd, f);
+ return true;
+ }
+ return false;
+}
+
+bool ToUpper(wchar32* text, size_t length) noexcept {
const auto f = [](const wchar32 s) { return ToUpper(s); };
- const auto* const textEnd = text + length;
- if (ModifySequence<true>(text, textEnd, f)) {
- ModifySequence<false>(text, textEnd, f);
- return true;
- }
- return false;
-}
-
-bool ToTitle(wchar32* text, size_t length) noexcept {
- if (!length) {
- return false;
- }
-
- const auto* textEnd = text + length;
- const auto firstSymbol = ReadSymbol(text, textEnd);
- const auto firstSymbolTitle = ToTitle(firstSymbol);
-
- // avoid unnacessary writes to the memory
- if (firstSymbol != firstSymbolTitle) {
- WriteSymbol(firstSymbolTitle, text);
- } else {
- text = SkipSymbol(text, textEnd);
- }
-
- return ToLower(text, textEnd - text) || firstSymbol != firstSymbolTitle;
-}
-
+ const auto* const textEnd = text + length;
+ if (ModifySequence<true>(text, textEnd, f)) {
+ ModifySequence<false>(text, textEnd, f);
+ return true;
+ }
+ return false;
+}
+
+bool ToTitle(wchar32* text, size_t length) noexcept {
+ if (!length) {
+ return false;
+ }
+
+ const auto* textEnd = text + length;
+ const auto firstSymbol = ReadSymbol(text, textEnd);
+ const auto firstSymbolTitle = ToTitle(firstSymbol);
+
+ // avoid unnacessary writes to the memory
+ if (firstSymbol != firstSymbolTitle) {
+ WriteSymbol(firstSymbolTitle, text);
+ } else {
+ text = SkipSymbol(text, textEnd);
+ }
+
+ return ToLower(text, textEnd - text) || firstSymbol != firstSymbolTitle;
+}
+
template <typename F>
static TUtf16String ToSmthRet(const TWtringBuf text, size_t pos, size_t count, F&& f) {
pos = pos < text.size() ? pos : text.size();
@@ -510,27 +510,27 @@ static TUtf16String ToSmthRet(const TWtringBuf text, size_t pos, size_t count, F
return res;
}
-template <typename F>
-static TUtf32String ToSmthRet(const TUtf32StringBuf text, size_t pos, size_t count, F&& f) {
- pos = pos < text.size() ? pos : text.size();
- count = count < text.size() - pos ? count : text.size() - pos;
-
- auto res = TUtf32String::Uninitialized(text.size());
- auto* const resBegin = res.Detach();
-
- if (pos) {
- MemCopy(resBegin, text.data(), pos);
- }
-
- f(text.data() + pos, count, resBegin + pos);
-
- if (count - pos != text.size()) {
- MemCopy(resBegin + pos + count, text.data() + pos + count, text.size() - pos - count);
- }
-
- return res;
-}
-
+template <typename F>
+static TUtf32String ToSmthRet(const TUtf32StringBuf text, size_t pos, size_t count, F&& f) {
+ pos = pos < text.size() ? pos : text.size();
+ count = count < text.size() - pos ? count : text.size() - pos;
+
+ auto res = TUtf32String::Uninitialized(text.size());
+ auto* const resBegin = res.Detach();
+
+ if (pos) {
+ MemCopy(resBegin, text.data(), pos);
+ }
+
+ f(text.data() + pos, count, resBegin + pos);
+
+ if (count - pos != text.size()) {
+ MemCopy(resBegin + pos + count, text.data() + pos + count, text.size() - pos - count);
+ }
+
+ return res;
+}
+
TUtf16String ToLowerRet(const TWtringBuf text, size_t pos, size_t count) {
return ToSmthRet(text, pos, count, [](const wchar16* theText, size_t length, wchar16* out) {
ToLower(theText, length, out);
@@ -549,24 +549,24 @@ TUtf16String ToTitleRet(const TWtringBuf text, size_t pos, size_t count) {
});
}
-TUtf32String ToLowerRet(const TUtf32StringBuf text, size_t pos, size_t count) {
+TUtf32String ToLowerRet(const TUtf32StringBuf text, size_t pos, size_t count) {
return ToSmthRet(text, pos, count, [](const wchar32* theText, size_t length, wchar32* out) {
- ToLower(theText, length, out);
- });
-}
-
-TUtf32String ToUpperRet(const TUtf32StringBuf text, size_t pos, size_t count) {
+ ToLower(theText, length, out);
+ });
+}
+
+TUtf32String ToUpperRet(const TUtf32StringBuf text, size_t pos, size_t count) {
return ToSmthRet(text, pos, count, [](const wchar32* theText, size_t length, wchar32* out) {
- ToUpper(theText, length, out);
- });
-}
-
-TUtf32String ToTitleRet(const TUtf32StringBuf text, size_t pos, size_t count) {
+ ToUpper(theText, length, out);
+ });
+}
+
+TUtf32String ToTitleRet(const TUtf32StringBuf text, size_t pos, size_t count) {
return ToSmthRet(text, pos, count, [](const wchar32* theText, size_t length, wchar32* out) {
- ToTitle(theText, length, out);
- });
-}
-
+ ToTitle(theText, length, out);
+ });
+}
+
template <bool insertBr>
void EscapeHtmlChars(TUtf16String& str) {
static const TUtf16String lt(LT, Y_ARRAY_SIZE(LT));
diff --git a/util/charset/wide.h b/util/charset/wide.h
index 04e6928aab..5a566983fa 100644
--- a/util/charset/wide.h
+++ b/util/charset/wide.h
@@ -34,20 +34,20 @@ namespace NDetail {
template <>
struct TSelector<false> {
template <class T>
- static inline void WriteSymbol(wchar16 s, T& dest) noexcept {
+ static inline void WriteSymbol(wchar16 s, T& dest) noexcept {
dest.push_back(s);
}
};
-
+
template <>
struct TSelector<true> {
template <class T>
- static inline void WriteSymbol(wchar16 s, T& dest) noexcept {
+ static inline void WriteSymbol(wchar16 s, T& dest) noexcept {
*(dest++) = s;
}
};
- inline wchar32 ReadSurrogatePair(const wchar16* chars) noexcept {
+ inline wchar32 ReadSurrogatePair(const wchar16* chars) noexcept {
const wchar32 SURROGATE_OFFSET = static_cast<wchar32>(0x10000 - (0xD800 << 10) - 0xDC00);
wchar16 lead = chars[0];
wchar16 tail = chars[1];
@@ -59,26 +59,26 @@ namespace NDetail {
}
template <class T>
- inline void WriteSurrogatePair(wchar32 s, T& dest) noexcept;
+ inline void WriteSurrogatePair(wchar32 s, T& dest) noexcept;
}
-inline wchar16* SkipSymbol(wchar16* begin, const wchar16* end) noexcept {
+inline wchar16* SkipSymbol(wchar16* begin, const wchar16* end) noexcept {
return begin + W16SymbolSize(begin, end);
}
-inline const wchar16* SkipSymbol(const wchar16* begin, const wchar16* end) noexcept {
+inline const wchar16* SkipSymbol(const wchar16* begin, const wchar16* end) noexcept {
return begin + W16SymbolSize(begin, end);
}
-inline wchar32* SkipSymbol(wchar32* begin, const wchar32* end) noexcept {
- Y_ASSERT(begin < end);
- return begin + 1;
-}
-inline const wchar32* SkipSymbol(const wchar32* begin, const wchar32* end) noexcept {
- Y_ASSERT(begin < end);
- return begin + 1;
-}
+inline wchar32* SkipSymbol(wchar32* begin, const wchar32* end) noexcept {
+ Y_ASSERT(begin < end);
+ return begin + 1;
+}
+inline const wchar32* SkipSymbol(const wchar32* begin, const wchar32* end) noexcept {
+ Y_ASSERT(begin < end);
+ return begin + 1;
+}
-inline wchar32 ReadSymbol(const wchar16* begin, const wchar16* end) noexcept {
+inline wchar32 ReadSymbol(const wchar16* begin, const wchar16* end) noexcept {
Y_ASSERT(begin < end);
if (IsW16SurrogateLead(*begin)) {
if (begin + 1 < end && IsW16SurrogateTail(*(begin + 1)))
@@ -92,13 +92,13 @@ inline wchar32 ReadSymbol(const wchar16* begin, const wchar16* end) noexcept {
return *begin;
}
-inline wchar32 ReadSymbol(const wchar32* begin, const wchar32* end) noexcept {
- Y_ASSERT(begin < end);
- return *begin;
-}
-
+inline wchar32 ReadSymbol(const wchar32* begin, const wchar32* end) noexcept {
+ Y_ASSERT(begin < end);
+ return *begin;
+}
+
//! presuming input data is either big enought of null terminated
-inline wchar32 ReadSymbolAndAdvance(const wchar16*& begin) noexcept {
+inline wchar32 ReadSymbolAndAdvance(const wchar16*& begin) noexcept {
Y_ASSERT(*begin);
if (IsW16SurrogateLead(begin[0])) {
if (IsW16SurrogateTail(begin[1])) {
@@ -116,13 +116,13 @@ inline wchar32 ReadSymbolAndAdvance(const wchar16*& begin) noexcept {
return *(begin++);
}
-//! presuming input data is either big enought of null terminated
-inline wchar32 ReadSymbolAndAdvance(const wchar32*& begin) noexcept {
- Y_ASSERT(*begin);
- return *(begin++);
-}
-
-inline wchar32 ReadSymbolAndAdvance(const wchar16*& begin, const wchar16* end) noexcept {
+//! presuming input data is either big enought of null terminated
+inline wchar32 ReadSymbolAndAdvance(const wchar32*& begin) noexcept {
+ Y_ASSERT(*begin);
+ return *(begin++);
+}
+
+inline wchar32 ReadSymbolAndAdvance(const wchar16*& begin, const wchar16* end) noexcept {
Y_ASSERT(begin < end);
if (IsW16SurrogateLead(begin[0])) {
if (begin + 1 != end && IsW16SurrogateTail(begin[1])) {
@@ -139,19 +139,19 @@ inline wchar32 ReadSymbolAndAdvance(const wchar16*& begin, const wchar16* end) n
return *(begin++);
}
-inline wchar32 ReadSymbolAndAdvance(const wchar32*& begin, const wchar32* end) noexcept {
+inline wchar32 ReadSymbolAndAdvance(const wchar32*& begin, const wchar32* end) noexcept {
Y_ASSERT(begin < end);
return *(begin++);
}
template <class T>
-inline size_t WriteSymbol(wchar16 s, T& dest) noexcept {
+inline size_t WriteSymbol(wchar16 s, T& dest) noexcept {
::NDetail::TSelector<std::is_pointer<T>::value>::WriteSymbol(s, dest);
return 1;
}
template <class T>
-inline size_t WriteSymbol(wchar32 s, T& dest) noexcept {
+inline size_t WriteSymbol(wchar32 s, T& dest) noexcept {
if (s > 0xFFFF) {
if (s >= ::NUnicode::UnicodeInstancesLimit()) {
return WriteSymbol(static_cast<wchar16>(BROKEN_RUNE), dest);
@@ -164,7 +164,7 @@ inline size_t WriteSymbol(wchar32 s, T& dest) noexcept {
return WriteSymbol(static_cast<wchar16>(s), dest);
}
-inline bool WriteSymbol(wchar32 s, wchar16*& dest, const wchar16* destEnd) noexcept {
+inline bool WriteSymbol(wchar32 s, wchar16*& dest, const wchar16* destEnd) noexcept {
Y_ASSERT(dest < destEnd);
if (s > 0xFFFF) {
@@ -184,12 +184,12 @@ inline bool WriteSymbol(wchar32 s, wchar16*& dest, const wchar16* destEnd) noexc
return true;
}
-inline size_t WriteSymbol(wchar32 s, wchar32*& dest) noexcept {
+inline size_t WriteSymbol(wchar32 s, wchar32*& dest) noexcept {
*(dest++) = s;
return 1;
}
-inline bool WriteSymbol(wchar32 s, wchar32*& dest, const wchar32* destEnd) noexcept {
+inline bool WriteSymbol(wchar32 s, wchar32*& dest, const wchar32* destEnd) noexcept {
Y_ASSERT(dest < destEnd);
*(dest++) = s;
@@ -260,7 +260,7 @@ public:
namespace NDetail {
template <bool robust, typename TCharType>
- inline void UTF8ToWideImplScalar(const unsigned char*& cur, const unsigned char* last, TCharType*& dest) noexcept {
+ inline void UTF8ToWideImplScalar(const unsigned char*& cur, const unsigned char* last, TCharType*& dest) noexcept {
wchar32 rune = BROKEN_RUNE;
while (cur != last) {
@@ -278,29 +278,29 @@ namespace NDetail {
}
}
- template <typename TCharType>
- inline void UTF16ToUTF32ImplScalar(const wchar16* cur, const wchar16* last, TCharType*& dest) noexcept {
- wchar32 rune = BROKEN_RUNE;
-
- while (cur != last) {
- rune = ReadSymbolAndAdvance(cur, last);
- Y_ASSERT(cur <= last);
- WriteSymbol(rune, dest);
- }
- }
-
+ template <typename TCharType>
+ inline void UTF16ToUTF32ImplScalar(const wchar16* cur, const wchar16* last, TCharType*& dest) noexcept {
+ wchar32 rune = BROKEN_RUNE;
+
+ while (cur != last) {
+ rune = ReadSymbolAndAdvance(cur, last);
+ Y_ASSERT(cur <= last);
+ WriteSymbol(rune, dest);
+ }
+ }
+
template <class TCharType>
inline void UTF8ToWideImplSSE41(const unsigned char*& /*cur*/, const unsigned char* /*last*/, TCharType*& /*dest*/) noexcept {
}
void UTF8ToWideImplSSE41(const unsigned char*& cur, const unsigned char* last, wchar16*& dest) noexcept;
-
- void UTF8ToWideImplSSE41(const unsigned char*& cur, const unsigned char* last, wchar32*& dest) noexcept;
+
+ void UTF8ToWideImplSSE41(const unsigned char*& cur, const unsigned char* last, wchar32*& dest) noexcept;
}
//! @return len if robust and position where encoding stopped if not
template <bool robust, typename TCharType>
-inline size_t UTF8ToWideImpl(const char* text, size_t len, TCharType* dest, size_t& written) noexcept {
+inline size_t UTF8ToWideImpl(const char* text, size_t len, TCharType* dest, size_t& written) noexcept {
const unsigned char* cur = reinterpret_cast<const unsigned char*>(text);
const unsigned char* last = cur + len;
TCharType* p = dest;
@@ -333,7 +333,7 @@ inline TUtf16String UTF8ToWide(const char* text, size_t len) {
}
template <bool robust, typename TCharType>
-inline bool UTF8ToWide(const char* text, size_t len, TCharType* dest, size_t& written) noexcept {
+inline bool UTF8ToWide(const char* text, size_t len, TCharType* dest, size_t& written) noexcept {
return UTF8ToWideImpl<robust>(text, len, dest, written) == len;
}
@@ -342,7 +342,7 @@ inline bool UTF8ToWide(const char* text, size_t len, TCharType* dest, size_t& wr
//! conversion stops if a broken symbol is met
//! @return @c true if all the text converted successfully, @c false - a broken symbol was found
template <typename TCharType>
-inline bool UTF8ToWide(const char* text, size_t len, TCharType* dest, size_t& written) noexcept {
+inline bool UTF8ToWide(const char* text, size_t len, TCharType* dest, size_t& written) noexcept {
return UTF8ToWide<false>(text, len, dest, written);
}
@@ -350,21 +350,21 @@ template <bool robust>
inline TWtringBuf UTF8ToWide(const TStringBuf src, TUtf16String& dst) {
dst.ReserveAndResize(src.size());
size_t written = 0;
- UTF8ToWideImpl<robust>(src.data(), src.size(), dst.begin(), written);
- dst.resize(written);
- return dst;
-}
-
-//! if not robust will stop at first error position
-template <bool robust>
-inline TUtf32StringBuf UTF8ToUTF32(const TStringBuf src, TUtf32String& dst) {
- dst.ReserveAndResize(src.size());
- size_t written = 0;
- UTF8ToWideImpl<robust>(src.data(), src.size(), dst.begin(), written);
+ UTF8ToWideImpl<robust>(src.data(), src.size(), dst.begin(), written);
dst.resize(written);
return dst;
}
+//! if not robust will stop at first error position
+template <bool robust>
+inline TUtf32StringBuf UTF8ToUTF32(const TStringBuf src, TUtf32String& dst) {
+ dst.ReserveAndResize(src.size());
+ size_t written = 0;
+ UTF8ToWideImpl<robust>(src.data(), src.size(), dst.begin(), written);
+ dst.resize(written);
+ return dst;
+}
+
inline TWtringBuf UTF8ToWide(const TStringBuf src, TUtf16String& dst) {
return UTF8ToWide<false>(src, dst);
}
@@ -378,13 +378,13 @@ inline TUtf16String UTF8ToWide(const TStringBuf s) {
return UTF8ToWide<robust>(s.data(), s.size());
}
-template <bool robust>
-inline TUtf32String UTF8ToUTF32(const TStringBuf s) {
- TUtf32String r;
- UTF8ToUTF32<robust>(s, r);
- return r;
-}
-
+template <bool robust>
+inline TUtf32String UTF8ToUTF32(const TStringBuf s) {
+ TUtf32String r;
+ UTF8ToUTF32<robust>(s, r);
+ return r;
+}
+
inline TUtf16String UTF8ToWide(const TStringBuf s) {
return UTF8ToWide<false>(s.data(), s.size());
}
@@ -428,23 +428,23 @@ inline TString WideToUTF8(const wchar16* text, size_t len) {
return s;
}
-inline TString WideToUTF8(const wchar32* text, size_t len) {
- TString s = TString::Uninitialized(WideToUTF8BufferSize(len));
- size_t written = 0;
- WideToUTF8(text, len, s.begin(), written);
- Y_ASSERT(s.size() >= written);
- s.remove(written);
- return s;
-}
-
+inline TString WideToUTF8(const wchar32* text, size_t len) {
+ TString s = TString::Uninitialized(WideToUTF8BufferSize(len));
+ size_t written = 0;
+ WideToUTF8(text, len, s.begin(), written);
+ Y_ASSERT(s.size() >= written);
+ s.remove(written);
+ return s;
+}
+
inline TString WideToUTF8(const TWtringBuf w) {
return WideToUTF8(w.data(), w.size());
}
-inline TString WideToUTF8(const TUtf32StringBuf w) {
- return WideToUTF8(w.data(), w.size());
-}
-
+inline TString WideToUTF8(const TUtf32StringBuf w) {
+ return WideToUTF8(w.data(), w.size());
+}
+
inline TUtf16String UTF32ToWide(const wchar32* begin, size_t len) {
TUtf16String res;
res.reserve(len);
@@ -653,11 +653,11 @@ inline TUtf16String ASCIIToWide(const TStringBuf s) {
return CopyTo<TUtf16String>(s.begin(), s.end());
}
-inline TUtf32String ASCIIToUTF32(const TStringBuf s) {
- Y_ASSERT(IsStringASCII(s.begin(), s.end()));
- return CopyTo<TUtf32String>(s.begin(), s.end());
-}
-
+inline TUtf32String ASCIIToUTF32(const TStringBuf s) {
+ Y_ASSERT(IsStringASCII(s.begin(), s.end()));
+ return CopyTo<TUtf32String>(s.begin(), s.end());
+}
+
//! returns @c true if string contains whitespace characters only
inline bool IsSpace(const wchar16* s, size_t n) {
if (n == 0)
@@ -739,30 +739,30 @@ bool IsUpper(const TWtringBuf text) noexcept;
bool ToLower(TUtf16String& text, size_t pos = 0, size_t count = TUtf16String::npos);
bool ToUpper(TUtf16String& text, size_t pos = 0, size_t count = TUtf16String::npos);
-/* Lowercase/uppercase given string inplace. Any alphabetic symbol will be converted to a proper
-* case, the rest of the symbols will be kept the same. It is expected that `text` is a correct
-* UTF-32 string.
-*
-* For example `ToLower("heLLo")` will return `"hello"`.
-*
-* @param text String to modify
-* @param pos Position of the first character to modify
-* @param count Length of the substring
-* @returns `true` if `text` was changed
-*
-* NOTE: `pos` and `count` are measured in `wchar16`, not in codepoints.
-*/
-bool ToLower(TUtf32String& /*text*/, size_t /*pos*/ = 0, size_t /*count*/ = TUtf16String::npos);
-bool ToUpper(TUtf32String& /*text*/, size_t /*pos*/ = 0, size_t /*count*/ = TUtf16String::npos);
-
+/* Lowercase/uppercase given string inplace. Any alphabetic symbol will be converted to a proper
+* case, the rest of the symbols will be kept the same. It is expected that `text` is a correct
+* UTF-32 string.
+*
+* For example `ToLower("heLLo")` will return `"hello"`.
+*
+* @param text String to modify
+* @param pos Position of the first character to modify
+* @param count Length of the substring
+* @returns `true` if `text` was changed
+*
+* NOTE: `pos` and `count` are measured in `wchar16`, not in codepoints.
+*/
+bool ToLower(TUtf32String& /*text*/, size_t /*pos*/ = 0, size_t /*count*/ = TUtf16String::npos);
+bool ToUpper(TUtf32String& /*text*/, size_t /*pos*/ = 0, size_t /*count*/ = TUtf16String::npos);
+
/* Titlecase first symbol and lowercase the rest, see `ToLower` for more details.
*/
bool ToTitle(TUtf16String& text, size_t pos = 0, size_t count = TUtf16String::npos);
-/* Titlecase first symbol and lowercase the rest, see `ToLower` for more details.
-*/
-bool ToTitle(TUtf32String& /*text*/, size_t /*pos*/ = 0, size_t /*count*/ = TUtf16String::npos);
-
+/* Titlecase first symbol and lowercase the rest, see `ToLower` for more details.
+*/
+bool ToTitle(TUtf32String& /*text*/, size_t /*pos*/ = 0, size_t /*count*/ = TUtf16String::npos);
+
/* @param text Pointer to the string to modify
* @param length Length of the string to modify
* @param out Pointer to the character array to write to
@@ -776,10 +776,10 @@ bool ToLower(const wchar16* text, size_t length, wchar16* out) noexcept;
bool ToUpper(const wchar16* text, size_t length, wchar16* out) noexcept;
bool ToTitle(const wchar16* text, size_t length, wchar16* out) noexcept;
-bool ToLower(const wchar32* text, size_t length, wchar32* out) noexcept;
-bool ToUpper(const wchar32* text, size_t length, wchar32* out) noexcept;
-bool ToTitle(const wchar32* text, size_t length, wchar32* out) noexcept;
-
+bool ToLower(const wchar32* text, size_t length, wchar32* out) noexcept;
+bool ToUpper(const wchar32* text, size_t length, wchar32* out) noexcept;
+bool ToTitle(const wchar32* text, size_t length, wchar32* out) noexcept;
+
/* @param text Pointer to the string to modify
* @param length Length of the string to modify
*
@@ -789,10 +789,10 @@ bool ToLower(wchar16* text, size_t length) noexcept;
bool ToUpper(wchar16* text, size_t length) noexcept;
bool ToTitle(wchar16* text, size_t length) noexcept;
-bool ToLower(wchar32* text, size_t length) noexcept;
-bool ToUpper(wchar32* text, size_t length) noexcept;
-bool ToTitle(wchar32* text, size_t length) noexcept;
-
+bool ToLower(wchar32* text, size_t length) noexcept;
+bool ToUpper(wchar32* text, size_t length) noexcept;
+bool ToTitle(wchar32* text, size_t length) noexcept;
+
/* Convenience wrappers for `ToLower`, `ToUpper` and `ToTitle`.
*/
TUtf16String ToLowerRet(TUtf16String text, size_t pos = 0, size_t count = TUtf16String::npos) Y_WARN_UNUSED_RESULT;
@@ -803,10 +803,10 @@ TUtf16String ToLowerRet(const TWtringBuf text, size_t pos = 0, size_t count = TW
TUtf16String ToUpperRet(const TWtringBuf text, size_t pos = 0, size_t count = TWtringBuf::npos) Y_WARN_UNUSED_RESULT;
TUtf16String ToTitleRet(const TWtringBuf text, size_t pos = 0, size_t count = TWtringBuf::npos) Y_WARN_UNUSED_RESULT;
-TUtf32String ToLowerRet(const TUtf32StringBuf text, size_t pos = 0, size_t count = TWtringBuf::npos) Y_WARN_UNUSED_RESULT;
-TUtf32String ToUpperRet(const TUtf32StringBuf text, size_t pos = 0, size_t count = TWtringBuf::npos) Y_WARN_UNUSED_RESULT;
-TUtf32String ToTitleRet(const TUtf32StringBuf text, size_t pos = 0, size_t count = TWtringBuf::npos) Y_WARN_UNUSED_RESULT;
-
+TUtf32String ToLowerRet(const TUtf32StringBuf text, size_t pos = 0, size_t count = TWtringBuf::npos) Y_WARN_UNUSED_RESULT;
+TUtf32String ToUpperRet(const TUtf32StringBuf text, size_t pos = 0, size_t count = TWtringBuf::npos) Y_WARN_UNUSED_RESULT;
+TUtf32String ToTitleRet(const TUtf32StringBuf text, size_t pos = 0, size_t count = TWtringBuf::npos) Y_WARN_UNUSED_RESULT;
+
//! replaces the '<', '>' and '&' characters in string with '&lt;', '&gt;' and '&amp;' respectively
// insertBr=true - replace '\r' and '\n' with "<BR>"
template <bool insertBr>
diff --git a/util/charset/wide_sse41.cpp b/util/charset/wide_sse41.cpp
index d1f2a74851..a4c0982f56 100644
--- a/util/charset/wide_sse41.cpp
+++ b/util/charset/wide_sse41.cpp
@@ -21,226 +21,226 @@ namespace NDetail {
//processes to the first error, or until less then 16 bytes left
//most code taken from https://woboq.com/blog/utf-8-processing-using-simd.html
-//return dstAdvance 0 in case of problems
-static Y_FORCE_INLINE ui32 Unpack16BytesIntoUtf16IfNoSurrogats(const unsigned char*& cur, __m128i& utf16Low, __m128i& utf16High) {
- unsigned char curAligned[16];
-
- memcpy(curAligned, cur, sizeof(__m128i));
- __m128i chunk = _mm_load_si128(reinterpret_cast<const __m128i*>(curAligned));
-
- //only ascii characters - simple copy
- if (!_mm_movemask_epi8(chunk)) {
- utf16Low = _mm_unpacklo_epi8(chunk, _mm_setzero_si128());
- utf16High = _mm_unpackhi_epi8(chunk, _mm_setzero_si128());
- cur += 16;
- return 16;
- }
+//return dstAdvance 0 in case of problems
+static Y_FORCE_INLINE ui32 Unpack16BytesIntoUtf16IfNoSurrogats(const unsigned char*& cur, __m128i& utf16Low, __m128i& utf16High) {
+ unsigned char curAligned[16];
+
+ memcpy(curAligned, cur, sizeof(__m128i));
+ __m128i chunk = _mm_load_si128(reinterpret_cast<const __m128i*>(curAligned));
+
+ //only ascii characters - simple copy
+ if (!_mm_movemask_epi8(chunk)) {
+ utf16Low = _mm_unpacklo_epi8(chunk, _mm_setzero_si128());
+ utf16High = _mm_unpackhi_epi8(chunk, _mm_setzero_si128());
+ cur += 16;
+ return 16;
+ }
- __m128i chunkSigned = _mm_add_epi8(chunk, _mm_set1_epi8(0x80));
- __m128i isAsciiMask = _mm_cmpgt_epi8(chunk, _mm_set1_epi8(0));
+ __m128i chunkSigned = _mm_add_epi8(chunk, _mm_set1_epi8(0x80));
+ __m128i isAsciiMask = _mm_cmpgt_epi8(chunk, _mm_set1_epi8(0));
- __m128i cond2 = _mm_cmplt_epi8(_mm_set1_epi8(0xc2 - 1 - 0x80), chunkSigned);
+ __m128i cond2 = _mm_cmplt_epi8(_mm_set1_epi8(0xc2 - 1 - 0x80), chunkSigned);
__m128i state = _mm_set1_epi8(0x0 | (char)0x80);
- __m128i cond3 = _mm_cmplt_epi8(_mm_set1_epi8(0xe0 - 1 - 0x80), chunkSigned);
+ __m128i cond3 = _mm_cmplt_epi8(_mm_set1_epi8(0xe0 - 1 - 0x80), chunkSigned);
state = _mm_blendv_epi8(state, _mm_set1_epi8(0x2 | (char)0xc0), cond2);
- int sourceAdvance;
- __m128i shifts;
- __m128i chunkLow, chunkHigh;
+ int sourceAdvance;
+ __m128i shifts;
+ __m128i chunkLow, chunkHigh;
- if (Y_LIKELY(!_mm_movemask_epi8(cond3))) {
- //main case: no bloks of size 3 or 4
+ if (Y_LIKELY(!_mm_movemask_epi8(cond3))) {
+ //main case: no bloks of size 3 or 4
- //rune len for start of multi-byte sequences (0 for b0... and b10..., 2 for b110..., etc.)
- __m128i count = _mm_and_si128(state, _mm_set1_epi8(0x7));
+ //rune len for start of multi-byte sequences (0 for b0... and b10..., 2 for b110..., etc.)
+ __m128i count = _mm_and_si128(state, _mm_set1_epi8(0x7));
- __m128i countSub1 = _mm_subs_epu8(count, _mm_set1_epi8(0x1));
+ __m128i countSub1 = _mm_subs_epu8(count, _mm_set1_epi8(0x1));
- shifts = countSub1;
- __m128i continuation1 = _mm_slli_si128(countSub1, 1);
+ shifts = countSub1;
+ __m128i continuation1 = _mm_slli_si128(countSub1, 1);
- shifts = _mm_add_epi8(shifts, _mm_slli_si128(shifts, 1));
- shifts = _mm_add_epi8(shifts, _mm_slli_si128(shifts, 2));
+ shifts = _mm_add_epi8(shifts, _mm_slli_si128(shifts, 1));
+ shifts = _mm_add_epi8(shifts, _mm_slli_si128(shifts, 2));
- __m128i counts = _mm_or_si128(count, continuation1);
+ __m128i counts = _mm_or_si128(count, continuation1);
- __m128i isBeginMultibyteMask = _mm_cmpgt_epi8(count, _mm_set1_epi8(0));
- __m128i needNoContinuationMask = _mm_cmpeq_epi8(continuation1, _mm_set1_epi8(0));
- __m128i isBeginMask = _mm_add_epi8(isBeginMultibyteMask, isAsciiMask);
- //each symbol should be exactly one of ascii, continuation or begin
- __m128i okMask = _mm_cmpeq_epi8(isBeginMask, needNoContinuationMask);
+ __m128i isBeginMultibyteMask = _mm_cmpgt_epi8(count, _mm_set1_epi8(0));
+ __m128i needNoContinuationMask = _mm_cmpeq_epi8(continuation1, _mm_set1_epi8(0));
+ __m128i isBeginMask = _mm_add_epi8(isBeginMultibyteMask, isAsciiMask);
+ //each symbol should be exactly one of ascii, continuation or begin
+ __m128i okMask = _mm_cmpeq_epi8(isBeginMask, needNoContinuationMask);
- if (_mm_movemask_epi8(okMask) != 0xFFFF) {
- return 0;
- }
+ if (_mm_movemask_epi8(okMask) != 0xFFFF) {
+ return 0;
+ }
- shifts = _mm_add_epi8(shifts, _mm_slli_si128(shifts, 4));
+ shifts = _mm_add_epi8(shifts, _mm_slli_si128(shifts, 4));
- __m128i mask = _mm_and_si128(state, _mm_set1_epi8(0xf8));
- shifts = _mm_add_epi8(shifts, _mm_slli_si128(shifts, 8));
+ __m128i mask = _mm_and_si128(state, _mm_set1_epi8(0xf8));
+ shifts = _mm_add_epi8(shifts, _mm_slli_si128(shifts, 8));
- chunk = _mm_andnot_si128(mask, chunk); // from now on, we only have usefull bits
- shifts = _mm_and_si128(shifts, _mm_cmplt_epi8(counts, _mm_set1_epi8(2))); // <=1
+ chunk = _mm_andnot_si128(mask, chunk); // from now on, we only have usefull bits
+ shifts = _mm_and_si128(shifts, _mm_cmplt_epi8(counts, _mm_set1_epi8(2))); // <=1
- __m128i chunk_right = _mm_slli_si128(chunk, 1);
- shifts = _mm_blendv_epi8(shifts, _mm_srli_si128(shifts, 1),
+ __m128i chunk_right = _mm_slli_si128(chunk, 1);
+ shifts = _mm_blendv_epi8(shifts, _mm_srli_si128(shifts, 1),
_mm_srli_si128(_mm_slli_epi16(shifts, 7), 1));
- chunkLow = _mm_blendv_epi8(chunk,
+ chunkLow = _mm_blendv_epi8(chunk,
_mm_or_si128(chunk, _mm_and_si128(_mm_slli_epi16(chunk_right, 6), _mm_set1_epi8(0xc0))),
_mm_cmpeq_epi8(counts, _mm_set1_epi8(1)));
- chunkHigh = _mm_and_si128(chunk, _mm_cmpeq_epi8(counts, _mm_set1_epi8(2)));
+ chunkHigh = _mm_and_si128(chunk, _mm_cmpeq_epi8(counts, _mm_set1_epi8(2)));
- shifts = _mm_blendv_epi8(shifts, _mm_srli_si128(shifts, 2),
+ shifts = _mm_blendv_epi8(shifts, _mm_srli_si128(shifts, 2),
_mm_srli_si128(_mm_slli_epi16(shifts, 6), 2));
- chunkHigh = _mm_srli_epi32(chunkHigh, 2);
+ chunkHigh = _mm_srli_epi32(chunkHigh, 2);
- shifts = _mm_blendv_epi8(shifts, _mm_srli_si128(shifts, 4),
+ shifts = _mm_blendv_epi8(shifts, _mm_srli_si128(shifts, 4),
_mm_srli_si128(_mm_slli_epi16(shifts, 5), 4));
-
- int c = _mm_extract_epi16(counts, 7);
- sourceAdvance = !(c & 0x0200) ? 16 : 15;
-
- } else {
- __m128i mask3 = _mm_slli_si128(cond3, 1);
-
- __m128i cond4 = _mm_cmplt_epi8(_mm_set1_epi8(0xf0 - 1 - 0x80), chunkSigned);
+
+ int c = _mm_extract_epi16(counts, 7);
+ sourceAdvance = !(c & 0x0200) ? 16 : 15;
+
+ } else {
+ __m128i mask3 = _mm_slli_si128(cond3, 1);
+
+ __m128i cond4 = _mm_cmplt_epi8(_mm_set1_epi8(0xf0 - 1 - 0x80), chunkSigned);
state = _mm_blendv_epi8(state, _mm_set1_epi8(0x3 | (char)0xe0), cond3);
-
- // 4 bytes sequences are not vectorize. Fall back to the scalar processing
- if (Y_UNLIKELY(_mm_movemask_epi8(cond4))) {
- return 0;
- }
-
- //rune len for start of multi-byte sequences (0 for b0... and b10..., 2 for b110..., etc.)
- __m128i count = _mm_and_si128(state, _mm_set1_epi8(0x7));
-
- __m128i countSub1 = _mm_subs_epu8(count, _mm_set1_epi8(0x1));
- __m128i continuation2 = _mm_slli_si128(_mm_subs_epu8(count, _mm_set1_epi8(0x2)), 2);
-
- shifts = countSub1;
- __m128i continuation1 = _mm_slli_si128(countSub1, 1);
-
- shifts = _mm_add_epi8(shifts, _mm_slli_si128(shifts, 1));
- __m128i continuationsRunelen = _mm_or_si128(continuation1, continuation2);
-
- shifts = _mm_add_epi8(shifts, _mm_slli_si128(shifts, 2));
- __m128i counts = _mm_or_si128(count, continuationsRunelen);
-
- __m128i isBeginMultibyteMask = _mm_cmpgt_epi8(count, _mm_set1_epi8(0));
- __m128i needNoContinuationMask = _mm_cmpeq_epi8(continuationsRunelen, _mm_set1_epi8(0));
- __m128i isBeginMask = _mm_add_epi8(isBeginMultibyteMask, isAsciiMask);
- //each symbol should be exactly one of ascii, continuation or begin
- __m128i okMask = _mm_cmpeq_epi8(isBeginMask, needNoContinuationMask);
-
- if (_mm_movemask_epi8(okMask) != 0xFFFF) {
- return 0;
- }
-
- shifts = _mm_add_epi8(shifts, _mm_slli_si128(shifts, 4));
-
- __m128i mask = _mm_and_si128(state, _mm_set1_epi8(0xf8));
- shifts = _mm_add_epi8(shifts, _mm_slli_si128(shifts, 8));
-
- chunk = _mm_andnot_si128(mask, chunk); // from now on, we only have usefull bits
- shifts = _mm_and_si128(shifts, _mm_cmplt_epi8(counts, _mm_set1_epi8(2))); // <=1
-
- __m128i chunk_right = _mm_slli_si128(chunk, 1);
- shifts = _mm_blendv_epi8(shifts, _mm_srli_si128(shifts, 1),
+
+ // 4 bytes sequences are not vectorize. Fall back to the scalar processing
+ if (Y_UNLIKELY(_mm_movemask_epi8(cond4))) {
+ return 0;
+ }
+
+ //rune len for start of multi-byte sequences (0 for b0... and b10..., 2 for b110..., etc.)
+ __m128i count = _mm_and_si128(state, _mm_set1_epi8(0x7));
+
+ __m128i countSub1 = _mm_subs_epu8(count, _mm_set1_epi8(0x1));
+ __m128i continuation2 = _mm_slli_si128(_mm_subs_epu8(count, _mm_set1_epi8(0x2)), 2);
+
+ shifts = countSub1;
+ __m128i continuation1 = _mm_slli_si128(countSub1, 1);
+
+ shifts = _mm_add_epi8(shifts, _mm_slli_si128(shifts, 1));
+ __m128i continuationsRunelen = _mm_or_si128(continuation1, continuation2);
+
+ shifts = _mm_add_epi8(shifts, _mm_slli_si128(shifts, 2));
+ __m128i counts = _mm_or_si128(count, continuationsRunelen);
+
+ __m128i isBeginMultibyteMask = _mm_cmpgt_epi8(count, _mm_set1_epi8(0));
+ __m128i needNoContinuationMask = _mm_cmpeq_epi8(continuationsRunelen, _mm_set1_epi8(0));
+ __m128i isBeginMask = _mm_add_epi8(isBeginMultibyteMask, isAsciiMask);
+ //each symbol should be exactly one of ascii, continuation or begin
+ __m128i okMask = _mm_cmpeq_epi8(isBeginMask, needNoContinuationMask);
+
+ if (_mm_movemask_epi8(okMask) != 0xFFFF) {
+ return 0;
+ }
+
+ shifts = _mm_add_epi8(shifts, _mm_slli_si128(shifts, 4));
+
+ __m128i mask = _mm_and_si128(state, _mm_set1_epi8(0xf8));
+ shifts = _mm_add_epi8(shifts, _mm_slli_si128(shifts, 8));
+
+ chunk = _mm_andnot_si128(mask, chunk); // from now on, we only have usefull bits
+ shifts = _mm_and_si128(shifts, _mm_cmplt_epi8(counts, _mm_set1_epi8(2))); // <=1
+
+ __m128i chunk_right = _mm_slli_si128(chunk, 1);
+ shifts = _mm_blendv_epi8(shifts, _mm_srli_si128(shifts, 1),
_mm_srli_si128(_mm_slli_epi16(shifts, 7), 1));
-
- chunkLow = _mm_blendv_epi8(chunk,
+
+ chunkLow = _mm_blendv_epi8(chunk,
_mm_or_si128(chunk, _mm_and_si128(_mm_slli_epi16(chunk_right, 6), _mm_set1_epi8(0xc0))),
_mm_cmpeq_epi8(counts, _mm_set1_epi8(1)));
-
- chunkHigh = _mm_and_si128(chunk, _mm_cmpeq_epi8(counts, _mm_set1_epi8(2)));
-
- shifts = _mm_blendv_epi8(shifts, _mm_srli_si128(shifts, 2),
+
+ chunkHigh = _mm_and_si128(chunk, _mm_cmpeq_epi8(counts, _mm_set1_epi8(2)));
+
+ shifts = _mm_blendv_epi8(shifts, _mm_srli_si128(shifts, 2),
_mm_srli_si128(_mm_slli_epi16(shifts, 6), 2));
- chunkHigh = _mm_srli_epi32(chunkHigh, 2);
-
- shifts = _mm_blendv_epi8(shifts, _mm_srli_si128(shifts, 4),
+ chunkHigh = _mm_srli_epi32(chunkHigh, 2);
+
+ shifts = _mm_blendv_epi8(shifts, _mm_srli_si128(shifts, 4),
_mm_srli_si128(_mm_slli_epi16(shifts, 5), 4));
- chunkHigh = _mm_or_si128(chunkHigh,
+ chunkHigh = _mm_or_si128(chunkHigh,
_mm_and_si128(_mm_and_si128(_mm_slli_epi32(chunk_right, 4), _mm_set1_epi8(0xf0)),
mask3));
- int c = _mm_extract_epi16(counts, 7);
+ int c = _mm_extract_epi16(counts, 7);
sourceAdvance = !(c & 0x0200) ? 16 : !(c & 0x02) ? 15
: 14;
- }
+ }
- shifts = _mm_blendv_epi8(shifts, _mm_srli_si128(shifts, 8),
+ shifts = _mm_blendv_epi8(shifts, _mm_srli_si128(shifts, 8),
_mm_srli_si128(_mm_slli_epi16(shifts, 4), 8));
- chunkHigh = _mm_slli_si128(chunkHigh, 1);
-
- __m128i shuf = _mm_add_epi8(shifts, _mm_set_epi8(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0));
-
- chunkLow = _mm_shuffle_epi8(chunkLow, shuf);
- chunkHigh = _mm_shuffle_epi8(chunkHigh, shuf);
-
- utf16Low = _mm_unpacklo_epi8(chunkLow, chunkHigh);
- utf16High = _mm_unpackhi_epi8(chunkLow, chunkHigh);
-
- ui32 s = _mm_extract_epi32(shifts, 3);
- ui32 destAdvance = sourceAdvance - (0xff & (s >> (8 * (3 - 16 + sourceAdvance))));
- cur += sourceAdvance;
- return destAdvance;
-}
-
-namespace NDetail {
- void UTF8ToWideImplSSE41(const unsigned char*& cur, const unsigned char* last, wchar16*& dest) noexcept {
- alignas(16) wchar16 destAligned[16];
-
- while (cur + 16 <= last) {
- __m128i utf16Low;
- __m128i utf16High;
- ui32 dstAdvance = Unpack16BytesIntoUtf16IfNoSurrogats(cur, utf16Low, utf16High);
-
- if (dstAdvance == 0) {
- break;
- }
-
- _mm_store_si128(reinterpret_cast<__m128i*>(destAligned), utf16Low);
- _mm_store_si128(reinterpret_cast<__m128i*>(destAligned) + 1, utf16High);
+ chunkHigh = _mm_slli_si128(chunkHigh, 1);
+
+ __m128i shuf = _mm_add_epi8(shifts, _mm_set_epi8(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0));
+
+ chunkLow = _mm_shuffle_epi8(chunkLow, shuf);
+ chunkHigh = _mm_shuffle_epi8(chunkHigh, shuf);
+
+ utf16Low = _mm_unpacklo_epi8(chunkLow, chunkHigh);
+ utf16High = _mm_unpackhi_epi8(chunkLow, chunkHigh);
+
+ ui32 s = _mm_extract_epi32(shifts, 3);
+ ui32 destAdvance = sourceAdvance - (0xff & (s >> (8 * (3 - 16 + sourceAdvance))));
+ cur += sourceAdvance;
+ return destAdvance;
+}
+
+namespace NDetail {
+ void UTF8ToWideImplSSE41(const unsigned char*& cur, const unsigned char* last, wchar16*& dest) noexcept {
+ alignas(16) wchar16 destAligned[16];
+
+ while (cur + 16 <= last) {
+ __m128i utf16Low;
+ __m128i utf16High;
+ ui32 dstAdvance = Unpack16BytesIntoUtf16IfNoSurrogats(cur, utf16Low, utf16High);
+
+ if (dstAdvance == 0) {
+ break;
+ }
+
+ _mm_store_si128(reinterpret_cast<__m128i*>(destAligned), utf16Low);
+ _mm_store_si128(reinterpret_cast<__m128i*>(destAligned) + 1, utf16High);
memcpy(dest, destAligned, sizeof(__m128i) * 2);
- dest += dstAdvance;
- }
- //The rest will be handled sequencially.
- // Possible improvement: go back to the vectorized processing after the error or the 4 byte sequence
- }
-
- void UTF8ToWideImplSSE41(const unsigned char*& cur, const unsigned char* last, wchar32*& dest) noexcept {
- alignas(16) wchar32 destAligned[16];
-
- while (cur + 16 <= last) {
- __m128i utf16Low;
- __m128i utf16High;
- ui32 dstAdvance = Unpack16BytesIntoUtf16IfNoSurrogats(cur, utf16Low, utf16High);
-
- if (dstAdvance == 0) {
- break;
- }
-
- //NOTE: we only work in case without surrogat pairs, so we can make simple copying with zeroes in 2 high bytes
- __m128i utf32_lowlow = _mm_unpacklo_epi16(utf16Low, _mm_set1_epi8(0));
- __m128i utf32_lowhigh = _mm_unpackhi_epi16(utf16Low, _mm_set1_epi8(0));
- __m128i utf32_highlow = _mm_unpacklo_epi16(utf16High, _mm_set1_epi8(0));
- __m128i utf32_highhigh = _mm_unpackhi_epi16(utf16High, _mm_set1_epi8(0));
-
- _mm_store_si128(reinterpret_cast<__m128i*>(destAligned), utf32_lowlow);
- _mm_store_si128(reinterpret_cast<__m128i*>(destAligned) + 1, utf32_lowhigh);
- _mm_store_si128(reinterpret_cast<__m128i*>(destAligned) + 2, utf32_highlow);
- _mm_store_si128(reinterpret_cast<__m128i*>(destAligned) + 3, utf32_highhigh);
-
- memcpy(dest, destAligned, sizeof(__m128i) * 4);
- dest += dstAdvance;
+ dest += dstAdvance;
+ }
+ //The rest will be handled sequencially.
+ // Possible improvement: go back to the vectorized processing after the error or the 4 byte sequence
+ }
+
+ void UTF8ToWideImplSSE41(const unsigned char*& cur, const unsigned char* last, wchar32*& dest) noexcept {
+ alignas(16) wchar32 destAligned[16];
+
+ while (cur + 16 <= last) {
+ __m128i utf16Low;
+ __m128i utf16High;
+ ui32 dstAdvance = Unpack16BytesIntoUtf16IfNoSurrogats(cur, utf16Low, utf16High);
+
+ if (dstAdvance == 0) {
+ break;
+ }
+
+ //NOTE: we only work in case without surrogat pairs, so we can make simple copying with zeroes in 2 high bytes
+ __m128i utf32_lowlow = _mm_unpacklo_epi16(utf16Low, _mm_set1_epi8(0));
+ __m128i utf32_lowhigh = _mm_unpackhi_epi16(utf16Low, _mm_set1_epi8(0));
+ __m128i utf32_highlow = _mm_unpacklo_epi16(utf16High, _mm_set1_epi8(0));
+ __m128i utf32_highhigh = _mm_unpackhi_epi16(utf16High, _mm_set1_epi8(0));
+
+ _mm_store_si128(reinterpret_cast<__m128i*>(destAligned), utf32_lowlow);
+ _mm_store_si128(reinterpret_cast<__m128i*>(destAligned) + 1, utf32_lowhigh);
+ _mm_store_si128(reinterpret_cast<__m128i*>(destAligned) + 2, utf32_highlow);
+ _mm_store_si128(reinterpret_cast<__m128i*>(destAligned) + 3, utf32_highhigh);
+
+ memcpy(dest, destAligned, sizeof(__m128i) * 4);
+ dest += dstAdvance;
}
//The rest will be handled sequencially.
- // Possible improvement: go back to the vectorized processing after the error or the 4 byte sequence
+ // Possible improvement: go back to the vectorized processing after the error or the 4 byte sequence
}
}
diff --git a/util/charset/wide_ut.cpp b/util/charset/wide_ut.cpp
index d8f3233e73..aa1a28f84f 100644
--- a/util/charset/wide_ut.cpp
+++ b/util/charset/wide_ut.cpp
@@ -1,7 +1,7 @@
#include "utf8.h"
#include "wide.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/string/reverse.h>
diff --git a/util/datetime/base_ut.cpp b/util/datetime/base_ut.cpp
index afc3f802eb..ae839a5849 100644
--- a/util/datetime/base_ut.cpp
+++ b/util/datetime/base_ut.cpp
@@ -1,6 +1,6 @@
#include "base.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/utility.h>
#include <util/generic/ylimits.h>
diff --git a/util/datetime/parser_deprecated_ut.cpp b/util/datetime/parser_deprecated_ut.cpp
index 6ad9f885b1..e7ab932ca4 100644
--- a/util/datetime/parser_deprecated_ut.cpp
+++ b/util/datetime/parser_deprecated_ut.cpp
@@ -1,6 +1,6 @@
#include "parser.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
static const time_t SECONDS_PER_HOUR = 3600;
static const time_t SECONDS_PER_MINUTE = 60;
diff --git a/util/datetime/parser_ut.cpp b/util/datetime/parser_ut.cpp
index 61364af997..94fb8b60b7 100644
--- a/util/datetime/parser_ut.cpp
+++ b/util/datetime/parser_ut.cpp
@@ -1,6 +1,6 @@
#include "parser.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
static const time_t SECONDS_PER_HOUR = 3600;
static const time_t SECONDS_PER_MINUTE = 60;
diff --git a/util/datetime/uptime_ut.cpp b/util/datetime/uptime_ut.cpp
index 7f5ecc482c..bd84efc357 100644
--- a/util/datetime/uptime_ut.cpp
+++ b/util/datetime/uptime_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "uptime.h"
diff --git a/util/digest/fnv_ut.cpp b/util/digest/fnv_ut.cpp
index ce56642b3e..bee033d919 100644
--- a/util/digest/fnv_ut.cpp
+++ b/util/digest/fnv_ut.cpp
@@ -1,6 +1,6 @@
#include "fnv.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TFnvTest) {
Y_UNIT_TEST(TestFnv32) {
diff --git a/util/digest/multi_ut.cpp b/util/digest/multi_ut.cpp
index dff64ff0cc..f9305fc7c2 100644
--- a/util/digest/multi_ut.cpp
+++ b/util/digest/multi_ut.cpp
@@ -1,6 +1,6 @@
#include "multi.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/stream/output.h>
diff --git a/util/digest/murmur.h b/util/digest/murmur.h
index 6b519b430a..8d44d3e0df 100644
--- a/util/digest/murmur.h
+++ b/util/digest/murmur.h
@@ -11,7 +11,7 @@ namespace NMurmurPrivate {
Y_PURE_FUNCTION ui32 MurmurHash32(const void* key, size_t len, ui32 seed) noexcept;
Y_PURE_FUNCTION ui64 MurmurHash64(const void* key, size_t len, ui64 seed) noexcept;
-
+
template <unsigned N>
struct TMurHelper;
diff --git a/util/digest/murmur_ut.cpp b/util/digest/murmur_ut.cpp
index 29287668bc..358083c7e2 100644
--- a/util/digest/murmur_ut.cpp
+++ b/util/digest/murmur_ut.cpp
@@ -1,7 +1,7 @@
#include "murmur.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
class TMurmurHashTest: public TTestBase {
UNIT_TEST_SUITE(TMurmurHashTest);
diff --git a/util/digest/sequence_ut.cpp b/util/digest/sequence_ut.cpp
index 87d6102ee5..a4413ea3fe 100644
--- a/util/digest/sequence_ut.cpp
+++ b/util/digest/sequence_ut.cpp
@@ -1,6 +1,6 @@
#include "sequence.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/map.h>
#include <util/generic/vector.h>
diff --git a/util/draft/date_ut.cpp b/util/draft/date_ut.cpp
index 8c33a6c1cf..bef600d361 100644
--- a/util/draft/date_ut.cpp
+++ b/util/draft/date_ut.cpp
@@ -1,6 +1,6 @@
#include "date.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TDateTest) {
Y_UNIT_TEST(ComponentsTest) {
diff --git a/util/draft/datetime_ut.cpp b/util/draft/datetime_ut.cpp
index a5e065ef6e..4434c8f948 100644
--- a/util/draft/datetime_ut.cpp
+++ b/util/draft/datetime_ut.cpp
@@ -1,6 +1,6 @@
#include "datetime.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/string/builder.h>
diff --git a/util/draft/holder_vector_ut.cpp b/util/draft/holder_vector_ut.cpp
index f64393860a..c7b95de7b3 100644
--- a/util/draft/holder_vector_ut.cpp
+++ b/util/draft/holder_vector_ut.cpp
@@ -1,6 +1,6 @@
#include "holder_vector.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(THolderVectorTest) {
Y_UNIT_TEST(TestCreateEmpty) {
diff --git a/util/draft/memory_ut.cpp b/util/draft/memory_ut.cpp
index 76bee30549..12befeeb83 100644
--- a/util/draft/memory_ut.cpp
+++ b/util/draft/memory_ut.cpp
@@ -1,6 +1,6 @@
#include "memory.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#pragma pack(1)
struct Y_PACKED TSampleStruct1 {
diff --git a/util/folder/dirent_win.c b/util/folder/dirent_win.c
index 7e6db74ce5..6b8d5c9462 100644
--- a/util/folder/dirent_win.c
+++ b/util/folder/dirent_win.c
@@ -23,32 +23,32 @@ struct DIR* opendir(const char* dirname) {
struct DIR* dir = (struct DIR*)malloc(sizeof(struct DIR));
if (!dir) {
return NULL;
- }
+ }
dir->sh = INVALID_HANDLE_VALUE;
dir->fff_templ = NULL;
dir->file_no = 0;
dir->readdir_buf = NULL;
-
+
int len = strlen(dirname);
//Remove trailing slashes
while (len && (dirname[len - 1] == '\\' || dirname[len - 1] == '/')) {
--len;
}
- int len_converted = MultiByteToWideChar(CP_UTF8, 0, dirname, len, 0, 0);
- if (len_converted == 0) {
+ int len_converted = MultiByteToWideChar(CP_UTF8, 0, dirname, len, 0, 0);
+ if (len_converted == 0) {
closedir(dir);
return NULL;
- }
+ }
dir->fff_templ = (WCHAR*)malloc((len_converted + 5) * sizeof(WCHAR));
if (!dir->fff_templ) {
closedir(dir);
return NULL;
- }
- MultiByteToWideChar(CP_UTF8, 0, dirname, len, dir->fff_templ, len_converted);
-
- WCHAR append[] = {'\\', '*', '.', '*', 0};
- memcpy(dir->fff_templ + len_converted, append, sizeof(append));
- dir->sh = FindFirstFileW(dir->fff_templ, &dir->wfd);
+ }
+ MultiByteToWideChar(CP_UTF8, 0, dirname, len, dir->fff_templ, len_converted);
+
+ WCHAR append[] = {'\\', '*', '.', '*', 0};
+ memcpy(dir->fff_templ + len_converted, append, sizeof(append));
+ dir->sh = FindFirstFileW(dir->fff_templ, &dir->wfd);
if (dir->sh == INVALID_HANDLE_VALUE) {
SetErrno();
closedir(dir);
@@ -68,7 +68,7 @@ int closedir(struct DIR* dir) {
}
int readdir_r(struct DIR* dir, struct dirent* entry, struct dirent** result) {
- if (!FindNextFileW(dir->sh, &dir->wfd)) {
+ if (!FindNextFileW(dir->sh, &dir->wfd)) {
int err = GetLastError();
*result = 0;
if (err == ERROR_NO_MORE_FILES) {
@@ -89,36 +89,36 @@ int readdir_r(struct DIR* dir, struct dirent* entry, struct dirent** result) {
} else {
entry->d_type = DT_REG;
}
- int len = lstrlenW(dir->wfd.cFileName);
- int conv_len = WideCharToMultiByte(CP_UTF8, 0, dir->wfd.cFileName, len, 0, 0, 0, 0);
- if (conv_len == 0) {
- return -1;
- }
- if (conv_len > sizeof(entry->d_name) - 1) {
- SetLastError(ERROR_INSUFFICIENT_BUFFER);
- return ERROR_INSUFFICIENT_BUFFER;
- }
- entry->d_namlen = conv_len;
- WideCharToMultiByte(CP_UTF8, 0, dir->wfd.cFileName, len, entry->d_name, conv_len, 0, 0);
- entry->d_name[conv_len] = 0;
+ int len = lstrlenW(dir->wfd.cFileName);
+ int conv_len = WideCharToMultiByte(CP_UTF8, 0, dir->wfd.cFileName, len, 0, 0, 0, 0);
+ if (conv_len == 0) {
+ return -1;
+ }
+ if (conv_len > sizeof(entry->d_name) - 1) {
+ SetLastError(ERROR_INSUFFICIENT_BUFFER);
+ return ERROR_INSUFFICIENT_BUFFER;
+ }
+ entry->d_namlen = conv_len;
+ WideCharToMultiByte(CP_UTF8, 0, dir->wfd.cFileName, len, entry->d_name, conv_len, 0, 0);
+ entry->d_name[conv_len] = 0;
*result = entry;
return 0;
}
struct dirent* readdir(struct DIR* dir) {
struct dirent* res;
- if (!dir->readdir_buf) {
+ if (!dir->readdir_buf) {
dir->readdir_buf = (struct dirent*)malloc(sizeof(struct dirent));
- if (dir->readdir_buf == 0)
- return 0;
- }
+ if (dir->readdir_buf == 0)
+ return 0;
+ }
readdir_r(dir, dir->readdir_buf, &res);
return res;
}
void rewinddir(struct DIR* dir) {
FindClose(dir->sh);
- dir->sh = FindFirstFileW(dir->fff_templ, &dir->wfd);
+ dir->sh = FindFirstFileW(dir->fff_templ, &dir->wfd);
dir->file_no = 0;
}
diff --git a/util/folder/dirut.cpp b/util/folder/dirut.cpp
index ffc9b09f96..096cf3fa00 100644
--- a/util/folder/dirut.cpp
+++ b/util/folder/dirut.cpp
@@ -3,7 +3,7 @@
#include "filelist.h"
#include "fts.h"
#include "pathsplit.h"
-#include "path.h"
+#include "path.h"
#include <util/generic/yexception.h>
#include <util/system/compiler.h>
@@ -396,7 +396,7 @@ void RemoveDirWithContents(TString dirName) {
}
int mkpath(char* path, int mode) {
- return NFs::MakeDirectoryRecursive(path, NFs::EFilePermission(mode)) ? 0 : -1;
+ return NFs::MakeDirectoryRecursive(path, NFs::EFilePermission(mode)) ? 0 : -1;
}
// Implementation of realpath in FreeBSD (version 9.0 and less) and GetFullPathName in Windows
@@ -415,10 +415,10 @@ TString RealPath(const TString& path) {
}
TString RealLocation(const TString& path) {
- if (NFs::Exists(path))
+ if (NFs::Exists(path))
return RealPath(path);
TString dirpath = GetDirName(path);
- if (NFs::Exists(dirpath))
+ if (NFs::Exists(dirpath))
return RealPath(dirpath) + GetDirectorySeparatorS() + GetFileNameComponent(path.data());
ythrow TFileError() << "RealLocation failed \"" << path << "\"";
}
@@ -439,8 +439,8 @@ int MakeTempDir(char path[/*FILENAME_MAX*/], const char* prefix) {
if ((ret = ResolvePath(prefix, nullptr, path, 1)) != 0)
return ret;
- if (!TFileStat(path).IsDir())
- return ENOENT;
+ if (!TFileStat(path).IsDir())
+ return ENOENT;
if ((strlcat(path, "tmpXXXXXX", FILENAME_MAX) > FILENAME_MAX - 100))
return EINVAL;
if (!(mkdtemp(path)))
@@ -450,7 +450,7 @@ int MakeTempDir(char path[/*FILENAME_MAX*/], const char* prefix) {
}
bool IsDir(const TString& path) {
- return TFileStat(path).IsDir();
+ return TFileStat(path).IsDir();
}
TString GetHomeDir() {
@@ -483,9 +483,9 @@ void MakeDirIfNotExist(const char* path, int mode) {
}
void MakePathIfNotExist(const char* path, int mode) {
- NFs::MakeDirectoryRecursive(path, NFs::EFilePermission(mode));
- if (!NFs::Exists(path) || !TFileStat(path).IsDir()) {
- ythrow TSystemError() << "failed to create directory " << path;
+ NFs::MakeDirectoryRecursive(path, NFs::EFilePermission(mode));
+ if (!NFs::Exists(path) || !TFileStat(path).IsDir()) {
+ ythrow TSystemError() << "failed to create directory " << path;
}
}
@@ -536,7 +536,7 @@ bool SafeResolveDir(const char* path, TString& result) {
}
TString GetDirName(const TString& path) {
- return TFsPath(path).Dirname();
+ return TFsPath(path).Dirname();
}
#ifdef _win32_
@@ -549,13 +549,13 @@ char* realpath(const char* pathname, char resolved_path[MAXPATHLEN]) {
#endif
TString GetBaseName(const TString& path) {
- return TFsPath(path).Basename();
+ return TFsPath(path).Basename();
}
-static bool IsAbsolutePath(const char* str) {
+static bool IsAbsolutePath(const char* str) {
return str && TPathSplitTraitsLocal::IsAbsolutePath(TStringBuf(str, NStringPrivate::GetStringLengthWithLimit(str, 3)));
-}
-
+}
+
int ResolvePath(const char* rel, const char* abs, char res[/*MAXPATHLEN*/], bool isdir) {
char t[MAXPATHLEN * 2 + 3];
size_t len;
diff --git a/util/folder/dirut.h b/util/folder/dirut.h
index 2537027b12..03de8ff143 100644
--- a/util/folder/dirut.h
+++ b/util/folder/dirut.h
@@ -2,7 +2,7 @@
#include <util/system/defaults.h>
#include <util/system/sysstat.h>
-#include <util/system/fs.h>
+#include <util/system/fs.h>
#include <util/generic/string.h>
#include <util/generic/yexception.h>
@@ -108,8 +108,8 @@ public:
if (!fname || !*fname)
return nullptr;
if (Strict) {
- NFs::EnsureExists(fname);
- } else if (!NFs::Exists(fname))
+ NFs::EnsureExists(fname);
+ } else if (!NFs::Exists(fname))
fname = nullptr;
return fname;
}
diff --git a/util/folder/dirut_ut.cpp b/util/folder/dirut_ut.cpp
index 45ebfc842c..e355038bf5 100644
--- a/util/folder/dirut_ut.cpp
+++ b/util/folder/dirut_ut.cpp
@@ -1,7 +1,7 @@
#include "dirut.h"
#include "tempdir.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/string.h>
#include <util/memory/tempbuf.h>
diff --git a/util/folder/filelist_ut.cpp b/util/folder/filelist_ut.cpp
index 0cdcdf3d00..94c75f884e 100644
--- a/util/folder/filelist_ut.cpp
+++ b/util/folder/filelist_ut.cpp
@@ -2,7 +2,7 @@
#include "filelist.h"
#include "tempdir.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/system/file.h>
#include <util/generic/string.h>
diff --git a/util/folder/fts.cpp b/util/folder/fts.cpp
index 0e6a6f86eb..86d6420536 100644
--- a/util/folder/fts.cpp
+++ b/util/folder/fts.cpp
@@ -91,29 +91,29 @@ int cmp_dird(dird fd1, dird fd2) {
#else // ndef _win_
int stat64UTF(const char* path, struct _stat64* _Stat) {
- int len_converted = MultiByteToWideChar(CP_UTF8, 0, path, -1, 0, 0);
- if (len_converted == 0) {
- return -1;
- }
+ int len_converted = MultiByteToWideChar(CP_UTF8, 0, path, -1, 0, 0);
+ if (len_converted == 0) {
+ return -1;
+ }
WCHAR* buf = (WCHAR*)malloc(sizeof(WCHAR) * (len_converted));
- if (buf == nullptr) {
- return -1;
- }
- MultiByteToWideChar(CP_UTF8, 0, path, -1, buf, len_converted);
-
- int ret = _wstat64(buf, _Stat);
- free(buf);
- return ret;
-}
-
-int stat64UTF(dird path, struct _stat64* _Stat) {
- return _wstat64(path, _Stat);
-}
-
+ if (buf == nullptr) {
+ return -1;
+ }
+ MultiByteToWideChar(CP_UTF8, 0, path, -1, buf, len_converted);
+
+ int ret = _wstat64(buf, _Stat);
+ free(buf);
+ return ret;
+}
+
+int stat64UTF(dird path, struct _stat64* _Stat) {
+ return _wstat64(path, _Stat);
+}
+
const dird invalidDirD = nullptr;
dird get_cwdd() {
- return _wgetcwd(nullptr, 0);
+ return _wgetcwd(nullptr, 0);
}
int valid_dird(dird fd) {
@@ -125,42 +125,42 @@ void close_dird(dird fd) {
}
int chdir_dird(dird fd) {
- return _wchdir(fd);
+ return _wchdir(fd);
}
-int chdir_dird(const char* path) {
- int len_converted = MultiByteToWideChar(CP_UTF8, 0, path, -1, 0, 0);
- if (len_converted == 0) {
- return -1;
- }
+int chdir_dird(const char* path) {
+ int len_converted = MultiByteToWideChar(CP_UTF8, 0, path, -1, 0, 0);
+ if (len_converted == 0) {
+ return -1;
+ }
WCHAR* buf = (WCHAR*)malloc(sizeof(WCHAR) * (len_converted));
- if (buf == nullptr) {
- return -1;
- }
- MultiByteToWideChar(CP_UTF8, 0, path, -1, buf, len_converted);
- int ret = _wchdir(buf);
- free(buf);
- return ret;
-}
-
+ if (buf == nullptr) {
+ return -1;
+ }
+ MultiByteToWideChar(CP_UTF8, 0, path, -1, buf, len_converted);
+ int ret = _wchdir(buf);
+ free(buf);
+ return ret;
+}
+
int cmp_dird(dird fd1, dird fd2) {
- return lstrcmpW(fd1, fd2);
+ return lstrcmpW(fd1, fd2);
}
dird get_dird(char* path) {
- int len_converted = MultiByteToWideChar(CP_UTF8, 0, path, -1, 0, 0);
- if (len_converted == 0) {
- return nullptr;
- }
+ int len_converted = MultiByteToWideChar(CP_UTF8, 0, path, -1, 0, 0);
+ if (len_converted == 0) {
+ return nullptr;
+ }
WCHAR* buf = (WCHAR*)malloc(sizeof(WCHAR) * (len_converted));
- if (buf == nullptr) {
- return nullptr;
- }
- MultiByteToWideChar(CP_UTF8, 0, path, -1, buf, len_converted);
-
+ if (buf == nullptr) {
+ return nullptr;
+ }
+ MultiByteToWideChar(CP_UTF8, 0, path, -1, buf, len_converted);
+
WCHAR* ret = _wfullpath(0, buf, 0);
-
- free(buf);
+
+ free(buf);
return ret;
}
@@ -1404,29 +1404,29 @@ fts_safe_changedir(FTS* sp, FTSENT* p, int /*fd*/, const char* path)
ret = -1;
goto bail;
}
- ret = chdir_dird(path);
+ ret = chdir_dird(path);
bail:
return (ret);
}
-
-static int
-fts_safe_changedir(FTS* sp, FTSENT* p, int /*fd*/, dird path) {
- int ret;
- stat_struct sb;
-
- if (ISSET(FTS_NOCHDIR))
- return (0);
- if (STAT_FUNC(path, &sb)) {
- ret = -1;
- goto bail;
- }
- if (p->fts_dev != sb.st_dev) {
+
+static int
+fts_safe_changedir(FTS* sp, FTSENT* p, int /*fd*/, dird path) {
+ int ret;
+ stat_struct sb;
+
+ if (ISSET(FTS_NOCHDIR))
+ return (0);
+ if (STAT_FUNC(path, &sb)) {
+ ret = -1;
+ goto bail;
+ }
+ if (p->fts_dev != sb.st_dev) {
errno = ENOENT; /* disinformation */
- ret = -1;
- goto bail;
- }
- ret = chdir_dird(path);
-bail:
- return (ret);
-}
+ ret = -1;
+ goto bail;
+ }
+ ret = chdir_dird(path);
+bail:
+ return (ret);
+}
#endif
diff --git a/util/folder/fts.h b/util/folder/fts.h
index f3c799e8c8..7da796bb62 100644
--- a/util/folder/fts.h
+++ b/util/folder/fts.h
@@ -10,7 +10,7 @@ typedef struct stat stat_struct;
#define STAT_FUNC stat
#else
#include <util/folder/dirent_win.h>
-typedef WCHAR* dird;
+typedef WCHAR* dird;
typedef unsigned short u_short;
typedef unsigned int nlink_t;
typedef struct _stat64 stat_struct;
@@ -18,7 +18,7 @@ typedef struct _stat64 stat_struct;
//TODO: remove from global scope stat64UTF stat64UTF
#ifdef __cplusplus
int stat64UTF(const char* path, struct _stat64* _Stat);
-int stat64UTF(dird path, struct _stat64* _Stat);
+int stat64UTF(dird path, struct _stat64* _Stat);
#endif
#endif
diff --git a/util/folder/fts_ut.cpp b/util/folder/fts_ut.cpp
index c5d59e35f4..d6a882fa60 100644
--- a/util/folder/fts_ut.cpp
+++ b/util/folder/fts_ut.cpp
@@ -2,7 +2,7 @@
#include "dirut.h"
#include "tempdir.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <library/cpp/threading/future/async.h>
#include <util/system/file.h>
diff --git a/util/folder/iterator_ut.cpp b/util/folder/iterator_ut.cpp
index 936becd139..98e28ba639 100644
--- a/util/folder/iterator_ut.cpp
+++ b/util/folder/iterator_ut.cpp
@@ -1,7 +1,7 @@
#include "dirut.h"
#include "iterator.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/system/fs.h>
#include <util/system/file.h>
diff --git a/util/folder/lstat_win.c b/util/folder/lstat_win.c
index cf94cec01a..43951ecd32 100644
--- a/util/folder/lstat_win.c
+++ b/util/folder/lstat_win.c
@@ -5,22 +5,22 @@
#include "lstat_win.h"
int lstat(const char* fileName, stat_struct* fileStat) {
- int len = strlen(fileName);
- int convRes = MultiByteToWideChar(CP_UTF8, 0, fileName, len, 0, 0);
- if (convRes == 0) {
- return -1;
- }
- WCHAR* buf = malloc(sizeof(WCHAR) * (convRes + 1));
- MultiByteToWideChar(CP_UTF8, 0, fileName, len, buf, convRes);
- buf[convRes] = 0;
-
+ int len = strlen(fileName);
+ int convRes = MultiByteToWideChar(CP_UTF8, 0, fileName, len, 0, 0);
+ if (convRes == 0) {
+ return -1;
+ }
+ WCHAR* buf = malloc(sizeof(WCHAR) * (convRes + 1));
+ MultiByteToWideChar(CP_UTF8, 0, fileName, len, buf, convRes);
+ buf[convRes] = 0;
+
HANDLE findHandle;
- WIN32_FIND_DATAW findBuf;
+ WIN32_FIND_DATAW findBuf;
int result;
- result = _wstat64(buf, fileStat);
+ result = _wstat64(buf, fileStat);
if (result == 0) {
SetLastError(0);
- findHandle = FindFirstFileW(buf, &findBuf);
+ findHandle = FindFirstFileW(buf, &findBuf);
if (findBuf.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT &&
(findBuf.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT || findBuf.dwReserved0 == IO_REPARSE_TAG_SYMLINK))
{
@@ -28,7 +28,7 @@ int lstat(const char* fileName, stat_struct* fileStat) {
}
FindClose(findHandle);
}
- free(buf);
+ free(buf);
return result;
}
diff --git a/util/folder/path.cpp b/util/folder/path.cpp
index bfe0c67d68..cdb1d6cd6f 100644
--- a/util/folder/path.cpp
+++ b/util/folder/path.cpp
@@ -188,21 +188,21 @@ TFsPath::TSplit& TFsPath::GetSplit() const {
static Y_FORCE_INLINE void VerifyPath(const TStringBuf path) {
Y_VERIFY(!path.Contains('\0'), "wrong format of TFsPath");
-}
-
+}
+
TFsPath::TFsPath() {
}
TFsPath::TFsPath(const TString& path)
: Path_(path)
{
- VerifyPath(Path_);
+ VerifyPath(Path_);
}
TFsPath::TFsPath(const TStringBuf path)
: Path_(ToString(path))
{
- VerifyPath(Path_);
+ VerifyPath(Path_);
}
TFsPath::TFsPath(const char* path)
@@ -330,7 +330,7 @@ TFsPath TFsPath::ReadLink() const {
}
bool TFsPath::Exists() const {
- return IsDefined() && NFs::Exists(*this);
+ return IsDefined() && NFs::Exists(*this);
}
void TFsPath::CheckExists() const {
@@ -459,7 +459,7 @@ void TFsPath::ForceRenameTo(const TString& newPath) const {
}
TFsPath TFsPath::Cwd() {
- return TFsPath(::NFs::CurrentWorkingDirectory());
+ return TFsPath(::NFs::CurrentWorkingDirectory());
}
const TPathSplit& TFsPath::PathSplit() const {
diff --git a/util/folder/path_ut.cpp b/util/folder/path_ut.cpp
index e6a3451016..d621554769 100644
--- a/util/folder/path_ut.cpp
+++ b/util/folder/path_ut.cpp
@@ -3,7 +3,7 @@
#include "dirut.h"
#include "tempdir.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/scope.h>
#include <util/system/platform.h>
@@ -444,9 +444,9 @@ Y_UNIT_TEST_SUITE(TFsPathTests) {
TFsPath(link).ForceDelete();
- UNIT_ASSERT(!NFs::Exists(link));
- UNIT_ASSERT(NFs::Exists(originFile));
- UNIT_ASSERT(NFs::Exists(originDir));
+ UNIT_ASSERT(!NFs::Exists(link));
+ UNIT_ASSERT(NFs::Exists(originFile));
+ UNIT_ASSERT(NFs::Exists(originDir));
}
Y_UNIT_TEST(TestRemoveSymlinkToFile) {
@@ -467,9 +467,9 @@ Y_UNIT_TEST_SUITE(TFsPathTests) {
TFsPath(link).ForceDelete();
- UNIT_ASSERT(!NFs::Exists(link));
- UNIT_ASSERT(NFs::Exists(originFile));
- UNIT_ASSERT(NFs::Exists(originDir));
+ UNIT_ASSERT(!NFs::Exists(link));
+ UNIT_ASSERT(NFs::Exists(originFile));
+ UNIT_ASSERT(NFs::Exists(originDir));
}
Y_UNIT_TEST(TestRemoveDirWithSymlinkToDir) {
@@ -493,10 +493,10 @@ Y_UNIT_TEST_SUITE(TFsPathTests) {
TFsPath(symlinkedDir).ForceDelete();
- UNIT_ASSERT(!NFs::Exists(symlinkedFile));
- UNIT_ASSERT(!NFs::Exists(symlinkedDir));
- UNIT_ASSERT(NFs::Exists(originFile));
- UNIT_ASSERT(NFs::Exists(originDir));
+ UNIT_ASSERT(!NFs::Exists(symlinkedFile));
+ UNIT_ASSERT(!NFs::Exists(symlinkedDir));
+ UNIT_ASSERT(NFs::Exists(originFile));
+ UNIT_ASSERT(NFs::Exists(originDir));
}
Y_UNIT_TEST(TestRemoveDirWithSymlinkToFile) {
@@ -520,10 +520,10 @@ Y_UNIT_TEST_SUITE(TFsPathTests) {
TFsPath(symlinkedDir).ForceDelete();
- UNIT_ASSERT(!NFs::Exists(symlinkedFile));
- UNIT_ASSERT(!NFs::Exists(symlinkedDir));
- UNIT_ASSERT(NFs::Exists(originFile));
- UNIT_ASSERT(NFs::Exists(originDir));
+ UNIT_ASSERT(!NFs::Exists(symlinkedFile));
+ UNIT_ASSERT(!NFs::Exists(symlinkedDir));
+ UNIT_ASSERT(NFs::Exists(originFile));
+ UNIT_ASSERT(NFs::Exists(originDir));
}
#endif
diff --git a/util/generic/adaptor_ut.cpp b/util/generic/adaptor_ut.cpp
index 721f849f93..c36d035843 100644
--- a/util/generic/adaptor_ut.cpp
+++ b/util/generic/adaptor_ut.cpp
@@ -1,7 +1,7 @@
#include "adaptor.h"
#include "yexception.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
struct TOnCopy: yexception {
};
diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp
index 8d732fcc0c..dd9629da4d 100644
--- a/util/generic/algorithm_ut.cpp
+++ b/util/generic/algorithm_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "algorithm.h"
#include "strbuf.h"
diff --git a/util/generic/array_ref_ut.cpp b/util/generic/array_ref_ut.cpp
index 4c8eaf7135..d1bc763c51 100644
--- a/util/generic/array_ref_ut.cpp
+++ b/util/generic/array_ref_ut.cpp
@@ -1,6 +1,6 @@
#include "array_ref.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TestArrayRef) {
Y_UNIT_TEST(TestDefaultConstructor) {
diff --git a/util/generic/array_size_ut.cpp b/util/generic/array_size_ut.cpp
index 13f45903c5..369c23658b 100644
--- a/util/generic/array_size_ut.cpp
+++ b/util/generic/array_size_ut.cpp
@@ -1,6 +1,6 @@
#include "array_size.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(ArraySizeTest) {
Y_UNIT_TEST(Test1) {
diff --git a/util/generic/benchmark/fastclp2/main.cpp b/util/generic/benchmark/fastclp2/main.cpp
index 49277db077..f4095b0c57 100644
--- a/util/generic/benchmark/fastclp2/main.cpp
+++ b/util/generic/benchmark/fastclp2/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/generic/bitops.h>
#include <util/generic/vector.h>
diff --git a/util/generic/benchmark/log2/main.cpp b/util/generic/benchmark/log2/main.cpp
index 969f09a309..32b83e9538 100644
--- a/util/generic/benchmark/log2/main.cpp
+++ b/util/generic/benchmark/log2/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <library/cpp/fast_log/fast_log.h>
diff --git a/util/generic/benchmark/rotate_bits/main.cpp b/util/generic/benchmark/rotate_bits/main.cpp
index 057edbe864..838c8cf869 100644
--- a/util/generic/benchmark/rotate_bits/main.cpp
+++ b/util/generic/benchmark/rotate_bits/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/generic/vector.h>
#include <util/generic/xrange.h>
diff --git a/util/generic/benchmark/singleton/main.cpp b/util/generic/benchmark/singleton/main.cpp
index 2b06bd371d..3a2a759370 100644
--- a/util/generic/benchmark/singleton/main.cpp
+++ b/util/generic/benchmark/singleton/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/generic/singleton.h>
#include <util/generic/xrange.h>
diff --git a/util/generic/benchmark/smart_pointers/main.cpp b/util/generic/benchmark/smart_pointers/main.cpp
index 92c2f923bb..1d04c00bf6 100644
--- a/util/generic/benchmark/smart_pointers/main.cpp
+++ b/util/generic/benchmark/smart_pointers/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/generic/ptr.h>
#include <util/generic/xrange.h>
diff --git a/util/generic/benchmark/sort/main.cpp b/util/generic/benchmark/sort/main.cpp
index d58f491f4d..7f3b5a9b26 100644
--- a/util/generic/benchmark/sort/main.cpp
+++ b/util/generic/benchmark/sort/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/generic/algorithm.h>
#include <util/generic/vector.h>
diff --git a/util/generic/benchmark/vector_count_ctor/f.cpp b/util/generic/benchmark/vector_count_ctor/f.cpp
index b89e351ba7..19ddc48781 100644
--- a/util/generic/benchmark/vector_count_ctor/f.cpp
+++ b/util/generic/benchmark/vector_count_ctor/f.cpp
@@ -1,6 +1,6 @@
#include "f.h"
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/generic/vector.h>
#include <util/generic/ptr.h>
diff --git a/util/generic/benchmark/vector_count_ctor/main.cpp b/util/generic/benchmark/vector_count_ctor/main.cpp
index 6fb1fda9c9..78ac40ffc3 100644
--- a/util/generic/benchmark/vector_count_ctor/main.cpp
+++ b/util/generic/benchmark/vector_count_ctor/main.cpp
@@ -1,6 +1,6 @@
#include "f.h"
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#define DEFINE_BENCHMARK(N) \
Y_CPU_BENCHMARK(Yvector_##N, iface) { \
diff --git a/util/generic/bitmap_ut.cpp b/util/generic/bitmap_ut.cpp
index 087d34a8dc..4e90309c74 100644
--- a/util/generic/bitmap_ut.cpp
+++ b/util/generic/bitmap_ut.cpp
@@ -1,6 +1,6 @@
#include "bitmap.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#define INIT_BITMAP(bitmap, bits) \
for (size_t i = 0; i < sizeof(bits) / sizeof(size_t); ++i) { \
diff --git a/util/generic/bitops.h b/util/generic/bitops.h
index 2db15fc59b..0de23f0be9 100644
--- a/util/generic/bitops.h
+++ b/util/generic/bitops.h
@@ -430,8 +430,8 @@ constexpr T RotateBitsRightCT(T value, const ui8 shift) noexcept {
*/
template <size_t Offset, size_t Size, class T>
Y_FORCE_INLINE T SelectBits(T value) {
- static_assert(Size < sizeof(T) * 8, "violated: Size < sizeof(T) * 8");
- static_assert(Offset < sizeof(T) * 8, "violated: Offset < sizeof(T) * 8");
+ static_assert(Size < sizeof(T) * 8, "violated: Size < sizeof(T) * 8");
+ static_assert(Offset < sizeof(T) * 8, "violated: Offset < sizeof(T) * 8");
T id = 1;
return (value >> Offset) & ((id << Size) - id);
}
@@ -441,8 +441,8 @@ Y_FORCE_INLINE T SelectBits(T value) {
*/
template <size_t Offset, size_t Size, class T>
void SetBits(T& value, T bits) {
- static_assert(Size < sizeof(T) * 8, "violated: Size < sizeof(T) * 8");
- static_assert(Offset < sizeof(T) * 8, "violated: Offset < sizeof(T) * 8");
+ static_assert(Size < sizeof(T) * 8, "violated: Size < sizeof(T) * 8");
+ static_assert(Offset < sizeof(T) * 8, "violated: Offset < sizeof(T) * 8");
T id = 1;
T maxValue = ((id << Size) - id);
Y_ASSERT(bits <= maxValue);
diff --git a/util/generic/bitops_ut.cpp b/util/generic/bitops_ut.cpp
index d23c2b5c27..a2a4539300 100644
--- a/util/generic/bitops_ut.cpp
+++ b/util/generic/bitops_ut.cpp
@@ -1,6 +1,6 @@
#include "bitops.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/string/builder.h>
diff --git a/util/generic/buffer.cpp b/util/generic/buffer.cpp
index b92697e1d0..71931aa467 100644
--- a/util/generic/buffer.cpp
+++ b/util/generic/buffer.cpp
@@ -4,7 +4,7 @@
#include "ymath.h"
#include <util/system/sys_alloc.h>
-#include <util/system/sanitizers.h>
+#include <util/system/sanitizers.h>
TBuffer::TBuffer(size_t len)
: Data_(nullptr)
@@ -44,20 +44,20 @@ TBuffer& TBuffer::operator=(TBuffer&& b) noexcept {
return *this;
}
-void TBuffer::Append(const char* buf, size_t len) {
- if (len > Avail()) {
- Reserve(Pos_ + len);
- }
-
- Y_ASSERT(len <= Avail());
-
+void TBuffer::Append(const char* buf, size_t len) {
+ if (len > Avail()) {
+ Reserve(Pos_ + len);
+ }
+
+ Y_ASSERT(len <= Avail());
+
MemCopy(Data() + Pos_, buf, len);
- NSan::Unpoison(Data() + Pos_, len);
- Pos_ += len;
-
- Y_ASSERT(Pos_ <= Len_);
-}
-
+ NSan::Unpoison(Data() + Pos_, len);
+ Pos_ += len;
+
+ Y_ASSERT(Pos_ <= Len_);
+}
+
void TBuffer::Fill(char ch, size_t len) {
if (len > Avail()) {
Reserve(Pos_ + len);
diff --git a/util/generic/buffer.h b/util/generic/buffer.h
index 9576467404..8bc3d9e8fe 100644
--- a/util/generic/buffer.h
+++ b/util/generic/buffer.h
@@ -92,7 +92,7 @@ public:
return Len_ - Pos_;
}
- void Append(const char* buf, size_t len);
+ void Append(const char* buf, size_t len);
inline void Append(const char* b, const char* e) {
Append(b, e - b);
diff --git a/util/generic/buffer_ut.cpp b/util/generic/buffer_ut.cpp
index 437d7122ec..b824798641 100644
--- a/util/generic/buffer_ut.cpp
+++ b/util/generic/buffer_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/system/datetime.h>
#include "string.h"
diff --git a/util/generic/cast_ut.cpp b/util/generic/cast_ut.cpp
index 718a8de79d..7b51fb3ced 100644
--- a/util/generic/cast_ut.cpp
+++ b/util/generic/cast_ut.cpp
@@ -1,6 +1,6 @@
#include "cast.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
class TGenericCastsTest: public TTestBase {
UNIT_TEST_SUITE(TGenericCastsTest);
diff --git a/util/generic/deque_ut.cpp b/util/generic/deque_ut.cpp
index 93bf50fa92..80adaef4b9 100644
--- a/util/generic/deque_ut.cpp
+++ b/util/generic/deque_ut.cpp
@@ -1,6 +1,6 @@
#include "deque.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <utility>
#include "yexception.h"
diff --git a/util/generic/explicit_type_ut.cpp b/util/generic/explicit_type_ut.cpp
index 50a745f090..09e839b77e 100644
--- a/util/generic/explicit_type_ut.cpp
+++ b/util/generic/explicit_type_ut.cpp
@@ -1,6 +1,6 @@
#include "explicit_type.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
struct TCallableBase {
public:
diff --git a/util/generic/flags_ut.cpp b/util/generic/flags_ut.cpp
index 5377c6a058..1ca01e4006 100644
--- a/util/generic/flags_ut.cpp
+++ b/util/generic/flags_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "flags.h"
diff --git a/util/generic/function_ut.cpp b/util/generic/function_ut.cpp
index 3880295a9f..8c754ec9db 100644
--- a/util/generic/function_ut.cpp
+++ b/util/generic/function_ut.cpp
@@ -1,7 +1,7 @@
#include "function.h"
#include "typetraits.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TestFunctionSignature) {
int FF(double x) {
diff --git a/util/generic/guid_ut.cpp b/util/generic/guid_ut.cpp
index 048354ff39..607ab75adc 100644
--- a/util/generic/guid_ut.cpp
+++ b/util/generic/guid_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "guid.h"
diff --git a/util/generic/hash.h b/util/generic/hash.h
index e46db21fa9..d9312fb860 100644
--- a/util/generic/hash.h
+++ b/util/generic/hash.h
@@ -621,7 +621,7 @@ public:
size_type max_size() const noexcept {
return size_type(-1);
}
-
+
Y_PURE_FUNCTION bool empty() const noexcept {
return size() == 0;
}
@@ -1530,7 +1530,7 @@ public:
size_type max_size() const noexcept {
return rep.max_size();
}
-
+
Y_PURE_FUNCTION bool empty() const noexcept {
return rep.empty();
}
@@ -1855,7 +1855,7 @@ public:
size_type max_size() const {
return rep.max_size();
}
-
+
Y_PURE_FUNCTION bool empty() const {
return rep.empty();
}
diff --git a/util/generic/hash_primes_ut.cpp b/util/generic/hash_primes_ut.cpp
index 7b5bf8b5c9..3cde6e69a0 100644
--- a/util/generic/hash_primes_ut.cpp
+++ b/util/generic/hash_primes_ut.cpp
@@ -1,6 +1,6 @@
#include "hash_primes.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/vector.h>
#include <util/string/builder.h>
diff --git a/util/generic/hash_set.h b/util/generic/hash_set.h
index e8088cf23b..8df4e0db79 100644
--- a/util/generic/hash_set.h
+++ b/util/generic/hash_set.h
@@ -122,7 +122,7 @@ public:
size_type max_size() const {
return rep.max_size();
}
-
+
Y_PURE_FUNCTION bool empty() const {
return rep.empty();
}
@@ -371,7 +371,7 @@ public:
size_type max_size() const {
return rep.max_size();
}
-
+
Y_PURE_FUNCTION bool empty() const {
return rep.empty();
}
diff --git a/util/generic/hash_ut.cpp b/util/generic/hash_ut.cpp
index 0551d58770..ee66b668d7 100644
--- a/util/generic/hash_ut.cpp
+++ b/util/generic/hash_ut.cpp
@@ -3,7 +3,7 @@
#include "hash_set.h"
#include <library/cpp/testing/common/probe.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <utility>
#include <util/str_stl.h>
diff --git a/util/generic/intrlist_ut.cpp b/util/generic/intrlist_ut.cpp
index eff7cdf2ee..a2c42448db 100644
--- a/util/generic/intrlist_ut.cpp
+++ b/util/generic/intrlist_ut.cpp
@@ -1,6 +1,6 @@
#include "intrlist.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/stream/output.h>
diff --git a/util/generic/is_in_ut.cpp b/util/generic/is_in_ut.cpp
index c668bce807..9e8a82d6fa 100644
--- a/util/generic/is_in_ut.cpp
+++ b/util/generic/is_in_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "algorithm.h"
#include "hash.h"
diff --git a/util/generic/iterator_range_ut.cpp b/util/generic/iterator_range_ut.cpp
index a7e3670ae1..ebd6633e33 100644
--- a/util/generic/iterator_range_ut.cpp
+++ b/util/generic/iterator_range_ut.cpp
@@ -1,6 +1,6 @@
#include "iterator_range.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/algorithm.h>
#include <util/generic/vector.h>
diff --git a/util/generic/iterator_ut.cpp b/util/generic/iterator_ut.cpp
index 00be19e10e..96ecb8f899 100644
--- a/util/generic/iterator_ut.cpp
+++ b/util/generic/iterator_ut.cpp
@@ -1,6 +1,6 @@
#include "iterator.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TIterator) {
Y_UNIT_TEST(ToForwardIteratorTest) {
diff --git a/util/generic/lazy_value_ut.cpp b/util/generic/lazy_value_ut.cpp
index f6135880c3..033b68c8ef 100644
--- a/util/generic/lazy_value_ut.cpp
+++ b/util/generic/lazy_value_ut.cpp
@@ -1,6 +1,6 @@
#include "lazy_value.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TLazyValueTestSuite) {
Y_UNIT_TEST(TestLazyValue) {
diff --git a/util/generic/list_ut.cpp b/util/generic/list_ut.cpp
index 9e60ecf01b..2542358dfa 100644
--- a/util/generic/list_ut.cpp
+++ b/util/generic/list_ut.cpp
@@ -1,6 +1,6 @@
#include "list.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TYListSuite) {
Y_UNIT_TEST(TestInitializerList) {
diff --git a/util/generic/map_ut.cpp b/util/generic/map_ut.cpp
index 79e832b024..d13bc3ae84 100644
--- a/util/generic/map_ut.cpp
+++ b/util/generic/map_ut.cpp
@@ -1,6 +1,6 @@
#include "map.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/memory/pool.h>
#include <algorithm>
diff --git a/util/generic/mapfindptr_ut.cpp b/util/generic/mapfindptr_ut.cpp
index 613da7a96b..74f8ad6b67 100644
--- a/util/generic/mapfindptr_ut.cpp
+++ b/util/generic/mapfindptr_ut.cpp
@@ -1,7 +1,7 @@
#include "string.h"
#include "hash.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <map>
diff --git a/util/generic/maybe_ut.cpp b/util/generic/maybe_ut.cpp
index 2c1a425c5e..f63b6362dc 100644
--- a/util/generic/maybe_ut.cpp
+++ b/util/generic/maybe_ut.cpp
@@ -1,7 +1,7 @@
#include <util/generic/string.h>
#include <util/generic/vector.h>
#include <util/stream/str.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "maybe.h"
@@ -150,11 +150,11 @@ Y_UNIT_TEST_SUITE(TMaybeTest) {
UNIT_ASSERT(m == 1);
- auto& x = m.ConstructInPlace(2);
+ auto& x = m.ConstructInPlace(2);
UNIT_ASSERT(m == 2);
- x = 7;
- UNIT_ASSERT(m == 7);
+ x = 7;
+ UNIT_ASSERT(m == 7);
}
Y_UNIT_TEST(TestMove) {
diff --git a/util/generic/mem_copy_ut.cpp b/util/generic/mem_copy_ut.cpp
index 8b55a11cf6..114181d27a 100644
--- a/util/generic/mem_copy_ut.cpp
+++ b/util/generic/mem_copy_ut.cpp
@@ -1,6 +1,6 @@
#include "mem_copy.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
namespace {
class TAssignBCalled: public yexception {
diff --git a/util/generic/objects_counter_ut.cpp b/util/generic/objects_counter_ut.cpp
index 4d5da37a56..0578decc62 100644
--- a/util/generic/objects_counter_ut.cpp
+++ b/util/generic/objects_counter_ut.cpp
@@ -1,6 +1,6 @@
#include "object_counter.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(ObjectsCounter) {
struct TObject: public TObjectCounter<TObject> {
diff --git a/util/generic/overloaded_ut.cpp b/util/generic/overloaded_ut.cpp
index f3d73895ad..68ddba94cf 100644
--- a/util/generic/overloaded_ut.cpp
+++ b/util/generic/overloaded_ut.cpp
@@ -1,6 +1,6 @@
#include <util/generic/overloaded.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/variant.h>
#include <util/generic/algorithm.h>
diff --git a/util/generic/ptr.h b/util/generic/ptr.h
index 19db0e3ec5..8a4fcc3da9 100644
--- a/util/generic/ptr.h
+++ b/util/generic/ptr.h
@@ -185,7 +185,7 @@ public:
return *this;
}
- inline T* Release() const noexcept Y_WARN_UNUSED_RESULT {
+ inline T* Release() const noexcept Y_WARN_UNUSED_RESULT {
return this->DoRelease(T_);
}
@@ -280,7 +280,7 @@ public:
Reset(nullptr);
}
- inline T* Release() noexcept Y_WARN_UNUSED_RESULT {
+ inline T* Release() noexcept Y_WARN_UNUSED_RESULT {
return this->DoRelease(T_);
}
@@ -566,7 +566,7 @@ public:
TIntrusivePtr(nullptr).Swap(*this);
}
- inline T* Release() const noexcept Y_WARN_UNUSED_RESULT {
+ inline T* Release() const noexcept Y_WARN_UNUSED_RESULT {
T* res = T_;
if (T_) {
Ops::DecRef(T_);
@@ -1011,7 +1011,7 @@ public:
return *this;
}
- inline T* Release() noexcept Y_WARN_UNUSED_RESULT {
+ inline T* Release() noexcept Y_WARN_UNUSED_RESULT {
return DoRelease(T_);
}
diff --git a/util/generic/ptr_ut.cpp b/util/generic/ptr_ut.cpp
index c2dcff23f6..306646d12d 100644
--- a/util/generic/ptr_ut.cpp
+++ b/util/generic/ptr_ut.cpp
@@ -2,7 +2,7 @@
#include "vector.h"
#include "noncopyable.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/hash_set.h>
#include <util/generic/is_in.h>
diff --git a/util/generic/queue_ut.cpp b/util/generic/queue_ut.cpp
index a33399e104..7bee07699d 100644
--- a/util/generic/queue_ut.cpp
+++ b/util/generic/queue_ut.cpp
@@ -2,7 +2,7 @@
#include "list.h"
#include "vector.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <utility>
diff --git a/util/generic/reserve.h b/util/generic/reserve.h
index 81ceed19dc..72fb466018 100644
--- a/util/generic/reserve.h
+++ b/util/generic/reserve.h
@@ -1,11 +1,11 @@
-#pragma once
-
-namespace NDetail {
- struct TReserveTag {
- size_t Capacity;
- };
-}
-
+#pragma once
+
+namespace NDetail {
+ struct TReserveTag {
+ size_t Capacity;
+ };
+}
+
constexpr ::NDetail::TReserveTag Reserve(size_t capacity) {
return ::NDetail::TReserveTag{capacity};
-}
+}
diff --git a/util/generic/scope_ut.cpp b/util/generic/scope_ut.cpp
index bdb434d487..d1742ab444 100644
--- a/util/generic/scope_ut.cpp
+++ b/util/generic/scope_ut.cpp
@@ -1,7 +1,7 @@
#include "scope.h"
#include <util/generic/ptr.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(ScopeToolsTest) {
Y_UNIT_TEST(OnScopeExitTest) {
diff --git a/util/generic/serialized_enum_ut.cpp b/util/generic/serialized_enum_ut.cpp
index 3a94e1d471..ab85b65961 100644
--- a/util/generic/serialized_enum_ut.cpp
+++ b/util/generic/serialized_enum_ut.cpp
@@ -1,6 +1,6 @@
#include "serialized_enum.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/deque.h>
#include <util/generic/map.h>
diff --git a/util/generic/set_ut.cpp b/util/generic/set_ut.cpp
index d2769d327f..e11453c8e8 100644
--- a/util/generic/set_ut.cpp
+++ b/util/generic/set_ut.cpp
@@ -1,6 +1,6 @@
#include "set.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <utility>
diff --git a/util/generic/singleton.cpp b/util/generic/singleton.cpp
index eb5a0662f8..687b2b3f64 100644
--- a/util/generic/singleton.cpp
+++ b/util/generic/singleton.cpp
@@ -2,7 +2,7 @@
#include <util/system/spinlock.h>
#include <util/system/thread.h>
-#include <util/system/sanitizers.h>
+#include <util/system/sanitizers.h>
#include <cstring>
@@ -32,12 +32,12 @@ void NPrivate::FillWithTrash(void* ptr, size_t len) {
Y_UNUSED(ptr);
Y_UNUSED(len);
#else
- if constexpr (NSan::TSanIsOn()) {
- Y_UNUSED(ptr);
- Y_UNUSED(len);
- } else {
- memset(ptr, 0xBA, len);
- }
+ if constexpr (NSan::TSanIsOn()) {
+ Y_UNUSED(ptr);
+ Y_UNUSED(len);
+ } else {
+ memset(ptr, 0xBA, len);
+ }
#endif
}
diff --git a/util/generic/singleton_ut.cpp b/util/generic/singleton_ut.cpp
index 35ba90cd76..2d50855677 100644
--- a/util/generic/singleton_ut.cpp
+++ b/util/generic/singleton_ut.cpp
@@ -1,6 +1,6 @@
#include "singleton.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TestSingleton) {
struct THuge {
diff --git a/util/generic/stack_ut.cpp b/util/generic/stack_ut.cpp
index 248127d326..1c9dd7ed89 100644
--- a/util/generic/stack_ut.cpp
+++ b/util/generic/stack_ut.cpp
@@ -1,6 +1,6 @@
#include "stack.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TYStackTest) {
Y_UNIT_TEST(ExplicitBool) {
diff --git a/util/generic/store_policy_ut.cpp b/util/generic/store_policy_ut.cpp
index c9722203aa..c867a853f5 100644
--- a/util/generic/store_policy_ut.cpp
+++ b/util/generic/store_policy_ut.cpp
@@ -1,6 +1,6 @@
#include "store_policy.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/algorithm.h>
#include <util/generic/vector.h>
diff --git a/util/generic/strbase.h b/util/generic/strbase.h
index ab39fc7537..e8bc89569a 100644
--- a/util/generic/strbase.h
+++ b/util/generic/strbase.h
@@ -483,14 +483,14 @@ public:
return !s.length() || find(s, pos) != npos;
}
- inline bool Contains(TChar c, size_t pos = 0) const noexcept {
+ inline bool Contains(TChar c, size_t pos = 0) const noexcept {
return find(c, pos) != npos;
}
- inline void Contains(std::enable_if<std::is_unsigned<TCharType>::value, char> c, size_t pos = 0) const noexcept {
- return find(ui8(c), pos) != npos;
- }
-
+ inline void Contains(std::enable_if<std::is_unsigned<TCharType>::value, char> c, size_t pos = 0) const noexcept {
+ return find(ui8(c), pos) != npos;
+ }
+
//~~~~Character Set Search~~~
inline size_t find_first_of(TCharType c) const noexcept {
return find_first_of(c, 0);
@@ -569,12 +569,12 @@ public:
return n;
}
- inline TDerived copy() const Y_WARN_UNUSED_RESULT {
+ inline TDerived copy() const Y_WARN_UNUSED_RESULT {
return TDerived(Ptr(), Len());
}
// ~~~ Partial copy ~~~~
- TDerived substr(size_t pos, size_t n = npos) const Y_WARN_UNUSED_RESULT {
+ TDerived substr(size_t pos, size_t n = npos) const Y_WARN_UNUSED_RESULT {
return TDerived(*This(), pos, n);
}
diff --git a/util/generic/strbuf_ut.cpp b/util/generic/strbuf_ut.cpp
index 69cde785af..20c284d352 100644
--- a/util/generic/strbuf_ut.cpp
+++ b/util/generic/strbuf_ut.cpp
@@ -1,6 +1,6 @@
#include "strbuf.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <string_view>
diff --git a/util/generic/string.cpp b/util/generic/string.cpp
index 3c655f1f66..6242c45685 100644
--- a/util/generic/string.cpp
+++ b/util/generic/string.cpp
@@ -80,7 +80,7 @@ template <>
bool TBasicString<wchar16, std::char_traits<wchar16>>::to_title(size_t pos, size_t n) {
return ToTitle(*this, pos, n);
}
-
+
template <>
TUtf32String&
TBasicString<wchar32, std::char_traits<wchar32>>::AppendAscii(const ::TStringBuf& s) {
@@ -112,9 +112,9 @@ TBasicString<char, std::char_traits<char>>::AppendUtf16(const ::TWtringBuf& s) {
template <>
TUtf32String&
TBasicString<wchar32, std::char_traits<wchar32>>::AppendUtf8(const ::TStringBuf& s) {
- size_t oldSize = size();
+ size_t oldSize = size();
ReserveAndResize(size() + s.size() * 4);
- size_t written = 0;
+ size_t written = 0;
size_t pos = UTF8ToWideImpl(s.data(), s.size(), begin() + oldSize, written);
if (pos != s.size()) {
ythrow yexception() << "failed to decode UTF-8 string at pos " << pos << ::NDetail::InStringMsg(s.data(), s.size());
@@ -122,35 +122,35 @@ TBasicString<wchar32, std::char_traits<wchar32>>::AppendUtf8(const ::TStringBuf&
resize(oldSize + written);
return *this;
-}
-
+}
+
template <>
TUtf32String&
TBasicString<wchar32, std::char_traits<wchar32>>::AppendUtf16(const ::TWtringBuf& s) {
- size_t oldSize = size();
+ size_t oldSize = size();
ReserveAndResize(size() + s.size() * 2);
-
- wchar32* oldEnd = begin() + oldSize;
- wchar32* end = oldEnd;
+
+ wchar32* oldEnd = begin() + oldSize;
+ wchar32* end = oldEnd;
NDetail::UTF16ToUTF32ImplScalar(s.data(), s.data() + s.size(), end);
- size_t written = end - oldEnd;
-
+ size_t written = end - oldEnd;
+
resize(oldSize + written);
-
+
return *this;
-}
-
+}
+
template <>
bool TBasicString<wchar32, std::char_traits<wchar32>>::to_lower(size_t pos, size_t n) {
return ToLower(*this, pos, n);
-}
-
+}
+
template <>
bool TBasicString<wchar32, std::char_traits<wchar32>>::to_upper(size_t pos, size_t n) {
return ToUpper(*this, pos, n);
-}
-
+}
+
template <>
bool TBasicString<wchar32, std::char_traits<wchar32>>::to_title(size_t pos, size_t n) {
return ToTitle(*this, pos, n);
-}
+}
diff --git a/util/generic/string.h b/util/generic/string.h
index 8cd8aa6917..543c494eda 100644
--- a/util/generic/string.h
+++ b/util/generic/string.h
@@ -14,7 +14,7 @@
#include "utility.h"
#include "bitops.h"
#include "explicit_type.h"
-#include "reserve.h"
+#include "reserve.h"
#include "singleton.h"
#include "strbase.h"
#include "strbuf.h"
@@ -379,7 +379,7 @@ public:
{
}
- inline explicit TBasicString(::NDetail::TReserveTag rt)
+ inline explicit TBasicString(::NDetail::TReserveTag rt)
#ifndef TSTRING_IS_STD_STRING
: S_(Construct())
#endif
diff --git a/util/generic/string_transparent_hash_ut.cpp b/util/generic/string_transparent_hash_ut.cpp
index b87fa2843e..cf1170c3ac 100644
--- a/util/generic/string_transparent_hash_ut.cpp
+++ b/util/generic/string_transparent_hash_ut.cpp
@@ -2,7 +2,7 @@
#include "vector.h"
#include "strbuf.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <library/cpp/containers/absl_flat_hash/flat_hash_set.h>
#include <util/str_stl.h>
diff --git a/util/generic/string_ut.cpp b/util/generic/string_ut.cpp
index ac82e9091d..93b9be3387 100644
--- a/util/generic/string_ut.cpp
+++ b/util/generic/string_ut.cpp
@@ -908,191 +908,191 @@ private:
UNIT_TEST_SUITE_REGISTRATION(TWideStringTest);
class TUtf32StringTest: public TTestBase, private TStringTestImpl<TUtf32String, TTestData<wchar32>> {
-public:
- UNIT_TEST_SUITE(TUtf32StringTest);
- UNIT_TEST(TestConstructors);
- UNIT_TEST(TestReplace);
+public:
+ UNIT_TEST_SUITE(TUtf32StringTest);
+ UNIT_TEST(TestConstructors);
+ UNIT_TEST(TestReplace);
#ifndef TSTRING_IS_STD_STRING
- UNIT_TEST(TestRefCount);
+ UNIT_TEST(TestRefCount);
#endif
- UNIT_TEST(TestFind);
- UNIT_TEST(TestContains);
- UNIT_TEST(TestOperators);
- UNIT_TEST(TestLetOperator)
- UNIT_TEST(TestMulOperators);
- UNIT_TEST(TestFuncs);
- UNIT_TEST(TestUtils);
- UNIT_TEST(TestEmpty);
- UNIT_TEST(TestJoin);
- UNIT_TEST(TestCopy);
- UNIT_TEST(TestStrCpy);
- UNIT_TEST(TestPrefixSuffix);
+ UNIT_TEST(TestFind);
+ UNIT_TEST(TestContains);
+ UNIT_TEST(TestOperators);
+ UNIT_TEST(TestLetOperator)
+ UNIT_TEST(TestMulOperators);
+ UNIT_TEST(TestFuncs);
+ UNIT_TEST(TestUtils);
+ UNIT_TEST(TestEmpty);
+ UNIT_TEST(TestJoin);
+ UNIT_TEST(TestCopy);
+ UNIT_TEST(TestStrCpy);
+ UNIT_TEST(TestPrefixSuffix);
#ifndef TSTRING_IS_STD_STRING
- UNIT_TEST(TestCharRef);
+ UNIT_TEST(TestCharRef);
#endif
- UNIT_TEST(TestBack);
- UNIT_TEST(TestFront)
- UNIT_TEST(TestDecodingMethods);
- UNIT_TEST(TestDecodingMethodsMixedStr);
+ UNIT_TEST(TestBack);
+ UNIT_TEST(TestFront)
+ UNIT_TEST(TestDecodingMethods);
+ UNIT_TEST(TestDecodingMethodsMixedStr);
UNIT_TEST(TestIterators);
UNIT_TEST(TestReverseIterators);
UNIT_TEST(TestStringLiterals);
- UNIT_TEST_SUITE_END();
-
-private:
- void TestDecodingMethods() {
- UNIT_ASSERT(TUtf32String::FromAscii("").empty());
- UNIT_ASSERT(TUtf32String::FromAscii("abc") == ASCIIToUTF32("abc"));
-
- const char* text = "123kx83abcd ej)#$%ddja&%J&";
- TUtf32String wtext = ASCIIToUTF32(text);
-
- UNIT_ASSERT(wtext == TUtf32String::FromAscii(text));
-
- TString strtext(text);
- UNIT_ASSERT(wtext == TUtf32String::FromAscii(strtext));
-
- TStringBuf strbuftext(text);
- UNIT_ASSERT(wtext == TUtf32String::FromAscii(strbuftext));
-
- UNIT_ASSERT(wtext.substr(5) == TUtf32String::FromAscii(text + 5));
-
- const wchar32 wideCyrillicAlphabet[] = {
- 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
- 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
- 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
- 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
- 0x00};
-
- TUtf32String strWide(wideCyrillicAlphabet);
- TString strUtf8 = WideToUTF8(strWide);
-
- UNIT_ASSERT(strWide == TUtf32String::FromUtf8(strUtf8.c_str()));
- UNIT_ASSERT(strWide == TUtf32String::FromUtf8(strUtf8));
- UNIT_ASSERT(strWide == TUtf32String::FromUtf8(TStringBuf(strUtf8)));
-
- // assign
-
- TUtf32String s1;
- s1.AssignAscii("1234");
- UNIT_ASSERT(s1 == ASCIIToUTF32("1234"));
-
- s1.AssignUtf8(strUtf8);
- UNIT_ASSERT(s1 == strWide);
-
- s1.AssignAscii(text);
- UNIT_ASSERT(s1 == wtext);
-
- // append
-
- TUtf32String s2;
- TUtf32String testAppend = strWide;
- s2.AppendUtf8(strUtf8);
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += ' ';
- s2.AppendAscii(" ");
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += '_';
- s2.AppendUtf8("_");
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += wtext;
- s2.AppendAscii(text);
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += wtext;
- s2.AppendUtf8(text);
-
- UNIT_ASSERT(testAppend == s2);
- }
-
- void TestDecodingMethodsMixedStr() {
- UNIT_ASSERT(TUtf32String::FromAscii("").empty());
- UNIT_ASSERT(TUtf32String::FromAscii("abc") == ASCIIToUTF32("abc"));
-
- const char* text = "123kx83abcd ej)#$%ddja&%J&";
- TUtf32String wtext = ASCIIToUTF32(text);
-
- UNIT_ASSERT(wtext == TUtf32String::FromAscii(text));
-
- TString strtext(text);
- UNIT_ASSERT(wtext == TUtf32String::FromAscii(strtext));
-
- TStringBuf strbuftext(text);
- UNIT_ASSERT(wtext == TUtf32String::FromAscii(strbuftext));
-
- UNIT_ASSERT(wtext.substr(5) == TUtf32String::FromAscii(text + 5));
-
- const wchar32 cyrilicAndLatinWide[] = {
- 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
- 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
- 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
- wchar32('z'),
- 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
- wchar32('z'),
- 0x00};
-
- TUtf32String strWide(cyrilicAndLatinWide);
- TString strUtf8 = WideToUTF8(strWide);
-
- UNIT_ASSERT(strWide == TUtf32String::FromUtf8(strUtf8.c_str()));
- UNIT_ASSERT(strWide == TUtf32String::FromUtf8(strUtf8));
- UNIT_ASSERT(strWide == UTF8ToUTF32<true>(strUtf8));
- UNIT_ASSERT(strWide == UTF8ToUTF32<false>(strUtf8));
- UNIT_ASSERT(strWide == TUtf32String::FromUtf8(TStringBuf(strUtf8)));
-
- // assign
-
- TUtf32String s1;
- s1.AssignAscii("1234");
- UNIT_ASSERT(s1 == ASCIIToUTF32("1234"));
-
- s1.AssignUtf8(strUtf8);
- UNIT_ASSERT(s1 == strWide);
-
- s1.AssignAscii(text);
- UNIT_ASSERT(s1 == wtext);
-
- // append
-
- TUtf32String s2;
- TUtf32String testAppend = strWide;
- s2.AppendUtf16(UTF8ToWide(strUtf8));
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += ' ';
- s2.AppendAscii(" ");
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += '_';
- s2.AppendUtf8("_");
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += wtext;
- s2.AppendAscii(text);
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += wtext;
- s2.AppendUtf8(text);
-
- UNIT_ASSERT(testAppend == s2);
- }
-
- void TestLetOperator() {
- TUtf32String str;
-
+ UNIT_TEST_SUITE_END();
+
+private:
+ void TestDecodingMethods() {
+ UNIT_ASSERT(TUtf32String::FromAscii("").empty());
+ UNIT_ASSERT(TUtf32String::FromAscii("abc") == ASCIIToUTF32("abc"));
+
+ const char* text = "123kx83abcd ej)#$%ddja&%J&";
+ TUtf32String wtext = ASCIIToUTF32(text);
+
+ UNIT_ASSERT(wtext == TUtf32String::FromAscii(text));
+
+ TString strtext(text);
+ UNIT_ASSERT(wtext == TUtf32String::FromAscii(strtext));
+
+ TStringBuf strbuftext(text);
+ UNIT_ASSERT(wtext == TUtf32String::FromAscii(strbuftext));
+
+ UNIT_ASSERT(wtext.substr(5) == TUtf32String::FromAscii(text + 5));
+
+ const wchar32 wideCyrillicAlphabet[] = {
+ 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
+ 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
+ 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
+ 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
+ 0x00};
+
+ TUtf32String strWide(wideCyrillicAlphabet);
+ TString strUtf8 = WideToUTF8(strWide);
+
+ UNIT_ASSERT(strWide == TUtf32String::FromUtf8(strUtf8.c_str()));
+ UNIT_ASSERT(strWide == TUtf32String::FromUtf8(strUtf8));
+ UNIT_ASSERT(strWide == TUtf32String::FromUtf8(TStringBuf(strUtf8)));
+
+ // assign
+
+ TUtf32String s1;
+ s1.AssignAscii("1234");
+ UNIT_ASSERT(s1 == ASCIIToUTF32("1234"));
+
+ s1.AssignUtf8(strUtf8);
+ UNIT_ASSERT(s1 == strWide);
+
+ s1.AssignAscii(text);
+ UNIT_ASSERT(s1 == wtext);
+
+ // append
+
+ TUtf32String s2;
+ TUtf32String testAppend = strWide;
+ s2.AppendUtf8(strUtf8);
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += ' ';
+ s2.AppendAscii(" ");
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += '_';
+ s2.AppendUtf8("_");
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += wtext;
+ s2.AppendAscii(text);
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += wtext;
+ s2.AppendUtf8(text);
+
+ UNIT_ASSERT(testAppend == s2);
+ }
+
+ void TestDecodingMethodsMixedStr() {
+ UNIT_ASSERT(TUtf32String::FromAscii("").empty());
+ UNIT_ASSERT(TUtf32String::FromAscii("abc") == ASCIIToUTF32("abc"));
+
+ const char* text = "123kx83abcd ej)#$%ddja&%J&";
+ TUtf32String wtext = ASCIIToUTF32(text);
+
+ UNIT_ASSERT(wtext == TUtf32String::FromAscii(text));
+
+ TString strtext(text);
+ UNIT_ASSERT(wtext == TUtf32String::FromAscii(strtext));
+
+ TStringBuf strbuftext(text);
+ UNIT_ASSERT(wtext == TUtf32String::FromAscii(strbuftext));
+
+ UNIT_ASSERT(wtext.substr(5) == TUtf32String::FromAscii(text + 5));
+
+ const wchar32 cyrilicAndLatinWide[] = {
+ 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
+ 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
+ 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
+ wchar32('z'),
+ 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
+ wchar32('z'),
+ 0x00};
+
+ TUtf32String strWide(cyrilicAndLatinWide);
+ TString strUtf8 = WideToUTF8(strWide);
+
+ UNIT_ASSERT(strWide == TUtf32String::FromUtf8(strUtf8.c_str()));
+ UNIT_ASSERT(strWide == TUtf32String::FromUtf8(strUtf8));
+ UNIT_ASSERT(strWide == UTF8ToUTF32<true>(strUtf8));
+ UNIT_ASSERT(strWide == UTF8ToUTF32<false>(strUtf8));
+ UNIT_ASSERT(strWide == TUtf32String::FromUtf8(TStringBuf(strUtf8)));
+
+ // assign
+
+ TUtf32String s1;
+ s1.AssignAscii("1234");
+ UNIT_ASSERT(s1 == ASCIIToUTF32("1234"));
+
+ s1.AssignUtf8(strUtf8);
+ UNIT_ASSERT(s1 == strWide);
+
+ s1.AssignAscii(text);
+ UNIT_ASSERT(s1 == wtext);
+
+ // append
+
+ TUtf32String s2;
+ TUtf32String testAppend = strWide;
+ s2.AppendUtf16(UTF8ToWide(strUtf8));
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += ' ';
+ s2.AppendAscii(" ");
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += '_';
+ s2.AppendUtf8("_");
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += wtext;
+ s2.AppendAscii(text);
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += wtext;
+ s2.AppendUtf8(text);
+
+ UNIT_ASSERT(testAppend == s2);
+ }
+
+ void TestLetOperator() {
+ TUtf32String str;
+
str = wchar32('X');
- UNIT_ASSERT(str == TUtf32String::FromAscii("X"));
-
- const TUtf32String hello = TUtf32String::FromAscii("hello");
+ UNIT_ASSERT(str == TUtf32String::FromAscii("X"));
+
+ const TUtf32String hello = TUtf32String::FromAscii("hello");
str = hello.data();
- UNIT_ASSERT(str == hello);
-
- str = hello;
- UNIT_ASSERT(str == hello);
- }
+ UNIT_ASSERT(str == hello);
+
+ str = hello;
+ UNIT_ASSERT(str == hello);
+ }
void TestStringLiterals() {
TUtf32String s1 = U"hello";
@@ -1101,10 +1101,10 @@ private:
TUtf32String s2 = U"привет";
UNIT_ASSERT_VALUES_EQUAL(s2, TUtf32String::FromUtf8("привет"));
}
-};
-
-UNIT_TEST_SUITE_REGISTRATION(TUtf32StringTest);
-
+};
+
+UNIT_TEST_SUITE_REGISTRATION(TUtf32StringTest);
+
class TStringStdTest: public TTestBase, private TStringStdTestImpl<TString, TTestData<char>> {
public:
UNIT_TEST_SUITE(TStringStdTest);
diff --git a/util/generic/string_ut.h b/util/generic/string_ut.h
index 44bb10bdeb..55cd378e01 100644
--- a/util/generic/string_ut.h
+++ b/util/generic/string_ut.h
@@ -2,7 +2,7 @@
#include "string.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/string/reverse.h>
@@ -565,9 +565,9 @@ public:
TStringType s9(*Data._1());
UNIT_ASSERT(s9 == Data._1());
-
+
TStringType s10(Reserve(100));
- UNIT_ASSERT(s10.empty());
+ UNIT_ASSERT(s10.empty());
UNIT_ASSERT(s10.capacity() >= 100);
}
@@ -1011,14 +1011,14 @@ public:
UNIT_ASSERT(!s1.IsDetached());
/* Read access shouldn't detach. */
- UNIT_ASSERT_VALUES_EQUAL(s0[0], (ui8)'a');
+ UNIT_ASSERT_VALUES_EQUAL(s0[0], (ui8)'a');
UNIT_ASSERT(!s0.IsDetached());
UNIT_ASSERT(!s1.IsDetached());
/* Writing should detach. */
- s1[0] = (ui8)'b';
+ s1[0] = (ui8)'b';
TStringType s2 = s0;
- s0[0] = (ui8)'c';
+ s0[0] = (ui8)'c';
UNIT_ASSERT_VALUES_EQUAL(s0, cbc);
UNIT_ASSERT_VALUES_EQUAL(s1, bbc);
@@ -1028,9 +1028,9 @@ public:
UNIT_ASSERT(s2.IsDetached());
/* Accessing null terminator is OK. Note that writing into it is UB. */
- UNIT_ASSERT_VALUES_EQUAL(s0[3], (ui8)'\0');
- UNIT_ASSERT_VALUES_EQUAL(s1[3], (ui8)'\0');
- UNIT_ASSERT_VALUES_EQUAL(s2[3], (ui8)'\0');
+ UNIT_ASSERT_VALUES_EQUAL(s0[3], (ui8)'\0');
+ UNIT_ASSERT_VALUES_EQUAL(s1[3], (ui8)'\0');
+ UNIT_ASSERT_VALUES_EQUAL(s2[3], (ui8)'\0');
/* Assignment one char reference to another results in modification of underlying character */
{
@@ -1053,12 +1053,12 @@ public:
TStringType str = chars;
const TStringType constStr = str;
- UNIT_ASSERT_VALUES_EQUAL(constStr.back(), (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(str.back(), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(constStr.back(), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(str.back(), (ui8)'o');
str.back() = 'r';
- UNIT_ASSERT_VALUES_EQUAL(constStr.back(), (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(str.back(), (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(constStr.back(), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(str.back(), (ui8)'r');
}
void TestFront() {
@@ -1067,12 +1067,12 @@ public:
TStringType str = chars;
const TStringType constStr = str;
- UNIT_ASSERT_VALUES_EQUAL(constStr.front(), (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(str.front(), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(constStr.front(), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(str.front(), (ui8)'f');
str.front() = 'r';
- UNIT_ASSERT_VALUES_EQUAL(constStr.front(), (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(str.front(), (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(constStr.front(), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(str.front(), (ui8)'r');
}
void TestIterators() {
@@ -1086,31 +1086,31 @@ public:
typename TStringType::const_iterator citBegin = constStr.begin();
typename TStringType::const_iterator citEnd = constStr.end();
- UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'f');
str.front() = 'r';
- UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'r');
- UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'f');
UNIT_ASSERT_VALUES_EQUAL(2, itEnd - itBegin);
UNIT_ASSERT_VALUES_EQUAL(2, citEnd - citBegin);
- UNIT_ASSERT_VALUES_EQUAL(*(++itBegin), (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*(++citBegin), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*(++itBegin), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*(++citBegin), (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*(--itBegin), (ui8)'r');
- UNIT_ASSERT_VALUES_EQUAL(*(--citBegin), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*(--itBegin), (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(*(--citBegin), (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*(itBegin++), (ui8)'r');
- UNIT_ASSERT_VALUES_EQUAL(*(citBegin++), (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*(itBegin++), (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(*(citBegin++), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*(itBegin--), (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*(citBegin--), (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'r');
- UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*(itBegin--), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*(citBegin--), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'f');
}
void TestReverseIterators() {
@@ -1124,33 +1124,33 @@ public:
typename TStringType::const_reverse_iterator critBegin = constStr.rbegin();
typename TStringType::const_reverse_iterator critEnd = constStr.rend();
- UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'o');
- str.back() = (ui8)'r';
- UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'r');
- UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'o');
+ str.back() = (ui8)'r';
+ UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'o');
UNIT_ASSERT_VALUES_EQUAL(2, ritEnd - ritBegin);
UNIT_ASSERT_VALUES_EQUAL(2, critEnd - critBegin);
- UNIT_ASSERT_VALUES_EQUAL(*(++ritBegin), (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*(++critBegin), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*(++ritBegin), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*(++critBegin), (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*(--ritBegin), (ui8)'r');
- UNIT_ASSERT_VALUES_EQUAL(*(--critBegin), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*(--ritBegin), (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(*(--critBegin), (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*(ritBegin++), (ui8)'r');
- UNIT_ASSERT_VALUES_EQUAL(*(critBegin++), (ui8)'o');
- UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*(ritBegin++), (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(*(critBegin++), (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*(ritBegin--), (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*(critBegin--), (ui8)'f');
- UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'r');
- UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'o');
+ UNIT_ASSERT_VALUES_EQUAL(*(ritBegin--), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*(critBegin--), (ui8)'f');
+ UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'r');
+ UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'o');
- *ritBegin = (ui8)'e';
- UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'e');
+ *ritBegin = (ui8)'e';
+ UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'e');
}
};
diff --git a/util/generic/typelist_ut.cpp b/util/generic/typelist_ut.cpp
index eeabfa97b1..6216d5e0a0 100644
--- a/util/generic/typelist_ut.cpp
+++ b/util/generic/typelist_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/system/type_name.h>
#include "typelist.h"
diff --git a/util/generic/typetraits.h b/util/generic/typetraits.h
index d165bd1a06..e8ad545631 100644
--- a/util/generic/typetraits.h
+++ b/util/generic/typetraits.h
@@ -235,7 +235,7 @@ struct TPodTraits<std::pair<T1, T2>> {
};
};
-template <class T>
+template <class T>
struct TIsPointerToConstMemberFunction: std::false_type {
};
diff --git a/util/generic/typetraits_ut.cpp b/util/generic/typetraits_ut.cpp
index e7571c75ec..afad5cc4d2 100644
--- a/util/generic/typetraits_ut.cpp
+++ b/util/generic/typetraits_ut.cpp
@@ -1,6 +1,6 @@
#include "typetraits.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <vector>
#include <tuple>
diff --git a/util/generic/utility_ut.cpp b/util/generic/utility_ut.cpp
index 8e9d5afff9..3226322cc5 100644
--- a/util/generic/utility_ut.cpp
+++ b/util/generic/utility_ut.cpp
@@ -1,7 +1,7 @@
#include "utility.h"
#include "ymath.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
// DO_NOT_STYLE
diff --git a/util/generic/va_args_ut.cpp b/util/generic/va_args_ut.cpp
index a9c96a0f55..3ea47b43ea 100644
--- a/util/generic/va_args_ut.cpp
+++ b/util/generic/va_args_ut.cpp
@@ -1,6 +1,6 @@
#include "va_args.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TMacroVarargMapTest) {
Y_UNIT_TEST(TestMapArgs) {
diff --git a/util/generic/vector.h b/util/generic/vector.h
index a5b258955a..935e9c0c59 100644
--- a/util/generic/vector.h
+++ b/util/generic/vector.h
@@ -1,7 +1,7 @@
#pragma once
#include "fwd.h"
-#include "reserve.h"
+#include "reserve.h"
#include <util/memory/alloc.h>
@@ -26,17 +26,17 @@ public:
}
inline explicit TVector(::NDetail::TReserveTag rt)
- : TBase()
- {
- this->reserve(rt.Capacity);
- }
-
+ : TBase()
+ {
+ this->reserve(rt.Capacity);
+ }
+
inline explicit TVector(::NDetail::TReserveTag rt, const typename TBase::allocator_type& a)
- : TBase(a)
- {
- this->reserve(rt.Capacity);
- }
-
+ : TBase(a)
+ {
+ this->reserve(rt.Capacity);
+ }
+
inline explicit TVector(size_type count)
: TBase(count)
{
@@ -103,9 +103,9 @@ public:
}
Y_PURE_FUNCTION inline bool empty() const noexcept {
- return TBase::empty();
- }
-
+ return TBase::empty();
+ }
+
inline yssize_t ysize() const noexcept {
return (yssize_t)TBase::size();
}
diff --git a/util/generic/vector_ut.cpp b/util/generic/vector_ut.cpp
index 0f6b4037a0..be3cd24828 100644
--- a/util/generic/vector_ut.cpp
+++ b/util/generic/vector_ut.cpp
@@ -1,6 +1,6 @@
#include "vector.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <utility>
#include "yexception.h"
@@ -279,13 +279,13 @@ private:
UNIT_ASSERT(v[5] == 25);
UNIT_ASSERT(v[6] == 36);
- size_t curCapacity = v.capacity();
+ size_t curCapacity = v.capacity();
v.clear();
UNIT_ASSERT(v.empty());
- //check that clear save reserved data
- UNIT_ASSERT_EQUAL(curCapacity, v.capacity());
-
+ //check that clear save reserved data
+ UNIT_ASSERT_EQUAL(curCapacity, v.capacity());
+
v.insert(v.begin(), 5, 10);
UNIT_ASSERT(v.size() == 5);
UNIT_ASSERT(v[0] == 10);
@@ -312,12 +312,12 @@ private:
{
TVector<int> v(Reserve(100));
-
- UNIT_ASSERT(v.capacity() >= 100);
- UNIT_ASSERT(v.size() == 0);
- }
-
- {
+
+ UNIT_ASSERT(v.capacity() >= 100);
+ UNIT_ASSERT(v.size() == 0);
+ }
+
+ {
//Test that used to generate an assertion when using __debug_alloc.
TVector<TestStruct> va;
va.reserve(1);
diff --git a/util/generic/xrange.h b/util/generic/xrange.h
index 5fc8c82912..578605f356 100644
--- a/util/generic/xrange.h
+++ b/util/generic/xrange.h
@@ -13,16 +13,16 @@
* for (auto i: xrange(MyVector.size())) { // instead for (size_t i = 0; i < MyVector.size(); ++i)
* DoSomething(i, MyVector[i]);
* }
- *
+ *
* TVector<int> arithmeticSeq = xrange(10); // instead: TVector<int> arithmeticSeq; for(size_t i = 0; i < 10; ++i) { arithmeticSeq.push_back(i); }
- *
+ *
*/
namespace NPrivate {
template <typename T>
class TSimpleXRange {
- using TDiff = decltype(T() - T());
-
+ using TDiff = decltype(T() - T());
+
public:
constexpr TSimpleXRange(T start, T finish) noexcept
: Start(start)
@@ -52,12 +52,12 @@ namespace NPrivate {
}
constexpr bool operator==(const TIterator& other) const noexcept {
- return Value == other.Value;
- }
-
- TIterator& operator++() noexcept {
+ return Value == other.Value;
+ }
+
+ TIterator& operator++() noexcept {
++Value;
- return *this;
+ return *this;
}
TIterator& operator--() noexcept {
@@ -66,25 +66,25 @@ namespace NPrivate {
}
constexpr TDiff operator-(const TIterator& b) const noexcept {
- return Value - b.Value;
- }
-
+ return Value - b.Value;
+ }
+
template <typename IntType>
constexpr TIterator operator+(const IntType& b) const noexcept {
- return TIterator(Value + b);
- }
-
+ return TIterator(Value + b);
+ }
+
template <typename IntType>
TIterator& operator+=(const IntType& b) noexcept {
- Value += b;
- return *this;
- }
-
+ Value += b;
+ return *this;
+ }
+
template <typename IntType>
constexpr TIterator operator-(const IntType& b) const noexcept {
- return TIterator(Value - b);
- }
-
+ return TIterator(Value - b);
+ }
+
template <typename IntType>
TIterator& operator-=(const IntType& b) noexcept {
Value -= b;
@@ -100,9 +100,9 @@ namespace NPrivate {
};
using value_type = T;
- using iterator = TIterator;
- using const_iterator = TIterator;
-
+ using iterator = TIterator;
+ using const_iterator = TIterator;
+
constexpr TIterator begin() const noexcept {
return TIterator(Start);
}
@@ -112,14 +112,14 @@ namespace NPrivate {
}
constexpr T size() const noexcept {
- return Finish - Start;
- }
-
- template <class Container>
+ return Finish - Start;
+ }
+
+ template <class Container>
operator Container() const {
- return Container(begin(), end());
- }
-
+ return Container(begin(), end());
+ }
+
private:
T Start;
T Finish;
@@ -161,12 +161,12 @@ namespace NPrivate {
}
constexpr bool operator==(const TIterator& other) const noexcept {
- return Value_ == other.Value_;
- }
-
- TIterator& operator++() noexcept {
+ return Value_ == other.Value_;
+ }
+
+ TIterator& operator++() noexcept {
Value_ += Parent_->Step_;
- return *this;
+ return *this;
}
TIterator& operator--() noexcept {
@@ -176,23 +176,23 @@ namespace NPrivate {
constexpr TDiff operator-(const TIterator& b) const noexcept {
return (Value_ - b.Value_) / Parent_->Step_;
- }
-
+ }
+
template <typename IntType>
constexpr TIterator operator+(const IntType& b) const noexcept {
return TIterator(*this) += b;
- }
-
+ }
+
template <typename IntType>
TIterator& operator+=(const IntType& b) noexcept {
Value_ += b * Parent_->Step_;
- return *this;
- }
-
+ return *this;
+ }
+
template <typename IntType>
constexpr TIterator operator-(const IntType& b) const noexcept {
return TIterator(*this) -= b;
- }
+ }
template <typename IntType>
TIterator& operator-=(const IntType& b) noexcept {
@@ -206,9 +206,9 @@ namespace NPrivate {
};
using value_type = T;
- using iterator = TIterator;
- using const_iterator = TIterator;
-
+ using iterator = TIterator;
+ using const_iterator = TIterator;
+
constexpr TIterator begin() const noexcept {
return TIterator(Start_, *this);
}
@@ -229,14 +229,14 @@ namespace NPrivate {
}
constexpr T size() const noexcept {
- return (Finish_ - Start_) / Step_;
- }
-
- template <class Container>
+ return (Finish_ - Start_) / Step_;
+ }
+
+ template <class Container>
operator Container() const {
- return Container(begin(), end());
- }
-
+ return Container(begin(), end());
+ }
+
private:
const T Start_;
const TDiff Step_;
diff --git a/util/generic/xrange_ut.cpp b/util/generic/xrange_ut.cpp
index 8106da03e7..f8ba3c6f1f 100644
--- a/util/generic/xrange_ut.cpp
+++ b/util/generic/xrange_ut.cpp
@@ -3,7 +3,7 @@
#include "algorithm.h"
#include "maybe.h"
#include "vector.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/string/builder.h>
Y_UNIT_TEST_SUITE(XRange) {
@@ -78,40 +78,40 @@ Y_UNIT_TEST_SUITE(XRange) {
}
UNIT_ASSERT_VALUES_EQUAL(digSumByPtr, digSumExpected);
}
-
+
Y_UNIT_TEST(SizeMethodCheck) {
- UNIT_ASSERT_VALUES_EQUAL(xrange(5).size(), 5);
- UNIT_ASSERT_VALUES_EQUAL(xrange(0, 5, 2).size(), 3);
- UNIT_ASSERT_VALUES_EQUAL(xrange(0, 6, 2).size(), 3);
- }
-
+ UNIT_ASSERT_VALUES_EQUAL(xrange(5).size(), 5);
+ UNIT_ASSERT_VALUES_EQUAL(xrange(0, 5, 2).size(), 3);
+ UNIT_ASSERT_VALUES_EQUAL(xrange(0, 6, 2).size(), 3);
+ }
+
class TVectorChild: public TVector<size_t> {
- public:
+ public:
template <typename TIterator>
TVectorChild(TIterator a, TIterator b)
: TVector<size_t>(a, b)
{
}
- };
-
+ };
+
Y_UNIT_TEST(ConvertionWorks) {
TVector<size_t> data = {0, 1, 2, 3, 4, 5, 6, 7, 8};
-
+
TVector<size_t> convertionResults[] = {xrange<size_t>(9),
xrange<ui32>(0, 9),
xrange(0, 9, 1)};
-
- for (const auto& arr : convertionResults) {
- UNIT_ASSERT(arr == data);
- }
-
- TVectorChild sons[] = {xrange(0, 9),
+
+ for (const auto& arr : convertionResults) {
+ UNIT_ASSERT(arr == data);
+ }
+
+ TVectorChild sons[] = {xrange(0, 9),
xrange(0, 9, 1)};
-
- for (const auto& arr : sons) {
- UNIT_ASSERT(arr == data);
- }
- }
+
+ for (const auto& arr : sons) {
+ UNIT_ASSERT(arr == data);
+ }
+ }
template <class XRangeContainer>
void TestEmptyRanges(const XRangeContainer& c) {
diff --git a/util/generic/yexception_ut.cpp b/util/generic/yexception_ut.cpp
index cb3e29fed8..3b3a66eb73 100644
--- a/util/generic/yexception_ut.cpp
+++ b/util/generic/yexception_ut.cpp
@@ -8,7 +8,7 @@ static inline void Throw2DontMove() {
ythrow yexception() << 1 << " qw " << 12.1; // don't move this line
}
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/algorithm.h>
#include <util/memory/tempbuf.h>
diff --git a/util/generic/ylimits_ut.cpp b/util/generic/ylimits_ut.cpp
index f1b3c6858c..a77fb0c74c 100644
--- a/util/generic/ylimits_ut.cpp
+++ b/util/generic/ylimits_ut.cpp
@@ -1,7 +1,7 @@
#include "cast.h"
#include "ylimits.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/string/cast.h>
#include <util/system/valgrind.h>
diff --git a/util/generic/ymath_ut.cpp b/util/generic/ymath_ut.cpp
index 29190b55eb..270ab5d1b1 100644
--- a/util/generic/ymath_ut.cpp
+++ b/util/generic/ymath_ut.cpp
@@ -1,7 +1,7 @@
#include "bitops.h"
#include "ymath.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/stream/output.h>
#include <util/datetime/cputimer.h>
diff --git a/util/memory/addstorage_ut.cpp b/util/memory/addstorage_ut.cpp
index 9b0c4989ab..f9b66d10fc 100644
--- a/util/memory/addstorage_ut.cpp
+++ b/util/memory/addstorage_ut.cpp
@@ -1,6 +1,6 @@
#include "addstorage.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
class TAddStorageTest: public TTestBase {
UNIT_TEST_SUITE(TAddStorageTest);
diff --git a/util/memory/benchmark/pool/main.cpp b/util/memory/benchmark/pool/main.cpp
index 0b4d6c94af..0ab611761c 100644
--- a/util/memory/benchmark/pool/main.cpp
+++ b/util/memory/benchmark/pool/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/memory/pool.h>
#include <util/generic/xrange.h>
diff --git a/util/memory/blob.cpp b/util/memory/blob.cpp
index 91da5cadca..341071e625 100644
--- a/util/memory/blob.cpp
+++ b/util/memory/blob.cpp
@@ -179,7 +179,7 @@ static inline TBlob CopyConstruct(const void* data, size_t len) {
memcpy(base->Data(), data, len);
TBlob ret(base->Data(), len, base.Get());
- Y_UNUSED(base.Release());
+ Y_UNUSED(base.Release());
return ret;
}
@@ -201,7 +201,7 @@ static inline TBlob ConstructFromMap(const TMemoryMap& map, ui64 offset, size_t
using TBase = TMappedBlobBase<TCounter>;
THolder<TBase> base(new TBase(map, offset, length, mode));
TBlob ret(base->Data(), base->Length(), base.Get());
- Y_UNUSED(base.Release());
+ Y_UNUSED(base.Release());
return ret;
}
@@ -310,7 +310,7 @@ static inline TBlob ReadFromFile(const TFile& file, ui64 offset, size_t length)
file.Pload(base->Data(), length, offset);
TBlob ret(base->Data(), length, base.Get());
- Y_UNUSED(base.Release());
+ Y_UNUSED(base.Release());
return ret;
}
@@ -356,7 +356,7 @@ static inline TBlob ConstructFromBuffer(TBuffer& in) {
THolder<TBase> base(new TBase(in));
TBlob ret(base->Buffer().Data(), base->Buffer().Size(), base.Get());
- Y_UNUSED(base.Release());
+ Y_UNUSED(base.Release());
return ret;
}
@@ -396,7 +396,7 @@ TBlob ConstructFromString(S&& s) {
auto base = MakeHolder<TBase>(std::forward<S>(s));
TBlob ret(base->String().data(), base->String().size(), base.Get());
- Y_UNUSED(base.Release());
+ Y_UNUSED(base.Release());
return ret;
}
diff --git a/util/memory/blob_ut.cpp b/util/memory/blob_ut.cpp
index 023f9a0487..1a82ca58db 100644
--- a/util/memory/blob_ut.cpp
+++ b/util/memory/blob_ut.cpp
@@ -1,6 +1,6 @@
#include "blob.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/system/tempfile.h>
#include <util/folder/path.h>
diff --git a/util/memory/pool_ut.cpp b/util/memory/pool_ut.cpp
index 1158a8ca42..d3a0123166 100644
--- a/util/memory/pool_ut.cpp
+++ b/util/memory/pool_ut.cpp
@@ -1,6 +1,6 @@
#include "pool.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/stream/output.h>
diff --git a/util/memory/smallobj_ut.cpp b/util/memory/smallobj_ut.cpp
index 86003d1d53..49483c498d 100644
--- a/util/memory/smallobj_ut.cpp
+++ b/util/memory/smallobj_ut.cpp
@@ -1,6 +1,6 @@
#include "smallobj.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/hash_set.h>
diff --git a/util/memory/tempbuf.h b/util/memory/tempbuf.h
index 334670eb1e..ad66fee283 100644
--- a/util/memory/tempbuf.h
+++ b/util/memory/tempbuf.h
@@ -26,26 +26,26 @@ public:
TTempBuf& operator=(TTempBuf&& b) noexcept;
Y_PURE_FUNCTION char* Data() noexcept;
-
+
Y_PURE_FUNCTION const char* Data() const noexcept;
-
+
Y_PURE_FUNCTION char* Current() noexcept;
-
+
Y_PURE_FUNCTION const char* Current() const noexcept;
-
+
Y_PURE_FUNCTION size_t Size() const noexcept;
-
+
Y_PURE_FUNCTION size_t Filled() const noexcept;
-
+
Y_PURE_FUNCTION size_t Left() const noexcept;
-
+
void Reset() noexcept;
void SetPos(size_t off);
char* Proceed(size_t off);
void Append(const void* data, size_t len);
Y_PURE_FUNCTION bool IsNull() const noexcept;
-
+
private:
TIntrusivePtr<TImpl> Impl_;
};
diff --git a/util/memory/tempbuf_ut.cpp b/util/memory/tempbuf_ut.cpp
index d6bcf9d546..9a37eadd55 100644
--- a/util/memory/tempbuf_ut.cpp
+++ b/util/memory/tempbuf_ut.cpp
@@ -2,7 +2,7 @@
#include <utility>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
class TTempBufTest: public TTestBase {
UNIT_TEST_SUITE(TTempBufTest);
diff --git a/util/network/address_ut.cpp b/util/network/address_ut.cpp
index 28f45172ff..bf0a988f2d 100644
--- a/util/network/address_ut.cpp
+++ b/util/network/address_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "address.h"
diff --git a/util/network/endpoint_ut.cpp b/util/network/endpoint_ut.cpp
index d5e40dd6e1..216f8cb071 100644
--- a/util/network/endpoint_ut.cpp
+++ b/util/network/endpoint_ut.cpp
@@ -1,6 +1,6 @@
#include "endpoint.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/hash_set.h>
#include <util/generic/strbuf.h>
diff --git a/util/network/ip_ut.cpp b/util/network/ip_ut.cpp
index 6716c6a699..c04063c910 100644
--- a/util/network/ip_ut.cpp
+++ b/util/network/ip_ut.cpp
@@ -1,6 +1,6 @@
#include "ip.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/yexception.h>
diff --git a/util/network/poller_ut.cpp b/util/network/poller_ut.cpp
index 6df0dda8ec..fe03dfc7c1 100644
--- a/util/network/poller_ut.cpp
+++ b/util/network/poller_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/system/error.h>
#include "pair.h"
diff --git a/util/network/sock_ut.cpp b/util/network/sock_ut.cpp
index fd8c783747..af5542185f 100644
--- a/util/network/sock_ut.cpp
+++ b/util/network/sock_ut.cpp
@@ -1,7 +1,7 @@
#include "sock.h"
-#include <library/cpp/testing/unittest/registar.h>
-#include <library/cpp/threading/future/legacy_future.h>
+#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/threading/future/legacy_future.h>
#include <util/system/fs.h>
diff --git a/util/network/socket_ut.cpp b/util/network/socket_ut.cpp
index 6b20e11f70..60650a2680 100644
--- a/util/network/socket_ut.cpp
+++ b/util/network/socket_ut.cpp
@@ -2,7 +2,7 @@
#include "pair.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/string/builder.h>
#include <util/generic/vector.h>
diff --git a/util/network/ut/ya.make b/util/network/ut/ya.make
index 1ba03e167c..71357d4b7d 100644
--- a/util/network/ut/ya.make
+++ b/util/network/ut/ya.make
@@ -6,7 +6,7 @@ OWNER(g:util)
SUBSCRIBER(g:util-subscribers)
PEERDIR(
- library/cpp/threading/future
+ library/cpp/threading/future
)
SRCS(
diff --git a/util/random/benchmark/prng/main.cpp b/util/random/benchmark/prng/main.cpp
index 2c6279ff71..2b3ebcaa2e 100644
--- a/util/random/benchmark/prng/main.cpp
+++ b/util/random/benchmark/prng/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/random/entropy.h>
#include <util/random/fast.h>
diff --git a/util/random/common_ops_ut.cpp b/util/random/common_ops_ut.cpp
index 905912bd1e..22ca1ce8eb 100644
--- a/util/random/common_ops_ut.cpp
+++ b/util/random/common_ops_ut.cpp
@@ -1,7 +1,7 @@
#include "common_ops.h"
#include "random.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/digest/numeric.h>
diff --git a/util/random/easy_ut.cpp b/util/random/easy_ut.cpp
index d1d024a91f..1857e6c747 100644
--- a/util/random/easy_ut.cpp
+++ b/util/random/easy_ut.cpp
@@ -1,6 +1,6 @@
#include "easy.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TEasyRndInterface) {
Y_UNIT_TEST(Test1) {
diff --git a/util/random/entropy_ut.cpp b/util/random/entropy_ut.cpp
index 1ff27203f0..cf0a0512f0 100644
--- a/util/random/entropy_ut.cpp
+++ b/util/random/entropy_ut.cpp
@@ -1,6 +1,6 @@
#include "entropy.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TestEntropy) {
Y_UNIT_TEST(TestSeed) {
diff --git a/util/random/fast_ut.cpp b/util/random/fast_ut.cpp
index 60994a98b0..4e110aea0b 100644
--- a/util/random/fast_ut.cpp
+++ b/util/random/fast_ut.cpp
@@ -1,6 +1,6 @@
#include "fast.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TTestFastRng) {
Y_UNIT_TEST(Test1) {
diff --git a/util/random/mersenne_ut.cpp b/util/random/mersenne_ut.cpp
index a4b84efa3d..774a5f7fa8 100644
--- a/util/random/mersenne_ut.cpp
+++ b/util/random/mersenne_ut.cpp
@@ -1,6 +1,6 @@
#include "mersenne.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/stream/output.h>
diff --git a/util/random/normal_ut.cpp b/util/random/normal_ut.cpp
index 42b6cc4ba2..e690bff845 100644
--- a/util/random/normal_ut.cpp
+++ b/util/random/normal_ut.cpp
@@ -1,7 +1,7 @@
#include "normal.h"
#include "fast.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/vector.h>
diff --git a/util/random/random_ut.cpp b/util/random/random_ut.cpp
index 30427676f3..4b9f1b1101 100644
--- a/util/random/random_ut.cpp
+++ b/util/random/random_ut.cpp
@@ -1,6 +1,6 @@
#include "random.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/ylimits.h>
diff --git a/util/random/shuffle_ut.cpp b/util/random/shuffle_ut.cpp
index 87cbae94c0..3bb437ab44 100644
--- a/util/random/shuffle_ut.cpp
+++ b/util/random/shuffle_ut.cpp
@@ -2,7 +2,7 @@
#include "shuffle.h"
#include "mersenne.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/ylimits.h>
diff --git a/util/str_stl.h b/util/str_stl.h
index f1e137181d..a01d07716e 100644
--- a/util/str_stl.h
+++ b/util/str_stl.h
@@ -84,14 +84,14 @@ template <>
struct hash<TString>: ::NHashPrivate::TStringHash<char> {
};
-template <>
+template <>
struct hash<TUtf16String>: ::NHashPrivate::TStringHash<wchar16> {
-};
-
+};
+
template <>
struct THash<TWtringBuf>: ::NHashPrivate::TStringHash<wchar16> {
};
-
+
template <>
struct hash<TUtf32String>: ::NHashPrivate::TStringHash<wchar32> {
};
@@ -194,11 +194,11 @@ struct TEqualTo<TUtf16String>: public TEqualTo<TWtringBuf> {
using is_transparent = void;
};
-template <>
+template <>
struct TEqualTo<TUtf32String>: public TEqualTo<TUtf32StringBuf> {
- using is_transparent = void;
-};
-
+ using is_transparent = void;
+};
+
template <class TFirst, class TSecond>
struct TEqualTo<std::pair<TFirst, TSecond>> {
template <class TOther>
@@ -247,11 +247,11 @@ struct TLess<TUtf16String>: public TLess<TWtringBuf> {
using is_transparent = void;
};
-template <>
+template <>
struct TLess<TUtf32String>: public TLess<TUtf32StringBuf> {
- using is_transparent = void;
-};
-
+ using is_transparent = void;
+};
+
template <class T>
struct TGreater: public std::greater<T> {
};
@@ -265,8 +265,8 @@ template <>
struct TGreater<TUtf16String>: public TGreater<TWtringBuf> {
using is_transparent = void;
};
-
-template <>
+
+template <>
struct TGreater<TUtf32String>: public TGreater<TUtf32StringBuf> {
- using is_transparent = void;
-};
+ using is_transparent = void;
+};
diff --git a/util/stream/aligned_ut.cpp b/util/stream/aligned_ut.cpp
index e980d05cf7..4f0e19d07b 100644
--- a/util/stream/aligned_ut.cpp
+++ b/util/stream/aligned_ut.cpp
@@ -1,6 +1,6 @@
#include "aligned.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
class TNastyInputStream: public IInputStream {
public:
diff --git a/util/stream/buffer_ut.cpp b/util/stream/buffer_ut.cpp
index 3494696190..22c05e77e1 100644
--- a/util/stream/buffer_ut.cpp
+++ b/util/stream/buffer_ut.cpp
@@ -1,6 +1,6 @@
#include "buffer.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/buffer.h>
diff --git a/util/stream/buffered_ut.cpp b/util/stream/buffered_ut.cpp
index 41d2fc3030..d091a23648 100644
--- a/util/stream/buffered_ut.cpp
+++ b/util/stream/buffered_ut.cpp
@@ -1,6 +1,6 @@
#include "buffered.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/string.h>
#include <util/random/mersenne.h>
diff --git a/util/stream/direct_io_ut.cpp b/util/stream/direct_io_ut.cpp
index 01d09db232..6c23d6c5f3 100644
--- a/util/stream/direct_io_ut.cpp
+++ b/util/stream/direct_io_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/string.h>
#include <util/generic/array_size.h>
diff --git a/util/stream/file_ut.cpp b/util/stream/file_ut.cpp
index ac0f09796e..84de4e9a05 100644
--- a/util/stream/file_ut.cpp
+++ b/util/stream/file_ut.cpp
@@ -1,6 +1,6 @@
#include "file.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/system/tempfile.h>
diff --git a/util/stream/format.cpp b/util/stream/format.cpp
index 3996130df5..eafdd20f81 100644
--- a/util/stream/format.cpp
+++ b/util/stream/format.cpp
@@ -4,13 +4,13 @@
#include <util/generic/ymath.h>
#include <util/string/cast.h>
-namespace NFormatPrivate {
- static inline i64 Round(double value) {
- double res1 = floor(value);
- double res2 = ceil(value);
+namespace NFormatPrivate {
+ static inline i64 Round(double value) {
+ double res1 = floor(value);
+ double res2 = ceil(value);
return (value - res1 < res2 - value) ? (i64)res1 : (i64)res2;
- }
-
+ }
+
static inline IOutputStream& PrintDoubleShortly(IOutputStream& os, const double& d) {
// General case: request 3 significant digits
// Side-effect: allows exponential representation
@@ -33,95 +33,95 @@ namespace NFormatPrivate {
}
return os << Prec(d, mode, ndigits);
- }
+ }
}
-
+
template <>
void Out<NFormatPrivate::THumanReadableSize>(IOutputStream& stream, const NFormatPrivate::THumanReadableSize& value) {
ui64 base = value.Format == SF_BYTES ? 1024 : 1000;
ui64 base2 = base * base;
ui64 base3 = base * base2;
ui64 base4 = base * base3;
-
- double v = value.Value;
- if (v < 0) {
- stream << "-";
- v = -v;
- }
-
- if (v < base) {
- NFormatPrivate::PrintDoubleShortly(stream, v);
+
+ double v = value.Value;
+ if (v < 0) {
+ stream << "-";
+ v = -v;
+ }
+
+ if (v < base) {
+ NFormatPrivate::PrintDoubleShortly(stream, v);
} else if (v < base2) {
- NFormatPrivate::PrintDoubleShortly(stream, v / (double)base) << 'K';
+ NFormatPrivate::PrintDoubleShortly(stream, v / (double)base) << 'K';
} else if (v < base3) {
- NFormatPrivate::PrintDoubleShortly(stream, v / (double)base2) << 'M';
+ NFormatPrivate::PrintDoubleShortly(stream, v / (double)base2) << 'M';
} else if (v < base4) {
- NFormatPrivate::PrintDoubleShortly(stream, v / (double)base3) << 'G';
- } else {
- NFormatPrivate::PrintDoubleShortly(stream, v / (double)base4) << 'T';
- }
-
+ NFormatPrivate::PrintDoubleShortly(stream, v / (double)base3) << 'G';
+ } else {
+ NFormatPrivate::PrintDoubleShortly(stream, v / (double)base4) << 'T';
+ }
+
if (value.Format == SF_BYTES) {
- if (v < base) {
+ if (v < base) {
stream << "B";
} else {
stream << "iB";
}
}
-}
-
+}
+
template <>
void Out<NFormatPrivate::THumanReadableDuration>(IOutputStream& os, const NFormatPrivate::THumanReadableDuration& hr) {
- TTempBuf buf;
- TMemoryOutput ss(buf.Data(), buf.Size());
-
- do {
- ui64 microSeconds = hr.Value.MicroSeconds();
- if (microSeconds < 1000) {
- ss << microSeconds << "us";
- break;
- }
- if (microSeconds < 1000 * 1000) {
+ TTempBuf buf;
+ TMemoryOutput ss(buf.Data(), buf.Size());
+
+ do {
+ ui64 microSeconds = hr.Value.MicroSeconds();
+ if (microSeconds < 1000) {
+ ss << microSeconds << "us";
+ break;
+ }
+ if (microSeconds < 1000 * 1000) {
NFormatPrivate::PrintDoubleShortly(ss, (double)microSeconds / 1000.0) << "ms";
- break;
- }
-
+ break;
+ }
+
double seconds = (double)(hr.Value.MilliSeconds()) / 1000.0;
- if (seconds < 60) {
- NFormatPrivate::PrintDoubleShortly(ss, seconds) << 's';
- break;
- }
-
- ui64 s = NFormatPrivate::Round(seconds * 1000 + 0.5) / 1000;
-
- ui64 m = s / 60;
- s = s % 60;
-
- ui64 h = m / 60;
- m = m % 60;
-
- ui64 d = h / 24;
- h = h % 24;
-
- ui64 times[] = {d, h, m, s};
- char names[] = {'d', 'h', 'm', 's'};
- bool first = true;
-
+ if (seconds < 60) {
+ NFormatPrivate::PrintDoubleShortly(ss, seconds) << 's';
+ break;
+ }
+
+ ui64 s = NFormatPrivate::Round(seconds * 1000 + 0.5) / 1000;
+
+ ui64 m = s / 60;
+ s = s % 60;
+
+ ui64 h = m / 60;
+ m = m % 60;
+
+ ui64 d = h / 24;
+ h = h % 24;
+
+ ui64 times[] = {d, h, m, s};
+ char names[] = {'d', 'h', 'm', 's'};
+ bool first = true;
+
for (size_t i = 0; i < Y_ARRAY_SIZE(times); ++i) {
- if (times[i] > 0) {
+ if (times[i] > 0) {
if (!first) {
- ss << ' ';
+ ss << ' ';
}
- ss << times[i] << names[i];
- first = false;
- }
- }
- } while (false);
-
- size_t written = buf.Size() - ss.Avail();
- os.Write(buf.Data(), written);
-}
-
+ ss << times[i] << names[i];
+ first = false;
+ }
+ }
+ } while (false);
+
+ size_t written = buf.Size() - ss.Avail();
+ os.Write(buf.Data(), written);
+}
+
void Time(IOutputStream& l) {
l << millisec();
}
diff --git a/util/stream/format.h b/util/stream/format.h
index b033208a1b..031559a424 100644
--- a/util/stream/format.h
+++ b/util/stream/format.h
@@ -3,10 +3,10 @@
#include "mem.h"
#include "output.h"
-#include <util/datetime/base.h>
-#include <util/generic/strbuf.h>
+#include <util/datetime/base.h>
+#include <util/generic/strbuf.h>
#include <util/generic/flags.h>
-#include <util/memory/tempbuf.h>
+#include <util/memory/tempbuf.h>
#include <util/string/cast.h>
enum ENumberFormatFlag {
@@ -131,27 +131,27 @@ namespace NFormatPrivate {
stream << str;
return stream;
}
-
+
template <typename Char, size_t Base>
struct TBaseText {
TBasicStringBuf<Char> Text;
-
+
inline TBaseText(const TBasicStringBuf<Char> text)
- : Text(text)
+ : Text(text)
{
}
- };
-
+ };
+
template <typename Char, size_t Base>
IOutputStream& operator<<(IOutputStream& os, const TBaseText<Char, Base>& text) {
for (size_t i = 0; i < text.Text.size(); ++i) {
- if (i != 0) {
- os << ' ';
- }
+ if (i != 0) {
+ os << ' ';
+ }
os << TUnsignedBaseNumber<Char, Base>(text.Text[i], HF_FULL);
- }
- return os;
- }
+ }
+ return os;
+ }
template <typename T>
struct TFloatPrecision {
@@ -170,20 +170,20 @@ namespace NFormatPrivate {
o << TStringBuf(buf, count);
return o;
}
-
- struct THumanReadableDuration {
- TDuration Value;
-
+
+ struct THumanReadableDuration {
+ TDuration Value;
+
constexpr THumanReadableDuration(const TDuration& value)
- : Value(value)
+ : Value(value)
{
}
- };
-
- struct THumanReadableSize {
- double Value;
+ };
+
+ struct THumanReadableSize {
+ double Value;
ESizeFormat Format;
- };
+ };
}
/**
@@ -280,7 +280,7 @@ static constexpr ::NFormatPrivate::TBaseNumber<T, 16> SHex(const T& value, const
return {value, flags};
}
-/**
+/**
* Output manipulator similar to `std::setbase(2)`.
*
* When written into a `IOutputStream`, writes out the provided value in
@@ -335,12 +335,12 @@ static constexpr ::NFormatPrivate::TBaseNumber<T, 2> SBin(const T& value, const
*
* @param value String to output.
*/
-template <typename TChar>
+template <typename TChar>
static inline ::NFormatPrivate::TBaseText<TChar, 16> HexText(const TBasicStringBuf<TChar> value) {
return ::NFormatPrivate::TBaseText<TChar, 16>(value);
-}
-
-/**
+}
+
+/**
* Output manipulator for binary string output.
*
* When written into a `IOutputStream`, writes out the provided characters
@@ -373,10 +373,10 @@ static inline ::NFormatPrivate::TBaseText<TChar, 2> BinText(const TBasicStringBu
* @param value Value to output.
*/
static constexpr ::NFormatPrivate::THumanReadableDuration HumanReadable(const TDuration duration) noexcept {
- return ::NFormatPrivate::THumanReadableDuration(duration);
-}
-
-/**
+ return ::NFormatPrivate::THumanReadableDuration(duration);
+}
+
+/**
* Output manipulator for writing out human-readable number of elements / memory
* amount in `ls -h` style.
*
@@ -388,22 +388,22 @@ static constexpr ::NFormatPrivate::THumanReadableDuration HumanReadable(const TD
*
* Example usage:
* @code
- * stream << HumanReadableSize(1024, SF_QUANTITY); // Will output "1.02K"
- * stream << HumanReadableSize(1024, SF_BYTES); // Will output "1KiB"
- * stream << "average usage " << HumanReadableSize(100 / 3., SF_BYTES); // Will output "average usage "33.3B""
+ * stream << HumanReadableSize(1024, SF_QUANTITY); // Will output "1.02K"
+ * stream << HumanReadableSize(1024, SF_BYTES); // Will output "1KiB"
+ * stream << "average usage " << HumanReadableSize(100 / 3., SF_BYTES); // Will output "average usage "33.3B""
* @endcode
*
* @param value Value to output.
* @param format Format to use.
*/
-static constexpr ::NFormatPrivate::THumanReadableSize HumanReadableSize(const double size, ESizeFormat format) noexcept {
+static constexpr ::NFormatPrivate::THumanReadableSize HumanReadableSize(const double size, ESizeFormat format) noexcept {
return {size, format};
-}
-
+}
+
void Time(IOutputStream& l);
void TimeHumanReadable(IOutputStream& l);
-/**
+/**
* Output manipulator for adjusting precision of floating point values.
*
* When written into a `IOutputStream`, writes out the provided floating point
@@ -424,7 +424,7 @@ static constexpr ::NFormatPrivate::TFloatPrecision<T> Prec(const T& value, const
return {value, mode, ndigits};
}
-/**
+/**
* Output manipulator for adjusting precision of floating point values.
*
* When written into a `IOutputStream`, writes out the provided floating point
diff --git a/util/stream/format_ut.cpp b/util/stream/format_ut.cpp
index 43245aeb48..b650a4f57f 100644
--- a/util/stream/format_ut.cpp
+++ b/util/stream/format_ut.cpp
@@ -1,7 +1,7 @@
#include "format.h"
-#include <library/cpp/testing/unittest/registar.h>
-#include <util/charset/wide.h>
+#include <library/cpp/testing/unittest/registar.h>
+#include <util/charset/wide.h>
Y_UNIT_TEST_SUITE(TOutputStreamFormattingTest) {
Y_UNIT_TEST(TestLeftPad) {
@@ -45,20 +45,20 @@ Y_UNIT_TEST_SUITE(TOutputStreamFormattingTest) {
(*ss) << Hex(*ii);
UNIT_ASSERT_VALUES_EQUAL("0x01234567", ss->Str());
}
-
+
Y_UNIT_TEST(TestHexText) {
- {
- TStringStream ss;
+ {
+ TStringStream ss;
ss << HexText(TStringBuf("abcи"));
- UNIT_ASSERT_VALUES_EQUAL("61 62 63 D0 B8", ss.Str());
- }
- {
- TStringStream ss;
+ UNIT_ASSERT_VALUES_EQUAL("61 62 63 D0 B8", ss.Str());
+ }
+ {
+ TStringStream ss;
TUtf16String w = UTF8ToWide("abcи");
- ss << HexText<wchar16>(w);
- UNIT_ASSERT_VALUES_EQUAL("0061 0062 0063 0438", ss.Str());
- }
- }
+ ss << HexText<wchar16>(w);
+ UNIT_ASSERT_VALUES_EQUAL("0061 0062 0063 0438", ss.Str());
+ }
+ }
Y_UNIT_TEST(TestBin) {
UNIT_ASSERT_VALUES_EQUAL(ToString(Bin(static_cast<ui32>(2), nullptr)), "10");
@@ -94,7 +94,7 @@ Y_UNIT_TEST_SUITE(TOutputStreamFormattingTest) {
ss << Prec(1.2345678901234567, PREC_POINT_DIGITS, 3);
UNIT_ASSERT_VALUES_EQUAL("1.235", ss.Str());
}
-
+
Y_UNIT_TEST(TestHumanReadableSize1000) {
UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(0, SF_QUANTITY)), "0");
@@ -109,8 +109,8 @@ Y_UNIT_TEST_SUITE(TOutputStreamFormattingTest) {
UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(-1234567, SF_QUANTITY)), "-1.23M");
UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(-12345678, SF_QUANTITY)), "-12.3M");
UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(-12345678 * 1000ll, SF_QUANTITY)), "-12.3G");
- }
-
+ }
+
Y_UNIT_TEST(TestHumanReadableSize1024) {
UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(0, SF_BYTES)), "0B");
@@ -123,7 +123,7 @@ Y_UNIT_TEST_SUITE(TOutputStreamFormattingTest) {
UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(5 * 1024 * 1024, SF_BYTES)), "5MiB");
UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(1236 * 1024 * 1024, SF_BYTES)), "1.21GiB");
UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(1024ull * 1024 * 1024 * 1024, SF_BYTES)), "1TiB");
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(100 / 3., SF_BYTES)), "33.3B");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(100 / 3., SF_BYTES)), "33.3B");
UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(-100, SF_BYTES)), "-100B");
UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(-1024, SF_BYTES)), "-1KiB");
@@ -134,7 +134,7 @@ Y_UNIT_TEST_SUITE(TOutputStreamFormattingTest) {
UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(-5 * 1024 * 1024, SF_BYTES)), "-5MiB");
UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(-1236 * 1024 * 1024, SF_BYTES)), "-1.21GiB");
UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(-1024ll * 1024 * 1024 * 1024, SF_BYTES)), "-1TiB");
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(-100 / 3., SF_BYTES)), "-33.3B");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(-100 / 3., SF_BYTES)), "-33.3B");
// XXX: For 1000 <= x < 1024, Prec(x, 3) falls back to exponential form
@@ -159,24 +159,24 @@ Y_UNIT_TEST_SUITE(TOutputStreamFormattingTest) {
UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(-1010ll * 1024 * 1024 * 1024, SF_BYTES)), "-1010GiB");
UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(-1000ll * 1024 * 1024 * 1024 * 1024, SF_BYTES)), "-1000TiB");
UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadableSize(-1010ll * 1024 * 1024 * 1024 * 1024, SF_BYTES)), "-1010TiB");
- }
-
+ }
+
Y_UNIT_TEST(TestHumanReadableDuration) {
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::MicroSeconds(0))), "0us");
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::MicroSeconds(1))), "1us");
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::MicroSeconds(100))), "100us");
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::MicroSeconds(1234))), "1.23ms");
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::MicroSeconds(12345))), "12.3ms");
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::MicroSeconds(1234567))), "1.23s");
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(5))), "5s");
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(59.9))), "59.9s");
-
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(60))), "1m");
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(61))), "1m 1s");
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(72))), "1m 12s");
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(620))), "10m 20s");
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(3600))), "1h");
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(3672))), "1h 1m 12s");
- UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(4220))), "1h 10m 20s");
- }
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::MicroSeconds(0))), "0us");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::MicroSeconds(1))), "1us");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::MicroSeconds(100))), "100us");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::MicroSeconds(1234))), "1.23ms");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::MicroSeconds(12345))), "12.3ms");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::MicroSeconds(1234567))), "1.23s");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(5))), "5s");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(59.9))), "59.9s");
+
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(60))), "1m");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(61))), "1m 1s");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(72))), "1m 12s");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(620))), "10m 20s");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(3600))), "1h");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(3672))), "1h 1m 12s");
+ UNIT_ASSERT_VALUES_EQUAL(ToString(HumanReadable(TDuration::Seconds(4220))), "1h 10m 20s");
+ }
}
diff --git a/util/stream/hex_ut.cpp b/util/stream/hex_ut.cpp
index 5074a0b616..f4c29a2c90 100644
--- a/util/stream/hex_ut.cpp
+++ b/util/stream/hex_ut.cpp
@@ -1,6 +1,6 @@
#include "hex.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "str.h"
Y_UNIT_TEST_SUITE(THexCodingTest) {
diff --git a/util/stream/input_ut.cpp b/util/stream/input_ut.cpp
index 4a93f5458e..fd45827407 100644
--- a/util/stream/input_ut.cpp
+++ b/util/stream/input_ut.cpp
@@ -1,7 +1,7 @@
#include "input.h"
#include "output.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/system/file.h>
#include <util/system/yassert.h>
diff --git a/util/stream/ios_ut.cpp b/util/stream/ios_ut.cpp
index 139f4296e5..51ab9a5735 100644
--- a/util/stream/ios_ut.cpp
+++ b/util/stream/ios_ut.cpp
@@ -4,7 +4,7 @@
#include "buffered.h"
#include "walk.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/string/cast.h>
#include <util/memory/tempbuf.h>
diff --git a/util/stream/labeled_ut.cpp b/util/stream/labeled_ut.cpp
index 12d0dc5004..da3b99fdba 100644
--- a/util/stream/labeled_ut.cpp
+++ b/util/stream/labeled_ut.cpp
@@ -1,6 +1,6 @@
#include "str.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TLabeledOutputTest) {
Y_UNIT_TEST(TBasicTest) {
diff --git a/util/stream/length_ut.cpp b/util/stream/length_ut.cpp
index 8968448954..5a21ca1630 100644
--- a/util/stream/length_ut.cpp
+++ b/util/stream/length_ut.cpp
@@ -1,6 +1,6 @@
#include "length.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/string.h>
diff --git a/util/stream/mem_ut.cpp b/util/stream/mem_ut.cpp
index f388ae66ac..5042ee55f5 100644
--- a/util/stream/mem_ut.cpp
+++ b/util/stream/mem_ut.cpp
@@ -1,6 +1,6 @@
#include "mem.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TestMemIO) {
Y_UNIT_TEST(TestReadTo) {
diff --git a/util/stream/multi_ut.cpp b/util/stream/multi_ut.cpp
index fc2553b533..ef67d30861 100644
--- a/util/stream/multi_ut.cpp
+++ b/util/stream/multi_ut.cpp
@@ -1,7 +1,7 @@
#include "mem.h"
#include "multi.h"
#include "str.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TestMultiInput) {
struct TTestCase {
diff --git a/util/stream/output.cpp b/util/stream/output.cpp
index db81b81b70..8faaca2b32 100644
--- a/util/stream/output.cpp
+++ b/util/stream/output.cpp
@@ -79,16 +79,16 @@ static void WriteString(IOutputStream& o, const wchar16* w, size_t n) {
o.Write(data, written);
}
-static void WriteString(IOutputStream& o, const wchar32* w, size_t n) {
+static void WriteString(IOutputStream& o, const wchar32* w, size_t n) {
const size_t buflen = (n * MAX_UTF8_BYTES); // * 4 because the conversion functions can convert unicode character into maximum 4 bytes of UTF8
- TTempBuf buffer(buflen + 1);
- char* const data = buffer.Data();
- size_t written = 0;
- WideToUTF8(w, n, data, written);
- data[written] = 0;
- o.Write(data, written);
-}
-
+ TTempBuf buffer(buflen + 1);
+ char* const data = buffer.Data();
+ size_t written = 0;
+ WideToUTF8(w, n, data, written);
+ data[written] = 0;
+ o.Write(data, written);
+}
+
template <>
void Out<TString>(IOutputStream& o, const TString& p) {
o.Write(p.data(), p.size());
@@ -139,24 +139,24 @@ void Out<const wchar16*>(IOutputStream& o, const wchar16* w) {
}
template <>
-void Out<const wchar32*>(IOutputStream& o, const wchar32* w) {
- if (w) {
+void Out<const wchar32*>(IOutputStream& o, const wchar32* w) {
+ if (w) {
WriteString(o, w, std::char_traits<wchar32>::length(w));
- } else {
- o.Write("(null)");
- }
-}
-
-template <>
+ } else {
+ o.Write("(null)");
+ }
+}
+
+template <>
void Out<TUtf16String>(IOutputStream& o, const TUtf16String& w) {
WriteString(o, w.c_str(), w.size());
}
-template <>
-void Out<TUtf32String>(IOutputStream& o, const TUtf32String& w) {
- WriteString(o, w.c_str(), w.size());
-}
-
+template <>
+void Out<TUtf32String>(IOutputStream& o, const TUtf32String& w) {
+ WriteString(o, w.c_str(), w.size());
+}
+
#define DEF_CONV_DEFAULT(type) \
template <> \
void Out<type>(IOutputStream & o, type p) { \
@@ -221,12 +221,12 @@ void Out<TBasicCharRef<TUtf16String>>(IOutputStream& o, const TBasicCharRef<TUtf
}
template <>
-void Out<TBasicCharRef<TUtf32String>>(IOutputStream& o, const TBasicCharRef<TUtf32String>& c) {
- o << static_cast<wchar32>(c);
-}
+void Out<TBasicCharRef<TUtf32String>>(IOutputStream& o, const TBasicCharRef<TUtf32String>& c) {
+ o << static_cast<wchar32>(c);
+}
#endif
-
-template <>
+
+template <>
void Out<const void*>(IOutputStream& o, const void* t) {
o << Hex(size_t(t));
}
diff --git a/util/stream/output.h b/util/stream/output.h
index 00eef50b95..a5d992206d 100644
--- a/util/stream/output.h
+++ b/util/stream/output.h
@@ -45,7 +45,7 @@ public:
inline ~TPart() = default;
static inline TPart CrLf() noexcept {
- return TPart("\r\n", 2);
+ return TPart("\r\n", 2);
}
const void* buf;
@@ -204,9 +204,9 @@ inline void Out<const char*>(IOutputStream& o, const char* t) {
template <>
void Out<const wchar16*>(IOutputStream& o, const wchar16* w);
-template <>
-void Out<const wchar32*>(IOutputStream& o, const wchar32* w);
-
+template <>
+void Out<const wchar32*>(IOutputStream& o, const wchar32* w);
+
static inline IOutputStream& operator<<(IOutputStream& o, TStreamManipulator m) {
m(o);
@@ -249,16 +249,16 @@ static inline IOutputStream& operator<<(IOutputStream& o, wchar16* t) {
return o;
}
-static inline IOutputStream& operator<<(IOutputStream& o, const wchar32* t) {
- Out<const wchar32*>(o, t);
- return o;
-}
-
-static inline IOutputStream& operator<<(IOutputStream& o, wchar32* t) {
- Out<const wchar32*>(o, t);
- return o;
-}
-
+static inline IOutputStream& operator<<(IOutputStream& o, const wchar32* t) {
+ Out<const wchar32*>(o, t);
+ return o;
+}
+
+static inline IOutputStream& operator<<(IOutputStream& o, wchar32* t) {
+ Out<const wchar32*>(o, t);
+ return o;
+}
+
namespace NPrivate {
IOutputStream& StdOutStream() noexcept;
IOutputStream& StdErrStream() noexcept;
diff --git a/util/stream/printf_ut.cpp b/util/stream/printf_ut.cpp
index 0eab167062..a364194a76 100644
--- a/util/stream/printf_ut.cpp
+++ b/util/stream/printf_ut.cpp
@@ -4,7 +4,7 @@
#include <util/generic/string.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TStreamPrintfTest) {
Y_UNIT_TEST(TestPrintf) {
diff --git a/util/stream/str.h b/util/stream/str.h
index 028bd572c0..03c7003820 100644
--- a/util/stream/str.h
+++ b/util/stream/str.h
@@ -79,7 +79,7 @@ public:
}
TStringOutput(TStringOutput&& s) noexcept = default;
-
+
~TStringOutput() override;
/**
diff --git a/util/stream/str_ut.cpp b/util/stream/str_ut.cpp
index fc6b46c31a..ca770770b9 100644
--- a/util/stream/str_ut.cpp
+++ b/util/stream/str_ut.cpp
@@ -1,6 +1,6 @@
#include "str.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/typetraits.h>
template <typename T>
@@ -136,17 +136,17 @@ Y_UNIT_TEST_SUITE(TStringInputOutputTest) {
UNIT_ASSERT_STRINGS_EQUAL(str, "1234567890");
}
-
- Y_UNIT_TEST(MoveConstructor) {
- TString str;
- TStringOutput output1(str);
- output1 << "foo";
-
- TStringOutput output2 = std::move(output1);
- output2 << "bar";
- UNIT_ASSERT_STRINGS_EQUAL(str, "foobar");
-
- // Check old stream is in a valid state
- output1 << "baz";
- }
+
+ Y_UNIT_TEST(MoveConstructor) {
+ TString str;
+ TStringOutput output1(str);
+ output1 << "foo";
+
+ TStringOutput output2 = std::move(output1);
+ output2 << "bar";
+ UNIT_ASSERT_STRINGS_EQUAL(str, "foobar");
+
+ // Check old stream is in a valid state
+ output1 << "baz";
+ }
}
diff --git a/util/stream/tokenizer_ut.cpp b/util/stream/tokenizer_ut.cpp
index afc566da86..1d0de89b12 100644
--- a/util/stream/tokenizer_ut.cpp
+++ b/util/stream/tokenizer_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/array_size.h>
#include <util/generic/strbuf.h>
diff --git a/util/stream/walk_ut.cpp b/util/stream/walk_ut.cpp
index e0a783799f..30a0c7c59e 100644
--- a/util/stream/walk_ut.cpp
+++ b/util/stream/walk_ut.cpp
@@ -1,6 +1,6 @@
#include "walk.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
class TStringListInput: public IWalkInput {
public:
diff --git a/util/stream/zerocopy_output_ut.cpp b/util/stream/zerocopy_output_ut.cpp
index e81f7fb056..81474adf84 100644
--- a/util/stream/zerocopy_output_ut.cpp
+++ b/util/stream/zerocopy_output_ut.cpp
@@ -1,6 +1,6 @@
#include "zerocopy_output.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/string.h>
diff --git a/util/stream/zlib_ut.cpp b/util/stream/zlib_ut.cpp
index 2290b4a9de..e093b9df79 100644
--- a/util/stream/zlib_ut.cpp
+++ b/util/stream/zlib_ut.cpp
@@ -1,6 +1,6 @@
#include "zlib.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "file.h"
#include <util/system/tempfile.h>
diff --git a/util/string/ascii_ut.cpp b/util/string/ascii_ut.cpp
index 89069fee50..2da5b47219 100644
--- a/util/string/ascii_ut.cpp
+++ b/util/string/ascii_ut.cpp
@@ -1,7 +1,7 @@
#include "ascii.h"
#include <ctype.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TAsciiTest) {
Y_UNIT_TEST(TestAscii) {
diff --git a/util/string/benchmark/ascii/main.cpp b/util/string/benchmark/ascii/main.cpp
index 673047025d..a1036a01f7 100644
--- a/util/string/benchmark/ascii/main.cpp
+++ b/util/string/benchmark/ascii/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/generic/xrange.h>
#include <util/string/ascii.h>
diff --git a/util/string/benchmark/cast/main.cpp b/util/string/benchmark/cast/main.cpp
index f604712ab6..652af83901 100644
--- a/util/string/benchmark/cast/main.cpp
+++ b/util/string/benchmark/cast/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/string/cast.h>
#include <util/generic/xrange.h>
diff --git a/util/string/benchmark/float_to_string/main.cpp b/util/string/benchmark/float_to_string/main.cpp
index 1c7c0684a3..c13ca55ac3 100644
--- a/util/string/benchmark/float_to_string/main.cpp
+++ b/util/string/benchmark/float_to_string/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/generic/singleton.h>
#include <util/generic/vector.h>
diff --git a/util/string/benchmark/join/main.cpp b/util/string/benchmark/join/main.cpp
index 1a8633d3a8..ba5653813c 100644
--- a/util/string/benchmark/join/main.cpp
+++ b/util/string/benchmark/join/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/generic/function.h>
#include <util/generic/singleton.h>
diff --git a/util/string/benchmark/subst_global/main.cpp b/util/string/benchmark/subst_global/main.cpp
index e0decfa042..aa26383b39 100644
--- a/util/string/benchmark/subst_global/main.cpp
+++ b/util/string/benchmark/subst_global/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/generic/cast.h>
#include <util/generic/singleton.h>
diff --git a/util/string/builder_ut.cpp b/util/string/builder_ut.cpp
index 22def683ec..5c1f24a7e4 100644
--- a/util/string/builder_ut.cpp
+++ b/util/string/builder_ut.cpp
@@ -1,6 +1,6 @@
#include "builder.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
static void TestEquals(const TString& expected, const TString& actual) {
UNIT_ASSERT_VALUES_EQUAL(expected, actual);
diff --git a/util/string/cast_ut.cpp b/util/string/cast_ut.cpp
index 033450c38c..c7a802ba06 100644
--- a/util/string/cast_ut.cpp
+++ b/util/string/cast_ut.cpp
@@ -1,6 +1,6 @@
#include "cast.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/charset/wide.h>
#include <util/system/defaults.h>
diff --git a/util/string/escape_ut.cpp b/util/string/escape_ut.cpp
index cd38ecffd3..366b6688dc 100644
--- a/util/string/escape_ut.cpp
+++ b/util/string/escape_ut.cpp
@@ -1,6 +1,6 @@
#include "escape.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/string.h>
#include <util/charset/wide.h>
diff --git a/util/string/hex_ut.cpp b/util/string/hex_ut.cpp
index 39a83d5e62..f4e8ba5bb0 100644
--- a/util/string/hex_ut.cpp
+++ b/util/string/hex_ut.cpp
@@ -1,6 +1,6 @@
#include "hex.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(THexCodingTest) {
Y_UNIT_TEST(TestEncode) {
diff --git a/util/string/join_ut.cpp b/util/string/join_ut.cpp
index 3ed2b2459c..5f27e6b9ac 100644
--- a/util/string/join_ut.cpp
+++ b/util/string/join_ut.cpp
@@ -1,6 +1,6 @@
#include "join.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/vector.h>
#include <util/stream/output.h>
diff --git a/util/string/printf_ut.cpp b/util/string/printf_ut.cpp
index 2b2f980b70..e82db07a8d 100644
--- a/util/string/printf_ut.cpp
+++ b/util/string/printf_ut.cpp
@@ -1,6 +1,6 @@
#include "printf.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TStringPrintf) {
Y_UNIT_TEST(TestSprintf) {
diff --git a/util/string/split_ut.cpp b/util/string/split_ut.cpp
index 43e59f2d75..dc57ebf2d8 100644
--- a/util/string/split_ut.cpp
+++ b/util/string/split_ut.cpp
@@ -1,6 +1,6 @@
#include "split.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/stream/output.h>
#include <util/charset/wide.h>
diff --git a/util/string/strip_ut.cpp b/util/string/strip_ut.cpp
index d1029d1498..f19a17d439 100644
--- a/util/string/strip_ut.cpp
+++ b/util/string/strip_ut.cpp
@@ -1,6 +1,6 @@
#include "strip.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/charset/wide.h>
diff --git a/util/string/subst.cpp b/util/string/subst.cpp
index b2df328dc1..034002ac8e 100644
--- a/util/string/subst.cpp
+++ b/util/string/subst.cpp
@@ -153,9 +153,9 @@ inline size_t SubstCharGlobalImpl(TStringType& s, typename TStringType::value_ty
* sure that we can make safe casts between values of these types and pointers.
*/
static_assert(sizeof(wchar16) == sizeof(char16_t), "");
-static_assert(sizeof(wchar32) == sizeof(char32_t), "");
+static_assert(sizeof(wchar32) == sizeof(char32_t), "");
static_assert(std::is_unsigned<wchar16>::value == std::is_unsigned<char16_t>::value, "");
-static_assert(std::is_unsigned<wchar32>::value == std::is_unsigned<char32_t>::value, "");
+static_assert(std::is_unsigned<wchar32>::value == std::is_unsigned<char32_t>::value, "");
size_t SubstGlobal(TString& text, const TStringBuf what, const TStringBuf with, size_t from) {
return SubstGlobalImpl(text, what, with, from);
@@ -169,10 +169,10 @@ size_t SubstGlobal(TUtf16String& text, const TWtringBuf what, const TWtringBuf w
return SubstGlobalImpl(text, what, with, from);
}
-size_t SubstGlobal(TUtf32String& text, const TUtf32StringBuf what, const TUtf32StringBuf with, size_t from) {
- return SubstGlobalImpl(text, what, with, from);
-}
-
+size_t SubstGlobal(TUtf32String& text, const TUtf32StringBuf what, const TUtf32StringBuf with, size_t from) {
+ return SubstGlobalImpl(text, what, with, from);
+}
+
size_t SubstGlobal(std::u16string& text, const TWtringBuf what, const TWtringBuf with, size_t from) {
return SubstGlobalImpl(text,
std::u16string_view(reinterpret_cast<const char16_t*>(what.data()), what.size()),
@@ -195,7 +195,7 @@ size_t SubstGlobal(TUtf16String& text, wchar16 what, wchar16 with, size_t from)
size_t SubstGlobal(std::u16string& text, wchar16 what, wchar16 with, size_t from) {
return SubstCharGlobalImpl(text, (char16_t)what, (char16_t)with, from);
}
-
-size_t SubstGlobal(TUtf32String& text, wchar32 what, wchar32 with, size_t from) {
+
+size_t SubstGlobal(TUtf32String& text, wchar32 what, wchar32 with, size_t from) {
return SubstCharGlobalImpl(text, (char32_t)what, (char32_t)with, from);
-}
+}
diff --git a/util/string/subst.h b/util/string/subst.h
index 45b622fbef..7288398515 100644
--- a/util/string/subst.h
+++ b/util/string/subst.h
@@ -17,7 +17,7 @@ size_t SubstGlobal(TString& text, TStringBuf what, TStringBuf with, size_t from
size_t SubstGlobal(std::string& text, TStringBuf what, TStringBuf with, size_t from = 0);
size_t SubstGlobal(TUtf16String& text, TWtringBuf what, TWtringBuf with, size_t from = 0);
size_t SubstGlobal(std::u16string& text, TWtringBuf what, TWtringBuf with, size_t from = 0);
-size_t SubstGlobal(TUtf32String& text, TUtf32StringBuf what, TUtf32StringBuf with, size_t from = 0);
+size_t SubstGlobal(TUtf32String& text, TUtf32StringBuf what, TUtf32StringBuf with, size_t from = 0);
/* Replace all occurences of character `what` with character `with` starting from position `from`.
*
@@ -32,7 +32,7 @@ size_t SubstGlobal(TString& text, char what, char with, size_t from = 0);
size_t SubstGlobal(std::string& text, char what, char with, size_t from = 0);
size_t SubstGlobal(TUtf16String& text, wchar16 what, wchar16 with, size_t from = 0);
size_t SubstGlobal(std::u16string& text, wchar16 what, wchar16 with, size_t from = 0);
-size_t SubstGlobal(TUtf32String& text, wchar32 what, wchar32 with, size_t from = 0);
+size_t SubstGlobal(TUtf32String& text, wchar32 what, wchar32 with, size_t from = 0);
// TODO(yazevnul):
// - rename `SubstGlobal` to `ReplaceAll` for convenience
diff --git a/util/string/subst_ut.cpp b/util/string/subst_ut.cpp
index 21eccef779..0c0e53fddb 100644
--- a/util/string/subst_ut.cpp
+++ b/util/string/subst_ut.cpp
@@ -2,7 +2,7 @@
#include "subst.h"
#include <string>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TStringSubst) {
static const size_t MIN_FROM_CTX = 4;
diff --git a/util/string/type.cpp b/util/string/type.cpp
index 49671c02c2..d798a7f03a 100644
--- a/util/string/type.cpp
+++ b/util/string/type.cpp
@@ -73,7 +73,7 @@ bool IsTrue(const TStringBuf v) noexcept {
return IsCaseInsensitiveAnyOf(v, trueOptions);
}
-bool IsFalse(const TStringBuf v) noexcept {
+bool IsFalse(const TStringBuf v) noexcept {
static constexpr std::array<TStringBuf, 7> falseOptions{
"false",
"f",
diff --git a/util/string/type.h b/util/string/type.h
index d6cb29ea58..4d6b52643f 100644
--- a/util/string/type.h
+++ b/util/string/type.h
@@ -11,12 +11,12 @@ Y_PURE_FUNCTION static inline bool IsSpace(const TStringBuf s) noexcept {
/// Returns "true" if the given string is an arabic number ([0-9]+)
Y_PURE_FUNCTION bool IsNumber(const TStringBuf s) noexcept;
-
+
Y_PURE_FUNCTION bool IsNumber(const TWtringBuf s) noexcept;
/// Returns "true" if the given string is a hex number ([0-9a-fA-F]+)
Y_PURE_FUNCTION bool IsHexNumber(const TStringBuf s) noexcept;
-
+
Y_PURE_FUNCTION bool IsHexNumber(const TWtringBuf s) noexcept;
/* Tests if the given string is case insensitive equal to one of:
diff --git a/util/string/type_ut.cpp b/util/string/type_ut.cpp
index 03e7af62bd..a8e723e404 100644
--- a/util/string/type_ut.cpp
+++ b/util/string/type_ut.cpp
@@ -1,6 +1,6 @@
#include "type.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/charset/wide.h>
diff --git a/util/string/util_ut.cpp b/util/string/util_ut.cpp
index 18a2d8e195..14aaa86bd5 100644
--- a/util/string/util_ut.cpp
+++ b/util/string/util_ut.cpp
@@ -1,6 +1,6 @@
#include "util.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
class TStrUtilTest: public TTestBase {
UNIT_TEST_SUITE(TStrUtilTest);
diff --git a/util/string/vector_ut.cpp b/util/string/vector_ut.cpp
index 817120f268..9b0016542e 100644
--- a/util/string/vector_ut.cpp
+++ b/util/string/vector_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/charset/wide.h>
#include "cast.h"
diff --git a/util/system/align_ut.cpp b/util/system/align_ut.cpp
index 3ba3a3442b..0d80d42e6a 100644
--- a/util/system/align_ut.cpp
+++ b/util/system/align_ut.cpp
@@ -1,6 +1,6 @@
#include "align.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
class TAlignTest: public TTestBase {
UNIT_TEST_SUITE(TAlignTest);
diff --git a/util/system/atexit_ut.cpp b/util/system/atexit_ut.cpp
index 953f432811..a26f5abb35 100644
--- a/util/system/atexit_ut.cpp
+++ b/util/system/atexit_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "atexit.h"
diff --git a/util/system/atomic_ut.cpp b/util/system/atomic_ut.cpp
index 07211ffba7..235d2dd060 100644
--- a/util/system/atomic_ut.cpp
+++ b/util/system/atomic_ut.cpp
@@ -1,6 +1,6 @@
#include "atomic.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/ylimits.h>
diff --git a/util/system/backtrace_ut.cpp b/util/system/backtrace_ut.cpp
index 9b5ead71bc..7e4919a1bb 100644
--- a/util/system/backtrace_ut.cpp
+++ b/util/system/backtrace_ut.cpp
@@ -1,7 +1,7 @@
#include "backtrace.h"
#include <util/generic/array_ref.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/stream/output.h>
diff --git a/util/system/benchmark/cpu_id/main.cpp b/util/system/benchmark/cpu_id/main.cpp
index 8efe539983..a073543508 100644
--- a/util/system/benchmark/cpu_id/main.cpp
+++ b/util/system/benchmark/cpu_id/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/system/cpu_id.h>
diff --git a/util/system/benchmark/create_destroy_thread/main.cpp b/util/system/benchmark/create_destroy_thread/main.cpp
index 0ca2a9d96f..ebafa960d2 100644
--- a/util/system/benchmark/create_destroy_thread/main.cpp
+++ b/util/system/benchmark/create_destroy_thread/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/system/thread.h>
diff --git a/util/system/benchmark/rdtsc/main.cpp b/util/system/benchmark/rdtsc/main.cpp
index 8189d10f06..d51ea9d172 100644
--- a/util/system/benchmark/rdtsc/main.cpp
+++ b/util/system/benchmark/rdtsc/main.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/benchmark/bench.h>
#include <util/system/datetime.h>
#include <util/generic/xrange.h>
diff --git a/util/system/byteorder_ut.cpp b/util/system/byteorder_ut.cpp
index 39b8603d3f..f53b19af48 100644
--- a/util/system/byteorder_ut.cpp
+++ b/util/system/byteorder_ut.cpp
@@ -1,6 +1,6 @@
#include "byteorder.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
class TByteOrderTest: public TTestBase {
UNIT_TEST_SUITE(TByteOrderTest);
diff --git a/util/system/compat_ut.cpp b/util/system/compat_ut.cpp
index dbd9289c17..eac69c58cb 100644
--- a/util/system/compat_ut.cpp
+++ b/util/system/compat_ut.cpp
@@ -1,6 +1,6 @@
#include "compat.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/folder/dirut.h>
#include <util/stream/output.h>
diff --git a/util/system/compiler.h b/util/system/compiler.h
index b373edcc46..d534f92779 100644
--- a/util/system/compiler.h
+++ b/util/system/compiler.h
@@ -187,15 +187,15 @@
#define Y_PUBLIC
#endif
-#if !defined(Y_UNUSED) && !defined(__cplusplus)
+#if !defined(Y_UNUSED) && !defined(__cplusplus)
#define Y_UNUSED(var) (void)(var)
#endif
-#if !defined(Y_UNUSED) && defined(__cplusplus)
+#if !defined(Y_UNUSED) && defined(__cplusplus)
template <class... Types>
constexpr Y_FORCE_INLINE int Y_UNUSED(Types&&...) {
return 0;
};
-#endif
+#endif
/**
* @def Y_ASSUME
@@ -553,15 +553,15 @@ _YandexAbort();
// Memory sanitizer sometimes doesn't correctly set parameter shadow of constant functions.
#if (defined(__clang__) || defined(__GNUC__)) && !defined(_msan_enabled_)
/**
- * @def Y_CONST_FUNCTION
- methods and functions, marked with this method are promised to:
- 1. do not have side effects
- 2. this method do not read global memory
- NOTE: this attribute can't be set for methods that depend on data, pointed by this
- this allow compilers to do hard optimization of that functions
- NOTE: in common case this attribute can't be set if method have pointer-arguments
- NOTE: as result there no any reason to discard result of such method
-*/
+ * @def Y_CONST_FUNCTION
+ methods and functions, marked with this method are promised to:
+ 1. do not have side effects
+ 2. this method do not read global memory
+ NOTE: this attribute can't be set for methods that depend on data, pointed by this
+ this allow compilers to do hard optimization of that functions
+ NOTE: in common case this attribute can't be set if method have pointer-arguments
+ NOTE: as result there no any reason to discard result of such method
+*/
#define Y_CONST_FUNCTION [[gnu::const]]
#endif
@@ -571,13 +571,13 @@ _YandexAbort();
#if defined(__clang__) || defined(__GNUC__)
/**
- * @def Y_PURE_FUNCTION
- methods and functions, marked with this method are promised to:
- 1. do not have side effects
- 2. result will be the same if no global memory changed
- this allow compilers to do hard optimization of that functions
- NOTE: as result there no any reason to discard result of such method
-*/
+ * @def Y_PURE_FUNCTION
+ methods and functions, marked with this method are promised to:
+ 1. do not have side effects
+ 2. result will be the same if no global memory changed
+ this allow compilers to do hard optimization of that functions
+ NOTE: as result there no any reason to discard result of such method
+*/
#define Y_PURE_FUNCTION [[gnu::pure]]
#endif
diff --git a/util/system/compiler_ut.cpp b/util/system/compiler_ut.cpp
index f93b1c0850..63cc6cdbeb 100644
--- a/util/system/compiler_ut.cpp
+++ b/util/system/compiler_ut.cpp
@@ -1,6 +1,6 @@
#include "compiler.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TCompilerTest) {
Y_UNIT_TEST(TestPragmaNoWshadow) {
diff --git a/util/system/condvar_ut.cpp b/util/system/condvar_ut.cpp
index 5130a18d32..cc8ae57dd2 100644
--- a/util/system/condvar_ut.cpp
+++ b/util/system/condvar_ut.cpp
@@ -2,7 +2,7 @@
#include "guard.h"
#include "condvar.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/system/atomic.h>
#include <util/system/atomic_ops.h>
diff --git a/util/system/context_ut.cpp b/util/system/context_ut.cpp
index 45cb0249f7..042a934bab 100644
--- a/util/system/context_ut.cpp
+++ b/util/system/context_ut.cpp
@@ -1,6 +1,6 @@
#include "context.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/deque.h>
#include <util/generic/yexception.h>
diff --git a/util/system/cpu_id.cpp b/util/system/cpu_id.cpp
index 598c71f4d9..aa9c180c64 100644
--- a/util/system/cpu_id.cpp
+++ b/util/system/cpu_id.cpp
@@ -118,10 +118,10 @@ bool NX86::HaveSSE42() noexcept {
return (TX86CpuInfo(0x1).ECX >> 20) & 1u;
}
-bool NX86::HaveF16C() noexcept {
- return (TX86CpuInfo(0x1).ECX >> 29) & 1u;
-}
-
+bool NX86::HaveF16C() noexcept {
+ return (TX86CpuInfo(0x1).ECX >> 29) & 1u;
+}
+
bool NX86::HavePOPCNT() noexcept {
return (TX86CpuInfo(0x1).ECX >> 23) & 1u;
}
diff --git a/util/system/cpu_id.h b/util/system/cpu_id.h
index 3c49e728a7..f6ec49a9fa 100644
--- a/util/system/cpu_id.h
+++ b/util/system/cpu_id.h
@@ -1,7 +1,7 @@
#pragma once
#include "types.h"
-#include "compiler.h"
+#include "compiler.h"
#include <util/generic/singleton.h>
#define Y_CPU_ID_ENUMERATE(F) \
@@ -11,7 +11,7 @@
F(SSSE3) \
F(SSE41) \
F(SSE42) \
- F(F16C) \
+ F(F16C) \
F(POPCNT) \
F(BMI1) \
F(BMI2) \
@@ -78,11 +78,11 @@ namespace NX86 {
bool CpuId(ui32 op, ui32 res[4]) noexcept;
bool CpuId(ui32 op, ui32 subOp, ui32 res[4]) noexcept;
-#define Y_DEF_NAME(X) Y_CONST_FUNCTION bool Have##X() noexcept;
+#define Y_DEF_NAME(X) Y_CONST_FUNCTION bool Have##X() noexcept;
Y_CPU_ID_ENUMERATE(Y_DEF_NAME)
#undef Y_DEF_NAME
-#define Y_DEF_NAME(X) Y_CONST_FUNCTION bool CachedHave##X() noexcept;
+#define Y_DEF_NAME(X) Y_CONST_FUNCTION bool CachedHave##X() noexcept;
Y_CPU_ID_ENUMERATE_OUTLINED_CACHED_DEFINE(Y_DEF_NAME)
#undef Y_DEF_NAME
diff --git a/util/system/cpu_id_ut.cpp b/util/system/cpu_id_ut.cpp
index 68f1f8aac7..ac41440900 100644
--- a/util/system/cpu_id_ut.cpp
+++ b/util/system/cpu_id_ut.cpp
@@ -2,7 +2,7 @@
#include "platform.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
// There are no tests yet for instructions that use 512-bit wide registers because they are not
// supported by some compilers yet.
@@ -18,7 +18,7 @@ static void ExecuteSSE3Instruction();
static void ExecuteSSSE3Instruction();
static void ExecuteSSE41Instruction();
static void ExecuteSSE42Instruction();
-static void ExecuteF16CInstruction();
+static void ExecuteF16CInstruction();
static void ExecuteAVXInstruction();
static void ExecuteAVX2Instruction();
static void ExecutePOPCNTInstruction();
@@ -134,13 +134,13 @@ void ExecuteSSE42Instruction() {
: "eax");
}
-void ExecuteF16CInstruction() {
- __asm__ __volatile__("vcvtph2ps %%xmm0, %%ymm0\n"
- :
- :
- : "xmm0");
-}
-
+void ExecuteF16CInstruction() {
+ __asm__ __volatile__("vcvtph2ps %%xmm0, %%ymm0\n"
+ :
+ :
+ : "xmm0");
+}
+
void ExecuteAVXInstruction() {
__asm__ __volatile__("vzeroupper\n"
:
@@ -276,9 +276,9 @@ void ExecuteSSE41Instruction() {
void ExecuteSSE42Instruction() {
}
-void ExecuteF16CInstruction() {
-}
-
+void ExecuteF16CInstruction() {
+}
+
void ExecuteAVXInstruction() {
}
@@ -373,9 +373,9 @@ void ExecuteSSE41Instruction() {
void ExecuteSSE42Instruction() {
}
-void ExecuteF16CInstruction() {
-}
-
+void ExecuteF16CInstruction() {
+}
+
void ExecuteAVXInstruction() {
}
diff --git a/util/system/daemon_ut.cpp b/util/system/daemon_ut.cpp
index f93b9a9645..5a0201185c 100644
--- a/util/system/daemon_ut.cpp
+++ b/util/system/daemon_ut.cpp
@@ -1,6 +1,6 @@
#include "daemon.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/network/pair.h>
#include <util/network/socket.h>
diff --git a/util/system/defaults.h b/util/system/defaults.h
index dcd7abea38..325480a55b 100644
--- a/util/system/defaults.h
+++ b/util/system/defaults.h
@@ -83,14 +83,14 @@
#ifdef NDEBUG
#define Y_IF_DEBUG(X)
- #ifdef __cplusplus
-constexpr bool Y_IS_DEBUG_BUILD = false;
- #endif
+ #ifdef __cplusplus
+constexpr bool Y_IS_DEBUG_BUILD = false;
+ #endif
#else
#define Y_IF_DEBUG(X) X
- #ifdef __cplusplus
-constexpr bool Y_IS_DEBUG_BUILD = true;
- #endif
+ #ifdef __cplusplus
+constexpr bool Y_IS_DEBUG_BUILD = true;
+ #endif
#endif
/**
diff --git a/util/system/direct_io_ut.cpp b/util/system/direct_io_ut.cpp
index 839c3de7ca..f8f7ede132 100644
--- a/util/system/direct_io_ut.cpp
+++ b/util/system/direct_io_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/yexception.h>
#include <util/system/fs.h>
diff --git a/util/system/env.cpp b/util/system/env.cpp
index ead9b566a5..a3d46e48d3 100644
--- a/util/system/env.cpp
+++ b/util/system/env.cpp
@@ -50,18 +50,18 @@ TString GetEnv(const TString& key, const TString& def) {
}
void SetEnv(const TString& key, const TString& value) {
- bool isOk = false;
- int errorCode = 0;
+ bool isOk = false;
+ int errorCode = 0;
#ifdef _win_
isOk = SetEnvironmentVariable(key.data(), value.data());
- if (!isOk) {
- errorCode = GetLastError();
- }
+ if (!isOk) {
+ errorCode = GetLastError();
+ }
#else
isOk = (0 == setenv(key.data(), value.data(), true /*replace*/));
- if (!isOk) {
- errorCode = errno;
- }
+ if (!isOk) {
+ errorCode = errno;
+ }
#endif
- Y_ENSURE_EX(isOk, TSystemError() << "failed to SetEnv with error-code " << errorCode);
+ Y_ENSURE_EX(isOk, TSystemError() << "failed to SetEnv with error-code " << errorCode);
}
diff --git a/util/system/env_ut.cpp b/util/system/env_ut.cpp
index e03cc01658..fb8bcd2420 100644
--- a/util/system/env_ut.cpp
+++ b/util/system/env_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/string.h>
#include "env.h"
diff --git a/util/system/error_ut.cpp b/util/system/error_ut.cpp
index 763b0dddb7..98ea0e9f7d 100644
--- a/util/system/error_ut.cpp
+++ b/util/system/error_ut.cpp
@@ -1,6 +1,6 @@
#include "error.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/ylimits.h>
diff --git a/util/system/event_ut.cpp b/util/system/event_ut.cpp
index 2506cb7a91..40565a8688 100644
--- a/util/system/event_ut.cpp
+++ b/util/system/event_ut.cpp
@@ -1,7 +1,7 @@
#include "event.h"
#include "atomic.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/thread/pool.h>
diff --git a/util/system/execpath.cpp b/util/system/execpath.cpp
index 33198af58b..c2d798e1c4 100644
--- a/util/system/execpath.cpp
+++ b/util/system/execpath.cpp
@@ -84,7 +84,7 @@ static inline TString FreeBSDGetArgv0() {
}
static inline bool FreeBSDGuessExecPath(const TString& guessPath, TString& execPath) {
- if (NFs::Exists(guessPath)) {
+ if (NFs::Exists(guessPath)) {
// now it should work for real
execPath = FreeBSDGetExecPath();
if (RealPath(execPath) == RealPath(guessPath)) {
diff --git a/util/system/execpath_ut.cpp b/util/system/execpath_ut.cpp
index 16b01466f5..40838e01a7 100644
--- a/util/system/execpath_ut.cpp
+++ b/util/system/execpath_ut.cpp
@@ -1,6 +1,6 @@
#include "execpath.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "platform.h"
#include <util/folder/dirut.h>
@@ -11,7 +11,7 @@ Y_UNIT_TEST_SUITE(TExecPathTest) {
TString persistentExecPath = GetPersistentExecPath();
try {
- UNIT_ASSERT(NFs::Exists(execPath));
+ UNIT_ASSERT(NFs::Exists(execPath));
UNIT_ASSERT(NFs::Exists(persistentExecPath));
} catch (...) {
Cerr << execPath << Endl;
diff --git a/util/system/file_ut.cpp b/util/system/file_ut.cpp
index 941e6a50f3..8b759a8a89 100644
--- a/util/system/file_ut.cpp
+++ b/util/system/file_ut.cpp
@@ -2,7 +2,7 @@
#include "fs.h"
#include "tempfile.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/stream/file.h>
#include <util/generic/yexception.h>
diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp
index 7454a4cb94..42b6b775d2 100644
--- a/util/system/filemap.cpp
+++ b/util/system/filemap.cpp
@@ -31,7 +31,7 @@
#endif
#include <util/generic/utility.h>
-#include <util/system/sanitizers.h>
+#include <util/system/sanitizers.h>
#include "filemap.h"
#undef PAGE_SIZE
@@ -260,7 +260,7 @@ public:
} else {
ythrow yexception() << "Can't map " << (unsigned long)size << " bytes at offset " << offset << " of '" << DbgName_ << "': " << LastSystemErrorText();
}
- NSan::Unpoison(result.Ptr, result.Size);
+ NSan::Unpoison(result.Ptr, result.Size);
if (Mode_ & oPrecharge) {
NPrivate::Precharge(result.Ptr, result.Size, 0, result.Size);
}
diff --git a/util/system/filemap.h b/util/system/filemap.h
index 11be64bff4..a1c1c43bc5 100644
--- a/util/system/filemap.h
+++ b/util/system/filemap.h
@@ -255,7 +255,7 @@ public:
Y_PURE_FUNCTION bool empty() const noexcept {
return Empty();
}
-
+
Y_PURE_FUNCTION bool Empty() const noexcept {
return 0 == Size_;
}
diff --git a/util/system/filemap_ut.cpp b/util/system/filemap_ut.cpp
index 73f109dc88..415b42ca7d 100644
--- a/util/system/filemap_ut.cpp
+++ b/util/system/filemap_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#ifdef _unix_
#include <sys/resource.h>
diff --git a/util/system/flock_ut.cpp b/util/system/flock_ut.cpp
index b5f6cb5328..7b4f7e1c5e 100644
--- a/util/system/flock_ut.cpp
+++ b/util/system/flock_ut.cpp
@@ -3,7 +3,7 @@
#include "guard.h"
#include "tempfile.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TFileLockTest) {
Y_UNIT_TEST(TestFlock) {
diff --git a/util/system/fs.cpp b/util/system/fs.cpp
index d2611a8ccc..2ee29591a7 100644
--- a/util/system/fs.cpp
+++ b/util/system/fs.cpp
@@ -12,9 +12,9 @@
#include <util/memory/tempbuf.h>
#include <util/stream/file.h>
#include <util/charset/wide.h>
-#include <util/folder/iterator.h>
-#include <util/system/fstat.h>
-#include <util/folder/path.h>
+#include <util/folder/iterator.h>
+#include <util/system/fstat.h>
+#include <util/folder/path.h>
bool NFs::Remove(const TString& path) {
#if defined(_win_)
@@ -25,65 +25,65 @@ bool NFs::Remove(const TString& path) {
}
void NFs::RemoveRecursive(const TString& path) {
- static const TStringBuf errStr = "error while removing ";
-
- if (!NFs::Exists(path)) {
- return;
- }
-
- if (!TFileStat(path).IsDir()) {
+ static const TStringBuf errStr = "error while removing ";
+
+ if (!NFs::Exists(path)) {
+ return;
+ }
+
+ if (!TFileStat(path).IsDir()) {
if (!NFs::Remove(path)) {
- ythrow TSystemError() << errStr << path << " with cwd (" << NFs::CurrentWorkingDirectory() << ")";
+ ythrow TSystemError() << errStr << path << " with cwd (" << NFs::CurrentWorkingDirectory() << ")";
}
- }
-
- TDirIterator dir(path);
-
+ }
+
+ TDirIterator dir(path);
+
for (auto it = dir.begin(); it != dir.end(); ++it) {
- switch (it->fts_info) {
- case FTS_DOT:
- case FTS_D:
+ switch (it->fts_info) {
+ case FTS_DOT:
+ case FTS_D:
break;
- default:
+ default:
if (!NFs::Remove(it->fts_path)) {
- ythrow TSystemError() << errStr << it->fts_path << " with cwd (" << NFs::CurrentWorkingDirectory() << ")";
+ ythrow TSystemError() << errStr << it->fts_path << " with cwd (" << NFs::CurrentWorkingDirectory() << ")";
}
- break;
- }
- }
-}
-
+ break;
+ }
+ }
+}
+
bool NFs::MakeDirectory(const TString& path, EFilePermissions mode) {
-#if defined(_win_)
+#if defined(_win_)
Y_UNUSED(mode);
- return NFsPrivate::WinMakeDirectory(path);
-#else
+ return NFsPrivate::WinMakeDirectory(path);
+#else
return mkdir(path.data(), mode) == 0;
-#endif
-}
-
+#endif
+}
+
bool NFs::MakeDirectoryRecursive(const TString& path, EFilePermissions mode, bool alwaysCreate) {
- if (NFs::Exists(path) && TFileStat(path).IsDir()) {
- if (alwaysCreate) {
+ if (NFs::Exists(path) && TFileStat(path).IsDir()) {
+ if (alwaysCreate) {
ythrow TIoException() << "path " << path << " already exists"
<< " with cwd (" << NFs::CurrentWorkingDirectory() << ")";
- }
- return true;
- } else {
- //NOTE: recursion is finite due to existence of "." and "/"
+ }
+ return true;
+ } else {
+ //NOTE: recursion is finite due to existence of "." and "/"
if (!NFs::MakeDirectoryRecursive(TFsPath(path).Parent(), mode, false)) {
return false;
}
bool isDirMade = NFs::MakeDirectory(path, mode);
if (!isDirMade && alwaysCreate) {
- ythrow TIoException() << "failed to create " << path << " with cwd (" << NFs::CurrentWorkingDirectory() << ")";
- }
+ ythrow TIoException() << "failed to create " << path << " with cwd (" << NFs::CurrentWorkingDirectory() << ")";
+ }
return TFileStat(path).IsDir();
- }
-}
-
+ }
+}
+
bool NFs::Rename(const TString& oldPath, const TString& newPath) {
#if defined(_win_)
return NFsPrivate::WinRename(oldPath, newPath);
@@ -145,35 +145,35 @@ void NFs::Copy(const TString& existingPath, const TString& newPath) {
TransferData(&src, &dst);
}
-
+
bool NFs::Exists(const TString& path) {
-#if defined(_win_)
+#if defined(_win_)
return NFsPrivate::WinExists(path);
-#elif defined(_unix_)
+#elif defined(_unix_)
return access(path.data(), F_OK) == 0;
-#endif
-}
-
+#endif
+}
+
TString NFs::CurrentWorkingDirectory() {
-#if defined(_win_)
- return NFsPrivate::WinCurrentWorkingDirectory();
-#elif defined(_unix_)
- TTempBuf result;
- char* r = getcwd(result.Data(), result.Size());
+#if defined(_win_)
+ return NFsPrivate::WinCurrentWorkingDirectory();
+#elif defined(_unix_)
+ TTempBuf result;
+ char* r = getcwd(result.Data(), result.Size());
if (r == nullptr) {
- throw TIoSystemError() << "failed to getcwd";
+ throw TIoSystemError() << "failed to getcwd";
}
- return result.Data();
-#endif
-}
-
+ return result.Data();
+#endif
+}
+
void NFs::SetCurrentWorkingDirectory(TString path) {
-#ifdef _win_
- bool ok = NFsPrivate::WinSetCurrentWorkingDirectory(path);
-#else
+#ifdef _win_
+ bool ok = NFsPrivate::WinSetCurrentWorkingDirectory(path);
+#else
bool ok = !chdir(path.data());
-#endif
+#endif
if (!ok) {
- ythrow TSystemError() << "failed to change directory to " << path.Quote();
+ ythrow TSystemError() << "failed to change directory to " << path.Quote();
}
-}
+}
diff --git a/util/system/fs.h b/util/system/fs.h
index 237daf2d2d..613ae9c793 100644
--- a/util/system/fs.h
+++ b/util/system/fs.h
@@ -1,11 +1,11 @@
#pragma once
-#include <util/generic/flags.h>
+#include <util/generic/flags.h>
#include <util/generic/string.h>
-#include <util/generic/yexception.h>
+#include <util/generic/yexception.h>
namespace NFs {
- enum EFilePermission {
+ enum EFilePermission {
FP_ALL_EXEC = 01,
FP_ALL_WRITE = 02,
FP_ALL_READ = 04,
@@ -15,14 +15,14 @@ namespace NFs {
FP_OWNER_READ = 0400,
FP_OWNER_WRITE = 0200,
FP_OWNER_EXEC = 0100,
-
+
FP_COMMON_FILE = 0777,
FP_SECRET_FILE = 0700,
- FP_NONSECRET_FILE = 0744,
- };
-
- Y_DECLARE_FLAGS(EFilePermissions, EFilePermission);
-
+ FP_NONSECRET_FILE = 0744,
+ };
+
+ Y_DECLARE_FLAGS(EFilePermissions, EFilePermission);
+
/// Remove a file or empty directory
///
/// @param[in] path Path to file or directory
@@ -30,53 +30,53 @@ namespace NFs {
/// LastSystemError() is set in case of failure
bool Remove(const TString& path);
- /// Remove a file or directory with contents
- ///
- /// @param[in] path Path to file or directory
- /// @throws
+ /// Remove a file or directory with contents
+ ///
+ /// @param[in] path Path to file or directory
+ /// @throws
void RemoveRecursive(const TString& path);
-
- /// Creates directory
- ///
- /// @param[in] path Path to the directory
- /// @param[in] mode Access permissions field; NOTE: ignored on win
- /// @returns true on success or false otherwise
+
+ /// Creates directory
+ ///
+ /// @param[in] path Path to the directory
+ /// @param[in] mode Access permissions field; NOTE: ignored on win
+ /// @returns true on success or false otherwise
bool MakeDirectory(const TString& path, EFilePermissions mode);
-
- /// Creates directory
- ///
- /// @param[in] path Path to the directory
- /// @returns true on success or false otherwise
- /// NOTE: access permissions is set to 0777
+
+ /// Creates directory
+ ///
+ /// @param[in] path Path to the directory
+ /// @returns true on success or false otherwise
+ /// NOTE: access permissions is set to 0777
inline bool MakeDirectory(const TString& path) {
- return MakeDirectory(path, FP_COMMON_FILE);
- }
-
- /// Creates directory and all non-existings parents
- ///
- /// @param[in] path Path to be created
- /// @param[in] mode Access permissions field; NOTE: ignored on win
- /// @param[in] alwaysCreate Throw if path already exists or failed to create
- /// @returns true if target path created or exists (and directory)
+ return MakeDirectory(path, FP_COMMON_FILE);
+ }
+
+ /// Creates directory and all non-existings parents
+ ///
+ /// @param[in] path Path to be created
+ /// @param[in] mode Access permissions field; NOTE: ignored on win
+ /// @param[in] alwaysCreate Throw if path already exists or failed to create
+ /// @returns true if target path created or exists (and directory)
bool MakeDirectoryRecursive(const TString& path, EFilePermissions mode, bool alwaysCreate);
-
- /// Creates directory and all non-existings parents
- ///
- /// @param[in] path Path to be created
- /// @param[in] mode Access permissions field; NOTE: ignored on win
+
+ /// Creates directory and all non-existings parents
+ ///
+ /// @param[in] path Path to be created
+ /// @param[in] mode Access permissions field; NOTE: ignored on win
/// @returns true if target path created or exists (and directory)
inline bool MakeDirectoryRecursive(const TString& path, EFilePermissions mode) {
- return MakeDirectoryRecursive(path, mode, false);
- }
-
- /// Creates directory and all non-existings parents
- ///
- /// @param[in] path Path to be created
- /// @returns true if target path created or exists (and directory)
+ return MakeDirectoryRecursive(path, mode, false);
+ }
+
+ /// Creates directory and all non-existings parents
+ ///
+ /// @param[in] path Path to be created
+ /// @returns true if target path created or exists (and directory)
inline bool MakeDirectoryRecursive(const TString& path) {
- return MakeDirectoryRecursive(path, FP_COMMON_FILE, false);
- }
-
+ return MakeDirectoryRecursive(path, FP_COMMON_FILE, false);
+ }
+
/// Rename a file or directory.
/// Removes newPath if it exists
///
@@ -126,31 +126,31 @@ namespace NFs {
/// @param[in] existingPath Path to an existing file
/// @param[in] newPath New path of file
void Copy(const TString& existingPath, const TString& newPath);
-
- /// Returns path to the current working directory
- ///
- /// Note: is not threadsafe
+
+ /// Returns path to the current working directory
+ ///
+ /// Note: is not threadsafe
TString CurrentWorkingDirectory();
-
- /// Changes current working directory
- ///
- /// @param[in] path Path for new cwd
- /// Note: is not threadsafe
+
+ /// Changes current working directory
+ ///
+ /// @param[in] path Path for new cwd
+ /// Note: is not threadsafe
void SetCurrentWorkingDirectory(TString path);
-
- /// Checks if file exists
- ///
- /// @param[in] path Path to check
+
+ /// Checks if file exists
+ ///
+ /// @param[in] path Path to check
bool Exists(const TString& path);
-
- /// Ensures that file exists
- ///
- /// @param[in] path Path to check
- /// @returns input argument
+
+ /// Ensures that file exists
+ ///
+ /// @param[in] path Path to check
+ /// @returns input argument
inline const TString& EnsureExists(const TString& path) {
Y_ENSURE_EX(Exists(path), TFileError{} << "Path " << path << " does not exists (checked from cwd:" << NFs::CurrentWorkingDirectory() << ")");
- return path;
- }
+ return path;
+ }
}
-
-Y_DECLARE_OPERATORS_FOR_FLAGS(NFs::EFilePermissions)
+
+Y_DECLARE_OPERATORS_FOR_FLAGS(NFs::EFilePermissions)
diff --git a/util/system/fs_ut.cpp b/util/system/fs_ut.cpp
index de071ebf55..21d0a9729a 100644
--- a/util/system/fs_ut.cpp
+++ b/util/system/fs_ut.cpp
@@ -1,6 +1,6 @@
#include "fs.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "file.h"
#include "sysstat.h"
@@ -8,61 +8,61 @@
#include <util/folder/dirut.h>
#include <util/folder/path.h>
-//WARNING: on windows the test must be run with administative rules
-
+//WARNING: on windows the test must be run with administative rules
+
class TFsTest: public TTestBase {
UNIT_TEST_SUITE(TFsTest);
- UNIT_TEST(TestCreateRemove);
- UNIT_TEST(TestRename);
+ UNIT_TEST(TestCreateRemove);
+ UNIT_TEST(TestRename);
UNIT_TEST(TestSymlink);
UNIT_TEST(TestHardlink);
- UNIT_TEST(TestCwdOpts);
- UNIT_TEST(TestEnsureExists);
+ UNIT_TEST(TestCwdOpts);
+ UNIT_TEST(TestEnsureExists);
UNIT_TEST_SUITE_END();
public:
- void TestCreateRemove();
- void TestRename();
+ void TestCreateRemove();
+ void TestRename();
void TestSymlink();
void TestHardlink();
- void TestCwdOpts();
- void TestEnsureExists();
+ void TestCwdOpts();
+ void TestEnsureExists();
};
UNIT_TEST_SUITE_REGISTRATION(TFsTest);
-static void Touch(const TFsPath& path) {
- TFile file(path, CreateAlways | WrOnly);
- file.Write("123", 3);
-}
-
-void TFsTest::TestCreateRemove() {
- TFsPath dir1 = "dir_aбвг";
- NFs::RemoveRecursive(dir1);
- UNIT_ASSERT(!NFs::Exists(dir1));
- UNIT_ASSERT(NFs::MakeDirectory(dir1));
-
- UNIT_ASSERT(TFileStat(dir1).IsDir());
- UNIT_ASSERT(!NFs::MakeDirectory(dir1));
-
- UNIT_ASSERT(NFs::Exists(dir1));
- TFsPath subdir1 = dir1 / "a" / "b";
- //TFsPath link = dir1 / "link";
-
- UNIT_ASSERT(NFs::MakeDirectoryRecursive(subdir1, NFs::FP_COMMON_FILE, true));
- UNIT_ASSERT(NFs::Exists(subdir1));
- UNIT_ASSERT(NFs::MakeDirectoryRecursive(subdir1, NFs::FP_COMMON_FILE, false));
- UNIT_ASSERT(NFs::MakeDirectoryRecursive(subdir1, NFs::FP_COMMON_FILE));
- UNIT_ASSERT_EXCEPTION(NFs::MakeDirectoryRecursive(subdir1, NFs::FP_COMMON_FILE, true), TIoException);
-
- TFsPath file1 = dir1 / "f1.txt";
+static void Touch(const TFsPath& path) {
+ TFile file(path, CreateAlways | WrOnly);
+ file.Write("123", 3);
+}
+
+void TFsTest::TestCreateRemove() {
+ TFsPath dir1 = "dir_aбвг";
+ NFs::RemoveRecursive(dir1);
+ UNIT_ASSERT(!NFs::Exists(dir1));
+ UNIT_ASSERT(NFs::MakeDirectory(dir1));
+
+ UNIT_ASSERT(TFileStat(dir1).IsDir());
+ UNIT_ASSERT(!NFs::MakeDirectory(dir1));
+
+ UNIT_ASSERT(NFs::Exists(dir1));
+ TFsPath subdir1 = dir1 / "a" / "b";
+ //TFsPath link = dir1 / "link";
+
+ UNIT_ASSERT(NFs::MakeDirectoryRecursive(subdir1, NFs::FP_COMMON_FILE, true));
+ UNIT_ASSERT(NFs::Exists(subdir1));
+ UNIT_ASSERT(NFs::MakeDirectoryRecursive(subdir1, NFs::FP_COMMON_FILE, false));
+ UNIT_ASSERT(NFs::MakeDirectoryRecursive(subdir1, NFs::FP_COMMON_FILE));
+ UNIT_ASSERT_EXCEPTION(NFs::MakeDirectoryRecursive(subdir1, NFs::FP_COMMON_FILE, true), TIoException);
+
+ TFsPath file1 = dir1 / "f1.txt";
TFsPath file2 = subdir1 + TString("_f2.txt");
- TFsPath file3 = subdir1 / "f2.txt";
- Touch(file1);
- Touch(file2);
- Touch(file3);
- //UNIT_ASSERT(NFs::SymLink(file3.RealPath(), link));
-
+ TFsPath file3 = subdir1 / "f2.txt";
+ Touch(file1);
+ Touch(file2);
+ Touch(file3);
+ //UNIT_ASSERT(NFs::SymLink(file3.RealPath(), link));
+
UNIT_ASSERT(NFs::MakeDirectoryRecursive(dir1 / "subdir1" / "subdir2" / "subdir3" / "subdir4", NFs::FP_COMMON_FILE, false));
UNIT_ASSERT(NFs::MakeDirectoryRecursive(dir1 / "subdir1" / "subdir2", NFs::FP_COMMON_FILE, false));
@@ -72,202 +72,202 @@ void TFsTest::TestCreateRemove() {
TString longUtf8Name = "";
while (longUtf8Name.size() < 255) {
- longUtf8Name = longUtf8Name + "fф";
- }
+ longUtf8Name = longUtf8Name + "fф";
+ }
UNIT_ASSERT_EQUAL(longUtf8Name.size(), 255);
- TFsPath longfile = dir1 / longUtf8Name;
- Touch(longfile);
-
- UNIT_ASSERT(NFs::Exists(longfile));
- UNIT_ASSERT(NFs::Exists(file1));
- UNIT_ASSERT(NFs::Exists(file2));
- UNIT_ASSERT(NFs::Exists(file3));
- //UNIT_ASSERT(NFs::Exists(link));
-
- UNIT_ASSERT(!NFs::Remove(dir1));
- NFs::RemoveRecursive(dir1);
-
- UNIT_ASSERT(!NFs::Exists(file1));
- UNIT_ASSERT(!NFs::Exists(file2));
- UNIT_ASSERT(!NFs::Exists(file3));
- //UNIT_ASSERT(!NFs::Exists(link));
- UNIT_ASSERT(!NFs::Exists(subdir1));
- UNIT_ASSERT(!NFs::Exists(longfile));
- UNIT_ASSERT(!NFs::Exists(dir1));
-}
-
+ TFsPath longfile = dir1 / longUtf8Name;
+ Touch(longfile);
+
+ UNIT_ASSERT(NFs::Exists(longfile));
+ UNIT_ASSERT(NFs::Exists(file1));
+ UNIT_ASSERT(NFs::Exists(file2));
+ UNIT_ASSERT(NFs::Exists(file3));
+ //UNIT_ASSERT(NFs::Exists(link));
+
+ UNIT_ASSERT(!NFs::Remove(dir1));
+ NFs::RemoveRecursive(dir1);
+
+ UNIT_ASSERT(!NFs::Exists(file1));
+ UNIT_ASSERT(!NFs::Exists(file2));
+ UNIT_ASSERT(!NFs::Exists(file3));
+ //UNIT_ASSERT(!NFs::Exists(link));
+ UNIT_ASSERT(!NFs::Exists(subdir1));
+ UNIT_ASSERT(!NFs::Exists(longfile));
+ UNIT_ASSERT(!NFs::Exists(dir1));
+}
+
void RunRenameTest(TFsPath src, TFsPath dst) {
// if previous running was failed
- TFsPath dir1 = "dir";
- TFsPath dir2 = "dst_dir";
-
- NFs::Remove(src);
- NFs::Remove(dst);
-
- NFs::Remove(dir1 / src);
- NFs::Remove(dir1);
- NFs::Remove(dir2 / src);
- NFs::Remove(dir2);
-
+ TFsPath dir1 = "dir";
+ TFsPath dir2 = "dst_dir";
+
+ NFs::Remove(src);
+ NFs::Remove(dst);
+
+ NFs::Remove(dir1 / src);
+ NFs::Remove(dir1);
+ NFs::Remove(dir2 / src);
+ NFs::Remove(dir2);
+
{
- TFile file(src, CreateNew | WrOnly);
+ TFile file(src, CreateNew | WrOnly);
file.Write("123", 3);
}
UNIT_ASSERT(NFs::Rename(src, dst));
- UNIT_ASSERT(NFs::Exists(dst));
- UNIT_ASSERT(!NFs::Exists(src));
-
+ UNIT_ASSERT(NFs::Exists(dst));
+ UNIT_ASSERT(!NFs::Exists(src));
+
{
- TFile file(dst, OpenExisting);
+ TFile file(dst, OpenExisting);
UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 3);
}
-
- NFs::MakeDirectory(dir1);
+
+ NFs::MakeDirectory(dir1);
{
- TFile file(dir1 / src, CreateNew | WrOnly);
- file.Write("123", 3);
- }
+ TFile file(dir1 / src, CreateNew | WrOnly);
+ file.Write("123", 3);
+ }
UNIT_ASSERT(NFs::Rename(dir1, dir2));
- UNIT_ASSERT(NFs::Exists(dir2 / src));
- UNIT_ASSERT(!NFs::Exists(dir1));
-
- {
- TFile file(dir2 / src, OpenExisting);
- UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 3);
- }
-
+ UNIT_ASSERT(NFs::Exists(dir2 / src));
+ UNIT_ASSERT(!NFs::Exists(dir1));
+
+ {
+ TFile file(dir2 / src, OpenExisting);
+ UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 3);
+ }
+
UNIT_ASSERT(!NFs::Remove(src));
UNIT_ASSERT(NFs::Remove(dst));
UNIT_ASSERT(!NFs::Remove(dir1));
UNIT_ASSERT(NFs::Remove(dir2 / src));
UNIT_ASSERT(NFs::Remove(dir2));
-}
-
+}
+
void TFsTest::TestRename() {
- RunRenameTest("src.txt", "dst.txt");
- RunRenameTest("src_абвг.txt", "dst_абвг.txt");
-}
-
-static void RunHardlinkTest(const TFsPath& src, const TFsPath& dst) {
- NFs::Remove(src);
- NFs::Remove(dst);
-
- {
- TFile file(src, CreateNew | WrOnly);
- file.Write("123", 3);
- }
-
- UNIT_ASSERT(NFs::HardLink(src, dst));
-
- {
- TFile file(dst, OpenExisting | RdOnly);
- UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 3);
- }
- {
- TFile file(src, OpenExisting | WrOnly);
+ RunRenameTest("src.txt", "dst.txt");
+ RunRenameTest("src_абвг.txt", "dst_абвг.txt");
+}
+
+static void RunHardlinkTest(const TFsPath& src, const TFsPath& dst) {
+ NFs::Remove(src);
+ NFs::Remove(dst);
+
+ {
+ TFile file(src, CreateNew | WrOnly);
+ file.Write("123", 3);
+ }
+
+ UNIT_ASSERT(NFs::HardLink(src, dst));
+
+ {
+ TFile file(dst, OpenExisting | RdOnly);
+ UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 3);
+ }
+ {
+ TFile file(src, OpenExisting | WrOnly);
file.Write("1234", 4);
}
{
- TFile file(dst, OpenExisting | RdOnly);
+ TFile file(dst, OpenExisting | RdOnly);
UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 4);
}
{
- TFile file(dst, OpenExisting | WrOnly);
+ TFile file(dst, OpenExisting | WrOnly);
file.Write("12345", 5);
}
-
+
{
- TFile file(src, OpenExisting | RdOnly);
+ TFile file(src, OpenExisting | RdOnly);
UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 5);
}
-
+
UNIT_ASSERT(NFs::Remove(dst));
UNIT_ASSERT(NFs::Remove(src));
}
-void TFsTest::TestHardlink() {
- RunHardlinkTest("tempfile", "hardlinkfile");
- RunHardlinkTest("tempfile_абвг", "hardlinkfile_абвг"); //utf-8 names
-}
-
+void TFsTest::TestHardlink() {
+ RunHardlinkTest("tempfile", "hardlinkfile");
+ RunHardlinkTest("tempfile_абвг", "hardlinkfile_абвг"); //utf-8 names
+}
+
static void RunSymLinkTest(TString fileLocalName, TString symLinkName) {
// if previous running was failed
- TFsPath subDir = "tempsubdir";
- TFsPath srcFile = subDir / fileLocalName;
-
- TFsPath subsubDir1 = subDir / "dir1";
- TFsPath subsubDir2 = subDir / "dir2";
-
- TFsPath linkD1 = "symlinkdir";
- TFsPath linkD2 = subsubDir1 / "linkd2";
- TFsPath dangling = subsubDir1 / "dangling";
-
- NFs::Remove(srcFile);
- NFs::Remove(symLinkName);
- NFs::Remove(linkD2);
- NFs::Remove(dangling);
- NFs::Remove(subsubDir1);
- NFs::Remove(subsubDir2);
- NFs::Remove(subDir);
- NFs::Remove(linkD1);
-
- NFs::MakeDirectory(subDir);
- NFs::MakeDirectory(subsubDir1, NFs::FP_NONSECRET_FILE);
- NFs::MakeDirectory(subsubDir2, NFs::FP_SECRET_FILE);
+ TFsPath subDir = "tempsubdir";
+ TFsPath srcFile = subDir / fileLocalName;
+
+ TFsPath subsubDir1 = subDir / "dir1";
+ TFsPath subsubDir2 = subDir / "dir2";
+
+ TFsPath linkD1 = "symlinkdir";
+ TFsPath linkD2 = subsubDir1 / "linkd2";
+ TFsPath dangling = subsubDir1 / "dangling";
+
+ NFs::Remove(srcFile);
+ NFs::Remove(symLinkName);
+ NFs::Remove(linkD2);
+ NFs::Remove(dangling);
+ NFs::Remove(subsubDir1);
+ NFs::Remove(subsubDir2);
+ NFs::Remove(subDir);
+ NFs::Remove(linkD1);
+
+ NFs::MakeDirectory(subDir);
+ NFs::MakeDirectory(subsubDir1, NFs::FP_NONSECRET_FILE);
+ NFs::MakeDirectory(subsubDir2, NFs::FP_SECRET_FILE);
{
- TFile file(srcFile, CreateNew | WrOnly);
+ TFile file(srcFile, CreateNew | WrOnly);
file.Write("1234567", 7);
}
- UNIT_ASSERT(NFs::SymLink(subDir, linkD1));
- UNIT_ASSERT(NFs::SymLink("../dir2", linkD2));
- UNIT_ASSERT(NFs::SymLink("../dir3", dangling));
+ UNIT_ASSERT(NFs::SymLink(subDir, linkD1));
+ UNIT_ASSERT(NFs::SymLink("../dir2", linkD2));
+ UNIT_ASSERT(NFs::SymLink("../dir3", dangling));
UNIT_ASSERT_STRINGS_EQUAL(NFs::ReadLink(linkD2), TString("..") + LOCSLASH_S "dir2");
UNIT_ASSERT_STRINGS_EQUAL(NFs::ReadLink(dangling), TString("..") + LOCSLASH_S "dir3");
{
- TFile file(linkD1 / fileLocalName, OpenExisting | RdOnly);
+ TFile file(linkD1 / fileLocalName, OpenExisting | RdOnly);
UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 7);
}
- UNIT_ASSERT(NFs::SymLink(srcFile, symLinkName));
+ UNIT_ASSERT(NFs::SymLink(srcFile, symLinkName));
{
- TFile file(symLinkName, OpenExisting | RdOnly);
+ TFile file(symLinkName, OpenExisting | RdOnly);
UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 7);
}
{
- TFileStat fs(linkD1);
+ TFileStat fs(linkD1);
UNIT_ASSERT(!fs.IsFile());
UNIT_ASSERT(fs.IsDir());
UNIT_ASSERT(!fs.IsSymlink());
}
{
- TFileStat fs(linkD1, true);
+ TFileStat fs(linkD1, true);
UNIT_ASSERT(!fs.IsFile());
//UNIT_ASSERT(fs.IsDir()); // failed on unix
UNIT_ASSERT(fs.IsSymlink());
}
{
- TFileStat fs(symLinkName);
+ TFileStat fs(symLinkName);
UNIT_ASSERT(fs.IsFile());
UNIT_ASSERT(!fs.IsDir());
UNIT_ASSERT(!fs.IsSymlink());
UNIT_ASSERT_VALUES_EQUAL(fs.Size, 7u);
}
-
+
{
- TFileStat fs(symLinkName, true);
+ TFileStat fs(symLinkName, true);
//UNIT_ASSERT(fs.IsFile()); // no evidence that symlink has to be a file as well
UNIT_ASSERT(!fs.IsDir());
UNIT_ASSERT(fs.IsSymlink());
}
UNIT_ASSERT(NFs::Remove(symLinkName));
- UNIT_ASSERT(NFs::Exists(srcFile));
-
+ UNIT_ASSERT(NFs::Exists(srcFile));
+
UNIT_ASSERT(NFs::Remove(linkD1));
- UNIT_ASSERT(NFs::Exists(srcFile));
-
+ UNIT_ASSERT(NFs::Exists(srcFile));
+
UNIT_ASSERT(!NFs::Remove(subDir));
-
+
UNIT_ASSERT(NFs::Remove(srcFile));
UNIT_ASSERT(NFs::Remove(linkD2));
UNIT_ASSERT(NFs::Remove(dangling));
@@ -275,51 +275,51 @@ static void RunSymLinkTest(TString fileLocalName, TString symLinkName) {
UNIT_ASSERT(NFs::Remove(subsubDir2));
UNIT_ASSERT(NFs::Remove(subDir));
}
-
+
void TFsTest::TestSymlink() {
- // if previous running was failed
- RunSymLinkTest("f.txt", "fl.txt");
- RunSymLinkTest("f_абвг.txt", "fl_абвг.txt"); //utf-8 names
-}
-
-void TFsTest::TestCwdOpts() {
- TFsPath initialCwd = NFs::CurrentWorkingDirectory();
- TFsPath subdir = "dir_forcwd_абвг";
- NFs::MakeDirectory(subdir, NFs::FP_SECRET_FILE | NFs::FP_ALL_READ);
- NFs::SetCurrentWorkingDirectory(subdir);
- TFsPath newCwd = NFs::CurrentWorkingDirectory();
-
- UNIT_ASSERT_EQUAL(newCwd.Fix(), (initialCwd / subdir).Fix());
-
- NFs::SetCurrentWorkingDirectory("..");
- TFsPath newCwd2 = NFs::CurrentWorkingDirectory();
- UNIT_ASSERT_EQUAL(newCwd2.Fix(), initialCwd.Fix());
- UNIT_ASSERT(NFs::Remove(subdir));
-}
-
-void TFsTest::TestEnsureExists() {
- TFsPath fileExists = "tmp_file_абвг.txt";
- TFsPath nonExists = "tmp2_file_абвг.txt";
- {
- NFs::Remove(fileExists);
- NFs::Remove(nonExists);
- TFile file(fileExists, CreateNew | WrOnly);
- file.Write("1234567", 7);
- }
-
- UNIT_ASSERT_NO_EXCEPTION(NFs::EnsureExists(fileExists));
- UNIT_ASSERT_EXCEPTION(NFs::EnsureExists(nonExists), TFileError);
-
- TStringBuilder expected;
+ // if previous running was failed
+ RunSymLinkTest("f.txt", "fl.txt");
+ RunSymLinkTest("f_абвг.txt", "fl_абвг.txt"); //utf-8 names
+}
+
+void TFsTest::TestCwdOpts() {
+ TFsPath initialCwd = NFs::CurrentWorkingDirectory();
+ TFsPath subdir = "dir_forcwd_абвг";
+ NFs::MakeDirectory(subdir, NFs::FP_SECRET_FILE | NFs::FP_ALL_READ);
+ NFs::SetCurrentWorkingDirectory(subdir);
+ TFsPath newCwd = NFs::CurrentWorkingDirectory();
+
+ UNIT_ASSERT_EQUAL(newCwd.Fix(), (initialCwd / subdir).Fix());
+
+ NFs::SetCurrentWorkingDirectory("..");
+ TFsPath newCwd2 = NFs::CurrentWorkingDirectory();
+ UNIT_ASSERT_EQUAL(newCwd2.Fix(), initialCwd.Fix());
+ UNIT_ASSERT(NFs::Remove(subdir));
+}
+
+void TFsTest::TestEnsureExists() {
+ TFsPath fileExists = "tmp_file_абвг.txt";
+ TFsPath nonExists = "tmp2_file_абвг.txt";
+ {
+ NFs::Remove(fileExists);
+ NFs::Remove(nonExists);
+ TFile file(fileExists, CreateNew | WrOnly);
+ file.Write("1234567", 7);
+ }
+
+ UNIT_ASSERT_NO_EXCEPTION(NFs::EnsureExists(fileExists));
+ UNIT_ASSERT_EXCEPTION(NFs::EnsureExists(nonExists), TFileError);
+
+ TStringBuilder expected;
TString got;
- try {
+ try {
NFs::EnsureExists(nonExists);
expected << __LOCATION__;
- } catch (const TFileError& err) {
- got = err.what();
- }
- UNIT_ASSERT(got.Contains(expected));
- UNIT_ASSERT(got.Contains(NFs::CurrentWorkingDirectory()));
-
- UNIT_ASSERT(NFs::Remove(fileExists));
-}
+ } catch (const TFileError& err) {
+ got = err.what();
+ }
+ UNIT_ASSERT(got.Contains(expected));
+ UNIT_ASSERT(got.Contains(NFs::CurrentWorkingDirectory()));
+
+ UNIT_ASSERT(NFs::Remove(fileExists));
+}
diff --git a/util/system/fs_win.cpp b/util/system/fs_win.cpp
index a410ccac06..8736b8ef00 100644
--- a/util/system/fs_win.cpp
+++ b/util/system/fs_win.cpp
@@ -20,11 +20,11 @@ namespace NFsPrivate {
}
static TString WCHARToUTF8(const LPWSTR wstr, size_t len) {
- static_assert(sizeof(WCHAR) == sizeof(wchar16), "expect sizeof(WCHAR) == sizeof(wchar16)");
-
+ static_assert(sizeof(WCHAR) == sizeof(wchar16), "expect sizeof(WCHAR) == sizeof(wchar16)");
+
return WideToUTF8((wchar16*)wstr, len);
- }
-
+ }
+
HANDLE CreateFileWithUtf8Name(const TStringBuf fName, ui32 accessMode, ui32 shareMode, ui32 createMode, ui32 attributes, bool inheritHandle) {
TUtf16String wstr;
LPCWSTR wname = UTF8ToWCHAR(fName, wstr);
@@ -37,8 +37,8 @@ namespace NFsPrivate {
secAttrs.lpSecurityDescriptor = nullptr;
secAttrs.nLength = sizeof(secAttrs);
return ::CreateFileW(wname, accessMode, shareMode, &secAttrs, createMode, attributes, nullptr);
- }
-
+ }
+
bool WinRename(const TString& oldPath, const TString& newPath) {
TUtf16String op, np;
LPCWSTR opPtr = UTF8ToWCHAR(oldPath, op);
@@ -47,10 +47,10 @@ namespace NFsPrivate {
::SetLastError(ERROR_INVALID_NAME);
return false;
}
-
+
return MoveFileExW(opPtr, npPtr, MOVEFILE_REPLACE_EXISTING) != 0;
}
-
+
bool WinRemove(const TString& path) {
TUtf16String wstr;
LPCWSTR wname = UTF8ToWCHAR(path, wstr);
@@ -67,10 +67,10 @@ namespace NFsPrivate {
return false;
}
-
+
bool WinSymLink(const TString& targetName, const TString& linkName) {
TString tName(targetName);
- {
+ {
size_t pos;
while ((pos = tName.find('/')) != TString::npos)
tName.replace(pos, 1, LOCSLASH_S);
@@ -79,7 +79,7 @@ namespace NFsPrivate {
LPCWSTR wname = UTF8ToWCHAR(tName, tstr);
TUtf16String lstr;
LPCWSTR lname = UTF8ToWCHAR(linkName, lstr);
-
+
// we can't create a dangling link to a dir in this way
ui32 attr = ::GetFileAttributesW(wname);
if (attr == INVALID_FILE_ATTRIBUTES) {
@@ -111,38 +111,38 @@ namespace NFsPrivate {
}
return (CreateHardLinkW(npPtr, epPtr, nullptr) != 0);
- }
-
+ }
+
bool WinExists(const TString& path) {
TUtf16String buf;
LPCWSTR ptr = UTF8ToWCHAR(path, buf);
return ::GetFileAttributesW(ptr) != INVALID_FILE_ATTRIBUTES;
}
-
+
TString WinCurrentWorkingDirectory() {
- TTempBuf result;
- LPWSTR buf = reinterpret_cast<LPWSTR>(result.Data());
- int r = GetCurrentDirectoryW(result.Size() / sizeof(WCHAR), buf);
- if (r == 0)
- throw TIoSystemError() << "failed to GetCurrentDirectory";
- return WCHARToUTF8(buf, r);
- }
-
+ TTempBuf result;
+ LPWSTR buf = reinterpret_cast<LPWSTR>(result.Data());
+ int r = GetCurrentDirectoryW(result.Size() / sizeof(WCHAR), buf);
+ if (r == 0)
+ throw TIoSystemError() << "failed to GetCurrentDirectory";
+ return WCHARToUTF8(buf, r);
+ }
+
bool WinSetCurrentWorkingDirectory(const TString& path) {
TUtf16String wstr;
- LPCWSTR wname = UTF8ToWCHAR(path, wstr);
- if (!wname) {
- ::SetLastError(ERROR_INVALID_NAME);
- return false;
- }
- return SetCurrentDirectoryW(wname);
- }
-
+ LPCWSTR wname = UTF8ToWCHAR(path, wstr);
+ if (!wname) {
+ ::SetLastError(ERROR_INVALID_NAME);
+ return false;
+ }
+ return SetCurrentDirectoryW(wname);
+ }
+
bool WinMakeDirectory(const TString path) {
TUtf16String buf;
- LPCWSTR ptr = UTF8ToWCHAR(path, buf);
- return CreateDirectoryW(ptr, (LPSECURITY_ATTRIBUTES) nullptr);
- }
+ LPCWSTR ptr = UTF8ToWCHAR(path, buf);
+ return CreateDirectoryW(ptr, (LPSECURITY_ATTRIBUTES) nullptr);
+ }
// edited part of <Ntifs.h> from Windows DDK
#define SYMLINK_FLAG_RELATIVE 1
@@ -229,5 +229,5 @@ bool GetObjectId(const char* path, GUID* id) {
return false;
}
*/
-
+
}
diff --git a/util/system/fs_win.h b/util/system/fs_win.h
index 8086129828..7fdab7c198 100644
--- a/util/system/fs_win.h
+++ b/util/system/fs_win.h
@@ -8,22 +8,22 @@
namespace NFsPrivate {
bool WinRename(const TString& oldPath, const TString& newPath);
-
+
bool WinSymLink(const TString& targetName, const TString& linkName);
-
+
bool WinHardLink(const TString& existingPath, const TString& newPath);
-
+
TString WinReadLink(const TString& path);
-
+
HANDLE CreateFileWithUtf8Name(const TStringBuf fName, ui32 accessMode, ui32 shareMode, ui32 createMode, ui32 attributes, bool inheritHandle);
-
+
bool WinRemove(const TString& path);
-
+
bool WinExists(const TString& path);
-
+
TString WinCurrentWorkingDirectory();
-
+
bool WinSetCurrentWorkingDirectory(const TString& path);
-
+
bool WinMakeDirectory(const TString path);
}
diff --git a/util/system/fstat_ut.cpp b/util/system/fstat_ut.cpp
index 160ecd936e..040cacbb09 100644
--- a/util/system/fstat_ut.cpp
+++ b/util/system/fstat_ut.cpp
@@ -3,8 +3,8 @@
#include "sysstat.h"
#include "fs.h"
-#include <library/cpp/testing/unittest/registar.h>
-#include <library/cpp/testing/unittest/tests_data.h>
+#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/tests_data.h>
#include <util/folder/path.h>
diff --git a/util/system/getpid_ut.cpp b/util/system/getpid_ut.cpp
index e7122a2971..fb0d42ef76 100644
--- a/util/system/getpid_ut.cpp
+++ b/util/system/getpid_ut.cpp
@@ -1,6 +1,6 @@
#include "getpid.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
class TGetPidTest: public TTestBase {
UNIT_TEST_SUITE(TGetPidTest);
diff --git a/util/system/guard_ut.cpp b/util/system/guard_ut.cpp
index 404ede99ab..6f18e9a5ee 100644
--- a/util/system/guard_ut.cpp
+++ b/util/system/guard_ut.cpp
@@ -1,7 +1,7 @@
#include "guard.h"
#include "rwlock.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/thread/pool.h>
diff --git a/util/system/hi_lo_ut.cpp b/util/system/hi_lo_ut.cpp
index 850c12327d..8610fbb9fd 100644
--- a/util/system/hi_lo_ut.cpp
+++ b/util/system/hi_lo_ut.cpp
@@ -1,6 +1,6 @@
#include <util/system/hi_lo.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "defaults.h"
diff --git a/util/system/hostname_ut.cpp b/util/system/hostname_ut.cpp
index fb1cb7dde4..009c4f8064 100644
--- a/util/system/hostname_ut.cpp
+++ b/util/system/hostname_ut.cpp
@@ -1,6 +1,6 @@
#include "hostname.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(THostNameTest) {
Y_UNIT_TEST(Test1) {
diff --git a/util/system/info_ut.cpp b/util/system/info_ut.cpp
index ad7449f8f4..5b2dd00460 100644
--- a/util/system/info_ut.cpp
+++ b/util/system/info_ut.cpp
@@ -1,6 +1,6 @@
#include "info.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
class TSysInfoTest: public TTestBase {
UNIT_TEST_SUITE(TSysInfoTest);
diff --git a/util/system/interrupt_signals_ut.cpp b/util/system/interrupt_signals_ut.cpp
index bec54fec61..0dda781cea 100644
--- a/util/system/interrupt_signals_ut.cpp
+++ b/util/system/interrupt_signals_ut.cpp
@@ -4,7 +4,7 @@
#include <util/datetime/base.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#ifdef _win_
#include <windows.h>
diff --git a/util/system/mem_info_ut.cpp b/util/system/mem_info_ut.cpp
index a1100ba646..864aff9cd4 100644
--- a/util/system/mem_info_ut.cpp
+++ b/util/system/mem_info_ut.cpp
@@ -1,6 +1,6 @@
#include "mem_info.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "info.h"
diff --git a/util/system/mincore_ut.cpp b/util/system/mincore_ut.cpp
index fc46cb1632..39fe7fd91a 100644
--- a/util/system/mincore_ut.cpp
+++ b/util/system/mincore_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#ifdef _unix_
#include <sys/resource.h>
diff --git a/util/system/mlock.cpp b/util/system/mlock.cpp
index 435338c98f..a47f94a993 100644
--- a/util/system/mlock.cpp
+++ b/util/system/mlock.cpp
@@ -54,27 +54,27 @@ void UnlockMemory(const void* addr, size_t len) {
void LockAllMemory(ELockAllMemoryFlags flags) {
Y_UNUSED(flags);
-#if defined(_android_)
+#if defined(_android_)
// unimplemented
-#elif defined(_cygwin_)
+#elif defined(_cygwin_)
// unimplemented
-#elif defined(_unix_)
- int sys_flags = 0;
+#elif defined(_unix_)
+ int sys_flags = 0;
if (flags & LockCurrentMemory) {
- sys_flags |= MCL_CURRENT;
- }
+ sys_flags |= MCL_CURRENT;
+ }
if (flags & LockFutureMemory) {
- sys_flags |= MCL_FUTURE;
- }
+ sys_flags |= MCL_FUTURE;
+ }
if (flags & LockMemoryOnFault) {
sys_flags |= MCL_ONFAULT;
}
- if (mlockall(sys_flags)) {
- ythrow yexception() << LastSystemErrorText();
- }
-#endif
-}
-
+ if (mlockall(sys_flags)) {
+ ythrow yexception() << LastSystemErrorText();
+ }
+#endif
+}
+
void UnlockAllMemory() {
#if defined(_cygwin_)
// unimplemented
diff --git a/util/system/mlock.h b/util/system/mlock.h
index f021c0fe67..389f65570d 100644
--- a/util/system/mlock.h
+++ b/util/system/mlock.h
@@ -22,10 +22,10 @@ enum ELockAllMemoryFlag {
/** Since Linux 4.4, with LockCurrentMemory or LockFutureMemory or both, lock only pages that are or once they are present in memory. */
LockMemoryOnFault = 4,
-};
+};
Y_DECLARE_FLAGS(ELockAllMemoryFlags, ELockAllMemoryFlag)
Y_DECLARE_OPERATORS_FOR_FLAGS(ELockAllMemoryFlags)
-
+
/**
* Performs provided locking operation.
*
@@ -34,7 +34,7 @@ Y_DECLARE_OPERATORS_FOR_FLAGS(ELockAllMemoryFlags)
* \param flags Locking operation to perform.
*/
void LockAllMemory(ELockAllMemoryFlags flags);
-
+
/**
* Unlocks whatever was locked with a previous call to `LockAllMemory`.
*
diff --git a/util/system/mutex_ut.cpp b/util/system/mutex_ut.cpp
index c8d7caafa1..b7509dfe35 100644
--- a/util/system/mutex_ut.cpp
+++ b/util/system/mutex_ut.cpp
@@ -1,7 +1,7 @@
#include "mutex.h"
#include "atomic.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/thread/pool.h>
#include <util/random/random.h>
diff --git a/util/system/nice_ut.cpp b/util/system/nice_ut.cpp
index ae0051f285..5a49c0355a 100644
--- a/util/system/nice_ut.cpp
+++ b/util/system/nice_ut.cpp
@@ -2,7 +2,7 @@
#include "platform.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#ifdef _unix_
#include <sys/resource.h>
diff --git a/util/system/pipe_ut.cpp b/util/system/pipe_ut.cpp
index 6d53432de8..7bd6ed0c57 100644
--- a/util/system/pipe_ut.cpp
+++ b/util/system/pipe_ut.cpp
@@ -1,6 +1,6 @@
#include "pipe.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TPipeTest) {
Y_UNIT_TEST(TestPipe) {
diff --git a/util/system/platform_ut.cpp b/util/system/platform_ut.cpp
index 9bfbce8315..aa2abf593e 100644
--- a/util/system/platform_ut.cpp
+++ b/util/system/platform_ut.cpp
@@ -1,6 +1,6 @@
#include "platform.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
class TPlatformTest: public TTestBase {
UNIT_TEST_SUITE(TPlatformTest);
diff --git a/util/system/progname_ut.cpp b/util/system/progname_ut.cpp
index 11f3d9308b..7b740c8730 100644
--- a/util/system/progname_ut.cpp
+++ b/util/system/progname_ut.cpp
@@ -1,6 +1,6 @@
#include "progname.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TProgramNameTest) {
Y_UNIT_TEST(TestIt) {
diff --git a/util/system/rusage_ut.cpp b/util/system/rusage_ut.cpp
index 0d4e0fe54b..ee0308c0cf 100644
--- a/util/system/rusage_ut.cpp
+++ b/util/system/rusage_ut.cpp
@@ -1,6 +1,6 @@
#include "rusage.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TRusageTest) {
Y_UNIT_TEST(TestRusage) {
diff --git a/util/system/rwlock_ut.cpp b/util/system/rwlock_ut.cpp
index 2b384c05b3..b9484a9ac1 100644
--- a/util/system/rwlock_ut.cpp
+++ b/util/system/rwlock_ut.cpp
@@ -1,7 +1,7 @@
#include "rwlock.h"
#include "atomic.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/thread/pool.h>
#include <util/random/random.h>
diff --git a/util/system/sanitizers_ut.cpp b/util/system/sanitizers_ut.cpp
index 5de096e14b..e6fd50c9a2 100644
--- a/util/system/sanitizers_ut.cpp
+++ b/util/system/sanitizers_ut.cpp
@@ -1,7 +1,7 @@
#include "sanitizers.h"
#include "sys_alloc.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(Sanitizers) {
Y_UNIT_TEST(MarkAsIntentionallyLeaked) {
diff --git a/util/system/shellcommand.cpp b/util/system/shellcommand.cpp
index b1989b5c8c..ffe294a2d6 100644
--- a/util/system/shellcommand.cpp
+++ b/util/system/shellcommand.cpp
@@ -717,7 +717,7 @@ void TShellCommand::TImpl::OnFork(TPipes& pipes, sigset_t oldmask, char* const*
}
if (WorkDir.size()) {
- NFs::SetCurrentWorkingDirectory(WorkDir);
+ NFs::SetCurrentWorkingDirectory(WorkDir);
}
if (CloseAllFdsOnExec) {
diff --git a/util/system/shellcommand_ut.cpp b/util/system/shellcommand_ut.cpp
index 9d849279d2..982cf4438c 100644
--- a/util/system/shellcommand_ut.cpp
+++ b/util/system/shellcommand_ut.cpp
@@ -6,8 +6,8 @@
#include "sigset.h"
#include "spinlock.h"
-#include <library/cpp/testing/unittest/env.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/env.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/folder/dirut.h>
#include <util/random/random.h>
@@ -315,7 +315,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
UNIT_ASSERT(cmd.GetExitCode().Defined() && -15 == cmd.GetExitCode());
}
sleep(1);
- UNIT_ASSERT(!NFs::Exists(tmpfile));
+ UNIT_ASSERT(!NFs::Exists(tmpfile));
}
// this ut is unix-only (win has no signal mask)
Y_UNIT_TEST(TestSignalMask) {
@@ -346,7 +346,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
UNIT_ASSERT(TShellCommand::SHELL_ERROR == cmd.GetStatus() || TShellCommand::SHELL_FINISHED == cmd.GetStatus());
}
sleep(1);
- UNIT_ASSERT(!NFs::Exists(tmpfile));
+ UNIT_ASSERT(!NFs::Exists(tmpfile));
// child proc should receive SIGTERM
options.SetClearSignalMask(true);
@@ -362,7 +362,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
UNIT_ASSERT(TShellCommand::SHELL_ERROR == cmd.GetStatus());
}
sleep(1);
- UNIT_ASSERT(!NFs::Exists(tmpfile));
+ UNIT_ASSERT(!NFs::Exists(tmpfile));
// restore signal mask
rc = SigProcMask(SIG_SETMASK, &oldmask, nullptr);
diff --git a/util/system/shmat_ut.cpp b/util/system/shmat_ut.cpp
index 9d92243ae7..f465593e5f 100644
--- a/util/system/shmat_ut.cpp
+++ b/util/system/shmat_ut.cpp
@@ -1,6 +1,6 @@
#include "shmat.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TTestSharedMemory) {
Y_UNIT_TEST(TestInProc) {
diff --git a/util/system/spinlock_ut.cpp b/util/system/spinlock_ut.cpp
index e8639a6404..c24bf92d45 100644
--- a/util/system/spinlock_ut.cpp
+++ b/util/system/spinlock_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "spinlock.h"
diff --git a/util/system/src_location_ut.cpp b/util/system/src_location_ut.cpp
index 5b86cb86ef..26036c2eb4 100644
--- a/util/system/src_location_ut.cpp
+++ b/util/system/src_location_ut.cpp
@@ -2,7 +2,7 @@
#include <util/string/builder.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
static inline TString GenLoc() {
return TStringBuilder() << __LOCATION__;
diff --git a/util/system/src_root_ut.cpp b/util/system/src_root_ut.cpp
index e9a675eb9a..d232aa8b71 100644
--- a/util/system/src_root_ut.cpp
+++ b/util/system/src_root_ut.cpp
@@ -1,13 +1,13 @@
#include "src_root.h"
#include <util/folder/pathsplit.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TestSourceRoot) {
Y_UNIT_TEST(TestStrip) {
// Reconstruct() converts "\" -> "/" on Windows
const TString path = TPathSplit(__SOURCE_FILE_IMPL__.As<TStringBuf>()).Reconstruct();
- UNIT_ASSERT_EQUAL(path, "util" LOCSLASH_S "system" LOCSLASH_S "src_root_ut.cpp");
+ UNIT_ASSERT_EQUAL(path, "util" LOCSLASH_S "system" LOCSLASH_S "src_root_ut.cpp");
}
Y_UNIT_TEST(TestPrivateChopPrefixRoutine) {
diff --git a/util/system/tempfile_ut.cpp b/util/system/tempfile_ut.cpp
index e4a0923d0b..aba7268060 100644
--- a/util/system/tempfile_ut.cpp
+++ b/util/system/tempfile_ut.cpp
@@ -1,6 +1,6 @@
#include "tempfile.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/folder/dirut.h>
#include <util/generic/yexception.h>
@@ -18,7 +18,7 @@ Y_UNIT_TEST_SUITE(TTempFileHandle) {
tmp.FlushData();
UNIT_ASSERT_STRINGS_EQUAL(TUnbufferedFileInput(tmp.Name()).ReadAll(), "hello world\n");
}
- UNIT_ASSERT(!NFs::Exists(path));
+ UNIT_ASSERT(!NFs::Exists(path));
}
Y_UNIT_TEST(InCurrentDir) {
diff --git a/util/system/thread_ut.cpp b/util/system/thread_ut.cpp
index d820898fd5..3d5c0ac15e 100644
--- a/util/system/thread_ut.cpp
+++ b/util/system/thread_ut.cpp
@@ -1,6 +1,6 @@
#include "thread.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <atomic>
diff --git a/util/system/tls.h b/util/system/tls.h
index 3c4f56dbeb..6742d2dba6 100644
--- a/util/system/tls.h
+++ b/util/system/tls.h
@@ -269,7 +269,7 @@ namespace NTls {
THolder<void> mem(::operator new(sizeof(T)));
THolder<T> newval(Constructor_->Construct(mem.Get()));
- Y_UNUSED(mem.Release());
+ Y_UNUSED(mem.Release());
Key_.Set((void*)newval.Get());
val = newval.Release();
}
diff --git a/util/system/tls_ut.cpp b/util/system/tls_ut.cpp
index e84d34b42a..c2d87b3a35 100644
--- a/util/system/tls_ut.cpp
+++ b/util/system/tls_ut.cpp
@@ -1,7 +1,7 @@
#include "tls.h"
#include "thread.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TTestTLS) {
struct X {
diff --git a/util/system/type_name_ut.cpp b/util/system/type_name_ut.cpp
index 86597f4232..deff6c5268 100644
--- a/util/system/type_name_ut.cpp
+++ b/util/system/type_name_ut.cpp
@@ -1,6 +1,6 @@
#include "type_name.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/yexception.h>
#include <util/generic/fwd.h>
diff --git a/util/system/types_ut.cpp b/util/system/types_ut.cpp
index 19e40cef46..0412c0c678 100644
--- a/util/system/types_ut.cpp
+++ b/util/system/types_ut.cpp
@@ -1,6 +1,6 @@
#include "types.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TestTypes) {
Y_UNIT_TEST(TestScanf) {
diff --git a/util/system/unaligned_mem_ut.cpp b/util/system/unaligned_mem_ut.cpp
index 9de3f3e931..48c547dc5c 100644
--- a/util/system/unaligned_mem_ut.cpp
+++ b/util/system/unaligned_mem_ut.cpp
@@ -1,7 +1,7 @@
#include "unaligned_mem.h"
-#include <library/cpp/testing/benchmark/bench.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/benchmark/bench.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/system/compiler.h>
diff --git a/util/system/user_ut.cpp b/util/system/user_ut.cpp
index 4f8a5ce2ef..ec86c2b490 100644
--- a/util/system/user_ut.cpp
+++ b/util/system/user_ut.cpp
@@ -1,6 +1,6 @@
#include "user.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(TestUser) {
Y_UNIT_TEST(TestNotEmpty) {
diff --git a/util/system/ut/ya.make b/util/system/ut/ya.make
index 127e7c261e..4b6dd01cdf 100644
--- a/util/system/ut/ya.make
+++ b/util/system/ut/ya.make
@@ -20,7 +20,7 @@ IF (OS_DARWIN)
ENDIF()
PEERDIR(
- library/cpp/testing/benchmark
+ library/cpp/testing/benchmark
)
SRCS(
diff --git a/util/system/yassert.h b/util/system/yassert.h
index 529823440c..831fbbd3d5 100644
--- a/util/system/yassert.h
+++ b/util/system/yassert.h
@@ -2,7 +2,7 @@
#include "defaults.h"
#include "src_root.h"
-#include "backtrace.h"
+#include "backtrace.h"
#if defined(_MSC_VER)
#include <new>
@@ -55,7 +55,7 @@ inline void YaDebugBreak() {
}
#undef Y_ASSERT
-
+
#if !defined(NDEBUG) && !defined(__GCCXML__)
#define Y_ASSERT(a) \
do { \
diff --git a/util/system/yassert_ut.cpp b/util/system/yassert_ut.cpp
index ddd392666c..6c1da535a4 100644
--- a/util/system/yassert_ut.cpp
+++ b/util/system/yassert_ut.cpp
@@ -2,7 +2,7 @@
// yassert.h must be included before all headers
#include "yassert.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(YassertTest) {
Y_UNIT_TEST(TestAcsLikeFunctionCall) {
diff --git a/util/thread/factory_ut.cpp b/util/thread/factory_ut.cpp
index 647d96c901..d9a38c5e0e 100644
--- a/util/thread/factory_ut.cpp
+++ b/util/thread/factory_ut.cpp
@@ -1,7 +1,7 @@
#include "factory.h"
#include "pool.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
class TThrPoolTest: public TTestBase {
UNIT_TEST_SUITE(TThrPoolTest);
diff --git a/util/thread/lfqueue.h b/util/thread/lfqueue.h
index ab523631e4..8d7e6aaa4b 100644
--- a/util/thread/lfqueue.h
+++ b/util/thread/lfqueue.h
@@ -385,12 +385,12 @@ public:
inline void Enqueue(TRef& t) {
Queue.Enqueue(t.Get());
- Y_UNUSED(t.Release());
+ Y_UNUSED(t.Release());
}
inline void Enqueue(TRef&& t) {
Queue.Enqueue(t.Get());
- Y_UNUSED(t.Release());
+ Y_UNUSED(t.Release());
}
inline bool IsEmpty() {
diff --git a/util/thread/lfqueue_ut.cpp b/util/thread/lfqueue_ut.cpp
index 83bca100cf..57ad8b4c34 100644
--- a/util/thread/lfqueue_ut.cpp
+++ b/util/thread/lfqueue_ut.cpp
@@ -1,5 +1,5 @@
-#include <library/cpp/threading/future/future.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/threading/future/future.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/algorithm.h>
#include <util/generic/vector.h>
diff --git a/util/thread/lfstack_ut.cpp b/util/thread/lfstack_ut.cpp
index e20a838f95..b392648ec6 100644
--- a/util/thread/lfstack_ut.cpp
+++ b/util/thread/lfstack_ut.cpp
@@ -2,9 +2,9 @@
#include <util/system/atomic.h>
#include <util/system/event.h>
#include <util/generic/deque.h>
-#include <library/cpp/threading/future/legacy_future.h>
+#include <library/cpp/threading/future/legacy_future.h>
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "lfstack.h"
diff --git a/util/thread/pool.cpp b/util/thread/pool.cpp
index 05fad02e9b..b5343e85be 100644
--- a/util/thread/pool.cpp
+++ b/util/thread/pool.cpp
@@ -671,7 +671,7 @@ bool IThreadPool::AddAndOwn(THolder<IObjectInQueue> obj) {
auto owner = MakeHolder<TOwnedObjectInQueue>(std::move(obj));
bool added = Add(owner.Get());
if (added) {
- Y_UNUSED(owner.Release());
+ Y_UNUSED(owner.Release());
}
return added;
}
diff --git a/util/thread/pool_ut.cpp b/util/thread/pool_ut.cpp
index 893770d0c4..5b16095a58 100644
--- a/util/thread/pool_ut.cpp
+++ b/util/thread/pool_ut.cpp
@@ -1,6 +1,6 @@
#include "pool.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/stream/output.h>
#include <util/random/fast.h>
diff --git a/util/thread/singleton_ut.cpp b/util/thread/singleton_ut.cpp
index 164b1cc184..8740bca949 100644
--- a/util/thread/singleton_ut.cpp
+++ b/util/thread/singleton_ut.cpp
@@ -1,4 +1,4 @@
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include "singleton.h"
diff --git a/util/ysaveload_ut.cpp b/util/ysaveload_ut.cpp
index 723c68f391..22016b9db3 100644
--- a/util/ysaveload_ut.cpp
+++ b/util/ysaveload_ut.cpp
@@ -1,6 +1,6 @@
#include "ysaveload.h"
-#include <library/cpp/testing/unittest/registar.h>
+#include <library/cpp/testing/unittest/registar.h>
#include <util/memory/pool.h>
#include <util/stream/buffer.h>