summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/.gitignore1
-rw-r--r--SwifTools/Dock/Dock.h6
-rw-r--r--SwifTools/Dock/MacOSXDock.h4
-rw-r--r--SwifTools/Dock/MacOSXDock.mm4
-rw-r--r--SwifTools/Dock/NullDock.h6
-rw-r--r--SwifTools/Dock/WindowsDock.h4
-rw-r--r--SwifTools/Idle/MacOSXIdleQuerier.cpp11
-rw-r--r--SwifTools/SpellParser.cpp11
-rw-r--r--Swift/Controllers/AccountController.cpp2
-rw-r--r--Swift/Controllers/AccountController.h2
-rw-r--r--Swift/Controllers/FileTransfer/FileTransferProgressInfo.cpp8
-rw-r--r--Swift/Controllers/FileTransfer/FileTransferProgressInfo.h13
-rw-r--r--Swift/Controllers/Roster/LeastCommonSubsequence.h4
-rw-r--r--Swift/Controllers/Roster/TableRoster.cpp25
-rw-r--r--Swift/Controllers/Storages/CertificateFileStorage.cpp13
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.cpp6
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.h5
-rw-r--r--Swift/QtUI/QtWebView.cpp6
-rw-r--r--Swiften/SASL/UnitTest/WindowsServicePrincipalNameTest.cpp10
-rw-r--r--Swiften/SASL/WindowsServicePrincipalName.h4
21 files changed, 84 insertions, 62 deletions
diff --git a/.gitignore b/.gitignore
index 2fd9953..d28db8b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -84,3 +84,4 @@ compile_commands.json
84*.vcxproj.filters 84*.vcxproj.filters
85*.vcxproj.user 85*.vcxproj.user
86*.sdf 86*.sdf
87tags
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/.gitignore b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/.gitignore
index aca6fe1..ef95cc1 100644
--- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/.gitignore
+++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/.gitignore
@@ -1,4 +1,5 @@
1EchoBot? 1EchoBot?
2EchoBot0x
2*.cpp.xml 3*.cpp.xml
3*.h.xml 4*.h.xml
4EchoComponent 5EchoComponent
diff --git a/SwifTools/Dock/Dock.h b/SwifTools/Dock/Dock.h
index 6120445..362aabc 100644
--- a/SwifTools/Dock/Dock.h
+++ b/SwifTools/Dock/Dock.h
@@ -1,11 +1,13 @@
1/* 1/*
2 * Copyright (c) 2010 Isode Limited. 2 * Copyright (c) 2010-2018 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
6 6
7#pragma once 7#pragma once
8 8
9#include <cstddef>
10
9namespace Swift { 11namespace Swift {
10 12
11 13
@@ -13,6 +15,6 @@ namespace Swift {
13 public: 15 public:
14 virtual ~Dock(); 16 virtual ~Dock();
15 17
16 virtual void setNumberOfPendingMessages(int i) = 0; 18 virtual void setNumberOfPendingMessages(size_t i) = 0;
17 }; 19 };
18} 20}
diff --git a/SwifTools/Dock/MacOSXDock.h b/SwifTools/Dock/MacOSXDock.h
index 6b33506..ef85a88 100644
--- a/SwifTools/Dock/MacOSXDock.h
+++ b/SwifTools/Dock/MacOSXDock.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010 Isode Limited. 2 * Copyright (c) 2010-2018 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -16,6 +16,6 @@ namespace Swift {
16 public: 16 public:
17 MacOSXDock(CocoaApplication* application); 17 MacOSXDock(CocoaApplication* application);
18 18
19 virtual void setNumberOfPendingMessages(int i); 19 virtual void setNumberOfPendingMessages(size_t i);
20 }; 20 };
21} 21}
diff --git a/SwifTools/Dock/MacOSXDock.mm b/SwifTools/Dock/MacOSXDock.mm
index 5c7207c..3935ac0 100644
--- a/SwifTools/Dock/MacOSXDock.mm
+++ b/SwifTools/Dock/MacOSXDock.mm
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2015-2016 Isode Limited. 2 * Copyright (c) 2015-2018 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -18,7 +18,7 @@ namespace Swift {
18MacOSXDock::MacOSXDock(CocoaApplication*) { 18MacOSXDock::MacOSXDock(CocoaApplication*) {
19} 19}
20 20
21void MacOSXDock::setNumberOfPendingMessages(int i) { 21void MacOSXDock::setNumberOfPendingMessages(size_t i) {
22 std::string label(i > 0 ? boost::lexical_cast<std::string>(i) : ""); 22 std::string label(i > 0 ? boost::lexical_cast<std::string>(i) : "");
23 NSString *labelString = [[NSString alloc] initWithUTF8String: label.c_str()]; 23 NSString *labelString = [[NSString alloc] initWithUTF8String: label.c_str()];
24 [[NSApp dockTile] setBadgeLabel: labelString]; 24 [[NSApp dockTile] setBadgeLabel: labelString];
diff --git a/SwifTools/Dock/NullDock.h b/SwifTools/Dock/NullDock.h
index 9f3c554..137ba03 100644
--- a/SwifTools/Dock/NullDock.h
+++ b/SwifTools/Dock/NullDock.h
@@ -1,11 +1,13 @@
1/* 1/*
2 * Copyright (c) 2010 Isode Limited. 2 * Copyright (c) 2010-2018 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
6 6
7#pragma once 7#pragma once
8 8
9#include <cstddef>
10
9#include <SwifTools/Dock/Dock.h> 11#include <SwifTools/Dock/Dock.h>
10 12
11namespace Swift { 13namespace Swift {
@@ -13,7 +15,7 @@ namespace Swift {
13 public: 15 public:
14 NullDock() {} 16 NullDock() {}
15 17
16 virtual void setNumberOfPendingMessages(int) { 18 virtual void setNumberOfPendingMessages(size_t) {
17 } 19 }
18 }; 20 };
19} 21}
diff --git a/SwifTools/Dock/WindowsDock.h b/SwifTools/Dock/WindowsDock.h
index fc10a48..f9a9dae 100644
--- a/SwifTools/Dock/WindowsDock.h
+++ b/SwifTools/Dock/WindowsDock.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2018 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -18,7 +18,7 @@ namespace Swift {
18 public: 18 public:
19 WindowsDock(QSystemTrayIcon* tray, Notifier* notifier) : tray(tray), notifier(notifier) {} 19 WindowsDock(QSystemTrayIcon* tray, Notifier* notifier) : tray(tray), notifier(notifier) {}
20 20
21 virtual void setNumberOfPendingMessages(int i) { 21 virtual void setNumberOfPendingMessages(size_t i) {
22 if (notifier->isAvailable()) { 22 if (notifier->isAvailable()) {
23 return; 23 return;
24 } 24 }
diff --git a/SwifTools/Idle/MacOSXIdleQuerier.cpp b/SwifTools/Idle/MacOSXIdleQuerier.cpp
index 6d6780b..89fa050 100644
--- a/SwifTools/Idle/MacOSXIdleQuerier.cpp
+++ b/SwifTools/Idle/MacOSXIdleQuerier.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010 Isode Limited. 2 * Copyright (c) 2010-2018 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -10,6 +10,8 @@
10 10
11#include <cassert> 11#include <cassert>
12#include <iostream> 12#include <iostream>
13#include <limits>
14
13#include <boost/numeric/conversion/cast.hpp> 15#include <boost/numeric/conversion/cast.hpp>
14#include <CoreFoundation/CoreFoundation.h> 16#include <CoreFoundation/CoreFoundation.h>
15 17
@@ -29,7 +31,12 @@ int MacOSXIdleQuerier::getIdleTimeSeconds() {
29 assert(result); 31 assert(result);
30 (void) result; 32 (void) result;
31 CFRelease(property); 33 CFRelease(property);
32 return boost::numeric_cast<int>(idle / 1000000000); 34 try {
35 return boost::numeric_cast<int>(idle / 1000000000);
36 }
37 catch (const boost::numeric::bad_numeric_cast&) {
38 return std::numeric_limits<int>::max();
39 }
33} 40}
34 41
35} 42}
diff --git a/SwifTools/SpellParser.cpp b/SwifTools/SpellParser.cpp
index 5bafa6e..e449b45 100644
--- a/SwifTools/SpellParser.cpp
+++ b/SwifTools/SpellParser.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2016 Isode Limited. 8 * Copyright (c) 2016-2018 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -15,7 +15,6 @@
15#include <string> 15#include <string>
16 16
17#include <boost/bind.hpp> 17#include <boost/bind.hpp>
18#include <boost/numeric/conversion/cast.hpp>
19#include <boost/ref.hpp> 18#include <boost/ref.hpp>
20#include <boost/spirit/include/lex_lexertl.hpp> 19#include <boost/spirit/include/lex_lexertl.hpp>
21 20
@@ -47,14 +46,14 @@ struct counter
47 { 46 {
48 switch (t.id()) { 47 switch (t.id()) {
49 case ID_WWW: 48 case ID_WWW:
50 position += boost::numeric_cast<size_t>(t.value().size()); 49 position += static_cast<std::size_t>(t.value().size());
51 break; 50 break;
52 case ID_HTTP: 51 case ID_HTTP:
53 position += boost::numeric_cast<size_t>(t.value().size()); 52 position += static_cast<std::size_t>(t.value().size());
54 break; 53 break;
55 case ID_WORD: // matched a word 54 case ID_WORD: // matched a word
56 wordPositions.push_back(boost::tuples::make_tuple(position, position + boost::numeric_cast<size_t>(t.value().size()))); 55 wordPositions.push_back(boost::tuples::make_tuple(position, position + static_cast<std::size_t>(t.value().size())));
57 position += boost::numeric_cast<size_t>(t.value().size()); 56 position += static_cast<std::size_t>(t.value().size());
58 break; 57 break;
59 case ID_CHAR: // match a simple char 58 case ID_CHAR: // match a simple char
60 ++position; 59 ++position;
diff --git a/Swift/Controllers/AccountController.cpp b/Swift/Controllers/AccountController.cpp
index ec914a6..27655c0 100644
--- a/Swift/Controllers/AccountController.cpp
+++ b/Swift/Controllers/AccountController.cpp
@@ -403,7 +403,7 @@ void AccountController::handleConnected() {
403 adHocManager_->setOnline(true); 403 adHocManager_->setOnline(true);
404} 404}
405 405
406void AccountController::handleEventQueueLengthChange(int count) { 406void AccountController::handleEventQueueLengthChange(size_t count) {
407 dock_->setNumberOfPendingMessages(count); 407 dock_->setNumberOfPendingMessages(count);
408} 408}
409 409
diff --git a/Swift/Controllers/AccountController.h b/Swift/Controllers/AccountController.h
index 774aa8b..4a31645 100644
--- a/Swift/Controllers/AccountController.h
+++ b/Swift/Controllers/AccountController.h
@@ -111,7 +111,7 @@ namespace Swift {
111 void handleChangeStatusRequest(StatusShow::Type show, const std::string &statusText); 111 void handleChangeStatusRequest(StatusShow::Type show, const std::string &statusText);
112 void handleDisconnected(const boost::optional<ClientError>& error); 112 void handleDisconnected(const boost::optional<ClientError>& error);
113 void handleServerDiscoInfoResponse(std::shared_ptr<DiscoInfo>, ErrorPayload::ref); 113 void handleServerDiscoInfoResponse(std::shared_ptr<DiscoInfo>, ErrorPayload::ref);
114 void handleEventQueueLengthChange(int count); 114 void handleEventQueueLengthChange(size_t count);
115 void handleVCardReceived(const JID& j, VCard::ref vCard); 115 void handleVCardReceived(const JID& j, VCard::ref vCard);
116 void handleSettingChanged(const std::string& settingPath); 116 void handleSettingChanged(const std::string& settingPath);
117 void handlePurgeSavedLoginRequest(const std::string& username); 117 void handlePurgeSavedLoginRequest(const std::string& username);
diff --git a/Swift/Controllers/FileTransfer/FileTransferProgressInfo.cpp b/Swift/Controllers/FileTransfer/FileTransferProgressInfo.cpp
index b073017..eddace9 100644
--- a/Swift/Controllers/FileTransfer/FileTransferProgressInfo.cpp
+++ b/Swift/Controllers/FileTransfer/FileTransferProgressInfo.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2016 Isode Limited. 8 * Copyright (c) 2016-2018 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -18,13 +18,13 @@
18 18
19namespace Swift { 19namespace Swift {
20 20
21FileTransferProgressInfo::FileTransferProgressInfo(boost::uintmax_t completeBytes) : completeBytes(completeBytes), completedBytes(0), percentage(0) { 21FileTransferProgressInfo::FileTransferProgressInfo(size_t completeBytes) : completeBytes(completeBytes), completedBytes(0), percentage(0) {
22 onProgressPercentage(0); 22 onProgressPercentage(0);
23} 23}
24 24
25void FileTransferProgressInfo::setBytesProcessed(int processedBytes) { 25void FileTransferProgressInfo::setBytesProcessed(size_t processedBytes) {
26 int oldPercentage = int(double(completedBytes) / double(completeBytes) * 100.0); 26 int oldPercentage = int(double(completedBytes) / double(completeBytes) * 100.0);
27 completedBytes += boost::numeric_cast<boost::uintmax_t>(processedBytes); 27 completedBytes += processedBytes;
28 int newPercentage = int(double(completedBytes) / double(completeBytes) * 100.0); 28 int newPercentage = int(double(completedBytes) / double(completeBytes) * 100.0);
29 if (oldPercentage != newPercentage) { 29 if (oldPercentage != newPercentage) {
30 onProgressPercentage(newPercentage); 30 onProgressPercentage(newPercentage);
diff --git a/Swift/Controllers/FileTransfer/FileTransferProgressInfo.h b/Swift/Controllers/FileTransfer/FileTransferProgressInfo.h
index 5fb955c..869ceba 100644
--- a/Swift/Controllers/FileTransfer/FileTransferProgressInfo.h
+++ b/Swift/Controllers/FileTransfer/FileTransferProgressInfo.h
@@ -5,31 +5,32 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2016 Isode Limited. 8 * Copyright (c) 2016-2018 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
12 12
13#pragma once 13#pragma once
14 14
15#include <boost/cstdint.hpp> 15#include <cstddef>
16
16#include <boost/signals2.hpp> 17#include <boost/signals2.hpp>
17 18
18namespace Swift { 19namespace Swift {
19 20
20class FileTransferProgressInfo { 21class FileTransferProgressInfo {
21public: 22public:
22 FileTransferProgressInfo(boost::uintmax_t completeBytes); 23 FileTransferProgressInfo(size_t completeBytes);
23 24
24public: 25public:
25 void setBytesProcessed(int processedBytes); 26 void setBytesProcessed(size_t processedBytes);
26 27
27 int getPercentage() const; 28 int getPercentage() const;
28 boost::signals2::signal<void (int)> onProgressPercentage; 29 boost::signals2::signal<void (int)> onProgressPercentage;
29 30
30private: 31private:
31 boost::uintmax_t completeBytes; 32 size_t completeBytes;
32 boost::uintmax_t completedBytes; 33 size_t completedBytes;
33 int percentage; 34 int percentage;
34}; 35};
35 36
diff --git a/Swift/Controllers/Roster/LeastCommonSubsequence.h b/Swift/Controllers/Roster/LeastCommonSubsequence.h
index 8daa20c..7988ee7 100644
--- a/Swift/Controllers/Roster/LeastCommonSubsequence.h
+++ b/Swift/Controllers/Roster/LeastCommonSubsequence.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011-2016 Isode Limited. 2 * Copyright (c) 2011-2018 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -32,7 +32,7 @@ namespace Swift {
32 Predicate predicate; 32 Predicate predicate;
33 for (size_t i = 1; i < width; ++i) { 33 for (size_t i = 1; i < width; ++i) {
34 for (size_t j = 1; j < height; ++j) { 34 for (size_t j = 1; j < height; ++j) {
35 result[i + j*width] = predicate(*(xBegin + boost::numeric_cast<long long>(i)-1), *(yBegin + boost::numeric_cast<long long >(j)-1)) ? result[(i-1) + (j-1)*width] + 1 : std::max(result[i + (j-1)*width], result[i-1 + (j*width)]); 35 result[i + j*width] = predicate(*(xBegin + static_cast<long long>(i)-1), *(yBegin + static_cast<long long>(j)-1)) ? result[(i-1) + (j-1)*width] + 1 : std::max(result[i + (j-1)*width], result[i-1 + (j*width)]);
36 } 36 }
37 } 37 }
38 } 38 }
diff --git a/Swift/Controllers/Roster/TableRoster.cpp b/Swift/Controllers/Roster/TableRoster.cpp
index 713f390..01bf4a6 100644
--- a/Swift/Controllers/Roster/TableRoster.cpp
+++ b/Swift/Controllers/Roster/TableRoster.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011-2016 Isode Limited. 2 * Copyright (c) 2011-2018 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -132,15 +132,20 @@ void TableRoster::handleUpdateTimerTick() {
132 std::vector<size_t> itemRemoves; 132 std::vector<size_t> itemRemoves;
133 std::vector<size_t> itemInserts; 133 std::vector<size_t> itemInserts;
134 computeIndexDiff<Item, ItemEquals, ItemNeedsUpdate >(sections[sectionUpdates[i]].items, newSections[sectionPostUpdates[i]].items, itemUpdates, itemPostUpdates, itemRemoves, itemInserts); 134 computeIndexDiff<Item, ItemEquals, ItemNeedsUpdate >(sections[sectionUpdates[i]].items, newSections[sectionPostUpdates[i]].items, itemUpdates, itemPostUpdates, itemRemoves, itemInserts);
135 size_t end = update.insertedRows.size(); 135 try {
136 update.insertedRows.resize(update.insertedRows.size() + itemInserts.size()); 136 size_t end = update.insertedRows.size();
137 std::transform(itemInserts.begin(), itemInserts.end(), update.insertedRows.begin() + boost::numeric_cast<long long>(end), CreateIndexForSection(sectionPostUpdates[i])); 137 update.insertedRows.resize(update.insertedRows.size() + itemInserts.size());
138 end = update.deletedRows.size(); 138 std::transform(itemInserts.begin(), itemInserts.end(), update.insertedRows.begin() + boost::numeric_cast<long long>(end), CreateIndexForSection(sectionPostUpdates[i]));
139 update.deletedRows.resize(update.deletedRows.size() + itemRemoves.size()); 139 end = update.deletedRows.size();
140 std::transform(itemRemoves.begin(), itemRemoves.end(), update.deletedRows.begin() + boost::numeric_cast<long long>(end), CreateIndexForSection(sectionUpdates[i])); 140 update.deletedRows.resize(update.deletedRows.size() + itemRemoves.size());
141 end = update.updatedRows.size(); 141 std::transform(itemRemoves.begin(), itemRemoves.end(), update.deletedRows.begin() + boost::numeric_cast<long long>(end), CreateIndexForSection(sectionUpdates[i]));
142 update.updatedRows.resize(update.updatedRows.size() + itemUpdates.size()); 142 end = update.updatedRows.size();
143 std::transform(itemUpdates.begin(), itemUpdates.end(), update.updatedRows.begin() + boost::numeric_cast<long long>(end), CreateIndexForSection(sectionPostUpdates[i])); 143 update.updatedRows.resize(update.updatedRows.size() + itemUpdates.size());
144 std::transform(itemUpdates.begin(), itemUpdates.end(), update.updatedRows.begin() + boost::numeric_cast<long long>(end), CreateIndexForSection(sectionPostUpdates[i]));
145 }
146 catch (const boost::numeric::bad_numeric_cast&) {
147 // If any container claims it has more than long long max items, we have bigger issues, so letting this pass
148 }
144 } 149 }
145 150
146 // Switch the old model with the new 151 // Switch the old model with the new
diff --git a/Swift/Controllers/Storages/CertificateFileStorage.cpp b/Swift/Controllers/Storages/CertificateFileStorage.cpp
index 8ba7d12..2e1343f 100644
--- a/Swift/Controllers/Storages/CertificateFileStorage.cpp
+++ b/Swift/Controllers/Storages/CertificateFileStorage.cpp
@@ -50,10 +50,15 @@ void CertificateFileStorage::addCertificate(Certificate::ref certificate) {
50 std::cerr << "ERROR: " << e.what() << std::endl; 50 std::cerr << "ERROR: " << e.what() << std::endl;
51 } 51 }
52 } 52 }
53 boost::filesystem::ofstream file(certificatePath, boost::filesystem::ofstream::binary|boost::filesystem::ofstream::out); 53 try {
54 ByteArray data = certificate->toDER(); 54 boost::filesystem::ofstream file(certificatePath, boost::filesystem::ofstream::binary|boost::filesystem::ofstream::out);
55 file.write(reinterpret_cast<const char*>(vecptr(data)), boost::numeric_cast<std::streamsize>(data.size())); 55 ByteArray data = certificate->toDER();
56 file.close(); 56 file.write(reinterpret_cast<const char*>(vecptr(data)), boost::numeric_cast<std::streamsize>(data.size()));
57 file.close();
58 }
59 catch (...) {
60 SWIFT_LOG(warning) << "Failed to store certificate to " << certificatePath << std::endl;
61 }
57} 62}
58 63
59boost::filesystem::path CertificateFileStorage::getCertificatePath(Certificate::ref certificate) const { 64boost::filesystem::path CertificateFileStorage::getCertificatePath(Certificate::ref certificate) const {
diff --git a/Swift/Controllers/XMPPEvents/EventController.cpp b/Swift/Controllers/XMPPEvents/EventController.cpp
index f8fb192..0e9429d 100644
--- a/Swift/Controllers/XMPPEvents/EventController.cpp
+++ b/Swift/Controllers/XMPPEvents/EventController.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2018 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -51,7 +51,7 @@ void EventController::handleIncomingEvent(std::shared_ptr<StanzaEvent> sourceEve
51 if ((messageEvent && messageEvent->isReadable()) || subscriptionEvent || errorEvent || mucInviteEvent || incomingFileTransferEvent) { 51 if ((messageEvent && messageEvent->isReadable()) || subscriptionEvent || errorEvent || mucInviteEvent || incomingFileTransferEvent) {
52 events_.push_back(sourceEvent); 52 events_.push_back(sourceEvent);
53 sourceEvent->onConclusion.connect(boost::bind(&EventController::handleEventConcluded, this, sourceEvent)); 53 sourceEvent->onConclusion.connect(boost::bind(&EventController::handleEventConcluded, this, sourceEvent));
54 onEventQueueLengthChange(boost::numeric_cast<int>(events_.size())); 54 onEventQueueLengthChange(events_.size());
55 onEventQueueEventAdded(sourceEvent); 55 onEventQueueEventAdded(sourceEvent);
56 if (sourceEvent->getConcluded()) { 56 if (sourceEvent->getConcluded()) {
57 handleEventConcluded(sourceEvent); 57 handleEventConcluded(sourceEvent);
@@ -62,7 +62,7 @@ void EventController::handleIncomingEvent(std::shared_ptr<StanzaEvent> sourceEve
62void EventController::handleEventConcluded(std::shared_ptr<StanzaEvent> event) { 62void EventController::handleEventConcluded(std::shared_ptr<StanzaEvent> event) {
63 event->onConclusion.disconnect(boost::bind(&EventController::handleEventConcluded, this, event)); 63 event->onConclusion.disconnect(boost::bind(&EventController::handleEventConcluded, this, event));
64 events_.erase(std::remove(events_.begin(), events_.end(), event), events_.end()); 64 events_.erase(std::remove(events_.begin(), events_.end(), event), events_.end());
65 onEventQueueLengthChange(boost::numeric_cast<int>(events_.size())); 65 onEventQueueLengthChange(events_.size());
66} 66}
67 67
68void EventController::disconnectAll() { 68void EventController::disconnectAll() {
diff --git a/Swift/Controllers/XMPPEvents/EventController.h b/Swift/Controllers/XMPPEvents/EventController.h
index 8a095d9..5b746e4 100644
--- a/Swift/Controllers/XMPPEvents/EventController.h
+++ b/Swift/Controllers/XMPPEvents/EventController.h
@@ -1,11 +1,12 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2018 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
6 6
7#pragma once 7#pragma once
8 8
9#include <cstddef>
9#include <memory> 10#include <memory>
10#include <vector> 11#include <vector>
11 12
@@ -22,7 +23,7 @@ namespace Swift {
22 ~EventController(); 23 ~EventController();
23 24
24 void handleIncomingEvent(std::shared_ptr<StanzaEvent> sourceEvent); 25 void handleIncomingEvent(std::shared_ptr<StanzaEvent> sourceEvent);
25 boost::signals2::signal<void (int)> onEventQueueLengthChange; 26 boost::signals2::signal<void (size_t)> onEventQueueLengthChange;
26 boost::signals2::signal<void (std::shared_ptr<StanzaEvent>)> onEventQueueEventAdded; 27 boost::signals2::signal<void (std::shared_ptr<StanzaEvent>)> onEventQueueEventAdded;
27 const EventList& getEvents() const {return events_;} 28 const EventList& getEvents() const {return events_;}
28 void disconnectAll(); 29 void disconnectAll();
diff --git a/Swift/QtUI/QtWebView.cpp b/Swift/QtUI/QtWebView.cpp
index 967be1a..24636ed 100644
--- a/Swift/QtUI/QtWebView.cpp
+++ b/Swift/QtUI/QtWebView.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2017 Isode Limited. 2 * Copyright (c) 2010-2018 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -7,8 +7,6 @@
7 7
8#include <Swift/QtUI/QtWebView.h> 8#include <Swift/QtUI/QtWebView.h>
9 9
10#include <boost/numeric/conversion/cast.hpp>
11
12#include <QFocusEvent> 10#include <QFocusEvent>
13#include <QKeyEvent> 11#include <QKeyEvent>
14#include <QKeySequence> 12#include <QKeySequence>
@@ -48,7 +46,7 @@ void QtWebView::keyPressEvent(QKeyEvent* event) {
48 modifiers, 46 modifiers,
49 event->text(), 47 event->text(),
50 event->isAutoRepeat(), 48 event->isAutoRepeat(),
51 boost::numeric_cast<unsigned short>(event->count())); 49 event->count());
52 QWebView::keyPressEvent(translatedEvent); 50 QWebView::keyPressEvent(translatedEvent);
53 delete translatedEvent; 51 delete translatedEvent;
54} 52}
diff --git a/Swiften/SASL/UnitTest/WindowsServicePrincipalNameTest.cpp b/Swiften/SASL/UnitTest/WindowsServicePrincipalNameTest.cpp
index fa07052..ef3a9b3 100644
--- a/Swiften/SASL/UnitTest/WindowsServicePrincipalNameTest.cpp
+++ b/Swiften/SASL/UnitTest/WindowsServicePrincipalNameTest.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2015 Isode Limited. 2 * Copyright (c) 2015-2018 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -97,16 +97,16 @@ class WindowsServicePrincipalNameTest : public CppUnit::TestFixture {
97 WindowsServicePrincipalName spn("adlon.isode.net"); 97 WindowsServicePrincipalName spn("adlon.isode.net");
98 98
99 spn.setInstanceName("mlink.adlon.isode.net"); 99 spn.setInstanceName("mlink.adlon.isode.net");
100 spn.setInstancePort(6222); 100 spn.setInstancePort(55222);
101 CPPUNIT_ASSERT_EQUAL(spn.toString(), std::string("xmpp/mlink.adlon.isode.net:6222/adlon.isode.net")); 101 CPPUNIT_ASSERT_EQUAL(spn.toString(), std::string("xmpp/mlink.adlon.isode.net:55222/adlon.isode.net"));
102 102
103 spn.setInstancePort(0); 103 spn.setInstancePort(0);
104 CPPUNIT_ASSERT_EQUAL(spn.toString(), std::string("xmpp/mlink.adlon.isode.net/adlon.isode.net")); 104 CPPUNIT_ASSERT_EQUAL(spn.toString(), std::string("xmpp/mlink.adlon.isode.net/adlon.isode.net"));
105 105
106 WindowsServicePrincipalName spn2("mlink.adlon.isode.net"); 106 WindowsServicePrincipalName spn2("mlink.adlon.isode.net");
107 107
108 spn2.setInstancePort(6222); 108 spn2.setInstancePort(55222);
109 CPPUNIT_ASSERT_EQUAL(spn2.toString(), std::string("xmpp/mlink.adlon.isode.net:6222")); 109 CPPUNIT_ASSERT_EQUAL(spn2.toString(), std::string("xmpp/mlink.adlon.isode.net:55222"));
110 110
111 spn2.setInstancePort(0); 111 spn2.setInstancePort(0);
112 CPPUNIT_ASSERT_EQUAL(spn2.toString(), std::string("xmpp/mlink.adlon.isode.net")); 112 CPPUNIT_ASSERT_EQUAL(spn2.toString(), std::string("xmpp/mlink.adlon.isode.net"));
diff --git a/Swiften/SASL/WindowsServicePrincipalName.h b/Swiften/SASL/WindowsServicePrincipalName.h
index 4c9f557..2e4e5c4 100644
--- a/Swiften/SASL/WindowsServicePrincipalName.h
+++ b/Swiften/SASL/WindowsServicePrincipalName.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2015 Isode Limited. 2 * Copyright (c) 2015-2018 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -49,7 +49,7 @@ namespace Swift {
49 * it remain 0 to indicate that the default port is 49 * it remain 0 to indicate that the default port is
50 * used. 50 * used.
51 */ 51 */
52 void setInstancePort(short int instancePort) { instancePort_ = instancePort; } 52 void setInstancePort(unsigned short instancePort) { instancePort_ = instancePort; }
53 53
54 /* 54 /*
55 * This follows the rules of SPN creation on Windows and 55 * This follows the rules of SPN creation on Windows and