aboutsummaryrefslogtreecommitdiff
path: root/room.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'room.cpp')
-rw-r--r--room.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/room.cpp b/room.cpp
index ae3360dc..bbad694d 100644
--- a/room.cpp
+++ b/room.cpp
@@ -52,9 +52,19 @@
using namespace QMatrixClient;
using namespace std::placeholders;
+#if !(defined __GLIBCXX__ && __GLIBCXX__ <= 20150123)
+using std::llround;
+#endif
enum EventsPlacement : int { Older = -1, Newer = 1 };
+// A workaround for MSVC 2015 that fails with "error C2440: 'return':
+// cannot convert from 'initializer list' to 'QMatrixClient::FileTransferInfo'"
+#if (defined(_MSC_VER) && _MSC_VER < 1910) || (defined(__GNUC__) && __GNUC__ <= 4)
+# define WORKAROUND_EXTENDED_INITIALIZER_LIST
+#endif
+
+
class Room::Private
{
public:
@@ -102,7 +112,7 @@ class Room::Private
struct FileTransferPrivateInfo
{
-#if (defined(_MSC_VER) && _MSC_VER < 1910) || (defined(__GNUC__) && __GNUC__ <= 4)
+#ifdef WORKAROUND_EXTENDED_INITIALIZER_LIST
FileTransferPrivateInfo() = default;
FileTransferPrivateInfo(BaseJob* j, QString fileName)
: job(j), localFileInfo(fileName)
@@ -647,13 +657,11 @@ FileTransferInfo Room::fileTransferInfo(const QString& id) const
if (total > INT_MAX)
{
// JavaScript doesn't deal with 64-bit integers; scale down if necessary
- progress = std::llround(double(progress) / total * INT_MAX);
+ progress = llround(double(progress) / total * INT_MAX);
total = INT_MAX;
}
-#if (defined(_MSC_VER) && _MSC_VER < 1910) || (defined(__GNUC__) && __GNUC__ <= 4)
- // A workaround for MSVC 2015 that fails with "error C2440: 'return':
- // cannot convert from 'initializer list' to 'QMatrixClient::FileTransferInfo'"
+#ifdef WORKAROUND_EXTENDED_INITIALIZER_LIST
FileTransferInfo fti;
fti.status = infoIt->status;
fti.progress = int(progress);