ape_reader: Use the BPositionIO GetSize
* Avoid to seek to the end to know the total size.
This commit is contained in:
parent
888469408c
commit
2a8ae5e815
@ -57,15 +57,14 @@ int TPositionBridgeIO::GetPosition()
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
int TPositionBridgeIO::GetSize()
|
int TPositionBridgeIO::GetSize()
|
||||||
{
|
{
|
||||||
off_t aCurPos;
|
|
||||||
off_t aSize;
|
|
||||||
|
|
||||||
if ( mPositionIO == NULL )
|
if ( mPositionIO == NULL )
|
||||||
return 0;
|
return 0;
|
||||||
aCurPos = mPositionIO->Position();
|
|
||||||
mPositionIO->Seek(0, SEEK_END);
|
off_t aSize;
|
||||||
aSize = mPositionIO->Position();
|
status_t err = mPositionIO->GetSize(&aSize);
|
||||||
mPositionIO->Seek(aCurPos, SEEK_SET);
|
if (err != B_OK)
|
||||||
|
return -1;
|
||||||
|
|
||||||
return aSize;
|
return aSize;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user