Skip to content

Commit d924f2a

Browse files
committed
Drop MSG_NOPREFIX flag
Since bilingual_str type is fully supported, the MSG_NOPREFIX flag is no longer needed.
1 parent 083daf7 commit d924f2a

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
@@ -1062,21 +1062,18 @@ void BitcoinGUI::message(const QString& title, QString message, unsigned int sty
10621062
int nMBoxIcon = QMessageBox::Information;
10631063
int nNotifyIcon = Notificator::Information;
10641064

1065-
bool prefix = !(style & CClientUIInterface::MSG_NOPREFIX);
1066-
style &= ~CClientUIInterface::MSG_NOPREFIX;
1067-
10681065
QString msgType;
10691066
if (!title.isEmpty()) {
10701067
msgType = title;
10711068
} else {
10721069
switch (style) {
10731070
case CClientUIInterface::MSG_ERROR:
10741071
msgType = tr("Error");
1075-
if (prefix) message = tr("Error: %1").arg(message);
1072+
message = tr("Error: %1").arg(message);
10761073
break;
10771074
case CClientUIInterface::MSG_WARNING:
10781075
msgType = tr("Warning");
1079-
if (prefix) message = tr("Warning: %1").arg(message);
1076+
message = tr("Warning: %1").arg(message);
10801077
break;
10811078
case CClientUIInterface::MSG_INFORMATION:
10821079
msgType = tr("Information");

src/ui_interface.h

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

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

src/validation.cpp

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

16571657
/** Abort with a message */
1658-
static bool AbortNode(const std::string& strMessage, const bilingual_str& userMessage = bilingual_str(), unsigned int prefix = 0)
1658+
static bool AbortNode(const std::string& strMessage, const bilingual_str& userMessage = bilingual_str())
16591659
{
16601660
SetMiscWarning(strMessage);
16611661
LogPrintf("*** %s\n", strMessage);
16621662
if (!userMessage.empty()) {
1663-
uiInterface.ThreadSafeMessageBox(userMessage, "", CClientUIInterface::MSG_ERROR | prefix);
1663+
uiInterface.ThreadSafeMessageBox(userMessage, "", CClientUIInterface::MSG_ERROR);
16641664
} else {
1665-
uiInterface.ThreadSafeMessageBox(_("Error: A fatal internal error occurred, see debug.log for details"), "", CClientUIInterface::MSG_ERROR | CClientUIInterface::MSG_NOPREFIX);
1665+
uiInterface.ThreadSafeMessageBox(_("A fatal internal error occurred, see debug.log for details"), "", CClientUIInterface::MSG_ERROR);
16661666
}
16671667
StartShutdown();
16681668
return false;
16691669
}
16701670

1671-
static bool AbortNode(BlockValidationState& state, const std::string& strMessage, const bilingual_str& userMessage = bilingual_str(), unsigned int prefix = 0)
1671+
static bool AbortNode(BlockValidationState& state, const std::string& strMessage, const bilingual_str& userMessage = bilingual_str())
16721672
{
1673-
AbortNode(strMessage, userMessage, prefix);
1673+
AbortNode(strMessage, userMessage);
16741674
return state.Error(strMessage);
16751675
}
16761676

@@ -2335,7 +2335,7 @@ bool CChainState::FlushStateToDisk(
23352335
if (fDoFullFlush || fPeriodicWrite) {
23362336
// Depend on nMinDiskSpace to ensure we can write block index
23372337
if (!CheckDiskSpace(GetBlocksDir())) {
2338-
return AbortNode(state, "Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
2338+
return AbortNode(state, "Disk space is too low!", _("Disk space is too low!"));
23392339
}
23402340
{
23412341
LOG_TIME_MILLIS_WITH_CATEGORY("write block and undo data to disk", BCLog::BENCH);
@@ -2383,7 +2383,7 @@ bool CChainState::FlushStateToDisk(
23832383
// an overestimation, as most will delete an existing entry or
23842384
// overwrite one. Still, use a conservative safety factor of 2.
23852385
if (!CheckDiskSpace(GetDataDir(), 48 * 2 * 2 * CoinsTip().GetCacheSize())) {
2386-
return AbortNode(state, "Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
2386+
return AbortNode(state, "Disk space is too low!", _("Disk space is too low!"));
23872387
}
23882388
// Flush the chainstate (which may refer to block index entries).
23892389
if (!CoinsTip().Flush())
@@ -3290,7 +3290,7 @@ static bool FindBlockPos(FlatFilePos &pos, unsigned int nAddSize, unsigned int n
32903290
bool out_of_space;
32913291
size_t bytes_allocated = BlockFileSeq().Allocate(pos, nAddSize, out_of_space);
32923292
if (out_of_space) {
3293-
return AbortNode("Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
3293+
return AbortNode("Disk space is too low!", _("Disk space is too low!"));
32943294
}
32953295
if (bytes_allocated != 0 && fPruneMode) {
32963296
fCheckForPruning = true;
@@ -3314,7 +3314,7 @@ static bool FindUndoPos(BlockValidationState &state, int nFile, FlatFilePos &pos
33143314
bool out_of_space;
33153315
size_t bytes_allocated = UndoFileSeq().Allocate(pos, nAddSize, out_of_space);
33163316
if (out_of_space) {
3317-
return AbortNode(state, "Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
3317+
return AbortNode(state, "Disk space is too low!", _("Disk space is too low!"));
33183318
}
33193319
if (bytes_allocated != 0 && fPruneMode) {
33203320
fCheckForPruning = true;

0 commit comments

Comments
 (0)