From 52fb63aded47733fa67e871ce0bd360b9eea7468 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 2 Nov 2021 15:25:02 +0200 Subject: [PATCH] Shuffle some names around in the data tool --- tool/packer.cpp | 19 +++++++++---------- tool/packer.h | 4 ++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/tool/packer.cpp b/tool/packer.cpp index d54d333..fa4d7e2 100644 --- a/tool/packer.cpp +++ b/tool/packer.cpp @@ -55,11 +55,10 @@ void Packer::pack_file(const string &fn) IO::BufferedFile in(fn); ObjectList objects; - bool raw = detect_raw(in); - if(raw) - transfer_raw(in, *tmp_file); - else + if(detect_data(in)) transfer_datafile(in, fn, *tmp_file, objects); + else + transfer_unknown(in, *tmp_file); unsigned length = tmp_file->tell()-offset; @@ -72,12 +71,12 @@ void Packer::pack_file(const string &fn) dir_alloc += 100+objects.size()*100; } -bool Packer::detect_raw(IO::Seekable &in) +bool Packer::detect_data(IO::Seekable &in) { IO::SeekOffset offset = in.tell(); - bool raw = false; + bool data = true; DataFile::Parser parser(in, "-"); - while(!raw && parser && in.tell()<10240) + while(data && parser && in.tell()<10240) { try { @@ -85,11 +84,11 @@ bool Packer::detect_raw(IO::Seekable &in) } catch(...) { - raw = true; + data = false; } } in.seek(offset, IO::S_BEG); - return raw; + return data; } void Packer::transfer_datafile(IO::Base &in, const string &fn, IO::Base &out, ObjectList &objects) @@ -124,7 +123,7 @@ void Packer::transfer_datafile(IO::Base &in, const string &fn, IO::Base &out, Ob delete writer; } -void Packer::transfer_raw(IO::Base &in, IO::Base &out) +void Packer::transfer_unknown(IO::Base &in, IO::Base &out) { while(!in.eof()) { diff --git a/tool/packer.h b/tool/packer.h index 960fea6..151947f 100644 --- a/tool/packer.h +++ b/tool/packer.h @@ -33,9 +33,9 @@ public: void pack_file(const std::string &); private: - bool detect_raw(Msp::IO::Seekable &); + bool detect_data(Msp::IO::Seekable &); void transfer_datafile(Msp::IO::Base &, const std::string &, Msp::IO::Base &, ObjectList &); - void transfer_raw(Msp::IO::Base &, Msp::IO::Base &); + void transfer_unknown(Msp::IO::Base &, Msp::IO::Base &); public: void create_pack(const std::string &); }; -- 2.45.2