diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp index ed598ac4f..ea2239b5b 100644 --- a/src/audio/audio.cpp +++ b/src/audio/audio.cpp @@ -308,7 +308,7 @@ void Audio::subscribeInput() return; } - inSubscriptions++; + ++inSubscriptions; qDebug() << "Subscribed to audio input device [" << inSubscriptions << "subscriptions ]"; } diff --git a/src/chatlog/chatlog.cpp b/src/chatlog/chatlog.cpp index a0be24763..aa0bfd6be 100644 --- a/src/chatlog/chatlog.cpp +++ b/src/chatlog/chatlog.cpp @@ -865,7 +865,7 @@ void ChatLog::retranslateUi() bool ChatLog::isActiveFileTransfer(ChatLine::Ptr l) { int count = l->getColumnCount(); - for (int i = 0; i < count; i++) + for (int i = 0; i < count; ++i) { ChatLineContent *content = l->getContent(i); ChatLineContentProxy *proxy = qobject_cast(content); diff --git a/src/chatlog/content/filetransferwidget.cpp b/src/chatlog/content/filetransferwidget.cpp index 5b8e60c42..bdb6ea05b 100644 --- a/src/chatlog/content/filetransferwidget.cpp +++ b/src/chatlog/content/filetransferwidget.cpp @@ -121,7 +121,7 @@ void FileTransferWidget::autoAcceptTransfer(const QString &path) do { filepath = QString("%1/%2%3.%4").arg(path, base, number > 0 ? QString(" (%1)").arg(QString::number(number)) : QString(), suffix); - number++; + ++number; } while (QFileInfo(filepath).exists()); diff --git a/src/chatlog/content/text.cpp b/src/chatlog/content/text.cpp index 4da82836c..5e7fd65fc 100644 --- a/src/chatlog/content/text.cpp +++ b/src/chatlog/content/text.cpp @@ -340,7 +340,7 @@ QString Text::extractSanitizedText(int from, int to) const if (pos >= from && pos < to) { txt += rune; - pos++; + ++pos; } } else @@ -350,7 +350,7 @@ QString Text::extractSanitizedText(int from, int to) const if (pos >= from && pos < to) txt += c; - pos++; + ++pos; } } } diff --git a/src/core/core.cpp b/src/core/core.cpp index 0c28f5796..df427917a 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -397,7 +397,7 @@ bool Core::checkConnection() emit disconnected(); isConnected = false; //count++; - } //else if (!toxConnected) count++; + } //else if (!toxConnected) ++count; return isConnected; } @@ -436,8 +436,8 @@ void Core::bootstrapDht() qDebug() << "Error adding TCP relay from "+dhtServer.name; } - j++; - i++; + ++j; + ++i; } } @@ -1047,7 +1047,7 @@ QList Core::getGroupPeerNames(int groupId) const qWarning() << "getGroupPeerNames: Unexpected tox_group_get_names result"; return names; } - for (uint16_t i=0; i vframe) { if (err == TOXAV_ERR_SEND_FRAME_SYNC) { - retries++; + ++retries; QThread::usleep(500); } else diff --git a/src/group.cpp b/src/group.cpp index 6d541627e..ee3be1950 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -87,7 +87,7 @@ void Group::regeneratePeerList() peers = Core::getInstance()->getGroupPeerNames(groupId); toxids.clear(); nPeers = peers.size(); - for (int i = 0; i < nPeers; i++) + for (int i = 0; i < nPeers; ++i) { ToxId id = Core::getInstance()->getGroupPeerToxId(groupId, i); if (id.isSelf()) diff --git a/src/ipc.cpp b/src/ipc.cpp index 658f8382f..f7ff6861d 100644 --- a/src/ipc.cpp +++ b/src/ipc.cpp @@ -128,7 +128,7 @@ time_t IPC::postEvent(const QString &name, const QByteArray& data, uint32_t dest IPCMemory* mem = global(); time_t result = 0; - for (uint32_t i = 0; !evt && i < EVENT_QUEUE_SIZE; i++) + for (uint32_t i = 0; !evt && i < EVENT_QUEUE_SIZE; ++i) { if (mem->events[i].posted == 0) evt = &mem->events[i]; @@ -188,7 +188,7 @@ bool IPC::isEventAccepted(time_t time) if (difftime(global()->lastProcessed, time) > 0) { IPCMemory* mem = global(); - for (uint32_t i = 0; i < EVENT_QUEUE_SIZE; i++) + for (uint32_t i = 0; i < EVENT_QUEUE_SIZE; ++i) { if (mem->events[i].posted == time && mem->events[i].processed) { @@ -225,7 +225,7 @@ bool IPC::waitUntilAccepted(time_t postTime, int32_t timeout/*=-1*/) IPC::IPCEvent *IPC::fetchEvent() { IPCMemory* mem = global(); - for (uint32_t i = 0; i < EVENT_QUEUE_SIZE; i++) + for (uint32_t i = 0; i < EVENT_QUEUE_SIZE; ++i) { IPCEvent* evt = &mem->events[i]; diff --git a/src/net/toxme.cpp b/src/net/toxme.cpp index 554daf1da..2b84b408c 100644 --- a/src/net/toxme.cpp +++ b/src/net/toxme.cpp @@ -98,7 +98,7 @@ QByteArray Toxme::getServerPubkey(QString url, QNetworkReply::NetworkError &erro QByteArray key; // I think, exist more easy way to convert key to ByteArray - for (int i = 0; i < pubkeySize; i++) { + for (int i = 0; i < pubkeySize; ++i) { QString byte = rawKey.mid(i*2, 2); key[i] = byte.toInt(nullptr, 16); } diff --git a/src/persistence/db/encrypteddb.cpp b/src/persistence/db/encrypteddb.cpp index 381bdc948..4b58826e2 100644 --- a/src/persistence/db/encrypteddb.cpp +++ b/src/persistence/db/encrypteddb.cpp @@ -152,7 +152,7 @@ void EncryptedDb::appendToEncrypted(const QString &sql) } buffer = buffer.right(buffer.size() - plainChunkSize); - chunkPosition++; + ++chunkPosition; } encrFile.seek(chunkPosition * encryptedChunkSize); diff --git a/src/persistence/profile.cpp b/src/persistence/profile.cpp index c9bd01351..f6f03cdd9 100644 --- a/src/persistence/profile.cpp +++ b/src/persistence/profile.cpp @@ -616,7 +616,7 @@ QVector Profile::remove() isRemoved = true; qDebug() << "Removing profile" << name; - for (int i=0; i= 0x80) { data[i] = static_cast(num | 0x80); - i++; + ++i; num = num >> 7; } data[i] = static_cast(num); @@ -127,7 +127,7 @@ QByteArray vuintToData(size_t num) while (num >= 0x80) { data[i] = static_cast(num | 0x80); - i++; + ++i; num = num >> 7; } data[i] = static_cast(num); diff --git a/src/persistence/settings.cpp b/src/persistence/settings.cpp index 11490dbd7..ee73b9ce6 100644 --- a/src/persistence/settings.cpp +++ b/src/persistence/settings.cpp @@ -719,7 +719,7 @@ void Settings::savePersonal(QString profileName, const QString &password) ps.setArrayIndex(index); ps.setValue("name", circle.name); ps.setValue("expanded", circle.expanded); - index++; + ++index; } ps.endArray(); } @@ -2291,7 +2291,7 @@ unsigned int Settings::getUnreadFriendRequests() const unsigned int unreadFriendRequests = 0; for (auto request : friendRequests) if (!request.read) - unreadFriendRequests++; + ++unreadFriendRequests; return unreadFriendRequests; } diff --git a/src/persistence/settingsserializer.cpp b/src/persistence/settingsserializer.cpp index 929c165ca..93595f818 100644 --- a/src/persistence/settingsserializer.cpp +++ b/src/persistence/settingsserializer.cpp @@ -283,7 +283,7 @@ void SettingsSerializer::save() QDataStream stream(&data, QIODevice::ReadWrite | QIODevice::Append); stream.setVersion(QDataStream::Qt_5_0); - for (int g=-1; g(v.group)].left(slashIndex)) a.group = i; a.name = groups[static_cast(v.group)].mid(slashIndex+1); @@ -547,7 +547,7 @@ void SettingsSerializer::readIni() } // Associate each array's values with the array - for (int ai=0; ai> DirectShow::getDeviceList() devIdString = wcharToUtf8(olestr); // replace ':' with '_' since FFmpeg uses : to delimitate sources - for (size_t i = 0; i < strlen(devIdString); i++) + for (size_t i = 0; i < strlen(devIdString); ++i) if (devIdString[i] == ':') devIdString[i] = '_'; @@ -146,7 +146,7 @@ static IBaseFilter* getDevFilter(QString devName) devIdString = wcharToUtf8(olestr); // replace ':' with '_' since FFmpeg uses : to delimitate sources - for (size_t i = 0; i < strlen(devIdString); i++) + for (size_t i = 0; i < strlen(devIdString); ++i) if (devIdString[i] == ':') devIdString[i] = '_'; diff --git a/src/video/cameradevice.cpp b/src/video/cameradevice.cpp index 85f1df99c..a1813e6c5 100644 --- a/src/video/cameradevice.cpp +++ b/src/video/cameradevice.cpp @@ -330,7 +330,7 @@ QVector> CameraDevice::getRawDeviceListGeneric() // Convert the list to a QVector devices.resize(devlist->nb_devices); - for (int i = 0; i < devlist->nb_devices; i++) + for (int i = 0; i < devlist->nb_devices; ++i) { AVDeviceInfo* dev = devlist->devices[i]; devices[i].first = dev->device_name; diff --git a/src/video/camerasource.cpp b/src/video/camerasource.cpp index 5bc0012ff..d2950d1a8 100644 --- a/src/video/camerasource.cpp +++ b/src/video/camerasource.cpp @@ -194,7 +194,7 @@ CameraSource::~CameraSource() if (device) { - for (int i = 0; i < subscriptions; i++) + for (int i = 0; i < subscriptions; ++i) device->close(); device = nullptr; @@ -286,11 +286,11 @@ bool CameraSource::openDevice() // We need to open the device as many time as we already have subscribers, // otherwise the device could get closed while we still have subscribers - for (int i = 0; i < subscriptions; i++) + for (int i = 0; i < subscriptions; ++i) device->open(); // Find the first video stream - for (unsigned i = 0; i < device->context->nb_streams; i++) + for (unsigned i = 0; i < device->context->nb_streams; ++i) { if (device->context->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { diff --git a/src/video/corevideosource.cpp b/src/video/corevideosource.cpp index 5f9a0a2ee..f69931fb5 100644 --- a/src/video/corevideosource.cpp +++ b/src/video/corevideosource.cpp @@ -84,14 +84,14 @@ void CoreVideoSource::pushFrame(const vpx_image_t* vpxframe) return; } - for (int i = 0; i < 3; i++) + for (int i = 0; i < 3; ++i) { int dstStride = avframe->linesize[i]; int srcStride = vpxframe->stride[i]; int minStride = std::min(dstStride, srcStride); int size = (i == 0) ? height : height / 2; - for (int j = 0; j < size; j++) + for (int j = 0; j < size; ++j) { uint8_t* dst = avframe->data[i] + dstStride * j; uint8_t* src = vpxframe->planes[i] + srcStride * j; diff --git a/src/widget/contentdialog.cpp b/src/widget/contentdialog.cpp index 0123a0513..147e50698 100644 --- a/src/widget/contentdialog.cpp +++ b/src/widget/contentdialog.cpp @@ -369,7 +369,7 @@ void ContentDialog::cycleContacts(bool forward, bool loop) void ContentDialog::onVideoShow(QSize size) { - videoCount++; + ++videoCount; if (videoCount > 1) return; diff --git a/src/widget/emoticonswidget.cpp b/src/widget/emoticonswidget.cpp index 9d1147056..2b03db2de 100644 --- a/src/widget/emoticonswidget.cpp +++ b/src/widget/emoticonswidget.cpp @@ -62,7 +62,7 @@ EmoticonsWidget::EmoticonsWidget(QWidget *parent) : // create pages buttonLayout->addStretch(); - for (int i = 0; i < pageCount; i++) + for (int i = 0; i < pageCount; ++i) { QGridLayout* pageLayout = new QGridLayout; pageLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), maxRows, 0); @@ -101,14 +101,14 @@ EmoticonsWidget::EmoticonsWidget(QWidget *parent) : qobject_cast(stack.widget(currPage)->layout())->addWidget(button, row, col); - col++; - currItem++; + ++col; + ++currItem; // next row if (col >= maxCols) { col = 0; - row++; + ++row; } // next page @@ -116,7 +116,7 @@ EmoticonsWidget::EmoticonsWidget(QWidget *parent) : { row = 0; currItem = 0; - currPage++; + ++currPage; } } diff --git a/src/widget/form/addfriendform.cpp b/src/widget/form/addfriendform.cpp index 6067c7a8f..941bf0f63 100644 --- a/src/widget/form/addfriendform.cpp +++ b/src/widget/form/addfriendform.cpp @@ -226,7 +226,7 @@ void AddFriendForm::setIdFromClipboard() void AddFriendForm::deleteFriendRequest(const QString& toxId) { int size = Settings::getInstance().getFriendRequestSize(); - for (int i = 0; i < size; i++) + for (int i = 0; i < size; ++i) { Settings::Request request = Settings::getInstance().getFriendRequest(i); if (ToxId(toxId) == ToxId(request.address)) diff --git a/src/widget/form/settings/avform.cpp b/src/widget/form/settings/avform.cpp index 3037e8cbb..1ddb62ffc 100644 --- a/src/widget/form/settings/avform.cpp +++ b/src/widget/form/settings/avform.cpp @@ -278,7 +278,7 @@ void AVForm::fillCameraModesComboBox() bool previouslyBlocked = videoModescomboBox->blockSignals(true); videoModescomboBox->clear(); - for(int i = 0; i < videoModes.size(); i++) + for(int i = 0; i < videoModes.size(); ++i) { VideoMode mode = videoModes[i]; @@ -305,7 +305,7 @@ int AVForm::searchPreferredIndex() QRect prefRes = Settings::getInstance().getCamVideoRes(); quint16 prefFPS = Settings::getInstance().getCamVideoFPS(); - for (int i = 0; i < videoModes.size(); i++) + for (int i = 0; i < videoModes.size(); ++i) { VideoMode mode = videoModes[i]; if (mode.width == prefRes.width() @@ -322,7 +322,7 @@ void AVForm::fillScreenModesComboBox() bool previouslyBlocked = videoModescomboBox->blockSignals(true); videoModescomboBox->clear(); - for(int i = 0; i < videoModes.size(); i++) + for(int i = 0; i < videoModes.size(); ++i) { VideoMode mode = videoModes[i]; QString pixelFormat = CameraDevice::getPixelFormatString(mode.pixel_format); diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp index d277bd0fb..64abb584a 100644 --- a/src/widget/form/settings/generalform.cpp +++ b/src/widget/form/settings/generalform.cpp @@ -121,7 +121,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) bodyUI->checkUpdates->setVisible(AUTOUPDATE_ENABLED); bodyUI->checkUpdates->setChecked(s.getCheckUpdates()); - for (int i = 0; i < langs.size(); i++) + for (int i = 0; i < langs.size(); ++i) bodyUI->transComboBox->insertItem(i, langs[i]); bodyUI->transComboBox->setCurrentIndex(locales.indexOf(s.getTranslation())); diff --git a/src/widget/form/settings/privacyform.cpp b/src/widget/form/settings/privacyform.cpp index 8d65af1f4..daa4b32ea 100644 --- a/src/widget/form/settings/privacyform.cpp +++ b/src/widget/form/settings/privacyform.cpp @@ -100,7 +100,7 @@ void PrivacyForm::on_randomNosapamButton_clicked() qsrand((uint)time.msec()); uint32_t newNospam{0}; - for (int i = 0; i < 4; i++) + for (int i = 0; i < 4; ++i) newNospam = (newNospam<<8) + (qrand() % 256); // Generate byte by byte. For some reason. Core::getInstance()->setNospam(newNospam); diff --git a/src/widget/form/settings/userinterfaceform.cpp b/src/widget/form/settings/userinterfaceform.cpp index 4cd6f3f6a..93124380c 100644 --- a/src/widget/form/settings/userinterfaceform.cpp +++ b/src/widget/form/settings/userinterfaceform.cpp @@ -234,11 +234,11 @@ void UserInterfaceForm::reloadSmileys() } QStringList smileys; - for (int i = 0; i < emoticons.size(); i++) + for (int i = 0; i < emoticons.size(); ++i) smileys.push_front(emoticons.at(i).first()); const QSize size(18,18); - for (int i = 0; i < smileLabels.size(); i++) + for (int i = 0; i < smileLabels.size(); ++i) { QIcon icon = SmileyPack::getInstance().getAsIcon(smileys[i]); smileLabels[i]->setPixmap(icon.pixmap(size)); diff --git a/src/widget/form/settingswidget.cpp b/src/widget/form/settingswidget.cpp index 82b8d109a..85a2844dc 100644 --- a/src/widget/form/settingswidget.cpp +++ b/src/widget/form/settingswidget.cpp @@ -104,6 +104,6 @@ void SettingsWidget::onTabChanged(int index) void SettingsWidget::retranslateUi() { - for (size_t i = 0; i < cfgForms.size(); i++) + for (size_t i = 0; i < cfgForms.size(); ++i) settingsWidgets->setTabText(i, cfgForms[i]->getFormName()); } diff --git a/src/widget/form/tabcompleter.cpp b/src/widget/form/tabcompleter.cpp index 316f112fe..7afef6412 100644 --- a/src/widget/form/tabcompleter.cpp +++ b/src/widget/form/tabcompleter.cpp @@ -93,7 +93,7 @@ void TabCompleter::complete() auto cur = msgEdit->textCursor(); cur.setPosition(cur.selectionEnd()); msgEdit->setTextCursor(cur); - for (int i = 0; i < lastCompletionLength; i++) + for (int i = 0; i < lastCompletionLength; ++i) msgEdit->textCursor().deletePreviousChar(); // insert completion diff --git a/src/widget/qrwidget.cpp b/src/widget/qrwidget.cpp index 9e37f6669..44d634459 100644 --- a/src/widget/qrwidget.cpp +++ b/src/widget/qrwidget.cpp @@ -96,10 +96,10 @@ void QRWidget::paintImage() const double aspect = w / h; const double scale = ((aspect > 1.0) ? h : w) / s; - for (int y = 0; y < s; y++) + for (int y = 0; y < s; ++y) { const int yy = y * s; - for (int x = 0; x < s; x++) + for (int x = 0; x < s; ++x) { const int xx = yy + x; const unsigned char b = qr->data[xx];