From 2a8ae5e8155fa2cb69d9368c3299d8979ada5670 Mon Sep 17 00:00:00 2001 From: Dario Casalinuovo Date: Tue, 31 May 2016 00:58:33 +0200 Subject: [PATCH] ape_reader: Use the BPositionIO GetSize * Avoid to seek to the end to know the total size. --- .../ape_reader/LibMonkeysAudio/PositionBridgeIO.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/add-ons/media/plugins/ape_reader/LibMonkeysAudio/PositionBridgeIO.cpp b/src/add-ons/media/plugins/ape_reader/LibMonkeysAudio/PositionBridgeIO.cpp index 3b610f6f9a..9bf4fffeb3 100644 --- a/src/add-ons/media/plugins/ape_reader/LibMonkeysAudio/PositionBridgeIO.cpp +++ b/src/add-ons/media/plugins/ape_reader/LibMonkeysAudio/PositionBridgeIO.cpp @@ -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; } //------------------------------------------------------------------------------