diff options
| author | tobo <[email protected]> | 2022-02-10 16:47:27 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:47:27 +0300 | 
| commit | 7fe839092527589b38f014d854c51565b3c1adfa (patch) | |
| tree | 309e97022d3530044b712b8f71318c78faf7856e | |
| parent | d0d68c395c10da4cb56a1c845504570a04d7893e (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
451 files changed, 3977 insertions, 3977 deletions
diff --git a/build/plugins/_common.py b/build/plugins/_common.py index 2f831a94db6..bcc8c5e5c0d 100644 --- a/build/plugins/_common.py +++ b/build/plugins/_common.py @@ -1,6 +1,6 @@  import sys  import hashlib -import base64 +import base64   class Result(object): @@ -22,7 +22,7 @@ def lazy(func):  def pathid(path): -    return base64.b32encode(hashlib.md5(path).digest()).lower().strip('=') +    return base64.b32encode(hashlib.md5(path).digest()).lower().strip('=')   def listid(l): diff --git a/build/plugins/res.py b/build/plugins/res.py index a937caba816..65419725934 100644 --- a/build/plugins/res.py +++ b/build/plugins/res.py @@ -41,7 +41,7 @@ def onfat_resource(unit, *args):      # we make several calls of rescompiler      # https://msdn.microsoft.com/ru-ru/library/windows/desktop/ms682425.aspx      for part_args in split(args, 8000): -        output = listid(part_args) + '.cpp' +        output = listid(part_args) + '.cpp'           inputs = [x for x, y in iterpair(part_args) if x != '-']          if inputs:              inputs = ['IN'] + inputs diff --git a/build/scripts/build_catboost.py b/build/scripts/build_catboost.py index 78334fc5f76..b5694069e77 100755 --- a/build/scripts/build_catboost.py +++ b/build/scripts/build_catboost.py @@ -1,71 +1,71 @@ -import sys -import os -import shutil -import re -import subprocess - -def get_value(val): -    dct = val.split('=', 1) -    if len(dct) > 1: -        return dct[1] -    return '' - - -class BuildCbBase(object): -    def run(self, cbmodel, cbname, cb_cpp_path): - -        data_prefix = "CB_External_" -        data = data_prefix + cbname -        datasize = data + "Size" - -        cbtype = "const NCatboostCalcer::TCatboostCalcer" -        cbload = "(ReadModel({0}, {1}, EModelType::CatboostBinary))".format(data, datasize) - -        cb_cpp_tmp_path = cb_cpp_path + ".tmp" -        cb_cpp_tmp = open(cb_cpp_tmp_path, 'w') - -        cb_cpp_tmp.write("#include <kernel/catboost/catboost_calcer.h>\n") - -        ro_data_path = os.path.dirname(cb_cpp_path) + "/" + data_prefix + cbname + ".rodata" -        cb_cpp_tmp.write("namespace{\n") -        cb_cpp_tmp.write("    extern \"C\" {\n") -        cb_cpp_tmp.write("        extern const unsigned char {1}{0}[];\n".format(cbname, data_prefix)) -        cb_cpp_tmp.write("        extern const ui32 {1}{0}Size;\n".format(cbname, data_prefix)) -        cb_cpp_tmp.write("    }\n") -        cb_cpp_tmp.write("}\n") -        archiverCall = subprocess.Popen([self.archiver, "-q", "-p", "-o", ro_data_path, cbmodel], stdout=None, stderr=subprocess.PIPE) -        archiverCall.wait() -        cb_cpp_tmp.write("extern {0} {1};\n".format(cbtype, cbname)) -        cb_cpp_tmp.write("{0} {1}{2};".format(cbtype, cbname, cbload)) -        cb_cpp_tmp.close() -        shutil.move(cb_cpp_tmp_path, cb_cpp_path) - -class BuildCb(BuildCbBase): -    def run(self, argv): -        if len(argv) < 5: -            print >>sys.stderr, "BuildCb.Run(<ARCADIA_ROOT> <archiver> <mninfo> <mnname> <cppOutput> [params...])" -            sys.exit(1) - -        self.SrcRoot = argv[0] -        self.archiver = argv[1] -        cbmodel = argv[2] -        cbname = argv[3] -        cb_cpp_path = argv[4] - -        super(BuildCb, self).run(cbmodel, cbname, cb_cpp_path) - - -def build_cb_f(argv): -    build_cb = BuildCb() -    build_cb.run(argv) - - -if __name__ == '__main__': -    if len(sys.argv) < 2: -        print >>sys.stderr, "Usage: build_cb.py <funcName> <args...>" -        sys.exit(1) - -    if (sys.argv[2:]): -        globals()[sys.argv[1]](sys.argv[2:]) -    else: -        globals()[sys.argv[1]]() +import sys  +import os  +import shutil  +import re  +import subprocess  +  +def get_value(val):  +    dct = val.split('=', 1)  +    if len(dct) > 1:  +        return dct[1]  +    return ''  +  +  +class BuildCbBase(object):  +    def run(self, cbmodel, cbname, cb_cpp_path):  +  +        data_prefix = "CB_External_"  +        data = data_prefix + cbname  +        datasize = data + "Size"  +  +        cbtype = "const NCatboostCalcer::TCatboostCalcer"  +        cbload = "(ReadModel({0}, {1}, EModelType::CatboostBinary))".format(data, datasize)  +  +        cb_cpp_tmp_path = cb_cpp_path + ".tmp"  +        cb_cpp_tmp = open(cb_cpp_tmp_path, 'w')  +  +        cb_cpp_tmp.write("#include <kernel/catboost/catboost_calcer.h>\n")  +  +        ro_data_path = os.path.dirname(cb_cpp_path) + "/" + data_prefix + cbname + ".rodata"  +        cb_cpp_tmp.write("namespace{\n")  +        cb_cpp_tmp.write("    extern \"C\" {\n")  +        cb_cpp_tmp.write("        extern const unsigned char {1}{0}[];\n".format(cbname, data_prefix))  +        cb_cpp_tmp.write("        extern const ui32 {1}{0}Size;\n".format(cbname, data_prefix))  +        cb_cpp_tmp.write("    }\n")  +        cb_cpp_tmp.write("}\n")  +        archiverCall = subprocess.Popen([self.archiver, "-q", "-p", "-o", ro_data_path, cbmodel], stdout=None, stderr=subprocess.PIPE)  +        archiverCall.wait()  +        cb_cpp_tmp.write("extern {0} {1};\n".format(cbtype, cbname))  +        cb_cpp_tmp.write("{0} {1}{2};".format(cbtype, cbname, cbload))  +        cb_cpp_tmp.close()  +        shutil.move(cb_cpp_tmp_path, cb_cpp_path)  +  +class BuildCb(BuildCbBase):  +    def run(self, argv):  +        if len(argv) < 5:  +            print >>sys.stderr, "BuildCb.Run(<ARCADIA_ROOT> <archiver> <mninfo> <mnname> <cppOutput> [params...])"  +            sys.exit(1)  +  +        self.SrcRoot = argv[0]  +        self.archiver = argv[1]  +        cbmodel = argv[2]  +        cbname = argv[3]  +        cb_cpp_path = argv[4]  +  +        super(BuildCb, self).run(cbmodel, cbname, cb_cpp_path)  +  +  +def build_cb_f(argv):  +    build_cb = BuildCb()  +    build_cb.run(argv)  +  +  +if __name__ == '__main__':  +    if len(sys.argv) < 2:  +        print >>sys.stderr, "Usage: build_cb.py <funcName> <args...>"  +        sys.exit(1)  +  +    if (sys.argv[2:]):  +        globals()[sys.argv[1]](sys.argv[2:])  +    else:  +        globals()[sys.argv[1]]()  diff --git a/build/scripts/gen_yql_python_udf.py b/build/scripts/gen_yql_python_udf.py index 13b58981170..643b594411a 100644 --- a/build/scripts/gen_yql_python_udf.py +++ b/build/scripts/gen_yql_python_udf.py @@ -18,7 +18,7 @@ LIBRA_MODULE(TLibraModule, "Libra@MODULE_NAME@");  #endif  extern "C" UDF_API void Register(IRegistrator& registrator, ui32 flags) { -    RegisterYqlPythonUdf(registrator, flags, TStringBuf("@MODULE_NAME@"), TStringBuf("@PACKAGE_NAME@"), EPythonFlavor::@FLAVOR@); +    RegisterYqlPythonUdf(registrator, flags, TStringBuf("@MODULE_NAME@"), TStringBuf("@PACKAGE_NAME@"), EPythonFlavor::@FLAVOR@);   #if @WITH_LIBRA@      RegisterHelper<TLibraModule>(registrator);  #endif diff --git a/build/ymake.core.conf b/build/ymake.core.conf index 081833998b8..d028fd4431f 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -410,7 +410,7 @@ when ($USE_ARCADIA_PYTHON == "no") {  }  # tag:allocator -DEFAULT_ALLOCATOR=LF +DEFAULT_ALLOCATOR=LF   # tag:allocator  when ($OS_ANDROID == "yes" || $MSVC == "yes") { @@ -1234,18 +1234,18 @@ module _BASE_UNIT: _BARE_UNIT {          }      } -    when ($USE_THINLTO == "yes") { -        when ($GCC) { -            CFLAGS+=-flto=thin -            LDFLAGS+=-flto=thin -        } -        when ($CLANG) { -            CFLAGS+=-flto=thin -            LDFLAGS+=-flto=thin -        } -    } - - +    when ($USE_THINLTO == "yes") {  +        when ($GCC) {  +            CFLAGS+=-flto=thin  +            LDFLAGS+=-flto=thin  +        }  +        when ($CLANG) {  +            CFLAGS+=-flto=thin  +            LDFLAGS+=-flto=thin  +        }  +    }  +  +       when ($CLANG) {          when ($PGO_ADD == "yes") {              CFLAGS+=-fprofile-instr-generate diff --git a/contrib/libs/cctz/tzdata/factory.cpp b/contrib/libs/cctz/tzdata/factory.cpp index 5a4b4a27b67..954a9a48c1c 100644 --- a/contrib/libs/cctz/tzdata/factory.cpp +++ b/contrib/libs/cctz/tzdata/factory.cpp @@ -19,7 +19,7 @@ namespace cctz_extension {          public:              static std::unique_ptr<cctz::ZoneInfoSource> LoadZone(const std::string& zoneName) { -                TString resourceName = TStringBuilder() << "/cctz/tzdata/"sv << zoneName; +                TString resourceName = TStringBuilder() << "/cctz/tzdata/"sv << zoneName;                   TString tzData;                  if (!NResource::FindExact(resourceName, &tzData)) {                      return nullptr; diff --git a/contrib/libs/zstd/CHANGELOG b/contrib/libs/zstd/CHANGELOG index 4e0045b950c..9dba31576d6 100644 --- a/contrib/libs/zstd/CHANGELOG +++ b/contrib/libs/zstd/CHANGELOG @@ -191,37 +191,37 @@ doc : Improved beginner CONTRIBUTING.md docs  doc : New issue templates for zstd  v1.4.4  (Nov 6, 2019) -perf: Improved decompression speed, by > 10%, by @terrelln -perf: Better compression speed when re-using a context, by @felixhandte -perf: Fix compression ratio when compressing large files with small dictionary, by @senhuang42 -perf: zstd reference encoder can generate RLE blocks, by @bimbashrestha -perf: minor generic speed optimization, by @davidbolvansky -api: new ability to extract sequences from the parser for analysis, by @bimbashrestha -api: fixed decoding of magic-less frames, by @terrelln -api: fixed ZSTD_initCStream_advanced() performance with fast modes, reported by @QrczakMK -cli: Named pipes support, by @bimbashrestha -cli: short tar's extension support, by @stokito -cli: command --output-dir-flat= , generates target files into requested directory, by @senhuang42 -cli: commands --stream-size=# and --size-hint=#, by @nmagerko -cli: command --exclude-compressed, by @shashank0791 -cli: faster `-t` test mode -cli: improved some error messages, by @vangyzen +perf: Improved decompression speed, by > 10%, by @terrelln  +perf: Better compression speed when re-using a context, by @felixhandte  +perf: Fix compression ratio when compressing large files with small dictionary, by @senhuang42  +perf: zstd reference encoder can generate RLE blocks, by @bimbashrestha  +perf: minor generic speed optimization, by @davidbolvansky  +api: new ability to extract sequences from the parser for analysis, by @bimbashrestha  +api: fixed decoding of magic-less frames, by @terrelln  +api: fixed ZSTD_initCStream_advanced() performance with fast modes, reported by @QrczakMK  +cli: Named pipes support, by @bimbashrestha  +cli: short tar's extension support, by @stokito  +cli: command --output-dir-flat= , generates target files into requested directory, by @senhuang42  +cli: commands --stream-size=# and --size-hint=#, by @nmagerko  +cli: command --exclude-compressed, by @shashank0791  +cli: faster `-t` test mode  +cli: improved some error messages, by @vangyzen   cli: fix command `-D dictionary` on Windows, reported by @artyompetrov  cli: fix rare deadlock condition within dictionary builder, by @terrelln -build: single-file decoder with emscripten compilation script, by @cwoffenden -build: fixed zlibWrapper compilation on Visual Studio, reported by @bluenlive -build: fixed deprecation warning for certain gcc version, reported by @jasonma163 -build: fix compilation on old gcc versions, by @cemeyer -build: improved installation directories for cmake script, by Dmitri Shubin -pack: modified pkgconfig, for better integration into openwrt, requested by @neheb -misc: Improved documentation : ZSTD_CLEVEL, DYNAMIC_BMI2, ZSTD_CDict, function deprecation, zstd format -misc: fixed educational decoder : accept larger literals section, and removed UNALIGNED() macro - +build: single-file decoder with emscripten compilation script, by @cwoffenden  +build: fixed zlibWrapper compilation on Visual Studio, reported by @bluenlive  +build: fixed deprecation warning for certain gcc version, reported by @jasonma163  +build: fix compilation on old gcc versions, by @cemeyer  +build: improved installation directories for cmake script, by Dmitri Shubin  +pack: modified pkgconfig, for better integration into openwrt, requested by @neheb  +misc: Improved documentation : ZSTD_CLEVEL, DYNAMIC_BMI2, ZSTD_CDict, function deprecation, zstd format  +misc: fixed educational decoder : accept larger literals section, and removed UNALIGNED() macro  +   v1.4.3  (Aug 20, 2019) -bug: Fix Dictionary Compression Ratio Regression by @cyan4973 (#1709) -bug: Fix Buffer Overflow in legacy v0.3 decompression by @felixhandte (#1722) -build: Add support for IAR C/C++ Compiler for Arm by @joseph0918 (#1705) - +bug: Fix Dictionary Compression Ratio Regression by @cyan4973 (#1709)  +bug: Fix Buffer Overflow in legacy v0.3 decompression by @felixhandte (#1722)  +build: Add support for IAR C/C++ Compiler for Arm by @joseph0918 (#1705)  +   v1.4.2  (Jul 26, 2019)  bug: Fix bug in zstd-0.5 decoder by @terrelln (#1696)  bug: Fix seekable decompression in-memory API by @iburinoc (#1695) diff --git a/contrib/libs/zstd/README.md b/contrib/libs/zstd/README.md index 69720ba2ccf..e883c752622 100644 --- a/contrib/libs/zstd/README.md +++ b/contrib/libs/zstd/README.md @@ -150,7 +150,7 @@ You can also take a look at [`.travis.yml`](.travis.yml) file for an  example about how Meson is used to build this project.  Note that default build type is **release**. - +   ### VCPKG  You can build and install zstd [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager: @@ -164,18 +164,18 @@ The zstd port in vcpkg is kept up to date by Microsoft team members and communit  If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.  ### Visual Studio (Windows) - +   Going into `build` directory, you will find additional possibilities:  - Projects for Visual Studio 2005, 2008 and 2010.    + VS2010 project is compatible with VS2012, VS2013, VS2015 and VS2017.  - Automated build scripts for Visual compiler by [@KrzysFR](https://github.com/KrzysFR), in `build/VS_scripts`,    which will build `zstd` cli and `libzstd` library without any need to open Visual Studio solution. - +   ### Buck - +   You can build the zstd binary via buck by executing: `buck build programs:zstd` from the root of the repo.  The output binary will be in `buck-out/gen/programs/`. - +   ## Testing  You can run quick local smoke tests by executing the `playTest.sh` script from the `src/tests` directory. diff --git a/contrib/libs/zstd/lib/README.md b/contrib/libs/zstd/lib/README.md index 4c9d8f05912..c155e30c3fe 100644 --- a/contrib/libs/zstd/lib/README.md +++ b/contrib/libs/zstd/lib/README.md @@ -179,7 +179,7 @@ The compiled executable will require ZSTD DLL which is available at `dll\libzstd  #### Advanced Build options - +   The build system requires a hash function in order to  separate object files created with different compilation flags.  By default, it tries to use `md5sum` or equivalent. @@ -199,15 +199,15 @@ In which case, the hash function doesn't matter.  #### Deprecated API - +   Obsolete API on their way out are stored in directory `lib/deprecated`.  At this stage, it contains older streaming prototypes, in `lib/deprecated/zbuff.h`.  These prototypes will be removed in some future version.  Consider migrating code towards supported streaming API exposed in `zstd.h`. - - +  +   #### Miscellaneous - +   The other files are not source code. There are :   - `BUCK` : support for `buck` build system (https://buckbuild.com/) diff --git a/contrib/libs/zstd/lib/common/bitstream.h b/contrib/libs/zstd/lib/common/bitstream.h index 84b6062ff35..0383d00ddf5 100644 --- a/contrib/libs/zstd/lib/common/bitstream.h +++ b/contrib/libs/zstd/lib/common/bitstream.h @@ -155,9 +155,9 @@ MEM_STATIC unsigned BIT_highbit32 (U32 val)              }  #       endif  #   elif defined(__GNUC__) && (__GNUC__ >= 3)   /* Use GCC Intrinsic */ -        return __builtin_clz (val) ^ 31; -#   elif defined(__ICCARM__)    /* IAR Intrinsic */ -        return 31 - __CLZ(val); +        return __builtin_clz (val) ^ 31;  +#   elif defined(__ICCARM__)    /* IAR Intrinsic */  +        return 31 - __CLZ(val);   #   else   /* Software version */          static const unsigned DeBruijnClz[32] = { 0,  9,  1, 10, 13, 21,  2, 29,                                                   11, 14, 16, 18, 22, 25,  3, 30, @@ -235,7 +235,7 @@ MEM_STATIC void BIT_flushBitsFast(BIT_CStream_t* bitC)  {      size_t const nbBytes = bitC->bitPos >> 3;      assert(bitC->bitPos < sizeof(bitC->bitContainer) * 8); -    assert(bitC->ptr <= bitC->endPtr); +    assert(bitC->ptr <= bitC->endPtr);       MEM_writeLEST(bitC->ptr, bitC->bitContainer);      bitC->ptr += nbBytes;      bitC->bitPos &= 7; @@ -251,7 +251,7 @@ MEM_STATIC void BIT_flushBits(BIT_CStream_t* bitC)  {      size_t const nbBytes = bitC->bitPos >> 3;      assert(bitC->bitPos < sizeof(bitC->bitContainer) * 8); -    assert(bitC->ptr <= bitC->endPtr); +    assert(bitC->ptr <= bitC->endPtr);       MEM_writeLEST(bitC->ptr, bitC->bitContainer);      bitC->ptr += nbBytes;      if (bitC->ptr > bitC->endPtr) bitC->ptr = bitC->endPtr; diff --git a/contrib/libs/zstd/lib/common/compiler.h b/contrib/libs/zstd/lib/common/compiler.h index 516930c01ec..c14ccccba0a 100644 --- a/contrib/libs/zstd/lib/common/compiler.h +++ b/contrib/libs/zstd/lib/common/compiler.h @@ -25,7 +25,7 @@  #  define INLINE_KEYWORD  #endif -#if defined(__GNUC__) || defined(__ICCARM__) +#if defined(__GNUC__) || defined(__ICCARM__)   #  define FORCE_INLINE_ATTR __attribute__((always_inline))  #elif defined(_MSC_VER)  #  define FORCE_INLINE_ATTR __forceinline @@ -74,18 +74,18 @@  #  define HINT_INLINE static INLINE_KEYWORD FORCE_INLINE_ATTR  #endif -/* UNUSED_ATTR tells the compiler it is okay if the function is unused. */ -#if defined(__GNUC__) -#  define UNUSED_ATTR __attribute__((unused)) -#else -#  define UNUSED_ATTR -#endif - +/* UNUSED_ATTR tells the compiler it is okay if the function is unused. */  +#if defined(__GNUC__)  +#  define UNUSED_ATTR __attribute__((unused))  +#else  +#  define UNUSED_ATTR  +#endif  +   /* force no inlining */  #ifdef _MSC_VER  #  define FORCE_NOINLINE static __declspec(noinline)  #else -#  if defined(__GNUC__) || defined(__ICCARM__) +#  if defined(__GNUC__) || defined(__ICCARM__)   #    define FORCE_NOINLINE static __attribute__((__noinline__))  #  else  #    define FORCE_NOINLINE static @@ -94,7 +94,7 @@  /* target attribute */ -#if defined(__GNUC__) || defined(__ICCARM__) +#if defined(__GNUC__) || defined(__ICCARM__)   #  define TARGET_ATTRIBUTE(target) __attribute__((__target__(target)))  #else  #  define TARGET_ATTRIBUTE(target) @@ -139,15 +139,15 @@      }                                     \  } -/* vectorization +/* vectorization    * older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax,   * and some compilers, like Intel ICC and MCST LCC, do not support it at all. */  #if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && !defined(__LCC__) -#  if (__GNUC__ == 4 && __GNUC_MINOR__ > 3) || (__GNUC__ >= 5) -#    define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize"))) -#  else -#    define DONT_VECTORIZE _Pragma("GCC optimize(\"no-tree-vectorize\")") -#  endif +#  if (__GNUC__ == 4 && __GNUC_MINOR__ > 3) || (__GNUC__ >= 5)  +#    define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize")))  +#  else  +#    define DONT_VECTORIZE _Pragma("GCC optimize(\"no-tree-vectorize\")")  +#  endif   #else  #  define DONT_VECTORIZE  #endif diff --git a/contrib/libs/zstd/lib/common/pool.c b/contrib/libs/zstd/lib/common/pool.c index 2e37cdd73c8..67d3bd8562c 100644 --- a/contrib/libs/zstd/lib/common/pool.c +++ b/contrib/libs/zstd/lib/common/pool.c @@ -133,13 +133,13 @@ POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize,      ctx->queueTail = 0;      ctx->numThreadsBusy = 0;      ctx->queueEmpty = 1; -    { -        int error = 0; -        error |= ZSTD_pthread_mutex_init(&ctx->queueMutex, NULL); -        error |= ZSTD_pthread_cond_init(&ctx->queuePushCond, NULL); -        error |= ZSTD_pthread_cond_init(&ctx->queuePopCond, NULL); -        if (error) { POOL_free(ctx); return NULL; } -    } +    {  +        int error = 0;  +        error |= ZSTD_pthread_mutex_init(&ctx->queueMutex, NULL);  +        error |= ZSTD_pthread_cond_init(&ctx->queuePushCond, NULL);  +        error |= ZSTD_pthread_cond_init(&ctx->queuePopCond, NULL);  +        if (error) { POOL_free(ctx); return NULL; }  +    }       ctx->shutdown = 0;      /* Allocate space for the thread handles */      ctx->threads = (ZSTD_pthread_t*)ZSTD_customMalloc(numThreads * sizeof(ZSTD_pthread_t), customMem); diff --git a/contrib/libs/zstd/lib/common/threading.c b/contrib/libs/zstd/lib/common/threading.c index 92cf57c195a..05497ead62f 100644 --- a/contrib/libs/zstd/lib/common/threading.c +++ b/contrib/libs/zstd/lib/common/threading.c @@ -15,8 +15,8 @@   * This file will hold wrapper for systems, which do not support pthreads   */ -#include "threading.h" - +#include "threading.h"  +   /* create fake symbol to avoid empty translation unit warning */  int g_ZSTD_threading_useless_symbol; @@ -75,48 +75,48 @@ int ZSTD_pthread_join(ZSTD_pthread_t thread, void **value_ptr)  }  #endif   /* ZSTD_MULTITHREAD */ - -#if defined(ZSTD_MULTITHREAD) && DEBUGLEVEL >= 1 && !defined(_WIN32) - +  +#if defined(ZSTD_MULTITHREAD) && DEBUGLEVEL >= 1 && !defined(_WIN32)  +   #define ZSTD_DEPS_NEED_MALLOC  #include "zstd_deps.h" - -int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* mutex, pthread_mutexattr_t const* attr) -{ +  +int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* mutex, pthread_mutexattr_t const* attr)  +{       *mutex = (pthread_mutex_t*)ZSTD_malloc(sizeof(pthread_mutex_t)); -    if (!*mutex) -        return 1; -    return pthread_mutex_init(*mutex, attr); -} - -int ZSTD_pthread_mutex_destroy(ZSTD_pthread_mutex_t* mutex) -{ -    if (!*mutex) -        return 0; -    { -        int const ret = pthread_mutex_destroy(*mutex); +    if (!*mutex)  +        return 1;  +    return pthread_mutex_init(*mutex, attr);  +}  +  +int ZSTD_pthread_mutex_destroy(ZSTD_pthread_mutex_t* mutex)  +{  +    if (!*mutex)  +        return 0;  +    {  +        int const ret = pthread_mutex_destroy(*mutex);           ZSTD_free(*mutex); -        return ret; -    } -} - -int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* cond, pthread_condattr_t const* attr) -{ +        return ret;  +    }  +}  +  +int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* cond, pthread_condattr_t const* attr)  +{       *cond = (pthread_cond_t*)ZSTD_malloc(sizeof(pthread_cond_t)); -    if (!*cond) -        return 1; -    return pthread_cond_init(*cond, attr); -} - -int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond) -{ -    if (!*cond) -        return 0; -    { -        int const ret = pthread_cond_destroy(*cond); +    if (!*cond)  +        return 1;  +    return pthread_cond_init(*cond, attr);  +}  +  +int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond)  +{  +    if (!*cond)  +        return 0;  +    {  +        int const ret = pthread_cond_destroy(*cond);           ZSTD_free(*cond); -        return ret; -    } -} - -#endif +        return ret;  +    }  +}  +  +#endif  diff --git a/contrib/libs/zstd/lib/common/threading.h b/contrib/libs/zstd/lib/common/threading.h index fd0060d5aa2..e9dba89412e 100644 --- a/contrib/libs/zstd/lib/common/threading.h +++ b/contrib/libs/zstd/lib/common/threading.h @@ -14,8 +14,8 @@  #ifndef THREADING_H_938743  #define THREADING_H_938743 -#include "debug.h" - +#include "debug.h"  +   #if defined (__cplusplus)  extern "C" {  #endif @@ -78,12 +78,12 @@ int ZSTD_pthread_join(ZSTD_pthread_t thread, void** value_ptr);   */ -#elif defined(ZSTD_MULTITHREAD)    /* posix assumed ; need a better detection method */ +#elif defined(ZSTD_MULTITHREAD)    /* posix assumed ; need a better detection method */   /* ===   POSIX Systems   === */  #  include <pthread.h> -#if DEBUGLEVEL < 1 - +#if DEBUGLEVEL < 1  +   #define ZSTD_pthread_mutex_t            pthread_mutex_t  #define ZSTD_pthread_mutex_init(a, b)   pthread_mutex_init((a), (b))  #define ZSTD_pthread_mutex_destroy(a)   pthread_mutex_destroy((a)) @@ -101,33 +101,33 @@ int ZSTD_pthread_join(ZSTD_pthread_t thread, void** value_ptr);  #define ZSTD_pthread_create(a, b, c, d) pthread_create((a), (b), (c), (d))  #define ZSTD_pthread_join(a, b)         pthread_join((a),(b)) -#else /* DEBUGLEVEL >= 1 */ - -/* Debug implementation of threading. - * In this implementation we use pointers for mutexes and condition variables. - * This way, if we forget to init/destroy them the program will crash or ASAN - * will report leaks. - */ - -#define ZSTD_pthread_mutex_t            pthread_mutex_t* -int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* mutex, pthread_mutexattr_t const* attr); -int ZSTD_pthread_mutex_destroy(ZSTD_pthread_mutex_t* mutex); -#define ZSTD_pthread_mutex_lock(a)      pthread_mutex_lock(*(a)) -#define ZSTD_pthread_mutex_unlock(a)    pthread_mutex_unlock(*(a)) - -#define ZSTD_pthread_cond_t             pthread_cond_t* -int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* cond, pthread_condattr_t const* attr); -int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond); -#define ZSTD_pthread_cond_wait(a, b)    pthread_cond_wait(*(a), *(b)) -#define ZSTD_pthread_cond_signal(a)     pthread_cond_signal(*(a)) -#define ZSTD_pthread_cond_broadcast(a)  pthread_cond_broadcast(*(a)) - -#define ZSTD_pthread_t                  pthread_t -#define ZSTD_pthread_create(a, b, c, d) pthread_create((a), (b), (c), (d)) -#define ZSTD_pthread_join(a, b)         pthread_join((a),(b)) - -#endif - +#else /* DEBUGLEVEL >= 1 */  +  +/* Debug implementation of threading.  + * In this implementation we use pointers for mutexes and condition variables.  + * This way, if we forget to init/destroy them the program will crash or ASAN  + * will report leaks.  + */  +  +#define ZSTD_pthread_mutex_t            pthread_mutex_t*  +int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* mutex, pthread_mutexattr_t const* attr);  +int ZSTD_pthread_mutex_destroy(ZSTD_pthread_mutex_t* mutex);  +#define ZSTD_pthread_mutex_lock(a)      pthread_mutex_lock(*(a))  +#define ZSTD_pthread_mutex_unlock(a)    pthread_mutex_unlock(*(a))  +  +#define ZSTD_pthread_cond_t             pthread_cond_t*  +int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* cond, pthread_condattr_t const* attr);  +int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond);  +#define ZSTD_pthread_cond_wait(a, b)    pthread_cond_wait(*(a), *(b))  +#define ZSTD_pthread_cond_signal(a)     pthread_cond_signal(*(a))  +#define ZSTD_pthread_cond_broadcast(a)  pthread_cond_broadcast(*(a))  +  +#define ZSTD_pthread_t                  pthread_t  +#define ZSTD_pthread_create(a, b, c, d) pthread_create((a), (b), (c), (d))  +#define ZSTD_pthread_join(a, b)         pthread_join((a),(b))  +  +#endif  +   #else  /* ZSTD_MULTITHREAD not defined */  /* No multithreading support */ diff --git a/contrib/libs/zstd/lib/common/zstd_internal.h b/contrib/libs/zstd/lib/common/zstd_internal.h index 1dee37cdbe0..adb235592e1 100644 --- a/contrib/libs/zstd/lib/common/zstd_internal.h +++ b/contrib/libs/zstd/lib/common/zstd_internal.h @@ -198,43 +198,43 @@ static void ZSTD_copy16(void* dst, const void* src) {  }  #define COPY16(d,s) { ZSTD_copy16(d,s); d+=16; s+=16; } -#define WILDCOPY_OVERLENGTH 32 -#define WILDCOPY_VECLEN 16 +#define WILDCOPY_OVERLENGTH 32  +#define WILDCOPY_VECLEN 16   typedef enum {      ZSTD_no_overlap, -    ZSTD_overlap_src_before_dst +    ZSTD_overlap_src_before_dst       /*  ZSTD_overlap_dst_before_src, */  } ZSTD_overlap_e;  /*! ZSTD_wildcopy() :   *  Custom version of ZSTD_memcpy(), can over read/write up to WILDCOPY_OVERLENGTH bytes (if length==0) - *  @param ovtype controls the overlap detection - *         - ZSTD_no_overlap: The source and destination are guaranteed to be at least WILDCOPY_VECLEN bytes apart. - *         - ZSTD_overlap_src_before_dst: The src and dst may overlap, but they MUST be at least 8 bytes apart. - *           The src buffer must be before the dst buffer. - */ + *  @param ovtype controls the overlap detection  + *         - ZSTD_no_overlap: The source and destination are guaranteed to be at least WILDCOPY_VECLEN bytes apart.  + *         - ZSTD_overlap_src_before_dst: The src and dst may overlap, but they MUST be at least 8 bytes apart.  + *           The src buffer must be before the dst buffer.  + */   MEM_STATIC FORCE_INLINE_ATTR -void ZSTD_wildcopy(void* dst, const void* src, ptrdiff_t length, ZSTD_overlap_e const ovtype) +void ZSTD_wildcopy(void* dst, const void* src, ptrdiff_t length, ZSTD_overlap_e const ovtype)   {      ptrdiff_t diff = (BYTE*)dst - (const BYTE*)src;      const BYTE* ip = (const BYTE*)src;      BYTE* op = (BYTE*)dst;      BYTE* const oend = op + length; -    if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) { -        /* Handle short offset copies. */ -        do { -            COPY8(op, ip) -        } while (op < oend); -    } else { -        assert(diff >= WILDCOPY_VECLEN || diff <= -WILDCOPY_VECLEN); +    if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) {  +        /* Handle short offset copies. */  +        do {  +            COPY8(op, ip)  +        } while (op < oend);  +    } else {  +        assert(diff >= WILDCOPY_VECLEN || diff <= -WILDCOPY_VECLEN);           /* Separate out the first COPY16() call because the copy length is -         * almost certain to be short, so the branches have different +         * almost certain to be short, so the branches have different            * probabilities. Since it is almost certain to be short, only do           * one COPY16() in the first call. Then, do two calls per loop since           * at that point it is more likely to have a high trip count. -         */ +         */   #ifdef __aarch64__          do {              COPY16(op, ip); @@ -245,11 +245,11 @@ void ZSTD_wildcopy(void* dst, const void* src, ptrdiff_t length, ZSTD_overlap_e          if (16 >= length) return;          op += 16;          ip += 16; -        do { -            COPY16(op, ip); -            COPY16(op, ip); -        } -        while (op < oend); +        do {  +            COPY16(op, ip);  +            COPY16(op, ip);  +        }  +        while (op < oend);   #endif      }  } @@ -378,9 +378,9 @@ MEM_STATIC U32 ZSTD_highbit32(U32 val)   /* compress, dictBuilder, decodeCorpus              }  #       endif  #   elif defined(__GNUC__) && (__GNUC__ >= 3)   /* GCC Intrinsic */ -        return __builtin_clz (val) ^ 31; -#   elif defined(__ICCARM__)    /* IAR Intrinsic */ -        return 31 - __CLZ(val); +        return __builtin_clz (val) ^ 31;  +#   elif defined(__ICCARM__)    /* IAR Intrinsic */  +        return 31 - __CLZ(val);   #   else   /* Software version */          static const U32 DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 };          U32 v = val; diff --git a/contrib/libs/zstd/lib/compress/zstd_compress.c b/contrib/libs/zstd/lib/compress/zstd_compress.c index f06456af926..2a6ca5f2b8a 100644 --- a/contrib/libs/zstd/lib/compress/zstd_compress.c +++ b/contrib/libs/zstd/lib/compress/zstd_compress.c @@ -76,13 +76,13 @@ struct ZSTD_CDict_s {      const void* dictContent;      size_t dictContentSize;      ZSTD_dictContentType_e dictContentType; /* The dictContentType the CDict was created with */ -    U32* entropyWorkspace; /* entropy workspace of HUF_WORKSPACE_SIZE bytes */ -    ZSTD_cwksp workspace; +    U32* entropyWorkspace; /* entropy workspace of HUF_WORKSPACE_SIZE bytes */  +    ZSTD_cwksp workspace;       ZSTD_matchState_t matchState;      ZSTD_compressedBlockState_t cBlockState;      ZSTD_customMem customMem;      U32 dictID; -    int compressionLevel; /* 0 indicates that advanced API was used to select CDict params */ +    int compressionLevel; /* 0 indicates that advanced API was used to select CDict params */       ZSTD_paramSwitch_e useRowMatchFinder; /* Indicates whether the CDict was created with params that would use                                             * row-based matchfinder. Unless the cdict is reloaded, we will use                                             * the same greedy/lazy matchfinder at compression time. @@ -120,23 +120,23 @@ ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem)  ZSTD_CCtx* ZSTD_initStaticCCtx(void* workspace, size_t workspaceSize)  { -    ZSTD_cwksp ws; -    ZSTD_CCtx* cctx; +    ZSTD_cwksp ws;  +    ZSTD_CCtx* cctx;       if (workspaceSize <= sizeof(ZSTD_CCtx)) return NULL;  /* minimum size */      if ((size_t)workspace & 7) return NULL;  /* must be 8-aligned */      ZSTD_cwksp_init(&ws, workspace, workspaceSize, ZSTD_cwksp_static_alloc); - -    cctx = (ZSTD_CCtx*)ZSTD_cwksp_reserve_object(&ws, sizeof(ZSTD_CCtx)); +  +    cctx = (ZSTD_CCtx*)ZSTD_cwksp_reserve_object(&ws, sizeof(ZSTD_CCtx));       if (cctx == NULL) return NULL;      ZSTD_memset(cctx, 0, sizeof(ZSTD_CCtx)); -    ZSTD_cwksp_move(&cctx->workspace, &ws); +    ZSTD_cwksp_move(&cctx->workspace, &ws);       cctx->staticSize = workspaceSize;      /* statically sized space. entropyWorkspace never moves (but prev/next block swap places) */      if (!ZSTD_cwksp_check_available(&cctx->workspace, ENTROPY_WORKSPACE_SIZE + 2 * sizeof(ZSTD_compressedBlockState_t))) return NULL; -    cctx->blockState.prevCBlock = (ZSTD_compressedBlockState_t*)ZSTD_cwksp_reserve_object(&cctx->workspace, sizeof(ZSTD_compressedBlockState_t)); -    cctx->blockState.nextCBlock = (ZSTD_compressedBlockState_t*)ZSTD_cwksp_reserve_object(&cctx->workspace, sizeof(ZSTD_compressedBlockState_t)); +    cctx->blockState.prevCBlock = (ZSTD_compressedBlockState_t*)ZSTD_cwksp_reserve_object(&cctx->workspace, sizeof(ZSTD_compressedBlockState_t));  +    cctx->blockState.nextCBlock = (ZSTD_compressedBlockState_t*)ZSTD_cwksp_reserve_object(&cctx->workspace, sizeof(ZSTD_compressedBlockState_t));       cctx->entropyWorkspace = (U32*)ZSTD_cwksp_reserve_object(&cctx->workspace, ENTROPY_WORKSPACE_SIZE);      cctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid());      return cctx; @@ -169,7 +169,7 @@ static void ZSTD_freeCCtxContent(ZSTD_CCtx* cctx)  #ifdef ZSTD_MULTITHREAD      ZSTDMT_freeCCtx(cctx->mtctx); cctx->mtctx = NULL;  #endif -    ZSTD_cwksp_free(&cctx->workspace, cctx->customMem); +    ZSTD_cwksp_free(&cctx->workspace, cctx->customMem);   }  size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx) @@ -177,13 +177,13 @@ size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx)      if (cctx==NULL) return 0;   /* support free on NULL */      RETURN_ERROR_IF(cctx->staticSize, memory_allocation,                      "not compatible with static CCtx"); -    { -        int cctxInWorkspace = ZSTD_cwksp_owns_buffer(&cctx->workspace, cctx); -        ZSTD_freeCCtxContent(cctx); -        if (!cctxInWorkspace) { +    {  +        int cctxInWorkspace = ZSTD_cwksp_owns_buffer(&cctx->workspace, cctx);  +        ZSTD_freeCCtxContent(cctx);  +        if (!cctxInWorkspace) {               ZSTD_customFree(cctx, cctx->customMem); -        } -    } +        }  +    }       return 0;  } @@ -202,9 +202,9 @@ static size_t ZSTD_sizeof_mtctx(const ZSTD_CCtx* cctx)  size_t ZSTD_sizeof_CCtx(const ZSTD_CCtx* cctx)  {      if (cctx==NULL) return 0;   /* support sizeof on NULL */ -    /* cctx may be in the workspace */ -    return (cctx->workspace.workspace == cctx ? 0 : sizeof(*cctx)) -           + ZSTD_cwksp_sizeof(&cctx->workspace) +    /* cctx may be in the workspace */  +    return (cctx->workspace.workspace == cctx ? 0 : sizeof(*cctx))  +           + ZSTD_cwksp_sizeof(&cctx->workspace)              + ZSTD_sizeof_localDict(cctx->localDict)             + ZSTD_sizeof_mtctx(cctx);  } @@ -522,7 +522,7 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param)      case ZSTD_c_forceAttachDict:          ZSTD_STATIC_ASSERT(ZSTD_dictDefaultAttach < ZSTD_dictForceLoad);          bounds.lowerBound = ZSTD_dictDefaultAttach; -        bounds.upperBound = ZSTD_dictForceLoad;       /* note : how to ensure at compile time that this is the highest value enum ? */ +        bounds.upperBound = ZSTD_dictForceLoad;       /* note : how to ensure at compile time that this is the highest value enum ? */           return bounds;      case ZSTD_c_literalCompressionMode: @@ -536,11 +536,11 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param)          bounds.upperBound = ZSTD_TARGETCBLOCKSIZE_MAX;          return bounds; -    case ZSTD_c_srcSizeHint: -        bounds.lowerBound = ZSTD_SRCSIZEHINT_MIN; -        bounds.upperBound = ZSTD_SRCSIZEHINT_MAX; -        return bounds; - +    case ZSTD_c_srcSizeHint:  +        bounds.lowerBound = ZSTD_SRCSIZEHINT_MIN;  +        bounds.upperBound = ZSTD_SRCSIZEHINT_MAX;  +        return bounds;  +       case ZSTD_c_stableInBuffer:      case ZSTD_c_stableOutBuffer:          bounds.lowerBound = (int)ZSTD_bm_buffered; @@ -628,7 +628,7 @@ static int ZSTD_isUpdateAuthorized(ZSTD_cParameter param)      case ZSTD_c_forceAttachDict:      case ZSTD_c_literalCompressionMode:      case ZSTD_c_targetCBlockSize: -    case ZSTD_c_srcSizeHint: +    case ZSTD_c_srcSizeHint:       case ZSTD_c_stableInBuffer:      case ZSTD_c_stableOutBuffer:      case ZSTD_c_blockDelimiters: @@ -683,7 +683,7 @@ size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int value)      case ZSTD_c_ldmMinMatch:      case ZSTD_c_ldmBucketSizeLog:      case ZSTD_c_targetCBlockSize: -    case ZSTD_c_srcSizeHint: +    case ZSTD_c_srcSizeHint:       case ZSTD_c_stableInBuffer:      case ZSTD_c_stableOutBuffer:      case ZSTD_c_blockDelimiters: @@ -715,33 +715,33 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams,              CCtxParams->compressionLevel = ZSTD_CLEVEL_DEFAULT; /* 0 == default */          else              CCtxParams->compressionLevel = value; -        if (CCtxParams->compressionLevel >= 0) return (size_t)CCtxParams->compressionLevel; +        if (CCtxParams->compressionLevel >= 0) return (size_t)CCtxParams->compressionLevel;           return 0;  /* return type (size_t) cannot represent negative values */      }      case ZSTD_c_windowLog :          if (value!=0)   /* 0 => use default */              BOUNDCHECK(ZSTD_c_windowLog, value); -        CCtxParams->cParams.windowLog = (U32)value; +        CCtxParams->cParams.windowLog = (U32)value;           return CCtxParams->cParams.windowLog;      case ZSTD_c_hashLog :          if (value!=0)   /* 0 => use default */              BOUNDCHECK(ZSTD_c_hashLog, value); -        CCtxParams->cParams.hashLog = (U32)value; +        CCtxParams->cParams.hashLog = (U32)value;           return CCtxParams->cParams.hashLog;      case ZSTD_c_chainLog :          if (value!=0)   /* 0 => use default */              BOUNDCHECK(ZSTD_c_chainLog, value); -        CCtxParams->cParams.chainLog = (U32)value; +        CCtxParams->cParams.chainLog = (U32)value;           return CCtxParams->cParams.chainLog;      case ZSTD_c_searchLog :          if (value!=0)   /* 0 => use default */              BOUNDCHECK(ZSTD_c_searchLog, value); -        CCtxParams->cParams.searchLog = (U32)value; -        return (size_t)value; +        CCtxParams->cParams.searchLog = (U32)value;  +        return (size_t)value;       case ZSTD_c_minMatch :          if (value!=0)   /* 0 => use default */ @@ -876,12 +876,12 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams,          CCtxParams->targetCBlockSize = value;          return CCtxParams->targetCBlockSize; -    case ZSTD_c_srcSizeHint : -        if (value!=0)    /* 0 ==> default */ -            BOUNDCHECK(ZSTD_c_srcSizeHint, value); -        CCtxParams->srcSizeHint = value; -        return CCtxParams->srcSizeHint; - +    case ZSTD_c_srcSizeHint :  +        if (value!=0)    /* 0 ==> default */  +            BOUNDCHECK(ZSTD_c_srcSizeHint, value);  +        CCtxParams->srcSizeHint = value;  +        return CCtxParams->srcSizeHint;  +       case ZSTD_c_stableInBuffer:          BOUNDCHECK(ZSTD_c_stableInBuffer, value);          CCtxParams->inBufferMode = (ZSTD_bufferMode_e)value; @@ -1025,9 +1025,9 @@ size_t ZSTD_CCtxParams_getParameter(      case ZSTD_c_targetCBlockSize :          *value = (int)CCtxParams->targetCBlockSize;          break; -    case ZSTD_c_srcSizeHint : -        *value = (int)CCtxParams->srcSizeHint; -        break; +    case ZSTD_c_srcSizeHint :  +        *value = (int)CCtxParams->srcSizeHint;  +        break;       case ZSTD_c_stableInBuffer :          *value = (int)CCtxParams->inBufferMode;          break; @@ -1401,10 +1401,10 @@ static void ZSTD_overrideCParams(  ZSTD_compressionParameters ZSTD_getCParamsFromCCtxParams(          const ZSTD_CCtx_params* CCtxParams, U64 srcSizeHint, size_t dictSize, ZSTD_cParamMode_e mode)  { -    ZSTD_compressionParameters cParams; -    if (srcSizeHint == ZSTD_CONTENTSIZE_UNKNOWN && CCtxParams->srcSizeHint > 0) { -      srcSizeHint = CCtxParams->srcSizeHint; -    } +    ZSTD_compressionParameters cParams;  +    if (srcSizeHint == ZSTD_CONTENTSIZE_UNKNOWN && CCtxParams->srcSizeHint > 0) {  +      srcSizeHint = CCtxParams->srcSizeHint;  +    }       cParams = ZSTD_getCParams_internal(CCtxParams->compressionLevel, srcSizeHint, dictSize, mode);      if (CCtxParams->ldmParams.enableLdm == ZSTD_ps_enable) cParams.windowLog = ZSTD_LDM_DEFAULT_WINDOW_LOG;      ZSTD_overrideCParams(&cParams, &CCtxParams->cParams); @@ -1425,13 +1425,13 @@ ZSTD_sizeof_matchState(const ZSTD_compressionParameters* const cParams,                                  : 0;      size_t const hSize = ((size_t)1) << cParams->hashLog;      U32    const hashLog3 = (forCCtx && cParams->minMatch==3) ? MIN(ZSTD_HASHLOG3_MAX, cParams->windowLog) : 0; -    size_t const h3Size = hashLog3 ? ((size_t)1) << hashLog3 : 0; -    /* We don't use ZSTD_cwksp_alloc_size() here because the tables aren't -     * surrounded by redzones in ASAN. */ -    size_t const tableSpace = chainSize * sizeof(U32) -                            + hSize * sizeof(U32) -                            + h3Size * sizeof(U32); -    size_t const optPotentialSpace = +    size_t const h3Size = hashLog3 ? ((size_t)1) << hashLog3 : 0;  +    /* We don't use ZSTD_cwksp_alloc_size() here because the tables aren't  +     * surrounded by redzones in ASAN. */  +    size_t const tableSpace = chainSize * sizeof(U32)  +                            + hSize * sizeof(U32)  +                            + h3Size * sizeof(U32);  +    size_t const optPotentialSpace =           ZSTD_cwksp_aligned_alloc_size((MaxML+1) * sizeof(U32))        + ZSTD_cwksp_aligned_alloc_size((MaxLL+1) * sizeof(U32))        + ZSTD_cwksp_aligned_alloc_size((MaxOff+1) * sizeof(U32)) @@ -1689,42 +1689,42 @@ static void ZSTD_invalidateMatchState(ZSTD_matchState_t* ms)      ms->dictMatchState = NULL;  } -/** - * Controls, for this matchState reset, whether the tables need to be cleared / - * prepared for the coming compression (ZSTDcrp_makeClean), or whether the - * tables can be left unclean (ZSTDcrp_leaveDirty), because we know that a - * subsequent operation will overwrite the table space anyways (e.g., copying - * the matchState contents in from a CDict). - */ -typedef enum { -    ZSTDcrp_makeClean, -    ZSTDcrp_leaveDirty -} ZSTD_compResetPolicy_e; - -/** - * Controls, for this matchState reset, whether indexing can continue where it - * left off (ZSTDirp_continue), or whether it needs to be restarted from zero - * (ZSTDirp_reset). - */ -typedef enum { -    ZSTDirp_continue, -    ZSTDirp_reset -} ZSTD_indexResetPolicy_e; - -typedef enum { -    ZSTD_resetTarget_CDict, -    ZSTD_resetTarget_CCtx -} ZSTD_resetTarget_e; - - -static size_t +/**  + * Controls, for this matchState reset, whether the tables need to be cleared /  + * prepared for the coming compression (ZSTDcrp_makeClean), or whether the  + * tables can be left unclean (ZSTDcrp_leaveDirty), because we know that a  + * subsequent operation will overwrite the table space anyways (e.g., copying  + * the matchState contents in from a CDict).  + */  +typedef enum {  +    ZSTDcrp_makeClean,  +    ZSTDcrp_leaveDirty  +} ZSTD_compResetPolicy_e;  + +/**  + * Controls, for this matchState reset, whether indexing can continue where it  + * left off (ZSTDirp_continue), or whether it needs to be restarted from zero  + * (ZSTDirp_reset).  + */  +typedef enum {  +    ZSTDirp_continue,  +    ZSTDirp_reset  +} ZSTD_indexResetPolicy_e;  + +typedef enum {  +    ZSTD_resetTarget_CDict,  +    ZSTD_resetTarget_CCtx  +} ZSTD_resetTarget_e;  + + +static size_t   ZSTD_reset_matchState(ZSTD_matchState_t* ms, -                      ZSTD_cwksp* ws, +                      ZSTD_cwksp* ws,                   const ZSTD_compressionParameters* cParams,                  const ZSTD_paramSwitch_e useRowMatchFinder, -                const ZSTD_compResetPolicy_e crp, -                const ZSTD_indexResetPolicy_e forceResetIndex, -                const ZSTD_resetTarget_e forWho) +                const ZSTD_compResetPolicy_e crp,  +                const ZSTD_indexResetPolicy_e forceResetIndex,  +                const ZSTD_resetTarget_e forWho)   {      /* disable chain table allocation for fast or row-based strategies */      size_t const chainSize = ZSTD_allocateChainTable(cParams->strategy, useRowMatchFinder, @@ -1733,46 +1733,46 @@ ZSTD_reset_matchState(ZSTD_matchState_t* ms,                                  : 0;      size_t const hSize = ((size_t)1) << cParams->hashLog;      U32    const hashLog3 = ((forWho == ZSTD_resetTarget_CCtx) && cParams->minMatch==3) ? MIN(ZSTD_HASHLOG3_MAX, cParams->windowLog) : 0; -    size_t const h3Size = hashLog3 ? ((size_t)1) << hashLog3 : 0; +    size_t const h3Size = hashLog3 ? ((size_t)1) << hashLog3 : 0;  -    DEBUGLOG(4, "reset indices : %u", forceResetIndex == ZSTDirp_reset); +    DEBUGLOG(4, "reset indices : %u", forceResetIndex == ZSTDirp_reset);       assert(useRowMatchFinder != ZSTD_ps_auto); -    if (forceResetIndex == ZSTDirp_reset) { +    if (forceResetIndex == ZSTDirp_reset) {           ZSTD_window_init(&ms->window); -        ZSTD_cwksp_mark_tables_dirty(ws); -    } +        ZSTD_cwksp_mark_tables_dirty(ws);  +    }       ms->hashLog3 = hashLog3; - +       ZSTD_invalidateMatchState(ms); -    assert(!ZSTD_cwksp_reserve_failed(ws)); /* check that allocation hasn't already failed */ - -    ZSTD_cwksp_clear_tables(ws); - -    DEBUGLOG(5, "reserving table space"); -    /* table Space */ -    ms->hashTable = (U32*)ZSTD_cwksp_reserve_table(ws, hSize * sizeof(U32)); -    ms->chainTable = (U32*)ZSTD_cwksp_reserve_table(ws, chainSize * sizeof(U32)); -    ms->hashTable3 = (U32*)ZSTD_cwksp_reserve_table(ws, h3Size * sizeof(U32)); -    RETURN_ERROR_IF(ZSTD_cwksp_reserve_failed(ws), memory_allocation, -                    "failed a workspace allocation in ZSTD_reset_matchState"); - -    DEBUGLOG(4, "reset table : %u", crp!=ZSTDcrp_leaveDirty); -    if (crp!=ZSTDcrp_leaveDirty) { -        /* reset tables only */ -        ZSTD_cwksp_clean_tables(ws); -    } - +    assert(!ZSTD_cwksp_reserve_failed(ws)); /* check that allocation hasn't already failed */  +  +    ZSTD_cwksp_clear_tables(ws);  +  +    DEBUGLOG(5, "reserving table space");  +    /* table Space */  +    ms->hashTable = (U32*)ZSTD_cwksp_reserve_table(ws, hSize * sizeof(U32));  +    ms->chainTable = (U32*)ZSTD_cwksp_reserve_table(ws, chainSize * sizeof(U32));  +    ms->hashTable3 = (U32*)ZSTD_cwksp_reserve_table(ws, h3Size * sizeof(U32));  +    RETURN_ERROR_IF(ZSTD_cwksp_reserve_failed(ws), memory_allocation,  +                    "failed a workspace allocation in ZSTD_reset_matchState");  +  +    DEBUGLOG(4, "reset table : %u", crp!=ZSTDcrp_leaveDirty);  +    if (crp!=ZSTDcrp_leaveDirty) {  +        /* reset tables only */  +        ZSTD_cwksp_clean_tables(ws);  +    }  +       /* opt parser space */      if ((forWho == ZSTD_resetTarget_CCtx) && (cParams->strategy >= ZSTD_btopt)) {          DEBUGLOG(4, "reserving optimal parser space"); -        ms->opt.litFreq = (unsigned*)ZSTD_cwksp_reserve_aligned(ws, (1<<Litbits) * sizeof(unsigned)); -        ms->opt.litLengthFreq = (unsigned*)ZSTD_cwksp_reserve_aligned(ws, (MaxLL+1) * sizeof(unsigned)); -        ms->opt.matchLengthFreq = (unsigned*)ZSTD_cwksp_reserve_aligned(ws, (MaxML+1) * sizeof(unsigned)); -        ms->opt.offCodeFreq = (unsigned*)ZSTD_cwksp_reserve_aligned(ws, (MaxOff+1) * sizeof(unsigned)); -        ms->opt.matchTable = (ZSTD_match_t*)ZSTD_cwksp_reserve_aligned(ws, (ZSTD_OPT_NUM+1) * sizeof(ZSTD_match_t)); -        ms->opt.priceTable = (ZSTD_optimal_t*)ZSTD_cwksp_reserve_aligned(ws, (ZSTD_OPT_NUM+1) * sizeof(ZSTD_optimal_t)); +        ms->opt.litFreq = (unsigned*)ZSTD_cwksp_reserve_aligned(ws, (1<<Litbits) * sizeof(unsigned));  +        ms->opt.litLengthFreq = (unsigned*)ZSTD_cwksp_reserve_aligned(ws, (MaxLL+1) * sizeof(unsigned));  +        ms->opt.matchLengthFreq = (unsigned*)ZSTD_cwksp_reserve_aligned(ws, (MaxML+1) * sizeof(unsigned));  +        ms->opt.offCodeFreq = (unsigned*)ZSTD_cwksp_reserve_aligned(ws, (MaxOff+1) * sizeof(unsigned));  +        ms->opt.matchTable = (ZSTD_match_t*)ZSTD_cwksp_reserve_aligned(ws, (ZSTD_OPT_NUM+1) * sizeof(ZSTD_match_t));  +        ms->opt.priceTable = (ZSTD_optimal_t*)ZSTD_cwksp_reserve_aligned(ws, (ZSTD_OPT_NUM+1) * sizeof(ZSTD_optimal_t));       }      if (ZSTD_rowMatchFinderUsed(cParams->strategy, useRowMatchFinder)) { @@ -1790,9 +1790,9 @@ ZSTD_reset_matchState(ZSTD_matchState_t* ms,      ms->cParams = *cParams; -    RETURN_ERROR_IF(ZSTD_cwksp_reserve_failed(ws), memory_allocation, -                    "failed a workspace allocation in ZSTD_reset_matchState"); -    return 0; +    RETURN_ERROR_IF(ZSTD_cwksp_reserve_failed(ws), memory_allocation,  +                    "failed a workspace allocation in ZSTD_reset_matchState");  +    return 0;   }  /* ZSTD_indexTooCloseToMax() : @@ -1831,12 +1831,12 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,                                        ZSTD_compResetPolicy_e const crp,                                        ZSTD_buffered_policy_e const zbuff)  { -    ZSTD_cwksp* const ws = &zc->workspace; +    ZSTD_cwksp* const ws = &zc->workspace;       DEBUGLOG(4, "ZSTD_resetCCtx_internal: pledgedSrcSize=%u, wlog=%u, useRowMatchFinder=%d useBlockSplitter=%d",                  (U32)pledgedSrcSize, params->cParams.windowLog, (int)params->useRowMatchFinder, (int)params->useBlockSplitter);      assert(!ZSTD_isError(ZSTD_checkCParams(params->cParams))); -    zc->isFirstBlock = 1; +    zc->isFirstBlock = 1;       /* Set applied params early so we can modify them for LDM,       * and point params at the applied params. @@ -1870,7 +1870,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,          int const dictTooBig = ZSTD_dictTooBig(loadedDictSize);          ZSTD_indexResetPolicy_e needsIndexReset =              (indexTooClose || dictTooBig || !zc->initialized) ? ZSTDirp_reset : ZSTDirp_continue; - +           size_t const neededSpace =              ZSTD_estimateCCtxSize_usingCCtxParams_internal(                  ¶ms->cParams, ¶ms->ldmParams, zc->staticSize != 0, params->useRowMatchFinder, @@ -1878,43 +1878,43 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,          int resizeWorkspace;          FORWARD_IF_ERROR(neededSpace, "cctx size estimate failed!"); - +           if (!zc->staticSize) ZSTD_cwksp_bump_oversized_duration(ws, 0); - +           {   /* Check if workspace is large enough, alloc a new one if needed */ -            int const workspaceTooSmall = ZSTD_cwksp_sizeof(ws) < neededSpace; -            int const workspaceWasteful = ZSTD_cwksp_check_wasteful(ws, neededSpace); +            int const workspaceTooSmall = ZSTD_cwksp_sizeof(ws) < neededSpace;  +            int const workspaceWasteful = ZSTD_cwksp_check_wasteful(ws, neededSpace);               resizeWorkspace = workspaceTooSmall || workspaceWasteful;              DEBUGLOG(4, "Need %zu B workspace", neededSpace);              DEBUGLOG(4, "windowSize: %zu - blockSize: %zu", windowSize, blockSize);              if (resizeWorkspace) { -                DEBUGLOG(4, "Resize workspaceSize from %zuKB to %zuKB", -                            ZSTD_cwksp_sizeof(ws) >> 10, +                DEBUGLOG(4, "Resize workspaceSize from %zuKB to %zuKB",  +                            ZSTD_cwksp_sizeof(ws) >> 10,                               neededSpace >> 10);                  RETURN_ERROR_IF(zc->staticSize, memory_allocation, "static cctx : no resize"); -                needsIndexReset = ZSTDirp_reset; +                needsIndexReset = ZSTDirp_reset;  -                ZSTD_cwksp_free(ws, zc->customMem); +                ZSTD_cwksp_free(ws, zc->customMem);                   FORWARD_IF_ERROR(ZSTD_cwksp_create(ws, neededSpace, zc->customMem), ""); - -                DEBUGLOG(5, "reserving object space"); +  +                DEBUGLOG(5, "reserving object space");                   /* Statically sized space.                   * entropyWorkspace never moves,                   * though prev/next block swap places */ -                assert(ZSTD_cwksp_check_available(ws, 2 * sizeof(ZSTD_compressedBlockState_t))); -                zc->blockState.prevCBlock = (ZSTD_compressedBlockState_t*) ZSTD_cwksp_reserve_object(ws, sizeof(ZSTD_compressedBlockState_t)); -                RETURN_ERROR_IF(zc->blockState.prevCBlock == NULL, memory_allocation, "couldn't allocate prevCBlock"); -                zc->blockState.nextCBlock = (ZSTD_compressedBlockState_t*) ZSTD_cwksp_reserve_object(ws, sizeof(ZSTD_compressedBlockState_t)); -                RETURN_ERROR_IF(zc->blockState.nextCBlock == NULL, memory_allocation, "couldn't allocate nextCBlock"); +                assert(ZSTD_cwksp_check_available(ws, 2 * sizeof(ZSTD_compressedBlockState_t)));  +                zc->blockState.prevCBlock = (ZSTD_compressedBlockState_t*) ZSTD_cwksp_reserve_object(ws, sizeof(ZSTD_compressedBlockState_t));  +                RETURN_ERROR_IF(zc->blockState.prevCBlock == NULL, memory_allocation, "couldn't allocate prevCBlock");  +                zc->blockState.nextCBlock = (ZSTD_compressedBlockState_t*) ZSTD_cwksp_reserve_object(ws, sizeof(ZSTD_compressedBlockState_t));  +                RETURN_ERROR_IF(zc->blockState.nextCBlock == NULL, memory_allocation, "couldn't allocate nextCBlock");                   zc->entropyWorkspace = (U32*) ZSTD_cwksp_reserve_object(ws, ENTROPY_WORKSPACE_SIZE);                  RETURN_ERROR_IF(zc->entropyWorkspace == NULL, memory_allocation, "couldn't allocate entropyWorkspace");          }   } -        ZSTD_cwksp_clear(ws); - +        ZSTD_cwksp_clear(ws);  +           /* init params */          zc->blockState.matchState.cParams = params->cParams;          zc->pledgedSrcSizePlusOne = pledgedSrcSize+1; @@ -1936,61 +1936,61 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,          /* ZSTD_wildcopy() is used to copy into the literals buffer,           * so we have to oversize the buffer by WILDCOPY_OVERLENGTH bytes.           */ -        zc->seqStore.litStart = ZSTD_cwksp_reserve_buffer(ws, blockSize + WILDCOPY_OVERLENGTH); +        zc->seqStore.litStart = ZSTD_cwksp_reserve_buffer(ws, blockSize + WILDCOPY_OVERLENGTH);           zc->seqStore.maxNbLit = blockSize; -        /* buffers */ +        /* buffers */           zc->bufferedPolicy = zbuff; -        zc->inBuffSize = buffInSize; -        zc->inBuff = (char*)ZSTD_cwksp_reserve_buffer(ws, buffInSize); -        zc->outBuffSize = buffOutSize; -        zc->outBuff = (char*)ZSTD_cwksp_reserve_buffer(ws, buffOutSize); - +        zc->inBuffSize = buffInSize;  +        zc->inBuff = (char*)ZSTD_cwksp_reserve_buffer(ws, buffInSize);  +        zc->outBuffSize = buffOutSize;  +        zc->outBuff = (char*)ZSTD_cwksp_reserve_buffer(ws, buffOutSize);  +           /* ldm bucketOffsets table */          if (params->ldmParams.enableLdm == ZSTD_ps_enable) { -            /* TODO: avoid memset? */ +            /* TODO: avoid memset? */               size_t const numBuckets =                    ((size_t)1) << (params->ldmParams.hashLog -                                    params->ldmParams.bucketSizeLog);              zc->ldmState.bucketOffsets = ZSTD_cwksp_reserve_buffer(ws, numBuckets);              ZSTD_memset(zc->ldmState.bucketOffsets, 0, numBuckets);          } - -        /* sequences storage */ +  +        /* sequences storage */           ZSTD_referenceExternalSequences(zc, NULL, 0); -        zc->seqStore.maxNbSeq = maxNbSeq; -        zc->seqStore.llCode = ZSTD_cwksp_reserve_buffer(ws, maxNbSeq * sizeof(BYTE)); -        zc->seqStore.mlCode = ZSTD_cwksp_reserve_buffer(ws, maxNbSeq * sizeof(BYTE)); -        zc->seqStore.ofCode = ZSTD_cwksp_reserve_buffer(ws, maxNbSeq * sizeof(BYTE)); -        zc->seqStore.sequencesStart = (seqDef*)ZSTD_cwksp_reserve_aligned(ws, maxNbSeq * sizeof(seqDef)); - -        FORWARD_IF_ERROR(ZSTD_reset_matchState( -            &zc->blockState.matchState, -            ws, +        zc->seqStore.maxNbSeq = maxNbSeq;  +        zc->seqStore.llCode = ZSTD_cwksp_reserve_buffer(ws, maxNbSeq * sizeof(BYTE));  +        zc->seqStore.mlCode = ZSTD_cwksp_reserve_buffer(ws, maxNbSeq * sizeof(BYTE));  +        zc->seqStore.ofCode = ZSTD_cwksp_reserve_buffer(ws, maxNbSeq * sizeof(BYTE));  +        zc->seqStore.sequencesStart = (seqDef*)ZSTD_cwksp_reserve_aligned(ws, maxNbSeq * sizeof(seqDef));  + +        FORWARD_IF_ERROR(ZSTD_reset_matchState(  +            &zc->blockState.matchState,  +            ws,               ¶ms->cParams,              params->useRowMatchFinder, -            crp, -            needsIndexReset, +            crp,  +            needsIndexReset,               ZSTD_resetTarget_CCtx), ""); -        /* ldm hash table */ +        /* ldm hash table */           if (params->ldmParams.enableLdm == ZSTD_ps_enable) { -            /* TODO: avoid memset? */ +            /* TODO: avoid memset? */               size_t const ldmHSize = ((size_t)1) << params->ldmParams.hashLog; -            zc->ldmState.hashTable = (ldmEntry_t*)ZSTD_cwksp_reserve_aligned(ws, ldmHSize * sizeof(ldmEntry_t)); +            zc->ldmState.hashTable = (ldmEntry_t*)ZSTD_cwksp_reserve_aligned(ws, ldmHSize * sizeof(ldmEntry_t));               ZSTD_memset(zc->ldmState.hashTable, 0, ldmHSize * sizeof(ldmEntry_t)); -            zc->ldmSequences = (rawSeq*)ZSTD_cwksp_reserve_aligned(ws, maxNbLdmSeq * sizeof(rawSeq)); -            zc->maxNbLdmSequences = maxNbLdmSeq; - +            zc->ldmSequences = (rawSeq*)ZSTD_cwksp_reserve_aligned(ws, maxNbLdmSeq * sizeof(rawSeq));  +            zc->maxNbLdmSequences = maxNbLdmSeq;  +               ZSTD_window_init(&zc->ldmState.window);              zc->ldmState.loadedDictEnd = 0; -        } - +        }  +           DEBUGLOG(3, "wksp: finished allocating, %zd bytes remain available", ZSTD_cwksp_available_space(ws));          assert(ZSTD_cwksp_estimated_space_within_bounds(ws, neededSpace, resizeWorkspace));          zc->initialized = 1; - +           return 0;      }  } @@ -2023,7 +2023,7 @@ static const size_t attachDictSizeCutoffs[ZSTD_STRATEGY_MAX+1] = {  };  static int ZSTD_shouldAttachDict(const ZSTD_CDict* cdict, -                                 const ZSTD_CCtx_params* params, +                                 const ZSTD_CCtx_params* params,                                    U64 pledgedSrcSize)  {      size_t cutoff = attachDictSizeCutoffs[cdict->matchState.cParams.strategy]; @@ -2124,23 +2124,23 @@ static size_t ZSTD_resetCCtx_byCopyingCDict(ZSTD_CCtx* cctx,          assert(cctx->appliedParams.cParams.chainLog == cdict_cParams->chainLog);      } -    ZSTD_cwksp_mark_tables_dirty(&cctx->workspace); +    ZSTD_cwksp_mark_tables_dirty(&cctx->workspace);       assert(params.useRowMatchFinder != ZSTD_ps_auto); - +       /* copy tables */      {   size_t const chainSize = ZSTD_allocateChainTable(cdict_cParams->strategy, cdict->useRowMatchFinder, 0 /* DDS guaranteed disabled */)                                                              ? ((size_t)1 << cdict_cParams->chainLog)                                                              : 0;          size_t const hSize =  (size_t)1 << cdict_cParams->hashLog; - +           ZSTD_memcpy(cctx->blockState.matchState.hashTable, -               cdict->matchState.hashTable, -               hSize * sizeof(U32)); +               cdict->matchState.hashTable,  +               hSize * sizeof(U32));           /* Do not copy cdict's chainTable if cctx has parameters such that it would not use chainTable */          if (ZSTD_allocateChainTable(cctx->appliedParams.cParams.strategy, cctx->appliedParams.useRowMatchFinder, 0 /* forDDSDict */)) {              ZSTD_memcpy(cctx->blockState.matchState.chainTable, -               cdict->matchState.chainTable, -               chainSize * sizeof(U32)); +               cdict->matchState.chainTable,  +               chainSize * sizeof(U32));           }          /* copy tag table */          if (ZSTD_rowMatchFinderUsed(cdict_cParams->strategy, cdict->useRowMatchFinder)) { @@ -2152,14 +2152,14 @@ static size_t ZSTD_resetCCtx_byCopyingCDict(ZSTD_CCtx* cctx,      }      /* Zero the hashTable3, since the cdict never fills it */ -    {   int const h3log = cctx->blockState.matchState.hashLog3; -        size_t const h3Size = h3log ? ((size_t)1 << h3log) : 0; +    {   int const h3log = cctx->blockState.matchState.hashLog3;  +        size_t const h3Size = h3log ? ((size_t)1 << h3log) : 0;           assert(cdict->matchState.hashLog3 == 0);          ZSTD_memset(cctx->blockState.matchState.hashTable3, 0, h3Size * sizeof(U32));      } -    ZSTD_cwksp_mark_tables_clean(&cctx->workspace); - +    ZSTD_cwksp_mark_tables_clean(&cctx->workspace);  +       /* copy dictionary offsets */      {   ZSTD_matchState_t const* srcMatchState = &cdict->matchState;          ZSTD_matchState_t* dstMatchState = &cctx->blockState.matchState; @@ -2182,7 +2182,7 @@ static size_t ZSTD_resetCCtx_byCopyingCDict(ZSTD_CCtx* cctx,   * in-place. We decide here which strategy to use. */  static size_t ZSTD_resetCCtx_usingCDict(ZSTD_CCtx* cctx,                              const ZSTD_CDict* cdict, -                            const ZSTD_CCtx_params* params, +                            const ZSTD_CCtx_params* params,                               U64 pledgedSrcSize,                              ZSTD_buffered_policy_e zbuff)  { @@ -2192,10 +2192,10 @@ static size_t ZSTD_resetCCtx_usingCDict(ZSTD_CCtx* cctx,      if (ZSTD_shouldAttachDict(cdict, params, pledgedSrcSize)) {          return ZSTD_resetCCtx_byAttachingCDict( -            cctx, cdict, *params, pledgedSrcSize, zbuff); +            cctx, cdict, *params, pledgedSrcSize, zbuff);       } else {          return ZSTD_resetCCtx_byCopyingCDict( -            cctx, cdict, *params, pledgedSrcSize, zbuff); +            cctx, cdict, *params, pledgedSrcSize, zbuff);       }  } @@ -2228,7 +2228,7 @@ static size_t ZSTD_copyCCtx_internal(ZSTD_CCtx* dstCCtx,          params.fParams = fParams;          ZSTD_resetCCtx_internal(dstCCtx, ¶ms, pledgedSrcSize,                                  /* loadedDictSize */ 0, -                                ZSTDcrp_leaveDirty, zbuff); +                                ZSTDcrp_leaveDirty, zbuff);           assert(dstCCtx->appliedParams.cParams.windowLog == srcCCtx->appliedParams.cParams.windowLog);          assert(dstCCtx->appliedParams.cParams.strategy == srcCCtx->appliedParams.cParams.strategy);          assert(dstCCtx->appliedParams.cParams.hashLog == srcCCtx->appliedParams.cParams.hashLog); @@ -2236,8 +2236,8 @@ static size_t ZSTD_copyCCtx_internal(ZSTD_CCtx* dstCCtx,          assert(dstCCtx->blockState.matchState.hashLog3 == srcCCtx->blockState.matchState.hashLog3);      } -    ZSTD_cwksp_mark_tables_dirty(&dstCCtx->workspace); - +    ZSTD_cwksp_mark_tables_dirty(&dstCCtx->workspace);  +       /* copy tables */      {   size_t const chainSize = ZSTD_allocateChainTable(srcCCtx->appliedParams.cParams.strategy,                                                           srcCCtx->appliedParams.useRowMatchFinder, @@ -2245,22 +2245,22 @@ static size_t ZSTD_copyCCtx_internal(ZSTD_CCtx* dstCCtx,                                      ? ((size_t)1 << srcCCtx->appliedParams.cParams.chainLog)                                      : 0;          size_t const hSize =  (size_t)1 << srcCCtx->appliedParams.cParams.hashLog; -        int const h3log = srcCCtx->blockState.matchState.hashLog3; -        size_t const h3Size = h3log ? ((size_t)1 << h3log) : 0; - +        int const h3log = srcCCtx->blockState.matchState.hashLog3;  +        size_t const h3Size = h3log ? ((size_t)1 << h3log) : 0;  +           ZSTD_memcpy(dstCCtx->blockState.matchState.hashTable, -               srcCCtx->blockState.matchState.hashTable, -               hSize * sizeof(U32)); +               srcCCtx->blockState.matchState.hashTable,  +               hSize * sizeof(U32));           ZSTD_memcpy(dstCCtx->blockState.matchState.chainTable, -               srcCCtx->blockState.matchState.chainTable, -               chainSize * sizeof(U32)); +               srcCCtx->blockState.matchState.chainTable,  +               chainSize * sizeof(U32));           ZSTD_memcpy(dstCCtx->blockState.matchState.hashTable3, -               srcCCtx->blockState.matchState.hashTable3, -               h3Size * sizeof(U32)); +               srcCCtx->blockState.matchState.hashTable3,  +               h3Size * sizeof(U32));       } -    ZSTD_cwksp_mark_tables_clean(&dstCCtx->workspace); - +    ZSTD_cwksp_mark_tables_clean(&dstCCtx->workspace);  +       /* copy dictionary offsets */      {          const ZSTD_matchState_t* srcMatchState = &srcCCtx->blockState.matchState; @@ -2314,20 +2314,20 @@ ZSTD_reduceTable_internal (U32* const table, U32 const size, U32 const reducerVa      U32 const reducerThreshold = reducerValue + ZSTD_WINDOW_START_INDEX;      assert((size & (ZSTD_ROWSIZE-1)) == 0);  /* multiple of ZSTD_ROWSIZE */      assert(size < (1U<<31));   /* can be casted to int */ - +   #if ZSTD_MEMORY_SANITIZER && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE) -    /* To validate that the table re-use logic is sound, and that we don't -     * access table space that we haven't cleaned, we re-"poison" the table -     * space every time we mark it dirty. -     * -     * This function however is intended to operate on those dirty tables and -     * re-clean them. So when this function is used correctly, we can unpoison -     * the memory it operated on. This introduces a blind spot though, since -     * if we now try to operate on __actually__ poisoned memory, we will not -     * detect that. */ -    __msan_unpoison(table, size * sizeof(U32)); -#endif - +    /* To validate that the table re-use logic is sound, and that we don't  +     * access table space that we haven't cleaned, we re-"poison" the table  +     * space every time we mark it dirty.  +     *  +     * This function however is intended to operate on those dirty tables and  +     * re-clean them. So when this function is used correctly, we can unpoison  +     * the memory it operated on. This introduces a blind spot though, since  +     * if we now try to operate on __actually__ poisoned memory, we will not  +     * detect that. */  +    __msan_unpoison(table, size * sizeof(U32));  +#endif  +       for (rowNb=0 ; rowNb < nbRows ; rowNb++) {          int column;          for (column=0; column<ZSTD_ROWSIZE; column++) { @@ -2576,7 +2576,7 @@ ZSTD_entropyCompressSeqStore_internal(seqStore_t* seqStorePtr,                                  ZSTD_entropyCTables_t* nextEntropy,                            const ZSTD_CCtx_params* cctxParams,                                  void* dst, size_t dstCapacity, -                                void* entropyWorkspace, size_t entropyWkspSize, +                                void* entropyWorkspace, size_t entropyWkspSize,                             const int bmi2)  {      const int longOffsets = cctxParams->cParams.windowLog > STREAM_ACCUMULATOR_MIN; @@ -2608,14 +2608,14 @@ ZSTD_entropyCompressSeqStore_internal(seqStore_t* seqStorePtr,          size_t const numLiterals = seqStorePtr->lit - seqStorePtr->litStart;          /* Base suspicion of uncompressibility on ratio of literals to sequences */          unsigned const suspectUncompressible = (numSequences == 0) || (numLiterals / numSequences >= SUSPECT_UNCOMPRESSIBLE_LITERAL_RATIO); -        size_t const litSize = (size_t)(seqStorePtr->lit - literals); +        size_t const litSize = (size_t)(seqStorePtr->lit - literals);           size_t const cSize = ZSTD_compressLiterals(                                      &prevEntropy->huf, &nextEntropy->huf,                                      cctxParams->cParams.strategy,                                      ZSTD_literalsCompressionIsDisabled(cctxParams),                                      op, dstCapacity,                                      literals, litSize, -                                    entropyWorkspace, entropyWkspSize, +                                    entropyWorkspace, entropyWkspSize,                                       bmi2, suspectUncompressible);          FORWARD_IF_ERROR(cSize, "ZSTD_compressLiterals failed");          assert(cSize <= dstCapacity); @@ -2625,22 +2625,22 @@ ZSTD_entropyCompressSeqStore_internal(seqStore_t* seqStorePtr,      /* Sequences Header */      RETURN_ERROR_IF((oend-op) < 3 /*max nbSeq Size*/ + 1 /*seqHead*/,                      dstSize_tooSmall, "Can't fit seq hdr in output buf!"); -    if (nbSeq < 128) { +    if (nbSeq < 128) {           *op++ = (BYTE)nbSeq; -    } else if (nbSeq < LONGNBSEQ) { -        op[0] = (BYTE)((nbSeq>>8) + 0x80); -        op[1] = (BYTE)nbSeq; -        op+=2; -    } else { -        op[0]=0xFF; -        MEM_writeLE16(op+1, (U16)(nbSeq - LONGNBSEQ)); -        op+=3; -    } +    } else if (nbSeq < LONGNBSEQ) {  +        op[0] = (BYTE)((nbSeq>>8) + 0x80);  +        op[1] = (BYTE)nbSeq;  +        op+=2;  +    } else {  +        op[0]=0xFF;  +        MEM_writeLE16(op+1, (U16)(nbSeq - LONGNBSEQ));  +        op+=3;  +    }       assert(op <= oend);      if (nbSeq==0) {          /* Copy the old tables over as if we repeated them */          ZSTD_memcpy(&nextEntropy->fse, &prevEntropy->fse, sizeof(prevEntropy->fse)); -        return (size_t)(op - ostart); +        return (size_t)(op - ostart);       }      {          ZSTD_symbolEncodingTypeStats_t stats; @@ -2658,7 +2658,7 @@ ZSTD_entropyCompressSeqStore_internal(seqStore_t* seqStorePtr,      }      {   size_t const bitstreamSize = ZSTD_encodeSequences( -                                        op, (size_t)(oend - op), +                                        op, (size_t)(oend - op),                                           CTable_MatchLength, mlCodeTable,                                          CTable_OffsetBits, ofCodeTable,                                          CTable_LitLength, llCodeTable, @@ -2685,7 +2685,7 @@ ZSTD_entropyCompressSeqStore_internal(seqStore_t* seqStorePtr,      }      DEBUGLOG(5, "compressed block size : %u", (unsigned)(op - ostart)); -    return (size_t)(op - ostart); +    return (size_t)(op - ostart);   }  MEM_STATIC size_t @@ -2695,13 +2695,13 @@ ZSTD_entropyCompressSeqStore(seqStore_t* seqStorePtr,                         const ZSTD_CCtx_params* cctxParams,                               void* dst, size_t dstCapacity,                               size_t srcSize, -                             void* entropyWorkspace, size_t entropyWkspSize, +                             void* entropyWorkspace, size_t entropyWkspSize,                                int bmi2)  {      size_t const cSize = ZSTD_entropyCompressSeqStore_internal(                              seqStorePtr, prevEntropy, nextEntropy, cctxParams,                              dst, dstCapacity, -                            entropyWorkspace, entropyWkspSize, bmi2); +                            entropyWorkspace, entropyWkspSize, bmi2);       if (cSize == 0) return 0;      /* When srcSize <= dstCapacity, there is enough space to write a raw uncompressed block.       * Since we ran out of space, block must be not compressible, so fall back to raw uncompressed block. @@ -2892,20 +2892,20 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize)      return ZSTDbss_compress;  } -static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc) -{ -    const seqStore_t* seqStore = ZSTD_getSeqStore(zc); +static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc)  +{  +    const seqStore_t* seqStore = ZSTD_getSeqStore(zc);       const seqDef* seqStoreSeqs = seqStore->sequencesStart;      size_t seqStoreSeqSize = seqStore->sequences - seqStoreSeqs;      size_t seqStoreLiteralsSize = (size_t)(seqStore->lit - seqStore->litStart);      size_t literalsRead = 0;      size_t lastLLSize; - -    ZSTD_Sequence* outSeqs = &zc->seqCollector.seqStart[zc->seqCollector.seqIndex]; +  +    ZSTD_Sequence* outSeqs = &zc->seqCollector.seqStart[zc->seqCollector.seqIndex];       size_t i;      repcodes_t updatedRepcodes; - -    assert(zc->seqCollector.seqIndex + 1 < zc->seqCollector.maxSequences); +  +    assert(zc->seqCollector.seqIndex + 1 < zc->seqCollector.maxSequences);       /* Ensure we have enough space for last literals "sequence" */      assert(zc->seqCollector.maxSequences >= seqStoreSeqSize + 1);      ZSTD_memcpy(updatedRepcodes.rep, zc->blockState.prevCBlock->rep, sizeof(repcodes_t)); @@ -2914,15 +2914,15 @@ static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc)          outSeqs[i].litLength = seqStoreSeqs[i].litLength;          outSeqs[i].matchLength = seqStoreSeqs[i].mlBase + MINMATCH;          outSeqs[i].rep = 0; - -        if (i == seqStore->longLengthPos) { +  +        if (i == seqStore->longLengthPos) {               if (seqStore->longLengthType == ZSTD_llt_literalLength) { -                outSeqs[i].litLength += 0x10000; +                outSeqs[i].litLength += 0x10000;               } else if (seqStore->longLengthType == ZSTD_llt_matchLength) { -                outSeqs[i].matchLength += 0x10000; -            } -        } - +                outSeqs[i].matchLength += 0x10000;  +            }  +        }  +           if (seqStoreSeqs[i].offBase <= ZSTD_REP_NUM) {              /* Derive the correct offset corresponding to a repcode */              outSeqs[i].rep = seqStoreSeqs[i].offBase; @@ -2931,11 +2931,11 @@ static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc)              } else {                  if (outSeqs[i].rep == 3) {                      rawOffset = updatedRepcodes.rep[0] - 1; -                } else { +                } else {                       rawOffset = updatedRepcodes.rep[outSeqs[i].rep]; -                } -            } -        } +                }  +            }  +        }           outSeqs[i].offset = rawOffset;          /* seqStoreSeqs[i].offset == offCode+1, and ZSTD_updateRep() expects offCode             so we provide seqStoreSeqs[i].offset - 1 */ @@ -2943,7 +2943,7 @@ static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc)                         seqStoreSeqs[i].offBase - 1,                         seqStoreSeqs[i].litLength == 0);          literalsRead += outSeqs[i].litLength; -    } +    }       /* Insert last literals (if any exist) in the block as a sequence with ml == off == 0.       * If there are no last literals, then we'll emit (of: 0, ml: 0, ll: 0), which is a marker       * for the block boundary, according to the API. @@ -2954,28 +2954,28 @@ static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc)      outSeqs[i].matchLength = outSeqs[i].offset = outSeqs[i].rep = 0;      seqStoreSeqSize++;      zc->seqCollector.seqIndex += seqStoreSeqSize; -} - +}  +   size_t ZSTD_generateSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs,                                size_t outSeqsSize, const void* src, size_t srcSize) -{ -    const size_t dstCapacity = ZSTD_compressBound(srcSize); +{  +    const size_t dstCapacity = ZSTD_compressBound(srcSize);       void* dst = ZSTD_customMalloc(dstCapacity, ZSTD_defaultCMem); -    SeqCollector seqCollector; - +    SeqCollector seqCollector;  +       RETURN_ERROR_IF(dst == NULL, memory_allocation, "NULL pointer!"); - -    seqCollector.collectSequences = 1; -    seqCollector.seqStart = outSeqs; -    seqCollector.seqIndex = 0; -    seqCollector.maxSequences = outSeqsSize; -    zc->seqCollector = seqCollector; - -    ZSTD_compress2(zc, dst, dstCapacity, src, srcSize); +  +    seqCollector.collectSequences = 1;  +    seqCollector.seqStart = outSeqs;  +    seqCollector.seqIndex = 0;  +    seqCollector.maxSequences = outSeqsSize;  +    zc->seqCollector = seqCollector;  +  +    ZSTD_compress2(zc, dst, dstCapacity, src, srcSize);       ZSTD_customFree(dst, ZSTD_defaultCMem); -    return zc->seqCollector.seqIndex; -} - +    return zc->seqCollector.seqIndex;  +}  +   size_t ZSTD_mergeBlockDelimiters(ZSTD_Sequence* sequences, size_t seqsSize) {      size_t in = 0;      size_t out = 0; @@ -3000,13 +3000,13 @@ static int ZSTD_isRLE(const BYTE* src, size_t length) {      const size_t unrollSize = sizeof(size_t) * 4;      const size_t unrollMask = unrollSize - 1;      const size_t prefixLength = length & unrollMask; -    size_t i; +    size_t i;       size_t u;      if (length == 1) return 1;      /* Check if prefix is RLE first before using unrolled loop */      if (prefixLength && ZSTD_count(ip+1, ip, ip+prefixLength) != prefixLength-1) {          return 0; -    } +    }       for (i = prefixLength; i != length; i += unrollSize) {          for (u = 0; u < unrollSize; u += sizeof(size_t)) {              if (MEM_readST(ip + i + u) != valueST) { @@ -3014,9 +3014,9 @@ static int ZSTD_isRLE(const BYTE* src, size_t length) {              }          }      } -    return 1; -} - +    return 1;  +}  +   /* Returns true if the given block may be RLE.   * This is just a heuristic based on the compressibility.   * It may return both false positives and false negatives. @@ -3764,29 +3764,29 @@ ZSTD_compressBlock_internal(ZSTD_CCtx* zc,                              void* dst, size_t dstCapacity,                              const void* src, size_t srcSize, U32 frame)  { -    /* This the upper bound for the length of an rle block. -     * This isn't the actual upper bound. Finding the real threshold -     * needs further investigation. -     */ -    const U32 rleMaxLength = 25; +    /* This the upper bound for the length of an rle block.  +     * This isn't the actual upper bound. Finding the real threshold  +     * needs further investigation.  +     */  +    const U32 rleMaxLength = 25;       size_t cSize; -    const BYTE* ip = (const BYTE*)src; -    BYTE* op = (BYTE*)dst; +    const BYTE* ip = (const BYTE*)src;  +    BYTE* op = (BYTE*)dst;       DEBUGLOG(5, "ZSTD_compressBlock_internal (dstCapacity=%u, dictLimit=%u, nextToUpdate=%u)", -                (unsigned)dstCapacity, (unsigned)zc->blockState.matchState.window.dictLimit, -                (unsigned)zc->blockState.matchState.nextToUpdate); +                (unsigned)dstCapacity, (unsigned)zc->blockState.matchState.window.dictLimit,  +                (unsigned)zc->blockState.matchState.nextToUpdate);       {   const size_t bss = ZSTD_buildSeqStore(zc, src, srcSize);          FORWARD_IF_ERROR(bss, "ZSTD_buildSeqStore failed");          if (bss == ZSTDbss_noCompress) { cSize = 0; goto out; }      } -    if (zc->seqCollector.collectSequences) { -        ZSTD_copyBlockSequences(zc); +    if (zc->seqCollector.collectSequences) {  +        ZSTD_copyBlockSequences(zc);           ZSTD_blockState_confirmRepcodesAndEntropyTables(&zc->blockState); -        return 0; -    } - +        return 0;  +    }  +       /* encode sequences and literals */      cSize = ZSTD_entropyCompressSeqStore(&zc->seqStore,              &zc->blockState.prevCBlock->entropy, &zc->blockState.nextCBlock->entropy, @@ -3796,21 +3796,21 @@ ZSTD_compressBlock_internal(ZSTD_CCtx* zc,              zc->entropyWorkspace, ENTROPY_WORKSPACE_SIZE /* statically allocated in resetCCtx */,              zc->bmi2); -    if (frame && -        /* We don't want to emit our first block as a RLE even if it qualifies because -         * doing so will cause the decoder (cli only) to throw a "should consume all input error." -         * This is only an issue for zstd <= v1.4.3 -         */ -        !zc->isFirstBlock && -        cSize < rleMaxLength && -        ZSTD_isRLE(ip, srcSize)) -    { -        cSize = 1; -        op[0] = ip[0]; -    } - +    if (frame &&  +        /* We don't want to emit our first block as a RLE even if it qualifies because  +         * doing so will cause the decoder (cli only) to throw a "should consume all input error."  +         * This is only an issue for zstd <= v1.4.3  +         */  +        !zc->isFirstBlock &&  +        cSize < rleMaxLength &&  +        ZSTD_isRLE(ip, srcSize))  +    {  +        cSize = 1;  +        op[0] = ip[0];  +    }  +   out: -    if (!ZSTD_isError(cSize) && cSize > 1) { +    if (!ZSTD_isError(cSize) && cSize > 1) {           ZSTD_blockState_confirmRepcodesAndEntropyTables(&zc->blockState);      }      /* We check that dictionaries have offset codes available for the first @@ -3898,11 +3898,11 @@ static size_t ZSTD_compressBlock_targetCBlockSize(ZSTD_CCtx* zc,      return cSize;  } -static void ZSTD_overflowCorrectIfNeeded(ZSTD_matchState_t* ms, -                                         ZSTD_cwksp* ws, -                                         ZSTD_CCtx_params const* params, -                                         void const* ip, -                                         void const* iend) +static void ZSTD_overflowCorrectIfNeeded(ZSTD_matchState_t* ms,  +                                         ZSTD_cwksp* ws,  +                                         ZSTD_CCtx_params const* params,  +                                         void const* ip,  +                                         void const* iend)   {      U32 const cycleLog = ZSTD_cycleLog(params->cParams.chainLog, params->cParams.strategy);      U32 const maxDist = (U32)1 << params->cParams.windowLog; @@ -3911,9 +3911,9 @@ static void ZSTD_overflowCorrectIfNeeded(ZSTD_matchState_t* ms,          ZSTD_STATIC_ASSERT(ZSTD_CHAINLOG_MAX <= 30);          ZSTD_STATIC_ASSERT(ZSTD_WINDOWLOG_MAX_32 <= 30);          ZSTD_STATIC_ASSERT(ZSTD_WINDOWLOG_MAX <= 31); -        ZSTD_cwksp_mark_tables_dirty(ws); +        ZSTD_cwksp_mark_tables_dirty(ws);           ZSTD_reduceIndex(ms, params, correction); -        ZSTD_cwksp_mark_tables_clean(ws); +        ZSTD_cwksp_mark_tables_clean(ws);           if (ms->nextToUpdate < correction) ms->nextToUpdate = 0;          else ms->nextToUpdate -= correction;          /* invalidate dictionaries on overflow correction */ @@ -3956,8 +3956,8 @@ static size_t ZSTD_compress_frameChunk(ZSTD_CCtx* cctx,                          "not enough space to store compressed block");          if (remaining < blockSize) blockSize = remaining; -        ZSTD_overflowCorrectIfNeeded( -            ms, &cctx->workspace, &cctx->appliedParams, ip, ip + blockSize); +        ZSTD_overflowCorrectIfNeeded(  +            ms, &cctx->workspace, &cctx->appliedParams, ip, ip + blockSize);           ZSTD_checkDictValidity(&ms->window, ip + blockSize, maxDist, &ms->loadedDictEnd, &ms->dictMatchState);          ZSTD_window_enforceMaxDist(&ms->window, ip, maxDist, &ms->loadedDictEnd, &ms->dictMatchState); @@ -3999,7 +3999,7 @@ static size_t ZSTD_compress_frameChunk(ZSTD_CCtx* cctx,              op += cSize;              assert(dstCapacity >= cSize);              dstCapacity -= cSize; -            cctx->isFirstBlock = 0; +            cctx->isFirstBlock = 0;               DEBUGLOG(5, "ZSTD_compress_frameChunk: adding a block of size %u",                          (unsigned)cSize);      }   } @@ -4010,25 +4010,25 @@ static size_t ZSTD_compress_frameChunk(ZSTD_CCtx* cctx,  static size_t ZSTD_writeFrameHeader(void* dst, size_t dstCapacity, -                                    const ZSTD_CCtx_params* params, U64 pledgedSrcSize, U32 dictID) +                                    const ZSTD_CCtx_params* params, U64 pledgedSrcSize, U32 dictID)   {   BYTE* const op = (BYTE*)dst;      U32   const dictIDSizeCodeLength = (dictID>0) + (dictID>=256) + (dictID>=65536);   /* 0-3 */ -    U32   const dictIDSizeCode = params->fParams.noDictIDFlag ? 0 : dictIDSizeCodeLength;   /* 0-3 */ -    U32   const checksumFlag = params->fParams.checksumFlag>0; -    U32   const windowSize = (U32)1 << params->cParams.windowLog; -    U32   const singleSegment = params->fParams.contentSizeFlag && (windowSize >= pledgedSrcSize); -    BYTE  const windowLogByte = (BYTE)((params->cParams.windowLog - ZSTD_WINDOWLOG_ABSOLUTEMIN) << 3); -    U32   const fcsCode = params->fParams.contentSizeFlag ? +    U32   const dictIDSizeCode = params->fParams.noDictIDFlag ? 0 : dictIDSizeCodeLength;   /* 0-3 */  +    U32   const checksumFlag = params->fParams.checksumFlag>0;  +    U32   const windowSize = (U32)1 << params->cParams.windowLog;  +    U32   const singleSegment = params->fParams.contentSizeFlag && (windowSize >= pledgedSrcSize);  +    BYTE  const windowLogByte = (BYTE)((params->cParams.windowLog - ZSTD_WINDOWLOG_ABSOLUTEMIN) << 3);  +    U32   const fcsCode = params->fParams.contentSizeFlag ?                        (pledgedSrcSize>=256) + (pledgedSrcSize>=65536+256) + (pledgedSrcSize>=0xFFFFFFFFU) : 0;  /* 0-3 */      BYTE  const frameHeaderDescriptionByte = (BYTE)(dictIDSizeCode + (checksumFlag<<2) + (singleSegment<<5) + (fcsCode<<6) );      size_t pos=0; -    assert(!(params->fParams.contentSizeFlag && pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN)); +    assert(!(params->fParams.contentSizeFlag && pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN));       RETURN_ERROR_IF(dstCapacity < ZSTD_FRAMEHEADERSIZE_MAX, dstSize_tooSmall,                      "dst buf is too small to fit worst-case frame header size.");      DEBUGLOG(4, "ZSTD_writeFrameHeader : dictIDFlag : %u ; dictID : %u ; dictIDSizeCode : %u", -                !params->fParams.noDictIDFlag, (unsigned)dictID, (unsigned)dictIDSizeCode); -    if (params->format == ZSTD_f_zstd1) { +                !params->fParams.noDictIDFlag, (unsigned)dictID, (unsigned)dictIDSizeCode);  +    if (params->format == ZSTD_f_zstd1) {           MEM_writeLE32(dst, ZSTD_MAGICNUMBER);          pos = 4;      } @@ -4122,7 +4122,7 @@ static size_t ZSTD_compressContinue_internal (ZSTD_CCtx* cctx,                      "missing init (ZSTD_compressBegin)");      if (frame && (cctx->stage==ZSTDcs_init)) { -        fhSize = ZSTD_writeFrameHeader(dst, dstCapacity, &cctx->appliedParams, +        fhSize = ZSTD_writeFrameHeader(dst, dstCapacity, &cctx->appliedParams,                                          cctx->pledgedSrcSizePlusOne-1, cctx->dictID);          FORWARD_IF_ERROR(fhSize, "ZSTD_writeFrameHeader failed");          assert(fhSize <= dstCapacity); @@ -4143,15 +4143,15 @@ static size_t ZSTD_compressContinue_internal (ZSTD_CCtx* cctx,      if (!frame) {          /* overflow check and correction for block mode */ -        ZSTD_overflowCorrectIfNeeded( -            ms, &cctx->workspace, &cctx->appliedParams, -            src, (BYTE const*)src + srcSize); +        ZSTD_overflowCorrectIfNeeded(  +            ms, &cctx->workspace, &cctx->appliedParams,  +            src, (BYTE const*)src + srcSize);       }      DEBUGLOG(5, "ZSTD_compressContinue_internal (blockSize=%u)", (unsigned)cctx->blockSize);      {   size_t const cSize = frame ?                               ZSTD_compress_frameChunk (cctx, dst, dstCapacity, src, srcSize, lastFrameChunk) : -                             ZSTD_compressBlock_internal (cctx, dst, dstCapacity, src, srcSize, 0 /* frame */); +                             ZSTD_compressBlock_internal (cctx, dst, dstCapacity, src, srcSize, 0 /* frame */);           FORWARD_IF_ERROR(cSize, "%s", frame ? "ZSTD_compress_frameChunk failed" : "ZSTD_compressBlock_internal failed");          cctx->consumedSrcSize += srcSize;          cctx->producedCSize += (cSize + fhSize); @@ -4187,8 +4187,8 @@ size_t ZSTD_getBlockSize(const ZSTD_CCtx* cctx)  size_t ZSTD_compressBlock(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize)  { -    DEBUGLOG(5, "ZSTD_compressBlock: srcSize = %u", (unsigned)srcSize); -    { size_t const blockSizeMax = ZSTD_getBlockSize(cctx); +    DEBUGLOG(5, "ZSTD_compressBlock: srcSize = %u", (unsigned)srcSize);  +    { size_t const blockSizeMax = ZSTD_getBlockSize(cctx);         RETURN_ERROR_IF(srcSize > blockSizeMax, srcSize_wrong, "input is larger than a block"); }      return ZSTD_compressContinue_internal(cctx, dst, dstCapacity, src, srcSize, 0 /* frame mode */, 0 /* last chunk */); @@ -4199,7 +4199,7 @@ size_t ZSTD_compressBlock(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const   */  static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms,                                           ldmState_t* ls, -                                         ZSTD_cwksp* ws, +                                         ZSTD_cwksp* ws,                                            ZSTD_CCtx_params const* params,                                           const void* src, size_t srcSize,                                           ZSTD_dictTableLoadMethod_e dtlm) @@ -4435,7 +4435,7 @@ static size_t ZSTD_loadZstdDictionary(ZSTD_compressedBlockState_t* bs,      {          size_t const dictContentSize = (size_t)(dictEnd - dictPtr); -        FORWARD_IF_ERROR(ZSTD_loadDictionaryContent( +        FORWARD_IF_ERROR(ZSTD_loadDictionaryContent(               ms, NULL, ws, params, dictPtr, dictContentSize, dtlm), "");      }      return dictID; @@ -4447,7 +4447,7 @@ static size_t  ZSTD_compress_insertDictionary(ZSTD_compressedBlockState_t* bs,                                 ZSTD_matchState_t* ms,                                 ldmState_t* ls, -                               ZSTD_cwksp* ws, +                               ZSTD_cwksp* ws,                            const ZSTD_CCtx_params* params,                           const void* dict, size_t dictSize,                                 ZSTD_dictContentType_e dictContentType, @@ -4455,10 +4455,10 @@ ZSTD_compress_insertDictionary(ZSTD_compressedBlockState_t* bs,                                 void* workspace)  {      DEBUGLOG(4, "ZSTD_compress_insertDictionary (dictSize=%u)", (U32)dictSize); -    if ((dict==NULL) || (dictSize<8)) { +    if ((dict==NULL) || (dictSize<8)) {           RETURN_ERROR_IF(dictContentType == ZSTD_dct_fullDict, dictionary_wrong, ""); -        return 0; -    } +        return 0;  +    }       ZSTD_reset_compressedBlockState(bs); @@ -4469,7 +4469,7 @@ ZSTD_compress_insertDictionary(ZSTD_compressedBlockState_t* bs,      if (MEM_readLE32(dict) != ZSTD_MAGIC_DICTIONARY) {          if (dictContentType == ZSTD_dct_auto) {              DEBUGLOG(4, "raw content dictionary detected"); -            return ZSTD_loadDictionaryContent( +            return ZSTD_loadDictionaryContent(                   ms, ls, ws, params, dict, dictSize, dtlm);          }          RETURN_ERROR_IF(dictContentType == ZSTD_dct_fullDict, dictionary_wrong, ""); @@ -4477,13 +4477,13 @@ ZSTD_compress_insertDictionary(ZSTD_compressedBlockState_t* bs,      }      /* dict as full zstd dictionary */ -    return ZSTD_loadZstdDictionary( -        bs, ms, ws, params, dict, dictSize, dtlm, workspace); +    return ZSTD_loadZstdDictionary(  +        bs, ms, ws, params, dict, dictSize, dtlm, workspace);   } -#define ZSTD_USE_CDICT_PARAMS_SRCSIZE_CUTOFF (128 KB) +#define ZSTD_USE_CDICT_PARAMS_SRCSIZE_CUTOFF (128 KB)   #define ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER (6ULL) - +   /*! ZSTD_compressBegin_internal() :   * @return : 0, or an error code */  static size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx, @@ -4491,40 +4491,40 @@ static size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx,                                      ZSTD_dictContentType_e dictContentType,                                      ZSTD_dictTableLoadMethod_e dtlm,                                      const ZSTD_CDict* cdict, -                                    const ZSTD_CCtx_params* params, U64 pledgedSrcSize, +                                    const ZSTD_CCtx_params* params, U64 pledgedSrcSize,                                       ZSTD_buffered_policy_e zbuff)  {      size_t const dictContentSize = cdict ? cdict->dictContentSize : dictSize;  #if ZSTD_TRACE      cctx->traceCtx = (ZSTD_trace_compress_begin != NULL) ? ZSTD_trace_compress_begin(cctx) : 0;  #endif -    DEBUGLOG(4, "ZSTD_compressBegin_internal: wlog=%u", params->cParams.windowLog); +    DEBUGLOG(4, "ZSTD_compressBegin_internal: wlog=%u", params->cParams.windowLog);       /* params are supposed to be fully validated at this point */ -    assert(!ZSTD_isError(ZSTD_checkCParams(params->cParams))); +    assert(!ZSTD_isError(ZSTD_checkCParams(params->cParams)));       assert(!((dict) && (cdict)));  /* either dict or cdict, not both */ -    if ( (cdict) -      && (cdict->dictContentSize > 0) -      && ( pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_SRCSIZE_CUTOFF -        || pledgedSrcSize < cdict->dictContentSize * ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER -        || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN -        || cdict->compressionLevel == 0) -      && (params->attachDictPref != ZSTD_dictForceLoad) ) { +    if ( (cdict)  +      && (cdict->dictContentSize > 0)  +      && ( pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_SRCSIZE_CUTOFF  +        || pledgedSrcSize < cdict->dictContentSize * ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER  +        || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN  +        || cdict->compressionLevel == 0)  +      && (params->attachDictPref != ZSTD_dictForceLoad) ) {           return ZSTD_resetCCtx_usingCDict(cctx, cdict, params, pledgedSrcSize, zbuff);      }      FORWARD_IF_ERROR( ZSTD_resetCCtx_internal(cctx, params, pledgedSrcSize,                                       dictContentSize,                                       ZSTDcrp_makeClean, zbuff) , ""); -    {   size_t const dictID = cdict ? -                ZSTD_compress_insertDictionary( -                        cctx->blockState.prevCBlock, &cctx->blockState.matchState, +    {   size_t const dictID = cdict ?  +                ZSTD_compress_insertDictionary(  +                        cctx->blockState.prevCBlock, &cctx->blockState.matchState,                           &cctx->ldmState, &cctx->workspace, &cctx->appliedParams, cdict->dictContent,                          cdict->dictContentSize, cdict->dictContentType, dtlm,                          cctx->entropyWorkspace) -              : ZSTD_compress_insertDictionary( -                        cctx->blockState.prevCBlock, &cctx->blockState.matchState, +              : ZSTD_compress_insertDictionary(  +                        cctx->blockState.prevCBlock, &cctx->blockState.matchState,                           &cctx->ldmState, &cctx->workspace, &cctx->appliedParams, dict, dictSize, -                        dictContentType, dtlm, cctx->entropyWorkspace); +                        dictContentType, dtlm, cctx->entropyWorkspace);           FORWARD_IF_ERROR(dictID, "ZSTD_compress_insertDictionary failed");          assert(dictID <= UINT_MAX);          cctx->dictID = (U32)dictID; @@ -4538,10 +4538,10 @@ size_t ZSTD_compressBegin_advanced_internal(ZSTD_CCtx* cctx,                                      ZSTD_dictContentType_e dictContentType,                                      ZSTD_dictTableLoadMethod_e dtlm,                                      const ZSTD_CDict* cdict, -                                    const ZSTD_CCtx_params* params, +                                    const ZSTD_CCtx_params* params,                                       unsigned long long pledgedSrcSize)  { -    DEBUGLOG(4, "ZSTD_compressBegin_advanced_internal: wlog=%u", params->cParams.windowLog); +    DEBUGLOG(4, "ZSTD_compressBegin_advanced_internal: wlog=%u", params->cParams.windowLog);       /* compression parameters verification and optimization */      FORWARD_IF_ERROR( ZSTD_checkCParams(params->cParams) , "");      return ZSTD_compressBegin_internal(cctx, @@ -4562,7 +4562,7 @@ size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* cctx,      return ZSTD_compressBegin_advanced_internal(cctx,                                              dict, dictSize, ZSTD_dct_auto, ZSTD_dtlm_fast,                                              NULL /*cdict*/, -                                            &cctxParams, pledgedSrcSize); +                                            &cctxParams, pledgedSrcSize);   }  size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel) @@ -4574,7 +4574,7 @@ size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t di      }      DEBUGLOG(4, "ZSTD_compressBegin_usingDict (dictSize=%u)", (unsigned)dictSize);      return ZSTD_compressBegin_internal(cctx, dict, dictSize, ZSTD_dct_auto, ZSTD_dtlm_fast, NULL, -                                       &cctxParams, ZSTD_CONTENTSIZE_UNKNOWN, ZSTDb_not_buffered); +                                       &cctxParams, ZSTD_CONTENTSIZE_UNKNOWN, ZSTDb_not_buffered);   }  size_t ZSTD_compressBegin(ZSTD_CCtx* cctx, int compressionLevel) @@ -4597,7 +4597,7 @@ static size_t ZSTD_writeEpilogue(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity)      /* special case : empty frame */      if (cctx->stage == ZSTDcs_init) { -        fhSize = ZSTD_writeFrameHeader(dst, dstCapacity, &cctx->appliedParams, 0, 0); +        fhSize = ZSTD_writeFrameHeader(dst, dstCapacity, &cctx->appliedParams, 0, 0);           FORWARD_IF_ERROR(fhSize, "ZSTD_writeFrameHeader failed");          dstCapacity -= fhSize;          op += fhSize; @@ -4697,7 +4697,7 @@ size_t ZSTD_compress_advanced_internal(          void* dst, size_t dstCapacity,          const void* src, size_t srcSize,          const void* dict,size_t dictSize, -        const ZSTD_CCtx_params* params) +        const ZSTD_CCtx_params* params)   {      DEBUGLOG(4, "ZSTD_compress_advanced_internal (srcSize:%u)", (unsigned)srcSize);      FORWARD_IF_ERROR( ZSTD_compressBegin_internal(cctx, @@ -4760,14 +4760,14 @@ size_t ZSTD_estimateCDictSize_advanced(          ZSTD_dictLoadMethod_e dictLoadMethod)  {      DEBUGLOG(5, "sizeof(ZSTD_CDict) : %u", (unsigned)sizeof(ZSTD_CDict)); -    return ZSTD_cwksp_alloc_size(sizeof(ZSTD_CDict)) -         + ZSTD_cwksp_alloc_size(HUF_WORKSPACE_SIZE) +    return ZSTD_cwksp_alloc_size(sizeof(ZSTD_CDict))  +         + ZSTD_cwksp_alloc_size(HUF_WORKSPACE_SIZE)            /* enableDedicatedDictSearch == 1 ensures that CDict estimation will not be too small            * in case we are using DDS with row-hash. */           + ZSTD_sizeof_matchState(&cParams, ZSTD_resolveRowMatchFinderMode(ZSTD_ps_auto, &cParams),                                    /* enableDedicatedDictSearch */ 1, /* forCCtx */ 0) -         + (dictLoadMethod == ZSTD_dlm_byRef ? 0 -            : ZSTD_cwksp_alloc_size(ZSTD_cwksp_align(dictSize, sizeof(void *)))); +         + (dictLoadMethod == ZSTD_dlm_byRef ? 0  +            : ZSTD_cwksp_alloc_size(ZSTD_cwksp_align(dictSize, sizeof(void *))));   }  size_t ZSTD_estimateCDictSize(size_t dictSize, int compressionLevel) @@ -4780,9 +4780,9 @@ size_t ZSTD_sizeof_CDict(const ZSTD_CDict* cdict)  {      if (cdict==NULL) return 0;   /* support sizeof on NULL */      DEBUGLOG(5, "sizeof(*cdict) : %u", (unsigned)sizeof(*cdict)); -    /* cdict may be in the workspace */ -    return (cdict->workspace.workspace == cdict ? 0 : sizeof(*cdict)) -        + ZSTD_cwksp_sizeof(&cdict->workspace); +    /* cdict may be in the workspace */  +    return (cdict->workspace.workspace == cdict ? 0 : sizeof(*cdict))  +        + ZSTD_cwksp_sizeof(&cdict->workspace);   }  static size_t ZSTD_initCDict_internal( @@ -4799,7 +4799,7 @@ static size_t ZSTD_initCDict_internal(      if ((dictLoadMethod == ZSTD_dlm_byRef) || (!dictBuffer) || (!dictSize)) {          cdict->dictContent = dictBuffer;      } else { -         void *internalBuffer = ZSTD_cwksp_reserve_object(&cdict->workspace, ZSTD_cwksp_align(dictSize, sizeof(void*))); +         void *internalBuffer = ZSTD_cwksp_reserve_object(&cdict->workspace, ZSTD_cwksp_align(dictSize, sizeof(void*)));           RETURN_ERROR_IF(!internalBuffer, memory_allocation, "NULL pointer!");          cdict->dictContent = internalBuffer;          ZSTD_memcpy(internalBuffer, dictBuffer, dictSize); @@ -4807,28 +4807,28 @@ static size_t ZSTD_initCDict_internal(      cdict->dictContentSize = dictSize;      cdict->dictContentType = dictContentType; -    cdict->entropyWorkspace = (U32*)ZSTD_cwksp_reserve_object(&cdict->workspace, HUF_WORKSPACE_SIZE); - - +    cdict->entropyWorkspace = (U32*)ZSTD_cwksp_reserve_object(&cdict->workspace, HUF_WORKSPACE_SIZE);  +  +       /* Reset the state to no dictionary */      ZSTD_reset_compressedBlockState(&cdict->cBlockState); -    FORWARD_IF_ERROR(ZSTD_reset_matchState( -        &cdict->matchState, -        &cdict->workspace, +    FORWARD_IF_ERROR(ZSTD_reset_matchState(  +        &cdict->matchState,  +        &cdict->workspace,           ¶ms.cParams,          params.useRowMatchFinder, -        ZSTDcrp_makeClean, -        ZSTDirp_reset, +        ZSTDcrp_makeClean,  +        ZSTDirp_reset,           ZSTD_resetTarget_CDict), "");      /* (Maybe) load the dictionary -     * Skips loading the dictionary if it is < 8 bytes. +     * Skips loading the dictionary if it is < 8 bytes.        */      {   params.compressionLevel = ZSTD_CLEVEL_DEFAULT;          params.fParams.contentSizeFlag = 1;          {   size_t const dictID = ZSTD_compress_insertDictionary(                      &cdict->cBlockState, &cdict->matchState, NULL, &cdict->workspace, -                    ¶ms, cdict->dictContent, cdict->dictContentSize, -                    dictContentType, ZSTD_dtlm_full, cdict->entropyWorkspace); +                    ¶ms, cdict->dictContent, cdict->dictContentSize,  +                    dictContentType, ZSTD_dtlm_full, cdict->entropyWorkspace);               FORWARD_IF_ERROR(dictID, "ZSTD_compress_insertDictionary failed");              assert(dictID <= (size_t)(U32)-1);              cdict->dictID = (U32)dictID; @@ -4847,26 +4847,26 @@ static ZSTD_CDict* ZSTD_createCDict_advanced_internal(size_t dictSize,  {      if ((!customMem.customAlloc) ^ (!customMem.customFree)) return NULL; -    {   size_t const workspaceSize = -            ZSTD_cwksp_alloc_size(sizeof(ZSTD_CDict)) + -            ZSTD_cwksp_alloc_size(HUF_WORKSPACE_SIZE) + +    {   size_t const workspaceSize =  +            ZSTD_cwksp_alloc_size(sizeof(ZSTD_CDict)) +  +            ZSTD_cwksp_alloc_size(HUF_WORKSPACE_SIZE) +               ZSTD_sizeof_matchState(&cParams, useRowMatchFinder, enableDedicatedDictSearch, /* forCCtx */ 0) + -            (dictLoadMethod == ZSTD_dlm_byRef ? 0 -             : ZSTD_cwksp_alloc_size(ZSTD_cwksp_align(dictSize, sizeof(void*)))); +            (dictLoadMethod == ZSTD_dlm_byRef ? 0  +             : ZSTD_cwksp_alloc_size(ZSTD_cwksp_align(dictSize, sizeof(void*))));           void* const workspace = ZSTD_customMalloc(workspaceSize, customMem); -        ZSTD_cwksp ws; -        ZSTD_CDict* cdict; +        ZSTD_cwksp ws;  +        ZSTD_CDict* cdict;  -        if (!workspace) { +        if (!workspace) {               ZSTD_customFree(workspace, customMem);              return NULL;          } - +           ZSTD_cwksp_init(&ws, workspace, workspaceSize, ZSTD_cwksp_dynamic_alloc); - -        cdict = (ZSTD_CDict*)ZSTD_cwksp_reserve_object(&ws, sizeof(ZSTD_CDict)); -        assert(cdict != NULL); -        ZSTD_cwksp_move(&cdict->workspace, &ws); +  +        cdict = (ZSTD_CDict*)ZSTD_cwksp_reserve_object(&ws, sizeof(ZSTD_CDict));  +        assert(cdict != NULL);  +        ZSTD_cwksp_move(&cdict->workspace, &ws);           cdict->customMem = customMem;          cdict->compressionLevel = ZSTD_NO_CLEVEL; /* signals advanced API usage */          cdict->useRowMatchFinder = useRowMatchFinder; @@ -4945,11 +4945,11 @@ ZSTD_CDict* ZSTD_createCDict(const void* dict, size_t dictSize, int compressionL  {      ZSTD_compressionParameters cParams = ZSTD_getCParams_internal(compressionLevel, ZSTD_CONTENTSIZE_UNKNOWN, dictSize, ZSTD_cpm_createCDict);      ZSTD_CDict* const cdict = ZSTD_createCDict_advanced(dict, dictSize, -                                                  ZSTD_dlm_byCopy, ZSTD_dct_auto, -                                                  cParams, ZSTD_defaultCMem); -    if (cdict) +                                                  ZSTD_dlm_byCopy, ZSTD_dct_auto,  +                                                  cParams, ZSTD_defaultCMem);  +    if (cdict)           cdict->compressionLevel = (compressionLevel == 0) ? ZSTD_CLEVEL_DEFAULT : compressionLevel; -    return cdict; +    return cdict;   }  ZSTD_CDict* ZSTD_createCDict_byReference(const void* dict, size_t dictSize, int compressionLevel) @@ -4967,11 +4967,11 @@ size_t ZSTD_freeCDict(ZSTD_CDict* cdict)  {      if (cdict==NULL) return 0;   /* support free on NULL */      {   ZSTD_customMem const cMem = cdict->customMem; -        int cdictInWorkspace = ZSTD_cwksp_owns_buffer(&cdict->workspace, cdict); -        ZSTD_cwksp_free(&cdict->workspace, cMem); -        if (!cdictInWorkspace) { +        int cdictInWorkspace = ZSTD_cwksp_owns_buffer(&cdict->workspace, cdict);  +        ZSTD_cwksp_free(&cdict->workspace, cMem);  +        if (!cdictInWorkspace) {               ZSTD_customFree(cdict, cMem); -        } +        }           return 0;      }  } @@ -4999,24 +4999,24 @@ const ZSTD_CDict* ZSTD_initStaticCDict(      ZSTD_paramSwitch_e const useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(ZSTD_ps_auto, &cParams);      /* enableDedicatedDictSearch == 1 ensures matchstate is not too small in case this CDict will be used for DDS + row hash */      size_t const matchStateSize = ZSTD_sizeof_matchState(&cParams, useRowMatchFinder, /* enableDedicatedDictSearch */ 1, /* forCCtx */ 0); -    size_t const neededSize = ZSTD_cwksp_alloc_size(sizeof(ZSTD_CDict)) -                            + (dictLoadMethod == ZSTD_dlm_byRef ? 0 -                               : ZSTD_cwksp_alloc_size(ZSTD_cwksp_align(dictSize, sizeof(void*)))) -                            + ZSTD_cwksp_alloc_size(HUF_WORKSPACE_SIZE) -                            + matchStateSize; -    ZSTD_CDict* cdict; +    size_t const neededSize = ZSTD_cwksp_alloc_size(sizeof(ZSTD_CDict))  +                            + (dictLoadMethod == ZSTD_dlm_byRef ? 0  +                               : ZSTD_cwksp_alloc_size(ZSTD_cwksp_align(dictSize, sizeof(void*))))  +                            + ZSTD_cwksp_alloc_size(HUF_WORKSPACE_SIZE)  +                            + matchStateSize;  +    ZSTD_CDict* cdict;       ZSTD_CCtx_params params; - +       if ((size_t)workspace & 7) return NULL;  /* 8-aligned */ - -    { -        ZSTD_cwksp ws; +  +    {  +        ZSTD_cwksp ws;           ZSTD_cwksp_init(&ws, workspace, workspaceSize, ZSTD_cwksp_static_alloc); -        cdict = (ZSTD_CDict*)ZSTD_cwksp_reserve_object(&ws, sizeof(ZSTD_CDict)); -        if (cdict == NULL) return NULL; -        ZSTD_cwksp_move(&cdict->workspace, &ws); -    } - +        cdict = (ZSTD_CDict*)ZSTD_cwksp_reserve_object(&ws, sizeof(ZSTD_CDict));  +        if (cdict == NULL) return NULL;  +        ZSTD_cwksp_move(&cdict->workspace, &ws);  +    }  +       DEBUGLOG(4, "(workspaceSize < neededSize) : (%u < %u) => %u",          (unsigned)workspaceSize, (unsigned)neededSize, (unsigned)(workspaceSize < neededSize));      if (workspaceSize < neededSize) return NULL; @@ -5028,7 +5028,7 @@ const ZSTD_CDict* ZSTD_initStaticCDict(      if (ZSTD_isError( ZSTD_initCDict_internal(cdict,                                                dict, dictSize, -                                              dictLoadMethod, dictContentType, +                                              dictLoadMethod, dictContentType,                                                 params) ))          return NULL; @@ -5065,14 +5065,14 @@ static size_t ZSTD_compressBegin_usingCDict_internal(      {          ZSTD_parameters params;          params.fParams = fParams; -        params.cParams = ( pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_SRCSIZE_CUTOFF -                        || pledgedSrcSize < cdict->dictContentSize * ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER -                        || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN +        params.cParams = ( pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_SRCSIZE_CUTOFF  +                        || pledgedSrcSize < cdict->dictContentSize * ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER  +                        || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN                           || cdict->compressionLevel == 0 ) ? -                ZSTD_getCParamsFromCDict(cdict) -              : ZSTD_getCParams(cdict->compressionLevel, -                                pledgedSrcSize, -                                cdict->dictContentSize); +                ZSTD_getCParamsFromCDict(cdict)  +              : ZSTD_getCParams(cdict->compressionLevel,  +                                pledgedSrcSize,  +                                cdict->dictContentSize);           ZSTD_CCtxParams_init_internal(&cctxParams, ¶ms, cdict->compressionLevel);      }      /* Increase window log to fit the entire dictionary and source if the @@ -5214,14 +5214,14 @@ size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pss)   *  Assumption 2 : either dict, or cdict, is defined, not both */  size_t ZSTD_initCStream_internal(ZSTD_CStream* zcs,                      const void* dict, size_t dictSize, const ZSTD_CDict* cdict, -                    const ZSTD_CCtx_params* params, -                    unsigned long long pledgedSrcSize) +                    const ZSTD_CCtx_params* params,  +                    unsigned long long pledgedSrcSize)   {      DEBUGLOG(4, "ZSTD_initCStream_internal");      FORWARD_IF_ERROR( ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only) , "");      FORWARD_IF_ERROR( ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize) , ""); -    assert(!ZSTD_isError(ZSTD_checkCParams(params->cParams))); -    zcs->requestedParams = *params; +    assert(!ZSTD_isError(ZSTD_checkCParams(params->cParams)));  +    zcs->requestedParams = *params;       assert(!((dict) && (cdict)));  /* either dict or cdict, not both */      if (dict) {          FORWARD_IF_ERROR( ZSTD_CCtx_loadDictionary(zcs, dict, dictSize) , ""); @@ -5260,7 +5260,7 @@ size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict)  /* ZSTD_initCStream_advanced() :   * pledgedSrcSize must be exact.   * if srcSize is not known at init time, use value ZSTD_CONTENTSIZE_UNKNOWN. - * dict is loaded with default parameters ZSTD_dct_auto and ZSTD_dlm_byCopy. */ + * dict is loaded with default parameters ZSTD_dct_auto and ZSTD_dlm_byCopy. */   size_t ZSTD_initCStream_advanced(ZSTD_CStream* zcs,                                   const void* dict, size_t dictSize,                                   ZSTD_parameters params, unsigned long long pss) diff --git a/contrib/libs/zstd/lib/compress/zstd_compress_internal.h b/contrib/libs/zstd/lib/compress/zstd_compress_internal.h index c406e794bdb..fcba5e8953a 100644 --- a/contrib/libs/zstd/lib/compress/zstd_compress_internal.h +++ b/contrib/libs/zstd/lib/compress/zstd_compress_internal.h @@ -19,7 +19,7 @@  *  Dependencies  ***************************************/  #include "../common/zstd_internal.h" -#include "zstd_cwksp.h" +#include "zstd_cwksp.h"   #ifdef ZSTD_MULTITHREAD  #  include "zstdmt_compress.h"  #endif @@ -207,15 +207,15 @@ typedef struct ZSTD_matchState_t ZSTD_matchState_t;  struct ZSTD_matchState_t {      ZSTD_window_t window;   /* State for window round buffer management */ -    U32 loadedDictEnd;      /* index of end of dictionary, within context's referential. -                             * When loadedDictEnd != 0, a dictionary is in use, and still valid. -                             * This relies on a mechanism to set loadedDictEnd=0 when dictionary is no longer within distance. -                             * Such mechanism is provided within ZSTD_window_enforceMaxDist() and ZSTD_checkDictValidity(). -                             * When dict referential is copied into active context (i.e. not attached), -                             * loadedDictEnd == dictSize, since referential starts from zero. -                             */ +    U32 loadedDictEnd;      /* index of end of dictionary, within context's referential.  +                             * When loadedDictEnd != 0, a dictionary is in use, and still valid.  +                             * This relies on a mechanism to set loadedDictEnd=0 when dictionary is no longer within distance.  +                             * Such mechanism is provided within ZSTD_window_enforceMaxDist() and ZSTD_checkDictValidity().  +                             * When dict referential is copied into active context (i.e. not attached),  +                             * loadedDictEnd == dictSize, since referential starts from zero.  +                             */       U32 nextToUpdate;       /* index from which to continue table update */ -    U32 hashLog3;           /* dispatch table for matches of len==3 : larger == faster, more memory */ +    U32 hashLog3;           /* dispatch table for matches of len==3 : larger == faster, more memory */       U32 rowHashLog;                          /* For row-based matchfinder: Hashlog based on nb of rows in the hashTable.*/      U16* tagTable;                           /* For row-based matchFinder: A row-based table containing the hashes and head index. */ @@ -275,12 +275,12 @@ typedef struct {  } ldmParams_t;  typedef struct { -    int collectSequences; -    ZSTD_Sequence* seqStart; -    size_t seqIndex; -    size_t maxSequences; -} SeqCollector; - +    int collectSequences;  +    ZSTD_Sequence* seqStart;  +    size_t seqIndex;  +    size_t maxSequences;  +} SeqCollector;  +   struct ZSTD_CCtx_params_s {      ZSTD_format_e format;      ZSTD_compressionParameters cParams; @@ -292,9 +292,9 @@ struct ZSTD_CCtx_params_s {      size_t targetCBlockSize;   /* Tries to fit compressed block size to be around targetCBlockSize.                                  * No target when targetCBlockSize == 0.                                  * There is no guarantee on compressed block size */ -    int srcSizeHint;           /* User's best guess of source size. -                                * Hint is not valid when srcSizeHint == 0. -                                * There is no guarantee that hint is close to actual source size */ +    int srcSizeHint;           /* User's best guess of source size.  +                                * Hint is not valid when srcSizeHint == 0.  +                                * There is no guarantee that hint is close to actual source size */       ZSTD_dictAttachPref_e attachDictPref;      ZSTD_paramSwitch_e literalCompressionMode; @@ -371,7 +371,7 @@ struct ZSTD_CCtx_s {      U32   dictID;      size_t dictContentSize; -    ZSTD_cwksp workspace; /* manages buffer for dynamic allocations */ +    ZSTD_cwksp workspace; /* manages buffer for dynamic allocations */       size_t blockSize;      unsigned long long pledgedSrcSizePlusOne;  /* this way, 0 (default) == unknown */      unsigned long long consumedSrcSize; @@ -380,8 +380,8 @@ struct ZSTD_CCtx_s {      ZSTD_customMem customMem;      ZSTD_threadPool* pool;      size_t staticSize; -    SeqCollector seqCollector; -    int isFirstBlock; +    SeqCollector seqCollector;  +    int isFirstBlock;       int initialized;      seqStore_t seqStore;      /* sequences storage ptrs */ @@ -560,23 +560,23 @@ MEM_STATIC int ZSTD_literalsCompressionIsDisabled(const ZSTD_CCtx_params* cctxPa      }  } -/*! ZSTD_safecopyLiterals() : - *  memcpy() function that won't read beyond more than WILDCOPY_OVERLENGTH bytes past ilimit_w. - *  Only called when the sequence ends past ilimit_w, so it only needs to be optimized for single - *  large copies. - */ +/*! ZSTD_safecopyLiterals() :  + *  memcpy() function that won't read beyond more than WILDCOPY_OVERLENGTH bytes past ilimit_w.  + *  Only called when the sequence ends past ilimit_w, so it only needs to be optimized for single  + *  large copies.  + */   static void  ZSTD_safecopyLiterals(BYTE* op, BYTE const* ip, BYTE const* const iend, BYTE const* ilimit_w)  { -    assert(iend > ilimit_w); -    if (ip <= ilimit_w) { -        ZSTD_wildcopy(op, ip, ilimit_w - ip, ZSTD_no_overlap); -        op += ilimit_w - ip; -        ip = ilimit_w; -    } -    while (ip < iend) *op++ = *ip++; -} - +    assert(iend > ilimit_w);  +    if (ip <= ilimit_w) {  +        ZSTD_wildcopy(op, ip, ilimit_w - ip, ZSTD_no_overlap);  +        op += ilimit_w - ip;  +        ip = ilimit_w;  +    }  +    while (ip < iend) *op++ = *ip++;  +}  +   #define ZSTD_REP_MOVE     (ZSTD_REP_NUM-1)  #define STORE_REPCODE_1 STORE_REPCODE(1)  #define STORE_REPCODE_2 STORE_REPCODE(2) @@ -594,7 +594,7 @@ ZSTD_safecopyLiterals(BYTE* op, BYTE const* ip, BYTE const* const iend, BYTE con   *  Store a sequence (litlen, litPtr, offCode and matchLength) into seqStore_t.   *  @offBase_minus1 : Users should use employ macros STORE_REPCODE_X and STORE_OFFSET().   *  @matchLength : must be >= MINMATCH - *  Allowed to overread literals up to litLimit. + *  Allowed to overread literals up to litLimit.   */  HINT_INLINE UNUSED_ATTR void  ZSTD_storeSeq(seqStore_t* seqStorePtr, @@ -602,8 +602,8 @@ ZSTD_storeSeq(seqStore_t* seqStorePtr,                U32 offBase_minus1,                size_t matchLength)  { -    BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH; -    BYTE const* const litEnd = literals + litLength; +    BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH;  +    BYTE const* const litEnd = literals + litLength;   #if defined(DEBUGLEVEL) && (DEBUGLEVEL >= 6)      static const BYTE* g_start = NULL;      if (g_start==NULL) g_start = (const BYTE*)literals;  /* note : index only works for compression within a single segment */ @@ -616,19 +616,19 @@ ZSTD_storeSeq(seqStore_t* seqStorePtr,      /* copy Literals */      assert(seqStorePtr->maxNbLit <= 128 KB);      assert(seqStorePtr->lit + litLength <= seqStorePtr->litStart + seqStorePtr->maxNbLit); -    assert(literals + litLength <= litLimit); -    if (litEnd <= litLimit_w) { -        /* Common case we can use wildcopy. -	 * First copy 16 bytes, because literals are likely short. -	 */ -        assert(WILDCOPY_OVERLENGTH >= 16); -        ZSTD_copy16(seqStorePtr->lit, literals); -        if (litLength > 16) { -            ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, (ptrdiff_t)litLength-16, ZSTD_no_overlap); -        } -    } else { -        ZSTD_safecopyLiterals(seqStorePtr->lit, literals, litEnd, litLimit_w); -    } +    assert(literals + litLength <= litLimit);  +    if (litEnd <= litLimit_w) {  +        /* Common case we can use wildcopy.  +	 * First copy 16 bytes, because literals are likely short.  +	 */  +        assert(WILDCOPY_OVERLENGTH >= 16);  +        ZSTD_copy16(seqStorePtr->lit, literals);  +        if (litLength > 16) {  +            ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, (ptrdiff_t)litLength-16, ZSTD_no_overlap);  +        }  +    } else {  +        ZSTD_safecopyLiterals(seqStorePtr->lit, literals, litEnd, litLimit_w);  +    }       seqStorePtr->lit += litLength;      /* literal Length */ @@ -1204,37 +1204,37 @@ ZSTD_window_enforceMaxDist(ZSTD_window_t* window,  /* Similar to ZSTD_window_enforceMaxDist(),   * but only invalidates dictionary - * when input progresses beyond window size. - * assumption : loadedDictEndPtr and dictMatchStatePtr are valid (non NULL) - *              loadedDictEnd uses same referential as window->base - *              maxDist is the window size */ + * when input progresses beyond window size.  + * assumption : loadedDictEndPtr and dictMatchStatePtr are valid (non NULL)  + *              loadedDictEnd uses same referential as window->base  + *              maxDist is the window size */   MEM_STATIC void -ZSTD_checkDictValidity(const ZSTD_window_t* window, +ZSTD_checkDictValidity(const ZSTD_window_t* window,                          const void* blockEnd,                               U32   maxDist,                               U32*  loadedDictEndPtr,                         const ZSTD_matchState_t** dictMatchStatePtr)  { -    assert(loadedDictEndPtr != NULL); -    assert(dictMatchStatePtr != NULL); -    {   U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base); -        U32 const loadedDictEnd = *loadedDictEndPtr; -        DEBUGLOG(5, "ZSTD_checkDictValidity: blockEndIdx=%u, maxDist=%u, loadedDictEnd=%u", -                    (unsigned)blockEndIdx, (unsigned)maxDist, (unsigned)loadedDictEnd); -        assert(blockEndIdx >= loadedDictEnd); - -        if (blockEndIdx > loadedDictEnd + maxDist) { -            /* On reaching window size, dictionaries are invalidated. -             * For simplification, if window size is reached anywhere within next block, -             * the dictionary is invalidated for the full block. -             */ -            DEBUGLOG(6, "invalidating dictionary for current block (distance > windowSize)"); -            *loadedDictEndPtr = 0; -            *dictMatchStatePtr = NULL; -        } else { -            if (*loadedDictEndPtr != 0) { -                DEBUGLOG(6, "dictionary considered valid for current block"); -    }   }   } +    assert(loadedDictEndPtr != NULL);  +    assert(dictMatchStatePtr != NULL);  +    {   U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base);  +        U32 const loadedDictEnd = *loadedDictEndPtr;  +        DEBUGLOG(5, "ZSTD_checkDictValidity: blockEndIdx=%u, maxDist=%u, loadedDictEnd=%u",  +                    (unsigned)blockEndIdx, (unsigned)maxDist, (unsigned)loadedDictEnd);  +        assert(blockEndIdx >= loadedDictEnd);  + +        if (blockEndIdx > loadedDictEnd + maxDist) {  +            /* On reaching window size, dictionaries are invalidated.  +             * For simplification, if window size is reached anywhere within next block,  +             * the dictionary is invalidated for the full block.  +             */  +            DEBUGLOG(6, "invalidating dictionary for current block (distance > windowSize)");  +            *loadedDictEndPtr = 0;  +            *dictMatchStatePtr = NULL;  +        } else {  +            if (*loadedDictEndPtr != 0) {  +                DEBUGLOG(6, "dictionary considered valid for current block");  +    }   }   }   }  MEM_STATIC void ZSTD_window_init(ZSTD_window_t* window) { @@ -1296,7 +1296,7 @@ MEM_STATIC U32 ZSTD_window_update(ZSTD_window_t* window,   * Returns the lowest allowed match index. It may either be in the ext-dict or the prefix.   */  MEM_STATIC U32 ZSTD_getLowestMatchIndex(const ZSTD_matchState_t* ms, U32 curr, unsigned windowLog) -{ +{       U32 const maxDistance = 1U << windowLog;      U32 const lowestValid = ms->window.lowLimit;      U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid; @@ -1306,8 +1306,8 @@ MEM_STATIC U32 ZSTD_getLowestMatchIndex(const ZSTD_matchState_t* ms, U32 curr, u       * valid for the entire block. So this check is sufficient to find the lowest valid match index.       */      U32 const matchLowest = isDictionary ? lowestValid : withinWindow; -    return matchLowest; -} +    return matchLowest;  +}   /**   * Returns the lowest allowed match index in the prefix. @@ -1324,8 +1324,8 @@ MEM_STATIC U32 ZSTD_getLowestPrefixIndex(const ZSTD_matchState_t* ms, U32 curr,      U32    const matchLowest = isDictionary ? lowestValid : withinWindow;      return matchLowest;  } - - +  +   /* debug functions */  #if (DEBUGLEVEL>=2) @@ -1399,7 +1399,7 @@ ZSTD_compressionParameters ZSTD_getCParamsFromCCtxParams(  size_t ZSTD_initCStream_internal(ZSTD_CStream* zcs,                       const void* dict, size_t dictSize,                       const ZSTD_CDict* cdict, -                     const ZSTD_CCtx_params* params, unsigned long long pledgedSrcSize); +                     const ZSTD_CCtx_params* params, unsigned long long pledgedSrcSize);   void ZSTD_resetSeqStore(seqStore_t* ssPtr); @@ -1414,7 +1414,7 @@ size_t ZSTD_compressBegin_advanced_internal(ZSTD_CCtx* cctx,                                      ZSTD_dictContentType_e dictContentType,                                      ZSTD_dictTableLoadMethod_e dtlm,                                      const ZSTD_CDict* cdict, -                                    const ZSTD_CCtx_params* params, +                                    const ZSTD_CCtx_params* params,                                       unsigned long long pledgedSrcSize);  /* ZSTD_compress_advanced_internal() : @@ -1423,7 +1423,7 @@ size_t ZSTD_compress_advanced_internal(ZSTD_CCtx* cctx,                                         void* dst, size_t dstCapacity,                                   const void* src, size_t srcSize,                                   const void* dict,size_t dictSize, -                                 const ZSTD_CCtx_params* params); +                                 const ZSTD_CCtx_params* params);   /* ZSTD_writeLastEmptyBlock() : diff --git a/contrib/libs/zstd/lib/compress/zstd_compress_literals.c b/contrib/libs/zstd/lib/compress/zstd_compress_literals.c index 52b0a8059ab..38905e42e64 100644 --- a/contrib/libs/zstd/lib/compress/zstd_compress_literals.c +++ b/contrib/libs/zstd/lib/compress/zstd_compress_literals.c @@ -72,7 +72,7 @@ size_t ZSTD_compressLiterals (ZSTD_hufCTables_t const* prevHuf,                                ZSTD_strategy strategy, int disableLiteralCompression,                                void* dst, size_t dstCapacity,                          const void* src, size_t srcSize, -                              void* entropyWorkspace, size_t entropyWorkspaceSize, +                              void* entropyWorkspace, size_t entropyWorkspaceSize,                           const int bmi2,                          unsigned suspectUncompressible)  { @@ -102,13 +102,13 @@ size_t ZSTD_compressLiterals (ZSTD_hufCTables_t const* prevHuf,      {   HUF_repeat repeat = prevHuf->repeatMode;          int const preferRepeat = strategy < ZSTD_lazy ? srcSize <= 1024 : 0;          if (repeat == HUF_repeat_valid && lhSize == 3) singleStream = 1; -        cLitSize = singleStream ? -            HUF_compress1X_repeat( -                ostart+lhSize, dstCapacity-lhSize, src, srcSize, +        cLitSize = singleStream ?  +            HUF_compress1X_repeat(  +                ostart+lhSize, dstCapacity-lhSize, src, srcSize,                   HUF_SYMBOLVALUE_MAX, HUF_TABLELOG_DEFAULT, entropyWorkspace, entropyWorkspaceSize,                  (HUF_CElt*)nextHuf->CTable, &repeat, preferRepeat, bmi2, suspectUncompressible) : -            HUF_compress4X_repeat( -                ostart+lhSize, dstCapacity-lhSize, src, srcSize, +            HUF_compress4X_repeat(  +                ostart+lhSize, dstCapacity-lhSize, src, srcSize,                   HUF_SYMBOLVALUE_MAX, HUF_TABLELOG_DEFAULT, entropyWorkspace, entropyWorkspaceSize,                  (HUF_CElt*)nextHuf->CTable, &repeat, preferRepeat, bmi2, suspectUncompressible);          if (repeat != HUF_repeat_none) { diff --git a/contrib/libs/zstd/lib/compress/zstd_compress_literals.h b/contrib/libs/zstd/lib/compress/zstd_compress_literals.h index 9775fb97cb7..55b4c5c04ee 100644 --- a/contrib/libs/zstd/lib/compress/zstd_compress_literals.h +++ b/contrib/libs/zstd/lib/compress/zstd_compress_literals.h @@ -24,7 +24,7 @@ size_t ZSTD_compressLiterals (ZSTD_hufCTables_t const* prevHuf,                                ZSTD_strategy strategy, int disableLiteralCompression,                                void* dst, size_t dstCapacity,                          const void* src, size_t srcSize, -                              void* entropyWorkspace, size_t entropyWorkspaceSize, +                              void* entropyWorkspace, size_t entropyWorkspaceSize,                           const int bmi2,                          unsigned suspectUncompressible); diff --git a/contrib/libs/zstd/lib/compress/zstd_compress_sequences.c b/contrib/libs/zstd/lib/compress/zstd_compress_sequences.c index f1e40af2ea0..a8463bbb99d 100644 --- a/contrib/libs/zstd/lib/compress/zstd_compress_sequences.c +++ b/contrib/libs/zstd/lib/compress/zstd_compress_sequences.c @@ -246,7 +246,7 @@ ZSTD_buildCTable(void* dst, size_t dstCapacity,                  const BYTE* codeTable, size_t nbSeq,                  const S16* defaultNorm, U32 defaultNormLog, U32 defaultMax,                  const FSE_CTable* prevCTable, size_t prevCTableSize, -                void* entropyWorkspace, size_t entropyWorkspaceSize) +                void* entropyWorkspace, size_t entropyWorkspaceSize)   {      BYTE* op = (BYTE*)dst;      const BYTE* const oend = op + dstCapacity; diff --git a/contrib/libs/zstd/lib/compress/zstd_compress_sequences.h b/contrib/libs/zstd/lib/compress/zstd_compress_sequences.h index 7991364c2f7..d0a0118da3e 100644 --- a/contrib/libs/zstd/lib/compress/zstd_compress_sequences.h +++ b/contrib/libs/zstd/lib/compress/zstd_compress_sequences.h @@ -35,7 +35,7 @@ ZSTD_buildCTable(void* dst, size_t dstCapacity,                  const BYTE* codeTable, size_t nbSeq,                  const S16* defaultNorm, U32 defaultNormLog, U32 defaultMax,                  const FSE_CTable* prevCTable, size_t prevCTableSize, -                void* entropyWorkspace, size_t entropyWorkspaceSize); +                void* entropyWorkspace, size_t entropyWorkspaceSize);   size_t ZSTD_encodeSequences(              void* dst, size_t dstCapacity, diff --git a/contrib/libs/zstd/lib/compress/zstd_cwksp.h b/contrib/libs/zstd/lib/compress/zstd_cwksp.h index dc3f40c80c3..327c1deb8b6 100644 --- a/contrib/libs/zstd/lib/compress/zstd_cwksp.h +++ b/contrib/libs/zstd/lib/compress/zstd_cwksp.h @@ -1,54 +1,54 @@ -/* +/*    * Copyright (c) Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef ZSTD_CWKSP_H -#define ZSTD_CWKSP_H - -/*-************************************* -*  Dependencies -***************************************/ + * All rights reserved.  + *  + * This source code is licensed under both the BSD-style license (found in the  + * LICENSE file in the root directory of this source tree) and the GPLv2 (found  + * in the COPYING file in the root directory of this source tree).  + * You may select, at your option, one of the above-listed licenses.  + */  +  +#ifndef ZSTD_CWKSP_H  +#define ZSTD_CWKSP_H  +  +/*-*************************************  +*  Dependencies  +***************************************/   #include "../common/zstd_internal.h" - -#if defined (__cplusplus) -extern "C" { -#endif - -/*-************************************* -*  Constants -***************************************/ - -/* Since the workspace is effectively its own little malloc implementation / - * arena, when we run under ASAN, we should similarly insert redzones between - * each internal element of the workspace, so ASAN will catch overruns that - * reach outside an object but that stay inside the workspace. - * - * This defines the size of that redzone. - */ -#ifndef ZSTD_CWKSP_ASAN_REDZONE_SIZE -#define ZSTD_CWKSP_ASAN_REDZONE_SIZE 128 -#endif - +  +#if defined (__cplusplus)  +extern "C" {  +#endif  +  +/*-*************************************  +*  Constants  +***************************************/  +  +/* Since the workspace is effectively its own little malloc implementation /  + * arena, when we run under ASAN, we should similarly insert redzones between  + * each internal element of the workspace, so ASAN will catch overruns that  + * reach outside an object but that stay inside the workspace.  + *  + * This defines the size of that redzone.  + */  +#ifndef ZSTD_CWKSP_ASAN_REDZONE_SIZE  +#define ZSTD_CWKSP_ASAN_REDZONE_SIZE 128  +#endif  +   /* Set our tables and aligneds to align by 64 bytes */  #define ZSTD_CWKSP_ALIGNMENT_BYTES 64 -/*-************************************* -*  Structures -***************************************/ -typedef enum { -    ZSTD_cwksp_alloc_objects, -    ZSTD_cwksp_alloc_buffers, -    ZSTD_cwksp_alloc_aligned -} ZSTD_cwksp_alloc_phase_e; - -/** +/*-*************************************  +*  Structures  +***************************************/  +typedef enum {  +    ZSTD_cwksp_alloc_objects,  +    ZSTD_cwksp_alloc_buffers,  +    ZSTD_cwksp_alloc_aligned  +} ZSTD_cwksp_alloc_phase_e;  +  +/**    * Used to describe whether the workspace is statically allocated (and will not   * necessarily ever be freed), or if it's dynamically allocated and we can   * expect a well-formed caller to free this. @@ -59,151 +59,151 @@ typedef enum {  } ZSTD_cwksp_static_alloc_e;  /** - * Zstd fits all its internal datastructures into a single continuous buffer, - * so that it only needs to perform a single OS allocation (or so that a buffer - * can be provided to it and it can perform no allocations at all). This buffer - * is called the workspace. - * - * Several optimizations complicate that process of allocating memory ranges - * from this workspace for each internal datastructure: - * - * - These different internal datastructures have different setup requirements: - * - *   - The static objects need to be cleared once and can then be trivially - *     reused for each compression. - * - *   - Various buffers don't need to be initialized at all--they are always - *     written into before they're read. - * - *   - The matchstate tables have a unique requirement that they don't need - *     their memory to be totally cleared, but they do need the memory to have - *     some bound, i.e., a guarantee that all values in the memory they've been - *     allocated is less than some maximum value (which is the starting value - *     for the indices that they will then use for compression). When this - *     guarantee is provided to them, they can use the memory without any setup - *     work. When it can't, they have to clear the area. - * - * - These buffers also have different alignment requirements. - * - * - We would like to reuse the objects in the workspace for multiple - *   compressions without having to perform any expensive reallocation or - *   reinitialization work. - * - * - We would like to be able to efficiently reuse the workspace across - *   multiple compressions **even when the compression parameters change** and - *   we need to resize some of the objects (where possible). - * - * To attempt to manage this buffer, given these constraints, the ZSTD_cwksp - * abstraction was created. It works as follows: - * - * Workspace Layout: - * - * [                        ... workspace ...                         ] - * [objects][tables ... ->] free space [<- ... aligned][<- ... buffers] - * - * The various objects that live in the workspace are divided into the - * following categories, and are allocated separately: - * - * - Static objects: this is optionally the enclosing ZSTD_CCtx or ZSTD_CDict, - *   so that literally everything fits in a single buffer. Note: if present, + * Zstd fits all its internal datastructures into a single continuous buffer,  + * so that it only needs to perform a single OS allocation (or so that a buffer  + * can be provided to it and it can perform no allocations at all). This buffer  + * is called the workspace.  + *  + * Several optimizations complicate that process of allocating memory ranges  + * from this workspace for each internal datastructure:  + *  + * - These different internal datastructures have different setup requirements:  + *  + *   - The static objects need to be cleared once and can then be trivially  + *     reused for each compression.  + *  + *   - Various buffers don't need to be initialized at all--they are always  + *     written into before they're read.  + *  + *   - The matchstate tables have a unique requirement that they don't need  + *     their memory to be totally cleared, but they do need the memory to have  + *     some bound, i.e., a guarantee that all values in the memory they've been  + *     allocated is less than some maximum value (which is the starting value  + *     for the indices that they will then use for compression). When this  + *     guarantee is provided to them, they can use the memory without any setup  + *     work. When it can't, they have to clear the area.  + *  + * - These buffers also have different alignment requirements.  + *  + * - We would like to reuse the objects in the workspace for multiple  + *   compressions without having to perform any expensive reallocation or  + *   reinitialization work.  + *  + * - We would like to be able to efficiently reuse the workspace across  + *   multiple compressions **even when the compression parameters change** and  + *   we need to resize some of the objects (where possible).  + *  + * To attempt to manage this buffer, given these constraints, the ZSTD_cwksp  + * abstraction was created. It works as follows:  + *  + * Workspace Layout:  + *  + * [                        ... workspace ...                         ]  + * [objects][tables ... ->] free space [<- ... aligned][<- ... buffers]  + *  + * The various objects that live in the workspace are divided into the  + * following categories, and are allocated separately:  + *  + * - Static objects: this is optionally the enclosing ZSTD_CCtx or ZSTD_CDict,  + *   so that literally everything fits in a single buffer. Note: if present,    *   this must be the first object in the workspace, since ZSTD_customFree{CCtx, - *   CDict}() rely on a pointer comparison to see whether one or two frees are - *   required. - * - * - Fixed size objects: these are fixed-size, fixed-count objects that are - *   nonetheless "dynamically" allocated in the workspace so that we can - *   control how they're initialized separately from the broader ZSTD_CCtx. - *   Examples: - *   - Entropy Workspace - *   - 2 x ZSTD_compressedBlockState_t - *   - CDict dictionary contents - * - * - Tables: these are any of several different datastructures (hash tables, - *   chain tables, binary trees) that all respect a common format: they are - *   uint32_t arrays, all of whose values are between 0 and (nextSrc - base). + *   CDict}() rely on a pointer comparison to see whether one or two frees are  + *   required.  + *  + * - Fixed size objects: these are fixed-size, fixed-count objects that are  + *   nonetheless "dynamically" allocated in the workspace so that we can  + *   control how they're initialized separately from the broader ZSTD_CCtx.  + *   Examples:  + *   - Entropy Workspace  + *   - 2 x ZSTD_compressedBlockState_t  + *   - CDict dictionary contents  + *  + * - Tables: these are any of several different datastructures (hash tables,  + *   chain tables, binary trees) that all respect a common format: they are  + *   uint32_t arrays, all of whose values are between 0 and (nextSrc - base).    *   Their sizes depend on the cparams. These tables are 64-byte aligned. - * - * - Aligned: these buffers are used for various purposes that require 4 byte + *  + * - Aligned: these buffers are used for various purposes that require 4 byte    *   alignment, but don't require any initialization before they're used. These   *   buffers are each aligned to 64 bytes. - * - * - Buffers: these buffers are used for various purposes that don't require - *   any alignment or initialization before they're used. This means they can - *   be moved around at no cost for a new compression. - * - * Allocating Memory: - * - * The various types of objects must be allocated in order, so they can be - * correctly packed into the workspace buffer. That order is: - * - * 1. Objects - * 2. Buffers + *  + * - Buffers: these buffers are used for various purposes that don't require  + *   any alignment or initialization before they're used. This means they can  + *   be moved around at no cost for a new compression.  + *  + * Allocating Memory:  + *  + * The various types of objects must be allocated in order, so they can be  + * correctly packed into the workspace buffer. That order is:  + *  + * 1. Objects  + * 2. Buffers    * 3. Aligned/Tables - * - * Attempts to reserve objects of different types out of order will fail. - */ -typedef struct { -    void* workspace; -    void* workspaceEnd; - -    void* objectEnd; -    void* tableEnd; -    void* tableValidEnd; -    void* allocStart; - + *  + * Attempts to reserve objects of different types out of order will fail.  + */  +typedef struct {  +    void* workspace;  +    void* workspaceEnd;  +  +    void* objectEnd;  +    void* tableEnd;  +    void* tableValidEnd;  +    void* allocStart;  +       BYTE allocFailed; -    int workspaceOversizedDuration; -    ZSTD_cwksp_alloc_phase_e phase; +    int workspaceOversizedDuration;  +    ZSTD_cwksp_alloc_phase_e phase;       ZSTD_cwksp_static_alloc_e isStatic; -} ZSTD_cwksp; - -/*-************************************* -*  Functions -***************************************/ - -MEM_STATIC size_t ZSTD_cwksp_available_space(ZSTD_cwksp* ws); - -MEM_STATIC void ZSTD_cwksp_assert_internal_consistency(ZSTD_cwksp* ws) { -    (void)ws; -    assert(ws->workspace <= ws->objectEnd); -    assert(ws->objectEnd <= ws->tableEnd); -    assert(ws->objectEnd <= ws->tableValidEnd); -    assert(ws->tableEnd <= ws->allocStart); -    assert(ws->tableValidEnd <= ws->allocStart); -    assert(ws->allocStart <= ws->workspaceEnd); -} - -/** - * Align must be a power of 2. - */ -MEM_STATIC size_t ZSTD_cwksp_align(size_t size, size_t const align) { -    size_t const mask = align - 1; -    assert((align & mask) == 0); -    return (size + mask) & ~mask; -} - -/** - * Use this to determine how much space in the workspace we will consume to - * allocate this object. (Normally it should be exactly the size of the object, - * but under special conditions, like ASAN, where we pad each object, it might - * be larger.) - * - * Since tables aren't currently redzoned, you don't need to call through this - * to figure out how much space you need for the matchState tables. Everything - * else is though. +} ZSTD_cwksp;  +  +/*-*************************************  +*  Functions  +***************************************/  +  +MEM_STATIC size_t ZSTD_cwksp_available_space(ZSTD_cwksp* ws);  +  +MEM_STATIC void ZSTD_cwksp_assert_internal_consistency(ZSTD_cwksp* ws) {  +    (void)ws;  +    assert(ws->workspace <= ws->objectEnd);  +    assert(ws->objectEnd <= ws->tableEnd);  +    assert(ws->objectEnd <= ws->tableValidEnd);  +    assert(ws->tableEnd <= ws->allocStart);  +    assert(ws->tableValidEnd <= ws->allocStart);  +    assert(ws->allocStart <= ws->workspaceEnd);  +}  +  +/**  + * Align must be a power of 2.  + */  +MEM_STATIC size_t ZSTD_cwksp_align(size_t size, size_t const align) {  +    size_t const mask = align - 1;  +    assert((align & mask) == 0);  +    return (size + mask) & ~mask;  +}  +  +/**  + * Use this to determine how much space in the workspace we will consume to  + * allocate this object. (Normally it should be exactly the size of the object,  + * but under special conditions, like ASAN, where we pad each object, it might  + * be larger.)  + *  + * Since tables aren't currently redzoned, you don't need to call through this  + * to figure out how much space you need for the matchState tables. Everything  + * else is though.    *   * Do not use for sizing aligned buffers. Instead, use ZSTD_cwksp_aligned_alloc_size(). - */ -MEM_STATIC size_t ZSTD_cwksp_alloc_size(size_t size) { + */  +MEM_STATIC size_t ZSTD_cwksp_alloc_size(size_t size) {       if (size == 0)          return 0;  #if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE) -    return size + 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE; -#else -    return size; -#endif -} - +    return size + 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE;  +#else  +    return size;  +#endif  +}  +   /**   * Returns an adjusted alloc size that is the nearest larger multiple of 64 bytes.   * Used to determine the number of bytes required for a given "aligned". @@ -279,17 +279,17 @@ ZSTD_cwksp_reserve_internal_buffer_space(ZSTD_cwksp* ws, size_t const bytes)  MEM_STATIC size_t  ZSTD_cwksp_internal_advance_phase(ZSTD_cwksp* ws, ZSTD_cwksp_alloc_phase_e phase)  { -    assert(phase >= ws->phase); -    if (phase > ws->phase) { +    assert(phase >= ws->phase);  +    if (phase > ws->phase) {           /* Going from allocating objects to allocating buffers */ -        if (ws->phase < ZSTD_cwksp_alloc_buffers && -                phase >= ZSTD_cwksp_alloc_buffers) { -            ws->tableValidEnd = ws->objectEnd; -        } +        if (ws->phase < ZSTD_cwksp_alloc_buffers &&  +                phase >= ZSTD_cwksp_alloc_buffers) {  +            ws->tableValidEnd = ws->objectEnd;  +        }           /* Going from allocating buffers to allocating aligneds/tables */ -        if (ws->phase < ZSTD_cwksp_alloc_aligned && -                phase >= ZSTD_cwksp_alloc_aligned) { +        if (ws->phase < ZSTD_cwksp_alloc_aligned &&  +                phase >= ZSTD_cwksp_alloc_aligned) {               {   /* Align the start of the "aligned" to 64 bytes. Use [1, 64] bytes. */                  size_t const bytesToAlign =                      ZSTD_CWKSP_ALIGNMENT_BYTES - ZSTD_cwksp_bytes_to_align_ptr(ws->allocStart, ZSTD_CWKSP_ALIGNMENT_BYTES); @@ -297,7 +297,7 @@ ZSTD_cwksp_internal_advance_phase(ZSTD_cwksp* ws, ZSTD_cwksp_alloc_phase_e phase                  ZSTD_STATIC_ASSERT((ZSTD_CWKSP_ALIGNMENT_BYTES & (ZSTD_CWKSP_ALIGNMENT_BYTES - 1)) == 0); /* power of 2 */                  RETURN_ERROR_IF(!ZSTD_cwksp_reserve_internal_buffer_space(ws, bytesToAlign),                                  memory_allocation, "aligned phase - alignment initial allocation failed!"); -            } +            }               {   /* Align the start of the tables to 64 bytes. Use [0, 63] bytes */                  void* const alloc = ws->objectEnd;                  size_t const bytesToAlign = ZSTD_cwksp_bytes_to_align_ptr(alloc, ZSTD_CWKSP_ALIGNMENT_BYTES); @@ -310,83 +310,83 @@ ZSTD_cwksp_internal_advance_phase(ZSTD_cwksp* ws, ZSTD_cwksp_alloc_phase_e phase                  if (ws->tableValidEnd < ws->tableEnd) {                      ws->tableValidEnd = ws->tableEnd;          }   }   } -        ws->phase = phase; +        ws->phase = phase;           ZSTD_cwksp_assert_internal_consistency(ws); -    } +    }       return 0; -} - -/** - * Returns whether this object/buffer/etc was allocated in this workspace. - */ +}  +  +/**  + * Returns whether this object/buffer/etc was allocated in this workspace.  + */   MEM_STATIC int ZSTD_cwksp_owns_buffer(const ZSTD_cwksp* ws, const void* ptr)  { -    return (ptr != NULL) && (ws->workspace <= ptr) && (ptr <= ws->workspaceEnd); -} - -/** - * Internal function. Do not use directly. - */ +    return (ptr != NULL) && (ws->workspace <= ptr) && (ptr <= ws->workspaceEnd);  +}  +  +/**  + * Internal function. Do not use directly.  + */   MEM_STATIC void*  ZSTD_cwksp_reserve_internal(ZSTD_cwksp* ws, size_t bytes, ZSTD_cwksp_alloc_phase_e phase)  { -    void* alloc; +    void* alloc;       if (ZSTD_isError(ZSTD_cwksp_internal_advance_phase(ws, phase)) || bytes == 0) {          return NULL;      }  #if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE) -    /* over-reserve space */ +    /* over-reserve space */       bytes += 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE; -#endif - +#endif  +       alloc = ZSTD_cwksp_reserve_internal_buffer_space(ws, bytes); - +   #if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE) -    /* Move alloc so there's ZSTD_CWKSP_ASAN_REDZONE_SIZE unused space on -     * either size. */ +    /* Move alloc so there's ZSTD_CWKSP_ASAN_REDZONE_SIZE unused space on  +     * either size. */       if (alloc) {          alloc = (BYTE *)alloc + ZSTD_CWKSP_ASAN_REDZONE_SIZE;          if (ws->isStatic == ZSTD_cwksp_dynamic_alloc) {              __asan_unpoison_memory_region(alloc, bytes);          }      } -#endif - -    return alloc; -} - -/** - * Reserves and returns unaligned memory. - */ +#endif  +  +    return alloc;  +}  +  +/**  + * Reserves and returns unaligned memory.  + */   MEM_STATIC BYTE* ZSTD_cwksp_reserve_buffer(ZSTD_cwksp* ws, size_t bytes)  { -    return (BYTE*)ZSTD_cwksp_reserve_internal(ws, bytes, ZSTD_cwksp_alloc_buffers); -} - -/** +    return (BYTE*)ZSTD_cwksp_reserve_internal(ws, bytes, ZSTD_cwksp_alloc_buffers);  +}  +  +/**    * Reserves and returns memory sized on and aligned on ZSTD_CWKSP_ALIGNMENT_BYTES (64 bytes). - */ + */   MEM_STATIC void* ZSTD_cwksp_reserve_aligned(ZSTD_cwksp* ws, size_t bytes)  {      void* ptr = ZSTD_cwksp_reserve_internal(ws, ZSTD_cwksp_align(bytes, ZSTD_CWKSP_ALIGNMENT_BYTES),                                              ZSTD_cwksp_alloc_aligned);      assert(((size_t)ptr & (ZSTD_CWKSP_ALIGNMENT_BYTES-1))== 0);      return ptr; -} - -/** +}  +  +/**    * Aligned on 64 bytes. These buffers have the special property that - * their values remain constrained, allowing us to re-use them without - * memset()-ing them. - */ + * their values remain constrained, allowing us to re-use them without  + * memset()-ing them.  + */   MEM_STATIC void* ZSTD_cwksp_reserve_table(ZSTD_cwksp* ws, size_t bytes)  { -    const ZSTD_cwksp_alloc_phase_e phase = ZSTD_cwksp_alloc_aligned; +    const ZSTD_cwksp_alloc_phase_e phase = ZSTD_cwksp_alloc_aligned;       void* alloc;      void* end;      void* top; - +       if (ZSTD_isError(ZSTD_cwksp_internal_advance_phase(ws, phase))) {          return NULL;      } @@ -394,236 +394,236 @@ MEM_STATIC void* ZSTD_cwksp_reserve_table(ZSTD_cwksp* ws, size_t bytes)      end = (BYTE *)alloc + bytes;      top = ws->allocStart; -    DEBUGLOG(5, "cwksp: reserving %p table %zd bytes, %zd bytes remaining", -        alloc, bytes, ZSTD_cwksp_available_space(ws) - bytes); -    assert((bytes & (sizeof(U32)-1)) == 0); -    ZSTD_cwksp_assert_internal_consistency(ws); -    assert(end <= top); -    if (end > top) { -        DEBUGLOG(4, "cwksp: table alloc failed!"); -        ws->allocFailed = 1; -        return NULL; -    } -    ws->tableEnd = end; - +    DEBUGLOG(5, "cwksp: reserving %p table %zd bytes, %zd bytes remaining",  +        alloc, bytes, ZSTD_cwksp_available_space(ws) - bytes);  +    assert((bytes & (sizeof(U32)-1)) == 0);  +    ZSTD_cwksp_assert_internal_consistency(ws);  +    assert(end <= top);  +    if (end > top) {  +        DEBUGLOG(4, "cwksp: table alloc failed!");  +        ws->allocFailed = 1;  +        return NULL;  +    }  +    ws->tableEnd = end;  +   #if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)      if (ws->isStatic == ZSTD_cwksp_dynamic_alloc) {          __asan_unpoison_memory_region(alloc, bytes);      } -#endif - +#endif  +       assert((bytes & (ZSTD_CWKSP_ALIGNMENT_BYTES-1)) == 0);      assert(((size_t)alloc & (ZSTD_CWKSP_ALIGNMENT_BYTES-1))== 0); -    return alloc; -} - -/** - * Aligned on sizeof(void*). +    return alloc;  +}  +  +/**  + * Aligned on sizeof(void*).    * Note : should happen only once, at workspace first initialization - */ + */   MEM_STATIC void* ZSTD_cwksp_reserve_object(ZSTD_cwksp* ws, size_t bytes)  {      size_t const roundedBytes = ZSTD_cwksp_align(bytes, sizeof(void*)); -    void* alloc = ws->objectEnd; -    void* end = (BYTE*)alloc + roundedBytes; - +    void* alloc = ws->objectEnd;  +    void* end = (BYTE*)alloc + roundedBytes;  +   #if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE) -    /* over-reserve space */ -    end = (BYTE *)end + 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE; -#endif - +    /* over-reserve space */  +    end = (BYTE *)end + 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE;  +#endif  +       DEBUGLOG(4, -        "cwksp: reserving %p object %zd bytes (rounded to %zd), %zd bytes remaining", -        alloc, bytes, roundedBytes, ZSTD_cwksp_available_space(ws) - roundedBytes); +        "cwksp: reserving %p object %zd bytes (rounded to %zd), %zd bytes remaining",  +        alloc, bytes, roundedBytes, ZSTD_cwksp_available_space(ws) - roundedBytes);       assert((size_t)alloc % ZSTD_ALIGNOF(void*) == 0);      assert(bytes % ZSTD_ALIGNOF(void*) == 0); -    ZSTD_cwksp_assert_internal_consistency(ws); -    /* we must be in the first phase, no advance is possible */ -    if (ws->phase != ZSTD_cwksp_alloc_objects || end > ws->workspaceEnd) { +    ZSTD_cwksp_assert_internal_consistency(ws);  +    /* we must be in the first phase, no advance is possible */  +    if (ws->phase != ZSTD_cwksp_alloc_objects || end > ws->workspaceEnd) {           DEBUGLOG(3, "cwksp: object alloc failed!"); -        ws->allocFailed = 1; -        return NULL; -    } -    ws->objectEnd = end; -    ws->tableEnd = end; -    ws->tableValidEnd = end; - +        ws->allocFailed = 1;  +        return NULL;  +    }  +    ws->objectEnd = end;  +    ws->tableEnd = end;  +    ws->tableValidEnd = end;  +   #if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE) -    /* Move alloc so there's ZSTD_CWKSP_ASAN_REDZONE_SIZE unused space on -     * either size. */ +    /* Move alloc so there's ZSTD_CWKSP_ASAN_REDZONE_SIZE unused space on  +     * either size. */       alloc = (BYTE*)alloc + ZSTD_CWKSP_ASAN_REDZONE_SIZE;      if (ws->isStatic == ZSTD_cwksp_dynamic_alloc) {          __asan_unpoison_memory_region(alloc, bytes);      } -#endif - -    return alloc; -} - +#endif  +  +    return alloc;  +}  +   MEM_STATIC void ZSTD_cwksp_mark_tables_dirty(ZSTD_cwksp* ws)  { -    DEBUGLOG(4, "cwksp: ZSTD_cwksp_mark_tables_dirty"); - +    DEBUGLOG(4, "cwksp: ZSTD_cwksp_mark_tables_dirty");  +   #if ZSTD_MEMORY_SANITIZER && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE) -    /* To validate that the table re-use logic is sound, and that we don't -     * access table space that we haven't cleaned, we re-"poison" the table -     * space every time we mark it dirty. */ -    { -        size_t size = (BYTE*)ws->tableValidEnd - (BYTE*)ws->objectEnd; -        assert(__msan_test_shadow(ws->objectEnd, size) == -1); -        __msan_poison(ws->objectEnd, size); -    } -#endif - -    assert(ws->tableValidEnd >= ws->objectEnd); -    assert(ws->tableValidEnd <= ws->allocStart); -    ws->tableValidEnd = ws->objectEnd; -    ZSTD_cwksp_assert_internal_consistency(ws); -} - -MEM_STATIC void ZSTD_cwksp_mark_tables_clean(ZSTD_cwksp* ws) { -    DEBUGLOG(4, "cwksp: ZSTD_cwksp_mark_tables_clean"); -    assert(ws->tableValidEnd >= ws->objectEnd); -    assert(ws->tableValidEnd <= ws->allocStart); -    if (ws->tableValidEnd < ws->tableEnd) { -        ws->tableValidEnd = ws->tableEnd; -    } -    ZSTD_cwksp_assert_internal_consistency(ws); -} - -/** - * Zero the part of the allocated tables not already marked clean. - */ -MEM_STATIC void ZSTD_cwksp_clean_tables(ZSTD_cwksp* ws) { -    DEBUGLOG(4, "cwksp: ZSTD_cwksp_clean_tables"); -    assert(ws->tableValidEnd >= ws->objectEnd); -    assert(ws->tableValidEnd <= ws->allocStart); -    if (ws->tableValidEnd < ws->tableEnd) { +    /* To validate that the table re-use logic is sound, and that we don't  +     * access table space that we haven't cleaned, we re-"poison" the table  +     * space every time we mark it dirty. */  +    {  +        size_t size = (BYTE*)ws->tableValidEnd - (BYTE*)ws->objectEnd;  +        assert(__msan_test_shadow(ws->objectEnd, size) == -1);  +        __msan_poison(ws->objectEnd, size);  +    }  +#endif  +  +    assert(ws->tableValidEnd >= ws->objectEnd);  +    assert(ws->tableValidEnd <= ws->allocStart);  +    ws->tableValidEnd = ws->objectEnd;  +    ZSTD_cwksp_assert_internal_consistency(ws);  +}  +  +MEM_STATIC void ZSTD_cwksp_mark_tables_clean(ZSTD_cwksp* ws) {  +    DEBUGLOG(4, "cwksp: ZSTD_cwksp_mark_tables_clean");  +    assert(ws->tableValidEnd >= ws->objectEnd);  +    assert(ws->tableValidEnd <= ws->allocStart);  +    if (ws->tableValidEnd < ws->tableEnd) {  +        ws->tableValidEnd = ws->tableEnd;  +    }  +    ZSTD_cwksp_assert_internal_consistency(ws);  +}  +  +/**  + * Zero the part of the allocated tables not already marked clean.  + */  +MEM_STATIC void ZSTD_cwksp_clean_tables(ZSTD_cwksp* ws) {  +    DEBUGLOG(4, "cwksp: ZSTD_cwksp_clean_tables");  +    assert(ws->tableValidEnd >= ws->objectEnd);  +    assert(ws->tableValidEnd <= ws->allocStart);  +    if (ws->tableValidEnd < ws->tableEnd) {           ZSTD_memset(ws->tableValidEnd, 0, (BYTE*)ws->tableEnd - (BYTE*)ws->tableValidEnd); -    } -    ZSTD_cwksp_mark_tables_clean(ws); -} - -/** - * Invalidates table allocations. - * All other allocations remain valid. - */ -MEM_STATIC void ZSTD_cwksp_clear_tables(ZSTD_cwksp* ws) { -    DEBUGLOG(4, "cwksp: clearing tables!"); - +    }  +    ZSTD_cwksp_mark_tables_clean(ws);  +}  +  +/**  + * Invalidates table allocations.  + * All other allocations remain valid.  + */  +MEM_STATIC void ZSTD_cwksp_clear_tables(ZSTD_cwksp* ws) {  +    DEBUGLOG(4, "cwksp: clearing tables!");  +   #if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)      /* We don't do this when the workspace is statically allocated, because       * when that is the case, we have no capability to hook into the end of the       * workspace's lifecycle to unpoison the memory.       */      if (ws->isStatic == ZSTD_cwksp_dynamic_alloc) { -        size_t size = (BYTE*)ws->tableValidEnd - (BYTE*)ws->objectEnd; -        __asan_poison_memory_region(ws->objectEnd, size); -    } -#endif - -    ws->tableEnd = ws->objectEnd; -    ZSTD_cwksp_assert_internal_consistency(ws); -} - -/** - * Invalidates all buffer, aligned, and table allocations. - * Object allocations remain valid. - */ -MEM_STATIC void ZSTD_cwksp_clear(ZSTD_cwksp* ws) { -    DEBUGLOG(4, "cwksp: clearing!"); - +        size_t size = (BYTE*)ws->tableValidEnd - (BYTE*)ws->objectEnd;  +        __asan_poison_memory_region(ws->objectEnd, size);  +    }  +#endif  +  +    ws->tableEnd = ws->objectEnd;  +    ZSTD_cwksp_assert_internal_consistency(ws);  +}  +  +/**  + * Invalidates all buffer, aligned, and table allocations.  + * Object allocations remain valid.  + */  +MEM_STATIC void ZSTD_cwksp_clear(ZSTD_cwksp* ws) {  +    DEBUGLOG(4, "cwksp: clearing!");  +   #if ZSTD_MEMORY_SANITIZER && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE) -    /* To validate that the context re-use logic is sound, and that we don't -     * access stuff that this compression hasn't initialized, we re-"poison" -     * the workspace (or at least the non-static, non-table parts of it) -     * every time we start a new compression. */ -    { -        size_t size = (BYTE*)ws->workspaceEnd - (BYTE*)ws->tableValidEnd; -        __msan_poison(ws->tableValidEnd, size); -    } -#endif - +    /* To validate that the context re-use logic is sound, and that we don't  +     * access stuff that this compression hasn't initialized, we re-"poison"  +     * the workspace (or at least the non-static, non-table parts of it)  +     * every time we start a new compression. */  +    {  +        size_t size = (BYTE*)ws->workspaceEnd - (BYTE*)ws->tableValidEnd;  +        __msan_poison(ws->tableValidEnd, size);  +    }  +#endif  +   #if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)      /* We don't do this when the workspace is statically allocated, because       * when that is the case, we have no capability to hook into the end of the       * workspace's lifecycle to unpoison the memory.       */      if (ws->isStatic == ZSTD_cwksp_dynamic_alloc) { -        size_t size = (BYTE*)ws->workspaceEnd - (BYTE*)ws->objectEnd; -        __asan_poison_memory_region(ws->objectEnd, size); -    } -#endif - -    ws->tableEnd = ws->objectEnd; -    ws->allocStart = ws->workspaceEnd; -    ws->allocFailed = 0; -    if (ws->phase > ZSTD_cwksp_alloc_buffers) { -        ws->phase = ZSTD_cwksp_alloc_buffers; -    } -    ZSTD_cwksp_assert_internal_consistency(ws); -} - -/** - * The provided workspace takes ownership of the buffer [start, start+size). - * Any existing values in the workspace are ignored (the previously managed - * buffer, if present, must be separately freed). - */ +        size_t size = (BYTE*)ws->workspaceEnd - (BYTE*)ws->objectEnd;  +        __asan_poison_memory_region(ws->objectEnd, size);  +    }  +#endif  +  +    ws->tableEnd = ws->objectEnd;  +    ws->allocStart = ws->workspaceEnd;  +    ws->allocFailed = 0;  +    if (ws->phase > ZSTD_cwksp_alloc_buffers) {  +        ws->phase = ZSTD_cwksp_alloc_buffers;  +    }  +    ZSTD_cwksp_assert_internal_consistency(ws);  +}  +  +/**  + * The provided workspace takes ownership of the buffer [start, start+size).  + * Any existing values in the workspace are ignored (the previously managed  + * buffer, if present, must be separately freed).  + */   MEM_STATIC void ZSTD_cwksp_init(ZSTD_cwksp* ws, void* start, size_t size, ZSTD_cwksp_static_alloc_e isStatic) { -    DEBUGLOG(4, "cwksp: init'ing workspace with %zd bytes", size); -    assert(((size_t)start & (sizeof(void*)-1)) == 0); /* ensure correct alignment */ -    ws->workspace = start; -    ws->workspaceEnd = (BYTE*)start + size; -    ws->objectEnd = ws->workspace; -    ws->tableValidEnd = ws->objectEnd; -    ws->phase = ZSTD_cwksp_alloc_objects; +    DEBUGLOG(4, "cwksp: init'ing workspace with %zd bytes", size);  +    assert(((size_t)start & (sizeof(void*)-1)) == 0); /* ensure correct alignment */  +    ws->workspace = start;  +    ws->workspaceEnd = (BYTE*)start + size;  +    ws->objectEnd = ws->workspace;  +    ws->tableValidEnd = ws->objectEnd;  +    ws->phase = ZSTD_cwksp_alloc_objects;       ws->isStatic = isStatic; -    ZSTD_cwksp_clear(ws); -    ws->workspaceOversizedDuration = 0; -    ZSTD_cwksp_assert_internal_consistency(ws); -} - -MEM_STATIC size_t ZSTD_cwksp_create(ZSTD_cwksp* ws, size_t size, ZSTD_customMem customMem) { +    ZSTD_cwksp_clear(ws);  +    ws->workspaceOversizedDuration = 0;  +    ZSTD_cwksp_assert_internal_consistency(ws);  +}  +  +MEM_STATIC size_t ZSTD_cwksp_create(ZSTD_cwksp* ws, size_t size, ZSTD_customMem customMem) {       void* workspace = ZSTD_customMalloc(size, customMem); -    DEBUGLOG(4, "cwksp: creating new workspace with %zd bytes", size); +    DEBUGLOG(4, "cwksp: creating new workspace with %zd bytes", size);       RETURN_ERROR_IF(workspace == NULL, memory_allocation, "NULL pointer!");      ZSTD_cwksp_init(ws, workspace, size, ZSTD_cwksp_dynamic_alloc); -    return 0; -} - -MEM_STATIC void ZSTD_cwksp_free(ZSTD_cwksp* ws, ZSTD_customMem customMem) { -    void *ptr = ws->workspace; -    DEBUGLOG(4, "cwksp: freeing workspace"); +    return 0;  +}  +  +MEM_STATIC void ZSTD_cwksp_free(ZSTD_cwksp* ws, ZSTD_customMem customMem) {  +    void *ptr = ws->workspace;  +    DEBUGLOG(4, "cwksp: freeing workspace");       ZSTD_memset(ws, 0, sizeof(ZSTD_cwksp));      ZSTD_customFree(ptr, customMem); -} - -/** - * Moves the management of a workspace from one cwksp to another. The src cwksp +}  +  +/**  + * Moves the management of a workspace from one cwksp to another. The src cwksp    * is left in an invalid state (src must be re-init()'ed before it's used again). - */ -MEM_STATIC void ZSTD_cwksp_move(ZSTD_cwksp* dst, ZSTD_cwksp* src) { -    *dst = *src; + */  +MEM_STATIC void ZSTD_cwksp_move(ZSTD_cwksp* dst, ZSTD_cwksp* src) {  +    *dst = *src;       ZSTD_memset(src, 0, sizeof(ZSTD_cwksp)); -} - -MEM_STATIC size_t ZSTD_cwksp_sizeof(const ZSTD_cwksp* ws) { -    return (size_t)((BYTE*)ws->workspaceEnd - (BYTE*)ws->workspace); -} - +}  +  +MEM_STATIC size_t ZSTD_cwksp_sizeof(const ZSTD_cwksp* ws) {  +    return (size_t)((BYTE*)ws->workspaceEnd - (BYTE*)ws->workspace);  +}  +   MEM_STATIC size_t ZSTD_cwksp_used(const ZSTD_cwksp* ws) {      return (size_t)((BYTE*)ws->tableEnd - (BYTE*)ws->workspace)           + (size_t)((BYTE*)ws->workspaceEnd - (BYTE*)ws->allocStart);  } -MEM_STATIC int ZSTD_cwksp_reserve_failed(const ZSTD_cwksp* ws) { -    return ws->allocFailed; -} - -/*-************************************* -*  Functions Checking Free Space -***************************************/ - +MEM_STATIC int ZSTD_cwksp_reserve_failed(const ZSTD_cwksp* ws) {  +    return ws->allocFailed;  +}  +  +/*-*************************************  +*  Functions Checking Free Space  +***************************************/  +   /* ZSTD_alignmentSpaceWithinBounds() :   * Returns if the estimated space needed for a wksp is within an acceptable limit of the   * actual amount of space used. @@ -642,35 +642,35 @@ MEM_STATIC int ZSTD_cwksp_estimated_space_within_bounds(const ZSTD_cwksp* const  } -MEM_STATIC size_t ZSTD_cwksp_available_space(ZSTD_cwksp* ws) { -    return (size_t)((BYTE*)ws->allocStart - (BYTE*)ws->tableEnd); -} - -MEM_STATIC int ZSTD_cwksp_check_available(ZSTD_cwksp* ws, size_t additionalNeededSpace) { -    return ZSTD_cwksp_available_space(ws) >= additionalNeededSpace; -} - -MEM_STATIC int ZSTD_cwksp_check_too_large(ZSTD_cwksp* ws, size_t additionalNeededSpace) { -    return ZSTD_cwksp_check_available( -        ws, additionalNeededSpace * ZSTD_WORKSPACETOOLARGE_FACTOR); -} - -MEM_STATIC int ZSTD_cwksp_check_wasteful(ZSTD_cwksp* ws, size_t additionalNeededSpace) { -    return ZSTD_cwksp_check_too_large(ws, additionalNeededSpace) -        && ws->workspaceOversizedDuration > ZSTD_WORKSPACETOOLARGE_MAXDURATION; -} - -MEM_STATIC void ZSTD_cwksp_bump_oversized_duration( -        ZSTD_cwksp* ws, size_t additionalNeededSpace) { -    if (ZSTD_cwksp_check_too_large(ws, additionalNeededSpace)) { -        ws->workspaceOversizedDuration++; -    } else { -        ws->workspaceOversizedDuration = 0; -    } -} - -#if defined (__cplusplus) -} -#endif - -#endif /* ZSTD_CWKSP_H */ +MEM_STATIC size_t ZSTD_cwksp_available_space(ZSTD_cwksp* ws) {  +    return (size_t)((BYTE*)ws->allocStart - (BYTE*)ws->tableEnd);  +}  +  +MEM_STATIC int ZSTD_cwksp_check_available(ZSTD_cwksp* ws, size_t additionalNeededSpace) {  +    return ZSTD_cwksp_available_space(ws) >= additionalNeededSpace;  +}  +  +MEM_STATIC int ZSTD_cwksp_check_too_large(ZSTD_cwksp* ws, size_t additionalNeededSpace) {  +    return ZSTD_cwksp_check_available(  +        ws, additionalNeededSpace * ZSTD_WORKSPACETOOLARGE_FACTOR);  +}  +  +MEM_STATIC int ZSTD_cwksp_check_wasteful(ZSTD_cwksp* ws, size_t additionalNeededSpace) {  +    return ZSTD_cwksp_check_too_large(ws, additionalNeededSpace)  +        && ws->workspaceOversizedDuration > ZSTD_WORKSPACETOOLARGE_MAXDURATION;  +}  +  +MEM_STATIC void ZSTD_cwksp_bump_oversized_duration(  +        ZSTD_cwksp* ws, size_t additionalNeededSpace) {  +    if (ZSTD_cwksp_check_too_large(ws, additionalNeededSpace)) {  +        ws->workspaceOversizedDuration++;  +    } else {  +        ws->workspaceOversizedDuration = 0;  +    }  +}  +  +#if defined (__cplusplus)  +}  +#endif  +  +#endif /* ZSTD_CWKSP_H */  diff --git a/contrib/libs/zstd/lib/compress/zstd_double_fast.c b/contrib/libs/zstd/lib/compress/zstd_double_fast.c index 76933dea262..a666c536718 100644 --- a/contrib/libs/zstd/lib/compress/zstd_double_fast.c +++ b/contrib/libs/zstd/lib/compress/zstd_double_fast.c @@ -269,7 +269,7 @@ size_t ZSTD_compressBlock_doubleFast_dictMatchState_generic(      const BYTE* ip = istart;      const BYTE* anchor = istart;      const U32 endIndex = (U32)((size_t)(istart - base) + srcSize); -    /* presumes that, if there is a dictionary, it must be using Attach mode */ +    /* presumes that, if there is a dictionary, it must be using Attach mode */       const U32 prefixLowestIndex = ZSTD_getLowestPrefixIndex(ms, endIndex, cParams->windowLog);      const BYTE* const prefixLowest = base + prefixLowestIndex;      const BYTE* const iend = istart + srcSize; @@ -544,7 +544,7 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic(      const BYTE* const ilimit = iend - 8;      const BYTE* const base = ms->window.base;      const U32   endIndex = (U32)((size_t)(istart - base) + srcSize); -    const U32   lowLimit = ZSTD_getLowestMatchIndex(ms, endIndex, cParams->windowLog); +    const U32   lowLimit = ZSTD_getLowestMatchIndex(ms, endIndex, cParams->windowLog);       const U32   dictStartIndex = lowLimit;      const U32   dictLimit = ms->window.dictLimit;      const U32   prefixStartIndex = (dictLimit > lowLimit) ? dictLimit : lowLimit; diff --git a/contrib/libs/zstd/lib/compress/zstd_fast.c b/contrib/libs/zstd/lib/compress/zstd_fast.c index 802fc315798..057e7c6f715 100644 --- a/contrib/libs/zstd/lib/compress/zstd_fast.c +++ b/contrib/libs/zstd/lib/compress/zstd_fast.c @@ -8,7 +8,7 @@   * You may select, at your option, one of the above-listed licenses.   */ -#include "zstd_compress_internal.h"  /* ZSTD_hashPtr, ZSTD_count, ZSTD_storeSeq */ +#include "zstd_compress_internal.h"  /* ZSTD_hashPtr, ZSTD_count, ZSTD_storeSeq */   #include "zstd_fast.h" @@ -89,7 +89,7 @@ void ZSTD_fillHashTable(ZSTD_matchState_t* ms,   *   * This is also the work we do at the beginning to enter the loop initially.   */ -FORCE_INLINE_TEMPLATE size_t +FORCE_INLINE_TEMPLATE size_t   ZSTD_compressBlock_fast_noDict_generic(          ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],          void const* src, size_t srcSize, @@ -136,7 +136,7 @@ ZSTD_compressBlock_fast_noDict_generic(      const BYTE* nextStep;      const size_t kStepIncr = (1 << (kSearchStrength - 1)); -    DEBUGLOG(5, "ZSTD_compressBlock_fast_generic"); +    DEBUGLOG(5, "ZSTD_compressBlock_fast_generic");       ip0 += (ip0 == prefixStart);      {   U32 const curr = (U32)(ip0 - base);          U32 const windowLow = ZSTD_getLowestPrefixIndex(ms, curr, cParams->windowLog); @@ -336,7 +336,7 @@ size_t ZSTD_compressBlock_fast(          ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],          void const* src, size_t srcSize)  { -    U32 const mls = ms->cParams.minMatch; +    U32 const mls = ms->cParams.minMatch;       assert(ms->dictMatchState == NULL);      if (ms->cParams.targetLength > 1) {          switch(mls) @@ -414,7 +414,7 @@ size_t ZSTD_compressBlock_fast_dictMatchState_generic(      assert(prefixStartIndex >= (U32)(dictEnd - dictBase));      /* init */ -    DEBUGLOG(5, "ZSTD_compressBlock_fast_dictMatchState_generic"); +    DEBUGLOG(5, "ZSTD_compressBlock_fast_dictMatchState_generic");       ip += (dictAndPrefixLength == 0);      /* dictMatchState repCode checks don't currently handle repCode == 0       * disabling. */ @@ -528,7 +528,7 @@ size_t ZSTD_compressBlock_fast_dictMatchState(          ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],          void const* src, size_t srcSize)  { -    U32 const mls = ms->cParams.minMatch; +    U32 const mls = ms->cParams.minMatch;       assert(ms->dictMatchState != NULL);      switch(mls)      { @@ -560,7 +560,7 @@ static size_t ZSTD_compressBlock_fast_extDict_generic(      const BYTE* ip = istart;      const BYTE* anchor = istart;      const U32   endIndex = (U32)((size_t)(istart - base) + srcSize); -    const U32   lowLimit = ZSTD_getLowestMatchIndex(ms, endIndex, cParams->windowLog); +    const U32   lowLimit = ZSTD_getLowestMatchIndex(ms, endIndex, cParams->windowLog);       const U32   dictStartIndex = lowLimit;      const BYTE* const dictStart = dictBase + dictStartIndex;      const U32   dictLimit = ms->window.dictLimit; @@ -574,7 +574,7 @@ static size_t ZSTD_compressBlock_fast_extDict_generic(      (void)hasStep; /* not currently specialized on whether it's accelerated */      DEBUGLOG(5, "ZSTD_compressBlock_fast_extDict_generic (offset_1=%u)", offset_1); - +       /* switch to "regular" variant if extDict is invalidated due to maxDistance */      if (prefixStartIndex == dictStartIndex)          return ZSTD_compressBlock_fast(ms, seqStore, rep, src, srcSize); @@ -595,12 +595,12 @@ static size_t ZSTD_compressBlock_fast_extDict_generic(          if ( ( ((U32)((prefixStartIndex-1) - repIndex) >= 3) /* intentional underflow */               & (offset_1 <= curr+1 - dictStartIndex) ) /* note: we are searching at curr+1 */             && (MEM_read32(repMatch) == MEM_read32(ip+1)) ) { -            const BYTE* const repMatchEnd = repIndex < prefixStartIndex ? dictEnd : iend; -            size_t const rLength = ZSTD_count_2segments(ip+1 +4, repMatch +4, iend, repMatchEnd, prefixStart) + 4; +            const BYTE* const repMatchEnd = repIndex < prefixStartIndex ? dictEnd : iend;  +            size_t const rLength = ZSTD_count_2segments(ip+1 +4, repMatch +4, iend, repMatchEnd, prefixStart) + 4;               ip++;              ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, STORE_REPCODE_1, rLength); -            ip += rLength; -            anchor = ip; +            ip += rLength;  +            anchor = ip;           } else {              if ( (matchIndex < dictStartIndex) ||                   (MEM_read32(match) != MEM_read32(ip)) ) { @@ -608,15 +608,15 @@ static size_t ZSTD_compressBlock_fast_extDict_generic(                  ip += ((ip-anchor) >> kSearchStrength) + stepSize;                  continue;              } -            {   const BYTE* const matchEnd = matchIndex < prefixStartIndex ? dictEnd : iend; -                const BYTE* const lowMatchPtr = matchIndex < prefixStartIndex ? dictStart : prefixStart; +            {   const BYTE* const matchEnd = matchIndex < prefixStartIndex ? dictEnd : iend;  +                const BYTE* const lowMatchPtr = matchIndex < prefixStartIndex ? dictStart : prefixStart;                   U32 const offset = curr - matchIndex; -                size_t mLength = ZSTD_count_2segments(ip+4, match+4, iend, matchEnd, prefixStart) + 4; +                size_t mLength = ZSTD_count_2segments(ip+4, match+4, iend, matchEnd, prefixStart) + 4;                   while (((ip>anchor) & (match>lowMatchPtr)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; }   /* catch up */ -                offset_2 = offset_1; offset_1 = offset;  /* update offset history */ +                offset_2 = offset_1; offset_1 = offset;  /* update offset history */                   ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, STORE_OFFSET(offset), mLength); -                ip += mLength; -                anchor = ip; +                ip += mLength;  +                anchor = ip;           }   }          if (ip <= ilimit) { @@ -627,12 +627,12 @@ static size_t ZSTD_compressBlock_fast_extDict_generic(              while (ip <= ilimit) {                  U32 const current2 = (U32)(ip-base);                  U32 const repIndex2 = current2 - offset_2; -                const BYTE* const repMatch2 = repIndex2 < prefixStartIndex ? dictBase + repIndex2 : base + repIndex2; +                const BYTE* const repMatch2 = repIndex2 < prefixStartIndex ? dictBase + repIndex2 : base + repIndex2;                   if ( (((U32)((prefixStartIndex-1) - repIndex2) >= 3) & (offset_2 <= curr - dictStartIndex))  /* intentional overflow */                     && (MEM_read32(repMatch2) == MEM_read32(ip)) ) {                      const BYTE* const repEnd2 = repIndex2 < prefixStartIndex ? dictEnd : iend;                      size_t const repLength2 = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, prefixStart) + 4; -                    { U32 const tmpOffset = offset_2; offset_2 = offset_1; offset_1 = tmpOffset; }  /* swap offset_2 <=> offset_1 */ +                    { U32 const tmpOffset = offset_2; offset_2 = offset_1; offset_1 = tmpOffset; }  /* swap offset_2 <=> offset_1 */                       ZSTD_storeSeq(seqStore, 0 /*litlen*/, anchor, iend, STORE_REPCODE_1, repLength2);                      hashTable[ZSTD_hashPtr(ip, hlog, mls)] = current2;                      ip += repLength2; @@ -659,7 +659,7 @@ size_t ZSTD_compressBlock_fast_extDict(          ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],          void const* src, size_t srcSize)  { -    U32 const mls = ms->cParams.minMatch; +    U32 const mls = ms->cParams.minMatch;       switch(mls)      {      default: /* includes case 3 */ diff --git a/contrib/libs/zstd/lib/compress/zstd_lazy.c b/contrib/libs/zstd/lib/compress/zstd_lazy.c index 2e38dcb46d2..fc88d372469 100644 --- a/contrib/libs/zstd/lib/compress/zstd_lazy.c +++ b/contrib/libs/zstd/lib/compress/zstd_lazy.c @@ -662,10 +662,10 @@ size_t ZSTD_HcFindBestMatch(      const BYTE* const dictEnd = dictBase + dictLimit;      const U32 curr = (U32)(ip-base);      const U32 maxDistance = 1U << cParams->windowLog; -    const U32 lowestValid = ms->window.lowLimit; +    const U32 lowestValid = ms->window.lowLimit;       const U32 withinMaxDistance = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid; -    const U32 isDictionary = (ms->loadedDictEnd != 0); -    const U32 lowLimit = isDictionary ? lowestValid : withinMaxDistance; +    const U32 isDictionary = (ms->loadedDictEnd != 0);  +    const U32 lowLimit = isDictionary ? lowestValid : withinMaxDistance;       const U32 minChain = curr > chainSize ? curr - chainSize : 0;      U32 nbAttempts = 1U << cParams->searchLog;      size_t ml=4-1; @@ -1441,7 +1441,7 @@ ZSTD_FOR_EACH_DICT_MODE(ZSTD_FOR_EACH_MLS, GEN_ZSTD_HC_VTABLE)  *  Common parser - lazy strategy  *********************************/  typedef enum { search_hashChain=0, search_binaryTree=1, search_rowHash=2 } searchMethod_e; - +   /**   * This table is indexed first by the four ZSTD_dictMode_e values, and then   * by the two searchMethod_e values. NULLs are placed for configurations @@ -1472,12 +1472,12 @@ ZSTD_selectLazyVTable(ZSTD_matchState_t const* ms, searchMethod_e searchMethod,      }  } -FORCE_INLINE_TEMPLATE size_t -ZSTD_compressBlock_lazy_generic( +FORCE_INLINE_TEMPLATE size_t  +ZSTD_compressBlock_lazy_generic(                           ZSTD_matchState_t* ms, seqStore_t* seqStore,                          U32 rep[ZSTD_REP_NUM],                          const void* src, size_t srcSize, -                        const searchMethod_e searchMethod, const U32 depth, +                        const searchMethod_e searchMethod, const U32 depth,                           ZSTD_dictMode_e const dictMode)  {      const BYTE* const istart = (const BYTE*)src; @@ -1715,7 +1715,7 @@ _storeSequence:      rep[1] = offset_2 ? offset_2 : savedOffset;      /* Return the last literals size */ -    return (size_t)(iend - anchor); +    return (size_t)(iend - anchor);   } @@ -1723,56 +1723,56 @@ size_t ZSTD_compressBlock_btlazy2(          ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],          void const* src, size_t srcSize)  { -    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2, ZSTD_noDict); +    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2, ZSTD_noDict);   }  size_t ZSTD_compressBlock_lazy2(          ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],          void const* src, size_t srcSize)  { -    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_noDict); +    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_noDict);   }  size_t ZSTD_compressBlock_lazy(          ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],          void const* src, size_t srcSize)  { -    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_noDict); +    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_noDict);   }  size_t ZSTD_compressBlock_greedy(          ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],          void const* src, size_t srcSize)  { -    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 0, ZSTD_noDict); +    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 0, ZSTD_noDict);   }  size_t ZSTD_compressBlock_btlazy2_dictMatchState(          ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],          void const* src, size_t srcSize)  { -    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2, ZSTD_dictMatchState); +    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2, ZSTD_dictMatchState);   }  size_t ZSTD_compressBlock_lazy2_dictMatchState(          ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],          void const* src, size_t srcSize)  { -    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_dictMatchState); +    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_dictMatchState);   }  size_t ZSTD_compressBlock_lazy_dictMatchState(          ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],          void const* src, size_t srcSize)  { -    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_dictMatchState); +    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_dictMatchState);   }  size_t ZSTD_compressBlock_greedy_dictMatchState(          ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],          void const* src, size_t srcSize)  { -    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 0, ZSTD_dictMatchState); +    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 0, ZSTD_dictMatchState);   } @@ -1867,7 +1867,7 @@ size_t ZSTD_compressBlock_lazy_extDict_generic(                          ZSTD_matchState_t* ms, seqStore_t* seqStore,                          U32 rep[ZSTD_REP_NUM],                          const void* src, size_t srcSize, -                        const searchMethod_e searchMethod, const U32 depth) +                        const searchMethod_e searchMethod, const U32 depth)   {      const BYTE* const istart = (const BYTE*)src;      const BYTE* ip = istart; @@ -2045,7 +2045,7 @@ _storeSequence:      rep[1] = offset_2;      /* Return the last literals size */ -    return (size_t)(iend - anchor); +    return (size_t)(iend - anchor);   } @@ -2053,7 +2053,7 @@ size_t ZSTD_compressBlock_greedy_extDict(          ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],          void const* src, size_t srcSize)  { -    return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 0); +    return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 0);   }  size_t ZSTD_compressBlock_lazy_extDict( @@ -2061,7 +2061,7 @@ size_t ZSTD_compressBlock_lazy_extDict(          void const* src, size_t srcSize)  { -    return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1); +    return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1);   }  size_t ZSTD_compressBlock_lazy2_extDict( @@ -2069,7 +2069,7 @@ size_t ZSTD_compressBlock_lazy2_extDict(          void const* src, size_t srcSize)  { -    return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2); +    return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2);   }  size_t ZSTD_compressBlock_btlazy2_extDict( @@ -2077,7 +2077,7 @@ size_t ZSTD_compressBlock_btlazy2_extDict(          void const* src, size_t srcSize)  { -    return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2); +    return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2);   }  size_t ZSTD_compressBlock_greedy_extDict_row( diff --git a/contrib/libs/zstd/lib/compress/zstd_ldm.c b/contrib/libs/zstd/lib/compress/zstd_ldm.c index 476b45746e0..232661f3adf 100644 --- a/contrib/libs/zstd/lib/compress/zstd_ldm.c +++ b/contrib/libs/zstd/lib/compress/zstd_ldm.c @@ -156,9 +156,9 @@ size_t ZSTD_ldm_getTableSize(ldmParams_t params)  {      size_t const ldmHSize = ((size_t)1) << params.hashLog;      size_t const ldmBucketSizeLog = MIN(params.bucketSizeLog, params.hashLog); -    size_t const ldmBucketSize = ((size_t)1) << (params.hashLog - ldmBucketSizeLog); -    size_t const totalSize = ZSTD_cwksp_alloc_size(ldmBucketSize) -                           + ZSTD_cwksp_alloc_size(ldmHSize * sizeof(ldmEntry_t)); +    size_t const ldmBucketSize = ((size_t)1) << (params.hashLog - ldmBucketSizeLog);  +    size_t const totalSize = ZSTD_cwksp_alloc_size(ldmBucketSize)  +                           + ZSTD_cwksp_alloc_size(ldmHSize * sizeof(ldmEntry_t));       return params.enableLdm == ZSTD_ps_enable ? totalSize : 0;  } @@ -710,7 +710,7 @@ size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore,                  rep[i] = rep[i-1];              rep[0] = sequence.offset;              /* Store the sequence */ -            ZSTD_storeSeq(seqStore, newLitLength, ip - newLitLength, iend, +            ZSTD_storeSeq(seqStore, newLitLength, ip - newLitLength, iend,                             STORE_OFFSET(sequence.offset),                            sequence.matchLength);              ip += sequence.matchLength; diff --git a/contrib/libs/zstd/lib/compress/zstd_opt.c b/contrib/libs/zstd/lib/compress/zstd_opt.c index 1b1ddad4289..eb6f4ee563a 100644 --- a/contrib/libs/zstd/lib/compress/zstd_opt.c +++ b/contrib/libs/zstd/lib/compress/zstd_opt.c @@ -688,21 +688,21 @@ U32 ZSTD_insertBtAndGetAllMatches (      for (; nbCompares && (matchIndex >= matchLow); --nbCompares) {          U32* const nextPtr = bt + 2*(matchIndex & btMask); -        const BYTE* match; +        const BYTE* match;           size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger);   /* guaranteed minimum nb of common bytes */          assert(curr > matchIndex);          if ((dictMode == ZSTD_noDict) || (dictMode == ZSTD_dictMatchState) || (matchIndex+matchLength >= dictLimit)) {              assert(matchIndex+matchLength >= dictLimit);  /* ensure the condition is correct when !extDict */              match = base + matchIndex; -            if (matchIndex >= dictLimit) assert(memcmp(match, ip, matchLength) == 0);  /* ensure early section of match is equal as expected */ +            if (matchIndex >= dictLimit) assert(memcmp(match, ip, matchLength) == 0);  /* ensure early section of match is equal as expected */               matchLength += ZSTD_count(ip+matchLength, match+matchLength, iLimit);          } else {              match = dictBase + matchIndex; -            assert(memcmp(match, ip, matchLength) == 0);  /* ensure early section of match is equal as expected */ +            assert(memcmp(match, ip, matchLength) == 0);  /* ensure early section of match is equal as expected */               matchLength += ZSTD_count_2segments(ip+matchLength, match+matchLength, iLimit, dictEnd, prefixStart);              if (matchIndex+matchLength >= dictLimit) -                match = base + matchIndex;   /* prepare for match[matchLength] read */ +                match = base + matchIndex;   /* prepare for match[matchLength] read */           }          if (matchLength > bestLength) { diff --git a/contrib/libs/zstd/lib/compress/zstdmt_compress.c b/contrib/libs/zstd/lib/compress/zstdmt_compress.c index 6bc14b035e1..6328a85fee0 100644 --- a/contrib/libs/zstd/lib/compress/zstdmt_compress.c +++ b/contrib/libs/zstd/lib/compress/zstdmt_compress.c @@ -695,7 +695,7 @@ static void ZSTDMT_compressionJob(void* jobDescription)      /* init */      if (job->cdict) { -        size_t const initError = ZSTD_compressBegin_advanced_internal(cctx, NULL, 0, ZSTD_dct_auto, ZSTD_dtlm_fast, job->cdict, &jobParams, job->fullFrameSize); +        size_t const initError = ZSTD_compressBegin_advanced_internal(cctx, NULL, 0, ZSTD_dct_auto, ZSTD_dtlm_fast, job->cdict, &jobParams, job->fullFrameSize);           assert(job->firstJob);  /* only allowed for first job */          if (ZSTD_isError(initError)) JOB_ERROR(initError);      } else {  /* srcStart points at reloaded section */ @@ -711,7 +711,7 @@ static void ZSTDMT_compressionJob(void* jobDescription)                                          job->prefix.start, job->prefix.size, ZSTD_dct_rawContent, /* load dictionary in "content-only" mode (no header analysis) */                                          ZSTD_dtlm_fast,                                          NULL, /*cdict*/ -                                        &jobParams, pledgedSrcSize); +                                        &jobParams, pledgedSrcSize);               if (ZSTD_isError(initError)) JOB_ERROR(initError);      }   } @@ -977,17 +977,17 @@ static void ZSTDMT_releaseAllJobResources(ZSTDMT_CCtx* mtctx)      unsigned jobID;      DEBUGLOG(3, "ZSTDMT_releaseAllJobResources");      for (jobID=0; jobID <= mtctx->jobIDMask; jobID++) { -        /* Copy the mutex/cond out */ -        ZSTD_pthread_mutex_t const mutex = mtctx->jobs[jobID].job_mutex; -        ZSTD_pthread_cond_t const cond = mtctx->jobs[jobID].job_cond; - +        /* Copy the mutex/cond out */  +        ZSTD_pthread_mutex_t const mutex = mtctx->jobs[jobID].job_mutex;  +        ZSTD_pthread_cond_t const cond = mtctx->jobs[jobID].job_cond;  +           DEBUGLOG(4, "job%02u: release dst address %08X", jobID, (U32)(size_t)mtctx->jobs[jobID].dstBuff.start);          ZSTDMT_releaseBuffer(mtctx->bufPool, mtctx->jobs[jobID].dstBuff); - -        /* Clear the job description, but keep the mutex/cond */ +  +        /* Clear the job description, but keep the mutex/cond */           ZSTD_memset(&mtctx->jobs[jobID], 0, sizeof(mtctx->jobs[jobID])); -        mtctx->jobs[jobID].job_mutex = mutex; -        mtctx->jobs[jobID].job_cond = cond; +        mtctx->jobs[jobID].job_mutex = mutex;  +        mtctx->jobs[jobID].job_cond = cond;       }      mtctx->inBuff.buffer = g_nullBuffer;      mtctx->inBuff.filled = 0; @@ -1149,7 +1149,7 @@ size_t ZSTDMT_toFlushNow(ZSTDMT_CCtx* mtctx)  /* =====   Multi-threaded compression   ===== */  /* ------------------------------------------ */ -static unsigned ZSTDMT_computeTargetJobLog(const ZSTD_CCtx_params* params) +static unsigned ZSTDMT_computeTargetJobLog(const ZSTD_CCtx_params* params)   {      unsigned jobLog;      if (params->ldmParams.enableLdm == ZSTD_ps_enable) { @@ -1158,7 +1158,7 @@ static unsigned ZSTDMT_computeTargetJobLog(const ZSTD_CCtx_params* params)           * based on cycleLog instead. */          jobLog = MAX(21, ZSTD_cycleLog(params->cParams.chainLog, params->cParams.strategy) + 3);      } else { -        jobLog = MAX(20, params->cParams.windowLog + 2); +        jobLog = MAX(20, params->cParams.windowLog + 2);       }      return MIN(jobLog, (unsigned)ZSTDMT_JOBLOG_MAX);  } @@ -1191,21 +1191,21 @@ static int ZSTDMT_overlapLog(int ovlog, ZSTD_strategy strat)      return ovlog;  } -static size_t ZSTDMT_computeOverlapSize(const ZSTD_CCtx_params* params) +static size_t ZSTDMT_computeOverlapSize(const ZSTD_CCtx_params* params)   { -    int const overlapRLog = 9 - ZSTDMT_overlapLog(params->overlapLog, params->cParams.strategy); -    int ovLog = (overlapRLog >= 8) ? 0 : (params->cParams.windowLog - overlapRLog); +    int const overlapRLog = 9 - ZSTDMT_overlapLog(params->overlapLog, params->cParams.strategy);  +    int ovLog = (overlapRLog >= 8) ? 0 : (params->cParams.windowLog - overlapRLog);       assert(0 <= overlapRLog && overlapRLog <= 8);      if (params->ldmParams.enableLdm == ZSTD_ps_enable) {          /* In Long Range Mode, the windowLog is typically oversized.           * In which case, it's preferable to determine the jobSize           * based on chainLog instead.           * Then, ovLog becomes a fraction of the jobSize, rather than windowSize */ -        ovLog = MIN(params->cParams.windowLog, ZSTDMT_computeTargetJobLog(params) - 2) +        ovLog = MIN(params->cParams.windowLog, ZSTDMT_computeTargetJobLog(params) - 2)                   - overlapRLog;      }      assert(0 <= ovLog && ovLog <= ZSTD_WINDOWLOG_MAX); -    DEBUGLOG(4, "overlapLog : %i", params->overlapLog); +    DEBUGLOG(4, "overlapLog : %i", params->overlapLog);       DEBUGLOG(4, "overlap size : %i", 1 << ovLog);      return (ovLog==0) ? 0 : (size_t)1 << ovLog;  } @@ -1257,11 +1257,11 @@ size_t ZSTDMT_initCStream_internal(          mtctx->cdict = cdict;      } -    mtctx->targetPrefixSize = ZSTDMT_computeOverlapSize(¶ms); +    mtctx->targetPrefixSize = ZSTDMT_computeOverlapSize(¶ms);       DEBUGLOG(4, "overlapLog=%i => %u KB", params.overlapLog, (U32)(mtctx->targetPrefixSize>>10));      mtctx->targetSectionSize = params.jobSize;      if (mtctx->targetSectionSize == 0) { -        mtctx->targetSectionSize = 1ULL << ZSTDMT_computeTargetJobLog(¶ms); +        mtctx->targetSectionSize = 1ULL << ZSTDMT_computeTargetJobLog(¶ms);       }      assert(mtctx->targetSectionSize <= (size_t)ZSTDMT_JOBSIZE_MAX); diff --git a/contrib/libs/zstd/lib/decompress/zstd_decompress.c b/contrib/libs/zstd/lib/decompress/zstd_decompress.c index b8bbefd538f..9147aaa091c 100644 --- a/contrib/libs/zstd/lib/decompress/zstd_decompress.c +++ b/contrib/libs/zstd/lib/decompress/zstd_decompress.c @@ -229,7 +229,7 @@ size_t ZSTD_estimateDCtxSize(void) { return sizeof(ZSTD_DCtx); }  static size_t ZSTD_startingInputLength(ZSTD_format_e format)  { -    size_t const startingInputLength = ZSTD_FRAMEHEADERSIZE_PREFIX(format); +    size_t const startingInputLength = ZSTD_FRAMEHEADERSIZE_PREFIX(format);       /* only supports formats ZSTD_f_zstd1 and ZSTD_f_zstd1_magicless */      assert( (format == ZSTD_f_zstd1) || (format == ZSTD_f_zstd1_magicless) );      return startingInputLength; @@ -610,7 +610,7 @@ unsigned long long ZSTD_findDecompressedSize(const void* src, size_t srcSize)  {      unsigned long long totalDstSize = 0; -    while (srcSize >= ZSTD_startingInputLength(ZSTD_f_zstd1)) { +    while (srcSize >= ZSTD_startingInputLength(ZSTD_f_zstd1)) {           U32 const magicNumber = MEM_readLE32(src);          if ((magicNumber & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) { @@ -806,10 +806,10 @@ unsigned long long ZSTD_decompressBound(const void* src, size_t srcSize)   ***************************************************************/  /** ZSTD_insertBlock() : - *  insert `src` block into `dctx` history. Useful to track uncompressed blocks. */ + *  insert `src` block into `dctx` history. Useful to track uncompressed blocks. */   size_t ZSTD_insertBlock(ZSTD_DCtx* dctx, const void* blockStart, size_t blockSize)  { -    DEBUGLOG(5, "ZSTD_insertBlock: %u bytes", (unsigned)blockSize); +    DEBUGLOG(5, "ZSTD_insertBlock: %u bytes", (unsigned)blockSize);       ZSTD_checkContinuity(dctx, blockStart, blockSize);      dctx->previousDstEnd = (const char*)blockStart + blockSize;      return blockSize; @@ -888,12 +888,12 @@ static size_t ZSTD_decompressFrame(ZSTD_DCtx* dctx,      /* check */      RETURN_ERROR_IF( -        remainingSrcSize < ZSTD_FRAMEHEADERSIZE_MIN(dctx->format)+ZSTD_blockHeaderSize, +        remainingSrcSize < ZSTD_FRAMEHEADERSIZE_MIN(dctx->format)+ZSTD_blockHeaderSize,           srcSize_wrong, "");      /* Frame Header */ -    {   size_t const frameHeaderSize = ZSTD_frameHeaderSize_internal( -                ip, ZSTD_FRAMEHEADERSIZE_PREFIX(dctx->format), dctx->format); +    {   size_t const frameHeaderSize = ZSTD_frameHeaderSize_internal(  +                ip, ZSTD_FRAMEHEADERSIZE_PREFIX(dctx->format), dctx->format);           if (ZSTD_isError(frameHeaderSize)) return frameHeaderSize;          RETURN_ERROR_IF(remainingSrcSize < frameHeaderSize+ZSTD_blockHeaderSize,                          srcSize_wrong, ""); @@ -978,7 +978,7 @@ static size_t ZSTD_decompressMultiFrame(ZSTD_DCtx* dctx,          dictSize = ZSTD_DDict_dictSize(ddict);      } -    while (srcSize >= ZSTD_startingInputLength(dctx->format)) { +    while (srcSize >= ZSTD_startingInputLength(dctx->format)) {   #if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1)          if (ZSTD_isLegacy(src, srcSize)) { @@ -1410,7 +1410,7 @@ ZSTD_loadDEntropy(ZSTD_entropyDTables_t* entropy,          size_t const dictContentSize = (size_t)(dictEnd - (dictPtr+12));          for (i=0; i<3; i++) {              U32 const rep = MEM_readLE32(dictPtr); dictPtr += 4; -            RETURN_ERROR_IF(rep==0 || rep > dictContentSize, +            RETURN_ERROR_IF(rep==0 || rep > dictContentSize,                               dictionary_corrupted, "");              entropy->rep[i] = rep;      }   } @@ -1584,7 +1584,7 @@ size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx,  {      RETURN_ERROR_IF(dctx->streamStage != zdss_init, stage_wrong, "");      ZSTD_clearDict(dctx); -    if (dict && dictSize != 0) { +    if (dict && dictSize != 0) {           dctx->ddictLocal = ZSTD_createDDict_advanced(dict, dictSize, dictLoadMethod, dictContentType, dctx->customMem);          RETURN_ERROR_IF(dctx->ddictLocal == NULL, memory_allocation, "NULL pointer!");          dctx->ddict = dctx->ddictLocal; @@ -1617,14 +1617,14 @@ size_t ZSTD_DCtx_refPrefix(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSiz  /* ZSTD_initDStream_usingDict() : - * return : expected size, aka ZSTD_startingInputLength(). + * return : expected size, aka ZSTD_startingInputLength().    * this function cannot fail */  size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize)  {      DEBUGLOG(4, "ZSTD_initDStream_usingDict");      FORWARD_IF_ERROR( ZSTD_DCtx_reset(zds, ZSTD_reset_session_only) , "");      FORWARD_IF_ERROR( ZSTD_DCtx_loadDictionary(zds, dict, dictSize) , ""); -    return ZSTD_startingInputLength(zds->format); +    return ZSTD_startingInputLength(zds->format);   }  /* note : this variant can't fail */ @@ -1641,16 +1641,16 @@ size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* dctx, const ZSTD_DDict* ddict)  {      FORWARD_IF_ERROR( ZSTD_DCtx_reset(dctx, ZSTD_reset_session_only) , "");      FORWARD_IF_ERROR( ZSTD_DCtx_refDDict(dctx, ddict) , ""); -    return ZSTD_startingInputLength(dctx->format); +    return ZSTD_startingInputLength(dctx->format);   }  /* ZSTD_resetDStream() : - * return : expected size, aka ZSTD_startingInputLength(). + * return : expected size, aka ZSTD_startingInputLength().    * this function cannot fail */  size_t ZSTD_resetDStream(ZSTD_DStream* dctx)  {      FORWARD_IF_ERROR(ZSTD_DCtx_reset(dctx, ZSTD_reset_session_only), ""); -    return ZSTD_startingInputLength(dctx->format); +    return ZSTD_startingInputLength(dctx->format);   } @@ -2012,7 +2012,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB                              zds->lhSize += remainingInput;                          }                          input->pos = input->size; -                        return (MAX((size_t)ZSTD_FRAMEHEADERSIZE_MIN(zds->format), hSize) - zds->lhSize) + ZSTD_blockHeaderSize;   /* remaining header bytes + next block header */ +                        return (MAX((size_t)ZSTD_FRAMEHEADERSIZE_MIN(zds->format), hSize) - zds->lhSize) + ZSTD_blockHeaderSize;   /* remaining header bytes + next block header */                       }                      assert(ip != NULL);                      ZSTD_memcpy(zds->headerBuffer + zds->lhSize, ip, toLoad); zds->lhSize = hSize; ip += toLoad; diff --git a/contrib/libs/zstd/lib/decompress/zstd_decompress_block.c b/contrib/libs/zstd/lib/decompress/zstd_decompress_block.c index 2e44d30d2f3..18fe5e45c40 100644 --- a/contrib/libs/zstd/lib/decompress/zstd_decompress_block.c +++ b/contrib/libs/zstd/lib/decompress/zstd_decompress_block.c @@ -120,7 +120,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx,                            const void* src, size_t srcSize,   /* note : srcSize < BLOCKSIZE */                            void* dst, size_t dstCapacity, const streaming_operation streaming)  { -    DEBUGLOG(5, "ZSTD_decodeLiteralsBlock"); +    DEBUGLOG(5, "ZSTD_decodeLiteralsBlock");       RETURN_ERROR_IF(srcSize < MIN_CBLOCK_SIZE, corruption_detected, "");      {   const BYTE* const istart = (const BYTE*) src; @@ -129,7 +129,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx,          switch(litEncType)          {          case set_repeat: -            DEBUGLOG(5, "set_repeat flag : re-using stats from previous compressed literals block"); +            DEBUGLOG(5, "set_repeat flag : re-using stats from previous compressed literals block");               RETURN_ERROR_IF(dctx->litEntropy==0, dictionary_corrupted, "");              ZSTD_FALLTHROUGH; @@ -160,7 +160,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx,                      /* 2 - 2 - 18 - 18 */                      lhSize = 5;                      litSize  = (lhc >> 4) & 0x3FFFF; -                    litCSize = (lhc >> 22) + ((size_t)istart[4] << 10); +                    litCSize = (lhc >> 22) + ((size_t)istart[4] << 10);                       break;                  }                  RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled"); @@ -472,8 +472,8 @@ void ZSTD_buildFSETable_body(ZSTD_seqSymbol* dt,                      symbolNext[s] = 1;                  } else {                      if (normalizedCounter[s] >= largeLimit) DTableH.fastMode=0; -                    assert(normalizedCounter[s]>=0); -                    symbolNext[s] = (U16)normalizedCounter[s]; +                    assert(normalizedCounter[s]>=0);  +                    symbolNext[s] = (U16)normalizedCounter[s];           }   }   }          ZSTD_memcpy(dt, &DTableH, sizeof(DTableH));      } @@ -749,83 +749,83 @@ typedef struct {      size_t prevOffset[ZSTD_REP_NUM];  } seqState_t; -/*! ZSTD_overlapCopy8() : - *  Copies 8 bytes from ip to op and updates op and ip where ip <= op. - *  If the offset is < 8 then the offset is spread to at least 8 bytes. - * - *  Precondition: *ip <= *op - *  Postcondition: *op - *op >= 8 - */ +/*! ZSTD_overlapCopy8() :  + *  Copies 8 bytes from ip to op and updates op and ip where ip <= op.  + *  If the offset is < 8 then the offset is spread to at least 8 bytes.  + *  + *  Precondition: *ip <= *op  + *  Postcondition: *op - *op >= 8  + */   HINT_INLINE void ZSTD_overlapCopy8(BYTE** op, BYTE const** ip, size_t offset) { -    assert(*ip <= *op); -    if (offset < 8) { -        /* close range match, overlap */ -        static const U32 dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 };   /* added */ -        static const int dec64table[] = { 8, 8, 8, 7, 8, 9,10,11 };   /* subtracted */ -        int const sub2 = dec64table[offset]; -        (*op)[0] = (*ip)[0]; -        (*op)[1] = (*ip)[1]; -        (*op)[2] = (*ip)[2]; -        (*op)[3] = (*ip)[3]; -        *ip += dec32table[offset]; -        ZSTD_copy4(*op+4, *ip); -        *ip -= sub2; -    } else { -        ZSTD_copy8(*op, *ip); -    } -    *ip += 8; -    *op += 8; -    assert(*op - *ip >= 8); -} - -/*! ZSTD_safecopy() : - *  Specialized version of memcpy() that is allowed to READ up to WILDCOPY_OVERLENGTH past the input buffer - *  and write up to 16 bytes past oend_w (op >= oend_w is allowed). - *  This function is only called in the uncommon case where the sequence is near the end of the block. It - *  should be fast for a single long sequence, but can be slow for several short sequences. - * - *  @param ovtype controls the overlap detection - *         - ZSTD_no_overlap: The source and destination are guaranteed to be at least WILDCOPY_VECLEN bytes apart. - *         - ZSTD_overlap_src_before_dst: The src and dst may overlap and may be any distance apart. - *           The src buffer must be before the dst buffer. - */ +    assert(*ip <= *op);  +    if (offset < 8) {  +        /* close range match, overlap */  +        static const U32 dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 };   /* added */  +        static const int dec64table[] = { 8, 8, 8, 7, 8, 9,10,11 };   /* subtracted */  +        int const sub2 = dec64table[offset];  +        (*op)[0] = (*ip)[0];  +        (*op)[1] = (*ip)[1];  +        (*op)[2] = (*ip)[2];  +        (*op)[3] = (*ip)[3];  +        *ip += dec32table[offset];  +        ZSTD_copy4(*op+4, *ip);  +        *ip -= sub2;  +    } else {  +        ZSTD_copy8(*op, *ip);  +    }  +    *ip += 8;  +    *op += 8;  +    assert(*op - *ip >= 8);  +}  + +/*! ZSTD_safecopy() :  + *  Specialized version of memcpy() that is allowed to READ up to WILDCOPY_OVERLENGTH past the input buffer  + *  and write up to 16 bytes past oend_w (op >= oend_w is allowed).  + *  This function is only called in the uncommon case where the sequence is near the end of the block. It  + *  should be fast for a single long sequence, but can be slow for several short sequences.  + *  + *  @param ovtype controls the overlap detection  + *         - ZSTD_no_overlap: The source and destination are guaranteed to be at least WILDCOPY_VECLEN bytes apart.  + *         - ZSTD_overlap_src_before_dst: The src and dst may overlap and may be any distance apart.  + *           The src buffer must be before the dst buffer.  + */   static void ZSTD_safecopy(BYTE* op, const BYTE* const oend_w, BYTE const* ip, ptrdiff_t length, ZSTD_overlap_e ovtype) { -    ptrdiff_t const diff = op - ip; -    BYTE* const oend = op + length; - -    assert((ovtype == ZSTD_no_overlap && (diff <= -8 || diff >= 8 || op >= oend_w)) || -           (ovtype == ZSTD_overlap_src_before_dst && diff >= 0)); - -    if (length < 8) { -        /* Handle short lengths. */ -        while (op < oend) *op++ = *ip++; -        return; -    } -    if (ovtype == ZSTD_overlap_src_before_dst) { -        /* Copy 8 bytes and ensure the offset >= 8 when there can be overlap. */ -        assert(length >= 8); -        ZSTD_overlapCopy8(&op, &ip, diff); +    ptrdiff_t const diff = op - ip;  +    BYTE* const oend = op + length;  +  +    assert((ovtype == ZSTD_no_overlap && (diff <= -8 || diff >= 8 || op >= oend_w)) ||  +           (ovtype == ZSTD_overlap_src_before_dst && diff >= 0));  +  +    if (length < 8) {  +        /* Handle short lengths. */  +        while (op < oend) *op++ = *ip++;  +        return;  +    }  +    if (ovtype == ZSTD_overlap_src_before_dst) {  +        /* Copy 8 bytes and ensure the offset >= 8 when there can be overlap. */  +        assert(length >= 8);  +        ZSTD_overlapCopy8(&op, &ip, diff);           length -= 8; -        assert(op - ip >= 8); -        assert(op <= oend); -    } - -    if (oend <= oend_w) { -        /* No risk of overwrite. */ -        ZSTD_wildcopy(op, ip, length, ovtype); -        return; -    } -    if (op <= oend_w) { -        /* Wildcopy until we get close to the end. */ -        assert(oend > oend_w); -        ZSTD_wildcopy(op, ip, oend_w - op, ovtype); -        ip += oend_w - op; +        assert(op - ip >= 8);  +        assert(op <= oend);  +    }  +  +    if (oend <= oend_w) {  +        /* No risk of overwrite. */  +        ZSTD_wildcopy(op, ip, length, ovtype);  +        return;  +    }  +    if (op <= oend_w) {  +        /* Wildcopy until we get close to the end. */  +        assert(oend > oend_w);  +        ZSTD_wildcopy(op, ip, oend_w - op, ovtype);  +        ip += oend_w - op;           op += oend_w - op; -    } -    /* Handle the leftovers. */ -    while (op < oend) *op++ = *ip++; -} - +    }  +    /* Handle the leftovers. */  +    while (op < oend) *op++ = *ip++;  +}  +   /* ZSTD_safecopyDstBeforeSrc():   * This version allows overlap with dst before src, or handles the non-overlap case with dst after src   * Kept separate from more common ZSTD_safecopy case to avoid performance impact to the safecopy common case */ @@ -849,16 +849,16 @@ static void ZSTD_safecopyDstBeforeSrc(BYTE* op, BYTE const* ip, ptrdiff_t length      while (op < oend) *op++ = *ip++;  } -/* ZSTD_execSequenceEnd(): - * This version handles cases that are near the end of the output buffer. It requires - * more careful checks to make sure there is no overflow. By separating out these hard - * and unlikely cases, we can speed up the common cases. - * - * NOTE: This function needs to be fast for a single long sequence, but doesn't need - * to be optimized for many small sequences, since those fall into ZSTD_execSequence(). - */ +/* ZSTD_execSequenceEnd():  + * This version handles cases that are near the end of the output buffer. It requires  + * more careful checks to make sure there is no overflow. By separating out these hard  + * and unlikely cases, we can speed up the common cases.  + *  + * NOTE: This function needs to be fast for a single long sequence, but doesn't need  + * to be optimized for many small sequences, since those fall into ZSTD_execSequence().  + */   FORCE_NOINLINE -size_t ZSTD_execSequenceEnd(BYTE* op, +size_t ZSTD_execSequenceEnd(BYTE* op,       BYTE* const oend, seq_t sequence,      const BYTE** litPtr, const BYTE* const litLimit,      const BYTE* const prefixStart, const BYTE* const virtualStart, const BYTE* const dictEnd) @@ -867,7 +867,7 @@ size_t ZSTD_execSequenceEnd(BYTE* op,      size_t const sequenceLength = sequence.litLength + sequence.matchLength;      const BYTE* const iLitEnd = *litPtr + sequence.litLength;      const BYTE* match = oLitEnd - sequence.offset; -    BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH; +    BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH;       /* bounds checks : careful of address space overflow in 32-bit mode */      RETURN_ERROR_IF(sequenceLength > (size_t)(oend - op), dstSize_tooSmall, "last match must fit within dstBuffer"); @@ -876,12 +876,12 @@ size_t ZSTD_execSequenceEnd(BYTE* op,      assert(oLitEnd < op + sequenceLength);      /* copy literals */ -    ZSTD_safecopy(op, oend_w, *litPtr, sequence.litLength, ZSTD_no_overlap); -    op = oLitEnd; -    *litPtr = iLitEnd; +    ZSTD_safecopy(op, oend_w, *litPtr, sequence.litLength, ZSTD_no_overlap);  +    op = oLitEnd;  +    *litPtr = iLitEnd;       /* copy Match */ -    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) { +    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {           /* offset beyond prefix */          RETURN_ERROR_IF(sequence.offset > (size_t)(oLitEnd - virtualStart), corruption_detected, "");          match = dictEnd - (prefixStart - match); @@ -897,7 +897,7 @@ size_t ZSTD_execSequenceEnd(BYTE* op,          match = prefixStart;          }      } -    ZSTD_safecopy(op, oend_w, match, sequence.matchLength, ZSTD_overlap_src_before_dst); +    ZSTD_safecopy(op, oend_w, match, sequence.matchLength, ZSTD_overlap_src_before_dst);       return sequenceLength;  } @@ -1067,27 +1067,27 @@ size_t ZSTD_execSequenceSplitLitBuffer(BYTE* op,              (MEM_32bits() && (size_t)(oend - op) < sequenceLength + WILDCOPY_OVERLENGTH)))          return ZSTD_execSequenceEndSplitLitBuffer(op, oend, oend_w, sequence, litPtr, litLimit, prefixStart, virtualStart, dictEnd); -    /* Assumptions (everything else goes into ZSTD_execSequenceEnd()) */ +    /* Assumptions (everything else goes into ZSTD_execSequenceEnd()) */       assert(op <= oLitEnd /* No overflow */);      assert(oLitEnd < oMatchEnd /* Non-zero match & no overflow */);      assert(oMatchEnd <= oend /* No underflow */); -    assert(iLitEnd <= litLimit /* Literal length is in bounds */); -    assert(oLitEnd <= oend_w /* Can wildcopy literals */); -    assert(oMatchEnd <= oend_w /* Can wildcopy matches */); - -    /* Copy Literals: -     * Split out litLength <= 16 since it is nearly always true. +1.6% on gcc-9. -     * We likely don't need the full 32-byte wildcopy. -     */ -    assert(WILDCOPY_OVERLENGTH >= 16); -    ZSTD_copy16(op, (*litPtr)); +    assert(iLitEnd <= litLimit /* Literal length is in bounds */);  +    assert(oLitEnd <= oend_w /* Can wildcopy literals */);  +    assert(oMatchEnd <= oend_w /* Can wildcopy matches */);  +  +    /* Copy Literals:  +     * Split out litLength <= 16 since it is nearly always true. +1.6% on gcc-9.  +     * We likely don't need the full 32-byte wildcopy.  +     */  +    assert(WILDCOPY_OVERLENGTH >= 16);  +    ZSTD_copy16(op, (*litPtr));       if (UNLIKELY(sequence.litLength > 16)) { -        ZSTD_wildcopy(op+16, (*litPtr)+16, sequence.litLength-16, ZSTD_no_overlap); -    } +        ZSTD_wildcopy(op+16, (*litPtr)+16, sequence.litLength-16, ZSTD_no_overlap);  +    }       op = oLitEnd;      *litPtr = iLitEnd;   /* update for next sequence */ -    /* Copy Match */ +    /* Copy Match */       if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {          /* offset beyond prefix -> go into extDict */          RETURN_ERROR_IF(UNLIKELY(sequence.offset > (size_t)(oLitEnd - virtualStart)), corruption_detected, ""); @@ -1103,32 +1103,32 @@ size_t ZSTD_execSequenceSplitLitBuffer(BYTE* op,              sequence.matchLength -= length1;              match = prefixStart;      }   } -    /* Match within prefix of 1 or more bytes */ -    assert(op <= oMatchEnd); -    assert(oMatchEnd <= oend_w); -    assert(match >= prefixStart); -    assert(sequence.matchLength >= 1); - -    /* Nearly all offsets are >= WILDCOPY_VECLEN bytes, which means we can use wildcopy -     * without overlap checking. -     */ +    /* Match within prefix of 1 or more bytes */  +    assert(op <= oMatchEnd);  +    assert(oMatchEnd <= oend_w);  +    assert(match >= prefixStart);  +    assert(sequence.matchLength >= 1);  + +    /* Nearly all offsets are >= WILDCOPY_VECLEN bytes, which means we can use wildcopy  +     * without overlap checking.  +     */       if (LIKELY(sequence.offset >= WILDCOPY_VECLEN)) { -        /* We bet on a full wildcopy for matches, since we expect matches to be -         * longer than literals (in general). In silesia, ~10% of matches are longer -         * than 16 bytes. -         */ -        ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength, ZSTD_no_overlap); -        return sequenceLength; +        /* We bet on a full wildcopy for matches, since we expect matches to be  +         * longer than literals (in general). In silesia, ~10% of matches are longer  +         * than 16 bytes.  +         */  +        ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength, ZSTD_no_overlap);  +        return sequenceLength;       } -    assert(sequence.offset < WILDCOPY_VECLEN); +    assert(sequence.offset < WILDCOPY_VECLEN);  -    /* Copy 8 bytes and spread the offset to be >= 8. */ -    ZSTD_overlapCopy8(&op, &match, sequence.offset); +    /* Copy 8 bytes and spread the offset to be >= 8. */  +    ZSTD_overlapCopy8(&op, &match, sequence.offset);  -    /* If the match length is > 8 bytes, then continue with the wildcopy. */ -    if (sequence.matchLength > 8) { -        assert(op < oMatchEnd); -        ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength-8, ZSTD_overlap_src_before_dst); +    /* If the match length is > 8 bytes, then continue with the wildcopy. */  +    if (sequence.matchLength > 8) {  +        assert(op < oMatchEnd);  +        ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength-8, ZSTD_overlap_src_before_dst);       }      return sequenceLength;  } diff --git a/contrib/libs/zstd/lib/dictBuilder/cover.c b/contrib/libs/zstd/lib/dictBuilder/cover.c index 028802a1b00..0d129c039bc 100644 --- a/contrib/libs/zstd/lib/dictBuilder/cover.c +++ b/contrib/libs/zstd/lib/dictBuilder/cover.c @@ -655,8 +655,8 @@ void COVER_warnOnSmallCorpus(size_t maxDictSize, size_t nbDmers, int displayLeve                      "compared to the source size %u! "                      "size(source)/size(dictionary) = %f, but it should be >= "                      "10! This may lead to a subpar dictionary! We recommend " -                    "training on sources at least 10x, and preferably 100x " -                    "the size of the dictionary! \n", (U32)maxDictSize, +                    "training on sources at least 10x, and preferably 100x "  +                    "the size of the dictionary! \n", (U32)maxDictSize,                       (U32)nbDmers, ratio);  } @@ -936,11 +936,11 @@ void COVER_best_finish(COVER_best_t *best, ZDICT_cover_params_t parameters,          }        }        /* Save the dictionary, parameters, and size */ -      if (dict) { -        memcpy(best->dict, dict, dictSize); -        best->dictSize = dictSize; -        best->parameters = parameters; -        best->compressedSize = compressedSize; +      if (dict) {  +        memcpy(best->dict, dict, dictSize);  +        best->dictSize = dictSize;  +        best->parameters = parameters;  +        best->compressedSize = compressedSize;         }      }      if (liveJobs == 0) { diff --git a/contrib/libs/zstd/lib/dictBuilder/zdict.c b/contrib/libs/zstd/lib/dictBuilder/zdict.c index 587df6b8619..5773af10635 100644 --- a/contrib/libs/zstd/lib/dictBuilder/zdict.c +++ b/contrib/libs/zstd/lib/dictBuilder/zdict.c @@ -619,7 +619,7 @@ static void ZDICT_fillNoise(void* buffer, size_t length)      unsigned const prime1 = 2654435761U;      unsigned const prime2 = 2246822519U;      unsigned acc = prime1; -    size_t p=0; +    size_t p=0;       for (p=0; p<length; p++) {          acc *= prime2;          ((unsigned char*)buffer)[p] = (unsigned char)(acc >> 21); diff --git a/contrib/libs/zstd/lib/legacy/zstd_v01.c b/contrib/libs/zstd/lib/legacy/zstd_v01.c index 23caaef5647..542f5ea9e75 100644 --- a/contrib/libs/zstd/lib/legacy/zstd_v01.c +++ b/contrib/libs/zstd/lib/legacy/zstd_v01.c @@ -342,7 +342,7 @@ FORCE_INLINE unsigned FSE_highbit32 (U32 val)      unsigned long r;      return _BitScanReverse(&r, val) ? (unsigned)r : 0;  #   elif defined(__GNUC__) && (GCC_VERSION >= 304)   /* GCC Intrinsic */ -    return __builtin_clz (val) ^ 31; +    return __builtin_clz (val) ^ 31;   #   else   /* Software version */      static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 };      U32 v = val; diff --git a/contrib/libs/zstd/lib/legacy/zstd_v02.c b/contrib/libs/zstd/lib/legacy/zstd_v02.c index 2f473a75734..379854ff74f 100644 --- a/contrib/libs/zstd/lib/legacy/zstd_v02.c +++ b/contrib/libs/zstd/lib/legacy/zstd_v02.c @@ -353,7 +353,7 @@ MEM_STATIC unsigned BIT_highbit32 (U32 val)      unsigned long r;      return _BitScanReverse(&r, val) ? (unsigned)r : 0;  #   elif defined(__GNUC__) && (__GNUC__ >= 3)   /* Use GCC Intrinsic */ -    return __builtin_clz (val) ^ 31; +    return __builtin_clz (val) ^ 31;   #   else   /* Software version */      static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 };      U32 v = val; @@ -2891,7 +2891,7 @@ static size_t ZSTD_decodeLiteralsBlock(void* ctx,              const size_t litSize = (MEM_readLE32(istart) & 0xFFFFFF) >> 2;   /* no buffer issue : srcSize >= MIN_CBLOCK_SIZE */              if (litSize > srcSize-11)   /* risk of reading too far with wildcopy */              { -                if (litSize > BLOCKSIZE) return ERROR(corruption_detected); +                if (litSize > BLOCKSIZE) return ERROR(corruption_detected);                   if (litSize > srcSize-3) return ERROR(corruption_detected);                  memcpy(dctx->litBuffer, istart, litSize);                  dctx->litPtr = dctx->litBuffer; diff --git a/contrib/libs/zstd/lib/legacy/zstd_v03.c b/contrib/libs/zstd/lib/legacy/zstd_v03.c index 6625f4df1cb..ad2552f421d 100644 --- a/contrib/libs/zstd/lib/legacy/zstd_v03.c +++ b/contrib/libs/zstd/lib/legacy/zstd_v03.c @@ -356,7 +356,7 @@ MEM_STATIC unsigned BIT_highbit32 (U32 val)      unsigned long r;      return _BitScanReverse(&r, val) ? (unsigned)r : 0;  #   elif defined(__GNUC__) && (__GNUC__ >= 3)   /* Use GCC Intrinsic */ -    return __builtin_clz (val) ^ 31; +    return __builtin_clz (val) ^ 31;   #   else   /* Software version */      static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 };      U32 v = val; @@ -2532,7 +2532,7 @@ static size_t ZSTD_decodeLiteralsBlock(void* ctx,              const size_t litSize = (MEM_readLE32(istart) & 0xFFFFFF) >> 2;   /* no buffer issue : srcSize >= MIN_CBLOCK_SIZE */              if (litSize > srcSize-11)   /* risk of reading too far with wildcopy */              { -                if (litSize > BLOCKSIZE) return ERROR(corruption_detected); +                if (litSize > BLOCKSIZE) return ERROR(corruption_detected);                   if (litSize > srcSize-3) return ERROR(corruption_detected);                  memcpy(dctx->litBuffer, istart, litSize);                  dctx->litPtr = dctx->litBuffer; diff --git a/contrib/libs/zstd/lib/legacy/zstd_v04.c b/contrib/libs/zstd/lib/legacy/zstd_v04.c index 8d305c7eae9..55c81796f43 100644 --- a/contrib/libs/zstd/lib/legacy/zstd_v04.c +++ b/contrib/libs/zstd/lib/legacy/zstd_v04.c @@ -627,7 +627,7 @@ MEM_STATIC unsigned BIT_highbit32 (U32 val)      unsigned long r;      return _BitScanReverse(&r, val) ? (unsigned)r : 0;  #   elif defined(__GNUC__) && (__GNUC__ >= 3)   /* Use GCC Intrinsic */ -    return __builtin_clz (val) ^ 31; +    return __builtin_clz (val) ^ 31;   #   else   /* Software version */      static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 };      U32 v = val; @@ -2657,7 +2657,7 @@ static size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx,              const size_t litSize = (MEM_readLE32(istart) & 0xFFFFFF) >> 2;   /* no buffer issue : srcSize >= MIN_CBLOCK_SIZE */              if (litSize > srcSize-11)   /* risk of reading too far with wildcopy */              { -                if (litSize > BLOCKSIZE) return ERROR(corruption_detected); +                if (litSize > BLOCKSIZE) return ERROR(corruption_detected);                   if (litSize > srcSize-3) return ERROR(corruption_detected);                  memcpy(dctx->litBuffer, istart, litSize);                  dctx->litPtr = dctx->litBuffer; @@ -3039,12 +3039,12 @@ static size_t ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx,  {      /* blockType == blockCompressed */      const BYTE* ip = (const BYTE*)src; -    size_t litCSize; - -    if (srcSize > BLOCKSIZE) return ERROR(corruption_detected); +    size_t litCSize;  +    if (srcSize > BLOCKSIZE) return ERROR(corruption_detected);  +       /* Decode literals sub-block */ -    litCSize = ZSTD_decodeLiteralsBlock(dctx, src, srcSize); +    litCSize = ZSTD_decodeLiteralsBlock(dctx, src, srcSize);       if (ZSTD_isError(litCSize)) return litCSize;      ip += litCSize;      srcSize -= litCSize; diff --git a/contrib/libs/zstd/lib/legacy/zstd_v05.c b/contrib/libs/zstd/lib/legacy/zstd_v05.c index 795dfb410c0..857e7653257 100644 --- a/contrib/libs/zstd/lib/legacy/zstd_v05.c +++ b/contrib/libs/zstd/lib/legacy/zstd_v05.c @@ -756,7 +756,7 @@ MEM_STATIC unsigned BITv05_highbit32 (U32 val)      unsigned long r;      return _BitScanReverse(&r, val) ? (unsigned)r : 0;  #   elif defined(__GNUC__) && (__GNUC__ >= 3)   /* Use GCC Intrinsic */ -    return __builtin_clz (val) ^ 31; +    return __builtin_clz (val) ^ 31;   #   else   /* Software version */      static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 };      U32 v = val; diff --git a/contrib/libs/zstd/lib/legacy/zstd_v06.c b/contrib/libs/zstd/lib/legacy/zstd_v06.c index ead213c4849..f668614dd93 100644 --- a/contrib/libs/zstd/lib/legacy/zstd_v06.c +++ b/contrib/libs/zstd/lib/legacy/zstd_v06.c @@ -860,7 +860,7 @@ MEM_STATIC unsigned BITv06_highbit32 ( U32 val)      unsigned long r;      return _BitScanReverse(&r, val) ? (unsigned)r : 0;  #   elif defined(__GNUC__) && (__GNUC__ >= 3)   /* Use GCC Intrinsic */ -    return __builtin_clz (val) ^ 31; +    return __builtin_clz (val) ^ 31;   #   else   /* Software version */      static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 };      U32 v = val; diff --git a/contrib/libs/zstd/lib/legacy/zstd_v07.c b/contrib/libs/zstd/lib/legacy/zstd_v07.c index 189f6ede69f..38e4a17d9c3 100644 --- a/contrib/libs/zstd/lib/legacy/zstd_v07.c +++ b/contrib/libs/zstd/lib/legacy/zstd_v07.c @@ -530,7 +530,7 @@ MEM_STATIC unsigned BITv07_highbit32 (U32 val)      unsigned long r;      return _BitScanReverse(&r, val) ? (unsigned)r : 0;  #   elif defined(__GNUC__) && (__GNUC__ >= 3)   /* Use GCC Intrinsic */ -    return __builtin_clz (val) ^ 31; +    return __builtin_clz (val) ^ 31;   #   else   /* Software version */      static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 };      U32 v = val; diff --git a/contrib/libs/zstd/lib/zstd.h b/contrib/libs/zstd/lib/zstd.h index a88ae7bf8ed..a29ddde89af 100644 --- a/contrib/libs/zstd/lib/zstd.h +++ b/contrib/libs/zstd/lib/zstd.h @@ -15,7 +15,7 @@ extern "C" {  #define ZSTD_H_235446  /* ======   Dependency   ======*/ -#include <limits.h>   /* INT_MAX */ +#include <limits.h>   /* INT_MAX */   #include <stddef.h>   /* size_t */ @@ -204,13 +204,13 @@ ZSTDLIB_API ZSTD_CCtx* ZSTD_createCCtx(void);  ZSTDLIB_API size_t     ZSTD_freeCCtx(ZSTD_CCtx* cctx);  /* accept NULL pointer */  /*! ZSTD_compressCCtx() : - *  Same as ZSTD_compress(), using an explicit ZSTD_CCtx. - *  Important : in order to behave similarly to `ZSTD_compress()`, - *  this function compresses at requested compression level, - *  __ignoring any other parameter__ . - *  If any advanced parameter was set using the advanced API, - *  they will all be reset. Only `compressionLevel` remains. - */ + *  Same as ZSTD_compress(), using an explicit ZSTD_CCtx.  + *  Important : in order to behave similarly to `ZSTD_compress()`,  + *  this function compresses at requested compression level,  + *  __ignoring any other parameter__ .  + *  If any advanced parameter was set using the advanced API,  + *  they will all be reset. Only `compressionLevel` remains.  + */   ZSTDLIB_API size_t ZSTD_compressCCtx(ZSTD_CCtx* cctx,                                       void* dst, size_t dstCapacity,                                 const void* src, size_t srcSize, @@ -245,7 +245,7 @@ ZSTDLIB_API size_t ZSTD_decompressDCtx(ZSTD_DCtx* dctx,   *   using ZSTD_CCtx_set*() functions.   *   Pushed parameters are sticky : they are valid for next compressed frame, and any subsequent frame.   *   "sticky" parameters are applicable to `ZSTD_compress2()` and `ZSTD_compressStream*()` ! - *   __They do not apply to "simple" one-shot variants such as ZSTD_compressCCtx()__ . + *   __They do not apply to "simple" one-shot variants such as ZSTD_compressCCtx()__ .    *   *   It's possible to reset all parameters to "default" using ZSTD_CCtx_reset().   * @@ -272,11 +272,11 @@ typedef enum {      /* compression parameters       * Note: When compressing with a ZSTD_CDict these parameters are superseded -     * by the parameters used to construct the ZSTD_CDict. -     * See ZSTD_CCtx_refCDict() for more info (superseded-by-cdict). */ -    ZSTD_c_compressionLevel=100, /* Set compression parameters according to pre-defined cLevel table. -                              * Note that exact compression parameters are dynamically determined, -                              * depending on both compression level and srcSize (when known). +     * by the parameters used to construct the ZSTD_CDict.  +     * See ZSTD_CCtx_refCDict() for more info (superseded-by-cdict). */  +    ZSTD_c_compressionLevel=100, /* Set compression parameters according to pre-defined cLevel table.  +                              * Note that exact compression parameters are dynamically determined,  +                              * depending on both compression level and srcSize (when known).                                 * Default level is ZSTD_CLEVEL_DEFAULT==3.                                * Special: value 0 means default, which is controlled by ZSTD_CLEVEL_DEFAULT.                                * Note 1 : it's possible to pass a negative compression level. @@ -284,17 +284,17 @@ typedef enum {                                *   to default. Setting this will however eventually dynamically impact the compression                                *   parameters which have not been manually set. The manually set                                *   ones will 'stick'. */ -    /* Advanced compression parameters : -     * It's possible to pin down compression parameters to some specific values. -     * In which case, these values are no longer dynamically selected by the compressor */ +    /* Advanced compression parameters :  +     * It's possible to pin down compression parameters to some specific values.  +     * In which case, these values are no longer dynamically selected by the compressor */       ZSTD_c_windowLog=101,    /* Maximum allowed back-reference distance, expressed as power of 2. -                              * This will set a memory budget for streaming decompression, -                              * with larger values requiring more memory -                              * and typically compressing more. +                              * This will set a memory budget for streaming decompression,  +                              * with larger values requiring more memory  +                              * and typically compressing more.                                 * Must be clamped between ZSTD_WINDOWLOG_MIN and ZSTD_WINDOWLOG_MAX.                                * Special: value 0 means "use default windowLog".                                * Note: Using a windowLog greater than ZSTD_WINDOWLOG_LIMIT_DEFAULT -                              *       requires explicitly allowing such size at streaming decompression stage. */ +                              *       requires explicitly allowing such size at streaming decompression stage. */       ZSTD_c_hashLog=102,      /* Size of the initial probe table, as a power of 2.                                * Resulting memory usage is (1 << (hashLog+2)).                                * Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX. @@ -305,13 +305,13 @@ typedef enum {                                * Resulting memory usage is (1 << (chainLog+2)).                                * Must be clamped between ZSTD_CHAINLOG_MIN and ZSTD_CHAINLOG_MAX.                                * Larger tables result in better and slower compression. -                              * This parameter is useless for "fast" strategy. +                              * This parameter is useless for "fast" strategy.                                 * It's still useful when using "dfast" strategy,                                * in which case it defines a secondary probe table.                                * Special: value 0 means "use default chainLog". */      ZSTD_c_searchLog=104,    /* Number of search attempts, as a power of 2.                                * More attempts result in better and slower compression. -                              * This parameter is useless for "fast" and "dFast" strategies. +                              * This parameter is useless for "fast" and "dFast" strategies.                                 * Special: value 0 means "use default searchLog". */      ZSTD_c_minMatch=105,     /* Minimum size of searched matches.                                * Note that Zstandard can still find matches of smaller size, @@ -367,7 +367,7 @@ typedef enum {      ZSTD_c_contentSizeFlag=200, /* Content size will be written into frame header _whenever known_ (default:1)                                * Content size must be known at the beginning of compression.                                * This is automatically the case when using ZSTD_compress2(), -                              * For streaming scenarios, content size must be provided with ZSTD_CCtx_setPledgedSrcSize() */ +                              * For streaming scenarios, content size must be provided with ZSTD_CCtx_setPledgedSrcSize() */       ZSTD_c_checksumFlag=201, /* A 32-bits checksum of content is written at end of frame (default:0) */      ZSTD_c_dictIDFlag=202,   /* When applicable, dictionary's ID is written into frame header (default:1) */ @@ -390,7 +390,7 @@ typedef enum {                                * Each compression job is completed in parallel, so this value can indirectly impact the nb of active threads.                                * 0 means default, which is dynamically determined based on compression parameters.                                * Job size must be a minimum of overlap size, or ZSTDMT_JOBSIZE_MIN (= 512 KB), whichever is largest. -                              * The minimum size is automatically and transparently enforced. */ +                              * The minimum size is automatically and transparently enforced. */       ZSTD_c_overlapLog=402,   /* Control the overlap size, as a fraction of window size.                                * The overlap size is an amount of data reloaded from previous job at the beginning of a new job.                                * It helps preserve compression ratio, while each job is compressed in parallel. @@ -413,7 +413,7 @@ typedef enum {       * ZSTD_c_forceAttachDict       * ZSTD_c_literalCompressionMode       * ZSTD_c_targetCBlockSize -     * ZSTD_c_srcSizeHint +     * ZSTD_c_srcSizeHint        * ZSTD_c_enableDedicatedDictSearch       * ZSTD_c_stableInBuffer       * ZSTD_c_stableOutBuffer @@ -844,17 +844,17 @@ ZSTDLIB_API size_t ZSTD_decompress_usingDict(ZSTD_DCtx* dctx,  typedef struct ZSTD_CDict_s ZSTD_CDict;  /*! ZSTD_createCDict() : - *  When compressing multiple messages or blocks using the same dictionary, - *  it's recommended to digest the dictionary only once, since it's a costly operation. - *  ZSTD_createCDict() will create a state from digesting a dictionary. - *  The resulting state can be used for future compression operations with very limited startup cost. + *  When compressing multiple messages or blocks using the same dictionary,  + *  it's recommended to digest the dictionary only once, since it's a costly operation.  + *  ZSTD_createCDict() will create a state from digesting a dictionary.  + *  The resulting state can be used for future compression operations with very limited startup cost.    *  ZSTD_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only. - * @dictBuffer can be released after ZSTD_CDict creation, because its content is copied within CDict. - *  Note 1 : Consider experimental function `ZSTD_createCDict_byReference()` if you prefer to not duplicate @dictBuffer content. - *  Note 2 : A ZSTD_CDict can be created from an empty @dictBuffer, - *      in which case the only thing that it transports is the @compressionLevel. - *      This can be useful in a pipeline featuring ZSTD_compress_usingCDict() exclusively, - *      expecting a ZSTD_CDict parameter with any data, including those without a known dictionary. */ + * @dictBuffer can be released after ZSTD_CDict creation, because its content is copied within CDict.  + *  Note 1 : Consider experimental function `ZSTD_createCDict_byReference()` if you prefer to not duplicate @dictBuffer content.  + *  Note 2 : A ZSTD_CDict can be created from an empty @dictBuffer,  + *      in which case the only thing that it transports is the @compressionLevel.  + *      This can be useful in a pipeline featuring ZSTD_compress_usingCDict() exclusively,  + *      expecting a ZSTD_CDict parameter with any data, including those without a known dictionary. */   ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict(const void* dictBuffer, size_t dictSize,                                           int compressionLevel); @@ -989,7 +989,7 @@ ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict);   *  Note 3 : Referencing a prefix involves building tables, which are dependent on compression parameters.   *           It's a CPU consuming operation, with non-negligible impact on latency.   *           If there is a need to use the same prefix multiple times, consider loadDictionary instead. - *  Note 4 : By default, the prefix is interpreted as raw content (ZSTD_dct_rawContent). + *  Note 4 : By default, the prefix is interpreted as raw content (ZSTD_dct_rawContent).    *           Use experimental ZSTD_CCtx_refPrefix_advanced() to alter dictionary interpretation. */  ZSTDLIB_API size_t ZSTD_CCtx_refPrefix(ZSTD_CCtx* cctx,                                   const void* prefix, size_t prefixSize); @@ -1040,7 +1040,7 @@ ZSTDLIB_API size_t ZSTD_DCtx_refDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict);   *  Note 2 : Prefix buffer is referenced. It **must** outlive decompression.   *           Prefix buffer must remain unmodified up to the end of frame,   *           reached when ZSTD_decompressStream() returns 0. - *  Note 3 : By default, the prefix is treated as raw content (ZSTD_dct_rawContent). + *  Note 3 : By default, the prefix is treated as raw content (ZSTD_dct_rawContent).    *           Use ZSTD_CCtx_refPrefix_advanced() to alter dictMode (Experimental section)   *  Note 4 : Referencing a raw content prefix has almost no cpu nor memory cost.   *           A full dictionary is more costly, as it requires building tables. @@ -1118,8 +1118,8 @@ ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);   * Some of them might be removed in the future (especially when redundant with existing stable functions)   * ***************************************************************************************/ -#define ZSTD_FRAMEHEADERSIZE_PREFIX(format) ((format) == ZSTD_f_zstd1 ? 5 : 1)   /* minimum input size required to query frame header size */ -#define ZSTD_FRAMEHEADERSIZE_MIN(format)    ((format) == ZSTD_f_zstd1 ? 6 : 2) +#define ZSTD_FRAMEHEADERSIZE_PREFIX(format) ((format) == ZSTD_f_zstd1 ? 5 : 1)   /* minimum input size required to query frame header size */  +#define ZSTD_FRAMEHEADERSIZE_MIN(format)    ((format) == ZSTD_f_zstd1 ? 6 : 2)   #define ZSTD_FRAMEHEADERSIZE_MAX   18   /* can be useful for static allocation */  #define ZSTD_SKIPPABLEHEADERSIZE    8 @@ -1167,8 +1167,8 @@ ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);  /* Advanced parameter bounds */  #define ZSTD_TARGETCBLOCKSIZE_MIN   64  #define ZSTD_TARGETCBLOCKSIZE_MAX   ZSTD_BLOCKSIZE_MAX -#define ZSTD_SRCSIZEHINT_MIN        0 -#define ZSTD_SRCSIZEHINT_MAX        INT_MAX +#define ZSTD_SRCSIZEHINT_MIN        0  +#define ZSTD_SRCSIZEHINT_MAX        INT_MAX   /* ---  Advanced types  --- */ @@ -1210,9 +1210,9 @@ typedef struct {                                 * sequence provider's perspective. For example, ZSTD_compressSequences() does not                                 * use this 'rep' field at all (as of now).                                 */ -} ZSTD_Sequence; - -typedef struct { +} ZSTD_Sequence;  +  +typedef struct {       unsigned windowLog;       /**< largest match distance : larger == more compression, more memory needed during decompression */      unsigned chainLog;        /**< fully searched segment : larger == more compression, slower, more memory (useless for fast) */      unsigned hashLog;         /**< dispatch table : larger == faster, more memory */ @@ -1241,12 +1241,12 @@ typedef enum {  typedef enum {      ZSTD_dlm_byCopy = 0,  /**< Copy dictionary content internally */ -    ZSTD_dlm_byRef = 1    /**< Reference dictionary content -- the dictionary buffer must outlive its users. */ +    ZSTD_dlm_byRef = 1    /**< Reference dictionary content -- the dictionary buffer must outlive its users. */   } ZSTD_dictLoadMethod_e;  typedef enum {      ZSTD_f_zstd1 = 0,           /* zstd frame format, specified in zstd_compression_format.md (default) */ -    ZSTD_f_zstd1_magicless = 1  /* Variant of zstd frame format, without initial 4-bytes magic number. +    ZSTD_f_zstd1_magicless = 1  /* Variant of zstd frame format, without initial 4-bytes magic number.                                    * Useful to save 4 bytes per generated frame.                                   * Decoder cannot recognise automatically this format, requiring this instruction. */  } ZSTD_format_e; @@ -1269,7 +1269,7 @@ typedef enum {       * to evolve and should be considered only in the context of extremely       * advanced performance tuning.       * -     * Zstd currently supports the use of a CDict in three ways: +     * Zstd currently supports the use of a CDict in three ways:        *       * - The contents of the CDict can be copied into the working context. This       *   means that the compression can search both the dictionary and input @@ -1285,12 +1285,12 @@ typedef enum {       *   working context's tables can be reused). For small inputs, this can be       *   faster than copying the CDict's tables.       * -     * - The CDict's tables are not used at all, and instead we use the working -     *   context alone to reload the dictionary and use params based on the source -     *   size. See ZSTD_compress_insertDictionary() and ZSTD_compress_usingDict(). -     *   This method is effective when the dictionary sizes are very small relative -     *   to the input size, and the input size is fairly large to begin with. -     * +     * - The CDict's tables are not used at all, and instead we use the working  +     *   context alone to reload the dictionary and use params based on the source  +     *   size. See ZSTD_compress_insertDictionary() and ZSTD_compress_usingDict().  +     *   This method is effective when the dictionary sizes are very small relative  +     *   to the input size, and the input size is fairly large to begin with.  +     *        * Zstd has a simple internal heuristic that selects which strategy to use       * at the beginning of a compression. However, if experimentation shows that       * Zstd is making poor choices, it is possible to override that choice with @@ -1299,7 +1299,7 @@ typedef enum {      ZSTD_dictDefaultAttach = 0, /* Use the default heuristic. */      ZSTD_dictForceAttach   = 1, /* Never copy the dictionary. */      ZSTD_dictForceCopy     = 2, /* Always copy the dictionary. */ -    ZSTD_dictForceLoad     = 3  /* Always reload the dictionary */ +    ZSTD_dictForceLoad     = 3  /* Always reload the dictionary */   } ZSTD_dictAttachPref_e;  typedef enum { @@ -1308,7 +1308,7 @@ typedef enum {                                 *   levels will be compressed. */    ZSTD_lcm_huffman = 1,       /**< Always attempt Huffman compression. Uncompressed literals will still be                                 *   emitted if Huffman compression is not profitable. */ -  ZSTD_lcm_uncompressed = 2   /**< Always emit uncompressed literals. */ +  ZSTD_lcm_uncompressed = 2   /**< Always emit uncompressed literals. */   } ZSTD_literalCompressionMode_e;  typedef enum { @@ -1382,17 +1382,17 @@ typedef enum {   * litLength may be == 0, and if so, then the sequence of (of: 0 ml: 0 ll: 0)   * simply acts as a block delimiter.   * - * zc can be used to insert custom compression params. - * This function invokes ZSTD_compress2 + * zc can be used to insert custom compression params.  + * This function invokes ZSTD_compress2    *   * The output of this function can be fed into ZSTD_compressSequences() with CCtx   * setting of ZSTD_c_blockDelimiters as ZSTD_sf_explicitBlockDelimiters   * @return : number of sequences generated - */ + */   ZSTDLIB_STATIC_API size_t ZSTD_generateSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs,                                            size_t outSeqsSize, const void* src, size_t srcSize); - +   /*! ZSTD_mergeBlockDelimiters() :   * Given an array of ZSTD_Sequence, remove all sequences that represent block delimiters/last literals   * by merging them into into the literals of the next sequence. @@ -1483,7 +1483,7 @@ ZSTDLIB_API unsigned ZSTD_isSkippableFrame(const void* buffer, size_t size);  /*! ZSTD_estimate*() :   *  These functions make it possible to estimate memory usage   *  of a future {D,C}Ctx, before its creation. - * + *    *  ZSTD_estimateCCtxSize() will provide a memory budget large enough   *  for any compression level up to selected one.   *  Note : Unlike ZSTD_estimateCStreamSize*(), this estimate @@ -1491,7 +1491,7 @@ ZSTDLIB_API unsigned ZSTD_isSkippableFrame(const void* buffer, size_t size);   *         Therefore, the estimation is only guaranteed for single-shot compressions, not streaming.   *  The estimate will assume the input may be arbitrarily large,   *  which is the worst case. - * + *    *  When srcSize can be bound by a known and rather "small" value,   *  this fact can be used to provide a tighter estimation   *  because the CCtx compression context will need less memory. @@ -1643,8 +1643,8 @@ ZSTDLIB_STATIC_API ZSTD_DDict* ZSTD_createDDict_advanced(   *  Create a digested dictionary for compression   *  Dictionary content is just referenced, not duplicated.   *  As a consequence, `dictBuffer` **must** outlive CDict, - *  and its content must remain unmodified throughout the lifetime of CDict. - *  note: equivalent to ZSTD_createCDict_advanced(), with dictLoadMethod==ZSTD_dlm_byRef */ + *  and its content must remain unmodified throughout the lifetime of CDict.  + *  note: equivalent to ZSTD_createCDict_advanced(), with dictLoadMethod==ZSTD_dlm_byRef */   ZSTDLIB_STATIC_API ZSTD_CDict* ZSTD_createCDict_byReference(const void* dictBuffer, size_t dictSize, int compressionLevel);  /*! ZSTD_getCParams() : @@ -1671,8 +1671,8 @@ ZSTDLIB_STATIC_API size_t ZSTD_checkCParams(ZSTD_compressionParameters params);  ZSTDLIB_STATIC_API ZSTD_compressionParameters ZSTD_adjustCParams(ZSTD_compressionParameters cPar, unsigned long long srcSize, size_t dictSize);  /*! ZSTD_compress_advanced() : - *  Note : this function is now DEPRECATED. - *         It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_setParameter() and other parameter setters. + *  Note : this function is now DEPRECATED.  + *         It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_setParameter() and other parameter setters.    *  This prototype will generate compilation warnings. */  ZSTD_DEPRECATED("use ZSTD_compress2")  size_t ZSTD_compress_advanced(ZSTD_CCtx* cctx, @@ -1683,7 +1683,7 @@ size_t ZSTD_compress_advanced(ZSTD_CCtx* cctx,  /*! ZSTD_compress_usingCDict_advanced() :   *  Note : this function is now DEPRECATED. - *         It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_loadDictionary() and other parameter setters. + *         It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_loadDictionary() and other parameter setters.    *  This prototype will generate compilation warnings. */  ZSTD_DEPRECATED("use ZSTD_compress2 with ZSTD_CCtx_loadDictionary")  size_t ZSTD_compress_usingCDict_advanced(ZSTD_CCtx* cctx, @@ -1763,12 +1763,12 @@ ZSTDLIB_STATIC_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const vo   * There is no guarantee on compressed block size (default:0) */  #define ZSTD_c_targetCBlockSize ZSTD_c_experimentalParam6 -/* User's best guess of source size. - * Hint is not valid when srcSizeHint == 0. - * There is no guarantee that hint is close to actual source size, - * but compression ratio may regress significantly if guess considerably underestimates */ -#define ZSTD_c_srcSizeHint ZSTD_c_experimentalParam7 - +/* User's best guess of source size.  + * Hint is not valid when srcSizeHint == 0.  + * There is no guarantee that hint is close to actual source size,  + * but compression ratio may regress significantly if guess considerably underestimates */  +#define ZSTD_c_srcSizeHint ZSTD_c_experimentalParam7  +   /* Controls whether the new and experimental "dedicated dictionary search   * structure" can be used. This feature is still rough around the edges, be   * prepared for surprising behavior! @@ -2203,9 +2203,9 @@ ZSTDLIB_STATIC_API size_t ZSTD_decompressStream_simpleArgs (   */  ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions")  size_t ZSTD_initCStream_srcSize(ZSTD_CStream* zcs, -                         int compressionLevel, -                         unsigned long long pledgedSrcSize); - +                         int compressionLevel,  +                         unsigned long long pledgedSrcSize);  +   /*! ZSTD_initCStream_usingDict() :   * This function is DEPRECATED, and is equivalent to:   *     ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); @@ -2214,36 +2214,36 @@ size_t ZSTD_initCStream_srcSize(ZSTD_CStream* zcs,   *   * Creates of an internal CDict (incompatible with static CCtx), except if   * dict == NULL or dictSize < 8, in which case no dict is used. - * Note: dict is loaded with ZSTD_dct_auto (treated as a full zstd dictionary if + * Note: dict is loaded with ZSTD_dct_auto (treated as a full zstd dictionary if    * it begins with ZSTD_MAGIC_DICTIONARY, else as raw content) and ZSTD_dlm_byCopy.   * This prototype will generate compilation warnings.   */  ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions")  size_t ZSTD_initCStream_usingDict(ZSTD_CStream* zcs, -                     const void* dict, size_t dictSize, -                           int compressionLevel); - +                     const void* dict, size_t dictSize,  +                           int compressionLevel);  +   /*! ZSTD_initCStream_advanced() :   * This function is DEPRECATED, and is approximately equivalent to:   *     ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); - *     // Pseudocode: Set each zstd parameter and leave the rest as-is. - *     for ((param, value) : params) { - *         ZSTD_CCtx_setParameter(zcs, param, value); - *     } + *     // Pseudocode: Set each zstd parameter and leave the rest as-is.  + *     for ((param, value) : params) {  + *         ZSTD_CCtx_setParameter(zcs, param, value);  + *     }    *     ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize);   *     ZSTD_CCtx_loadDictionary(zcs, dict, dictSize);   * - * dict is loaded with ZSTD_dct_auto and ZSTD_dlm_byCopy. - * pledgedSrcSize must be correct. - * If srcSize is not known at init time, use value ZSTD_CONTENTSIZE_UNKNOWN. + * dict is loaded with ZSTD_dct_auto and ZSTD_dlm_byCopy.  + * pledgedSrcSize must be correct.  + * If srcSize is not known at init time, use value ZSTD_CONTENTSIZE_UNKNOWN.    * This prototype will generate compilation warnings.   */  ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions")  size_t ZSTD_initCStream_advanced(ZSTD_CStream* zcs, -                    const void* dict, size_t dictSize, -                          ZSTD_parameters params, -                          unsigned long long pledgedSrcSize); - +                    const void* dict, size_t dictSize,  +                          ZSTD_parameters params,  +                          unsigned long long pledgedSrcSize);  +   /*! ZSTD_initCStream_usingCDict() :   * This function is DEPRECATED, and equivalent to:   *     ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); @@ -2254,14 +2254,14 @@ size_t ZSTD_initCStream_advanced(ZSTD_CStream* zcs,   */  ZSTD_DEPRECATED("use ZSTD_CCtx_reset and ZSTD_CCtx_refCDict, see zstd.h for detailed instructions")  size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict); - +   /*! ZSTD_initCStream_usingCDict_advanced() : - *   This function is DEPRECATED, and is approximately equivalent to: + *   This function is DEPRECATED, and is approximately equivalent to:    *     ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); - *     // Pseudocode: Set each zstd frame parameter and leave the rest as-is. - *     for ((fParam, value) : fParams) { - *         ZSTD_CCtx_setParameter(zcs, fParam, value); - *     } + *     // Pseudocode: Set each zstd frame parameter and leave the rest as-is.  + *     for ((fParam, value) : fParams) {  + *         ZSTD_CCtx_setParameter(zcs, fParam, value);  + *     }    *     ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize);   *     ZSTD_CCtx_refCDict(zcs, cdict);   * @@ -2272,9 +2272,9 @@ size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict);   */  ZSTD_DEPRECATED("use ZSTD_CCtx_reset and ZSTD_CCtx_refCDict, see zstd.h for detailed instructions")  size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs, -                               const ZSTD_CDict* cdict, -                                     ZSTD_frameParameters fParams, -                                     unsigned long long pledgedSrcSize); +                               const ZSTD_CDict* cdict,  +                                     ZSTD_frameParameters fParams,  +                                     unsigned long long pledgedSrcSize);   /*! ZSTD_resetCStream() :   * This function is DEPRECATED, and is equivalent to: @@ -2340,10 +2340,10 @@ ZSTDLIB_STATIC_API size_t ZSTD_toFlushNow(ZSTD_CCtx* cctx);   *     ZSTD_DCtx_loadDictionary(zds, dict, dictSize);   *   * note: no dictionary will be used if dict == NULL or dictSize < 8 - * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x + * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x    */  ZSTDLIB_STATIC_API size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize); - +   /*!   * This function is deprecated, and is equivalent to:   * @@ -2351,17 +2351,17 @@ ZSTDLIB_STATIC_API size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const vo   *     ZSTD_DCtx_refDDict(zds, ddict);   *   * note : ddict is referenced, it must outlive decompression session - * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x + * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x    */  ZSTDLIB_STATIC_API size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const ZSTD_DDict* ddict); - +   /*!   * This function is deprecated, and is equivalent to:   *   *     ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);   *   * re-use decompression parameters from previous init; saves dictionary loading - * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x + * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x    */  ZSTDLIB_STATIC_API size_t ZSTD_resetDStream(ZSTD_DStream* zds); @@ -2536,8 +2536,8 @@ ZSTDLIB_STATIC_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx);  /*!      Block functions produce and decode raw zstd blocks, without frame metadata. -    Frame metadata cost is typically ~12 bytes, which can be non-negligible for very small blocks (< 100 bytes). -    But users will have to take in charge needed metadata to regenerate data, such as compressed and content sizes. +    Frame metadata cost is typically ~12 bytes, which can be non-negligible for very small blocks (< 100 bytes).  +    But users will have to take in charge needed metadata to regenerate data, such as compressed and content sizes.       A few rules to respect :      - Compressing and decompressing require a context structure @@ -2548,14 +2548,14 @@ ZSTDLIB_STATIC_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx);        + copyCCtx() and copyDCtx() can be used too      - Block size is limited, it must be <= ZSTD_getBlockSize() <= ZSTD_BLOCKSIZE_MAX == 128 KB        + If input is larger than a block size, it's necessary to split input data into multiple blocks -      + For inputs larger than a single block, consider using regular ZSTD_compress() instead. -        Frame metadata is not that costly, and quickly becomes negligible as source size grows larger than a block. -    - When a block is considered not compressible enough, ZSTD_compressBlock() result will be 0 (zero) ! -      ===> In which case, nothing is produced into `dst` ! -      + User __must__ test for such outcome and deal directly with uncompressed data -      + A block cannot be declared incompressible if ZSTD_compressBlock() return value was != 0. -        Doing so would mess up with statistics history, leading to potential data corruption. -      + ZSTD_decompressBlock() _doesn't accept uncompressed data as input_ !! +      + For inputs larger than a single block, consider using regular ZSTD_compress() instead.  +        Frame metadata is not that costly, and quickly becomes negligible as source size grows larger than a block.  +    - When a block is considered not compressible enough, ZSTD_compressBlock() result will be 0 (zero) !  +      ===> In which case, nothing is produced into `dst` !  +      + User __must__ test for such outcome and deal directly with uncompressed data  +      + A block cannot be declared incompressible if ZSTD_compressBlock() return value was != 0.  +        Doing so would mess up with statistics history, leading to potential data corruption.  +      + ZSTD_decompressBlock() _doesn't accept uncompressed data as input_ !!         + In case of multiple successive blocks, should some of them be uncompressed,          decoder must be informed of their existence in order to follow proper history.          Use ZSTD_insertBlock() for such a case. diff --git a/library/cpp/actors/core/actor_coroutine_ut.cpp b/library/cpp/actors/core/actor_coroutine_ut.cpp index 951512b8772..558a2f7e963 100644 --- a/library/cpp/actors/core/actor_coroutine_ut.cpp +++ b/library/cpp/actors/core/actor_coroutine_ut.cpp @@ -94,7 +94,7 @@ Y_UNIT_TEST_SUITE(ActorCoro) {              DoneEvent.Signal();          } -        void ProcessUnexpectedEvent(TAutoPtr<IEventHandle> event) override { +        void ProcessUnexpectedEvent(TAutoPtr<IEventHandle> event) override {               if (event->GetTypeRewrite() == Enough) {                  Finish = true;              } diff --git a/library/cpp/actors/core/event_pb_ut.cpp b/library/cpp/actors/core/event_pb_ut.cpp index a16c3092b3b..5e434fdf632 100644 --- a/library/cpp/actors/core/event_pb_ut.cpp +++ b/library/cpp/actors/core/event_pb_ut.cpp @@ -6,20 +6,20 @@  Y_UNIT_TEST_SUITE(TEventSerialization) {      struct TMockEvent: public NActors::IEventBase {          TBigMessage* msg; -        bool -        SerializeToArcadiaStream(NActors::TChunkSerializer* chunker) const override { +        bool  +        SerializeToArcadiaStream(NActors::TChunkSerializer* chunker) const override {               return msg->SerializeToZeroCopyStream(chunker);          }          bool IsSerializable() const override {              return true;          } -        TString ToStringHeader() const override { +        TString ToStringHeader() const override {               return TString();          }          virtual TString Serialize() const {              return TString();          } -        ui32 Type() const override { +        ui32 Type() const override {               return 0;          };      }; diff --git a/library/cpp/actors/core/io_dispatcher.cpp b/library/cpp/actors/core/io_dispatcher.cpp index 90699ff16c7..729c3bcb169 100644 --- a/library/cpp/actors/core/io_dispatcher.cpp +++ b/library/cpp/actors/core/io_dispatcher.cpp @@ -27,7 +27,7 @@ namespace NActors {                  : Timestamp(timestamp)                  , Callback(std::move(ev->Callback))              {} - +               void Execute() {                  Callback();              } @@ -52,7 +52,7 @@ namespace NActors {                  }                  CondVar.Signal();              } - +               bool Dequeue(std::list<TTask>& list, bool *sendNotify) {                  with_lock (Mutex) {                      CondVar.Wait(Mutex, [&] { return NumThreadsToStop || !Tasks.empty(); }); @@ -169,7 +169,7 @@ namespace NActors {              , ThreadsStopped(counters->GetCounter("ThreadsStopped", true))          {} -        ~TIoDispatcherActor() override { +        ~TIoDispatcherActor() override {               TaskQueue.Stop();          } diff --git a/library/cpp/actors/core/scheduler_actor.cpp b/library/cpp/actors/core/scheduler_actor.cpp index febc5e40dd2..329aeebd342 100644 --- a/library/cpp/actors/core/scheduler_actor.cpp +++ b/library/cpp/actors/core/scheduler_actor.cpp @@ -24,11 +24,11 @@ namespace NActors {              Y_VERIFY(Descriptor != -1, "timerfd_create() failed with %s", strerror(errno));          } -        ~TTimerDescriptor() override { +        ~TTimerDescriptor() override {               close(Descriptor);          } -        int GetDescriptor() override { +        int GetDescriptor() override {               return Descriptor;          }      }; diff --git a/library/cpp/actors/http/http_proxy_incoming.cpp b/library/cpp/actors/http/http_proxy_incoming.cpp index 80fe2af53d0..a92c458c1e8 100644 --- a/library/cpp/actors/http/http_proxy_incoming.cpp +++ b/library/cpp/actors/http/http_proxy_incoming.cpp @@ -56,11 +56,11 @@ public:          response = nullptr;      } -    TAutoPtr<IEventHandle> AfterRegister(const TActorId& self, const TActorId& parent) override { +    TAutoPtr<IEventHandle> AfterRegister(const TActorId& self, const TActorId& parent) override {           return new IEventHandle(self, parent, new TEvents::TEvBootstrap());      } -    void Die(const TActorContext& ctx) override { +    void Die(const TActorContext& ctx) override {           ctx.Send(Endpoint.Owner, new TEvHttpProxy::TEvHttpConnectionClosed(ctx.SelfID, std::move(RecycledRequests)));          TSocketImpl::Shutdown();          TBase::Die(ctx); diff --git a/library/cpp/actors/http/http_proxy_outgoing.cpp b/library/cpp/actors/http/http_proxy_outgoing.cpp index d9189dba8ab..b72ec0c2e89 100644 --- a/library/cpp/actors/http/http_proxy_outgoing.cpp +++ b/library/cpp/actors/http/http_proxy_outgoing.cpp @@ -29,7 +29,7 @@ public:          TSocketImpl::SetTimeout(SOCKET_TIMEOUT);      } -    void Die(const NActors::TActorContext& ctx) override { +    void Die(const NActors::TActorContext& ctx) override {           ctx.Send(Owner, new TEvHttpProxy::TEvHttpConnectionClosed(ctx.SelfID));          TSocketImpl::Shutdown(); // to avoid errors when connection already closed          TBase::Die(ctx); diff --git a/library/cpp/actors/interconnect/profiler.h b/library/cpp/actors/interconnect/profiler.h index 77a59e31794..c8ee78e5f2d 100644 --- a/library/cpp/actors/interconnect/profiler.h +++ b/library/cpp/actors/interconnect/profiler.h @@ -131,7 +131,7 @@ namespace NActors {                      s << key << " num# " << value.size() << " sum# " << sum << "ns max# " << (i->Duration * 1000000 / cyclesPerMs) << "ns";                      if (i->Interior) {                          s << " {" << i->Interior << "}"; -                    } +                    }                   }              } diff --git a/library/cpp/actors/interconnect/ut_fat/main.cpp b/library/cpp/actors/interconnect/ut_fat/main.cpp index 5d19bc30030..965fce77e6f 100644 --- a/library/cpp/actors/interconnect/ut_fat/main.cpp +++ b/library/cpp/actors/interconnect/ut_fat/main.cpp @@ -29,11 +29,11 @@ Y_UNIT_TEST_SUITE(InterconnectUnstableConnection) {          {          } -        ~TSenderActor() override { +        ~TSenderActor() override {               Cerr << "Sent " << SequenceNumber << " messages\n";          } -        void SendMessage(const TActorContext& ctx) override { +        void SendMessage(const TActorContext& ctx) override {               const ui32 flags = IEventHandle::MakeFlags(0, SendFlags);              const ui64 cookie = SequenceNumber;              const TString payload('@', RandomNumber<size_t>(65536) + 4096); @@ -43,7 +43,7 @@ Y_UNIT_TEST_SUITE(InterconnectUnstableConnection) {              ++SequenceNumber;          } -        void Handle(TEvents::TEvUndelivered::TPtr& ev, const TActorContext& ctx) override { +        void Handle(TEvents::TEvUndelivered::TPtr& ev, const TActorContext& ctx) override {               auto record = std::find(InFly.begin(), InFly.end(), ev->Cookie);              if (SendFlags & IEventHandle::FlagGenerateUnsureUndelivered) {                  if (record != InFly.end()) { @@ -56,7 +56,7 @@ Y_UNIT_TEST_SUITE(InterconnectUnstableConnection) {              }          } -        void Handle(TEvTestResponse::TPtr& ev, const TActorContext& ctx) override { +        void Handle(TEvTestResponse::TPtr& ev, const TActorContext& ctx) override {               Y_VERIFY(InFly);              const NInterconnectTest::TEvTestResponse& record = ev->Get()->Record;              Y_VERIFY(record.HasConfirmedSequenceNumber()); @@ -85,7 +85,7 @@ Y_UNIT_TEST_SUITE(InterconnectUnstableConnection) {          {          } -        void Handle(TEvTest::TPtr& ev, const TActorContext& /*ctx*/) override { +        void Handle(TEvTest::TPtr& ev, const TActorContext& /*ctx*/) override {               const NInterconnectTest::TEvTest& m = ev->Get()->Record;              Y_VERIFY(m.HasSequenceNumber());              Y_VERIFY(m.GetSequenceNumber() >= ReceivedCount, "got #%" PRIu64 " expected at least #%" PRIu64, @@ -94,7 +94,7 @@ Y_UNIT_TEST_SUITE(InterconnectUnstableConnection) {              SenderNode->Send(ev->Sender, new TEvTestResponse(m.GetSequenceNumber()));          } -        ~TReceiverActor() override { +        ~TReceiverActor() override {               Cerr << "Received " << ReceivedCount << " messages\n";          }      }; diff --git a/library/cpp/actors/testlib/test_runtime.cpp b/library/cpp/actors/testlib/test_runtime.cpp index 6fa25b99656..af7ea2e336b 100644 --- a/library/cpp/actors/testlib/test_runtime.cpp +++ b/library/cpp/actors/testlib/test_runtime.cpp @@ -242,7 +242,7 @@ namespace NActors {              Y_UNUSED(Runtime);          } -        void Prepare(TActorSystem *actorSystem, volatile ui64 *currentTimestamp, volatile ui64 *currentMonotonic) override { +        void Prepare(TActorSystem *actorSystem, volatile ui64 *currentTimestamp, volatile ui64 *currentMonotonic) override {               Y_UNUSED(actorSystem);              Node->ActorSystemTimestamp = currentTimestamp;              Node->ActorSystemMonotonic = currentMonotonic; @@ -253,13 +253,13 @@ namespace NActors {              Y_UNUSED(scheduleReadersCount);          } -        void Start() override { +        void Start() override {           } -        void PrepareStop() override { +        void PrepareStop() override {           } -        void Stop() override { +        void Stop() override {           }      private: @@ -343,7 +343,7 @@ namespace NActors {          }          // for actorsystem -        bool Send(TAutoPtr<IEventHandle>& ev) override { +        bool Send(TAutoPtr<IEventHandle>& ev) override {               TGuard<TMutex> guard(Runtime->Mutex);              bool verbose = (Runtime->CurrentDispatchContext ? !Runtime->CurrentDispatchContext->Options->Quiet : true) && VERBOSE;              if (Runtime->BlockedOutput.find(ev->Sender) != Runtime->BlockedOutput.end()) { @@ -393,21 +393,21 @@ namespace NActors {              return true;          } -        void ScheduleActivation(ui32 activation) override { +        void ScheduleActivation(ui32 activation) override {               Y_UNUSED(activation);          } -        void ScheduleActivationEx(ui32 activation, ui64 revolvingCounter) override { +        void ScheduleActivationEx(ui32 activation, ui64 revolvingCounter) override {               Y_UNUSED(activation);              Y_UNUSED(revolvingCounter);          } -        TActorId Register(IActor *actor, TMailboxType::EType mailboxType, ui64 revolvingCounter, +        TActorId Register(IActor *actor, TMailboxType::EType mailboxType, ui64 revolvingCounter,               const TActorId& parentId) override {              return Runtime->Register(actor, NodeIndex, PoolId, mailboxType, revolvingCounter, parentId);          } -        TActorId Register(IActor *actor, TMailboxHeader *mailbox, ui32 hint, const TActorId& parentId) override { +        TActorId Register(IActor *actor, TMailboxHeader *mailbox, ui32 hint, const TActorId& parentId) override {               return Runtime->Register(actor, NodeIndex, PoolId, mailbox, hint, parentId);          } @@ -418,13 +418,13 @@ namespace NActors {              Y_UNUSED(scheduleSz);          } -        void Start() override { +        void Start() override {           } -        void PrepareStop() override { +        void PrepareStop() override {           } -        void Shutdown() override { +        void Shutdown() override {           }          bool Cleanup() override { @@ -432,7 +432,7 @@ namespace NActors {          }          // generic -        TAffinity* Affinity() const override { +        TAffinity* Affinity() const override {               Y_FAIL();          } diff --git a/library/cpp/actors/util/rope_cont_deque.h b/library/cpp/actors/util/rope_cont_deque.h index d1d122c49c6..3bc3476023c 100644 --- a/library/cpp/actors/util/rope_cont_deque.h +++ b/library/cpp/actors/util/rope_cont_deque.h @@ -8,7 +8,7 @@ namespace NRopeDetails {  template<typename TChunk>  class TChunkList {      std::deque<TChunk> Chunks; - +       static constexpr size_t MaxInplaceItems = 4;      using TInplace = TStackVec<TChunk, MaxInplaceItems>;      TInplace Inplace; diff --git a/library/cpp/actors/util/rope_ut.cpp b/library/cpp/actors/util/rope_ut.cpp index cabeed92306..f9ed32891bd 100644 --- a/library/cpp/actors/util/rope_ut.cpp +++ b/library/cpp/actors/util/rope_ut.cpp @@ -40,7 +40,7 @@ TString RopeToString(const TRope& rope) {          res.append(iter.ContiguousData(), iter.ContiguousSize());          iter.AdvanceToNextContiguousBlock();      } - +       UNIT_ASSERT_VALUES_EQUAL(rope.GetSize(), res.size());      TString temp = TString::Uninitialized(rope.GetSize()); diff --git a/library/cpp/archive/yarchive.h b/library/cpp/archive/yarchive.h index 8120bcb9402..003443ea742 100644 --- a/library/cpp/archive/yarchive.h +++ b/library/cpp/archive/yarchive.h @@ -16,7 +16,7 @@ static constexpr size_t ArchiveWriterDefaultDataAlignment = 16;  class TArchiveWriter {  public: -    explicit TArchiveWriter(IOutputStream* out, bool compress = true); +    explicit TArchiveWriter(IOutputStream* out, bool compress = true);       ~TArchiveWriter();      void Flush(); @@ -31,16 +31,16 @@ private:  class TArchiveReader : public IModelsArchiveReader {  public: -    explicit TArchiveReader(const TBlob& data); -    ~TArchiveReader() override; - -    size_t Count() const noexcept override; -    TString KeyByIndex(size_t n) const override; -    bool Has(TStringBuf key) const override; -    TAutoPtr<IInputStream> ObjectByKey(TStringBuf key) const override; -    TBlob ObjectBlobByKey(TStringBuf key) const override; -    TBlob BlobByKey(TStringBuf key) const override; -    bool Compressed() const override; +    explicit TArchiveReader(const TBlob& data);  +    ~TArchiveReader() override;  + +    size_t Count() const noexcept override;  +    TString KeyByIndex(size_t n) const override;  +    bool Has(TStringBuf key) const override;  +    TAutoPtr<IInputStream> ObjectByKey(TStringBuf key) const override;  +    TBlob ObjectBlobByKey(TStringBuf key) const override;  +    TBlob BlobByKey(TStringBuf key) const override;  +    bool Compressed() const override;   private:      class TImpl; diff --git a/library/cpp/balloc/malloc-info.cpp b/library/cpp/balloc/malloc-info.cpp index 604b1fb145d..813f93f5ee0 100644 --- a/library/cpp/balloc/malloc-info.cpp +++ b/library/cpp/balloc/malloc-info.cpp @@ -9,7 +9,7 @@ extern "C" void EnableBalloc();  extern "C" bool BallocDisabled();  namespace { -    bool SetAllocParam(const char* name, const char* value) { +    bool SetAllocParam(const char* name, const char* value) {           if (strcmp(name, "disable") == 0) {              if (value == nullptr || strcmp(value, "false") != 0) {                  // all values other than "false" are considred to be "true" for compatibility @@ -22,7 +22,7 @@ namespace {          return false;      } -    bool CheckAllocParam(const char* name, bool defaultValue) { +    bool CheckAllocParam(const char* name, bool defaultValue) {           if (strcmp(name, "disable") == 0) {              return BallocDisabled();          } diff --git a/library/cpp/blockcodecs/codecs/brotli/brotli.cpp b/library/cpp/blockcodecs/codecs/brotli/brotli.cpp index 6e3cd971bdc..4893fb7a006 100644 --- a/library/cpp/blockcodecs/codecs/brotli/brotli.cpp +++ b/library/cpp/blockcodecs/codecs/brotli/brotli.cpp @@ -13,7 +13,7 @@ namespace {          inline TBrotliCodec(ui32 level)              : Quality(level) -            , MyName(TStringBuf("brotli_") + ToString(level)) +            , MyName(TStringBuf("brotli_") + ToString(level))           {          } @@ -63,5 +63,5 @@ namespace {              }          }      }; -    const TBrotliRegistrar Registrar{}; +    const TBrotliRegistrar Registrar{};   } diff --git a/library/cpp/blockcodecs/codecs/bzip/bzip.cpp b/library/cpp/blockcodecs/codecs/bzip/bzip.cpp index 3a5cfdd0e9a..3ca1f80daf4 100644 --- a/library/cpp/blockcodecs/codecs/bzip/bzip.cpp +++ b/library/cpp/blockcodecs/codecs/bzip/bzip.cpp @@ -58,5 +58,5 @@ namespace {              RegisterAlias("bzip2", "bzip2-6");          }      }; -    const TBZipRegistrar Registrar{}; +    const TBZipRegistrar Registrar{};   } diff --git a/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp b/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp index da2831fbd24..9d836b87fb2 100644 --- a/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp +++ b/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp @@ -34,7 +34,7 @@ namespace {              const int ret = fastlz_decompress(in.data(), in.size(), out, len);              if (ret < 0 || (size_t)ret != len) { -                ythrow TDataError() << TStringBuf("can not decompress"); +                ythrow TDataError() << TStringBuf("can not decompress");               }          } @@ -50,5 +50,5 @@ namespace {              RegisterAlias("fastlz", "fastlz-0");          }      }; -    const TFastLZRegistrar Registrar{}; +    const TFastLZRegistrar Registrar{};   } diff --git a/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp b/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp index 042f031679c..0e80f47cc61 100644 --- a/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp +++ b/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp @@ -11,13 +11,13 @@ namespace {      struct TZStd06Codec: public TAddLengthCodec<TZStd06Codec> {          inline TZStd06Codec(unsigned level)              : Level(level) -            , MyName(TStringBuf("zstd06_") + ToString(Level)) +            , MyName(TStringBuf("zstd06_") + ToString(Level))           {          }          static inline size_t CheckError(size_t ret, const char* what) {              if (ZSTD_isError(ret)) { -                ythrow yexception() << what << TStringBuf(" zstd error: ") << ZSTD_getErrorName(ret); +                ythrow yexception() << what << TStringBuf(" zstd error: ") << ZSTD_getErrorName(ret);               }              return ret; @@ -54,5 +54,5 @@ namespace {              }          }      }; -    const TZStd06Registrar Registrar{}; +    const TZStd06Registrar Registrar{};   } diff --git a/library/cpp/blockcodecs/codecs/lz4/lz4.cpp b/library/cpp/blockcodecs/codecs/lz4/lz4.cpp index fbf0fe110f1..db8d9f40198 100644 --- a/library/cpp/blockcodecs/codecs/lz4/lz4.cpp +++ b/library/cpp/blockcodecs/codecs/lz4/lz4.cpp @@ -53,7 +53,7 @@ namespace {          }          static inline TStringBuf DPrefix() { -            return TStringBuf("fast"); +            return TStringBuf("fast");           }      }; @@ -66,7 +66,7 @@ namespace {          }          static inline TStringBuf DPrefix() { -            return TStringBuf("safe"); +            return TStringBuf("safe");           }      }; @@ -119,5 +119,5 @@ namespace {              RegisterAlias("lz4hc", "lz4-hc-safe");          }      }; -    const TLz4Registrar Registrar{}; +    const TLz4Registrar Registrar{};   } diff --git a/library/cpp/blockcodecs/codecs/lzma/lzma.cpp b/library/cpp/blockcodecs/codecs/lzma/lzma.cpp index 6c8d5fded42..c2c3784540a 100644 --- a/library/cpp/blockcodecs/codecs/lzma/lzma.cpp +++ b/library/cpp/blockcodecs/codecs/lzma/lzma.cpp @@ -39,7 +39,7 @@ namespace {          inline void DoDecompress(const TData& in, void* out, size_t len) const {              if (in.size() <= LZMA_PROPS_SIZE) { -                ythrow TDataError() << TStringBuf("broken lzma stream"); +                ythrow TDataError() << TStringBuf("broken lzma stream");               }              const unsigned char* props = (const unsigned char*)in.data(); @@ -70,5 +70,5 @@ namespace {              RegisterAlias("lzma", "lzma-5");          }      }; -    const TLzmaRegistrar Registrar{}; +    const TLzmaRegistrar Registrar{};   } diff --git a/library/cpp/blockcodecs/codecs/snappy/snappy.cpp b/library/cpp/blockcodecs/codecs/snappy/snappy.cpp index f6be05a05fc..18e499eea17 100644 --- a/library/cpp/blockcodecs/codecs/snappy/snappy.cpp +++ b/library/cpp/blockcodecs/codecs/snappy/snappy.cpp @@ -48,5 +48,5 @@ namespace {              RegisterCodec(MakeHolder<TSnappyCodec>());          }      }; -    const TSnappyRegistrar Registrar{}; +    const TSnappyRegistrar Registrar{};   } diff --git a/library/cpp/blockcodecs/codecs/zlib/zlib.cpp b/library/cpp/blockcodecs/codecs/zlib/zlib.cpp index cdb556c36d4..8e23269f6d2 100644 --- a/library/cpp/blockcodecs/codecs/zlib/zlib.cpp +++ b/library/cpp/blockcodecs/codecs/zlib/zlib.cpp @@ -60,5 +60,5 @@ namespace {              RegisterAlias("zlib", "zlib-6");          }      }; -    const TZLibRegistrar Registrar{}; +    const TZLibRegistrar Registrar{};   } diff --git a/library/cpp/blockcodecs/codecs/zstd/zstd.cpp b/library/cpp/blockcodecs/codecs/zstd/zstd.cpp index 95299b3f6d3..7ea1c6371bb 100644 --- a/library/cpp/blockcodecs/codecs/zstd/zstd.cpp +++ b/library/cpp/blockcodecs/codecs/zstd/zstd.cpp @@ -11,13 +11,13 @@ namespace {      struct TZStd08Codec: public TAddLengthCodec<TZStd08Codec> {          inline TZStd08Codec(unsigned level)              : Level(level) -            , MyName(TStringBuf("zstd08_") + ToString(Level)) +            , MyName(TStringBuf("zstd08_") + ToString(Level))           {          }          static inline size_t CheckError(size_t ret, const char* what) {              if (ZSTD_isError(ret)) { -                ythrow yexception() << what << TStringBuf(" zstd error: ") << ZSTD_getErrorName(ret); +                ythrow yexception() << what << TStringBuf(" zstd error: ") << ZSTD_getErrorName(ret);               }              return ret; @@ -55,5 +55,5 @@ namespace {              }          }      }; -    const TZStd08Registrar Registrar{}; +    const TZStd08Registrar Registrar{};   } diff --git a/library/cpp/blockcodecs/core/codecs.cpp b/library/cpp/blockcodecs/core/codecs.cpp index 21506e812b4..43421c1aa56 100644 --- a/library/cpp/blockcodecs/core/codecs.cpp +++ b/library/cpp/blockcodecs/core/codecs.cpp @@ -83,7 +83,7 @@ TCodecList NBlockCodecs::ListAllCodecs() {  }  TString NBlockCodecs::ListAllCodecsAsString() { -    return JoinSeq(TStringBuf(","), ListAllCodecs()); +    return JoinSeq(TStringBuf(","), ListAllCodecs());   }  void NBlockCodecs::RegisterCodec(TCodecPtr codec) { diff --git a/library/cpp/blockcodecs/core/common.h b/library/cpp/blockcodecs/core/common.h index f05df4d3341..8da81b45f97 100644 --- a/library/cpp/blockcodecs/core/common.h +++ b/library/cpp/blockcodecs/core/common.h @@ -56,7 +56,7 @@ namespace NBlockCodecs {          }          TStringBuf Name() const noexcept override { -            return TStringBuf("null"); +            return TStringBuf("null");           }      }; @@ -83,7 +83,7 @@ namespace NBlockCodecs {              WriteUnaligned<ui64>(ptr, (ui64) in.size()); -            return Base()->DoCompress(!in ? TData(TStringBuf("")) : in, ptr + 1) + sizeof(*ptr); +            return Base()->DoCompress(!in ? TData(TStringBuf("")) : in, ptr + 1) + sizeof(*ptr);           }          size_t Decompress(const TData& in, void* out) const override { diff --git a/library/cpp/blockcodecs/core/stream.cpp b/library/cpp/blockcodecs/core/stream.cpp index 4f7db3c32be..7a7422738b2 100644 --- a/library/cpp/blockcodecs/core/stream.cpp +++ b/library/cpp/blockcodecs/core/stream.cpp @@ -12,7 +12,7 @@  using namespace NBlockCodecs;  namespace { -    constexpr size_t MAX_BUF_LEN = 128 * 1024 * 1024; +    constexpr size_t MAX_BUF_LEN = 128 * 1024 * 1024;       typedef ui16 TCodecID;      typedef ui64 TBlockLen; @@ -55,11 +55,11 @@ namespace {          TByID ByID;      }; -    TCodecID CodecID(const ICodec* c) { +    TCodecID CodecID(const ICodec* c) {           return TIds::CodecID(c);      } -    const ICodec* CodecByID(TCodecID id) { +    const ICodec* CodecByID(TCodecID id) {           return Singleton<TIds>()->Find(id);      }  } @@ -70,7 +70,7 @@ TCodedOutput::TCodedOutput(IOutputStream* out, const ICodec* c, size_t bufLen)      , S_(out)  {      if (bufLen > MAX_BUF_LEN) { -        ythrow yexception() << TStringBuf("too big buffer size: ") << bufLen; +        ythrow yexception() << TStringBuf("too big buffer size: ") << bufLen;       }  } @@ -198,7 +198,7 @@ size_t TDecodedInput::DoUnboundedNext(const void** ptr) {      auto codec = CodecByID(codecId);      if (C_) { -        Y_ENSURE(C_->Name() == codec->Name(), TStringBuf("incorrect stream codec")); +        Y_ENSURE(C_->Name() == codec->Name(), TStringBuf("incorrect stream codec"));       }      if (codec->DecompressedLength(block) > MAX_BUF_LEN) { diff --git a/library/cpp/blockcodecs/ya.make b/library/cpp/blockcodecs/ya.make index b8f03d5421c..acda7440308 100644 --- a/library/cpp/blockcodecs/ya.make +++ b/library/cpp/blockcodecs/ya.make @@ -22,6 +22,6 @@ SRCS(  END() -RECURSE_FOR_TESTS( +RECURSE_FOR_TESTS(       ut  ) diff --git a/library/cpp/cgiparam/cgiparam.cpp b/library/cpp/cgiparam/cgiparam.cpp index f3277b8e4b2..2ecc06d3f4d 100644 --- a/library/cpp/cgiparam/cgiparam.cpp +++ b/library/cpp/cgiparam/cgiparam.cpp @@ -57,7 +57,7 @@ size_t TCgiParameters::EraseAll(const TStringBuf name) {      return num;  } -void TCgiParameters::JoinUnescaped(const TStringBuf key, char sep, TStringBuf val) { +void TCgiParameters::JoinUnescaped(const TStringBuf key, char sep, TStringBuf val) {       const auto pair = equal_range(key);      auto it = pair.first; diff --git a/library/cpp/cgiparam/cgiparam.h b/library/cpp/cgiparam/cgiparam.h index 87d1ab0ad45..f32217b7e4f 100644 --- a/library/cpp/cgiparam/cgiparam.h +++ b/library/cpp/cgiparam/cgiparam.h @@ -18,7 +18,7 @@ struct TStringLess {  class TCgiParameters: public TMultiMap<TString, TString> {  public: -    TCgiParameters() = default; +    TCgiParameters() = default;       explicit TCgiParameters(const TStringBuf cgiParamStr) {          Scan(cgiParamStr); @@ -117,7 +117,7 @@ public:      // join multiple values into a single one using a separator      // if val is a [possibly empty] non-NULL string, append it as well -    void JoinUnescaped(const TStringBuf key, char sep, TStringBuf val = TStringBuf()); +    void JoinUnescaped(const TStringBuf key, char sep, TStringBuf val = TStringBuf());       bool Erase(const TStringBuf name, size_t numOfValue = 0);      bool Erase(const TStringBuf name, const TStringBuf val); @@ -163,7 +163,7 @@ void TCgiParameters::ReplaceUnescaped(const TStringBuf key, TIter valuesBegin, c  class TQuickCgiParam: public TMultiMap<TStringBuf, TStringBuf> {  public: -    TQuickCgiParam() = default; +    TQuickCgiParam() = default;       explicit TQuickCgiParam(const TStringBuf cgiParamStr); diff --git a/library/cpp/cgiparam/cgiparam_ut.cpp b/library/cpp/cgiparam/cgiparam_ut.cpp index a5623420840..23d4f964729 100644 --- a/library/cpp/cgiparam/cgiparam_ut.cpp +++ b/library/cpp/cgiparam/cgiparam_ut.cpp @@ -198,7 +198,7 @@ Y_UNIT_TEST_SUITE(TCgiParametersTest) {          TCgiParameters c;          c.Scan("foo=1&foo=2"); -        c.JoinUnescaped("foo", ';', "0"); +        c.JoinUnescaped("foo", ';', "0");           UNIT_ASSERT_VALUES_EQUAL(c.Print(), "foo=1;2;0");      } diff --git a/library/cpp/charset/codepage_ut.cpp b/library/cpp/charset/codepage_ut.cpp index c3ac3ac478e..5eef9cd893b 100644 --- a/library/cpp/charset/codepage_ut.cpp +++ b/library/cpp/charset/codepage_ut.cpp @@ -59,13 +59,13 @@ public:          const CodePage* cp = CodePageByCharset(CODES_ASCII);          char tmp[100]; -        TStringBuf s = "abcde"; +        TStringBuf s = "abcde";           TStringBuf upper(tmp, cp->ToUpper(s.begin(), s.end(), tmp)); -        UNIT_ASSERT_VALUES_EQUAL(upper, TStringBuf("ABCDE")); +        UNIT_ASSERT_VALUES_EQUAL(upper, TStringBuf("ABCDE"));           TStringBuf lower(tmp, cp->ToLower(upper.begin(), upper.end(), tmp)); -        UNIT_ASSERT_VALUES_EQUAL(lower, TStringBuf("abcde")); +        UNIT_ASSERT_VALUES_EQUAL(lower, TStringBuf("abcde"));       }      void TestBrokenRune() { diff --git a/library/cpp/codecs/codecs_registry.cpp b/library/cpp/codecs/codecs_registry.cpp index 17d07062ab4..ec565135217 100644 --- a/library/cpp/codecs/codecs_registry.cpp +++ b/library/cpp/codecs/codecs_registry.cpp @@ -72,7 +72,7 @@ namespace NCodecs {                  if (TSolarCodec::MyName() == name) {                      return new TSolarCodec();                  } -                if (name.EndsWith(TStringBuf("-a"))) { +                if (name.EndsWith(TStringBuf("-a"))) {                       return MakeCodecImpl<TAdaptiveSolarCodec>(name, name.SubStr(TSolarCodec::MyName().size()).Chop(2));                  } else {                      return MakeCodecImpl<TSolarCodec>(name, name.SubStr(TSolarCodec::MyName().size())); @@ -81,19 +81,19 @@ namespace NCodecs {              template <class TCodecCls>              TCodecPtr MakeCodecImpl(const TStringBuf& name, const TStringBuf& type) const { -                if (TStringBuf("-8k") == type) { +                if (TStringBuf("-8k") == type) {                       return new TCodecCls(1 << 13);                  } -                if (TStringBuf("-16k") == type) { +                if (TStringBuf("-16k") == type) {                       return new TCodecCls(1 << 14);                  } -                if (TStringBuf("-32k") == type) { +                if (TStringBuf("-32k") == type) {                       return new TCodecCls(1 << 15);                  } -                if (TStringBuf("-64k") == type) { +                if (TStringBuf("-64k") == type) {                       return new TCodecCls(1 << 16);                  } -                if (TStringBuf("-256k") == type) { +                if (TStringBuf("-256k") == type) {                       return new TCodecCls(1 << 18);                  }                  ythrow TNoCodecException(name); diff --git a/library/cpp/codecs/solar_codec.h b/library/cpp/codecs/solar_codec.h index 7158ae79262..e80d33e443c 100644 --- a/library/cpp/codecs/solar_codec.h +++ b/library/cpp/codecs/solar_codec.h @@ -65,40 +65,40 @@ namespace NCodecs {      class TSolarCodec: public ICodec {      public:          static TStringBuf MyName8k() { -            return TStringBuf("solar-8k"); +            return TStringBuf("solar-8k");           }          static TStringBuf MyName16k() { -            return TStringBuf("solar-16k"); +            return TStringBuf("solar-16k");           }          static TStringBuf MyName32k() { -            return TStringBuf("solar-32k"); +            return TStringBuf("solar-32k");           }          static TStringBuf MyName64k() { -            return TStringBuf("solar-64k"); +            return TStringBuf("solar-64k");           }          static TStringBuf MyName256k() { -            return TStringBuf("solar-256k"); +            return TStringBuf("solar-256k");           }          static TStringBuf MyName() { -            return TStringBuf("solar"); +            return TStringBuf("solar");           }          static TStringBuf MyName8kAdapt() { -            return TStringBuf("solar-8k-a"); +            return TStringBuf("solar-8k-a");           }          static TStringBuf MyName16kAdapt() { -            return TStringBuf("solar-16k-a"); +            return TStringBuf("solar-16k-a");           }          static TStringBuf MyName32kAdapt() { -            return TStringBuf("solar-32k-a"); +            return TStringBuf("solar-32k-a");           }          static TStringBuf MyName64kAdapt() { -            return TStringBuf("solar-64k-a"); +            return TStringBuf("solar-64k-a");           }          static TStringBuf MyName256kAdapt() { -            return TStringBuf("solar-256k-a"); +            return TStringBuf("solar-256k-a");           }          static TStringBuf MyNameShortInt() { -            return TStringBuf("solar-si"); +            return TStringBuf("solar-si");           }          explicit TSolarCodec(ui32 maxentries = 1 << 14, ui32 maxiter = 16, const NGreedyDict::TBuildSettings& s = NGreedyDict::TBuildSettings()) diff --git a/library/cpp/codecs/static/static.cpp b/library/cpp/codecs/static/static.cpp index 44a07dd73a2..d741e46f7dd 100644 --- a/library/cpp/codecs/static/static.cpp +++ b/library/cpp/codecs/static/static.cpp @@ -13,10 +13,10 @@  #include <util/ysaveload.h>  namespace NCodecs { -    static constexpr TStringBuf STATIC_CODEC_INFO_MAGIC = "CodecInf"; +    static constexpr TStringBuf STATIC_CODEC_INFO_MAGIC = "CodecInf";       static TStringBuf GetStaticCodecInfoMagic() { -        return STATIC_CODEC_INFO_MAGIC; +        return STATIC_CODEC_INFO_MAGIC;       }      void SaveCodecInfoToStream(IOutputStream& out, const TStaticCodecInfo& info) { diff --git a/library/cpp/codecs/static/ut/static_ut.cpp b/library/cpp/codecs/static/ut/static_ut.cpp index 57e1e628874..999da7702b0 100644 --- a/library/cpp/codecs/static/ut/static_ut.cpp +++ b/library/cpp/codecs/static/ut/static_ut.cpp @@ -8,7 +8,7 @@ class TStaticCodecUsageTest: public NUnitTest::TTestBase {  private:      void DoTestUsage(NStaticCodecExample::EDictVersion dv, size_t expectedSize) { -        const TStringBuf letov = "Всё идёт по плану"; +        const TStringBuf letov = "Всё идёт по плану";           TBuffer outEnc, outDec;          NStaticCodecExample::Encode(outEnc, letov, dv); diff --git a/library/cpp/colorizer/colors.cpp b/library/cpp/colorizer/colors.cpp index decc5c9847d..358764fce35 100644 --- a/library/cpp/colorizer/colors.cpp +++ b/library/cpp/colorizer/colors.cpp @@ -16,124 +16,124 @@ namespace {      constexpr TStringBuf ToStringBufC(NColorizer::EAnsiCode x) {          switch(x) {              case RESET: -                return "\033[0m"; +                return "\033[0m";               case ST_LIGHT: -                return "\033[1m"; +                return "\033[1m";               case ST_DARK: -                return "\033[2m"; +                return "\033[2m";               case ST_NORMAL: -                return "\033[22m"; +                return "\033[22m";               case ITALIC_ON: -                return "\033[3m"; +                return "\033[3m";               case ITALIC_OFF: -                return "\033[23m"; +                return "\033[23m";               case UNDERLINE_ON: -                return "\033[4m"; +                return "\033[4m";               case UNDERLINE_OFF: -                return "\033[24m"; +                return "\033[24m";               case FG_DEFAULT: -                return "\033[39m"; +                return "\033[39m";               case FG_BLACK: -                return "\033[30m"; +                return "\033[30m";               case FG_RED: -                return "\033[31m"; +                return "\033[31m";               case FG_GREEN: -                return "\033[32m"; +                return "\033[32m";               case FG_YELLOW: -                return "\033[33m"; +                return "\033[33m";               case FG_BLUE: -                return "\033[34m"; +                return "\033[34m";               case FG_MAGENTA: -                return "\033[35m"; +                return "\033[35m";               case FG_CYAN: -                return "\033[36m"; +                return "\033[36m";               case FG_WHITE: -                return "\033[37m"; +                return "\033[37m";               case BG_DEFAULT: -                return "\033[49m"; +                return "\033[49m";               case BG_BLACK: -                return "\033[40m"; +                return "\033[40m";               case BG_RED: -                return "\033[41m"; +                return "\033[41m";               case BG_GREEN: -                return "\033[42m"; +                return "\033[42m";               case BG_YELLOW: -                return "\033[43m"; +                return "\033[43m";               case BG_BLUE: -                return "\033[44m"; +                return "\033[44m";               case BG_MAGENTA: -                return "\033[45m"; +                return "\033[45m";               case BG_CYAN: -                return "\033[46m"; +                return "\033[46m";               case BG_WHITE: -                return "\033[47m"; +                return "\033[47m";               // Note: the following codes are split into two escabe sequences because of how ya.make handles them.              case DEFAULT: -                return "\033[0m\033[0;39m"; +                return "\033[0m\033[0;39m";               case BLACK: -                return "\033[0m\033[0;30m"; +                return "\033[0m\033[0;30m";               case RED: -                return "\033[0m\033[0;31m"; +                return "\033[0m\033[0;31m";               case GREEN: -                return "\033[0m\033[0;32m"; +                return "\033[0m\033[0;32m";               case YELLOW: -                return "\033[0m\033[0;33m"; +                return "\033[0m\033[0;33m";               case BLUE: -                return "\033[0m\033[0;34m"; +                return "\033[0m\033[0;34m";               case MAGENTA: -                return "\033[0m\033[0;35m"; +                return "\033[0m\033[0;35m";               case CYAN: -                return "\033[0m\033[0;36m"; +                return "\033[0m\033[0;36m";               case WHITE: -                return "\033[0m\033[0;37m"; +                return "\033[0m\033[0;37m";               case LIGHT_DEFAULT: -                return "\033[0m\033[1;39m"; +                return "\033[0m\033[1;39m";               case LIGHT_BLACK: -                return "\033[0m\033[1;30m"; +                return "\033[0m\033[1;30m";               case LIGHT_RED: -                return "\033[0m\033[1;31m"; +                return "\033[0m\033[1;31m";               case LIGHT_GREEN: -                return "\033[0m\033[1;32m"; +                return "\033[0m\033[1;32m";               case LIGHT_YELLOW: -                return "\033[0m\033[1;33m"; +                return "\033[0m\033[1;33m";               case LIGHT_BLUE: -                return "\033[0m\033[1;34m"; +                return "\033[0m\033[1;34m";               case LIGHT_MAGENTA: -                return "\033[0m\033[1;35m"; +                return "\033[0m\033[1;35m";               case LIGHT_CYAN: -                return "\033[0m\033[1;36m"; +                return "\033[0m\033[1;36m";               case LIGHT_WHITE: -                return "\033[0m\033[1;37m"; +                return "\033[0m\033[1;37m";               case DARK_DEFAULT: -                return "\033[0m\033[2;39m"; +                return "\033[0m\033[2;39m";               case DARK_BLACK: -                return "\033[0m\033[2;30m"; +                return "\033[0m\033[2;30m";               case DARK_RED: -                return "\033[0m\033[2;31m"; +                return "\033[0m\033[2;31m";               case DARK_GREEN: -                return "\033[0m\033[2;32m"; +                return "\033[0m\033[2;32m";               case DARK_YELLOW: -                return "\033[0m\033[2;33m"; +                return "\033[0m\033[2;33m";               case DARK_BLUE: -                return "\033[0m\033[2;34m"; +                return "\033[0m\033[2;34m";               case DARK_MAGENTA: -                return "\033[0m\033[2;35m"; +                return "\033[0m\033[2;35m";               case DARK_CYAN: -                return "\033[0m\033[2;36m"; +                return "\033[0m\033[2;36m";               case DARK_WHITE: -                return "\033[0m\033[2;37m"; +                return "\033[0m\033[2;37m";               case INVALID:              default: -                return ""; +                return "";           }      }  } @@ -346,75 +346,75 @@ TStringBuf TColors::DarkWhite() const noexcept {  }  TStringBuf TColors::OldColor() const noexcept { -    return IsTTY() ? "\033[22;39m" : ""; +    return IsTTY() ? "\033[22;39m" : "";   }  TStringBuf TColors::BoldColor() const noexcept { -    return IsTTY() ? "\033[1m" : ""; +    return IsTTY() ? "\033[1m" : "";   }  TStringBuf TColors::BlackColor() const noexcept { -    return IsTTY() ? "\033[22;30m" : ""; +    return IsTTY() ? "\033[22;30m" : "";   }  TStringBuf TColors::BlueColor() const noexcept { -    return IsTTY() ? "\033[22;34m" : ""; +    return IsTTY() ? "\033[22;34m" : "";   }  TStringBuf TColors::GreenColor() const noexcept { -    return IsTTY() ? "\033[22;32m" : ""; +    return IsTTY() ? "\033[22;32m" : "";   }  TStringBuf TColors::CyanColor() const noexcept { -    return IsTTY() ? "\033[22;36m" : ""; +    return IsTTY() ? "\033[22;36m" : "";   }  TStringBuf TColors::RedColor() const noexcept { -    return IsTTY() ? "\033[22;31m" : ""; +    return IsTTY() ? "\033[22;31m" : "";   }  TStringBuf TColors::PurpleColor() const noexcept { -    return IsTTY() ? "\033[22;35m" : ""; +    return IsTTY() ? "\033[22;35m" : "";   }  TStringBuf TColors::BrownColor() const noexcept { -    return IsTTY() ? "\033[22;33m" : ""; +    return IsTTY() ? "\033[22;33m" : "";   }  TStringBuf TColors::LightGrayColor() const noexcept { -    return IsTTY() ? "\033[22;37m" : ""; +    return IsTTY() ? "\033[22;37m" : "";   }  TStringBuf TColors::DarkGrayColor() const noexcept { -    return IsTTY() ? "\033[1;30m" : ""; +    return IsTTY() ? "\033[1;30m" : "";   }  TStringBuf TColors::LightBlueColor() const noexcept { -    return IsTTY() ? "\033[1;34m" : ""; +    return IsTTY() ? "\033[1;34m" : "";   }  TStringBuf TColors::LightGreenColor() const noexcept { -    return IsTTY() ? "\033[1;32m" : ""; +    return IsTTY() ? "\033[1;32m" : "";   }  TStringBuf TColors::LightCyanColor() const noexcept { -    return IsTTY() ? "\033[1;36m" : ""; +    return IsTTY() ? "\033[1;36m" : "";   }  TStringBuf TColors::LightRedColor() const noexcept { -    return IsTTY() ? "\033[1;31m" : ""; +    return IsTTY() ? "\033[1;31m" : "";   }  TStringBuf TColors::LightPurpleColor() const noexcept { -    return IsTTY() ? "\033[1;35m" : ""; +    return IsTTY() ? "\033[1;35m" : "";   }  TStringBuf TColors::YellowColor() const noexcept { -    return IsTTY() ? "\033[1;33m" : ""; +    return IsTTY() ? "\033[1;33m" : "";   }  TStringBuf TColors::WhiteColor() const noexcept { -    return IsTTY() ? "\033[1;37m" : ""; +    return IsTTY() ? "\033[1;37m" : "";   } diff --git a/library/cpp/containers/comptrie/comptrie_builder.h b/library/cpp/containers/comptrie/comptrie_builder.h index cf7d2e39a34..7939a866012 100644 --- a/library/cpp/containers/comptrie/comptrie_builder.h +++ b/library/cpp/containers/comptrie/comptrie_builder.h @@ -24,7 +24,7 @@ enum ECompactTrieBuilderFlags {      CTBF_UNIQUE = 1 << 2,  }; -using TCompactTrieBuilderFlags = ECompactTrieBuilderFlags; +using TCompactTrieBuilderFlags = ECompactTrieBuilderFlags;   inline TCompactTrieBuilderFlags operator|(TCompactTrieBuilderFlags first, TCompactTrieBuilderFlags second) {      return static_cast<TCompactTrieBuilderFlags>(static_cast<int>(first) | second); diff --git a/library/cpp/containers/comptrie/comptrie_trie.h b/library/cpp/containers/comptrie/comptrie_trie.h index 40ec1e52b32..6a6ccaf3bb8 100644 --- a/library/cpp/containers/comptrie/comptrie_trie.h +++ b/library/cpp/containers/comptrie/comptrie_trie.h @@ -66,9 +66,9 @@ public:      // Skipper should be initialized with &Packer, not with &other.Packer, so you have to redefine these.      TCompactTrie(const TCompactTrie& other); -    TCompactTrie(TCompactTrie&& other) noexcept; +    TCompactTrie(TCompactTrie&& other) noexcept;       TCompactTrie& operator=(const TCompactTrie& other); -    TCompactTrie& operator=(TCompactTrie&& other) noexcept; +    TCompactTrie& operator=(TCompactTrie&& other) noexcept;       explicit operator bool() const {          return !IsEmpty(); @@ -166,7 +166,7 @@ public:          TKey GetKey() const;          size_t GetKeySize() const;          TData GetValue() const; -        void GetValue(TData& data) const; +        void GetValue(TData& data) const;           const char* GetValuePtr() const;      private: @@ -259,7 +259,7 @@ TCompactTrie<T, D, S>::TCompactTrie(const TCompactTrie& other)  }  template <class T, class D, class S> -TCompactTrie<T, D, S>::TCompactTrie(TCompactTrie&& other) noexcept +TCompactTrie<T, D, S>::TCompactTrie(TCompactTrie&& other) noexcept       : DataHolder(std::move(other.DataHolder))      , EmptyValue(std::move(other.EmptyValue))      , Packer(std::move(other.Packer)) @@ -277,7 +277,7 @@ TCompactTrie<T, D, S>& TCompactTrie<T, D, S>::operator=(const TCompactTrie& othe  }  template <class T, class D, class S> -TCompactTrie<T, D, S>& TCompactTrie<T, D, S>::operator=(TCompactTrie&& other) noexcept { +TCompactTrie<T, D, S>& TCompactTrie<T, D, S>::operator=(TCompactTrie&& other) noexcept {       if (this != &other) {          DataHolder = std::move(other.DataHolder);          EmptyValue = std::move(other.EmptyValue); @@ -499,7 +499,7 @@ bool TCompactTrie<T, D, S>::LookupLongestPrefix(const TSymbol* key, size_t keyle      while (key != keyend) {          T label = *(key++);          for (i64 i = (i64)ExtraBits<TSymbol>(); i >= 0; i -= 8) { -            const char flags = LeapByte(datapos, dataend, (char)(label >> i)); +            const char flags = LeapByte(datapos, dataend, (char)(label >> i));               if (!datapos) {                  return found; // no such arc              } diff --git a/library/cpp/containers/comptrie/comptrie_ut.cpp b/library/cpp/containers/comptrie/comptrie_ut.cpp index 74bee09b5d6..3cac5f104f9 100644 --- a/library/cpp/containers/comptrie/comptrie_ut.cpp +++ b/library/cpp/containers/comptrie/comptrie_ut.cpp @@ -1327,10 +1327,10 @@ void TCompactTrieTest::TestSearchIterImpl() {      {          TCompactTrieBuilder<TChar, ui32> builder;          TStringBuf data[] = { -            TStringBuf("abaab"), -            TStringBuf("abcdef"), -            TStringBuf("abbbc"), -            TStringBuf("bdfaa"), +            TStringBuf("abaab"),  +            TStringBuf("abcdef"),  +            TStringBuf("abbbc"),  +            TStringBuf("bdfaa"),           };          for (size_t i = 0; i < Y_ARRAY_SIZE(data); ++i) {              builder.Add(TConvertKey<TChar>::Convert(data[i]), i + 1); @@ -1341,26 +1341,26 @@ void TCompactTrieTest::TestSearchIterImpl() {      TCompactTrie<TChar, ui32> trie(buffer.Buffer().Data(), buffer.Buffer().Size());      ui32 value = 0;      auto iter(MakeSearchIterator(trie)); -    MoveIter(iter, TConvertKey<TChar>::Convert(TStringBuf("abc"))); +    MoveIter(iter, TConvertKey<TChar>::Convert(TStringBuf("abc")));       UNIT_ASSERT(!iter.GetValue(&value));      iter = MakeSearchIterator(trie); -    MoveIter(iter, TConvertKey<TChar>::Convert(TStringBuf("abbbc"))); +    MoveIter(iter, TConvertKey<TChar>::Convert(TStringBuf("abbbc")));       UNIT_ASSERT(iter.GetValue(&value));      UNIT_ASSERT_EQUAL(value, 3);      iter = MakeSearchIterator(trie); -    UNIT_ASSERT(iter.Advance(TConvertKey<TChar>::Convert(TStringBuf("bdfa")))); +    UNIT_ASSERT(iter.Advance(TConvertKey<TChar>::Convert(TStringBuf("bdfa"))));       UNIT_ASSERT(!iter.GetValue(&value));      iter = MakeSearchIterator(trie); -    UNIT_ASSERT(iter.Advance(TConvertKey<TChar>::Convert(TStringBuf("bdfaa")))); +    UNIT_ASSERT(iter.Advance(TConvertKey<TChar>::Convert(TStringBuf("bdfaa"))));       UNIT_ASSERT(iter.GetValue(&value));      UNIT_ASSERT_EQUAL(value, 4);      UNIT_ASSERT(!MakeSearchIterator(trie).Advance(TChar('z'))); -    UNIT_ASSERT(!MakeSearchIterator(trie).Advance(TConvertKey<TChar>::Convert(TStringBuf("cdf")))); -    UNIT_ASSERT(!MakeSearchIterator(trie).Advance(TConvertKey<TChar>::Convert(TStringBuf("abca")))); +    UNIT_ASSERT(!MakeSearchIterator(trie).Advance(TConvertKey<TChar>::Convert(TStringBuf("cdf"))));  +    UNIT_ASSERT(!MakeSearchIterator(trie).Advance(TConvertKey<TChar>::Convert(TStringBuf("abca"))));   }  void TCompactTrieTest::TestSearchIterChar() { @@ -1411,9 +1411,9 @@ void TCompactTrieTest::TestFirstSymbolIterator() {      typedef TCompactTrie<TSymbol> TTrie;      CreateTrie<TSymbol>(bufout, false, false);      TTrie trie(bufout.Buffer().Data(), bufout.Buffer().Size()); -    TStringBuf rootAnswers = "abcdf"; +    TStringBuf rootAnswers = "abcdf";       TestFirstSymbolIteratorForTrie(trie, rootAnswers); -    TStringBuf aAnswers = "abcd"; +    TStringBuf aAnswers = "abcd";       TestFirstSymbolIteratorForTrie(trie.FindTails(MakeWideKey<TSymbol>("a", 1)), aAnswers);  } diff --git a/library/cpp/containers/comptrie/make_fast_layout.cpp b/library/cpp/containers/comptrie/make_fast_layout.cpp index ade78d78994..42228ebcc62 100644 --- a/library/cpp/containers/comptrie/make_fast_layout.cpp +++ b/library/cpp/containers/comptrie/make_fast_layout.cpp @@ -35,7 +35,7 @@ namespace NCompactTrie {      namespace {          class TTrieNodeSet {          public: -            TTrieNodeSet() = default; +            TTrieNodeSet() = default;               explicit TTrieNodeSet(const TOpaqueTrie& trie)                  : Body(trie.Length / (8 * MinNodeSize) + 1, 0) @@ -83,7 +83,7 @@ namespace NCompactTrie {          class TTrieNodeCounts {          public: -            TTrieNodeCounts() = default; +            TTrieNodeCounts() = default;               explicit TTrieNodeCounts(const TOpaqueTrie& trie)                  : Body(trie.Length / MinNodeSize, 0) diff --git a/library/cpp/containers/flat_hash/lib/ut/probings_ut.cpp b/library/cpp/containers/flat_hash/lib/ut/probings_ut.cpp index 593f8cbb1bb..dfd971b2dc0 100644 --- a/library/cpp/containers/flat_hash/lib/ut/probings_ut.cpp +++ b/library/cpp/containers/flat_hash/lib/ut/probings_ut.cpp @@ -11,7 +11,7 @@ namespace {          }      }; -    constexpr TDummySizeFitter SIZE_FITTER; +    constexpr TDummySizeFitter SIZE_FITTER;       auto atLeast13 = [](size_t idx) { return idx >= 13; };  } diff --git a/library/cpp/containers/sorted_vector/sorted_vector_ut.cpp b/library/cpp/containers/sorted_vector/sorted_vector_ut.cpp index 893862f098a..d7de58321da 100644 --- a/library/cpp/containers/sorted_vector/sorted_vector_ut.cpp +++ b/library/cpp/containers/sorted_vector/sorted_vector_ut.cpp @@ -14,8 +14,8 @@ Y_UNIT_TEST_SUITE(TestSimpleMap) {          UNIT_ASSERT_VALUES_UNEQUAL(map.FindPtr(TString("a")), nullptr);          UNIT_ASSERT_VALUES_EQUAL(map.FindPtr(TString("c")), nullptr); -        UNIT_ASSERT_VALUES_UNEQUAL(map.FindPtr(TStringBuf("a")), nullptr); -        UNIT_ASSERT_VALUES_EQUAL(map.FindPtr(TStringBuf("c")), nullptr); +        UNIT_ASSERT_VALUES_UNEQUAL(map.FindPtr(TStringBuf("a")), nullptr);  +        UNIT_ASSERT_VALUES_EQUAL(map.FindPtr(TStringBuf("c")), nullptr);           UNIT_ASSERT_VALUES_UNEQUAL(map.FindPtr("a"), nullptr);          UNIT_ASSERT_VALUES_EQUAL(map.FindPtr("c"), nullptr); diff --git a/library/cpp/containers/stack_array/stack_array.h b/library/cpp/containers/stack_array/stack_array.h index 28e49bfc3c2..3a844be17be 100644 --- a/library/cpp/containers/stack_array/stack_array.h +++ b/library/cpp/containers/stack_array/stack_array.h @@ -3,7 +3,7 @@  #include "range_ops.h"  #include <util/generic/array_ref.h> -#include <util/system/defaults.h> /* For alloca. */ +#include <util/system/defaults.h> /* For alloca. */   namespace NStackArray {      /** diff --git a/library/cpp/containers/ya.make b/library/cpp/containers/ya.make index 4b1b315e6a5..72875c2da75 100644 --- a/library/cpp/containers/ya.make +++ b/library/cpp/containers/ya.make @@ -66,6 +66,6 @@ RECURSE(      top_keeper/ut      two_level_hash      two_level_hash/ut -    vp_tree -    vp_tree/ut +    vp_tree  +    vp_tree/ut   ) diff --git a/library/cpp/coroutine/engine/poller.cpp b/library/cpp/coroutine/engine/poller.cpp index 61164fa56bf..e2dc336cbbc 100644 --- a/library/cpp/coroutine/engine/poller.cpp +++ b/library/cpp/coroutine/engine/poller.cpp @@ -188,7 +188,7 @@ namespace {      }; -    inline short PollFlags(ui16 flags) noexcept { +    inline short PollFlags(ui16 flags) noexcept {           short ret = 0;          if (flags & CONT_POLL_READ) { diff --git a/library/cpp/coroutine/engine/sockpool.cpp b/library/cpp/coroutine/engine/sockpool.cpp index b9482e780fe..a7ae874b221 100644 --- a/library/cpp/coroutine/engine/sockpool.cpp +++ b/library/cpp/coroutine/engine/sockpool.cpp @@ -34,7 +34,7 @@ TPooledSocket TSocketPool::AllocateMore(TConnectData* conn) {          TSocketHolder s(NCoro::Socket(Addr_->Addr()->sa_family, SOCK_STREAM, 0));          if (s == INVALID_SOCKET) { -            ythrow TSystemError(errno) << TStringBuf("can not create socket"); +            ythrow TSystemError(errno) << TStringBuf("can not create socket");           }          SetCommonSockOpts(s, Addr_->Addr()); @@ -45,7 +45,7 @@ TPooledSocket TSocketPool::AllocateMore(TConnectData* conn) {          if (ret == EINTR) {              continue;          } else if (ret) { -            ythrow TSystemError(ret) << TStringBuf("can not connect(") << cont->Name() << ')'; +            ythrow TSystemError(ret) << TStringBuf("can not connect(") << cont->Name() << ')';           }          THolder<TPooledSocket::TImpl> res(new TPooledSocket::TImpl(s, this)); diff --git a/library/cpp/coroutine/engine/stack/stack_guards.h b/library/cpp/coroutine/engine/stack/stack_guards.h index 3a7ef26481f..d2b5c9487d5 100644 --- a/library/cpp/coroutine/engine/stack/stack_guards.h +++ b/library/cpp/coroutine/engine/stack/stack_guards.h @@ -69,7 +69,7 @@ namespace NCoro::NStack {          }      private: -        static constexpr TStringBuf Canary = "[ThisIsACanaryCoroutineStackGuardIfYouReadThisTheStackIsStillOK]"; +        static constexpr TStringBuf Canary = "[ThisIsACanaryCoroutineStackGuardIfYouReadThisTheStackIsStillOK]";           static_assert(Canary.size() == 64);          static constexpr uint64_t AlignedSize_ = (Canary.size() + PageSize - 1) & ~PageSizeMask;      }; diff --git a/library/cpp/coroutine/listener/listen.cpp b/library/cpp/coroutine/listener/listen.cpp index 3d4e711d1d5..4614783e98e 100644 --- a/library/cpp/coroutine/listener/listen.cpp +++ b/library/cpp/coroutine/listener/listen.cpp @@ -240,7 +240,7 @@ public:                  L_.PushBack(new TOneSocketListener(this, MakeHolder<TIPv6Addr>(*sa.In6)));                  break;              default: -                ythrow yexception() << TStringBuf("unknown protocol"); +                ythrow yexception() << TStringBuf("unknown protocol");           }      } diff --git a/library/cpp/dbg_output/colorscheme.h b/library/cpp/dbg_output/colorscheme.h index a5b9cf749a8..ef966666e0c 100644 --- a/library/cpp/dbg_output/colorscheme.h +++ b/library/cpp/dbg_output/colorscheme.h @@ -71,17 +71,17 @@ namespace NDbgDump {              // TODO: support backgrounds in library/cpp/colorizer              DBG_OUTPUT_COLOR_HANDLER(Key) {                  if (Depth++ == 0 && Colors.IsTTY()) { -                    stream << DumpRaw(TStringBuf("\033[42m")); +                    stream << DumpRaw(TStringBuf("\033[42m"));                   }              }              DBG_OUTPUT_COLOR_HANDLER(Value) {                  if (Depth++ == 0 && Colors.IsTTY()) { -                    stream << DumpRaw(TStringBuf("\033[44m")); +                    stream << DumpRaw(TStringBuf("\033[44m"));                   }              }              DBG_OUTPUT_COLOR_HANDLER(ResetRole) {                  if (--Depth == 0 && Colors.IsTTY()) { -                    stream << DumpRaw(TStringBuf("\033[49m")); +                    stream << DumpRaw(TStringBuf("\033[49m"));                   }              } diff --git a/library/cpp/deprecated/kmp/kmp.h b/library/cpp/deprecated/kmp/kmp.h index a7f72eece6a..5c62a5ec817 100644 --- a/library/cpp/deprecated/kmp/kmp.h +++ b/library/cpp/deprecated/kmp/kmp.h @@ -7,7 +7,7 @@  template <typename T>  void ComputePrefixFunction(const T* begin, const T* end, ssize_t** result) { -    Y_ENSURE(begin != end, TStringBuf("empty pattern")); +    Y_ENSURE(begin != end, TStringBuf("empty pattern"));       ssize_t len = end - begin;      TArrayHolder<ssize_t> resultHolder(new ssize_t[len + 1]);      ssize_t i = 0; diff --git a/library/cpp/deprecated/split/split_iterator.h b/library/cpp/deprecated/split/split_iterator.h index 0eacc29228e..34af7f9843a 100644 --- a/library/cpp/deprecated/split/split_iterator.h +++ b/library/cpp/deprecated/split/split_iterator.h @@ -273,7 +273,7 @@ public:      }      inline TSizeTRegion Next() { -        Y_ENSURE(!Eof(), TStringBuf("eof reached")); +        Y_ENSURE(!Eof(), TStringBuf("eof reached"));           return Split.Next(Pos);      } diff --git a/library/cpp/digest/crc32c/crc32c.cpp b/library/cpp/digest/crc32c/crc32c.cpp index 369b46a2136..913d4c9300a 100644 --- a/library/cpp/digest/crc32c/crc32c.cpp +++ b/library/cpp/digest/crc32c/crc32c.cpp @@ -19,7 +19,7 @@ namespace {              Pimpl->Delete();          } -        inline ui32 Extend(ui32 init, const void* data, size_t n) const noexcept { +        inline ui32 Extend(ui32 init, const void* data, size_t n) const noexcept {               crcutil_interface::UINT64 sum = init;              Pimpl->Compute(data, n, &sum);              return (ui32)sum; diff --git a/library/cpp/digest/lower_case/hash_ops_ut.cpp b/library/cpp/digest/lower_case/hash_ops_ut.cpp index a7ab0b86ea6..f4a730a00cb 100644 --- a/library/cpp/digest/lower_case/hash_ops_ut.cpp +++ b/library/cpp/digest/lower_case/hash_ops_ut.cpp @@ -30,7 +30,7 @@ Y_UNIT_TEST_SUITE(TestCIHash) {      }      Y_UNIT_TEST(Test1) { -        UNIT_ASSERT_VALUES_EQUAL(TCIOps()("aBc3"), TCIOps()(TStringBuf("AbC3"))); +        UNIT_ASSERT_VALUES_EQUAL(TCIOps()("aBc3"), TCIOps()(TStringBuf("AbC3")));           UNIT_ASSERT(TCIOps()("aBc4", "AbC4"));      }  } diff --git a/library/cpp/digest/md5/md5_ut.cpp b/library/cpp/digest/md5/md5_ut.cpp index 1c3e4ad0a9f..9c466eab004 100644 --- a/library/cpp/digest/md5/md5_ut.cpp +++ b/library/cpp/digest/md5/md5_ut.cpp @@ -8,7 +8,7 @@  Y_UNIT_TEST_SUITE(TMD5Test) {      Y_UNIT_TEST(TestMD5) {          // echo -n 'qwertyuiopqwertyuiopasdfghjklasdfghjkl' | md5sum -        constexpr const char* b = "qwertyuiopqwertyuiopasdfghjklasdfghjkl"; +        constexpr const char* b = "qwertyuiopqwertyuiopasdfghjklasdfghjkl";           MD5 r;          r.Update((const unsigned char*)b, 15); @@ -20,7 +20,7 @@ Y_UNIT_TEST_SUITE(TMD5Test) {          UNIT_ASSERT_NO_DIFF(s, TStringBuf("3ac00dd696b966fd74deee3c35a59d8f")); -        TString result = r.Calc(TStringBuf(b)); +        TString result = r.Calc(TStringBuf(b));           result.to_lower();          UNIT_ASSERT_NO_DIFF(result, TStringBuf("3ac00dd696b966fd74deee3c35a59d8f"));      } @@ -51,12 +51,12 @@ Y_UNIT_TEST_SUITE(TMD5Test) {      Y_UNIT_TEST(TestIsMD5) {          UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf())); -        UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa0")));   // length 31 -        UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa000"))); // length 33 -        UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa0g")));  // wrong character 'g' -        UNIT_ASSERT_EQUAL(true, MD5::IsMD5(TStringBuf("4136EBB0E4C45D21E2B09294C75CFA08"))); -        UNIT_ASSERT_EQUAL(true, MD5::IsMD5(TStringBuf("4136ebb0E4C45D21e2b09294C75CfA08"))); -        UNIT_ASSERT_EQUAL(true, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa08"))); +        UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa0")));   // length 31  +        UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa000"))); // length 33  +        UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa0g")));  // wrong character 'g'  +        UNIT_ASSERT_EQUAL(true, MD5::IsMD5(TStringBuf("4136EBB0E4C45D21E2B09294C75CFA08")));  +        UNIT_ASSERT_EQUAL(true, MD5::IsMD5(TStringBuf("4136ebb0E4C45D21e2b09294C75CfA08")));  +        UNIT_ASSERT_EQUAL(true, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa08")));       }      Y_UNIT_TEST(TestMd5HalfMix) { diff --git a/library/cpp/dns/cache.cpp b/library/cpp/dns/cache.cpp index 05c14e82fce..6c1f55e4f80 100644 --- a/library/cpp/dns/cache.cpp +++ b/library/cpp/dns/cache.cpp @@ -123,7 +123,7 @@ namespace {                  na = ThreadedResolve(host, rt.Info.Port);              } else {                  Y_ASSERT(0); -                throw yexception() << TStringBuf("invalid resolve method"); +                throw yexception() << TStringBuf("invalid resolve method");               }              return new TResolvedHost(originalHost, *na); @@ -174,7 +174,7 @@ namespace {          }      }; -    inline IDns* ThrDns() { +    inline IDns* ThrDns() {           return FastTlsSingleton<TThreadedDns>();      }  } diff --git a/library/cpp/dns/thread.cpp b/library/cpp/dns/thread.cpp index 8b27d2d527c..b5a5237004a 100644 --- a/library/cpp/dns/thread.cpp +++ b/library/cpp/dns/thread.cpp @@ -25,7 +25,7 @@ namespace {                  if (!Error) {                      if (!Result) { -                        ythrow TNetworkResolutionError(EAI_AGAIN) << TStringBuf(": resolver down"); +                        ythrow TNetworkResolutionError(EAI_AGAIN) << TStringBuf(": resolver down");                       }                      return Result; @@ -33,7 +33,7 @@ namespace {                  Error->Raise(); -                ythrow TNetworkResolutionError(EAI_FAIL) << TStringBuf(": shit happen"); +                ythrow TNetworkResolutionError(EAI_FAIL) << TStringBuf(": shit happen");               }              inline void Resolve() noexcept { diff --git a/library/cpp/enumbitset/enumbitset_ut.cpp b/library/cpp/enumbitset/enumbitset_ut.cpp index e55b3251c34..4b11a4078cd 100644 --- a/library/cpp/enumbitset/enumbitset_ut.cpp +++ b/library/cpp/enumbitset/enumbitset_ut.cpp @@ -19,7 +19,7 @@ enum ETestEnum {      TE_OVERFLOW, // to test overflow  }; -using TTestBitSet = TEnumBitSet<ETestEnum, TE_FIRST, TE_MAX>; +using TTestBitSet = TEnumBitSet<ETestEnum, TE_FIRST, TE_MAX>;   Y_UNIT_TEST_SUITE(TEnumBitSetTest) {      Y_UNIT_TEST(TestMainFunctions) { diff --git a/library/cpp/execprofile/autostart/start.cpp b/library/cpp/execprofile/autostart/start.cpp index 4fffb03ae1c..35e06cafa48 100644 --- a/library/cpp/execprofile/autostart/start.cpp +++ b/library/cpp/execprofile/autostart/start.cpp @@ -11,5 +11,5 @@ namespace {          }      }; -    const TInit initer; +    const TInit initer;   } diff --git a/library/cpp/getopt/last_getopt_demo/demo.cpp b/library/cpp/getopt/last_getopt_demo/demo.cpp index 79426a9cc91..325d359de55 100644 --- a/library/cpp/getopt/last_getopt_demo/demo.cpp +++ b/library/cpp/getopt/last_getopt_demo/demo.cpp @@ -11,12 +11,12 @@ Y_COMPLETER(HeaderCompleter) {      bool addPostHeaders = false;      for (int i = 0; i < argc; ++i) { -        if (argv[i] == TStringBuf("--method") && i + 1 < argc) { +        if (argv[i] == TStringBuf("--method") && i + 1 < argc) {               auto method = TString(argv[i + 1]);              method.to_upper();              addPostHeaders = method == "POST" || method == "PUT";              break; -        } else if (argv[i] == TStringBuf("--post-data") || argv[i] == TStringBuf("--post-file")) { +        } else if (argv[i] == TStringBuf("--post-data") || argv[i] == TStringBuf("--post-file")) {               addPostHeaders = true;              break;          } diff --git a/library/cpp/getopt/small/completer.cpp b/library/cpp/getopt/small/completer.cpp index 3fff684adbe..01169dc0815 100644 --- a/library/cpp/getopt/small/completer.cpp +++ b/library/cpp/getopt/small/completer.cpp @@ -219,7 +219,7 @@ namespace NLastGetopt::NComp {      namespace {          TCustomCompleter* Head = nullptr; -        TStringBuf SpecialFlag = "---CUSTOM-COMPLETION---"; +        TStringBuf SpecialFlag = "---CUSTOM-COMPLETION---";       }      void TCustomCompleter::FireCustomCompleter(int argc, const char** argv) { diff --git a/library/cpp/getopt/small/last_getopt_opt.cpp b/library/cpp/getopt/small/last_getopt_opt.cpp index 9a99437f4bd..841a499cb8d 100644 --- a/library/cpp/getopt/small/last_getopt_opt.cpp +++ b/library/cpp/getopt/small/last_getopt_opt.cpp @@ -8,8 +8,8 @@  #include <ctype.h>  namespace NLastGetopt { -    static const TStringBuf ExcludedShortNameChars = "= -\t\n"; -    static const TStringBuf ExcludedLongNameChars = "= \t\n"; +    static const TStringBuf ExcludedShortNameChars = "= -\t\n";  +    static const TStringBuf ExcludedLongNameChars = "= \t\n";       bool TOpt::NameIs(const TString& name) const {          for (const auto& next : LongNames_) { diff --git a/library/cpp/getopt/small/last_getopt_opts.cpp b/library/cpp/getopt/small/last_getopt_opts.cpp index 03c432849f1..efdf68eeccc 100644 --- a/library/cpp/getopt/small/last_getopt_opts.cpp +++ b/library/cpp/getopt/small/last_getopt_opts.cpp @@ -22,7 +22,7 @@ namespace NLastGetoptPrivate {  }  namespace NLastGetopt { -    static const TStringBuf SPad = "  "; +    static const TStringBuf SPad = "  ";       void PrintVersionAndExit(const TOptsParser*) {          Cout << (NLastGetoptPrivate::VersionString() ? NLastGetoptPrivate::VersionString() : "program version: not linked with library/cpp/getopt") << Endl; diff --git a/library/cpp/getopt/small/modchooser.h b/library/cpp/getopt/small/modchooser.h index 0a8de6d50b5..8e32423ab4c 100644 --- a/library/cpp/getopt/small/modchooser.h +++ b/library/cpp/getopt/small/modchooser.h @@ -9,12 +9,12 @@  #include <functional>  //! Mode function with vector of cli arguments. -using TMainFunctionPtrV = std::function<int(const TVector<TString>&)> ; -using TMainFunctionRawPtrV = int (*)(const TVector<TString>& argv); +using TMainFunctionPtrV = std::function<int(const TVector<TString>&)> ;  +using TMainFunctionRawPtrV = int (*)(const TVector<TString>& argv);   //! Mode function with classic argc and argv arguments. -using TMainFunctionPtr = std::function<int(int, const char**)> ; -using TMainFunctionRawPtr = int (*)(const int argc, const char** argv); +using TMainFunctionPtr = std::function<int(int, const char**)> ;  +using TMainFunctionRawPtr = int (*)(const int argc, const char** argv);   //! Mode class with vector of cli arguments.  class TMainClassV { @@ -26,7 +26,7 @@ public:  //! Mode class with classic argc and argv arguments.  class TMainClass {  public: -    virtual int operator()(int argc, const char** argv) = 0; +    virtual int operator()(int argc, const char** argv) = 0;       virtual ~TMainClass() = default;  }; @@ -47,10 +47,10 @@ public:      ~TModChooser();  public: -    void AddMode(const TString& mode, TMainFunctionRawPtr func, const TString& description, bool hidden = false, bool noCompletion = false); -    void AddMode(const TString& mode, TMainFunctionRawPtrV func, const TString& description, bool hidden = false, bool noCompletion = false); -    void AddMode(const TString& mode, TMainFunctionPtr func, const TString& description, bool hidden = false, bool noCompletion = false); -    void AddMode(const TString& mode, TMainFunctionPtrV func, const TString& description, bool hidden = false, bool noCompletion = false); +    void AddMode(const TString& mode, TMainFunctionRawPtr func, const TString& description, bool hidden = false, bool noCompletion = false);  +    void AddMode(const TString& mode, TMainFunctionRawPtrV func, const TString& description, bool hidden = false, bool noCompletion = false);  +    void AddMode(const TString& mode, TMainFunctionPtr func, const TString& description, bool hidden = false, bool noCompletion = false);  +    void AddMode(const TString& mode, TMainFunctionPtrV func, const TString& description, bool hidden = false, bool noCompletion = false);       void AddMode(const TString& mode, TMainClass* func, const TString& description, bool hidden = false, bool noCompletion = false);      void AddMode(const TString& mode, TMainClassV* func, const TString& description, bool hidden = false, bool noCompletion = false); @@ -95,7 +95,7 @@ public:       *      call it and return its return code.       *   4) If appropriate mode is not found - return non-zero code.       */ -    int Run(int argc, const char** argv) const; +    int Run(int argc, const char** argv) const;       //! Run appropriate mode. Same as Run(const int, const char**)      int Run(const TVector<TString>& argv) const; @@ -174,7 +174,7 @@ private:  //! Mode class that allows introspecting its console arguments.  class TMainClassArgs: public TMainClass {  public: -    int operator()(int argc, const char** argv) final; +    int operator()(int argc, const char** argv) final;   public:      //! Run this mode. @@ -197,7 +197,7 @@ private:  //! Mode class that uses sub-modes to dispatch commands further.  class TMainClassModes: public TMainClass {  public: -    int operator()(int argc, const char** argv) final; +    int operator()(int argc, const char** argv) final;   public:      //! Run this mode. diff --git a/library/cpp/getopt/ut/last_getopt_ut.cpp b/library/cpp/getopt/ut/last_getopt_ut.cpp index c99a1d053d1..aa4f469aa45 100644 --- a/library/cpp/getopt/ut/last_getopt_ut.cpp +++ b/library/cpp/getopt/ut/last_getopt_ut.cpp @@ -126,7 +126,7 @@ struct TOptsParserTester {  };  namespace { -    bool gSimpleFlag = false; +    bool gSimpleFlag = false;       void SimpleHander(void) {          gSimpleFlag = true;      } diff --git a/library/cpp/grpc/client/grpc_client_low.cpp b/library/cpp/grpc/client/grpc_client_low.cpp index 73cc908ef82..49825f97253 100644 --- a/library/cpp/grpc/client/grpc_client_low.cpp +++ b/library/cpp/grpc/client/grpc_client_low.cpp @@ -203,7 +203,7 @@ class TGRpcClientLow::TContextImpl final      using TContextPtr = std::shared_ptr<TContextImpl>;  public: -    ~TContextImpl() override { +    ~TContextImpl() override {           Y_VERIFY(CountChildren() == 0,                  "Destructor called with non-empty children"); diff --git a/library/cpp/grpc/server/grpc_request.h b/library/cpp/grpc/server/grpc_request.h index 5bd8d3902b5..659d3868d84 100644 --- a/library/cpp/grpc/server/grpc_request.h +++ b/library/cpp/grpc/server/grpc_request.h @@ -374,11 +374,11 @@ private:              }              //TODO: Move this in to grpc_request_proxy -            auto maybeDatabase = GetPeerMetaValues(TStringBuf("x-ydb-database")); +            auto maybeDatabase = GetPeerMetaValues(TStringBuf("x-ydb-database"));               if (maybeDatabase.empty()) {                  Counters_->CountRequestsWithoutDatabase();              } -            auto maybeToken = GetPeerMetaValues(TStringBuf("x-ydb-auth-ticket")); +            auto maybeToken = GetPeerMetaValues(TStringBuf("x-ydb-auth-ticket"));               if (maybeToken.empty() || maybeToken[0].empty()) {                  TString db{maybeDatabase ? maybeDatabase[0] : TStringBuf{}};                  Counters_->CountRequestsWithoutToken(); diff --git a/library/cpp/html/escape/escape.cpp b/library/cpp/html/escape/escape.cpp index 5b8ed60f045..8d0b5c2a1ee 100644 --- a/library/cpp/html/escape/escape.cpp +++ b/library/cpp/html/escape/escape.cpp @@ -11,14 +11,14 @@ namespace NHtml {              TStringBuf Entity;          }; -        TReplace Escapable[] = { -            {'"', false, TStringBuf(""")}, -            {'&', true, TStringBuf("&")}, -            {'<', true, TStringBuf("<")}, -            {'>', true, TStringBuf(">")}, +        TReplace Escapable[] = {  +            {'"', false, TStringBuf(""")},  +            {'&', true, TStringBuf("&")},  +            {'<', true, TStringBuf("<")},  +            {'>', true, TStringBuf(">")},           }; -        TString EscapeImpl(const TString& value, bool isText) { +        TString EscapeImpl(const TString& value, bool isText) {               auto ci = value.begin();              // Looking for escapable characters.              for (; ci != value.end(); ++ci) { diff --git a/library/cpp/html/pcdata/pcdata.cpp b/library/cpp/html/pcdata/pcdata.cpp index 740c240fd23..43c150c4bf1 100644 --- a/library/cpp/html/pcdata/pcdata.cpp +++ b/library/cpp/html/pcdata/pcdata.cpp @@ -19,31 +19,31 @@ static void EncodeHtmlPcdataAppendInternal(const TStringBuf str, TString& strout          switch (*s) {              case '\"': -                strout += TStringBuf("""); -                ++s; +                strout += TStringBuf(""");  +                ++s;                   break;              case '<': -                strout += TStringBuf("<"); -                ++s; +                strout += TStringBuf("<");  +                ++s;                   break;              case '>': -                strout += TStringBuf(">"); -                ++s; +                strout += TStringBuf(">");  +                ++s;                   break;              case '\'': -                strout += TStringBuf("'"); -                ++s; +                strout += TStringBuf("'");  +                ++s;                   break;              case '&':                  if (qAmp) -                    strout += TStringBuf("&"); +                    strout += TStringBuf("&");                   else -                    strout += TStringBuf("&"); -                ++s; +                    strout += TStringBuf("&");  +                ++s;                   break;          }      } diff --git a/library/cpp/http/fetch/exthttpcodes.cpp b/library/cpp/http/fetch/exthttpcodes.cpp index acc05650c89..8710b1ba3ac 100644 --- a/library/cpp/http/fetch/exthttpcodes.cpp +++ b/library/cpp/http/fetch/exthttpcodes.cpp @@ -178,89 +178,89 @@ TStringBuf ExtHttpCodeStr(int code) noexcept {      }      switch (code) {          case HTTP_BAD_RESPONSE_HEADER: -            return TStringBuf("Bad response header"); +            return TStringBuf("Bad response header");           case HTTP_CONNECTION_LOST: -            return TStringBuf("Connection lost"); +            return TStringBuf("Connection lost");           case HTTP_BODY_TOO_LARGE: -            return TStringBuf("Body too large"); +            return TStringBuf("Body too large");           case HTTP_ROBOTS_TXT_DISALLOW: -            return TStringBuf("robots.txt disallow"); +            return TStringBuf("robots.txt disallow");           case HTTP_BAD_URL: -            return TStringBuf("Bad url"); +            return TStringBuf("Bad url");           case HTTP_BAD_MIME: -            return TStringBuf("Bad mime type"); +            return TStringBuf("Bad mime type");           case HTTP_DNS_FAILURE: -            return TStringBuf("Dns failure"); +            return TStringBuf("Dns failure");           case HTTP_BAD_STATUS_CODE: -            return TStringBuf("Bad status code"); +            return TStringBuf("Bad status code");           case HTTP_BAD_HEADER_STRING: -            return TStringBuf("Bad header string"); +            return TStringBuf("Bad header string");           case HTTP_BAD_CHUNK: -            return TStringBuf("Bad chunk"); +            return TStringBuf("Bad chunk");           case HTTP_CONNECT_FAILED: -            return TStringBuf("Connect failed"); +            return TStringBuf("Connect failed");           case HTTP_FILTER_DISALLOW: -            return TStringBuf("Filter disallow"); +            return TStringBuf("Filter disallow");           case HTTP_LOCAL_EIO: -            return TStringBuf("Local eio"); +            return TStringBuf("Local eio");           case HTTP_BAD_CONTENT_LENGTH: -            return TStringBuf("Bad content length"); +            return TStringBuf("Bad content length");           case HTTP_BAD_ENCODING: -            return TStringBuf("Bad encoding"); +            return TStringBuf("Bad encoding");           case HTTP_LENGTH_UNKNOWN: -            return TStringBuf("Length unknown"); +            return TStringBuf("Length unknown");           case HTTP_HEADER_EOF: -            return TStringBuf("Header EOF"); +            return TStringBuf("Header EOF");           case HTTP_MESSAGE_EOF: -            return TStringBuf("Message EOF"); +            return TStringBuf("Message EOF");           case HTTP_CHUNK_EOF: -            return TStringBuf("Chunk EOF"); +            return TStringBuf("Chunk EOF");           case HTTP_PAST_EOF: -            return TStringBuf("Past EOF"); +            return TStringBuf("Past EOF");           case HTTP_HEADER_TOO_LARGE: -            return TStringBuf("Header is too large"); +            return TStringBuf("Header is too large");           case HTTP_URL_TOO_LARGE: -            return TStringBuf("Url is too large"); +            return TStringBuf("Url is too large");           case HTTP_INTERRUPTED: -            return TStringBuf("Interrupted"); +            return TStringBuf("Interrupted");           case HTTP_CUSTOM_NOT_MODIFIED: -            return TStringBuf("Signature detector thinks that doc is not modified"); +            return TStringBuf("Signature detector thinks that doc is not modified");           case HTTP_BAD_CONTENT_ENCODING: -            return TStringBuf("Bad content encoding"); +            return TStringBuf("Bad content encoding");           case HTTP_NO_RESOURCES: -            return TStringBuf("No resources"); +            return TStringBuf("No resources");           case HTTP_FETCHER_SHUTDOWN: -            return TStringBuf("Fetcher shutdown"); +            return TStringBuf("Fetcher shutdown");           case HTTP_CHUNK_TOO_LARGE: -            return TStringBuf("Chunk size is too big"); +            return TStringBuf("Chunk size is too big");           case HTTP_SERVER_BUSY: -            return TStringBuf("Server is busy"); +            return TStringBuf("Server is busy");           case HTTP_SERVICE_UNKNOWN: -            return TStringBuf("Service is unknown"); +            return TStringBuf("Service is unknown");           case HTTP_PROXY_UNKNOWN: -            return TStringBuf("Zora: unknown error"); +            return TStringBuf("Zora: unknown error");           case HTTP_PROXY_REQUEST_TIME_OUT: -            return TStringBuf("Zora: request time out"); +            return TStringBuf("Zora: request time out");           case HTTP_PROXY_INTERNAL_ERROR: -            return TStringBuf("Zora: internal server error"); +            return TStringBuf("Zora: internal server error");           case HTTP_PROXY_CONNECT_FAILED: -            return TStringBuf("Spider proxy connect failed"); +            return TStringBuf("Spider proxy connect failed");           case HTTP_PROXY_CONNECTION_LOST: -            return TStringBuf("Spider proxy connection lost"); +            return TStringBuf("Spider proxy connection lost");           case HTTP_PROXY_NO_PROXY: -            return TStringBuf("Spider proxy no proxy alive in region"); +            return TStringBuf("Spider proxy no proxy alive in region");           case HTTP_PROXY_ERROR: -            return TStringBuf("Spider proxy returned custom error"); +            return TStringBuf("Spider proxy returned custom error");           case HTTP_SSL_ERROR: -            return TStringBuf("Ssl library returned error"); +            return TStringBuf("Ssl library returned error");           case HTTP_CACHED_COPY_NOT_FOUND: -            return TStringBuf("Cached copy for the url is not available"); +            return TStringBuf("Cached copy for the url is not available");           case HTTP_TIMEDOUT_WHILE_BYTES_RECEIVING: -            return TStringBuf("Timed out while bytes receiving"); +            return TStringBuf("Timed out while bytes receiving");               // TODO: messages for >2000 codes          default: -            return TStringBuf("Unknown HTTP code"); +            return TStringBuf("Unknown HTTP code");       }  } diff --git a/library/cpp/http/fetch/httpload.h b/library/cpp/http/fetch/httpload.h index e22e4b809ea..1f9530af79c 100644 --- a/library/cpp/http/fetch/httpload.h +++ b/library/cpp/http/fetch/httpload.h @@ -103,7 +103,7 @@ public:  /********************************************************/  // Here is httpAgent that uses socketAbstractHandler class  // ant its derivatives -using httpSpecialAgent = THttpAgent<TSocketHandlerPtr>; +using httpSpecialAgent = THttpAgent<TSocketHandlerPtr>;   /********************************************************/  // Regular handler is used as implementation of diff --git a/library/cpp/http/io/headers.h b/library/cpp/http/io/headers.h index a71793d1c68..133adc3ddbb 100644 --- a/library/cpp/http/io/headers.h +++ b/library/cpp/http/io/headers.h @@ -35,7 +35,7 @@ public:      /// Возвращает строку "имя параметра: значение".      inline TString ToString() const { -        return Name_ + TStringBuf(": ") + Value_; +        return Name_ + TStringBuf(": ") + Value_;       }  private: diff --git a/library/cpp/http/io/headers_ut.cpp b/library/cpp/http/io/headers_ut.cpp index 1d23ef8fdcb..34f22704219 100644 --- a/library/cpp/http/io/headers_ut.cpp +++ b/library/cpp/http/io/headers_ut.cpp @@ -9,7 +9,7 @@  namespace {      class THeadersExistence {      public: -        THeadersExistence() = default; +        THeadersExistence() = default;           THeadersExistence(const THttpHeaders& headers) {              for (THttpHeaders::TConstIterator it = headers.Begin(); @@ -155,7 +155,7 @@ void THttpHeadersTest::TestAddHeaderTemplateness() {      THttpHeaders h1;      h1.AddHeader("h1", "v1");      h1.AddHeader("h2", TString("v2")); -    h1.AddHeader("h3", TStringBuf("v3")); +    h1.AddHeader("h3", TStringBuf("v3"));       h1.AddHeader("h4", TStringBuf("v4"));      THeadersExistence h2; diff --git a/library/cpp/http/io/stream.cpp b/library/cpp/http/io/stream.cpp index 6689be684fc..966c9378326 100644 --- a/library/cpp/http/io/stream.cpp +++ b/library/cpp/http/io/stream.cpp @@ -27,15 +27,15 @@          if (!stricmp((header).Name().data(), str))  namespace { -    inline size_t SuggestBufferSize() { +    inline size_t SuggestBufferSize() {           return 8192;      } -    inline TStringBuf Trim(const char* b, const char* e) noexcept { +    inline TStringBuf Trim(const char* b, const char* e) noexcept {           return StripString(TStringBuf(b, e));      } -    inline TStringBuf RmSemiColon(const TStringBuf& s) { +    inline TStringBuf RmSemiColon(const TStringBuf& s) {           return s.Before(';');      } @@ -235,7 +235,7 @@ private:      struct TTrEnc {          inline void operator()(const TStringBuf& s) { -            if (s == TStringBuf("chunked")) { +            if (s == TStringBuf("chunked")) {                   p->Chunked = true;              }          } @@ -642,7 +642,7 @@ private:      inline bool HasResponseBody() const noexcept {          if (IsHttpResponse()) { -            if (Request_ && Request_->FirstLine().StartsWith(TStringBuf("HEAD"))) +            if (Request_ && Request_->FirstLine().StartsWith(TStringBuf("HEAD")))                   return false;              if (FirstLine_.size() > 9 && strncmp(FirstLine_.data() + 9, "204", 3) == 0)                  return false; @@ -815,13 +815,13 @@ private:              const THttpInputHeader& header = *h;              const TString hl = to_lower(header.Name()); -            if (hl == TStringBuf("connection")) { -                keepAlive = to_lower(header.Value()) == TStringBuf("keep-alive"); -            } else if (IsCompressionHeaderEnabled() && hl == TStringBuf("content-encoding")) { +            if (hl == TStringBuf("connection")) {  +                keepAlive = to_lower(header.Value()) == TStringBuf("keep-alive");  +            } else if (IsCompressionHeaderEnabled() && hl == TStringBuf("content-encoding")) {                   encoder = TCompressionCodecFactory::Instance().FindEncoder(to_lower(header.Value())); -            } else if (hl == TStringBuf("transfer-encoding")) { -                chunked = to_lower(header.Value()) == TStringBuf("chunked"); -            } else if (hl == TStringBuf("content-length")) { +            } else if (hl == TStringBuf("transfer-encoding")) {  +                chunked = to_lower(header.Value()) == TStringBuf("chunked");  +            } else if (hl == TStringBuf("content-length")) {                   haveContentLength = true;              }          } @@ -980,17 +980,17 @@ void SendMinimalHttpRequest(TSocket& s, const TStringBuf& host, const TStringBuf      output.EnableCompression(false);      const IOutputStream::TPart parts[] = { -        IOutputStream::TPart(TStringBuf("GET ")), +        IOutputStream::TPart(TStringBuf("GET ")),           IOutputStream::TPart(request), -        IOutputStream::TPart(TStringBuf(" HTTP/1.1")), +        IOutputStream::TPart(TStringBuf(" HTTP/1.1")),           IOutputStream::TPart::CrLf(), -        IOutputStream::TPart(TStringBuf("Host: ")), +        IOutputStream::TPart(TStringBuf("Host: ")),           IOutputStream::TPart(host),          IOutputStream::TPart::CrLf(), -        IOutputStream::TPart(TStringBuf("User-Agent: ")), +        IOutputStream::TPart(TStringBuf("User-Agent: ")),           IOutputStream::TPart(agent),          IOutputStream::TPart::CrLf(), -        IOutputStream::TPart(TStringBuf("From: ")), +        IOutputStream::TPart(TStringBuf("From: ")),           IOutputStream::TPart(from),          IOutputStream::TPart::CrLf(),          IOutputStream::TPart::CrLf(), diff --git a/library/cpp/http/io/stream_ut.cpp b/library/cpp/http/io/stream_ut.cpp index 1ea35df675a..2256eb9f718 100644 --- a/library/cpp/http/io/stream_ut.cpp +++ b/library/cpp/http/io/stream_ut.cpp @@ -634,7 +634,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {              }          private: -            TString Data_{TStringBuf("HEAD / HTTP/1.1\r\nHost: yandex.ru\r\n\r\n")}; +            TString Data_{TStringBuf("HEAD / HTTP/1.1\r\nHost: yandex.ru\r\n\r\n")};               size_t Pos_{0};              bool Eof_{false};          }; @@ -662,7 +662,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {          out << "";          out.Finish();          TString result = outBuf.Str(); -        UNIT_ASSERT(!result.Contains(TStringBuf("0\r\n"))); +        UNIT_ASSERT(!result.Contains(TStringBuf("0\r\n")));       }      Y_UNIT_TEST(TestHttpOutputDisableCompressionHeader) { diff --git a/library/cpp/http/io/stream_ut_medium.cpp b/library/cpp/http/io/stream_ut_medium.cpp index 2c125eb21e4..c1e42b97d1e 100644 --- a/library/cpp/http/io/stream_ut_medium.cpp +++ b/library/cpp/http/io/stream_ut_medium.cpp @@ -7,11 +7,11 @@ Y_UNIT_TEST_SUITE(THttpTestMedium) {          TStringBuf data = "aaaaaaaaaaaaaaaaaaaaaaa";          for (auto codec : SupportedCodings()) { -            if (codec == TStringBuf("z-zlib-0")) { +            if (codec == TStringBuf("z-zlib-0")) {                   continue;              } -            if (codec == TStringBuf("z-null")) { +            if (codec == TStringBuf("z-null")) {                   continue;              } diff --git a/library/cpp/http/misc/http_headers.h b/library/cpp/http/misc/http_headers.h index ff359937fa8..9c17ef1c665 100644 --- a/library/cpp/http/misc/http_headers.h +++ b/library/cpp/http/misc/http_headers.h @@ -9,64 +9,64 @@   * https://github.com/spring-projects/spring-framework/blob/816bbee8de584676250e2bc5dcff6da6cd81623f/spring-web/src/main/java/org/springframework/http/HttpHeaders.java   */  namespace NHttpHeaders { -    constexpr TStringBuf ACCEPT = "Accept"; -    constexpr TStringBuf ACCEPT_CHARSET = "Accept-Charset"; -    constexpr TStringBuf ACCEPT_ENCODING = "Accept-Encoding"; -    constexpr TStringBuf ACCEPT_LANGUAGE = "Accept-Language"; -    constexpr TStringBuf ACCEPT_RANGES = "Accept-Ranges"; -    constexpr TStringBuf ACCESS_CONTROL_ALLOW_CREDENTIALS = "Access-Control-Allow-Credentials"; -    constexpr TStringBuf ACCESS_CONTROL_ALLOW_HEADERS = "Access-Control-Allow-Headers"; -    constexpr TStringBuf ACCESS_CONTROL_ALLOW_METHODS = "Access-Control-Allow-Methods"; -    constexpr TStringBuf ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin"; -    constexpr TStringBuf ACCESS_CONTROL_EXPOSE_HEADERS = "Access-Control-Expose-Headers"; -    constexpr TStringBuf ACCESS_CONTROL_MAX_AGE = "Access-Control-Max-Age"; -    constexpr TStringBuf ACCESS_CONTROL_REQUEST_HEADERS = "Access-Control-Request-Headers"; -    constexpr TStringBuf ACCESS_CONTROL_REQUEST_METHOD = "Access-Control-Request-Method"; -    constexpr TStringBuf AGE = "Age"; -    constexpr TStringBuf ALLOW = "Allow"; -    constexpr TStringBuf AUTHORIZATION = "Authorization"; -    constexpr TStringBuf CACHE_CONTROL = "Cache-Control"; -    constexpr TStringBuf CONNECTION = "Connection"; -    constexpr TStringBuf CONTENT_ENCODING = "Content-Encoding"; -    constexpr TStringBuf CONTENT_DISPOSITION = "Content-Disposition"; -    constexpr TStringBuf CONTENT_LANGUAGE = "Content-Language"; -    constexpr TStringBuf CONTENT_LENGTH = "Content-Length"; -    constexpr TStringBuf CONTENT_LOCATION = "Content-Location"; -    constexpr TStringBuf CONTENT_RANGE = "Content-Range"; -    constexpr TStringBuf CONTENT_TYPE = "Content-Type"; -    constexpr TStringBuf COOKIE = "Cookie"; -    constexpr TStringBuf DATE = "Date"; -    constexpr TStringBuf ETAG = "ETag"; -    constexpr TStringBuf EXPECT = "Expect"; -    constexpr TStringBuf EXPIRES = "Expires"; -    constexpr TStringBuf FROM = "From"; -    constexpr TStringBuf HOST = "Host"; -    constexpr TStringBuf IF_MATCH = "If-Match"; -    constexpr TStringBuf IF_MODIFIED_SINCE = "If-Modified-Since"; -    constexpr TStringBuf IF_NONE_MATCH = "If-None-Match"; -    constexpr TStringBuf IF_RANGE = "If-Range"; -    constexpr TStringBuf IF_UNMODIFIED_SINCE = "If-Unmodified-Since"; -    constexpr TStringBuf LAST_MODIFIED = "Last-Modified"; -    constexpr TStringBuf LINK = "Link"; -    constexpr TStringBuf LOCATION = "Location"; -    constexpr TStringBuf MAX_FORWARDS = "Max-Forwards"; -    constexpr TStringBuf ORIGIN = "Origin"; -    constexpr TStringBuf PRAGMA = "Pragma"; -    constexpr TStringBuf PROXY_AUTHENTICATE = "Proxy-Authenticate"; -    constexpr TStringBuf PROXY_AUTHORIZATION = "Proxy-Authorization"; -    constexpr TStringBuf RANGE = "Range"; -    constexpr TStringBuf REFERER = "Referer"; -    constexpr TStringBuf RETRY_AFTER = "Retry-After"; -    constexpr TStringBuf SERVER = "Server"; -    constexpr TStringBuf SET_COOKIE = "Set-Cookie"; -    constexpr TStringBuf SET_COOKIE2 = "Set-Cookie2"; -    constexpr TStringBuf TE = "TE"; -    constexpr TStringBuf TRAILER = "Trailer"; -    constexpr TStringBuf TRANSFER_ENCODING = "Transfer-Encoding"; -    constexpr TStringBuf UPGRADE = "Upgrade"; -    constexpr TStringBuf USER_AGENT = "User-Agent"; -    constexpr TStringBuf VARY = "Vary"; -    constexpr TStringBuf VIA = "Via"; -    constexpr TStringBuf WARNING = "Warning"; -    constexpr TStringBuf WWW_AUTHENTICATE = "WWW-Authenticate"; +    constexpr TStringBuf ACCEPT = "Accept";  +    constexpr TStringBuf ACCEPT_CHARSET = "Accept-Charset";  +    constexpr TStringBuf ACCEPT_ENCODING = "Accept-Encoding";  +    constexpr TStringBuf ACCEPT_LANGUAGE = "Accept-Language";  +    constexpr TStringBuf ACCEPT_RANGES = "Accept-Ranges";  +    constexpr TStringBuf ACCESS_CONTROL_ALLOW_CREDENTIALS = "Access-Control-Allow-Credentials";  +    constexpr TStringBuf ACCESS_CONTROL_ALLOW_HEADERS = "Access-Control-Allow-Headers";  +    constexpr TStringBuf ACCESS_CONTROL_ALLOW_METHODS = "Access-Control-Allow-Methods";  +    constexpr TStringBuf ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin";  +    constexpr TStringBuf ACCESS_CONTROL_EXPOSE_HEADERS = "Access-Control-Expose-Headers";  +    constexpr TStringBuf ACCESS_CONTROL_MAX_AGE = "Access-Control-Max-Age";  +    constexpr TStringBuf ACCESS_CONTROL_REQUEST_HEADERS = "Access-Control-Request-Headers";  +    constexpr TStringBuf ACCESS_CONTROL_REQUEST_METHOD = "Access-Control-Request-Method";  +    constexpr TStringBuf AGE = "Age";  +    constexpr TStringBuf ALLOW = "Allow";  +    constexpr TStringBuf AUTHORIZATION = "Authorization";  +    constexpr TStringBuf CACHE_CONTROL = "Cache-Control";  +    constexpr TStringBuf CONNECTION = "Connection";  +    constexpr TStringBuf CONTENT_ENCODING = "Content-Encoding";  +    constexpr TStringBuf CONTENT_DISPOSITION = "Content-Disposition";  +    constexpr TStringBuf CONTENT_LANGUAGE = "Content-Language";  +    constexpr TStringBuf CONTENT_LENGTH = "Content-Length";  +    constexpr TStringBuf CONTENT_LOCATION = "Content-Location";  +    constexpr TStringBuf CONTENT_RANGE = "Content-Range";  +    constexpr TStringBuf CONTENT_TYPE = "Content-Type";  +    constexpr TStringBuf COOKIE = "Cookie";  +    constexpr TStringBuf DATE = "Date";  +    constexpr TStringBuf ETAG = "ETag";  +    constexpr TStringBuf EXPECT = "Expect";  +    constexpr TStringBuf EXPIRES = "Expires";  +    constexpr TStringBuf FROM = "From";  +    constexpr TStringBuf HOST = "Host";  +    constexpr TStringBuf IF_MATCH = "If-Match";  +    constexpr TStringBuf IF_MODIFIED_SINCE = "If-Modified-Since";  +    constexpr TStringBuf IF_NONE_MATCH = "If-None-Match";  +    constexpr TStringBuf IF_RANGE = "If-Range";  +    constexpr TStringBuf IF_UNMODIFIED_SINCE = "If-Unmodified-Since";  +    constexpr TStringBuf LAST_MODIFIED = "Last-Modified";  +    constexpr TStringBuf LINK = "Link";  +    constexpr TStringBuf LOCATION = "Location";  +    constexpr TStringBuf MAX_FORWARDS = "Max-Forwards";  +    constexpr TStringBuf ORIGIN = "Origin";  +    constexpr TStringBuf PRAGMA = "Pragma";  +    constexpr TStringBuf PROXY_AUTHENTICATE = "Proxy-Authenticate";  +    constexpr TStringBuf PROXY_AUTHORIZATION = "Proxy-Authorization";  +    constexpr TStringBuf RANGE = "Range";  +    constexpr TStringBuf REFERER = "Referer";  +    constexpr TStringBuf RETRY_AFTER = "Retry-After";  +    constexpr TStringBuf SERVER = "Server";  +    constexpr TStringBuf SET_COOKIE = "Set-Cookie";  +    constexpr TStringBuf SET_COOKIE2 = "Set-Cookie2";  +    constexpr TStringBuf TE = "TE";  +    constexpr TStringBuf TRAILER = "Trailer";  +    constexpr TStringBuf TRANSFER_ENCODING = "Transfer-Encoding";  +    constexpr TStringBuf UPGRADE = "Upgrade";  +    constexpr TStringBuf USER_AGENT = "User-Agent";  +    constexpr TStringBuf VARY = "Vary";  +    constexpr TStringBuf VIA = "Via";  +    constexpr TStringBuf WARNING = "Warning";  +    constexpr TStringBuf WWW_AUTHENTICATE = "WWW-Authenticate";   } // namespace HttpHeaders diff --git a/library/cpp/http/misc/httpcodes.cpp b/library/cpp/http/misc/httpcodes.cpp index ad8c80ac1e5..2514be1fa3c 100644 --- a/library/cpp/http/misc/httpcodes.cpp +++ b/library/cpp/http/misc/httpcodes.cpp @@ -3,139 +3,139 @@  TStringBuf HttpCodeStrEx(int code) noexcept {      switch (code) {          case HTTP_CONTINUE: -            return TStringBuf("100 Continue"); +            return TStringBuf("100 Continue");           case HTTP_SWITCHING_PROTOCOLS: -            return TStringBuf("101 Switching protocols"); +            return TStringBuf("101 Switching protocols");           case HTTP_PROCESSING: -            return TStringBuf("102 Processing"); +            return TStringBuf("102 Processing");           case HTTP_OK: -            return TStringBuf("200 Ok"); +            return TStringBuf("200 Ok");           case HTTP_CREATED: -            return TStringBuf("201 Created"); +            return TStringBuf("201 Created");           case HTTP_ACCEPTED: -            return TStringBuf("202 Accepted"); +            return TStringBuf("202 Accepted");           case HTTP_NON_AUTHORITATIVE_INFORMATION: -            return TStringBuf("203 None authoritative information"); +            return TStringBuf("203 None authoritative information");           case HTTP_NO_CONTENT: -            return TStringBuf("204 No content"); +            return TStringBuf("204 No content");           case HTTP_RESET_CONTENT: -            return TStringBuf("205 Reset content"); +            return TStringBuf("205 Reset content");           case HTTP_PARTIAL_CONTENT: -            return TStringBuf("206 Partial content"); +            return TStringBuf("206 Partial content");           case HTTP_MULTI_STATUS: -            return TStringBuf("207 Multi status"); +            return TStringBuf("207 Multi status");           case HTTP_ALREADY_REPORTED: -            return TStringBuf("208 Already reported"); +            return TStringBuf("208 Already reported");           case HTTP_IM_USED: -            return TStringBuf("226 IM used"); +            return TStringBuf("226 IM used");           case HTTP_MULTIPLE_CHOICES: -            return TStringBuf("300 Multiple choices"); +            return TStringBuf("300 Multiple choices");           case HTTP_MOVED_PERMANENTLY: -            return TStringBuf("301 Moved permanently"); +            return TStringBuf("301 Moved permanently");           case HTTP_FOUND: -            return TStringBuf("302 Moved temporarily"); +            return TStringBuf("302 Moved temporarily");           case HTTP_SEE_OTHER: -            return TStringBuf("303 See other"); +            return TStringBuf("303 See other");           case HTTP_NOT_MODIFIED: -            return TStringBuf("304 Not modified"); +            return TStringBuf("304 Not modified");           case HTTP_USE_PROXY: -            return TStringBuf("305 Use proxy"); +            return TStringBuf("305 Use proxy");           case HTTP_TEMPORARY_REDIRECT: -            return TStringBuf("307 Temporarily redirect"); +            return TStringBuf("307 Temporarily redirect");           case HTTP_PERMANENT_REDIRECT: -            return TStringBuf("308 Permanent redirect"); +            return TStringBuf("308 Permanent redirect");           case HTTP_BAD_REQUEST: -            return TStringBuf("400 Bad request"); +            return TStringBuf("400 Bad request");           case HTTP_UNAUTHORIZED: -            return TStringBuf("401 Unauthorized"); +            return TStringBuf("401 Unauthorized");           case HTTP_PAYMENT_REQUIRED: -            return TStringBuf("402 Payment required"); +            return TStringBuf("402 Payment required");           case HTTP_FORBIDDEN: -            return TStringBuf("403 Forbidden"); +            return TStringBuf("403 Forbidden");           case HTTP_NOT_FOUND: -            return TStringBuf("404 Not found"); +            return TStringBuf("404 Not found");           case HTTP_METHOD_NOT_ALLOWED: -            return TStringBuf("405 Method not allowed"); +            return TStringBuf("405 Method not allowed");           case HTTP_NOT_ACCEPTABLE: -            return TStringBuf("406 Not acceptable"); +            return TStringBuf("406 Not acceptable");           case HTTP_PROXY_AUTHENTICATION_REQUIRED: -            return TStringBuf("407 Proxy Authentication required"); +            return TStringBuf("407 Proxy Authentication required");           case HTTP_REQUEST_TIME_OUT: -            return TStringBuf("408 Request time out"); +            return TStringBuf("408 Request time out");           case HTTP_CONFLICT: -            return TStringBuf("409 Conflict"); +            return TStringBuf("409 Conflict");           case HTTP_GONE: -            return TStringBuf("410 Gone"); +            return TStringBuf("410 Gone");           case HTTP_LENGTH_REQUIRED: -            return TStringBuf("411 Length required"); +            return TStringBuf("411 Length required");           case HTTP_PRECONDITION_FAILED: -            return TStringBuf("412 Precondition failed"); +            return TStringBuf("412 Precondition failed");           case HTTP_REQUEST_ENTITY_TOO_LARGE: -            return TStringBuf("413 Request entity too large"); +            return TStringBuf("413 Request entity too large");           case HTTP_REQUEST_URI_TOO_LARGE: -            return TStringBuf("414 Request uri too large"); +            return TStringBuf("414 Request uri too large");           case HTTP_UNSUPPORTED_MEDIA_TYPE: -            return TStringBuf("415 Unsupported media type"); +            return TStringBuf("415 Unsupported media type");           case HTTP_REQUESTED_RANGE_NOT_SATISFIABLE: -            return TStringBuf("416 Requested Range Not Satisfiable"); +            return TStringBuf("416 Requested Range Not Satisfiable");           case HTTP_EXPECTATION_FAILED: -            return TStringBuf("417 Expectation Failed"); +            return TStringBuf("417 Expectation Failed");           case HTTP_I_AM_A_TEAPOT: -            return TStringBuf("418 I Am A Teapot"); +            return TStringBuf("418 I Am A Teapot");           case HTTP_AUTHENTICATION_TIMEOUT: -            return TStringBuf("419 Authentication Timeout"); +            return TStringBuf("419 Authentication Timeout");           case HTTP_MISDIRECTED_REQUEST: -            return TStringBuf("421 Misdirected Request"); +            return TStringBuf("421 Misdirected Request");           case HTTP_UNPROCESSABLE_ENTITY: -            return TStringBuf("422 Unprocessable Entity"); +            return TStringBuf("422 Unprocessable Entity");           case HTTP_LOCKED: -            return TStringBuf("423 Locked"); +            return TStringBuf("423 Locked");           case HTTP_FAILED_DEPENDENCY: -            return TStringBuf("424 Failed Dependency"); +            return TStringBuf("424 Failed Dependency");           case HTTP_UNORDERED_COLLECTION: -            return TStringBuf("425 Unordered Collection"); +            return TStringBuf("425 Unordered Collection");           case HTTP_UPGRADE_REQUIRED: -            return TStringBuf("426 Upgrade Required"); +            return TStringBuf("426 Upgrade Required");           case HTTP_PRECONDITION_REQUIRED: -            return TStringBuf("428 Precondition Required"); +            return TStringBuf("428 Precondition Required");           case HTTP_TOO_MANY_REQUESTS: -            return TStringBuf("429 Too Many Requests"); +            return TStringBuf("429 Too Many Requests");           case HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE: -            return TStringBuf("431 Request Header Fields Too Large"); +            return TStringBuf("431 Request Header Fields Too Large");           case HTTP_UNAVAILABLE_FOR_LEGAL_REASONS: -            return TStringBuf("451 Unavailable For Legal Reason"); +            return TStringBuf("451 Unavailable For Legal Reason");           case HTTP_INTERNAL_SERVER_ERROR: -            return TStringBuf("500 Internal server error"); +            return TStringBuf("500 Internal server error");           case HTTP_NOT_IMPLEMENTED: -            return TStringBuf("501 Not implemented"); +            return TStringBuf("501 Not implemented");           case HTTP_BAD_GATEWAY: -            return TStringBuf("502 Bad gateway"); +            return TStringBuf("502 Bad gateway");           case HTTP_SERVICE_UNAVAILABLE: -            return TStringBuf("503 Service unavailable"); +            return TStringBuf("503 Service unavailable");           case HTTP_GATEWAY_TIME_OUT: -            return TStringBuf("504 Gateway time out"); +            return TStringBuf("504 Gateway time out");           case HTTP_HTTP_VERSION_NOT_SUPPORTED: -            return TStringBuf("505 HTTP version not supported"); +            return TStringBuf("505 HTTP version not supported");           case HTTP_VARIANT_ALSO_NEGOTIATES: -            return TStringBuf("506 Variant also negotiates"); +            return TStringBuf("506 Variant also negotiates");           case HTTP_INSUFFICIENT_STORAGE: -            return TStringBuf("507 Insufficient storage"); +            return TStringBuf("507 Insufficient storage");           case HTTP_LOOP_DETECTED: -            return TStringBuf("508 Loop Detected"); +            return TStringBuf("508 Loop Detected");           case HTTP_BANDWIDTH_LIMIT_EXCEEDED: -            return TStringBuf("509 Bandwidth Limit Exceeded"); +            return TStringBuf("509 Bandwidth Limit Exceeded");           case HTTP_NOT_EXTENDED: -            return TStringBuf("510 Not Extended"); +            return TStringBuf("510 Not Extended");           case HTTP_NETWORK_AUTHENTICATION_REQUIRED: -            return TStringBuf("511 Network Authentication Required"); +            return TStringBuf("511 Network Authentication Required");           case HTTP_UNASSIGNED_512: -            return TStringBuf("512 Unassigned"); +            return TStringBuf("512 Unassigned");           default: -            return TStringBuf("000 Unknown HTTP code"); +            return TStringBuf("000 Unknown HTTP code");       }  } diff --git a/library/cpp/http/misc/httpreqdata.cpp b/library/cpp/http/misc/httpreqdata.cpp index f6951f68cd9..0d3ed0ecee7 100644 --- a/library/cpp/http/misc/httpreqdata.cpp +++ b/library/cpp/http/misc/httpreqdata.cpp @@ -64,7 +64,7 @@ const char* TBaseServerRequestData::RemoteAddr() const {      return Addr;  } -const char* TBaseServerRequestData::HeaderIn(TStringBuf key) const { +const char* TBaseServerRequestData::HeaderIn(TStringBuf key) const {       auto it = HeadersIn_.find(key);      if (it == HeadersIn_.end()) { @@ -86,7 +86,7 @@ TString TBaseServerRequestData::HeaderByIndex(size_t n) const noexcept {          --n;      } -    return TString(i->first) + TStringBuf(": ") + i->second; +    return TString(i->first) + TStringBuf(": ") + i->second;   }  const char* TBaseServerRequestData::Environment(const char* key) const { diff --git a/library/cpp/http/misc/httpreqdata.h b/library/cpp/http/misc/httpreqdata.h index 16e59c4d78c..938a8f54e1d 100644 --- a/library/cpp/http/misc/httpreqdata.h +++ b/library/cpp/http/misc/httpreqdata.h @@ -58,7 +58,7 @@ public:      void AppendQueryString(const char* str, size_t length);      const char* RemoteAddr() const;      void SetRemoteAddr(TStringBuf addr); -    const char* HeaderIn(TStringBuf key) const; +    const char* HeaderIn(TStringBuf key) const;       const THttpHeadersContainer& HeadersIn() const {          return HeadersIn_; diff --git a/library/cpp/http/misc/httpreqdata_ut.cpp b/library/cpp/http/misc/httpreqdata_ut.cpp index e7f16ef27c8..13e493a76f9 100644 --- a/library/cpp/http/misc/httpreqdata_ut.cpp +++ b/library/cpp/http/misc/httpreqdata_ut.cpp @@ -13,8 +13,8 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {          sd.AddHeader("x-XxX", "y-yyy");          UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 2); -        UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-XX")), TStringBuf("y-yy")); -        UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-XXX")), TStringBuf("y-yyy")); +        UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-XX")), TStringBuf("y-yy"));  +        UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-XXX")), TStringBuf("y-yyy"));       }      Y_UNIT_TEST(ComplexHeaders) { @@ -23,21 +23,21 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {          sd.AddHeader("x-Xx", "y-yy");          UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 1); -        UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-XX")), TStringBuf("y-yy")); +        UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-XX")), TStringBuf("y-yy"));           sd.AddHeader("x-Xz", "y-yy");          UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 2); -        UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-Xz")), TStringBuf("y-yy")); +        UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-Xz")), TStringBuf("y-yy"));           UNIT_ASSERT_VALUES_EQUAL(sd.ServerName(), "zzz");          UNIT_ASSERT_VALUES_EQUAL(sd.ServerPort(), "1");          sd.AddHeader("Host", "1234");          UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 3); -        UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("Host")), TStringBuf("1234")); +        UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("Host")), TStringBuf("1234"));           UNIT_ASSERT_VALUES_EQUAL(sd.ServerName(), "1234");          sd.AddHeader("Host", "12345:678");          UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 3); -        UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("Host")), TStringBuf("12345:678")); +        UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("Host")), TStringBuf("12345:678"));           UNIT_ASSERT_VALUES_EQUAL(sd.ServerName(), "12345");          UNIT_ASSERT_VALUES_EQUAL(sd.ServerPort(), "678");      } @@ -122,7 +122,7 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {          UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), qs);          UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), rd.OrigQueryStringBuf()); -        constexpr TStringBuf appendix = "gta=true>a=new"; +        constexpr TStringBuf appendix = "gta=true>a=new";           rd.AppendQueryString(appendix.data(), appendix.size());          UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), qs + '&' + appendix); diff --git a/library/cpp/http/server/options.cpp b/library/cpp/http/server/options.cpp index 05c954384a2..0d645b9d73a 100644 --- a/library/cpp/http/server/options.cpp +++ b/library/cpp/http/server/options.cpp @@ -7,14 +7,14 @@  #include <util/generic/hash_set.h>  #include <util/generic/yexception.h> -using TAddr = THttpServerOptions::TAddr; +using TAddr = THttpServerOptions::TAddr;   static inline TString AddrToString(const TAddr& addr) {      return addr.Addr + ":" + ToString(addr.Port);  }  static inline TNetworkAddress ToNetworkAddr(const TString& address, ui16 port) { -    if (address.empty() || address == TStringBuf("*")) { +    if (address.empty() || address == TStringBuf("*")) {           return TNetworkAddress(port);      } diff --git a/library/cpp/http/server/response.cpp b/library/cpp/http/server/response.cpp index 52d64c91cec..28581427e1d 100644 --- a/library/cpp/http/server/response.cpp +++ b/library/cpp/http/server/response.cpp @@ -25,14 +25,14 @@ void THttpResponse::OutTo(IOutputStream& os) const {      parts.reserve(FIRST_LINE_PARTS + HEADERS_PARTS + CONTENT_PARTS);      // first line -    parts.push_back(IOutputStream::TPart(TStringBuf("HTTP/1.1 "))); +    parts.push_back(IOutputStream::TPart(TStringBuf("HTTP/1.1 ")));       parts.push_back(IOutputStream::TPart(HttpCodeStrEx(Code)));      parts.push_back(IOutputStream::TPart::CrLf());      // headers      for (THttpHeaders::TConstIterator i = Headers.Begin(); i != Headers.End(); ++i) {          parts.push_back(IOutputStream::TPart(i->Name())); -        parts.push_back(IOutputStream::TPart(TStringBuf(": "))); +        parts.push_back(IOutputStream::TPart(TStringBuf(": ")));           parts.push_back(IOutputStream::TPart(i->Value()));          parts.push_back(IOutputStream::TPart::CrLf());      } @@ -44,7 +44,7 @@ void THttpResponse::OutTo(IOutputStream& os) const {          mo << Content.size(); -        parts.push_back(IOutputStream::TPart(TStringBuf("Content-Length: "))); +        parts.push_back(IOutputStream::TPart(TStringBuf("Content-Length: ")));           parts.push_back(IOutputStream::TPart(buf, mo.Buf() - buf));          parts.push_back(IOutputStream::TPart::CrLf());      } diff --git a/library/cpp/int128/int128.h b/library/cpp/int128/int128.h index f1121fc0c61..7a21021bcd1 100644 --- a/library/cpp/int128/int128.h +++ b/library/cpp/int128/int128.h @@ -1030,7 +1030,7 @@ inline ui128 FromStringImpl<ui128>(const char* data, size_t length) {          const TStringBuf string(data, length);          for (auto&& c : string) {              if (!std::isdigit(c)) { -                ythrow TFromStringException() << "Unexpected symbol \""sv << c << "\""sv; +                ythrow TFromStringException() << "Unexpected symbol \""sv << c << "\""sv;               }              ui128 x1 = result; @@ -1042,7 +1042,7 @@ inline ui128 FromStringImpl<ui128>(const char* data, size_t length) {              result = x10 + s;              if (GetHigh(result) < GetHigh(x1)) { -                ythrow TFromStringException() << TStringBuf("Integer overflow"); +                ythrow TFromStringException() << TStringBuf("Integer overflow");               }          } @@ -1237,7 +1237,7 @@ inline i128 FromStringImpl<i128>(const char* data, size_t length) {          const TStringBuf string(data, length);          for (auto&& c : string) {              if (!std::isdigit(c)) { -                ythrow TFromStringException() << "Unexpected symbol \""sv << c << "\""sv; +                ythrow TFromStringException() << "Unexpected symbol \""sv << c << "\""sv;               }              i128 x1 = result; @@ -1249,7 +1249,7 @@ inline i128 FromStringImpl<i128>(const char* data, size_t length) {              result = x10 + s;              if (GetHigh(result) < GetHigh(x1)) { -                ythrow TFromStringException() << TStringBuf("Integer overflow"); +                ythrow TFromStringException() << TStringBuf("Integer overflow");               }          } diff --git a/library/cpp/ipmath/ipmath.cpp b/library/cpp/ipmath/ipmath.cpp index b8cca00c805..3ed365c16c6 100644 --- a/library/cpp/ipmath/ipmath.cpp +++ b/library/cpp/ipmath/ipmath.cpp @@ -10,11 +10,11 @@ namespace {      TStringBuf TypeToString(TIpv6Address::TIpType type) {          switch (type) {              case TIpv6Address::Ipv4: -                return TStringBuf("IPv4"); +                return TStringBuf("IPv4");               case TIpv6Address::Ipv6: -                return TStringBuf("IPv6"); +                return TStringBuf("IPv6");               default: -                return TStringBuf("UNKNOWN"); +                return TStringBuf("UNKNOWN");           }      } diff --git a/library/cpp/json/fast_sax/parser.rl6 b/library/cpp/json/fast_sax/parser.rl6 index edb4e9ee1b3..b7280594d2a 100644 --- a/library/cpp/json/fast_sax/parser.rl6 +++ b/library/cpp/json/fast_sax/parser.rl6 @@ -41,7 +41,7 @@ struct TParserCtx {          return b && e && b <= e;      } -    bool OnError(TStringBuf reason = TStringBuf(""), bool end = false) const { +    bool OnError(TStringBuf reason = TStringBuf(""), bool end = false) const {           size_t off = 0;          TStringBuf token; diff --git a/library/cpp/json/flex_buffers/cvt.cpp b/library/cpp/json/flex_buffers/cvt.cpp index fee0cea0b83..c0c8d97edba 100644 --- a/library/cpp/json/flex_buffers/cvt.cpp +++ b/library/cpp/json/flex_buffers/cvt.cpp @@ -19,49 +19,49 @@ namespace {          {          } -        bool OnNull() override { +        bool OnNull() override {               B.Null();              return true;          } -        bool OnBoolean(bool v) override { +        bool OnBoolean(bool v) override {               B.Bool(v);              return true;          } -        bool OnInteger(long long v) override { +        bool OnInteger(long long v) override {               B.Int(v);              return true;          } -        bool OnUInteger(unsigned long long v) override { +        bool OnUInteger(unsigned long long v) override {               B.UInt(v);              return true;          } -        bool OnDouble(double v) override { +        bool OnDouble(double v) override {               B.Double(v);              return true;          } -        bool OnString(const TStringBuf& v) override { +        bool OnString(const TStringBuf& v) override {               B.String(v.data(), v.size());              return true;          } -        bool OnOpenMap() override { +        bool OnOpenMap() override {               S.push_back(B.StartMap());              return true;          } -        bool OnMapKey(const TStringBuf& v) override { +        bool OnMapKey(const TStringBuf& v) override {               auto iv = P.AppendCString(v);              B.Key(iv.data(), iv.size()); @@ -69,33 +69,33 @@ namespace {              return true;          } -        bool OnCloseMap() override { +        bool OnCloseMap() override {               B.EndMap(PopOffset());              return true;          } -        bool OnOpenArray() override { +        bool OnOpenArray() override {               S.push_back(B.StartVector());              return true;          } -        bool OnCloseArray() override { +        bool OnCloseArray() override {               B.EndVector(PopOffset(), false, false);              return true;          } -        bool OnStringNoCopy(const TStringBuf& s) override { +        bool OnStringNoCopy(const TStringBuf& s) override {               return OnString(s);          } -        bool OnMapKeyNoCopy(const TStringBuf& s) override { +        bool OnMapKeyNoCopy(const TStringBuf& s) override {               return OnMapKey(s);          } -        bool OnEnd() override { +        bool OnEnd() override {               B.Finish();              Y_ENSURE(S.empty()); @@ -103,7 +103,7 @@ namespace {              return true;          } -        void OnError(size_t, TStringBuf reason) override { +        void OnError(size_t, TStringBuf reason) override {               ythrow yexception() << reason;          } diff --git a/library/cpp/json/json_prettifier.cpp b/library/cpp/json/json_prettifier.cpp index bb16aab44e5..e0b5bedf31d 100644 --- a/library/cpp/json/json_prettifier.cpp +++ b/library/cpp/json/json_prettifier.cpp @@ -161,11 +161,11 @@ namespace NJson {          }          bool OnNull() override { -            return WriteVal(TStringBuf("null")); +            return WriteVal(TStringBuf("null"));           }          bool OnBoolean(bool v) override { -            return WriteVal(v ? TStringBuf("true") : TStringBuf("false")); +            return WriteVal(v ? TStringBuf("true") : TStringBuf("false"));           }          bool OnInteger(long long i) override { diff --git a/library/cpp/json/json_reader.cpp b/library/cpp/json/json_reader.cpp index 072c8deafee..8c036566858 100644 --- a/library/cpp/json/json_reader.cpp +++ b/library/cpp/json/json_reader.cpp @@ -14,9 +14,9 @@  namespace NJson {      namespace {          TString PrintError(const rapidjson::ParseResult& result) { -            return TStringBuilder() << TStringBuf("Offset: ") << result.Offset() -                                    << TStringBuf(", Code: ") << (int)result.Code() -                                    << TStringBuf(", Error: ") << GetParseError_En(result.Code()); +            return TStringBuilder() << TStringBuf("Offset: ") << result.Offset()  +                                    << TStringBuf(", Code: ") << (int)result.Code()  +                                    << TStringBuf(", Error: ") << GetParseError_En(result.Code());           }      } diff --git a/library/cpp/json/writer/json.cpp b/library/cpp/json/writer/json.cpp index 02370c2d79e..b5c0d517ea4 100644 --- a/library/cpp/json/writer/json.cpp +++ b/library/cpp/json/writer/json.cpp @@ -214,13 +214,13 @@ namespace NJsonWriter {      }      TValueContext TBuf::WriteNull() { -        UnsafeWriteValue(TStringBuf("null")); +        UnsafeWriteValue(TStringBuf("null"));           return TValueContext(*this);      }      TValueContext TBuf::WriteBool(bool b) { -        constexpr TStringBuf trueVal = "true"; -        constexpr TStringBuf falseVal = "false"; +        constexpr TStringBuf trueVal = "true";  +        constexpr TStringBuf falseVal = "false";           UnsafeWriteValue(b ? trueVal : falseVal);          return TValueContext(*this);      } @@ -323,7 +323,7 @@ namespace NJsonWriter {  #define MATCH(sym, string)                        \      case sym:                                     \          UnsafeWriteRawBytes(beg, cur - beg);      \ -        UnsafeWriteRawBytes(TStringBuf(string));  \ +        UnsafeWriteRawBytes(TStringBuf(string));  \           return true      inline bool TBuf::EscapedWriteChar(const char* beg, const char* cur, EHtmlEscapeMode hem) { diff --git a/library/cpp/json/writer/json_value.cpp b/library/cpp/json/writer/json_value.cpp index c61e8d1dc43..e22f0a0b389 100644 --- a/library/cpp/json/writer/json_value.cpp +++ b/library/cpp/json/writer/json_value.cpp @@ -531,7 +531,7 @@ namespace NJson {              case JSON_NULL:              case JSON_UNDEFINED:              default: -                return false; +                return false;               case JSON_BOOLEAN:                  return Value.Boolean;          } diff --git a/library/cpp/lfalloc/lf_allocX64.h b/library/cpp/lfalloc/lf_allocX64.h index fd2a906d6ff..41284233e53 100644 --- a/library/cpp/lfalloc/lf_allocX64.h +++ b/library/cpp/lfalloc/lf_allocX64.h @@ -31,7 +31,7 @@  #define _win_  #define Y_FORCE_INLINE __forceinline -using TAtomic = volatile long; +using TAtomic = volatile long;   static inline long AtomicAdd(TAtomic& a, long b) {      return _InterlockedExchangeAdd(&a, b) + b; diff --git a/library/cpp/linear_regression/linear_regression.cpp b/library/cpp/linear_regression/linear_regression.cpp index 150f9d214e9..a48eb9661a3 100644 --- a/library/cpp/linear_regression/linear_regression.cpp +++ b/library/cpp/linear_regression/linear_regression.cpp @@ -369,7 +369,7 @@ namespace {  }  namespace { -    inline double ArgMinPrecise(std::function<double(double)> func, double left, double right) { +    inline double ArgMinPrecise(std::function<double(double)> func, double left, double right) {           const size_t intervalsCount = 20;          double points[intervalsCount + 1];          double values[intervalsCount + 1]; diff --git a/library/cpp/linear_regression/linear_regression.h b/library/cpp/linear_regression/linear_regression.h index e57de5ff6cc..a7c56ac3cb1 100644 --- a/library/cpp/linear_regression/linear_regression.h +++ b/library/cpp/linear_regression/linear_regression.h @@ -253,7 +253,7 @@ private:  public:      Y_SAVELOAD_DEFINE(TransformationType, TransformationParameters); -    TFeaturesTransformer() = default; +    TFeaturesTransformer() = default;       TFeaturesTransformer(const ETransformationType transformationType,                           const TTransformationParameters transformationParameters) diff --git a/library/cpp/linear_regression/unimodal.h b/library/cpp/linear_regression/unimodal.h index e11b1118f6c..48d2f3f8e4e 100644 --- a/library/cpp/linear_regression/unimodal.h +++ b/library/cpp/linear_regression/unimodal.h @@ -19,7 +19,7 @@ struct TOptimizationParams {      size_t IterationsCount = 1000; -    TOptimizationParams() = default; +    TOptimizationParams() = default;       static TOptimizationParams Default(const TVector<double>& values) {          TOptimizationParams optimizationParams; diff --git a/library/cpp/logger/global/common.cpp b/library/cpp/logger/global/common.cpp index 4fb05c19b4b..cfb8ccfe2df 100644 --- a/library/cpp/logger/global/common.cpp +++ b/library/cpp/logger/global/common.cpp @@ -15,7 +15,7 @@ namespace NLoggingImpl {              TString newPath = Sprintf("%s_%s_%" PRIu64, logType.data(), NLoggingImpl::GetLocalTimeSSimple().data(), static_cast<ui64>(Now().MicroSeconds()));              TFsPath(logType).RenameTo(newPath);          } -        if (startAsDaemon && (logType == "console"sv || logType == "cout"sv || logType == "cerr"sv)) { +        if (startAsDaemon && (logType == "console"sv || logType == "cout"sv || logType == "cerr"sv)) {               logType = "null";          } diff --git a/library/cpp/logger/global/common.h b/library/cpp/logger/global/common.h index 7dcf650decb..c7949332164 100644 --- a/library/cpp/logger/global/common.h +++ b/library/cpp/logger/global/common.h @@ -69,7 +69,7 @@ namespace NLoggingImpl {      TString GetLocalTimeSSimple();      // Returns correct log type to use -    TString PrepareToOpenLog(TString logType, int logLevel, bool rotation, bool startAsDaemon); +    TString PrepareToOpenLog(TString logType, int logLevel, bool rotation, bool startAsDaemon);       template <class TLoggerType>      void InitLogImpl(TString logType, const int logLevel, const bool rotation, const bool startAsDaemon) { @@ -78,11 +78,11 @@ namespace NLoggingImpl {  }  struct TLogRecordContext { -    constexpr TLogRecordContext(const TSourceLocation& sourceLocation, TStringBuf customMessage, ELogPriority priority) -        : SourceLocation(sourceLocation) -        , CustomMessage(customMessage) -        , Priority(priority) -    {} +    constexpr TLogRecordContext(const TSourceLocation& sourceLocation, TStringBuf customMessage, ELogPriority priority)  +        : SourceLocation(sourceLocation)  +        , CustomMessage(customMessage)  +        , Priority(priority)  +    {}       TSourceLocation SourceLocation;      TStringBuf CustomMessage; diff --git a/library/cpp/lwtrace/rwspinlock.h b/library/cpp/lwtrace/rwspinlock.h index 7c518ec49e4..9d467cd616d 100644 --- a/library/cpp/lwtrace/rwspinlock.h +++ b/library/cpp/lwtrace/rwspinlock.h @@ -84,5 +84,5 @@ struct TRWSpinLockWriteOps {      }  }; -using TReadSpinLockGuard = TGuard<TRWSpinLock, TRWSpinLockReadOps>; -using TWriteSpinLockGuard = TGuard<TRWSpinLock, TRWSpinLockWriteOps>; +using TReadSpinLockGuard = TGuard<TRWSpinLock, TRWSpinLockReadOps>;  +using TWriteSpinLockGuard = TGuard<TRWSpinLock, TRWSpinLockWriteOps>;  diff --git a/library/cpp/lwtrace/trace_ut.cpp b/library/cpp/lwtrace/trace_ut.cpp index cb03e4fbde9..e42d00e4cb5 100644 --- a/library/cpp/lwtrace/trace_ut.cpp +++ b/library/cpp/lwtrace/trace_ut.cpp @@ -462,7 +462,7 @@ Y_UNIT_TEST_SUITE(LWTraceTrace) {                  : TCustomActionExecutor(probe, false /* not destructive */)              {}          private: -            bool DoExecute(TOrbit&, const TParams& params) override { +            bool DoExecute(TOrbit&, const TParams& params) override {                   (void)params;                  nCustomActionsCalls++;                  return true; diff --git a/library/cpp/malloc/api/malloc.cpp b/library/cpp/malloc/api/malloc.cpp index eed1c58a383..a319878b253 100644 --- a/library/cpp/malloc/api/malloc.cpp +++ b/library/cpp/malloc/api/malloc.cpp @@ -4,15 +4,15 @@  #include "malloc.h"  namespace { -    bool SetEmptyParam(const char*, const char*) { +    bool SetEmptyParam(const char*, const char*) {           return false;      } -    const char* GetEmptyParam(const char*) { +    const char* GetEmptyParam(const char*) {           return nullptr;      } -    bool CheckEmptyParam(const char*, bool defaultValue) { +    bool CheckEmptyParam(const char*, bool defaultValue) {           return defaultValue;      }  } diff --git a/library/cpp/malloc/jemalloc/malloc-info.cpp b/library/cpp/malloc/jemalloc/malloc-info.cpp index 2643ca47668..655515b8c29 100644 --- a/library/cpp/malloc/jemalloc/malloc-info.cpp +++ b/library/cpp/malloc/jemalloc/malloc-info.cpp @@ -16,7 +16,7 @@ TMallocInfo NMalloc::MallocInfo() {  #include <contrib/libs/jemalloc/include/jemalloc/jemalloc.h>  namespace { -    bool JESetParam(const char* param, const char*) { +    bool JESetParam(const char* param, const char*) {           if (param) {              if (strcmp(param, "j:reset_epoch") == 0) {                  uint64_t epoch = 1; diff --git a/library/cpp/messagebus/coreconn.h b/library/cpp/messagebus/coreconn.h index fca228d82e8..c509af90552 100644 --- a/library/cpp/messagebus/coreconn.h +++ b/library/cpp/messagebus/coreconn.h @@ -54,7 +54,7 @@ namespace NBus {      struct TMaxConnectedException: public yexception {          TMaxConnectedException(unsigned maxConnect) {              yexception& exc = *this; -            exc << TStringBuf("Exceeded maximum number of outstanding connections: "); +            exc << TStringBuf("Exceeded maximum number of outstanding connections: ");               exc << maxConnect;          }      }; diff --git a/library/cpp/messagebus/rain_check/http/client_ut.cpp b/library/cpp/messagebus/rain_check/http/client_ut.cpp index 16281143911..bb5560debdb 100644 --- a/library/cpp/messagebus/rain_check/http/client_ut.cpp +++ b/library/cpp/messagebus/rain_check/http/client_ut.cpp @@ -182,24 +182,24 @@ Y_UNIT_TEST_SUITE(RainCheckHttpClient) {      UNIT_ASSERT(!!TryGetHttpCodeFromErrorDescription(line));            \      UNIT_ASSERT_EQUAL(*TryGetHttpCodeFromErrorDescription(line), code) -        CHECK_VALID_LINE(TStringBuf("library/cpp/neh/http.cpp:<LINE>: request failed(HTTP/1.0 200 Some random message"), 200); -        CHECK_VALID_LINE(TStringBuf("library/cpp/neh/http.cpp:<LINE>: request failed(HTTP/1.0 404 Some random message"), 404); -        CHECK_VALID_LINE(TStringBuf("request failed(HTTP/1.0 100 Some random message"), 100); -        CHECK_VALID_LINE(TStringBuf("request failed(HTTP/1.0 105)"), 105); -        CHECK_VALID_LINE(TStringBuf("request failed(HTTP/1.1 2004 Some random message"), 200); +        CHECK_VALID_LINE(TStringBuf("library/cpp/neh/http.cpp:<LINE>: request failed(HTTP/1.0 200 Some random message"), 200);  +        CHECK_VALID_LINE(TStringBuf("library/cpp/neh/http.cpp:<LINE>: request failed(HTTP/1.0 404 Some random message"), 404);  +        CHECK_VALID_LINE(TStringBuf("request failed(HTTP/1.0 100 Some random message"), 100);  +        CHECK_VALID_LINE(TStringBuf("request failed(HTTP/1.0 105)"), 105);  +        CHECK_VALID_LINE(TStringBuf("request failed(HTTP/1.1 2004 Some random message"), 200);   #undef CHECK_VALID_LINE  #define CHECK_INVALID_LINE(line)                                        \      UNIT_ASSERT_NO_EXCEPTION(TryGetHttpCodeFromErrorDescription(line)); \      UNIT_ASSERT(!TryGetHttpCodeFromErrorDescription(line)) -        CHECK_INVALID_LINE(TStringBuf("library/cpp/neh/http.cpp:<LINE>: request failed(HTTP/1.1 1 Some random message")); -        CHECK_INVALID_LINE(TStringBuf("request failed(HTTP/1.0 asdf Some random message")); -        CHECK_INVALID_LINE(TStringBuf("HTTP/1.0 200 Some random message")); -        CHECK_INVALID_LINE(TStringBuf("request failed(HTTP/1.0 2x00 Some random message")); -        CHECK_INVALID_LINE(TStringBuf("HTTP/1.0 200 Some random message")); -        CHECK_INVALID_LINE(TStringBuf("HTTP/1.0 200")); -        CHECK_INVALID_LINE(TStringBuf("request failed(HTTP/1.1  3334 Some random message")); +        CHECK_INVALID_LINE(TStringBuf("library/cpp/neh/http.cpp:<LINE>: request failed(HTTP/1.1 1 Some random message"));  +        CHECK_INVALID_LINE(TStringBuf("request failed(HTTP/1.0 asdf Some random message"));  +        CHECK_INVALID_LINE(TStringBuf("HTTP/1.0 200 Some random message"));  +        CHECK_INVALID_LINE(TStringBuf("request failed(HTTP/1.0 2x00 Some random message"));  +        CHECK_INVALID_LINE(TStringBuf("HTTP/1.0 200 Some random message"));  +        CHECK_INVALID_LINE(TStringBuf("HTTP/1.0 200"));  +        CHECK_INVALID_LINE(TStringBuf("request failed(HTTP/1.1  3334 Some random message"));   #undef CHECK_INVALID_LINE      }  } diff --git a/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp b/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp index 51d75762f68..44f515d1c37 100644 --- a/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp +++ b/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp @@ -14,9 +14,9 @@ namespace NRainCheck {          // "library/cpp/neh/http.cpp:<LINE>: request failed(<FIRST-HTTP-RESPONSE-LINE>)"          // (see library/cpp/neh/http.cpp:625). So, we will try to parse this message and          // find out HttpCode in it. It is bad temporary solution, but we have no choice. -        const TStringBuf SUBSTR = "request failed("; +        const TStringBuf SUBSTR = "request failed(";           const size_t SUBSTR_LEN = SUBSTR.size(); -        const size_t FIRST_LINE_LEN = TStringBuf("HTTP/1.X NNN").size(); +        const size_t FIRST_LINE_LEN = TStringBuf("HTTP/1.X NNN").size();           TMaybe<HttpCodes> httpCode; diff --git a/library/cpp/messagebus/remote_connection.cpp b/library/cpp/messagebus/remote_connection.cpp index 22932569dbd..3066a6cceae 100644 --- a/library/cpp/messagebus/remote_connection.cpp +++ b/library/cpp/messagebus/remote_connection.cpp @@ -676,14 +676,14 @@ namespace NBus {          }          namespace { -            inline void WriteHeader(const TBusHeader& header, TBuffer& data) { +            inline void WriteHeader(const TBusHeader& header, TBuffer& data) {                   data.Reserve(data.Size() + sizeof(TBusHeader));                  /// \todo hton instead of memcpy                  memcpy(data.Data() + data.Size(), &header, sizeof(TBusHeader));                  data.Advance(sizeof(TBusHeader));              } -            inline void WriteDummyHeader(TBuffer& data) { +            inline void WriteDummyHeader(TBuffer& data) {                   data.Resize(data.Size() + sizeof(TBusHeader));              } diff --git a/library/cpp/messagebus/test/helper/example.cpp b/library/cpp/messagebus/test/helper/example.cpp index 7c6d704042c..985c135b959 100644 --- a/library/cpp/messagebus/test/helper/example.cpp +++ b/library/cpp/messagebus/test/helper/example.cpp @@ -8,11 +8,11 @@ using namespace NBus;  using namespace NBus::NTest;  static void FillWithJunk(TArrayRef<char> data) { -    TStringBuf junk = +    TStringBuf junk =           "01234567890123456789012345678901234567890123456789012345678901234567890123456789"          "01234567890123456789012345678901234567890123456789012345678901234567890123456789"          "01234567890123456789012345678901234567890123456789012345678901234567890123456789" -        "01234567890123456789012345678901234567890123456789012345678901234567890123456789"; +        "01234567890123456789012345678901234567890123456789012345678901234567890123456789";       for (size_t i = 0; i < data.size(); i += junk.size()) {          memcpy(data.data() + i, junk.data(), Min(junk.size(), data.size() - i)); diff --git a/library/cpp/messagebus/test/perftest/perftest.cpp b/library/cpp/messagebus/test/perftest/perftest.cpp index 84893192789..b8f79b92202 100644 --- a/library/cpp/messagebus/test/perftest/perftest.cpp +++ b/library/cpp/messagebus/test/perftest/perftest.cpp @@ -125,8 +125,8 @@ TConfig Config;  ////////////////////////////////////////////////////////////////  /// \brief Fast message -using TPerftestRequest = TBusBufferMessage<TPerftestRequestRecord, 77>; -using TPerftestResponse = TBusBufferMessage<TPerftestResponseRecord, 79>; +using TPerftestRequest = TBusBufferMessage<TPerftestRequestRecord, 77>;  +using TPerftestResponse = TBusBufferMessage<TPerftestResponseRecord, 79>;   static size_t RequestSize() {      return RandomNumber<size_t>(TheConfig->MessageSize * 2 + 1); diff --git a/library/cpp/messagebus/test/ut/one_way_ut.cpp b/library/cpp/messagebus/test/ut/one_way_ut.cpp index 9c21227e2bd..5ff09b74ed0 100644 --- a/library/cpp/messagebus/test/ut/one_way_ut.cpp +++ b/library/cpp/messagebus/test/ut/one_way_ut.cpp @@ -64,7 +64,7 @@ struct NullClient : TBusClientHandlerError {          Session->RegisterService("localhost");      } -    ~NullClient() override { +    ~NullClient() override {           Session->Shutdown();      } @@ -106,7 +106,7 @@ public:          Session = TBusServerSession::Create(&Proto, this, sessionConfig, Queue);      } -    ~NullServer() override { +    ~NullServer() override {           Session->Shutdown();      } diff --git a/library/cpp/messagebus/www/www.cpp b/library/cpp/messagebus/www/www.cpp index 62ec241d852..af3ed2761cb 100644 --- a/library/cpp/messagebus/www/www.cpp +++ b/library/cpp/messagebus/www/www.cpp @@ -121,23 +121,23 @@ namespace {  }  namespace { -    TString RootHref() { +    TString RootHref() {           return ConcatStrings("?");      } -    TString QueueHref(TStringBuf name) { +    TString QueueHref(TStringBuf name) {           return ConcatStrings("?q=", name);      } -    TString ServerSessionHref(TStringBuf name) { +    TString ServerSessionHref(TStringBuf name) {           return ConcatStrings("?ss=", name);      } -    TString ClientSessionHref(TStringBuf name) { +    TString ClientSessionHref(TStringBuf name) {           return ConcatStrings("?cs=", name);      } -    TString OldModuleHref(TStringBuf name) { +    TString OldModuleHref(TStringBuf name) {           return ConcatStrings("?om=", name);      } @@ -147,19 +147,19 @@ namespace {      }      */ -    void QueueLink(TStringBuf name) { +    void QueueLink(TStringBuf name) {           A(QueueHref(name), name);      } -    void ServerSessionLink(TStringBuf name) { +    void ServerSessionLink(TStringBuf name) {           A(ServerSessionHref(name), name);      } -    void ClientSessionLink(TStringBuf name) { +    void ClientSessionLink(TStringBuf name) {           A(ClientSessionHref(name), name);      } -    void OldModuleLink(TStringBuf name) { +    void OldModuleLink(TStringBuf name) {           A(OldModuleHref(name), name);      } diff --git a/library/cpp/monlib/dynamic_counters/contention_ut.cpp b/library/cpp/monlib/dynamic_counters/contention_ut.cpp index 8798044ee3c..575a4f0e6d5 100644 --- a/library/cpp/monlib/dynamic_counters/contention_ut.cpp +++ b/library/cpp/monlib/dynamic_counters/contention_ut.cpp @@ -24,7 +24,7 @@ Y_UNIT_TEST_SUITE(TDynamicCountersContentionTest) {                  Thread.Start();              } -            ~TConsumer() override { +            ~TConsumer() override {                   Thread.Join();              } diff --git a/library/cpp/monlib/dynamic_counters/counters.cpp b/library/cpp/monlib/dynamic_counters/counters.cpp index 3635d87d0d2..a1e7883c1db 100644 --- a/library/cpp/monlib/dynamic_counters/counters.cpp +++ b/library/cpp/monlib/dynamic_counters/counters.cpp @@ -44,7 +44,7 @@ namespace {      }  } -static constexpr TStringBuf INDENT = "    "; +static constexpr TStringBuf INDENT = "    ";   TDynamicCounters::TDynamicCounters(EVisibility vis)  { @@ -223,10 +223,10 @@ void TDynamicCounters::OutputPlainText(IOutputStream& os, const TString& indent)              auto snapshot = histogram->Snapshot();              for (ui32 i = 0, count = snapshot->Count(); i < count; i++) { -                os << indent << INDENT << TStringBuf("bin="); +                os << indent << INDENT << TStringBuf("bin=");                   TBucketBound bound = snapshot->UpperBound(i);                  if (bound == Max<TBucketBound>()) { -                    os << TStringBuf("inf"); +                    os << TStringBuf("inf");                   } else {                     os << bound;                  } diff --git a/library/cpp/monlib/dynamic_counters/golovan_page.cpp b/library/cpp/monlib/dynamic_counters/golovan_page.cpp index 49cf2d39bb6..67680484c90 100644 --- a/library/cpp/monlib/dynamic_counters/golovan_page.cpp +++ b/library/cpp/monlib/dynamic_counters/golovan_page.cpp @@ -22,7 +22,7 @@ public:          FirstCounter = true;      } -    void OnCounter(const TString&, const TString& value, const TCounterForPtr* counter) override { +    void OnCounter(const TString&, const TString& value, const TCounterForPtr* counter) override {           if (FirstCounter) {              FirstCounter = false;          } else { @@ -42,14 +42,14 @@ public:      void OnHistogram(const TString&, const TString&, IHistogramSnapshotPtr, bool) override {      } -    void OnGroupBegin(const TString&, const TString& value, const TDynamicCounters*) override { +    void OnGroupBegin(const TString&, const TString& value, const TDynamicCounters*) override {           prefix += value;          if (!value.empty()) {              prefix += "_";          }      } -    void OnGroupEnd(const TString&, const TString&, const TDynamicCounters*) override { +    void OnGroupEnd(const TString&, const TString&, const TDynamicCounters*) override {           prefix = "";      } diff --git a/library/cpp/monlib/dynamic_counters/page.cpp b/library/cpp/monlib/dynamic_counters/page.cpp index 5124a47bb33..eecf536623d 100644 --- a/library/cpp/monlib/dynamic_counters/page.cpp +++ b/library/cpp/monlib/dynamic_counters/page.cpp @@ -15,9 +15,9 @@ namespace {  }  TMaybe<EFormat> ParseFormat(TStringBuf str) { -    if (str == TStringBuf("json")) { +    if (str == TStringBuf("json")) {           return EFormat::JSON; -    } else if (str == TStringBuf("spack")) { +    } else if (str == TStringBuf("spack")) {           return EFormat::SPACK;      } else if (str == TStringBuf("prometheus")) {          return EFormat::PROMETHEUS; @@ -46,7 +46,7 @@ void TDynamicCountersPage::Output(NMonitoring::IMonHttpRequest& request) {          parts.pop_back();      } -    if (!parts.empty() && parts.back() == TStringBuf("private")) { +    if (!parts.empty() && parts.back() == TStringBuf("private")) {           visibility = TCountableBase::EVisibility::Private;          parts.pop_back();      } diff --git a/library/cpp/monlib/encode/format.cpp b/library/cpp/monlib/encode/format.cpp index 400ce5a6438..d366b326815 100644 --- a/library/cpp/monlib/encode/format.cpp +++ b/library/cpp/monlib/encode/format.cpp @@ -116,17 +116,17 @@ template <>  NMonitoring::EFormat FromStringImpl<NMonitoring::EFormat>(const char* str, size_t len) {      using NMonitoring::EFormat;      TStringBuf value(str, len); -    if (value == TStringBuf("SPACK")) { +    if (value == TStringBuf("SPACK")) {           return EFormat::SPACK; -    } else if (value == TStringBuf("JSON")) { +    } else if (value == TStringBuf("JSON")) {           return EFormat::JSON; -    } else if (value == TStringBuf("PROTOBUF")) { +    } else if (value == TStringBuf("PROTOBUF")) {           return EFormat::PROTOBUF; -    } else if (value == TStringBuf("TEXT")) { +    } else if (value == TStringBuf("TEXT")) {           return EFormat::TEXT; -    } else if (value == TStringBuf("PROMETHEUS")) { +    } else if (value == TStringBuf("PROMETHEUS")) {           return EFormat::PROMETHEUS; -    } else if (value == TStringBuf("UNKNOWN")) { +    } else if (value == TStringBuf("UNKNOWN")) {           return EFormat::UNKNOWN;      }      ythrow yexception() << "unknown format: " << value; @@ -137,22 +137,22 @@ void Out<NMonitoring::EFormat>(IOutputStream& o, NMonitoring::EFormat f) {      using NMonitoring::EFormat;      switch (f) {          case EFormat::SPACK: -            o << TStringBuf("SPACK"); +            o << TStringBuf("SPACK");               return;          case EFormat::JSON: -            o << TStringBuf("JSON"); +            o << TStringBuf("JSON");               return;          case EFormat::PROTOBUF: -            o << TStringBuf("PROTOBUF"); +            o << TStringBuf("PROTOBUF");               return;          case EFormat::TEXT: -            o << TStringBuf("TEXT"); +            o << TStringBuf("TEXT");               return;          case EFormat::PROMETHEUS: -            o << TStringBuf("PROMETHEUS"); +            o << TStringBuf("PROMETHEUS");               return;          case EFormat::UNKNOWN: -            o << TStringBuf("UNKNOWN"); +            o << TStringBuf("UNKNOWN");               return;      } @@ -163,15 +163,15 @@ template <>  NMonitoring::ECompression FromStringImpl<NMonitoring::ECompression>(const char* str, size_t len) {      using NMonitoring::ECompression;      TStringBuf value(str, len); -    if (value == TStringBuf("IDENTITY")) { +    if (value == TStringBuf("IDENTITY")) {           return ECompression::IDENTITY; -    } else if (value == TStringBuf("ZLIB")) { +    } else if (value == TStringBuf("ZLIB")) {           return ECompression::ZLIB; -    } else if (value == TStringBuf("LZ4")) { +    } else if (value == TStringBuf("LZ4")) {           return ECompression::LZ4; -    } else if (value == TStringBuf("ZSTD")) { +    } else if (value == TStringBuf("ZSTD")) {           return ECompression::ZSTD; -    } else if (value == TStringBuf("UNKNOWN")) { +    } else if (value == TStringBuf("UNKNOWN")) {           return ECompression::UNKNOWN;      }      ythrow yexception() << "unknown compression: " << value; @@ -182,19 +182,19 @@ void Out<NMonitoring::ECompression>(IOutputStream& o, NMonitoring::ECompression      using NMonitoring::ECompression;      switch (c) {          case ECompression::IDENTITY: -            o << TStringBuf("IDENTITY"); +            o << TStringBuf("IDENTITY");               return;          case ECompression::ZLIB: -            o << TStringBuf("ZLIB"); +            o << TStringBuf("ZLIB");               return;          case ECompression::LZ4: -            o << TStringBuf("LZ4"); +            o << TStringBuf("LZ4");               return;          case ECompression::ZSTD: -            o << TStringBuf("ZSTD"); +            o << TStringBuf("ZSTD");               return;          case ECompression::UNKNOWN: -            o << TStringBuf("UNKNOWN"); +            o << TStringBuf("UNKNOWN");               return;      } diff --git a/library/cpp/monlib/encode/format.h b/library/cpp/monlib/encode/format.h index 495d42d7867..d0e2143e3a7 100644 --- a/library/cpp/monlib/encode/format.h +++ b/library/cpp/monlib/encode/format.h @@ -4,18 +4,18 @@  namespace NMonitoring {      namespace NFormatContenType { -        constexpr TStringBuf TEXT = "application/x-solomon-txt"; -        constexpr TStringBuf JSON = "application/json"; -        constexpr TStringBuf PROTOBUF = "application/x-solomon-pb"; -        constexpr TStringBuf SPACK = "application/x-solomon-spack"; -        constexpr TStringBuf PROMETHEUS = "text/plain"; +        constexpr TStringBuf TEXT = "application/x-solomon-txt";  +        constexpr TStringBuf JSON = "application/json";  +        constexpr TStringBuf PROTOBUF = "application/x-solomon-pb";  +        constexpr TStringBuf SPACK = "application/x-solomon-spack";  +        constexpr TStringBuf PROMETHEUS = "text/plain";       }      namespace NFormatContentEncoding { -        constexpr TStringBuf IDENTITY = "identity"; -        constexpr TStringBuf ZLIB = "zlib"; -        constexpr TStringBuf LZ4 = "lz4"; -        constexpr TStringBuf ZSTD = "zstd"; +        constexpr TStringBuf IDENTITY = "identity";  +        constexpr TStringBuf ZLIB = "zlib";  +        constexpr TStringBuf LZ4 = "lz4";  +        constexpr TStringBuf ZSTD = "zstd";       }      /** diff --git a/library/cpp/monlib/encode/json/json_decoder.cpp b/library/cpp/monlib/encode/json/json_decoder.cpp index d44ff5fd286..8777caa021a 100644 --- a/library/cpp/monlib/encode/json/json_decoder.cpp +++ b/library/cpp/monlib/encode/json/json_decoder.cpp @@ -172,11 +172,11 @@ private:  };  std::pair<double, bool> ParseSpecDouble(TStringBuf string) { -    if (string == TStringBuf("nan") || string == TStringBuf("NaN")) { +    if (string == TStringBuf("nan") || string == TStringBuf("NaN")) {           return {std::numeric_limits<double>::quiet_NaN(), true}; -    } else if (string == TStringBuf("inf") || string == TStringBuf("Infinity")) { +    } else if (string == TStringBuf("inf") || string == TStringBuf("Infinity")) {           return {std::numeric_limits<double>::infinity(), true}; -    } else if (string == TStringBuf("-inf") || string == TStringBuf("-Infinity")) { +    } else if (string == TStringBuf("-inf") || string == TStringBuf("-Infinity")) {           return  {-std::numeric_limits<double>::infinity(), true};      } else {          return {0, false}; @@ -762,7 +762,7 @@ if (Y_UNLIKELY(!(CONDITION))) {                  \                  break;              case TState::METRIC_MODE: -                if (value == TStringBuf("deriv")) { +                if (value == TStringBuf("deriv")) {                       LastMetric_.Type = EMetricType::RATE;                  }                  State_.ToPrev(); @@ -814,11 +814,11 @@ if (Y_UNLIKELY(!(CONDITION))) {                  \      bool OnMapKey(const TStringBuf& key) override {          switch (State_.Current()) {              case TState::ROOT_OBJECT: -                if (key == TStringBuf("commonLabels") || key == TStringBuf("labels")) { +                if (key == TStringBuf("commonLabels") || key == TStringBuf("labels")) {                       State_.ToNext(TState::COMMON_LABELS); -                } else if (key == TStringBuf("ts")) { +                } else if (key == TStringBuf("ts")) {                       State_.ToNext(TState::COMMON_TS); -                } else if (key == TStringBuf("sensors") || key == TStringBuf("metrics")) { +                } else if (key == TStringBuf("sensors") || key == TStringBuf("metrics")) {                       State_.ToNext(TState::METRICS_ARRAY);                  }                  break; @@ -829,36 +829,36 @@ if (Y_UNLIKELY(!(CONDITION))) {                  \                  break;              case TState::METRIC_OBJECT: -                if (key == TStringBuf("labels")) { +                if (key == TStringBuf("labels")) {                       State_.ToNext(TState::METRIC_LABELS);                  } else if (key == TStringBuf("name")) {                      State_.ToNext(TState::METRIC_NAME); -                } else if (key == TStringBuf("ts")) { +                } else if (key == TStringBuf("ts")) {                       PARSE_ENSURE(!LastMetric_.SeenTimeseries,                               "mixed timeseries and ts attributes");                      LastMetric_.SeenTsOrValue = true;                      State_.ToNext(TState::METRIC_TS); -                } else if (key == TStringBuf("value")) { +                } else if (key == TStringBuf("value")) {                       PARSE_ENSURE(!LastMetric_.SeenTimeseries,                               "mixed timeseries and value attributes");                      LastMetric_.SeenTsOrValue = true;                      State_.ToNext(TState::METRIC_VALUE); -                } else if (key == TStringBuf("timeseries")) { +                } else if (key == TStringBuf("timeseries")) {                       PARSE_ENSURE(!LastMetric_.SeenTsOrValue,                               "mixed timeseries and ts/value attributes");                      LastMetric_.SeenTimeseries = true;                      State_.ToNext(TState::METRIC_TIMESERIES); -                } else if (key == TStringBuf("mode")) { +                } else if (key == TStringBuf("mode")) {                       State_.ToNext(TState::METRIC_MODE); -                } else if (key == TStringBuf("kind") || key == TStringBuf("type")) { +                } else if (key == TStringBuf("kind") || key == TStringBuf("type")) {                       State_.ToNext(TState::METRIC_TYPE); -                } else if (key == TStringBuf("hist")) { +                } else if (key == TStringBuf("hist")) {                       State_.ToNext(TState::METRIC_HIST); -                } else if (key == TStringBuf("summary")) { +                } else if (key == TStringBuf("summary")) {                       State_.ToNext(TState::METRIC_DSUMMARY); -                } else if (key == TStringBuf("log_hist")) { +                } else if (key == TStringBuf("log_hist")) {                       State_.ToNext(TState::METRIC_LOG_HIST); -                } else if (key == TStringBuf("memOnly")) { +                } else if (key == TStringBuf("memOnly")) {                       // deprecated. Skip it without errors for backward compatibility                  } else {                      ErrorMsg_ = TStringBuilder() << "unexpected key \"" << key << "\" in a metric schema"; @@ -867,51 +867,51 @@ if (Y_UNLIKELY(!(CONDITION))) {                  \                  break;              case TState::METRIC_TIMESERIES: -                if (key == TStringBuf("ts")) { +                if (key == TStringBuf("ts")) {                       State_.ToNext(TState::METRIC_TS); -                } else if (key == TStringBuf("value")) { +                } else if (key == TStringBuf("value")) {                       State_.ToNext(TState::METRIC_VALUE); -                } else if (key == TStringBuf("hist")) { +                } else if (key == TStringBuf("hist")) {                       State_.ToNext(TState::METRIC_HIST); -                } else if (key == TStringBuf("summary")) { +                } else if (key == TStringBuf("summary")) {                       State_.ToNext(TState::METRIC_DSUMMARY); -                } else if (key == TStringBuf("log_hist")) { +                } else if (key == TStringBuf("log_hist")) {                       State_.ToNext(TState::METRIC_LOG_HIST);                  }                  break;              case TState::METRIC_HIST: -                if (key == TStringBuf("bounds")) { +                if (key == TStringBuf("bounds")) {                       State_.ToNext(TState::METRIC_HIST_BOUNDS); -                } else if (key == TStringBuf("buckets")) { +                } else if (key == TStringBuf("buckets")) {                       State_.ToNext(TState::METRIC_HIST_BUCKETS); -                } else if (key == TStringBuf("inf")) { +                } else if (key == TStringBuf("inf")) {                       State_.ToNext(TState::METRIC_HIST_INF);                  }                  break;              case TState::METRIC_LOG_HIST: -                if (key == TStringBuf("base")) { +                if (key == TStringBuf("base")) {                       State_.ToNext(TState::METRIC_LOG_HIST_BASE); -                } else if (key == TStringBuf("zeros_count")) { +                } else if (key == TStringBuf("zeros_count")) {                       State_.ToNext(TState::METRIC_LOG_HIST_ZEROS); -                } else if (key == TStringBuf("start_power")) { +                } else if (key == TStringBuf("start_power")) {                       State_.ToNext(TState::METRIC_LOG_HIST_START_POWER); -                } else if (key == TStringBuf("buckets")) { +                } else if (key == TStringBuf("buckets")) {                       State_.ToNext(TState::METRIC_LOG_HIST_BUCKETS);                  }                  break;              case TState::METRIC_DSUMMARY: -                if (key == TStringBuf("sum")) { +                if (key == TStringBuf("sum")) {                       State_.ToNext(TState::METRIC_DSUMMARY_SUM); -                } else if (key == TStringBuf("min")) { +                } else if (key == TStringBuf("min")) {                       State_.ToNext(TState::METRIC_DSUMMARY_MIN); -                } else if (key == TStringBuf("max")) { +                } else if (key == TStringBuf("max")) {                       State_.ToNext(TState::METRIC_DSUMMARY_MAX); -                } else if (key == TStringBuf("last")) { +                } else if (key == TStringBuf("last")) {                       State_.ToNext(TState::METRIC_DSUMMARY_LAST); -                } else if (key == TStringBuf("count")) { +                } else if (key == TStringBuf("count")) {                       State_.ToNext(TState::METRIC_DSUMMARY_COUNT);                  } diff --git a/library/cpp/monlib/encode/json/json_decoder_ut.cpp b/library/cpp/monlib/encode/json/json_decoder_ut.cpp index 4464e1d26a4..6c047f96e59 100644 --- a/library/cpp/monlib/encode/json/json_decoder_ut.cpp +++ b/library/cpp/monlib/encode/json/json_decoder_ut.cpp @@ -15,15 +15,15 @@ enum EJsonPart : ui8 {  };  constexpr std::array<TStringBuf, 3> JSON_PARTS = { -    TStringBuf(R"("metrics": [{ +    TStringBuf(R"("metrics": [{           "labels": { "key": "value" },          "type": "GAUGE",          "value": 123      }])"), -    TStringBuf(R"("ts": 1)"), +    TStringBuf(R"("ts": 1)"),  -    TStringBuf(R"("commonLabels": { +    TStringBuf(R"("commonLabels": {           "key1": "value1",          "key2": "value2"      })"), @@ -52,10 +52,10 @@ void ValidateCommonParts(TCommonParts&& commonParts, bool checkLabels, bool chec      if (checkLabels) {          auto& labels = commonParts.CommonLabels;          UNIT_ASSERT_VALUES_EQUAL(labels.Size(), 2); -        UNIT_ASSERT(labels.Has(TStringBuf("key1"))); -        UNIT_ASSERT(labels.Has(TStringBuf("key2"))); -        UNIT_ASSERT_VALUES_EQUAL(labels.Get(TStringBuf("key1")).value()->Value(), "value1"); -        UNIT_ASSERT_VALUES_EQUAL(labels.Get(TStringBuf("key2")).value()->Value(), "value2"); +        UNIT_ASSERT(labels.Has(TStringBuf("key1")));  +        UNIT_ASSERT(labels.Has(TStringBuf("key2")));  +        UNIT_ASSERT_VALUES_EQUAL(labels.Get(TStringBuf("key1")).value()->Value(), "value1");  +        UNIT_ASSERT_VALUES_EQUAL(labels.Get(TStringBuf("key2")).value()->Value(), "value2");       }  } diff --git a/library/cpp/monlib/encode/json/json_encoder.cpp b/library/cpp/monlib/encode/json/json_encoder.cpp index 20d2bb6283f..7a6d6406e70 100644 --- a/library/cpp/monlib/encode/json/json_encoder.cpp +++ b/library/cpp/monlib/encode/json/json_encoder.cpp @@ -36,7 +36,7 @@ namespace NMonitoring {              void WriteTime(TInstant time) {                  if (time != TInstant::Zero()) { -                    Buf_.WriteKey(TStringBuf("ts")); +                    Buf_.WriteKey(TStringBuf("ts"));                       if (Style_ == EJsonStyle::Solomon) {                          Buf_.WriteULongLong(time.Seconds());                      } else { @@ -46,24 +46,24 @@ namespace NMonitoring {              }              void WriteValue(double value) { -                Buf_.WriteKey(TStringBuf("value")); +                Buf_.WriteKey(TStringBuf("value"));                   Buf_.WriteDouble(value);              }              void WriteValue(i64 value) { -                Buf_.WriteKey(TStringBuf("value")); +                Buf_.WriteKey(TStringBuf("value"));                   Buf_.WriteLongLong(value);              }              void WriteValue(ui64 value) { -                Buf_.WriteKey(TStringBuf("value")); +                Buf_.WriteKey(TStringBuf("value"));                   Buf_.WriteULongLong(value);              }              void WriteValue(IHistogramSnapshot* s) {                  Y_ENSURE(Style_ == EJsonStyle::Solomon); -                Buf_.WriteKey(TStringBuf("hist")); +                Buf_.WriteKey(TStringBuf("hist"));                   Buf_.BeginObject();                  if (ui32 count = s->Count()) {                      bool hasInf = (s->UpperBound(count - 1) == Max<double>()); @@ -71,14 +71,14 @@ namespace NMonitoring {                          count--;                      } -                    Buf_.WriteKey(TStringBuf("bounds")); +                    Buf_.WriteKey(TStringBuf("bounds"));                       Buf_.BeginList();                      for (ui32 i = 0; i < count; i++) {                          Buf_.WriteDouble(s->UpperBound(i));                      }                      Buf_.EndList(); -                    Buf_.WriteKey(TStringBuf("buckets")); +                    Buf_.WriteKey(TStringBuf("buckets"));                       Buf_.BeginList();                      for (ui32 i = 0; i < count; i++) {                          Buf_.WriteULongLong(s->Value(i)); @@ -86,7 +86,7 @@ namespace NMonitoring {                      Buf_.EndList();                      if (hasInf) { -                        Buf_.WriteKey(TStringBuf("inf")); +                        Buf_.WriteKey(TStringBuf("inf"));                           Buf_.WriteULongLong(s->Value(count));                      }                  } @@ -96,22 +96,22 @@ namespace NMonitoring {              void WriteValue(ISummaryDoubleSnapshot* s) {                  Y_ENSURE(Style_ == EJsonStyle::Solomon); -                Buf_.WriteKey(TStringBuf("summary")); +                Buf_.WriteKey(TStringBuf("summary"));                   Buf_.BeginObject(); -                Buf_.WriteKey(TStringBuf("sum")); +                Buf_.WriteKey(TStringBuf("sum"));                   Buf_.WriteDouble(s->GetSum()); -                Buf_.WriteKey(TStringBuf("min")); +                Buf_.WriteKey(TStringBuf("min"));                   Buf_.WriteDouble(s->GetMin()); -                Buf_.WriteKey(TStringBuf("max")); +                Buf_.WriteKey(TStringBuf("max"));                   Buf_.WriteDouble(s->GetMax()); -                Buf_.WriteKey(TStringBuf("last")); +                Buf_.WriteKey(TStringBuf("last"));                   Buf_.WriteDouble(s->GetLast()); -                Buf_.WriteKey(TStringBuf("count")); +                Buf_.WriteKey(TStringBuf("count"));                   Buf_.WriteULongLong(s->GetCount());                  Buf_.EndObject(); @@ -120,19 +120,19 @@ namespace NMonitoring {              void WriteValue(TLogHistogramSnapshot* s) {                  Y_ENSURE(Style_ == EJsonStyle::Solomon); -                Buf_.WriteKey(TStringBuf("log_hist")); +                Buf_.WriteKey(TStringBuf("log_hist"));                   Buf_.BeginObject(); -                Buf_.WriteKey(TStringBuf("base")); +                Buf_.WriteKey(TStringBuf("base"));                   Buf_.WriteDouble(s->Base()); -                Buf_.WriteKey(TStringBuf("zeros_count")); +                Buf_.WriteKey(TStringBuf("zeros_count"));                   Buf_.WriteULongLong(s->ZerosCount()); -                Buf_.WriteKey(TStringBuf("start_power")); +                Buf_.WriteKey(TStringBuf("start_power"));                   Buf_.WriteInt(s->StartPower()); -                Buf_.WriteKey(TStringBuf("buckets")); +                Buf_.WriteKey(TStringBuf("buckets"));                   Buf_.BeginList();                  for (size_t i = 0; i < s->Count(); ++i) {                      Buf_.WriteDouble(s->Bucket(i)); @@ -239,7 +239,7 @@ namespace NMonitoring {              {              } -            ~TEncoderJson() override { +            ~TEncoderJson() override {                   Close();              } @@ -303,7 +303,7 @@ namespace NMonitoring {                      Buf_.WriteKey(TStringBuf(Style_ == EJsonStyle::Solomon ? "commonLabels" : "labels"));                  } else if (State_ == TEncoderState::EState::METRIC) {                      State_ = TEncoderState::EState::METRIC_LABELS; -                    Buf_.WriteKey(TStringBuf("labels")); +                    Buf_.WriteKey(TStringBuf("labels"));                   } else {                      State_.ThrowInvalid("expected METRIC or ROOT");                  } @@ -381,7 +381,7 @@ namespace NMonitoring {                               "mixed metric value types in one metric");                      if (!TimeSeries_) { -                        Buf_.WriteKey(TStringBuf("timeseries")); +                        Buf_.WriteKey(TStringBuf("timeseries"));                           Buf_.BeginList();                          Buf_.BeginObject();                          Y_ENSURE(LastPoint_.GetTime() != TInstant::Zero(), @@ -426,7 +426,7 @@ namespace NMonitoring {                  MetricsMergingMode_ = EMetricsMergingMode::MERGE_METRICS;              } -            ~TBufferedJsonEncoder() override { +            ~TBufferedJsonEncoder() override {                   Close();              } @@ -490,7 +490,7 @@ namespace NMonitoring {                  WriteMetricType(metric.MetricType); -                Buf_.WriteKey(TStringBuf("labels")); +                Buf_.WriteKey(TStringBuf("labels"));                   WriteLabels(metric.Labels, false);                  metric.TimeSeries.SortByTs(); @@ -499,7 +499,7 @@ namespace NMonitoring {                      WriteTime(point.GetTime());                      WriteValue(metric.TimeSeries.GetValueType(), point.GetValue());                  } else if (metric.TimeSeries.Size() > 1) { -                    Buf_.WriteKey(TStringBuf("timeseries")); +                    Buf_.WriteKey(TStringBuf("timeseries"));                       Buf_.BeginList();                      metric.TimeSeries.ForEach([this](TInstant time, EMetricValueType type, TMetricValue value) {                          Buf_.BeginObject(); diff --git a/library/cpp/monlib/encode/legacy_protobuf/legacy_proto_decoder.cpp b/library/cpp/monlib/encode/legacy_protobuf/legacy_proto_decoder.cpp index f87a2d7e8f4..f74cade8e8f 100644 --- a/library/cpp/monlib/encode/legacy_protobuf/legacy_proto_decoder.cpp +++ b/library/cpp/monlib/encode/legacy_protobuf/legacy_proto_decoder.cpp @@ -163,10 +163,10 @@ namespace NMonitoring {                  TRACE("found fixed label " << l);              } -            EType Type() const override { +            EType Type() const override {                   return EType::Fixed;              } -            TLabel Get(const NProtoBuf::Message&) override { +            TLabel Get(const NProtoBuf::Message&) override {                   return Label_;              } @@ -184,10 +184,10 @@ namespace NMonitoring {                  TRACE("found lazy label");              } -            EType Type() const override { +            EType Type() const override {                   return EType::Lazy;              } -            TLabel Get(const NProtoBuf::Message& msg) override { +            TLabel Get(const NProtoBuf::Message& msg) override {                   return Fn_(msg);              } @@ -289,7 +289,7 @@ namespace NMonitoring {                      TStringBuf lhs, rhs;                      const bool isDynamic = str.TrySplit(':', lhs, rhs); -                    const bool isIndexing = isDynamic && rhs == TStringBuf("#"); +                    const bool isIndexing = isDynamic && rhs == TStringBuf("#");                       if (isIndexing) {                          TRACE("parsed index labels"); diff --git a/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp b/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp index 7e81357dbda..0cdecebcfa0 100644 --- a/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp +++ b/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp @@ -22,7 +22,7 @@  namespace NMonitoring {      namespace { -        constexpr ui32 MAX_LABEL_VALUE_LEN = 256; +        constexpr ui32 MAX_LABEL_VALUE_LEN = 256;           using TLabelsMap = THashMap<TString, TString>; @@ -225,7 +225,7 @@ namespace NMonitoring {                  SkipSpaces();                  TStringBuf keyword = ReadToken(); -                if (keyword == TStringBuf("TYPE")) { +                if (keyword == TStringBuf("TYPE")) {                       SkipSpaces();                      TStringBuf nextName = ReadTokenAsMetricName(); @@ -561,11 +561,11 @@ namespace NMonitoring {              }              double ParseGoDouble(TStringBuf str) { -                if (str == TStringBuf("+Inf")) { +                if (str == TStringBuf("+Inf")) {                       return std::numeric_limits<double>::infinity(); -                } else if (str == TStringBuf("-Inf")) { +                } else if (str == TStringBuf("-Inf")) {                       return -std::numeric_limits<double>::infinity(); -                } else if (str == TStringBuf("NaN")) { +                } else if (str == TStringBuf("NaN")) {                       return NAN;                  } diff --git a/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp b/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp index 15efeb8c034..7eee2d709da 100644 --- a/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp +++ b/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp @@ -71,7 +71,7 @@ namespace NMonitoring {                      TBucketBound bound = h->UpperBound(i);                      TStringBuf boundStr;                      if (bound == HISTOGRAM_INF_BOUND) { -                        boundStr = TStringBuf("+Inf"); +                        boundStr = TStringBuf("+Inf");                       } else {                          size_t len = FloatToString(bound, TmpBuf_, Y_ARRAY_SIZE(TmpBuf_));                          boundStr = TStringBuf(TmpBuf_, len); diff --git a/library/cpp/monlib/encode/prometheus/prometheus_model.h b/library/cpp/monlib/encode/prometheus/prometheus_model.h index cb7f2cb15b7..377934f8b4f 100644 --- a/library/cpp/monlib/encode/prometheus/prometheus_model.h +++ b/library/cpp/monlib/encode/prometheus/prometheus_model.h @@ -13,16 +13,16 @@ namespace NPrometheus {      // and https://github.com/prometheus/common/blob/master/expfmt/text_parse.go      // -    inline constexpr TStringBuf BUCKET_SUFFIX = "_bucket"; -    inline constexpr TStringBuf COUNT_SUFFIX = "_count"; -    inline constexpr TStringBuf SUM_SUFFIX = "_sum"; -    inline constexpr TStringBuf MIN_SUFFIX = "_min"; -    inline constexpr TStringBuf MAX_SUFFIX = "_max"; -    inline constexpr TStringBuf LAST_SUFFIX = "_last"; +    inline constexpr TStringBuf BUCKET_SUFFIX = "_bucket";  +    inline constexpr TStringBuf COUNT_SUFFIX = "_count";  +    inline constexpr TStringBuf SUM_SUFFIX = "_sum";  +    inline constexpr TStringBuf MIN_SUFFIX = "_min";  +    inline constexpr TStringBuf MAX_SUFFIX = "_max";  +    inline constexpr TStringBuf LAST_SUFFIX = "_last";       // Used for the label that defines the upper bound of a bucket of a      // histogram ("le" -> "less or equal"). -    inline constexpr TStringBuf BUCKET_LABEL = "le"; +    inline constexpr TStringBuf BUCKET_LABEL = "le";       inline bool IsValidLabelNameStart(char ch) { diff --git a/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp b/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp index 2d11b9d5ba3..1b4a1a23b4d 100644 --- a/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp +++ b/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp @@ -213,7 +213,7 @@ namespace NMonitoring {                  FillHistogram(*snapshot, point->MutableHistogram());              } -            void OnSummaryDouble(TInstant time, ISummaryDoubleSnapshotPtr snapshot) override { +            void OnSummaryDouble(TInstant time, ISummaryDoubleSnapshotPtr snapshot) override {                   Y_ENSURE(Sample_, "metric not started");                  NProto::TPoint* point = Sample_->AddPoints();                  point->SetTime(time.MilliSeconds()); diff --git a/library/cpp/monlib/encode/spack/compression.cpp b/library/cpp/monlib/encode/spack/compression.cpp index 0d2152fc851..d7223203ad8 100644 --- a/library/cpp/monlib/encode/spack/compression.cpp +++ b/library/cpp/monlib/encode/spack/compression.cpp @@ -124,7 +124,7 @@ namespace NMonitoring {              static size_t Compress(TBlock in, TBlock out) {                  size_t rc = ZSTD_compress(out.data(), out.size(), in.data(), in.size(), LEVEL);                  if (Y_UNLIKELY(ZSTD_isError(rc))) { -                    ythrow yexception() << TStringBuf("zstd compression failed: ") +                    ythrow yexception() << TStringBuf("zstd compression failed: ")                                           << ZSTD_getErrorName(rc);                  }                  return rc; @@ -133,7 +133,7 @@ namespace NMonitoring {              static void Decompress(TBlock in, TBlock out) {                  size_t rc = ZSTD_decompress(out.data(), out.size(), in.data(), in.size());                  if (Y_UNLIKELY(ZSTD_isError(rc))) { -                    ythrow yexception() << TStringBuf("zstd decompression failed: ") +                    ythrow yexception() << TStringBuf("zstd decompression failed: ")                                           << ZSTD_getErrorName(rc);                  }                  Y_ENSURE(rc == out.size(), "zstd decompressed wrong size"); @@ -249,7 +249,7 @@ namespace NMonitoring {              {              } -            ~TFramedCompressStream() override { +            ~TFramedCompressStream() override {                   try {                      Finish();                  } catch (...) { diff --git a/library/cpp/monlib/encode/spack/spack_v1_encoder.cpp b/library/cpp/monlib/encode/spack/spack_v1_encoder.cpp index a2b0bb5f50a..7d5766d7280 100644 --- a/library/cpp/monlib/encode/spack/spack_v1_encoder.cpp +++ b/library/cpp/monlib/encode/spack/spack_v1_encoder.cpp @@ -39,7 +39,7 @@ namespace NMonitoring {                  LabelValuesPool_.SetSorted(true);              } -            ~TEncoderSpackV1() override { +            ~TEncoderSpackV1() override {                   Close();              } diff --git a/library/cpp/monlib/encode/text/text_encoder.cpp b/library/cpp/monlib/encode/text/text_encoder.cpp index 10336261f09..e60caf21447 100644 --- a/library/cpp/monlib/encode/text/text_encoder.cpp +++ b/library/cpp/monlib/encode/text/text_encoder.cpp @@ -30,7 +30,7 @@ namespace NMonitoring {                  State_.Expect(TEncoderState::EState::ROOT);                  CommonTime_ = time;                  if (time != TInstant::Zero()) { -                    Out_->Write(TStringBuf("common time: ")); +                    Out_->Write(TStringBuf("common time: "));                       WriteTime(time);                      Out_->Write('\n');                  } @@ -62,7 +62,7 @@ namespace NMonitoring {                      State_ = TEncoderState::EState::METRIC;                  } else if (State_ == TEncoderState::EState::COMMON_LABELS) {                      State_ = TEncoderState::EState::ROOT; -                    Out_->Write(TStringBuf("common labels: ")); +                    Out_->Write(TStringBuf("common labels: "));                       WriteLabels();                      Out_->Write('\n');                  } else { @@ -149,11 +149,11 @@ namespace NMonitoring {                  out << '{';                  for (auto&& l : Labels_) { -                    out << l.Name() << TStringBuf("='") << l.Value() << '\''; +                    out << l.Name() << TStringBuf("='") << l.Value() << '\'';                       ++i;                      if (i < size) { -                        out << TStringBuf(", "); +                        out << TStringBuf(", ");                       }                  }; @@ -166,7 +166,7 @@ namespace NMonitoring {                  (*Out_) << LeftPad(typeStr, MaxMetricTypeNameLength) << ' ';                  // (2) name and labels -                auto name = Labels_.Extract(TStringBuf("sensor")); +                auto name = Labels_.Extract(TStringBuf("sensor"));                   if (name) {                      if (name->Value().find(' ') != TString::npos) {                          (*Out_) << '"' << name->Value() << '"'; @@ -179,10 +179,10 @@ namespace NMonitoring {                  // (3) values                  if (!TimeSeries_.Empty()) {                      TimeSeries_.SortByTs(); -                    Out_->Write(TStringBuf(" [")); +                    Out_->Write(TStringBuf(" ["));                       for (size_t i = 0; i < TimeSeries_.Size(); i++) {                          if (i > 0) { -                            Out_->Write(TStringBuf(", ")); +                            Out_->Write(TStringBuf(", "));                           }                          const auto& point = TimeSeries_[i]; @@ -191,7 +191,7 @@ namespace NMonitoring {                          } else {                              Out_->Write('(');                              WriteTime(point.GetTime()); -                            Out_->Write(TStringBuf(", ")); +                            Out_->Write(TStringBuf(", "));                               WriteValue(TimeSeries_.GetValueType(), point.GetValue());                              Out_->Write(')');                          } diff --git a/library/cpp/monlib/encode/unistat/unistat_decoder.cpp b/library/cpp/monlib/encode/unistat/unistat_decoder.cpp index b2344b0905c..7497ae1f79c 100644 --- a/library/cpp/monlib/encode/unistat/unistat_decoder.cpp +++ b/library/cpp/monlib/encode/unistat/unistat_decoder.cpp @@ -156,9 +156,9 @@ namespace NMonitoring {                  Y_ENSURE(suffix.size() >= 3 && suffix.size() <= 5, "Disallowed suffix value: " << suffix); -                if (suffix == TStringBuf("summ") || suffix == TStringBuf("hgram")) { +                if (suffix == TStringBuf("summ") || suffix == TStringBuf("hgram")) {                       return true; -                } else if (suffix == TStringBuf("max")) { +                } else if (suffix == TStringBuf("max")) {                       return false;                  } diff --git a/library/cpp/monlib/encode/unistat/unistat_ut.cpp b/library/cpp/monlib/encode/unistat/unistat_ut.cpp index dbbc238bf32..7da071a587f 100644 --- a/library/cpp/monlib/encode/unistat/unistat_ut.cpp +++ b/library/cpp/monlib/encode/unistat/unistat_ut.cpp @@ -9,7 +9,7 @@ using namespace NMonitoring;  Y_UNIT_TEST_SUITE(TUnistatDecoderTest) {      Y_UNIT_TEST(ScalarMetric) { -        constexpr auto input = TStringBuf(R"([["something_axxx", 42]])"); +        constexpr auto input = TStringBuf(R"([["something_axxx", 42]])");           NProto::TMultiSamplesList samples;          auto encoder = EncoderProtobuf(&samples); @@ -57,7 +57,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) {      }      Y_UNIT_TEST(ThrowsOnTopLevelObject) { -        constexpr auto input = TStringBuf(R"({["something_axxx", 42]})"); +        constexpr auto input = TStringBuf(R"({["something_axxx", 42]})");           NProto::TMultiSamplesList samples;          auto encoder = EncoderProtobuf(&samples); @@ -66,7 +66,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) {      }      Y_UNIT_TEST(ThrowsOnUnwrappedMetric) { -        constexpr auto input = TStringBuf(R"(["something_axxx", 42])"); +        constexpr auto input = TStringBuf(R"(["something_axxx", 42])");           NProto::TMultiSamplesList samples;          auto encoder = EncoderProtobuf(&samples); @@ -75,7 +75,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) {      }      Y_UNIT_TEST(HistogramMetric) { -        constexpr auto input = TStringBuf(R"([["something_hgram", [[0, 1], [200, 2], [500, 3]] ]])"); +        constexpr auto input = TStringBuf(R"([["something_hgram", [[0, 1], [200, 2], [500, 3]] ]])");           NProto::TMultiSamplesList samples;          auto encoder = EncoderProtobuf(&samples); @@ -106,7 +106,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) {      }      Y_UNIT_TEST(AbsoluteHistogram) { -        constexpr auto input = TStringBuf(R"([["something_ahhh", [[0, 1], [200, 2], [500, 3]] ]])"); +        constexpr auto input = TStringBuf(R"([["something_ahhh", [[0, 1], [200, 2], [500, 3]] ]])");           NProto::TMultiSamplesList samples;          auto encoder = EncoderProtobuf(&samples); @@ -134,23 +134,23 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) {          auto encoder = EncoderProtobuf(&samples);          { -            constexpr auto input = TStringBuf(R"([["someth!ng_ahhh", [[0, 1], [200, 2], [500, 3]] ]])"); +            constexpr auto input = TStringBuf(R"([["someth!ng_ahhh", [[0, 1], [200, 2], [500, 3]] ]])");               UNIT_ASSERT_EXCEPTION(DecodeUnistat(input, encoder.Get()), yexception);          }          { -            constexpr auto input = TStringBuf(R"([["foo_a", [[0, 1], [200, 2], [500, 3]] ]])"); +            constexpr auto input = TStringBuf(R"([["foo_a", [[0, 1], [200, 2], [500, 3]] ]])");               UNIT_ASSERT_EXCEPTION(DecodeUnistat(input, encoder.Get()), yexception);          }          { -            constexpr auto input = TStringBuf(R"([["foo_ahhh;tag=value", [[0, 1], [200, 2], [500, 3]] ]])"); +            constexpr auto input = TStringBuf(R"([["foo_ahhh;tag=value", [[0, 1], [200, 2], [500, 3]] ]])");               UNIT_ASSERT_EXCEPTION(DecodeUnistat(input, encoder.Get()), yexception);          }      }      Y_UNIT_TEST(MultipleMetrics) { -        constexpr auto input = TStringBuf(R"([["something_axxx", 42], ["some-other_dhhh", 53]])"); +        constexpr auto input = TStringBuf(R"([["something_axxx", 42], ["some-other_dhhh", 53]])");           NProto::TMultiSamplesList samples;          auto encoder = EncoderProtobuf(&samples); @@ -182,7 +182,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) {      }      Y_UNIT_TEST(UnderscoreName) { -        constexpr auto input = TStringBuf(R"([["something_anything_dmmm", 42]])"); +        constexpr auto input = TStringBuf(R"([["something_anything_dmmm", 42]])");           NProto::TMultiSamplesList samples;          auto encoder = EncoderProtobuf(&samples); @@ -202,7 +202,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) {      }      Y_UNIT_TEST(MaxAggr) { -        constexpr auto input = TStringBuf(R"([["something_anything_max", 42]])"); +        constexpr auto input = TStringBuf(R"([["something_anything_max", 42]])");           NProto::TMultiSamplesList samples;          auto encoder = EncoderProtobuf(&samples); diff --git a/library/cpp/monlib/metrics/ewma.cpp b/library/cpp/monlib/metrics/ewma.cpp index 8a296c32258..1c170ff394f 100644 --- a/library/cpp/monlib/metrics/ewma.cpp +++ b/library/cpp/monlib/metrics/ewma.cpp @@ -22,7 +22,7 @@ namespace {              Y_VERIFY(metric != nullptr, "Passing nullptr metric is not allowed");          } -        ~TExpMovingAverage() override = default; +        ~TExpMovingAverage() override = default;           // This method NOT thread safe          void Tick() override { diff --git a/library/cpp/monlib/metrics/histogram_snapshot.cpp b/library/cpp/monlib/metrics/histogram_snapshot.cpp index 75b58115464..488505b1ccc 100644 --- a/library/cpp/monlib/metrics/histogram_snapshot.cpp +++ b/library/cpp/monlib/metrics/histogram_snapshot.cpp @@ -28,25 +28,25 @@ namespace {  template <typename TStream>  auto& Output(TStream& os, const NMonitoring::IHistogramSnapshot& hist) { -    os << TStringBuf("{"); +    os << TStringBuf("{");       ui32 i = 0;      ui32 count = hist.Count();      if (count > 0) {          for (; i < count - 1; ++i) { -            os << hist.UpperBound(i) << TStringBuf(": ") << hist.Value(i); -            os << TStringBuf(", "); +            os << hist.UpperBound(i) << TStringBuf(": ") << hist.Value(i);  +            os << TStringBuf(", ");           }          if (hist.UpperBound(i) == Max<NMonitoring::TBucketBound>()) { -            os << TStringBuf("inf: ") << hist.Value(i); +            os << TStringBuf("inf: ") << hist.Value(i);           } else { -            os << hist.UpperBound(i) << TStringBuf(": ") << hist.Value(i); +            os << hist.UpperBound(i) << TStringBuf(": ") << hist.Value(i);           }      } -    os << TStringBuf("}"); +    os << TStringBuf("}");       return os;  } diff --git a/library/cpp/monlib/metrics/labels.cpp b/library/cpp/monlib/metrics/labels.cpp index 1eaadb7cba0..1beeb00ad1f 100644 --- a/library/cpp/monlib/metrics/labels.cpp +++ b/library/cpp/monlib/metrics/labels.cpp @@ -8,7 +8,7 @@ static void OutputLabels(IOutputStream& out, const NMonitoring::ILabels& labels)      out << '{';      for (const auto& label: labels) {          if (i++ > 0) { -            out << TStringBuf(", "); +            out << TStringBuf(", ");           }          out << label;      } diff --git a/library/cpp/monlib/metrics/labels_ut.cpp b/library/cpp/monlib/metrics/labels_ut.cpp index f0e4f532aba..e1a4f0c392d 100644 --- a/library/cpp/monlib/metrics/labels_ut.cpp +++ b/library/cpp/monlib/metrics/labels_ut.cpp @@ -93,9 +93,9 @@ Y_UNIT_TEST_SUITE(TLabelsTest) {      Y_UNIT_TEST(Labels) {          TLabels labels; -        UNIT_ASSERT(labels.Add(TStringBuf("name1"), TStringBuf("value1"))); +        UNIT_ASSERT(labels.Add(TStringBuf("name1"), TStringBuf("value1")));           UNIT_ASSERT(labels.Size() == 1); -        UNIT_ASSERT(labels.Has(TStringBuf("name1"))); +        UNIT_ASSERT(labels.Has(TStringBuf("name1")));           {              auto l = labels.Find("name1");              UNIT_ASSERT(l.Defined()); @@ -108,12 +108,12 @@ Y_UNIT_TEST_SUITE(TLabelsTest) {          }          // duplicated name -        UNIT_ASSERT(!labels.Add(TStringBuf("name1"), TStringBuf("value2"))); +        UNIT_ASSERT(!labels.Add(TStringBuf("name1"), TStringBuf("value2")));           UNIT_ASSERT(labels.Size() == 1); -        UNIT_ASSERT(labels.Add(TStringBuf("name2"), TStringBuf("value2"))); +        UNIT_ASSERT(labels.Add(TStringBuf("name2"), TStringBuf("value2")));           UNIT_ASSERT(labels.Size() == 2); -        UNIT_ASSERT(labels.Has(TStringBuf("name2"))); +        UNIT_ASSERT(labels.Has(TStringBuf("name2")));           {              auto l = labels.Find("name2");              UNIT_ASSERT(l.Defined()); diff --git a/library/cpp/monlib/metrics/log_histogram_snapshot.cpp b/library/cpp/monlib/metrics/log_histogram_snapshot.cpp index 21cf2ca2bbc..fae201f2690 100644 --- a/library/cpp/monlib/metrics/log_histogram_snapshot.cpp +++ b/library/cpp/monlib/metrics/log_histogram_snapshot.cpp @@ -9,16 +9,16 @@ namespace {  template <typename TStream>  auto& Output(TStream& o, const NMonitoring::TLogHistogramSnapshot& hist) { -    o << TStringBuf("{"); +    o << TStringBuf("{");       for (auto i = 0u; i < hist.Count(); ++i) { -        o << hist.UpperBound(i) << TStringBuf(": ") << hist.Bucket(i); -        o << TStringBuf(", "); +        o << hist.UpperBound(i) << TStringBuf(": ") << hist.Bucket(i);  +        o << TStringBuf(", ");       } -    o << TStringBuf("zeros: ") << hist.ZerosCount(); +    o << TStringBuf("zeros: ") << hist.ZerosCount();  -    o << TStringBuf("}"); +    o << TStringBuf("}");       return o;  } diff --git a/library/cpp/monlib/metrics/metric_type.cpp b/library/cpp/monlib/metrics/metric_type.cpp index a8a546e843c..ca1d32f7c6a 100644 --- a/library/cpp/monlib/metrics/metric_type.cpp +++ b/library/cpp/monlib/metrics/metric_type.cpp @@ -8,42 +8,42 @@ namespace NMonitoring {      TStringBuf MetricTypeToStr(EMetricType type) {          switch (type) {              case EMetricType::GAUGE: -                return TStringBuf("GAUGE"); +                return TStringBuf("GAUGE");               case EMetricType::COUNTER: -                return TStringBuf("COUNTER"); +                return TStringBuf("COUNTER");               case EMetricType::RATE: -                return TStringBuf("RATE"); +                return TStringBuf("RATE");               case EMetricType::IGAUGE: -                return TStringBuf("IGAUGE"); +                return TStringBuf("IGAUGE");               case EMetricType::HIST: -                return TStringBuf("HIST"); +                return TStringBuf("HIST");               case EMetricType::HIST_RATE: -                return TStringBuf("HIST_RATE"); +                return TStringBuf("HIST_RATE");               case EMetricType::DSUMMARY: -                return TStringBuf("DSUMMARY"); +                return TStringBuf("DSUMMARY");               case EMetricType::LOGHIST: -                return TStringBuf("LOGHIST"); +                return TStringBuf("LOGHIST");               default: -                return TStringBuf("UNKNOWN"); +                return TStringBuf("UNKNOWN");           }      }      EMetricType MetricTypeFromStr(TStringBuf str) { -        if (str == TStringBuf("GAUGE") || str == TStringBuf("DGAUGE")) { +        if (str == TStringBuf("GAUGE") || str == TStringBuf("DGAUGE")) {               return EMetricType::GAUGE; -        } else if (str == TStringBuf("COUNTER")) { +        } else if (str == TStringBuf("COUNTER")) {               return EMetricType::COUNTER; -        } else if (str == TStringBuf("RATE")) { +        } else if (str == TStringBuf("RATE")) {               return EMetricType::RATE; -        } else if (str == TStringBuf("IGAUGE")) { +        } else if (str == TStringBuf("IGAUGE")) {               return EMetricType::IGAUGE; -        } else if (str == TStringBuf("HIST")) { +        } else if (str == TStringBuf("HIST")) {               return EMetricType::HIST; -        } else if (str == TStringBuf("HIST_RATE")) { +        } else if (str == TStringBuf("HIST_RATE")) {               return EMetricType::HIST_RATE; -        } else if (str == TStringBuf("DSUMMARY")) { +        } else if (str == TStringBuf("DSUMMARY")) {               return EMetricType::DSUMMARY; -        } else if (str == TStringBuf("LOGHIST")) { +        } else if (str == TStringBuf("LOGHIST")) {               return EMetricType::LOGHIST;          } else {              ythrow yexception() << "unknown metric type: " << str; diff --git a/library/cpp/monlib/metrics/summary_snapshot.cpp b/library/cpp/monlib/metrics/summary_snapshot.cpp index 0b132633377..7d90846bfea 100644 --- a/library/cpp/monlib/metrics/summary_snapshot.cpp +++ b/library/cpp/monlib/metrics/summary_snapshot.cpp @@ -9,15 +9,15 @@ namespace {  template <typename TStream>  auto& Output(TStream& o, const NMonitoring::ISummaryDoubleSnapshot& s) { -    o << TStringBuf("{"); +    o << TStringBuf("{");  -    o << TStringBuf("sum: ") << s.GetSum() << TStringBuf(", "); -    o << TStringBuf("min: ") << s.GetMin() << TStringBuf(", "); -    o << TStringBuf("max: ") << s.GetMax() << TStringBuf(", "); -    o << TStringBuf("last: ") << s.GetLast() << TStringBuf(", "); -    o << TStringBuf("count: ") << s.GetCount(); +    o << TStringBuf("sum: ") << s.GetSum() << TStringBuf(", ");  +    o << TStringBuf("min: ") << s.GetMin() << TStringBuf(", ");  +    o << TStringBuf("max: ") << s.GetMax() << TStringBuf(", ");  +    o << TStringBuf("last: ") << s.GetLast() << TStringBuf(", ");  +    o << TStringBuf("count: ") << s.GetCount();  -    o << TStringBuf("}"); +    o << TStringBuf("}");       return o;  } diff --git a/library/cpp/monlib/service/format.h b/library/cpp/monlib/service/format.h index 0044b586b19..5eb32619662 100644 --- a/library/cpp/monlib/service/format.h +++ b/library/cpp/monlib/service/format.h @@ -21,9 +21,9 @@ namespace NMonitoring {          auto it = FindIf(std::begin(headers), std::end(headers),              [=] (const auto& h) {                  if constexpr (NPrivate::THasName<std::decay_t<decltype(h)>>::value) { -                    return AsciiCompareIgnoreCase(h.Name(), TStringBuf("accept-encoding")) == 0; +                    return AsciiCompareIgnoreCase(h.Name(), TStringBuf("accept-encoding")) == 0;                   } else if (isPlainPair) { -                    return AsciiCompareIgnoreCase(h.first, TStringBuf("accept-encoding")) == 0; +                    return AsciiCompareIgnoreCase(h.first, TStringBuf("accept-encoding")) == 0;                   }              }); @@ -46,14 +46,14 @@ namespace NMonitoring {      template <typename TRequest>      NMonitoring::EFormat ParseFormat(const TRequest& req) {          auto&& formatStr = req.GetParams() -            .Get(TStringBuf("format")); +            .Get(TStringBuf("format"));           if (!formatStr.empty()) { -            if (formatStr == TStringBuf("SPACK")) { +            if (formatStr == TStringBuf("SPACK")) {                   return EFormat::SPACK; -            } else if (formatStr == TStringBuf("TEXT")) { +            } else if (formatStr == TStringBuf("TEXT")) {                   return EFormat::TEXT; -            } else if (formatStr == TStringBuf("JSON")) { +            } else if (formatStr == TStringBuf("JSON")) {                   return EFormat::JSON;              } else {                  ythrow yexception() << "unknown format: " << formatStr << ". Only spack is supported here"; @@ -66,9 +66,9 @@ namespace NMonitoring {          auto it = FindIf(std::begin(headers), std::end(headers),              [=] (const auto& h) {                  if constexpr (NPrivate::THasName<std::decay_t<decltype(h)>>::value) { -                    return AsciiCompareIgnoreCase(h.Name(), TStringBuf("accept")) == 0; +                    return AsciiCompareIgnoreCase(h.Name(), TStringBuf("accept")) == 0;                   } else if (isPlainPair) { -                    return AsciiCompareIgnoreCase(h.first, TStringBuf("accept")) == 0; +                    return AsciiCompareIgnoreCase(h.first, TStringBuf("accept")) == 0;                   }              }); diff --git a/library/cpp/monlib/service/pages/index_mon_page.cpp b/library/cpp/monlib/service/pages/index_mon_page.cpp index 83ff8b529ae..3e2db86b9ee 100644 --- a/library/cpp/monlib/service/pages/index_mon_page.cpp +++ b/library/cpp/monlib/service/pages/index_mon_page.cpp @@ -15,7 +15,7 @@ void TIndexMonPage::OutputIndexPage(IMonHttpRequest& request) {  void TIndexMonPage::Output(IMonHttpRequest& request) {      TStringBuf pathInfo = request.GetPathInfo(); -    if (pathInfo.empty() || pathInfo == TStringBuf("/")) { +    if (pathInfo.empty() || pathInfo == TStringBuf("/")) {           OutputIndexPage(request);          return;      } diff --git a/library/cpp/monlib/service/pages/registry_mon_page.cpp b/library/cpp/monlib/service/pages/registry_mon_page.cpp index c59e50f622e..ecdba2e8278 100644 --- a/library/cpp/monlib/service/pages/registry_mon_page.cpp +++ b/library/cpp/monlib/service/pages/registry_mon_page.cpp @@ -15,10 +15,10 @@ namespace NMonitoring {              IMetricEncoderPtr encoder;              TString resp; -            if (formatStr == TStringBuf("json")) { +            if (formatStr == TStringBuf("json")) {                   resp = HTTPOKJSON;                  encoder = NMonitoring::EncoderJson(&out); -            } else if (formatStr == TStringBuf("spack")) { +            } else if (formatStr == TStringBuf("spack")) {                   resp = HTTPOKSPACK;                  const auto compression = ParseCompression(request);                  encoder = NMonitoring::EncoderSpackV1(&out, ETimePrecision::SECONDS, compression); diff --git a/library/cpp/on_disk/chunks/chunked_helpers.h b/library/cpp/on_disk/chunks/chunked_helpers.h index 5fa96afdca0..b5da9d11df7 100644 --- a/library/cpp/on_disk/chunks/chunked_helpers.h +++ b/library/cpp/on_disk/chunks/chunked_helpers.h @@ -14,7 +14,7 @@  #include "reader.h"  #include "writer.h" -#include <cmath> +#include <cmath>   #include <cstddef>  template <typename T> @@ -48,7 +48,7 @@ public:          return sizeof(ui64) + Size * sizeof(T);      } -    ~TYVector() = default; +    ~TYVector() = default;   };  template <typename T> @@ -57,7 +57,7 @@ private:      TVector<T> Vector;  public: -    TYVectorWriter() = default; +    TYVectorWriter() = default;       void PushBack(const T& value) {          Vector.push_back(value); @@ -423,7 +423,7 @@ private:      T Value;  public: -    TSingleValueWriter() = default; +    TSingleValueWriter() = default;       TSingleValueWriter(const T& value)          : Value(value) diff --git a/library/cpp/openssl/holders/bio.cpp b/library/cpp/openssl/holders/bio.cpp index 42cc5fc1ef7..e6473ec758a 100644 --- a/library/cpp/openssl/holders/bio.cpp +++ b/library/cpp/openssl/holders/bio.cpp @@ -16,7 +16,7 @@ namespace NOpenSSL {      )          : THolder(type, name)      { -        BIO_meth_set_write(*this, write); +        BIO_meth_set_write(*this, write);           BIO_meth_set_read(*this, read);          BIO_meth_set_puts(*this, puts);          BIO_meth_set_gets(*this, gets); diff --git a/library/cpp/openssl/io/stream.cpp b/library/cpp/openssl/io/stream.cpp index 0b4be38c0e3..f9fdeb27468 100644 --- a/library/cpp/openssl/io/stream.cpp +++ b/library/cpp/openssl/io/stream.cpp @@ -25,15 +25,15 @@ namespace {          }      }; -    int GetLastSslError() noexcept { +    int GetLastSslError() noexcept {           return ERR_peek_last_error();      } -    const char* SslErrorText(int error) noexcept { +    const char* SslErrorText(int error) noexcept {           return ERR_error_string(error, nullptr);      } -    inline TStringBuf SslLastError() noexcept { +    inline TStringBuf SslLastError() noexcept {           return SslErrorText(GetLastSslError());      } @@ -69,7 +69,7 @@ namespace {      using TBioPtr = TSslHolderPtr<bio_st>;      using TX509Ptr = TSslHolderPtr<x509_st>; -    inline TSslContextPtr CreateSslCtx(const ssl_method_st* method) { +    inline TSslContextPtr CreateSslCtx(const ssl_method_st* method) {           TSslContextPtr ctx(SSL_CTX_new(method));          if (!ctx) { diff --git a/library/cpp/packedtypes/packedfloat.h b/library/cpp/packedtypes/packedfloat.h index f178912ed33..829e283ddc8 100644 --- a/library/cpp/packedtypes/packedfloat.h +++ b/library/cpp/packedtypes/packedfloat.h @@ -8,7 +8,7 @@  #include <cfloat>  #include <limits>  #include <algorithm> -#include <cassert> +#include <cassert>   namespace NPackedFloat {      /* @@ -146,66 +146,66 @@ namespace NPackedFloat {      };  } -using f64 = double; -using f32 = float; +using f64 = double;  +using f32 = float;   static_assert(sizeof(f32) == 4, "expect sizeof(f32) == 4");  static_assert(sizeof(f64) == 8, "expect sizeof(f64) == 8"); -using f16 = NPackedFloat::float16<1>; -using uf16 = NPackedFloat::float16<0>; -using f8 = NPackedFloat::float8<1>; -using uf8 = NPackedFloat::float8<0>; -using f8d = NPackedFloat::float8<1, 1>; -using uf8d = NPackedFloat::float8<0, 1>; +using f16 = NPackedFloat::float16<1>;  +using uf16 = NPackedFloat::float16<0>;  +using f8 = NPackedFloat::float8<1>;  +using uf8 = NPackedFloat::float8<0>;  +using f8d = NPackedFloat::float8<1, 1>;  +using uf8d = NPackedFloat::float8<0, 1>;   // [0,1) value in 1/255s. -using frac8 = ui8; +using frac8 = ui8;  -using frac16 = ui16; +using frac16 = ui16;   template <class T> -inline constexpr T Float2Frac(float fac) { +inline constexpr T Float2Frac(float fac) {       return T(fac * float(Max<T>()));  }  template <class T> -inline constexpr T Float2FracR(float fac) { +inline constexpr T Float2FracR(float fac) {       float v = fac * float(Max<T>());      return T(v + 0.5f);  }  template <class T> -inline constexpr float Frac2Float(T pf) { -    constexpr float multiplier = float(1.0 / Max<T>()); -    return pf * multiplier; +inline constexpr float Frac2Float(T pf) {  +    constexpr float multiplier = float(1.0 / Max<T>());  +    return pf * multiplier;   } -class TUi82FloatMapping { -private: -    float Mapping[Max<ui8>() + 1] = {}; - -public: -    constexpr TUi82FloatMapping() noexcept { -        for (ui32 i = 0; i < Y_ARRAY_SIZE(Mapping); ++i) { -            Mapping[i] = static_cast<float>(i) / Max<ui8>(); -        } -    } - -    inline float operator [] (ui8 index) const { -        return Mapping[index]; -    } -}; - -constexpr TUi82FloatMapping Ui82FloatMapping{}; - -template <> -inline float Frac2Float(ui8 pf) { -    return Ui82FloatMapping[pf]; -} - -// Probably you don't want to use it, since sizeof(float) == sizeof(ui32) -template <> -inline float Frac2Float(ui32 pf) = delete; - +class TUi82FloatMapping {  +private:  +    float Mapping[Max<ui8>() + 1] = {};  +  +public:  +    constexpr TUi82FloatMapping() noexcept {  +        for (ui32 i = 0; i < Y_ARRAY_SIZE(Mapping); ++i) {  +            Mapping[i] = static_cast<float>(i) / Max<ui8>();  +        }  +    }  +  +    inline float operator [] (ui8 index) const {  +        return Mapping[index];  +    }  +};  +  +constexpr TUi82FloatMapping Ui82FloatMapping{};  +  +template <>  +inline float Frac2Float(ui8 pf) {  +    return Ui82FloatMapping[pf];  +}  +  +// Probably you don't want to use it, since sizeof(float) == sizeof(ui32)  +template <>  +inline float Frac2Float(ui32 pf) = delete;  +   template <class T>  inline float FracOrFloatToFloat(T t) {      return Frac2Float(t); diff --git a/library/cpp/packers/packers.h b/library/cpp/packers/packers.h index 1bde1b59aaf..41ae4300225 100644 --- a/library/cpp/packers/packers.h +++ b/library/cpp/packers/packers.h @@ -105,7 +105,7 @@ namespace NPackers {      template <>      inline size_t TIntegralPacker<ui64>::MeasureLeaf(const ui64& val) const { -        constexpr size_t MAX_SIZE = sizeof(ui64) + sizeof(ui64) / 8; +        constexpr size_t MAX_SIZE = sizeof(ui64) + sizeof(ui64) / 8;           ui64 value = val;          size_t len = 1; diff --git a/library/cpp/protobuf/json/ut/json2proto_ut.cpp b/library/cpp/protobuf/json/ut/json2proto_ut.cpp index 0dfe57bc7a2..cdc8bc87be7 100644 --- a/library/cpp/protobuf/json/ut/json2proto_ut.cpp +++ b/library/cpp/protobuf/json/ut/json2proto_ut.cpp @@ -123,7 +123,7 @@ Y_UNIT_TEST(TestNameGenerator) {      cfg.SetNameGenerator([](const NProtoBuf::FieldDescriptor&) { return "42"; });      TNameGeneratorType proto; -    Json2Proto(TStringBuf(R"({"42":42})"), proto, cfg); +    Json2Proto(TStringBuf(R"({"42":42})"), proto, cfg);       TNameGeneratorType expected;      expected.SetField(42); @@ -524,7 +524,7 @@ Y_UNIT_TEST(TestInvalidRepeatedFieldWithMapAsObject) {      TCompositeRepeated proto;      TJson2ProtoConfig config;      config.MapAsObject = true; -    UNIT_ASSERT_EXCEPTION(Json2Proto(TStringBuf(R"({"Part":{"Boo":{}}})"), proto, config), yexception); +    UNIT_ASSERT_EXCEPTION(Json2Proto(TStringBuf(R"({"Part":{"Boo":{}}})"), proto, config), yexception);   }  Y_UNIT_TEST(TestStringTransforms) { diff --git a/library/cpp/random_provider/random_provider.cpp b/library/cpp/random_provider/random_provider.cpp index 64cb48b8b7a..d9399a4f384 100644 --- a/library/cpp/random_provider/random_provider.cpp +++ b/library/cpp/random_provider/random_provider.cpp @@ -25,7 +25,7 @@ public:          return ret;      } -    TGUID GenUuid4() noexcept override { +    TGUID GenUuid4() noexcept override {           TGUID ret;          WriteUnaligned<ui64>(ret.dw, RandomNumber<ui64>());          WriteUnaligned<ui64>(ret.dw + 2, RandomNumber<ui64>()); @@ -53,7 +53,7 @@ public:          return ret;      } -    TGUID GenUuid4() noexcept override { +    TGUID GenUuid4() noexcept override {           TGUID ret;          WriteUnaligned<ui64>(ret.dw, Gen.GenRand());          WriteUnaligned<ui64>(ret.dw + 2, Gen.GenRand()); diff --git a/library/cpp/regex/pcre/README.md b/library/cpp/regex/pcre/README.md index b5b09a3715b..7a143b2616d 100644 --- a/library/cpp/regex/pcre/README.md +++ b/library/cpp/regex/pcre/README.md @@ -8,7 +8,7 @@ This library allows us to erase these charset conversions.  # Interface  Before starting with interface details, let's consider simplest library usage example: -`UNIT_ASSERT(NPcre::TPcre<wchar16>(u"ba+d").Matches(TWtringBuf(u"baaad")));` +`UNIT_ASSERT(NPcre::TPcre<wchar16>(u"ba+d").Matches(TWtringBuf(u"baaad")));`   Here we see regular expression construction for UTF-16 charset: @@ -16,7 +16,7 @@ Here we see regular expression construction for UTF-16 charset:  and matching of the subject string `baaad` against this pattern: -`.Matches(TWtringBuf(u"baaad"))`; +`.Matches(TWtringBuf(u"baaad"))`;   Let's consider both of them in details. diff --git a/library/cpp/regex/pire/ut/regexp_ut.cpp b/library/cpp/regex/pire/ut/regexp_ut.cpp index e7206de9ad4..7ff84e0a26f 100644 --- a/library/cpp/regex/pire/ut/regexp_ut.cpp +++ b/library/cpp/regex/pire/ut/regexp_ut.cpp @@ -19,16 +19,16 @@ Y_UNIT_TEST_SUITE(TRegExp) {      Y_UNIT_TEST(Boundaries) {          UNIT_ASSERT(!TMatcher(TFsm("qwb$", TFsm::TOptions().SetSurround(true))).Match("aqwb").Final());          UNIT_ASSERT(!TMatcher(TFsm("^aqw", TFsm::TOptions().SetSurround(true))).Match("aqwb").Final()); -        UNIT_ASSERT(TMatcher(TFsm("qwb$", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final()); -        UNIT_ASSERT(TMatcher(TFsm("^aqw", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final()); -        UNIT_ASSERT(!TMatcher(TFsm("qw$", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final()); -        UNIT_ASSERT(!TMatcher(TFsm("^qw", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final()); +        UNIT_ASSERT(TMatcher(TFsm("qwb$", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final());  +        UNIT_ASSERT(TMatcher(TFsm("^aqw", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final());  +        UNIT_ASSERT(!TMatcher(TFsm("qw$", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final());  +        UNIT_ASSERT(!TMatcher(TFsm("^qw", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final());           UNIT_ASSERT(TMatcher(TFsm("^aqwb$", TFsm::TOptions().SetSurround(true))) -                        .Match(TStringBuf("a"), true, false) -                        .Match(TStringBuf("q"), false, false) -                        .Match(TStringBuf("w"), false, false) -                        .Match(TStringBuf("b"), false, true) +                        .Match(TStringBuf("a"), true, false)  +                        .Match(TStringBuf("q"), false, false)  +                        .Match(TStringBuf("w"), false, false)  +                        .Match(TStringBuf("b"), false, true)                           .Final());      } @@ -100,7 +100,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSearcher searcher(fsm);          searcher.Search("in db and here we have user_id=0x0d0a; same as CRLF");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("0x0d0a")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("0x0d0a"));       }      Y_UNIT_TEST(Capture2) { @@ -109,7 +109,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSearcher searcher(fsm);          searcher.Search("wabcdef");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("abcde")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("abcde"));       }      Y_UNIT_TEST(Capture3) { @@ -119,7 +119,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSearcher searcher(fsm);          searcher.Search("http://vkontakte.ru/id100500");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("100500")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("100500"));       }      Y_UNIT_TEST(Capture4) { @@ -129,7 +129,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSearcher searcher(fsm);          searcher.Search("   Здравствуйте, Уважаемый (-ая)!   ");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("Уважаемый (-ая)")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("Уважаемый (-ая)"));       }      Y_UNIT_TEST(Capture5) { @@ -137,7 +137,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSearcher searcher(fsm);          searcher.Search("\"/away.php?to=http:some.addr\"&id=1");          UNIT_ASSERT(searcher.Captured()); -        //UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("some.addr")); +        //UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("some.addr"));       }      Y_UNIT_TEST(Capture6) { @@ -145,7 +145,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSearcher searcher(fsm);          searcher.Search("/some/table/path/to-match-with");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("/to-match-with")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("/to-match-with"));       }      Y_UNIT_TEST(Capture7) { @@ -153,7 +153,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSearcher searcher(fsm);          searcher.Search("ala pref bla suff cla");          UNIT_ASSERT(searcher.Captured()); -        //UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("pref bla suff")); +        //UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("pref bla suff"));       }      Y_UNIT_TEST(CaptureXA) { @@ -162,7 +162,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSearcher searcher(fsm);          searcher.Search("xa");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xa")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xa"));       }      Y_UNIT_TEST(CaptureWrongXX) { @@ -175,7 +175,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          // TCapturingFsm uses a fast - O(|text|) - but incorrect algorithm.          // It works more or less for a particular class of regexps to which ".*(xx).*" does not belong.          // So it returns not the expected "xx" but just the second "x" instead. -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("x")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("x"));       }      Y_UNIT_TEST(CaptureRight1XX) { @@ -194,7 +194,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          searcher.Search("axx");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xx")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xx"));       }      Y_UNIT_TEST(CaptureRight3XX) { @@ -204,7 +204,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          searcher.Search("axxb");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xx")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xx"));       }      Y_UNIT_TEST(SlowCaptureXX) { @@ -213,7 +213,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSlowSearcher searcher(fsm);          searcher.Search("xx");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xx")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xx"));       }      Y_UNIT_TEST(SlowCapture) { @@ -222,7 +222,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSlowSearcher searcher(fsm);          searcher.Search("http://vkontakte.ru/id100500");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("100500")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("100500"));       }      Y_UNIT_TEST(SlowCaptureGreedy) { @@ -230,7 +230,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSlowSearcher searcher(fsm);          searcher.Search("pref ala bla pref cla suff dla");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("pref cla suff")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("pref cla suff"));       }      Y_UNIT_TEST(SlowCaptureNonGreedy) { @@ -238,7 +238,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSlowSearcher searcher(fsm);          searcher.Search("pref ala bla pref cla suff dla");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("pref ala bla pref cla suff")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("pref ala bla pref cla suff"));       }      Y_UNIT_TEST(SlowCapture2) { @@ -248,7 +248,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSlowSearcher searcher(fsm);          searcher.Search("   Здравствуйте, Уважаемый (-ая)!   ");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("Уважаемый (-ая)")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("Уважаемый (-ая)"));       }      Y_UNIT_TEST(SlowCapture3) { @@ -256,7 +256,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSlowSearcher searcher(fsm);          searcher.Search("in db and here we have user_id=0x0d0a; same as CRLF");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("0x0d0a")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("0x0d0a"));       }      Y_UNIT_TEST(SlowCapture4) { @@ -264,7 +264,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSlowSearcher searcher(fsm);          searcher.Search("\"/away.php?to=http:some.addr\"&id=1");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("some.addr")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("some.addr"));       }      Y_UNIT_TEST(CapturedEmptySlow) { @@ -272,7 +272,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSlowSearcher searcher(fsm);          searcher.Search("And Comments=");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf(""));       }      Y_UNIT_TEST(CaptureInOrFirst) { @@ -294,7 +294,7 @@ Y_UNIT_TEST_SUITE(TRegExp) {          TSlowSearcher searcher(fsm);          searcher.Search("ID=");          UNIT_ASSERT(searcher.Captured()); -        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("")); +        UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf(""));       }      Y_UNIT_TEST(CaptureInside) { diff --git a/library/cpp/resource/registry.cpp b/library/cpp/resource/registry.cpp index 66001c47693..537d8e51269 100644 --- a/library/cpp/resource/registry.cpp +++ b/library/cpp/resource/registry.cpp @@ -12,7 +12,7 @@ using namespace NResource;  using namespace NBlockCodecs;  namespace { -    inline const ICodec* GetCodec() noexcept { +    inline const ICodec* GetCodec() noexcept {           static const ICodec* ret = Codec("zstd08_5");          return ret; diff --git a/library/cpp/scheme/scimpl_json_write.cpp b/library/cpp/scheme/scimpl_json_write.cpp index aadd7e6cd5f..164ccbec319 100644 --- a/library/cpp/scheme/scimpl_json_write.cpp +++ b/library/cpp/scheme/scimpl_json_write.cpp @@ -70,7 +70,7 @@ namespace NSc {          NImpl::TSelfLoopContext::TGuard loopCheck(loopCtx, core);          if (!loopCheck.Ok) { -            out << TStringBuf("null"); // a loop encountered (and asserted), skip the back reference +            out << TStringBuf("null"); // a loop encountered (and asserted), skip the back reference               return;          } @@ -80,11 +80,11 @@ namespace NSc {                  [[fallthrough]]; /* no break */              }              case EType::Null: { -                out << TStringBuf("null"); +                out << TStringBuf("null");                   break;              }              case EType::Bool: { -                out << (core.IntNumber ? TStringBuf("true") : TStringBuf("false")); +                out << (core.IntNumber ? TStringBuf("true") : TStringBuf("false"));                   break;              }              case EType::IntNumber: { @@ -96,7 +96,7 @@ namespace NSc {                  if (!jopts.NumberPolicy || jopts.NumberPolicy(d)) {                      out << d;                  } else { -                    out << TStringBuf("null"); +                    out << TStringBuf("null");                   }                  break;              } @@ -105,7 +105,7 @@ namespace NSc {                  if (!jopts.StringPolicy || jopts.StringPolicy(s)) {                      WriteString(out, s);                  } else { -                    out << TStringBuf("null"); +                    out << TStringBuf("null");                   }                  break;              } diff --git a/library/cpp/scheme/tests/fuzz_ops/ut/vm_parse_ut.cpp b/library/cpp/scheme/tests/fuzz_ops/ut/vm_parse_ut.cpp index ce3786a6714..9a1a4fa738f 100644 --- a/library/cpp/scheme/tests/fuzz_ops/ut/vm_parse_ut.cpp +++ b/library/cpp/scheme/tests/fuzz_ops/ut/vm_parse_ut.cpp @@ -48,27 +48,27 @@ Y_UNIT_TEST_SUITE(TestParseNextAction) {      Y_UNIT_TEST(TestParsePos) {          DoTestParsePosFailure("", 1, 0); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x00"sv), 1, 0), 0); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x01"sv), 1, 0), 0); +        UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x00"sv), 1, 0), 0);  +        UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x01"sv), 1, 0), 0);  -        DoTestParsePosFailure(TStringBuf("\x02"sv), 1, 0); -        DoTestParsePosFailure(TStringBuf("\x03"sv), 2, 0); +        DoTestParsePosFailure(TStringBuf("\x02"sv), 1, 0);  +        DoTestParsePosFailure(TStringBuf("\x03"sv), 2, 0);  -        UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x02"sv), 2, 0), 1); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x03"sv), 2, 1), 0); +        UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x02"sv), 2, 0), 1);  +        UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x03"sv), 2, 1), 0);  -        UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x0E"sv), 8, 0), 7); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x0F"sv), 8, 7), 0); +        UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x0E"sv), 8, 0), 7);  +        UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x0F"sv), 8, 7), 0);           { -            TVMState st{TStringBuf("\xDE\x7B"), 16, 0}; +            TVMState st{TStringBuf("\xDE\x7B"), 16, 0};               UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(st), 15);              UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(st), 15);              UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(st), 15);              UNIT_ASSERT(!ParsePos(st));          }          { -            TVMState st{TStringBuf("\xFF\x7F"), 16, 15}; +            TVMState st{TStringBuf("\xFF\x7F"), 16, 15};               UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(st), 0);              UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(st), 0);              UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(st), 0); @@ -97,15 +97,15 @@ Y_UNIT_TEST_SUITE(TestParseNextAction) {      Y_UNIT_TEST(TestParseRef) {          DoTestParseRefFailure("", 1, 0); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(TStringBuf("\x00"sv), 1, 0), std::make_pair((ui32)-1, TRef::T_CREATE_FRONT)); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(TStringBuf("\x01"sv), 1, 0), std::make_pair((ui32)-1, TRef::T_CREATE_BACK)); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(TStringBuf("\x0A"sv), 2, 0), std::make_pair(1u, TRef::T_REF__POS)); +        UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(TStringBuf("\x00"sv), 1, 0), std::make_pair((ui32)-1, TRef::T_CREATE_FRONT));  +        UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(TStringBuf("\x01"sv), 1, 0), std::make_pair((ui32)-1, TRef::T_CREATE_BACK));  +        UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(TStringBuf("\x0A"sv), 2, 0), std::make_pair(1u, TRef::T_REF__POS));  -        DoTestParseRefFailure(TStringBuf("\x12"), 1, 0); -        DoTestParseRefFailure(TStringBuf("\x03"sv), 1, 0); +        DoTestParseRefFailure(TStringBuf("\x12"), 1, 0);  +        DoTestParseRefFailure(TStringBuf("\x03"sv), 1, 0);           { -            TVMState st{TStringBuf("\x7A\x7D"), 16, 0}; +            TVMState st{TStringBuf("\x7A\x7D"), 16, 0};               UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(st), std::make_pair(15u, TRef::T_REF__POS));              UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(st), std::make_pair(15u, TRef::T_REF__POS));              UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(st), std::make_pair((ui32)-1, TRef::T_CREATE_BACK)); @@ -134,14 +134,14 @@ Y_UNIT_TEST_SUITE(TestParseNextAction) {      Y_UNIT_TEST(TestParseSrc) {          DoTestParseSrcFailure("", 1, 0); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParseSrcSuccess(TStringBuf("\x08"sv), 2, 0), std::make_pair(1u, TSrc::T_LREF__POS)); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParseSrcSuccess(TStringBuf("\x09"sv), 2, 0), std::make_pair(1u, TSrc::T_CREF__POS)); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParseSrcSuccess(TStringBuf("\x0A"sv), 2, 0), std::make_pair(1u, TSrc::T_RREF__POS)); +        UNIT_ASSERT_VALUES_EQUAL(DoTestParseSrcSuccess(TStringBuf("\x08"sv), 2, 0), std::make_pair(1u, TSrc::T_LREF__POS));  +        UNIT_ASSERT_VALUES_EQUAL(DoTestParseSrcSuccess(TStringBuf("\x09"sv), 2, 0), std::make_pair(1u, TSrc::T_CREF__POS));  +        UNIT_ASSERT_VALUES_EQUAL(DoTestParseSrcSuccess(TStringBuf("\x0A"sv), 2, 0), std::make_pair(1u, TSrc::T_RREF__POS));  -        DoTestParseSrcFailure(TStringBuf("\x03"sv), 1, 0); +        DoTestParseSrcFailure(TStringBuf("\x03"sv), 1, 0);           { -            TVMState st{TStringBuf("\x7A\x7D"), 16, 0}; +            TVMState st{TStringBuf("\x7A\x7D"), 16, 0};               UNIT_ASSERT_VALUES_EQUAL(DoTestParseSrcSuccess(st), std::make_pair(15u, TSrc::T_RREF__POS));              UNIT_ASSERT_VALUES_EQUAL(DoTestParseSrcSuccess(st), std::make_pair(15u, TSrc::T_RREF__POS));              UNIT_ASSERT(!ParseSrc(st)); @@ -169,21 +169,21 @@ Y_UNIT_TEST_SUITE(TestParseNextAction) {      Y_UNIT_TEST(TestParseDst) {          DoTestParseDstFailure("", 1, 0); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x00"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_FRONT_LREF)); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x01"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_FRONT_CREF)); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x02"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_FRONT_RREF)); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x03"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_BACK_LREF)); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x04"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_BACK_CREF)); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x05"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_BACK_RREF)); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x26\x00"sv), 2, 0), std::make_pair(1u, TDst::T_LREF__POS)); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x27\x00"sv), 2, 0), std::make_pair(1u, TDst::T_CREF__POS)); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x28\x00"sv), 2, 0), std::make_pair(1u, TDst::T_RREF__POS)); +        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x00"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_FRONT_LREF));  +        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x01"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_FRONT_CREF));  +        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x02"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_FRONT_RREF));  +        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x03"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_BACK_LREF));  +        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x04"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_BACK_CREF));  +        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x05"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_BACK_RREF));  +        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x26\x00"sv), 2, 0), std::make_pair(1u, TDst::T_LREF__POS));  +        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x27\x00"sv), 2, 0), std::make_pair(1u, TDst::T_CREF__POS));  +        UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x28\x00"sv), 2, 0), std::make_pair(1u, TDst::T_RREF__POS));  -        DoTestParseDstFailure(TStringBuf("\x06"sv), 1, 0); -        DoTestParseDstFailure(TStringBuf("\x09\x00"sv), 1, 0); +        DoTestParseDstFailure(TStringBuf("\x06"sv), 1, 0);  +        DoTestParseDstFailure(TStringBuf("\x09\x00"sv), 1, 0);           { -            TVMState st{TStringBuf("\x14\xE7\x09"sv), 16, 0}; +            TVMState st{TStringBuf("\x14\xE7\x09"sv), 16, 0};               // 4=4              UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(st), std::make_pair((ui32)-1, TDst::T_CREATE_BACK_CREF));              // 4=8 @@ -217,8 +217,8 @@ Y_UNIT_TEST_SUITE(TestParseNextAction) {      Y_UNIT_TEST(TestParsePath) {          DoTestParsePathFailure("", 1, 0); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParsePathSuccess(TStringBuf("\x00"sv), 1, 0), TStringBuf("")); -        UNIT_ASSERT_VALUES_EQUAL(DoTestParsePathSuccess(TStringBuf("\x21\x0C"sv), 1, 0), TStringBuf("a")); +        UNIT_ASSERT_VALUES_EQUAL(DoTestParsePathSuccess(TStringBuf("\x00"sv), 1, 0), TStringBuf(""));  +        UNIT_ASSERT_VALUES_EQUAL(DoTestParsePathSuccess(TStringBuf("\x21\x0C"sv), 1, 0), TStringBuf("a"));           DoTestParsePathFailure("\x22\x0C", 1, 0);      } diff --git a/library/cpp/scheme/tests/ut/scheme_cast_ut.cpp b/library/cpp/scheme/tests/ut/scheme_cast_ut.cpp index 4f907157e92..84fa453ffc1 100644 --- a/library/cpp/scheme/tests/ut/scheme_cast_ut.cpp +++ b/library/cpp/scheme/tests/ut/scheme_cast_ut.cpp @@ -14,7 +14,7 @@ using THI = THashMap<int, int>;  using TMI = TMap<int, int>;  using THSI = THashSet<int>;  using TSI = TSet<int>; -using TPI = std::pair<int, int>; +using TPI = std::pair<int, int>;   Y_UNIT_TEST_SUITE(TSchemeCastTest) {      Y_UNIT_TEST(TestYVector) { diff --git a/library/cpp/scheme/tests/ut/scheme_json_ut.cpp b/library/cpp/scheme/tests/ut/scheme_json_ut.cpp index daeb2654f9a..429add30308 100644 --- a/library/cpp/scheme/tests/ut/scheme_json_ut.cpp +++ b/library/cpp/scheme/tests/ut/scheme_json_ut.cpp @@ -9,8 +9,8 @@  #include <type_traits>  #include <library/cpp/string_utils/quote/quote.h> -using namespace std::string_view_literals; - +using namespace std::string_view_literals;  +   Y_UNIT_TEST_SUITE(TSchemeJsonTest) {      Y_UNIT_TEST(TestJson) {          const char* json = "[\n" @@ -122,7 +122,7 @@ Y_UNIT_TEST_SUITE(TSchemeJsonTest) {      }      Y_UNIT_TEST(TestJsonEscape) { -        NSc::TValue v("\10\7\6\5\4\3\2\1\0"sv); +        NSc::TValue v("\10\7\6\5\4\3\2\1\0"sv);           UNIT_ASSERT_VALUES_EQUAL(v.ToJson(), "\"\\b\\u0007\\u0006\\u0005\\u0004\\u0003\\u0002\\u0001\\u0000\"");      } diff --git a/library/cpp/scheme/tests/ut/scheme_merge_ut.cpp b/library/cpp/scheme/tests/ut/scheme_merge_ut.cpp index 2a06cf110da..d7e2f758180 100644 --- a/library/cpp/scheme/tests/ut/scheme_merge_ut.cpp +++ b/library/cpp/scheme/tests/ut/scheme_merge_ut.cpp @@ -42,8 +42,8 @@ Y_UNIT_TEST_SUITE(TSchemeMergeTest) {          UNIT_ASSERT(0. == v["a"][1]["f"]);          UNIT_ASSERT(v["a"][1]["g"].IsArray());          UNIT_ASSERT(v["a"][1]["g"].Has(1)); -        UNIT_ASSERT(TStringBuf("h") == v["a"][1]["g"][0]); -        UNIT_ASSERT(TStringBuf("i") == v["a"][1]["g"][1]); +        UNIT_ASSERT(TStringBuf("h") == v["a"][1]["g"][0]);  +        UNIT_ASSERT(TStringBuf("i") == v["a"][1]["g"][1]);           {              TStringBuf data = "{ a : [ { d : 42 }, { g : [ 3 ] } ], q : r }"; @@ -64,7 +64,7 @@ Y_UNIT_TEST_SUITE(TSchemeMergeTest) {          UNIT_ASSERT(v.Has("a"));          UNIT_ASSERT(v.Has("q")); -        UNIT_ASSERT(TStringBuf("r") == v["q"]); +        UNIT_ASSERT(TStringBuf("r") == v["q"]);           UNIT_ASSERT(v["a"].Has(1));          UNIT_ASSERT(!v["a"][0].Has("b"));          UNIT_ASSERT(v["a"][0].Has("d")); diff --git a/library/cpp/sighandler/async_signals_handler.cpp b/library/cpp/sighandler/async_signals_handler.cpp index 00ce1c18fbd..ee75e157e5f 100644 --- a/library/cpp/sighandler/async_signals_handler.cpp +++ b/library/cpp/sighandler/async_signals_handler.cpp @@ -25,9 +25,9 @@  #include <util/generic/hash.h>  namespace { -    volatile int SIGNAL_PIPE_WRITE_FD = 0; // will be initialized in ctor +    volatile int SIGNAL_PIPE_WRITE_FD = 0; // will be initialized in ctor  -    void WriteAllOrDie(const int fd, const void* buf, size_t bufsize) { +    void WriteAllOrDie(const int fd, const void* buf, size_t bufsize) {           size_t totalBytesWritten = 0;          while (totalBytesWritten != bufsize) { @@ -38,7 +38,7 @@ namespace {          }      } -    void PipeWriterSignalHandler(int, siginfo_t* info, void*) { +    void PipeWriterSignalHandler(int, siginfo_t* info, void*) {           const ui8 signum = static_cast<ui8>(info->si_signo);          WriteAllOrDie(SIGNAL_PIPE_WRITE_FD, &signum, 1); @@ -188,7 +188,7 @@ namespace {      // It such situation we have 2 options:      //  - wait for auxiliary thread to die - which will cause dead lock      //  - destruct variable, ignoring thread - which will cause data corruption. -    TAsyncSignalsHandler* SIGNALS_HANDLER = nullptr; +    TAsyncSignalsHandler* SIGNALS_HANDLER = nullptr;   }  void SetAsyncSignalHandler(int signum, TAutoPtr<TEventHandler> handler) { diff --git a/library/cpp/sse/ut/test.cpp b/library/cpp/sse/ut/test.cpp index 33c999d284b..ad07abe0638 100644 --- a/library/cpp/sse/ut/test.cpp +++ b/library/cpp/sse/ut/test.cpp @@ -60,15 +60,15 @@ struct T_mm_CallWrapper {      T_mm_CallWrapper<__m128, decltype(_mm_func), _mm_func>  #define WrapD(_mm_func) \      T_mm_CallWrapper<__m128d, decltype(_mm_func), _mm_func> -using int8x16_t = std::array<i8, 16>; -using int16x8_t = std::array<i16, 8>; -using int32x4_t = std::array<i32, 4>; -using int64x2_t = std::array<i64, 2>; -using uint8x16_t = std::array<ui8, 16>; -using uint16x8_t = std::array<ui16, 8>; -using uint32x4_t = std::array<ui32, 4>; -using uint64x2_t = std::array<ui64, 2>; -using float32x4_t = std::array<float, 4>; +using int8x16_t = std::array<i8, 16>;  +using int16x8_t = std::array<i16, 8>;  +using int32x4_t = std::array<i32, 4>;  +using int64x2_t = std::array<i64, 2>;  +using uint8x16_t = std::array<ui8, 16>;  +using uint16x8_t = std::array<ui16, 8>;  +using uint32x4_t = std::array<ui32, 4>;  +using uint64x2_t = std::array<ui64, 2>;  +using float32x4_t = std::array<float, 4>;   using float64x2_t = std::array<double, 2>;  template <typename TVectorType> diff --git a/library/cpp/streams/lz/lz.cpp b/library/cpp/streams/lz/lz.cpp index b65bb3ed965..82b7b332487 100644 --- a/library/cpp/streams/lz/lz.cpp +++ b/library/cpp/streams/lz/lz.cpp @@ -180,7 +180,7 @@ class TDecompressorBaseImpl: public TDecompressor, public TCommonData {  public:      static inline ui32 CheckVer(ui32 v) {          if (v != 1) { -            ythrow yexception() << TStringBuf("incorrect stream version: ") << v; +            ythrow yexception() << TStringBuf("incorrect stream version: ") << v;           }          return v; diff --git a/library/cpp/streams/zstd/zstd.cpp b/library/cpp/streams/zstd/zstd.cpp index 29816f6d4c9..45fad9f5c54 100644 --- a/library/cpp/streams/zstd/zstd.cpp +++ b/library/cpp/streams/zstd/zstd.cpp @@ -9,7 +9,7 @@  namespace {      inline void CheckError(const char* op, size_t code) {          if (::ZSTD_isError(code)) { -            ythrow yexception() << op << TStringBuf(" zstd error: ") << ::ZSTD_getErrorName(code); +            ythrow yexception() << op << TStringBuf(" zstd error: ") << ::ZSTD_getErrorName(code);           }      } diff --git a/library/cpp/string_utils/base64/base64.cpp b/library/cpp/string_utils/base64/base64.cpp index 05c201f0de7..c85ad417ce9 100644 --- a/library/cpp/string_utils/base64/base64.cpp +++ b/library/cpp/string_utils/base64/base64.cpp @@ -65,7 +65,7 @@ namespace {          }      }; -    const TImpl GetImpl() { +    const TImpl GetImpl() {           static const TImpl IMPL;          return IMPL;      } diff --git a/library/cpp/string_utils/base64/base64_ut.cpp b/library/cpp/string_utils/base64/base64_ut.cpp index bcc1e658791..4dbefc74e81 100644 --- a/library/cpp/string_utils/base64/base64_ut.cpp +++ b/library/cpp/string_utils/base64/base64_ut.cpp @@ -16,8 +16,8 @@  #include <array> -using namespace std::string_view_literals; - +using namespace std::string_view_literals;  +   #define BASE64_UT_DECLARE_BASE64_IMPL(prefix, encFunction, decFunction)                                                        \      Y_DECLARE_UNUSED                                                                                                           \      static size_t prefix##Base64Decode(void* dst, const char* b, const char* e) {                                              \ @@ -298,7 +298,7 @@ Y_UNIT_TEST_SUITE(TBase64) {      }      Y_UNIT_TEST(TestAllPossibleOctets) { -        const TString x("\0\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0B\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7F"sv); +        const TString x("\0\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0B\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7F"sv);           const TString xEnc = "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn8=";          const TString y = Base64Decode(xEnc);          const TString yEnc = Base64Encode(x); @@ -307,7 +307,7 @@ Y_UNIT_TEST_SUITE(TBase64) {      }      Y_UNIT_TEST(TestTwoPaddingCharacters) { -        const TString x("a"); +        const TString x("a");           const TString xEnc = "YQ==";          const TString y = Base64Decode(xEnc);          const TString yEnc = Base64Encode(x); @@ -316,7 +316,7 @@ Y_UNIT_TEST_SUITE(TBase64) {      }      Y_UNIT_TEST(TestOnePaddingCharacter) { -        const TString x("aa"); +        const TString x("aa");           const TString xEnc = "YWE=";          const TString y = Base64Decode(xEnc);          const TString yEnc = Base64Encode(x); @@ -325,7 +325,7 @@ Y_UNIT_TEST_SUITE(TBase64) {      }      Y_UNIT_TEST(TestNoPaddingCharacters) { -        const TString x("aaa"); +        const TString x("aaa");           const TString xEnc = "YWFh";          const TString y = Base64Decode(xEnc);          const TString yEnc = Base64Encode(x); @@ -334,7 +334,7 @@ Y_UNIT_TEST_SUITE(TBase64) {      }      Y_UNIT_TEST(TestTrailingZero) { -        const TString x("foo\0"sv); +        const TString x("foo\0"sv);           const TString xEnc = "Zm9vAA==";          const TString y = Base64Decode(xEnc);          const TString yEnc = Base64Encode(x); @@ -343,7 +343,7 @@ Y_UNIT_TEST_SUITE(TBase64) {      }      Y_UNIT_TEST(TestTwoTrailingZeroes) { -        const TString x("foo\0\0"sv); +        const TString x("foo\0\0"sv);           const TString xEnc = "Zm9vAAA=";          const TString y = Base64Decode(xEnc);          const TString yEnc = Base64Encode(x); @@ -352,7 +352,7 @@ Y_UNIT_TEST_SUITE(TBase64) {      }      Y_UNIT_TEST(TestZero) { -        const TString x("\0"sv); +        const TString x("\0"sv);           const TString xEnc = "AA==";          const TString y = Base64Decode(xEnc);          const TString yEnc = Base64Encode(x); @@ -361,7 +361,7 @@ Y_UNIT_TEST_SUITE(TBase64) {      }      Y_UNIT_TEST(TestSymbolsAfterZero) { -        const TString x("\0a"sv); +        const TString x("\0a"sv);           const TString xEnc = "AGE=";          const TString y = Base64Decode(xEnc);          const TString yEnc = Base64Encode(x); diff --git a/library/cpp/string_utils/indent_text/indent_text.h b/library/cpp/string_utils/indent_text/indent_text.h index 7117d6c0ee6..2e8b450ec98 100644 --- a/library/cpp/string_utils/indent_text/indent_text.h +++ b/library/cpp/string_utils/indent_text/indent_text.h @@ -3,4 +3,4 @@  #include <util/generic/string.h>  #include <util/generic/strbuf.h> -TString IndentText(TStringBuf text, TStringBuf indent = TStringBuf("    ")); +TString IndentText(TStringBuf text, TStringBuf indent = TStringBuf("    "));  diff --git a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp index cf0f78637f3..a2705d6ba35 100644 --- a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp +++ b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp @@ -26,8 +26,8 @@ namespace {  Y_UNIT_TEST_SUITE(Levenstein) {      Y_UNIT_TEST(Distance) { -        UNIT_ASSERT_VALUES_EQUAL(NLevenshtein::Distance(TStringBuf("hello"), TStringBuf("hulloah")), 3); -        UNIT_ASSERT_VALUES_EQUAL(NLevenshtein::Distance(TStringBuf("yeoman"), TStringBuf("yo man")), 2); +        UNIT_ASSERT_VALUES_EQUAL(NLevenshtein::Distance(TStringBuf("hello"), TStringBuf("hulloah")), 3);  +        UNIT_ASSERT_VALUES_EQUAL(NLevenshtein::Distance(TStringBuf("yeoman"), TStringBuf("yo man")), 2);       }  } diff --git a/library/cpp/string_utils/quote/quote.cpp b/library/cpp/string_utils/quote/quote.cpp index e523350b80a..26693c44b35 100644 --- a/library/cpp/string_utils/quote/quote.cpp +++ b/library/cpp/string_utils/quote/quote.cpp @@ -114,7 +114,7 @@ static inline It1 Escape(It1 to, It2 from, It3 end, const bool* escape_map = cha              *to++ = (*from == ' ' ? '+' : *from);          } -        ++from; +        ++from;       }      *to = 0; @@ -129,12 +129,12 @@ static inline It1 Unescape(It1 to, It2 from, It3 end, FromHex fromHex) {      while (from != end) {          switch (*from) {              case '%': -                ++from; +                ++from;                   *to++ = fromHex.x2c(from);                  break;              case '+':                  *to++ = ' '; -                ++from; +                ++from;                   break;              default:                  *to++ = *from++; @@ -289,7 +289,7 @@ char* UrlEscape(char* to, const char* from, bool forceEscape) {              *to++ = d2x((unsigned char)*from & 0xF);          } else              *to++ = *from; -        ++from; +        ++from;       }      *to = 0; diff --git a/library/cpp/string_utils/quote/quote_ut.cpp b/library/cpp/string_utils/quote/quote_ut.cpp index 6c552b279e1..1c682efda02 100644 --- a/library/cpp/string_utils/quote/quote_ut.cpp +++ b/library/cpp/string_utils/quote/quote_ut.cpp @@ -22,7 +22,7 @@ Y_UNIT_TEST_SUITE(TCGIEscapeTest) {      Y_UNIT_TEST(StringBuf) {          char tmp[100]; -        UNIT_ASSERT_VALUES_EQUAL(CgiEscape(tmp, "!@#$%^&*(){}[]\" "), TStringBuf("!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+")); +        UNIT_ASSERT_VALUES_EQUAL(CgiEscape(tmp, "!@#$%^&*(){}[]\" "), TStringBuf("!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+"));       }      Y_UNIT_TEST(StrokaRet) { @@ -51,7 +51,7 @@ Y_UNIT_TEST_SUITE(TCGIUnescapeTest) {      Y_UNIT_TEST(StringBuf) {          char tmp[100]; -        UNIT_ASSERT_VALUES_EQUAL(CgiUnescape(tmp, "!@%23$%25^%26*%28%29"), TStringBuf("!@#$%^&*()")); +        UNIT_ASSERT_VALUES_EQUAL(CgiUnescape(tmp, "!@%23$%25^%26*%28%29"), TStringBuf("!@#$%^&*()"));       }      Y_UNIT_TEST(TestValidZeroTerm) { diff --git a/library/cpp/string_utils/url/url.cpp b/library/cpp/string_utils/url/url.cpp index 85f4ac5d693..ae70184c310 100644 --- a/library/cpp/string_utils/url/url.cpp +++ b/library/cpp/string_utils/url/url.cpp @@ -17,14 +17,14 @@  namespace {      struct TUncheckedSize { -        static bool Has(size_t) { +        static bool Has(size_t) {               return true;          }      };      struct TKnownSize {          size_t MySize; -        explicit TKnownSize(size_t sz) +        explicit TKnownSize(size_t sz)               : MySize(sz)          {          } @@ -158,17 +158,17 @@ TStringBuf GetSchemeHostAndPort(const TStringBuf url, bool trimHttp, bool trimDe      const size_t schemeSize = GetSchemePrefixSize(url);      const TStringBuf scheme = url.Head(schemeSize); -    const bool isHttp = (schemeSize == 0 || scheme == TStringBuf("http://")); +    const bool isHttp = (schemeSize == 0 || scheme == TStringBuf("http://"));       TStringBuf hostAndPort = GetHostAndPort(url.Tail(schemeSize));      if (trimDefaultPort) {          const size_t pos = hostAndPort.find(':');          if (pos != TStringBuf::npos) { -            const bool isHttps = (scheme == TStringBuf("https://")); +            const bool isHttps = (scheme == TStringBuf("https://"));               const TStringBuf port = hostAndPort.Tail(pos + 1); -            if ((isHttp && port == TStringBuf("80")) || (isHttps && port == TStringBuf("443"))) { +            if ((isHttp && port == TStringBuf("80")) || (isHttps && port == TStringBuf("443"))) {                   // trimming default port                  hostAndPort = hostAndPort.Head(pos);              } @@ -221,9 +221,9 @@ bool TryGetSchemeHostAndPort(const TStringBuf url, TStringBuf& scheme, TStringBu          }      } else {          host = hostAndPort; -        if (scheme == TStringBuf("https://")) { +        if (scheme == TStringBuf("https://")) {               port = 443; -        } else if (scheme == TStringBuf("http://")) { +        } else if (scheme == TStringBuf("http://")) {               port = 80;          }      } @@ -254,7 +254,7 @@ TStringBuf GetDomain(const TStringBuf host) noexcept {      for (bool wasPoint = false; c != host.data(); --c) {          if (*c == '.') {              if (wasPoint) { -                ++c; +                ++c;                   break;              }              wasPoint = true; @@ -316,14 +316,14 @@ static inline bool IsSchemeChar(char c) noexcept {  static bool HasPrefix(const TStringBuf url) noexcept {      TStringBuf scheme, unused; -    if (!url.TrySplit(TStringBuf("://"), scheme, unused)) +    if (!url.TrySplit(TStringBuf("://"), scheme, unused))           return false;      return AllOf(scheme, IsSchemeChar);  }  TString AddSchemePrefix(const TString& url) { -    return AddSchemePrefix(url, TStringBuf("http")); +    return AddSchemePrefix(url, TStringBuf("http"));   }  TString AddSchemePrefix(const TString& url, TStringBuf scheme) { @@ -331,7 +331,7 @@ TString AddSchemePrefix(const TString& url, TStringBuf scheme) {          return url;      } -    return TString::Join(scheme, TStringBuf("://"), url); +    return TString::Join(scheme, TStringBuf("://"), url);   }  #define X(c) (c >= 'A' ? ((c & 0xdf) - 'A') + 10 : (c - '0')) diff --git a/library/cpp/testing/benchmark/bench.cpp b/library/cpp/testing/benchmark/bench.cpp index 08d8708005a..24299e6b12f 100644 --- a/library/cpp/testing/benchmark/bench.cpp +++ b/library/cpp/testing/benchmark/bench.cpp @@ -73,7 +73,7 @@ namespace {          const TStringBuf N;      }; -    inline TString DoFmtTime(double t) { +    inline TString DoFmtTime(double t) {           if (t > 0.1) {              return ToString(t) + " seconds";          } @@ -173,7 +173,7 @@ namespace {          }      }; -    TLinFunc CalcModel(const TSamples& s) { +    TLinFunc CalcModel(const TSamples& s) {           TKahanSLRSolver solver;          for (const auto& p : s) { @@ -188,7 +188,7 @@ namespace {          return TLinFunc{c, i};      } -    inline TSamples RemoveOutliers(const TSamples& s, double fraction) { +    inline TSamples RemoveOutliers(const TSamples& s, double fraction) {           if (s.size() < 20) {              return s;          } @@ -263,7 +263,7 @@ namespace {      using TTests = TIntrusiveListWithAutoDelete<ITestRunner, TDestructor>; -    inline TTests& Tests() { +    inline TTests& Tests() {           return *Singleton<TTests>();      } @@ -285,7 +285,7 @@ namespace {          F_JSON /* "json" */      }; -    TAdaptiveLock STDOUT_LOCK; +    TAdaptiveLock STDOUT_LOCK;       struct IReporter {          virtual void Report(TResult&& result) = 0; @@ -420,7 +420,7 @@ namespace {          TAdaptiveLock ResultsLock_;      }; -    THolder<IReporter> MakeReporter(const EOutFormat type) { +    THolder<IReporter> MakeReporter(const EOutFormat type) {           switch (type) {              case F_CONSOLE:                  return MakeHolder<TConsoleReporter>(); @@ -438,11 +438,11 @@ namespace {          return MakeHolder<TConsoleReporter>(); // make compiler happy      } -    THolder<IReporter> MakeOrderedReporter(const EOutFormat type) { +    THolder<IReporter> MakeOrderedReporter(const EOutFormat type) {           return MakeHolder<TOrderedReporter>(MakeReporter(type));      } -    void EnumerateTests(TVector<ITestRunner*>& tests) { +    void EnumerateTests(TVector<ITestRunner*>& tests) {           for (size_t id : xrange(tests.size())) {              tests[id]->SequentialId = id;          } @@ -453,11 +453,11 @@ template <>  EOutFormat FromStringImpl<EOutFormat>(const char* data, size_t len) {      const auto s = TStringBuf{data, len}; -    if (TStringBuf("console") == s) { +    if (TStringBuf("console") == s) {           return F_CONSOLE; -    } else if (TStringBuf("csv") == s) { +    } else if (TStringBuf("csv") == s) {           return F_CSV; -    } else if (TStringBuf("json") == s) { +    } else if (TStringBuf("json") == s) {           return F_JSON;      } diff --git a/library/cpp/testing/benchmark/bench.h b/library/cpp/testing/benchmark/bench.h index 21551ad0dd4..d2fab337090 100644 --- a/library/cpp/testing/benchmark/bench.h +++ b/library/cpp/testing/benchmark/bench.h @@ -84,9 +84,9 @@ namespace NBench {      int Main(int argc, char** argv);  } -#define Y_CPU_BENCHMARK(name, cnt)                              \ -    namespace N_bench_##name {                                  \ -        static void Run(::NBench::NCpu::TParams&);              \ -        const ::NBench::NCpu::TRegistar benchmark(#name, &Run); \ -    }                                                           \ +#define Y_CPU_BENCHMARK(name, cnt)                              \  +    namespace N_bench_##name {                                  \  +        static void Run(::NBench::NCpu::TParams&);              \  +        const ::NBench::NCpu::TRegistar benchmark(#name, &Run); \  +    }                                                           \       static void N_bench_##name::Run(::NBench::NCpu::TParams& cnt) diff --git a/library/cpp/testing/common/env.h b/library/cpp/testing/common/env.h index 7b89aa1bed8..af1c807e3cc 100644 --- a/library/cpp/testing/common/env.h +++ b/library/cpp/testing/common/env.h @@ -11,7 +11,7 @@  TString ArcadiaSourceRoot();  // @brief return full path for file or folder specified by known source location `where` and `path` which is relative to parent folder of `where` -//        for the instance: there is 2 files in folder test example_ut.cpp and example.data, so full path to test/example.data can be obtained +//        for the instance: there is 2 files in folder test example_ut.cpp and example.data, so full path to test/example.data can be obtained   //        from example_ut.cpp as ArcadiaFromCurrentLocation(__SOURCE_FILE__, "example.data")  TString ArcadiaFromCurrentLocation(TStringBuf where, TStringBuf path); diff --git a/library/cpp/testing/common/network.cpp b/library/cpp/testing/common/network.cpp index 230c50ee6de..40965779fb1 100644 --- a/library/cpp/testing/common/network.cpp +++ b/library/cpp/testing/common/network.cpp @@ -37,7 +37,7 @@ namespace {          {          } -        ~TPortGuard() override { +        ~TPortGuard() override {               Y_VERIFY_SYSERROR(NFs::Remove(Lock_->GetName()));          } diff --git a/library/cpp/testing/gmock_in_unittest/events.cpp b/library/cpp/testing/gmock_in_unittest/events.cpp index dbd65b727d7..5f3e21b23e9 100644 --- a/library/cpp/testing/gmock_in_unittest/events.cpp +++ b/library/cpp/testing/gmock_in_unittest/events.cpp @@ -12,18 +12,18 @@ void TGMockTestEventListener::OnTestPartResult(const testing::TestPartResult& re          const TString summary = result.summary();          TStringBuilder msg;          if (result.file_name()) -            msg << result.file_name() << TStringBuf(":"); +            msg << result.file_name() << TStringBuf(":");           if (result.line_number() != -1) -            msg << result.line_number() << TStringBuf(":"); +            msg << result.line_number() << TStringBuf(":");           if (summary) {              if (msg) { -                msg << TStringBuf("\n"); +                msg << TStringBuf("\n");               }              msg << summary;          }          if (message && summary != message) {              if (msg) { -                msg << TStringBuf("\n"); +                msg << TStringBuf("\n");               }              msg << message;          } diff --git a/library/cpp/testing/unittest/registar.cpp b/library/cpp/testing/unittest/registar.cpp index 3679b768ed4..0fe5ef9700c 100644 --- a/library/cpp/testing/unittest/registar.cpp +++ b/library/cpp/testing/unittest/registar.cpp @@ -364,7 +364,7 @@ void NUnitTest::TTestBase::AtEnd() {      Processor()->UnitStop(unit);  } -void NUnitTest::TTestBase::Run(std::function<void()> f, const TString& suite, const char* name, const bool forceFork) { +void NUnitTest::TTestBase::Run(std::function<void()> f, const TString& suite, const char* name, const bool forceFork) {       TestErrors_ = 0;      CurrentSubtest_ = name;      Processor()->Run(f, suite, name, forceFork); diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h index 44517a00924..76f48372bc5 100644 --- a/library/cpp/testing/unittest/registar.h +++ b/library/cpp/testing/unittest/registar.h @@ -135,7 +135,7 @@ namespace NUnitTest {          // Should execute a test whitin suite?          virtual bool CheckAccessTest(TString /*suite*/, const char* /*name*/); -        virtual void Run(std::function<void()> f, const TString& /*suite*/, const char* /*name*/, bool /*forceFork*/); +        virtual void Run(std::function<void()> f, const TString& /*suite*/, const char* /*name*/, bool /*forceFork*/);           // This process is forked for current test          virtual bool GetIsForked() const; @@ -219,11 +219,11 @@ namespace NUnitTest {          void AtEnd(); -        void Run(std::function<void()> f, const TString& suite, const char* name, bool forceFork); +        void Run(std::function<void()> f, const TString& suite, const char* name, bool forceFork);           class TCleanUp {          public: -            explicit TCleanUp(TTestBase* base); +            explicit TCleanUp(TTestBase* base);               ~TCleanUp(); @@ -771,7 +771,7 @@ public:                       \          ITestSuiteProcessor* Processor() const noexcept;      private: -        explicit TTestFactory(ITestSuiteProcessor* processor); +        explicit TTestFactory(ITestSuiteProcessor* processor);           ~TTestFactory(); @@ -805,15 +805,15 @@ public:                       \          {          } -        inline TBaseTestCase(const char* name, std::function<void(TTestContext&)> body, bool forceFork) +        inline TBaseTestCase(const char* name, std::function<void(TTestContext&)> body, bool forceFork)               : Name_(name) -            , Body_(std::move(body)) +            , Body_(std::move(body))               , ForceFork_(forceFork)          {          }          virtual ~TBaseTestCase() = default; - +           // Each test case is executed in 3 steps:          //          // 1. SetUp() (from fixture) @@ -850,7 +850,7 @@ public:                       \                  Parent->SetHandler();              } -            TInvokeGuard(TInvokeGuard&& guard) noexcept +            TInvokeGuard(TInvokeGuard&& guard) noexcept                   : Parent(guard.Parent)              {                  guard.Parent = nullptr; @@ -912,7 +912,7 @@ public:                       \      };  #define UNIT_TEST_SUITE_REGISTRATION(T) \ -    static const ::NUnitTest::TTestBaseFactory<T> Y_GENERATE_UNIQUE_ID(UTREG_); +    static const ::NUnitTest::TTestBaseFactory<T> Y_GENERATE_UNIQUE_ID(UTREG_);   #define Y_UNIT_TEST_SUITE_IMPL_F(N, T, F)                                                                          \      namespace NTestSuite##N {                                                                                           \ @@ -936,9 +936,9 @@ public:                       \                  return StaticName();                                                                                    \              }                                                                                                           \                                                                                                                          \ -            static void AddTest(const char* name,                                                                       \ -                const std::function<void(NUnitTest::TTestContext&)>& body, bool forceFork)                              \ -            {                                                                                                           \ +            static void AddTest(const char* name,                                                                       \  +                const std::function<void(NUnitTest::TTestContext&)>& body, bool forceFork)                              \  +            {                                                                                                           \                   Tests().push_back([=]{ return MakeHolder<NUnitTest::TBaseTestCase>(name, body, forceFork); });          \              }                                                                                                           \                                                                                                                          \ @@ -1005,7 +1005,7 @@ public:                       \              TCurrentTest::AddTest(TTestCase##N::Create);    \          }                                                   \      };                                                      \ -    static const TTestRegistration##N testRegistration##N; +    static const TTestRegistration##N testRegistration##N;   #define Y_UNIT_TEST_IMPL(N, FF, F)      \      Y_UNIT_TEST_IMPL_REGISTER(N, FF, F) \ diff --git a/library/cpp/testing/unittest/registar_ut.cpp b/library/cpp/testing/unittest/registar_ut.cpp index 1f36d53abbe..b06a3f7a689 100644 --- a/library/cpp/testing/unittest/registar_ut.cpp +++ b/library/cpp/testing/unittest/registar_ut.cpp @@ -43,9 +43,9 @@ Y_UNIT_TEST_SUITE(TUnitTestMacroTest) {          UNIT_ASSERT_TEST_FAILS(stringsEqual("q", TString("w")));          UNIT_ASSERT_TEST_FAILS(stringsEqual(TString("q"), "w"));          UNIT_ASSERT_TEST_FAILS(stringsEqual(TString("a"), TString("b"))); -        UNIT_ASSERT_TEST_FAILS(stringsEqual(TString("a"), TStringBuf("b"))); -        UNIT_ASSERT_TEST_FAILS(stringsEqual("a", TStringBuf("b"))); -        UNIT_ASSERT_TEST_FAILS(stringsEqual(TStringBuf("a"), "b")); +        UNIT_ASSERT_TEST_FAILS(stringsEqual(TString("a"), TStringBuf("b")));  +        UNIT_ASSERT_TEST_FAILS(stringsEqual("a", TStringBuf("b")));  +        UNIT_ASSERT_TEST_FAILS(stringsEqual(TStringBuf("a"), "b"));           TString empty;          TStringBuf emptyBuf; @@ -86,19 +86,19 @@ Y_UNIT_TEST_SUITE(TUnitTestMacroTest) {          UNIT_ASSERT_TEST_FAILS(stringsUnequal("", ""));          UNIT_ASSERT_TEST_FAILS(stringsUnequal("42", TString("42")));          UNIT_ASSERT_TEST_FAILS(stringsUnequal(TString("4"), "4")); -        UNIT_ASSERT_TEST_FAILS(stringsUnequal("d", TStringBuf("d"))); -        UNIT_ASSERT_TEST_FAILS(stringsUnequal(TStringBuf("yandex"), "yandex")); -        UNIT_ASSERT_TEST_FAILS(stringsUnequal(TStringBuf("index"), TString("index"))); -        UNIT_ASSERT_TEST_FAILS(stringsUnequal(TString("diff"), TStringBuf("diff"))); +        UNIT_ASSERT_TEST_FAILS(stringsUnequal("d", TStringBuf("d")));  +        UNIT_ASSERT_TEST_FAILS(stringsUnequal(TStringBuf("yandex"), "yandex"));  +        UNIT_ASSERT_TEST_FAILS(stringsUnequal(TStringBuf("index"), TString("index")));  +        UNIT_ASSERT_TEST_FAILS(stringsUnequal(TString("diff"), TStringBuf("diff")));           UNIT_ASSERT_STRINGS_UNEQUAL("1", "2");          UNIT_ASSERT_STRINGS_UNEQUAL("", "3"); -        UNIT_ASSERT_STRINGS_UNEQUAL("green", TStringBuf("red")); -        UNIT_ASSERT_STRINGS_UNEQUAL(TStringBuf("solomon"), "golovan"); +        UNIT_ASSERT_STRINGS_UNEQUAL("green", TStringBuf("red"));  +        UNIT_ASSERT_STRINGS_UNEQUAL(TStringBuf("solomon"), "golovan");           UNIT_ASSERT_STRINGS_UNEQUAL("d", TString("f"));          UNIT_ASSERT_STRINGS_UNEQUAL(TString("yandex"), "index"); -        UNIT_ASSERT_STRINGS_UNEQUAL(TString("mail"), TStringBuf("yandex")); -        UNIT_ASSERT_STRINGS_UNEQUAL(TStringBuf("C++"), TString("python")); +        UNIT_ASSERT_STRINGS_UNEQUAL(TString("mail"), TStringBuf("yandex"));  +        UNIT_ASSERT_STRINGS_UNEQUAL(TStringBuf("C++"), TString("python"));       }      Y_UNIT_TEST(Equal) { @@ -352,7 +352,7 @@ Y_UNIT_TEST_SUITE(TUnitTestMacroTest) {      Y_UNIT_TEST(ExceptionContains) {          UNIT_ASSERT_TEST_FAILS(TTestException("abc").AssertExceptionContains<TTestException>("cba")); -        UNIT_ASSERT_TEST_FAILS(TTestException("abc").AssertExceptionContains<TTestException>(TStringBuf("cba"))); +        UNIT_ASSERT_TEST_FAILS(TTestException("abc").AssertExceptionContains<TTestException>(TStringBuf("cba")));           UNIT_ASSERT_TEST_FAILS(TTestException("abc").AssertExceptionContains<TTestException>(TString("cba")));          UNIT_ASSERT_TEST_FAILS(TTestException("abc").AssertExceptionContains<TTestException>(TStringBuilder() << "cba")); diff --git a/library/cpp/testing/unittest/utmain.cpp b/library/cpp/testing/unittest/utmain.cpp index 305bc6b40fc..7f345ba7ca7 100644 --- a/library/cpp/testing/unittest/utmain.cpp +++ b/library/cpp/testing/unittest/utmain.cpp @@ -151,12 +151,12 @@ private:              TStringBuilder msgs;              for (const TString& m : ErrorMessages) {                  if (msgs) { -                    msgs << TStringBuf("\n"); +                    msgs << TStringBuf("\n");                   }                  msgs << m;              }              if (msgs) { -                msgs << TStringBuf("\n"); +                msgs << TStringBuf("\n");               }              TraceSubtestFinished(descr->test->unit->name.data(), descr->test->name, "fail", msgs, descr->Context);              ErrorMessages.clear(); diff --git a/library/cpp/threading/equeue/equeue.cpp b/library/cpp/threading/equeue/equeue.cpp index 54a848e912a..9d3b2785db0 100644 --- a/library/cpp/threading/equeue/equeue.cpp +++ b/library/cpp/threading/equeue/equeue.cpp @@ -29,7 +29,7 @@ public:          AtomicIncrement(Queue_->ObjectCount_);      } -    ~TDecrementingWrapper() override { +    ~TDecrementingWrapper() override {           AtomicDecrement(Queue_->ObjectCount_);          AtomicDecrement(Queue_->GuardCount_);      } diff --git a/library/cpp/threading/equeue/equeue_ut.cpp b/library/cpp/threading/equeue/equeue_ut.cpp index 9cf2aced44e..5ff4c693476 100644 --- a/library/cpp/threading/equeue/equeue_ut.cpp +++ b/library/cpp/threading/equeue/equeue_ut.cpp @@ -41,7 +41,7 @@ Y_UNIT_TEST_SUITE(TElasticQueueTest) {          Counters.Reset();          struct TWaitJob: public IObjectInQueue { -            void Process(void*) override { +            void Process(void*) override {                   WaitEvent.Wait();                  AtomicIncrement(Counters.Processed);              } @@ -72,7 +72,7 @@ Y_UNIT_TEST_SUITE(TElasticQueueTest) {  //concurrent test -- send many jobs from different threads      struct TJob: public IObjectInQueue { -        void Process(void*) override { +        void Process(void*) override {               AtomicIncrement(Counters.Processed);          };      }; @@ -96,7 +96,7 @@ Y_UNIT_TEST_SUITE(TElasticQueueTest) {          TryCounter = 0;          struct TSender: public IThreadFactory::IThreadAble { -            void DoExecute() override { +            void DoExecute() override {                   while ((size_t)AtomicIncrement(TryCounter) <= N) {                      if (!TryAdd()) {                          Sleep(TDuration::MicroSeconds(50)); diff --git a/library/cpp/threading/future/subscription/wait_all_or_exception_ut.cpp b/library/cpp/threading/future/subscription/wait_all_or_exception_ut.cpp index 34ae9edb4e6..0a9f84ab691 100644 --- a/library/cpp/threading/future/subscription/wait_all_or_exception_ut.cpp +++ b/library/cpp/threading/future/subscription/wait_all_or_exception_ut.cpp @@ -29,7 +29,7 @@ Y_UNIT_TEST_SUITE(TWaitAllOrExceptionTest) {          auto w = NWait::WaitAllOrException(p1.GetFuture(), p2.GetFuture());          UNIT_ASSERT(!w.HasValue() && !w.HasException()); -        constexpr TStringBuf message = "Test exception"; +        constexpr TStringBuf message = "Test exception";           p1.SetException(std::make_exception_ptr(yexception() << message));          UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) {              return message == e.what(); @@ -54,7 +54,7 @@ Y_UNIT_TEST_SUITE(TWaitAllOrExceptionTest) {          auto w = NWait::WaitAllOrException(f, p.GetFuture());          UNIT_ASSERT(!w.HasValue() && !w.HasException()); -        constexpr TStringBuf message = "Test exception 2"; +        constexpr TStringBuf message = "Test exception 2";           p.SetException(std::make_exception_ptr(yexception() << message));          UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) {              return message == e.what(); @@ -85,7 +85,7 @@ Y_UNIT_TEST_SUITE(TWaitAllOrExceptionTest) {          auto w = NWait::WaitAllOrException(TVector<TFuture<void>>{ p.GetFuture() });          UNIT_ASSERT(!w.HasValue() && !w.HasException()); -        constexpr TStringBuf message = "Test exception 3"; +        constexpr TStringBuf message = "Test exception 3";           p.SetException(std::make_exception_ptr(yexception() << message));          UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) {              return message == e.what(); @@ -112,7 +112,7 @@ Y_UNIT_TEST_SUITE(TWaitAllOrExceptionTest) {          auto w = NWait::WaitAllOrException(TVector<TFuture<int>>{ p1.GetFuture(), f, p2.GetFuture() });          UNIT_ASSERT(!w.HasValue() && !w.HasException()); -        constexpr TStringBuf message = "Test exception 4"; +        constexpr TStringBuf message = "Test exception 4";           p1.SetException(std::make_exception_ptr(yexception() << message));          UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) {              return message == e.what(); @@ -124,7 +124,7 @@ Y_UNIT_TEST_SUITE(TWaitAllOrExceptionTest) {      Y_UNIT_TEST(TestManyWithVectorAndIntialError) {          auto p1 = NewPromise();          auto p2 = NewPromise(); -        constexpr TStringBuf message = "Test exception 5"; +        constexpr TStringBuf message = "Test exception 5";           auto f = MakeErrorFuture<void>(std::make_exception_ptr(yexception() << message));          auto w = NWait::WaitAllOrException(TVector<TFuture<void>>{ p1.GetFuture(), p2.GetFuture(), f });          UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) { diff --git a/library/cpp/threading/future/subscription/wait_all_ut.cpp b/library/cpp/threading/future/subscription/wait_all_ut.cpp index 3bc9762671c..73e2d4d6e43 100644 --- a/library/cpp/threading/future/subscription/wait_all_ut.cpp +++ b/library/cpp/threading/future/subscription/wait_all_ut.cpp @@ -29,7 +29,7 @@ Y_UNIT_TEST_SUITE(TWaitAllTest) {          auto w = NWait::WaitAll(p1.GetFuture(), p2.GetFuture());          UNIT_ASSERT(!w.HasValue() && !w.HasException()); -        constexpr TStringBuf message = "Test exception"; +        constexpr TStringBuf message = "Test exception";           p1.SetException(std::make_exception_ptr(yexception() << message));          UNIT_ASSERT(!w.HasValue() && !w.HasException()); @@ -55,7 +55,7 @@ Y_UNIT_TEST_SUITE(TWaitAllTest) {          auto w = NWait::WaitAll(f, p.GetFuture());          UNIT_ASSERT(!w.HasValue() && !w.HasException()); -        constexpr TStringBuf message = "Test exception 2"; +        constexpr TStringBuf message = "Test exception 2";           p.SetException(std::make_exception_ptr(yexception() << message));          UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) {              return message == e.what(); @@ -86,7 +86,7 @@ Y_UNIT_TEST_SUITE(TWaitAllTest) {          auto w = NWait::WaitAll(TVector<TFuture<void>>{ p.GetFuture() });          UNIT_ASSERT(!w.HasValue() && !w.HasException()); -        constexpr TStringBuf message = "Test exception 3"; +        constexpr TStringBuf message = "Test exception 3";           p.SetException(std::make_exception_ptr(yexception() << message));          UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) {              return message == e.what(); @@ -113,7 +113,7 @@ Y_UNIT_TEST_SUITE(TWaitAllTest) {          auto w = NWait::WaitAll(TVector<TFuture<int>>{ p1.GetFuture(), f, p2.GetFuture() });          UNIT_ASSERT(!w.HasValue() && !w.HasException()); -        constexpr TStringBuf message = "Test exception 4"; +        constexpr TStringBuf message = "Test exception 4";           p1.SetException(std::make_exception_ptr(yexception() << message));          UNIT_ASSERT(!w.HasValue() && !w.HasException()); diff --git a/library/cpp/threading/future/subscription/wait_any_ut.cpp b/library/cpp/threading/future/subscription/wait_any_ut.cpp index 262080e8d12..745072b8927 100644 --- a/library/cpp/threading/future/subscription/wait_any_ut.cpp +++ b/library/cpp/threading/future/subscription/wait_any_ut.cpp @@ -27,7 +27,7 @@ Y_UNIT_TEST_SUITE(TWaitAnyTest) {          auto w = NWait::WaitAny(p1.GetFuture(), p2.GetFuture());          UNIT_ASSERT(!w.HasValue() && !w.HasException()); -        constexpr TStringBuf message = "Test exception"; +        constexpr TStringBuf message = "Test exception";           p2.SetException(std::make_exception_ptr(yexception() << message));          UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) {              return message == e.what(); @@ -47,7 +47,7 @@ Y_UNIT_TEST_SUITE(TWaitAnyTest) {      Y_UNIT_TEST(TestOneUnsignaledOneSignaledWithException) {          auto p = NewPromise(); -        constexpr TStringBuf message = "Test exception 2"; +        constexpr TStringBuf message = "Test exception 2";           auto f = MakeErrorFuture<void>(std::make_exception_ptr(yexception() << message));          auto w = NWait::WaitAny(f, p.GetFuture());          UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) { @@ -81,7 +81,7 @@ Y_UNIT_TEST_SUITE(TWaitAnyTest) {          auto w = NWait::WaitAny(TVector<TFuture<void>>{ p.GetFuture() });          UNIT_ASSERT(!w.HasValue() && !w.HasException()); -        constexpr TStringBuf message = "Test exception 3"; +        constexpr TStringBuf message = "Test exception 3";           p.SetException(std::make_exception_ptr(yexception() << message));          UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) {              return message == e.what(); @@ -121,7 +121,7 @@ Y_UNIT_TEST_SUITE(TWaitAnyTest) {          auto w = NWait::WaitAny(TVector<TFuture<void>>{ p1.GetFuture(), p2.GetFuture(), p3.GetFuture() });          UNIT_ASSERT(!w.HasValue() && !w.HasException()); -        constexpr TStringBuf message = "Test exception 4"; +        constexpr TStringBuf message = "Test exception 4";           p2.SetException(std::make_exception_ptr(yexception() << message));          UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) {              return message == e.what(); diff --git a/library/cpp/threading/skip_list/perf/main.cpp b/library/cpp/threading/skip_list/perf/main.cpp index 4ad52049e73..8b6365d2339 100644 --- a/library/cpp/threading/skip_list/perf/main.cpp +++ b/library/cpp/threading/skip_list/perf/main.cpp @@ -18,11 +18,11 @@ namespace {      //////////////////////////////////////////////////////////////////////////////// -    IOutputStream& LogInfo() { +    IOutputStream& LogInfo() {           return Cerr << TInstant::Now() << " INFO: ";      } -    IOutputStream& LogError() { +    IOutputStream& LogError() {           return Cerr << TInstant::Now() << " ERROR: ";      } diff --git a/library/cpp/threading/task_scheduler/task_scheduler.cpp b/library/cpp/threading/task_scheduler/task_scheduler.cpp index 174dde4bf75..e3a847b234e 100644 --- a/library/cpp/threading/task_scheduler/task_scheduler.cpp +++ b/library/cpp/threading/task_scheduler/task_scheduler.cpp @@ -85,7 +85,7 @@ namespace {              AtomicIncrement(Counter_);          } -        ~TTaskWrapper() override { +        ~TTaskWrapper() override {               AtomicDecrement(Counter_);          }      private: diff --git a/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp b/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp index 3b5203194a3..50e40316d04 100644 --- a/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp +++ b/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp @@ -21,10 +21,10 @@ class TTaskSchedulerTest: public TTestBase {                      AtomicIncrement(ScheduledTaskCounter_);                  } -                ~TCheckTask() override { +                ~TCheckTask() override {                   } -                bool Process() override { +                bool Process() override {                       const TDuration delay = Now() - Start_;                      if (delay < Delay_) { diff --git a/library/cpp/timezone_conversion/civil.cpp b/library/cpp/timezone_conversion/civil.cpp index 5986318b9a8..756b2a2b019 100644 --- a/library/cpp/timezone_conversion/civil.cpp +++ b/library/cpp/timezone_conversion/civil.cpp @@ -20,7 +20,7 @@ namespace {          return true;      } -    bool TryParseUTCOffsetTimezone(TStringBuf name, int& offset) { +    bool TryParseUTCOffsetTimezone(TStringBuf name, int& offset) {           static constexpr TStringBuf OFFSET_PREFIX = "UTC";          if (!name.SkipPrefix(OFFSET_PREFIX)) {              return false; @@ -210,25 +210,25 @@ void Out<NDatetime::TWeekday>(IOutputStream& out, NDatetime::TWeekday wd) {      using namespace cctz;      switch (wd) {          case weekday::monday: -            out << TStringBuf("Monday"); +            out << TStringBuf("Monday");               break;          case weekday::tuesday: -            out << TStringBuf("Tuesday"); +            out << TStringBuf("Tuesday");               break;          case weekday::wednesday: -            out << TStringBuf("Wednesday"); +            out << TStringBuf("Wednesday");               break;          case weekday::thursday: -            out << TStringBuf("Thursday"); +            out << TStringBuf("Thursday");               break;          case weekday::friday: -            out << TStringBuf("Friday"); +            out << TStringBuf("Friday");               break;          case weekday::saturday: -            out << TStringBuf("Saturday"); +            out << TStringBuf("Saturday");               break;          case weekday::sunday: -            out << TStringBuf("Sunday"); +            out << TStringBuf("Sunday");               break;      }  } diff --git a/library/cpp/unicode/punycode/punycode.cpp b/library/cpp/unicode/punycode/punycode.cpp index 800d1f19fe4..f524cfbbf6f 100644 --- a/library/cpp/unicode/punycode/punycode.cpp +++ b/library/cpp/unicode/punycode/punycode.cpp @@ -130,7 +130,7 @@ bool CanBePunycodeHostName(const TStringBuf& host) {      if (!IsStringASCII(host.begin(), host.end()))          return false; -    static constexpr TStringBuf ACE = "xn--"; +    static constexpr TStringBuf ACE = "xn--";       TStringBuf tail(host);      while (tail) { diff --git a/library/cpp/uri/assign.cpp b/library/cpp/uri/assign.cpp index ae9125c7274..edc5d9f99ea 100644 --- a/library/cpp/uri/assign.cpp +++ b/library/cpp/uri/assign.cpp @@ -195,7 +195,7 @@ namespace NUri {          // process #! fragments          // https://developers.google.com/webmasters/ajax-crawling/docs/specification -        static const TStringBuf escFragPrefix(TStringBuf("_escaped_fragment_=")); +        static const TStringBuf escFragPrefix(TStringBuf("_escaped_fragment_="));           bool encHashBangFrag = false;          TStringBuf qryBeforeEscapedFragment; diff --git a/library/cpp/uri/common.cpp b/library/cpp/uri/common.cpp index 05af1e57d18..2047bfb78e1 100644 --- a/library/cpp/uri/common.cpp +++ b/library/cpp/uri/common.cpp @@ -8,12 +8,12 @@ namespace NUri {      const TSchemeInfo TSchemeInfo::Registry[] = {          TSchemeInfo(TScheme::SchemeEmpty, TStringBuf()), // scheme is empty and inited -        TSchemeInfo(TScheme::SchemeHTTP, TStringBuf("http"), TField::FlagHost | TField::FlagPath, 80), -        TSchemeInfo(TScheme::SchemeHTTPS, TStringBuf("https"), TField::FlagHost | TField::FlagPath, 443), -        TSchemeInfo(TScheme::SchemeFTP, TStringBuf("ftp"), TField::FlagHost | TField::FlagPath, 20), -        TSchemeInfo(TScheme::SchemeFILE, TStringBuf("file"), TField::FlagPath), -        TSchemeInfo(TScheme::SchemeWS, TStringBuf("ws"), TField::FlagHost | TField::FlagPath, 80), -        TSchemeInfo(TScheme::SchemeWSS, TStringBuf("wss"), TField::FlagHost | TField::FlagPath, 443), +        TSchemeInfo(TScheme::SchemeHTTP, TStringBuf("http"), TField::FlagHost | TField::FlagPath, 80),  +        TSchemeInfo(TScheme::SchemeHTTPS, TStringBuf("https"), TField::FlagHost | TField::FlagPath, 443),  +        TSchemeInfo(TScheme::SchemeFTP, TStringBuf("ftp"), TField::FlagHost | TField::FlagPath, 20),  +        TSchemeInfo(TScheme::SchemeFILE, TStringBuf("file"), TField::FlagPath),  +        TSchemeInfo(TScheme::SchemeWS, TStringBuf("ws"), TField::FlagHost | TField::FlagPath, 80),  +        TSchemeInfo(TScheme::SchemeWSS, TStringBuf("wss"), TField::FlagHost | TField::FlagPath, 443),           // add above          TSchemeInfo(TScheme::SchemeUnknown, TStringBuf()) // scheme is empty and uninited      }; diff --git a/library/cpp/uri/uri.cpp b/library/cpp/uri/uri.cpp index 56a9a4e5ef4..8e759c04be2 100644 --- a/library/cpp/uri/uri.cpp +++ b/library/cpp/uri/uri.cpp @@ -190,7 +190,7 @@ namespace NUri {              // ... and the scheme requires a path...              if (GetSchemeInfo().FldReq & FlagPath)                  // ... set path -                FldSetNoDirty(FieldPath, TStringBuf("/")); +                FldSetNoDirty(FieldPath, TStringBuf("/"));       }      /********************************************************/ @@ -210,7 +210,7 @@ namespace NUri {          const ui32 cleanFields = ~FieldsDirty;          do { -            static constexpr TStringBuf rootPath = "/"; +            static constexpr TStringBuf rootPath = "/";               if (noscheme) {                  if (!basescheme.empty()) { @@ -408,7 +408,7 @@ namespace NUri {              v = Fields[FieldPath];              // for relative, empty path is not the same as missing              if (v.empty() && 0 == (flags & FlagHost)) -                v = TStringBuf("."); +                v = TStringBuf(".");               out << v;          } diff --git a/library/cpp/uri/uri.h b/library/cpp/uri/uri.h index 3b6c19fe4a8..12f6adb8757 100644 --- a/library/cpp/uri/uri.h +++ b/library/cpp/uri/uri.h @@ -183,8 +183,8 @@ namespace NUri {          // uses directly, doesn't mark dirty          template <size_t size>          bool FldMemSet(EField field, const char (&value)[size]) { -            static_assert(size > 0); -            return FldSetImpl(field, TStringBuf(value, size - 1), true); +            static_assert(size > 0);  +            return FldSetImpl(field, TStringBuf(value, size - 1), true);           }          // duplicate one field to another diff --git a/library/cpp/uri/uri_ut.cpp b/library/cpp/uri/uri_ut.cpp index 2ebd83fc93a..f80f88ae4e2 100644 --- a/library/cpp/uri/uri_ut.cpp +++ b/library/cpp/uri/uri_ut.cpp @@ -323,7 +323,7 @@ namespace NUri {              // cause a dirty field              url.FldMemSet(TField::FieldUser, "use"); // it is now shorter              UNIT_ASSERT(!url.FldIsDirty()); -            url.FldMemSet(TField::FieldUser, TStringBuf("user")); +            url.FldMemSet(TField::FieldUser, TStringBuf("user"));               UNIT_ASSERT(url.FldIsDirty());              // copy again diff --git a/library/cpp/xml/document/xml-document.cpp b/library/cpp/xml/document/xml-document.cpp index 18a554d7321..c14c18bd482 100644 --- a/library/cpp/xml/document/xml-document.cpp +++ b/library/cpp/xml/document/xml-document.cpp @@ -9,7 +9,7 @@  #include <util/folder/dirut.h>  namespace { -    struct TInit { +    struct TInit {           inline TInit() {              NXml::InitEngine();          } diff --git a/library/cpp/xml/init/init.cpp b/library/cpp/xml/init/init.cpp index aa96c2dd317..50a59fa44c6 100644 --- a/library/cpp/xml/init/init.cpp +++ b/library/cpp/xml/init/init.cpp @@ -9,7 +9,7 @@  #include <util/generic/singleton.h>  namespace { -    int CharEncodingInput(unsigned char* out, int* outlen, const unsigned char* in, int* inlen) { +    int CharEncodingInput(unsigned char* out, int* outlen, const unsigned char* in, int* inlen) {           size_t read = 0, written = 0;          RECODE_RESULT r = Recode(CODES_WIN, CODES_UTF8, (const char*)in, (char*)out, (size_t)*inlen, (size_t)*outlen, read, written);          if (r == RECODE_EOOUTPUT) diff --git a/library/cpp/ya.make b/library/cpp/ya.make index 8c1193b0077..baea39e7f14 100644 --- a/library/cpp/ya.make +++ b/library/cpp/ya.make @@ -64,7 +64,7 @@ RECURSE(      consistent_hash_ring/ut      consistent_hashing      consistent_hashing/ut -    containers +    containers       coroutine      cppparser      cpuid_check @@ -394,9 +394,9 @@ RECURSE(      vec4      vec4/ut      vl_feat -    vowpalwabbit -    vowpalwabbit/tools -    vowpalwabbit/ut +    vowpalwabbit  +    vowpalwabbit/tools  +    vowpalwabbit/ut       watchdog      watchdog/timeout/ut      wordlistreader diff --git a/library/cpp/yson/detail.h b/library/cpp/yson/detail.h index 27f5e8ffff2..a4c3fa769b3 100644 --- a/library/cpp/yson/detail.h +++ b/library/cpp/yson/detail.h @@ -425,10 +425,10 @@ namespace NYson {              template <bool AllowFinish>              double ReadNanOrInf() { -                static const TStringBuf nanString = "nan"; -                static const TStringBuf infString = "inf"; -                static const TStringBuf plusInfString = "+inf"; -                static const TStringBuf minusInfString = "-inf"; +                static const TStringBuf nanString = "nan";  +                static const TStringBuf infString = "inf";  +                static const TStringBuf plusInfString = "+inf";  +                static const TStringBuf minusInfString = "-inf";                   TStringBuf expectedString;                  double expectedValue; @@ -560,8 +560,8 @@ namespace NYson {              bool ReadBoolean() {                  Buffer_.clear(); -                static TStringBuf trueString = "true"; -                static TStringBuf falseString = "false"; +                static TStringBuf trueString = "true";  +                static TStringBuf falseString = "false";                   auto throwIncorrectBoolean = [&]() {                      ythrow TYsonException() << "Incorrect boolean string " << TString(Buffer_.data(), Buffer_.size()); diff --git a/library/cpp/yson/node/node.cpp b/library/cpp/yson/node/node.cpp index b39e0707187..262708a2d07 100644 --- a/library/cpp/yson/node/node.cpp +++ b/library/cpp/yson/node/node.cpp @@ -99,18 +99,18 @@ TNode::TNode(const char* s)      : Value_(TString(s))  { } -TNode::TNode(TStringBuf s) +TNode::TNode(TStringBuf s)       : Value_(TString(s))  { } -TNode::TNode(std::string_view s) +TNode::TNode(std::string_view s)       : Value_(TString(s)) -{ } - -TNode::TNode(const std::string& s) +{ }  +  +TNode::TNode(const std::string& s)       : Value_(TString(s)) -{ } - +{ }  +   TNode::TNode(TString s)      : Value_(std::move(s))  { } diff --git a/library/cpp/yson/node/node.h b/library/cpp/yson/node/node.h index 5f90f95df07..772100bd368 100644 --- a/library/cpp/yson/node/node.h +++ b/library/cpp/yson/node/node.h @@ -73,9 +73,9 @@ public:      TNode();      TNode(const char* s); -    TNode(TStringBuf s); -    explicit TNode(std::string_view s); -    explicit TNode(const std::string& s); +    TNode(TStringBuf s);  +    explicit TNode(std::string_view s);  +    explicit TNode(const std::string& s);       TNode(TString s);      TNode(int i); diff --git a/library/cpp/yson/writer.cpp b/library/cpp/yson/writer.cpp index 054459f9f5f..43402eb5069 100644 --- a/library/cpp/yson/writer.cpp +++ b/library/cpp/yson/writer.cpp @@ -15,7 +15,7 @@ namespace NYson {      // Copied from <util/string/escape.cpp>      namespace { -        inline char HexDigit(char value) { +        inline char HexDigit(char value) {               Y_ASSERT(value < 16);              if (value < 10)                  return '0' + value; @@ -23,26 +23,26 @@ namespace NYson {                  return 'A' + value - 10;          } -        inline char OctDigit(char value) { +        inline char OctDigit(char value) {               Y_ASSERT(value < 8);              return '0' + value;          } -        inline bool IsPrintable(char c) { +        inline bool IsPrintable(char c) {               return c >= 32 && c <= 126;          } -        inline bool IsHexDigit(char c) { +        inline bool IsHexDigit(char c) {               return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f');          } -        inline bool IsOctDigit(char c) { +        inline bool IsOctDigit(char c) {               return c >= '0' && c <= '7';          } -        const size_t ESCAPE_C_BUFFER_SIZE = 4; +        const size_t ESCAPE_C_BUFFER_SIZE = 4;  -        inline size_t EscapeC(unsigned char c, char next, char r[ESCAPE_C_BUFFER_SIZE]) { +        inline size_t EscapeC(unsigned char c, char next, char r[ESCAPE_C_BUFFER_SIZE]) {               // (1) Printable characters go as-is, except backslash and double quote.              // (2) Characters \r, \n, \t and \0 ... \7 replaced by their simple escape characters (if possible).              // (3) Otherwise, character is encoded using hexadecimal escape sequence (if possible), or octal. @@ -114,9 +114,9 @@ namespace NYson {                  return ::ToString(value);              } -            static const TStringBuf nanLiteral = "%nan"; -            static const TStringBuf infLiteral = "%inf"; -            static const TStringBuf negativeInfLiteral = "%-inf"; +            static const TStringBuf nanLiteral = "%nan";  +            static const TStringBuf infLiteral = "%inf";  +            static const TStringBuf negativeInfLiteral = "%-inf";               TStringBuf str;              if (std::isnan(value)) { diff --git a/library/cpp/yson_pull/detail/percent_scalar.h b/library/cpp/yson_pull/detail/percent_scalar.h index ff4571842e1..4dfb57d36b4 100644 --- a/library/cpp/yson_pull/detail/percent_scalar.h +++ b/library/cpp/yson_pull/detail/percent_scalar.h @@ -10,12 +10,12 @@ namespace NYsonPull::NDetail {      struct percent_scalar {          //! Text boolean literals -        static constexpr TStringBuf true_literal = "%true"; -        static constexpr TStringBuf false_literal = "%false"; +        static constexpr TStringBuf true_literal = "%true";  +        static constexpr TStringBuf false_literal = "%false";           //! Text floating-point literals -        static constexpr TStringBuf nan_literal = "%nan"; -        static constexpr TStringBuf positive_inf_literal = "%inf"; -        static constexpr TStringBuf negative_inf_literal = "%-inf"; +        static constexpr TStringBuf nan_literal = "%nan";  +        static constexpr TStringBuf positive_inf_literal = "%inf";  +        static constexpr TStringBuf negative_inf_literal = "%-inf";           percent_scalar_type type;          union { diff --git a/library/cpp/yson_pull/read_ops.cpp b/library/cpp/yson_pull/read_ops.cpp index 9d7e6a4a2d2..6ca8313d542 100644 --- a/library/cpp/yson_pull/read_ops.cpp +++ b/library/cpp/yson_pull/read_ops.cpp @@ -4,7 +4,7 @@ using namespace NYsonPull;  using namespace NYsonPull::NReadOps;  namespace { -    bool TrySkipValueUntil(EEventType end, TReader& reader) { +    bool TrySkipValueUntil(EEventType end, TReader& reader) {           const auto& event = reader.NextEvent();          if (event.Type() == end) {              return false; @@ -13,7 +13,7 @@ namespace {          return true;      } -    bool TrySkipKeyValueUntil(EEventType end, TReader& reader) { +    bool TrySkipKeyValueUntil(EEventType end, TReader& reader) {           const auto& event = reader.NextEvent();          if (event.Type() == end) {              return false; diff --git a/library/cpp/yson_pull/ut/reader_ut.cpp b/library/cpp/yson_pull/ut/reader_ut.cpp index 1184265ddbc..c40f05e551a 100644 --- a/library/cpp/yson_pull/ut/reader_ut.cpp +++ b/library/cpp/yson_pull/ut/reader_ut.cpp @@ -75,15 +75,15 @@ namespace {  Y_UNIT_TEST_SUITE(Reader) {      Y_UNIT_TEST(ScalarEntity) { -        test_scalar(TStringBuf("#"), NYsonPull::TScalar{}); +        test_scalar(TStringBuf("#"), NYsonPull::TScalar{});       }      Y_UNIT_TEST(ScalarBoolean) { -        test_scalar(TStringBuf("%true"), true); -        test_scalar(TStringBuf("%false"), false); +        test_scalar(TStringBuf("%true"), true);  +        test_scalar(TStringBuf("%false"), false);  -        test_scalar(TStringBuf("\x05"sv), true); -        test_scalar(TStringBuf("\x04"sv), false); +        test_scalar(TStringBuf("\x05"sv), true);  +        test_scalar(TStringBuf("\x04"sv), false);           REJECT("%");          REJECT("%trueth"); @@ -94,18 +94,18 @@ Y_UNIT_TEST_SUITE(Reader) {      }      Y_UNIT_TEST(ScalarInt64) { -        test_scalar(TStringBuf("1"), i64{1}); -        test_scalar(TStringBuf("+1"), i64{1}); -        test_scalar(TStringBuf("100000"), i64{100000}); -        test_scalar(TStringBuf("+100000"), i64{100000}); -        test_scalar(TStringBuf("-100000"), i64{-100000}); -        test_scalar(TStringBuf("9223372036854775807"), i64{9223372036854775807}); -        test_scalar(TStringBuf("+9223372036854775807"), i64{9223372036854775807}); - -        test_scalar(TStringBuf("\x02\x02"sv), i64{1}); -        test_scalar(TStringBuf("\x02\xc0\x9a\x0c"sv), i64{100000}); -        test_scalar(TStringBuf("\x02\xbf\x9a\x0c"sv), i64{-100000}); -        test_scalar(TStringBuf("\x02\xfe\xff\xff\xff\xff\xff\xff\xff\xff\x01"sv), i64{9223372036854775807}); +        test_scalar(TStringBuf("1"), i64{1});  +        test_scalar(TStringBuf("+1"), i64{1});  +        test_scalar(TStringBuf("100000"), i64{100000});  +        test_scalar(TStringBuf("+100000"), i64{100000});  +        test_scalar(TStringBuf("-100000"), i64{-100000});  +        test_scalar(TStringBuf("9223372036854775807"), i64{9223372036854775807});  +        test_scalar(TStringBuf("+9223372036854775807"), i64{9223372036854775807});  + +        test_scalar(TStringBuf("\x02\x02"sv), i64{1});  +        test_scalar(TStringBuf("\x02\xc0\x9a\x0c"sv), i64{100000});  +        test_scalar(TStringBuf("\x02\xbf\x9a\x0c"sv), i64{-100000});  +        test_scalar(TStringBuf("\x02\xfe\xff\xff\xff\xff\xff\xff\xff\xff\x01"sv), i64{9223372036854775807});           REJECT("1a2");          REJECT("1-1-1-1"); @@ -113,14 +113,14 @@ Y_UNIT_TEST_SUITE(Reader) {      }      Y_UNIT_TEST(SclarUInt64) { -        test_scalar(TStringBuf("1u"), ui64{1}); -        test_scalar(TStringBuf("+1u"), ui64{1}); -        test_scalar(TStringBuf("100000u"), ui64{100000}); -        test_scalar(TStringBuf("+100000u"), ui64{100000}); -        test_scalar(TStringBuf("9223372036854775807u"), ui64{9223372036854775807u}); -        test_scalar(TStringBuf("+9223372036854775807u"), ui64{9223372036854775807u}); -        test_scalar(TStringBuf("18446744073709551615u"), ui64{18446744073709551615u}); -        test_scalar(TStringBuf("+18446744073709551615u"), ui64{18446744073709551615u}); +        test_scalar(TStringBuf("1u"), ui64{1});  +        test_scalar(TStringBuf("+1u"), ui64{1});  +        test_scalar(TStringBuf("100000u"), ui64{100000});  +        test_scalar(TStringBuf("+100000u"), ui64{100000});  +        test_scalar(TStringBuf("9223372036854775807u"), ui64{9223372036854775807u});  +        test_scalar(TStringBuf("+9223372036854775807u"), ui64{9223372036854775807u});  +        test_scalar(TStringBuf("18446744073709551615u"), ui64{18446744073709551615u});  +        test_scalar(TStringBuf("+18446744073709551615u"), ui64{18446744073709551615u});           REJECT("1a2u");          REJECT("1-1-1-1u"); @@ -130,45 +130,45 @@ Y_UNIT_TEST_SUITE(Reader) {      }      Y_UNIT_TEST(ScalarFloat64) { -        test_scalar(TStringBuf("0.0"), double{0.0}); -        test_scalar(TStringBuf("+0.0"), double{0.0}); -        test_scalar(TStringBuf("+.0"), double{0.0}); -        test_scalar(TStringBuf("+.5"), double{0.5}); -        test_scalar(TStringBuf("-.5"), double{-0.5}); -        test_scalar(TStringBuf("1.0"), double{1.0}); -        test_scalar(TStringBuf("+1.0"), double{1.0}); -        test_scalar(TStringBuf("-1.0"), double{-1.0}); -        test_scalar(TStringBuf("1000.0"), double{1000.0}); -        test_scalar(TStringBuf("+1000.0"), double{1000.0}); -        test_scalar(TStringBuf("-1000.0"), double{-1000.0}); -        test_scalar(TStringBuf("1e12"), double{1e12}); -        test_scalar(TStringBuf("1e+12"), double{1e12}); -        test_scalar(TStringBuf("+1e+12"), double{1e12}); -        test_scalar(TStringBuf("-1e+12"), double{-1e12}); -        test_scalar(TStringBuf("1e-12"), double{1e-12}); -        test_scalar(TStringBuf("+1e-12"), double{1e-12}); -        test_scalar(TStringBuf("-1e-12"), double{-1e-12}); - -        test_scalar(TStringBuf("\x03\x00\x00\x00\x00\x00\x00\x00\x00"sv), double{0.0}); +        test_scalar(TStringBuf("0.0"), double{0.0});  +        test_scalar(TStringBuf("+0.0"), double{0.0});  +        test_scalar(TStringBuf("+.0"), double{0.0});  +        test_scalar(TStringBuf("+.5"), double{0.5});  +        test_scalar(TStringBuf("-.5"), double{-0.5});  +        test_scalar(TStringBuf("1.0"), double{1.0});  +        test_scalar(TStringBuf("+1.0"), double{1.0});  +        test_scalar(TStringBuf("-1.0"), double{-1.0});  +        test_scalar(TStringBuf("1000.0"), double{1000.0});  +        test_scalar(TStringBuf("+1000.0"), double{1000.0});  +        test_scalar(TStringBuf("-1000.0"), double{-1000.0});  +        test_scalar(TStringBuf("1e12"), double{1e12});  +        test_scalar(TStringBuf("1e+12"), double{1e12});  +        test_scalar(TStringBuf("+1e+12"), double{1e12});  +        test_scalar(TStringBuf("-1e+12"), double{-1e12});  +        test_scalar(TStringBuf("1e-12"), double{1e-12});  +        test_scalar(TStringBuf("+1e-12"), double{1e-12});  +        test_scalar(TStringBuf("-1e-12"), double{-1e-12});  + +        test_scalar(TStringBuf("\x03\x00\x00\x00\x00\x00\x00\x00\x00"sv), double{0.0});           test_scalar( -            TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf8\x7f"sv), +            TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf8\x7f"sv),               double{std::numeric_limits<double>::quiet_NaN()});          test_scalar( -            TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf0\x7f"sv), +            TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf0\x7f"sv),               double{std::numeric_limits<double>::infinity()});          test_scalar( -            TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf0\xff"sv), +            TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf0\xff"sv),               double{-std::numeric_limits<double>::infinity()});          test_scalar( -            TStringBuf("%nan"), +            TStringBuf("%nan"),               double{std::numeric_limits<double>::quiet_NaN()});          test_scalar( -            TStringBuf("%inf"), +            TStringBuf("%inf"),               double{std::numeric_limits<double>::infinity()});          test_scalar( -            TStringBuf("%-inf"), +            TStringBuf("%-inf"),               double{-std::numeric_limits<double>::infinity()});          REJECT("++0.0"); @@ -176,7 +176,7 @@ Y_UNIT_TEST_SUITE(Reader) {          REJECT("++.1");          REJECT("1.0.0");          //REJECT("1e+10000"); -        REJECT(TStringBuf("\x03\x00\x00\x00\x00\x00\x00\x00"sv)); +        REJECT(TStringBuf("\x03\x00\x00\x00\x00\x00\x00\x00"sv));           // XXX: Questionable behaviour?          ACCEPT("+.0"); @@ -194,16 +194,16 @@ Y_UNIT_TEST_SUITE(Reader) {      }      Y_UNIT_TEST(ScalarString) { -        test_scalar(TStringBuf(R"(foobar)"), TStringBuf("foobar")); -        test_scalar(TStringBuf(R"(foobar11)"), TStringBuf("foobar11")); -        test_scalar(TStringBuf(R"("foobar")"), TStringBuf("foobar")); +        test_scalar(TStringBuf(R"(foobar)"), TStringBuf("foobar"));  +        test_scalar(TStringBuf(R"(foobar11)"), TStringBuf("foobar11"));  +        test_scalar(TStringBuf(R"("foobar")"), TStringBuf("foobar"));           // wat? "\x0cf" parsed as a single char? no way! -        test_scalar("\x01\x0c" "foobar"sv, -                    TStringBuf("foobar")); +        test_scalar("\x01\x0c" "foobar"sv,  +                    TStringBuf("foobar"));           REJECT(R"("foobar)"); -        REJECT("\x01\x0c" "fooba"sv); -        REJECT("\x01\x0d" "foobar"sv); // negative length +        REJECT("\x01\x0c" "fooba"sv);  +        REJECT("\x01\x0d" "foobar"sv); // negative length       }      Y_UNIT_TEST(EmptyList) { @@ -241,7 +241,7 @@ Y_UNIT_TEST_SUITE(Reader) {          {              auto& e = reader.NextEvent();              UNIT_ASSERT_VALUES_EQUAL(NYsonPull::EEventType::Key, e.Type()); -            UNIT_ASSERT_VALUES_EQUAL(TStringBuf("11"), e.AsString()); +            UNIT_ASSERT_VALUES_EQUAL(TStringBuf("11"), e.AsString());           }          {              auto& e = reader.NextEvent(); @@ -252,7 +252,7 @@ Y_UNIT_TEST_SUITE(Reader) {          {              auto& e = reader.NextEvent();              UNIT_ASSERT_VALUES_EQUAL(NYsonPull::EEventType::Key, e.Type()); -            UNIT_ASSERT_VALUES_EQUAL(TStringBuf("nothing"), e.AsString()); +            UNIT_ASSERT_VALUES_EQUAL(TStringBuf("nothing"), e.AsString());           }          {              auto& e = reader.NextEvent(); @@ -263,7 +263,7 @@ Y_UNIT_TEST_SUITE(Reader) {          {              auto& e = reader.NextEvent();              UNIT_ASSERT_VALUES_EQUAL(NYsonPull::EEventType::Key, e.Type()); -            UNIT_ASSERT_VALUES_EQUAL(TStringBuf("zero"), e.AsString()); +            UNIT_ASSERT_VALUES_EQUAL(TStringBuf("zero"), e.AsString());           }          {              auto& e = reader.NextEvent(); @@ -274,18 +274,18 @@ Y_UNIT_TEST_SUITE(Reader) {          {              auto& e = reader.NextEvent();              UNIT_ASSERT_VALUES_EQUAL(NYsonPull::EEventType::Key, e.Type()); -            UNIT_ASSERT_VALUES_EQUAL(TStringBuf("foo"), e.AsString()); +            UNIT_ASSERT_VALUES_EQUAL(TStringBuf("foo"), e.AsString());           }          {              auto& e = reader.NextEvent();              UNIT_ASSERT_VALUES_EQUAL(NYsonPull::EEventType::Scalar, e.Type()); -            UNIT_ASSERT_VALUES_EQUAL(NYsonPull::TScalar{TStringBuf("bar")}, e.AsScalar()); +            UNIT_ASSERT_VALUES_EQUAL(NYsonPull::TScalar{TStringBuf("bar")}, e.AsScalar());           }          {              auto& e = reader.NextEvent();              UNIT_ASSERT_VALUES_EQUAL(NYsonPull::EEventType::Key, e.Type()); -            UNIT_ASSERT_VALUES_EQUAL(TStringBuf("list"), e.AsString()); +            UNIT_ASSERT_VALUES_EQUAL(TStringBuf("list"), e.AsString());           }          UNIT_ASSERT_VALUES_EQUAL(NYsonPull::EEventType::BeginList, reader.NextEvent().Type());          { diff --git a/library/cpp/yson_pull/ut/writer_ut.cpp b/library/cpp/yson_pull/ut/writer_ut.cpp index 5c304bad0f3..aa9aa1cff92 100644 --- a/library/cpp/yson_pull/ut/writer_ut.cpp +++ b/library/cpp/yson_pull/ut/writer_ut.cpp @@ -8,8 +8,8 @@  #include <climits>  #include <limits> -using namespace std::string_view_literals; - +using namespace std::string_view_literals;  +   namespace {      template <typename Writer, typename Function>      TString with_writer(Function&& function) { @@ -155,101 +155,101 @@ Y_UNIT_TEST_SUITE(Writer) {      Y_UNIT_TEST(BinaryBoolean) {          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x4"), +            TStringBuf("\x4"),               to_yson_binary_string(NYsonPull::TScalar{false}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x5"), +            TStringBuf("\x5"),               to_yson_binary_string(NYsonPull::TScalar{true}));      }      Y_UNIT_TEST(BinaryInt64) {          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x2\0"sv), +            TStringBuf("\x2\0"sv),               to_yson_binary_string(NYsonPull::TScalar{i64{0}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x2\x90\x3"), +            TStringBuf("\x2\x90\x3"),               to_yson_binary_string(NYsonPull::TScalar{i64{200}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x2\xC0\xB8\x2"), +            TStringBuf("\x2\xC0\xB8\x2"),               to_yson_binary_string(NYsonPull::TScalar{i64{20000}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x2\x80\x88\xDE\xBE\x1"), +            TStringBuf("\x2\x80\x88\xDE\xBE\x1"),               to_yson_binary_string(NYsonPull::TScalar{i64{200000000}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x2\x80\x80\x90\xF8\x9B\xF9\x86G"), +            TStringBuf("\x2\x80\x80\x90\xF8\x9B\xF9\x86G"),               to_yson_binary_string(NYsonPull::TScalar{i64{20000000000000000}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x2\xFE\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1"), +            TStringBuf("\x2\xFE\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1"),               to_yson_binary_string(NYsonPull::TScalar{i64{INT64_MAX}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x2\x8F\x3"), +            TStringBuf("\x2\x8F\x3"),               to_yson_binary_string(NYsonPull::TScalar{i64{-200}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x2\xBF\xB8\x2"), +            TStringBuf("\x2\xBF\xB8\x2"),               to_yson_binary_string(NYsonPull::TScalar{i64{-20000}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x2\xFF\x87\xDE\xBE\x1"), +            TStringBuf("\x2\xFF\x87\xDE\xBE\x1"),               to_yson_binary_string(NYsonPull::TScalar{i64{-200000000}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x2\xFF\xFF\x8F\xF8\x9B\xF9\x86G"), +            TStringBuf("\x2\xFF\xFF\x8F\xF8\x9B\xF9\x86G"),               to_yson_binary_string(NYsonPull::TScalar{i64{-20000000000000000}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x2\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1"), +            TStringBuf("\x2\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1"),               to_yson_binary_string(NYsonPull::TScalar{i64{INT64_MIN}}));      }      Y_UNIT_TEST(BinaryUInt64) {          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x6\0"sv), +            TStringBuf("\x6\0"sv),               to_yson_binary_string(NYsonPull::TScalar{ui64{0}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x6\xC8\x1"), +            TStringBuf("\x6\xC8\x1"),               to_yson_binary_string(NYsonPull::TScalar{ui64{200}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x6\xA0\x9C\x1"), +            TStringBuf("\x6\xA0\x9C\x1"),               to_yson_binary_string(NYsonPull::TScalar{ui64{20000}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x6\x80\x84\xAF_"), +            TStringBuf("\x6\x80\x84\xAF_"),               to_yson_binary_string(NYsonPull::TScalar{ui64{200000000}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x6\x80\x80\x88\xFC\xCD\xBC\xC3#"), +            TStringBuf("\x6\x80\x80\x88\xFC\xCD\xBC\xC3#"),               to_yson_binary_string(NYsonPull::TScalar{ui64{20000000000000000}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x6\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x7F"), +            TStringBuf("\x6\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x7F"),               to_yson_binary_string(NYsonPull::TScalar{ui64{INT64_MAX}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x6\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1"), +            TStringBuf("\x6\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1"),               to_yson_binary_string(NYsonPull::TScalar{ui64{UINT64_MAX}}));      }      Y_UNIT_TEST(BinaryFloat64) {          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf0\x7f"sv), +            TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf0\x7f"sv),               to_yson_binary_string(NYsonPull::TScalar{std::numeric_limits<double>::infinity()}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf0\xff"sv), +            TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf0\xff"sv),               to_yson_binary_string(NYsonPull::TScalar{-std::numeric_limits<double>::infinity()}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf8\x7f"sv), +            TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf8\x7f"sv),               to_yson_binary_string(NYsonPull::TScalar{std::numeric_limits<double>::quiet_NaN()}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x03\x9a\x99\x99\x99\x99\x99\xf1\x3f"), +            TStringBuf("\x03\x9a\x99\x99\x99\x99\x99\xf1\x3f"),               to_yson_binary_string(NYsonPull::TScalar{double{1.1}}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x03\x9a\x99\x99\x99\x99\x99\xf1\xbf"), +            TStringBuf("\x03\x9a\x99\x99\x99\x99\x99\xf1\xbf"),               to_yson_binary_string(NYsonPull::TScalar{double{-1.1}}));      }      Y_UNIT_TEST(BinaryString) {          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x1\0"sv), +            TStringBuf("\x1\0"sv),               to_yson_binary_string(NYsonPull::TScalar{""}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x1\nhello"), +            TStringBuf("\x1\nhello"),               to_yson_binary_string(NYsonPull::TScalar{"hello"}));          UNIT_ASSERT_VALUES_EQUAL( -            TStringBuf("\x1\x16hello\nworld"), +            TStringBuf("\x1\x16hello\nworld"),               to_yson_binary_string(NYsonPull::TScalar{"hello\nworld"}));      } diff --git a/library/cpp/yt/misc/enum-inl.h b/library/cpp/yt/misc/enum-inl.h index 59ef7047753..9557432b3b7 100644 --- a/library/cpp/yt/misc/enum-inl.h +++ b/library/cpp/yt/misc/enum-inl.h @@ -73,7 +73,7 @@ static constexpr bool AreValuesDistinct(const TValues& values)          \          static TStringBuf GetTypeName() \          { \ -            static constexpr TStringBuf typeName = PP_STRINGIZE(name); \ +            static constexpr TStringBuf typeName = PP_STRINGIZE(name); \               return typeName; \          } \          \ @@ -143,7 +143,7 @@ static constexpr bool AreValuesDistinct(const TValues& values)      ENUM__GET_DOMAIN_NAMES_ITEM_ATOMIC(PP_ELEMENT(seq, 0))  #define ENUM__GET_DOMAIN_NAMES_ITEM_ATOMIC(item) \ -    TStringBuf(PP_STRINGIZE(item)), +    TStringBuf(PP_STRINGIZE(item)),   #define ENUM__DECOMPOSE \      static std::vector<TType> Decompose(TType value) \ diff --git a/library/cpp/yt/string/format-inl.h b/library/cpp/yt/string/format-inl.h index 5484d4a216c..93b0aadac52 100644 --- a/library/cpp/yt/string/format-inl.h +++ b/library/cpp/yt/string/format-inl.h @@ -49,7 +49,7 @@ inline void FormatValue(TStringBuilderBase* builder, TStringBuf value, TStringBu          hasAlign = true;          alignSize = 10 * alignSize + (*current - '0');          if (alignSize > 1000000) { -            builder->AppendString(TStringBuf("<alignment overflow>")); +            builder->AppendString(TStringBuf("<alignment overflow>"));               return;          }          ++current; @@ -144,8 +144,8 @@ inline void FormatValue(TStringBuilderBase* builder, bool value, TStringBuf form      }      auto str = lowercase -        ? (value ? TStringBuf("true") : TStringBuf("false")) -        : (value ? TStringBuf("True") : TStringBuf("False")); +        ? (value ? TStringBuf("true") : TStringBuf("false"))  +        : (value ? TStringBuf("True") : TStringBuf("False"));       builder->AppendString(str);  } @@ -406,7 +406,7 @@ struct TValueFormatter<std::pair<T1, T2>>      {          builder->AppendChar('{');          FormatValue(builder, value.first, format); -        builder->AppendString(TStringBuf(", ")); +        builder->AppendString(TStringBuf(", "));           FormatValue(builder, value.second, format);          builder->AppendChar('}');      } @@ -415,7 +415,7 @@ struct TValueFormatter<std::pair<T1, T2>>  // std::optional  inline void FormatValue(TStringBuilderBase* builder, std::nullopt_t, TStringBuf /*format*/)  { -    builder->AppendString(TStringBuf("<null>")); +    builder->AppendString(TStringBuf("<null>"));   }  template <class T> @@ -487,7 +487,7 @@ char* WriteIntToBufferBackwards(char* buffer, TValue value);  template <class TValue>  void FormatValueViaHelper(TStringBuilderBase* builder, TValue value, TStringBuf format, TStringBuf genericSpec)  { -    if (format == TStringBuf("v")) { +    if (format == TStringBuf("v")) {           const int MaxResultSize = 64;          char buffer[MaxResultSize];          char* end = buffer + MaxResultSize; @@ -504,14 +504,14 @@ void FormatValueViaHelper(TStringBuilderBase* builder, TValue value, TStringBuf          FormatValueViaHelper(builder, static_cast<castType>(value), format, genericSpec); \      } -XX(i8,              int,                TStringBuf("d")) -XX(ui8,             unsigned int,       TStringBuf("u")) -XX(i16,             int,                TStringBuf("d")) -XX(ui16,            unsigned int,       TStringBuf("u")) -XX(i32,             int,                TStringBuf("d")) -XX(ui32,            unsigned int,       TStringBuf("u")) -XX(long,            long,               TStringBuf("ld")) -XX(unsigned long,   unsigned long,      TStringBuf("lu")) +XX(i8,              int,                TStringBuf("d"))  +XX(ui8,             unsigned int,       TStringBuf("u"))  +XX(i16,             int,                TStringBuf("d"))  +XX(ui16,            unsigned int,       TStringBuf("u"))  +XX(i32,             int,                TStringBuf("d"))  +XX(ui32,            unsigned int,       TStringBuf("u"))  +XX(long,            long,               TStringBuf("ld"))  +XX(unsigned long,   unsigned long,      TStringBuf("lu"))   #undef XX @@ -521,8 +521,8 @@ XX(unsigned long,   unsigned long,      TStringBuf("lu"))          FormatValueViaSprintf(builder, static_cast<castType>(value), format, genericSpec); \      } -XX(double,          double,             TStringBuf("lf")) -XX(float,           float,              TStringBuf("f")) +XX(double,          double,             TStringBuf("lf"))  +XX(float,           float,              TStringBuf("f"))   #undef XX @@ -530,7 +530,7 @@ XX(float,           float,              TStringBuf("f"))  template <class T>  void FormatValue(TStringBuilderBase* builder, T* value, TStringBuf format)  { -    FormatValueViaSprintf(builder, value, format, TStringBuf("p")); +    FormatValueViaSprintf(builder, value, format, TStringBuf("p"));   }  // TDuration (specialize for performance reasons) @@ -672,7 +672,7 @@ struct TArgFormatterImpl<IndexBase>  {      void operator() (size_t /*index*/, TStringBuilderBase* builder, TStringBuf /*format*/) const      { -        builder->AppendString(TStringBuf("<missing argument>")); +        builder->AppendString(TStringBuf("<missing argument>"));       }  }; diff --git a/library/cpp/yt/string/string.cpp b/library/cpp/yt/string/string.cpp index 7440ac3fdd1..55646270983 100644 --- a/library/cpp/yt/string/string.cpp +++ b/library/cpp/yt/string/string.cpp @@ -191,13 +191,13 @@ char* WriteUnsignedIntToBufferBackwardsImpl(char* ptr, T value)  template <>  char* WriteIntToBufferBackwards(char* ptr, i32 value)  { -    return WriteSignedIntToBufferBackwardsImpl(ptr, value, TStringBuf("-2147483647")); +    return WriteSignedIntToBufferBackwardsImpl(ptr, value, TStringBuf("-2147483647"));   }  template <>  char* WriteIntToBufferBackwards(char* ptr, i64 value)  { -    return WriteSignedIntToBufferBackwardsImpl(ptr, value, TStringBuf("-9223372036854775808")); +    return WriteSignedIntToBufferBackwardsImpl(ptr, value, TStringBuf("-9223372036854775808"));   }  template <> diff --git a/library/cpp/yt/string/string.h b/library/cpp/yt/string/string.h index ae6c99caab0..c9199117e69 100644 --- a/library/cpp/yt/string/string.h +++ b/library/cpp/yt/string/string.h @@ -25,13 +25,13 @@ struct TDefaultFormatter      template <class T>      void operator()(TStringBuilderBase* builder, const T& obj) const      { -        FormatValue(builder, obj, TStringBuf("v")); +        FormatValue(builder, obj, TStringBuf("v"));       }  }; -static constexpr TStringBuf DefaultJoinToStringDelimiter = ", "; -static constexpr TStringBuf DefaultKeyValueDelimiter = ": "; -static constexpr TStringBuf DefaultRangeEllipsisFormat = "..."; +static constexpr TStringBuf DefaultJoinToStringDelimiter = ", ";  +static constexpr TStringBuf DefaultKeyValueDelimiter = ": ";  +static constexpr TStringBuf DefaultRangeEllipsisFormat = "...";   // ASCII characters from 0x20 = ' ' to 0x7e = '~' are printable.  static constexpr char PrintableASCIILow = 0x20; diff --git a/library/cpp/yt/string/string_builder.h b/library/cpp/yt/string/string_builder.h index 0e13e709045..2d9dd6edc74 100644 --- a/library/cpp/yt/string/string_builder.h +++ b/library/cpp/yt/string/string_builder.h @@ -75,7 +75,7 @@ protected:  ////////////////////////////////////////////////////////////////////////////////  template <class T> -TString ToStringViaBuilder(const T& value, TStringBuf spec = TStringBuf("v")); +TString ToStringViaBuilder(const T& value, TStringBuf spec = TStringBuf("v"));   //////////////////////////////////////////////////////////////////////////////// @@ -86,7 +86,7 @@ class TDelimitedStringBuilderWrapper  public:      TDelimitedStringBuilderWrapper(          TStringBuilderBase* builder, -        TStringBuf delimiter = TStringBuf(", ")) +        TStringBuf delimiter = TStringBuf(", "))           : Builder_(builder)          , Delimiter_(delimiter)      { } diff --git a/tools/archiver/main.cpp b/tools/archiver/main.cpp index 6cda54c1ea8..987d889d49b 100644 --- a/tools/archiver/main.cpp +++ b/tools/archiver/main.cpp @@ -41,7 +41,7 @@ namespace {      private:          void WriteBuf() { -            Slave << '"' << Buf << "\",\n"sv; +            Slave << '"' << Buf << "\",\n"sv;               Buf.clear();          } diff --git a/tools/enum_parser/enum_parser/main.cpp b/tools/enum_parser/enum_parser/main.cpp index 0943c69c1da..1fb07241577 100644 --- a/tools/enum_parser/enum_parser/main.cpp +++ b/tools/enum_parser/enum_parser/main.cpp @@ -129,7 +129,7 @@ static inline void CloseArray(TStringStream& out) {  }  static TString WrapStringBuf(const TStringBuf str) { -    return TString::Join("TStringBuf(\"", str, "\")"); +    return TString::Join("TStringBuf(\"", str, "\")");   }  void GenerateEnum( diff --git a/tools/rescompressor/main.cpp b/tools/rescompressor/main.cpp index 9aba1002c5d..67a9ee0a46d 100644 --- a/tools/rescompressor/main.cpp +++ b/tools/rescompressor/main.cpp @@ -110,7 +110,7 @@ int main(int argc, char** argv) {      }      while (TStringBuf(argv[ind]).StartsWith("--replace=")) { -        replacements.push_back(TStringBuf(argv[ind]).SubStr(TStringBuf("--replace=").Size())); +        replacements.push_back(TStringBuf(argv[ind]).SubStr(TStringBuf("--replace=").Size()));           ind++;      } @@ -119,7 +119,7 @@ int main(int argc, char** argv) {      bool error = false;      while (ind < argc) {          TString compressed; -        if ("-"sv == argv[ind]) { +        if ("-"sv == argv[ind]) {               ind++;              if (ind >= argc) {                  error = true; diff --git a/util/charset/generated/unidata.cpp b/util/charset/generated/unidata.cpp index 6f5adbbc0aa..ea2158ab80b 100644 --- a/util/charset/generated/unidata.cpp +++ b/util/charset/generated/unidata.cpp @@ -1,7 +1,7 @@  #include <util/charset/unidata.h>  namespace { namespace NUnidataTableGenerated { -    using TV = const NUnicode::NPrivate::TUnidataTable::TStored; +    using TV = const NUnicode::NPrivate::TUnidataTable::TStored;       static const TV V[] = {  #undef V0 diff --git a/util/charset/utf8_ut.cpp b/util/charset/utf8_ut.cpp index 9e68881cca2..fab9164e49f 100644 --- a/util/charset/utf8_ut.cpp +++ b/util/charset/utf8_ut.cpp @@ -15,7 +15,7 @@ Y_UNIT_TEST_SUITE(TUtfUtilTest) {      Y_UNIT_TEST(TestToLowerUtfString) {          UNIT_ASSERT_VALUES_EQUAL(ToLowerUTF8("xyz XYZ ПРИВЕТ!"), "xyz xyz привет!"); -        UNIT_ASSERT_VALUES_EQUAL(ToLowerUTF8(TStringBuf("xyz")), "xyz"); +        UNIT_ASSERT_VALUES_EQUAL(ToLowerUTF8(TStringBuf("xyz")), "xyz");           {              TString s = "привет!"; @@ -55,7 +55,7 @@ Y_UNIT_TEST_SUITE(TUtfUtilTest) {      Y_UNIT_TEST(TestToUpperUtfString) {          UNIT_ASSERT_VALUES_EQUAL(ToUpperUTF8("xyz XYZ привет!"), "XYZ XYZ ПРИВЕТ!"); -        UNIT_ASSERT_VALUES_EQUAL(ToUpperUTF8(TStringBuf("XYZ")), "XYZ"); +        UNIT_ASSERT_VALUES_EQUAL(ToUpperUTF8(TStringBuf("XYZ")), "XYZ");           {              TString s = "ПРИВЕТ!"; @@ -93,7 +93,7 @@ Y_UNIT_TEST_SUITE(TUtfUtilTest) {      }      Y_UNIT_TEST(TestUTF8ToWide) { -        TFileInput in(ArcadiaSourceRoot() + TStringBuf("/util/charset/ut/utf8/test1.txt")); +        TFileInput in(ArcadiaSourceRoot() + TStringBuf("/util/charset/ut/utf8/test1.txt"));           TString text = in.ReadAll();          UNIT_ASSERT(WideToUTF8(UTF8ToWide(text)) == text); @@ -101,7 +101,7 @@ Y_UNIT_TEST_SUITE(TUtfUtilTest) {      Y_UNIT_TEST(TestInvalidUTF8) {          TVector<TString> testData; -        TFileInput input(ArcadiaSourceRoot() + TStringBuf("/util/charset/ut/utf8/invalid_UTF8.bin")); +        TFileInput input(ArcadiaSourceRoot() + TStringBuf("/util/charset/ut/utf8/invalid_UTF8.bin"));           Load(&input, testData);          for (const auto& text : testData) { @@ -110,7 +110,7 @@ Y_UNIT_TEST_SUITE(TUtfUtilTest) {      }      Y_UNIT_TEST(TestUTF8ToWideScalar) { -        TFileInput in(ArcadiaSourceRoot() + TStringBuf("/util/charset/ut/utf8/test1.txt")); +        TFileInput in(ArcadiaSourceRoot() + TStringBuf("/util/charset/ut/utf8/test1.txt"));           TString text = in.ReadAll();          TUtf16String wtextSSE = UTF8ToWide(text); diff --git a/util/charset/wide.h b/util/charset/wide.h index 04e6928aab3..fce8ed500b0 100644 --- a/util/charset/wide.h +++ b/util/charset/wide.h @@ -815,10 +815,10 @@ void EscapeHtmlChars(TUtf16String& str);  //! returns number of characters in range. Handle surrogate pairs as one character.  inline size_t CountWideChars(const wchar16* b, const wchar16* e) {      size_t count = 0; -    Y_ENSURE(b <= e, TStringBuf("invalid iterators")); +    Y_ENSURE(b <= e, TStringBuf("invalid iterators"));       while (b < e) {          b = SkipSymbol(b, e); -        ++count; +        ++count;       }      return count;  } @@ -829,7 +829,7 @@ inline size_t CountWideChars(const TWtringBuf str) {  //! checks whether the range is valid UTF-16 sequence  inline bool IsValidUTF16(const wchar16* b, const wchar16* e) { -    Y_ENSURE(b <= e, TStringBuf("invalid iterators")); +    Y_ENSURE(b <= e, TStringBuf("invalid iterators"));       while (b < e) {          wchar32 symbol = ReadSymbolAndAdvance(b, e);          if (symbol == BROKEN_RUNE) diff --git a/util/datetime/base.cpp b/util/datetime/base.cpp index 38ecc3ab962..b78def8c777 100644 --- a/util/datetime/base.cpp +++ b/util/datetime/base.cpp @@ -146,7 +146,7 @@ void Out<TInstant>(IOutputStream& os, TTypeTraits<TInstant>::TFuncParam instant)      auto len = FormatDate8601(buf, sizeof(buf), instant.TimeT());      // shouldn't happen due to current implementation of FormatDate8601() and GmTimeR() -    Y_ENSURE(len, TStringBuf("Out<TInstant>: year does not fit into an integer")); +    Y_ENSURE(len, TStringBuf("Out<TInstant>: year does not fit into an integer"));       os.Write(buf, len - 1 /* 'Z' */);      WriteMicroSecondsToStream(os, instant.MicroSecondsOfSecond()); diff --git a/util/datetime/base_ut.cpp b/util/datetime/base_ut.cpp index afc3f802eb2..e098ce06d5d 100644 --- a/util/datetime/base_ut.cpp +++ b/util/datetime/base_ut.cpp @@ -493,8 +493,8 @@ Y_UNIT_TEST_SUITE(DateTimeTest) {      }      Y_UNIT_TEST(TestNoexceptConstruction) { -        UNIT_ASSERT_EXCEPTION(TDuration::MilliSeconds(FromString(TStringBuf("not a number"))), yexception); -        UNIT_ASSERT_EXCEPTION(TDuration::Seconds(FromString(TStringBuf("not a number"))), yexception); +        UNIT_ASSERT_EXCEPTION(TDuration::MilliSeconds(FromString(TStringBuf("not a number"))), yexception);  +        UNIT_ASSERT_EXCEPTION(TDuration::Seconds(FromString(TStringBuf("not a number"))), yexception);       }      Y_UNIT_TEST(TestFromValueForTDuration) { diff --git a/util/datetime/cputimer.h b/util/datetime/cputimer.h index 7d38d5bdb38..820454f8b6e 100644 --- a/util/datetime/cputimer.h +++ b/util/datetime/cputimer.h @@ -12,7 +12,7 @@ private:      TStringStream Message_;  public: -    TTimer(const TStringBuf message = TStringBuf(" took: ")); +    TTimer(const TStringBuf message = TStringBuf(" took: "));       ~TTimer();  }; diff --git a/util/datetime/parser_deprecated_ut.cpp b/util/datetime/parser_deprecated_ut.cpp index 6ad9f885b1c..13383d3f18c 100644 --- a/util/datetime/parser_deprecated_ut.cpp +++ b/util/datetime/parser_deprecated_ut.cpp @@ -466,53 +466,53 @@ Y_UNIT_TEST_SUITE(TDateTimeParseTestDeprecated) {      Y_UNIT_TEST(TestTInstantTryParseDeprecated) {          { -            const TStringBuf s = "2009-09-19 03:37:08.1+04:00"; +            const TStringBuf s = "2009-09-19 03:37:08.1+04:00";               const auto i = TInstant::ParseIso8601Deprecated(s);              TInstant iTry;              UNIT_ASSERT(TInstant::TryParseIso8601Deprecated(s, iTry));              UNIT_ASSERT_VALUES_EQUAL(i, iTry);          }          { -            const TStringBuf s = "2009-09aslkdjfkljasdjfl4:00"; +            const TStringBuf s = "2009-09aslkdjfkljasdjfl4:00";               TInstant iTry;              UNIT_ASSERT_EXCEPTION(TInstant::ParseIso8601Deprecated(s), TDateTimeParseException);              UNIT_ASSERT(!TInstant::TryParseIso8601Deprecated(s, iTry));          }          { -            const TStringBuf s = "Wed, 14 Oct 2009 16:55:33 GMT"; +            const TStringBuf s = "Wed, 14 Oct 2009 16:55:33 GMT";               const auto i = TInstant::ParseRfc822Deprecated(s);              TInstant iTry;              UNIT_ASSERT(TInstant::TryParseRfc822Deprecated(s, iTry));              UNIT_ASSERT_VALUES_EQUAL(i, iTry);          }          { -            const TStringBuf s = "Wed, alsdjflkasjdfl:55:33 GMT"; +            const TStringBuf s = "Wed, alsdjflkasjdfl:55:33 GMT";               TInstant iTry;              UNIT_ASSERT_EXCEPTION(TInstant::ParseRfc822Deprecated(s), TDateTimeParseException);              UNIT_ASSERT(!TInstant::TryParseRfc822Deprecated(s, iTry));          }          { -            const TStringBuf s = "20091014165533Z"; +            const TStringBuf s = "20091014165533Z";               const auto i = TInstant::ParseX509ValidityDeprecated(s);              TInstant iTry;              UNIT_ASSERT(TInstant::TryParseX509Deprecated(s, iTry));              UNIT_ASSERT_VALUES_EQUAL(i, iTry);          }          { -            const TStringBuf s = "200asdfasdf533Z"; +            const TStringBuf s = "200asdfasdf533Z";               TInstant iTry;              UNIT_ASSERT_EXCEPTION(TInstant::ParseX509ValidityDeprecated(s), TDateTimeParseException);              UNIT_ASSERT(!TInstant::TryParseX509Deprecated(s, iTry));          }          { -            const TStringBuf s = "990104074212Z"; +            const TStringBuf s = "990104074212Z";               const auto i = TInstant::ParseX509ValidityDeprecated(s);              TInstant iTry;              UNIT_ASSERT(TInstant::TryParseX509Deprecated(s, iTry));              UNIT_ASSERT_VALUES_EQUAL(i, iTry);          }          { -            const TStringBuf s = "9901asdf4212Z"; +            const TStringBuf s = "9901asdf4212Z";               TInstant iTry;              UNIT_ASSERT_EXCEPTION(TInstant::ParseX509ValidityDeprecated(s), TDateTimeParseException);              UNIT_ASSERT(!TInstant::TryParseX509Deprecated(s, iTry)); diff --git a/util/datetime/parser_ut.cpp b/util/datetime/parser_ut.cpp index 61364af997f..b430bc6abf6 100644 --- a/util/datetime/parser_ut.cpp +++ b/util/datetime/parser_ut.cpp @@ -516,53 +516,53 @@ Y_UNIT_TEST_SUITE(TDateTimeParseTest) {      Y_UNIT_TEST(TestTInstantTryParse) {          { -            const TStringBuf s = "2009-09-19 03:37:08.1+04:00"; +            const TStringBuf s = "2009-09-19 03:37:08.1+04:00";               const auto i = TInstant::ParseIso8601(s);              TInstant iTry;              UNIT_ASSERT(TInstant::TryParseIso8601(s, iTry));              UNIT_ASSERT_VALUES_EQUAL(i, iTry);          }          { -            const TStringBuf s = "2009-09aslkdjfkljasdjfl4:00"; +            const TStringBuf s = "2009-09aslkdjfkljasdjfl4:00";               TInstant iTry;              UNIT_ASSERT_EXCEPTION(TInstant::ParseIso8601(s), TDateTimeParseException);              UNIT_ASSERT(!TInstant::TryParseIso8601(s, iTry));          }          { -            const TStringBuf s = "Wed, 14 Oct 2009 16:55:33 GMT"; +            const TStringBuf s = "Wed, 14 Oct 2009 16:55:33 GMT";               const auto i = TInstant::ParseRfc822(s);              TInstant iTry;              UNIT_ASSERT(TInstant::TryParseRfc822(s, iTry));              UNIT_ASSERT_VALUES_EQUAL(i, iTry);          }          { -            const TStringBuf s = "Wed, alsdjflkasjdfl:55:33 GMT"; +            const TStringBuf s = "Wed, alsdjflkasjdfl:55:33 GMT";               TInstant iTry;              UNIT_ASSERT_EXCEPTION(TInstant::ParseRfc822(s), TDateTimeParseException);              UNIT_ASSERT(!TInstant::TryParseRfc822(s, iTry));          }          { -            const TStringBuf s = "20091014165533Z"; +            const TStringBuf s = "20091014165533Z";               const auto i = TInstant::ParseX509Validity(s);              TInstant iTry;              UNIT_ASSERT(TInstant::TryParseX509(s, iTry));              UNIT_ASSERT_VALUES_EQUAL(i, iTry);          }          { -            const TStringBuf s = "200asdfasdf533Z"; +            const TStringBuf s = "200asdfasdf533Z";               TInstant iTry;              UNIT_ASSERT_EXCEPTION(TInstant::ParseX509Validity(s), TDateTimeParseException);              UNIT_ASSERT(!TInstant::TryParseX509(s, iTry));          }          { -            const TStringBuf s = "990104074212Z"; +            const TStringBuf s = "990104074212Z";               const auto i = TInstant::ParseX509Validity(s);              TInstant iTry;              UNIT_ASSERT(TInstant::TryParseX509(s, iTry));              UNIT_ASSERT_VALUES_EQUAL(i, iTry);          }          { -            const TStringBuf s = "9901asdf4212Z"; +            const TStringBuf s = "9901asdf4212Z";               TInstant iTry;              UNIT_ASSERT_EXCEPTION(TInstant::ParseX509Validity(s), TDateTimeParseException);              UNIT_ASSERT(!TInstant::TryParseX509(s, iTry)); diff --git a/util/datetime/strptime.cpp b/util/datetime/strptime.cpp index f0d4ec333e8..709eb56b804 100644 --- a/util/datetime/strptime.cpp +++ b/util/datetime/strptime.cpp @@ -190,7 +190,7 @@ _strptime(const char* buf, const char* fmt, struct tm* tm, int* GMTp)          if (c != '%') {              if (isspace((unsigned char)c))                  while (*buf != 0 && isspace((unsigned char)*buf)) -                    ++buf; +                    ++buf;               else if (c != *buf++)                  return 0;              continue; diff --git a/util/datetime/systime.cpp b/util/datetime/systime.cpp index 6ee7e8fc6ed..f77464704bd 100644 --- a/util/datetime/systime.cpp +++ b/util/datetime/systime.cpp @@ -113,14 +113,14 @@ struct tm* GmTimeR(const time_t* timer, struct tm* tmbuf) {      tmbuf->tm_wday = (dayno + 4) % 7; // Day 0 was a thursday      while (dayno >= (ui64)YEARSIZE(year)) {          dayno -= YEARSIZE(year); -        ++year; +        ++year;       }      tmbuf->tm_year = year - YEAR0;      tmbuf->tm_yday = dayno;      tmbuf->tm_mon = 0;      while (dayno >= (ui64)_ytab[LEAPYEAR(year)][tmbuf->tm_mon]) {          dayno -= _ytab[LEAPYEAR(year)][tmbuf->tm_mon]; -        ++tmbuf->tm_mon; +        ++tmbuf->tm_mon;       }      tmbuf->tm_mday = dayno + 1;      tmbuf->tm_isdst = 0; diff --git a/util/folder/dirut.cpp b/util/folder/dirut.cpp index ffc9b09f967..e9392170370 100644 --- a/util/folder/dirut.cpp +++ b/util/folder/dirut.cpp @@ -87,29 +87,29 @@ bool resolvepath(TString& folder, const TString& home) {                  break;              } else {                  memmove(pp + j, pp + j + 1, (i - j - 1) * sizeof(p)); -                --i; +                --i;               }          } else if (strcmp(p, "..") == 0) {              if (j == i - 1) {                  if (j == 1) {                      p = "";                  } else { -                    --i; +                    --i;                       pp[j - 1] = "";                  }                  break;              } else {                  if (j == 1) {                      memmove(pp + j, pp + j + 1, (i - j - 1) * sizeof(p)); -                    --i; +                    --i;                   } else {                      memmove(pp + j - 1, pp + j + 1, (i - j - 1) * sizeof(p));                      i -= 2; -                    --j; +                    --j;                   }              }          } else -            ++j; +            ++j;       }      char* s = newpath; @@ -144,10 +144,10 @@ static int next_dir(T*& ptr) {          int c = (unsigned char)*ptr++;          switch (c) {              case ' ': -                ++has_blank; +                ++has_blank;                   break;              case '.': -                ++has_dot; +                ++has_dot;                   break;              case '/':              case ':': @@ -157,17 +157,17 @@ static int next_dir(T*& ptr) {              case '<':              case '>':              case '|': -                ++has_ctrl; +                ++has_ctrl;                   break;              default:                  if (c == 127 || c < ' ') -                    ++has_ctrl; +                    ++has_ctrl;                   else -                    ++has_letter; +                    ++has_letter;           }      }      if (*ptr) -        ++ptr; +        ++ptr;       if (has_ctrl)          return dt_error;      if (has_letter) @@ -208,7 +208,7 @@ static int skip_disk(T*& ptr) {              ptr += 2;          }          if (*ptr == '\\' || *ptr == '/') { -            ++ptr; +            ++ptr;               result |= dk_fromroot;          }      } @@ -228,14 +228,14 @@ int correctpath(char* cpath, const char* path) {          if (c == '/')              c = '\\';          if (c == '\\') -            ++counter; +            ++counter;           else              counter = 0;          if (counter <= 1) {              *cptr = c; -            ++cptr; +            ++cptr;           } -        ++ptr; +        ++ptr;       }      *cptr = 0;      // replace '/' by '\' @@ -249,21 +249,21 @@ int correctpath(char* cpath, const char* path) {      while (*ptr) {          switch (next_dir(ptr)) {              case dt_dir: -                ++level; +                ++level;                   break;              case dt_empty:                  memmove(ptr1, ptr, strlen(ptr) + 1);                  ptr = ptr1;                  break;              case dt_up: -                --level; +                --level;                   if (level >= 0) {                      *--ptr1 = 0;                      ptr1 = strrchr(cpath, '\\');                      if (!ptr1)                          ptr1 = cpath;                      else -                        ++ptr1; +                        ++ptr1;                       memmove(ptr1, ptr, strlen(ptr) + 1);                      ptr = ptr1;                      break; diff --git a/util/folder/filelist.cpp b/util/folder/filelist.cpp index b21fcdbf208..5872a9c9c0f 100644 --- a/util/folder/filelist.cpp +++ b/util/folder/filelist.cpp @@ -16,7 +16,7 @@ void TFileEntitiesList::Fill(const TString& dirname, TStringBuf prefix, TStringB      size_t dirNameLength = dirname.length();      while (dirNameLength && (dirname[dirNameLength - 1] == '\\' || dirname[dirNameLength - 1] == '/')) { -        --dirNameLength; +        --dirNameLength;       }      for (auto file = dir.begin(); file != dir.end(); ++file) { diff --git a/util/folder/fts.cpp b/util/folder/fts.cpp index 0e6a6f86eb9..326c37ef13f 100644 --- a/util/folder/fts.cpp +++ b/util/folder/fts.cpp @@ -902,7 +902,7 @@ fts_build(FTS* sp, int type)          /* GCC, you're too verbose. */          cp = nullptr;      } -    ++len; +    ++len;       maxlen = sp->fts_pathlen - len;      level = cur->fts_level + 1; diff --git a/util/folder/path.cpp b/util/folder/path.cpp index bfe0c67d687..1f1f27aedc5 100644 --- a/util/folder/path.cpp +++ b/util/folder/path.cpp @@ -17,7 +17,7 @@ struct TFsPath::TSplit: public TAtomicRefCount<TSplit>, public TPathSplit {  void TFsPath::CheckDefined() const {      if (!IsDefined()) { -        ythrow TIoException() << TStringBuf("must be defined"); +        ythrow TIoException() << TStringBuf("must be defined");       }  } @@ -83,7 +83,7 @@ TFsPath TFsPath::RelativePath(const TFsPath& root) const {      size_t cnt = 0;      while (split.size() > cnt && rsplit.size() > cnt && split[cnt] == rsplit[cnt]) { -        ++cnt; +        ++cnt;       }      bool absboth = split.IsAbsolute && rsplit.IsAbsolute;      if (cnt == 0 && !absboth) { diff --git a/util/folder/pathsplit.cpp b/util/folder/pathsplit.cpp index 81d439a727b..cb2340bbc60 100644 --- a/util/folder/pathsplit.cpp +++ b/util/folder/pathsplit.cpp @@ -17,8 +17,8 @@ static inline size_t ToReserve(const T& t) {  }  void TPathSplitTraitsUnix::DoParseFirstPart(const TStringBuf part) { -    if (part == TStringBuf(".")) { -        push_back(TStringBuf(".")); +    if (part == TStringBuf(".")) {  +        push_back(TStringBuf("."));           return;      } @@ -46,8 +46,8 @@ void TPathSplitTraitsUnix::DoParsePart(const TStringBuf part0) {  void TPathSplitTraitsWindows::DoParseFirstPart(const TStringBuf part0) {      TStringBuf part(part0); -    if (part == TStringBuf(".")) { -        push_back(TStringBuf(".")); +    if (part == TStringBuf(".")) {  +        push_back(TStringBuf("."));           return;      } @@ -107,9 +107,9 @@ TString TPathSplitStore::DoReconstruct(const TStringBuf slash) const {  }  void TPathSplitStore::AppendComponent(const TStringBuf comp) { -    if (!comp || comp == TStringBuf(".")) { +    if (!comp || comp == TStringBuf(".")) {           ; // ignore -    } else if (comp == TStringBuf("..") && !empty() && back() != TStringBuf("..")) { +    } else if (comp == TStringBuf("..") && !empty() && back() != TStringBuf("..")) {           pop_back();      } else {          // push back first .. also diff --git a/util/folder/pathsplit.h b/util/folder/pathsplit.h index d134338e35d..8d893f6eacc 100644 --- a/util/folder/pathsplit.h +++ b/util/folder/pathsplit.h @@ -25,7 +25,7 @@ struct TPathSplitTraitsUnix: public TPathSplitStore {      static constexpr char MainPathSep = '/';      inline TString Reconstruct() const { -        return DoReconstruct(TStringBuf("/")); +        return DoReconstruct(TStringBuf("/"));       }      static constexpr bool IsPathSep(const char c) noexcept { @@ -44,7 +44,7 @@ struct TPathSplitTraitsWindows: public TPathSplitStore {      static constexpr char MainPathSep = '\\';      inline TString Reconstruct() const { -        return DoReconstruct(TStringBuf("\\")); +        return DoReconstruct(TStringBuf("\\"));       }      static constexpr bool IsPathSep(char c) noexcept { diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp index 8d732fcc0cf..c44e3c2224c 100644 --- a/util/generic/algorithm_ut.cpp +++ b/util/generic/algorithm_ut.cpp @@ -8,10 +8,10 @@ static auto isOne = [](char c) { return c == '1'; };  Y_UNIT_TEST_SUITE(TAlgorithm) {      Y_UNIT_TEST(AnyTest) { -        UNIT_ASSERT(0 == AnyOf(TStringBuf("00"), isOne)); -        UNIT_ASSERT(1 == AnyOf(TStringBuf("01"), isOne)); -        UNIT_ASSERT(1 == AnyOf(TStringBuf("10"), isOne)); -        UNIT_ASSERT(1 == AnyOf(TStringBuf("11"), isOne)); +        UNIT_ASSERT(0 == AnyOf(TStringBuf("00"), isOne));  +        UNIT_ASSERT(1 == AnyOf(TStringBuf("01"), isOne));  +        UNIT_ASSERT(1 == AnyOf(TStringBuf("10"), isOne));  +        UNIT_ASSERT(1 == AnyOf(TStringBuf("11"), isOne));           UNIT_ASSERT(0 == AnyOf(TStringBuf(), isOne));          const char array00[]{'0', '0'}; @@ -21,10 +21,10 @@ Y_UNIT_TEST_SUITE(TAlgorithm) {      }      Y_UNIT_TEST(AllOfTest) { -        UNIT_ASSERT(0 == AllOf(TStringBuf("00"), isOne)); -        UNIT_ASSERT(0 == AllOf(TStringBuf("01"), isOne)); -        UNIT_ASSERT(0 == AllOf(TStringBuf("10"), isOne)); -        UNIT_ASSERT(1 == AllOf(TStringBuf("11"), isOne)); +        UNIT_ASSERT(0 == AllOf(TStringBuf("00"), isOne));  +        UNIT_ASSERT(0 == AllOf(TStringBuf("01"), isOne));  +        UNIT_ASSERT(0 == AllOf(TStringBuf("10"), isOne));  +        UNIT_ASSERT(1 == AllOf(TStringBuf("11"), isOne));           UNIT_ASSERT(1 == AllOf(TStringBuf(), isOne));          const char array01[]{'0', '1'}; @@ -34,11 +34,11 @@ Y_UNIT_TEST_SUITE(TAlgorithm) {      }      Y_UNIT_TEST(CountIfTest) { -        UNIT_ASSERT(3 == CountIf(TStringBuf("____1________1____1_______"), isOne)); -        UNIT_ASSERT(5 == CountIf(TStringBuf("1____1________1____1_______1"), isOne)); -        UNIT_ASSERT(0 == CountIf(TStringBuf("___________"), isOne)); +        UNIT_ASSERT(3 == CountIf(TStringBuf("____1________1____1_______"), isOne));  +        UNIT_ASSERT(5 == CountIf(TStringBuf("1____1________1____1_______1"), isOne));  +        UNIT_ASSERT(0 == CountIf(TStringBuf("___________"), isOne));           UNIT_ASSERT(0 == CountIf(TStringBuf(), isOne)); -        UNIT_ASSERT(1 == CountIf(TStringBuf("1"), isOne)); +        UNIT_ASSERT(1 == CountIf(TStringBuf("1"), isOne));           const char array[] = "____1________1____1_______";          UNIT_ASSERT(3 == CountIf(array, isOne)); @@ -46,11 +46,11 @@ Y_UNIT_TEST_SUITE(TAlgorithm) {      Y_UNIT_TEST(CountTest) {          UNIT_ASSERT(3 == Count("____1________1____1_______", '1')); -        UNIT_ASSERT(3 == Count(TStringBuf("____1________1____1_______"), '1')); -        UNIT_ASSERT(5 == Count(TStringBuf("1____1________1____1_______1"), '1')); -        UNIT_ASSERT(0 == Count(TStringBuf("___________"), '1')); +        UNIT_ASSERT(3 == Count(TStringBuf("____1________1____1_______"), '1'));  +        UNIT_ASSERT(5 == Count(TStringBuf("1____1________1____1_______1"), '1'));  +        UNIT_ASSERT(0 == Count(TStringBuf("___________"), '1'));           UNIT_ASSERT(0 == Count(TStringBuf(), '1')); -        UNIT_ASSERT(1 == Count(TStringBuf("1"), '1')); +        UNIT_ASSERT(1 == Count(TStringBuf("1"), '1'));           const char array[] = "____1________1____1_______";          UNIT_ASSERT(3 == Count(array, '1')); @@ -85,18 +85,18 @@ Y_UNIT_TEST_SUITE(TAlgorithm) {          UNIT_ASSERT_VALUES_EQUAL(CountOf(TString("xyz"), "123", "poi", "xyz"), 1);          // TString and TStringBuf -        UNIT_ASSERT_VALUES_EQUAL(CountOf(TString("xyz"), TStringBuf("123"), TStringBuf("poi")), 0); -        UNIT_ASSERT_VALUES_EQUAL(CountOf(TString("xyz"), TStringBuf("123"), TStringBuf("poi"), -                                         TStringBuf("xyz")), +        UNIT_ASSERT_VALUES_EQUAL(CountOf(TString("xyz"), TStringBuf("123"), TStringBuf("poi")), 0);  +        UNIT_ASSERT_VALUES_EQUAL(CountOf(TString("xyz"), TStringBuf("123"), TStringBuf("poi"),  +                                         TStringBuf("xyz")),                                    1);          // TStringBuf and const char * -        UNIT_ASSERT_VALUES_EQUAL(CountOf(TStringBuf("xyz"), "123", "poi"), 0); -        UNIT_ASSERT_VALUES_EQUAL(CountOf(TStringBuf("xyz"), "123", "poi", "xyz"), 1); +        UNIT_ASSERT_VALUES_EQUAL(CountOf(TStringBuf("xyz"), "123", "poi"), 0);  +        UNIT_ASSERT_VALUES_EQUAL(CountOf(TStringBuf("xyz"), "123", "poi", "xyz"), 1);           // TStringBuf and TString -        UNIT_ASSERT_VALUES_EQUAL(CountOf(TStringBuf("xyz"), TString("123"), TString("poi")), 0); -        UNIT_ASSERT_VALUES_EQUAL(CountOf(TStringBuf("xyz"), TString("123"), TString("poi"), +        UNIT_ASSERT_VALUES_EQUAL(CountOf(TStringBuf("xyz"), TString("123"), TString("poi")), 0);  +        UNIT_ASSERT_VALUES_EQUAL(CountOf(TStringBuf("xyz"), TString("123"), TString("poi"),                                            TString("xyz")),                                   1);      } @@ -151,7 +151,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) {      struct TVectorNoCopy: std::vector<int> {      public: -        TVectorNoCopy() = default; +        TVectorNoCopy() = default;       private:          TVectorNoCopy(const TVectorNoCopy&); diff --git a/util/generic/bitops.h b/util/generic/bitops.h index 2db15fc59b6..28983463a64 100644 --- a/util/generic/bitops.h +++ b/util/generic/bitops.h @@ -81,7 +81,7 @@ namespace NBitOps {              value >>= 1;              while (value) {                  value >>= 1; -                ++result; +                ++result;               }              return result; @@ -282,7 +282,7 @@ Y_FORCE_INLINE ui64 MostSignificantBit(ui64 v) {      ui64 res = 0;      if (v)          while (v >>= 1) -            ++res; +            ++res;   #endif      return res;  } @@ -301,7 +301,7 @@ Y_FORCE_INLINE ui64 LeastSignificantBit(ui64 v) {      ui64 res = 0;      if (v) {          while (!(v & 1)) { -            ++res; +            ++res;               v >>= 1;          }      } diff --git a/util/generic/bitops_ut.cpp b/util/generic/bitops_ut.cpp index d23c2b5c27e..018c9bae6eb 100644 --- a/util/generic/bitops_ut.cpp +++ b/util/generic/bitops_ut.cpp @@ -36,7 +36,7 @@ static T ReverseBitsSlow(T v) {      for (v >>= 1; v; v >>= 1) {          r <<= 1;          r |= v & 1; -        --s; +        --s;       }      r <<= s; // shift when v's highest bits are zero diff --git a/util/generic/hash.h b/util/generic/hash.h index e46db21fa97..1ec3d356775 100644 --- a/util/generic/hash.h +++ b/util/generic/hash.h @@ -77,8 +77,8 @@ struct __yhashtable_iterator {          : cur(n)      {      } /*y*/ -    __yhashtable_iterator() = default; - +    __yhashtable_iterator() = default;  +       reference operator*() const {          return cur->val;      } @@ -961,7 +961,7 @@ __yhashtable_iterator<V>& __yhashtable_iterator<V>::operator++() {      if ((uintptr_t)cur & 1) {          node** bucket = (node**)((uintptr_t)cur & ~1);          while (*bucket == nullptr) -            ++bucket; +            ++bucket;           Y_ASSERT(*bucket != nullptr);          cur = (node*)((uintptr_t)*bucket & ~1);      } @@ -982,7 +982,7 @@ __yhashtable_const_iterator<V>& __yhashtable_const_iterator<V>::operator++() {      if ((uintptr_t)cur & 1) {          node** bucket = (node**)((uintptr_t)cur & ~1);          while (*bucket == nullptr) -            ++bucket; +            ++bucket;           Y_ASSERT(*bucket != nullptr);          cur = (node*)((uintptr_t)*bucket & ~1);      } diff --git a/util/generic/hash_ut.cpp b/util/generic/hash_ut.cpp index 0551d587708..0d986dc19b8 100644 --- a/util/generic/hash_ut.cpp +++ b/util/generic/hash_ut.cpp @@ -306,7 +306,7 @@ void THashTest::TestHMMap1() {      UNIT_ASSERT((*i).first == 'X');      UNIT_ASSERT((*i).second == 10); -    ++i; +    ++i;       UNIT_ASSERT((*i).first == 'X');      UNIT_ASSERT((*i).second == 20); @@ -746,7 +746,7 @@ void THashTest::TestInvariants() {      int count1 = 0;      for (auto pos = set.begin(); pos != set.end(); pos++) { -        ++count1; +        ++count1;       }      UNIT_ASSERT_VALUES_EQUAL(count1, 1000); @@ -1143,7 +1143,7 @@ void THashTest::TestAt() {      char key[] = {11, 12, 0, 1, 2, 11, 0};      TEST_AT_THROWN_EXCEPTION(TString, TString, char*, key, "\\x0B\\x0C"); -    TEST_AT_THROWN_EXCEPTION(TString, TString, TStringBuf, TStringBuf(key, sizeof(key) - 1), "\\x0B\\x0C\\0\\1\\2\\x0B"); +    TEST_AT_THROWN_EXCEPTION(TString, TString, TStringBuf, TStringBuf(key, sizeof(key) - 1), "\\x0B\\x0C\\0\\1\\2\\x0B");   #undef TEST_AT_THROWN_EXCEPTION  } diff --git a/util/generic/is_in_ut.cpp b/util/generic/is_in_ut.cpp index c668bce8078..ca183a9d5d4 100644 --- a/util/generic/is_in_ut.cpp +++ b/util/generic/is_in_ut.cpp @@ -81,12 +81,12 @@ Y_UNIT_TEST_SUITE(TIsIn) {          UNIT_ASSERT(IsIn({6}, 6));          UNIT_ASSERT(!IsIn({6}, 7));          UNIT_ASSERT(!IsIn(std::initializer_list<int>(), 6)); -        UNIT_ASSERT(IsIn({TStringBuf("abc"), TStringBuf("def")}, TStringBuf("abc"))); -        UNIT_ASSERT(IsIn({TStringBuf("abc"), TStringBuf("def")}, TStringBuf("def"))); -        UNIT_ASSERT(IsIn({"abc", "def"}, TStringBuf("def"))); +        UNIT_ASSERT(IsIn({TStringBuf("abc"), TStringBuf("def")}, TStringBuf("abc")));  +        UNIT_ASSERT(IsIn({TStringBuf("abc"), TStringBuf("def")}, TStringBuf("def")));  +        UNIT_ASSERT(IsIn({"abc", "def"}, TStringBuf("def")));           UNIT_ASSERT(IsIn({abc, def}, def)); // direct pointer comparison -        UNIT_ASSERT(!IsIn({TStringBuf("abc"), TStringBuf("def")}, TStringBuf("ghi"))); -        UNIT_ASSERT(!IsIn({"abc", "def"}, TStringBuf("ghi"))); +        UNIT_ASSERT(!IsIn({TStringBuf("abc"), TStringBuf("def")}, TStringBuf("ghi")));  +        UNIT_ASSERT(!IsIn({"abc", "def"}, TStringBuf("ghi")));           UNIT_ASSERT(!IsIn({"abc", "def"}, TString("ghi")));          const TStringBuf str = "abc////"; @@ -111,6 +111,6 @@ Y_UNIT_TEST_SUITE(TIsIn) {          UNIT_ASSERT(IsIn(array, "a"));          UNIT_ASSERT(IsIn(array, TString("b")));          UNIT_ASSERT(!IsIn(array, "c")); -        UNIT_ASSERT(IsIn(array, TStringBuf("d"))); +        UNIT_ASSERT(IsIn(array, TStringBuf("d")));       }  } diff --git a/util/generic/iterator_ut.cpp b/util/generic/iterator_ut.cpp index 00be19e10ec..6e7494b28c8 100644 --- a/util/generic/iterator_ut.cpp +++ b/util/generic/iterator_ut.cpp @@ -52,9 +52,9 @@ Y_UNIT_TEST_SUITE(TInputRangeAdaptor) {      };      Y_UNIT_TEST(TUrlPart) { -        const TVector<TStringBuf> expected = {TStringBuf("yandex.ru"), TStringBuf("search?")}; +        const TVector<TStringBuf> expected = {TStringBuf("yandex.ru"), TStringBuf("search?")};           auto expected_part = expected.begin(); -        for (const TStringBuf& part : TUrlPart(TStringBuf("yandex.ru/search?"))) { +        for (const TStringBuf& part : TUrlPart(TStringBuf("yandex.ru/search?"))) {               UNIT_ASSERT_VALUES_EQUAL(part, *expected_part);              ++expected_part;          } diff --git a/util/generic/map_ut.cpp b/util/generic/map_ut.cpp index 79e832b024f..63f6ae574a0 100644 --- a/util/generic/map_ut.cpp +++ b/util/generic/map_ut.cpp @@ -80,13 +80,13 @@ Y_UNIT_TEST_SUITE(TYMapTest) {          m.insert(std::pair<const char, int>('Y', 32)); // jbuck: standard way          typename mmap::iterator i = m.find('X');       // Find first match. -        ++i; +        ++i;           UNIT_ASSERT((*i).first == 'X');          UNIT_ASSERT((*i).second == 20); -        ++i; +        ++i;           UNIT_ASSERT((*i).first == 'Y');          UNIT_ASSERT((*i).second == 32); -        ++i; +        ++i;           UNIT_ASSERT(i == m.end());          size_t count = m.erase('X'); diff --git a/util/generic/maybe.cpp b/util/generic/maybe.cpp index 43262934f87..6ce4627190d 100644 --- a/util/generic/maybe.cpp +++ b/util/generic/maybe.cpp @@ -1,13 +1,13 @@  #include "maybe.h" -#include <util/system/type_name.h> +#include <util/system/type_name.h>  -[[noreturn]] void NMaybe::TPolicyUndefinedExcept::OnEmpty(const std::type_info& valueTypeInfo) { -    ythrow yexception() << "TMaybe is empty, value type: "sv << TypeName(valueTypeInfo); +[[noreturn]] void NMaybe::TPolicyUndefinedExcept::OnEmpty(const std::type_info& valueTypeInfo) {  +    ythrow yexception() << "TMaybe is empty, value type: "sv << TypeName(valueTypeInfo);   } -[[noreturn]] void NMaybe::TPolicyUndefinedFail::OnEmpty(const std::type_info& valueTypeInfo) { -    const TString typeName = TypeName(valueTypeInfo); -    Y_FAIL("TMaybe is empty, value type: %s", typeName.c_str()); +[[noreturn]] void NMaybe::TPolicyUndefinedFail::OnEmpty(const std::type_info& valueTypeInfo) {  +    const TString typeName = TypeName(valueTypeInfo);  +    Y_FAIL("TMaybe is empty, value type: %s", typeName.c_str());   }  template <> diff --git a/util/generic/maybe.h b/util/generic/maybe.h index 34d21aebcdc..b1b1a681e5c 100644 --- a/util/generic/maybe.h +++ b/util/generic/maybe.h @@ -11,11 +11,11 @@  namespace NMaybe {      struct TPolicyUndefinedExcept { -        [[noreturn]] static void OnEmpty(const std::type_info& valueTypeInfo); +        [[noreturn]] static void OnEmpty(const std::type_info& valueTypeInfo);       };      struct TPolicyUndefinedFail { -        [[noreturn]] static void OnEmpty(const std::type_info& valueTypeInfo); +        [[noreturn]] static void OnEmpty(const std::type_info& valueTypeInfo);       };  } @@ -301,7 +301,7 @@ public:      void CheckDefined() const {          if (Y_UNLIKELY(!Defined())) { -            Policy::OnEmpty(typeid(TValueType)); +            Policy::OnEmpty(typeid(TValueType));           }      } @@ -716,7 +716,7 @@ inline IOutputStream& operator<<(IOutputStream& out, const TMaybe<T, TPolicy>& m      if (maybe.Defined()) {          out << *maybe;      } else { -        out << TStringBuf("(empty maybe)"); +        out << TStringBuf("(empty maybe)");       }      return out;  } diff --git a/util/generic/maybe_ut.cpp b/util/generic/maybe_ut.cpp index 2c1a425c5ef..1213f7f9f47 100644 --- a/util/generic/maybe_ut.cpp +++ b/util/generic/maybe_ut.cpp @@ -998,9 +998,9 @@ Y_UNIT_TEST_SUITE(TMaybeTest) {          UNIT_ASSERT(m.Defined());          UNIT_ASSERT(m->FromMaybeConstructorApplied);      } - -    Y_UNIT_TEST(TestOnEmptyException) { -        TMaybe<TStringBuf> v; -        UNIT_ASSERT_EXCEPTION_CONTAINS(v.GetRef(), yexception, "StringBuf"); -    } +  +    Y_UNIT_TEST(TestOnEmptyException) {  +        TMaybe<TStringBuf> v;  +        UNIT_ASSERT_EXCEPTION_CONTAINS(v.GetRef(), yexception, "StringBuf");  +    }   } diff --git a/util/generic/reserve.h b/util/generic/reserve.h index 81ceed19dc4..a4610208a4a 100644 --- a/util/generic/reserve.h +++ b/util/generic/reserve.h @@ -6,6 +6,6 @@ namespace NDetail {      };  } -constexpr ::NDetail::TReserveTag Reserve(size_t capacity) { +constexpr ::NDetail::TReserveTag Reserve(size_t capacity) {       return ::NDetail::TReserveTag{capacity};  } diff --git a/util/generic/strbase.h b/util/generic/strbase.h index ab39fc7537f..66361b9b272 100644 --- a/util/generic/strbase.h +++ b/util/generic/strbase.h @@ -107,10 +107,10 @@ public:      using const_reverse_iterator = TReverseIteratorBase<const_iterator>;      static constexpr size_t StrLen(const TCharType* s) noexcept { -        if (Y_LIKELY(s)) { +        if (Y_LIKELY(s)) {               return TTraits::length(s); -        } -        return 0; +        }  +        return 0;       }      template <class TCharTraits> @@ -172,7 +172,7 @@ public:          return Ptr()[Len() - 1];      } -    inline TCharType front() const noexcept { +    inline TCharType front() const noexcept {           Y_ASSERT(!empty());          return Ptr()[0];      } @@ -261,16 +261,16 @@ public:          return s1.AsStringView() == s2.AsStringView();      } -    static bool equal(const TSelf& s1, const TCharType* p) noexcept { -        if (p == nullptr) { -            return s1.Len() == 0; -        } - +    static bool equal(const TSelf& s1, const TCharType* p) noexcept {  +        if (p == nullptr) {  +            return s1.Len() == 0;  +        }  +           return s1.AsStringView() == p;      } -    static bool equal(const TCharType* p, const TSelf& s2) noexcept { -        return equal(s2, p); +    static bool equal(const TCharType* p, const TSelf& s2) noexcept {  +        return equal(s2, p);       }      static bool equal(const TStringView s1, const TStringView s2) noexcept { diff --git a/util/generic/strbuf_ut.cpp b/util/generic/strbuf_ut.cpp index 69cde785af0..6daf61a7cf0 100644 --- a/util/generic/strbuf_ut.cpp +++ b/util/generic/strbuf_ut.cpp @@ -11,7 +11,7 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {          UNIT_ASSERT_EQUAL(*str.data(), 'q');          UNIT_ASSERT_EQUAL(str.size(), 6); -        TStringBuf str1("qwe\0rty"sv); +        TStringBuf str1("qwe\0rty"sv);           TStringBuf str2(str1.data());          UNIT_ASSERT_VALUES_UNEQUAL(str1, str2);          UNIT_ASSERT_VALUES_EQUAL(str1.size(), 7); @@ -30,7 +30,7 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {      Y_UNIT_TEST(TestConstExpr) {          static constexpr TStringBuf str1("qwe\0rty", 7);          static constexpr TStringBuf str2(str1.data(), str1.size()); -        static constexpr TStringBuf str3 = "qwe\0rty"sv; +        static constexpr TStringBuf str3 = "qwe\0rty"sv;           UNIT_ASSERT_VALUES_EQUAL(str1.size(), 7); @@ -52,8 +52,8 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {      Y_UNIT_TEST(TestAfter) {          TStringBuf str("qwerty"); -        UNIT_ASSERT_VALUES_EQUAL(str.After('w'), TStringBuf("erty")); -        UNIT_ASSERT_VALUES_EQUAL(str.After('x'), TStringBuf("qwerty")); +        UNIT_ASSERT_VALUES_EQUAL(str.After('w'), TStringBuf("erty"));  +        UNIT_ASSERT_VALUES_EQUAL(str.After('x'), TStringBuf("qwerty"));           UNIT_ASSERT_VALUES_EQUAL(str.After('y'), TStringBuf());          UNIT_ASSERT_STRINGS_EQUAL(str.After('='), str); @@ -65,9 +65,9 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {      Y_UNIT_TEST(TestBefore) {          TStringBuf str("qwerty"); -        UNIT_ASSERT_VALUES_EQUAL(str.Before('w'), TStringBuf("q")); -        UNIT_ASSERT_VALUES_EQUAL(str.Before('x'), TStringBuf("qwerty")); -        UNIT_ASSERT_VALUES_EQUAL(str.Before('y'), TStringBuf("qwert")); +        UNIT_ASSERT_VALUES_EQUAL(str.Before('w'), TStringBuf("q"));  +        UNIT_ASSERT_VALUES_EQUAL(str.Before('x'), TStringBuf("qwerty"));  +        UNIT_ASSERT_VALUES_EQUAL(str.Before('y'), TStringBuf("qwert"));           UNIT_ASSERT_VALUES_EQUAL(str.Before('q'), TStringBuf());      } @@ -137,7 +137,7 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {      Y_UNIT_TEST(TestEmpty) {          UNIT_ASSERT(TStringBuf().empty()); -        UNIT_ASSERT(!TStringBuf("q").empty()); +        UNIT_ASSERT(!TStringBuf("q").empty());       }      Y_UNIT_TEST(TestShift) { @@ -149,10 +149,10 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {          UNIT_ASSERT(str.empty());          str = qw; -        UNIT_ASSERT_EQUAL(str.SubStr(2), TStringBuf("erty")); +        UNIT_ASSERT_EQUAL(str.SubStr(2), TStringBuf("erty"));           UNIT_ASSERT_EQUAL(str.Skip(3), qw.SubStr(3));          str.Chop(1); -        UNIT_ASSERT_EQUAL(str, TStringBuf("rt")); +        UNIT_ASSERT_EQUAL(str, TStringBuf("rt"));       }      Y_UNIT_TEST(TestSplit) { @@ -161,19 +161,19 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {          rt = qw;          lt = rt.NextTok('r'); -        UNIT_ASSERT_EQUAL(lt, TStringBuf("qwe")); -        UNIT_ASSERT_EQUAL(rt, TStringBuf("ty")); +        UNIT_ASSERT_EQUAL(lt, TStringBuf("qwe"));  +        UNIT_ASSERT_EQUAL(rt, TStringBuf("ty"));           lt = qw;          rt = lt.SplitOff('r'); -        UNIT_ASSERT_EQUAL(lt, TStringBuf("qwe")); -        UNIT_ASSERT_EQUAL(rt, TStringBuf("ty")); +        UNIT_ASSERT_EQUAL(lt, TStringBuf("qwe"));  +        UNIT_ASSERT_EQUAL(rt, TStringBuf("ty"));           rt = qw;          lt = rt.NextTok('r');          TStringBuf ty = rt.NextTok('r'); // no 'r' in "ty"          UNIT_ASSERT_EQUAL(rt.size(), 0); -        UNIT_ASSERT_EQUAL(ty, TStringBuf("ty")); +        UNIT_ASSERT_EQUAL(ty, TStringBuf("ty"));       }      Y_UNIT_TEST(TestNextTok) { @@ -187,19 +187,19 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {      Y_UNIT_TEST(TestNextStringTok) {          TStringBuf buf1("a@@b@@c"); -        UNIT_ASSERT_EQUAL(buf1.NextTok("@@"), TStringBuf("a")); -        UNIT_ASSERT_EQUAL(buf1.NextTok("@@"), TStringBuf("b")); -        UNIT_ASSERT_EQUAL(buf1.NextTok("@@"), TStringBuf("c")); +        UNIT_ASSERT_EQUAL(buf1.NextTok("@@"), TStringBuf("a"));  +        UNIT_ASSERT_EQUAL(buf1.NextTok("@@"), TStringBuf("b"));  +        UNIT_ASSERT_EQUAL(buf1.NextTok("@@"), TStringBuf("c"));           UNIT_ASSERT_EQUAL(buf1, TStringBuf());          TStringBuf buf2("a@@b@@c"); -        UNIT_ASSERT_EQUAL(buf2.RNextTok("@@"), TStringBuf("c")); -        UNIT_ASSERT_EQUAL(buf2.RNextTok("@@"), TStringBuf("b")); -        UNIT_ASSERT_EQUAL(buf2.RNextTok("@@"), TStringBuf("a")); +        UNIT_ASSERT_EQUAL(buf2.RNextTok("@@"), TStringBuf("c"));  +        UNIT_ASSERT_EQUAL(buf2.RNextTok("@@"), TStringBuf("b"));  +        UNIT_ASSERT_EQUAL(buf2.RNextTok("@@"), TStringBuf("a"));           UNIT_ASSERT_EQUAL(buf2, TStringBuf());          TStringBuf buf3("a@@b@@c"); -        UNIT_ASSERT_EQUAL(buf3.RNextTok("@@@"), TStringBuf("a@@b@@c")); +        UNIT_ASSERT_EQUAL(buf3.RNextTok("@@@"), TStringBuf("a@@b@@c"));           UNIT_ASSERT_EQUAL(buf3, TStringBuf());      } @@ -223,7 +223,7 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {      }      Y_UNIT_TEST(TestRFind) { -        TStringBuf buf1 = "123123456"; +        TStringBuf buf1 = "123123456";           UNIT_ASSERT_EQUAL(buf1.rfind('3'), 5);          UNIT_ASSERT_EQUAL(buf1.rfind('4'), 6);          UNIT_ASSERT_EQUAL(buf1.rfind('7'), TStringBuf::npos); @@ -242,11 +242,11 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {      Y_UNIT_TEST(TestRNextTok) {          TStringBuf buf1("a.b.c"); -        UNIT_ASSERT_EQUAL(buf1.RNextTok('.'), TStringBuf("c")); -        UNIT_ASSERT_EQUAL(buf1, TStringBuf("a.b")); +        UNIT_ASSERT_EQUAL(buf1.RNextTok('.'), TStringBuf("c"));  +        UNIT_ASSERT_EQUAL(buf1, TStringBuf("a.b"));           TStringBuf buf2("a"); -        UNIT_ASSERT_EQUAL(buf2.RNextTok('.'), TStringBuf("a")); +        UNIT_ASSERT_EQUAL(buf2.RNextTok('.'), TStringBuf("a"));           UNIT_ASSERT_EQUAL(buf2, TStringBuf());          TStringBuf buf3("ab cd ef"), tok; @@ -258,12 +258,12 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {      Y_UNIT_TEST(TestRSplitOff) {          TStringBuf buf1("a.b.c"); -        UNIT_ASSERT_EQUAL(buf1.RSplitOff('.'), TStringBuf("a.b")); -        UNIT_ASSERT_EQUAL(buf1, TStringBuf("c")); +        UNIT_ASSERT_EQUAL(buf1.RSplitOff('.'), TStringBuf("a.b"));  +        UNIT_ASSERT_EQUAL(buf1, TStringBuf("c"));           TStringBuf buf2("a");          UNIT_ASSERT_EQUAL(buf2.RSplitOff('.'), TStringBuf()); -        UNIT_ASSERT_EQUAL(buf2, TStringBuf("a")); +        UNIT_ASSERT_EQUAL(buf2, TStringBuf("a"));       }      Y_UNIT_TEST(TestCBeginCEnd) { @@ -352,7 +352,7 @@ Y_UNIT_TEST_SUITE(TWtrBufTest) {      Y_UNIT_TEST(TestConstExpr) {          static constexpr TWtringBuf str1(u"qwe\0rty", 7);          static constexpr TWtringBuf str2(str1.data(), str1.size()); -        static constexpr TWtringBuf str3 = u"qwe\0rty"sv; +        static constexpr TWtringBuf str3 = u"qwe\0rty"sv;           UNIT_ASSERT_VALUES_EQUAL(str1.size(), 7); diff --git a/util/generic/string.h b/util/generic/string.h index 8cd8aa6917f..b867f9a9d2e 100644 --- a/util/generic/string.h +++ b/util/generic/string.h @@ -205,7 +205,7 @@ protected:          return {new TStdStr(std::forward<A>(a)...), typename TStorage::TNoIncrement()};      } -    static TStorage Construct() noexcept { +    static TStorage Construct() noexcept {           return TStdStr::NullStr();      } @@ -372,7 +372,7 @@ public:      }      // ~~~ Constructor ~~~ : FAMILY0(,TBasicString) -    TBasicString() noexcept +    TBasicString() noexcept   #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 b87fa2843e6..10c782e5747 100644 --- a/util/generic/string_transparent_hash_ut.cpp +++ b/util/generic/string_transparent_hash_ut.cpp @@ -15,5 +15,5 @@ Y_UNIT_TEST_SUITE(StringHashFunctorTests) {          // If either `THash` or `TEqualTo` is not transparent compilation will fail.          UNIT_ASSERT_UNEQUAL(s.find(TStringBuf("foo")), s.end());          UNIT_ASSERT_EQUAL(s.find(TStringBuf("bar")), s.end()); -    } +    }   } diff --git a/util/generic/string_ut.cpp b/util/generic/string_ut.cpp index ac82e9091db..e4fbd69c792 100644 --- a/util/generic/string_ut.cpp +++ b/util/generic/string_ut.cpp @@ -724,7 +724,7 @@ protected:  class TStringTest: public TTestBase, private TStringTestImpl<TString, TTestData<char>> {  public:      UNIT_TEST_SUITE(TStringTest); -    UNIT_TEST(TestMaxSize); +    UNIT_TEST(TestMaxSize);       UNIT_TEST(TestConstructors);      UNIT_TEST(TestReplace);  #ifndef TSTRING_IS_STD_STRING diff --git a/util/generic/string_ut.h b/util/generic/string_ut.h index 44bb10bdebe..4bd0e376c18 100644 --- a/util/generic/string_ut.h +++ b/util/generic/string_ut.h @@ -517,13 +517,13 @@ protected:      TTestData Data;  public: -    void TestMaxSize() { +    void TestMaxSize() {           const size_t badMaxVal = TStringType{}.max_size() + 1; - -        TStringType s; -        UNIT_CHECK_GENERATED_EXCEPTION(s.reserve(badMaxVal), std::length_error); -    } - +  +        TStringType s;  +        UNIT_CHECK_GENERATED_EXCEPTION(s.reserve(badMaxVal), std::length_error);  +    }  +       void TestConstructors() {          TStringType s0(nullptr);          UNIT_ASSERT(s0.size() == 0); diff --git a/util/generic/typelist.h b/util/generic/typelist.h index 5ce26ab97c7..19e90159cd0 100644 --- a/util/generic/typelist.h +++ b/util/generic/typelist.h @@ -78,12 +78,12 @@ namespace NTL {      template <bool isSigned, class T, class TS, class TU>      struct TTypeSelectorBase {          using TSignedInts = typename TConcat<TTypeList<T>, TS>::type; -        using TUnsignedInts = TU; +        using TUnsignedInts = TU;       };      template <class T, class TS, class TU>      struct TTypeSelectorBase<false, T, TS, TU> { -        using TSignedInts = TS; +        using TSignedInts = TS;           using TUnsignedInts = typename TConcat<TTypeList<T>, TU>::type;      }; @@ -91,8 +91,8 @@ namespace NTL {      struct TTypeSelector: public TTypeSelectorBase<((T)(-1) < 0), T, TS, TU> {      }; -    using T1 = TTypeSelector<char, TCommonSignedInts, TCommonUnsignedInts>; -    using T2 = TTypeSelector<wchar_t, T1::TSignedInts, T1::TUnsignedInts>; +    using T1 = TTypeSelector<char, TCommonSignedInts, TCommonUnsignedInts>;  +    using T2 = TTypeSelector<wchar_t, T1::TSignedInts, T1::TUnsignedInts>;   }  using TSignedInts = NTL::T2::TSignedInts; diff --git a/util/generic/vector_ut.cpp b/util/generic/vector_ut.cpp index 0f6b4037a00..ce5e00cd832 100644 --- a/util/generic/vector_ut.cpp +++ b/util/generic/vector_ut.cpp @@ -505,7 +505,7 @@ private:          template <class TOther>          struct rebind { -            using other = TDebugAlloc<TOther>; +            using other = TDebugAlloc<TOther>;           };      }; diff --git a/util/generic/xrange_ut.cpp b/util/generic/xrange_ut.cpp index 8106da03e7f..a0c0da7121e 100644 --- a/util/generic/xrange_ut.cpp +++ b/util/generic/xrange_ut.cpp @@ -15,7 +15,7 @@ Y_UNIT_TEST_SUITE(XRange) {          size_t last = 0;          for (auto i : xrange(begin, end)) { -            ++count; +            ++count;               sum += i;              last = i;              if (!firstInited) { diff --git a/util/generic/yexception.cpp b/util/generic/yexception.cpp index 2ce6c4369da..9744e70e873 100644 --- a/util/generic/yexception.cpp +++ b/util/generic/yexception.cpp @@ -23,7 +23,7 @@ TString CurrentExceptionMessage() {              const TBackTrace* bt = e.BackTrace();              if (bt) { -                return TString::Join(bt->PrintToString(), TStringBuf("\n"), FormatExc(e)); +                return TString::Join(bt->PrintToString(), TStringBuf("\n"), FormatExc(e));               }              return FormatExc(e); @@ -70,9 +70,9 @@ std::string CurrentExceptionTypeName() {  void TSystemError::Init() {      yexception& exc = *this; -    exc << TStringBuf("("); +    exc << TStringBuf("(");       exc << TStringBuf(LastSystemErrorText(Status_)); -    exc << TStringBuf(") "); +    exc << TStringBuf(") ");   }  NPrivateException::yexception::yexception() { diff --git a/util/generic/yexception.h b/util/generic/yexception.h index b0c604e8c45..7662c1b6393 100644 --- a/util/generic/yexception.h +++ b/util/generic/yexception.h @@ -75,7 +75,7 @@ namespace NPrivateException {      template <class T>      static inline T&& operator+(const TSourceLocation& sl, T&& t) { -        return std::forward<T>(t << sl << TStringBuf(": ")); +        return std::forward<T>(t << sl << TStringBuf(": "));       }  } @@ -180,7 +180,7 @@ TString FormatExc(const std::exception& exception);          if (Y_UNLIKELY(!(CONDITION))) {          \              ythrow THROW_EXPRESSION;             \          }                                        \ -    } while (false) +    } while (false)   /// @def Y_ENSURE_SIMPLE  /// This macro works like the Y_ENSURE, but requires the second argument to be a constant string view. @@ -194,10 +194,10 @@ TString FormatExc(const std::exception& exception);          }                                                                                                                   \      } while (false) -#define Y_ENSURE_IMPL_1(CONDITION) Y_ENSURE_SIMPLE(CONDITION, ::TStringBuf("Condition violated: `" Y_STRINGIZE(CONDITION) "'"), ::NPrivate::ThrowYException) +#define Y_ENSURE_IMPL_1(CONDITION) Y_ENSURE_SIMPLE(CONDITION, ::TStringBuf("Condition violated: `" Y_STRINGIZE(CONDITION) "'"), ::NPrivate::ThrowYException)   #define Y_ENSURE_IMPL_2(CONDITION, MESSAGE) Y_ENSURE_EX(CONDITION, yexception() << MESSAGE) -#define Y_ENSURE_BT_IMPL_1(CONDITION) Y_ENSURE_SIMPLE(CONDITION, ::TStringBuf("Condition violated: `" Y_STRINGIZE(CONDITION) "'"), ::NPrivate::ThrowYExceptionWithBacktrace) +#define Y_ENSURE_BT_IMPL_1(CONDITION) Y_ENSURE_SIMPLE(CONDITION, ::TStringBuf("Condition violated: `" Y_STRINGIZE(CONDITION) "'"), ::NPrivate::ThrowYExceptionWithBacktrace)   #define Y_ENSURE_BT_IMPL_2(CONDITION, MESSAGE) Y_ENSURE_EX(CONDITION, TWithBackTrace<yexception>() << MESSAGE)  /** diff --git a/util/generic/yexception_ut.cpp b/util/generic/yexception_ut.cpp index cb3e29fed84..0e113cdd45b 100644 --- a/util/generic/yexception_ut.cpp +++ b/util/generic/yexception_ut.cpp @@ -29,9 +29,9 @@ static void CallbackFun(int i) {  static IOutputStream* OUTS = nullptr; -namespace NOuter::NInner { -    void Compare10And20() { -        Y_ENSURE(10 > 20); +namespace NOuter::NInner {  +    void Compare10And20() {  +        Y_ENSURE(10 > 20);       }  } diff --git a/util/generic/ymath.h b/util/generic/ymath.h index 9ff9ae2abe2..067f091a322 100644 --- a/util/generic/ymath.h +++ b/util/generic/ymath.h @@ -56,14 +56,14 @@ static constexpr T Sqr(const T t) noexcept {      return t * t;  } -inline double Sigmoid(double x) { -    return 1.0 / (1.0 + std::exp(-x)); -} - -inline float Sigmoid(float x) { -    return 1.0f / (1.0f + std::exp(-x)); -} - +inline double Sigmoid(double x) {  +    return 1.0 / (1.0 + std::exp(-x));  +}  +  +inline float Sigmoid(float x) {  +    return 1.0f / (1.0f + std::exp(-x));  +}  +   static inline bool IsFinite(double f) {  #if defined(isfinite)      return isfinite(f); diff --git a/util/generic/ymath_ut.cpp b/util/generic/ymath_ut.cpp index 29190b55eb4..86294e9e1b2 100644 --- a/util/generic/ymath_ut.cpp +++ b/util/generic/ymath_ut.cpp @@ -33,7 +33,7 @@ class TMathTest: public TTestBase {      UNIT_TEST(TestIsValidFloat);      UNIT_TEST(TestAbs);      UNIT_TEST(TestPower); -    UNIT_TEST(TestSigmoid); +    UNIT_TEST(TestSigmoid);       UNIT_TEST(TestCeilDiv);      UNIT_TEST_SUITE_END(); @@ -44,7 +44,7 @@ private:      void TestLogGamma();      void TestAbs();      void TestPower(); -    void TestSigmoid(); +    void TestSigmoid();       void TestCeilDiv();      inline void TestIsValidFloat() { @@ -181,16 +181,16 @@ void TMathTest::TestPower() {      UNIT_ASSERT_DOUBLES_EQUAL(Power(0.0, 0), 1.0, 1e-9);      UNIT_ASSERT_DOUBLES_EQUAL(Power(0.1, 3), 1e-3, 1e-9);  } - -void TMathTest::TestSigmoid() { -    UNIT_ASSERT_EQUAL(Sigmoid(0.f), 0.5f); -    UNIT_ASSERT_EQUAL(Sigmoid(-5000.f), 0.0f); -    UNIT_ASSERT_EQUAL(Sigmoid(5000.f), 1.0f); - -    UNIT_ASSERT_EQUAL(Sigmoid(0.), 0.5); -    UNIT_ASSERT_EQUAL(Sigmoid(-5000.), 0.0); -    UNIT_ASSERT_EQUAL(Sigmoid(5000.), 1.0); -} +  +void TMathTest::TestSigmoid() {  +    UNIT_ASSERT_EQUAL(Sigmoid(0.f), 0.5f);  +    UNIT_ASSERT_EQUAL(Sigmoid(-5000.f), 0.0f);  +    UNIT_ASSERT_EQUAL(Sigmoid(5000.f), 1.0f);  +  +    UNIT_ASSERT_EQUAL(Sigmoid(0.), 0.5);  +    UNIT_ASSERT_EQUAL(Sigmoid(-5000.), 0.0);  +    UNIT_ASSERT_EQUAL(Sigmoid(5000.), 1.0);  +}   void TMathTest::TestCeilDiv() {      UNIT_ASSERT_VALUES_EQUAL(CeilDiv<ui8>(2, 3), 1); diff --git a/util/memory/blob.cpp b/util/memory/blob.cpp index 91da5cadca3..d0e9b6e85c6 100644 --- a/util/memory/blob.cpp +++ b/util/memory/blob.cpp @@ -109,7 +109,7 @@ public:          : Map_(map)          , Mode_(mode)      { -        Y_ENSURE(Map_.IsOpen(), TStringBuf("memory map not open")); +        Y_ENSURE(Map_.IsOpen(), TStringBuf("memory map not open"));           Map_.Map(offset, len); @@ -122,7 +122,7 @@ public:          }      } -    ~TMappedBlobBase() override { +    ~TMappedBlobBase() override {           if (Mode_ == EMappingMode::Locked && Length()) {              UnlockMemory(Data(), Length());          } diff --git a/util/network/endpoint.cpp b/util/network/endpoint.cpp index 9acdd069408..d6b8aa6035c 100644 --- a/util/network/endpoint.cpp +++ b/util/network/endpoint.cpp @@ -7,7 +7,7 @@ TEndpoint::TEndpoint(const TEndpoint::TAddrRef& addr)      const sockaddr* sa = Addr_->Addr();      if (sa->sa_family != AF_INET && sa->sa_family != AF_INET6 && sa->sa_family != AF_UNIX) { -        ythrow yexception() << TStringBuf("endpoint can contain only ipv4, ipv6 or unix address"); +        ythrow yexception() << TStringBuf("endpoint can contain only ipv4, ipv6 or unix address");       }  } diff --git a/util/network/endpoint_ut.cpp b/util/network/endpoint_ut.cpp index d5e40dd6e1c..1adcf951482 100644 --- a/util/network/endpoint_ut.cpp +++ b/util/network/endpoint_ut.cpp @@ -53,8 +53,8 @@ Y_UNIT_TEST_SUITE(TEndpointTest) {          TEndpoint ep3(new NAddr::TAddrInfo(&*na3.Begin()));          UNIT_ASSERT(ep3.IsIpV6()); -        UNIT_ASSERT(ep3.IpToString().StartsWith(TStringBuf("2a02:6b8:0:1410:"))); -        UNIT_ASSERT(ep3.IpToString().EndsWith(TStringBuf(":5f6c:f3c2"))); +        UNIT_ASSERT(ep3.IpToString().StartsWith(TStringBuf("2a02:6b8:0:1410:")));  +        UNIT_ASSERT(ep3.IpToString().EndsWith(TStringBuf(":5f6c:f3c2")));           UNIT_ASSERT_VALUES_EQUAL(54321, ep3.Port());          TNetworkAddress na4("2a02:6b8:0:1410:0::5f6c:f3c2", 1); diff --git a/util/network/init.h b/util/network/init.h index 08a79c0fcaa..ea7e2898d75 100644 --- a/util/network/init.h +++ b/util/network/init.h @@ -18,7 +18,7 @@      #include <netinet/tcp.h>      #include <arpa/inet.h> -using SOCKET = int; +using SOCKET = int;       #define closesocket(s) close(s)      #define SOCKET_ERROR -1 @@ -30,7 +30,7 @@ using SOCKET = int;      #include <winsock2.h>      #include <ws2tcpip.h> -using nfds_t = ULONG; +using nfds_t = ULONG;       #undef Yield diff --git a/util/network/socket.cpp b/util/network/socket.cpp index 4f6e8043462..c392d20dd35 100644 --- a/util/network/socket.cpp +++ b/util/network/socket.cpp @@ -163,7 +163,7 @@ int poll(struct pollfd fds[], nfds_t nfds, int timeout) noexcept {              int error = WSAGetLastError();              if (error == WSAEINVAL || error == WSAENOTSOCK) {                  fd->revents = POLLNVAL; -                ++checked_sockets; +                ++checked_sockets;               } else {                  errno = EIO;                  return -1; @@ -188,7 +188,7 @@ int poll(struct pollfd fds[], nfds_t nfds, int timeout) noexcept {              if (FD_ISSET(fd->fd, &writefds)) {                  fd->revents |= POLLOUT;              } -            ++checked_sockets; +            ++checked_sockets;           }      } diff --git a/util/network/socket_ut.cpp b/util/network/socket_ut.cpp index 6b20e11f70a..78bc5b12e83 100644 --- a/util/network/socket_ut.cpp +++ b/util/network/socket_ut.cpp @@ -46,7 +46,7 @@ void TSockTest::TestSock() {      TSocket s(addr);      TSocketOutput so(s);      TSocketInput si(s); -    const TStringBuf req = "GET / HTTP/1.1\r\nHost: yandex.ru\r\n\r\n"; +    const TStringBuf req = "GET / HTTP/1.1\r\nHost: yandex.ru\r\n\r\n";       so.Write(req.data(), req.size()); diff --git a/util/random/entropy.cpp b/util/random/entropy.cpp index 3617edb83d7..9548784b6a2 100644 --- a/util/random/entropy.cpp +++ b/util/random/entropy.cpp @@ -107,7 +107,7 @@ namespace {          using TRnd = TMersenne<TKey>;      public: -        inline explicit TMersenneInput(const TBuffer& rnd) +        inline explicit TMersenneInput(const TBuffer& rnd)               : Rnd_((const TKey*)rnd.Data(), rnd.Size() / sizeof(TKey))          {          } @@ -136,7 +136,7 @@ namespace {      class TEntropyPoolStream: public IInputStream {      public: -        inline explicit TEntropyPoolStream(const TBuffer& buffer) +        inline explicit TEntropyPoolStream(const TBuffer& buffer)               : Mi_(buffer)              , Bi_(&Mi_, 8192)          { diff --git a/util/stream/aligned_ut.cpp b/util/stream/aligned_ut.cpp index e980d05cf71..890dfa7d8fe 100644 --- a/util/stream/aligned_ut.cpp +++ b/util/stream/aligned_ut.cpp @@ -16,7 +16,7 @@ protected:          }          *static_cast<unsigned char*>(buf) = static_cast<unsigned char>(Pos_); -        ++Pos_; +        ++Pos_;           return 1;      } @@ -25,7 +25,7 @@ protected:              return 0;          } -        ++Pos_; +        ++Pos_;           return 1;      } diff --git a/util/stream/format.h b/util/stream/format.h index b033208a1b0..e3cd64cc57c 100644 --- a/util/stream/format.h +++ b/util/stream/format.h @@ -118,9 +118,9 @@ namespace NFormatPrivate {          if (value.Flags & HF_ADDX) {              if (Base == 16) { -                stream << TStringBuf("0x"); +                stream << TStringBuf("0x");               } else if (Base == 2) { -                stream << TStringBuf("0b"); +                stream << TStringBuf("0b");               }          } @@ -329,7 +329,7 @@ static constexpr ::NFormatPrivate::TBaseNumber<T, 2> SBin(const T& value, const   *   * Example usage:   * @code - * stream << HexText(TStringBuf("abcи"));  // Will output "61 62 63 D0 B8" + * stream << HexText(TStringBuf("abcи"));  // Will output "61 62 63 D0 B8"    * stream << HexText(TWtringBuf(u"abcи")); // Will output "0061 0062 0063 0438"   * @endcode   * @@ -348,7 +348,7 @@ static inline ::NFormatPrivate::TBaseText<TChar, 16> HexText(const TBasicStringB   *   * Example usage:   * @code - * stream << BinText(TStringBuf("aaa"));  // Will output "01100001 01100001 01100001" + * stream << BinText(TStringBuf("aaa"));  // Will output "01100001 01100001 01100001"    * @endcode   *   * @param value                         String to output. diff --git a/util/stream/format_ut.cpp b/util/stream/format_ut.cpp index 43245aeb48e..9c1e7c7f9d5 100644 --- a/util/stream/format_ut.cpp +++ b/util/stream/format_ut.cpp @@ -49,7 +49,7 @@ Y_UNIT_TEST_SUITE(TOutputStreamFormattingTest) {      Y_UNIT_TEST(TestHexText) {          {              TStringStream ss; -            ss << HexText(TStringBuf("abcи")); +            ss << HexText(TStringBuf("abcи"));               UNIT_ASSERT_VALUES_EQUAL("61 62 63 D0 B8", ss.Str());          }          { @@ -76,9 +76,9 @@ Y_UNIT_TEST_SUITE(TOutputStreamFormattingTest) {      }      Y_UNIT_TEST(TestBinText) { -        UNIT_ASSERT_VALUES_EQUAL(ToString(BinText(TStringBuf("\1"))), "00000001"); -        UNIT_ASSERT_VALUES_EQUAL(ToString(BinText(TStringBuf("\1\1"))), "00000001 00000001"); -        UNIT_ASSERT_VALUES_EQUAL(ToString(BinText(TStringBuf("aaa"))), "01100001 01100001 01100001"); +        UNIT_ASSERT_VALUES_EQUAL(ToString(BinText(TStringBuf("\1"))), "00000001");  +        UNIT_ASSERT_VALUES_EQUAL(ToString(BinText(TStringBuf("\1\1"))), "00000001 00000001");  +        UNIT_ASSERT_VALUES_EQUAL(ToString(BinText(TStringBuf("aaa"))), "01100001 01100001 01100001");       }      Y_UNIT_TEST(TestPrec) { diff --git a/util/stream/hex.cpp b/util/stream/hex.cpp index 1c05330504a..dafcefebf7a 100644 --- a/util/stream/hex.cpp +++ b/util/stream/hex.cpp @@ -16,7 +16,7 @@ void HexEncode(const void* in, size_t len, IOutputStream& out) {  }  void HexDecode(const void* in, size_t len, IOutputStream& out) { -    Y_ENSURE(!(len & 1), TStringBuf("Odd buffer length passed to HexDecode")); +    Y_ENSURE(!(len & 1), TStringBuf("Odd buffer length passed to HexDecode"));       static const size_t NUM_OF_BYTES = 32;      char buffer[NUM_OF_BYTES]; diff --git a/util/stream/input.cpp b/util/stream/input.cpp index 6e8170f2f9f..6949bac9bc7 100644 --- a/util/stream/input.cpp +++ b/util/stream/input.cpp @@ -28,7 +28,7 @@ size_t IInputStream::DoReadTo(TString& st, char to) {      size_t result = 0;      do { -        ++result; +        ++result;           if (ch == to) {              break; diff --git a/util/stream/mem.cpp b/util/stream/mem.cpp index 22a3339e274..4f2b73082d2 100644 --- a/util/stream/mem.cpp +++ b/util/stream/mem.cpp @@ -39,7 +39,7 @@ void TMemoryInput::DoUndo(size_t len) {  TMemoryOutput::~TMemoryOutput() = default;  size_t TMemoryOutput::DoNext(void** ptr) { -    Y_ENSURE(Buf_ < End_, TStringBuf("memory output stream exhausted")); +    Y_ENSURE(Buf_ < End_, TStringBuf("memory output stream exhausted"));       *ptr = Buf_;      size_t bufferSize = End_ - Buf_;      Buf_ = End_; @@ -53,13 +53,13 @@ void TMemoryOutput::DoUndo(size_t len) {  void TMemoryOutput::DoWrite(const void* buf, size_t len) {      char* end = Buf_ + len; -    Y_ENSURE(end <= End_, TStringBuf("memory output stream exhausted")); +    Y_ENSURE(end <= End_, TStringBuf("memory output stream exhausted"));       memcpy(Buf_, buf, len);      Buf_ = end;  }  void TMemoryOutput::DoWriteC(char c) { -    Y_ENSURE(Buf_ < End_, TStringBuf("memory output stream exhausted")); +    Y_ENSURE(Buf_ < End_, TStringBuf("memory output stream exhausted"));       *Buf_++ = c;  } diff --git a/util/stream/output.cpp b/util/stream/output.cpp index db81b81b701..a1992f6cf66 100644 --- a/util/stream/output.cpp +++ b/util/stream/output.cpp @@ -240,7 +240,7 @@ using TNullPtr = decltype(nullptr);  template <>  void Out<TNullPtr>(IOutputStream& o, TTypeTraits<TNullPtr>::TFuncParam) { -    o << TStringBuf("nullptr"); +    o << TStringBuf("nullptr");   }  #if defined(_android_) diff --git a/util/stream/tokenizer_ut.cpp b/util/stream/tokenizer_ut.cpp index afc566da86e..37b30d8e5fa 100644 --- a/util/stream/tokenizer_ut.cpp +++ b/util/stream/tokenizer_ut.cpp @@ -40,7 +40,7 @@ Y_UNIT_TEST_SUITE(TStreamTokenizerTests) {      Y_UNIT_TEST(LastTokenendDoesntSatisfyPredicateTest) {          const char data[] = "abc\ndef\nxxxxxx";          const auto dataSize = Y_ARRAY_SIZE(data) - 1; -        const TStringBuf tokens[] = {TStringBuf("abc"), TStringBuf("def"), TStringBuf("xxxxxx")}; +        const TStringBuf tokens[] = {TStringBuf("abc"), TStringBuf("def"), TStringBuf("xxxxxx")};           const auto tokensSize = Y_ARRAY_SIZE(tokens);          auto&& input = TMemoryInput{data, dataSize};          auto&& tokenizer = TStreamTokenizer<TEol>{&input}; @@ -58,7 +58,7 @@ Y_UNIT_TEST_SUITE(TStreamTokenizerTests) {      Y_UNIT_TEST(FirstTokenIsEmptyTest) {          const char data[] = "\ndef\nxxxxxx";          const auto dataSize = Y_ARRAY_SIZE(data) - 1; -        const TStringBuf tokens[] = {TStringBuf(), TStringBuf("def"), TStringBuf("xxxxxx")}; +        const TStringBuf tokens[] = {TStringBuf(), TStringBuf("def"), TStringBuf("xxxxxx")};           const auto tokensSize = Y_ARRAY_SIZE(tokens);          auto&& input = TMemoryInput{data, dataSize};          auto&& tokenizer = TStreamTokenizer<TEol>{&input}; @@ -91,7 +91,7 @@ Y_UNIT_TEST_SUITE(TStreamTokenizerTests) {      Y_UNIT_TEST(SimpleTest) {          const char data[] = "qwerty\n1234567890\n";          const auto dataSize = Y_ARRAY_SIZE(data) - 1; -        const TStringBuf tokens[] = {TStringBuf("qwerty"), TStringBuf("1234567890")}; +        const TStringBuf tokens[] = {TStringBuf("qwerty"), TStringBuf("1234567890")};           const auto tokensSize = Y_ARRAY_SIZE(tokens);          auto&& input = TMemoryInput{data, dataSize};          auto&& tokenizer = TStreamTokenizer<TEol>{&input}; @@ -115,7 +115,7 @@ Y_UNIT_TEST_SUITE(TStreamTokenizerTests) {          const char data[] = "abc|def|xxxxxx";          const auto dataSize = Y_ARRAY_SIZE(data) - 1; -        const TStringBuf tokens[] = {TStringBuf("abc"), TStringBuf("def"), TStringBuf("xxxxxx")}; +        const TStringBuf tokens[] = {TStringBuf("abc"), TStringBuf("def"), TStringBuf("xxxxxx")};           const auto tokensSize = Y_ARRAY_SIZE(tokens);          auto&& input = TMemoryInput{data, dataSize};          auto&& tokenizer = TStreamTokenizer<TIsVerticalBar>{&input}; @@ -139,8 +139,8 @@ Y_UNIT_TEST_SUITE(TStreamTokenizerTests) {          const char data[] = "abc|def|xxxxxx,abc|def|xxxxxx";          const auto dataSize = Y_ARRAY_SIZE(data) - 1; -        const TStringBuf tokens[] = {TStringBuf("abc"), TStringBuf("def"), TStringBuf("xxxxxx"), -                                     TStringBuf("abc"), TStringBuf("def"), TStringBuf("xxxxxx")}; +        const TStringBuf tokens[] = {TStringBuf("abc"), TStringBuf("def"), TStringBuf("xxxxxx"),  +                                     TStringBuf("abc"), TStringBuf("def"), TStringBuf("xxxxxx")};           const auto tokensSize = Y_ARRAY_SIZE(tokens);          auto&& input = TMemoryInput{data, dataSize};          auto&& tokenizer = TStreamTokenizer<TIsVerticalBar>{&input}; @@ -199,7 +199,7 @@ Y_UNIT_TEST_SUITE(TStreamTokenizerTests) {      Y_UNIT_TEST(FirstTokenHasSizeOfTheBufferTest) {          const char data[] = "xxxxx\nxx";          const auto dataSize = Y_ARRAY_SIZE(data) - 1; -        const TStringBuf tokens[] = {TStringBuf("xxxxx"), TStringBuf("xx")}; +        const TStringBuf tokens[] = {TStringBuf("xxxxx"), TStringBuf("xx")};           const auto tokensSize = Y_ARRAY_SIZE(tokens);          auto&& input = TMemoryInput{data, dataSize};          auto&& tokenizer = TStreamTokenizer<TEol>{&input, TEol{}, tokens[0].size()}; @@ -231,7 +231,7 @@ Y_UNIT_TEST_SUITE(TStreamTokenizerTests) {      Y_UNIT_TEST(BufferSizeInitialSizeSmallerThanTokenTest) {          const char data[] = "xxxxx\nxx";          const auto dataSize = Y_ARRAY_SIZE(data) - 1; -        const TStringBuf tokens[] = {TStringBuf("xxxxx"), TStringBuf("xx")}; +        const TStringBuf tokens[] = {TStringBuf("xxxxx"), TStringBuf("xx")};           const auto tokensSize = Y_ARRAY_SIZE(tokens);          auto&& input = TMemoryInput{data, dataSize};          auto&& tokenizer = TStreamTokenizer<TEol>{&input, TEol{}, 1}; @@ -248,7 +248,7 @@ Y_UNIT_TEST_SUITE(TStreamTokenizerTests) {      Y_UNIT_TEST(RangeBasedForTest) {          const char data[] = "abc\ndef\nxxxxxx";          const auto dataSize = Y_ARRAY_SIZE(data) - 1; -        const TStringBuf tokens[] = {TStringBuf("abc"), TStringBuf("def"), TStringBuf("xxxxxx")}; +        const TStringBuf tokens[] = {TStringBuf("abc"), TStringBuf("def"), TStringBuf("xxxxxx")};           const auto tokensSize = Y_ARRAY_SIZE(tokens);          auto&& input = TMemoryInput{data, dataSize};          auto&& tokenizer = TStreamTokenizer<TEol>{&input}; diff --git a/util/stream/zlib_ut.cpp b/util/stream/zlib_ut.cpp index 2290b4a9dee..4ccd2c72caf 100644 --- a/util/stream/zlib_ut.cpp +++ b/util/stream/zlib_ut.cpp @@ -76,8 +76,8 @@ Y_UNIT_TEST_SUITE(TZLibTest) {      }      Y_UNIT_TEST(Dictionary) { -        static constexpr TStringBuf data = "<html><body></body></html>"; -        static constexpr TStringBuf dict = "</<html><body>"; +        static constexpr TStringBuf data = "<html><body></body></html>";  +        static constexpr TStringBuf dict = "</<html><body>";           for (auto type : {ZLib::Raw, ZLib::ZLib}) {              TStringStream compressed;              { diff --git a/util/string/ascii_ut.cpp b/util/string/ascii_ut.cpp index 89069fee50a..d4a31f61b61 100644 --- a/util/string/ascii_ut.cpp +++ b/util/string/ascii_ut.cpp @@ -64,7 +64,7 @@ Y_UNIT_TEST_SUITE(TAsciiTest) {      Y_UNIT_TEST(CompareTest) {          UNIT_ASSERT(AsciiEqualsIgnoreCase("qqq", "qQq")); -        UNIT_ASSERT(AsciiEqualsIgnoreCase("qqq", TStringBuf("qQq"))); +        UNIT_ASSERT(AsciiEqualsIgnoreCase("qqq", TStringBuf("qQq")));           TString qq = "qq";          TString qQ = "qQ";          UNIT_ASSERT(AsciiEqualsIgnoreCase(qq, qQ)); diff --git a/util/string/cast.cpp b/util/string/cast.cpp index aa1e65a8e90..2a4f6970422 100644 --- a/util/string/cast.cpp +++ b/util/string/cast.cpp @@ -6,7 +6,7 @@  #include <cstdio>  #include <string> -#include <cmath> +#include <cmath>   #include <util/string/type.h>  #include <util/string/cast.h> @@ -31,12 +31,12 @@ using double_conversion::StringToDoubleConverter;   */  namespace { -    constexpr char IntToChar[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; +    constexpr char IntToChar[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};       static_assert(Y_ARRAY_SIZE(IntToChar) == 16, "expect Y_ARRAY_SIZE(IntToChar) == 16");      // clang-format off -    constexpr int LetterToIntMap[] = { +    constexpr int LetterToIntMap[] = {           20, 20, 20, 20, 20, 20, 20, 20, 20, 20,          20, 20, 20, 20, 20, 20, 20, 20, 20, 20,          20, 20, 20, 20, 20, 20, 20, 20, 20, 20, @@ -52,17 +52,17 @@ namespace {      // clang-format on      template <class T> -    std::enable_if_t<std::is_signed<T>::value, std::make_unsigned_t<T>> NegateNegativeSigned(T value) noexcept { +    std::enable_if_t<std::is_signed<T>::value, std::make_unsigned_t<T>> NegateNegativeSigned(T value) noexcept {           return std::make_unsigned_t<T>(-(value + 1)) + std::make_unsigned_t<T>(1);      }      template <class T> -    std::enable_if_t<std::is_unsigned<T>::value, std::make_unsigned_t<T>> NegateNegativeSigned(T) noexcept { +    std::enable_if_t<std::is_unsigned<T>::value, std::make_unsigned_t<T>> NegateNegativeSigned(T) noexcept {           Y_UNREACHABLE();      }      template <class T> -    std::make_signed_t<T> NegatePositiveSigned(T value) noexcept { +    std::make_signed_t<T> NegatePositiveSigned(T value) noexcept {           return value > 0 ? (-std::make_signed_t<T>(value - 1) - 1) : 0;      } @@ -72,18 +72,18 @@ namespace {          static_assert(std::is_unsigned<T>::value, "TBasicIntFormatter can only handle unsigned integers.");          static inline size_t Format(T value, TChar* buf, size_t len) { -            Y_ENSURE(len, TStringBuf("zero length")); +            Y_ENSURE(len, TStringBuf("zero length"));               TChar* tmp = buf;              do { -                // divide only once, do not use mod -                const T nextVal = static_cast<T>(value / base); -                *tmp++ = IntToChar[base == 2 || base == 4 || base == 8 || base == 16 ? value & (base - 1) : value - base * nextVal]; -                value = nextVal; +                // divide only once, do not use mod  +                const T nextVal = static_cast<T>(value / base);  +                *tmp++ = IntToChar[base == 2 || base == 4 || base == 8 || base == 16 ? value & (base - 1) : value - base * nextVal];  +                value = nextVal;               } while (value && --len); -            Y_ENSURE(!value, TStringBuf("not enough room in buffer")); +            Y_ENSURE(!value, TStringBuf("not enough room in buffer"));               const size_t result = tmp - buf; @@ -111,7 +111,7 @@ namespace {              using TUFmt = TBasicIntFormatter<std::make_unsigned_t<T>, base, TChar>;              if (std::is_signed<T>::value && value < 0) { -                Y_ENSURE(len >= 2, TStringBuf("not enough room in buffer")); +                Y_ENSURE(len >= 2, TStringBuf("not enough room in buffer"));                   *buf = '-'; @@ -126,15 +126,15 @@ namespace {      struct TFltModifiers;      template <class T, int base, class TChar> -    Y_NO_INLINE size_t FormatInt(T value, TChar* buf, size_t len) { +    Y_NO_INLINE size_t FormatInt(T value, TChar* buf, size_t len) {           return TIntFormatter<T, base, TChar>::Format(value, buf, len);      }      template <class T> -    inline size_t FormatFlt(T t, char* buf, size_t len) { +    inline size_t FormatFlt(T t, char* buf, size_t len) {           const int ret = snprintf(buf, len, TFltModifiers<T>::ModifierWrite, t); -        Y_ENSURE(ret >= 0 && (size_t)ret <= len, TStringBuf("cannot format float")); +        Y_ENSURE(ret >= 0 && (size_t)ret <= len, TStringBuf("cannot format float"));           return (size_t)ret;      } @@ -148,7 +148,7 @@ namespace {          PS_OVERFLOW,      }; -    constexpr ui8 SAFE_LENS[4][17] = { +    constexpr ui8 SAFE_LENS[4][17] = {           {0, 0, 7, 5, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1},          {0, 0, 15, 10, 7, 6, 6, 5, 5, 5, 4, 4, 4, 4, 4, 4, 3},          {0, 0, 31, 20, 15, 13, 12, 11, 10, 10, 9, 9, 8, 8, 8, 8, 7}, @@ -160,7 +160,7 @@ namespace {      }      template <unsigned BASE, class TChar, class T> -    inline std::enable_if_t<(BASE > 10), bool> CharToDigit(TChar c, T* digit) noexcept { +    inline std::enable_if_t<(BASE > 10), bool> CharToDigit(TChar c, T* digit) noexcept {           unsigned uc = c;          if (uc >= Y_ARRAY_SIZE(LetterToIntMap)) { @@ -173,7 +173,7 @@ namespace {      }      template <unsigned BASE, class TChar, class T> -    inline std::enable_if_t<(BASE <= 10), bool> CharToDigit(TChar c, T* digit) noexcept { +    inline std::enable_if_t<(BASE <= 10), bool> CharToDigit(TChar c, T* digit) noexcept {           return (c >= '0') && ((*digit = (c - '0')) < BASE);      } @@ -284,7 +284,7 @@ namespace {                  return PS_EMPTY_STRING;              } -            bool negative = false; +            bool negative = false;               TUnsigned max;              if (*pos == '+') {                  pos++; @@ -329,22 +329,22 @@ namespace {          switch (status) {              case PS_EMPTY_STRING: -                ythrow TFromStringException() << TStringBuf("Cannot parse empty string as number. "); +                ythrow TFromStringException() << TStringBuf("Cannot parse empty string as number. ");               case PS_PLUS_STRING: -                ythrow TFromStringException() << TStringBuf("Cannot parse string \"+\" as number. "); +                ythrow TFromStringException() << TStringBuf("Cannot parse string \"+\" as number. ");               case PS_MINUS_STRING: -                ythrow TFromStringException() << TStringBuf("Cannot parse string \"-\" as number. "); +                ythrow TFromStringException() << TStringBuf("Cannot parse string \"-\" as number. ");               case PS_BAD_SYMBOL: -                ythrow TFromStringException() << TStringBuf("Unexpected symbol \"") << EscapeC(*pos) << TStringBuf("\" at pos ") << (pos - data) << TStringBuf(" in string ") << TStringType(data, len).Quote() << TStringBuf(". "); +                ythrow TFromStringException() << TStringBuf("Unexpected symbol \"") << EscapeC(*pos) << TStringBuf("\" at pos ") << (pos - data) << TStringBuf(" in string ") << TStringType(data, len).Quote() << TStringBuf(". ");               case PS_OVERFLOW: -                ythrow TFromStringException() << TStringBuf("Integer overflow in string ") << TStringType(data, len).Quote() << TStringBuf(". "); +                ythrow TFromStringException() << TStringBuf("Integer overflow in string ") << TStringType(data, len).Quote() << TStringBuf(". ");               default: -                ythrow yexception() << TStringBuf("Unknown error code in string converter. "); +                ythrow yexception() << TStringBuf("Unknown error code in string converter. ");           }      }      template <typename T, typename TUnsigned, int base, typename TChar> -    Y_NO_INLINE T ParseInt(const TChar* data, size_t len, const TBounds<TUnsigned>& bounds) { +    Y_NO_INLINE T ParseInt(const TChar* data, size_t len, const TBounds<TUnsigned>& bounds) {           T result;          const TChar* pos = data;          EParseStatus status = TIntParser<T, base, TChar>::Parse(&pos, pos + len, bounds, &result); @@ -357,12 +357,12 @@ namespace {      }      template <typename T, typename TUnsigned, int base, typename TChar> -    Y_NO_INLINE bool TryParseInt(const TChar* data, size_t len, const TBounds<TUnsigned>& bounds, T* result) { +    Y_NO_INLINE bool TryParseInt(const TChar* data, size_t len, const TBounds<TUnsigned>& bounds, T* result) {           return TIntParser<T, base, TChar>::Parse(&data, data + len, bounds, result) == PS_OK;      }      template <class T> -    inline T ParseFlt(const char* data, size_t len) { +    inline T ParseFlt(const char* data, size_t len) {           /*           * TODO           */ @@ -384,7 +384,7 @@ namespace {              return ret;          } -        ythrow TFromStringException() << TStringBuf("cannot parse float(") << TStringBuf(data, len) << TStringBuf(")"); +        ythrow TFromStringException() << TStringBuf("cannot parse float(") << TStringBuf(data, len) << TStringBuf(")");       }  #define DEF_FLT_MOD(type, modifierWrite, modifierRead)                    \ @@ -405,16 +405,16 @@ namespace {       * sure they go into binary as actual values and there is no associated       * initialization code.       * */ -    constexpr TBounds<ui64> bSBounds = {static_cast<ui64>(SCHAR_MAX), static_cast<ui64>(UCHAR_MAX - SCHAR_MAX)}; -    constexpr TBounds<ui64> bUBounds = {static_cast<ui64>(UCHAR_MAX), 0}; -    constexpr TBounds<ui64> sSBounds = {static_cast<ui64>(SHRT_MAX), static_cast<ui64>(USHRT_MAX - SHRT_MAX)}; -    constexpr TBounds<ui64> sUBounds = {static_cast<ui64>(USHRT_MAX), 0}; -    constexpr TBounds<ui64> iSBounds = {static_cast<ui64>(INT_MAX), static_cast<ui64>(UINT_MAX - INT_MAX)}; -    constexpr TBounds<ui64> iUBounds = {static_cast<ui64>(UINT_MAX), 0}; -    constexpr TBounds<ui64> lSBounds = {static_cast<ui64>(LONG_MAX), static_cast<ui64>(ULONG_MAX - LONG_MAX)}; -    constexpr TBounds<ui64> lUBounds = {static_cast<ui64>(ULONG_MAX), 0}; -    constexpr TBounds<ui64> llSBounds = {static_cast<ui64>(LLONG_MAX), static_cast<ui64>(ULLONG_MAX - LLONG_MAX)}; -    constexpr TBounds<ui64> llUBounds = {static_cast<ui64>(ULLONG_MAX), 0}; +    constexpr TBounds<ui64> bSBounds = {static_cast<ui64>(SCHAR_MAX), static_cast<ui64>(UCHAR_MAX - SCHAR_MAX)};  +    constexpr TBounds<ui64> bUBounds = {static_cast<ui64>(UCHAR_MAX), 0};  +    constexpr TBounds<ui64> sSBounds = {static_cast<ui64>(SHRT_MAX), static_cast<ui64>(USHRT_MAX - SHRT_MAX)};  +    constexpr TBounds<ui64> sUBounds = {static_cast<ui64>(USHRT_MAX), 0};  +    constexpr TBounds<ui64> iSBounds = {static_cast<ui64>(INT_MAX), static_cast<ui64>(UINT_MAX - INT_MAX)};  +    constexpr TBounds<ui64> iUBounds = {static_cast<ui64>(UINT_MAX), 0};  +    constexpr TBounds<ui64> lSBounds = {static_cast<ui64>(LONG_MAX), static_cast<ui64>(ULONG_MAX - LONG_MAX)};  +    constexpr TBounds<ui64> lUBounds = {static_cast<ui64>(ULONG_MAX), 0};  +    constexpr TBounds<ui64> llSBounds = {static_cast<ui64>(LLONG_MAX), static_cast<ui64>(ULLONG_MAX - LLONG_MAX)};  +    constexpr TBounds<ui64> llUBounds = {static_cast<ui64>(ULLONG_MAX), 0};   }  #define DEF_INT_SPEC_II(TYPE, ITYPE, BASE)                              \ @@ -474,7 +474,7 @@ DEF_FLT_SPEC(long double)  template <>  size_t ToStringImpl<bool>(bool t, char* buf, size_t len) { -    Y_ENSURE(len, TStringBuf("zero length")); +    Y_ENSURE(len, TStringBuf("zero length"));       *buf = t ? '1' : '0';      return 1;  } @@ -510,7 +510,7 @@ bool FromStringImpl<bool>(const char* data, size_t len) {      bool result;      if (!TryFromStringImpl<bool>(data, len, result)) { -        ythrow TFromStringException() << TStringBuf("Cannot parse bool(") << TStringBuf(data, len) << TStringBuf("). "); +        ythrow TFromStringException() << TStringBuf("Cannot parse bool(") << TStringBuf(data, len) << TStringBuf("). ");       }      return result; @@ -683,7 +683,7 @@ template <>  double FromStringImpl<double>(const char* data, size_t len) {      double d = 0.0;      if (!TryFromStringImpl(data, len, d)) { -        ythrow TFromStringException() << TStringBuf("cannot parse float(") << TStringBuf(data, len) << TStringBuf(")"); +        ythrow TFromStringException() << TStringBuf("cannot parse float(") << TStringBuf(data, len) << TStringBuf(")");       }      return d;  } diff --git a/util/string/cast_ut.cpp b/util/string/cast_ut.cpp index 033450c38c4..1a1d6c5d91a 100644 --- a/util/string/cast_ut.cpp +++ b/util/string/cast_ut.cpp @@ -282,10 +282,10 @@ Y_UNIT_TEST_SUITE(TCastTest) {          UNIT_ASSERT_STRINGS_EQUAL(FloatToString(std::numeric_limits<double>::quiet_NaN()), "nan");          UNIT_ASSERT_STRINGS_EQUAL(FloatToString(std::numeric_limits<double>::infinity()), "inf"); -        UNIT_ASSERT_STRINGS_EQUAL(FloatToString(-std::numeric_limits<double>::infinity()), "-inf"); - -        UNIT_ASSERT_STRINGS_EQUAL(FloatToString(std::numeric_limits<float>::quiet_NaN()), "nan"); -        UNIT_ASSERT_STRINGS_EQUAL(FloatToString(std::numeric_limits<float>::infinity()), "inf"); +        UNIT_ASSERT_STRINGS_EQUAL(FloatToString(-std::numeric_limits<double>::infinity()), "-inf");  +  +        UNIT_ASSERT_STRINGS_EQUAL(FloatToString(std::numeric_limits<float>::quiet_NaN()), "nan");  +        UNIT_ASSERT_STRINGS_EQUAL(FloatToString(std::numeric_limits<float>::infinity()), "inf");           UNIT_ASSERT_STRINGS_EQUAL(FloatToString(-std::numeric_limits<float>::infinity()), "-inf");      } @@ -452,7 +452,7 @@ Y_UNIT_TEST_SUITE(TCastTest) {      Y_UNIT_TEST(TestAutoDetectType) {          UNIT_ASSERT_DOUBLES_EQUAL((float)FromString("0.0001"), 0.0001, EPS);          UNIT_ASSERT_DOUBLES_EQUAL((double)FromString("0.0015", sizeof("0.0015") - 2), 0.001, EPS); -        UNIT_ASSERT_DOUBLES_EQUAL((long double)FromString(TStringBuf("0.0001")), 0.0001, EPS); +        UNIT_ASSERT_DOUBLES_EQUAL((long double)FromString(TStringBuf("0.0001")), 0.0001, EPS);           UNIT_ASSERT_DOUBLES_EQUAL((float)FromString(TString("10E-5")), 10E-5, EPS);          UNIT_ASSERT_VALUES_EQUAL((bool)FromString("da"), true);          UNIT_ASSERT_VALUES_EQUAL((bool)FromString("no"), false); @@ -512,13 +512,13 @@ Y_UNIT_TEST_SUITE(TCastTest) {      Y_UNIT_TEST(TryStringBuf) {          { -            constexpr TStringBuf hello = "hello"; +            constexpr TStringBuf hello = "hello";               TStringBuf out;              UNIT_ASSERT(TryFromString(hello, out));              UNIT_ASSERT_VALUES_EQUAL(hello, out);          }          { -            constexpr TStringBuf empty = ""; +            constexpr TStringBuf empty = "";               TStringBuf out;              UNIT_ASSERT(TryFromString(empty, out));              UNIT_ASSERT_VALUES_EQUAL(empty, out); diff --git a/util/string/escape_ut.cpp b/util/string/escape_ut.cpp index cd38ecffd34..68513df10cd 100644 --- a/util/string/escape_ut.cpp +++ b/util/string/escape_ut.cpp @@ -5,8 +5,8 @@  #include <util/generic/string.h>  #include <util/charset/wide.h> -using namespace std::string_view_literals; - +using namespace std::string_view_literals;  +   namespace {      struct TExample {          TString Expected; @@ -22,11 +22,11 @@ namespace {  static const TExample CommonTestData[] = {      // Should be valid UTF-8. -    {"http://ya.ru/", "http://ya.ru/"}, -    {"http://ya.ru/\\x17\\n", "http://ya.ru/\x17\n"}, +    {"http://ya.ru/", "http://ya.ru/"},  +    {"http://ya.ru/\\x17\\n", "http://ya.ru/\x17\n"},  -    {"http://ya.ru/\\0", "http://ya.ru/\0"sv}, -    {"http://ya.ru/\\0\\0", "http://ya.ru/\0\0"sv}, +    {"http://ya.ru/\\0", "http://ya.ru/\0"sv},  +    {"http://ya.ru/\\0\\0", "http://ya.ru/\0\0"sv},       {"http://ya.ru/\\0\\0000", "http://ya.ru/\0\0"                                 "0"sv},      {"http://ya.ru/\\0\\0001", "http://ya.ru/\0\x00" @@ -37,13 +37,13 @@ static const TExample CommonTestData[] = {      {R"(\2\4\689)", "\2\4\6"                      "89"sv}, // \6 -> \6 because next char '8' is not "octal" -    {R"(\"Hello\", Alice said.)", "\"Hello\", Alice said."}, -    {"Slash\\\\dash!", "Slash\\dash!"}, -    {R"(There\nare\r\nnewlines.)", "There\nare\r\nnewlines."}, -    {"There\\tare\\ttabs.", "There\tare\ttabs."}, +    {R"(\"Hello\", Alice said.)", "\"Hello\", Alice said."},  +    {"Slash\\\\dash!", "Slash\\dash!"},  +    {R"(There\nare\r\nnewlines.)", "There\nare\r\nnewlines."},  +    {"There\\tare\\ttabs.", "There\tare\ttabs."},  -    {"There are questions \\x3F\\x3F?", "There are questions ???"}, -    {"There are questions \\x3F?", "There are questions ??"}, +    {"There are questions \\x3F\\x3F?", "There are questions ???"},  +    {"There are questions \\x3F?", "There are questions ??"},   };  Y_UNIT_TEST_SUITE(TEscapeCTest) { diff --git a/util/string/hex.cpp b/util/string/hex.cpp index 667397987fc..4d5ea72e7d4 100644 --- a/util/string/hex.cpp +++ b/util/string/hex.cpp @@ -32,7 +32,7 @@ char* HexEncode(const void* in, size_t len, char* out) {  void* HexDecode(const void* in, size_t len, void* ptr) {      const char* b = (const char*)in;      const char* e = b + len; -    Y_ENSURE(!(len & 1), TStringBuf("Odd buffer length passed to HexDecode")); +    Y_ENSURE(!(len & 1), TStringBuf("Odd buffer length passed to HexDecode"));       char* out = (char*)ptr; diff --git a/util/string/join_ut.cpp b/util/string/join_ut.cpp index 3ed2b2459c4..f23d2c0440e 100644 --- a/util/string/join_ut.cpp +++ b/util/string/join_ut.cpp @@ -19,7 +19,7 @@ Y_UNIT_TEST_SUITE(JoinStringTest) {          UNIT_ASSERT_EQUAL(Join(", ", 10, 11.1, "foobar"), "10, 11.1, foobar");          UNIT_ASSERT_EQUAL(Join(", ", 10, 11.1, TString("foobar")), "10, 11.1, foobar"); -        UNIT_ASSERT_EQUAL(Join('#', 0, "a", "foobar", -1.4, TStringBuf("aaa")), "0#a#foobar#-1.4#aaa"); +        UNIT_ASSERT_EQUAL(Join('#', 0, "a", "foobar", -1.4, TStringBuf("aaa")), "0#a#foobar#-1.4#aaa");           UNIT_ASSERT_EQUAL(Join("", "", ""), "");          UNIT_ASSERT_EQUAL(Join("", "a", "b", "c"), "abc");          UNIT_ASSERT_EQUAL(Join("", "a", "b", "", "c"), "abc"); diff --git a/util/string/split.h b/util/string/split.h index bc46d9e64c6..401d75bdd9a 100644 --- a/util/string/split.h +++ b/util/string/split.h @@ -427,7 +427,7 @@ inline size_t Split(const TStringBuf s, const TSetDelimiter<const char>& delim,  template <class P, class D>  void GetNext(TStringBuf& s, D delim, P& param) {      TStringBuf next = s.NextTok(delim); -    Y_ENSURE(next.IsInited(), TStringBuf("Split: number of fields less than number of Split output arguments")); +    Y_ENSURE(next.IsInited(), TStringBuf("Split: number of fields less than number of Split output arguments"));       param = FromString<P>(next);  } @@ -442,12 +442,12 @@ void GetNext(TStringBuf& s, D delim, TMaybe<P>& param) {  }  // example: -// Split(TStringBuf("Sherlock,2014,36.6"), ',', name, year, temperature); +// Split(TStringBuf("Sherlock,2014,36.6"), ',', name, year, temperature);   template <class D, class P1, class P2>  void Split(TStringBuf s, D delim, P1& p1, P2& p2) {      GetNext(s, delim, p1);      GetNext(s, delim, p2); -    Y_ENSURE(!s.IsInited(), TStringBuf("Split: number of fields more than number of Split output arguments")); +    Y_ENSURE(!s.IsInited(), TStringBuf("Split: number of fields more than number of Split output arguments"));   }  template <class D, class P1, class P2, class... Other> diff --git a/util/string/split_ut.cpp b/util/string/split_ut.cpp index 43e59f2d754..7f4c0d6d230 100644 --- a/util/string/split_ut.cpp +++ b/util/string/split_ut.cpp @@ -648,7 +648,7 @@ Y_UNIT_TEST_SUITE(StringSplitter) {          TVector<TString> actual1 = {"another", "one,", "and", "another", "one"};          num = 0; -        for (TStringBuf elem : StringSplitter(TStringBuf("another one, and \n\n     another    one")).SplitBySet(" \n").SkipEmpty()) { +        for (TStringBuf elem : StringSplitter(TStringBuf("another one, and \n\n     another    one")).SplitBySet(" \n").SkipEmpty()) {               UNIT_ASSERT_VALUES_EQUAL(elem, actual1[num++]);          } diff --git a/util/string/strip_ut.cpp b/util/string/strip_ut.cpp index d1029d1498a..84451b467cd 100644 --- a/util/string/strip_ut.cpp +++ b/util/string/strip_ut.cpp @@ -94,15 +94,15 @@ Y_UNIT_TEST_SUITE(TStripStringTest) {      }      Y_UNIT_TEST(TestWtrokaStrip) { -        UNIT_ASSERT_EQUAL(StripString(TWtringBuf(u" abc ")), u"abc"); -        UNIT_ASSERT_EQUAL(StripStringLeft(TWtringBuf(u" abc ")), u"abc "); -        UNIT_ASSERT_EQUAL(StripStringRight(TWtringBuf(u" abc ")), u" abc"); +        UNIT_ASSERT_EQUAL(StripString(TWtringBuf(u" abc ")), u"abc");  +        UNIT_ASSERT_EQUAL(StripStringLeft(TWtringBuf(u" abc ")), u"abc ");  +        UNIT_ASSERT_EQUAL(StripStringRight(TWtringBuf(u" abc ")), u" abc");       }      Y_UNIT_TEST(TestWtrokaCustomStrip) {          UNIT_ASSERT_EQUAL(              StripString( -                TWtringBuf(u"/abc/"), +                TWtringBuf(u"/abc/"),                   EqualsStripAdapter(u'/')),              u"abc");      } diff --git a/util/string/type.cpp b/util/string/type.cpp index 49671c02c2c..3fbc547fc6c 100644 --- a/util/string/type.cpp +++ b/util/string/type.cpp @@ -17,38 +17,38 @@ bool IsSpace(const char* s, size_t len) noexcept {  template <typename TStringType>  static bool IsNumberT(const TStringType& s) noexcept { -    if (s.empty()) { -        return false; -    } - +    if (s.empty()) {  +        return false;  +    }  +       return std::all_of(s.begin(), s.end(), IsAsciiDigit<typename TStringType::value_type>); -} - +}  +   bool IsNumber(const TStringBuf s) noexcept { -    return IsNumberT(s); -} - +    return IsNumberT(s);  +}  +   bool IsNumber(const TWtringBuf s) noexcept { -    return IsNumberT(s); -} - +    return IsNumberT(s);  +}  +   template <typename TStringType>  static bool IsHexNumberT(const TStringType& s) noexcept { -    if (s.empty()) { +    if (s.empty()) {           return false; -    } +    }       return std::all_of(s.begin(), s.end(), IsAsciiHex<typename TStringType::value_type>);  }  bool IsHexNumber(const TStringBuf s) noexcept { -    return IsHexNumberT(s); -} - +    return IsHexNumberT(s);  +}  +   bool IsHexNumber(const TWtringBuf s) noexcept { -    return IsHexNumberT(s); -} - +    return IsHexNumberT(s);  +}  +   namespace {      template <size_t N>      bool IsCaseInsensitiveAnyOf(TStringBuf str, const std::array<TStringBuf, N>& options) { @@ -63,24 +63,24 @@ namespace {  bool IsTrue(const TStringBuf v) noexcept {      static constexpr std::array<TStringBuf, 7> trueOptions{ -        "true", -        "t", -        "yes", -        "y", -        "on", -        "1", -        "da"}; +        "true",  +        "t",  +        "yes",  +        "y",  +        "on",  +        "1",  +        "da"};       return IsCaseInsensitiveAnyOf(v, trueOptions);  }  bool IsFalse(const TStringBuf v) noexcept {      static constexpr std::array<TStringBuf, 7> falseOptions{ -        "false", -        "f", -        "no", -        "n", -        "off", -        "0", -        "net"}; +        "false",  +        "f",  +        "no",  +        "n",  +        "off",  +        "0",  +        "net"};       return IsCaseInsensitiveAnyOf(v, falseOptions);  } diff --git a/util/string/type.h b/util/string/type.h index d6cb29ea589..a868cc265a0 100644 --- a/util/string/type.h +++ b/util/string/type.h @@ -18,7 +18,7 @@ Y_PURE_FUNCTION bool IsNumber(const TWtringBuf s) noexcept;  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:   * - "true",   * - "t", diff --git a/util/string/type_ut.cpp b/util/string/type_ut.cpp index 03e7af62bd0..d41b7edb371 100644 --- a/util/string/type_ut.cpp +++ b/util/string/type_ut.cpp @@ -2,8 +2,8 @@  #include <library/cpp/testing/unittest/registar.h> -#include <util/charset/wide.h> - +#include <util/charset/wide.h>  +   Y_UNIT_TEST_SUITE(TStringClassify) {      Y_UNIT_TEST(TestIsSpace) {          UNIT_ASSERT_EQUAL(IsSpace(" "), true); @@ -38,32 +38,32 @@ Y_UNIT_TEST_SUITE(TStringClassify) {          UNIT_ASSERT(!IsFalse("fa"));          UNIT_ASSERT(!IsFalse("foobar"));      } - +       Y_UNIT_TEST(TestIsNumber) { -        UNIT_ASSERT(IsNumber("0")); -        UNIT_ASSERT(IsNumber("12345678901234567890")); -        UNIT_ASSERT(!IsNumber("1234567890a")); -        UNIT_ASSERT(!IsNumber("12345xx67890a")); -        UNIT_ASSERT(!IsNumber("foobar")); +        UNIT_ASSERT(IsNumber("0"));  +        UNIT_ASSERT(IsNumber("12345678901234567890"));  +        UNIT_ASSERT(!IsNumber("1234567890a"));  +        UNIT_ASSERT(!IsNumber("12345xx67890a"));  +        UNIT_ASSERT(!IsNumber("foobar"));           UNIT_ASSERT(!IsNumber("")); - +           UNIT_ASSERT(IsNumber(u"0"));          UNIT_ASSERT(IsNumber(u"12345678901234567890"));          UNIT_ASSERT(!IsNumber(u"1234567890a"));          UNIT_ASSERT(!IsNumber(u"12345xx67890a"));          UNIT_ASSERT(!IsNumber(u"foobar")); -    } - +    }  +       Y_UNIT_TEST(TestIsHexNumber) { -        UNIT_ASSERT(IsHexNumber("0")); -        UNIT_ASSERT(IsHexNumber("aaaadddAAAAA")); -        UNIT_ASSERT(IsHexNumber("0123456789ABCDEFabcdef")); -        UNIT_ASSERT(IsHexNumber("12345678901234567890")); -        UNIT_ASSERT(IsHexNumber("1234567890a")); -        UNIT_ASSERT(!IsHexNumber("12345xx67890a")); -        UNIT_ASSERT(!IsHexNumber("foobar")); +        UNIT_ASSERT(IsHexNumber("0"));  +        UNIT_ASSERT(IsHexNumber("aaaadddAAAAA"));  +        UNIT_ASSERT(IsHexNumber("0123456789ABCDEFabcdef"));  +        UNIT_ASSERT(IsHexNumber("12345678901234567890"));  +        UNIT_ASSERT(IsHexNumber("1234567890a"));  +        UNIT_ASSERT(!IsHexNumber("12345xx67890a"));  +        UNIT_ASSERT(!IsHexNumber("foobar"));           UNIT_ASSERT(!IsHexNumber(TString())); - +           UNIT_ASSERT(IsHexNumber(u"0"));          UNIT_ASSERT(IsHexNumber(u"aaaadddAAAAA"));          UNIT_ASSERT(IsHexNumber(u"0123456789ABCDEFabcdef")); @@ -72,5 +72,5 @@ Y_UNIT_TEST_SUITE(TStringClassify) {          UNIT_ASSERT(!IsHexNumber(u"12345xx67890a"));          UNIT_ASSERT(!IsHexNumber(u"foobar"));          UNIT_ASSERT(!IsHexNumber(TUtf16String())); -    } +    }   } diff --git a/util/string/util.h b/util/string/util.h index 0d77a5042b8..24fcaa5bb86 100644 --- a/util/string/util.h +++ b/util/string/util.h @@ -73,13 +73,13 @@ public:      /// [DIFFERENCE FOR NOT_FOUND CASE: Returns end of string, not NULL]      const char* brk(const char* s) const {          while (c_chars_table[(ui8)*s]) -            ++s; +            ++s;           return s;      }      const char* brk(const char* s, const char* e) const {          while (s < e && c_chars_table[(ui8)*s]) -            ++s; +            ++s;           return s;      } @@ -87,13 +87,13 @@ public:      /// That is, skip all characters in table      const char* cbrk(const char* s) const {          while (chars_table[(ui8)*s]) -            ++s; +            ++s;           return s;      }      const char* cbrk(const char* s, const char* e) const {          while (s < e && chars_table[(ui8)*s]) -            ++s; +            ++s;           return s;      } @@ -148,7 +148,7 @@ public:  protected:      void init(const char* charset, bool extended); -    str_spn() = default; +    str_spn() = default;   };  // an analogue of tr/$from/$to/ diff --git a/util/system/backtrace.cpp b/util/system/backtrace.cpp index b77fe58fb11..68e4121cab0 100644 --- a/util/system/backtrace.cpp +++ b/util/system/backtrace.cpp @@ -149,8 +149,8 @@ TResolvedSymbol ResolveSymbol(void* sym, char* buf, size_t len) {      return ret;  }  #elif defined(_win_) -    #include <util/generic/singleton.h> - +    #include <util/generic/singleton.h>  +   namespace {      struct TWinSymbolResolverImpl {          typedef BOOL(WINAPI* TSymInitializeFunc)(HANDLE, PCSTR, BOOL); diff --git a/util/system/context.cpp b/util/system/context.cpp index ad993090884..4c67affa1fd 100644 --- a/util/system/context.cpp +++ b/util/system/context.cpp @@ -221,14 +221,14 @@ TContMachineContext::TContMachineContext()      : Fiber_(ConvertThreadToFiber(this))      , MainFiber_(true)  { -    Y_ENSURE(Fiber_, TStringBuf("fiber error")); +    Y_ENSURE(Fiber_, TStringBuf("fiber error"));   }  TContMachineContext::TContMachineContext(const TContClosure& c)      : Fiber_(CreateFiber(c.Stack.size(), (LPFIBER_START_ROUTINE)ContextTrampoLine, (LPVOID)c.TrampoLine))      , MainFiber_(false)  { -    Y_ENSURE(Fiber_, TStringBuf("fiber error")); +    Y_ENSURE(Fiber_, TStringBuf("fiber error"));   }  TContMachineContext::~TContMachineContext() { diff --git a/util/system/datetime.cpp b/util/system/datetime.cpp index b07b50679a6..94ce01df787 100644 --- a/util/system/datetime.cpp +++ b/util/system/datetime.cpp @@ -5,8 +5,8 @@  #include <util/datetime/systime.h> -#include <ctime> -#include <cerrno> +#include <ctime>  +#include <cerrno>   #ifdef _darwin_      #include <AvailabilityMacros.h> diff --git a/util/system/dynlib.cpp b/util/system/dynlib.cpp index 9d2541c25f1..14dfb625f22 100644 --- a/util/system/dynlib.cpp +++ b/util/system/dynlib.cpp @@ -18,7 +18,7 @@          #define RTLD_GLOBAL (0)      #endif -using HINSTANCE = void*; +using HINSTANCE = void*;       #define DLLOPEN(path, flags) dlopen(path, flags)      #define DLLCLOSE(hndl) dlclose(hndl) @@ -37,7 +37,7 @@ inline TString DLLERR() {      if (!msg)          return "DLLERR() unknown error";      while (cnt && isspace(msg[cnt - 1])) -        --cnt; +        --cnt;       TString err(msg, 0, cnt);      LocalFree(msg);      return err; diff --git a/util/system/env.cpp b/util/system/env.cpp index ead9b566a5f..09dfc8271ac 100644 --- a/util/system/env.cpp +++ b/util/system/env.cpp @@ -18,7 +18,7 @@   *   * Relevant links:   *  - http://bugs.python.org/issue16633 - *  - https://a.yandex-team.ru/review/108892/details + *  - https://a.yandex-team.ru/review/108892/details    */  TString GetEnv(const TString& key, const TString& def) { diff --git a/util/system/file.cpp b/util/system/file.cpp index 4a261d020cb..2beb6a8e3be 100644 --- a/util/system/file.cpp +++ b/util/system/file.cpp @@ -784,9 +784,9 @@ TString DecodeOpenMode(ui32 mode0) {      if ((mode & flag) == flag) {  \          mode &= ~flag;            \          if (r) {                  \ -            r << TStringBuf("|"); \ +            r << TStringBuf("|"); \           }                         \ -        r << TStringBuf(#flag);   \ +        r << TStringBuf(#flag);   \       }      F(RdWr) @@ -828,7 +828,7 @@ TString DecodeOpenMode(ui32 mode0) {      if (mode != 0) {          if (r) { -            r << TStringBuf("|"); +            r << TStringBuf("|");           }          r << Hex(mode); diff --git a/util/system/file_lock.cpp b/util/system/file_lock.cpp index 45d91282c5b..f10cc089e02 100644 --- a/util/system/file_lock.cpp +++ b/util/system/file_lock.cpp @@ -3,7 +3,7 @@  #include <util/generic/yexception.h> -#include <cerrno> +#include <cerrno>   namespace {      int GetMode(const EFileLockType type) { diff --git a/util/system/fstat.cpp b/util/system/fstat.cpp index 81e98cbc6bb..4a1562f60a8 100644 --- a/util/system/fstat.cpp +++ b/util/system/fstat.cpp @@ -5,7 +5,7 @@  #include <util/folder/path.h> -#include <cerrno> +#include <cerrno>   #if defined(_win_)      #include "fs_win.h" @@ -96,7 +96,7 @@ static bool GetStatByName(TSystemFStat& fs, const char* fileName, bool nofollow)  #endif  } -TFileStat::TFileStat() = default; +TFileStat::TFileStat() = default;   TFileStat::TFileStat(const TFile& f) {      *this = TFileStat(f.GetHandle()); diff --git a/util/system/info.cpp b/util/system/info.cpp index cf6681e89a9..6546cca2389 100644 --- a/util/system/info.cpp +++ b/util/system/info.cpp @@ -106,11 +106,11 @@ size_t NSystemInfo::NumberOfCpus() {                  column = 0;              } else if (column != -1) {                  if (AsciiToLower(ch) == matchstr[column]) { -                    ++column; +                    ++column;                       if (column == sizeof(matchstr) - 1) {                          column = -1; -                        ++ret; +                        ++ret;                       }                  } else {                      column = -1; diff --git a/util/system/mem_info.cpp b/util/system/mem_info.cpp index aa51ae3b16d..7016b01089b 100644 --- a/util/system/mem_info.cpp +++ b/util/system/mem_info.cpp @@ -25,7 +25,7 @@      #include <Windows.h>      #include <util/generic/ptr.h> -using NTSTATUS = LONG; +using NTSTATUS = LONG;       #define STATUS_INFO_LENGTH_MISMATCH 0xC0000004      #define STATUS_BUFFER_TOO_SMALL 0xC0000023 @@ -38,7 +38,7 @@ typedef struct _CLIENT_ID {      HANDLE UniqueProcess;      HANDLE UniqueThread;  } CLIENT_ID, *PCLIENT_ID; -using KWAIT_REASON = ULONG; +using KWAIT_REASON = ULONG;   typedef struct _SYSTEM_THREAD_INFORMATION {      LARGE_INTEGER KernelTime;      LARGE_INTEGER UserTime; diff --git a/util/system/rwlock.cpp b/util/system/rwlock.cpp index bb3dcbf1881..9f9b3975c06 100644 --- a/util/system/rwlock.cpp +++ b/util/system/rwlock.cpp @@ -51,7 +51,7 @@ void TRWMutex::TImpl::AcquireRead() noexcept {              ReadCond_.Wait(Lock_);          } -        ++State_; +        ++State_;       }      ReadCond_.Signal(); @@ -63,7 +63,7 @@ bool TRWMutex::TImpl::TryAcquireRead() noexcept {              return false;          } -        ++State_; +        ++State_;       }      return true; diff --git a/util/system/sem.cpp b/util/system/sem.cpp index 4a93b903b5c..d7c2bca19c9 100644 --- a/util/system/sem.cpp +++ b/util/system/sem.cpp @@ -49,12 +49,12 @@ namespace {      class TSemaphoreImpl {      private:  #ifdef _win_ -        using SEMHANDLE = HANDLE; +        using SEMHANDLE = HANDLE;   #else      #ifdef USE_SYSV_SEMAPHORES -        using SEMHANDLE = int; +        using SEMHANDLE = int;       #else -        using SEMHANDLE = sem_t*; +        using SEMHANDLE = sem_t*;       #endif  #endif @@ -76,7 +76,7 @@ namespace {                  while (*p) {                      if (*p == '\\')                          *p = '/'; -                    ++p; +                    ++p;                   }              }              // non-blocking on init diff --git a/util/system/shellcommand.cpp b/util/system/shellcommand.cpp index b1989b5c8c3..c6cd6341909 100644 --- a/util/system/shellcommand.cpp +++ b/util/system/shellcommand.cpp @@ -109,7 +109,7 @@ namespace {  // temporary measure to avoid rewriting all poll calls on win TPipeHandle  #if defined(_win_) -using REALPIPEHANDLE = HANDLE; +using REALPIPEHANDLE = HANDLE;       #define INVALID_REALPIPEHANDLE INVALID_HANDLE_VALUE  class TRealPipeHandle @@ -183,7 +183,7 @@ private:  #else  using TRealPipeHandle = TPipeHandle; -using REALPIPEHANDLE = PIPEHANDLE; +using REALPIPEHANDLE = PIPEHANDLE;       #define INVALID_REALPIPEHANDLE INVALID_PIPEHANDLE  #endif @@ -756,7 +756,7 @@ void TShellCommand::TImpl::OnFork(TPipes& pipes, sigset_t oldmask, char* const*  #endif  void TShellCommand::TImpl::Run() { -    Y_ENSURE(AtomicGet(ExecutionStatus) != SHELL_RUNNING, TStringBuf("Process is already running")); +    Y_ENSURE(AtomicGet(ExecutionStatus) != SHELL_RUNNING, TStringBuf("Process is already running"));       // Prepare I/O streams      CollectedOutput.clear();      CollectedError.clear(); diff --git a/util/system/sigset.h b/util/system/sigset.h index 8dd02fd8171..9fa5a9dfe9f 100644 --- a/util/system/sigset.h +++ b/util/system/sigset.h @@ -12,7 +12,7 @@      #define SIG_UNBLOCK 2      #define SIG_SETMASK 3 -using sigset_t = ui32; +using sigset_t = ui32;   #else      #error not supported yet diff --git a/util/system/src_root_ut.cpp b/util/system/src_root_ut.cpp index e9a675eb9ab..a77c9ce89ce 100644 --- a/util/system/src_root_ut.cpp +++ b/util/system/src_root_ut.cpp @@ -13,7 +13,7 @@ Y_UNIT_TEST_SUITE(TestSourceRoot) {      Y_UNIT_TEST(TestPrivateChopPrefixRoutine) {          static constexpr const char str[] = ":\0:\0: It's unlikely that this string has an ARCADIA_ROOT as its prefix :\0:\0:";          static constexpr const auto strStaticBuf = STATIC_BUF(str); -        UNIT_ASSERT_VALUES_EQUAL(TStringBuf(str, sizeof(str) - 1), ::NPrivate::StripRoot(strStaticBuf).As<TStringBuf>()); +        UNIT_ASSERT_VALUES_EQUAL(TStringBuf(str, sizeof(str) - 1), ::NPrivate::StripRoot(strStaticBuf).As<TStringBuf>());           UNIT_ASSERT_VALUES_EQUAL(0, ::NPrivate::RootPrefixLength(strStaticBuf));          static_assert(::NPrivate::IsProperPrefix(STATIC_BUF("foo"), STATIC_BUF("foobar")), R"(IsProperPrefix("foo", "foobar") failed)"); diff --git a/util/system/sysstat.h b/util/system/sysstat.h index b7c424c11bd..2d09f10c18c 100644 --- a/util/system/sysstat.h +++ b/util/system/sysstat.h @@ -23,9 +23,9 @@  int Chmod(const char* fname, int mode);  int Umask(int mode); -static constexpr int MODE0777 = (S_IRWXU | S_IRWXG | S_IRWXO); -static constexpr int MODE0775 = (S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); -static constexpr int MODE0755 = (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); +static constexpr int MODE0777 = (S_IRWXU | S_IRWXG | S_IRWXO);  +static constexpr int MODE0775 = (S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);  +static constexpr int MODE0755 = (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);   int Mkdir(const char* path, int mode); diff --git a/util/system/user.cpp b/util/system/user.cpp index 83e89ea0a81..cc3ec171ee2 100644 --- a/util/system/user.cpp +++ b/util/system/user.cpp @@ -41,7 +41,7 @@ TString GetUsername() {              return TString(pwd->pw_name);          } -        ythrow TSystemError() << TStringBuf(" getpwuid failed"); +        ythrow TSystemError() << TStringBuf(" getpwuid failed");   #else          passwd pwd;          passwd* tmpPwd; diff --git a/util/system/yassert.h b/util/system/yassert.h index 529823440cb..e95a7920950 100644 --- a/util/system/yassert.h +++ b/util/system/yassert.h @@ -100,12 +100,12 @@ namespace NPrivate {          if (Y_UNLIKELY(!(expr))) {                                                                   \              ::NPrivate::Panic(__SOURCE_FILE_IMPL__, __LINE__, __FUNCTION__, #expr, " " __VA_ARGS__); \          }                                                                                            \ -    } while (false) +    } while (false)   #define Y_FAIL(...)                                                                                \      do {                                                                                           \          ::NPrivate::Panic(__SOURCE_FILE_IMPL__, __LINE__, __FUNCTION__, nullptr, " " __VA_ARGS__); \ -    } while (false) +    } while (false)   #ifndef NDEBUG      /// Assert that depend on NDEBUG macro and outputs message like printf diff --git a/util/thread/factory.cpp b/util/thread/factory.cpp index 48e898f32dc..150c4aa7830 100644 --- a/util/thread/factory.cpp +++ b/util/thread/factory.cpp @@ -56,7 +56,7 @@ namespace {              : Func(func)          {          } -        void DoExecute() override { +        void DoExecute() override {               THolder<TThreadFactoryFuncObj> self(this);              Func();          } diff --git a/util/thread/pool.cpp b/util/thread/pool.cpp index 05fad02e9b9..e35fde4a1c5 100644 --- a/util/thread/pool.cpp +++ b/util/thread/pool.cpp @@ -350,7 +350,7 @@ size_t TThreadPool::GetMaxQueueSize() const noexcept {  }  bool TThreadPool::Add(IObjectInQueue* obj) { -    Y_ENSURE_EX(Impl_.Get(), TThreadPoolException() << TStringBuf("mtp queue not started")); +    Y_ENSURE_EX(Impl_.Get(), TThreadPoolException() << TStringBuf("mtp queue not started"));       if (Impl_->NeedRestart()) {          Start(Impl_->GetThreadCountExpected(), Impl_->GetMaxQueueSize()); @@ -455,7 +455,7 @@ public:              Obj_ = obj; -            Y_ENSURE_EX(!AllDone_, TThreadPoolException() << TStringBuf("adding to a stopped queue")); +            Y_ENSURE_EX(!AllDone_, TThreadPoolException() << TStringBuf("adding to a stopped queue"));           }          CondReady_.Signal(); @@ -566,7 +566,7 @@ DEFINE_THREAD_POOL_CTORS(TSimpleThreadPool)  TAdaptiveThreadPool::~TAdaptiveThreadPool() = default;  bool TAdaptiveThreadPool::Add(IObjectInQueue* obj) { -    Y_ENSURE_EX(Impl_.Get(), TThreadPoolException() << TStringBuf("mtp queue not started")); +    Y_ENSURE_EX(Impl_.Get(), TThreadPoolException() << TStringBuf("mtp queue not started"));       Impl_->Add(obj); @@ -590,7 +590,7 @@ size_t TAdaptiveThreadPool::Size() const noexcept {  }  void TAdaptiveThreadPool::SetMaxIdleTime(TDuration interval) { -    Y_ENSURE_EX(Impl_.Get(), TThreadPoolException() << TStringBuf("mtp queue not started")); +    Y_ENSURE_EX(Impl_.Get(), TThreadPoolException() << TStringBuf("mtp queue not started"));       Impl_->SetMaxIdleTime(interval);  } @@ -604,7 +604,7 @@ TSimpleThreadPool::~TSimpleThreadPool() {  }  bool TSimpleThreadPool::Add(IObjectInQueue* obj) { -    Y_ENSURE_EX(Slave_.Get(), TThreadPoolException() << TStringBuf("mtp queue not started")); +    Y_ENSURE_EX(Slave_.Get(), TThreadPoolException() << TStringBuf("mtp queue not started"));       return Slave_->Add(obj);  } @@ -660,11 +660,11 @@ namespace {  }  void IThreadPool::SafeAdd(IObjectInQueue* obj) { -    Y_ENSURE_EX(Add(obj), TThreadPoolException() << TStringBuf("can not add object to queue")); +    Y_ENSURE_EX(Add(obj), TThreadPoolException() << TStringBuf("can not add object to queue"));   }  void IThreadPool::SafeAddAndOwn(THolder<IObjectInQueue> obj) { -    Y_ENSURE_EX(AddAndOwn(std::move(obj)), TThreadPoolException() << TStringBuf("can not add to queue and own")); +    Y_ENSURE_EX(AddAndOwn(std::move(obj)), TThreadPoolException() << TStringBuf("can not add to queue and own"));   }  bool IThreadPool::AddAndOwn(THolder<IObjectInQueue> obj) { diff --git a/util/thread/pool.h b/util/thread/pool.h index d1ea3a67cb6..3f9c2bbe145 100644 --- a/util/thread/pool.h +++ b/util/thread/pool.h @@ -150,7 +150,7 @@ public:      template <class T>      void SafeAddFunc(T&& func) { -        Y_ENSURE_EX(AddFunc(std::forward<T>(func)), TThreadPoolException() << TStringBuf("can not add function to queue")); +        Y_ENSURE_EX(AddFunc(std::forward<T>(func)), TThreadPoolException() << TStringBuf("can not add function to queue"));       }      void SafeAddAndOwn(THolder<IObjectInQueue> obj); diff --git a/util/ysaveload.h b/util/ysaveload.h index 02efb4049b6..6d894a0ac60 100644 --- a/util/ysaveload.h +++ b/util/ysaveload.h @@ -64,7 +64,7 @@ static inline void LoadPodType(IInputStream* rh, T& t) {      const size_t res = rh->Load(&t, sizeof(T));      if (Y_UNLIKELY(res != sizeof(T))) { -        ::NPrivate::ThrowLoadEOFException(sizeof(T), res, TStringBuf("pod type")); +        ::NPrivate::ThrowLoadEOFException(sizeof(T), res, TStringBuf("pod type"));       }  } @@ -79,7 +79,7 @@ static inline void LoadPodArray(IInputStream* rh, T* arr, size_t count) {      const size_t res = rh->Load(arr, len);      if (Y_UNLIKELY(res != len)) { -        ::NPrivate::ThrowLoadEOFException(len, res, TStringBuf("pod array")); +        ::NPrivate::ThrowLoadEOFException(len, res, TStringBuf("pod array"));       }  } @@ -453,10 +453,10 @@ public:      static void Load(IInputStream* rh, TBuffer& buf);  }; -template <class TSetOrMap, class TValue> -class TSetSerializerInserterBase { +template <class TSetOrMap, class TValue>  +class TSetSerializerInserterBase {   public: -    inline TSetSerializerInserterBase(TSetOrMap& s) +    inline TSetSerializerInserterBase(TSetOrMap& s)           : S_(s)      {          S_.clear(); @@ -466,29 +466,29 @@ public:          S_.insert(v);      } -protected: -    TSetOrMap& S_; +protected:  +    TSetOrMap& S_;   }; -template <class TSetOrMap, class TValue, bool sorted> +template <class TSetOrMap, class TValue, bool sorted>   class TSetSerializerInserter: public TSetSerializerInserterBase<TSetOrMap, TValue> { -    using TBase = TSetSerializerInserterBase<TSetOrMap, TValue>; +    using TBase = TSetSerializerInserterBase<TSetOrMap, TValue>;  -public: -    inline TSetSerializerInserter(TSetOrMap& s, size_t cnt) -        : TBase(s) -    { +public:  +    inline TSetSerializerInserter(TSetOrMap& s, size_t cnt)  +        : TBase(s)  +    {           Y_UNUSED(cnt); -    } -}; - +    }  +};  +   template <class TSetType, class TValue>  class TSetSerializerInserter<TSetType, TValue, true>: public TSetSerializerInserterBase<TSetType, TValue> {      using TBase = TSetSerializerInserterBase<TSetType, TValue>;  public:      inline TSetSerializerInserter(TSetType& s, size_t cnt) -        : TBase(s) +        : TBase(s)       {          Y_UNUSED(cnt);          P_ = this->S_.begin(); @@ -502,19 +502,19 @@ private:      typename TSetType::iterator P_;  }; -template <class T1, class T2, class T3, class T4, class T5, class TValue> +template <class T1, class T2, class T3, class T4, class T5, class TValue>   class TSetSerializerInserter<THashMap<T1, T2, T3, T4, T5>, TValue, false>: public TSetSerializerInserterBase<THashMap<T1, T2, T3, T4, T5>, TValue> {      using TMapType = THashMap<T1, T2, T3, T4, T5>;      using TBase = TSetSerializerInserterBase<TMapType, TValue>; -public: +public:       inline TSetSerializerInserter(TMapType& m, size_t cnt) -        : TBase(m) -    { +        : TBase(m)  +    {           m.reserve(cnt); -    } -}; - +    }  +};  +   template <class T1, class T2, class T3, class T4, class T5, class TValue>  class TSetSerializerInserter<THashMultiMap<T1, T2, T3, T4, T5>, TValue, false>: public TSetSerializerInserterBase<THashMultiMap<T1, T2, T3, T4, T5>, TValue> {      using TMapType = THashMultiMap<T1, T2, T3, T4, T5>; @@ -528,19 +528,19 @@ public:      }  }; -template <class T1, class T2, class T3, class T4, class TValue> +template <class T1, class T2, class T3, class T4, class TValue>   class TSetSerializerInserter<THashSet<T1, T2, T3, T4>, TValue, false>: public TSetSerializerInserterBase<THashSet<T1, T2, T3, T4>, TValue> {      using TSetType = THashSet<T1, T2, T3, T4>;      using TBase = TSetSerializerInserterBase<TSetType, TValue>; -public: +public:       inline TSetSerializerInserter(TSetType& s, size_t cnt) -        : TBase(s) -    { +        : TBase(s)  +    {           s.reserve(cnt); -    } -}; - +    }  +};  +   template <class TSetType, class TValue, bool sorted>  class TSetSerializerBase {  public: diff --git a/ydb/core/base/path.cpp b/ydb/core/base/path.cpp index 0cfb16f99dc..fee1b33cf8a 100644 --- a/ydb/core/base/path.cpp +++ b/ydb/core/base/path.cpp @@ -78,7 +78,7 @@ TStringBuf ExtractDomain(const TString& path) noexcept {  TStringBuf ExtractDomain(TStringBuf path) noexcept {      //  coherence with SplitPath and JoinPath that allow no / leading path -    path.SkipPrefix(TStringBuf("/")); +    path.SkipPrefix(TStringBuf("/"));       return path.Before('/');  } @@ -86,23 +86,23 @@ TStringBuf ExtractDomain(TStringBuf path) noexcept {  bool IsEqualPaths(const TString& l, const TString& r) noexcept {      auto left = TStringBuf(l);      // coherence with SplitPath and JoinPath that allow no / leading path -    left.SkipPrefix(TStringBuf("/")); +    left.SkipPrefix(TStringBuf("/"));       // also do not accaunt / at the end -    left.ChopSuffix(TStringBuf("/")); +    left.ChopSuffix(TStringBuf("/"));       auto right = TStringBuf(r); -    right.SkipPrefix(TStringBuf("/")); -    right.ChopSuffix(TStringBuf("/")); +    right.SkipPrefix(TStringBuf("/"));  +    right.ChopSuffix(TStringBuf("/"));       return left == right;  }  bool IsStartWithSlash(const TString &l) { -    return TStringBuf(l).StartsWith(TStringBuf("/")); +    return TStringBuf(l).StartsWith(TStringBuf("/"));   }  TString::const_iterator PathPartBrokenAt(const TString &part, const TStringBuf extraSymbols) { -    static constexpr TStringBuf basicSymbols = "-_."; +    static constexpr TStringBuf basicSymbols = "-_.";       for (auto it = part.begin(); it != part.end(); ++it) {          if (!isalnum(*it)                  && !basicSymbols.Contains(*it) @@ -147,7 +147,7 @@ TStringBuf ExtractParent(const TString &path) noexcept {      TStringBuf parent = TStringBuf(path);      //  coherence with SplitPath and JoinPath that allow no / leading path -    parent.ChopSuffix(TStringBuf("/")); +    parent.ChopSuffix(TStringBuf("/"));       return parent.RBefore('/');  } @@ -156,7 +156,7 @@ TStringBuf ExtractBase(const TString &path) noexcept {      TStringBuf parent = TStringBuf(path);      //  coherence with SplitPath and JoinPath that allow no / leading path -    parent.ChopSuffix(TStringBuf("/")); +    parent.ChopSuffix(TStringBuf("/"));       return parent.RAfter('/');  } diff --git a/ydb/core/blobstorage/crypto/chacha_ut.cpp b/ydb/core/blobstorage/crypto/chacha_ut.cpp index 18db0f8df64..19a1f90f460 100644 --- a/ydb/core/blobstorage/crypto/chacha_ut.cpp +++ b/ydb/core/blobstorage/crypto/chacha_ut.cpp @@ -80,7 +80,7 @@ Y_UNIT_TEST_SUITE(TChaCha)      }      Y_UNIT_TEST(MultiEncipherOneDecipher) { -        TStringBuf lorem = +        TStringBuf lorem =                   "Lorem ipsum dolor sit amet, consectetur adipisicing elit, "                  "sed do eiusmod tempor incididunt ut labore et dolore magna "                  "aliqua. Ut enim ad minim veniam, quis nostrud exercitation " @@ -88,7 +88,7 @@ Y_UNIT_TEST_SUITE(TChaCha)                  "Duis aute irure dolor in reprehenderit in voluptate velit "                  "esse cillum dolore eu fugiat nulla pariatur. Excepteur sint "                  "occaecat cupidatat non proident, sunt in culpa qui officia " -                "deserunt mollit anim id est laborum."; +                "deserunt mollit anim id est laborum.";           TSecuredBlock<> buf(lorem.data(), lorem.size()); @@ -111,9 +111,9 @@ Y_UNIT_TEST_SUITE(TChaCha)      }      Y_UNIT_TEST(SecondBlock) { -        TStringBuf plaintext = +        TStringBuf plaintext =                   "1111111122222222333333334444444455555555666666667777777788888888" -                "qqqqqqqqwwwwwwwweeeeeeeerrrrrrrrttttttttyyyyyyyyuuuuuuuuiiiiiiii"; +                "qqqqqqqqwwwwwwwweeeeeeeerrrrrrrrttttttttyyyyyyyyuuuuuuuuiiiiiiii";           TSecuredBlock<> buf(plaintext.data(), plaintext.size()); diff --git a/ydb/core/blobstorage/crypto/chacha_vec_ut.cpp b/ydb/core/blobstorage/crypto/chacha_vec_ut.cpp index 823348e8321..dce20a7e6f8 100644 --- a/ydb/core/blobstorage/crypto/chacha_vec_ut.cpp +++ b/ydb/core/blobstorage/crypto/chacha_vec_ut.cpp @@ -82,7 +82,7 @@ Y_UNIT_TEST_SUITE(TChaChaVec)      }      Y_UNIT_TEST(MultiEncipherOneDecipher) { -        TStringBuf lorem = +        TStringBuf lorem =                   "Lorem ipsum dolor sit amet, consectetur adipisicing elit, "                  "sed do eiusmod tempor incididunt ut labore et dolore magna "                  "aliqua. Ut enim ad minim veniam, quis nostrud exercitation " @@ -90,7 +90,7 @@ Y_UNIT_TEST_SUITE(TChaChaVec)                  "Duis aute irure dolor in reprehenderit in voluptate velit "                  "esse cillum dolore eu fugiat nulla pariatur. Excepteur sint "                  "occaecat cupidatat non proident, sunt in culpa qui officia " -                "deserunt mollit anim id est laborum."; +                "deserunt mollit anim id est laborum.";           TSecuredBlock<> buf(lorem.data(), lorem.size()); @@ -113,9 +113,9 @@ Y_UNIT_TEST_SUITE(TChaChaVec)      }      Y_UNIT_TEST(SecondBlock) { -        TStringBuf plaintext = +        TStringBuf plaintext =                   "1111111122222222333333334444444455555555666666667777777788888888" -                "qqqqqqqqwwwwwwwweeeeeeeerrrrrrrrttttttttyyyyyyyyuuuuuuuuiiiiiiii"; +                "qqqqqqqqwwwwwwwweeeeeeeerrrrrrrrttttttttyyyyyyyyuuuuuuuuiiiiiiii";           TSecuredBlock<> buf(plaintext.data(), plaintext.size()); diff --git a/ydb/core/blobstorage/ut_vdisk/lib/http_client.cpp b/ydb/core/blobstorage/ut_vdisk/lib/http_client.cpp index abde48cedfa..9fd9fdd2bbd 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/http_client.cpp +++ b/ydb/core/blobstorage/ut_vdisk/lib/http_client.cpp @@ -44,24 +44,24 @@ void THttpClient::SendHttpRequest(const TStringBuf relativeUrl,      TString contentLength;      parts.reserve(16);      parts.push_back(IOutputStream::TPart(method)); -    parts.push_back(TStringBuf(" ")); +    parts.push_back(TStringBuf(" "));       parts.push_back(relativeUrl); -    parts.push_back(TStringBuf(" HTTP/1.1")); +    parts.push_back(TStringBuf(" HTTP/1.1"));       parts.push_back(IOutputStream::TPart::CrLf()); -    parts.push_back(TStringBuf("Host: ")); +    parts.push_back(TStringBuf("Host: "));       parts.push_back(TStringBuf(Host));      parts.push_back(IOutputStream::TPart::CrLf()); -    parts.push_back(TStringBuf("From: [email protected]")); +    parts.push_back(TStringBuf("From: [email protected]"));       parts.push_back(IOutputStream::TPart::CrLf());      if (body.size() > 0) {          contentLength = ToString(body.size()); -        parts.push_back(TStringBuf("Content-Length: ")); +        parts.push_back(TStringBuf("Content-Length: "));           parts.push_back(TStringBuf(contentLength));          parts.push_back(IOutputStream::TPart::CrLf());      }      for (const auto& entry: headers) {          parts.push_back(IOutputStream::TPart(entry.first)); -        parts.push_back(IOutputStream::TPart(TStringBuf(": "))); +        parts.push_back(IOutputStream::TPart(TStringBuf(": ")));           parts.push_back(IOutputStream::TPart(entry.second));          parts.push_back(IOutputStream::TPart::CrLf());      } diff --git a/ydb/core/cms/sentinel.cpp b/ydb/core/cms/sentinel.cpp index 638b78fe09b..735f26faeb3 100644 --- a/ydb/core/cms/sentinel.cpp +++ b/ydb/core/cms/sentinel.cpp @@ -399,7 +399,7 @@ public:      }      static TStringBuf Name() { -        return "ConfigUpdater"sv; +        return "ConfigUpdater"sv;       }      using TBase::TBase; @@ -588,7 +588,7 @@ public:      }      static TStringBuf Name() { -        return "StateUpdater"sv; +        return "StateUpdater"sv;       }      using TBase::TBase; @@ -684,7 +684,7 @@ public:      }      static TStringBuf Name() { -        return "StatusChanger"sv; +        return "StatusChanger"sv;       }      explicit TStatusChanger( @@ -1018,7 +1018,7 @@ public:      }      static TStringBuf Name() { -        return "Main"sv; +        return "Main"sv;       }      explicit TSentinel(TCmsStatePtr cmsState) diff --git a/ydb/core/engine/kikimr_program_builder.cpp b/ydb/core/engine/kikimr_program_builder.cpp index fd32a772ee9..5526c6ab3cd 100644 --- a/ydb/core/engine/kikimr_program_builder.cpp +++ b/ydb/core/engine/kikimr_program_builder.cpp @@ -95,7 +95,7 @@ TUpdateRowBuilder::TUpdateRowBuilder(const TTypeEnvironment& env)      : Builder(env)      , Env(env)  { -    NullInternName = Env.InternName(TStringBuf("Null")); +    NullInternName = Env.InternName(TStringBuf("Null"));   }  void TUpdateRowBuilder::SetColumn( @@ -178,7 +178,7 @@ TKikimrProgramBuilder::TKikimrProgramBuilder(      : TProgramBuilder(env, functionRegistry, true)  {      UseNullType = false; -    NullInternName = Env.InternName(TStringBuf("Null")); +    NullInternName = Env.InternName(TStringBuf("Null"));       std::array<TType*, 3> tupleTypes;      tupleTypes[0] = NewDataType(NUdf::TDataType<ui64>::Id); @@ -341,8 +341,8 @@ TRuntimeNode TKikimrProgramBuilder::SelectRange(      TStructTypeBuilder returnTypeBuilder(Env);      returnTypeBuilder.Reserve(2); -    returnTypeBuilder.Add(TStringBuf("List"), listType); -    returnTypeBuilder.Add(TStringBuf("Truncated"), boolType); +    returnTypeBuilder.Add(TStringBuf("List"), listType);  +    returnTypeBuilder.Add(TStringBuf("Truncated"), boolType);       auto returnType = returnTypeBuilder.Build();      TCallableBuilder builder(Env, "SelectRange", returnType); @@ -518,10 +518,10 @@ TRuntimeNode TKikimrProgramBuilder::Bind(TRuntimeNode program, TRuntimeNode para      {          TExploringNodeVisitor explorer;          explorer.Walk(program.GetNode(), Env); -        auto parameterFunc = Env.InternName(TStringBuf("Parameter")); -        auto mapParameterFunc = Env.InternName(TStringBuf("MapParameter")); -        auto flatMapParameterFunc = Env.InternName(TStringBuf("FlatMapParameter")); -        auto arg = Env.InternName(TStringBuf("Arg")); +        auto parameterFunc = Env.InternName(TStringBuf("Parameter"));  +        auto mapParameterFunc = Env.InternName(TStringBuf("MapParameter"));  +        auto flatMapParameterFunc = Env.InternName(TStringBuf("FlatMapParameter"));  +        auto arg = Env.InternName(TStringBuf("Arg"));           for (auto node : explorer.GetNodes()) {              if (node->GetType()->GetKind() != TType::EKind::Callable)                  continue; diff --git a/ydb/core/engine/mkql_engine_flat.h b/ydb/core/engine/mkql_engine_flat.h index 7bee67584b9..9d2cecb62a6 100644 --- a/ydb/core/engine/mkql_engine_flat.h +++ b/ydb/core/engine/mkql_engine_flat.h @@ -13,10 +13,10 @@  namespace NKikimr {  namespace NMiniKQL { -const TStringBuf TxInternalResultPrefix = "__"; -const TStringBuf TxLocksResultLabel = "__tx_locks"; -const TStringBuf TxLocksResultLabel2 = "__tx_locks2"; -const TStringBuf TxInfoResultLabel = "__tx_info"; +const TStringBuf TxInternalResultPrefix = "__";  +const TStringBuf TxLocksResultLabel = "__tx_locks";  +const TStringBuf TxLocksResultLabel2 = "__tx_locks2";  +const TStringBuf TxInfoResultLabel = "__tx_info";   // Should be strictly less than NActors::TEventPB::MaxByteSize to avoid VERIFY in actorlib  const ui32 MaxDatashardReplySize = 48 * 1024 * 1024; // 48 MB diff --git a/ydb/core/engine/mkql_engine_flat_impl.h b/ydb/core/engine/mkql_engine_flat_impl.h index bb232a52aae..ed42b9c16e8 100644 --- a/ydb/core/engine/mkql_engine_flat_impl.h +++ b/ydb/core/engine/mkql_engine_flat_impl.h @@ -8,17 +8,17 @@ namespace NMiniKQL {      struct TBuiltinStrings {          TBuiltinStrings(const TTypeEnvironment& env) -            : Filter(env.InternName(TStringBuf("Filter"))) -            , FilterNullMembers(env.InternName(TStringBuf("FilterNullMembers"))) -            , SkipNullMembers(env.InternName(TStringBuf("SkipNullMembers"))) -            , FlatMap(env.InternName(TStringBuf("FlatMap"))) -            , Map(env.InternName(TStringBuf("Map"))) -            , Member(env.InternName(TStringBuf("Member"))) -            , ToHashedDict(env.InternName(TStringBuf("ToHashedDict"))) -            , DictItems(env.InternName(TStringBuf("DictItems"))) -            , Take(env.InternName(TStringBuf("Take"))) -            , Length(env.InternName(TStringBuf("Length"))) -            , Arg(env.InternName(TStringBuf("Arg"))) +            : Filter(env.InternName(TStringBuf("Filter")))  +            , FilterNullMembers(env.InternName(TStringBuf("FilterNullMembers")))  +            , SkipNullMembers(env.InternName(TStringBuf("SkipNullMembers")))  +            , FlatMap(env.InternName(TStringBuf("FlatMap")))  +            , Map(env.InternName(TStringBuf("Map")))  +            , Member(env.InternName(TStringBuf("Member")))  +            , ToHashedDict(env.InternName(TStringBuf("ToHashedDict")))  +            , DictItems(env.InternName(TStringBuf("DictItems")))  +            , Take(env.InternName(TStringBuf("Take")))  +            , Length(env.InternName(TStringBuf("Length")))  +            , Arg(env.InternName(TStringBuf("Arg")))           {              All.reserve(20);              All.insert(Filter); @@ -53,14 +53,14 @@ namespace NMiniKQL {          TFlatEngineStrings(const TTypeEnvironment& env)              : TTableStrings(env)              , Builtins(env) -            , SetResult(env.InternName(TStringBuf("SetResult"))) -            , Abort(env.InternName(TStringBuf("Abort"))) -            , StepTxId(env.InternName(TStringBuf("StepTxId"))) -            , AcquireLocks(env.InternName(TStringBuf("AcquireLocks"))) -            , CombineByKeyMerge(env.InternName(TStringBuf("CombineByKeyMerge"))) -            , Diagnostics(env.InternName(TStringBuf("Diagnostics"))) -            , PartialTake(env.InternName(TStringBuf("PartialTake"))) -            , PartialSort(env.InternName(TStringBuf("PartialSort"))) +            , SetResult(env.InternName(TStringBuf("SetResult")))  +            , Abort(env.InternName(TStringBuf("Abort")))  +            , StepTxId(env.InternName(TStringBuf("StepTxId")))  +            , AcquireLocks(env.InternName(TStringBuf("AcquireLocks")))  +            , CombineByKeyMerge(env.InternName(TStringBuf("CombineByKeyMerge")))  +            , Diagnostics(env.InternName(TStringBuf("Diagnostics")))  +            , PartialTake(env.InternName(TStringBuf("PartialTake")))  +            , PartialSort(env.InternName(TStringBuf("PartialSort")))           {              All.insert(SetResult);              All.insert(Abort); diff --git a/ydb/core/engine/mkql_keys.h b/ydb/core/engine/mkql_keys.h index 635ad3ce147..d4333cf70f2 100644 --- a/ydb/core/engine/mkql_keys.h +++ b/ydb/core/engine/mkql_keys.h @@ -17,10 +17,10 @@ TReadTarget ExtractFlatReadTarget(TRuntimeNode modeInput);  struct TTableStrings {      TTableStrings(const TTypeEnvironment& env) -        : SelectRow(env.InternName(TStringBuf("SelectRow"))) -        , SelectRange(env.InternName(TStringBuf("SelectRange"))) -        , UpdateRow(env.InternName(TStringBuf("UpdateRow"))) -        , EraseRow(env.InternName(TStringBuf("EraseRow"))) +        : SelectRow(env.InternName(TStringBuf("SelectRow")))  +        , SelectRange(env.InternName(TStringBuf("SelectRange")))  +        , UpdateRow(env.InternName(TStringBuf("UpdateRow")))  +        , EraseRow(env.InternName(TStringBuf("EraseRow")))       {          All.reserve(10);          All.insert(SelectRow); diff --git a/ydb/core/engine/mkql_proto_ut.cpp b/ydb/core/engine/mkql_proto_ut.cpp index c6e00e947c5..77831bab7d0 100644 --- a/ydb/core/engine/mkql_proto_ut.cpp +++ b/ydb/core/engine/mkql_proto_ut.cpp @@ -11,8 +11,8 @@  #include <google/protobuf/text_format.h>  #include <library/cpp/testing/unittest/registar.h> -using namespace std::string_view_literals; - +using namespace std::string_view_literals;  +   namespace NKikimr {  namespace NMiniKQL { @@ -49,7 +49,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProtoTestYdb) {      Y_UNIT_TEST(TestExportUuidTypeYdb) {          TestExportType<Ydb::Type>([](TProgramBuilder& pgmBuilder) { -            auto pgmReturn = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::Uuid>("\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"sv); +            auto pgmReturn = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::Uuid>("\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"sv);               return pgmReturn;          },          "type_id: UUID\n"); @@ -187,8 +187,8 @@ Y_UNIT_TEST(TestExportVariantStructTypeYdb) {          TestExportType<Ydb::Type>([](TProgramBuilder& pgmBuilder) {              std::vector<std::pair<std::string_view, TType*>> structElemenTypes; -            structElemenTypes.push_back({"a", pgmBuilder.NewDataType(NUdf::TDataType<ui64>::Id)}); -            structElemenTypes.push_back({"b", pgmBuilder.NewDataType(NUdf::TDataType<ui32>::Id)}); +            structElemenTypes.push_back({"a", pgmBuilder.NewDataType(NUdf::TDataType<ui64>::Id)});  +            structElemenTypes.push_back({"b", pgmBuilder.NewDataType(NUdf::TDataType<ui32>::Id)});               TType* structType = pgmBuilder.NewStructType(structElemenTypes);              auto pgmReturn = pgmBuilder.NewVariant(                  pgmBuilder.NewDataLiteral<ui32>(66), @@ -236,7 +236,7 @@ Y_UNIT_TEST(TestExportVariantStructTypeYdb) {      Y_UNIT_TEST(TestExportUuidYdb) {          TestExportValue<Ydb::Value>([](TProgramBuilder& pgmBuilder) { -            auto pgmReturn = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::Uuid>("\1\0\0\0\0\0\0\0\2\0\0\0\0\0\0\0"sv); +            auto pgmReturn = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::Uuid>("\1\0\0\0\0\0\0\0\2\0\0\0\0\0\0\0"sv);               return pgmReturn;          }, "low_128: 1\n"             "high_128: 2\n"); diff --git a/ydb/core/grpc_services/rpc_kh_snapshots.cpp b/ydb/core/grpc_services/rpc_kh_snapshots.cpp index c390c81faeb..d9824baf806 100644 --- a/ydb/core/grpc_services/rpc_kh_snapshots.cpp +++ b/ydb/core/grpc_services/rpc_kh_snapshots.cpp @@ -17,7 +17,7 @@ namespace NGRpcService {  //////////////////////////////////////////////////////////////////////////////// -static constexpr TStringBuf SnapshotUriPrefix = "snapshot:///"; +static constexpr TStringBuf SnapshotUriPrefix = "snapshot:///";   static constexpr ui64 SNAPSHOT_TIMEOUT_MS = 30000;  static constexpr ui64 REQUEST_TIMEOUT_MS = 5000; diff --git a/ydb/core/kqp/common/kqp_yql.h b/ydb/core/kqp/common/kqp_yql.h index 7de6cffe397..d633504570b 100644 --- a/ydb/core/kqp/common/kqp_yql.h +++ b/ydb/core/kqp/common/kqp_yql.h @@ -30,7 +30,7 @@ enum class EPhysicalTxType {  };  struct TKqpPhyTxSettings { -    static constexpr TStringBuf TypeSettingName = "type"; +    static constexpr TStringBuf TypeSettingName = "type";       std::optional<EPhysicalTxType> Type;      static constexpr std::string_view WithEffectsSettingName = "with_effects"sv; @@ -41,7 +41,7 @@ struct TKqpPhyTxSettings {  };  struct TKqpReadTableSettings { -    static constexpr TStringBuf SkipNullKeysSettingName = "SkipNullKeys"; +    static constexpr TStringBuf SkipNullKeysSettingName = "SkipNullKeys";       static constexpr TStringBuf ItemsLimitSettingName = "ItemsLimit";      static constexpr TStringBuf ReverseSettingName = "Reverse"; diff --git a/ydb/core/kqp/host/kqp_host.cpp b/ydb/core/kqp/host/kqp_host.cpp index 44af6d11682..88cefa2692c 100644 --- a/ydb/core/kqp/host/kqp_host.cpp +++ b/ydb/core/kqp/host/kqp_host.cpp @@ -380,9 +380,9 @@ public:          TStringBuilder builder; -        if (evaluateNode->Content() == "EvaluateAtom"sv) +        if (evaluateNode->Content() == "EvaluateAtom"sv)               builder << "ATOM evaluation"; -        else if (evaluateNode->Content() == "EvaluateIf!"sv) +        else if (evaluateNode->Content() == "EvaluateIf!"sv)               builder << "EVALUATE IF";          else              builder << "EVALUATE"; diff --git a/ydb/core/kqp/kqp.h b/ydb/core/kqp/kqp.h index 09f794591d3..6c614148b77 100644 --- a/ydb/core/kqp/kqp.h +++ b/ydb/core/kqp/kqp.h @@ -15,8 +15,8 @@  namespace NKikimr {  namespace NKqp { -const TStringBuf DefaultKikimrClusterName = "kikimr"; -const TStringBuf DefaultKikimrPublicClusterName = "db"; +const TStringBuf DefaultKikimrClusterName = "kikimr";  +const TStringBuf DefaultKikimrPublicClusterName = "db";   inline NActors::TActorId MakeKqpProxyID(ui32 nodeId) {      const char name[12] = "kqp_proxy"; diff --git a/ydb/core/kqp/prepare/kqp_type_ann.cpp b/ydb/core/kqp/prepare/kqp_type_ann.cpp index ee51c7349c2..7bfc22f73be 100644 --- a/ydb/core/kqp/prepare/kqp_type_ann.cpp +++ b/ydb/core/kqp/prepare/kqp_type_ann.cpp @@ -573,7 +573,7 @@ TStatus AnnotateInsertRows(const TExprNode::TPtr& node, TExprContext& ctx, const      }      TStringBuf onConflict = node->Child(TKqlInsertRows::idx_OnConflict)->Content(); -    if (onConflict != "abort"sv && onConflict != "revert"sv) { +    if (onConflict != "abort"sv && onConflict != "revert"sv) {           ctx.AddError(TIssue(ctx.GetPosition(node->Pos()), TStringBuilder()              << "Unsupported insert on-conflict policy `" << onConflict << "`."));          return TStatus::Error; diff --git a/ydb/core/kqp/provider/yql_kikimr_exec.cpp b/ydb/core/kqp/provider/yql_kikimr_exec.cpp index ad360fcaebe..69c85a5c7b8 100644 --- a/ydb/core/kqp/provider/yql_kikimr_exec.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_exec.cpp @@ -263,7 +263,7 @@ public:              auto configure = TCoConfigure(input);              auto clusterName = TString(configure.DataSource().Arg(1).Cast<TCoAtom>().Value()); -            if (configure.Arg(2).Cast<TCoAtom>().Value() == TStringBuf("Attr")) { +            if (configure.Arg(2).Cast<TCoAtom>().Value() == TStringBuf("Attr")) {                   auto name = TString(configure.Arg(3).Cast<TCoAtom>().Value());                  TMaybe<TString> value;                  if (configure.Args().Count() == 5) { diff --git a/ydb/core/kqp/provider/yql_kikimr_opt_join.cpp b/ydb/core/kqp/provider/yql_kikimr_opt_join.cpp index 662082c5432..db42ef1bbc8 100644 --- a/ydb/core/kqp/provider/yql_kikimr_opt_join.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_opt_join.cpp @@ -756,20 +756,20 @@ TExprBase GetEquiJoinTreeExpr(const TExprBase& joinScope, const TVector<TCoEquiJ  }  TMaybe<TStringBuf> TryFlipJoinType(TStringBuf joinType) { -    if (joinType == TStringBuf("Inner")) { -        return TStringBuf("Inner"); +    if (joinType == TStringBuf("Inner")) {  +        return TStringBuf("Inner");       } -    if (joinType == TStringBuf("LeftSemi")) { -        return TStringBuf("RightSemi"); +    if (joinType == TStringBuf("LeftSemi")) {  +        return TStringBuf("RightSemi");       } -    if (joinType == TStringBuf("RightSemi")) { -        return TStringBuf("LeftSemi"); +    if (joinType == TStringBuf("RightSemi")) {  +        return TStringBuf("LeftSemi");       } -    if (joinType == TStringBuf("Right")) { -        return TStringBuf("Left"); +    if (joinType == TStringBuf("Right")) {  +        return TStringBuf("Left");       } -    if (joinType == TStringBuf("RightOnly")) { -        return TStringBuf("LeftOnly"); +    if (joinType == TStringBuf("RightOnly")) {  +        return TStringBuf("LeftOnly");       }      return Nothing();  } @@ -809,7 +809,7 @@ bool RewriteEquiJoinInternal(const TCoEquiJoinTuple& joinTree, const TVector<TCo              return true;          } -        bool tryFlip = joinTree.Type().Value() == TStringBuf("LeftSemi") +        bool tryFlip = joinTree.Type().Value() == TStringBuf("LeftSemi")               ? !config.HasOptDisableJoinReverseTableLookupLeftSemi()              : !config.HasOptDisableJoinReverseTableLookup(); diff --git a/ydb/core/kqp/provider/yql_kikimr_provider.cpp b/ydb/core/kqp/provider/yql_kikimr_provider.cpp index 635d1648279..bb53f805461 100644 --- a/ydb/core/kqp/provider/yql_kikimr_provider.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_provider.cpp @@ -13,9 +13,9 @@ using namespace NNodes;  namespace { -const TStringBuf CommitModeFlush = "flush"; -const TStringBuf CommitModeRollback = "rollback"; -const TStringBuf CommitModeScheme = "scheme"; +const TStringBuf CommitModeFlush = "flush";  +const TStringBuf CommitModeRollback = "rollback";  +const TStringBuf CommitModeScheme = "scheme";   struct TKikimrData {      THashSet<TStringBuf> DataSourceNames; @@ -234,40 +234,40 @@ void TKikimrTableDescription::ToYson(NYson::TYsonWriter& writer) const {      auto& meta = *Metadata;      writer.OnBeginMap(); -    writer.OnKeyedItem(TStringBuf("Cluster")); +    writer.OnKeyedItem(TStringBuf("Cluster"));       writer.OnStringScalar(meta.Cluster); -    writer.OnKeyedItem(TStringBuf("Name")); +    writer.OnKeyedItem(TStringBuf("Name"));       writer.OnStringScalar(meta.Name); -    writer.OnKeyedItem(TStringBuf("Id")); +    writer.OnKeyedItem(TStringBuf("Id"));       writer.OnStringScalar(meta.PathId.ToString()); -    writer.OnKeyedItem(TStringBuf("DoesExist")); +    writer.OnKeyedItem(TStringBuf("DoesExist"));       writer.OnBooleanScalar(DoesExist()); -    writer.OnKeyedItem(TStringBuf("IsSorted")); +    writer.OnKeyedItem(TStringBuf("IsSorted"));       writer.OnBooleanScalar(true); -    writer.OnKeyedItem(TStringBuf("IsDynamic")); +    writer.OnKeyedItem(TStringBuf("IsDynamic"));       writer.OnBooleanScalar(true); -    writer.OnKeyedItem(TStringBuf("UniqueKeys")); +    writer.OnKeyedItem(TStringBuf("UniqueKeys"));       writer.OnBooleanScalar(true); -    writer.OnKeyedItem(TStringBuf("CanWrite")); +    writer.OnKeyedItem(TStringBuf("CanWrite"));       writer.OnBooleanScalar(true); -    writer.OnKeyedItem(TStringBuf("IsRealData")); +    writer.OnKeyedItem(TStringBuf("IsRealData"));       writer.OnBooleanScalar(true); -    writer.OnKeyedItem(TStringBuf("YqlCompatibleSchema")); +    writer.OnKeyedItem(TStringBuf("YqlCompatibleSchema"));       writer.OnBooleanScalar(true); -    writer.OnKeyedItem(TStringBuf("RecordsCount")); +    writer.OnKeyedItem(TStringBuf("RecordsCount"));       writer.OnInt64Scalar(meta.RecordsCount); -    writer.OnKeyedItem(TStringBuf("DataSize")); +    writer.OnKeyedItem(TStringBuf("DataSize"));       writer.OnInt64Scalar(meta.DataSize); -    writer.OnKeyedItem(TStringBuf("MemorySize")); +    writer.OnKeyedItem(TStringBuf("MemorySize"));       writer.OnInt64Scalar(meta.MemorySize); -    writer.OnKeyedItem(TStringBuf("ChunkCount")); +    writer.OnKeyedItem(TStringBuf("ChunkCount"));       writer.OnInt64Scalar(meta.ShardsCount); -    writer.OnKeyedItem(TStringBuf("AccessTime")); +    writer.OnKeyedItem(TStringBuf("AccessTime"));       writer.OnInt64Scalar(meta.LastAccessTime.Seconds()); -    writer.OnKeyedItem(TStringBuf("ModifyTime")); +    writer.OnKeyedItem(TStringBuf("ModifyTime"));       writer.OnInt64Scalar(meta.LastUpdateTime.Seconds());      writer.OnKeyedItem("Fields"); @@ -358,7 +358,7 @@ bool TKikimrKey::Extract(const TExprNode& key) {      if (key.ChildrenSize() > 1) {          for (ui32 i = 1; i < key.ChildrenSize(); ++i) {              auto tag = key.Child(i)->Child(0); -            if (tag->Content() == TStringBuf("view")) { +            if (tag->Content() == TStringBuf("view")) {                   const TExprNode* viewNode = key.Child(i)->Child(1);                  if (!viewNode->IsCallable("String")) {                      Ctx.AddError(TIssue(Ctx.GetPosition(viewNode->Pos()), "Expected String")); diff --git a/ydb/core/kqp/provider/yql_kikimr_provider.h b/ydb/core/kqp/provider/yql_kikimr_provider.h index 6903e6f1932..c5d3f2bafb6 100644 --- a/ydb/core/kqp/provider/yql_kikimr_provider.h +++ b/ydb/core/kqp/provider/yql_kikimr_provider.h @@ -16,7 +16,7 @@  namespace NYql { -const TStringBuf KikimrMkqlProtoFormat = "mkql_proto"; +const TStringBuf KikimrMkqlProtoFormat = "mkql_proto";   class IKikimrRemoteGateway; diff --git a/ydb/core/metering/metering.h b/ydb/core/metering/metering.h index 6e17fcadf12..a94326b2774 100644 --- a/ydb/core/metering/metering.h +++ b/ydb/core/metering/metering.h @@ -51,7 +51,7 @@ struct TEvMetering  void SendMeteringJson(const NActors::TActorContext& ctx, TString message);  inline NActors::TActorId MakeMeteringServiceID() { -    return NActors::TActorId(0, TStringBuf("YDB_METER")); +    return NActors::TActorId(0, TStringBuf("YDB_METER"));   }  THolder<NActors::IActor> CreateMeteringWriter( diff --git a/ydb/core/sys_view/common/path.h b/ydb/core/sys_view/common/path.h index 5f17df91a4b..9a94a29c4b4 100644 --- a/ydb/core/sys_view/common/path.h +++ b/ydb/core/sys_view/common/path.h @@ -5,7 +5,7 @@  namespace NKikimr {  namespace NSysView { -constexpr TStringBuf SysPathName = ".sys"; +constexpr TStringBuf SysPathName = ".sys";   } // NSysView  } // NKikimr diff --git a/ydb/core/sys_view/common/schema.h b/ydb/core/sys_view/common/schema.h index f7a4f191e13..6b88639dc24 100644 --- a/ydb/core/sys_view/common/schema.h +++ b/ydb/core/sys_view/common/schema.h @@ -8,27 +8,27 @@  namespace NKikimr {  namespace NSysView { -constexpr TStringBuf PartitionStatsName = "partition_stats"; -constexpr TStringBuf NodesName = "nodes"; - -constexpr TStringBuf TopQueriesByDuration1MinuteName = "top_queries_by_duration_one_minute"; -constexpr TStringBuf TopQueriesByDuration1HourName = "top_queries_by_duration_one_hour"; -constexpr TStringBuf TopQueriesByReadBytes1MinuteName = "top_queries_by_read_bytes_one_minute"; -constexpr TStringBuf TopQueriesByReadBytes1HourName = "top_queries_by_read_bytes_one_hour"; -constexpr TStringBuf TopQueriesByCpuTime1MinuteName = "top_queries_by_cpu_time_one_minute"; -constexpr TStringBuf TopQueriesByCpuTime1HourName = "top_queries_by_cpu_time_one_hour"; +constexpr TStringBuf PartitionStatsName = "partition_stats";  +constexpr TStringBuf NodesName = "nodes";  + +constexpr TStringBuf TopQueriesByDuration1MinuteName = "top_queries_by_duration_one_minute";  +constexpr TStringBuf TopQueriesByDuration1HourName = "top_queries_by_duration_one_hour";  +constexpr TStringBuf TopQueriesByReadBytes1MinuteName = "top_queries_by_read_bytes_one_minute";  +constexpr TStringBuf TopQueriesByReadBytes1HourName = "top_queries_by_read_bytes_one_hour";  +constexpr TStringBuf TopQueriesByCpuTime1MinuteName = "top_queries_by_cpu_time_one_minute";  +constexpr TStringBuf TopQueriesByCpuTime1HourName = "top_queries_by_cpu_time_one_hour";   constexpr TStringBuf TopQueriesByRequestUnits1MinuteName = "top_queries_by_request_units_one_minute";  constexpr TStringBuf TopQueriesByRequestUnits1HourName = "top_queries_by_request_units_one_hour"; -constexpr TStringBuf PDisksName = "ds_pdisks"; -constexpr TStringBuf VSlotsName = "ds_vslots"; -constexpr TStringBuf GroupsName = "ds_groups"; -constexpr TStringBuf StoragePoolsName = "ds_storage_pools"; +constexpr TStringBuf PDisksName = "ds_pdisks";  +constexpr TStringBuf VSlotsName = "ds_vslots";  +constexpr TStringBuf GroupsName = "ds_groups";  +constexpr TStringBuf StoragePoolsName = "ds_storage_pools";   constexpr TStringBuf StorageStatsName = "ds_storage_stats"; -constexpr TStringBuf TabletsName = "hive_tablets"; +constexpr TStringBuf TabletsName = "hive_tablets";  -constexpr TStringBuf QueryMetricsName = "query_metrics_one_minute"; +constexpr TStringBuf QueryMetricsName = "query_metrics_one_minute";   constexpr TStringBuf StorePrimaryIndexStatsName = "store_primary_index_stats";  constexpr TStringBuf TablePrimaryIndexStatsName = "primary_index_stats"; diff --git a/ydb/core/tablet_flat/ut/ut_sausage.cpp b/ydb/core/tablet_flat/ut/ut_sausage.cpp index 9fed2caacc8..e2562c66913 100644 --- a/ydb/core/tablet_flat/ut/ut_sausage.cpp +++ b/ydb/core/tablet_flat/ut/ut_sausage.cpp @@ -114,17 +114,17 @@ Y_UNIT_TEST_SUITE(NPageCollection) {          TWriter writer(cookieAllocator, 1 /* channel */, 8192 * 1024);          const auto r1 = writer.AddPage(chunk1, 1); -        writer.AddInplace(r1, TStringBuf("chunk 1")); +        writer.AddInplace(r1, TStringBuf("chunk 1"));           UNIT_ASSERT(r1 == 0 && checkGlobs(writer.Grab()) == 0);          const auto r2 = writer.AddPage(chunk2, 2); -        writer.AddInplace(r2, TStringBuf("chunk 2")); +        writer.AddInplace(r2, TStringBuf("chunk 2"));           UNIT_ASSERT(r2 == 1 && checkGlobs(writer.Grab()) == 2);          const auto r3 = writer.AddPage(chunk3, 3); -        writer.AddInplace(r3, TStringBuf("chunk 3")); +        writer.AddInplace(r3, TStringBuf("chunk 3"));           UNIT_ASSERT(r3 == 2 && checkGlobs(writer.Grab()) == 1); diff --git a/ydb/core/tx/datashard/check_scheme_tx_unit.cpp b/ydb/core/tx/datashard/check_scheme_tx_unit.cpp index bbba1c6d95d..bcb2d6dcd55 100644 --- a/ydb/core/tx/datashard/check_scheme_tx_unit.cpp +++ b/ydb/core/tx/datashard/check_scheme_tx_unit.cpp @@ -416,7 +416,7 @@ bool TCheckSchemeTxUnit::CheckAlter(TActiveTransaction *activeTx)      const NKikimrTxDataShard::TFlatSchemeTransaction &tx = activeTx->GetSchemeTx();      Y_VERIFY(!Pipeline.HasDrop()); -    const TStringBuf kind = "Alter"; +    const TStringBuf kind = "Alter";       if (HasDuplicate(activeTx, kind, &TPipeline::HasAlter)) {          return false;      } @@ -520,7 +520,7 @@ bool TCheckSchemeTxUnit::CheckBackup(TActiveTransaction *activeTx)      const NKikimrTxDataShard::TFlatSchemeTransaction &tx = activeTx->GetSchemeTx();      Y_VERIFY(!Pipeline.HasDrop()); -    const TStringBuf kind = "Backup"; +    const TStringBuf kind = "Backup";       if (HasDuplicate(activeTx, kind, &TPipeline::HasBackup)) {          return false;      } @@ -544,7 +544,7 @@ bool TCheckSchemeTxUnit::CheckRestore(TActiveTransaction *activeTx)      const NKikimrTxDataShard::TFlatSchemeTransaction &tx = activeTx->GetSchemeTx();      Y_VERIFY(!Pipeline.HasDrop()); -    const TStringBuf kind = "Restore"; +    const TStringBuf kind = "Restore";       if (HasDuplicate(activeTx, kind, &TPipeline::HasRestore)) {          return false;      } diff --git a/ydb/core/tx/datashard/datashard_distributed_erase.cpp b/ydb/core/tx/datashard/datashard_distributed_erase.cpp index fae7d2edeb3..911922f3822 100644 --- a/ydb/core/tx/datashard/datashard_distributed_erase.cpp +++ b/ydb/core/tx/datashard/datashard_distributed_erase.cpp @@ -358,7 +358,7 @@ class TDistEraser: public TActorBootstrapped<TDistEraser> {      void Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr& ev) {          const auto& request = ev->Get()->Request; -        const TStringBuf marker = "ResolveTables"; +        const TStringBuf marker = "ResolveTables";           LOG_D("Handle TEvTxProxySchemeCache::TEvNavigateKeySetResult"              << ": request# " << (request ? request->ToString(*AppData()->TypeRegistry) : "nullptr")); @@ -522,7 +522,7 @@ class TDistEraser: public TActorBootstrapped<TDistEraser> {          }          const auto& request = ev->Get()->Request; -        const TStringBuf marker = "ResolveKeys"; +        const TStringBuf marker = "ResolveKeys";           LOG_D("Handle TEvTxProxySchemeCache::TEvResolveKeySetResult"              << ": request# " << (request ? request->ToString(*AppData()->TypeRegistry) : "nullptr")); @@ -833,30 +833,30 @@ class TDistEraser: public TActorBootstrapped<TDistEraser> {              case NKikimrTxDataShard::TEvProposeTransactionResult::ERROR:                  CancelProposal(shardId);                  Mon->TxResultError->Inc(); -                return error(TEvResponse::SHARD_NOT_AVAILABLE, TStringBuf("Not available")); +                return error(TEvResponse::SHARD_NOT_AVAILABLE, TStringBuf("Not available"));               case NKikimrTxDataShard::TEvProposeTransactionResult::ABORTED:                  Mon->TxResultAborted->Inc(); -                return error(TEvResponse::SHARD_ABORTED, TStringBuf("Aborted")); +                return error(TEvResponse::SHARD_ABORTED, TStringBuf("Aborted"));               case NKikimrTxDataShard::TEvProposeTransactionResult::TRY_LATER:                  CancelProposal(shardId);                  Mon->TxResultShardTryLater->Inc(); -                return error(TEvResponse::SHARD_TRY_LATER, TStringBuf("Try later")); +                return error(TEvResponse::SHARD_TRY_LATER, TStringBuf("Try later"));               case NKikimrTxDataShard::TEvProposeTransactionResult::OVERLOADED:                  CancelProposal(shardId);                  Mon->TxResultShardOverloaded->Inc(); -                return error(TEvResponse::SHARD_OVERLOADED, TStringBuf("Overloaded")); +                return error(TEvResponse::SHARD_OVERLOADED, TStringBuf("Overloaded"));               case NKikimrTxDataShard::TEvProposeTransactionResult::EXEC_ERROR:                  Mon->TxResultExecError->Inc(); -                return error(TEvResponse::SHARD_EXEC_ERROR, TStringBuf("Execution error")); +                return error(TEvResponse::SHARD_EXEC_ERROR, TStringBuf("Execution error"));               case NKikimrTxDataShard::TEvProposeTransactionResult::RESULT_UNAVAILABLE:                  Mon->TxResultResultUnavailable->Inc(); -                return error(TEvResponse::SHARD_RESULT_UNAVAILABLE, TStringBuf("Result unavailable")); +                return error(TEvResponse::SHARD_RESULT_UNAVAILABLE, TStringBuf("Result unavailable"));               case NKikimrTxDataShard::TEvProposeTransactionResult::CANCELLED:                  Mon->TxResultCancelled->Inc(); -                return error(TEvResponse::SHARD_CANCELLED, TStringBuf("Cancelled")); +                return error(TEvResponse::SHARD_CANCELLED, TStringBuf("Cancelled"));               case NKikimrTxDataShard::TEvProposeTransactionResult::BAD_REQUEST:                  Mon->TxResultCancelled->Inc(); -                return error(TEvResponse::SHARD_CANCELLED, TStringBuf("Bad request")); +                return error(TEvResponse::SHARD_CANCELLED, TStringBuf("Bad request"));               default:                  CancelProposal();                  Mon->TxResultFatal->Inc(); @@ -997,16 +997,16 @@ class TDistEraser: public TActorBootstrapped<TDistEraser> {              }              case NKikimrTxDataShard::TEvProposeTransactionResult::ABORTED:                  Mon->PlanClientTxResultAborted->Inc(); -                return error(TEvResponse::SHARD_ABORTED, TStringBuf("Aborted")); +                return error(TEvResponse::SHARD_ABORTED, TStringBuf("Aborted"));               case NKikimrTxDataShard::TEvProposeTransactionResult::RESULT_UNAVAILABLE:                  Mon->PlanClientTxResultResultUnavailable->Inc(); -                return error(TEvResponse::SHARD_RESULT_UNAVAILABLE, TStringBuf("Result unavailable")); +                return error(TEvResponse::SHARD_RESULT_UNAVAILABLE, TStringBuf("Result unavailable"));               case NKikimrTxDataShard::TEvProposeTransactionResult::CANCELLED:                  Mon->PlanClientTxResultCancelled->Inc(); -                return error(TEvResponse::SHARD_CANCELLED, TStringBuf("Cancelled")); +                return error(TEvResponse::SHARD_CANCELLED, TStringBuf("Cancelled"));               default:                  Mon->PlanClientTxResultExecError->Inc(); -                return error(TEvResponse::SHARD_EXEC_ERROR, TStringBuf("Unexpected status")); +                return error(TEvResponse::SHARD_EXEC_ERROR, TStringBuf("Unexpected status"));           }      } diff --git a/ydb/core/tx/datashard/datashard_pipeline.cpp b/ydb/core/tx/datashard/datashard_pipeline.cpp index 3498162c17e..d2bc35c43e2 100644 --- a/ydb/core/tx/datashard/datashard_pipeline.cpp +++ b/ydb/core/tx/datashard/datashard_pipeline.cpp @@ -1165,7 +1165,7 @@ TOperation::TPtr TPipeline::BuildOperation(TEvDataShard::TEvProposeTransaction::          tx->SetProcessingParams(rec.GetProcessingParams());          if (!tx->BuildSchemeTx()) { -            malformed(TStringBuf("scheme"), tx->GetSchemeTx().ShortDebugString()); +            malformed(TStringBuf("scheme"), tx->GetSchemeTx().ShortDebugString());               return tx;          } @@ -1180,7 +1180,7 @@ TOperation::TPtr TPipeline::BuildOperation(TEvDataShard::TEvProposeTransaction::          }      } else if (tx->IsSnapshotTx()) {          if (!tx->BuildSnapshotTx()) { -            malformed(TStringBuf("snapshot"), tx->GetSnapshotTx().ShortDebugString()); +            malformed(TStringBuf("snapshot"), tx->GetSnapshotTx().ShortDebugString());               return tx;          } @@ -1195,7 +1195,7 @@ TOperation::TPtr TPipeline::BuildOperation(TEvDataShard::TEvProposeTransaction::          }      } else if (tx->IsDistributedEraseTx()) {          if (!tx->BuildDistributedEraseTx()) { -            malformed(TStringBuf("distributed erase"), tx->GetDistributedEraseTx()->GetBody().ShortDebugString()); +            malformed(TStringBuf("distributed erase"), tx->GetDistributedEraseTx()->GetBody().ShortDebugString());               return tx;          } diff --git a/ydb/core/tx/datashard/datashard_ut_kqp.cpp b/ydb/core/tx/datashard/datashard_ut_kqp.cpp index d3145951a4e..e0744ec6f31 100644 --- a/ydb/core/tx/datashard/datashard_ut_kqp.cpp +++ b/ydb/core/tx/datashard/datashard_ut_kqp.cpp @@ -57,7 +57,7 @@ public:      void BeforeTest(const char* test) {          Cerr << "-- Before test " << test << Endl;          AppCfg.MutableTableServiceConfig()->MutableResourceManager()->SetChannelBufferSize(1); -        if (test == "AbortOnDisconnect"sv) { +        if (test == "AbortOnDisconnect"sv) {               AppCfg.MutableTableServiceConfig()->MutableResourceManager()->SetScanBufferSize(1);          }          TTestBase::BeforeTest(test); diff --git a/ydb/core/tx/datashard/export_s3_base_uploader.h b/ydb/core/tx/datashard/export_s3_base_uploader.h index 8c72a8c3936..99b91561713 100644 --- a/ydb/core/tx/datashard/export_s3_base_uploader.h +++ b/ydb/core/tx/datashard/export_s3_base_uploader.h @@ -92,7 +92,7 @@ protected:              << ": self# " << this->SelfId()              << ", result# " << result); -        if (!CheckResult(result, TStringBuf("PutObject (scheme)"))) { +        if (!CheckResult(result, TStringBuf("PutObject (scheme)"))) {               return;          } @@ -171,7 +171,7 @@ protected:              << ": self# " << this->SelfId()              << ", result# " << result); -        if (!CheckResult(result, TStringBuf("PutObject (data)"))) { +        if (!CheckResult(result, TStringBuf("PutObject (data)"))) {               return;          } @@ -241,7 +241,7 @@ protected:              << ": self# " << this->SelfId()              << ", result# " << result); -        if (!CheckResult(result, TStringBuf("CreateMultipartUpload"))) { +        if (!CheckResult(result, TStringBuf("CreateMultipartUpload"))) {               return;          } @@ -255,7 +255,7 @@ protected:              << ": self# " << this->SelfId()              << ", result# " << result); -        if (!CheckResult(result, TStringBuf("UploadPart"))) { +        if (!CheckResult(result, TStringBuf("UploadPart"))) {               return;          } @@ -371,7 +371,7 @@ public:      }      static constexpr TStringBuf LogPrefix() { -        return "s3"sv; +        return "s3"sv;       }      explicit TS3UploaderBase( diff --git a/ydb/core/tx/datashard/export_scan.cpp b/ydb/core/tx/datashard/export_scan.cpp index 2cda75fdd07..ce498aa6bc5 100644 --- a/ydb/core/tx/datashard/export_scan.cpp +++ b/ydb/core/tx/datashard/export_scan.cpp @@ -147,7 +147,7 @@ class TExportScan: private NActors::IActor, public NTable::IScan {  public:      static constexpr TStringBuf LogPrefix() { -        return "scanner"sv; +        return "scanner"sv;       }      explicit TExportScan(std::function<IActor*()>&& createUploaderFn, IBuffer::TPtr buffer) diff --git a/ydb/core/tx/datashard/import_s3.cpp b/ydb/core/tx/datashard/import_s3.cpp index 9ea7fbab5c0..7cca6a2bc02 100644 --- a/ydb/core/tx/datashard/import_s3.cpp +++ b/ydb/core/tx/datashard/import_s3.cpp @@ -198,7 +198,7 @@ class TS3Downloader: public TActorBootstrapped<TS3Downloader>, private TS3User {              << ": self# " << SelfId()              << ", result# " << result); -        if (!CheckResult(result, TStringBuf("HeadObject"))) { +        if (!CheckResult(result, TStringBuf("HeadObject"))) {               return;          } @@ -221,7 +221,7 @@ class TS3Downloader: public TActorBootstrapped<TS3Downloader>, private TS3User {              return;          } -        if (!CheckETag(*info.DataETag, ETag, TStringBuf("DownloadInfo"))) { +        if (!CheckETag(*info.DataETag, ETag, TStringBuf("DownloadInfo"))) {               return;          } diff --git a/ydb/core/tx/long_tx_service/public/events.h b/ydb/core/tx/long_tx_service/public/events.h index e053c1c8571..ee2fe7efbad 100644 --- a/ydb/core/tx/long_tx_service/public/events.h +++ b/ydb/core/tx/long_tx_service/public/events.h @@ -10,7 +10,7 @@ namespace NKikimr {  namespace NLongTxService {      inline TActorId MakeLongTxServiceID(ui32 nodeId) { -        return TActorId(nodeId, TStringBuf("long_tx_svc")); +        return TActorId(nodeId, TStringBuf("long_tx_svc"));       }      struct TEvLongTxService { diff --git a/ydb/core/tx/scheme_board/cache.cpp b/ydb/core/tx/scheme_board/cache.cpp index 8e778a4a1d8..9528350b116 100644 --- a/ydb/core/tx/scheme_board/cache.cpp +++ b/ydb/core/tx/scheme_board/cache.cpp @@ -1965,11 +1965,11 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {      };      static EPathType PathType(const TStringBuf path) { -        if (path == "/sys"sv) { +        if (path == "/sys"sv) {               return EPathType::SysPath; -        } else if (path == "/sys/locks"sv) { +        } else if (path == "/sys/locks"sv) {               return EPathType::SysLocksV1; -        } else if (path == "/sys/locks2"sv) { +        } else if (path == "/sys/locks2"sv) {               return EPathType::SysLocksV2;          } diff --git a/ydb/core/tx/scheme_board/subscriber.cpp b/ydb/core/tx/scheme_board/subscriber.cpp index 97173d81ad5..7c349c748e8 100644 --- a/ydb/core/tx/scheme_board/subscriber.cpp +++ b/ydb/core/tx/scheme_board/subscriber.cpp @@ -364,7 +364,7 @@ public:      }      static constexpr TStringBuf LogPrefix() { -        return "replica"sv; +        return "replica"sv;       }      explicit TReplicaSubscriber( @@ -512,7 +512,7 @@ public:      }      static constexpr TStringBuf LogPrefix() { -        return "proxy"sv; +        return "proxy"sv;       }      explicit TSubscriberProxy( @@ -920,7 +920,7 @@ public:      }      static constexpr TStringBuf LogPrefix() { -        return "main"sv; +        return "main"sv;       }      explicit TSubscriber( diff --git a/ydb/core/tx/scheme_cache/scheme_cache.h b/ydb/core/tx/scheme_cache/scheme_cache.h index 26a07897a11..c7177c2cf35 100644 --- a/ydb/core/tx/scheme_cache/scheme_cache.h +++ b/ydb/core/tx/scheme_cache/scheme_cache.h @@ -524,7 +524,7 @@ public:  };  inline TActorId MakeSchemeCacheID() { -    return TActorId(0, TStringBuf("SchmCcheSrv")); +    return TActorId(0, TStringBuf("SchmCcheSrv"));   }  } // NKikimr diff --git a/ydb/core/tx/schemeshard/schemeshard__monitoring.cpp b/ydb/core/tx/schemeshard/schemeshard__monitoring.cpp index 76e73182496..7053abc5161 100644 --- a/ydb/core/tx/schemeshard/schemeshard__monitoring.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__monitoring.cpp @@ -77,36 +77,36 @@ struct TCgi {      static const TParam UpdateCoordinatorsConfigDryRun;      struct TPages { -        static constexpr TStringBuf MainPage = "Main"; -        static constexpr TStringBuf AdminPage = "Admin"; -        static constexpr TStringBuf AdminRequest = "AdminRequest"; -        static constexpr TStringBuf TransactionList = "TxList"; -        static constexpr TStringBuf TransactionInfo = "TxInfo"; -        static constexpr TStringBuf PathInfo = "PathInfo"; -        static constexpr TStringBuf ShardInfoByTabletId = "ShardInfoByTabletId"; -        static constexpr TStringBuf ShardInfoByShardIdx = "ShardInfoByShardIdx"; -        static constexpr TStringBuf BuildIndexInfo = "BuildIndexInfo"; +        static constexpr TStringBuf MainPage = "Main";  +        static constexpr TStringBuf AdminPage = "Admin";  +        static constexpr TStringBuf AdminRequest = "AdminRequest";  +        static constexpr TStringBuf TransactionList = "TxList";  +        static constexpr TStringBuf TransactionInfo = "TxInfo";  +        static constexpr TStringBuf PathInfo = "PathInfo";  +        static constexpr TStringBuf ShardInfoByTabletId = "ShardInfoByTabletId";  +        static constexpr TStringBuf ShardInfoByShardIdx = "ShardInfoByShardIdx";  +        static constexpr TStringBuf BuildIndexInfo = "BuildIndexInfo";       };  }; -const TCgi::TParam TCgi::TabletID = TStringBuf("TabletID"); -const TCgi::TParam TCgi::TxId = TStringBuf("TxId"); -const TCgi::TParam TCgi::PartId = TStringBuf("PartId"); -const TCgi::TParam TCgi::OperationId = TStringBuf("OperationId"); -const TCgi::TParam TCgi::OwnerShardIdx = TStringBuf("OwnerShardIdx"); -const TCgi::TParam TCgi::LocalShardIdx = TStringBuf("LocalShardIdx"); -const TCgi::TParam TCgi::ShardID = TStringBuf("ShardID"); -const TCgi::TParam TCgi::OwnerPathId = TStringBuf("OwnerPathId"); -const TCgi::TParam TCgi::LocalPathId = TStringBuf("LocalPathId"); -const TCgi::TParam TCgi::IsReadOnlyMode = TStringBuf("IsReadOnlyMode"); -const TCgi::TParam TCgi::UpdateAccessDatabaseRights = TStringBuf("UpdateAccessDatabaseRights"); -const TCgi::TParam TCgi::UpdateAccessDatabaseRightsDryRun = TStringBuf("UpdateAccessDatabaseRightsDryRun"); -const TCgi::TParam TCgi::FixAccessDatabaseInheritance = TStringBuf("FixAccessDatabaseInheritance"); -const TCgi::TParam TCgi::FixAccessDatabaseInheritanceDryRun = TStringBuf("FixAccessDatabaseInheritanceDryRun"); -const TCgi::TParam TCgi::Page = TStringBuf("Page"); -const TCgi::TParam TCgi::BuildIndexId = TStringBuf("BuildIndexId"); -const TCgi::TParam TCgi::UpdateCoordinatorsConfig = TStringBuf("UpdateCoordinatorsConfig"); -const TCgi::TParam TCgi::UpdateCoordinatorsConfigDryRun = TStringBuf("UpdateCoordinatorsConfigDryRun"); +const TCgi::TParam TCgi::TabletID = TStringBuf("TabletID");  +const TCgi::TParam TCgi::TxId = TStringBuf("TxId");  +const TCgi::TParam TCgi::PartId = TStringBuf("PartId");  +const TCgi::TParam TCgi::OperationId = TStringBuf("OperationId");  +const TCgi::TParam TCgi::OwnerShardIdx = TStringBuf("OwnerShardIdx");  +const TCgi::TParam TCgi::LocalShardIdx = TStringBuf("LocalShardIdx");  +const TCgi::TParam TCgi::ShardID = TStringBuf("ShardID");  +const TCgi::TParam TCgi::OwnerPathId = TStringBuf("OwnerPathId");  +const TCgi::TParam TCgi::LocalPathId = TStringBuf("LocalPathId");  +const TCgi::TParam TCgi::IsReadOnlyMode = TStringBuf("IsReadOnlyMode");  +const TCgi::TParam TCgi::UpdateAccessDatabaseRights = TStringBuf("UpdateAccessDatabaseRights");  +const TCgi::TParam TCgi::UpdateAccessDatabaseRightsDryRun = TStringBuf("UpdateAccessDatabaseRightsDryRun");  +const TCgi::TParam TCgi::FixAccessDatabaseInheritance = TStringBuf("FixAccessDatabaseInheritance");  +const TCgi::TParam TCgi::FixAccessDatabaseInheritanceDryRun = TStringBuf("FixAccessDatabaseInheritanceDryRun");  +const TCgi::TParam TCgi::Page = TStringBuf("Page");  +const TCgi::TParam TCgi::BuildIndexId = TStringBuf("BuildIndexId");  +const TCgi::TParam TCgi::UpdateCoordinatorsConfig = TStringBuf("UpdateCoordinatorsConfig");  +const TCgi::TParam TCgi::UpdateCoordinatorsConfigDryRun = TStringBuf("UpdateCoordinatorsConfigDryRun");   class TUpdateCoordinatorsConfigActor : public TActorBootstrapped<TUpdateCoordinatorsConfigActor> { @@ -786,7 +786,7 @@ private:                              }                              TABLED() {                                  str << status.DebugMessage; -                            } +                            }                               TABLED() {                                  str << Self->Generation() << ":" << status.SeqNoRound;                              } diff --git a/ydb/core/tx/schemeshard/schemeshard_path_element.h b/ydb/core/tx/schemeshard/schemeshard_path_element.h index 9912880c057..a7868978320 100644 --- a/ydb/core/tx/schemeshard/schemeshard_path_element.h +++ b/ydb/core/tx/schemeshard/schemeshard_path_element.h @@ -16,14 +16,14 @@  namespace NKikimr {  namespace NSchemeShard { -constexpr TStringBuf ATTR_PREFIX = "__"; -constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT = "__volume_space_limit"; -constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT_HDD = "__volume_space_limit_hdd"; -constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT_SSD = "__volume_space_limit_ssd"; -constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT_SSD_NONREPL = "__volume_space_limit_ssd_nonrepl"; +constexpr TStringBuf ATTR_PREFIX = "__";  +constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT = "__volume_space_limit";  +constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT_HDD = "__volume_space_limit_hdd";  +constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT_SSD = "__volume_space_limit_ssd";  +constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT_SSD_NONREPL = "__volume_space_limit_ssd_nonrepl";   constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT_SSD_SYSTEM = "__volume_space_limit_ssd_system"; -constexpr TStringBuf ATTR_EXTRA_PATH_SYMBOLS_ALLOWED = "__extra_path_symbols_allowed"; -constexpr TStringBuf ATTR_DOCUMENT_API_VERSION = "__document_api_version"; +constexpr TStringBuf ATTR_EXTRA_PATH_SYMBOLS_ALLOWED = "__extra_path_symbols_allowed";  +constexpr TStringBuf ATTR_DOCUMENT_API_VERSION = "__document_api_version";   inline bool WeakCheck(char c) {      // 33: ! " # $ % & ' ( ) * + , - . / diff --git a/ydb/core/tx/sequenceproxy/public/events.h b/ydb/core/tx/sequenceproxy/public/events.h index db786242e35..e46f31deea7 100644 --- a/ydb/core/tx/sequenceproxy/public/events.h +++ b/ydb/core/tx/sequenceproxy/public/events.h @@ -12,7 +12,7 @@ namespace NKikimr {  namespace NSequenceProxy {      inline TActorId MakeSequenceProxyServiceID(ui32 nodeId = 0) { -        return TActorId(nodeId, TStringBuf("seqproxy_svc")); +        return TActorId(nodeId, TStringBuf("seqproxy_svc"));       }      struct TEvSequenceProxy { diff --git a/ydb/core/tx/time_cast/time_cast.h b/ydb/core/tx/time_cast/time_cast.h index 1202d5a7991..e469bdd336c 100644 --- a/ydb/core/tx/time_cast/time_cast.h +++ b/ydb/core/tx/time_cast/time_cast.h @@ -183,7 +183,7 @@ struct TEvMediatorTimecast {  IActor* CreateMediatorTimecastProxy();  inline TActorId MakeMediatorTimecastProxyID() { -    return TActorId(0, TStringBuf("txmdtimecast")); +    return TActorId(0, TStringBuf("txmdtimecast"));   }  } diff --git a/ydb/core/tx/tx_proxy/proxy.cpp b/ydb/core/tx/tx_proxy/proxy.cpp index 55962e7d06f..979eb066b88 100644 --- a/ydb/core/tx/tx_proxy/proxy.cpp +++ b/ydb/core/tx/tx_proxy/proxy.cpp @@ -3,7 +3,7 @@  namespace NKikimr {  TActorId MakeTxProxyID() { -    return TActorId(0, TStringBuf("TxProxyServ")); +    return TActorId(0, TStringBuf("TxProxyServ"));   }  } diff --git a/ydb/core/tx/tx_proxy/schemereq.cpp b/ydb/core/tx/tx_proxy/schemereq.cpp index 923fe381ae6..440d98d4be8 100644 --- a/ydb/core/tx/tx_proxy/schemereq.cpp +++ b/ydb/core/tx/tx_proxy/schemereq.cpp @@ -16,8 +16,8 @@  namespace NKikimr {  namespace NTxProxy { -static constexpr TStringBuf DocApiRequestType = "_document_api_request"; -static constexpr TStringBuf DocApiTableVersionAttribute = "__document_api_version"; +static constexpr TStringBuf DocApiRequestType = "_document_api_request";  +static constexpr TStringBuf DocApiTableVersionAttribute = "__document_api_version";   template<typename TDerived>  struct TBaseSchemeReq: public TActorBootstrapped<TDerived> { diff --git a/ydb/core/util/address_classifier.cpp b/ydb/core/util/address_classifier.cpp index 46f291e417a..7b92055e9be 100644 --- a/ydb/core/util/address_classifier.cpp +++ b/ydb/core/util/address_classifier.cpp @@ -4,7 +4,7 @@ namespace NKikimr::NAddressClassifier {  TString ExtractAddress(const TString& peer) {      TStringBuf buf(peer); -    if (buf.SkipPrefix(TStringBuf("ipv"))) { +    if (buf.SkipPrefix(TStringBuf("ipv"))) {           buf.Skip(2); // skip 4/6 and ':'          if (buf.StartsWith('[')) {              buf.Skip(1); diff --git a/ydb/core/ymq/actor/log.cpp b/ydb/core/ymq/actor/log.cpp index b182d89fe16..95ee63b104f 100644 --- a/ydb/core/ymq/actor/log.cpp +++ b/ydb/core/ymq/actor/log.cpp @@ -27,14 +27,14 @@ TLogQueueName::TLogQueueName(const TQueuePath& queuePath, ui64 shard)  }  void TLogQueueName::OutTo(IOutputStream& out) const { -    out << "["sv << UserName; +    out << "["sv << UserName;       if (QueueName) { -        out << "/"sv << QueueName; +        out << "/"sv << QueueName;       }      if (Shard != std::numeric_limits<ui64>::max()) { -        out << "/"sv << Shard; +        out << "/"sv << Shard;       } -    out << "]"sv; +    out << "]"sv;   }  } // namespace NKikimr::NSQS diff --git a/ydb/core/ymq/actor/serviceid.h b/ydb/core/ymq/actor/serviceid.h index 7219d918ba0..e6ba7add3bc 100644 --- a/ydb/core/ymq/actor/serviceid.h +++ b/ydb/core/ymq/actor/serviceid.h @@ -11,24 +11,24 @@ namespace NKikimr::NSQS {  inline TActorId MakeSqsServiceID(ui32 nodeId) {      Y_VERIFY(nodeId != 0); -    return TActorId(nodeId, TStringBuf("SQS_SERVICE")); +    return TActorId(nodeId, TStringBuf("SQS_SERVICE"));   }  inline TActorId MakeSqsProxyServiceID(ui32 nodeId) {      Y_VERIFY(nodeId != 0); -    return TActorId(nodeId, TStringBuf("SQS_PROXY")); +    return TActorId(nodeId, TStringBuf("SQS_PROXY"));   }  inline TActorId MakeSqsAccessServiceID() { -    return TActorId(0, TStringBuf("SQS_ACCESS")); +    return TActorId(0, TStringBuf("SQS_ACCESS"));   }  inline TActorId MakeSqsFolderServiceID() { -    return TActorId(0, TStringBuf("SQS_FOLDER")); +    return TActorId(0, TStringBuf("SQS_FOLDER"));   }  inline TActorId MakeSqsMeteringServiceID() { -    return TActorId(0, TStringBuf("SQS_METER")); +    return TActorId(0, TStringBuf("SQS_METER"));   }  IActor* CreateSqsService(TMaybe<ui32> ydbPort = Nothing()); diff --git a/ydb/core/ymq/base/helpers.cpp b/ydb/core/ymq/base/helpers.cpp index 0d6ad36b135..c4e58d1b646 100644 --- a/ydb/core/ymq/base/helpers.cpp +++ b/ydb/core/ymq/base/helpers.cpp @@ -34,12 +34,12 @@ bool IsAlphaNumAndPunctuation(TStringBuf str) {  static bool MessageAttributesCharacters[256] = {}; -constexpr TStringBuf AWS_RESERVED_PREFIX = "AWS."; -constexpr TStringBuf AMAZON_RESERVED_PREFIX = "Amazon."; -constexpr TStringBuf YA_RESERVED_PREFIX = "Ya."; -constexpr TStringBuf YC_RESERVED_PREFIX = "YC."; -constexpr TStringBuf YANDEX_RESERVED_PREFIX = "Yandex."; -constexpr TStringBuf FIFO_SUFFIX = ".fifo"; +constexpr TStringBuf AWS_RESERVED_PREFIX = "AWS.";  +constexpr TStringBuf AMAZON_RESERVED_PREFIX = "Amazon.";  +constexpr TStringBuf YA_RESERVED_PREFIX = "Ya.";  +constexpr TStringBuf YC_RESERVED_PREFIX = "YC.";  +constexpr TStringBuf YANDEX_RESERVED_PREFIX = "Yandex.";  +constexpr TStringBuf FIFO_SUFFIX = ".fifo";   static bool MakeMessageAttributesCharacters() {      char src[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-."; diff --git a/ydb/core/ymq/base/ut/helpers_ut.cpp b/ydb/core/ymq/base/ut/helpers_ut.cpp index 9f1db59c722..0018dd3b683 100644 --- a/ydb/core/ymq/base/ut/helpers_ut.cpp +++ b/ydb/core/ymq/base/ut/helpers_ut.cpp @@ -113,7 +113,7 @@ Y_UNIT_TEST_SUITE(MessageBodyValidationTest) {          UNIT_ASSERT(ValidateMessageBody("\uD7FF", desc));          UNIT_ASSERT(ValidateMessageBody("\u00FF", desc)); -        UNIT_ASSERT(!ValidateMessageBody(TStringBuf("\0", 1), desc)); +        UNIT_ASSERT(!ValidateMessageBody(TStringBuf("\0", 1), desc));           UNIT_ASSERT(!ValidateMessageBody("\u0002", desc));          UNIT_ASSERT(!ValidateMessageBody("\u0019", desc));          UNIT_ASSERT(!ValidateMessageBody("\uFFFF", desc)); diff --git a/ydb/core/ymq/http/http.cpp b/ydb/core/ymq/http/http.cpp index 5d0963bfb2e..b21f6f551ff 100644 --- a/ydb/core/ymq/http/http.cpp +++ b/ydb/core/ymq/http/http.cpp @@ -36,11 +36,11 @@ using NKikimrClient::TSqsResponse;  namespace { -constexpr TStringBuf AUTHORIZATION_HEADER = "authorization"; -constexpr TStringBuf SECURITY_TOKEN_HEADER = "x-amz-security-token"; -constexpr TStringBuf IAM_TOKEN_HEADER = "x-yacloud-subjecttoken"; -constexpr TStringBuf FORWARDED_IP_HEADER = "x-forwarded-for"; -constexpr TStringBuf REQUEST_ID_HEADER = "x-request-id"; +constexpr TStringBuf AUTHORIZATION_HEADER = "authorization";  +constexpr TStringBuf SECURITY_TOKEN_HEADER = "x-amz-security-token";  +constexpr TStringBuf IAM_TOKEN_HEADER = "x-yacloud-subjecttoken";  +constexpr TStringBuf FORWARDED_IP_HEADER = "x-forwarded-for";  +constexpr TStringBuf REQUEST_ID_HEADER = "x-request-id";   const std::vector<TStringBuf> PRIVATE_TOKENS_HEADERS = {      SECURITY_TOKEN_HEADER, @@ -49,7 +49,7 @@ const std::vector<TStringBuf> PRIVATE_TOKENS_HEADERS = {  const TString CREDENTIAL_PARAM = "credential"; -constexpr TStringBuf PRIVATE_REQUEST_PATH_PREFIX = "/private"; +constexpr TStringBuf PRIVATE_REQUEST_PATH_PREFIX = "/private";   const TSet<TString> ModifyPermissionsActions = {"GrantPermissions", "RevokePermissions", "SetPermissions"}; diff --git a/ydb/core/ymq/http/parser.rl6 b/ydb/core/ymq/http/parser.rl6 index b617c334a31..098d5989760 100644 --- a/ydb/core/ymq/http/parser.rl6 +++ b/ydb/core/ymq/http/parser.rl6 @@ -81,7 +81,7 @@ change_visibility_entry =      "ChangeMessageVisibilityBatchRequestEntry" > { Id_ = 1; } ('.' int %{ Id_ = I; CurrentParams_ = &Params_->BatchEntries[Id_]; }) '.'          (("Id"                % { CurrentParams_->Id = value; }) |           ("ReceiptHandle"     % { CurrentParams_->ReceiptHandle = value; }) | -         ("VisibilityTimeout" % { CurrentParams_->VisibilityTimeout = ParseAndValidate(value, TStringBuf("VisibilityTimeout")); })); +         ("VisibilityTimeout" % { CurrentParams_->VisibilityTimeout = ParseAndValidate(value, TStringBuf("VisibilityTimeout")); }));   delete_message_entry =      "DeleteMessageBatchRequestEntry" > { Id_ = 1; } ('.' int %{ Id_ = I; CurrentParams_ = &Params_->BatchEntries[Id_]; }) '.' @@ -90,11 +90,11 @@ delete_message_entry =  send_message_entry =      "SendMessageBatchRequestEntry" > { Id_ = 1; } ('.' int %{ Id_ = I; CurrentParams_ = &Params_->BatchEntries[Id_]; }) '.' -        (("DelaySeconds"           % { CurrentParams_->DelaySeconds = ParseAndValidate(value, TStringBuf("DelaySeconds")); }) | +        (("DelaySeconds"           % { CurrentParams_->DelaySeconds = ParseAndValidate(value, TStringBuf("DelaySeconds")); }) |            ("Id"                     % { CurrentParams_->Id = value; }) |           ("MessageBody"            % { CurrentParams_->MessageBody = value; }) | -         ("MessageDeduplicationId" % { CurrentParams_->MessageDeduplicationId = ValidateAlphaNumAndPunctuation128ForAssign(value, TStringBuf("MessageDeduplicationId")); }) | -         ("MessageGroupId"         % { CurrentParams_->MessageGroupId = ValidateAlphaNumAndPunctuation128ForAssign(value, TStringBuf("MessageGroupId")); }) | +         ("MessageDeduplicationId" % { CurrentParams_->MessageDeduplicationId = ValidateAlphaNumAndPunctuation128ForAssign(value, TStringBuf("MessageDeduplicationId")); }) |  +         ("MessageGroupId"         % { CurrentParams_->MessageGroupId = ValidateAlphaNumAndPunctuation128ForAssign(value, TStringBuf("MessageGroupId")); }) |            message_attribute);  delete_queue_entry = @@ -118,24 +118,24 @@ permissions_entry =  main := |*      ('Action')                  { CurrentParams_->Action = value; };      ('Clear')                   { CurrentParams_->Clear = value; }; -    ('DelaySeconds')            { CurrentParams_->DelaySeconds = ParseAndValidate(value, TStringBuf("DelaySeconds")); }; +    ('DelaySeconds')            { CurrentParams_->DelaySeconds = ParseAndValidate(value, TStringBuf("DelaySeconds")); };       ('folderId')                { CurrentParams_->FolderId = value; }; -    ('MaxNumberOfMessages')     { CurrentParams_->MaxNumberOfMessages = ParseAndValidate(value, TStringBuf("MaxNumberOfMessages")); }; +    ('MaxNumberOfMessages')     { CurrentParams_->MaxNumberOfMessages = ParseAndValidate(value, TStringBuf("MaxNumberOfMessages")); };       ('MessageBody')             { CurrentParams_->MessageBody = value; }; -    ('MessageDeduplicationId')  { CurrentParams_->MessageDeduplicationId = ValidateAlphaNumAndPunctuation128ForAssign(value, TStringBuf("MessageDeduplicationId")); }; -    ('MessageGroupId')          { CurrentParams_->MessageGroupId = ValidateAlphaNumAndPunctuation128ForAssign(value, TStringBuf("MessageGroupId")); }; +    ('MessageDeduplicationId')  { CurrentParams_->MessageDeduplicationId = ValidateAlphaNumAndPunctuation128ForAssign(value, TStringBuf("MessageDeduplicationId")); };  +    ('MessageGroupId')          { CurrentParams_->MessageGroupId = ValidateAlphaNumAndPunctuation128ForAssign(value, TStringBuf("MessageGroupId")); };       ('Path')                    { CurrentParams_->Path = value; };      ('QueueName')               { CurrentParams_->QueueName = value; };      ('QueueNamePrefix')         { CurrentParams_->QueueNamePrefix = value; };      ('QueueUrl')                { CurrentParams_->QueueUrl = value; };      ('ReceiptHandle')           { CurrentParams_->ReceiptHandle = value; }; -    ('ReceiveRequestAttemptId') { CurrentParams_->ReceiveRequestAttemptId = ValidateAlphaNumAndPunctuation128ForAssign(value, TStringBuf("ReceiveRequestAttemptId")); }; +    ('ReceiveRequestAttemptId') { CurrentParams_->ReceiveRequestAttemptId = ValidateAlphaNumAndPunctuation128ForAssign(value, TStringBuf("ReceiveRequestAttemptId")); };       ('Subject')                 { CurrentParams_->Subject = value; };      ('UserName')                { CurrentParams_->UserName = value; };      ('UserNamePrefix')          { CurrentParams_->UserNamePrefix = value; };      ('Version')                 { CurrentParams_->Version = value; }; -    ('VisibilityTimeout')       { CurrentParams_->VisibilityTimeout = ParseAndValidate(value, TStringBuf("VisibilityTimeout")); }; -    ('WaitTimeSeconds')         { CurrentParams_->WaitTimeSeconds = ParseAndValidate(value, TStringBuf("WaitTimeSeconds")); }; +    ('VisibilityTimeout')       { CurrentParams_->VisibilityTimeout = ParseAndValidate(value, TStringBuf("VisibilityTimeout")); };  +    ('WaitTimeSeconds')         { CurrentParams_->WaitTimeSeconds = ParseAndValidate(value, TStringBuf("WaitTimeSeconds")); };       attribute;      attribute_name; diff --git a/ydb/library/backup/backup.cpp b/ydb/library/backup/backup.cpp index 676cc831ee2..43583ce2c68 100644 --- a/ydb/library/backup/backup.cpp +++ b/ydb/library/backup/backup.cpp @@ -164,7 +164,7 @@ void PrintValue(IOutputStream& out, TValueParser& parser) {              break;          case TTypeParser::ETypeKind::Void: -            out << "Void"sv; +            out << "Void"sv;               break;          case TTypeParser::ETypeKind::List: diff --git a/ydb/library/binary_json/read.cpp b/ydb/library/binary_json/read.cpp index d0ee07490f0..3396bf991e1 100644 --- a/ydb/library/binary_json/read.cpp +++ b/ydb/library/binary_json/read.cpp @@ -381,16 +381,16 @@ struct TBinaryJsonValidator {          TPODReader reader(Buffer);          const auto header = reader.Read<THeader>();          if (!header.Defined()) { -            return "Missing header"sv; +            return "Missing header"sv;           }          if (header->Version != CURRENT_VERSION) { -            return "Version does not match current"sv; +            return "Version does not match current"sv;           }          if (header->Version > EVersion::MaxVersion) { -            return "Invalid version"sv; +            return "Invalid version"sv;           }          if (header->StringOffset >= Buffer.Size()) { -            return "String index offset points outside of buffer"sv; +            return "String index offset points outside of buffer"sv;           }          StringIndexStart = header->StringOffset; @@ -398,7 +398,7 @@ struct TBinaryJsonValidator {          TPODReader stringReader(Buffer, /* start */ StringIndexStart, /* end */ Buffer.Size());          const auto stringCount = stringReader.Read<ui32>();          if (!stringCount.Defined()) { -            return "Missing string index size"sv; +            return "Missing string index size"sv;           }          StringEntryStart = StringIndexStart + sizeof(ui32);          StringDataStart = StringEntryStart + (*stringCount) * sizeof(TSEntry); @@ -408,13 +408,13 @@ struct TBinaryJsonValidator {          for (ui32 i = 0; i < *stringCount; i++) {              const auto entry = stringReader.Read<TSEntry>();              if (!entry.Defined()) { -                return "Missing entry in string index"sv; +                return "Missing entry in string index"sv;               }              if (entry->Type != EStringType::RawNullTerminated) { -                return "String entry type is invalid"sv; +                return "String entry type is invalid"sv;               }              if (lastStringOffset >= entry->Value) { -                return "String entry offset points to invalid location"sv; +                return "String entry offset points to invalid location"sv;               }              totalLength += entry->Value - lastStringOffset;              lastStringOffset = entry->Value; @@ -422,22 +422,22 @@ struct TBinaryJsonValidator {          NumberIndexStart = StringDataStart + totalLength;          if (NumberIndexStart > Buffer.Size()) { -            return "Total length of strings in String index exceeds Buffer size"sv; +            return "Total length of strings in String index exceeds Buffer size"sv;           }          // Validate Number index          if ((Buffer.Size() - NumberIndexStart) % sizeof(double) != 0) { -            return "Number index cannot be split into doubles"sv; +            return "Number index cannot be split into doubles"sv;           }          TPODReader numberReader(Buffer, /* start */ NumberIndexStart, /* end */ Buffer.Size());          TMaybe<double> current;          while (current = numberReader.Read<double>()) {              if (std::isnan(*current)) { -                return "Number index element is NaN"sv; +                return "Number index element is NaN"sv;               }              if (std::isinf(*current)) { -                return "Number index element is infinite"sv; +                return "Number index element is infinite"sv;               }          } @@ -448,10 +448,10 @@ struct TBinaryJsonValidator {  private:      TMaybe<TStringBuf> IsValidStringOffset(ui32 offset) {          if (offset < StringEntryStart || offset >= StringDataStart) { -            return "String offset is out of String index entries section"sv; +            return "String offset is out of String index entries section"sv;           }          if ((offset - StringEntryStart) % sizeof(TSEntry) != 0) { -            return "String offset does not point to the start of entry"sv; +            return "String offset does not point to the start of entry"sv;           }          return Nothing();      } @@ -459,7 +459,7 @@ private:      TMaybe<TStringBuf> IsValidEntry(TPODReader& reader, ui32 depth, bool containersAllowed = true) {          const auto entry = reader.Read<TEntry>();          if (!entry.Defined()) { -            return "Missing entry"sv; +            return "Missing entry"sv;           }          switch (entry->Type) { @@ -473,29 +473,29 @@ private:              case EEntryType::Number: {                  const auto numberOffset = entry->Value;                  if (numberOffset < NumberIndexStart || numberOffset >= Buffer.Size()) { -                    return "Number offset cannot point outside of Number index"sv; +                    return "Number offset cannot point outside of Number index"sv;                   }                  if ((numberOffset - NumberIndexStart) % sizeof(double) != 0) { -                    return "Number offset does not point to the start of number"sv; +                    return "Number offset does not point to the start of number"sv;                   }                  break;              }              case EEntryType::Container: {                  if (!containersAllowed) { -                    return "This entry cannot be a container"sv; +                    return "This entry cannot be a container"sv;                   }                  const auto metaOffset = entry->Value;                  if (metaOffset < reader.Pos) { -                    return "Offset to container cannot point before element"sv; +                    return "Offset to container cannot point before element"sv;                   }                  if (metaOffset >= StringIndexStart) { -                    return "Offset to container cannot point outside of Tree section"sv; +                    return "Offset to container cannot point outside of Tree section"sv;                   }                  TPODReader containerReader(reader.Buffer, metaOffset, StringIndexStart);                  return IsValidContainer(containerReader, depth + 1);              }              default: -                return "Invalid entry type"sv; +                return "Invalid entry type"sv;           }          return Nothing(); @@ -504,13 +504,13 @@ private:      TMaybe<TStringBuf> IsValidContainer(TPODReader& reader, ui32 depth) {          const auto meta = reader.Read<TMeta>();          if (!meta.Defined()) { -            return "Missing Meta for container"sv; +            return "Missing Meta for container"sv;           }          switch (meta->Type) {              case EContainerType::TopLevelScalar: {                  if (depth > 0) { -                    return "Top level scalar can be located only at the root of BinaryJson tree"sv; +                    return "Top level scalar can be located only at the root of BinaryJson tree"sv;                   }                  return IsValidEntry(reader, depth, /* containersAllowed */ false); @@ -531,7 +531,7 @@ private:                  for (ui32 i = 0; i < meta->Size; i++) {                      const auto keyOffset = keyReader.Read<TKeyEntry>();                      if (!keyOffset.Defined()) { -                        return "Cannot read key offset"sv; +                        return "Cannot read key offset"sv;                       }                      auto error = IsValidStringOffset(*keyOffset);                      if (error.Defined()) { @@ -546,7 +546,7 @@ private:                  break;              }              default: -                return "Invalid container type"sv; +                return "Invalid container type"sv;           }          return Nothing(); diff --git a/ydb/library/http_proxy/authorization/signature.cpp b/ydb/library/http_proxy/authorization/signature.cpp index 60368c0614e..a049bf9250c 100644 --- a/ydb/library/http_proxy/authorization/signature.cpp +++ b/ydb/library/http_proxy/authorization/signature.cpp @@ -48,7 +48,7 @@ static TString HashSHA256(TStringBuf data) {  static const char newline = '\n';  static const char pathDelim = '/'; -constexpr TStringBuf AUTHORIZATION_HEADER = "authorization"; +constexpr TStringBuf AUTHORIZATION_HEADER = "authorization";   static const TString SIGNED_HEADERS_PARAM = "signedheaders";  static const TString SIGNATURE_PARAM = "signature"; @@ -214,7 +214,7 @@ void TAwsRequestSignV4::MakeCanonicalRequest(const THttpInput& input, const TPar      }      for (const auto& [key, value] : canonicalHeaders) { -        canonicalRequest << key << ":"sv << JoinRange(",", value.begin(), value.end()) << newline; +        canonicalRequest << key << ":"sv << JoinRange(",", value.begin(), value.end()) << newline;       }      canonicalRequest << newline; // skip additional line after headers @@ -247,7 +247,7 @@ void TAwsRequestSignV4::MakeCanonicalRequest(const THttpInput& input, const TPar  void TAwsRequestSignV4::MakeFinalStringToSign() {      TStringStream finalStringToSign; -    finalStringToSign << "AWS4-HMAC-SHA256"sv << newline; +    finalStringToSign << "AWS4-HMAC-SHA256"sv << newline;       finalStringToSign << AwsTimestamp_ << newline;      finalStringToSign << AwsDate_ << pathDelim; diff --git a/ydb/library/mkql_proto/mkql_proto_ut.cpp b/ydb/library/mkql_proto/mkql_proto_ut.cpp index fdda085f18a..bb91d4db560 100644 --- a/ydb/library/mkql_proto/mkql_proto_ut.cpp +++ b/ydb/library/mkql_proto/mkql_proto_ut.cpp @@ -2,8 +2,8 @@  #include <ydb/library/mkql_proto/ut/helpers/helpers.h> -using namespace std::string_view_literals; - +using namespace std::string_view_literals;  +   namespace NKikimr::NMiniKQL {  Y_UNIT_TEST_SUITE(TMiniKQLProtoTest) { @@ -66,7 +66,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProtoTest) {      Y_UNIT_TEST(TestExportUuidType) {          TestExportType<NKikimrMiniKQL::TType>([](TProgramBuilder& pgmBuilder) { -            auto pgmReturn = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::Uuid>(TStringBuf("\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"sv)); +            auto pgmReturn = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::Uuid>(TStringBuf("\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"sv));               return pgmReturn;          },          "Kind: Data\n" @@ -338,7 +338,7 @@ Variant {      Y_UNIT_TEST(TestExportUuid) {          TestExportValue<NKikimrMiniKQL::TValue>([](TProgramBuilder& pgmBuilder) { -            auto pgmReturn = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::Uuid>(TStringBuf("\1\0\0\0\0\0\0\0\2\0\0\0\0\0\0\0"sv)); +            auto pgmReturn = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::Uuid>(TStringBuf("\1\0\0\0\0\0\0\0\2\0\0\0\0\0\0\0"sv));               return pgmReturn;          }, "Low128: 1\n"             "Hi128: 2\n"); diff --git a/ydb/library/yql/ast/yql_ast.cpp b/ydb/library/yql/ast/yql_ast.cpp index 16e521d9010..cc13e37a815 100644 --- a/ydb/library/yql/ast/yql_ast.cpp +++ b/ydb/library/yql/ast/yql_ast.cpp @@ -426,13 +426,13 @@ namespace {      inline bool IsQuoteNode(const TAstNode& node) {          return node.GetChildrenCount() == 2                  && node.GetChild(0)->GetType() == TAstNode::Atom -                && node.GetChild(0)->GetContent() == TStringBuf("quote"); +                && node.GetChild(0)->GetContent() == TStringBuf("quote");       }      inline bool IsBlockNode(const TAstNode& node) {          return node.GetChildrenCount() == 2                  && node.GetChild(0)->GetType() == TAstNode::Atom -                && node.GetChild(0)->GetContent() == TStringBuf("block"); +                && node.GetChild(0)->GetContent() == TStringBuf("block");       }      Y_NO_INLINE void Indent(IOutputStream& out, ui32 indentation) { @@ -442,7 +442,7 @@ namespace {      }      void MultilineAtomPrint(IOutputStream& out, const TStringBuf& str) { -        out << TStringBuf("@@"); +        out << TStringBuf("@@");           size_t idx = str.find('@');          if (idx == TString::npos) {              out << str; @@ -459,14 +459,14 @@ namespace {                      begin = str.data() + idx;                      while (count--) { -                        out.Write(TStringBuf("@@")); +                        out.Write(TStringBuf("@@"));                       }                  }                  idx = str.find('@', idx);              } while (idx != TString::npos);              out.Write(begin, str.end() - begin);          } -        out << TStringBuf("@@"); +        out << TStringBuf("@@");       }      void PrintNode(IOutputStream& out, const TAstNode& node) { @@ -484,7 +484,7 @@ namespace {              }          } else if (node.GetType() == TAstNode::List) {              if (!node.GetChildrenCount()) { -                out << TStringBuf("()"); +                out << TStringBuf("()");               } else if (IsQuoteNode(node)) {                  out << '\'';                  PrintNode(out, *node.GetChild(1)); @@ -641,7 +641,7 @@ void TAstNode::PrettyPrintTo(IOutputStream& out, ui32 flags) const {      PrettyPrintNode(out, *this, 0, 0, 0, flags);  } -TAstNode TAstNode::QuoteAtom(TPosition(0, 0), TStringBuf("quote"), TNodeFlags::Default); +TAstNode TAstNode::QuoteAtom(TPosition(0, 0), TStringBuf("quote"), TNodeFlags::Default);   } // namespace NYql diff --git a/ydb/library/yql/ast/yql_ast_ut.cpp b/ydb/library/yql/ast/yql_ast_ut.cpp index 23e140653d7..1ff29266d1f 100644 --- a/ydb/library/yql/ast/yql_ast_ut.cpp +++ b/ydb/library/yql/ast/yql_ast_ut.cpp @@ -9,7 +9,7 @@  namespace NYql {  Y_UNIT_TEST_SUITE(TParseYqlAst) { -    constexpr TStringBuf TEST_PROGRAM = +    constexpr TStringBuf TEST_PROGRAM =           "(\n"          "#comment\n"          "(let mr_source (DataSource 'yamr 'cedar))\n" @@ -22,7 +22,7 @@ Y_UNIT_TEST_SUITE(TParseYqlAst) {          "(let world (Write! world mr_sink (Key '('table (KeyString 'Output))) table1low '('('mode 'append))))\n"          "(let world (Commit! world mr_sink))\n"          "(return world)\n" -        ")"; +        ")";       Y_UNIT_TEST(ParseAstTest) {          TAstParseResult res = ParseAst(TEST_PROGRAM); @@ -136,45 +136,45 @@ Y_UNIT_TEST_SUITE(TParseYqlAst) {      Y_UNIT_TEST(GoodArbitraryAtom) {          TestGoodArbitraryAtom("(\"\")", TStringBuf()); -        TestGoodArbitraryAtom("(\" 1 a 3 b \")", TStringBuf(" 1 a 3 b ")); +        TestGoodArbitraryAtom("(\" 1 a 3 b \")", TStringBuf(" 1 a 3 b "));           ui8 expectedHex[] = { 0xab, 'c', 'd', 0x00 }; -        TestGoodArbitraryAtom("(\"\\xabcd\")", TBasicStringBuf<ui8>(expectedHex)); -        TestGoodArbitraryAtom("(\" \\x3d \")", TStringBuf(" \x3d ")); +        TestGoodArbitraryAtom("(\"\\xabcd\")", TBasicStringBuf<ui8>(expectedHex));  +        TestGoodArbitraryAtom("(\" \\x3d \")", TStringBuf(" \x3d "));           ui8 expectedOctal[] = { 056, '7', '8', 0x00 }; -        TestGoodArbitraryAtom("(\"\\05678\")", TBasicStringBuf<ui8>(expectedOctal)); -        TestGoodArbitraryAtom("(\" \\056 \")", TStringBuf(" \056 ")); -        TestGoodArbitraryAtom("(\" \\177 \")", TStringBuf(" \177 ")); -        TestGoodArbitraryAtom("(\" \\377 \")", TStringBuf(" \377 ")); -        TestGoodArbitraryAtom("(\" \\477 \")", TStringBuf(" 477 ")); +        TestGoodArbitraryAtom("(\"\\05678\")", TBasicStringBuf<ui8>(expectedOctal));  +        TestGoodArbitraryAtom("(\" \\056 \")", TStringBuf(" \056 "));  +        TestGoodArbitraryAtom("(\" \\177 \")", TStringBuf(" \177 "));  +        TestGoodArbitraryAtom("(\" \\377 \")", TStringBuf(" \377 "));  +        TestGoodArbitraryAtom("(\" \\477 \")", TStringBuf(" 477 "));           {              ui8 expected1[] = { 0x01, 0x00 }; -            TestGoodArbitraryAtom("(\"\\u0001\")", TBasicStringBuf<ui8>(expected1)); +            TestGoodArbitraryAtom("(\"\\u0001\")", TBasicStringBuf<ui8>(expected1));               ui8 expected2[] = { 0xE1, 0x88, 0xB4, 0x00 }; -            TestGoodArbitraryAtom("(\"\\u1234\")", TBasicStringBuf<ui8>(expected2)); +            TestGoodArbitraryAtom("(\"\\u1234\")", TBasicStringBuf<ui8>(expected2));               ui8 expected3[] = { 0xef, 0xbf, 0xbf, 0x00 }; -            TestGoodArbitraryAtom("(\"\\uffff\")", TBasicStringBuf<ui8>(expected3)); +            TestGoodArbitraryAtom("(\"\\uffff\")", TBasicStringBuf<ui8>(expected3));           }          {              ui8 expected1[] = { 0x01, 0x00 }; -            TestGoodArbitraryAtom("(\"\\U00000001\")", TBasicStringBuf<ui8>(expected1)); +            TestGoodArbitraryAtom("(\"\\U00000001\")", TBasicStringBuf<ui8>(expected1));               ui8 expected2[] = { 0xf4, 0x8f, 0xbf, 0xbf, 0x00 }; -            TestGoodArbitraryAtom("(\"\\U0010ffff\")", TBasicStringBuf<ui8>(expected2)); +            TestGoodArbitraryAtom("(\"\\U0010ffff\")", TBasicStringBuf<ui8>(expected2));           } -        TestGoodArbitraryAtom("(\"\\t\")", TStringBuf("\t")); -        TestGoodArbitraryAtom("(\"\\n\")", TStringBuf("\n")); -        TestGoodArbitraryAtom("(\"\\r\")", TStringBuf("\r")); -        TestGoodArbitraryAtom("(\"\\b\")", TStringBuf("\b")); -        TestGoodArbitraryAtom("(\"\\f\")", TStringBuf("\f")); -        TestGoodArbitraryAtom("(\"\\a\")", TStringBuf("\a")); -        TestGoodArbitraryAtom("(\"\\v\")", TStringBuf("\v")); +        TestGoodArbitraryAtom("(\"\\t\")", TStringBuf("\t"));  +        TestGoodArbitraryAtom("(\"\\n\")", TStringBuf("\n"));  +        TestGoodArbitraryAtom("(\"\\r\")", TStringBuf("\r"));  +        TestGoodArbitraryAtom("(\"\\b\")", TStringBuf("\b"));  +        TestGoodArbitraryAtom("(\"\\f\")", TStringBuf("\f"));  +        TestGoodArbitraryAtom("(\"\\a\")", TStringBuf("\a"));  +        TestGoodArbitraryAtom("(\"\\v\")", TStringBuf("\v"));       }      void TestBadArbitraryAtom( diff --git a/ydb/library/yql/ast/yql_expr.cpp b/ydb/library/yql/ast/yql_expr.cpp index 82f6c5812ac..fa098978d7e 100644 --- a/ydb/library/yql/ast/yql_expr.cpp +++ b/ydb/library/yql/ast/yql_expr.cpp @@ -19,7 +19,7 @@  namespace NYql { -const TStringBuf ZeroString = ""; +const TStringBuf ZeroString = "";   void ReportError(TExprContext& ctx, const TIssue& issue) {      ctx.AddError(issue); @@ -163,22 +163,22 @@ namespace {          const TTypeAnnotationNode* CompileTypeAnnotationNode(const TAstNode& node) {              if (node.IsAtom()) { -                if (node.GetContent() == TStringBuf(".")) { +                if (node.GetContent() == TStringBuf(".")) {                       return nullptr;                  } -                else if (node.GetContent() == TStringBuf("Unit")) { +                else if (node.GetContent() == TStringBuf("Unit")) {                       return Expr.MakeType<TUnitExprType>();                  } -                else if (node.GetContent() == TStringBuf("World")) { +                else if (node.GetContent() == TStringBuf("World")) {                       return Expr.MakeType<TWorldExprType>();                  } -                else if (node.GetContent() == TStringBuf("Void")) { +                else if (node.GetContent() == TStringBuf("Void")) {                       return Expr.MakeType<TVoidExprType>();                  } -                else if (node.GetContent() == TStringBuf("Null")) { +                else if (node.GetContent() == TStringBuf("Null")) {                       return Expr.MakeType<TNullExprType>();                  } -                else if (node.GetContent() == TStringBuf("Generic")) { +                else if (node.GetContent() == TStringBuf("Generic")) {                       return Expr.MakeType<TGenericExprType>();                  }                  else if (node.GetContent() == TStringBuf("EmptyList")) { @@ -203,7 +203,7 @@ namespace {                  }                  auto content = node.GetChild(0)->GetContent(); -                if (content == TStringBuf("Data")) { +                if (content == TStringBuf("Data")) {                       const auto count = node.GetChildrenCount();                      if (!(count == 2 || count == 4) || !node.GetChild(1)->IsAtom()) {                          AddError(node, "Bad data type annotation"); @@ -230,7 +230,7 @@ namespace {                          return ann;                      } -                } else if (content == TStringBuf("List")) { +                } else if (content == TStringBuf("List")) {                       if (node.GetChildrenCount() != 2) {                          AddError(node, "Bad list type annotation");                          return nullptr; @@ -241,7 +241,7 @@ namespace {                          return nullptr;                      return Expr.MakeType<TListExprType>(r); -                } else if (content == TStringBuf("Stream")) { +                } else if (content == TStringBuf("Stream")) {                       if (node.GetChildrenCount() != 2) {                          AddError(node, "Bad stream type annotation");                          return nullptr; @@ -252,7 +252,7 @@ namespace {                          return nullptr;                      return Expr.MakeType<TStreamExprType>(r); -                } else if (content == TStringBuf("Struct")) { +                } else if (content == TStringBuf("Struct")) {                       TVector<const TItemExprType*> children;                      for (size_t index = 1; index < node.GetChildrenCount(); ++index) {                          auto r = CompileTypeAnnotationNode(*node.GetChild(index)); @@ -273,7 +273,7 @@ namespace {                      }                      return ann; -                } else if (content == TStringBuf("Multi")) { +                } else if (content == TStringBuf("Multi")) {                       TTypeAnnotationNode::TListType children;                      for (size_t index = 1; index < node.GetChildrenCount(); ++index) {                          auto r = CompileTypeAnnotationNode(*node.GetChild(index)); @@ -289,7 +289,7 @@ namespace {                      }                      return ann; -                } else if (content == TStringBuf("Tuple")) { +                } else if (content == TStringBuf("Tuple")) {                       TTypeAnnotationNode::TListType children;                      for (size_t index = 1; index < node.GetChildrenCount(); ++index) {                          auto r = CompileTypeAnnotationNode(*node.GetChild(index)); @@ -305,7 +305,7 @@ namespace {                      }                      return ann; -                } else if (content == TStringBuf("Item")) { +                } else if (content == TStringBuf("Item")) {                       if (node.GetChildrenCount() != 3 || !node.GetChild(1)->IsAtom()) {                          AddError(node, "Bad item type annotation");                          return nullptr; @@ -316,7 +316,7 @@ namespace {                          return nullptr;                      return Expr.MakeType<TItemExprType>(TString(node.GetChild(1)->GetContent()), r); -                } else if (content == TStringBuf("Optional")) { +                } else if (content == TStringBuf("Optional")) {                       if (node.GetChildrenCount() != 2) {                          AddError(node, "Bad optional type annotation");                          return nullptr; @@ -327,7 +327,7 @@ namespace {                          return nullptr;                      return Expr.MakeType<TOptionalExprType>(r); -                } else if (content == TStringBuf("Type")) { +                } else if (content == TStringBuf("Type")) {                       if (node.GetChildrenCount() != 2) {                          AddError(node, "Bad type annotation");                          return nullptr; @@ -339,7 +339,7 @@ namespace {                      return Expr.MakeType<TTypeExprType>(r);                  } -                else if (content == TStringBuf("Dict")) { +                else if (content == TStringBuf("Dict")) {                       if (node.GetChildrenCount() != 3) {                          AddError(node, "Bad dict annotation");                          return nullptr; @@ -360,7 +360,7 @@ namespace {                      return ann;                  } -                else if (content == TStringBuf("Callable")) { +                else if (content == TStringBuf("Callable")) {                       if (node.GetChildrenCount() <= 2) {                          AddError(node, "Bad callable annotation");                          return nullptr; @@ -459,14 +459,14 @@ namespace {                      }                      return ann; -                } else if (content == TStringBuf("Resource")) { +                } else if (content == TStringBuf("Resource")) {                       if (node.GetChildrenCount() != 2 || !node.GetChild(1)->IsAtom()) {                          AddError(node, "Bad resource type annotation");                          return nullptr;                      }                      return Expr.MakeType<TResourceExprType>(TString(node.GetChild(1)->GetContent())); -                } else if (content == TStringBuf("Tagged")) { +                } else if (content == TStringBuf("Tagged")) {                       if (node.GetChildrenCount() != 3 || !node.GetChild(2)->IsAtom()) {                          AddError(node, "Bad tagged type annotation");                          return nullptr; @@ -483,7 +483,7 @@ namespace {                      }                      return ann; -                } else if (content == TStringBuf("Error")) { +                } else if (content == TStringBuf("Error")) {                       if (node.GetChildrenCount() != 5 || !node.GetChild(1)->IsAtom() ||                          !node.GetChild(2)->IsAtom() || !node.GetChild(3)->IsAtom() || !node.GetChild(4)->IsAtom()) {                          AddError(node, "Bad error type annotation"); @@ -504,7 +504,7 @@ namespace {                      auto file = TString(node.GetChild(3)->GetContent());                      return Expr.MakeType<TErrorExprType>(TIssue(TPosition(column, row, file), TString(node.GetChild(4)->GetContent()))); -                } else if (content == TStringBuf("Variant")) { +                } else if (content == TStringBuf("Variant")) {                       if (node.GetChildrenCount() != 2) {                          AddError(node, "Bad variant type annotation");                          return nullptr; @@ -520,7 +520,7 @@ namespace {                      }                      return ann; -                } else if (content == TStringBuf("Stream")) { +                } else if (content == TStringBuf("Stream")) {                       if (node.GetChildrenCount() != 2) {                          AddError(node, "Bad stream type annotation");                          return nullptr; @@ -531,7 +531,7 @@ namespace {                          return nullptr;                      return Expr.MakeType<TStreamExprType>(r); -                } else if (content == TStringBuf("Flow")) { +                } else if (content == TStringBuf("Flow")) {                       if (node.GetChildrenCount() != 2) {                          AddError(node, "Bad flow type annotation");                          return nullptr; @@ -554,12 +554,12 @@ namespace {          switch (annotation.GetKind()) {          case ETypeAnnotationKind::Unit:              { -                return TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Unit"), pool); +                return TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Unit"), pool);               }          case ETypeAnnotationKind::Tuple:              { -                auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Tuple"), pool); +                auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Tuple"), pool);                   TSmallVec<TAstNode*> children;                  children.push_back(self);                  for (auto& child : annotation.Cast<TTupleExprType>()->GetItems()) { @@ -571,7 +571,7 @@ namespace {          case ETypeAnnotationKind::Struct:              { -                auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Struct"), pool); +                auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Struct"), pool);                   TSmallVec<TAstNode*> children;                  children.push_back(self);                  for (auto& child : annotation.Cast<TStructExprType>()->GetItems()) { @@ -583,14 +583,14 @@ namespace {          case ETypeAnnotationKind::List:              { -                auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("List"), pool); +                auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("List"), pool);                   auto itemType = ConvertTypeAnnotationToAst(*annotation.Cast<TListExprType>()->GetItemType(), pool, refAtoms);                  return TAstNode::NewList(TPosition(), pool, self, itemType);              }          case ETypeAnnotationKind::Optional:          { -            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Optional"), pool); +            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Optional"), pool);               auto itemType = ConvertTypeAnnotationToAst(*annotation.Cast<TOptionalExprType>()->GetItemType(), pool, refAtoms);              return TAstNode::NewList(TPosition(), pool, self, itemType);          } @@ -598,7 +598,7 @@ namespace {          case ETypeAnnotationKind::Item:              {                  auto casted = annotation.Cast<TItemExprType>(); -                auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Item"), pool); +                auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Item"), pool);                   auto name = refAtoms ?                      TAstNode::NewLiteralAtom(TPosition(), casted->GetName(), pool, TNodeFlags::ArbitraryContent) :                      TAstNode::NewAtom(TPosition(), casted->GetName(), pool, TNodeFlags::ArbitraryContent); @@ -608,7 +608,7 @@ namespace {          case ETypeAnnotationKind::Data:              { -                auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Data"), pool); +                auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Data"), pool);                   auto datatype = refAtoms ?                      TAstNode::NewLiteralAtom(TPosition(), annotation.Cast<TDataExprType>()->GetName(), pool) :                      TAstNode::NewAtom(TPosition(), annotation.Cast<TDataExprType>()->GetName(), pool); @@ -629,19 +629,19 @@ namespace {          case ETypeAnnotationKind::World:          { -            return TAstNode::NewLiteralAtom(TPosition(), TStringBuf("World"), pool); +            return TAstNode::NewLiteralAtom(TPosition(), TStringBuf("World"), pool);           }          case ETypeAnnotationKind::Type:          { -            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Type"), pool); +            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Type"), pool);               auto type = ConvertTypeAnnotationToAst(*annotation.Cast<TTypeExprType>()->GetType(), pool, refAtoms);              return TAstNode::NewList(TPosition(), pool, self, type);          }          case ETypeAnnotationKind::Dict:          { -            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Dict"), pool); +            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Dict"), pool);               auto dictType = annotation.Cast<TDictExprType>();              auto keyType = ConvertTypeAnnotationToAst(*dictType->GetKeyType(), pool, refAtoms);              auto payloadType = ConvertTypeAnnotationToAst(*dictType->GetPayloadType(), pool, refAtoms); @@ -650,17 +650,17 @@ namespace {          case ETypeAnnotationKind::Void:          { -            return TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Void"), pool); +            return TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Void"), pool);           }          case ETypeAnnotationKind::Null:          { -            return TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Null"), pool); +            return TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Null"), pool);           }          case ETypeAnnotationKind::Callable:          { -            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Callable"), pool); +            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Callable"), pool);               auto callable = annotation.Cast<TCallableExprType>();              TSmallVec<TAstNode*> mainSettings;              if (callable->GetOptionalArgumentsCount() > 0 || !callable->GetPayload().empty()) { @@ -704,12 +704,12 @@ namespace {          case ETypeAnnotationKind::Generic:          { -            return TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Generic"), pool); +            return TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Generic"), pool);           }          case ETypeAnnotationKind::Resource:          { -            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Resource"), pool); +            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Resource"), pool);               auto restype = refAtoms ?                  TAstNode::NewLiteralAtom(TPosition(), annotation.Cast<TResourceExprType>()->GetTag(), pool, TNodeFlags::ArbitraryContent) :                  TAstNode::NewAtom(TPosition(), annotation.Cast<TResourceExprType>()->GetTag(), pool, TNodeFlags::ArbitraryContent); @@ -718,7 +718,7 @@ namespace {          case ETypeAnnotationKind::Tagged:          { -            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Tagged"), pool); +            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Tagged"), pool);               auto type = ConvertTypeAnnotationToAst(*annotation.Cast<TTaggedExprType>()->GetBaseType(), pool, refAtoms);              auto restype = refAtoms ?                  TAstNode::NewLiteralAtom(TPosition(), annotation.Cast<TTaggedExprType>()->GetTag(), pool, TNodeFlags::ArbitraryContent) : @@ -728,7 +728,7 @@ namespace {          case ETypeAnnotationKind::Error:          { -            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Error"), pool); +            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Error"), pool);               const auto& err = annotation.Cast<TErrorExprType>()->GetError();              auto row = TAstNode::NewAtom(TPosition(), ToString(err.Position.Row), pool);              auto column = TAstNode::NewAtom(TPosition(), ToString(err.Position.Column), pool); @@ -743,28 +743,28 @@ namespace {          case ETypeAnnotationKind::Variant:          { -            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Variant"), pool); +            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Variant"), pool);               auto underlyingType = ConvertTypeAnnotationToAst(*annotation.Cast<TVariantExprType>()->GetUnderlyingType(), pool, refAtoms);              return TAstNode::NewList(TPosition(), pool, self, underlyingType);          }          case ETypeAnnotationKind::Stream:          { -            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Stream"), pool); +            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Stream"), pool);               auto itemType = ConvertTypeAnnotationToAst(*annotation.Cast<TStreamExprType>()->GetItemType(), pool, refAtoms);              return TAstNode::NewList(TPosition(), pool, self, itemType);          }          case ETypeAnnotationKind::Flow:          { -            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Flow"), pool); +            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Flow"), pool);               auto itemType = ConvertTypeAnnotationToAst(*annotation.Cast<TFlowExprType>()->GetItemType(), pool, refAtoms);              return TAstNode::NewList(TPosition(), pool, self, itemType);          }          case ETypeAnnotationKind::Multi:          { -            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Multi"), pool); +            auto self = TAstNode::NewLiteralAtom(TPosition(), TStringBuf("Multi"), pool);               TSmallVec<TAstNode*> children;              children.push_back(self);              for (auto& child : annotation.Cast<TMultiExprType>()->GetItems()) { @@ -803,7 +803,7 @@ namespace {                  YQL_ENSURE(exprNode->GetTypeAnn());                  typeAnn = ConvertTypeAnnotationToAst(*exprNode->GetTypeAnn(), pool, refAtoms);              } else { -                typeAnn = TAstNode::NewLiteralAtom(node->GetPosition(), TStringBuf("."), pool); +                typeAnn = TAstNode::NewLiteralAtom(node->GetPosition(), TStringBuf("."), pool);               }              children.push_back(typeAnn); @@ -841,7 +841,7 @@ namespace {          const auto args = node.GetChild(1);          if (!args->IsList() || args->GetChildrenCount() != 2 || !args->GetChild(0)->IsAtom() || -            args->GetChild(0)->GetContent() != TStringBuf("quote") || !args->GetChild(1)->IsList()) { +            args->GetChild(0)->GetContent() != TStringBuf("quote") || !args->GetChild(1)->IsList()) {               ctx.AddError(node, "Lambda arguments must be a quoted list of atoms");              return {};          } @@ -893,14 +893,14 @@ namespace {          const auto name = node.GetChild(1);          if (name->IsAtom() || name->GetChildrenCount() != 2 || !name->GetChild(0)->IsAtom() || !name->GetChild(1)->IsAtom() || -            name->GetChild(0)->GetContent() != TStringBuf("quote")) { +            name->GetChild(0)->GetContent() != TStringBuf("quote")) {               ctx.AddError(*name, "Expected quoted atom for package name");              return false;          }          const auto versionNode = node.GetChild(2);          if (versionNode->IsAtom() || versionNode->GetChildrenCount() != 2 || !versionNode->GetChild(0)->IsAtom() || !versionNode->GetChild(1)->IsAtom() || -            versionNode->GetChild(0)->GetContent() != TStringBuf("quote")) { +            versionNode->GetChild(0)->GetContent() != TStringBuf("quote")) {               ctx.AddError(*versionNode, "Expected quoted atom for package version");              return false;          } @@ -932,7 +932,7 @@ namespace {          const auto alias = node.GetChild(2);          if (alias->IsAtom() || alias->GetChildrenCount() != 2 || !alias->GetChild(0)->IsAtom() || !alias->GetChild(1)->IsAtom() || -            alias->GetChild(0)->GetContent() != TStringBuf("quote")) { +            alias->GetChild(0)->GetContent() != TStringBuf("quote")) {               ctx.AddError(*alias, "Expected quoted pair");              return nullptr;          } @@ -1011,7 +1011,7 @@ namespace {          const auto alias = node.GetChild(2);          if (!alias->IsListOfSize(2) || !alias->GetChild(0)->IsAtom() || !alias->GetChild(1)->IsAtom() || -            alias->GetChild(0)->GetContent() != TStringBuf("quote")) { +            alias->GetChild(0)->GetContent() != TStringBuf("quote")) {               ctx.AddError(node, "Expected quoted pair");              return false;          } @@ -1173,10 +1173,10 @@ namespace {                      return {};                  } -                if (firstChild->GetContent() == TStringBuf("library")) { +                if (firstChild->GetContent() == TStringBuf("library")) {                       if (!CompileLibraryDef(*node, ctx))                          return {}; -                } else if (firstChild->GetContent() == TStringBuf("set_package_version")) { +                } else if (firstChild->GetContent() == TStringBuf("set_package_version")) {                       if (!CompileSetPackageVersion(*node, ctx))                          return {};                  } @@ -1215,16 +1215,16 @@ namespace {                  return {};              } -            if (firstChild->GetContent() == TStringBuf("let")) { +            if (firstChild->GetContent() == TStringBuf("let")) {                   if (!CompileLet(*node, ctx))                      return {}; -            } else if (firstChild->GetContent() == TStringBuf("return")) { +            } else if (firstChild->GetContent() == TStringBuf("return")) {                   if (!CompileReturn(*node, ctx))                      return {}; -            } else if (firstChild->GetContent() == TStringBuf("import")) { +            } else if (firstChild->GetContent() == TStringBuf("import")) {                   if (!CompileImport(*node, ctx))                      return {}; -            } else if (firstChild->GetContent() == TStringBuf("declare")) { +            } else if (firstChild->GetContent() == TStringBuf("declare")) {                   if (!topLevel) {                      ctx.AddError(*firstChild, "Declare statements are only allowed on top level block");                      return {}; @@ -1232,14 +1232,14 @@ namespace {                  if (!CompileDeclare(*node, ctx))                      return {}; -            } else if (firstChild->GetContent() == TStringBuf("library")) { +            } else if (firstChild->GetContent() == TStringBuf("library")) {                   if (!topLevel) {                      ctx.AddError(*firstChild, "Library statements are only allowed on top level block");                      return {};                  }                  continue; -            } else if (firstChild->GetContent() == TStringBuf("set_package_version")) { +            } else if (firstChild->GetContent() == TStringBuf("set_package_version")) {                   if (!topLevel) {                      ctx.AddError(*firstChild, "set_package_version statements are only allowed on top level block");                      return {}; @@ -1287,13 +1287,13 @@ namespace {                  return false;              } -            if (firstChild->GetContent() == TStringBuf("let")) { +            if (firstChild->GetContent() == TStringBuf("let")) {                   if (!CompileLet(*node, ctx))                      return false; -            } else if (firstChild->GetContent() == TStringBuf("import")) { +            } else if (firstChild->GetContent() == TStringBuf("import")) {                   if (!CompileImport(*node, ctx))                      return false; -            } else if (firstChild->GetContent() == TStringBuf("export")) { +            } else if (firstChild->GetContent() == TStringBuf("export")) {                   if (!CompileExport(*node, ctx))                      return false;              } else { @@ -1328,7 +1328,7 @@ namespace {          }          auto function = node.GetChild(0)->GetContent(); -        if (function == TStringBuf("quote")) { +        if (function == TStringBuf("quote")) {               if (node.GetChildrenCount() != 2) {                  ctx.AddError(node, "Quote should have one argument");                  return {}; @@ -1340,22 +1340,22 @@ namespace {              return {};          } -        if (function == TStringBuf("let") || function == TStringBuf("return")) { +        if (function == TStringBuf("let") || function == TStringBuf("return")) {               ctx.AddError(node, "Let and return should be used only at first level or inside def");              return {};          } -        if (function == TStringBuf("lambda")) { +        if (function == TStringBuf("lambda")) {               return CompileLambda(node, ctx);          } -        if (function == TStringBuf("bind")) { +        if (function == TStringBuf("bind")) {               if (auto bind = CompileBind(node, ctx))                  return {std::move(bind)};              return {};          } -        if (function == TStringBuf("block")) { +        if (function == TStringBuf("block")) {               if (node.GetChildrenCount() != 2) {                  ctx.AddError(node, "Block should have one argument");                  return {}; @@ -1363,7 +1363,7 @@ namespace {              const auto quotedList = node.GetChild(1);              if (quotedList->GetChildrenCount() != 2 || !quotedList->GetChild(0)->IsAtom() || -                quotedList->GetChild(0)->GetContent() != TStringBuf("quote")) { +                quotedList->GetChild(0)->GetContent() != TStringBuf("quote")) {                   ctx.AddError(node, "Expected quoted list");                  return {};              } @@ -1562,7 +1562,7 @@ namespace {                              break;                          } -                        auto declareAtom = TAstNode::NewLiteralAtom(ctx.Expr.GetPosition(node.Pos()), TStringBuf("declare"), pool); +                        auto declareAtom = TAstNode::NewLiteralAtom(ctx.Expr.GetPosition(node.Pos()), TStringBuf("declare"), pool);                           auto nameAtom = ctx.RefAtoms                              ? TAstNode::NewLiteralAtom(ctx.Expr.GetPosition(nameNode.Pos()), nameNode.Content(), pool)                              : TAstNode::NewAtom(ctx.Expr.GetPosition(nameNode.Pos()), nameNode.Content(), pool); @@ -1619,7 +1619,7 @@ namespace {                          TSmallVec<const TExprNode*> body(node.ChildrenSize() - 1U);                          for (ui32 i = 0U; i < body.size(); ++i)                              body[i] = node.Child(i + 1U); -                        const auto blockNode = TAstNode::NewLiteralAtom(ctx.Expr.GetPosition(node.Pos()), TStringBuf("block"), pool); +                        const auto blockNode = TAstNode::NewLiteralAtom(ctx.Expr.GetPosition(node.Pos()), TStringBuf("block"), pool);                           const auto quotedListNode = TAstNode::NewList(ctx.Expr.GetPosition(node.Pos()), pool,                              AnnotateAstNode(&TAstNode::QuoteAtom, nullptr, annotationFlags, pool, ctx.RefAtoms),                              ConvertFunction(node.Pos(), body, ctx, annotationFlags, pool)); @@ -1632,7 +1632,7 @@ namespace {                          ctx.CurrentFrame = prevFrame;                          res = TAstNode::NewList(ctx.Expr.GetPosition(node.Pos()), pool,                              AnnotateAstNode(TAstNode::NewLiteralAtom( -                                ctx.Expr.GetPosition(node.Pos()), TStringBuf("lambda"), pool), nullptr, annotationFlags, pool, ctx.RefAtoms), +                                ctx.Expr.GetPosition(node.Pos()), TStringBuf("lambda"), pool), nullptr, annotationFlags, pool, ctx.RefAtoms),                               AnnotateAstNode(argsContainer, &args, annotationFlags, pool, ctx.RefAtoms),                              res);                      } else { @@ -1643,7 +1643,7 @@ namespace {                          ctx.CurrentFrame = prevFrame;                          children[0] = AnnotateAstNode(TAstNode::NewLiteralAtom( -                                ctx.Expr.GetPosition(node.Pos()), TStringBuf("lambda"), pool), nullptr, annotationFlags, pool, ctx.RefAtoms); +                                ctx.Expr.GetPosition(node.Pos()), TStringBuf("lambda"), pool), nullptr, annotationFlags, pool, ctx.RefAtoms);                           children[1] = AnnotateAstNode(argsContainer, &args, annotationFlags, pool, ctx.RefAtoms);                          res = TAstNode::NewList(ctx.Expr.GetPosition(node.Pos()), children.data(), children.size(), pool);                      } @@ -1651,7 +1651,7 @@ namespace {                  }              case TExprNode::World: -                res = TAstNode::NewLiteralAtom(ctx.Expr.GetPosition(node.Pos()), TStringBuf("world"), pool); +                res = TAstNode::NewLiteralAtom(ctx.Expr.GetPosition(node.Pos()), TStringBuf("world"), pool);                   break;              default:                  YQL_ENSURE(false, "Unknown type: " << static_cast<ui32>(node.Type())); @@ -1670,7 +1670,7 @@ namespace {                  continue;              } -            const auto letAtom = TAstNode::NewLiteralAtom(ctx.Expr.GetPosition(node->Pos()), TStringBuf("let"), pool); +            const auto letAtom = TAstNode::NewLiteralAtom(ctx.Expr.GetPosition(node->Pos()), TStringBuf("let"), pool);               const auto nameAtom = TAstNode::NewAtom(ctx.Expr.GetPosition(node->Pos()), name, pool);              const auto valueNode = BuildValueNode(*node, ctx, name, annotationFlags, pool, true); @@ -1681,7 +1681,7 @@ namespace {              children.push_back(AnnotateAstNode(letNode, nullptr, annotationFlags, pool, ctx.RefAtoms));          } -        const auto returnAtom = TAstNode::NewLiteralAtom(ctx.Expr.GetPosition(position), TStringBuf("return"), pool); +        const auto returnAtom = TAstNode::NewLiteralAtom(ctx.Expr.GetPosition(position), TStringBuf("return"), pool);           TSmallVec<TAstNode*> returnChildren;          returnChildren.reserve(roots.size() + 1U);          returnChildren.emplace_back(AnnotateAstNode(returnAtom, nullptr, annotationFlags, pool, ctx.RefAtoms)); @@ -1975,7 +1975,7 @@ bool CompileExpr(TAstNode& astRoot, TExprNode::TPtr& exprRoot, TExprContext& ctx          world->SetTypeAnn(compileCtx.Expr.MakeType<TWorldExprType>());      } -    compileCtx.Frames.back().Bindings[TStringBuf("world")] = {std::move(world)}; +    compileCtx.Frames.back().Bindings[TStringBuf("world")] = {std::move(world)};       auto ret = CompileFunction(*cleanRoot, compileCtx, true);      if (1U != ret.size())          return false; diff --git a/ydb/library/yql/ast/yql_type_string.cpp b/ydb/library/yql/ast/yql_type_string.cpp index af9af93259d..41bbcf6969b 100644 --- a/ydb/library/yql/ast/yql_type_string.cpp +++ b/ydb/library/yql/ast/yql_type_string.cpp @@ -96,51 +96,51 @@ bool IsTypeKeyword(int token)  EToken TokenTypeFromStr(TStringBuf str)  {      static const THashMap<TStringBuf, EToken> map = { -        { TStringBuf("String"), TOKEN_STRING }, -        { TStringBuf("Bool"), TOKEN_BOOL }, -        { TStringBuf("Int32"), TOKEN_INT32 }, -        { TStringBuf("Uint32"), TOKEN_UINT32 }, -        { TStringBuf("Int64"), TOKEN_INT64 }, -        { TStringBuf("Uint64"), TOKEN_UINT64 }, -        { TStringBuf("Float"), TOKEN_FLOAT }, -        { TStringBuf("Double"), TOKEN_DOUBLE }, -        { TStringBuf("List"), TOKEN_LIST }, -        { TStringBuf("Optional"), TOKEN_OPTIONAL }, -        { TStringBuf("Dict"), TOKEN_DICT }, -        { TStringBuf("Tuple"), TOKEN_TUPLE }, -        { TStringBuf("Struct"), TOKEN_STRUCT }, -        { TStringBuf("Resource"), TOKEN_RESOURCE }, -        { TStringBuf("Void"), TOKEN_VOID }, -        { TStringBuf("Callable"), TOKEN_CALLABLE }, -        { TStringBuf("Tagged"), TOKEN_TAGGED }, -        { TStringBuf("Yson"), TOKEN_YSON }, -        { TStringBuf("Utf8"), TOKEN_UTF8 }, -        { TStringBuf("Variant"), TOKEN_VARIANT }, -        { TStringBuf("Unit"), TOKEN_UNIT }, -        { TStringBuf("Stream"), TOKEN_STREAM }, -        { TStringBuf("Generic"), TOKEN_GENERIC }, -        { TStringBuf("Json"), TOKEN_JSON }, -        { TStringBuf("Date"), TOKEN_DATE }, -        { TStringBuf("Datetime"), TOKEN_DATETIME }, -        { TStringBuf("Timestamp"), TOKEN_TIMESTAMP }, -        { TStringBuf("Interval"), TOKEN_INTERVAL }, -        { TStringBuf("Null"), TOKEN_NULL }, -        { TStringBuf("Decimal"), TOKEN_DECIMAL }, -        { TStringBuf("Int8"), TOKEN_INT8 }, -        { TStringBuf("Uint8"), TOKEN_UINT8 }, -        { TStringBuf("Int16"), TOKEN_INT16 }, -        { TStringBuf("Uint16"), TOKEN_UINT16 }, -        { TStringBuf("TzDate"), TOKEN_TZDATE }, -        { TStringBuf("TzDatetime"), TOKEN_TZDATETIME }, -        { TStringBuf("TzTimestamp"), TOKEN_TZTIMESTAMP }, -        { TStringBuf("Uuid"), TOKEN_UUID }, -        { TStringBuf("Flow"), TOKEN_FLOW }, -        { TStringBuf("Set"), TOKEN_SET }, -        { TStringBuf("Enum"), TOKEN_ENUM }, -        { TStringBuf("EmptyList"), TOKEN_EMPTYLIST }, -        { TStringBuf("EmptyDict"), TOKEN_EMPTYDICT }, -        { TStringBuf("JsonDocument"), TOKEN_JSON_DOCUMENT }, -        { TStringBuf("DyNumber"), TOKEN_DYNUMBER }, +        { TStringBuf("String"), TOKEN_STRING },  +        { TStringBuf("Bool"), TOKEN_BOOL },  +        { TStringBuf("Int32"), TOKEN_INT32 },  +        { TStringBuf("Uint32"), TOKEN_UINT32 },  +        { TStringBuf("Int64"), TOKEN_INT64 },  +        { TStringBuf("Uint64"), TOKEN_UINT64 },  +        { TStringBuf("Float"), TOKEN_FLOAT },  +        { TStringBuf("Double"), TOKEN_DOUBLE },  +        { TStringBuf("List"), TOKEN_LIST },  +        { TStringBuf("Optional"), TOKEN_OPTIONAL },  +        { TStringBuf("Dict"), TOKEN_DICT },  +        { TStringBuf("Tuple"), TOKEN_TUPLE },  +        { TStringBuf("Struct"), TOKEN_STRUCT },  +        { TStringBuf("Resource"), TOKEN_RESOURCE },  +        { TStringBuf("Void"), TOKEN_VOID },  +        { TStringBuf("Callable"), TOKEN_CALLABLE },  +        { TStringBuf("Tagged"), TOKEN_TAGGED },  +        { TStringBuf("Yson"), TOKEN_YSON },  +        { TStringBuf("Utf8"), TOKEN_UTF8 },  +        { TStringBuf("Variant"), TOKEN_VARIANT },  +        { TStringBuf("Unit"), TOKEN_UNIT },  +        { TStringBuf("Stream"), TOKEN_STREAM },  +        { TStringBuf("Generic"), TOKEN_GENERIC },  +        { TStringBuf("Json"), TOKEN_JSON },  +        { TStringBuf("Date"), TOKEN_DATE },  +        { TStringBuf("Datetime"), TOKEN_DATETIME },  +        { TStringBuf("Timestamp"), TOKEN_TIMESTAMP },  +        { TStringBuf("Interval"), TOKEN_INTERVAL },  +        { TStringBuf("Null"), TOKEN_NULL },  +        { TStringBuf("Decimal"), TOKEN_DECIMAL },  +        { TStringBuf("Int8"), TOKEN_INT8 },  +        { TStringBuf("Uint8"), TOKEN_UINT8 },  +        { TStringBuf("Int16"), TOKEN_INT16 },  +        { TStringBuf("Uint16"), TOKEN_UINT16 },  +        { TStringBuf("TzDate"), TOKEN_TZDATE },  +        { TStringBuf("TzDatetime"), TOKEN_TZDATETIME },  +        { TStringBuf("TzTimestamp"), TOKEN_TZTIMESTAMP },  +        { TStringBuf("Uuid"), TOKEN_UUID },  +        { TStringBuf("Flow"), TOKEN_FLOW },  +        { TStringBuf("Set"), TOKEN_SET },  +        { TStringBuf("Enum"), TOKEN_ENUM },  +        { TStringBuf("EmptyList"), TOKEN_EMPTYLIST },  +        { TStringBuf("EmptyDict"), TOKEN_EMPTYDICT },  +        { TStringBuf("JsonDocument"), TOKEN_JSON_DOCUMENT },  +        { TStringBuf("DyNumber"), TOKEN_DYNUMBER },       };      auto it = map.find(str); @@ -459,7 +459,7 @@ private:                  if (optArgsStarted) {                      if (!argType->IsList() || argType->GetChildrenCount() == 0 ||                          !argType->GetChild(0)->IsAtom() || -                        argType->GetChild(0)->GetContent() != TStringBuf("OptionalType")) +                        argType->GetChild(0)->GetContent() != TStringBuf("OptionalType"))                       {                          return AddError("Optionals are only allowed in the optional arguments");                      } @@ -478,7 +478,7 @@ private:                  }                  if (argFlags) {                      if (argName.empty()) { -                        auto atom = MakeQuotedLiteralAtom(TStringBuf(""), TNodeFlags::ArbitraryContent); +                        auto atom = MakeQuotedLiteralAtom(TStringBuf(""), TNodeFlags::ArbitraryContent);                           argSettings.push_back(atom);                      }                      argSettings.push_back(MakeQuotedAtom(ToString(argFlags))); @@ -519,7 +519,7 @@ private:      bool ParseCallableArgFlags(ui32& argFlags) {          GetNextToken(); // eat '{' -        if (Token != TOKEN_IDENTIFIER || Identifier != TStringBuf("Flags")) { +        if (Token != TOKEN_IDENTIFIER || Identifier != TStringBuf("Flags")) {               AddError("Expected Flags field");              return false;          } @@ -529,7 +529,7 @@ private:          for (;;) {              if (Token == TOKEN_IDENTIFIER) { -                if (Identifier == TStringBuf("AutoMap")) { +                if (Identifier == TStringBuf("AutoMap")) {                       argFlags |= TArgumentFlags::AutoMap;                  } else {                      AddError(TString("Unknown flag name: ") + Identifier); @@ -557,7 +557,7 @@ private:      bool ParseCallablePayload(TStringBuf& payload) {          GetNextToken(); // eat '{' -        if (Token != TOKEN_IDENTIFIER && Identifier != TStringBuf("Payload")) { +        if (Token != TOKEN_IDENTIFIER && Identifier != TStringBuf("Payload")) {               AddError("Expected Payload field");              return false;          } @@ -821,12 +821,12 @@ private:              TSmallVec<TAstNode*>& args, size_t optionalArgsCount,              TAstNode* returnType, TStringBuf payload)      { -        args[0] = MakeLiteralAtom(TStringBuf("CallableType")); +        args[0] = MakeLiteralAtom(TStringBuf("CallableType"));           TSmallVec<TAstNode*> mainSettings;          if (optionalArgsCount || !payload.empty()) {              mainSettings.push_back(optionalArgsCount                  ? MakeQuotedAtom(ToString(optionalArgsCount)) -                : MakeQuotedLiteralAtom(TStringBuf("0"))); +                : MakeQuotedLiteralAtom(TStringBuf("0")));           }          if (!payload.empty()) { @@ -844,7 +844,7 @@ private:      TAstNode* MakeListType(TAstNode* itemType) {          TAstNode* items[] = { -            MakeLiteralAtom(TStringBuf("ListType")), +            MakeLiteralAtom(TStringBuf("ListType")),               itemType,          };          return MakeList(items, Y_ARRAY_SIZE(items)); @@ -852,7 +852,7 @@ private:      TAstNode* MakeStreamType(TAstNode* itemType) {          TAstNode* items[] = { -            MakeLiteralAtom(TStringBuf("StreamType")), +            MakeLiteralAtom(TStringBuf("StreamType")),               itemType,          };          return MakeList(items, Y_ARRAY_SIZE(items)); @@ -860,7 +860,7 @@ private:      TAstNode* MakeFlowType(TAstNode* itemType) {          TAstNode* items[] = { -            MakeLiteralAtom(TStringBuf("FlowType")), +            MakeLiteralAtom(TStringBuf("FlowType")),               itemType,          };          return MakeList(items, Y_ARRAY_SIZE(items)); @@ -868,7 +868,7 @@ private:      TAstNode* MakeVariantType(TAstNode* underlyingType) {          TAstNode* items[] = { -            MakeLiteralAtom(TStringBuf("VariantType")), +            MakeLiteralAtom(TStringBuf("VariantType")),               underlyingType,          };          return MakeList(items, Y_ARRAY_SIZE(items)); @@ -876,7 +876,7 @@ private:      TAstNode* MakeDictType(TAstNode* keyType, TAstNode* valueType) {          TAstNode* items[] = { -            MakeLiteralAtom(TStringBuf("DictType")), +            MakeLiteralAtom(TStringBuf("DictType")),               keyType,              valueType,          }; @@ -884,13 +884,13 @@ private:      }      TAstNode* MakeTupleType(TSmallVec<TAstNode*>& items) { -        items[0] = MakeLiteralAtom(TStringBuf("TupleType")); +        items[0] = MakeLiteralAtom(TStringBuf("TupleType"));           return MakeList(items.data(), items.size());      }      TAstNode* MakeStructType(const TMap<TString, TAstNode*>& members) {          TSmallVec<TAstNode*> items; -        items.push_back(MakeLiteralAtom(TStringBuf("StructType"))); +        items.push_back(MakeLiteralAtom(TStringBuf("StructType")));           for (const auto& member: members) {              TAstNode* memberType[] = { @@ -946,7 +946,7 @@ private:      TAstNode* MakeResourceType(TStringBuf tag) {          TAstNode* items[] = { -            MakeLiteralAtom(TStringBuf("ResourceType")), +            MakeLiteralAtom(TStringBuf("ResourceType")),               MakeQuotedAtom(tag),          };          return MakeList(items, Y_ARRAY_SIZE(items)); @@ -954,49 +954,49 @@ private:      TAstNode* MakeVoidType() {          TAstNode* items[] = { -            MakeLiteralAtom(TStringBuf("VoidType")) +            MakeLiteralAtom(TStringBuf("VoidType"))           };          return MakeList(items, Y_ARRAY_SIZE(items));      }      TAstNode* MakeNullType() {          TAstNode* items[] = { -            MakeLiteralAtom(TStringBuf("NullType")) +            MakeLiteralAtom(TStringBuf("NullType"))           };          return MakeList(items, Y_ARRAY_SIZE(items));      }      TAstNode* MakeEmptyListType() {          TAstNode* items[] = { -            MakeLiteralAtom(TStringBuf("EmptyListType")) +            MakeLiteralAtom(TStringBuf("EmptyListType"))           };          return MakeList(items, Y_ARRAY_SIZE(items));      }      TAstNode* MakeEmptyDictType() {          TAstNode* items[] = { -            MakeLiteralAtom(TStringBuf("EmptyDictType")) +            MakeLiteralAtom(TStringBuf("EmptyDictType"))           };          return MakeList(items, Y_ARRAY_SIZE(items));      }      TAstNode* MakeUnitType() {          TAstNode* items[] = { -            MakeLiteralAtom(TStringBuf("UnitType")) +            MakeLiteralAtom(TStringBuf("UnitType"))           };          return MakeList(items, Y_ARRAY_SIZE(items));      }      TAstNode* MakeGenericType() {          TAstNode* items[] = { -            MakeLiteralAtom(TStringBuf("GenericType")) +            MakeLiteralAtom(TStringBuf("GenericType"))           };          return MakeList(items, Y_ARRAY_SIZE(items));      }      TAstNode* MakeTaggedType(TAstNode* baseType, TStringBuf tag) {          TAstNode* items[] = { -            MakeLiteralAtom(TStringBuf("TaggedType")), +            MakeLiteralAtom(TStringBuf("TaggedType")),               baseType,              MakeQuotedAtom(tag)          }; @@ -1006,7 +1006,7 @@ private:      TAstNode* MakeDataType(TStringBuf type) {          TAstNode* items[] = { -            MakeLiteralAtom(TStringBuf("DataType")), +            MakeLiteralAtom(TStringBuf("DataType")),               MakeQuotedAtom(type),          };          return MakeList(items, Y_ARRAY_SIZE(items)); @@ -1014,8 +1014,8 @@ private:      TAstNode* MakeDecimalType(TStringBuf precision, TStringBuf scale) {          TAstNode* items[] = { -            MakeLiteralAtom(TStringBuf("DataType")), -            MakeQuotedAtom(TStringBuf("Decimal")), +            MakeLiteralAtom(TStringBuf("DataType")),  +            MakeQuotedAtom(TStringBuf("Decimal")),               MakeQuotedAtom(precision),              MakeQuotedAtom(scale),          }; @@ -1024,7 +1024,7 @@ private:      TAstNode* MakeOptionalType(TAstNode* type) {          TAstNode* items[] = { -            MakeLiteralAtom(TStringBuf("OptionalType")), +            MakeLiteralAtom(TStringBuf("OptionalType")),               type,          };          return MakeList(items, Y_ARRAY_SIZE(items)); @@ -1108,11 +1108,11 @@ public:  private:      void Visit(const TUnitExprType& type) final {          Y_UNUSED(type); -        Out_ << TStringBuf("Unit"); +        Out_ << TStringBuf("Unit");       }      void Visit(const TMultiExprType& type) final { -        Out_ << TStringBuf("Multi<"); +        Out_ << TStringBuf("Multi<");           const auto& items = type.GetItems();          for (ui32 i = 0; i < items.size(); ++i) {              if (i) { @@ -1124,7 +1124,7 @@ private:      }      void Visit(const TTupleExprType& type) final { -        Out_ << TStringBuf("Tuple<"); +        Out_ << TStringBuf("Tuple<");           const auto& items = type.GetItems();          for (ui32 i = 0; i < items.size(); ++i) {              if (i) { @@ -1136,7 +1136,7 @@ private:      }      void Visit(const TStructExprType& type) final { -        Out_ << TStringBuf("Struct<"); +        Out_ << TStringBuf("Struct<");           const auto& items = type.GetItems();          for (ui32 i = 0; i < items.size(); ++i) {              if (i) { @@ -1154,19 +1154,19 @@ private:      }      void Visit(const TListExprType& type) final { -        Out_ << TStringBuf("List<"); +        Out_ << TStringBuf("List<");           type.GetItemType()->Accept(*this);          Out_ << '>';      }      void Visit(const TStreamExprType& type) final { -        Out_ << TStringBuf("Stream<"); +        Out_ << TStringBuf("Stream<");           type.GetItemType()->Accept(*this);          Out_ << '>';      }      void Visit(const TFlowExprType& type) final { -        Out_ << TStringBuf("Flow<"); +        Out_ << TStringBuf("Flow<");           type.GetItemType()->Accept(*this);          Out_ << '>';      } @@ -1180,13 +1180,13 @@ private:      void Visit(const TWorldExprType& type) final {          Y_UNUSED(type); -        Out_ << TStringBuf("World"); +        Out_ << TStringBuf("World");       }      void Visit(const TOptionalExprType& type) final {          const TTypeAnnotationNode* itemType = type.GetItemType();          if (itemType->GetKind() == ETypeAnnotationKind::Callable) { -            Out_ << TStringBuf("Optional<"); +            Out_ << TStringBuf("Optional<");               itemType->Accept(*this);              Out_ << '>';          } else { @@ -1201,7 +1201,7 @@ private:          ui32 optArgsCount =                  Min<ui32>(type.GetOptionalArgumentsCount(), argsCount); -        Out_ << TStringBuf("Callable<("); +        Out_ << TStringBuf("Callable<(");           for (ui32 i = 0; i < argsCount; ++i) {              if (i) {                  Out_ << ','; @@ -1216,9 +1216,9 @@ private:              }              argInfo.Type->Accept(*this);              if (argInfo.Flags) { -                Out_ << TStringBuf("{Flags:"); +                Out_ << TStringBuf("{Flags:");                   if (argInfo.Flags & TArgumentFlags::AutoMap) { -                    Out_ << TStringBuf("AutoMap"); +                    Out_ << TStringBuf("AutoMap");                   }                  Out_ << '}';              } @@ -1228,33 +1228,33 @@ private:              Out_ << ']';          } -        Out_ << TStringBuf(")->"); +        Out_ << TStringBuf(")->");           type.GetReturnType()->Accept(*this);          if (!type.GetPayload().empty()) { -            Out_ << TStringBuf("{Payload:") << type.GetPayload() << '}'; +            Out_ << TStringBuf("{Payload:") << type.GetPayload() << '}';           }          Out_ << '>';      }      void Visit(const TResourceExprType& type) final { -        Out_ << TStringBuf("Resource<"); +        Out_ << TStringBuf("Resource<");           EscapeArbitraryAtom(type.GetTag(), '\'', &Out_);          Out_ << '>';      }      void Visit(const TTypeExprType& type) final { -        Out_ << TStringBuf("Type<"); +        Out_ << TStringBuf("Type<");           type.GetType()->Accept(*this);          Out_ << '>';      }      void Visit(const TDictExprType& type) final {          if (type.GetPayloadType()->GetKind() == ETypeAnnotationKind::Void) { -            Out_ << TStringBuf("Set<"); +            Out_ << TStringBuf("Set<");               type.GetKeyType()->Accept(*this);              Out_ << '>';          } else { -            Out_ << TStringBuf("Dict<"); +            Out_ << TStringBuf("Dict<");               type.GetKeyType()->Accept(*this);              Out_ << ',';              type.GetPayloadType()->Accept(*this); @@ -1264,31 +1264,31 @@ private:      void Visit(const TVoidExprType& type) final {          Y_UNUSED(type); -        Out_ << TStringBuf("Void"); +        Out_ << TStringBuf("Void");       }      void Visit(const TNullExprType& type) final {          Y_UNUSED(type); -        Out_ << TStringBuf("Null"); +        Out_ << TStringBuf("Null");       }      void Visit(const TEmptyListExprType& type) final {          Y_UNUSED(type); -        Out_ << TStringBuf("EmptyList"); +        Out_ << TStringBuf("EmptyList");       }      void Visit(const TEmptyDictExprType& type) final {          Y_UNUSED(type); -        Out_ << TStringBuf("EmptyDict"); +        Out_ << TStringBuf("EmptyDict");       }      void Visit(const TGenericExprType& type) final {          Y_UNUSED(type); -        Out_ << TStringBuf("Generic"); +        Out_ << TStringBuf("Generic");       }      void Visit(const TTaggedExprType& type) final { -        Out_ << TStringBuf("Tagged<"); +        Out_ << TStringBuf("Tagged<");           type.GetBaseType()->Accept(*this);          Out_ << ',';          EscapeArbitraryAtom(type.GetTag(), '\'', &Out_); @@ -1296,7 +1296,7 @@ private:      }      void Visit(const TErrorExprType& type) final { -        Out_ << TStringBuf("Error<"); +        Out_ << TStringBuf("Error<");           auto pos = type.GetError().Position;          EscapeArbitraryAtom(pos.File.empty() ? "<main>" : pos.File, '\'', &Out_);          Out_ << ':'; @@ -1311,7 +1311,7 @@ private:      void Visit(const TVariantExprType& type) final {          auto underlyingType = type.GetUnderlyingType();          if (underlyingType->GetKind() == ETypeAnnotationKind::Tuple) { -            Out_ << TStringBuf("Variant<"); +            Out_ << TStringBuf("Variant<");               auto tupleType = underlyingType->Cast<TTupleExprType>();              const auto& items = tupleType->GetItems();              for (ui32 i = 0; i < items.size(); ++i) { @@ -1328,7 +1328,7 @@ private:                   allVoid = allVoid && (items[i]->GetItemType()->GetKind() == ETypeAnnotationKind::Void);              } -            Out_ << (allVoid ? TStringBuf("Enum<") : TStringBuf("Variant<")); +            Out_ << (allVoid ? TStringBuf("Enum<") : TStringBuf("Variant<"));               for (ui32 i = 0; i < items.size(); ++i) {                  if (i) {                      Out_ << ','; diff --git a/ydb/library/yql/core/common_opt/yql_co_simple1.cpp b/ydb/library/yql/core/common_opt/yql_co_simple1.cpp index a32a6c3dabe..f2b627085a1 100644 --- a/ydb/library/yql/core/common_opt/yql_co_simple1.cpp +++ b/ydb/library/yql/core/common_opt/yql_co_simple1.cpp @@ -1435,10 +1435,10 @@ bool ShouldConvertSqlInToJoin(const TCoSqlIn& sqlIn, bool /* negated */) {      bool tableSource = false;      for (const auto& hint : sqlIn.Options()) { -        if (hint.Name().Value() == TStringBuf("isCompact")) { +        if (hint.Name().Value() == TStringBuf("isCompact")) {               return false;          } -        if (hint.Name().Value() == TStringBuf("tableSource")) { +        if (hint.Name().Value() == TStringBuf("tableSource")) {               tableSource = true;          }      } diff --git a/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.jnj b/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.jnj index 4b5733693f4..3f2e7ad51f3 100644 --- a/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.jnj +++ b/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.jnj @@ -63,13 +63,13 @@ public:      static bool Match(const TExprNode* node) {          {%- if node.Match.Type == "Callable" %} -        return node->IsCallable(TStringBuf("{{ node.Match.Name }}")); +        return node->IsCallable(TStringBuf("{{ node.Match.Name }}"));           {% elif node.Match.Type == "NodeType" %}          return node->Type() == TExprNode::{{ node.Match.TypeName }};          {% elif node.Match.Type == "CallableBase" %}          static THashSet<TStringBuf> namesToMatch = {              {%- for name in node.aux.namesToMatch %} -            TStringBuf("{{ name }}"), +            TStringBuf("{{ name }}"),               {%- endfor %}          };          return node->IsCallable(namesToMatch); @@ -83,7 +83,7 @@ public:      }          {%- if node.Match.Type == "Callable" %}      static const TStringBuf CallableName() { -        return "{{ node.Match.Name }}"sv; +        return "{{ node.Match.Name }}"sv;       }          {%- endif %}      {%- endif %} @@ -125,7 +125,7 @@ protected:          static THashSet<TStringBuf> namesToMatch = {              {%- for name in node.aux.namesToMatch %} -            TStringBuf("{{ name }}"), +            TStringBuf("{{ name }}"),               {%- endfor %}          };          if (namesToMatch.find(CallableNameHolder) == namesToMatch.end()) { diff --git a/ydb/library/yql/core/file_storage/url_meta.cpp b/ydb/library/yql/core/file_storage/url_meta.cpp index 2dd973ea06a..1b7f0f4494e 100644 --- a/ydb/library/yql/core/file_storage/url_meta.cpp +++ b/ydb/library/yql/core/file_storage/url_meta.cpp @@ -43,22 +43,22 @@ void TUrlMeta::TryReadFrom(const TString& path) {      TIFStream in(file);      THttpHeaders headers(&in);      for (auto it = headers.Begin(); it != headers.End(); ++it) { -        if (it->Name() == TStringBuf("ETag")) { +        if (it->Name() == TStringBuf("ETag")) {               ETag = it->Value();              continue;          } -        if (it->Name() == TStringBuf("ContentFile")) { +        if (it->Name() == TStringBuf("ContentFile")) {               ContentFile = it->Value();              continue;          } -        if (it->Name() == TStringBuf("Md5")) { +        if (it->Name() == TStringBuf("Md5")) {               Md5 = it->Value();              continue;          } -        if (it->Name() == TStringBuf("LastModified")) { +        if (it->Name() == TStringBuf("LastModified")) {               LastModified = it->Value();              continue;          } diff --git a/ydb/library/yql/core/services/yql_eval_expr.cpp b/ydb/library/yql/core/services/yql_eval_expr.cpp index 811f22a6054..5d1d43a63ba 100644 --- a/ydb/library/yql/core/services/yql_eval_expr.cpp +++ b/ydb/library/yql/core/services/yql_eval_expr.cpp @@ -25,10 +25,10 @@ using namespace NKikimr::NMiniKQL;  using namespace NNodes;  static THashSet<TStringBuf> EvaluationFuncs = { -    TStringBuf("EvaluateAtom"), -    TStringBuf("EvaluateExpr"), -    TStringBuf("EvaluateType"), -    TStringBuf("EvaluateCode") +    TStringBuf("EvaluateAtom"),  +    TStringBuf("EvaluateExpr"),  +    TStringBuf("EvaluateType"),  +    TStringBuf("EvaluateCode")   };  static THashSet<TStringBuf> SubqueryExpandFuncs = { diff --git a/ydb/library/yql/core/type_ann/type_ann_core.cpp b/ydb/library/yql/core/type_ann/type_ann_core.cpp index 5846e6cb108..66c25c26364 100644 --- a/ydb/library/yql/core/type_ann/type_ann_core.cpp +++ b/ydb/library/yql/core/type_ann/type_ann_core.cpp @@ -69,7 +69,7 @@ namespace NTypeAnnImpl {              isValid = NKikimr::NMiniKQL::IsValidStringValue(slot, atomNode.Content());              if (!isValid) {                  if (slot == NKikimr::NUdf::EDataSlot::Bool) { -                    isValid = (atomNode.Content() == TStringBuf("0")) || (atomNode.Content() == TStringBuf("1")); +                    isValid = (atomNode.Content() == TStringBuf("0")) || (atomNode.Content() == TStringBuf("1"));                   } else if (NKikimr::NUdf::GetDataTypeInfo(slot).Features &                      (NKikimr::NUdf::EDataTypeFeatures::DateType | NKikimr::NUdf::EDataTypeFeatures::TimeIntervalType)) {                      T data; @@ -751,7 +751,7 @@ namespace NTypeAnnImpl {              }              if (child->ChildrenSize() == 2) { -                if (child->Head().Content() == TStringBuf("epoch") || child->Head().Content() == TStringBuf("commitEpoch")) { +                if (child->Head().Content() == TStringBuf("epoch") || child->Head().Content() == TStringBuf("commitEpoch")) {                       if (!EnsureAtom(*child->Child(1), ctx.Expr)) {                          return IGraphTransformer::TStatus::Error;                      } diff --git a/ydb/library/yql/core/type_ann/type_ann_types.cpp b/ydb/library/yql/core/type_ann/type_ann_types.cpp index c27c0c433fd..2586580b6c6 100644 --- a/ydb/library/yql/core/type_ann/type_ann_types.cpp +++ b/ydb/library/yql/core/type_ann/type_ann_types.cpp @@ -892,7 +892,7 @@ namespace NTypeAnnImpl {          auto inputPos = ctx.Expr.GetPosition(input->Pos());          auto astRoot = TAstNode::NewList(inputPos, pool,              TAstNode::NewList(inputPos, pool, -                TAstNode::NewLiteralAtom(inputPos, TStringBuf("return"), pool), parsedType)); +                TAstNode::NewLiteralAtom(inputPos, TStringBuf("return"), pool), parsedType));           TExprNode::TPtr exprRoot;          if (!CompileExpr(*astRoot, exprRoot, ctx.Expr, nullptr)) {              return IGraphTransformer::TStatus::Error; diff --git a/ydb/library/yql/core/yql_callable_names.h b/ydb/library/yql/core/yql_callable_names.h index c54cc833c46..a7285482cb6 100644 --- a/ydb/library/yql/core/yql_callable_names.h +++ b/ydb/library/yql/core/yql_callable_names.h @@ -4,15 +4,15 @@  namespace NYql { -constexpr TStringBuf LeftName = "Left!"; -constexpr TStringBuf RightName = "Right!"; -constexpr TStringBuf SyncName = "Sync!"; -constexpr TStringBuf IfName = "If!"; -constexpr TStringBuf ForName = "For!"; -constexpr TStringBuf CommitName = "Commit!"; -constexpr TStringBuf ReadName = "Read!"; -constexpr TStringBuf WriteName = "Write!"; -constexpr TStringBuf ConfigureName = "Configure!"; -constexpr TStringBuf ConsName = "Cons!"; +constexpr TStringBuf LeftName = "Left!";  +constexpr TStringBuf RightName = "Right!";  +constexpr TStringBuf SyncName = "Sync!";  +constexpr TStringBuf IfName = "If!";  +constexpr TStringBuf ForName = "For!";  +constexpr TStringBuf CommitName = "Commit!";  +constexpr TStringBuf ReadName = "Read!";  +constexpr TStringBuf WriteName = "Write!";  +constexpr TStringBuf ConfigureName = "Configure!";  +constexpr TStringBuf ConsName = "Cons!";   } // namespace NYql diff --git a/ydb/library/yql/core/yql_csv.cpp b/ydb/library/yql/core/yql_csv.cpp index 259b6144f1b..f2e0b537d22 100644 --- a/ydb/library/yql/core/yql_csv.cpp +++ b/ydb/library/yql/core/yql_csv.cpp @@ -170,7 +170,7 @@ TCsvOutputStream::TCsvOutputStream(IOutputStream& slave, char delimiter, bool qu  void TCsvOutputStream::DoWrite(const void* buf, size_t len)  {      TStringBuf charBuf(reinterpret_cast<const char*>(buf), len); -    if (charBuf == TStringBuf("\n")) { +    if (charBuf == TStringBuf("\n")) {           WasNL_ = true;          Slave_.Write(buf, len);      } else { diff --git a/ydb/library/yql/core/yql_expr_type_annotation.cpp b/ydb/library/yql/core/yql_expr_type_annotation.cpp index f2b793af8d3..f880cd6fb02 100644 --- a/ydb/library/yql/core/yql_expr_type_annotation.cpp +++ b/ydb/library/yql/core/yql_expr_type_annotation.cpp @@ -27,8 +27,8 @@ using namespace NKikimr;  namespace { -constexpr TStringBuf TypeResourceTag = "_Type"; -constexpr TStringBuf CodeResourceTag = "_Expr"; +constexpr TStringBuf TypeResourceTag = "_Type";  +constexpr TStringBuf CodeResourceTag = "_Expr";   TExprNode::TPtr RebuildDict(const TExprNode::TPtr& node, const TExprNode::TPtr& lambda, TExprContext& ctx) {      auto ret = ctx.Builder(node->Pos()) @@ -4572,15 +4572,15 @@ static TString GetStructDiff(const TStructExprType& left, const TStructExprType&      for (auto item: left.GetItems()) {          if (auto rightItem = rightItems.Value(item->GetName(), nullptr)) {              if (!IsSameAnnotation(*item, *rightItem)) { -                res << item->GetName() << '(' << GetTypeDiff(*item->GetItemType(), *rightItem->GetItemType()) << TStringBuf("),"); +                res << item->GetName() << '(' << GetTypeDiff(*item->GetItemType(), *rightItem->GetItemType()) << TStringBuf("),");               }              rightItems.erase(item->GetName());          } else { -            res << '-' << item->GetName() << '(' << *item->GetItemType() << TStringBuf("),"); +            res << '-' << item->GetName() << '(' << *item->GetItemType() << TStringBuf("),");           }      }      for (auto& item: rightItems) { -        res << '+' << item.first << '(' << *item.second->GetItemType() << TStringBuf("),"); +        res << '+' << item.first << '(' << *item.second->GetItemType() << TStringBuf("),");       }      if (!res.empty()) {          return res.pop_back(); // remove trailing comma @@ -4596,31 +4596,31 @@ TString GetTypeDiff(const TTypeAnnotationNode& left, const TTypeAnnotationNode&      if (left.GetKind() == right.GetKind()) {          switch (left.GetKind()) {          case ETypeAnnotationKind::List: -            res << TStringBuf("List<") +            res << TStringBuf("List<")                   << GetTypeDiff(*left.Cast<TListExprType>()->GetItemType(), *right.Cast<TListExprType>()->GetItemType())                  << '>';              return res;          case ETypeAnnotationKind::Stream: -            res << TStringBuf("Stream<") +            res << TStringBuf("Stream<")                   << GetTypeDiff(*left.Cast<TStreamExprType>()->GetItemType(), *right.Cast<TStreamExprType>()->GetItemType())                  << '>';                  return res;          case ETypeAnnotationKind::Struct: -            res << TStringBuf("Struct<") +            res << TStringBuf("Struct<")                   << GetStructDiff(*left.Cast<TStructExprType>(), *right.Cast<TStructExprType>())                  << '>';              return res;          case ETypeAnnotationKind::Flow: -            res << TStringBuf("Flow<") +            res << TStringBuf("Flow<")                   << GetTypeDiff(*left.Cast<TFlowExprType>()->GetItemType(), *right.Cast<TFlowExprType>()->GetItemType())                  << '>';                  return res;          default: -            res << left << TStringBuf("!=") << right; +            res << left << TStringBuf("!=") << right;               return res;          }      } -    res << left.GetKind() << TStringBuf("!=") << right.GetKind(); +    res << left.GetKind() << TStringBuf("!=") << right.GetKind();       return res;  } @@ -4814,7 +4814,7 @@ TExprNode::TPtr ExpandType(TPositionHandle position, const TTypeAnnotationNode&  }  bool IsSystemMember(const TStringBuf& memberName) { -    return memberName.StartsWith(TStringBuf("_yql_")); +    return memberName.StartsWith(TStringBuf("_yql_"));   }  IGraphTransformer::TStatus NormalizeTupleOfAtoms(const TExprNode::TPtr& input, ui32 index, TExprNode::TPtr& output, TExprContext& ctx, diff --git a/ydb/library/yql/core/yql_expr_type_annotation.h b/ydb/library/yql/core/yql_expr_type_annotation.h index a865aa27cd9..3e41efd60f7 100644 --- a/ydb/library/yql/core/yql_expr_type_annotation.h +++ b/ydb/library/yql/core/yql_expr_type_annotation.h @@ -27,10 +27,10 @@ T FromString(const TExprNode& node, NKikimr::NUdf::EDataSlot slot) {              return out.Get<T>();          } else if (slot == NKikimr::NUdf::EDataSlot::Bool) {              T value = T(); -            if (node.Content() == TStringBuf("0")) { +            if (node.Content() == TStringBuf("0")) {                   *(ui8*)&value = 0;                  return value; -            } else if (node.Content() == TStringBuf("1")) { +            } else if (node.Content() == TStringBuf("1")) {                   *(ui8*)&value = 1;                  return value;              } diff --git a/ydb/library/yql/dq/opt/dq_opt.h b/ydb/library/yql/dq/opt/dq_opt.h index 5b3146d0f42..9caeef250a1 100644 --- a/ydb/library/yql/dq/opt/dq_opt.h +++ b/ydb/library/yql/dq/opt/dq_opt.h @@ -10,7 +10,7 @@ namespace NYql::NDq {  struct TDqStageSettings {      static constexpr TStringBuf LogicalIdSettingName = "_logical_id"; -    static constexpr TStringBuf IdSettingName = "_id"; +    static constexpr TStringBuf IdSettingName = "_id";       static constexpr TStringBuf SinglePartitionSettingName = "_single_partition";      static constexpr TStringBuf IsExternalSetting = "is_external_function";      static constexpr TStringBuf TransformNameSetting = "transform_name"; diff --git a/ydb/library/yql/dq/opt/dq_opt_join.cpp b/ydb/library/yql/dq/opt/dq_opt_join.cpp index 4097b49e24a..767c43563d2 100644 --- a/ydb/library/yql/dq/opt/dq_opt_join.cpp +++ b/ydb/library/yql/dq/opt/dq_opt_join.cpp @@ -89,10 +89,10 @@ TMaybe<TJoinInputDesc> BuildDqJoin(const TCoEquiJoinTuple& joinTuple,      TStringBuf joinType = joinTuple.Type().Value();      TSet<std::pair<TStringBuf, TStringBuf>> resultKeys; -    if (joinType != TStringBuf("RightOnly") && joinType != TStringBuf("RightSemi")) { +    if (joinType != TStringBuf("RightOnly") && joinType != TStringBuf("RightSemi")) {           resultKeys.insert(left->Keys.begin(), left->Keys.end());      } -    if (joinType != TStringBuf("LeftOnly") && joinType != TStringBuf("LeftSemi")) { +    if (joinType != TStringBuf("LeftOnly") && joinType != TStringBuf("LeftSemi")) {           resultKeys.insert(right->Keys.begin(), right->Keys.end());      } diff --git a/ydb/library/yql/dq/type_ann/dq_type_ann.cpp b/ydb/library/yql/dq/type_ann/dq_type_ann.cpp index fcbd3bb9ecf..f12271f3f6a 100644 --- a/ydb/library/yql/dq/type_ann/dq_type_ann.cpp +++ b/ydb/library/yql/dq/type_ann/dq_type_ann.cpp @@ -357,7 +357,7 @@ const TStructExprType* GetDqJoinResultType(const TExprNode::TPtr& input, bool st      auto leftStructType = leftInputItemType->Cast<TStructExprType>();      auto leftTableLabel = join.LeftLabel().Maybe<TCoAtom>()          ? join.LeftLabel().Cast<TCoAtom>().Value() -        : TStringBuf(""); +        : TStringBuf("");       auto rightInputItemType = GetSeqItemType(rightInputType);      if (!EnsureStructType(join.Pos(), *rightInputItemType, ctx)) { @@ -366,7 +366,7 @@ const TStructExprType* GetDqJoinResultType(const TExprNode::TPtr& input, bool st      auto rightStructType = rightInputItemType->Cast<TStructExprType>();      auto rightTableLabel = join.RightLabel().Maybe<TCoAtom>()          ? join.RightLabel().Cast<TCoAtom>().Value() -        : TStringBuf(""); +        : TStringBuf("");       return GetDqJoinResultType<IsMapJoin>(join.Pos(), *leftStructType, leftTableLabel, *rightStructType,          rightTableLabel, join.JoinType(), join.JoinKeys(), ctx); diff --git a/ydb/library/yql/minikql/comp_nodes/ut/mkql_combine_ut.cpp b/ydb/library/yql/minikql/comp_nodes/ut/mkql_combine_ut.cpp index 0a147c619da..0df534bc48c 100644 --- a/ydb/library/yql/minikql/comp_nodes/ut/mkql_combine_ut.cpp +++ b/ydb/library/yql/minikql/comp_nodes/ut/mkql_combine_ut.cpp @@ -155,8 +155,8 @@ TRuntimeNode MakeStream(TSetup_<LLVM>& setup, ui64 peakStep) {      TCallableBuilder callableBuilder(*setup.Env, WithYields ? "TestYieldStream" : "TestStream",          pb.NewStreamType(              pb.NewStructType({ -                {TStringBuf("a"), pb.NewDataType(NUdf::EDataSlot::Uint64)}, -                {TStringBuf("b"), pb.NewDataType(NUdf::EDataSlot::String)} +                {TStringBuf("a"), pb.NewDataType(NUdf::EDataSlot::Uint64)},  +                {TStringBuf("b"), pb.NewDataType(NUdf::EDataSlot::String)}               })          )      ); @@ -177,8 +177,8 @@ TRuntimeNode Combine(TProgramBuilder& pb, TRuntimeNode stream, std::function<TRu          const auto a = pb.Add(pb.Member(item, "a"), pb.Member(state, "a"));          const auto b = pb.Concat(pb.Member(item, "b"), pb.Member(state, "b"));          return pb.NewStruct({ -            {TStringBuf("a"), a}, -            {TStringBuf("b"), b}, +            {TStringBuf("a"), a},  +            {TStringBuf("b"), b},           });      }; diff --git a/ydb/library/yql/minikql/comp_nodes/ut/mkql_sort_ut.cpp b/ydb/library/yql/minikql/comp_nodes/ut/mkql_sort_ut.cpp index 2457baabc0c..311b2169f42 100644 --- a/ydb/library/yql/minikql/comp_nodes/ut/mkql_sort_ut.cpp +++ b/ydb/library/yql/minikql/comp_nodes/ut/mkql_sort_ut.cpp @@ -24,8 +24,8 @@ TRuntimeNode MakeStream(TSetup<LLVM>& setup) {      TCallableBuilder callableBuilder(*setup.Env, "TestYieldStream",          pgmBuilder.NewStreamType(              pgmBuilder.NewStructType({ -                {TStringBuf("a"), pgmBuilder.NewDataType(NUdf::EDataSlot::Uint64)}, -                {TStringBuf("b"), pgmBuilder.NewDataType(NUdf::EDataSlot::String)} +                {TStringBuf("a"), pgmBuilder.NewDataType(NUdf::EDataSlot::Uint64)},  +                {TStringBuf("b"), pgmBuilder.NewDataType(NUdf::EDataSlot::String)}               })          )      ); diff --git a/ydb/library/yql/minikql/compact_hash.h b/ydb/library/yql/minikql/compact_hash.h index a9586db4640..3d47d55d7d3 100644 --- a/ydb/library/yql/minikql/compact_hash.h +++ b/ydb/library/yql/minikql/compact_hash.h @@ -528,9 +528,9 @@ public:      void PrintStat(IOutputStream& out) const {          size_t usedPages = 0;          if (std::is_same<TPrimary, TSecondary>::value) { -            usedPages = Pools[0].PrintStat(TStringBuf(""), out); +            usedPages = Pools[0].PrintStat(TStringBuf(""), out);           } else { -            usedPages = Pools[0].PrintStat(TStringBuf("Primary: "), out) + Pools[1].PrintStat(TStringBuf("Secondary: "), out); +            usedPages = Pools[0].PrintStat(TStringBuf("Primary: "), out) + Pools[1].PrintStat(TStringBuf("Secondary: "), out);           }          GetPagePool().PrintStat(usedPages, out);      } diff --git a/ydb/library/yql/minikql/computation/mkql_computation_node_list_ut.cpp b/ydb/library/yql/minikql/computation/mkql_computation_node_list_ut.cpp index f8a90d60fe3..4657052c7b9 100644 --- a/ydb/library/yql/minikql/computation/mkql_computation_node_list_ut.cpp +++ b/ydb/library/yql/minikql/computation/mkql_computation_node_list_ut.cpp @@ -7,7 +7,7 @@ namespace NKikimr {  namespace NMiniKQL {  Y_UNIT_TEST_SUITE(TestListRepresentation) {      Y_UNIT_TEST(Test) { -        TMemoryUsageInfo memInfo(TStringBuf("test")); +        TMemoryUsageInfo memInfo(TStringBuf("test"));           TScopedAlloc alloc;          using TListType = TListRepresentation<ui32, 256>;          TListType list1; diff --git a/ydb/library/yql/minikql/computation/mkql_value_builder.cpp b/ydb/library/yql/minikql/computation/mkql_value_builder.cpp index ad476617158..7509ee8d787 100644 --- a/ydb/library/yql/minikql/computation/mkql_value_builder.cpp +++ b/ydb/library/yql/minikql/computation/mkql_value_builder.cpp @@ -31,7 +31,7 @@ void TDefaultValueBuilder::SetCalleePositionHolder(const NUdf::TSourcePosition*&  }  void TDefaultValueBuilder::Terminate(const char* message) const { -    TStringBuf reason = (message ? TStringBuf(message) : TStringBuf("(unknown)")); +    TStringBuf reason = (message ? TStringBuf(message) : TStringBuf("(unknown)"));       TString fullMessage = TStringBuilder() <<          "Terminate was called, reason(" << reason.size() << "): " << reason << Endl;      HolderFactory_.CleanupModulesOnTerminate(); diff --git a/ydb/library/yql/minikql/computation/presort_ut.cpp b/ydb/library/yql/minikql/computation/presort_ut.cpp index 4adf957ca1b..95069cf78c5 100644 --- a/ydb/library/yql/minikql/computation/presort_ut.cpp +++ b/ydb/library/yql/minikql/computation/presort_ut.cpp @@ -9,8 +9,8 @@  #include <util/string/hex.h> -using namespace std::literals::string_view_literals; - +using namespace std::literals::string_view_literals;  +   namespace NKikimr {  namespace NMiniKQL { @@ -337,24 +337,24 @@ Y_UNIT_TEST(Double) {  Y_UNIT_TEST(String) {      const TVector<std::tuple<TStringBuf, TString, TString>> values = { -        {TStringBuf(""), "00", "FF"}, -        {"\x00"sv, "1F00000000000000000000000000000001", +        {TStringBuf(""), "00", "FF"},  +        {"\x00"sv, "1F00000000000000000000000000000001",               "E0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"}, -        {"\x01", "1F01000000000000000000000000000001", +        {"\x01", "1F01000000000000000000000000000001",               "E0FEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"}, -        {"0", "1F30000000000000000000000000000001", +        {"0", "1F30000000000000000000000000000001",               "E0CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"}, -        {"0123", "1F30313233000000000000000000000004", +        {"0123", "1F30313233000000000000000000000004",               "E0CFCECDCCFFFFFFFFFFFFFFFFFFFFFFFB"}, -        {"0123456789abcde", "1F3031323334353637383961626364650F", +        {"0123456789abcde", "1F3031323334353637383961626364650F",               "E0CFCECDCCCBCAC9C8C7C69E9D9C9B9AF0"}, -        {"a", "1F61000000000000000000000000000001", +        {"a", "1F61000000000000000000000000000001",               "E09EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"}, -        {"a\x00"sv, "1F61000000000000000000000000000002", +        {"a\x00"sv, "1F61000000000000000000000000000002",               "E09EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD"}, -        {"abc", "1F61626300000000000000000000000003", +        {"abc", "1F61626300000000000000000000000003",               "E09E9D9CFFFFFFFFFFFFFFFFFFFFFFFFFC"}, -        {"b", "1F62000000000000000000000000000001", +        {"b", "1F62000000000000000000000000000001",               "E09DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"},      };      TPresortTest().ValidateEncoding<NUdf::EDataSlot::String>(values); @@ -362,13 +362,13 @@ Y_UNIT_TEST(String) {  Y_UNIT_TEST(Uuid) {      const TVector<std::tuple<TStringBuf, TString, TString>> values = { -        {"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"sv, +        {"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"sv,               "00000000000000000000000000000000",              "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"}, -        {"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1"sv, +        {"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1"sv,               "00000000000000000000000000000001",              "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"}, -        {"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", +        {"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff",               "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",              "00000000000000000000000000000000"},      }; @@ -439,7 +439,7 @@ Y_UNIT_TEST(GenericVoid) {      NUdf::TUnboxedValue value = NUdf::TUnboxedValuePod::Void();      TGenericPresortEncoder encoder(type);      auto buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("")); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf(""));   }  Y_UNIT_TEST(GenericBool) { @@ -449,9 +449,9 @@ Y_UNIT_TEST(GenericBool) {      NUdf::TUnboxedValue value = NUdf::TUnboxedValuePod(true);      TGenericPresortEncoder encoder(type);      auto buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01")); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01"));       buf = encoder.Encode(value, true); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\xFE")); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\xFE"));   }  Y_UNIT_TEST(GenericNumber) { @@ -461,7 +461,7 @@ Y_UNIT_TEST(GenericNumber) {      NUdf::TUnboxedValue value = NUdf::TUnboxedValuePod(ui32(1234));      TGenericPresortEncoder encoder(type);      auto buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x00\x00\x04\xD2"sv)); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x00\x00\x04\xD2"sv));   }  Y_UNIT_TEST(GenericString) { @@ -471,7 +471,7 @@ Y_UNIT_TEST(GenericString) {      NUdf::TUnboxedValue value = MakeString("ALongStringExample");      TGenericPresortEncoder encoder(type);      auto buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x1F" "ALongStringExam\x1Fple\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03"sv)); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x1F" "ALongStringExam\x1Fple\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03"sv));   }  Y_UNIT_TEST(GenericOptional) { @@ -481,10 +481,10 @@ Y_UNIT_TEST(GenericOptional) {      NUdf::TUnboxedValue value = NUdf::TUnboxedValuePod(true);      TGenericPresortEncoder encoder(type);      auto buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x01")); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x01"));       value = {};      buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x00"sv)); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x00"sv));   }  Y_UNIT_TEST(NestedOptional) { @@ -523,17 +523,17 @@ Y_UNIT_TEST(GenericList) {      auto value = holderFactory.GetEmptyContainer();      TGenericPresortEncoder encoder(type);      auto buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x00"sv)); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x00"sv));       NUdf::TUnboxedValue* items;      value = holderFactory.CreateDirectArrayHolder(1, items);      items[0] = NUdf::TUnboxedValuePod(true);      buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x01\x00"sv)); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x01\x00"sv));       value = holderFactory.CreateDirectArrayHolder(2, items);      items[0] = NUdf::TUnboxedValuePod(true);      items[1] = NUdf::TUnboxedValuePod(false);      buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x01\x01\x00\x00"sv)); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x01\x01\x00\x00"sv));   }  Y_UNIT_TEST(GenericTuple) { @@ -551,7 +551,7 @@ Y_UNIT_TEST(GenericTuple) {      items[1] = NUdf::TUnboxedValuePod(ui32(1234));      TGenericPresortEncoder encoder(type);      auto buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x00\x00\x04\xD2"sv)); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x00\x00\x04\xD2"sv));   }  Y_UNIT_TEST(GenericStruct) { @@ -569,7 +569,7 @@ Y_UNIT_TEST(GenericStruct) {      items[1] = NUdf::TUnboxedValuePod(ui32(1234));      TGenericPresortEncoder encoder(type);      auto buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x00\x00\x04\xD2"sv)); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x00\x00\x04\xD2"sv));   }  Y_UNIT_TEST(GenericTupleVariant) { @@ -585,10 +585,10 @@ Y_UNIT_TEST(GenericTupleVariant) {      TGenericPresortEncoder encoder(type);      auto value = holderFactory.CreateVariantHolder(NUdf::TUnboxedValuePod(true), 0);      auto buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x00\x01"sv)); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x00\x01"sv));       value = holderFactory.CreateVariantHolder(NUdf::TUnboxedValuePod(ui32(1234)), 1);      buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x00\x00\x04\xD2"sv)); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x00\x00\x04\xD2"sv));   }  Y_UNIT_TEST(GenericStructVariant) { @@ -604,10 +604,10 @@ Y_UNIT_TEST(GenericStructVariant) {      TGenericPresortEncoder encoder(type);      auto value = holderFactory.CreateVariantHolder(NUdf::TUnboxedValuePod(true), 0);      auto buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x00\x01"sv)); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x00\x01"sv));       value = holderFactory.CreateVariantHolder(NUdf::TUnboxedValuePod(ui32(1234)), 1);      buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x00\x00\x04\xD2"sv)); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x00\x00\x04\xD2"sv));   }  Y_UNIT_TEST(GenericDict) { @@ -626,18 +626,18 @@ Y_UNIT_TEST(GenericDict) {      auto value = holderFactory.GetEmptyContainer();      TGenericPresortEncoder encoder(type);      auto buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x00"sv)); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x00"sv));       value = holderFactory.CreateDirectHashedDictHolder([](TValuesDictHashMap& map) {          map.emplace(NUdf::TUnboxedValuePod(ui32(1234)), NUdf::TUnboxedValuePod(true));      }, keyTypes, false, true, nullptr);      buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x00\x00\x04\xD2\x01\x00"sv)); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x00\x00\x04\xD2\x01\x00"sv));       value = holderFactory.CreateDirectHashedDictHolder([](TValuesDictHashMap& map) {          map.emplace(NUdf::TUnboxedValuePod(ui32(5678)), NUdf::TUnboxedValuePod(false));          map.emplace(NUdf::TUnboxedValuePod(ui32(1234)), NUdf::TUnboxedValuePod(true));      }, keyTypes, false, true, nullptr);      buf = encoder.Encode(value, false); -    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x00\x00\x04\xD2\x01\x01\x00\x00\x16\x2E\x00\x00"sv)); +    UNIT_ASSERT_NO_DIFF(buf, TStringBuf("\x01\x00\x00\x04\xD2\x01\x01\x00\x00\x16\x2E\x00\x00"sv));   }  } diff --git a/ydb/library/yql/minikql/mkql_function_registry.cpp b/ydb/library/yql/minikql/mkql_function_registry.cpp index d3545ad138d..f51361e3918 100644 --- a/ydb/library/yql/minikql/mkql_function_registry.cpp +++ b/ydb/library/yql/minikql/mkql_function_registry.cpp @@ -407,7 +407,7 @@ public:          Y_UNUSED(pos);          Y_UNUSED(secureParamsProvider);          Y_UNUSED(funcInfo); -        return TStatus::Error(TStringBuf("Unsupported access to builtins registry")); +        return TStatus::Error(TStringBuf("Unsupported access to builtins registry"));       }      TMaybe<TString> FindUdfPath( diff --git a/ydb/library/yql/minikql/mkql_function_registry.h b/ydb/library/yql/minikql/mkql_function_registry.h index f18152cb24e..f787e74ca9f 100644 --- a/ydb/library/yql/minikql/mkql_function_registry.h +++ b/ydb/library/yql/minikql/mkql_function_registry.h @@ -142,7 +142,7 @@ inline TStringBuf ModuleName(const TStringBuf& name) {      return name;  } -const TStringBuf StaticModulePrefix(TStringBuf("<static>::")); +const TStringBuf StaticModulePrefix(TStringBuf("<static>::"));   void FillStaticModules(IMutableFunctionRegistry& registry); diff --git a/ydb/library/yql/minikql/mkql_mem_info.h b/ydb/library/yql/minikql/mkql_mem_info.h index 8e880d1db30..8881eb3205c 100644 --- a/ydb/library/yql/minikql/mkql_mem_info.h +++ b/ydb/library/yql/minikql/mkql_mem_info.h @@ -144,10 +144,10 @@ public:      inline ui64 GetPeak() const { return Peak_; }      inline void PrintTo(IOutputStream& out) const { -        out << Title_ << TStringBuf(": usage=") << GetUsage() -            << TStringBuf(" (allocated=") << GetAllocated() -            << TStringBuf(", freed=") << GetFreed() -            << TStringBuf(", peak=") << GetPeak() +        out << Title_ << TStringBuf(": usage=") << GetUsage()  +            << TStringBuf(" (allocated=") << GetAllocated()  +            << TStringBuf(", freed=") << GetFreed()  +            << TStringBuf(", peak=") << GetPeak()               << ')';      } @@ -159,9 +159,9 @@ public:                  continue;              }              ++leakCount; -            Cerr << TStringBuf("Not freed ") -                << it.first << TStringBuf(" size: ") << it.second.Size -                << TStringBuf(", location: ") << it.second.Location +            Cerr << TStringBuf("Not freed ")  +                << it.first << TStringBuf(" size: ") << it.second.Size  +                << TStringBuf(", location: ") << it.second.Location                   << Endl;          } diff --git a/ydb/library/yql/minikql/mkql_node.cpp b/ydb/library/yql/minikql/mkql_node.cpp index 4c6f3e45ad4..e1ef0895e3b 100644 --- a/ydb/library/yql/minikql/mkql_node.cpp +++ b/ydb/library/yql/minikql/mkql_node.cpp @@ -183,7 +183,7 @@ TStringBuf TType::KindAsStr(EKind kind) {          MKQL_TYPE_KINDS(MKQL_SWITCH_ENUM_TYPE_TO_STR)      } -    return TStringBuf("unknown"); +    return TStringBuf("unknown");   }  TStringBuf TType::GetKindAsStr() const { diff --git a/ydb/library/yql/minikql/mkql_program_builder.cpp b/ydb/library/yql/minikql/mkql_program_builder.cpp index 47ae6e4c8fc..61a8ff9c86e 100644 --- a/ydb/library/yql/minikql/mkql_program_builder.cpp +++ b/ydb/library/yql/minikql/mkql_program_builder.cpp @@ -12,8 +12,8 @@  #include <util/string/printf.h>  #include <array> -using namespace std::string_view_literals; - +using namespace std::string_view_literals;  +   namespace NKikimr {  namespace NMiniKQL { @@ -4752,7 +4752,7 @@ TRuntimeNode TProgramBuilder::Default(TType* type) {      const auto scheme = targetType->GetSchemeType();      const auto value = scheme == NUdf::TDataType<NUdf::TUuid>::Id ? -        Env.NewStringValue("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"sv) : +        Env.NewStringValue("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"sv) :           scheme == NUdf::TDataType<NUdf::TDyNumber>::Id ? NUdf::TUnboxedValuePod::Embedded("\1") : NUdf::TUnboxedValuePod::Zero();      return TRuntimeNode(TDataLiteral::Create(value, targetType, Env), true);  } diff --git a/ydb/library/yql/minikql/mkql_type_ops.cpp b/ydb/library/yql/minikql/mkql_type_ops.cpp index d559bb108ce..cc01604e03b 100644 --- a/ydb/library/yql/minikql/mkql_type_ops.cpp +++ b/ydb/library/yql/minikql/mkql_type_ops.cpp @@ -46,7 +46,7 @@ struct TTimezones {      TTimezones() {          NResource::TResources resList; -        const TStringBuf prefix = "/cctz/tzdata/"; +        const TStringBuf prefix = "/cctz/tzdata/";           NResource::FindMatch(prefix, &resList);          const auto allTimezones = NUdf::GetTimezones();          for (ui16 id = 0; id < allTimezones.size(); ++id) { @@ -1581,7 +1581,7 @@ NUdf::TUnboxedValuePod ParseInterval(const std::string_view& buf) {  bool IsValidStringValue(NUdf::EDataSlot type, NUdf::TStringRef buf) {      switch (type) {      case NUdf::EDataSlot::Bool: -        return AsciiEqualsIgnoreCase(buf, TStringBuf("true")) || AsciiEqualsIgnoreCase(buf, TStringBuf("false")); +        return AsciiEqualsIgnoreCase(buf, TStringBuf("true")) || AsciiEqualsIgnoreCase(buf, TStringBuf("false"));       case NUdf::EDataSlot::Int8:          return IsValidNumberString<i8>(buf); @@ -1639,10 +1639,10 @@ bool IsValidStringValue(NUdf::EDataSlot type, NUdf::TStringRef buf) {  NUdf::TUnboxedValuePod ValueFromString(NUdf::EDataSlot type, NUdf::TStringRef buf) {      switch (type) {      case NUdf::EDataSlot::Bool: { -        if (AsciiEqualsIgnoreCase(buf, TStringBuf("true"))) { +        if (AsciiEqualsIgnoreCase(buf, TStringBuf("true"))) {               return NUdf::TUnboxedValuePod(true);          } -        if (AsciiEqualsIgnoreCase(buf, TStringBuf("false"))) { +        if (AsciiEqualsIgnoreCase(buf, TStringBuf("false"))) {               return NUdf::TUnboxedValuePod(false);          }          return NUdf::TUnboxedValuePod(); diff --git a/ydb/library/yql/minikql/mkql_type_ops_ut.cpp b/ydb/library/yql/minikql/mkql_type_ops_ut.cpp index 01828a9a525..273b3b53570 100644 --- a/ydb/library/yql/minikql/mkql_type_ops_ut.cpp +++ b/ydb/library/yql/minikql/mkql_type_ops_ut.cpp @@ -71,36 +71,36 @@ Y_UNIT_TEST_SUITE(TMiniKQLTypeOps) {          ui16 tzId;          ui16 date; -        UNIT_ASSERT(DeserializeTzDate(TStringBuilder() << "\x00\xea"sv << "\x00\x01"sv, date, tzId)); +        UNIT_ASSERT(DeserializeTzDate(TStringBuilder() << "\x00\xea"sv << "\x00\x01"sv, date, tzId));           UNIT_ASSERT_VALUES_EQUAL(date, 234);          UNIT_ASSERT_VALUES_EQUAL(tzId, 1);          {              TStringStream out;              SerializeTzDate(date, tzId, out); -            UNIT_ASSERT_VALUES_EQUAL(out.Str(), TStringBuilder() << "\x00\xea"sv << "\x00\x01"sv); +            UNIT_ASSERT_VALUES_EQUAL(out.Str(), TStringBuilder() << "\x00\xea"sv << "\x00\x01"sv);           }          ui32 datetime; -        UNIT_ASSERT(DeserializeTzDatetime(TStringBuilder() << "\x00\x00\x02\x37"sv << "\x00\x01"sv, datetime, tzId)); +        UNIT_ASSERT(DeserializeTzDatetime(TStringBuilder() << "\x00\x00\x02\x37"sv << "\x00\x01"sv, datetime, tzId));           UNIT_ASSERT_VALUES_EQUAL(datetime, 567);          UNIT_ASSERT_VALUES_EQUAL(tzId, 1);          {              TStringStream out;              SerializeTzDatetime(datetime, tzId, out); -            UNIT_ASSERT_VALUES_EQUAL(out.Str(), TStringBuilder() << "\x00\x00\x02\x37"sv << "\x00\x01"sv); +            UNIT_ASSERT_VALUES_EQUAL(out.Str(), TStringBuilder() << "\x00\x00\x02\x37"sv << "\x00\x01"sv);           }          ui64 timestamp; -        UNIT_ASSERT(DeserializeTzTimestamp(TStringBuilder() << "\x00\x00\x00\x00\x00\x00\x03\x7a"sv << "\x00\x01"sv, timestamp, tzId)); +        UNIT_ASSERT(DeserializeTzTimestamp(TStringBuilder() << "\x00\x00\x00\x00\x00\x00\x03\x7a"sv << "\x00\x01"sv, timestamp, tzId));           UNIT_ASSERT_VALUES_EQUAL(timestamp, 890);          UNIT_ASSERT_VALUES_EQUAL(tzId, 1);          {              TStringStream out;              SerializeTzTimestamp(timestamp, tzId, out); -            UNIT_ASSERT_VALUES_EQUAL(out.Str(), TStringBuilder() << "\x00\x00\x00\x00\x00\x00\x03\x7a"sv << "\x00\x01"sv); +            UNIT_ASSERT_VALUES_EQUAL(out.Str(), TStringBuilder() << "\x00\x00\x00\x00\x00\x00\x03\x7a"sv << "\x00\x01"sv);           }      }  } diff --git a/ydb/library/yql/minikql/mkql_utils.h b/ydb/library/yql/minikql/mkql_utils.h index 0c22d2857c5..9627ec5f0d1 100644 --- a/ydb/library/yql/minikql/mkql_utils.h +++ b/ydb/library/yql/minikql/mkql_utils.h @@ -24,7 +24,7 @@ public:      }      inline static TStatus Error() { -        return TStatus(TString(TStringBuf("Error: "))); +        return TStatus(TString(TStringBuf("Error: ")));       }      template <class T> diff --git a/ydb/library/yql/providers/common/codec/yql_codec_results.h b/ydb/library/yql/providers/common/codec/yql_codec_results.h index e34d2a3a689..3a8a5ffdd71 100644 --- a/ydb/library/yql/providers/common/codec/yql_codec_results.h +++ b/ydb/library/yql/providers/common/codec/yql_codec_results.h @@ -13,7 +13,7 @@ namespace NCommon {  // write null as entity  class TYsonResultWriter {  public: -    static constexpr TStringBuf VoidString = "Void"; +    static constexpr TStringBuf VoidString = "Void";   public:      explicit TYsonResultWriter(NYson::TYsonConsumerBase& writer) diff --git a/ydb/library/yql/providers/common/codec/yql_restricted_yson.cpp b/ydb/library/yql/providers/common/codec/yql_restricted_yson.cpp index 08b4521748d..3d5be7c7f8b 100644 --- a/ydb/library/yql/providers/common/codec/yql_restricted_yson.cpp +++ b/ydb/library/yql/providers/common/codec/yql_restricted_yson.cpp @@ -24,7 +24,7 @@ public:      void OnStringScalar(TStringBuf value) override {          Open(); -        Type(TStringBuf("string")); +        Type(TStringBuf("string"));           Buffer.clear();          bool isAscii = true; @@ -55,35 +55,35 @@ public:      void OnInt64Scalar(i64 value) override {          Open(); -        Type(TStringBuf("int64")); +        Type(TStringBuf("int64"));           Value(ToString(value));          Close();      }      void OnUint64Scalar(ui64 value) override {          Open(); -        Type(TStringBuf("uint64")); +        Type(TStringBuf("uint64"));           Value(ToString(value));          Close();      }      void OnDoubleScalar(double value) override {          Open(); -        Type(TStringBuf("double")); +        Type(TStringBuf("double"));           Value(::FloatToString(value));          Close();      }      void OnBooleanScalar(bool value) override {          Open(); -        Type(TStringBuf("boolean")); -        Value(value ? TStringBuf("true") : TStringBuf("false")); +        Type(TStringBuf("boolean"));  +        Value(value ? TStringBuf("true") : TStringBuf("false"));           Close();      }      void OnEntity() override {          if (AfterAttributes) { -            Writer.OnKeyedItem(TStringBuf("$value")); +            Writer.OnKeyedItem(TStringBuf("$value"));               Writer.OnEntity();              Writer.OnEndMap();              AfterAttributes = false; @@ -94,7 +94,7 @@ public:      void OnBeginList() override {          if (AfterAttributes) { -            Writer.OnKeyedItem(TStringBuf("$value")); +            Writer.OnKeyedItem(TStringBuf("$value"));           }          Writer.OnBeginList(); @@ -117,7 +117,7 @@ public:      void OnBeginMap() override {          if (AfterAttributes) { -            Writer.OnKeyedItem(TStringBuf("$value")); +            Writer.OnKeyedItem(TStringBuf("$value"));           }          Writer.OnBeginMap(); @@ -144,7 +144,7 @@ public:      void OnBeginAttributes() override {          Writer.OnBeginMap(); -        Writer.OnKeyedItem(TStringBuf("$attributes")); +        Writer.OnKeyedItem(TStringBuf("$attributes"));           Writer.OnBeginMap();      } @@ -165,12 +165,12 @@ public:      }      void Type(const TStringBuf& type) { -        Writer.OnKeyedItem(TStringBuf("$type")); +        Writer.OnKeyedItem(TStringBuf("$type"));           Writer.OnUtf8StringScalar(type);      }      void Value(const TStringBuf& value) { -        Writer.OnKeyedItem(TStringBuf("$value")); +        Writer.OnKeyedItem(TStringBuf("$value"));           Writer.OnUtf8StringScalar(value);      } diff --git a/ydb/library/yql/providers/common/comp_nodes/yql_maketype.cpp b/ydb/library/yql/providers/common/comp_nodes/yql_maketype.cpp index fe3d3c626ee..1dc9353ecf7 100644 --- a/ydb/library/yql/providers/common/comp_nodes/yql_maketype.cpp +++ b/ydb/library/yql/providers/common/comp_nodes/yql_maketype.cpp @@ -278,7 +278,7 @@ public:                  NUdf::TUnboxedValue flagValue;                  while (flagsIterator.Next(flagValue)) {                      auto flagName = TStringBuf(flagValue.AsStringRef()); -                    if (flagName == TStringBuf("AutoMap")) { +                    if (flagName == TStringBuf("AutoMap")) {                           info.Flags |= NUdf::ICallablePayload::TArgumentFlags::AutoMap;                      } else {                          UdfTerminate((TStringBuilder() << Pos_ << ": Unknown flag: " << flagName << ", known flags: AutoMap.").data()); @@ -293,7 +293,7 @@ public:              auto optCountValue = Args_.size() > 2 ? Args_[2]->GetValue(ctx) : NUdf::TUnboxedValue();              auto payloadValue = Args_.size() > 3 ? Args_[3]->GetValue(ctx) : NUdf::TUnboxedValue();              auto optCount = optCountValue ? optCountValue.template Get<ui32>() : 0; -            auto payload = payloadValue ? TStringBuf(payloadValue.AsStringRef()) : TStringBuf(""); +            auto payload = payloadValue ? TStringBuf(payloadValue.AsStringRef()) : TStringBuf("");               auto callableType = exprCtxPtr->template MakeType<NYql::TCallableExprType>(resultType, args, optCount, payload);              if (!callableType->Validate(Pos_, *exprCtxPtr)) {                  UdfTerminate(exprCtxPtr->IssueManager.GetIssues().ToString().data()); diff --git a/ydb/library/yql/providers/common/comp_nodes/yql_parsetypehandle.cpp b/ydb/library/yql/providers/common/comp_nodes/yql_parsetypehandle.cpp index 8919e250a18..dafcbe6196d 100644 --- a/ydb/library/yql/providers/common/comp_nodes/yql_parsetypehandle.cpp +++ b/ydb/library/yql/providers/common/comp_nodes/yql_parsetypehandle.cpp @@ -35,7 +35,7 @@ public:          auto exprCtxPtr = GetExprContextPtr(ctx, ExprCtxMutableIndex_);          auto astRoot = NYql::TAstNode::NewList({}, pool,              NYql::TAstNode::NewList({}, pool, -                NYql::TAstNode::NewLiteralAtom({}, TStringBuf("return"), pool), parsedType)); +                NYql::TAstNode::NewLiteralAtom({}, TStringBuf("return"), pool), parsedType));           NYql::TExprNode::TPtr exprRoot;          if (!CompileExpr(*astRoot, exprRoot, *exprCtxPtr, nullptr)) {              UdfTerminate(exprCtxPtr->IssueManager.GetIssues().ToString().data()); diff --git a/ydb/library/yql/providers/common/comp_nodes/yql_splittype.cpp b/ydb/library/yql/providers/common/comp_nodes/yql_splittype.cpp index 84415beae0f..20714b5d971 100644 --- a/ydb/library/yql/providers/common/comp_nodes/yql_splittype.cpp +++ b/ydb/library/yql/providers/common/comp_nodes/yql_splittype.cpp @@ -167,7 +167,7 @@ public:                  if (flags & NUdf::ICallablePayload::TArgumentFlags::AutoMap) {                      NUdf::TUnboxedValue* inplaceFlags = nullptr;                      flagsList = ctx.HolderFactory.CreateDirectArrayHolder(1, inplaceFlags); -                    inplaceFlags[0] = MakeString(TStringBuf("AutoMap")); +                    inplaceFlags[0] = MakeString(TStringBuf("AutoMap"));                   }                  inplaceArg[0] = flagsList; // Flags diff --git a/ydb/library/yql/providers/common/config/yql_configuration_transformer.cpp b/ydb/library/yql/providers/common/config/yql_configuration_transformer.cpp index 9fbd44acb3d..2c33d79c023 100644 --- a/ydb/library/yql/providers/common/config/yql_configuration_transformer.cpp +++ b/ydb/library/yql/providers/common/config/yql_configuration_transformer.cpp @@ -63,7 +63,7 @@ IGraphTransformer::TStatus TProviderConfigurationTransformer::DoTransform(TExprN              }              auto atom = node->Child(2)->Content(); -            if (atom == TStringBuf("Attr")) { +            if (atom == TStringBuf("Attr")) {                   if (!EnsureMinArgsCount(*node, 4, ctx)) {                      return nullptr;                  } @@ -99,7 +99,7 @@ IGraphTransformer::TStatus TProviderConfigurationTransformer::DoTransform(TExprN                  if (!HandleAttr(node->Child(3)->Pos(), clusterName, name, value, ctx)) {                      return nullptr;                  } -            } else if (atom == TStringBuf("Auth")) { +            } else if (atom == TStringBuf("Auth")) {                   if (!EnsureArgsCount(*node, 4, ctx)) {                      return nullptr;                  } diff --git a/ydb/library/yql/providers/common/config/yql_dispatch.h b/ydb/library/yql/providers/common/config/yql_dispatch.h index 7389cbf082b..5438e8c7dbf 100644 --- a/ydb/library/yql/providers/common/config/yql_dispatch.h +++ b/ydb/library/yql/providers/common/config/yql_dispatch.h @@ -206,7 +206,7 @@ public:              THashSet<TType> allowed(container.cbegin(), container.cend());              Validators_.push_back([allowed = std::move(allowed)](const TString&, TType value) {                  if (!allowed.has(value)) { -                    throw yexception() << "Value " << value << " is not in set of allowed values: " << JoinSeq(TStringBuf(","), allowed); +                    throw yexception() << "Value " << value << " is not in set of allowed values: " << JoinSeq(TStringBuf(","), allowed);                   }              });              return *this; @@ -216,7 +216,7 @@ public:              THashSet<TType> allowed(list);              Validators_.push_back([allowed = std::move(allowed)](const TString&, TType value) {                  if (!allowed.contains(value)) { -                    throw yexception() << "Value " << value << " is not in set of allowed values: " << JoinSeq(TStringBuf(","), allowed); +                    throw yexception() << "Value " << value << " is not in set of allowed values: " << JoinSeq(TStringBuf(","), allowed);                   }              });              return *this; diff --git a/ydb/library/yql/providers/common/provider/yql_provider.cpp b/ydb/library/yql/providers/common/provider/yql_provider.cpp index aa782ee93ff..50d863fe15a 100644 --- a/ydb/library/yql/providers/common/provider/yql_provider.cpp +++ b/ydb/library/yql/providers/common/provider/yql_provider.cpp @@ -492,8 +492,8 @@ bool FillUsedFilesImpl(              }          } -        if (moduleName == TStringBuf("Geo")) { -            const auto geobase = TUserDataKey::File(TStringBuf("/home/geodata6.bin")); +        if (moduleName == TStringBuf("Geo")) {  +            const auto geobase = TUserDataKey::File(TStringBuf("/home/geodata6.bin"));               if (const auto block = types.UserDataStorage->FindUserDataBlock(geobase)) {                  files.emplace(geobase, *block).first->second.Usage.Set(EUserDataBlockUsage::Path);              } else { diff --git a/ydb/library/yql/providers/config/yql_config_provider.cpp b/ydb/library/yql/providers/config/yql_config_provider.cpp index 6952e96cf07..cb3215e12ec 100644 --- a/ydb/library/yql/providers/config/yql_config_provider.cpp +++ b/ydb/library/yql/providers/config/yql_config_provider.cpp @@ -551,7 +551,7 @@ namespace {                  Types.Diagnostics = true;              } -            else if (name == TStringBuf("Warning")) { +            else if (name == TStringBuf("Warning")) {                   if (!SetWarningRule(pos, args, ctx)) {                      return false;                  } diff --git a/ydb/library/yql/providers/config/yql_config_provider.h b/ydb/library/yql/providers/config/yql_config_provider.h index ea1f47508ac..7bb0e300c39 100644 --- a/ydb/library/yql/providers/config/yql_config_provider.h +++ b/ydb/library/yql/providers/config/yql_config_provider.h @@ -8,7 +8,7 @@ namespace NYql {  class TGatewaysConfig; -const TStringBuf ConfReadName = "ConfRead!"; +const TStringBuf ConfReadName = "ConfRead!";   using TAllowSettingPolicy = std::function<bool(TStringBuf settingName)>; diff --git a/ydb/library/yql/providers/dq/provider/exec/yql_dq_exectransformer.cpp b/ydb/library/yql/providers/dq/provider/exec/yql_dq_exectransformer.cpp index 8759f442219..02ecca6397d 100644 --- a/ydb/library/yql/providers/dq/provider/exec/yql_dq_exectransformer.cpp +++ b/ydb/library/yql/providers/dq/provider/exec/yql_dq_exectransformer.cpp @@ -226,8 +226,8 @@ public:          , DqTypeAnnotationTransformer(              CreateTypeAnnotationTransformer(NDq::CreateDqTypeAnnotationTransformer(*State->TypeCtx), *State->TypeCtx))      { -        AddHandler({TStringBuf("Result")}, RequireNone(), Hndl(&TInMemoryExecTransformer::HandleResult)); -        AddHandler({TStringBuf("Pull")}, RequireNone(), Hndl(&TInMemoryExecTransformer::HandlePull)); +        AddHandler({TStringBuf("Result")}, RequireNone(), Hndl(&TInMemoryExecTransformer::HandleResult));  +        AddHandler({TStringBuf("Pull")}, RequireNone(), Hndl(&TInMemoryExecTransformer::HandlePull));           AddHandler({TDqCnResult::CallableName()}, RequireNone(), Pass());          AddHandler({TDqQuery::CallableName()}, RequireFirst(), Pass());      } @@ -333,7 +333,7 @@ private:                  if (!callable.HasResult()) {                      const auto& callableType = callable.GetType();                      const auto& name = callableType->GetNameStr(); -                    if (name == TStringBuf("FolderPath")) +                    if (name == TStringBuf("FolderPath"))                       {                          const TString folderName(AS_VALUE(TDataLiteral, callable.GetInput(0))->AsValue().AsStringRef());                          auto blocks = TUserDataStorage::FindUserDataFolder(files, folderName); @@ -368,7 +368,7 @@ private:                          if (result.GetNode() != node) {                              callable.SetResult(result, typeEnv);                          } -                    } else if (name == TStringBuf("FileContent") || name == TStringBuf("FilePath")) { +                    } else if (name == TStringBuf("FileContent") || name == TStringBuf("FilePath")) {                           const TString fileName(AS_VALUE(TDataLiteral, callable.GetInput(0))->AsValue().AsStringRef());                          auto block = TUserDataStorage::FindUserDataBlock(files, fileName); @@ -382,14 +382,14 @@ private:                          switch (block->Type) {                              case EUserDataType::URL:                              case EUserDataType::PATH: { -                                TString content = (name == TStringBuf("FilePath")) +                                TString content = (name == TStringBuf("FilePath"))                                       ? fullFileName                                      : TFileInput(block->FrozenFile->GetPath()).ReadAll();                                  result = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>(content);                                  break;                              }                              case EUserDataType::RAW_INLINE_DATA: { -                                TString content = (name == TStringBuf("FilePath")) +                                TString content = (name == TStringBuf("FilePath"))                                       ? fullFileName                                      : block->Data;                                  result = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>(content); @@ -402,7 +402,7 @@ private:                          if (result.GetNode() != node) {                              callable.SetResult(result, typeEnv);                          } -                        if (name == TStringBuf("FilePath")) { +                        if (name == TStringBuf("FilePath")) {                               // filePath, fileName, md5                              auto f = IDqGateway::TFileResource();                              f.SetLocalPath(filePath); @@ -412,7 +412,7 @@ private:                              f.SetSize(block->FrozenFile->GetSize());                              uploadList->emplace(f);                          } -                    } else if (name == TStringBuf("Udf") || name == TStringBuf("ScriptUdf")) { +                    } else if (name == TStringBuf("Udf") || name == TStringBuf("ScriptUdf")) {                           const TString udfName(AS_VALUE(TDataLiteral, callable.GetInput(0))->AsValue().AsStringRef());                          const auto moduleName = ModuleName(udfName); @@ -435,7 +435,7 @@ private:                              uploadList->emplace(f);                          } -                        if (moduleName == TStringBuf("Geo")) { +                        if (moduleName == TStringBuf("Geo")) {                               TString fileName = "/home/geodata6.bin";                              auto block = TUserDataStorage::FindUserDataBlock(files, fileName);                              MKQL_ENSURE(block, "File not found: " << fileName); @@ -536,14 +536,14 @@ private:                      const auto& callableType = callable.GetType();                      const auto& name = callableType->GetNameStr(); -                    if (name == TStringBuf("Udf") || name == TStringBuf("ScriptUdf")) { +                    if (name == TStringBuf("Udf") || name == TStringBuf("ScriptUdf")) {                           const TString udfName(AS_VALUE(TDataLiteral, callable.GetInput(0))->AsValue().AsStringRef());                          const auto moduleName = ModuleName(udfName);                          *untrustedUdfFlag = *untrustedUdfFlag || -                            callable.GetType()->GetName() == TStringBuf("ScriptUdf") || +                            callable.GetType()->GetName() == TStringBuf("ScriptUdf") ||                               !State->FunctionRegistry->IsLoadedUdfModule(moduleName) || -                            moduleName == TStringBuf("Geo"); +                            moduleName == TStringBuf("Geo");                       }                  }              } diff --git a/ydb/library/yql/providers/solomon/provider/yql_solomon_datasink.cpp b/ydb/library/yql/providers/solomon/provider/yql_solomon_datasink.cpp index b09fd381a07..411ecf362bb 100644 --- a/ydb/library/yql/providers/solomon/provider/yql_solomon_datasink.cpp +++ b/ydb/library/yql/providers/solomon/provider/yql_solomon_datasink.cpp @@ -98,17 +98,17 @@ public:          auto write = maybeWrite.Cast();          auto& key = write.Arg(2).Ref(); -        if (!key.IsCallable(TStringBuf("Key"))) { -            ctx.AddError(TIssue(ctx.GetPosition(key.Pos()), TStringBuf("Expected key"))); +        if (!key.IsCallable(TStringBuf("Key"))) {  +            ctx.AddError(TIssue(ctx.GetPosition(key.Pos()), TStringBuf("Expected key")));               return {};          }          if (key.ChildrenSize() < 1) { -            ctx.AddError(TIssue(ctx.GetPosition(key.Pos()), TStringBuf("Key must have at least one component"))); +            ctx.AddError(TIssue(ctx.GetPosition(key.Pos()), TStringBuf("Key must have at least one component")));               return {};          }          auto tagName = key.Child(0)->Child(0)->Content(); -        if (tagName != TStringBuf("table")) { +        if (tagName != TStringBuf("table")) {               ctx.AddError(TIssue(ctx.GetPosition(key.Child(0)->Pos()),                  TStringBuilder() << "Unexpected tag: " << tagName));              return {}; diff --git a/ydb/library/yql/public/issue/yql_issue.cpp b/ydb/library/yql/public/issue/yql_issue.cpp index 3b89156874b..c634047a180 100644 --- a/ydb/library/yql/public/issue/yql_issue.cpp +++ b/ydb/library/yql/public/issue/yql_issue.cpp @@ -224,7 +224,7 @@ TIssue ExceptionToIssue(const std::exception& e, const TPosition& pos) {      return issue;  } -static constexpr TStringBuf TerminationMessageMarker = "Terminate was called, reason("; +static constexpr TStringBuf TerminationMessageMarker = "Terminate was called, reason(";   TMaybe<TPosition> TryParseTerminationMessage(TStringBuf& message) {      size_t len = 0; diff --git a/ydb/library/yql/public/issue/yql_issue_ut.cpp b/ydb/library/yql/public/issue/yql_issue_ut.cpp index 87b417da391..a9bf6a11bc1 100644 --- a/ydb/library/yql/public/issue/yql_issue_ut.cpp +++ b/ydb/library/yql/public/issue/yql_issue_ut.cpp @@ -83,10 +83,10 @@ Y_UNIT_TEST_SUITE(TextWalkerTest) {          pos.Row = 1;          TTextWalker walker(pos); -        walker.Advance(TStringBuf("a\r\taa")); +        walker.Advance(TStringBuf("a\r\taa"));           UNIT_ASSERT_VALUES_EQUAL(pos, TPosition(5, 1)); -        walker.Advance(TStringBuf("\na")); +        walker.Advance(TStringBuf("\na"));           UNIT_ASSERT_VALUES_EQUAL(pos, TPosition(1, 2));      } @@ -95,11 +95,11 @@ Y_UNIT_TEST_SUITE(TextWalkerTest) {          pos.Row = 1;          TTextWalker walker(pos); -        walker.Advance(TStringBuf("a\raa\r")); +        walker.Advance(TStringBuf("a\raa\r"));           UNIT_ASSERT_VALUES_EQUAL(pos, TPosition(4, 1));          walker.Advance('\n');          UNIT_ASSERT_VALUES_EQUAL(pos, TPosition(4, 1)); -        walker.Advance(TStringBuf("\r\r\ra")); +        walker.Advance(TStringBuf("\r\r\ra"));           UNIT_ASSERT_VALUES_EQUAL(pos, TPosition(4, 2));          walker.Advance('\r');          UNIT_ASSERT_VALUES_EQUAL(pos, TPosition(4, 2)); diff --git a/ydb/library/yql/public/udf/udf_data_type.cpp b/ydb/library/yql/public/udf/udf_data_type.cpp index e9ac59c3b28..ad309898901 100644 --- a/ydb/library/yql/public/udf/udf_data_type.cpp +++ b/ydb/library/yql/public/udf/udf_data_type.cpp @@ -79,12 +79,12 @@ TMaybe<TCastResultOptions> GetCastResult(EDataSlot source, EDataSlot target) {      case xId: return EDataSlot::xName;  #define UDF_TYPE_PARSE(xName, xUnused1, xUnused2, xUnused3, xUnused4, xUnused5) \ -    if (TStringBuf(#xName) == str) {                        \ +    if (TStringBuf(#xName) == str) {                        \           return EDataSlot::xName;                           \      }  #define UDF_TYPE_INFO(xName, xId, xType, xFeatures, xLayoutType, xParamsCount) \ -    { TStringBuf(#xName), xId, static_cast<EDataTypeFeatures>(xFeatures), \ +    { TStringBuf(#xName), xId, static_cast<EDataTypeFeatures>(xFeatures), \           TPlainDataType<xType>::Result || TTzDataType<xType>::Result ? sizeof(xLayoutType) : 0, xParamsCount, GetDecimalWidth(static_cast<EDataTypeFeatures>(xFeatures), sizeof(xLayoutType)) },  TMaybe<EDataSlot> FindDataSlot(TDataTypeId id) { diff --git a/ydb/library/yql/public/udf/udf_type_builder.h b/ydb/library/yql/public/udf/udf_type_builder.h index 8bfc73a449d..00ba1b26f83 100644 --- a/ydb/library/yql/public/udf/udf_type_builder.h +++ b/ydb/library/yql/public/udf/udf_type_builder.h @@ -436,7 +436,7 @@ struct TSourcePosition {  UDF_ASSERT_TYPE_SIZE(TSourcePosition, 24);  inline IOutputStream& operator<<(IOutputStream& os, const TSourcePosition& pos) { -    os << (pos.File_.Size() ? TStringBuf(pos.File_) : TStringBuf("<main>")) << ':' << pos.Row_ << ':' << pos.Column_ << ':'; +    os << (pos.File_.Size() ? TStringBuf(pos.File_) : TStringBuf("<main>")) << ':' << pos.Row_ << ':' << pos.Column_ << ':';       return os;  } diff --git a/ydb/library/yql/public/udf/udf_validate.cpp b/ydb/library/yql/public/udf/udf_validate.cpp index be61b79cf29..c748f1d6b4a 100644 --- a/ydb/library/yql/public/udf/udf_validate.cpp +++ b/ydb/library/yql/public/udf/udf_validate.cpp @@ -21,7 +21,7 @@ TStringBuf ValidateModeAsStr(EValidateMode validateMode) {          UDF_VALIDATE_MODE(SWITCH_ENUM_TYPE_TO_STR)      } -    return TStringBuf("unknown"); +    return TStringBuf("unknown");   }  EValidateMode ValidateModeByStr(const TString& validateModeStr) { @@ -39,7 +39,7 @@ TStringBuf ValidatePolicyAsStr(EValidatePolicy validatePolicy) {          UDF_VALIDATE_POLICY(SWITCH_ENUM_TYPE_TO_STR)      } -    return TStringBuf("unknown"); +    return TStringBuf("unknown");   }  EValidatePolicy ValidatePolicyByStr(const TString& validatePolicyStr) { diff --git a/ydb/library/yql/sql/v0/builtin.cpp b/ydb/library/yql/sql/v0/builtin.cpp index a0945f9d05e..b845713b5c2 100644 --- a/ydb/library/yql/sql/v0/builtin.cpp +++ b/ydb/library/yql/sql/v0/builtin.cpp @@ -1477,7 +1477,7 @@ public:      {}      bool DoInit(TContext& ctx, ISource* src) override { -        const bool isPython = ModuleName.find(TStringBuf("Python")) != TString::npos; +        const bool isPython = ModuleName.find(TStringBuf("Python")) != TString::npos;           if (!isPython) {              if (Args.size() != 2) {                  ctx.Error(Pos) << ModuleName << " script declaration requires exactly two parameters"; diff --git a/ydb/library/yql/sql/v0/query.cpp b/ydb/library/yql/sql/v0/query.cpp index 7752b28b017..f988e2900d4 100644 --- a/ydb/library/yql/sql/v0/query.cpp +++ b/ydb/library/yql/sql/v0/query.cpp @@ -1093,21 +1093,21 @@ public:          Node = Y();          Node = L(Node, AstNode(TString(ConfigureName))); -        Node = L(Node, AstNode(TString(TStringBuf("world")))); +        Node = L(Node, AstNode(TString(TStringBuf("world"))));           Node = L(Node, datasource); -        if (Name == TStringBuf("flags")) { +        if (Name == TStringBuf("flags")) {               for (ui32 i = 0; i < Values.size(); ++i) {                  Node = L(Node, Values[i].Build());              }          } -        else if (Name == TStringBuf("AddFileByUrl") || Name == TStringBuf("AddFolderByUrl") || Name == TStringBuf("ImportUdfs")) { +        else if (Name == TStringBuf("AddFileByUrl") || Name == TStringBuf("AddFolderByUrl") || Name == TStringBuf("ImportUdfs")) {               Node = L(Node, BuildQuotedAtom(Pos, Name));              for (ui32 i = 0; i < Values.size(); ++i) {                  Node = L(Node, Values[i].Build());              }          } -        else if (Name == TStringBuf("auth")) { +        else if (Name == TStringBuf("auth")) {               Node = L(Node, BuildQuotedAtom(Pos, "Auth"));              Node = L(Node, Values.empty() ? BuildQuotedAtom(Pos, TString()) : Values.front().Build());          } diff --git a/ydb/library/yql/sql/v1/builtin.cpp b/ydb/library/yql/sql/v1/builtin.cpp index 43ef1243f10..0198ce8fe99 100644 --- a/ydb/library/yql/sql/v1/builtin.cpp +++ b/ydb/library/yql/sql/v1/builtin.cpp @@ -2122,7 +2122,7 @@ public:      {}      bool DoInit(TContext& ctx, ISource* src) override { -        const bool isPython = ModuleName.find(TStringBuf("Python")) != TString::npos; +        const bool isPython = ModuleName.find(TStringBuf("Python")) != TString::npos;           if (!isPython) {              if (Args.size() != 2) {                  ctx.Error(Pos) << ModuleName << " script declaration requires exactly two parameters"; diff --git a/ydb/library/yql/sql/v1/query.cpp b/ydb/library/yql/sql/v1/query.cpp index 725356b9f57..6413c4bd94d 100644 --- a/ydb/library/yql/sql/v1/query.cpp +++ b/ydb/library/yql/sql/v1/query.cpp @@ -1808,21 +1808,21 @@ public:          Node = Y();          Node = L(Node, AstNode(TString(ConfigureName))); -        Node = L(Node, AstNode(TString(TStringBuf("world")))); +        Node = L(Node, AstNode(TString(TStringBuf("world"))));           Node = L(Node, datasource); -        if (Name == TStringBuf("flags")) { +        if (Name == TStringBuf("flags")) {               for (ui32 i = 0; i < Values.size(); ++i) {                  Node = L(Node, Values[i].Build());              }          } -        else if (Name == TStringBuf("AddFileByUrl") || Name == TStringBuf("AddFolderByUrl") || Name == TStringBuf("ImportUdfs") || Name == TStringBuf("SetPackageVersion")) { +        else if (Name == TStringBuf("AddFileByUrl") || Name == TStringBuf("AddFolderByUrl") || Name == TStringBuf("ImportUdfs") || Name == TStringBuf("SetPackageVersion")) {               Node = L(Node, BuildQuotedAtom(Pos, Name));              for (ui32 i = 0; i < Values.size(); ++i) {                  Node = L(Node, Values[i].Build());              }          } -        else if (Name == TStringBuf("auth")) { +        else if (Name == TStringBuf("auth")) {               Node = L(Node, BuildQuotedAtom(Pos, "Auth"));              Node = L(Node, Values.empty() ? BuildQuotedAtom(Pos, TString()) : Values.front().Build());          } diff --git a/ydb/library/yql/utils/fetch/fetch.cpp b/ydb/library/yql/utils/fetch/fetch.cpp index 100c88c3858..6636483dcc6 100644 --- a/ydb/library/yql/utils/fetch/fetch.cpp +++ b/ydb/library/yql/utils/fetch/fetch.cpp @@ -32,7 +32,7 @@ public:          ui16 port = 80;          bool https = false; -        if (url.Get(THttpURL::FieldScheme) == TStringBuf("https")) { +        if (url.Get(THttpURL::FieldScheme) == TStringBuf("https")) {               port = 443;              https = true;          } @@ -44,7 +44,7 @@ public:          TString req;          {              TStringOutput rqs(req); -            TStringBuf userAgent = "User-Agent: Mozilla/5.0 (compatible; YQL/1.0)"; +            TStringBuf userAgent = "User-Agent: Mozilla/5.0 (compatible; YQL/1.0)";               IOutputStream::TPart request[] = {                  IOutputStream::TPart("GET ", 4), @@ -91,7 +91,7 @@ public:      THttpURL GetRedirectURL(const THttpURL& baseUrl) override {          for (auto i = HttpInput->Headers().Begin(); i != HttpInput->Headers().End(); ++i) { -            if (0 == TCiString::compare(i->Name(), TStringBuf("location"))) { +            if (0 == TCiString::compare(i->Name(), TStringBuf("location"))) {                   THttpURL target = ParseURL(i->Value(), THttpURL::FeaturesAll | NUri::TFeature::FeatureConvertHostIDN);                  if (!target.IsValidAbs()) {                      target.Merge(baseUrl); diff --git a/ydb/library/yql/utils/log/context.cpp b/ydb/library/yql/utils/log/context.cpp index b591c42a779..91a884aa828 100644 --- a/ydb/library/yql/utils/log/context.cpp +++ b/ydb/library/yql/utils/log/context.cpp @@ -46,7 +46,7 @@ void OutputLogCtx(IOutputStream* out, bool withBraces) {          }          if (withBraces) { -            (*out) << TStringBuf("} "); +            (*out) << TStringBuf("} ");           }      }  } @@ -75,7 +75,7 @@ TAutoPtr<TLogElement> TContextPreprocessor::Preprocess(  void TYqlLogContextLocation::SetThrowedLogContextPath() const {      TStringStream ss; -    ss << Location_ << TStringBuf(": "); +    ss << Location_ << TStringBuf(": ");       OutputLogCtx(&ss, true);      TThrowedLogContext* tlc = FastTlsSingleton<TThrowedLogContext>();      tlc->LocationWithLogContext = ss.Str(); diff --git a/ydb/library/yql/utils/log/log.cpp b/ydb/library/yql/utils/log/log.cpp index b62bfeb907a..f8834a83b30 100644 --- a/ydb/library/yql/utils/log/log.cpp +++ b/ydb/library/yql/utils/log/log.cpp @@ -146,16 +146,16 @@ void TYqlLog::WriteLogPrefix(IOutputStream* out, EComponent component, ELevel le      WriteLocalTime(out);      *out << ' '               << ELevelHelpers::ToString(level) << ' ' -             << ProcName_ << TStringBuf("(pid=") << ProcId_ -             << TStringBuf(", tid=") +             << ProcName_ << TStringBuf("(pid=") << ProcId_  +             << TStringBuf(", tid=")   #ifdef _unix_               << Hex(SystemCurrentThreadIdImpl())  #else               << SystemCurrentThreadIdImpl()  #endif -             << TStringBuf(") [") << EComponentHelpers::ToString(component) -             << TStringBuf("] ") -             << file.RAfter(LOCSLASH_C) << ':' << line << TStringBuf(": "); +             << TStringBuf(") [") << EComponentHelpers::ToString(component)  +             << TStringBuf("] ")  +             << file.RAfter(LOCSLASH_C) << ':' << line << TStringBuf(": ");   }  void TYqlLog::SetMaxLogLimit(ui64 limit) { @@ -174,15 +174,15 @@ void InitLogger(const TString& logType, bool startAsDaemon) {          levels.fill(ELevel::INFO);          if (startAsDaemon && ( -                TStringBuf("console") == logType || -                TStringBuf("cout") == logType || -                TStringBuf("cerr") == logType)) +                TStringBuf("console") == logType ||  +                TStringBuf("cout") == logType ||  +                TStringBuf("cerr") == logType))           {              TLoggerOperator<TYqlLog>::Set(new TYqlLog("null", levels));              return;          } -        if (TStringBuf("syslog") == logType) { +        if (TStringBuf("syslog") == logType) {               auto backend = MakeHolder<TSysLogBackend>(                          GetProgramName().data(), TSysLogBackend::TSYSLOG_LOCAL1);              auto& logger = TLoggerOperator<TYqlLog>::Log(); diff --git a/ydb/library/yql/utils/log/log_component.h b/ydb/library/yql/utils/log/log_component.h index d7a1e10ca16..a56dd0b5b54 100644 --- a/ydb/library/yql/utils/log/log_component.h +++ b/ydb/library/yql/utils/log/log_component.h @@ -50,26 +50,26 @@ struct EComponentHelpers {      static TStringBuf ToString(EComponent component) {          switch (component) { -        case EComponent::Default: return TStringBuf("default"); -        case EComponent::Core: return TStringBuf("core"); -        case EComponent::CoreEval: return TStringBuf("core eval"); -        case EComponent::CorePeepHole: return TStringBuf("core peephole"); -        case EComponent::CoreExecution: return TStringBuf("core exec"); -        case EComponent::Sql: return TStringBuf("sql"); -        case EComponent::ProviderCommon: return TStringBuf("common provider"); -        case EComponent::ProviderConfig: return TStringBuf("CONFIG"); -        case EComponent::ProviderResult: return TStringBuf("RESULT"); -        case EComponent::ProviderYt: return TStringBuf("YT"); -        case EComponent::ProviderKikimr: return TStringBuf("KIKIMR"); -        case EComponent::ProviderKqp: return TStringBuf("KQP"); -        case EComponent::ProviderRtmr: return TStringBuf("RTMR"); -        case EComponent::Performance: return TStringBuf("perf"); -        case EComponent::Net: return TStringBuf("net"); -        case EComponent::ProviderStat: return TStringBuf("STATFACE"); -        case EComponent::ProviderSolomon: return TStringBuf("SOLOMON"); -        case EComponent::ProviderDq: return TStringBuf("DQ"); -        case EComponent::ProviderClickHouse: return TStringBuf("CLICKHOUSE"); -        case EComponent::ProviderYdb: return TStringBuf("YDB"); +        case EComponent::Default: return TStringBuf("default");  +        case EComponent::Core: return TStringBuf("core");  +        case EComponent::CoreEval: return TStringBuf("core eval");  +        case EComponent::CorePeepHole: return TStringBuf("core peephole");  +        case EComponent::CoreExecution: return TStringBuf("core exec");  +        case EComponent::Sql: return TStringBuf("sql");  +        case EComponent::ProviderCommon: return TStringBuf("common provider");  +        case EComponent::ProviderConfig: return TStringBuf("CONFIG");  +        case EComponent::ProviderResult: return TStringBuf("RESULT");  +        case EComponent::ProviderYt: return TStringBuf("YT");  +        case EComponent::ProviderKikimr: return TStringBuf("KIKIMR");  +        case EComponent::ProviderKqp: return TStringBuf("KQP");  +        case EComponent::ProviderRtmr: return TStringBuf("RTMR");  +        case EComponent::Performance: return TStringBuf("perf");  +        case EComponent::Net: return TStringBuf("net");  +        case EComponent::ProviderStat: return TStringBuf("STATFACE");  +        case EComponent::ProviderSolomon: return TStringBuf("SOLOMON");  +        case EComponent::ProviderDq: return TStringBuf("DQ");  +        case EComponent::ProviderClickHouse: return TStringBuf("CLICKHOUSE");  +        case EComponent::ProviderYdb: return TStringBuf("YDB");           case EComponent::ProviderPq: return TStringBuf("PQ");          case EComponent::ProviderS3: return TStringBuf("S3");          case EComponent::CoreDq: return TStringBuf("core dq"); @@ -80,26 +80,26 @@ struct EComponentHelpers {      }      static EComponent FromString(TStringBuf str) { -        if (str == TStringBuf("default")) return EComponent::Default; -        if (str == TStringBuf("core")) return EComponent::Core; -        if (str == TStringBuf("core eval")) return EComponent::CoreEval; -        if (str == TStringBuf("core peephole")) return EComponent::CorePeepHole; -        if (str == TStringBuf("core exec")) return EComponent::CoreExecution; -        if (str == TStringBuf("sql")) return EComponent::Sql; -        if (str == TStringBuf("common provider")) return EComponent::ProviderCommon; -        if (str == TStringBuf("CONFIG")) return EComponent::ProviderConfig; -        if (str == TStringBuf("RESULT")) return EComponent::ProviderResult; -        if (str == TStringBuf("YT")) return EComponent::ProviderYt; -        if (str == TStringBuf("KIKIMR")) return EComponent::ProviderKikimr; -        if (str == TStringBuf("KQP")) return EComponent::ProviderKqp; -        if (str == TStringBuf("RTMR")) return EComponent::ProviderRtmr; -        if (str == TStringBuf("perf")) return EComponent::Performance; -        if (str == TStringBuf("net")) return EComponent::Net; -        if (str == TStringBuf("STATFACE")) return EComponent::ProviderStat; -        if (str == TStringBuf("SOLOMON")) return EComponent::ProviderSolomon; -        if (str == TStringBuf("DQ")) return EComponent::ProviderDq; -        if (str == TStringBuf("CLICKHOUSE")) return EComponent::ProviderClickHouse; -        if (str == TStringBuf("YDB")) return EComponent::ProviderYdb; +        if (str == TStringBuf("default")) return EComponent::Default;  +        if (str == TStringBuf("core")) return EComponent::Core;  +        if (str == TStringBuf("core eval")) return EComponent::CoreEval;  +        if (str == TStringBuf("core peephole")) return EComponent::CorePeepHole;  +        if (str == TStringBuf("core exec")) return EComponent::CoreExecution;  +        if (str == TStringBuf("sql")) return EComponent::Sql;  +        if (str == TStringBuf("common provider")) return EComponent::ProviderCommon;  +        if (str == TStringBuf("CONFIG")) return EComponent::ProviderConfig;  +        if (str == TStringBuf("RESULT")) return EComponent::ProviderResult;  +        if (str == TStringBuf("YT")) return EComponent::ProviderYt;  +        if (str == TStringBuf("KIKIMR")) return EComponent::ProviderKikimr;  +        if (str == TStringBuf("KQP")) return EComponent::ProviderKqp;  +        if (str == TStringBuf("RTMR")) return EComponent::ProviderRtmr;  +        if (str == TStringBuf("perf")) return EComponent::Performance;  +        if (str == TStringBuf("net")) return EComponent::Net;  +        if (str == TStringBuf("STATFACE")) return EComponent::ProviderStat;  +        if (str == TStringBuf("SOLOMON")) return EComponent::ProviderSolomon;  +        if (str == TStringBuf("DQ")) return EComponent::ProviderDq;  +        if (str == TStringBuf("CLICKHOUSE")) return EComponent::ProviderClickHouse;  +        if (str == TStringBuf("YDB")) return EComponent::ProviderYdb;           if (str == TStringBuf("PQ")) return EComponent::ProviderPq;          if (str == TStringBuf("S3")) return EComponent::ProviderS3;          if (str == TStringBuf("core dq")) return EComponent::CoreDq; diff --git a/ydb/library/yql/utils/log/log_level.h b/ydb/library/yql/utils/log/log_level.h index ccb12e4690b..b558fe14d1c 100644 --- a/ydb/library/yql/utils/log/log_level.h +++ b/ydb/library/yql/utils/log/log_level.h @@ -59,26 +59,26 @@ struct ELevelHelpers {      static TStringBuf ToString(ELevel level) {          // aligned 5-letters string          switch (level) { -        case ELevel::FATAL: return TStringBuf("FATAL"); -        case ELevel::ERROR: return TStringBuf("ERROR"); -        case ELevel::WARN:  return TStringBuf("WARN "); -        case ELevel::NOTICE:return TStringBuf("NOTE "); -        case ELevel::INFO:  return TStringBuf("INFO "); -        case ELevel::DEBUG: return TStringBuf("DEBUG"); -        case ELevel::TRACE: return TStringBuf("TRACE"); +        case ELevel::FATAL: return TStringBuf("FATAL");  +        case ELevel::ERROR: return TStringBuf("ERROR");  +        case ELevel::WARN:  return TStringBuf("WARN ");  +        case ELevel::NOTICE:return TStringBuf("NOTE ");  +        case ELevel::INFO:  return TStringBuf("INFO ");  +        case ELevel::DEBUG: return TStringBuf("DEBUG");  +        case ELevel::TRACE: return TStringBuf("TRACE");           }          ythrow yexception() << "unknown log level: " << ToInt(level);      }      static ELevel FromString(TStringBuf str) {          // aligned 5-letters string -        if (str == TStringBuf("FATAL")) return ELevel::FATAL; -        if (str == TStringBuf("ERROR")) return ELevel::ERROR; -        if (str == TStringBuf("WARN ")) return ELevel::WARN; -        if (str == TStringBuf("NOTE ")) return ELevel::NOTICE; -        if (str == TStringBuf("INFO ")) return ELevel::INFO; -        if (str == TStringBuf("DEBUG")) return ELevel::DEBUG; -        if (str == TStringBuf("TRACE")) return ELevel::TRACE; +        if (str == TStringBuf("FATAL")) return ELevel::FATAL;  +        if (str == TStringBuf("ERROR")) return ELevel::ERROR;  +        if (str == TStringBuf("WARN ")) return ELevel::WARN;  +        if (str == TStringBuf("NOTE ")) return ELevel::NOTICE;  +        if (str == TStringBuf("INFO ")) return ELevel::INFO;  +        if (str == TStringBuf("DEBUG")) return ELevel::DEBUG;  +        if (str == TStringBuf("TRACE")) return ELevel::TRACE;           ythrow yexception() << "unknown log level: " << str;      } diff --git a/ydb/library/yql/utils/log/log_ut.cpp b/ydb/library/yql/utils/log/log_ut.cpp index bf8b71476c0..3c3e57585ca 100644 --- a/ydb/library/yql/utils/log/log_ut.cpp +++ b/ydb/library/yql/utils/log/log_ut.cpp @@ -202,7 +202,7 @@ Y_UNIT_TEST_SUITE(TLogTest)              UNIT_ASSERT_STRINGS_EQUAL(CurrentLogContextPath(), "ctx1");              YQL_LOG(INFO) << "level1 - begin"; -            YQL_LOG_CTX_BLOCK(TStringBuf("ctx2")) { +            YQL_LOG_CTX_BLOCK(TStringBuf("ctx2")) {                   UNIT_ASSERT_STRINGS_EQUAL(CurrentLogContextPath(), "ctx1/ctx2");                  YQL_LOG(WARN) << "level2";              } @@ -290,7 +290,7 @@ Y_UNIT_TEST_SUITE(TLogTest)              UNIT_ASSERT_STRINGS_EQUAL(CurrentLogContextPath(), "ctx1");              YQL_LOG(INFO) << "level1 - begin"; -            YQL_LOG_CTX_BLOCK(TStringBuf("ctx2")) { +            YQL_LOG_CTX_BLOCK(TStringBuf("ctx2")) {                   UNIT_ASSERT_STRINGS_EQUAL(CurrentLogContextPath(), "ctx1/ctx2");                  YQL_LOG(WARN) << "level2 - begin"; diff --git a/ydb/library/yql/utils/log/profile.cpp b/ydb/library/yql/utils/log/profile.cpp index ba9556498fd..80fa744a47c 100644 --- a/ydb/library/yql/utils/log/profile.cpp +++ b/ydb/library/yql/utils/log/profile.cpp @@ -21,16 +21,16 @@ TProfilingScope::~TProfilingScope() {      TStringBuf unit("us");      if (elapsed > 1000000) {          elapsed /= 1000000; -        unit = TStringBuf("s"); +        unit = TStringBuf("s");       } else if (elapsed > 1000) {          elapsed /= 1000; -        unit = TStringBuf("ms"); +        unit = TStringBuf("ms");       }      auto doLog = [&]() {          YQL_PERF_LOG(Level_, File_, Line_) -                << TStringBuf("Execution of [") << Name_ -                << TStringBuf("] took ") << Prec(elapsed, 3) << unit; +                << TStringBuf("Execution of [") << Name_  +                << TStringBuf("] took ") << Prec(elapsed, 3) << unit;       };      if (!LogCtxPath_.empty()) { diff --git a/ydb/library/yql/utils/parse_double_ut.cpp b/ydb/library/yql/utils/parse_double_ut.cpp index 6f9cdea2f1f..ad1c1396bac 100644 --- a/ydb/library/yql/utils/parse_double_ut.cpp +++ b/ydb/library/yql/utils/parse_double_ut.cpp @@ -13,40 +13,40 @@ Y_UNIT_TEST_SUITE(TParseDouble) {      }      Y_UNIT_TEST(ExactValues) { -        ParseAndCheck(TStringBuf("nan"), TryFloatFromString, std::numeric_limits<float>::quiet_NaN()); -        ParseAndCheck(TStringBuf("nAn"), TryDoubleFromString, std::numeric_limits<double>::quiet_NaN()); +        ParseAndCheck(TStringBuf("nan"), TryFloatFromString, std::numeric_limits<float>::quiet_NaN());  +        ParseAndCheck(TStringBuf("nAn"), TryDoubleFromString, std::numeric_limits<double>::quiet_NaN());  -        ParseAndCheck(TStringBuf("+nan"), TryFloatFromString, std::numeric_limits<float>::quiet_NaN()); -        ParseAndCheck(TStringBuf("+NAN"), TryDoubleFromString, std::numeric_limits<double>::quiet_NaN()); +        ParseAndCheck(TStringBuf("+nan"), TryFloatFromString, std::numeric_limits<float>::quiet_NaN());  +        ParseAndCheck(TStringBuf("+NAN"), TryDoubleFromString, std::numeric_limits<double>::quiet_NaN());  -        ParseAndCheck(TStringBuf("-nan"), TryFloatFromString, std::numeric_limits<float>::quiet_NaN()); -        ParseAndCheck(TStringBuf("-NaN"), TryDoubleFromString, std::numeric_limits<double>::quiet_NaN()); +        ParseAndCheck(TStringBuf("-nan"), TryFloatFromString, std::numeric_limits<float>::quiet_NaN());  +        ParseAndCheck(TStringBuf("-NaN"), TryDoubleFromString, std::numeric_limits<double>::quiet_NaN());  -        ParseAndCheck(TStringBuf("inf"), TryFloatFromString, std::numeric_limits<float>::infinity()); -        ParseAndCheck(TStringBuf("iNf"), TryDoubleFromString, std::numeric_limits<double>::infinity()); +        ParseAndCheck(TStringBuf("inf"), TryFloatFromString, std::numeric_limits<float>::infinity());  +        ParseAndCheck(TStringBuf("iNf"), TryDoubleFromString, std::numeric_limits<double>::infinity());  -        ParseAndCheck(TStringBuf("+inf"), TryFloatFromString, std::numeric_limits<float>::infinity()); -        ParseAndCheck(TStringBuf("+INF"), TryDoubleFromString, std::numeric_limits<double>::infinity()); +        ParseAndCheck(TStringBuf("+inf"), TryFloatFromString, std::numeric_limits<float>::infinity());  +        ParseAndCheck(TStringBuf("+INF"), TryDoubleFromString, std::numeric_limits<double>::infinity());  -        ParseAndCheck(TStringBuf("-inf"), TryFloatFromString, -std::numeric_limits<float>::infinity()); -        ParseAndCheck(TStringBuf("-InF"), TryDoubleFromString, -std::numeric_limits<double>::infinity()); +        ParseAndCheck(TStringBuf("-inf"), TryFloatFromString, -std::numeric_limits<float>::infinity());  +        ParseAndCheck(TStringBuf("-InF"), TryDoubleFromString, -std::numeric_limits<double>::infinity());  -        ParseAndCheck<float>(TStringBuf("-12.3456"), TryFloatFromString, -12.3456); -        ParseAndCheck(TStringBuf("-12.3456"), TryDoubleFromString, -12.3456); +        ParseAndCheck<float>(TStringBuf("-12.3456"), TryFloatFromString, -12.3456);  +        ParseAndCheck(TStringBuf("-12.3456"), TryDoubleFromString, -12.3456);  -        ParseAndCheck<float>(TStringBuf("1.23e-2"), TryFloatFromString, 0.0123); -        ParseAndCheck(TStringBuf("1.23e-2"), TryDoubleFromString, 0.0123); +        ParseAndCheck<float>(TStringBuf("1.23e-2"), TryFloatFromString, 0.0123);  +        ParseAndCheck(TStringBuf("1.23e-2"), TryDoubleFromString, 0.0123);  -        UNIT_ASSERT_EQUAL(FloatFromString(TStringBuf("iNf")), std::numeric_limits<float>::infinity()); -        UNIT_ASSERT_EQUAL(DoubleFromString(TStringBuf("iNf")), std::numeric_limits<float>::infinity()); +        UNIT_ASSERT_EQUAL(FloatFromString(TStringBuf("iNf")), std::numeric_limits<float>::infinity());  +        UNIT_ASSERT_EQUAL(DoubleFromString(TStringBuf("iNf")), std::numeric_limits<float>::infinity());       }      Y_UNIT_TEST(Errors) { -        UNIT_ASSERT_EXCEPTION_CONTAINS(FloatFromString(TStringBuf("")), std::exception, "unable to parse float from ''"); -        UNIT_ASSERT_EXCEPTION_CONTAINS(DoubleFromString(TStringBuf("")), std::exception, "unable to parse double from ''"); +        UNIT_ASSERT_EXCEPTION_CONTAINS(FloatFromString(TStringBuf("")), std::exception, "unable to parse float from ''");  +        UNIT_ASSERT_EXCEPTION_CONTAINS(DoubleFromString(TStringBuf("")), std::exception, "unable to parse double from ''");  -        UNIT_ASSERT_EXCEPTION_CONTAINS(FloatFromString(TStringBuf("info")), std::exception, "unable to parse float from 'info'"); -        UNIT_ASSERT_EXCEPTION_CONTAINS(DoubleFromString(TStringBuf("-nana")), std::exception, "unable to parse double from '-nana'"); +        UNIT_ASSERT_EXCEPTION_CONTAINS(FloatFromString(TStringBuf("info")), std::exception, "unable to parse float from 'info'");  +        UNIT_ASSERT_EXCEPTION_CONTAINS(DoubleFromString(TStringBuf("-nana")), std::exception, "unable to parse double from '-nana'");       }  }  } diff --git a/ydb/public/sdk/cpp/client/ydb_value/value.cpp b/ydb/public/sdk/cpp/client/ydb_value/value.cpp index 8c18d4d50f8..6ee7fcfb882 100644 --- a/ydb/public/sdk/cpp/client/ydb_value/value.cpp +++ b/ydb/public/sdk/cpp/client/ydb_value/value.cpp @@ -523,7 +523,7 @@ void FormatTypeInternal(TTypeParser& parser, IOutputStream& out) {              break;          case TTypeParser::ETypeKind::Void: -            out << "Void"sv; +            out << "Void"sv;               break;          default: diff --git a/ydb/services/persqueue_v1/grpc_pq_schema.cpp b/ydb/services/persqueue_v1/grpc_pq_schema.cpp index 7756adc797b..d4aeaf626d6 100644 --- a/ydb/services/persqueue_v1/grpc_pq_schema.cpp +++ b/ydb/services/persqueue_v1/grpc_pq_schema.cpp @@ -17,7 +17,7 @@ using grpc::Status;  namespace NKikimr::NGRpcProxy::V1 { -constexpr TStringBuf GRPCS_ENDPOINT_PREFIX = "grpcs://"; +constexpr TStringBuf GRPCS_ENDPOINT_PREFIX = "grpcs://";   ///////////////////////////////////////////////////////////////////////////////  | 
