]> git.tdb.fi Git - libs/datafile.git/commitdiff
Shuffle some names around in the data tool
authorMikko Rasa <tdb@tdb.fi>
Tue, 2 Nov 2021 13:25:02 +0000 (15:25 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 2 Nov 2021 14:39:06 +0000 (16:39 +0200)
tool/packer.cpp
tool/packer.h

index d54d333e3affc244e80ce9653cbc4867f66f43fe..fa4d7e236a943ba3361507cb5ff0b2bcf559415a 100644 (file)
@@ -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())
        {
index 960fea6f391a2b49fd7420af193b069d4bdd66f3..151947fbba945bd683017cf1389ff5e467278c3d 100644 (file)
@@ -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 &);
 };