From ecbda287d4c85c1845993be6e0c3eaff6ab66295 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Fri, 13 Jun 2014 15:28:07 -0400 Subject: [PATCH] BinaryGallery support for streams which don't know they have reached the end of the stream until they try to read from it --- openbr/plugins/gallery.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openbr/plugins/gallery.cpp b/openbr/plugins/gallery.cpp index 547a922..c4b40da 100644 --- a/openbr/plugins/gallery.cpp +++ b/openbr/plugins/gallery.cpp @@ -125,7 +125,10 @@ class BinaryGallery : public Gallery TemplateList templates; while ((templates.size() < readBlockSize) && !stream.atEnd()) { - templates.append(readTemplate()); + const Template t = readTemplate(); + if (t.isEmpty() && t.file.isNull()) + continue; + templates.append(t); templates.last().file.set("progress", totalSize()); } @@ -199,7 +202,7 @@ class utGallery : public BinaryGallery while (bytesNeeded > 0) { qint64 bytesRead = gallery.read(dst, bytesNeeded); if (bytesRead <= 0) - qFatal("Unexepected EOF when reading universal template data, needed: %d more bytes.", bytesNeeded); + qFatal("Unexepected EOF when reading universal template data, needed: %d more bytes.", int(bytesNeeded)); bytesNeeded -= bytesRead; dst += bytesRead; } -- libgit2 0.21.4