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;
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
{
}
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)
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())
{
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 &);
};