Commit ecbda287d4c85c1845993be6e0c3eaff6ab66295
1 parent
dfb71de9
BinaryGallery support for streams which don't know they have reached the end of …
…the stream until they try to read from it
Showing
1 changed file
with
5 additions
and
2 deletions
openbr/plugins/gallery.cpp
| ... | ... | @@ -125,7 +125,10 @@ class BinaryGallery : public Gallery |
| 125 | 125 | |
| 126 | 126 | TemplateList templates; |
| 127 | 127 | while ((templates.size() < readBlockSize) && !stream.atEnd()) { |
| 128 | - templates.append(readTemplate()); | |
| 128 | + const Template t = readTemplate(); | |
| 129 | + if (t.isEmpty() && t.file.isNull()) | |
| 130 | + continue; | |
| 131 | + templates.append(t); | |
| 129 | 132 | templates.last().file.set("progress", totalSize()); |
| 130 | 133 | } |
| 131 | 134 | |
| ... | ... | @@ -199,7 +202,7 @@ class utGallery : public BinaryGallery |
| 199 | 202 | while (bytesNeeded > 0) { |
| 200 | 203 | qint64 bytesRead = gallery.read(dst, bytesNeeded); |
| 201 | 204 | if (bytesRead <= 0) |
| 202 | - qFatal("Unexepected EOF when reading universal template data, needed: %d more bytes.", bytesNeeded); | |
| 205 | + qFatal("Unexepected EOF when reading universal template data, needed: %d more bytes.", int(bytesNeeded)); | |
| 203 | 206 | bytesNeeded -= bytesRead; |
| 204 | 207 | dst += bytesRead; |
| 205 | 208 | } | ... | ... |