diff options
Diffstat (limited to 'SwifTools')
| -rw-r--r-- | SwifTools/Dock/Dock.h | 6 | ||||
| -rw-r--r-- | SwifTools/Dock/MacOSXDock.h | 4 | ||||
| -rw-r--r-- | SwifTools/Dock/MacOSXDock.mm | 4 | ||||
| -rw-r--r-- | SwifTools/Dock/NullDock.h | 6 | ||||
| -rw-r--r-- | SwifTools/Dock/WindowsDock.h | 4 | ||||
| -rw-r--r-- | SwifTools/Idle/MacOSXIdleQuerier.cpp | 11 | ||||
| -rw-r--r-- | SwifTools/SpellParser.cpp | 11 |
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 @@ | |||
| 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 | namespace Swift { | 11 | namespace 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 { | |||
| 18 | MacOSXDock::MacOSXDock(CocoaApplication*) { | 18 | MacOSXDock::MacOSXDock(CocoaApplication*) { |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | void MacOSXDock::setNumberOfPendingMessages(int i) { | 21 | void 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 | ||
| 11 | namespace Swift { | 13 | namespace 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; |
Swift