summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/validity.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2024-10-05 20:53:59 +1000
committer Vas Crabb <vas@vastheman.com>2024-10-05 20:53:59 +1000
commitfc41ef0c9a73c96528f1e1551734522aa23f4580 (patch)
tree39c48158ac8c6fd47d715ee85f1e074efbccea2c /src/emu/validity.cpp
parent1228725b7acaba82fe742a5cd5a4a3f1e40de7e4 (diff)
emu/ioport.cpp: Improved validation of DIP switch locations.
* Treat an empty switch name as an error. * Treat a non-positive switch number as an error. * Also allocate fewer temporary strings.
Diffstat (limited to 'src/emu/validity.cpp')
-rw-r--r--src/emu/validity.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp
index 4cb6202b4d9..f95395fa159 100644
--- a/src/emu/validity.cpp
+++ b/src/emu/validity.cpp
@@ -22,6 +22,7 @@
#include "unicode.h"
#include <cctype>
+#include <sstream>
#include <type_traits>
#include <typeinfo>
@@ -2495,12 +2496,13 @@ void validity_checker::validate_inputs(device_t &root)
// allocate the input ports
ioport_list portlist;
- std::string errorbuf;
- portlist.append(device, errorbuf);
-
- // report any errors during construction
- if (!errorbuf.empty())
- osd_printf_error("I/O port error during construction:\n%s\n", errorbuf);
+ {
+ // report any errors during construction
+ std::ostringstream errorbuf;
+ portlist.append(device, errorbuf);
+ if (errorbuf.tellp())
+ osd_printf_error("I/O port error during construction:\n%s\n", std::move(errorbuf).str());
+ }
// do a first pass over ports to add their names and find duplicates
for (auto &port : portlist)