Commit 2f3b3e39f92d65ea7d4b5e74205fb2df1e6b9b09
1 parent
b44ba452
fixed utGallery bugs
Showing
2 changed files
with
5 additions
and
5 deletions
openbr/plugins/gallery.cpp
| ... | ... | @@ -199,7 +199,7 @@ class utGallery : public BinaryGallery |
| 199 | 199 | while (bytesNeeded > 0) { |
| 200 | 200 | qint64 bytesRead = gallery.read(dst, bytesNeeded); |
| 201 | 201 | if (bytesRead <= 0) |
| 202 | - qFatal("Unexepected EOF when reading universal template data."); | |
| 202 | + qFatal("Unexepected EOF when reading universal template data, needed: %d more bytes.", bytesNeeded); | |
| 203 | 203 | bytesNeeded -= bytesRead; |
| 204 | 204 | dst += bytesRead; |
| 205 | 205 | } |
| ... | ... | @@ -224,7 +224,7 @@ class utGallery : public BinaryGallery |
| 224 | 224 | if (t.empty()) |
| 225 | 225 | return; |
| 226 | 226 | |
| 227 | - const QByteArray imageID = t.file.get<QByteArray>("ImageID"); | |
| 227 | + const QByteArray imageID = QByteArray::fromHex(t.file.get<QByteArray>("ImageID")); | |
| 228 | 228 | if (imageID.size() != 16) |
| 229 | 229 | qFatal("Expected 16-byte ImageID, got: %d bytes.", imageID.size()); |
| 230 | 230 | |
| ... | ... | @@ -239,8 +239,8 @@ class utGallery : public BinaryGallery |
| 239 | 239 | const QByteArray templateID = QCryptographicHash::hash(data, QCryptographicHash::Md5); |
| 240 | 240 | const uint32_t size = data.size(); |
| 241 | 241 | |
| 242 | - gallery.write(QByteArray::fromHex(imageID)); | |
| 243 | - gallery.write(QByteArray::fromHex(templateID)); | |
| 242 | + gallery.write(imageID); | |
| 243 | + gallery.write(templateID); | |
| 244 | 244 | gallery.write((const char*) &algorithmID, 4); |
| 245 | 245 | gallery.write((const char*) &size, 4); |
| 246 | 246 | gallery.write(data); | ... | ... |
openbr/plugins/misc.cpp
| ... | ... | @@ -150,7 +150,7 @@ private: |
| 150 | 150 | dst += (mode == Encoded) ? encoded : decoded; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - dst.file.set("ImageID", QVariant(QCryptographicHash::hash(data, QCryptographicHash::Md5))); | |
| 153 | + dst.file.set("ImageID", QVariant(QCryptographicHash::hash(data, QCryptographicHash::Md5).toHex())); | |
| 154 | 154 | dst.file.set("AlgorithmID", mode == Decoded ? 5 : 3); |
| 155 | 155 | } |
| 156 | 156 | }; | ... | ... |