summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2021-01-20 10:48:19 +0100
committerOliver Wolff <oliver.wolff@qt.io>2021-01-25 09:48:07 +0100
commit6ae23a74723da9923d3c62725189fc5f5f0b0924 (patch)
tree37cf407128bd542975dba286ff0f88b43feb3b7d
parent257d073d030a322ecae6f8e50c29c8c3841ab03d (diff)
Fix mingw warnings
GetProcAddr returns a FARPROC (function pointer with no arguments) for mingw. In reality GetProcAddr does not result in a FARPROC though so that we have to cast it to void* before casting it to the "real" function pointer to tell mingw that we know what we are doing. Additionally the return value of lastIndexOf was ignored in one place. Just use it instead of relying on the match having been made. Change-Id: I007f4732ff563aa01d2140ed8f92d1fc78f1a71b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--src/activeqt/control/qaxserverbase.cpp3
-rw-r--r--src/tools/idc/main.cpp12
2 files changed, 9 insertions, 6 deletions
diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp
index efdefd3..13ab5ee 100644
--- a/src/activeqt/control/qaxserverbase.cpp
+++ b/src/activeqt/control/qaxserverbase.cpp
@@ -2399,8 +2399,7 @@ HRESULT WINAPI QAxServerBase::Invoke(DISPID dispidMember, REFIID riid,
if (index == -1) {
QRegularExpression regexp(QLatin1String("_([0-9])\\("));
QRegularExpressionMatch rmatch;
- QString::fromLatin1(name.constData()).lastIndexOf(regexp, -1, &rmatch);
- if (rmatch.hasMatch()) {
+ if (QString::fromLatin1(name.constData()).lastIndexOf(regexp, -1, &rmatch) != -1) {
name.chop(rmatch.capturedLength(0));
name += '(';
int overload = rmatch.capturedView(1).toInt() + 1;
diff --git a/src/tools/idc/main.cpp b/src/tools/idc/main.cpp
index 2a50e31..3a84cd7 100644
--- a/src/tools/idc/main.cpp
+++ b/src/tools/idc/main.cpp
@@ -194,7 +194,8 @@ static bool dllInstall(const QString &input, bool doRegister)
}
typedef HRESULT(__stdcall* DllInstallProc)(BOOL bInstall, PCWSTR pszCmdLine);
- DllInstallProc DllInstall = reinterpret_cast<DllInstallProc>(GetProcAddress(hdll, "DllInstall"));
+ DllInstallProc DllInstall = reinterpret_cast<DllInstallProc>
+ (reinterpret_cast<void *>(GetProcAddress(hdll, "DllInstall")));
if (!DllInstall) {
fprintf(stderr, "Library file %s doesn't appear to be a COM library supporting DllInstall\n", qPrintable(input));
return false;
@@ -219,7 +220,8 @@ static bool registerServer(const QString &input, bool perUser)
}
typedef HRESULT(__stdcall* RegServerProc)();
- RegServerProc DllRegisterServer = reinterpret_cast<RegServerProc>(GetProcAddress(hdll, "DllRegisterServer"));
+ RegServerProc DllRegisterServer = reinterpret_cast<RegServerProc>
+ (reinterpret_cast<void *>(GetProcAddress(hdll, "DllRegisterServer")));
if (!DllRegisterServer) {
fprintf(stderr, "Library file %s doesn't appear to be a COM library\n", qPrintable(input));
return false;
@@ -246,7 +248,8 @@ static bool unregisterServer(const QString &input, bool perUser)
}
typedef HRESULT(__stdcall* RegServerProc)();
- RegServerProc DllUnregisterServer = reinterpret_cast<RegServerProc>(GetProcAddress(hdll, "DllUnregisterServer"));
+ RegServerProc DllUnregisterServer = reinterpret_cast<RegServerProc>
+ (reinterpret_cast<void *>(GetProcAddress(hdll, "DllUnregisterServer")));
if (!DllUnregisterServer) {
fprintf(stderr, "Library file %s doesn't appear to be a COM library\n", qPrintable(input));
return false;
@@ -273,7 +276,8 @@ static HRESULT dumpIdl(const QString &input, const QString &idlfile, const QStri
return 3;
}
typedef HRESULT(__stdcall* DumpIDLProc)(const QString&, const QString&);
- DumpIDLProc DumpIDL = reinterpret_cast<DumpIDLProc>(GetProcAddress(hdll, "DumpIDL"));
+ DumpIDLProc DumpIDL = reinterpret_cast<DumpIDLProc>
+ (reinterpret_cast<void *>(GetProcAddress(hdll, "DumpIDL")));
if (!DumpIDL) {
fprintf(stderr, "Couldn't resolve 'DumpIDL' symbol in %s\n", qPrintable(input));
return 3;