aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoramatveyev <amatveyev@yandex-team.ru>2022-02-10 16:50:11 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:11 +0300
commit8bfc24a315c0a821841d2d5bb73e55268b7ecfb6 (patch)
tree11b6d7b43a1a1f99547031fd7c6218e292aee533
parent8d3a5b9c70bfb823a30242286328d6017b82b9ce (diff)
downloadydb-8bfc24a315c0a821841d2d5bb73e55268b7ecfb6.tar.gz
Restoring authorship annotation for <amatveyev@yandex-team.ru>. Commit 1 of 2.
-rw-r--r--library/cpp/sse/README.md14
-rw-r--r--library/cpp/uri/assign.cpp2
-rw-r--r--library/cpp/uri/uri-ru_ut.cpp24
-rw-r--r--util/system/direct_io.cpp56
-rw-r--r--util/system/direct_io.h8
-rw-r--r--util/system/direct_io_ut.cpp60
6 files changed, 82 insertions, 82 deletions
diff --git a/library/cpp/sse/README.md b/library/cpp/sse/README.md
index a82c98a1b9..876508a4db 100644
--- a/library/cpp/sse/README.md
+++ b/library/cpp/sse/README.md
@@ -1,7 +1,7 @@
-Overview
-===
-This library provides the implementation of Intel SSE intrinsics for other CPU architectures. Currently supports PowerPC via translation to AltiVec and ARM via NEON. In some cases, falls back to software emulation if there's no corresponding instruction in the target instruction set.
-
-Usage
-===
-Include library/cpp/sse/sse.h and use the needed intrinsics. Implementation will be selected based on the target architecture of the used toolchain.
+Overview
+===
+This library provides the implementation of Intel SSE intrinsics for other CPU architectures. Currently supports PowerPC via translation to AltiVec and ARM via NEON. In some cases, falls back to software emulation if there's no corresponding instruction in the target instruction set.
+
+Usage
+===
+Include library/cpp/sse/sse.h and use the needed intrinsics. Implementation will be selected based on the target architecture of the used toolchain.
diff --git a/library/cpp/uri/assign.cpp b/library/cpp/uri/assign.cpp
index ae9125c727..89c0d7cc12 100644
--- a/library/cpp/uri/assign.cpp
+++ b/library/cpp/uri/assign.cpp
@@ -320,7 +320,7 @@ namespace NUri {
char* end = out.Buf();
const EField fld = convertIDN ? FieldHost : FieldHostAscii;
FldSetNoDirty(fld, TStringBuf(beg, end));
- out << '\0';
+ out << '\0';
}
Buffer.Resize(out.Len());
diff --git a/library/cpp/uri/uri-ru_ut.cpp b/library/cpp/uri/uri-ru_ut.cpp
index ec35a164d2..be7cfb5248 100644
--- a/library/cpp/uri/uri-ru_ut.cpp
+++ b/library/cpp/uri/uri-ru_ut.cpp
@@ -146,18 +146,18 @@ namespace NUri {
#undef ENC
}
}
-
- // Regression test for SEARCH-11283
- Y_UNIT_TEST(RegressionTest11283) {
- TStringBuf url = "http://xn--n1aaa.пидорасы.com/";
-
- TUri uri;
- TState::EParsed er = uri.Parse(url, NUri::TParseFlags(NUri::TFeature::FeaturesRobot | NUri::TFeature::FeatureNoRelPath));
- UNIT_ASSERT_VALUES_EQUAL(er, TState::ParsedOK);
- TStringBuf host = uri.GetHost();
- // Should be properly null-terminated
- UNIT_ASSERT_VALUES_EQUAL(host.size(), strlen(host.data()));
- }
+
+ // Regression test for SEARCH-11283
+ Y_UNIT_TEST(RegressionTest11283) {
+ TStringBuf url = "http://xn--n1aaa.пидорасы.com/";
+
+ TUri uri;
+ TState::EParsed er = uri.Parse(url, NUri::TParseFlags(NUri::TFeature::FeaturesRobot | NUri::TFeature::FeatureNoRelPath));
+ UNIT_ASSERT_VALUES_EQUAL(er, TState::ParsedOK);
+ TStringBuf host = uri.GetHost();
+ // Should be properly null-terminated
+ UNIT_ASSERT_VALUES_EQUAL(host.size(), strlen(host.data()));
+ }
}
}
diff --git a/util/system/direct_io.cpp b/util/system/direct_io.cpp
index f59c54b0cb..16fd9353dc 100644
--- a/util/system/direct_io.cpp
+++ b/util/system/direct_io.cpp
@@ -54,8 +54,8 @@ TDirectIOBufferedFile::TDirectIOBufferedFile(const TString& path, EOpenMode oMod
, WritePosition(0)
, DirectIO(false)
{
- if (buflen == 0) {
- ythrow TFileError() << "unbuffered usage is not supported";
+ if (buflen == 0) {
+ ythrow TFileError() << "unbuffered usage is not supported";
}
if (oMode & Direct) {
@@ -80,9 +80,9 @@ void TDirectIOBufferedFile::SetDirectIO(bool value) {
}
if (!!Alignment && value) {
- (void)fcntl(File.GetHandle(), F_SETFL, fcntl(File.GetHandle(), F_GETFL) | DIRECT_IO_FLAGS);
+ (void)fcntl(File.GetHandle(), F_SETFL, fcntl(File.GetHandle(), F_GETFL) | DIRECT_IO_FLAGS);
} else {
- (void)fcntl(File.GetHandle(), F_SETFL, fcntl(File.GetHandle(), F_GETFL) & ~DIRECT_IO_FLAGS);
+ (void)fcntl(File.GetHandle(), F_SETFL, fcntl(File.GetHandle(), F_GETFL) & ~DIRECT_IO_FLAGS);
}
DirectIO = value;
@@ -92,27 +92,27 @@ void TDirectIOBufferedFile::SetDirectIO(bool value) {
}
TDirectIOBufferedFile::~TDirectIOBufferedFile() {
- try {
- Finish();
- } catch (...) {
- }
+ try {
+ Finish();
+ } catch (...) {
+ }
}
void TDirectIOBufferedFile::FlushData() {
- WriteToFile(Buffer, DataLen, FlushedBytes);
- DataLen = 0;
- File.FlushData();
+ WriteToFile(Buffer, DataLen, FlushedBytes);
+ DataLen = 0;
+ File.FlushData();
}
void TDirectIOBufferedFile::Finish() {
- FlushData();
- File.Flush();
- File.Close();
+ FlushData();
+ File.Flush();
+ File.Close();
}
void TDirectIOBufferedFile::Write(const void* buffer, size_t byteCount) {
- WriteToBuffer(buffer, byteCount, DataLen);
- WritePosition += byteCount;
+ WriteToBuffer(buffer, byteCount, DataLen);
+ WritePosition += byteCount;
}
void TDirectIOBufferedFile::WriteToBuffer(const void* buf, size_t len, ui64 position) {
@@ -139,7 +139,7 @@ void TDirectIOBufferedFile::WriteToFile(const void* buf, size_t len, ui64 positi
if (!!len) {
SetDirectIO(IsAligned(buf) && IsAligned(len) && IsAligned(position));
- File.Pwrite(buf, len, position);
+ File.Pwrite(buf, len, position);
FlushedBytes = Max(FlushedBytes, position + len);
FlushedToDisk = Min(FlushedToDisk, position);
@@ -246,21 +246,21 @@ size_t TDirectIOBufferedFile::Pread(void* buffer, size_t byteCount, ui64 offset)
}
void TDirectIOBufferedFile::Pwrite(const void* buffer, size_t byteCount, ui64 offset) {
- if (offset > WritePosition) {
- ythrow yexception() << "cannot frite to position" << offset;
- }
+ if (offset > WritePosition) {
+ ythrow yexception() << "cannot frite to position" << offset;
+ }
size_t writeToBufer = byteCount;
size_t writeToFile = 0;
- if (FlushedBytes > offset) {
- writeToFile = Min<ui64>(byteCount, FlushedBytes - offset);
- WriteToFile(buffer, writeToFile, offset);
- writeToBufer -= writeToFile;
- }
+ if (FlushedBytes > offset) {
+ writeToFile = Min<ui64>(byteCount, FlushedBytes - offset);
+ WriteToFile(buffer, writeToFile, offset);
+ writeToBufer -= writeToFile;
+ }
- if (writeToBufer > 0) {
- ui64 bufferOffset = offset + writeToFile - FlushedBytes;
- WriteToBuffer((const char*)buffer + writeToFile, writeToBufer, bufferOffset);
+ if (writeToBufer > 0) {
+ ui64 bufferOffset = offset + writeToFile - FlushedBytes;
+ WriteToBuffer((const char*)buffer + writeToFile, writeToBufer, bufferOffset);
}
}
diff --git a/util/system/direct_io.h b/util/system/direct_io.h
index 6a3325a960..a4f20f50fc 100644
--- a/util/system/direct_io.h
+++ b/util/system/direct_io.h
@@ -22,7 +22,7 @@ public:
void Pwrite(const void* buffer, size_t byteCount, ui64 offset);
inline bool IsOpen() const {
- return true;
+ return true;
}
inline ui64 GetWritePosition() const {
@@ -33,8 +33,8 @@ public:
return FlushedBytes + DataLen;
}
- inline FHANDLE GetHandle() {
- return File.GetHandle();
+ inline FHANDLE GetHandle() {
+ return File.GetHandle();
}
inline void FallocateNoResize(ui64 length) {
@@ -61,7 +61,7 @@ private:
void SetDirectIO(bool value);
private:
- TFile File;
+ TFile File;
size_t Alignment;
size_t BufLen;
size_t DataLen;
diff --git a/util/system/direct_io_ut.cpp b/util/system/direct_io_ut.cpp
index 839c3de7ca..fc8e8d9d5c 100644
--- a/util/system/direct_io_ut.cpp
+++ b/util/system/direct_io_ut.cpp
@@ -1,14 +1,14 @@
#include <library/cpp/testing/unittest/registar.h>
-#include <util/generic/yexception.h>
+#include <util/generic/yexception.h>
#include <util/system/fs.h>
#include <util/system/tempfile.h>
#include <util/random/random.h>
-
+
#include "direct_io.h"
-static const char* FileName_("./test.file");
-
+static const char* FileName_("./test.file");
+
Y_UNIT_TEST_SUITE(TDirectIoTestSuite) {
Y_UNIT_TEST(TestDirectFile) {
TDirectIOBufferedFile file(FileName_, RdWr | Direct | Seq | CreateAlways, 1 << 15);
@@ -51,7 +51,7 @@ Y_UNIT_TEST_SUITE(TDirectIoTestSuite) {
}
NFs::Remove(FileName_);
}
-
+
void TestHugeFile(size_t size) {
TTempFile tmpFile("test.file");
@@ -87,29 +87,29 @@ Y_UNIT_TEST_SUITE(TDirectIoTestSuite) {
}
}
}
-
-Y_UNIT_TEST_SUITE(TDirectIoErrorHandling) {
- Y_UNIT_TEST(Constructor) {
- // A non-existent file should not be opened for reading
+
+Y_UNIT_TEST_SUITE(TDirectIoErrorHandling) {
+ Y_UNIT_TEST(Constructor) {
+ // A non-existent file should not be opened for reading
UNIT_ASSERT_EXCEPTION(TDirectIOBufferedFile(FileName_, RdOnly, 1 << 15), TFileError);
- }
-
- Y_UNIT_TEST(WritingReadOnlyFileBufferFlushed) {
- // Note the absence of Direct
- TDirectIOBufferedFile file(FileName_, RdOnly | OpenAlways, 1);
- TString buffer = "Hello";
- UNIT_ASSERT_EXCEPTION(file.Write(buffer.data(), buffer.size()), TFileError);
- NFs::Remove(FileName_);
- }
-
- Y_UNIT_TEST(WritingReadOnlyFileAllInBuffer) {
- TDirectIOBufferedFile file(FileName_, RdOnly | Direct | Seq | OpenAlways, 1 << 15);
- TString buffer = "Hello";
-
- // Doesn't throw because of buffering.
- file.Write(buffer.data(), buffer.size());
-
- UNIT_ASSERT_EXCEPTION(file.Finish(), TFileError);
- NFs::Remove(FileName_);
- }
-}
+ }
+
+ Y_UNIT_TEST(WritingReadOnlyFileBufferFlushed) {
+ // Note the absence of Direct
+ TDirectIOBufferedFile file(FileName_, RdOnly | OpenAlways, 1);
+ TString buffer = "Hello";
+ UNIT_ASSERT_EXCEPTION(file.Write(buffer.data(), buffer.size()), TFileError);
+ NFs::Remove(FileName_);
+ }
+
+ Y_UNIT_TEST(WritingReadOnlyFileAllInBuffer) {
+ TDirectIOBufferedFile file(FileName_, RdOnly | Direct | Seq | OpenAlways, 1 << 15);
+ TString buffer = "Hello";
+
+ // Doesn't throw because of buffering.
+ file.Write(buffer.data(), buffer.size());
+
+ UNIT_ASSERT_EXCEPTION(file.Finish(), TFileError);
+ NFs::Remove(FileName_);
+ }
+}