[vlc-commits] taglib: fix readBlock

Thomas Guillem git at videolan.org
Fri Jul 22 11:26:05 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jul 22 11:10:49 2016 +0200| [e54bc05e228f86a764f6af3e8a65477ee8b59fbf] | committer: Thomas Guillem

taglib: fix readBlock

Taglib doesn't handle partial reads.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e54bc05e228f86a764f6af3e8a65477ee8b59fbf
---

 modules/meta_engine/taglib.cpp |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp
index 94b9dbc..15c77f3 100644
--- a/modules/meta_engine/taglib.cpp
+++ b/modules/meta_engine/taglib.cpp
@@ -180,10 +180,11 @@ public:
     ByteVector readBlock(ulong length)
     {
         ByteVector res(length, 0);
-        int i_read = vlc_stream_ReadPartial( m_stream, res.data(), length);
+        ssize_t i_read = vlc_stream_Read( m_stream, res.data(), length);
         if (i_read < 0)
-            return ByteVector::null;;
-        res.resize(i_read);
+            return ByteVector::null;
+        else if ((size_t)i_read != length)
+            res.resize(i_read);
         return res;
     }
 



More information about the vlc-commits mailing list