From b309ae8936e9b021045008485e0433425b0dd198 Mon Sep 17 00:00:00 2001 From: Hamatoma Date: Wed, 1 Jun 2016 03:03:21 +0200 Subject: [PATCH] Windows corrections --- appl/rebackgui/BackupUtils.cpp | 7 +++++-- appl/rebackgui/Configuration.cpp | 2 ++ appl/rebackgui/mainwindow.cpp | 7 ++++++- appl/rebackgui/mainwindow.hpp | 2 ++ base/ReFileUtils.cpp | 8 ++++++-- base/ReLogger.cpp | 4 ++-- base/ReStringUtils.cpp | 4 ++-- gui/ReSettings.hpp | 4 ++-- 8 files changed, 27 insertions(+), 11 deletions(-) diff --git a/appl/rebackgui/BackupUtils.cpp b/appl/rebackgui/BackupUtils.cpp index 2b7e5d4..ed7a9d8 100644 --- a/appl/rebackgui/BackupUtils.cpp +++ b/appl/rebackgui/BackupUtils.cpp @@ -56,6 +56,7 @@ QString BackupUtils::findAbstractTarget(const QString& path, ReLogger* logger) } } #elif defined _WIN32 + (void) logger; rc = ";" + path.mid(2); #endif return rc; @@ -111,6 +112,7 @@ QString BackupUtils::findTarget(const BackupItem& item, MainWindow& mainWindow, } } #elif defined _WIN32 + (void) tempoararyMounted; QStringList drives = ReFileUtils::findRootDirs(); QStringList::const_iterator it; for (it = drives.cbegin(); it != drives.cend(); ++it){ @@ -125,7 +127,7 @@ QString BackupUtils::findTarget(const BackupItem& item, MainWindow& mainWindow, if (QFileInfo(markerFile).exists()){ if (rc.isEmpty()) rc = ReFileUtils::parentOf(markerFile); - ReConfig config(I18N::s2b(markerFile), true, logger); + ReConfig config(I18N::s2b(markerFile), true, mainWindow.logger()); if (! config.asString((item.m_uid + ".created").toLatin1(), "").isEmpty()){ rc = ReFileUtils::parentOf(markerFile); @@ -211,7 +213,8 @@ QString BackupUtils::targetDescription(const QString& backupPath, ReLogger *logg } } #elif defined _WIN32 - + (void) backupPath; + (void) logger; #endif return rc; } diff --git a/appl/rebackgui/Configuration.cpp b/appl/rebackgui/Configuration.cpp index 88298e1..ae2de13 100644 --- a/appl/rebackgui/Configuration.cpp +++ b/appl/rebackgui/Configuration.cpp @@ -205,7 +205,9 @@ ReSuccess_t Configuration::readBackupDate(BackupItem& item){ } } } +#ifdef __linux__ m_mainWindow->unmount(temporaryMounted); +#endif FILETRACE_IT(s_traceConfig, (s_traceConfig.m_fp, "comboBoxVerbose->currentIndex(); if (! isStart){ setStatusMessage(LOG_INFO, ""); +#ifdef __linux__ unmount(""); +#endif } } @@ -960,6 +964,7 @@ void MainWindow::writeTargetConfiguration(BackupItem& item, const QString& targe onSaveConfig(); } +#ifdef __linux__ /** * Unmounts the current target device. * @@ -983,4 +988,4 @@ void MainWindow::unmount(const QString& device) .arg(QString::fromUtf8(answer))); } } - +#endif diff --git a/appl/rebackgui/mainwindow.hpp b/appl/rebackgui/mainwindow.hpp index 6714d7d..f6a2fff 100644 --- a/appl/rebackgui/mainwindow.hpp +++ b/appl/rebackgui/mainwindow.hpp @@ -38,7 +38,9 @@ public: void setLastFile(const QString& lastFile); void setLastFile(const QString& lastDir, const QString& lastFile); void saveState(); +#ifdef __linux__ void unmount(const QString& device); +#endif QString lastDirectory() const; void setLastTarget(const QString& lastTarget); diff --git a/base/ReFileUtils.cpp b/base/ReFileUtils.cpp index 5ba8580..99a8b24 100644 --- a/base/ReFileUtils.cpp +++ b/base/ReFileUtils.cpp @@ -24,9 +24,10 @@ enum { int ReFileUtils::m_maxCharSet = 128; bool ReFileUtils::m_ignoreSetUidError = false; QDateTime ReFileUtils::m_undefinedTime; +#ifdef __linux__ ReMountInfo* ReMountInfo::m_instance = NULL; ReBlockDevices* ReBlockDevices::m_instance = NULL; - +#endif /** * Constructor. */ @@ -173,6 +174,9 @@ QString ReFileUtils::copy(const QString& source, const QString& target, bool setUser){ QString rc; #if defined _WIN32 + (void) setUser; + (void) buffer; + (void) sourceInfo; const ushort* src = source.utf16(); const ushort* trg = target.utf16(); if (! CopyFile(reinterpret_cast(src), @@ -1184,7 +1188,7 @@ QByteArray ReFileUtils::tempFile(const char* node, const char* parent, _unlink(rc.constData()); return rc; } -#if 0 +#ifdef WIN32 /** * Converts the unix time (milliseconds from 1.1.1970) to the WIN32 filetime. * diff --git a/base/ReLogger.cpp b/base/ReLogger.cpp index 544f304..6116a87 100644 --- a/base/ReLogger.cpp +++ b/base/ReLogger.cpp @@ -548,7 +548,7 @@ void ReFileAppender::findLastNo() QByteArray fullName; for (int ix = m_currentNo; ix > 0 && ix > m_currentNo - 10; ix--){ fullName = nameOf(ix); - unlink(fullName); + _unlink(fullName); } } @@ -581,7 +581,7 @@ void ReFileAppender::reopen(bool isFirst) { } if (m_currentNo - m_maxCount > 0){ fullName = nameOf(m_currentNo - m_maxCount); - unlink(fullName.constData()); + _unlink(fullName.constData()); } } diff --git a/base/ReStringUtils.cpp b/base/ReStringUtils.cpp index 79a815d..de2fd59 100644 --- a/base/ReStringUtils.cpp +++ b/base/ReStringUtils.cpp @@ -232,7 +232,7 @@ bool ReStringUtils::isInList(const char* phrase, const char* list, while (!rc && end != NULL) { if (end - list == phraseLength) { if (ignoreCase) - rc = strnicmp(list, phrase, phraseLength) == 0; + rc = _strnicmp(list, phrase, phraseLength) == 0; else rc = strncmp(list, phrase, end - list) == 0; if (rc) @@ -243,7 +243,7 @@ bool ReStringUtils::isInList(const char* phrase, const char* list, } if (!rc) { if (ignoreCase) - rc = strnicmp(list, phrase, end - list) == 0; + rc = _strnicmp(list, phrase, end - list) == 0; else rc = strncmp(list, phrase, end - list) == 0; } diff --git a/gui/ReSettings.hpp b/gui/ReSettings.hpp index 135d639..5734137 100644 --- a/gui/ReSettings.hpp +++ b/gui/ReSettings.hpp @@ -71,8 +71,8 @@ typedef QMap*> ReChapterMap; class ReSettings { public: - static QString TRUE; - static QString FALSE; + static QString sTRUE; + static QString sFALSE; public: ReSettings(const QString& path, const QString& prefix, ReLogger* logger); ~ReSettings(); -- 2.39.5