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 & ...@@ -76,8 +76,8 @@ QOpenGLFramebufferObject *CameraRenderer::createFramebufferObject (const QSize &
// It's not the same thread as render. // It's not the same thread as render.
coreManager->lockVideoRender(); coreManager->lockVideoRender();
mContextInfo->width = size.width(); mContextInfo->width = static_cast<GLuint>(size.width());
mContextInfo->height = size.height(); mContextInfo->height = static_cast<GLuint>(size.height());
mContextInfo->functions = MSFunctions::getInstance()->getFunctions(); mContextInfo->functions = MSFunctions::getInstance()->getFunctions();
mUpdateContextInfo = true; mUpdateContextInfo = true;
......
...@@ -71,8 +71,8 @@ QOpenGLFramebufferObject *CameraPreviewRenderer::createFramebufferObject (const ...@@ -71,8 +71,8 @@ QOpenGLFramebufferObject *CameraPreviewRenderer::createFramebufferObject (const
// It's not the same thread as render. // It's not the same thread as render.
coreManager->lockVideoRender(); coreManager->lockVideoRender();
mContextInfo->width = size.width(); mContextInfo->width = static_cast<GLuint>(size.width());
mContextInfo->height = size.height(); mContextInfo->height = static_cast<GLuint>(size.height());
mContextInfo->functions = MSFunctions::getInstance()->getFunctions(); mContextInfo->functions = MSFunctions::getInstance()->getFunctions();
mUpdateContextInfo = true; mUpdateContextInfo = true;
......
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
#define THUMBNAIL_IMAGE_FILE_HEIGHT 100 #define THUMBNAIL_IMAGE_FILE_HEIGHT 100
#define THUMBNAIL_IMAGE_FILE_WIDTH 100 #define THUMBNAIL_IMAGE_FILE_WIDTH 100
// In Bytes.
#define FILE_SIZE_LIMIT 524288000
using namespace std; using namespace std;
// ============================================================================= // =============================================================================
...@@ -367,10 +370,17 @@ void ChatModel::sendFileMessage (const QString &path) { ...@@ -367,10 +370,17 @@ void ChatModel::sendFileMessage (const QString &path) {
if (!file.exists()) if (!file.exists())
return; 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(); shared_ptr<linphone::Content> content = CoreManager::getInstance()->getCore()->createContent();
content->setType("application"); content->setType("application");
content->setSubtype("octet-stream"); content->setSubtype("octet-stream");
content->setSize(file.size());
content->setSize(static_cast<size_t>(fileSize));
content->setName(::Utils::qStringToLinphoneString(QFileInfo(file).fileName())); content->setName(::Utils::qStringToLinphoneString(QFileInfo(file).fileName()));
shared_ptr<linphone::ChatMessage> message = mChatRoom->createFileTransferMessage(content); 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