sparse files fixes. now sets the size of the files in case sparse files are supported

This commit is contained in:
Arvid Norberg
2007-04-19 03:06:15 +00:00
parent a35c1ef1a5
commit 92cf13c2c2
5 changed files with 79 additions and 26 deletions

View File

@@ -245,6 +245,17 @@ namespace libtorrent
return ret;
}
void set_size(size_type s)
{
size_type pos = tell();
seek(1, 0);
char dummy = 0;
read(&dummy, 1);
seek(1, 0);
write(&dummy, 1);
seek(pos, 1);
}
size_type seek(size_type offset, int m)
{
assert(m_open_mode);
@@ -318,6 +329,11 @@ namespace libtorrent
return m_impl->read(buf, num_bytes);
}
void file::set_size(size_type s)
{
m_impl->set_size(s);
}
size_type file::seek(size_type pos, file::seek_mode m)
{
return m_impl->seek(pos, m.m_val);