mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-15 08:41:19 +08:00
Revert "test NSFile::CFileBinary as Stream"
This reverts commit 54261fd1a1.
This commit is contained in:
@ -22,15 +22,15 @@ bool Sector::IsStreamed()
|
||||
if (stream == nullptr || size == MINISECTOR_SIZE)
|
||||
return false;
|
||||
|
||||
auto currentPossition = stream->TellFile();
|
||||
auto currentPossition = stream->tellg();
|
||||
|
||||
stream->SeekFile(0, SEEK_END);
|
||||
auto endPossition = stream->TellFile();
|
||||
stream->SeekFile(0, SEEK_SET);
|
||||
auto begPossition = stream->TellFile();
|
||||
stream->seekg(std::ios_base::end);
|
||||
auto endPossition = stream->tellg();
|
||||
stream->seekg(std::ios_base::beg);
|
||||
auto begPossition = stream->tellg();
|
||||
auto streamSize = endPossition - begPossition;
|
||||
|
||||
stream->SeekFile(currentPossition, SEEK_SET);
|
||||
stream->seekg(currentPossition, std::ios_base::beg);
|
||||
|
||||
return (this->id * size) + size < streamSize;
|
||||
}
|
||||
@ -85,9 +85,8 @@ std::vector<BYTE> &Sector::GetData()
|
||||
data = std::vector<BYTE>(size, 0);
|
||||
if (IsStreamed())
|
||||
{
|
||||
DWORD bytesWasRead(0);
|
||||
stream->SeekFile(size + id * size, SEEK_SET);
|
||||
stream->ReadFile(data.data(), size, bytesWasRead);
|
||||
stream->seekg(size + id * size, std::ios_base::beg);
|
||||
stream->read(reinterpret_cast<char*>(data.data()), size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user