summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'SwifTools')
-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
7 files changed, 28 insertions, 18 deletions
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 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
+#include <cstddef>
+
namespace Swift {
@@ -13,6 +15,6 @@ namespace Swift {
public:
virtual ~Dock();
- virtual void setNumberOfPendingMessages(int i) = 0;
+ virtual void setNumberOfPendingMessages(size_t i) = 0;
};
}
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 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -16,6 +16,6 @@ namespace Swift {
public:
MacOSXDock(CocoaApplication* application);
- virtual void setNumberOfPendingMessages(int i);
+ virtual void setNumberOfPendingMessages(size_t i);
};
}
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 @@
/*
- * Copyright (c) 2015-2016 Isode Limited.
+ * Copyright (c) 2015-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -18,7 +18,7 @@ namespace Swift {
MacOSXDock::MacOSXDock(CocoaApplication*) {
}
-void MacOSXDock::setNumberOfPendingMessages(int i) {
+void MacOSXDock::setNumberOfPendingMessages(size_t i) {
std::string label(i > 0 ? boost::lexical_cast<std::string>(i) : "");
NSString *labelString = [[NSString alloc] initWithUTF8String: label.c_str()];
[[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 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
+#include <cstddef>
+
#include <SwifTools/Dock/Dock.h>
namespace Swift {
@@ -13,7 +15,7 @@ namespace Swift {
public:
NullDock() {}
- virtual void setNumberOfPendingMessages(int) {
+ virtual void setNumberOfPendingMessages(size_t) {
}
};
}
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 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -18,7 +18,7 @@ namespace Swift {
public:
WindowsDock(QSystemTrayIcon* tray, Notifier* notifier) : tray(tray), notifier(notifier) {}
- virtual void setNumberOfPendingMessages(int i) {
+ virtual void setNumberOfPendingMessages(size_t i) {
if (notifier->isAvailable()) {
return;
}
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 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -10,6 +10,8 @@
#include <cassert>
#include <iostream>
+#include <limits>
+
#include <boost/numeric/conversion/cast.hpp>
#include <CoreFoundation/CoreFoundation.h>
@@ -29,7 +31,12 @@ int MacOSXIdleQuerier::getIdleTimeSeconds() {
assert(result);
(void) result;
CFRelease(property);
- return boost::numeric_cast<int>(idle / 1000000000);
+ try {
+ return boost::numeric_cast<int>(idle / 1000000000);
+ }
+ catch (const boost::numeric::bad_numeric_cast&) {
+ return std::numeric_limits<int>::max();
+ }
}
}
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 @@
*/
/*
- * Copyright (c) 2016 Isode Limited.
+ * Copyright (c) 2016-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -15,7 +15,6 @@
#include <string>
#include <boost/bind.hpp>
-#include <boost/numeric/conversion/cast.hpp>
#include <boost/ref.hpp>
#include <boost/spirit/include/lex_lexertl.hpp>
@@ -47,14 +46,14 @@ struct counter
{
switch (t.id()) {
case ID_WWW:
- position += boost::numeric_cast<size_t>(t.value().size());
+ position += static_cast<std::size_t>(t.value().size());
break;
case ID_HTTP:
- position += boost::numeric_cast<size_t>(t.value().size());
+ position += static_cast<std::size_t>(t.value().size());
break;
case ID_WORD: // matched a word
- wordPositions.push_back(boost::tuples::make_tuple(position, position + boost::numeric_cast<size_t>(t.value().size())));
- position += boost::numeric_cast<size_t>(t.value().size());
+ wordPositions.push_back(boost::tuples::make_tuple(position, position + static_cast<std::size_t>(t.value().size())));
+ position += static_cast<std::size_t>(t.value().size());
break;
case ID_CHAR: // match a simple char
++position;