summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Oliver Stöneberg <firewave@users.noreply.github.com>2020-01-29 15:59:50 +0100
committer GitHub <noreply@github.com>2020-01-29 09:59:50 -0500
commitc761a27e5c0e2847598d1c5c5e4d26c24944a516 (patch)
tree3ae338050a56da03deee40b7637e945aa866887d
parent4da780c24327a45ffe499080a05aeb5e3579b589 (diff)
fixed some clang-tidy warnings (nw) (#6229)
* fixed some readability-static-accessed-through-instance clang-tidy warnings (nw) * fixed some readability-redundant-string-cstr clang-tidy warnings (nw) * fixed some readability-redundant-control-flow clang-tidy warnings (nw) * fixed some modernize-use-nullptr clang-tidy warnings (nw) * fixed some performance-faster-string-find clang-tidy warnings (nw) * fixed some performance-for-range-copy clang-tidy warnings (nw) * fixed some performance-unnecessary-value-param clang-tidy warnings (nw)
-rw-r--r--src/devices/cpu/i8089/i8089_dasm.cpp28
-rw-r--r--src/devices/cpu/i8089/i8089_dasm.h28
-rw-r--r--src/devices/cpu/ns32000/ns32000dasm.cpp2
-rw-r--r--src/devices/cpu/ns32000/ns32000dasm.h2
-rw-r--r--src/devices/cpu/s2650/2650dasm.cpp2
-rw-r--r--src/devices/cpu/s2650/2650dasm.h2
-rw-r--r--src/devices/sound/megd.cpp2
-rw-r--r--src/devices/sound/megd.h2
-rw-r--r--src/emu/config.cpp12
-rw-r--r--src/emu/diimage.cpp2
-rw-r--r--src/emu/emumem.cpp2
-rw-r--r--src/emu/http.cpp4
-rw-r--r--src/emu/machine.cpp4
-rw-r--r--src/emu/rendlay.cpp6
-rw-r--r--src/emu/validity.cpp18
-rw-r--r--src/emu/video.cpp4
-rw-r--r--src/mame/drivers/blockade.cpp3
-rw-r--r--src/mame/drivers/megatech.cpp16
-rw-r--r--src/mame/drivers/stv.cpp8
-rw-r--r--src/mame/drivers/tutor.cpp2
-rw-r--r--src/mame/machine/3dom2.cpp4
-rw-r--r--src/mame/machine/esqpanel.cpp4
-rw-r--r--src/mame/machine/megadriv.cpp2
-rw-r--r--src/mame/video/3dom2_te.cpp6
-rw-r--r--src/mame/video/powervr2.cpp2
25 files changed, 82 insertions, 85 deletions
diff --git a/src/devices/cpu/i8089/i8089_dasm.cpp b/src/devices/cpu/i8089/i8089_dasm.cpp
index 8e45053b1ba..ad8b9d5705e 100644
--- a/src/devices/cpu/i8089/i8089_dasm.cpp
+++ b/src/devices/cpu/i8089/i8089_dasm.cpp
@@ -60,7 +60,7 @@ std::string i8089_disassembler::invalid()
}
// to register or memory from immediate
-std::string i8089_disassembler::from_i(std::string instr8, std::string instr16, std::string target)
+std::string i8089_disassembler::from_i(const std::string &instr8, const std::string &instr16, const std::string &target)
{
if (m_w == 0 && m_wb == 1)
return util::string_format("%s %s, %02x", instr8, target, fetch_immediate());
@@ -71,7 +71,7 @@ std::string i8089_disassembler::from_i(std::string instr8, std::string instr16,
}
// register, immediate
-std::string i8089_disassembler::inst_ri(std::string instr8, std::string instr16)
+std::string i8089_disassembler::inst_ri(const std::string &instr8, const std::string &instr16)
{
if (m_mm == 0)
return from_i(instr8, instr16, m_reg[m_brp]);
@@ -80,7 +80,7 @@ std::string i8089_disassembler::inst_ri(std::string instr8, std::string instr16)
}
// register
-std::string i8089_disassembler::inst_r(std::string instr)
+std::string i8089_disassembler::inst_r(const std::string &instr)
{
if (m_mm == 0 && m_w == 0 && m_aa == 0 && m_wb == 0)
return util::string_format("%s %s", instr, m_reg[m_brp]);
@@ -89,7 +89,7 @@ std::string i8089_disassembler::inst_r(std::string instr)
}
// jump register
-std::string i8089_disassembler::inst_jr(std::string instr8, std::string instr16)
+std::string i8089_disassembler::inst_jr(const std::string &instr8, const std::string &instr16)
{
uint16_t i = fetch_immediate();
if (m_mm == 0 && m_w == 0 && m_wb == 1)
@@ -101,14 +101,14 @@ std::string i8089_disassembler::inst_jr(std::string instr8, std::string instr16)
}
// memory immediate
-std::string i8089_disassembler::inst_mi(std::string instr8, std::string instr16)
+std::string i8089_disassembler::inst_mi(const std::string &instr8, const std::string &instr16)
{
std::string off = offset();
return from_i(instr8, instr16, off);
}
// register memory
-std::string i8089_disassembler::inst_rm(std::string instr8, std::string instr16)
+std::string i8089_disassembler::inst_rm(const std::string &instr8, const std::string &instr16)
{
std::string off = offset();
if (m_w == 0 && m_wb == 0)
@@ -120,7 +120,7 @@ std::string i8089_disassembler::inst_rm(std::string instr8, std::string instr16)
}
// jump memory
-std::string i8089_disassembler::inst_jm(std::string jump8short, std::string jump8long)
+std::string i8089_disassembler::inst_jm(const std::string &jump8short, const std::string &jump8long)
{
std::string off = offset();
uint16_t i = fetch_immediate();
@@ -133,7 +133,7 @@ std::string i8089_disassembler::inst_jm(std::string jump8short, std::string jump
}
// jump memory bit
-std::string i8089_disassembler::inst_jmb(std::string jump8short, std::string jump8long)
+std::string i8089_disassembler::inst_jmb(const std::string &jump8short, const std::string &jump8long)
{
std::string off = offset();
uint16_t i = fetch_immediate();
@@ -146,7 +146,7 @@ std::string i8089_disassembler::inst_jmb(std::string jump8short, std::string jum
}
// memory register
-std::string i8089_disassembler::inst_mr(std::string instr8, std::string instr16)
+std::string i8089_disassembler::inst_mr(const std::string &instr8, const std::string &instr16)
{
std::string off = offset();
if (m_w == 0 && m_wb == 0)
@@ -158,7 +158,7 @@ std::string i8089_disassembler::inst_mr(std::string instr8, std::string instr16)
}
// pointer memory
-std::string i8089_disassembler::inst_pm(std::string instr16)
+std::string i8089_disassembler::inst_pm(const std::string &instr16)
{
std::string off = offset();
if (m_w == 1 && m_wb == 0)
@@ -168,7 +168,7 @@ std::string i8089_disassembler::inst_pm(std::string instr16)
}
// memory pointer
-std::string i8089_disassembler::inst_mp(std::string instr16)
+std::string i8089_disassembler::inst_mp(const std::string &instr16)
{
std::string off = offset();
if (m_w == 1 && m_wb == 0)
@@ -178,7 +178,7 @@ std::string i8089_disassembler::inst_mp(std::string instr16)
}
// jump memory
-std::string i8089_disassembler::inst_j16(std::string jump8short, std::string jump16short, std::string jump8long, std::string jump16long)
+std::string i8089_disassembler::inst_j16(const std::string &jump8short, const std::string &jump16short, const std::string &jump8long, const std::string &jump16long)
{
std::string off = offset();
uint16_t i = fetch_immediate();
@@ -195,7 +195,7 @@ std::string i8089_disassembler::inst_j16(std::string jump8short, std::string jum
}
// memory
-std::string i8089_disassembler::inst_m(std::string instr8, std::string instr16)
+std::string i8089_disassembler::inst_m(const std::string &instr8, const std::string &instr16)
{
std::string off = offset();
if (m_w == 0 && m_wb == 0)
@@ -207,7 +207,7 @@ std::string i8089_disassembler::inst_m(std::string instr8, std::string instr16)
}
// memory bit
-std::string i8089_disassembler::inst_b(std::string instr)
+std::string i8089_disassembler::inst_b(const std::string &instr)
{
std::string off = offset();
if (m_w == 0 && m_wb == 0)
diff --git a/src/devices/cpu/i8089/i8089_dasm.h b/src/devices/cpu/i8089/i8089_dasm.h
index cf59d4b483c..a8a7c2115a5 100644
--- a/src/devices/cpu/i8089/i8089_dasm.h
+++ b/src/devices/cpu/i8089/i8089_dasm.h
@@ -49,20 +49,20 @@ private:
std::string offset();
std::string invalid();
- std::string from_i(std::string instr8, std::string instr16, std::string target);
- std::string inst_ri(std::string instr8, std::string instr16);
- std::string inst_r(std::string instr);
- std::string inst_jr(std::string instr8, std::string instr16);
- std::string inst_mi(std::string instr8, std::string instr16);
- std::string inst_rm(std::string instr8, std::string instr16);
- std::string inst_jm(std::string jump8short, std::string jump8long);
- std::string inst_jmb(std::string jump8short, std::string jump8long);
- std::string inst_mr(std::string instr8, std::string instr16);
- std::string inst_pm(std::string instr16);
- std::string inst_mp(std::string instr16);
- std::string inst_j16(std::string jump8short, std::string jump16short, std::string jump8long, std::string jump16long);
- std::string inst_m(std::string instr8, std::string instr16);
- std::string inst_b(std::string instr);
+ std::string from_i(const std::string &instr8, const std::string &instr16, const std::string &target);
+ std::string inst_ri(const std::string &instr8, const std::string &instr16);
+ std::string inst_r(const std::string &instr);
+ std::string inst_jr(const std::string &instr8, const std::string &instr16);
+ std::string inst_mi(const std::string &instr8, const std::string &instr16);
+ std::string inst_rm(const std::string &instr8, const std::string &instr16);
+ std::string inst_jm(const std::string &jump8short, const std::string &jump8long);
+ std::string inst_jmb(const std::string &jump8short, const std::string &jump8long);
+ std::string inst_mr(const std::string &instr8, const std::string &instr16);
+ std::string inst_pm(const std::string &instr16);
+ std::string inst_mp(const std::string &instr16);
+ std::string inst_j16(const std::string &jump8short, const std::string &jump16short, const std::string &jump8long, const std::string &jump16long);
+ std::string inst_m(const std::string &instr8, const std::string &instr16);
+ std::string inst_b(const std::string &instr);
std::string do_disassemble();
void load_instruction();
diff --git a/src/devices/cpu/ns32000/ns32000dasm.cpp b/src/devices/cpu/ns32000/ns32000dasm.cpp
index 8bc25f48c60..9556f7bcdda 100644
--- a/src/devices/cpu/ns32000/ns32000dasm.cpp
+++ b/src/devices/cpu/ns32000/ns32000dasm.cpp
@@ -360,7 +360,7 @@ int8_t ns32000_disassembler::short2int(uint8_t val)
return (val & 0x08) ? val | 0xf0 : val;
}
-std::string ns32000_disassembler::mnemonic_index(std::string form, std::string itype, std::string ftype)
+std::string ns32000_disassembler::mnemonic_index(std::string form, const std::string &itype, const std::string &ftype)
{
if (itype.size() && form.find('i') != std::string::npos)
form.replace(form.find('i'), 1, itype);
diff --git a/src/devices/cpu/ns32000/ns32000dasm.h b/src/devices/cpu/ns32000/ns32000dasm.h
index 4cbf4cf3bda..0c8d3e2ab82 100644
--- a/src/devices/cpu/ns32000/ns32000dasm.h
+++ b/src/devices/cpu/ns32000/ns32000dasm.h
@@ -101,7 +101,7 @@ private:
static char const *const M[];
static char const *const PR[];
- std::string mnemonic_index(std::string form, std::string itype, std::string ftype);
+ std::string mnemonic_index(std::string form, const std::string &itype, const std::string &ftype);
uint8_t opcode_format(uint8_t byte);
int8_t short2int(uint8_t val);
static inline int32_t get_disp(offs_t &pc, const data_buffer &opcodes);
diff --git a/src/devices/cpu/s2650/2650dasm.cpp b/src/devices/cpu/s2650/2650dasm.cpp
index 34b144532d2..871ea354594 100644
--- a/src/devices/cpu/s2650/2650dasm.cpp
+++ b/src/devices/cpu/s2650/2650dasm.cpp
@@ -45,7 +45,7 @@ std::string s2650_disassembler::IMM(offs_t pc, const data_buffer &params)
const char s2650_disassembler::cc[4] = { 'z', 'p', 'm', 'a' };
-void s2650_disassembler::add(std::string &buf, std::string str)
+void s2650_disassembler::add(std::string &buf, const std::string &str)
{
if(!buf.empty())
buf += '+';
diff --git a/src/devices/cpu/s2650/2650dasm.h b/src/devices/cpu/s2650/2650dasm.h
index 15f04cdffa7..cb5db5f85c8 100644
--- a/src/devices/cpu/s2650/2650dasm.h
+++ b/src/devices/cpu/s2650/2650dasm.h
@@ -34,7 +34,7 @@ private:
static const int rel[0x100];
static const char cc[4];
- void add(std::string &buf, std::string str);
+ void add(std::string &buf, const std::string &str);
std::string SYM(int addr);
std::string IMM(offs_t pc, const data_buffer &params);
std::string IMM_PSL(offs_t pc, const data_buffer &params);
diff --git a/src/devices/sound/megd.cpp b/src/devices/sound/megd.cpp
index 2790a7ca69c..47ff6dfdb3d 100644
--- a/src/devices/sound/megd.cpp
+++ b/src/devices/sound/megd.cpp
@@ -37,7 +37,7 @@ u32 meg_disassembler::b(u64 opc, u32 start, u32 count)
return (opc >> start) & ((1 << count) - 1);
}
-void meg_disassembler::append(std::string &r, std::string e)
+void meg_disassembler::append(std::string &r, const std::string &e)
{
if(r != "")
r += " ; ";
diff --git a/src/devices/sound/megd.h b/src/devices/sound/megd.h
index 59a13aa0ea4..82bad8f4beb 100644
--- a/src/devices/sound/megd.h
+++ b/src/devices/sound/megd.h
@@ -33,7 +33,7 @@ private:
std::string goffset(offs_t address) const;
static inline u32 b(u64 opc, u32 start, u32 count);
- static inline void append(std::string &r, std::string e);
+ static inline void append(std::string &r, const std::string &e);
};
#endif
diff --git a/src/emu/config.cpp b/src/emu/config.cpp
index 3574eb2d12e..a27a77b1dd6 100644
--- a/src/emu/config.cpp
+++ b/src/emu/config.cpp
@@ -60,7 +60,7 @@ int configuration_manager::load_settings()
int loaded = 0;
/* loop over all registrants and call their init function */
- for (auto type : m_typelist)
+ for (const auto &type : m_typelist)
type.load(config_type::INIT, nullptr);
/* now load the controller file */
@@ -93,7 +93,7 @@ int configuration_manager::load_settings()
loaded = load_xml(file, config_type::GAME);
/* loop over all registrants and call their final function */
- for (auto type : m_typelist)
+ for (const auto &type : m_typelist)
type.load(config_type::FINAL, nullptr);
/* if we didn't find a saved config, return 0 so the main core knows that it */
@@ -105,7 +105,7 @@ int configuration_manager::load_settings()
void configuration_manager::save_settings()
{
/* loop over all registrants and call their init function */
- for (auto type : m_typelist)
+ for (const auto &type : m_typelist)
type.save(config_type::INIT, nullptr);
/* save the defaults file */
@@ -120,7 +120,7 @@ void configuration_manager::save_settings()
save_xml(file, config_type::GAME);
/* loop over all registrants and call their final function */
- for (auto type : m_typelist)
+ for (const auto &type : m_typelist)
type.save(config_type::FINAL, nullptr);
}
@@ -204,7 +204,7 @@ int configuration_manager::load_xml(emu_file &file, config_type which_type)
osd_printf_debug("Entry: %s -- processing\n", name);
/* loop over all registrants and call their load function */
- for (auto type : m_typelist)
+ for (const auto &type : m_typelist)
type.load(which_type, systemnode->get_child(type.name.c_str()));
count++;
}
@@ -246,7 +246,7 @@ int configuration_manager::save_xml(emu_file &file, config_type which_type)
/* create the input node and write it out */
/* loop over all registrants and call their save function */
- for (auto type : m_typelist)
+ for (const auto &type : m_typelist)
{
util::xml::data_node *const curnode = systemnode->add_child(type.name.c_str(), nullptr);
if (!curnode)
diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp
index fe3d6d9e292..8cc849ee189 100644
--- a/src/emu/diimage.cpp
+++ b/src/emu/diimage.cpp
@@ -381,7 +381,7 @@ void device_image_interface::setup_working_directory()
// get user-specified directory and make sure it exists
m_working_directory = device().mconfig().options().sw_path();
// if multipath, get first
- size_t i = m_working_directory.find_first_of(";");
+ size_t i = m_working_directory.find_first_of(';');
if (i != std::string::npos)
m_working_directory.resize(i);
// validate directory
diff --git a/src/emu/emumem.cpp b/src/emu/emumem.cpp
index 3514045e32d..8f820606279 100644
--- a/src/emu/emumem.cpp
+++ b/src/emu/emumem.cpp
@@ -2582,7 +2582,7 @@ void memory_bank::set_base(void *base)
m_curentry = 0;
}
m_entries[m_curentry] = reinterpret_cast<u8 *>(base);
- for(auto cb : m_alloc_notifier)
+ for(const auto &cb : m_alloc_notifier)
cb(base);
m_alloc_notifier.clear();
}
diff --git a/src/emu/http.cpp b/src/emu/http.cpp
index 5b0dcca8d05..e00861ff4a0 100644
--- a/src/emu/http.cpp
+++ b/src/emu/http.cpp
@@ -295,8 +295,8 @@ http_manager::http_manager(bool active, short port, const char *root)
}
// Determine the file extension.
- std::size_t last_slash_pos = path.find_last_of("/");
- std::size_t last_dot_pos = path.find_last_of(".");
+ std::size_t last_slash_pos = path.find_last_of('/');
+ std::size_t last_dot_pos = path.find_last_of('.');
std::string extension;
if (last_dot_pos != std::string::npos && last_dot_pos > last_slash_pos)
{
diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp
index b3c0fd0d8e5..830ee6c4d82 100644
--- a/src/emu/machine.cpp
+++ b/src/emu/machine.cpp
@@ -521,8 +521,8 @@ std::string running_machine::get_statename(const char *option) const
int name_found = 0;
// find length of the device name
- int end1 = statename_str.find("/", pos + 3);
- int end2 = statename_str.find("%", pos + 3);
+ int end1 = statename_str.find('/', pos + 3);
+ int end2 = statename_str.find('%', pos + 3);
int end;
if ((end1 != -1) && (end2 != -1))
diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp
index c4b458ed80c..ea227b2c77b 100644
--- a/src/emu/rendlay.cpp
+++ b/src/emu/rendlay.cpp
@@ -2149,14 +2149,14 @@ public:
// split out position names from string and figure out our number of symbols
int location;
m_numstops = 0;
- location=symbollist.find(",");
+ location=symbollist.find(',');
while (location!=-1)
{
m_stopnames[m_numstops] = symbollist;
m_stopnames[m_numstops] = m_stopnames[m_numstops].substr(0, location);
symbollist = symbollist.substr(location+1, symbollist.length()-(location-1));
m_numstops++;
- location=symbollist.find(",");
+ location=symbollist.find(',');
}
m_stopnames[m_numstops++] = symbollist;
@@ -2166,7 +2166,7 @@ public:
for (int i=0;i<m_numstops;i++)
{
- location=m_stopnames[i].find(":");
+ location=m_stopnames[i].find(':');
if (location!=-1)
{
m_imagefile[i] = m_stopnames[i];
diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp
index 04944255b62..868f7c96935 100644
--- a/src/emu/validity.cpp
+++ b/src/emu/validity.cpp
@@ -222,7 +222,7 @@ bool validity_checker::check_all_matching(const char *string)
bool validated_any = false;
while (m_drivlist.next())
{
- if (m_drivlist.matches(string, m_drivlist.driver().name))
+ if (driver_list::matches(string, m_drivlist.driver().name))
{
validate_one(m_drivlist.driver());
validated_any = true;
@@ -1418,8 +1418,8 @@ void validity_checker::validate_driver()
// determine if we are a clone
bool is_clone = (strcmp(m_current_driver->parent, "0") != 0);
- int clone_of = m_drivlist.clone(*m_current_driver);
- if (clone_of != -1 && (m_drivlist.driver(clone_of).flags & machine_flags::IS_BIOS_ROOT))
+ int clone_of = driver_list::clone(*m_current_driver);
+ if (clone_of != -1 && (driver_list::driver(clone_of).flags & machine_flags::IS_BIOS_ROOT))
is_clone = false;
// if we have at least 100 drivers, validate the clone
@@ -1428,11 +1428,11 @@ void validity_checker::validate_driver()
osd_printf_error("Driver is a clone of nonexistent driver %s\n", m_current_driver->parent);
// look for recursive cloning
- if (clone_of != -1 && &m_drivlist.driver(clone_of) == m_current_driver)
+ if (clone_of != -1 && &driver_list::driver(clone_of) == m_current_driver)
osd_printf_error("Driver is a clone of itself\n");
// look for clones that are too deep
- if (clone_of != -1 && (clone_of = m_drivlist.non_bios_clone(clone_of)) != -1)
+ if (clone_of != -1 && (clone_of = driver_list::non_bios_clone(clone_of)) != -1)
osd_printf_error("Driver is a clone of a clone\n");
// make sure the driver name is not too long
@@ -1463,16 +1463,16 @@ void validity_checker::validate_driver()
compatible_with = nullptr;
// check for this driver being compatible with a nonexistent driver
- if (compatible_with != nullptr && m_drivlist.find(m_current_driver->compatible_with) == -1)
+ if (compatible_with != nullptr && driver_list::find(m_current_driver->compatible_with) == -1)
osd_printf_error("Driver is listed as compatible with nonexistent driver %s\n", m_current_driver->compatible_with);
// check for clone_of and compatible_with being specified at the same time
- if (m_drivlist.clone(*m_current_driver) != -1 && compatible_with != nullptr)
+ if (driver_list::clone(*m_current_driver) != -1 && compatible_with != nullptr)
osd_printf_error("Driver cannot be both a clone and listed as compatible with another system\n");
// find any recursive dependencies on the current driver
- for (int other_drv = m_drivlist.compatible_with(*m_current_driver); other_drv != -1; other_drv = m_drivlist.compatible_with(other_drv))
- if (m_current_driver == &m_drivlist.driver(other_drv))
+ for (int other_drv = driver_list::compatible_with(*m_current_driver); other_drv != -1; other_drv = driver_list::compatible_with(other_drv))
+ if (m_current_driver == &driver_list::driver(other_drv))
{
osd_printf_error("Driver is recursively compatible with itself\n");
break;
diff --git a/src/emu/video.cpp b/src/emu/video.cpp
index 727af74ea01..65ff20473c5 100644
--- a/src/emu/video.cpp
+++ b/src/emu/video.cpp
@@ -1358,8 +1358,8 @@ osd_file::error video_manager::open_next(emu_file &file, const char *extension,
int name_found = 0;
// find length of the device name
- int end1 = snapstr.find("/", pos + 3);
- int end2 = snapstr.find("%", pos + 3);
+ int end1 = snapstr.find('/', pos + 3);
+ int end2 = snapstr.find('%', pos + 3);
int end;
if ((end1 != -1) && (end2 != -1))
diff --git a/src/mame/drivers/blockade.cpp b/src/mame/drivers/blockade.cpp
index 5dcb98e9c19..423cff31072 100644
--- a/src/mame/drivers/blockade.cpp
+++ b/src/mame/drivers/blockade.cpp
@@ -415,18 +415,15 @@ DISCRETE_SOUND_END
WRITE8_MEMBER( blockade_state::sound_freq_w )
{
m_discrete->write(BLOCKADE_NOTE_DATA, data);
- return;
}
WRITE8_MEMBER( blockade_state::env_on_w )
{
m_samples->start(0, 0);
- return;
}
WRITE8_MEMBER( blockade_state::env_off_w )
{
- return;
}
const char *const blockade_sample_names[] =
diff --git a/src/mame/drivers/megatech.cpp b/src/mame/drivers/megatech.cpp
index 424dc7a08c7..11077e1cacc 100644
--- a/src/mame/drivers/megatech.cpp
+++ b/src/mame/drivers/megatech.cpp
@@ -653,23 +653,23 @@ MACHINE_RESET_MEMBER(mtech_state, megatech)
std::string region_tag;
if (m_cart1->get_rom_size() > 0)
- m_cart_reg[0] = memregion(region_tag.assign(m_cart1->tag()).append(GENERIC_ROM_REGION_TAG).c_str());
+ m_cart_reg[0] = memregion(region_tag.assign(m_cart1->tag()).append(GENERIC_ROM_REGION_TAG));
else
m_cart_reg[0] = memregion(":mt_slot1:cart");
if (m_cart2)
- m_cart_reg[1] = memregion(region_tag.assign(m_cart2->tag()).append(GENERIC_ROM_REGION_TAG).c_str());
+ m_cart_reg[1] = memregion(region_tag.assign(m_cart2->tag()).append(GENERIC_ROM_REGION_TAG));
if (m_cart3)
- m_cart_reg[2] = memregion(region_tag.assign(m_cart3->tag()).append(GENERIC_ROM_REGION_TAG).c_str());
+ m_cart_reg[2] = memregion(region_tag.assign(m_cart3->tag()).append(GENERIC_ROM_REGION_TAG));
if (m_cart4)
- m_cart_reg[3] = memregion(region_tag.assign(m_cart4->tag()).append(GENERIC_ROM_REGION_TAG).c_str());
+ m_cart_reg[3] = memregion(region_tag.assign(m_cart4->tag()).append(GENERIC_ROM_REGION_TAG));
if (m_cart5)
- m_cart_reg[4] = memregion(region_tag.assign(m_cart5->tag()).append(GENERIC_ROM_REGION_TAG).c_str());
+ m_cart_reg[4] = memregion(region_tag.assign(m_cart5->tag()).append(GENERIC_ROM_REGION_TAG));
if (m_cart6)
- m_cart_reg[5] = memregion(region_tag.assign(m_cart6->tag()).append(GENERIC_ROM_REGION_TAG).c_str());
+ m_cart_reg[5] = memregion(region_tag.assign(m_cart6->tag()).append(GENERIC_ROM_REGION_TAG));
if (m_cart7)
- m_cart_reg[6] = memregion(region_tag.assign(m_cart7->tag()).append(GENERIC_ROM_REGION_TAG).c_str());
+ m_cart_reg[6] = memregion(region_tag.assign(m_cart7->tag()).append(GENERIC_ROM_REGION_TAG));
if (m_cart8)
- m_cart_reg[7] = memregion(region_tag.assign(m_cart8->tag()).append(GENERIC_ROM_REGION_TAG).c_str());
+ m_cart_reg[7] = memregion(region_tag.assign(m_cart8->tag()).append(GENERIC_ROM_REGION_TAG));
switch_cart(0);
}
diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp
index f82a5470c29..f62a0d6bfc8 100644
--- a/src/mame/drivers/stv.cpp
+++ b/src/mame/drivers/stv.cpp
@@ -1191,19 +1191,19 @@ MACHINE_RESET_MEMBER(stv_state,stv)
std::string region_tag;
if (m_cart1)
- m_cart_reg[0] = memregion(region_tag.assign(m_cart1->tag()).append(GENERIC_ROM_REGION_TAG).c_str());
+ m_cart_reg[0] = memregion(region_tag.assign(m_cart1->tag()).append(GENERIC_ROM_REGION_TAG));
else
m_cart_reg[0] = memregion("cart");
if (m_cart2)
- m_cart_reg[1] = memregion(region_tag.assign(m_cart2->tag()).append(GENERIC_ROM_REGION_TAG).c_str());
+ m_cart_reg[1] = memregion(region_tag.assign(m_cart2->tag()).append(GENERIC_ROM_REGION_TAG));
else
m_cart_reg[1] = nullptr;
if (m_cart3)
- m_cart_reg[2] = memregion(region_tag.assign(m_cart3->tag()).append(GENERIC_ROM_REGION_TAG).c_str());
+ m_cart_reg[2] = memregion(region_tag.assign(m_cart3->tag()).append(GENERIC_ROM_REGION_TAG));
else
m_cart_reg[2] = nullptr;
if (m_cart4)
- m_cart_reg[3] = memregion(region_tag.assign(m_cart4->tag()).append(GENERIC_ROM_REGION_TAG).c_str());
+ m_cart_reg[3] = memregion(region_tag.assign(m_cart4->tag()).append(GENERIC_ROM_REGION_TAG));
else
m_cart_reg[3] = nullptr;
diff --git a/src/mame/drivers/tutor.cpp b/src/mame/drivers/tutor.cpp
index 8226690a247..6f0b572e615 100644
--- a/src/mame/drivers/tutor.cpp
+++ b/src/mame/drivers/tutor.cpp
@@ -239,7 +239,7 @@ private:
void tutor_state::machine_start()
{
std::string region_tag;
- m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str());
+ m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG));
m_tape_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tutor_state::tape_interrupt_handler),this));
diff --git a/src/mame/machine/3dom2.cpp b/src/mame/machine/3dom2.cpp
index b984da8b1ab..01dc23c1e1c 100644
--- a/src/mame/machine/3dom2.cpp
+++ b/src/mame/machine/3dom2.cpp
@@ -1514,9 +1514,9 @@ void m2_cde_device::device_start()
{
// Find our friend the BDA
m_bda = downcast<m2_bda_device *>(machine().device("bda"));
- assert(m_bda != NULL);
+ assert(m_bda != nullptr);
- if (m_bda == NULL)
+ if (m_bda == nullptr)
throw device_missing_dependencies();
// Resolve callbacks
diff --git a/src/mame/machine/esqpanel.cpp b/src/mame/machine/esqpanel.cpp
index 9fb5b1c9d38..f5df1b55e87 100644
--- a/src/mame/machine/esqpanel.cpp
+++ b/src/mame/machine/esqpanel.cpp
@@ -154,7 +154,7 @@ namespace esqpanel {
m_to_send.put(c);
const std::string &s = m_to_send.str();
- for (auto iter: m_panels)
+ for (const auto &iter: m_panels)
{
external_panel_ptr panel = iter.second;
if (panel->send_display_data())
@@ -215,7 +215,7 @@ namespace esqpanel {
}
// Echo the non-command message to any other connected panels that want it
- for (auto iter: m_panels)
+ for (const auto &iter: m_panels)
{
external_panel_ptr other_panel = iter.second;
if (other_panel != panel && (t & other_panel->send_message_types()) != 0)
diff --git a/src/mame/machine/megadriv.cpp b/src/mame/machine/megadriv.cpp
index 7dedd2caa90..285d64b44f9 100644
--- a/src/mame/machine/megadriv.cpp
+++ b/src/mame/machine/megadriv.cpp
@@ -1023,7 +1023,7 @@ void md_base_state::md2_pal(machine_config &config)
WRITE8_MEMBER(md_base_state::megadriv_tas_callback)
{
- return; // writeback not allowed
+ // writeback not allowed
}
void md_base_state::megadriv_init_common()
diff --git a/src/mame/video/3dom2_te.cpp b/src/mame/video/3dom2_te.cpp
index c41f7496e89..5b6d6b633e5 100644
--- a/src/mame/video/3dom2_te.cpp
+++ b/src/mame/video/3dom2_te.cpp
@@ -1224,9 +1224,9 @@ void m2_te_device::setup_triangle(uint32_t flags)
if ((vb.y - vc.y) < 0.0f) a |= 2;
if ((vc.y - va.y) < 0.0f) a |= 1;
- const se_vtx *v1 = NULL;
- const se_vtx *v2 = NULL;
- const se_vtx *v3 = NULL;
+ const se_vtx *v1 = nullptr;
+ const se_vtx *v2 = nullptr;
+ const se_vtx *v3 = nullptr;
switch (a)
{
diff --git a/src/mame/video/powervr2.cpp b/src/mame/video/powervr2.cpp
index a97299b6fcb..bd10a122f15 100644
--- a/src/mame/video/powervr2.cpp
+++ b/src/mame/video/powervr2.cpp
@@ -730,7 +730,7 @@ void powervr2_device::tex_get_info(texinfo *t)
// fprintf(stderr, "tex %d %d %d %d\n", t->pf, t->mode, pal_ram_ctrl, t->mipmapped);
if(!t->textured)
{
- t->r = NULL;
+ t->r = nullptr;
}
else
{