aboutsummaryrefslogtreecommitdiffstats
path: root/util/system
diff options
context:
space:
mode:
authordanlark <danlark@yandex-team.ru>2022-02-10 16:46:10 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:10 +0300
commitbaa58daefa91fde4b4769facdbd2903763b9c6a8 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/system
parent3426a9bc7f169ae9da54cef557ad2a33f6e8eee0 (diff)
downloadydb-baa58daefa91fde4b4769facdbd2903763b9c6a8.tar.gz
Restoring authorship annotation for <danlark@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system')
-rw-r--r--util/system/atexit.cpp2
-rw-r--r--util/system/compat.cpp2
-rw-r--r--util/system/dynlib.cpp6
-rw-r--r--util/system/dynlib.h4
-rw-r--r--util/system/env.cpp10
-rw-r--r--util/system/file.cpp2
-rw-r--r--util/system/filemap.h2
-rw-r--r--util/system/fs.cpp16
-rw-r--r--util/system/fs_ut.cpp4
-rw-r--r--util/system/fs_win.cpp6
-rw-r--r--util/system/fstat.cpp6
-rw-r--r--util/system/fstat_ut.cpp4
-rw-r--r--util/system/hi_lo.h2
-rw-r--r--util/system/hostname.cpp4
-rw-r--r--util/system/progname.cpp2
-rw-r--r--util/system/protect.cpp2
-rw-r--r--util/system/shellcommand.cpp22
-rw-r--r--util/system/shellcommand_ut.cpp16
-rw-r--r--util/system/shmat.cpp2
-rw-r--r--util/system/unaligned_mem.h8
-rw-r--r--util/system/unaligned_mem_ut.cpp16
21 files changed, 69 insertions, 69 deletions
diff --git a/util/system/atexit.cpp b/util/system/atexit.cpp
index 1714784f29..74fb10b6b1 100644
--- a/util/system/atexit.cpp
+++ b/util/system/atexit.cpp
@@ -60,7 +60,7 @@ namespace {
inline void Register(TAtExitFunc func, void* ctx, size_t priority) {
with_lock (Lock_) {
- Store_.push_back({func, ctx, priority, Store_.size()});
+ Store_.push_back({func, ctx, priority, Store_.size()});
Items_.push(&Store_.back());
}
}
diff --git a/util/system/compat.cpp b/util/system/compat.cpp
index 00eac400d7..18fbfa296a 100644
--- a/util/system/compat.cpp
+++ b/util/system/compat.cpp
@@ -18,7 +18,7 @@
#ifndef HAVE_NATIVE_GETPROGNAME
const char* getprogname() {
- return GetProgramName().data();
+ return GetProgramName().data();
}
#endif
diff --git a/util/system/dynlib.cpp b/util/system/dynlib.cpp
index f5084f2f68..9d2541c25f 100644
--- a/util/system/dynlib.cpp
+++ b/util/system/dynlib.cpp
@@ -53,7 +53,7 @@ private:
(void)flags;
if (!Module) {
- ythrow yexception() << DLLERR().data();
+ ythrow yexception() << DLLERR().data();
}
}
@@ -81,7 +81,7 @@ public:
void* symbol = SymOptional(name);
if (symbol == nullptr) {
- ythrow yexception() << DLLERR().data();
+ ythrow yexception() << DLLERR().data();
}
return symbol;
@@ -100,7 +100,7 @@ TDynamicLibrary::TDynamicLibrary() noexcept {
}
TDynamicLibrary::TDynamicLibrary(const TString& path, int flags) {
- Open(path.data(), flags);
+ Open(path.data(), flags);
}
TDynamicLibrary::~TDynamicLibrary() = default;
diff --git a/util/system/dynlib.h b/util/system/dynlib.h
index 6515df903a..66eaf4a5c1 100644
--- a/util/system/dynlib.h
+++ b/util/system/dynlib.h
@@ -56,7 +56,7 @@ public:
PLib = nullptr;
DLib = nullptr;
if (es.IsDynamic())
- Open(es.LibName().data(), es.VtblName().data());
+ Open(es.LibName().data(), es.VtblName().data());
else if (es.IsStatic())
SetSym(es.Symbol());
}
@@ -64,7 +64,7 @@ public:
if (this != &es) {
Close();
if (es.IsDynamic())
- Open(es.LibName().data(), es.VtblName().data());
+ Open(es.LibName().data(), es.VtblName().data());
else if (es.IsStatic())
SetSym(es.Symbol());
}
diff --git a/util/system/env.cpp b/util/system/env.cpp
index 483b000d34..ead9b566a5 100644
--- a/util/system/env.cpp
+++ b/util/system/env.cpp
@@ -23,7 +23,7 @@
TString GetEnv(const TString& key, const TString& def) {
#ifdef _win_
- size_t len = GetEnvironmentVariableA(key.data(), nullptr, 0);
+ size_t len = GetEnvironmentVariableA(key.data(), nullptr, 0);
if (len == 0) {
if (GetLastError() == ERROR_ENVVAR_NOT_FOUND) {
@@ -36,7 +36,7 @@ TString GetEnv(const TString& key, const TString& def) {
size_t bufferSize;
do {
bufferSize = buffer.size();
- len = GetEnvironmentVariableA(key.data(), buffer.data(), static_cast<DWORD>(bufferSize));
+ len = GetEnvironmentVariableA(key.data(), buffer.data(), static_cast<DWORD>(bufferSize));
if (len > bufferSize) {
buffer.resize(len);
}
@@ -44,7 +44,7 @@ TString GetEnv(const TString& key, const TString& def) {
return TString(buffer.data(), len);
#else
- const char* env = getenv(key.data());
+ const char* env = getenv(key.data());
return env ? TString(env) : def;
#endif
}
@@ -53,12 +53,12 @@ void SetEnv(const TString& key, const TString& value) {
bool isOk = false;
int errorCode = 0;
#ifdef _win_
- isOk = SetEnvironmentVariable(key.data(), value.data());
+ isOk = SetEnvironmentVariable(key.data(), value.data());
if (!isOk) {
errorCode = GetLastError();
}
#else
- isOk = (0 == setenv(key.data(), value.data(), true /*replace*/));
+ isOk = (0 == setenv(key.data(), value.data(), true /*replace*/));
if (!isOk) {
errorCode = errno;
}
diff --git a/util/system/file.cpp b/util/system/file.cpp
index 743e8f67f2..4a261d020c 100644
--- a/util/system/file.cpp
+++ b/util/system/file.cpp
@@ -260,7 +260,7 @@ TFileHandle::TFileHandle(const TString& fName, EOpenMode oMode) noexcept {
//temp file
if (Fd_ >= 0 && (oMode & Transient)) {
- unlink(fName.data());
+ unlink(fName.data());
}
#else
#error unsupported platform
diff --git a/util/system/filemap.h b/util/system/filemap.h
index b084c060a3..11be64bff4 100644
--- a/util/system/filemap.h
+++ b/util/system/filemap.h
@@ -4,7 +4,7 @@
#include "align.h"
#include "yassert.h"
-#include <util/generic/noncopyable.h>
+#include <util/generic/noncopyable.h>
#include <util/generic/ptr.h>
#include <util/generic/utility.h>
#include <util/generic/yexception.h>
diff --git a/util/system/fs.cpp b/util/system/fs.cpp
index e2db6cd403..d2611a8ccc 100644
--- a/util/system/fs.cpp
+++ b/util/system/fs.cpp
@@ -20,7 +20,7 @@ bool NFs::Remove(const TString& path) {
#if defined(_win_)
return NFsPrivate::WinRemove(path);
#else
- return ::remove(path.data()) == 0;
+ return ::remove(path.data()) == 0;
#endif
}
@@ -58,7 +58,7 @@ bool NFs::MakeDirectory(const TString& path, EFilePermissions mode) {
Y_UNUSED(mode);
return NFsPrivate::WinMakeDirectory(path);
#else
- return mkdir(path.data(), mode) == 0;
+ return mkdir(path.data(), mode) == 0;
#endif
}
@@ -88,7 +88,7 @@ bool NFs::Rename(const TString& oldPath, const TString& newPath) {
#if defined(_win_)
return NFsPrivate::WinRename(oldPath, newPath);
#else
- return ::rename(oldPath.data(), newPath.data()) == 0;
+ return ::rename(oldPath.data(), newPath.data()) == 0;
#endif
}
@@ -102,7 +102,7 @@ bool NFs::HardLink(const TString& existingPath, const TString& newPath) {
#if defined(_win_)
return NFsPrivate::WinHardLink(existingPath, newPath);
#elif defined(_unix_)
- return (0 == link(existingPath.data(), newPath.data()));
+ return (0 == link(existingPath.data(), newPath.data()));
#endif
}
@@ -110,7 +110,7 @@ bool NFs::SymLink(const TString& targetPath, const TString& linkPath) {
#if defined(_win_)
return NFsPrivate::WinSymLink(targetPath, linkPath);
#elif defined(_unix_)
- return 0 == symlink(targetPath.data(), linkPath.data());
+ return 0 == symlink(targetPath.data(), linkPath.data());
#endif
}
@@ -120,7 +120,7 @@ TString NFs::ReadLink(const TString& path) {
#elif defined(_unix_)
TTempBuf buf;
while (true) {
- ssize_t r = readlink(path.data(), buf.Data(), buf.Size());
+ ssize_t r = readlink(path.data(), buf.Data(), buf.Size());
if (r < 0) {
ythrow yexception() << "can't read link " << path << ", errno = " << errno;
}
@@ -150,7 +150,7 @@ bool NFs::Exists(const TString& path) {
#if defined(_win_)
return NFsPrivate::WinExists(path);
#elif defined(_unix_)
- return access(path.data(), F_OK) == 0;
+ return access(path.data(), F_OK) == 0;
#endif
}
@@ -171,7 +171,7 @@ void NFs::SetCurrentWorkingDirectory(TString path) {
#ifdef _win_
bool ok = NFsPrivate::WinSetCurrentWorkingDirectory(path);
#else
- bool ok = !chdir(path.data());
+ bool ok = !chdir(path.data());
#endif
if (!ok) {
ythrow TSystemError() << "failed to change directory to " << path.Quote();
diff --git a/util/system/fs_ut.cpp b/util/system/fs_ut.cpp
index 7ed677bce0..de071ebf55 100644
--- a/util/system/fs_ut.cpp
+++ b/util/system/fs_ut.cpp
@@ -71,10 +71,10 @@ void TFsTest::TestCreateRemove() {
UNIT_ASSERT(!NFs::MakeDirectoryRecursive(file1, NFs::FP_COMMON_FILE, false));
TString longUtf8Name = "";
- while (longUtf8Name.size() < 255) {
+ while (longUtf8Name.size() < 255) {
longUtf8Name = longUtf8Name + "fф";
}
- UNIT_ASSERT_EQUAL(longUtf8Name.size(), 255);
+ UNIT_ASSERT_EQUAL(longUtf8Name.size(), 255);
TFsPath longfile = dir1 / longUtf8Name;
Touch(longfile);
diff --git a/util/system/fs_win.cpp b/util/system/fs_win.cpp
index 9360677e82..a410ccac06 100644
--- a/util/system/fs_win.cpp
+++ b/util/system/fs_win.cpp
@@ -10,13 +10,13 @@
namespace NFsPrivate {
static LPCWSTR UTF8ToWCHAR(const TStringBuf str, TUtf16String& wstr) {
- wstr.resize(str.size());
+ wstr.resize(str.size());
size_t written = 0;
- if (!UTF8ToWide(str.data(), str.size(), wstr.begin(), written))
+ if (!UTF8ToWide(str.data(), str.size(), wstr.begin(), written))
return nullptr;
wstr.erase(written);
static_assert(sizeof(WCHAR) == sizeof(wchar16), "expect sizeof(WCHAR) == sizeof(wchar16)");
- return (const WCHAR*)wstr.data();
+ return (const WCHAR*)wstr.data();
}
static TString WCHARToUTF8(const LPWSTR wstr, size_t len) {
diff --git a/util/system/fstat.cpp b/util/system/fstat.cpp
index c413e552c6..81e98cbc6b 100644
--- a/util/system/fstat.cpp
+++ b/util/system/fstat.cpp
@@ -121,11 +121,11 @@ void TFileStat::MakeFromFileName(const char* fileName, bool nofollow) {
}
TFileStat::TFileStat(const TFsPath& fileName, bool nofollow) {
- MakeFromFileName(fileName.GetPath().data(), nofollow);
+ MakeFromFileName(fileName.GetPath().data(), nofollow);
}
TFileStat::TFileStat(const TString& fileName, bool nofollow) {
- MakeFromFileName(fileName.data(), nofollow);
+ MakeFromFileName(fileName.data(), nofollow);
}
TFileStat::TFileStat(const char* fileName, bool nofollow) {
@@ -211,5 +211,5 @@ i64 GetFileLength(const char* name) {
}
i64 GetFileLength(const TString& name) {
- return GetFileLength(name.data());
+ return GetFileLength(name.data());
}
diff --git a/util/system/fstat_ut.cpp b/util/system/fstat_ut.cpp
index 81a0dbcb1d..160ecd936e 100644
--- a/util/system/fstat_ut.cpp
+++ b/util/system/fstat_ut.cpp
@@ -13,7 +13,7 @@ Y_UNIT_TEST_SUITE(TestFileStat) {
TString fileName = "f1.txt";
TFileStat oFs;
{
- TFile file(fileName.data(), OpenAlways | WrOnly);
+ TFile file(fileName.data(), OpenAlways | WrOnly);
file.Write("1234567", 7);
{
@@ -43,7 +43,7 @@ Y_UNIT_TEST_SUITE(TestFileStat) {
UNIT_ASSERT_VALUES_EQUAL(cFs.Uid, oFs.Uid);
UNIT_ASSERT_VALUES_EQUAL(cFs.Gid, oFs.Gid);
UNIT_ASSERT_VALUES_EQUAL(cFs.INode, oFs.INode);
- UNIT_ASSERT(unlink(fileName.data()) == 0);
+ UNIT_ASSERT(unlink(fileName.data()) == 0);
}
Y_UNIT_TEST(DirTest) {
diff --git a/util/system/hi_lo.h b/util/system/hi_lo.h
index 452b3c697a..f86870534f 100644
--- a/util/system/hi_lo.h
+++ b/util/system/hi_lo.h
@@ -41,7 +41,7 @@ namespace NHiLoPrivate {
}
TIntRef& operator=(TRepr value) {
- WriteUnaligned<TRepr>(GetPtr(), value);
+ WriteUnaligned<TRepr>(GetPtr(), value);
return *this;
}
diff --git a/util/system/hostname.cpp b/util/system/hostname.cpp
index 9d6a1333fe..386f646d6b 100644
--- a/util/system/hostname.cpp
+++ b/util/system/hostname.cpp
@@ -69,7 +69,7 @@ const TString& HostName() {
}
const char* GetHostName() {
- return HostName().data();
+ return HostName().data();
}
const TString& FQDNHostName() {
@@ -77,7 +77,7 @@ const TString& FQDNHostName() {
}
const char* GetFQDNHostName() {
- return FQDNHostName().data();
+ return FQDNHostName().data();
}
bool IsFQDN(const TString& name) {
diff --git a/util/system/progname.cpp b/util/system/progname.cpp
index 5a2b3e805b..2c29119320 100644
--- a/util/system/progname.cpp
+++ b/util/system/progname.cpp
@@ -9,7 +9,7 @@ static const char* Argv0;
namespace {
struct TProgramNameHolder {
inline TProgramNameHolder()
- : ProgName(GetFileNameComponent(Argv0 ? Argv0 : GetExecPath().data()))
+ : ProgName(GetFileNameComponent(Argv0 ? Argv0 : GetExecPath().data()))
{
}
diff --git a/util/system/protect.cpp b/util/system/protect.cpp
index 20a4ba5a08..bbb8d410df 100644
--- a/util/system/protect.cpp
+++ b/util/system/protect.cpp
@@ -29,7 +29,7 @@ static TString ModeToString(const EProtectMemory mode) {
if (mode & PM_EXEC) {
strMode += "PM_EXEC|";
}
- return strMode.substr(0, strMode.size() - 1);
+ return strMode.substr(0, strMode.size() - 1);
}
void ProtectMemory(void* addr, const size_t length, const EProtectMemory mode) {
diff --git a/util/system/shellcommand.cpp b/util/system/shellcommand.cpp
index aa84ea1661..b1989b5c8c 100644
--- a/util/system/shellcommand.cpp
+++ b/util/system/shellcommand.cpp
@@ -563,13 +563,13 @@ void TShellCommand::TImpl::StartProcess(TShellCommand::TImpl::TPipes& pipes) {
Y_ENSURE_EX(cmd.size() < MAX_COMMAND_LINE, yexception() << "Command is too long (length=" << cmd.size() << ")");
TTempArray<wchar_t> cmdcopy(MAX_COMMAND_LINE);
- Copy(cmd.data(), cmd.data() + cmd.size(), cmdcopy.Data());
- *(cmdcopy.Data() + cmd.size()) = 0;
+ Copy(cmd.data(), cmd.data() + cmd.size(), cmdcopy.Data());
+ *(cmdcopy.Data() + cmd.size()) = 0;
const wchar_t* cwd = NULL;
std::wstring cwdBuff;
- if (WorkDir.size()) {
- cwdBuff = GetWString(WorkDir.data());
+ if (WorkDir.size()) {
+ cwdBuff = GetWString(WorkDir.data());
cwd = cwdBuff.c_str();
}
@@ -580,7 +580,7 @@ void TShellCommand::TImpl::StartProcess(TShellCommand::TImpl::TPipes& pipes) {
env += e->first + '=' + e->second + '\0';
}
env += '\0';
- lpEnvironment = const_cast<char*>(env.data());
+ lpEnvironment = const_cast<char*>(env.data());
}
// disable messagebox (may be in debug too)
@@ -602,9 +602,9 @@ void TShellCommand::TImpl::StartProcess(TShellCommand::TImpl::TPipes& pipes) {
&process_info);
} else {
res = CreateProcessWithLogonW(
- GetWString(User.Name.data()).c_str(),
+ GetWString(User.Name.data()).c_str(),
nullptr, // domain (if this parameter is NULL, the user name must be specified in UPN format)
- GetWString(User.Password.data()).c_str(),
+ GetWString(User.Password.data()).c_str(),
0, // logon flags
NULL, // image name
cmdcopy.Data(),
@@ -796,12 +796,12 @@ void TShellCommand::TImpl::Run() {
qargv.push_back(const_cast<char*>("-c"));
// two args for 'sh -c -- ',
// one for program name, and one for NULL at the end
- qargv.push_back(const_cast<char*>(shellArg.data()));
+ qargv.push_back(const_cast<char*>(shellArg.data()));
} else {
qargv.reserve(Arguments.size() + 2);
- qargv.push_back(const_cast<char*>(Command.data()));
+ qargv.push_back(const_cast<char*>(Command.data()));
for (auto& i : Arguments) {
- qargv.push_back(const_cast<char*>(i.data()));
+ qargv.push_back(const_cast<char*>(i.data()));
}
}
@@ -812,7 +812,7 @@ void TShellCommand::TImpl::Run() {
if (!Environment.empty()) {
for (auto& env : Environment) {
envHolder.emplace_back(env.first + '=' + env.second);
- envp.push_back(const_cast<char*>(envHolder.back().data()));
+ envp.push_back(const_cast<char*>(envHolder.back().data()));
}
envp.push_back(nullptr);
}
diff --git a/util/system/shellcommand_ut.cpp b/util/system/shellcommand_ut.cpp
index cea2777100..9d849279d2 100644
--- a/util/system/shellcommand_ut.cpp
+++ b/util/system/shellcommand_ut.cpp
@@ -139,7 +139,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
<< "sort";
cmd.Run();
UNIT_ASSERT(TShellCommand::SHELL_FINISHED == cmd.GetStatus());
- UNIT_ASSERT_VALUES_EQUAL(cmd.GetError().size(), 0u);
+ UNIT_ASSERT_VALUES_EQUAL(cmd.GetError().size(), 0u);
UNIT_ASSERT(cmd.GetExitCode().Defined() && 0 == cmd.GetExitCode());
}
}
@@ -164,7 +164,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
UNIT_ASSERT_VALUES_EQUAL(cmd.GetError(), "");
#if !defined(_win_)
UNIT_ASSERT(TShellCommand::SHELL_FINISHED == cmd.GetStatus());
- UNIT_ASSERT_VALUES_EQUAL(cmd.GetOutput().size(), 0u);
+ UNIT_ASSERT_VALUES_EQUAL(cmd.GetOutput().size(), 0u);
UNIT_ASSERT(cmd.GetExitCode().Defined() && 0 == cmd.GetExitCode());
#endif
}
@@ -183,20 +183,20 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
#else
UNIT_ASSERT_VALUES_EQUAL(input, output);
#endif
- UNIT_ASSERT_VALUES_EQUAL(cmd.GetError().size(), 0u);
+ UNIT_ASSERT_VALUES_EQUAL(cmd.GetError().size(), 0u);
}
Y_UNIT_TEST(TestRunNonexistent) {
TShellCommand cmd("iwerognweiofnewio"); // some nonexistent command name
cmd.Run().Wait();
UNIT_ASSERT(TShellCommand::SHELL_ERROR == cmd.GetStatus());
- UNIT_ASSERT_VALUES_UNEQUAL(cmd.GetError().size(), 0u);
+ UNIT_ASSERT_VALUES_UNEQUAL(cmd.GetError().size(), 0u);
UNIT_ASSERT(cmd.GetExitCode().Defined() && 0 != cmd.GetExitCode());
}
Y_UNIT_TEST(TestExitCode) {
TShellCommand cmd("grep qwerty qwerty"); // some nonexistent file name
cmd.Run().Wait();
UNIT_ASSERT(TShellCommand::SHELL_ERROR == cmd.GetStatus());
- UNIT_ASSERT_VALUES_UNEQUAL(cmd.GetError().size(), 0u);
+ UNIT_ASSERT_VALUES_UNEQUAL(cmd.GetError().size(), 0u);
UNIT_ASSERT(cmd.GetExitCode().Defined() && 2 == cmd.GetExitCode());
}
// 'type con' and 'copy con con' want real console, not stdin, use sort
@@ -208,7 +208,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
TShellCommand cmd(catCommand, options);
cmd.Run().Wait();
UNIT_ASSERT_VALUES_EQUAL(input, cmd.GetOutput());
- UNIT_ASSERT_VALUES_EQUAL(cmd.GetError().size(), 0u);
+ UNIT_ASSERT_VALUES_EQUAL(cmd.GetError().size(), 0u);
}
Y_UNIT_TEST(TestOutput) {
TShellCommandOptions options;
@@ -221,7 +221,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
TShellCommand cmd(catCommand, options);
cmd.Run().Wait();
UNIT_ASSERT_VALUES_EQUAL(input, output);
- UNIT_ASSERT_VALUES_EQUAL(cmd.GetError().size(), 0u);
+ UNIT_ASSERT_VALUES_EQUAL(cmd.GetError().size(), 0u);
}
Y_UNIT_TEST(TestIO) {
// descriptive test: use all options
@@ -390,7 +390,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
TShellCommand cmd(catCommand, options);
cmd.Run().Wait();
UNIT_ASSERT(TShellCommand::SHELL_INTERNAL_ERROR == cmd.GetStatus());
- UNIT_ASSERT_VALUES_UNEQUAL(cmd.GetInternalError().size(), 0u);
+ UNIT_ASSERT_VALUES_UNEQUAL(cmd.GetInternalError().size(), 0u);
}
Y_UNIT_TEST(TestHugeOutput) {
TShellCommandOptions options;
diff --git a/util/system/shmat.cpp b/util/system/shmat.cpp
index 6795f17164..07ff0d6caa 100644
--- a/util/system/shmat.cpp
+++ b/util/system/shmat.cpp
@@ -170,7 +170,7 @@ static key_t GetKey(const TGUID& id) {
}
bool TSharedMemory::Open(const TGUID& id, int size) {
- Y_VERIFY(id, "invalid shared memory guid: %s", GetGuidAsString(id).data());
+ Y_VERIFY(id, "invalid shared memory guid: %s", GetGuidAsString(id).data());
//Y_ASSERT(Data == 0);
Size = size;
diff --git a/util/system/unaligned_mem.h b/util/system/unaligned_mem.h
index 61433ccfbe..4b84686f2f 100644
--- a/util/system/unaligned_mem.h
+++ b/util/system/unaligned_mem.h
@@ -16,11 +16,11 @@ inline T ReadUnaligned(const void* from) noexcept {
return ret;
}
-// std::remove_reference_t for non-deduced context to prevent such code to blow below:
-// ui8 first = f(); ui8 second = g();
-// WriteUnaligned(to, first - second) (int will be deduced)
+// std::remove_reference_t for non-deduced context to prevent such code to blow below:
+// ui8 first = f(); ui8 second = g();
+// WriteUnaligned(to, first - second) (int will be deduced)
template <class T>
-inline void WriteUnaligned(void* to, const std::remove_reference_t<T>& t) noexcept {
+inline void WriteUnaligned(void* to, const std::remove_reference_t<T>& t) noexcept {
memcpy(to, &t, sizeof(T));
}
diff --git a/util/system/unaligned_mem_ut.cpp b/util/system/unaligned_mem_ut.cpp
index 3b4ebd8887..9de3f3e931 100644
--- a/util/system/unaligned_mem_ut.cpp
+++ b/util/system/unaligned_mem_ut.cpp
@@ -33,9 +33,9 @@ Y_UNIT_TEST_SUITE(UnalignedMem) {
Y_UNIT_TEST(TestReadWrite) {
alignas(ui64) char buf[100];
- WriteUnaligned<ui16>(buf + 1, (ui16)1);
- WriteUnaligned<ui32>(buf + 1 + 2, (ui32)2);
- WriteUnaligned<ui64>(buf + 1 + 2 + 4, (ui64)3);
+ WriteUnaligned<ui16>(buf + 1, (ui16)1);
+ WriteUnaligned<ui32>(buf + 1 + 2, (ui32)2);
+ WriteUnaligned<ui64>(buf + 1 + 2 + 4, (ui64)3);
UNIT_ASSERT_VALUES_EQUAL(ReadUnaligned<ui16>(buf + 1), 1);
UNIT_ASSERT_VALUES_EQUAL(ReadUnaligned<ui32>(buf + 1 + 2), 2);
@@ -48,9 +48,9 @@ Y_UNIT_TEST_SUITE(UnalignedMem) {
alignas(ui64) static char buf[100] = {0}; // static is required for Clobber to work
- WriteUnaligned<ui16>(buf + 1, (ui16)1);
- WriteUnaligned<ui32>(buf + 1 + 2, (ui32)2);
- WriteUnaligned<ui64>(buf + 1 + 2 + 4, (ui64)3);
+ WriteUnaligned<ui16>(buf + 1, (ui16)1);
+ WriteUnaligned<ui32>(buf + 1 + 2, (ui32)2);
+ WriteUnaligned<ui64>(buf + 1 + 2 + 4, (ui64)3);
NBench::Clobber();
auto val1 = ReadUnaligned<ui16>(buf + 1);
@@ -72,7 +72,7 @@ Y_UNIT_TEST_SUITE(UnalignedMem) {
Y_UNIT_TEST(TestReadWrite128) {
alignas(TUInt128) char buf[100] = {0};
- WriteUnaligned<TUInt128>(buf + 1, TUInt128::Max());
+ WriteUnaligned<TUInt128>(buf + 1, TUInt128::Max());
auto val = ReadUnaligned<TUInt128>(buf + 1);
UNIT_ASSERT(val == TUInt128::Max());
}
@@ -82,7 +82,7 @@ Y_UNIT_TEST_SUITE(UnalignedMem) {
alignas(TUInt128) static char buf[100] = {0}; // static is required for Clobber to work
- WriteUnaligned<TUInt128>(buf + 1, TUInt128::Max());
+ WriteUnaligned<TUInt128>(buf + 1, TUInt128::Max());
NBench::Clobber();
auto val = ReadUnaligned<TUInt128>(buf + 1);