From eb55c4a691400527a6d299e957210d8451babf85 Mon Sep 17 00:00:00 2001 From: soramimi Date: Sat, 20 Jan 2024 21:40:10 +0900 Subject: [PATCH] . --- src/BasicRepositoryDialog.h | 4 +- src/BlameWindow.cpp | 4 +- src/ColorButton.cpp | 2 +- src/CommitDetailGetter.cpp | 6 +-- src/ConfigUserDialog.cpp | 1 + src/EditProfilesDialog.cpp | 4 ++ src/FileDiffSliderWidget.cpp | 2 +- src/FileDiffWidget.cpp | 10 ++-- src/Git.cpp | 6 +-- src/Git.h | 2 +- src/GitObjectManager.cpp | 4 +- src/GitPack.cpp | 4 +- src/LogTableWidget.cpp | 26 ++++----- src/MainWindow.cpp | 12 ----- src/MainWindow.h | 54 +++++++++---------- src/RepositoryPropertyDialog.cpp | 10 ++-- src/RepositoryPropertyDialog.h | 6 +-- src/SimpleImageWidget.cpp | 2 + src/coloredit/RingSlider.cpp | 4 +- src/common/joinpath.cpp | 2 +- src/common/misc.cpp | 8 +-- .../TraditionalWindowsStyleTreeControl.cpp | 24 ++++----- src/gpg.cpp | 12 ++--- src/gunzip.cpp | 14 ++--- .../AbstractCharacterBasedApplication.cpp | 9 +--- src/texteditor/TextEditorView.cpp | 2 +- src/urlencode.cpp | 8 +-- src/webclient.cpp | 5 ++ 28 files changed, 121 insertions(+), 126 deletions(-) diff --git a/src/BasicRepositoryDialog.h b/src/BasicRepositoryDialog.h index 914e7d2d..9607a644 100644 --- a/src/BasicRepositoryDialog.h +++ b/src/BasicRepositoryDialog.h @@ -9,8 +9,8 @@ class MainWindow; class BasicRepositoryDialog : public QDialog { public: - explicit BasicRepositoryDialog(MainWindow *mainwindow, GitPtr g); - ~BasicRepositoryDialog() override; + explicit BasicRepositoryDialog(MainWindow *mainwindow, GitPtr g); + ~BasicRepositoryDialog() override; private: struct Private; Private *m; diff --git a/src/BlameWindow.cpp b/src/BlameWindow.cpp index 95a69e88..6717ce74 100644 --- a/src/BlameWindow.cpp +++ b/src/BlameWindow.cpp @@ -138,8 +138,8 @@ QList BlameWindow::parseBlame(char const *begin, char const *end) } else { char const *p = line.c_str(); char const *q = strchr(p, ' '); - if (q) { - QString label = QString::fromLatin1(p, int(q - p)); + if (q) { + QString label = QString::fromLatin1(p, int(q - p)); if (item.commit_id.isEmpty()) { item.commit_id = label; int a, b, c; diff --git a/src/ColorButton.cpp b/src/ColorButton.cpp index 291e4ef4..144ff633 100644 --- a/src/ColorButton.cpp +++ b/src/ColorButton.cpp @@ -46,7 +46,7 @@ void ColorButton::setColor(QColor const &color) */ void ColorButton::paintEvent(QPaintEvent *event) { - (void)event; + (void)event; QPainter pr(this); QStyleOptionToolButton o; QStyleOptionButton o2; diff --git a/src/CommitDetailGetter.cpp b/src/CommitDetailGetter.cpp index 5b95ad15..c447d284 100644 --- a/src/CommitDetailGetter.cpp +++ b/src/CommitDetailGetter.cpp @@ -18,7 +18,7 @@ void CommitDetailGetter::start(GitPtr git) git_ = git; threads_.clear(); threads_.resize(4); - for (int i = 0; i < threads_.size(); i++) { + for (size_t i = 0; i < threads_.size(); i++) { std::thread th([&](){ while (1) { Request item; @@ -90,7 +90,7 @@ void CommitDetailGetter::stop() requests_.clear(); cache_.clear(); } - for (int i = 0; i < threads_.size(); i++) { + for (size_t i = 0; i < threads_.size(); i++) { if (threads_[i].joinable()) { threads_[i].join(); } @@ -139,7 +139,7 @@ CommitDetailGetter::Data CommitDetailGetter::query(Git::CommitID const &id, bool item.id = id; requests_.push_back(item); - const int MAX = std::min(1000, global->appsettings.maximum_number_of_commit_item_acquisitions); + const size_t MAX = std::min(1000, global->appsettings.maximum_number_of_commit_item_acquisitions); size_t n = requests_.size(); if (n > MAX) { diff --git a/src/ConfigUserDialog.cpp b/src/ConfigUserDialog.cpp index 8c6499fc..edcdc525 100644 --- a/src/ConfigUserDialog.cpp +++ b/src/ConfigUserDialog.cpp @@ -148,6 +148,7 @@ void ConfigUserDialog::on_lineEdit_local_email_textEdited(const QString &text) void ConfigUserDialog::on_checkBox_unset_local_stateChanged(int arg1) { + (void)arg1; bool f = ui->checkBox_unset_local->isChecked(); ui->lineEdit_local_name->setEnabled(!f); ui->lineEdit_local_email->setEnabled(!f); diff --git a/src/EditProfilesDialog.cpp b/src/EditProfilesDialog.cpp index f097f942..206c860a 100644 --- a/src/EditProfilesDialog.cpp +++ b/src/EditProfilesDialog.cpp @@ -235,6 +235,9 @@ void EditProfilesDialog::on_pushButton_down_clicked() void EditProfilesDialog::on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous) { + (void)current; + (void)previous; + updateUI(); int row = ui->tableWidget->currentRow(); @@ -350,6 +353,7 @@ void EditProfilesDialog::on_pushButton_get_icon_from_network_clicked() void EditProfilesDialog::on_tableWidget_itemDoubleClicked(QTableWidgetItem *item) { + (void)item; if (enable_double_click_) { done(QDialog::Accepted); } diff --git a/src/FileDiffSliderWidget.cpp b/src/FileDiffSliderWidget.cpp index b3c00fb8..82b7e4fe 100644 --- a/src/FileDiffSliderWidget.cpp +++ b/src/FileDiffSliderWidget.cpp @@ -57,7 +57,7 @@ QPixmap FileDiffSliderWidget::makeDiffPixmap(int width, int height, TextDiffLine QPixmap pixmap = QPixmap(w, h * scale); pixmap.fill(theme->diff_slider_normal_bg); QPainter pr(&pixmap); - auto Loop = [&](std::function const &getcolor){ + auto Loop = [&](std::function const &getcolor){ int i = 0; while (i < lines.size()) { auto type = (TextDiffLine::Type)lines[i].type; diff --git a/src/FileDiffWidget.cpp b/src/FileDiffWidget.cpp index 5c160370..da954ad2 100644 --- a/src/FileDiffWidget.cpp +++ b/src/FileDiffWidget.cpp @@ -202,7 +202,7 @@ void FileDiffWidget::makeSideBySideDiffData(Git::Diff const &diff, std::vector 0 || h > 0) { - while (h > 0) { - int hunk_number = int(h - 1); + while (h > 0) { + int hunk_number = int(h - 1); HunkItem const &hi = hunks[hunk_number]; if (hi.pos + hi.len < linenum) { break; @@ -451,8 +451,8 @@ void FileDiffWidget::setSingleFile(QByteArray const &ba, QString const &id, QStr void FileDiffWidget::setOriginalLines_(QByteArray const &ba, Git::SubmoduleItem const *submodule, Git::CommitItem const *submodule_commit) { - (void)submodule; - (void)submodule_commit; + (void)submodule; + (void)submodule_commit; m->original_lines.clear(); diff --git a/src/Git.cpp b/src/Git.cpp index 2056e484..db258915 100644 --- a/src/Git.cpp +++ b/src/Git.cpp @@ -1526,8 +1526,8 @@ bool Git::reflog(ReflogItemList *out, int maxcount) c = *ptr; } if (c == '\r' || c == '\n' || c == 0) { - int d = 0; - QString line = QString::fromUtf8(left, int(ptr - left)); + int d = 0; + QString line = QString::fromUtf8(left, int(ptr - left)); if (left < ptr) { d = *left & 0xff; } @@ -1614,7 +1614,7 @@ QString Git::trimPath(QString const &s) } return QString::fromUtf8(ba); } - if (left == begin && right == end) return s; + if (left == begin && right == end) return s; return QString::fromUtf16((char16_t const *)left, int(right - left)); } diff --git a/src/Git.h b/src/Git.h index 3b0c390d..c241ddbe 100644 --- a/src/Git.h +++ b/src/Git.h @@ -634,7 +634,7 @@ struct NamedCommitItem { Tag, }; Type type = Type::None; - QString remote; + QString remote; QString name; Git::CommitID id; }; diff --git a/src/GitObjectManager.cpp b/src/GitObjectManager.cpp index 7c67c9c2..bbdd9e34 100644 --- a/src/GitObjectManager.cpp +++ b/src/GitObjectManager.cpp @@ -355,8 +355,8 @@ Git::CommitID GitObjectCache::getCommitIdFromTag(QString const &tag) if (!obj.content.isEmpty()) { misc::splitLines(obj.content, [&](char const *ptr, size_t len){ if (!commit_id.isValid()) { - if (len >= 7 + GIT_ID_LENGTH && strncmp(ptr, "object ", 7) == 0) { - Git::CommitID id2(QString::fromUtf8(ptr + 7, int(len - 7)).trimmed()); + if (len >= 7 + GIT_ID_LENGTH && strncmp(ptr, "object ", 7) == 0) { + Git::CommitID id2(QString::fromUtf8(ptr + 7, int(len - 7)).trimmed()); if (Git::isValidID(id2)) { commit_id = id2; } diff --git a/src/GitPack.cpp b/src/GitPack.cpp index 9f22236e..224e5103 100644 --- a/src/GitPack.cpp +++ b/src/GitPack.cpp @@ -35,8 +35,8 @@ void GitPack::decodeTree(QByteArray *out) for (int i = 0; i < 20; i++) { sprintf(p, "%02x", ptr[i]); p += 2; - } - ba.append(tmp, int(p - tmp)); + } + ba.append(tmp, int(p - tmp)); ba.append('\t'); ba.append(name.c_str(), name.size()); ba.append('\n'); diff --git a/src/LogTableWidget.cpp b/src/LogTableWidget.cpp index 70592419..2bbc7d19 100644 --- a/src/LogTableWidget.cpp +++ b/src/LogTableWidget.cpp @@ -221,19 +221,19 @@ void drawBranch(QPainterPath *path, double x0, double y0, double x1, double y1, { if (x0 == x1) { path->moveTo(x0, y0); - path->lineTo(x1, y1); - } else { - double ym = bend_early ? (y0 + r) : (y1 - r); - if (bend_early) { - path->moveTo(x0, y0); - path->cubicTo(x0, ym, x1, ym, x1, ym + ym - y0); - path->lineTo(x1, y1); - } else { - path->moveTo(x0, y0); - path->lineTo(x0, ym + ym - y1); - path->cubicTo(x0, ym, x1, ym, x1, y1); - } - } + path->lineTo(x1, y1); + } else { + double ym = bend_early ? (y0 + r) : (y1 - r); + if (bend_early) { + path->moveTo(x0, y0); + path->cubicTo(x0, ym, x1, ym, x1, ym + ym - y0); + path->lineTo(x1, y1); + } else { + path->moveTo(x0, y0); + path->lineTo(x0, ym + ym - y1); + path->cubicTo(x0, ym, x1, ym, x1, y1); + } + } } void LogTableWidget::paintEvent(QPaintEvent *e) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index c057e6fc..f3eb21b7 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -619,18 +619,6 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event) } } } else if (et == QEvent::FocusIn) { - auto SelectItem = [](QListWidget *w){ - int row = w->currentRow(); - if (row < 0) { - row = 0; - w->setCurrentRow(row); - } - auto *item = w->item(row); - if (item) { - item->setSelected(true); - w->viewport()->update(); - } - }; // ファイルリストがフォーカスを得たとき、diffビューを更新する。(コンテキストメニュー対応) if (watched == frame()->unstagedFileslistwidget()) { m->last_focused_file_list = watched; diff --git a/src/MainWindow.h b/src/MainWindow.h index 3f79f6f9..7607aa99 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -30,22 +30,22 @@ struct GitHubRepositoryInfo { class AsyncExecGitThread_ : public QThread { private: - GitPtr g; - std::function callback; + GitPtr g; + std::function callback; public: - AsyncExecGitThread_(GitPtr g, std::function const &callback) - : g(g) - , callback(callback) - { - } - virtual ~AsyncExecGitThread_() override - { - } + AsyncExecGitThread_(GitPtr g, std::function const &callback) + : g(g) + , callback(callback) + { + } + virtual ~AsyncExecGitThread_() override + { + } protected: - void run() override - { - callback(g); - } + void run() override + { + callback(g); + } }; class HunkItem { @@ -134,7 +134,7 @@ class MainWindow : public QMainWindow { int idiff; }; - Ui::MainWindow *ui; + Ui::MainWindow *ui; struct Private; Private *m; @@ -197,7 +197,7 @@ class MainWindow : public QMainWindow { void rebaseBranch(Git::CommitItem const *commit); void cherrypick(Git::CommitItem const *commit); void merge(RepositoryWrapperFrame *frame, const Git::CommitItem *commit = nullptr); - void detectGitServerType(GitPtr g); + void detectGitServerType(GitPtr g); void setRemoteOnline(bool f, bool save); void startTimers(); void onCloneCompleted(bool success, const QVariant &userdata); @@ -245,16 +245,16 @@ class MainWindow : public QMainWindow { void checkUser(); void openRepository(bool validate, bool waitcursor = true, bool keep_selection = false); void updateRepository(); - void reopenRepository(bool log, const std::function &callback); + void reopenRepository(bool log, const std::function &callback); void setCurrentRepository(const RepositoryData &repo, bool clear_authentication); void openSelectedRepository(); QList makeDiffs(RepositoryWrapperFrame *frame, QString id, bool *ok); - void queryBranches(RepositoryWrapperFrame *frame, GitPtr g); + void queryBranches(RepositoryWrapperFrame *frame, GitPtr g); void updateRemoteInfo(); - void queryRemotes(GitPtr g); + void queryRemotes(GitPtr g); void clone(QString url = {}, QString dir = {}); - void submodule_add(QString url = {}, const QString &local_dir = {}); - const Git::CommitItem *selectedCommitItem(RepositoryWrapperFrame *frame) const; + void submodule_add(QString url = {}, const QString &local_dir = {}); + const Git::CommitItem *selectedCommitItem(RepositoryWrapperFrame *frame) const; void commit(RepositoryWrapperFrame *frame, bool amend = false); void commitAmend(RepositoryWrapperFrame *frame); void pushSetUpstream(bool set_upstream, const QString &remote, const QString &branch, bool force); @@ -285,9 +285,9 @@ class MainWindow : public QMainWindow { Git::Object internalCatFile(RepositoryWrapperFrame *frame, GitPtr g, const QString &id); bool isThereUncommitedChanges() const; static void addDiffItems(const QList *diff_list, const std::function &add_item); - Git::CommitItemList retrieveCommitLog(GitPtr g); + Git::CommitItemList retrieveCommitLog(GitPtr g); std::map > &commitToBranchMapRef(RepositoryWrapperFrame *frame); - void updateWindowTitle(GitPtr g); + void updateWindowTitle(GitPtr g); QString makeCommitInfoText(RepositoryWrapperFrame *frame, int row, QList *label_list); void removeRepositoryFromBookmark(int index, bool ask); void openTerminal(const RepositoryData *repo); @@ -346,13 +346,13 @@ class MainWindow : public QMainWindow { PtyCondition getPtyCondition(); void setPtyUserData(const QVariant &userdata); void setPtyProcessOk(bool pty_process_ok); - bool fetch(GitPtr g, bool prune); - bool fetch_tags_f(GitPtr g); + bool fetch(GitPtr g, bool prune); + bool fetch_tags_f(GitPtr g); void setPtyCondition(const PtyCondition &ptyCondition); const QList &cRepositories() const; QList *pRepositories(); void setRepos(QList const &list); - bool interactionCanceled() const; + bool interactionCanceled() const; void setInteractionCanceled(bool canceled); InteractionMode interactionMode() const; void setInteractionMode(const InteractionMode &im); @@ -465,7 +465,7 @@ class MainWindow : public QMainWindow { QString determinFileType(QByteArray in); QList queryTagList(RepositoryWrapperFrame *frame); TextEditorThemePtr themeForTextEditor(); - bool isValidWorkingCopy(GitPtr g) const; + bool isValidWorkingCopy(GitPtr g) const; void emitWriteLog(const QByteArray &ba, bool receive); QString findFileID(RepositoryWrapperFrame *frame, const QString &commit_id, const QString &file); const Git::CommitItem *commitItem(const RepositoryWrapperFrame *frame, int row) const; diff --git a/src/RepositoryPropertyDialog.cpp b/src/RepositoryPropertyDialog.cpp index f81c5cb5..675e27f9 100644 --- a/src/RepositoryPropertyDialog.cpp +++ b/src/RepositoryPropertyDialog.cpp @@ -21,11 +21,11 @@ RepositoryPropertyDialog::RepositoryPropertyDialog(MainWindow *parent, Git::Cont ui->groupBox_remote->setVisible(open_repository_menu); - ui->label_editable_name->setText(repository.name); - ui->label_editable_name->setVisible(true); - ui->lineEdit_name->setText(repository.name); - ui->lineEdit_name->setVisible(false); - ui->lineEdit_local_dir->setText(misc::normalizePathSeparator(repository.local_dir)); + ui->label_editable_name->setText(repository.name); + ui->label_editable_name->setVisible(true); + ui->lineEdit_name->setText(repository.name); + ui->lineEdit_name->setVisible(false); + ui->lineEdit_local_dir->setText(misc::normalizePathSeparator(repository.local_dir)); ui->pushButton_close->setFocus(); diff --git a/src/RepositoryPropertyDialog.h b/src/RepositoryPropertyDialog.h index e2e62354..8cc1d8f7 100644 --- a/src/RepositoryPropertyDialog.h +++ b/src/RepositoryPropertyDialog.h @@ -19,7 +19,7 @@ class RepositoryPropertyDialog : public BasicRepositoryDialog { Ui::RepositoryPropertyDialog *ui; RepositoryData repository; bool remote_changed = false; - bool name_changed = false; + bool name_changed = false; Git::Context const *gcx; void updateRemotesTable(); bool execEditRemoteDialog(Git::Remote *remote, EditRemoteDialog::Operation op); @@ -32,14 +32,14 @@ class RepositoryPropertyDialog : public BasicRepositoryDialog { ~RepositoryPropertyDialog() override; bool isRemoteChanged() const; - bool isNameChanged() const; + bool isNameChanged() const; QString getName(); private slots: void on_pushButton_remote_add_clicked(); void on_pushButton_remote_edit_clicked(); void on_pushButton_remote_remove_clicked(); void on_pushButton_remote_menu_clicked(); - void on_pushButton_edit_name_clicked(); + void on_pushButton_edit_name_clicked(); // QDialog interface public slots: diff --git a/src/SimpleImageWidget.cpp b/src/SimpleImageWidget.cpp index 41d073c4..9ecdead5 100644 --- a/src/SimpleImageWidget.cpp +++ b/src/SimpleImageWidget.cpp @@ -24,6 +24,8 @@ void SimpleImageWidget::setImage(const QImage &image) */ void SimpleImageWidget::paintEvent(QPaintEvent *event) { + (void)event; + // ウィンドウに内接するように画像を描画 int dw = width(); diff --git a/src/coloredit/RingSlider.cpp b/src/coloredit/RingSlider.cpp index 68095e09..a4159fea 100644 --- a/src/coloredit/RingSlider.cpp +++ b/src/coloredit/RingSlider.cpp @@ -174,8 +174,8 @@ void RingSlider::mouseDoubleClickEvent(QMouseEvent *e) { int w = slider_rect_.width(); if (w > 1) { - double x = double(e->pos().x() - slider_rect_.x()) * (maximum() - minimum()) / (w - 1); - int v = (int)floor(x + 0.5); + double x = double(e->pos().x() - slider_rect_.x()) * (maximum() - minimum()) / (w - 1); + int v = (int)floor(x + 0.5); v = std::clamp(v, minimum(), maximum()); setValue(v); } diff --git a/src/common/joinpath.cpp b/src/common/joinpath.cpp index facb0bc9..fb39c322 100644 --- a/src/common/joinpath.cpp +++ b/src/common/joinpath.cpp @@ -74,7 +74,7 @@ QString qjoinpath(char16_t const *left, char16_t const *right) { std::vector vec; joinpath_(left, right, &vec); - if (vec.empty()) return QString(); + if (vec.empty()) return QString(); return QString::fromUtf16(&vec[0], vec.size()); } diff --git a/src/common/misc.cpp b/src/common/misc.cpp index 942238fa..1919a2ac 100644 --- a/src/common/misc.cpp +++ b/src/common/misc.cpp @@ -82,7 +82,7 @@ QStringList misc::splitLines(QString const &text) if (ptr < end) { c = *ptr; } - if (c == '\n' || c == '\r' || c == 0) { + if (c == '\n' || c == '\r' || c == 0) { list.push_back(QString::fromUtf16((char16_t const *)left, int(ptr - left))); if (c == 0) break; if (c == '\n') { @@ -172,7 +172,7 @@ QStringList misc::splitWords(QString const &text) c = *ptr; } if (QChar::isSpace(c) || c == 0) { - if (left < ptr) { + if (left < ptr) { list.push_back(QString::fromUtf16((char16_t const *)left, int(ptr - left))); } if (c == 0) break; @@ -350,8 +350,8 @@ void misc::dump(uint8_t const *ptr, size_t len) c = '.'; } pos++; - } - *dst = (char)c; + } + *dst = (char)c; dst++; } *dst = 0; diff --git a/src/darktheme/TraditionalWindowsStyleTreeControl.cpp b/src/darktheme/TraditionalWindowsStyleTreeControl.cpp index caff928e..48accc27 100644 --- a/src/darktheme/TraditionalWindowsStyleTreeControl.cpp +++ b/src/darktheme/TraditionalWindowsStyleTreeControl.cpp @@ -30,21 +30,21 @@ static unsigned char minus_image[9][9] = { TraditionalWindowsStyleTreeControl::TraditionalWindowsStyleTreeControl() { // create brush - { - QImage img(2, 2, QImage::Format_RGB32); - QRgb *p; - QRgb t = qRgb(0xff, 0xff, 0xff); - QRgb u = qRgb(0x80, 0x80, 0x80); + { + QImage img(2, 2, QImage::Format_RGB32); + QRgb *p; + QRgb t = qRgb(0xff, 0xff, 0xff); + QRgb u = qRgb(0x80, 0x80, 0x80); p = reinterpret_cast(img.scanLine(0)); - p[0] = u; - p[1] = t; + p[0] = u; + p[1] = t; p = reinterpret_cast(img.scanLine(1)); - p[0] = t; - p[1] = u; - br_branch = QBrush(img); - } + p[0] = t; + p[1] = u; + br_branch = QBrush(img); + } - // create open/close buttons + // create open/close buttons QImage img_plus(9, 9, QImage::Format_RGB32); QImage img_minus(9, 9, QImage::Format_RGB32); for (int y = 0; y < 9; y++) { diff --git a/src/gpg.cpp b/src/gpg.cpp index ced4b492..c1df57e2 100644 --- a/src/gpg.cpp +++ b/src/gpg.cpp @@ -63,17 +63,17 @@ void gpg::parse(char const *begin, char const *end, QList *keys) q2 = q3 = q4; } char const *e = q2 ? q2 : (p + strlen(p)); - while (p < e && isspace((unsigned char)e[-1])) e--; - key->name = QString::fromUtf8(p, int(e - p)); + while (p < e && isspace((unsigned char)e[-1])) e--; + key->name = QString::fromUtf8(p, int(e - p)); if (q2 && q3 && q2 < q3 && *q2 == '(') { - q2++; - key->comment = QString::fromUtf8(q2, int(q3 - q2)); + q2++; + key->comment = QString::fromUtf8(q2, int(q3 - q2)); } if (q4) { q4++; char const *q5 = strchr(q4, '>'); - if (q5) { - key->mail = QString::fromUtf8(q4, int(q5 - q4)); + if (q5) { + key->mail = QString::fromUtf8(q4, int(q5 - q4)); } } }; diff --git a/src/gunzip.cpp b/src/gunzip.cpp index 2f5a4f79..40f505ce 100644 --- a/src/gunzip.cpp +++ b/src/gunzip.cpp @@ -72,7 +72,7 @@ bool gunzip::decode(QIODevice *input, QIODevice *output) }; if (h->flg & FEXTRA) { - input->read((char *)ibuf, 2); + input->read((char *)ibuf, 2); n = ((uint8_t)ibuf[1] << 8) | (uint8_t)ibuf[0]; input->seek(input->pos() + n); } @@ -144,12 +144,12 @@ bool gunzip::decode(QIODevice *input, QIODevice *output) unsigned char obuf[65536]; stream.next_out = obuf; /* discard the output */ stream.avail_out = sizeof(obuf); - if (maxsize != -1 && stream.total_out + stream.avail_out > (unsigned)maxsize && (unsigned)maxsize >= stream.total_out) { - stream.avail_out = size_t(maxsize - stream.total_out); + if (maxsize != -1 && stream.total_out + stream.avail_out > (unsigned)maxsize && (unsigned)maxsize >= stream.total_out) { + stream.avail_out = size_t(maxsize - stream.total_out); } uLong total_out = stream.total_out; - err = ::inflate(&stream, Z_NO_FLUSH); - int n = int(stream.total_out - total_out); + err = ::inflate(&stream, Z_NO_FLUSH); + int n = int(stream.total_out - total_out); if (output) { if (write) { @@ -165,7 +165,7 @@ bool gunzip::decode(QIODevice *input, QIODevice *output) if (!ok) throw QString("failed to write to the output device"); } - crc = crc32(crc, (unsigned char const *)obuf, (size_t)n); + crc = crc32(crc, (unsigned char const *)obuf, (size_t)n); if (err == Z_STREAM_END) { break; } @@ -183,7 +183,7 @@ bool gunzip::decode(QIODevice *input, QIODevice *output) Close(); input->seek(inpos + stream.total_in); - input->read((char *)ibuf, 8); + input->read((char *)ibuf, 8); auto ReadU32LE = [](void const *p)->uint32_t{ auto const *q = (uint8_t const *)p; diff --git a/src/texteditor/AbstractCharacterBasedApplication.cpp b/src/texteditor/AbstractCharacterBasedApplication.cpp index bd876908..bde8d8d2 100644 --- a/src/texteditor/AbstractCharacterBasedApplication.cpp +++ b/src/texteditor/AbstractCharacterBasedApplication.cpp @@ -1748,8 +1748,8 @@ void AbstractCharacterBasedApplication::updateCursorPos(bool auto_scroll) std::vector pts; makeColumnPosList(&pts); if (pts.size() > 1) { - int newcol = pts.back(); - int newindex = (int)pts.size() - 1; + int newcol = pts.back(); + int newindex = (int)pts.size() - 1; for (int i = 0; i + 1 < (int)pts.size(); i++) { int x = pts[i]; if (x <= col && col < pts[i + 1]) { @@ -1760,11 +1760,6 @@ void AbstractCharacterBasedApplication::updateCursorPos(bool auto_scroll) } } index = newindex; -//@ col = newcol; -// } else if (!pts.empty()) { -// col = pts.back(); -// } else { -// col = 0; } } diff --git a/src/texteditor/TextEditorView.cpp b/src/texteditor/TextEditorView.cpp index d136b328..53d919a8 100644 --- a/src/texteditor/TextEditorView.cpp +++ b/src/texteditor/TextEditorView.cpp @@ -22,7 +22,7 @@ struct TextEditorView::Private { PreEditText preedit; QFont text_font; - InputMethodPopup *ime_popup = nullptr; + InputMethodPopup *ime_popup = nullptr; int top_margin = 0; int bottom_margin = 0; QSize basic_character_size; diff --git a/src/urlencode.cpp b/src/urlencode.cpp index 3cb5ede7..09f3b6b2 100644 --- a/src/urlencode.cpp +++ b/src/urlencode.cpp @@ -95,8 +95,8 @@ static void url_decode_(char const *ptr, char const *end, std::vector *out tmp[2] = 0; c = (unsigned char)strtol(tmp, nullptr, 16); ptr += 2; - } - vecprint(out, (char)c); + } + vecprint(out, (char)c); } } @@ -106,8 +106,8 @@ std::string url_decode(char const *str, char const *end) return std::string(); } - std::vector out; - out.reserve(size_t(end - str + 10)); + std::vector out; + out.reserve(size_t(end - str + 10)); url_decode_(str, end, &out); diff --git a/src/webclient.cpp b/src/webclient.cpp index 18c4c1a8..0a4ef243 100644 --- a/src/webclient.cpp +++ b/src/webclient.cpp @@ -806,7 +806,12 @@ bool WebClient::https_get(Request const &request_req, Post const *post, RequestO X509_NAME_ENTRY *entry = X509_NAME_get_entry(x509name, i); ASN1_STRING *asn1str = X509_NAME_ENTRY_get_data(entry); int asn1len = ASN1_STRING_length(asn1str); +#if 0 unsigned char *p = ASN1_STRING_data(asn1str); +#else + unsigned char const *p = ASN1_STRING_get0_data(asn1str); + +#endif std::string str((char const *)p, asn1len); out->push_back(str); }