From 3b7a79f137a09a68f9d1febfaacf5bf3dc07fe2d Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Sun, 24 Apr 2022 13:27:36 +0200 Subject: [PATCH] FindAdv: Amend d09f5ce1: Added new debug level :findverbose Fix the GUI handling for the new value using now 'unsigned long long' instead of 'int' --- src/frontends/qt/GuiProgressView.cpp | 11 ++++++----- src/support/debug.cpp | 2 +- src/support/debug.h | 7 +++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/frontends/qt/GuiProgressView.cpp b/src/frontends/qt/GuiProgressView.cpp index 6c5f939f4b..c44704b74e 100644 --- a/src/frontends/qt/GuiProgressView.cpp +++ b/src/frontends/qt/GuiProgressView.cpp @@ -51,7 +51,7 @@ GuiProgressView::~GuiProgressView() namespace{ -typedef pair DebugMap; +typedef pair DebugMap; typedef vector DebugVector; bool DebugSorter(DebugMap const & a, DebugMap const & b) @@ -106,7 +106,7 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area, for (; dit != den; ++dit) { QTreeWidgetItem * item = new QTreeWidgetItem(widget_->debugMessagesTW); item->setText(0, dit->second); - item->setData(0, Qt::UserRole, int(dit->first)); + item->setData(0, Qt::UserRole, dit->first); item->setText(1, qt_("No")); } widget_->debugMessagesTW->resizeColumnToContents(0); @@ -152,11 +152,12 @@ void GuiProgressView::debugMessageActivated(QTreeWidgetItem * item, int) void GuiProgressView::levelChanged() { - unsigned int level = Debug::NONE; + unsigned long long level = Debug::NONE; QTreeWidgetItemIterator it(widget_->debugMessagesTW); while (*it) { - if ((*it)->text(1) == qt_("Yes")) - level |= (*it)->data(0, Qt::UserRole).toInt(); + if ((*it)->text(1) == qt_("Yes")) { + level |= (*it)->data(0, Qt::UserRole).toULongLong(); + } ++it; } dispatch(FuncRequest(LFUN_DEBUG_LEVEL_SET, convert(level))); diff --git a/src/support/debug.cpp b/src/support/debug.cpp index 04485be69d..fa40d597fe 100644 --- a/src/support/debug.cpp +++ b/src/support/debug.cpp @@ -129,7 +129,7 @@ Debug::Type Debug::value(string const & val) break; // Is it a number? if (isStrInt(tmp)) - l |= static_cast(convert(tmp)); + l |= static_cast(convert(tmp)); else // Search for an explicit name for (DebugErrorItem const & item : errorTags) diff --git a/src/support/debug.h b/src/support/debug.h index 681ef3fbaf..2306524ca1 100644 --- a/src/support/debug.h +++ b/src/support/debug.h @@ -32,12 +32,15 @@ typedef basic_streambuf > streambuf; #endif +// Make sure at compile time that sizeof(unsigned long long) >= 8 +typedef char p__LINE__[ (sizeof(unsigned long long) > 7) ? 1 : -1]; + namespace lyx { /// This is all the different debug levels that we have. namespace Debug { /// - typedef uint64_t base_type; + typedef unsigned long long base_type; enum Type : base_type { /// NONE = 0, @@ -106,7 +109,7 @@ namespace Debug { /// FINDVERBOSE= (1u << 31), /// - DEBUG = (1L << 32), + DEBUG = (1ULL << 32), /// ANY = 0x1ffffffff };