From 27c1445c9f82434a39ada4c5fbf188d1ab09e5ba Mon Sep 17 00:00:00 2001 From: kh1 Date: Tue, 21 Aug 2012 12:05:11 +0200 Subject: Revert "Fixes required for errorless MinGW-w64 compilation are done." This reverts commit 9cad5d54cf0d78e92b4ee831299d83b657f42f2e as it breaks compressing the meta folder (Windows 7, VS 2010). Change-Id: I24d4ec37941487fc3cc998706d33cd5d8b9f011a Reviewed-by: Tim Jenssen --- src/libs/kdtools/kdsavefile.cpp | 11 ++++------- src/libs/kdtools/kdtools.pri | 2 +- src/libs/kdtools/kdupdaterupdateoperations.cpp | 25 ++++++++++++------------- 3 files changed, 17 insertions(+), 21 deletions(-) (limited to 'src/libs/kdtools') diff --git a/src/libs/kdtools/kdsavefile.cpp b/src/libs/kdtools/kdsavefile.cpp index 5a81ad424..94ed1aa36 100644 --- a/src/libs/kdtools/kdsavefile.cpp +++ b/src/libs/kdtools/kdsavefile.cpp @@ -28,8 +28,7 @@ #include #ifdef Q_OS_WIN - #include - #include // PQR for MinGW-w64: Required for _SH_DENYRW +# include #endif #include #include @@ -93,11 +92,9 @@ static QString makeAbsolute(const QString &path) static int myOpen(const QString &path, int flags, int mode) { #ifdef Q_OS_WIN - // PQR for MinGW-w64: _wsopen_s doesn't exist in MSVCRT.dll, let's use _wsopen. - return _wsopen(reinterpret_cast(path.utf16()), flags, _SH_DENYRW, mode); - //int fd; - //_wsopen_s(&fd, reinterpret_cast(path.utf16()), flags, _SH_DENYRW, mode); - //return fd; + int fd; + _wsopen_s(&fd, reinterpret_cast(path.utf16()), flags, _SH_DENYRW, mode); + return fd; #else return open(QFile::encodeName(path).constData(), flags, mode); #endif diff --git a/src/libs/kdtools/kdtools.pri b/src/libs/kdtools/kdtools.pri index 6023fdee8..a83243502 100644 --- a/src/libs/kdtools/kdtools.pri +++ b/src/libs/kdtools/kdtools.pri @@ -17,7 +17,7 @@ HEADERS += $$PWD/kdtoolsglobal.h \ $$PWD/kdsysinfo.h SOURCES += $$PWD/kdjob.cpp \ -# $$PWD/kdgenericfactory.cpp \ # this has no content + $$PWD/kdgenericfactory.cpp \ $$PWD/kdselfrestarter.cpp \ $$PWD/kdsavefile.cpp \ $$PWD/kdrunoncechecker.cpp \ diff --git a/src/libs/kdtools/kdupdaterupdateoperations.cpp b/src/libs/kdtools/kdupdaterupdateoperations.cpp index fa8f3ce0d..6f934abe8 100644 --- a/src/libs/kdtools/kdupdaterupdateoperations.cpp +++ b/src/libs/kdtools/kdupdaterupdateoperations.cpp @@ -104,8 +104,8 @@ void CopyOperation::backup() setValue(QLatin1String("backupOfExistingDestination"), backupFileName(dest)); - // race condition: The backup file could get created - // by another process right now. But this is the same + // race condition: The backup file could get created + // by another process right now. But this is the same // in QFile::copy... const bool success = QFile::rename(dest, value(QLatin1String("backupOfExistingDestination")).toString()); if (!success) @@ -179,9 +179,9 @@ QDomDocument CopyOperation::toXml() const // we don't want to save the backupOfExistingDestination if (!hasValue(QLatin1String("backupOfExistingDestination"))) return UpdateOperation::toXml(); - + CopyOperation *const me = const_cast(this); - + const QVariant v = value(QLatin1String("backupOfExistingDestination")); me->clearValue(QLatin1String("backupOfExistingDestination")); const QDomDocument xml = UpdateOperation::toXml(); @@ -225,8 +225,8 @@ void MoveOperation::backup() setValue(QLatin1String("backupOfExistingDestination"), backupFileName(dest)); - // race condition: The backup file could get created - // by another process right now. But this is the same + // race condition: The backup file could get created + // by another process right now. But this is the same // in QFile::copy... const bool success = QFile::rename(dest, value(QLatin1String("backupOfExistingDestination")).toString()); if (!success) @@ -389,9 +389,9 @@ QDomDocument DeleteOperation::toXml() const // we don't want to save the backupOfExistingFile if (!hasValue(QLatin1String("backupOfExistingFile"))) return UpdateOperation::toXml(); - + DeleteOperation *const me = const_cast(this); - + const QVariant v = value(QLatin1String("backupOfExistingFile")); me->clearValue(QLatin1String("backupOfExistingFile")); const QDomDocument xml = UpdateOperation::toXml(); @@ -847,7 +847,7 @@ bool ExecuteOperation::performOperation() } QList allowedExitCodes; - + QRegExp re(QLatin1String("^\\{((-?\\d+,)*-?\\d+)\\}$")); if (re.exactMatch(args.first())) { const QStringList numbers = re.cap(1).split(QLatin1Char(',')); @@ -865,7 +865,7 @@ bool ExecuteOperation::performOperation() args.pop_back(); #ifdef Q_OS_WIN QString arguments = qt_create_commandline(args.front(), args.mid(1)); - + PROCESS_INFORMATION pinfo; STARTUPINFOW startupInfo = { sizeof(STARTUPINFO), 0, 0, 0, @@ -873,8 +873,7 @@ bool ExecuteOperation::performOperation() static_cast< ulong >(CW_USEDEFAULT), static_cast< ulong >(CW_USEDEFAULT), 0, 0, 0, STARTF_USESHOWWINDOW, SW_HIDE, 0, 0, 0, 0, 0 }; - // PQR for MinGW-w64: Parameter #2 was const_cast< wchar_t* >(static_cast< const wchar_t* >(arguments.utf16())). - success = CreateProcess(0, (LPWSTR)arguments.utf16(), + success = CreateProcess(0, const_cast< wchar_t* >(static_cast< const wchar_t* >(arguments.utf16())), 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, 0, 0, &startupInfo, &pinfo); @@ -888,7 +887,7 @@ bool ExecuteOperation::performOperation() { Environment::instance().applyTo(&process); //apply non-persistent variables process.start(args.front(), args.mid(1)); - + QEventLoop loop; QObject::connect(&process, SIGNAL(finished(int, QProcess::ExitStatus)), &loop, SLOT(quit())); QObject::connect(&process, SIGNAL(readyRead()), this, SLOT(readProcessOutput())); -- cgit v1.2.3