summaryrefslogtreecommitdiffstats
path: root/src/qtdeclarative-1-fixes.patch
blob: 9ec5a736c7d55bd81cd085b7a2b4ff3737cff605 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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 <ritt.ks@gmail.com>
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 <Friedemann.Kleint@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
---
 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 <qlibrary.h>
 #include <windows.h>
 
-#define CSIDL_APPDATA		0x001a	// <username>\Application Data
+#ifndef CSIDL_APPDATA
+#  define CSIDL_APPDATA           0x001a  // <username>\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<LPCTSTR>(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