aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-12-28 12:47:02 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-01-05 21:01:29 +0900
commit3ecf762f497a4d4b6ea7583689c0b9b284300201 (patch)
tree3a07e600cdd0a1aec845cb1f6d997ec18c700691
parent143fffcf3962184befbbe37bebc5544d25bc7c39 (diff)
downloadlibquotient-3ecf762f497a4d4b6ea7583689c0b9b284300201.tar.gz
libquotient-3ecf762f497a4d4b6ea7583689c0b9b284300201.zip
EventContent: use qint64 for the payload size
-rw-r--r--lib/events/eventcontent.cpp8
-rw-r--r--lib/events/eventcontent.h6
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/events/eventcontent.cpp b/lib/events/eventcontent.cpp
index a6b1c763..bac2b72f 100644
--- a/lib/events/eventcontent.cpp
+++ b/lib/events/eventcontent.cpp
@@ -17,6 +17,8 @@
*/
#include "eventcontent.h"
+
+#include "converters.h"
#include "util.h"
#include <QtCore/QMimeDatabase>
@@ -30,7 +32,7 @@ QJsonObject Base::toJson() const
return o;
}
-FileInfo::FileInfo(const QUrl& u, int payloadSize, const QMimeType& mimeType,
+FileInfo::FileInfo(const QUrl& u, qint64 payloadSize, const QMimeType& mimeType,
const QString& originalFilename)
: mimeType(mimeType), url(u), payloadSize(payloadSize)
, originalName(originalFilename)
@@ -41,7 +43,7 @@ FileInfo::FileInfo(const QUrl& u, const QJsonObject& infoJson,
: originalInfoJson(infoJson)
, mimeType(QMimeDatabase().mimeTypeForName(infoJson["mimetype"_ls].toString()))
, url(u)
- , payloadSize(infoJson["size"_ls].toInt())
+ , payloadSize(fromJson<qint64>(infoJson["size"_ls]))
, originalName(originalFilename)
{
if (!mimeType.isValid())
@@ -55,7 +57,7 @@ void FileInfo::fillInfoJson(QJsonObject* infoJson) const
infoJson->insert(QStringLiteral("mimetype"), mimeType.name());
}
-ImageInfo::ImageInfo(const QUrl& u, int fileSize, QMimeType mimeType,
+ImageInfo::ImageInfo(const QUrl& u, qint64 fileSize, QMimeType mimeType,
const QSize& imageSize)
: FileInfo(u, fileSize, mimeType), imageSize(imageSize)
{ }
diff --git a/lib/events/eventcontent.h b/lib/events/eventcontent.h
index ea321fb6..2a48e910 100644
--- a/lib/events/eventcontent.h
+++ b/lib/events/eventcontent.h
@@ -88,7 +88,7 @@ namespace QMatrixClient
class FileInfo
{
public:
- explicit FileInfo(const QUrl& u, int payloadSize = -1,
+ explicit FileInfo(const QUrl& u, qint64 payloadSize = -1,
const QMimeType& mimeType = {},
const QString& originalFilename = {});
FileInfo(const QUrl& u, const QJsonObject& infoJson,
@@ -109,7 +109,7 @@ namespace QMatrixClient
QJsonObject originalInfoJson;
QMimeType mimeType;
QUrl url;
- int payloadSize;
+ qint64 payloadSize;
QString originalName;
};
@@ -127,7 +127,7 @@ namespace QMatrixClient
class ImageInfo : public FileInfo
{
public:
- explicit ImageInfo(const QUrl& u, int fileSize = -1,
+ explicit ImageInfo(const QUrl& u, qint64 fileSize = -1,
QMimeType mimeType = {},
const QSize& imageSize = {});
ImageInfo(const QUrl& u, const QJsonObject& infoJson,