aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--events/tagevent.cpp2
-rw-r--r--jobs/syncjob.cpp2
-rw-r--r--room.cpp18
3 files changed, 15 insertions, 7 deletions
diff --git a/events/tagevent.cpp b/events/tagevent.cpp
index 886a10c6..c643ac62 100644
--- a/events/tagevent.cpp
+++ b/events/tagevent.cpp
@@ -44,7 +44,7 @@ QStringList TagEvent::tagNames() const
QHash<QString, TagRecord> TagEvent::tags() const
{
QHash<QString, TagRecord> result;
- auto allTags { tagsObject() };
+ auto allTags = tagsObject();
for (auto it = allTags.begin(); it != allTags.end(); ++ it)
result.insert(it.key(), TagRecord(it.value().toObject()));
return result;
diff --git a/jobs/syncjob.cpp b/jobs/syncjob.cpp
index fd8bfc1a..6b3f3acf 100644
--- a/jobs/syncjob.cpp
+++ b/jobs/syncjob.cpp
@@ -68,7 +68,7 @@ BaseJob::Status SyncData::parseJson(const QJsonDocument &data)
{
QElapsedTimer et; et.start();
- auto json { data.object() };
+ auto json = data.object();
nextBatch_ = json.value("next_batch").toString();
// TODO: presence
accountData.fromJson(json);
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);