This file is part of MXE.
See index.html for further information.
This patch has been taken from:
https://github.com/qtproject/qtdeclarative/commit/156bb6ed1aafe96a1d5ea85e3ad8445d6e785bcb
From 156bb6ed1aafe96a1d5ea85e3ad8445d6e785bcb Mon Sep 17 00:00:00 2001
From: Konstantin Ritt
Date: Wed, 26 Mar 2014 20:29:29 +0200
Subject: [PATCH] Fix build on older MinGW
The correct declaration of the SHGetPathFromIDList symbol is
being used in mingw-w64 as of r6215, which is a v3 snapshot;
until then, SHGetPathFromIDList was declared to use LPITEMIDLIST.
Change-Id: Icc2f7814bad475c9b825f7d70c0ae4da72f471d9
Reviewed-by: Friedemann Kleint
Reviewed-by: Kai Koehne
Reviewed-by: Simon Hausmann
---
src/qml/qml/qqmlengine.cpp | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index d927a8c..d378d77 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -109,7 +109,9 @@
#include
#include
-#define CSIDL_APPDATA 0x001a // \Application Data
+#ifndef CSIDL_APPDATA
+# define CSIDL_APPDATA 0x001a // \Application Data
+#endif
#endif
Q_DECLARE_METATYPE(QQmlProperty)
@@ -2302,12 +2304,23 @@ static inline QString shellNormalizeFileName(const QString &name)
{
const QString nativeSeparatorName(QDir::toNativeSeparators(name));
const LPCTSTR nameC = reinterpret_cast(nativeSeparatorName.utf16());
+// The correct declaration of the SHGetPathFromIDList symbol is
+// being used in mingw-w64 as of r6215, which is a v3 snapshot.
+#if defined(Q_CC_MINGW) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3)
+ ITEMIDLIST file;
+ if (FAILED(SHParseDisplayName(nameC, NULL, &file, 0, NULL)))
+ return name;
+ TCHAR buffer[MAX_PATH];
+ if (!SHGetPathFromIDList(&file, buffer))
+ return name;
+#else
PIDLIST_ABSOLUTE file;
if (FAILED(SHParseDisplayName(nameC, NULL, &file, 0, NULL)))
return name;
TCHAR buffer[MAX_PATH];
if (!SHGetPathFromIDList(file, buffer))
return name;
+#endif
QString canonicalName = QString::fromWCharArray(buffer);
// Upper case drive letter
if (canonicalName.size() > 2 && canonicalName.at(1) == QLatin1Char(':'))
--
1.9.1