summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2013-07-12 09:00:12 +0200
committerhjk <hjk121@nokiamail.com>2013-07-12 09:39:35 +0200
commitb89afac9d445bd193776b71757bffaa8fdf3e958 (patch)
treed6a8a9352254d39861b32d847f24b5abb53539a5
parent80e657b39064266505ab47c562185bdbc5969390 (diff)
downloadqt-creator-b89afac9d445bd193776b71757bffaa8fdf3e958.tar.gz
Utils: Rename winQPidToPid to qPidToPid
... and make it a no-op on non-Windows. Saves #ifdefs. Change-Id: Ie791f7b9f1a425325d0b889e73758c5f7f7e6ad2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
-rw-r--r--src/libs/utils/qtcprocess.cpp14
-rw-r--r--src/libs/utils/qtcprocess.h6
-rw-r--r--src/libs/utils/winutils.cpp6
-rw-r--r--src/libs/utils/winutils.h2
-rw-r--r--src/plugins/debugger/cdb/cdbengine.cpp7
-rw-r--r--src/plugins/debugger/gdb/localgdbprocess.cpp11
-rw-r--r--src/plugins/valgrind/valgrindprocess.cpp6
7 files changed, 26 insertions, 26 deletions
diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp
index 1666d28318..a0764fe678 100644
--- a/src/libs/utils/qtcprocess.cpp
+++ b/src/libs/utils/qtcprocess.cpp
@@ -1473,3 +1473,17 @@ void QtcProcess::ArgIterator::appendArg(const QString &str)
m_str->insert(m_pos, QLatin1Char(' ') + qstr);
m_pos += qstr.length() + 1;
}
+
+namespace Utils {
+
+QTCREATOR_UTILS_EXPORT unsigned long qPidToPid(const Q_PID qpid)
+{
+#ifdef Q_OS_WIN
+ const PROCESS_INFORMATION *processInfo = reinterpret_cast<const PROCESS_INFORMATION*>(qpid);
+ return processInfo->dwProcessId;
+#else
+ return qpid;
+#endif
+}
+
+} // namespace Utils
diff --git a/src/libs/utils/qtcprocess.h b/src/libs/utils/qtcprocess.h
index e516c7dd70..57dae3b5e6 100644
--- a/src/libs/utils/qtcprocess.h
+++ b/src/libs/utils/qtcprocess.h
@@ -155,6 +155,10 @@ private:
#endif
};
-}
+// Converts the Q_PID into a integer value. This is a no-op
+// except on Windows.
+QTCREATOR_UTILS_EXPORT unsigned long qPidToPid(const Q_PID qpid);
+
+} // namespace Utils
#endif // QTCPROCESS_H
diff --git a/src/libs/utils/winutils.cpp b/src/libs/utils/winutils.cpp
index 01ed4d2a0c..cf54a24d4f 100644
--- a/src/libs/utils/winutils.cpp
+++ b/src/libs/utils/winutils.cpp
@@ -177,12 +177,6 @@ QTCREATOR_UTILS_EXPORT QString normalizePathName(const QString &name)
return canonicalName;
}
-QTCREATOR_UTILS_EXPORT unsigned long winQPidToPid(const Q_PID qpid)
-{
- const PROCESS_INFORMATION *processInfo = reinterpret_cast<const PROCESS_INFORMATION*>(qpid);
- return processInfo->dwProcessId;
-}
-
QTCREATOR_UTILS_EXPORT bool winIs64BitSystem()
{
SYSTEM_INFO systemInfo;
diff --git a/src/libs/utils/winutils.h b/src/libs/utils/winutils.h
index b50f73c6cc..e791a41037 100644
--- a/src/libs/utils/winutils.h
+++ b/src/libs/utils/winutils.h
@@ -59,6 +59,8 @@ QTCREATOR_UTILS_EXPORT QString getLongPathName(const QString &name);
// Returns long name with canonical capitalization.
QTCREATOR_UTILS_EXPORT QString normalizePathName(const QString &name);
+// Converts the Q_PID into a integer value. This is a no-op
+// except on Windows.
QTCREATOR_UTILS_EXPORT unsigned long winQPidToPid(const Q_PID qpid);
QTCREATOR_UTILS_EXPORT bool winIs64BitSystem();
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp
index d66f6085e9..9625973ab5 100644
--- a/src/plugins/debugger/cdb/cdbengine.cpp
+++ b/src/plugins/debugger/cdb/cdbengine.cpp
@@ -754,11 +754,8 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa
arg(QDir::toNativeSeparators(executable), m_process.errorString());
return false;
}
-#ifdef Q_OS_WIN
- const unsigned long pid = Utils::winQPidToPid(m_process.pid());
-#else
- const unsigned long pid = 0;
-#endif
+
+ const unsigned long pid = Utils::qPidToPid(m_process.pid());
showMessage(QString::fromLatin1("%1 running as %2").
arg(QDir::toNativeSeparators(executable)).arg(pid), LogMisc);
m_hasDebuggee = true;
diff --git a/src/plugins/debugger/gdb/localgdbprocess.cpp b/src/plugins/debugger/gdb/localgdbprocess.cpp
index 486c372df8..c14eef3a19 100644
--- a/src/plugins/debugger/gdb/localgdbprocess.cpp
+++ b/src/plugins/debugger/gdb/localgdbprocess.cpp
@@ -32,9 +32,7 @@
#include "procinterrupt.h"
#include "debuggerconstants.h"
-#ifdef Q_OS_WIN
-#include <utils/winutils.h>
-#endif
+#include <utils/qtcprocess.h>
namespace Debugger {
namespace Internal {
@@ -84,12 +82,7 @@ void LocalGdbProcess::kill()
bool LocalGdbProcess::interrupt()
{
- long pid;
-#ifdef Q_OS_WIN
- pid = Utils::winQPidToPid(m_gdbProc.pid());
-#else
- pid = m_gdbProc.pid();
-#endif
+ long pid = Utils::qPidToPid(m_gdbProc.pid());
return interruptProcess(pid, GdbEngineType, &m_errorString);
}
diff --git a/src/plugins/valgrind/valgrindprocess.cpp b/src/plugins/valgrind/valgrindprocess.cpp
index 88dce9ea40..d112044e6c 100644
--- a/src/plugins/valgrind/valgrindprocess.cpp
+++ b/src/plugins/valgrind/valgrindprocess.cpp
@@ -135,11 +135,7 @@ void ValgrindProcess::run(const QString &valgrindExecutable, const QStringList &
m_localProcess.setCommand(valgrindExecutable, m_arguments);
m_localProcess.start();
m_localProcess.waitForStarted();
- #ifdef Q_OS_WIN
- m_pid = Utils::winQPidToPid(m_localProcess.pid());
- #else
- m_pid = m_localProcess.pid();
- #endif
+ m_pid = Utils::qPidToPid(m_localProcess.pid());
} else {
m_remote.m_valgrindExe = valgrindExecutable;
m_remote.m_debuggee = debuggeeExecutable;