Don't seek at the end for each top-level element
Rather use the previously determined file size to determine the max element size.
This commit is contained in:
parent
21dc376ad1
commit
fb3702e311
|
@ -61,7 +61,7 @@ void BasicFileInfo::reopen(bool readOnly)
|
||||||
invalidated();
|
invalidated();
|
||||||
m_file.open(m_path, (m_readOnly = readOnly) ? ios_base::in | ios_base::binary : ios_base::in | ios_base::out | ios_base::binary);
|
m_file.open(m_path, (m_readOnly = readOnly) ? ios_base::in | ios_base::binary : ios_base::in | ios_base::out | ios_base::binary);
|
||||||
m_file.seekg(0, ios_base::end);
|
m_file.seekg(0, ios_base::end);
|
||||||
m_size = m_file.tellg();
|
m_size = static_cast<uint64>(m_file.tellg());
|
||||||
m_file.seekg(0, ios_base::beg);
|
m_file.seekg(0, ios_base::beg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,8 +230,7 @@ GenericFileElement<ImplementationType>::GenericFileElement(GenericFileElement<Im
|
||||||
m_container(&container),
|
m_container(&container),
|
||||||
m_parsed(false)
|
m_parsed(false)
|
||||||
{
|
{
|
||||||
stream().seekg(0, std::ios_base::end);
|
m_maxSize = container.fileInfo().size();
|
||||||
m_maxSize = static_cast<uint64>(stream().tellg());
|
|
||||||
if(m_maxSize > startOffset) {
|
if(m_maxSize > startOffset) {
|
||||||
m_maxSize -= startOffset;
|
m_maxSize -= startOffset;
|
||||||
stream().seekg(startOffset, std::ios_base::beg);
|
stream().seekg(startOffset, std::ios_base::beg);
|
||||||
|
|
Loading…
Reference in New Issue