Commit 120dfc8e authored by Ronan Abhamon's avatar Ronan Abhamon

feat(app): replace some static_cast to functional cast (for simple types like int)

parent 0f09a0b5
...@@ -276,7 +276,7 @@ void Cli::Command::executeUri (const shared_ptr<linphone::Address> &address) con ...@@ -276,7 +276,7 @@ void Cli::Command::executeUri (const shared_ptr<linphone::Address> &address) con
// TODO: check if there is too much headers. // TODO: check if there is too much headers.
for (const auto &argName : mArgsScheme.keys()) { for (const auto &argName : mArgsScheme.keys()) {
const string header = address->getHeader(::Utils::appStringToCoreString(argName)); const string header = address->getHeader(::Utils::appStringToCoreString(argName));
args[argName] = QByteArray::fromBase64(QByteArray(header.c_str(), static_cast<int>(header.length()))); args[argName] = QByteArray::fromBase64(QByteArray(header.c_str(), int(header.length())));
} }
address->clean(); address->clean();
args["sip-address"] = ::Utils::coreStringToAppString(address->asStringUriOnly()); args["sip-address"] = ::Utils::coreStringToAppString(address->asStringUriOnly());
......
...@@ -43,7 +43,7 @@ static void removeAttribute (QXmlStreamAttributes &readerAttributes, const QStri ...@@ -43,7 +43,7 @@ static void removeAttribute (QXmlStreamAttributes &readerAttributes, const QStri
return name == attribute.name() && !attribute.prefix().length(); return name == attribute.name() && !attribute.prefix().length();
}); });
if (it != readerAttributes.cend()) if (it != readerAttributes.cend())
readerAttributes.remove(static_cast<int>(distance(readerAttributes.cbegin(), it))); readerAttributes.remove(int(distance(readerAttributes.cbegin(), it)));
} }
static QByteArray buildByteArrayAttribute (const QByteArray &name, const QByteArray &value) { static QByteArray buildByteArrayAttribute (const QByteArray &name, const QByteArray &value) {
...@@ -280,8 +280,8 @@ QImage ImageProvider::requestImage (const QString &id, QSize *size, const QSize ...@@ -280,8 +280,8 @@ QImage ImageProvider::requestImage (const QString &id, QSize *size, const QSize
const int width = requestedSize.width(); const int width = requestedSize.width();
const int height = requestedSize.height(); const int height = requestedSize.height();
QImage image( QImage image(
width > 0 ? width : static_cast<int>(viewBox.width()), width > 0 ? width : int(viewBox.width()),
height > 0 ? height : static_cast<int>(viewBox.height()), height > 0 ? height : int(viewBox.height()),
QImage::Format_ARGB32 QImage::Format_ARGB32
); );
if (Q_UNLIKELY(image.isNull())) { if (Q_UNLIKELY(image.isNull())) {
......
...@@ -213,7 +213,7 @@ void SingleApplicationPrivate::connectToPrimary (int msecs, char connectionType) ...@@ -213,7 +213,7 @@ void SingleApplicationPrivate::connectToPrimary (int msecs, char connectionType)
initMsg.append(connectionType); initMsg.append(connectionType);
initMsg.append(reinterpret_cast<const char *>(&instanceNumber), sizeof(quint32)); initMsg.append(reinterpret_cast<const char *>(&instanceNumber), sizeof(quint32));
initMsg.append(QByteArray::number(qChecksum(initMsg.constData(), static_cast<uint>(initMsg.length())), 256)); initMsg.append(QByteArray::number(qChecksum(initMsg.constData(), uint(initMsg.length())), 256));
socket->write(initMsg); socket->write(initMsg);
socket->flush(); socket->flush();
...@@ -304,11 +304,11 @@ void SingleApplicationPrivate::slotConnectionEstablished () { ...@@ -304,11 +304,11 @@ void SingleApplicationPrivate::slotConnectionEstablished () {
initMsg += connectionType; initMsg += connectionType;
tmp = nextConnSocket->read(sizeof(quint32)); tmp = nextConnSocket->read(sizeof(quint32));
const char *data = tmp.constData(); const char *data = tmp.constData();
instanceId = static_cast<quint32>(*data); instanceId = quint32(*data);
initMsg += tmp; initMsg += tmp;
// Verify the checksum of the initMsg // Verify the checksum of the initMsg
QByteArray checksum = QByteArray::number( QByteArray checksum = QByteArray::number(
qChecksum(initMsg.constData(), static_cast<uint>(initMsg.length())), qChecksum(initMsg.constData(), uint(initMsg.length())),
256 256
); );
tmp = nextConnSocket->read(checksum.length()); tmp = nextConnSocket->read(checksum.length());
......
...@@ -30,21 +30,23 @@ ...@@ -30,21 +30,23 @@
#include "CallsListModel.hpp" #include "CallsListModel.hpp"
/* Delay before removing call in ms. */
#define DELAY_BEFORE_REMOVE_CALL 3000
using namespace std; using namespace std;
// ============================================================================= // =============================================================================
namespace {
/* Delay before removing call in ms. */
constexpr int cDelayBeforeRemoveCall = 3000;
}
static inline int findCallIndex (QList<CallModel *> &list, const shared_ptr<linphone::Call> &call) { static inline int findCallIndex (QList<CallModel *> &list, const shared_ptr<linphone::Call> &call) {
auto it = find_if(list.begin(), list.end(), [call](CallModel *callModel) { auto it = find_if(list.begin(), list.end(), [call](CallModel *callModel) {
return call == callModel->getCall(); return call == callModel->getCall();
}); });
Q_ASSERT(it != list.end()); Q_ASSERT(it != list.end());
return static_cast<int>(distance(list.begin(), it)); return int(distance(list.begin(), it));
} }
static inline int findCallIndex (QList<CallModel *> &list, const CallModel &callModel) { static inline int findCallIndex (QList<CallModel *> &list, const CallModel &callModel) {
...@@ -253,7 +255,7 @@ void CallsListModel::removeCall (const shared_ptr<linphone::Call> &call) { ...@@ -253,7 +255,7 @@ void CallsListModel::removeCall (const shared_ptr<linphone::Call> &call) {
return; return;
} }
QTimer::singleShot(DELAY_BEFORE_REMOVE_CALL, this, [this, callModel] { QTimer::singleShot(cDelayBeforeRemoveCall, this, [this, callModel] {
removeCallCb(callModel); removeCallCb(callModel);
}); });
} }
......
...@@ -30,12 +30,14 @@ ...@@ -30,12 +30,14 @@
#include "Camera.hpp" #include "Camera.hpp"
#define MAX_FPS 30
using namespace std; using namespace std;
// ============================================================================= // =============================================================================
namespace {
constexpr int cMaxFps = 30;
}
struct ContextInfo { struct ContextInfo {
GLuint width; GLuint width;
GLuint height; GLuint height;
...@@ -77,8 +79,8 @@ QOpenGLFramebufferObject *CameraRenderer::createFramebufferObject (const QSize & ...@@ -77,8 +79,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 = static_cast<GLuint>(size.width()); mContextInfo->width = GLuint(size.width());
mContextInfo->height = static_cast<GLuint>(size.height()); mContextInfo->height = GLuint(size.height());
mContextInfo->functions = MSFunctions::getInstance()->getFunctions(); mContextInfo->functions = MSFunctions::getInstance()->getFunctions();
mUpdateContextInfo = true; mUpdateContextInfo = true;
...@@ -179,7 +181,7 @@ Camera::Camera (QQuickItem *parent) : QQuickFramebufferObject(parent) { ...@@ -179,7 +181,7 @@ Camera::Camera (QQuickItem *parent) : QQuickFramebufferObject(parent) {
setMirrorVertically(true); setMirrorVertically(true);
mRefreshTimer = new QTimer(this); mRefreshTimer = new QTimer(this);
mRefreshTimer->setInterval(1000 / MAX_FPS); mRefreshTimer->setInterval(1000 / cMaxFps);
QObject::connect( QObject::connect(
mRefreshTimer, &QTimer::timeout, mRefreshTimer, &QTimer::timeout,
......
...@@ -30,12 +30,14 @@ ...@@ -30,12 +30,14 @@
#include "CameraPreview.hpp" #include "CameraPreview.hpp"
#define MAX_FPS 30
using namespace std; using namespace std;
// ============================================================================= // =============================================================================
namespace {
constexpr int cMaxFps = 30;
}
struct ContextInfo { struct ContextInfo {
GLuint width; GLuint width;
GLuint height; GLuint height;
...@@ -72,8 +74,8 @@ QOpenGLFramebufferObject *CameraPreviewRenderer::createFramebufferObject (const ...@@ -72,8 +74,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 = static_cast<GLuint>(size.width()); mContextInfo->width = GLuint(size.width());
mContextInfo->height = static_cast<GLuint>(size.height()); mContextInfo->height = GLuint(size.height());
mContextInfo->functions = MSFunctions::getInstance()->getFunctions(); mContextInfo->functions = MSFunctions::getInstance()->getFunctions();
mUpdateContextInfo = true; mUpdateContextInfo = true;
...@@ -142,7 +144,7 @@ CameraPreview::CameraPreview (QQuickItem *parent) : QQuickFramebufferObject(pare ...@@ -142,7 +144,7 @@ CameraPreview::CameraPreview (QQuickItem *parent) : QQuickFramebufferObject(pare
setMirrorVertically(true); setMirrorVertically(true);
mRefreshTimer = new QTimer(this); mRefreshTimer = new QTimer(this);
mRefreshTimer->setInterval(1000 / MAX_FPS); mRefreshTimer->setInterval(1000 / cMaxFps);
QObject::connect( QObject::connect(
mRefreshTimer, &QTimer::timeout, mRefreshTimer, &QTimer::timeout,
......
...@@ -85,7 +85,7 @@ static inline void createThumbnail (const shared_ptr<linphone::ChatMessage> &mes ...@@ -85,7 +85,7 @@ static inline void createThumbnail (const shared_ptr<linphone::ChatMessage> &mes
int rotation = 0; int rotation = 0;
QExifImageHeader exifImageHeader; QExifImageHeader exifImageHeader;
if (exifImageHeader.loadFromJpeg(thumbnailPath)) if (exifImageHeader.loadFromJpeg(thumbnailPath))
rotation = static_cast<int>(exifImageHeader.value(QExifImageHeader::ImageTag::Orientation).toShort()); rotation = int(exifImageHeader.value(QExifImageHeader::ImageTag::Orientation).toShort());
QImage thumbnail = image.scaled( QImage thumbnail = image.scaled(
THUMBNAIL_IMAGE_FILE_WIDTH, THUMBNAIL_IMAGE_FILE_HEIGHT, THUMBNAIL_IMAGE_FILE_WIDTH, THUMBNAIL_IMAGE_FILE_HEIGHT,
...@@ -148,7 +148,7 @@ private: ...@@ -148,7 +148,7 @@ private:
} }
void signalDataChanged (const QList<ChatEntryData>::iterator &it) { void signalDataChanged (const QList<ChatEntryData>::iterator &it) {
int row = static_cast<int>(distance(mChatModel->mEntries.begin(), it)); int row = int(distance(mChatModel->mEntries.begin(), it));
emit mChatModel->dataChanged(mChatModel->index(row, 0), mChatModel->index(row, 0)); emit mChatModel->dataChanged(mChatModel->index(row, 0), mChatModel->index(row, 0));
} }
...@@ -175,7 +175,7 @@ private: ...@@ -175,7 +175,7 @@ private:
if (it == mChatModel->mEntries.end()) if (it == mChatModel->mEntries.end())
return; return;
(*it).first["fileOffset"] = static_cast<quint64>(offset); (*it).first["fileOffset"] = quint64(offset);
signalDataChanged(it); signalDataChanged(it);
} }
...@@ -411,7 +411,7 @@ void ChatModel::sendFileMessage (const QString &path) { ...@@ -411,7 +411,7 @@ void ChatModel::sendFileMessage (const QString &path) {
content->setSubtype(::Utils::appStringToCoreString(mimeType[1])); content->setSubtype(::Utils::appStringToCoreString(mimeType[1]));
} }
content->setSize(static_cast<size_t>(fileSize)); content->setSize(size_t(fileSize));
content->setName(::Utils::appStringToCoreString(QFileInfo(file).fileName())); content->setName(::Utils::appStringToCoreString(QFileInfo(file).fileName()));
shared_ptr<linphone::ChatMessage> message = mChatRoom->createFileTransferMessage(content); shared_ptr<linphone::ChatMessage> message = mChatRoom->createFileTransferMessage(content);
...@@ -534,7 +534,7 @@ void ChatModel::fillMessageEntry (QVariantMap &dest, const shared_ptr<linphone:: ...@@ -534,7 +534,7 @@ void ChatModel::fillMessageEntry (QVariantMap &dest, const shared_ptr<linphone::
shared_ptr<const linphone::Content> content = message->getFileTransferInformation(); shared_ptr<const linphone::Content> content = message->getFileTransferInformation();
if (content) { if (content) {
dest["fileSize"] = static_cast<quint64>(content->getSize()); dest["fileSize"] = quint64(content->getSize());
dest["fileName"] = ::Utils::coreStringToAppString(content->getName()); dest["fileName"] = ::Utils::coreStringToAppString(content->getName());
dest["wasDownloaded"] = ::fileWasDownloaded(message); dest["wasDownloaded"] = ::fileWasDownloaded(message);
...@@ -587,7 +587,7 @@ void ChatModel::removeEntry (ChatEntryData &pair) { ...@@ -587,7 +587,7 @@ void ChatModel::removeEntry (ChatEntryData &pair) {
}); });
if (it != mEntries.end()) if (it != mEntries.end())
removeEntry(static_cast<int>(distance(mEntries.begin(), it))); removeEntry(int(distance(mEntries.begin(), it)));
}); });
} }
...@@ -626,7 +626,7 @@ void ChatModel::insertCall (const shared_ptr<linphone::CallLog> &callLog) { ...@@ -626,7 +626,7 @@ void ChatModel::insertCall (const shared_ptr<linphone::CallLog> &callLog) {
return a.first["timestamp"] < b.first["timestamp"]; return a.first["timestamp"] < b.first["timestamp"];
}); });
int row = static_cast<int>(distance(mEntries.begin(), it)); int row = int(distance(mEntries.begin(), it));
beginInsertRows(QModelIndex(), row, row); beginInsertRows(QModelIndex(), row, row);
it = mEntries.insert(it, pair); it = mEntries.insert(it, pair);
......
...@@ -74,7 +74,7 @@ bool ContactsListProxyModel::filterAcceptsRow ( ...@@ -74,7 +74,7 @@ bool ContactsListProxyModel::filterAcceptsRow (
const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
const ContactModel *contact = index.data().value<ContactModel *>(); const ContactModel *contact = index.data().value<ContactModel *>();
mWeights[contact] = static_cast<unsigned int>(round(computeContactWeight(contact))); mWeights[contact] = uint(round(computeContactWeight(contact)));
return mWeights[contact] > 0 && ( return mWeights[contact] > 0 && (
!mUseConnectedFilter || !mUseConnectedFilter ||
...@@ -129,7 +129,7 @@ float ContactsListProxyModel::computeContactWeight (const ContactModel *contact) ...@@ -129,7 +129,7 @@ float ContactsListProxyModel::computeContactWeight (const ContactModel *contact)
// Get all contact's addresses. // Get all contact's addresses.
const list<shared_ptr<linphone::Address> > addresses = contact->mLinphoneFriend->getAddresses(); const list<shared_ptr<linphone::Address> > addresses = contact->mLinphoneFriend->getAddresses();
float size = static_cast<float>(addresses.size()); float size = float(addresses.size());
for (auto it = addresses.cbegin(); it != addresses.cend(); ++it) for (auto it = addresses.cbegin(); it != addresses.cend(); ++it)
weight += computeStringWeight( weight += computeStringWeight(
::Utils::coreStringToAppString((*it)->asStringUriOnly()), ::Utils::coreStringToAppString((*it)->asStringUriOnly()),
......
...@@ -241,7 +241,7 @@ void Notifier::notifyReceivedFileMessage (const shared_ptr<linphone::ChatMessage ...@@ -241,7 +241,7 @@ void Notifier::notifyReceivedFileMessage (const shared_ptr<linphone::ChatMessage
QVariantMap map; QVariantMap map;
map["fileUri"] = ::Utils::coreStringToAppString(message->getFileTransferFilepath()); map["fileUri"] = ::Utils::coreStringToAppString(message->getFileTransferFilepath());
map["fileSize"] = static_cast<quint64>(message->getFileTransferInformation()->getSize()); map["fileSize"] = quint64(message->getFileTransferInformation()->getSize());
SHOW_NOTIFICATION(map); SHOW_NOTIFICATION(map);
} }
......
...@@ -28,7 +28,7 @@ Units::Units (QObject *parent) : QObject(parent) {} ...@@ -28,7 +28,7 @@ Units::Units (QObject *parent) : QObject(parent) {}
float Units::getDp () const { float Units::getDp () const {
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
return static_cast<float>(96.0 / 72.0); return float(96.0 / 72.0);
#endif // ifdef Q_OS_MACOS #endif // ifdef Q_OS_MACOS
return 1.0; return 1.0;
......
...@@ -164,7 +164,7 @@ bool AccountSettingsModel::addOrUpdateProxyConfig ( ...@@ -164,7 +164,7 @@ bool AccountSettingsModel::addOrUpdateProxyConfig (
proxyConfig->setPublishExpires(data["registrationDuration"].toInt()); proxyConfig->setPublishExpires(data["registrationDuration"].toInt());
proxyConfig->setRoute(::Utils::appStringToCoreString(data["route"].toString())); proxyConfig->setRoute(::Utils::appStringToCoreString(data["route"].toString()));
proxyConfig->setContactParameters(::Utils::appStringToCoreString(data["contactParams"].toString())); proxyConfig->setContactParameters(::Utils::appStringToCoreString(data["contactParams"].toString()));
proxyConfig->setAvpfRrInterval(static_cast<uint8_t>(data["avpfInterval"].toInt())); proxyConfig->setAvpfRrInterval(uint8_t(data["avpfInterval"].toInt()));
proxyConfig->enableRegister(data["registerEnabled"].toBool()); proxyConfig->enableRegister(data["registerEnabled"].toBool());
proxyConfig->enablePublish(data["publishPresence"].toBool()); proxyConfig->enablePublish(data["publishPresence"].toBool());
proxyConfig->setAvpfMode(data["avpfEnabled"].toBool() proxyConfig->setAvpfMode(data["avpfEnabled"].toBool()
......
...@@ -29,14 +29,14 @@ ...@@ -29,14 +29,14 @@
#include "SettingsModel.hpp" #include "SettingsModel.hpp"
#ifndef DEFAULT_RLS_URI
#define DEFAULT_RLS_URI "sips:rls@sip.linphone.org"
#endif // ifndef RLS_URI
using namespace std; using namespace std;
// ============================================================================= // =============================================================================
namespace {
constexpr char cDefaultRlsUri[] = "sips:rls@sip.linphone.org";
}
const string SettingsModel::UI_SECTION("ui"); const string SettingsModel::UI_SECTION("ui");
SettingsModel::SettingsModel (QObject *parent) : QObject(parent) { SettingsModel::SettingsModel (QObject *parent) : QObject(parent) {
...@@ -190,11 +190,11 @@ void SettingsModel::setVideoPreset (const QString &preset) { ...@@ -190,11 +190,11 @@ void SettingsModel::setVideoPreset (const QString &preset) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
int SettingsModel::getVideoFramerate () const { int SettingsModel::getVideoFramerate () const {
return static_cast<int>(CoreManager::getInstance()->getCore()->getPreferredFramerate()); return int(CoreManager::getInstance()->getCore()->getPreferredFramerate());
} }
void SettingsModel::setVideoFramerate (int framerate) { void SettingsModel::setVideoFramerate (int framerate) {
CoreManager::getInstance()->getCore()->setPreferredFramerate(static_cast<float>(framerate)); CoreManager::getInstance()->getCore()->setPreferredFramerate(float(framerate));
emit videoFramerateChanged(framerate); emit videoFramerateChanged(framerate);
} }
...@@ -660,7 +660,7 @@ bool SettingsModel::getRlsUriEnabled () const { ...@@ -660,7 +660,7 @@ bool SettingsModel::getRlsUriEnabled () const {
void SettingsModel::setRlsUriEnabled (bool status) { void SettingsModel::setRlsUriEnabled (bool status) {
mConfig->setInt(UI_SECTION, "rls_uri_enabled", status); mConfig->setInt(UI_SECTION, "rls_uri_enabled", status);
mConfig->setString("sip", "rls_uri", status ? DEFAULT_RLS_URI : ""); mConfig->setString("sip", "rls_uri", status ? cDefaultRlsUri : "");
emit rlsUriEnabledChanged(status); emit rlsUriEnabledChanged(status);
} }
...@@ -669,7 +669,7 @@ static string getRlsUriDomain () { ...@@ -669,7 +669,7 @@ static string getRlsUriDomain () {
if (!domain.empty()) if (!domain.empty())
return domain; return domain;
shared_ptr<linphone::Address> linphoneAddress = CoreManager::getInstance()->getCore()->createAddress(DEFAULT_RLS_URI); shared_ptr<linphone::Address> linphoneAddress = CoreManager::getInstance()->getCore()->createAddress(cDefaultRlsUri);
Q_CHECK_PTR(linphoneAddress); Q_CHECK_PTR(linphoneAddress);
domain = linphoneAddress->getDomain(); domain = linphoneAddress->getDomain();
return domain; return domain;
...@@ -686,7 +686,7 @@ void SettingsModel::configureRlsUri () { ...@@ -686,7 +686,7 @@ void SettingsModel::configureRlsUri () {
const string domain = getRlsUriDomain(); const string domain = getRlsUriDomain();
for (const auto &proxyConfig : CoreManager::getInstance()->getCore()->getProxyConfigList()) for (const auto &proxyConfig : CoreManager::getInstance()->getCore()->getProxyConfigList())
if (proxyConfig->getDomain() == domain) { if (proxyConfig->getDomain() == domain) {
mConfig->setString("sip", "rls_uri", DEFAULT_RLS_URI); mConfig->setString("sip", "rls_uri", cDefaultRlsUri);
return; return;
} }
...@@ -701,7 +701,7 @@ void SettingsModel::configureRlsUri (const shared_ptr<const linphone::ProxyConfi ...@@ -701,7 +701,7 @@ void SettingsModel::configureRlsUri (const shared_ptr<const linphone::ProxyConfi
const string domain = getRlsUriDomain(); const string domain = getRlsUriDomain();
if (proxyConfig->getDomain() == domain) { if (proxyConfig->getDomain() == domain) {
mConfig->setString("sip", "rls_uri", DEFAULT_RLS_URI); mConfig->setString("sip", "rls_uri", cDefaultRlsUri);
return; return;
} }
......
...@@ -293,5 +293,5 @@ int TelephoneNumbersModel::getDefaultIndex () const { ...@@ -293,5 +293,5 @@ int TelephoneNumbersModel::getDefaultIndex () const {
return country == pair.first; return country == pair.first;
} }
); );
return it != mCountryCodes.cend() ? static_cast<int>(distance(mCountryCodes.cbegin(), it)) : 0; return it != mCountryCodes.cend() ? int(distance(mCountryCodes.cbegin(), it)) : 0;
} }
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
void TestUtils::executeKeySequence (QQuickWindow *window, QKeySequence sequence) { void TestUtils::executeKeySequence (QQuickWindow *window, QKeySequence sequence) {
for (int i = 0; i < sequence.count(); ++i) { for (int i = 0; i < sequence.count(); ++i) {
uint key = static_cast<uint>(sequence[static_cast<uint>(i)]); uint key = uint(sequence[uint(i)]);
QTest::keyClick( QTest::keyClick(
window, window,
Qt::Key(key & ~Qt::KeyboardModifierMask), Qt::Key(key & ~Qt::KeyboardModifierMask),
......
...@@ -540,7 +540,7 @@ quint32 QExifValue::toLong () const { ...@@ -540,7 +540,7 @@ quint32 QExifValue::toLong () const {
case Long: case Long:
return static_cast<const QExifLongValuePrivate *>(d.constData())->value.at(0); return static_cast<const QExifLongValuePrivate *>(d.constData())->value.at(0);
case SignedLong: case SignedLong:
return static_cast<quint32>(static_cast<const QExifSignedLongValuePrivate *>(d.constData())->value.at(0)); return quint32(static_cast<const QExifSignedLongValuePrivate *>(d.constData())->value.at(0));
} }
} }
return 0; return 0;
...@@ -598,7 +598,7 @@ qint32 QExifValue::toSignedLong () const { ...@@ -598,7 +598,7 @@ qint32 QExifValue::toSignedLong () const {
case Short: case Short:
return static_cast<const QExifShortValuePrivate *>(d.constData())->value.at(0); return static_cast<const QExifShortValuePrivate *>(d.constData())->value.at(0);
case Long: case Long:
return static_cast<qint32>(static_cast<const QExifLongValuePrivate *>(d.constData())->value.at(0)); return qint32(static_cast<const QExifLongValuePrivate *>(d.constData())->value.at(0));
case SignedLong: case SignedLong:
return static_cast<const QExifSignedLongValuePrivate *>(d.constData())->value.at(0); return static_cast<const QExifSignedLongValuePrivate *>(d.constData())->value.at(0);
} }
...@@ -1030,13 +1030,13 @@ quint32 QExifImageHeader::sizeOf (const QExifValue &value) const { ...@@ -1030,13 +1030,13 @@ quint32 QExifImageHeader::sizeOf (const QExifValue &value) const {
case QExifValue::Ascii: case QExifValue::Ascii:
return value.count() > 4 ? 12 + value.count() : 12; return value.count() > 4 ? 12 + value.count() : 12;
case QExifValue::Short: case QExifValue::Short:
return value.count() > 2 ? static_cast<quint32>(12 + value.count() * sizeof(quint16)) : 12; return value.count() > 2 ? quint32(12 + value.count() * sizeof(quint16)) : 12;
case QExifValue::Long: case QExifValue::Long:
case QExifValue::SignedLong: case QExifValue::SignedLong:
return value.count() > 1 ? static_cast<quint32>(12 + value.count() * sizeof(quint32)) : 12; return value.count() > 1 ? quint32(12 + value.count() * sizeof(quint32)) : 12;
case QExifValue::Rational: case QExifValue::Rational:
case QExifValue::SignedRational: case QExifValue::SignedRational:
return value.count() > 0 ? static_cast<quint32>(12 + value.count() * sizeof(quint32) * 2) : 12; return value.count() > 0 ? quint32(12 + value.count() * sizeof(quint32) * 2) : 12;
default: default:
return 0; return 0;
} }
...@@ -1352,7 +1352,7 @@ QExifValue QExifImageHeader::readIfdValue (QDataStream &stream, int startPos, co ...@@ -1352,7 +1352,7 @@ QExifValue QExifImageHeader::readIfdValue (QDataStream &stream, int startPos, co
return QExifValue(QString::fromUtf8(header.offsetAscii, header.count - 1)); return QExifValue(QString::fromUtf8(header.offsetAscii, header.count - 1));
} }
case QExifValue::Short: { case QExifValue::Short: {
QVector<quint16> value(static_cast<quint16>(header.count)); QVector<quint16> value(quint16(header.count));
if (header.count > 2) { if (header.count > 2) {
stream.device()->seek(startPos + header.offset); stream.device()->seek(startPos + header.offset);
...@@ -1366,7 +1366,7 @@ QExifValue QExifImageHeader::readIfdValue (QDataStream &stream, int startPos, co ...@@ -1366,7 +1366,7 @@ QExifValue QExifImageHeader::readIfdValue (QDataStream &stream, int startPos, co
return QExifValue(value); return QExifValue(value);
} }
case QExifValue::Long: { case QExifValue::Long: {
QVector<quint32> value(static_cast<quint32>(header.count)); QVector<quint32> value(quint32(header.count));
if (header.count > 1) { if (header.count > 1) {
stream.device()->seek(startPos + header.offset); stream.device()->seek(startPos + header.offset);
...@@ -1462,7 +1462,7 @@ QMap<T, QExifValue> QExifImageHeader::readIfdValues ( ...@@ -1462,7 +1462,7 @@ QMap<T, QExifValue> QExifImageHeader::readIfdValues (
bool QExifImageHeader::read (QIODevice *device) { bool QExifImageHeader::read (QIODevice *device) {
clear(); clear();
int startPos = static_cast<int>(device->pos()); int startPos = int(device->pos());
QDataStream stream(device); QDataStream stream(device);
...@@ -1544,7 +1544,7 @@ quint32 QExifImageHeader::writeExifHeader (QDataStream &stream, quint16 tag, con ...@@ -1544,7 +1544,7 @@ quint32 QExifImageHeader::writeExifHeader (QDataStream &stream, quint16 tag, con
} else { } else {
stream << offset; stream << offset;
offset += static_cast<quint32>(value.count()); offset += quint32(value.count());
} }
break; break;
case QExifValue::Undefined: case QExifValue::Undefined:
...@@ -1556,7 +1556,7 @@ quint32 QExifImageHeader::writeExifHeader (QDataStream &stream, quint16 tag, con ...@@ -1556,7 +1556,7 @@ quint32 QExifImageHeader::writeExifHeader (QDataStream &stream, quint16 tag, con
} else { } else {
stream << offset; stream << offset;
offset += static_cast<quint32>(value.count()); offset += quint32(value.count());
} }
break; break;
case QExifValue::Ascii: case QExifValue::Ascii:
...@@ -1569,7 +1569,7 @@ quint32 QExifImageHeader::writeExifHeader (QDataStream &stream, quint16 tag, con ...@@ -1569,7 +1569,7 @@ quint32 QExifImageHeader::writeExifHeader (QDataStream &stream, quint16 tag, con
} else { } else {
stream << offset; stream << offset;
offset += static_cast<quint32>(value.count()); offset += quint32(value.count());
} }
break; break;
case QExifValue::Short: case QExifValue::Short:
...@@ -1581,7 +1581,7 @@ quint32 QExifImageHeader::writeExifHeader (QDataStream &stream, quint16 tag, con ...@@ -1581,7 +1581,7 @@ quint32 QExifImageHeader::writeExifHeader (QDataStream &stream, quint16 tag, con
} else { } else {
stream << offset; stream << offset;
offset += static_cast<quint32>(value.count() * sizeof(quint16)); offset += quint32(value.count() * sizeof(quint16));
} }
break; break;
case QExifValue::Long: case QExifValue::Long:
...@@ -1592,7 +1592,7 @@ quint32 QExifImageHeader::writeExifHeader (QDataStream &stream, quint16 tag, con ...@@ -1592,7 +1592,7 @@ quint32 QExifImageHeader::writeExifHeader (QDataStream &stream, quint16 tag, con
} else { } else {
stream << offset; stream << offset;
offset += static_cast<quint32>(value.count() * sizeof(quint32)); offset += quint32(value.count() * sizeof(quint32));
} }
break; break;
case QExifValue::SignedLong: case QExifValue::SignedLong:
...@@ -1603,7 +1603,7 @@ quint32 QExifImageHeader::writeExifHeader (QDataStream &stream, quint16 tag, con ...@@ -1603,7 +1603,7 @@ quint32 QExifImageHeader::writeExifHeader (QDataStream &stream, quint16 tag, con
} else { } else {
stream << offset; stream << offset;
offset += static_cast<quint32>(value.count() * sizeof(qint32)); offset += quint32(value.count() * sizeof(qint32));
} }
break; break;
case QExifValue::Rational: case QExifValue::Rational:
...@@ -1612,7 +1612,7 @@ quint32 QExifImageHeader::writeExifHeader (QDataStream &stream, quint16 tag, con ...@@ -1612,7 +1612,7 @@ quint32 QExifImageHeader::writeExifHeader (QDataStream &stream, quint16 tag, con
} else { } else {
stream << offset; stream << offset;
offset += static_cast<quint32>(value.count() * sizeof(quint32) * 2); offset += quint32(value.count() * sizeof(quint32) * 2);
} }
break; break;
case QExifValue::SignedRational: case QExifValue::SignedRational:
...@@ -1621,7 +1621,7 @@ quint32 QExifImageHeader::writeExifHeader (QDataStream &stream, quint16 tag, con ...@@ -1621,7 +1621,7 @@ quint32 QExifImageHeader::writeExifHeader (QDataStream &stream, quint16 tag, con
} else { } else {
stream << offset; stream << offset;
offset += static_cast<quint32>(value.count() * sizeof(qint32) * 2); offset += quint32(value.count() * sizeof(qint32) * 2);
} }
break; break;
default: default:
...@@ -1730,7 +1730,7 @@ qint64 QExifImageHeader::write (QIODevice *device) const { ...@@ -1730,7 +1730,7 @@ qint64 QExifImageHeader::write (QIODevice *device) const {
device->write("\x00\x00\x00\x08", 4); device->write("\x00\x00\x00\x08", 4);
} }
quint16 count = static_cast<quint16>(d->imageIfdValues.count() + 1); quint16 count = quint16(d->imageIfdValues.count() + 1);
quint32 offset = 26; quint32 offset = 26;
if (!d->gpsIfdValues.isEmpty()) { if (!d->gpsIfdValues.isEmpty()) {
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
namespace Utils { namespace Utils {
inline QString coreStringToAppString (const std::string &string) { inline QString coreStringToAppString (const std::string &string) {
return QString::fromLocal8Bit(string.c_str(), static_cast<int>(string.size())); return QString::fromLocal8Bit(string.c_str(), int(string.size()));
} }
inline std::string appStringToCoreString (const QString &string) { inline std::string appStringToCoreString (const QString &string) {
......
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