diff --git a/src/chatlog/chatline.cpp b/src/chatlog/chatline.cpp index e52956568..27653ae97 100644 --- a/src/chatlog/chatline.cpp +++ b/src/chatlog/chatline.cpp @@ -167,13 +167,16 @@ void ChatLine::replaceContent(int col, ChatLineContent *lineContent) void ChatLine::layout(qreal w, QPointF scenePos) { + if (!content.size()) + return; + width = w; bbox.setTopLeft(scenePos); qreal fixedWidth = (content.size()-1) * columnSpacing; qreal varWidth = 0.0; // used for normalisation - for (int i = 0; i < static_cast(format.size()); ++i) + for (size_t i = 0; i < format.size(); ++i) { if (format[i].policy == ColumnFormat::FixedSize) fixedWidth += format[i].size; @@ -190,8 +193,7 @@ void ChatLine::layout(qreal w, QPointF scenePos) qreal xOffset = 0.0; qreal xPos[content.size()]; - - for (int i = 0; i < static_cast(content.size()); ++i) + for (size_t i = 0; i < content.size(); ++i) { // calculate the effective width of the current column qreal width; @@ -225,7 +227,7 @@ void ChatLine::layout(qreal w, QPointF scenePos) maxVOffset = qMax(maxVOffset, content[i]->getAscent()); } - for (int i = 0; i < static_cast(content.size()); ++i) + for (size_t i = 0; i < content.size(); ++i) { // calculate vertical alignment // vertical alignment may depend on width, so we do it in a second pass diff --git a/src/core/core.cpp b/src/core/core.cpp index 2aabd8eaa..94393c9dc 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -973,20 +973,20 @@ QList Core::getGroupPeerNames(int groupId) const { QList names; int nPeers = getGroupNumberPeers(groupId); - if (nPeers == -1) + if (nPeers < 0) { qWarning() << "getGroupPeerNames: Unable to get number of peers"; return names; } - uint8_t namesArray[nPeers][TOX_MAX_NAME_LENGTH]; - uint16_t* lengths = new uint16_t[nPeers]; - int result = tox_group_get_names(tox, groupId, namesArray, lengths, nPeers); + std::unique_ptr namesArray{new uint8_t[nPeers][TOX_MAX_NAME_LENGTH]}; + std::unique_ptr lengths{new uint16_t[nPeers]}; + int result = tox_group_get_names(tox, groupId, namesArray.get(), lengths.get(), nPeers); if (result != nPeers) { qWarning() << "getGroupPeerNames: Unexpected result"; return names; } - for (int i=0; i(data.data()), salt)) { qWarning() << "can't get salt from" << filename << "header"; @@ -110,7 +110,6 @@ QByteArray Core::getSaltFromFile(QString filename) } QByteArray res(reinterpret_cast(salt), TOX_PASS_SALT_LENGTH); - delete[] salt; return res; } diff --git a/src/platform/camera/v4l2.cpp b/src/platform/camera/v4l2.cpp index 7daf1034e..172bd4695 100644 --- a/src/platform/camera/v4l2.cpp +++ b/src/platform/camera/v4l2.cpp @@ -122,6 +122,9 @@ QVector v4l2::getDeviceModes(QString devName) case V4L2_FRMSIZE_TYPE_STEPWISE: mode.width = vfse.stepwise.max_width; mode.height = vfse.stepwise.max_height; + break; + default: + continue; } QVector rates = getDeviceModeFramerates(fd, mode.width, mode.height, vfd.pixelformat); for (unsigned short rate : rates) diff --git a/src/widget/about/aboutuser.cpp b/src/widget/about/aboutuser.cpp index c71f21075..00a649545 100644 --- a/src/widget/about/aboutuser.cpp +++ b/src/widget/about/aboutuser.cpp @@ -99,8 +99,7 @@ void AboutUser::onRemoveHistoryClicked() History* history = Nexus::getProfile()->getHistory(); if (history) history->removeFriendHistory(toxId.publicKey); - QMessageBox::StandardButton reply; - reply = QMessageBox::information(this, + QMessageBox::information(this, tr("History removed"), tr("Chat history with %1 removed!").arg(ui->userName->text().toHtmlEscaped()), QMessageBox::Ok); diff --git a/src/widget/groupwidget.cpp b/src/widget/groupwidget.cpp index cd113e416..a4cbec9e6 100644 --- a/src/widget/groupwidget.cpp +++ b/src/widget/groupwidget.cpp @@ -83,7 +83,7 @@ void GroupWidget::contextMenuEvent(QContextMenuEvent* event) if (contentDialog == nullptr || notAlone) openChatWindow = menu.addAction(tr("Open chat in new window")); - if (contentDialog->hasGroupWidget(groupId, this)) + if (contentDialog && contentDialog->hasGroupWidget(groupId, this)) removeChatWindow = menu.addAction(tr("Remove chat from this window")); menu.addSeparator(); diff --git a/src/widget/notificationscrollarea.cpp b/src/widget/notificationscrollarea.cpp index 4432d1503..dc03586a8 100644 --- a/src/widget/notificationscrollarea.cpp +++ b/src/widget/notificationscrollarea.cpp @@ -116,7 +116,7 @@ void NotificationScrollArea::resizeEvent(QResizeEvent *event) void NotificationScrollArea::findNextWidget() { - int value; + int value = 0; GenericChatroomWidget* next = nullptr; QHash::iterator i = trackedWidgets.begin(); @@ -151,7 +151,7 @@ void NotificationScrollArea::findNextWidget() void NotificationScrollArea::findPreviousWidget() { - int value; + int value = 0; GenericChatroomWidget* next = nullptr; QHash::iterator i = trackedWidgets.begin(); diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 97ca9a497..8898d4c45 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -1486,7 +1486,6 @@ void Widget::onGroupNamelistChanged(int groupnumber, int peernumber, uint8_t Cha } else if (change == TOX_CHAT_CHANGE_PEER_NAME) // core overwrites old name before telling us it changed... { - qDebug() << "UPDATING PEER"; g->updatePeer(peernumber, name); } }