diff options
author | Edwin Mons <edwin.mons@isode.com> | 2018-10-30 07:24:24 (GMT) |
---|---|---|
committer | Edwin Mons <edwin.mons@isode.com> | 2018-11-14 10:35:55 (GMT) |
commit | 30639ed8dbb419890eab5a0b46d3a78896c7f22d (patch) | |
tree | 62b7a3b19bc3d84bfc0a0d4ac71a79beb0946e8c /Swift/Controllers/FileTransfer | |
parent | 5758cc48f5f340132d19e79f647dd5d3ad8c54fc (diff) | |
download | swift-30639ed8dbb419890eab5a0b46d3a78896c7f22d.zip swift-30639ed8dbb419890eab5a0b46d3a78896c7f22d.tar.bz2 |
Fix various uses of numeric_cast in UI bits
Apart from QtUI bits, this addresses use of uncaught numeric cast
exceptions in message count handling, the spell parser and the MacOS
idle querier.
The WindowsServicePrincipalName logic previously had an issue where
using ports from 32768 onwards would result in a bad_numeric_cast
exception to be thrown. This has been addressed at the same time as the
uncaught exceptions, and all ports should work now.
The tags file has been extended to ignore more files.
Change-Id: I73ced35f06517bee5c58f990d20fa437b40ac84e
Diffstat (limited to 'Swift/Controllers/FileTransfer')
-rw-r--r-- | Swift/Controllers/FileTransfer/FileTransferProgressInfo.cpp | 8 | ||||
-rw-r--r-- | Swift/Controllers/FileTransfer/FileTransferProgressInfo.h | 13 |
2 files changed, 11 insertions, 10 deletions
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 @@ */ /* - * Copyright (c) 2016 Isode Limited. + * Copyright (c) 2016-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -18,13 +18,13 @@ namespace Swift { -FileTransferProgressInfo::FileTransferProgressInfo(boost::uintmax_t completeBytes) : completeBytes(completeBytes), completedBytes(0), percentage(0) { +FileTransferProgressInfo::FileTransferProgressInfo(size_t completeBytes) : completeBytes(completeBytes), completedBytes(0), percentage(0) { onProgressPercentage(0); } -void FileTransferProgressInfo::setBytesProcessed(int processedBytes) { +void FileTransferProgressInfo::setBytesProcessed(size_t processedBytes) { int oldPercentage = int(double(completedBytes) / double(completeBytes) * 100.0); - completedBytes += boost::numeric_cast<boost::uintmax_t>(processedBytes); + completedBytes += processedBytes; int newPercentage = int(double(completedBytes) / double(completeBytes) * 100.0); if (oldPercentage != newPercentage) { 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 @@ */ /* - * Copyright (c) 2016 Isode Limited. + * Copyright (c) 2016-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/cstdint.hpp> +#include <cstddef> + #include <boost/signals2.hpp> namespace Swift { class FileTransferProgressInfo { public: - FileTransferProgressInfo(boost::uintmax_t completeBytes); + FileTransferProgressInfo(size_t completeBytes); public: - void setBytesProcessed(int processedBytes); + void setBytesProcessed(size_t processedBytes); int getPercentage() const; boost::signals2::signal<void (int)> onProgressPercentage; private: - boost::uintmax_t completeBytes; - boost::uintmax_t completedBytes; + size_t completeBytes; + size_t completedBytes; int percentage; }; |