Commit 69d3e7b5 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(app): fix implicit conversions and limit file size in chat

parent ac0f9722
......@@ -76,8 +76,8 @@ QOpenGLFramebufferObject *CameraRenderer::createFramebufferObject (const QSize &
// It's not the same thread as render.
coreManager->lockVideoRender();
mContextInfo->width = size.width();
mContextInfo->height = size.height();
mContextInfo->width = static_cast<GLuint>(size.width());
mContextInfo->height = static_cast<GLuint>(size.height());
mContextInfo->functions = MSFunctions::getInstance()->getFunctions();
mUpdateContextInfo = true;
......
......@@ -71,8 +71,8 @@ QOpenGLFramebufferObject *CameraPreviewRenderer::createFramebufferObject (const
// It's not the same thread as render.
coreManager->lockVideoRender();
mContextInfo->width = size.width();
mContextInfo->height = size.height();
mContextInfo->width = static_cast<GLuint>(size.width());
mContextInfo->height = static_cast<GLuint>(size.height());
mContextInfo->functions = MSFunctions::getInstance()->getFunctions();
mUpdateContextInfo = true;
......
......@@ -41,6 +41,9 @@
#define THUMBNAIL_IMAGE_FILE_HEIGHT 100
#define THUMBNAIL_IMAGE_FILE_WIDTH 100
// In Bytes.
#define FILE_SIZE_LIMIT 524288000
using namespace std;
// =============================================================================
......@@ -367,10 +370,17 @@ void ChatModel::sendFileMessage (const QString &path) {
if (!file.exists())
return;
qint64 fileSize = file.size();
if (fileSize > FILE_SIZE_LIMIT) {
qWarning() << QStringLiteral("Unable to send file. (Size limit=%1)").arg(FILE_SIZE_LIMIT);
return;
}
shared_ptr<linphone::Content> content = CoreManager::getInstance()->getCore()->createContent();
content->setType("application");
content->setSubtype("octet-stream");
content->setSize(file.size());
content->setSize(static_cast<size_t>(fileSize));
content->setName(::Utils::qStringToLinphoneString(QFileInfo(file).fileName()));
shared_ptr<linphone::ChatMessage> message = mChatRoom->createFileTransferMessage(content);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment