[PATCH 7/8] Webservices: use toUtf8() when dealing with files
Lubomir I. Ivanov
neolit123 at gmail.com
Wed Dec 18 14:47:05 UTC 2013
From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
Looks like toLocal8Bit() when dealing with files that
have special characters in the path is not a good
option on win32.
These are not likely to break but we add the safety
anyway.
Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
qt-ui/subsurfacewebservices.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
index 096100a..266332f 100644
--- a/qt-ui/subsurfacewebservices.cpp
+++ b/qt-ui/subsurfacewebservices.cpp
@@ -125,7 +125,7 @@ static char *prepare_dives_for_divelogs(const bool selected)
/* generate a random filename and create/open that file with zip_open */
QString tempfileQ = QDir::tempPath() + "/import-" + QString::number(qrand() % 99999999) + ".dld";
- tempfile = strdup(tempfileQ.toLocal8Bit().data());
+ tempfile = strdup(tempfileQ.toUtf8().data());
zip = zip_open(tempfile, ZIP_CREATE, NULL);
if (!zip) {
@@ -759,7 +759,7 @@ void DivelogsDeWebServices::downloadFinished()
if (!zip)
::close(duppedfd);
#else
- struct zip *zip = zip_open(zipFile.fileName().toLocal8Bit().data(), 0, &errorcode);
+ struct zip *zip = zip_open(zipFile.fileName().toUtf8().data(), 0, &errorcode);
#endif
if (!zip) {
char buf[512];
@@ -855,7 +855,7 @@ void DivelogsDeWebServices::buttonClicked(QAbstractButton* button)
}
/* parse file and import dives */
char *error = NULL;
- parse_file(zipFile.fileName().toLocal8Bit().data(), &error);
+ parse_file(zipFile.fileName().toUtf8().data(), &error);
if (error != NULL) {
mainWindow()->showError(error);
free(error);
--
1.7.11.msysgit.0
More information about the subsurface
mailing list