+#include <msp/io/slice.h>
#include <msp/strings/format.h>
#include <msp/strings/regex.h>
#include "collection.h"
using namespace std;
+namespace {
+
+void delete_io(Msp::IO::Base *io)
+{
+ delete io;
+}
+
+}
+
namespace Msp {
namespace DataFile {
RefPtr<IO::Base> PackSource::File::open() const
{
- RefPtr<IO::BufferedFile> io_file = new IO::BufferedFile(pack.get_filename());
- io_file->seek(pack.get_base_offset()+offset, IO::S_BEG);
- return io_file;
+ IO::BufferedFile *io_file = new IO::BufferedFile(pack.get_filename());
+ IO::Slice *io_slice = new IO::Slice(*io_file, pack.get_base_offset()+offset, length);
+ io_slice->signal_deleted.connect(sigc::bind(sigc::ptr_fun(delete_io), io_file));
+ return io_slice;
}
string PackSource::File::get_full_name() const