Skip to content

Commit 6fad0cf

Browse files
committed
Drop MSG_NOPREFIX flag
Since bilingual_str type is fully supported, the MSG_NOPREFIX flag is no longer needed.
1 parent 4ee5c12 commit 6fad0cf

File tree

4 files changed

+23
-33
lines changed

4 files changed

+23
-33
lines changed

src/noui.cpp

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,20 @@ bool noui_ThreadSafeMessageBox(const bilingual_str& message, const std::string&
2323
{
2424
bool fSecure = style & CClientUIInterface::SECURE;
2525
style &= ~CClientUIInterface::SECURE;
26-
bool prefix = !(style & CClientUIInterface::MSG_NOPREFIX);
27-
style &= ~CClientUIInterface::MSG_NOPREFIX;
2826

2927
std::string strCaption;
30-
if (prefix) {
31-
switch (style) {
32-
case CClientUIInterface::MSG_ERROR:
33-
strCaption = "Error: ";
34-
break;
35-
case CClientUIInterface::MSG_WARNING:
36-
strCaption = "Warning: ";
37-
break;
38-
case CClientUIInterface::MSG_INFORMATION:
39-
strCaption = "Information: ";
40-
break;
41-
default:
42-
strCaption = caption + ": "; // Use supplied caption (can be empty)
43-
}
28+
switch (style) {
29+
case CClientUIInterface::MSG_ERROR:
30+
strCaption = "Error: ";
31+
break;
32+
case CClientUIInterface::MSG_WARNING:
33+
strCaption = "Warning: ";
34+
break;
35+
case CClientUIInterface::MSG_INFORMATION:
36+
strCaption = "Information: ";
37+
break;
38+
default:
39+
strCaption = caption + ": "; // Use supplied caption (can be empty)
4440
}
4541

4642
if (!fSecure) {

src/qt/bitcoingui.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,21 +1048,18 @@ void BitcoinGUI::message(const QString& title, QString message, unsigned int sty
10481048
int nMBoxIcon = QMessageBox::Information;
10491049
int nNotifyIcon = Notificator::Information;
10501050

1051-
bool prefix = !(style & CClientUIInterface::MSG_NOPREFIX);
1052-
style &= ~CClientUIInterface::MSG_NOPREFIX;
1053-
10541051
QString msgType;
10551052
if (!title.isEmpty()) {
10561053
msgType = title;
10571054
} else {
10581055
switch (style) {
10591056
case CClientUIInterface::MSG_ERROR:
10601057
msgType = tr("Error");
1061-
if (prefix) message = tr("Error: %1").arg(message);
1058+
message = tr("Error: %1").arg(message);
10621059
break;
10631060
case CClientUIInterface::MSG_WARNING:
10641061
msgType = tr("Warning");
1065-
if (prefix) message = tr("Warning: %1").arg(message);
1062+
message = tr("Warning: %1").arg(message);
10661063
break;
10671064
case CClientUIInterface::MSG_INFORMATION:
10681065
msgType = tr("Information");

src/ui_interface.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ class CClientUIInterface
6666
/** Force blocking, modal message box dialog (not just OS notification) */
6767
MODAL = 0x10000000U,
6868

69-
/** Do not prepend error/warning prefix */
70-
MSG_NOPREFIX = 0x20000000U,
71-
7269
/** Do not print contents of message to debug log */
7370
SECURE = 0x40000000U,
7471

src/validation.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,22 +1651,22 @@ bool UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex* pindex)
16511651
}
16521652

16531653
/** Abort with a message */
1654-
static bool AbortNode(const std::string& strMessage, const bilingual_str& userMessage = bilingual_str(), unsigned int prefix = 0)
1654+
static bool AbortNode(const std::string& strMessage, const bilingual_str& userMessage = bilingual_str())
16551655
{
16561656
SetMiscWarning(strMessage);
16571657
LogPrintf("*** %s\n", strMessage);
16581658
if (!userMessage.empty()) {
1659-
uiInterface.ThreadSafeMessageBox(userMessage, "", CClientUIInterface::MSG_ERROR | prefix);
1659+
uiInterface.ThreadSafeMessageBox(userMessage, "", CClientUIInterface::MSG_ERROR);
16601660
} else {
1661-
uiInterface.ThreadSafeMessageBox(_("Error: A fatal internal error occurred, see debug.log for details"), "", CClientUIInterface::MSG_ERROR | CClientUIInterface::MSG_NOPREFIX);
1661+
uiInterface.ThreadSafeMessageBox(_("A fatal internal error occurred, see debug.log for details"), "", CClientUIInterface::MSG_ERROR);
16621662
}
16631663
StartShutdown();
16641664
return false;
16651665
}
16661666

1667-
static bool AbortNode(BlockValidationState& state, const std::string& strMessage, const bilingual_str& userMessage = bilingual_str(), unsigned int prefix = 0)
1667+
static bool AbortNode(BlockValidationState& state, const std::string& strMessage, const bilingual_str& userMessage = bilingual_str())
16681668
{
1669-
AbortNode(strMessage, userMessage, prefix);
1669+
AbortNode(strMessage, userMessage);
16701670
return state.Error(strMessage);
16711671
}
16721672

@@ -2318,7 +2318,7 @@ bool CChainState::FlushStateToDisk(
23182318
if (fDoFullFlush || fPeriodicWrite) {
23192319
// Depend on nMinDiskSpace to ensure we can write block index
23202320
if (!CheckDiskSpace(GetBlocksDir())) {
2321-
return AbortNode(state, "Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
2321+
return AbortNode(state, "Disk space is too low!", _("Disk space is too low!"));
23222322
}
23232323
{
23242324
LOG_TIME_MILLIS_WITH_CATEGORY("write block and undo data to disk", BCLog::BENCH);
@@ -2366,7 +2366,7 @@ bool CChainState::FlushStateToDisk(
23662366
// an overestimation, as most will delete an existing entry or
23672367
// overwrite one. Still, use a conservative safety factor of 2.
23682368
if (!CheckDiskSpace(GetDataDir(), 48 * 2 * 2 * CoinsTip().GetCacheSize())) {
2369-
return AbortNode(state, "Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
2369+
return AbortNode(state, "Disk space is too low!", _("Disk space is too low!"));
23702370
}
23712371
// Flush the chainstate (which may refer to block index entries).
23722372
if (!CoinsTip().Flush())
@@ -3264,7 +3264,7 @@ static bool FindBlockPos(FlatFilePos &pos, unsigned int nAddSize, unsigned int n
32643264
bool out_of_space;
32653265
size_t bytes_allocated = BlockFileSeq().Allocate(pos, nAddSize, out_of_space);
32663266
if (out_of_space) {
3267-
return AbortNode("Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
3267+
return AbortNode("Disk space is too low!", _("Disk space is too low!"));
32683268
}
32693269
if (bytes_allocated != 0 && fPruneMode) {
32703270
fCheckForPruning = true;
@@ -3288,7 +3288,7 @@ static bool FindUndoPos(BlockValidationState &state, int nFile, FlatFilePos &pos
32883288
bool out_of_space;
32893289
size_t bytes_allocated = UndoFileSeq().Allocate(pos, nAddSize, out_of_space);
32903290
if (out_of_space) {
3291-
return AbortNode(state, "Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
3291+
return AbortNode(state, "Disk space is too low!", _("Disk space is too low!"));
32923292
}
32933293
if (bytes_allocated != 0 && fPruneMode) {
32943294
fCheckForPruning = true;

0 commit comments

Comments
 (0)