diff --git a/src/persistence/offlinemsgengine.cpp b/src/persistence/offlinemsgengine.cpp index c3667646c..54f20d4b6 100644 --- a/src/persistence/offlinemsgengine.cpp +++ b/src/persistence/offlinemsgengine.cpp @@ -81,21 +81,24 @@ void OfflineMsgEngine::deliverOfflineMsgs() QMap msgs = undeliveredMsgs; removeAllReciepts(); - for (auto iter = msgs.begin(); iter != msgs.end(); iter++) - { - if (iter.value().timestamp.msecsTo(QDateTime::currentDateTime()) < offlineTimeout) + for (auto iter = msgs.begin(); iter != msgs.end(); ++iter) + { + auto val = iter.value(); + auto key = iter.key(); + + if (val.timestamp.msecsTo(QDateTime::currentDateTime()) < offlineTimeout) { - registerReceipt(iter.value().receipt, iter.key(), iter.value().msg, iter.value().timestamp); + registerReceipt(val.receipt, key, val.msg, val.timestamp); continue; } - QString messageText = iter.value().msg->toString(); + QString messageText = val.msg->toString(); int rec; - if (iter.value().msg->isAction()) + if (val.msg->isAction()) rec = Core::getInstance()->sendAction(f->getFriendID(), messageText); else rec = Core::getInstance()->sendMessage(f->getFriendID(), messageText); - registerReceipt(rec, iter.key(), iter.value().msg); + registerReceipt(rec, key, val.msg); } } diff --git a/src/video/cameradevice.cpp b/src/video/cameradevice.cpp index ab0e6f358..ab3cb130f 100644 --- a/src/video/cameradevice.cpp +++ b/src/video/cameradevice.cpp @@ -40,7 +40,7 @@ QMutex CameraDevice::openDeviceLock, CameraDevice::iformatLock; AVInputFormat* CameraDevice::iformat{nullptr}; AVInputFormat* CameraDevice::idesktopFormat{nullptr}; -CameraDevice::CameraDevice(const QString devName, AVFormatContext *context) +CameraDevice::CameraDevice(const QString &devName, AVFormatContext *context) : devName{devName}, context{context}, refcount{1} { } diff --git a/src/video/cameradevice.h b/src/video/cameradevice.h index edf50549d..83209aeeb 100644 --- a/src/video/cameradevice.h +++ b/src/video/cameradevice.h @@ -66,7 +66,7 @@ public: static QString getDefaultDeviceName(); private: - CameraDevice(const QString devName, AVFormatContext *context); + CameraDevice(const QString &devName, AVFormatContext *context); static CameraDevice* open(QString devName, AVDictionary** options); static bool getDefaultInputFormat(); ///< Sets CameraDevice::iformat, returns success/failure static QVector > getRawDeviceListGeneric(); ///< Uses avdevice_list_devices diff --git a/src/widget/form/tabcompleter.cpp b/src/widget/form/tabcompleter.cpp index f5fbd921b..4c897bc1c 100644 --- a/src/widget/form/tabcompleter.cpp +++ b/src/widget/form/tabcompleter.cpp @@ -91,7 +91,7 @@ void TabCompleter::complete() // remember charcount to delete next time and advance to next completion lastCompletionLength = nextCompletion->length(); - nextCompletion++; + ++nextCompletion; // we're completing the first word of the line if (msgEdit->textCursor().position() == lastCompletionLength) diff --git a/src/widget/maskablepixmapwidget.cpp b/src/widget/maskablepixmapwidget.cpp index 958d3af52..bb2bf8fa9 100644 --- a/src/widget/maskablepixmapwidget.cpp +++ b/src/widget/maskablepixmapwidget.cpp @@ -81,7 +81,7 @@ void MaskablePixmapWidget::setClickable(bool clickable) unsetCursor(); } -void MaskablePixmapWidget::setPixmap(const QPixmap &pmap, QColor background) +void MaskablePixmapWidget::setPixmap(const QPixmap &pmap, const QColor &background) { if (!pmap.isNull()) { diff --git a/src/widget/maskablepixmapwidget.h b/src/widget/maskablepixmapwidget.h index 590d8f976..9cfad272e 100644 --- a/src/widget/maskablepixmapwidget.h +++ b/src/widget/maskablepixmapwidget.h @@ -30,7 +30,7 @@ public: ~MaskablePixmapWidget(); void autopickBackground(); void setClickable(bool clickable); - void setPixmap(const QPixmap &pmap, QColor background); + void setPixmap(const QPixmap &pmap, const QColor &background); void setPixmap(const QPixmap &pmap); QPixmap getPixmap() const; void setSize(QSize size); diff --git a/src/widget/style.cpp b/src/widget/style.cpp index 9b93b30eb..57f47a8c6 100644 --- a/src/widget/style.cpp +++ b/src/widget/style.cpp @@ -179,7 +179,7 @@ void Style::setThemeColor(int color) setThemeColor(themeColorColors[color]); } -void Style::setThemeColor(QColor color) +void Style::setThemeColor(const QColor &color) { if (!color.isValid()) { diff --git a/src/widget/style.h b/src/widget/style.h index b3ec7361c..6b4cb236d 100644 --- a/src/widget/style.h +++ b/src/widget/style.h @@ -65,7 +65,7 @@ public: static QString resolve(QString qss); static void repolish(QWidget* w); static void setThemeColor(int color); - static void setThemeColor(QColor color); ///< Pass an invalid QColor to reset to defaults + static void setThemeColor(const QColor &color); ///< Pass an invalid QColor to reset to defaults static void applyTheme(); ///< Reloads some CCS static QPixmap scaleSvgImage(const QString& path, uint32_t width, uint32_t height); diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 410d3fd70..2400c7821 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -685,7 +685,7 @@ void Widget::onTransferClicked() } } -void Widget::confirmExecutableOpen(const QFileInfo file) +void Widget::confirmExecutableOpen(const QFileInfo &file) { static const QStringList dangerousExtensions = { "app", "bat", "com", "cpl", "dmg", "exe", "hta", "jar", "js", "jse", "lnk", "msc", "msh", "msh1", "msh1xml", "msh2", "msh2xml", "mshxml", "msi", "msp", "pif", "ps1", "ps1xml", "ps2", "ps2xml", "psc1", "psc2", "py", "reg", "scf", "sh", "src", "vb", "vbe", "vbs", "ws", "wsc", "wsf", "wsh" }; diff --git a/src/widget/widget.h b/src/widget/widget.h index b26084c16..c92eb869b 100644 --- a/src/widget/widget.h +++ b/src/widget/widget.h @@ -85,7 +85,7 @@ public: ContentDialog* createContentDialog() const; ContentLayout* createContentDialog(DialogType type); - static void confirmExecutableOpen(const QFileInfo file); + static void confirmExecutableOpen(const QFileInfo &file); void clearAllReceipts(); void reloadHistory();