Commit 8e581750897f501b866d45f19f1c6f4a02519d48
1 parent
3b5ddba6
io tweaks
Showing
2 changed files
with
8 additions
and
4 deletions
openbr/plugins/gallery/binary.cpp
| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | |
| 17 | 17 | #include <QJsonObject> |
| 18 | 18 | #include <QJsonParseError> |
| 19 | +#include <QUrl> | |
| 19 | 20 | |
| 20 | 21 | #ifdef _WIN32 |
| 21 | 22 | #include <io.h> |
| ... | ... | @@ -271,8 +272,9 @@ class utGallery : public BinaryGallery |
| 271 | 272 | t.file.set("Label", ut.label); |
| 272 | 273 | t.append(cv::Mat(1, dataSize, CV_8UC1, dataStart).clone() /* We don't want a shallow copy! */); |
| 273 | 274 | } else { |
| 274 | - if (!gallery.atEnd()) | |
| 275 | - qFatal("Failed to read universal template header!"); | |
| 275 | + gallery.close(); | |
| 276 | + /*if (!gallery.atEnd()) | |
| 277 | + qFatal("Failed to read universal template header!");*/ | |
| 276 | 278 | } |
| 277 | 279 | return t; |
| 278 | 280 | } |
| ... | ... | @@ -284,7 +286,7 @@ class utGallery : public BinaryGallery |
| 284 | 286 | qFatal("Expected 16-byte ImageID, got: %d bytes.", imageID.size()); |
| 285 | 287 | |
| 286 | 288 | const int32_t algorithmID = (t.isEmpty() || t.file.fte) ? 0 : t.file.get<int32_t>("AlgorithmID"); |
| 287 | - const QByteArray url = t.file.get<QString>("URL", t.file.name).toLatin1(); | |
| 289 | + const QByteArray url = QUrl::fromUserInput(t.file.get<QString>("URL", t.file.name)).toEncoded(); | |
| 288 | 290 | |
| 289 | 291 | int32_t x = 0, y = 0; |
| 290 | 292 | uint32_t width = 0, height = 0; | ... | ... |
openbr/plugins/io/download.cpp
| ... | ... | @@ -57,7 +57,9 @@ private: |
| 57 | 57 | if (!url.contains("://")) |
| 58 | 58 | url = "file://" + url; |
| 59 | 59 | dst.file.set("URL", url); |
| 60 | - if (url.startsWith("file://")) | |
| 60 | + if (url.startsWith("file:///")) | |
| 61 | + url = url.mid(8); | |
| 62 | + else if (url.startsWith("file://")) | |
| 61 | 63 | url = url.mid(7); |
| 62 | 64 | |
| 63 | 65 | QIODevice *device = NULL; | ... | ... |