summaryrefslogtreecommitdiffstats
path: root/src/qtserialport_qt4-1-fixes.patch
blob: f00628d334afc97d189b72d81fd535331218f1f8 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
This file is part of MXE.
See index.html for further information.

From 7ad6f136fb1efe7e85e65a1b90061f6963fac075 Mon Sep 17 00:00:00 2001
From: Samuel Gaist <samuel.gaist@edeltech.ch>
Date: Sat, 27 Sep 2014 15:39:57 -0700
Subject: [PATCH 1/2] Make tst_qtserialport build with Qt 4

The newly moved twoStageSynchronousLoopback fails to compile since
there's no qCompare available for int and long long with Qt 4. This
patch allows to build it again with Qt 4

Change-Id: Ib3764b125f371ae70864bd578c7ccda39d08ae22
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>

Taken from https://qt.gitorious.org/qt/qtserialport/commit/f1761c1236edce428278f7a9e8aa1091097eaa57

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
---
 tests/auto/qserialport/tst_qserialport.cpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/auto/qserialport/tst_qserialport.cpp b/tests/auto/qserialport/tst_qserialport.cpp
index 6fcb941..af767dd 100644
--- a/tests/auto/qserialport/tst_qserialport.cpp
+++ b/tests/auto/qserialport/tst_qserialport.cpp
@@ -470,12 +470,13 @@ void tst_QSerialPort::twoStageSynchronousLoopback()
     senderPort.waitForBytesWritten(waitMsecs);
     QTest::qSleep(waitMsecs);
     receiverPort.waitForReadyRead(waitMsecs);
-    QCOMPARE(newlineArray.size(), receiverPort.bytesAvailable());
+    QCOMPARE(qint64(newlineArray.size()), receiverPort.bytesAvailable());
+
     receiverPort.write(receiverPort.readAll());
     receiverPort.waitForBytesWritten(waitMsecs);
     QTest::qSleep(waitMsecs);
     senderPort.waitForReadyRead(waitMsecs);
-    QCOMPARE(newlineArray.size(), senderPort.bytesAvailable());
+    QCOMPARE(qint64(newlineArray.size()), receiverPort.bytesAvailable());
     QCOMPARE(newlineArray, senderPort.readAll());
 
     // second stage
@@ -483,12 +484,12 @@ void tst_QSerialPort::twoStageSynchronousLoopback()
     senderPort.waitForBytesWritten(waitMsecs);
     QTest::qSleep(waitMsecs);
     receiverPort.waitForReadyRead(waitMsecs);
-    QCOMPARE(newlineArray.size(), receiverPort.bytesAvailable());
+    QCOMPARE(qint64(newlineArray.size()), receiverPort.bytesAvailable());
     receiverPort.write(receiverPort.readAll());
     receiverPort.waitForBytesWritten(waitMsecs);
     QTest::qSleep(waitMsecs);
     senderPort.waitForReadyRead(waitMsecs);
-    QCOMPARE(newlineArray.size(), senderPort.bytesAvailable());
+    QCOMPARE(qint64(newlineArray.size()), receiverPort.bytesAvailable());
     QCOMPARE(newlineArray, senderPort.readAll());
 }
 
-- 
1.8.3.2


From c68b55c600c04a42bdd31e869b1a28d90868c2aa Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Sat, 27 Sep 2014 15:46:52 -0700
Subject: [PATCH 2/2] Work-around qmake bundled with Qt 4 not supporting macro
 expansion

---
 src/serialport/serialport.pro | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/serialport/serialport.pro b/src/serialport/serialport.pro
index feb6e9c..6500ca7 100644
--- a/src/serialport/serialport.pro
+++ b/src/serialport/serialport.pro
@@ -14,6 +14,10 @@ greaterThan(QT_MAJOR_VERSION, 4) {
     include($$PWD/qt4support/install-helper.pri)
     CONFIG += module create_prl
     mac:QMAKE_FRAMEWORK_BUNDLE_NAME = $$TARGET
+    load(moc)
+    # qmake bundled with Qt 4 doesn't support macro expansion.
+    # Work around it here.
+    QMAKE_MOC = $$QMAKE_MOC -DQT_DEPRECATED_SINCE=1
 }
 
 PRECOMPILED_HEADER =
-- 
1.8.3.2