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

This commit is contained in:
Ronan Abhamon 2017-04-24 14:00:23 +02:00
parent ac0f9722fc
commit 69d3e7b522
3 changed files with 15 additions and 5 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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);