Commit 2f3b3e39f92d65ea7d4b5e74205fb2df1e6b9b09

Authored by Josh Klontz
1 parent b44ba452

fixed utGallery bugs

openbr/plugins/gallery.cpp
@@ -199,7 +199,7 @@ class utGallery : public BinaryGallery @@ -199,7 +199,7 @@ class utGallery : public BinaryGallery
199 while (bytesNeeded > 0) { 199 while (bytesNeeded > 0) {
200 qint64 bytesRead = gallery.read(dst, bytesNeeded); 200 qint64 bytesRead = gallery.read(dst, bytesNeeded);
201 if (bytesRead <= 0) 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 bytesNeeded -= bytesRead; 203 bytesNeeded -= bytesRead;
204 dst += bytesRead; 204 dst += bytesRead;
205 } 205 }
@@ -224,7 +224,7 @@ class utGallery : public BinaryGallery @@ -224,7 +224,7 @@ class utGallery : public BinaryGallery
224 if (t.empty()) 224 if (t.empty())
225 return; 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 if (imageID.size() != 16) 228 if (imageID.size() != 16)
229 qFatal("Expected 16-byte ImageID, got: %d bytes.", imageID.size()); 229 qFatal("Expected 16-byte ImageID, got: %d bytes.", imageID.size());
230 230
@@ -239,8 +239,8 @@ class utGallery : public BinaryGallery @@ -239,8 +239,8 @@ class utGallery : public BinaryGallery
239 const QByteArray templateID = QCryptographicHash::hash(data, QCryptographicHash::Md5); 239 const QByteArray templateID = QCryptographicHash::hash(data, QCryptographicHash::Md5);
240 const uint32_t size = data.size(); 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 gallery.write((const char*) &algorithmID, 4); 244 gallery.write((const char*) &algorithmID, 4);
245 gallery.write((const char*) &size, 4); 245 gallery.write((const char*) &size, 4);
246 gallery.write(data); 246 gallery.write(data);
openbr/plugins/misc.cpp
@@ -150,7 +150,7 @@ private: @@ -150,7 +150,7 @@ private:
150 dst += (mode == Encoded) ? encoded : decoded; 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 dst.file.set("AlgorithmID", mode == Decoded ? 5 : 3); 154 dst.file.set("AlgorithmID", mode == Decoded ? 5 : 3);
155 } 155 }
156 }; 156 };