aboutsummaryrefslogtreecommitdiffstats
path: root/tools/archiver
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:25 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:25 +0300
commit344ea37b4a345701ab0e67de2266a1c1bd7baf2d (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /tools/archiver
parent706b83ed7de5a473436620367af31fc0ceecde07 (diff)
downloadydb-344ea37b4a345701ab0e67de2266a1c1bd7baf2d.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 2 of 2.
Diffstat (limited to 'tools/archiver')
-rw-r--r--tools/archiver/main.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/tools/archiver/main.cpp b/tools/archiver/main.cpp
index 30ffea8aab..6cda54c1ea 100644
--- a/tools/archiver/main.cpp
+++ b/tools/archiver/main.cpp
@@ -48,7 +48,7 @@ namespace {
private:
IOutputStream& Slave;
const size_t Stride;
- TString Buf;
+ TString Buf;
};
class THexOutput: public IOutputStream {
@@ -158,7 +158,7 @@ namespace {
}
IOutputStream* Out_ = nullptr;
- const TString Base_;
+ const TString Base_;
ui64 Count_ = 0;
};
@@ -177,7 +177,7 @@ namespace {
*Slave() << "\n};\nextern const unsigned int " << B << "Size = sizeof(" << B << ") / sizeof(" << B << "[0]);\n}\n";
}
- const TString B;
+ const TString B;
};
struct TCStringOutput: public IOutputStream {
@@ -192,7 +192,7 @@ namespace {
}
void DoWrite(const void* data, size_t len) override {
- *O << TString((const char*)data, len).Quote() << '\n';
+ *O << TString((const char*)data, len).Quote() << '\n';
}
void DoFinish() override {
@@ -201,7 +201,7 @@ namespace {
}
IOutputStream* O = nullptr;
- const TString B;
+ const TString B;
};
struct TMyFileComparator {
@@ -228,7 +228,7 @@ namespace {
return res < 0;
}
- mutable THashMap<std::pair<TString, TString>, int> SavedResults;
+ mutable THashMap<std::pair<TString, TString>, int> SavedResults;
};
struct TDuplicatesMap {
@@ -241,14 +241,14 @@ namespace {
void Finish() {
Y_ENSURE(!InitialFillingDone);
InitialFillingDone = true;
- TMap<i64, TVector<TString>> bySize;
+ TMap<i64, TVector<TString>> bySize;
for (const TString& fname: FileNames) {
TFile file(fname, OpenExisting | RdOnly);
bySize[file.GetLength()].push_back(fname);
}
for (const auto& bySizeElement: bySize) {
if (bySizeElement.second.size() > 1) {
- TMap<TString, TVector<TString>, TMyFileComparator> byContents;
+ TMap<TString, TVector<TString>, TMyFileComparator> byContents;
for (const TString& fname: bySizeElement.second) {
byContents[fname].push_back(fname);
}
@@ -270,9 +270,9 @@ namespace {
}
bool InitialFillingDone = false;
- TVector<TString> FileNames;
- THashMap<TString, TString> FileNameToRecordName;
- THashMap<TString, TString> Synonyms;
+ TVector<TString> FileNames;
+ THashMap<TString, TString> FileNameToRecordName;
+ THashMap<TString, TString> Synonyms;
};
struct TDeduplicationArchiveWriter {
@@ -292,9 +292,9 @@ namespace {
static inline TAutoPtr<IOutputStream> OpenOutput(const TString& url) {
if (url.empty()) {
- return new TBuffered<TUnbufferedFileOutput>(8192, Duplicate(1));
+ return new TBuffered<TUnbufferedFileOutput>(8192, Duplicate(1));
} else {
- return new TBuffered<TUnbufferedFileOutput>(8192, url);
+ return new TBuffered<TUnbufferedFileOutput>(8192, url);
}
}
@@ -302,7 +302,7 @@ static inline bool IsDelim(char ch) noexcept {
return ch == '/' || ch == '\\';
}
-static inline TString GetFile(const TString& s) {
+static inline TString GetFile(const TString& s) {
const char* e = s.end();
const char* b = s.begin();
const char* c = e - 1;
@@ -315,10 +315,10 @@ static inline TString GetFile(const TString& s) {
++c;
}
- return TString(c, e - c);
+ return TString(c, e - c);
}
-static inline TString Fix(TString f) {
+static inline TString Fix(TString f) {
if (!f.empty() && IsDelim(f[f.size() - 1])) {
f.pop_back();
}
@@ -358,9 +358,9 @@ static inline void Append(TDeduplicationArchiveWriter& w, const TString& fname,
namespace {
struct TRec {
bool Recursive = false;
- TString Key;
- TString Path;
- TString Prefix;
+ TString Key;
+ TString Path;
+ TString Prefix;
TRec() = default;
@@ -379,18 +379,18 @@ namespace {
}
template <typename T>
- inline void DoRecurse(T& w, const TString& off) const {
+ inline void DoRecurse(T& w, const TString& off) const {
{
TFileList fl;
const char* name;
- const TString p = Path + off;
+ const TString p = Path + off;
fl.Fill(p, true);
while ((name = fl.Next())) {
- const TString fname = p + name;
- const TString rname = Prefix + off + name;
+ const TString fname = p + name;
+ const TString rname = Prefix + off + name;
Append(w, fname, rname);
}
@@ -400,7 +400,7 @@ namespace {
TDirsList dl;
const char* name;
- const TString p = Path + off;
+ const TString p = Path + off;
dl.Fill(p, true);
@@ -427,7 +427,7 @@ struct TMappingReader {
TBlob Blob;
TArchiveReader Reader;
- TMappingReader(const TString& archive)
+ TMappingReader(const TString& archive)
: Map(archive)
, Blob(TBlob::FromMemoryMapSingleThreaded(Map, 0, Map.Length()))
, Reader(Blob)
@@ -435,12 +435,12 @@ struct TMappingReader {
}
};
-static void UnpackArchive(const TString& archive, const TFsPath& dir = TFsPath()) {
+static void UnpackArchive(const TString& archive, const TFsPath& dir = TFsPath()) {
TMappingReader mappingReader(archive);
const TArchiveReader& reader = mappingReader.Reader;
const size_t count = reader.Count();
for (size_t i = 0; i < count; ++i) {
- const TString key = reader.KeyByIndex(i);
+ const TString key = reader.KeyByIndex(i);
const TString fileName = CutFirstSlash(key);
if (!Quiet) {
Cerr << archive << " --> " << fileName << Endl;
@@ -448,7 +448,7 @@ static void UnpackArchive(const TString& archive, const TFsPath& dir = TFsPath()
const TFsPath path(dir / fileName);
path.Parent().MkDirs();
TAutoPtr<IInputStream> in = reader.ObjectByKey(key);
- TFixedBufferFileOutput out(path);
+ TFixedBufferFileOutput out(path);
TransferData(in.Get(), &out);
out.Finish();
}
@@ -459,7 +459,7 @@ static void ListArchive(const TString& archive, bool cutSlash) {
const TArchiveReader& reader = mappingReader.Reader;
const size_t count = reader.Count();
for (size_t i = 0; i < count; ++i) {
- const TString key = reader.KeyByIndex(i);
+ const TString key = reader.KeyByIndex(i);
TString fileName = key;
if (cutSlash) {
fileName = CutFirstSlash(key);
@@ -473,7 +473,7 @@ static void ListArchiveMd5(const TString& archive, bool cutSlash) {
const TArchiveReader& reader = mappingReader.Reader;
const size_t count = reader.Count();
for (size_t i = 0; i < count; ++i) {
- const TString key = reader.KeyByIndex(i);
+ const TString key = reader.KeyByIndex(i);
TString fileName = key;
if (cutSlash) {
fileName = CutFirstSlash(key);
@@ -558,38 +558,38 @@ int main(int argc, char** argv) {
.Optional()
.StoreValue(&Quiet, true);
- TString prepend;
+ TString prepend;
opts.AddLongOption('z', "prepend", "Prepend string to output")
.RequiredArgument("<prefix>")
.StoreResult(&prepend);
- TString append;
+ TString append;
opts.AddLongOption('a', "append", "Append string to output")
.RequiredArgument("<suffix>")
.StoreResult(&append);
- TString outputf;
+ TString outputf;
opts.AddLongOption('o', "output", "Output to file instead stdout")
.RequiredArgument("<file>")
.StoreResult(&outputf);
- TString unpackDir;
+ TString unpackDir;
opts.AddLongOption('d', "unpackdir", "Unpack destination directory")
.RequiredArgument("<dir>")
.DefaultValue(".")
.StoreResult(&unpackDir);
- TString yasmBase;
+ TString yasmBase;
opts.AddLongOption('A', "yasm", "Output dump is yasm format")
.RequiredArgument("<base>")
.StoreResult(&yasmBase);
- TString cppBase;
+ TString cppBase;
opts.AddLongOption('C', "cpp", "Output dump is C/C++ format")
.RequiredArgument("<base>")
.StoreResult(&cppBase);
- TString forceKeys;
+ TString forceKeys;
opts.AddLongOption('k', "keys", "Set explicit list of keys for elements")
.RequiredArgument("<keys>")
.StoreResult(&forceKeys);
@@ -601,10 +601,10 @@ int main(int argc, char** argv) {
SubstGlobal(append, "\\n", "\n");
SubstGlobal(prepend, "\\n", "\n");
- TVector<TRec> recs;
+ TVector<TRec> recs;
const auto& files = optsRes.GetFreeArgs();
- TVector<TStringBuf> keys;
+ TVector<TStringBuf> keys;
if (forceKeys.size())
StringSplitter(forceKeys).Split(':').SkipEmpty().Collect(&keys);
@@ -623,7 +623,7 @@ int main(int argc, char** argv) {
const size_t pos = path.find(':', off);
TRec cur;
cur.Path = path.substr(0, pos);
- if (pos != TString::npos)
+ if (pos != TString::npos)
cur.Prefix = path.substr(pos + 1);
if (keys.size())
cur.Key = keys[i];