ape_reader: Use the BPositionIO GetSize

* Avoid to seek to the end to know the total size.
This commit is contained in:
Dario Casalinuovo 2016-05-31 00:58:33 +02:00
parent 888469408c
commit 2a8ae5e815

View File

@ -57,15 +57,14 @@ int TPositionBridgeIO::GetPosition()
//------------------------------------------------------------------------------
int TPositionBridgeIO::GetSize()
{
off_t aCurPos;
off_t aSize;
if ( mPositionIO == NULL )
return 0;
aCurPos = mPositionIO->Position();
mPositionIO->Seek(0, SEEK_END);
aSize = mPositionIO->Position();
mPositionIO->Seek(aCurPos, SEEK_SET);
off_t aSize;
status_t err = mPositionIO->GetSize(&aSize);
if (err != B_OK)
return -1;
return aSize;
}
//------------------------------------------------------------------------------