From fb3702e311d23f964b0d7abfe97c6eafa4f79841 Mon Sep 17 00:00:00 2001 From: Martchus Date: Thu, 17 Aug 2017 20:05:32 +0200 Subject: [PATCH] Don't seek at the end for each top-level element Rather use the previously determined file size to determine the max element size. --- basicfileinfo.cpp | 2 +- genericfileelement.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/basicfileinfo.cpp b/basicfileinfo.cpp index 2ca214e..237a097 100644 --- a/basicfileinfo.cpp +++ b/basicfileinfo.cpp @@ -61,7 +61,7 @@ void BasicFileInfo::reopen(bool readOnly) 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.seekg(0, ios_base::end); - m_size = m_file.tellg(); + m_size = static_cast(m_file.tellg()); m_file.seekg(0, ios_base::beg); } diff --git a/genericfileelement.h b/genericfileelement.h index aa827fa..261f82d 100644 --- a/genericfileelement.h +++ b/genericfileelement.h @@ -230,8 +230,7 @@ GenericFileElement::GenericFileElement(GenericFileElement(stream().tellg()); + m_maxSize = container.fileInfo().size(); if(m_maxSize > startOffset) { m_maxSize -= startOffset; stream().seekg(startOffset, std::ios_base::beg);