diff options
author | danlark <danlark@yandex-team.ru> | 2022-02-10 16:46:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:08 +0300 |
commit | 3426a9bc7f169ae9da54cef557ad2a33f6e8eee0 (patch) | |
tree | 26154e1e9990f1bb4525d3e3fb5b6dac2c2c1da2 /tools/archiver | |
parent | cb68f224c46a8ee52ac3fdd2a32534b8bb8dc134 (diff) | |
download | ydb-3426a9bc7f169ae9da54cef557ad2a33f6e8eee0.tar.gz |
Restoring authorship annotation for <danlark@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'tools/archiver')
-rw-r--r-- | tools/archiver/alignment_test/alignment_ut.cpp | 16 | ||||
-rw-r--r-- | tools/archiver/main.cpp | 20 |
2 files changed, 18 insertions, 18 deletions
diff --git a/tools/archiver/alignment_test/alignment_ut.cpp b/tools/archiver/alignment_test/alignment_ut.cpp index 88b07e19b0..a40e2e28c5 100644 --- a/tools/archiver/alignment_test/alignment_ut.cpp +++ b/tools/archiver/alignment_test/alignment_ut.cpp @@ -20,10 +20,10 @@ Y_UNIT_TEST_SUITE(AlignmentTest) { ); auto dataFile1 = dataArchive.BlobByKey("/data_file.txt"); auto dataFile2 = dataArchive.BlobByKey("/data_file2.txt"); - UNIT_ASSERT_NO_DIFF(TStringBuf(dataFile1.AsCharPtr(), dataFile1.Size()), "some text\n"); - UNIT_ASSERT_NO_DIFF(TStringBuf(dataFile2.AsCharPtr(), dataFile2.Size()), "second file content\n"); - UNIT_ASSERT_VALUES_EQUAL(size_t(dataFile1.AsCharPtr()) % ArchiveWriterDefaultDataAlignment, 0); - UNIT_ASSERT_VALUES_EQUAL(size_t(dataFile2.AsCharPtr()) % ArchiveWriterDefaultDataAlignment, 0); + UNIT_ASSERT_NO_DIFF(TStringBuf(dataFile1.AsCharPtr(), dataFile1.Size()), "some text\n"); + UNIT_ASSERT_NO_DIFF(TStringBuf(dataFile2.AsCharPtr(), dataFile2.Size()), "second file content\n"); + UNIT_ASSERT_VALUES_EQUAL(size_t(dataFile1.AsCharPtr()) % ArchiveWriterDefaultDataAlignment, 0); + UNIT_ASSERT_VALUES_EQUAL(size_t(dataFile2.AsCharPtr()) % ArchiveWriterDefaultDataAlignment, 0); } Y_UNIT_TEST(ArchiveAsmCheck) { @@ -33,9 +33,9 @@ Y_UNIT_TEST_SUITE(AlignmentTest) { ); auto dataFile1 = dataArchive.BlobByKey("/data_file.txt"); auto dataFile2 = dataArchive.BlobByKey("/data_file2.txt"); - UNIT_ASSERT_NO_DIFF(TStringBuf(dataFile1.AsCharPtr(), dataFile1.Size()), "some text\n"); - UNIT_ASSERT_NO_DIFF(TStringBuf(dataFile2.AsCharPtr(), dataFile2.Size()), "second file content\n"); - UNIT_ASSERT_VALUES_EQUAL(size_t(dataFile1.AsCharPtr()) % ArchiveWriterDefaultDataAlignment, 0); - UNIT_ASSERT_VALUES_EQUAL(size_t(dataFile2.AsCharPtr()) % ArchiveWriterDefaultDataAlignment, 0); + UNIT_ASSERT_NO_DIFF(TStringBuf(dataFile1.AsCharPtr(), dataFile1.Size()), "some text\n"); + UNIT_ASSERT_NO_DIFF(TStringBuf(dataFile2.AsCharPtr(), dataFile2.Size()), "second file content\n"); + UNIT_ASSERT_VALUES_EQUAL(size_t(dataFile1.AsCharPtr()) % ArchiveWriterDefaultDataAlignment, 0); + UNIT_ASSERT_VALUES_EQUAL(size_t(dataFile2.AsCharPtr()) % ArchiveWriterDefaultDataAlignment, 0); } } diff --git a/tools/archiver/main.cpp b/tools/archiver/main.cpp index 6cda54c1ea..3648d6647f 100644 --- a/tools/archiver/main.cpp +++ b/tools/archiver/main.cpp @@ -34,7 +34,7 @@ namespace { void DoWrite(const void* data, size_t len) override { for (const char* p = (const char*)data; len > 0; ++p, --len) { Buf.append(*p); - if (Buf.size() == Stride) + if (Buf.size() == Stride) WriteBuf(); } } @@ -319,7 +319,7 @@ static inline TString GetFile(const TString& s) { } static inline TString Fix(TString f) { - if (!f.empty() && IsDelim(f[f.size() - 1])) { + if (!f.empty() && IsDelim(f[f.size() - 1])) { f.pop_back(); } @@ -374,7 +374,7 @@ namespace { if (IsDir(Path)) { DoRecurse(w, "/"); } else { - Append(w, Path, Key.size() ? Key : Prefix + "/" + GetFile(Path)); + Append(w, Path, Key.size() ? Key : Prefix + "/" + GetFile(Path)); } } @@ -605,15 +605,15 @@ int main(int argc, char** argv) { const auto& files = optsRes.GetFreeArgs(); TVector<TStringBuf> keys; - if (forceKeys.size()) - StringSplitter(forceKeys).Split(':').SkipEmpty().Collect(&keys); + if (forceKeys.size()) + StringSplitter(forceKeys).Split(':').SkipEmpty().Collect(&keys); - if (keys.size() && keys.size() != files.size()) { + if (keys.size() && keys.size() != files.size()) { Cerr << "Invalid number of keys=" << keys.size() << " (!= number of files=" << files.size() << ")" << Endl; return 1; } - for (size_t i = 0; i < files.size(); ++i) { + for (size_t i = 0; i < files.size(); ++i) { const auto& path = files[i]; size_t off = 0; #ifdef _win_ @@ -625,7 +625,7 @@ int main(int argc, char** argv) { cur.Path = path.substr(0, pos); if (pos != TString::npos) cur.Prefix = path.substr(pos + 1); - if (keys.size()) + if (keys.size()) cur.Key = keys[i]; cur.Recursive = recursive; cur.Fix(); @@ -665,7 +665,7 @@ int main(int argc, char** argv) { out = hexout.Get(); } - outf->Write(prepend.data(), prepend.size()); + outf->Write(prepend.data(), prepend.size()); if (cat) { for (const auto& rec: recs) { @@ -691,7 +691,7 @@ int main(int argc, char** argv) { } catch (...) { } - outf->Write(append.data(), append.size()); + outf->Write(append.data(), append.size()); } } catch (...) { Cerr << CurrentExceptionMessage() << Endl; |