Skip to content

Commit b405d07

Browse files
committed
Suppress duplicate messages
The multi-pass scanning of disk images may mean the same message was displayed multiple times. We now suppress any exact duplicates.
1 parent eac465b commit b405d07

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

include/Util.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ const char *CHS (int cyl, int head, int sector);
108108
const char *CHR (int cyl, int head, int record);
109109
const char *CHSR (int cyl, int head, int sector, int record);
110110

111+
extern std::set<std::string> seen_messages;
111112

112113
template <typename ...Args>
113114
void Message (MsgType type, const char* pcsz_, Args&& ...args)
@@ -117,6 +118,14 @@ void Message (MsgType type, const char* pcsz_, Args&& ...args)
117118
if (type == msgError)
118119
throw util::exception(msg);
119120

121+
if (type != msgStatus)
122+
{
123+
if (seen_messages.find(msg) != seen_messages.end())
124+
return;
125+
126+
seen_messages.insert(msg);
127+
}
128+
120129
switch (type)
121130
{
122131
case msgStatus: break;

src/Image.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "BlockDevice.h"
88

99
bool UnwrapSDF (std::shared_ptr<Disk> &src_disk, std::shared_ptr<Disk> &disk);
10-
bool ReadUnsupp (MemFile &file, std::shared_ptr<Disk> &disk);
1110

1211
bool ReadImage (const std::string &path, std::shared_ptr<Disk> &disk, bool normalise)
1312
{

src/Util.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#include "SAMdisk.h"
44

5+
std::set<std::string> seen_messages;
6+
57
static uint32_t adwUsed[2][3];
68

79
const char *ValStr (int val, const char *pcszDec_, const char *pcszHex_, bool fForceDecimal_)

0 commit comments

Comments
 (0)