diff options
author | muzykantov <muzykantov@yandex-team.ru> | 2022-02-10 16:51:51 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:51:51 +0300 |
commit | fffc5498228bac1ad41ed40b9b7f5cb453796ba8 (patch) | |
tree | ab7fbbf3253d4c0e2793218f09378908beb025fb | |
parent | 8057fea3b8c36263516f0a7e1a01fdf7380764a4 (diff) | |
download | ydb-fffc5498228bac1ad41ed40b9b7f5cb453796ba8.tar.gz |
Restoring authorship annotation for <muzykantov@yandex-team.ru>. Commit 2 of 2.
-rw-r--r-- | util/generic/array_ref.h | 22 | ||||
-rw-r--r-- | util/system/fstat.cpp | 4 | ||||
-rw-r--r-- | util/system/fstat_ut.cpp | 42 |
3 files changed, 34 insertions, 34 deletions
diff --git a/util/generic/array_ref.h b/util/generic/array_ref.h index 13666508e2..1ac60ac7d3 100644 --- a/util/generic/array_ref.h +++ b/util/generic/array_ref.h @@ -94,39 +94,39 @@ public: return (S_ == 0); } - constexpr inline iterator begin() const noexcept { + constexpr inline iterator begin() const noexcept { return T_; } - constexpr inline iterator end() const noexcept { + constexpr inline iterator end() const noexcept { return (T_ + S_); } - constexpr inline const_iterator cbegin() const noexcept { + constexpr inline const_iterator cbegin() const noexcept { return T_; } - constexpr inline const_iterator cend() const noexcept { + constexpr inline const_iterator cend() const noexcept { return (T_ + S_); } - constexpr inline reverse_iterator rbegin() const noexcept { + constexpr inline reverse_iterator rbegin() const noexcept { return reverse_iterator(T_ + S_); } - constexpr inline reverse_iterator rend() const noexcept { + constexpr inline reverse_iterator rend() const noexcept { return reverse_iterator(T_); } - constexpr inline const_reverse_iterator crbegin() const noexcept { + constexpr inline const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(T_ + S_); } - constexpr inline const_reverse_iterator crend() const noexcept { + constexpr inline const_reverse_iterator crend() const noexcept { return const_reverse_iterator(T_); } - constexpr inline reference front() const noexcept { + constexpr inline reference front() const noexcept { return *T_; } @@ -150,7 +150,7 @@ public: return (*this)[n]; } - constexpr inline explicit operator bool() const noexcept { + constexpr inline explicit operator bool() const noexcept { return (S_ > 0); } @@ -216,7 +216,7 @@ public: return TArrayRef(T_ + offset, size); } - constexpr inline yssize_t ysize() const noexcept { + constexpr inline yssize_t ysize() const noexcept { return static_cast<yssize_t>(this->size()); } diff --git a/util/system/fstat.cpp b/util/system/fstat.cpp index b4031c27fe..81e98cbc6b 100644 --- a/util/system/fstat.cpp +++ b/util/system/fstat.cpp @@ -27,8 +27,8 @@ ui32 GetFileMode(DWORD fileAttributes) { mode |= _S_IFDIR; if (fileAttributes & (FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE)) mode |= _S_IFREG; - if ((fileAttributes & FILE_ATTRIBUTE_READONLY) == 0) - mode |= _S_IWRITE; + if ((fileAttributes & FILE_ATTRIBUTE_READONLY) == 0) + mode |= _S_IWRITE; return mode; } diff --git a/util/system/fstat_ut.cpp b/util/system/fstat_ut.cpp index 526ba77167..160ecd936e 100644 --- a/util/system/fstat_ut.cpp +++ b/util/system/fstat_ut.cpp @@ -133,25 +133,25 @@ Y_UNIT_TEST_SUITE(TestFileStat) { UNIT_ASSERT_VALUES_EQUAL_C(false, statFollow.IsDir(), ToString(statFollow.Mode)); } - Y_UNIT_TEST(ChmodTest) { - const TString fileName = "m.txt"; - TFile file(fileName.c_str(), OpenAlways | WrOnly); - file.Write("1", 1); - file.Close(); - - const TFileStat statDefault(fileName); - UNIT_ASSERT(Chmod(fileName.c_str(), statDefault.Mode) == 0); - const TFileStat statUnchanged(fileName); - UNIT_ASSERT_VALUES_EQUAL(statDefault.Mode, statUnchanged.Mode); - - UNIT_ASSERT(Chmod(fileName.c_str(), S_IRUSR | S_IRGRP | S_IROTH) == 0); - const TFileStat statReadOnly(fileName); - UNIT_ASSERT_VALUES_UNEQUAL(statDefault.Mode, statReadOnly.Mode); - UNIT_ASSERT(Chmod(fileName.c_str(), statReadOnly.Mode) == 0); - UNIT_ASSERT_VALUES_EQUAL(statReadOnly.Mode, TFileStat(fileName).Mode); - - UNIT_ASSERT(Chmod(fileName.c_str(), statDefault.Mode) == 0); - UNIT_ASSERT(unlink(fileName.c_str()) == 0); - } - + Y_UNIT_TEST(ChmodTest) { + const TString fileName = "m.txt"; + TFile file(fileName.c_str(), OpenAlways | WrOnly); + file.Write("1", 1); + file.Close(); + + const TFileStat statDefault(fileName); + UNIT_ASSERT(Chmod(fileName.c_str(), statDefault.Mode) == 0); + const TFileStat statUnchanged(fileName); + UNIT_ASSERT_VALUES_EQUAL(statDefault.Mode, statUnchanged.Mode); + + UNIT_ASSERT(Chmod(fileName.c_str(), S_IRUSR | S_IRGRP | S_IROTH) == 0); + const TFileStat statReadOnly(fileName); + UNIT_ASSERT_VALUES_UNEQUAL(statDefault.Mode, statReadOnly.Mode); + UNIT_ASSERT(Chmod(fileName.c_str(), statReadOnly.Mode) == 0); + UNIT_ASSERT_VALUES_EQUAL(statReadOnly.Mode, TFileStat(fileName).Mode); + + UNIT_ASSERT(Chmod(fileName.c_str(), statDefault.Mode) == 0); + UNIT_ASSERT(unlink(fileName.c_str()) == 0); + } + } |