From e82920f726af10db91ad949340c0584dfc66b611 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Thu, 31 Jul 2014 14:52:21 -0400 Subject: [PATCH] BinaryGallery and jsonGallery logic cleanup --- openbr/plugins/gallery.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/openbr/plugins/gallery.cpp b/openbr/plugins/gallery.cpp index 620b11a..48c8040 100644 --- a/openbr/plugins/gallery.cpp +++ b/openbr/plugins/gallery.cpp @@ -147,10 +147,10 @@ class BinaryGallery : public Gallery TemplateList templates; while ((templates.size() < readBlockSize) && !gallery.atEnd()) { const Template t = readTemplate(); - if (t.isEmpty() && t.file.isNull()) - continue; - templates.append(t); - templates.last().file.set("progress", position()); + if (!t.isEmpty() || !t.file.isNull()) { + templates.append(t); + templates.last().file.set("progress", position()); + } // Special case for pipes where we want to process data as soon as it is available if (gallery.isSequential()) @@ -350,7 +350,9 @@ class jsonGallery : public BinaryGallery Template readTemplate() { QJsonParseError error; - const QByteArray line = gallery.readLine(); + const QByteArray line = gallery.readLine().simplified(); + if (line.isEmpty()) + return Template(); File file = QJsonDocument::fromJson(line, &error).object().toVariantMap(); if (error.error != QJsonParseError::NoError) { qWarning("Couldn't parse: %s\n", line.data()); -- libgit2 0.21.4