summaryrefslogtreecommitdiffstatshomepage
path: root/src/tools
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2015-12-04 10:29:21 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2015-12-04 10:29:21 +0100
commit1b0ec08af5cd3b3268b5889ba4e30409431434e2 (patch)
tree42c510afaaeb15e1f97eff044a4d295586c30aaa /src/tools
parent5a2f80dcde2e76356bf568f1e2d71b054a7db45b (diff)
clang-modernize part 6
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/chdman.cpp24
-rw-r--r--src/tools/src2html.cpp6
2 files changed, 15 insertions, 15 deletions
diff --git a/src/tools/chdman.cpp b/src/tools/chdman.cpp
index 691fc71b47b..91e40c51b5b 100644
--- a/src/tools/chdman.cpp
+++ b/src/tools/chdman.cpp
@@ -772,9 +772,9 @@ static int print_help(const char *argv0, const char *error = nullptr)
// print a summary of each command
printf("Usage:\n");
- for (int cmdnum = 0; cmdnum < ARRAY_LENGTH(s_commands); cmdnum++)
+ for (auto & desc : s_commands)
{
- const command_description &desc = s_commands[cmdnum];
+
printf(" %s %s%s\n", argv0, desc.name, desc.description);
}
printf("\nFor help with any command, run:\n");
@@ -808,10 +808,10 @@ static int print_help(const char *argv0, const command_description &desc, const
option++;
// find the option
- for (int optnum = 0; optnum < ARRAY_LENGTH(s_options); optnum++)
- if (strcmp(option, s_options[optnum].name) == 0)
+ for (auto & s_option : s_options)
+ if (strcmp(option, s_option.name) == 0)
{
- const option_description &odesc = s_options[optnum];
+ const option_description &odesc = s_option;
printf(" --%s", odesc.name);
if (odesc.shortname != nullptr)
printf(", -%s", odesc.shortname);
@@ -1391,10 +1391,10 @@ static void do_info(parameters_t &params)
// determine our index
UINT32 metaindex = ~0;
- for (unsigned int cur = 0; cur < info.size(); cur++)
- if (info[cur].tag == metatag)
+ for (auto & elem : info)
+ if (elem.tag == metatag)
{
- metaindex = ++info[cur].index;
+ metaindex = ++elem.index;
break;
}
@@ -2858,10 +2858,10 @@ int CLIB_DECL main(int argc, char *argv[])
}
// iterate over commands to find our match
- for (int cmdnum = 0; cmdnum < ARRAY_LENGTH(s_commands); cmdnum++)
- if (strcmp(command, s_commands[cmdnum].name) == 0)
+ for (auto & s_command : s_commands)
+ if (strcmp(command, s_command.name) == 0)
{
- const command_description &desc = s_commands[cmdnum];
+ const command_description &desc = s_command;
// print help if that was requested
if (help)
@@ -2933,7 +2933,7 @@ int CLIB_DECL main(int argc, char *argv[])
// all clear, run the command
try
{
- (*s_commands[cmdnum].handler)(parameters);
+ (*s_command.handler)(parameters);
return 0;
}
catch (chd_error &err)
diff --git a/src/tools/src2html.cpp b/src/tools/src2html.cpp
index 62eefb4da56..e5d2f8f496c 100644
--- a/src/tools/src2html.cpp
+++ b/src/tools/src2html.cpp
@@ -410,10 +410,10 @@ static int recurse_dir(int srcrootlen, int dstrootlen, std::string &srcdir, std:
{
// make sure we care, first
file_type type = FILE_TYPE_INVALID;
- for (int extnum = 0; extnum < ARRAY_LENGTH(extension_lookup); extnum++)
- if (core_filename_ends_with(curlist->name.c_str(), extension_lookup[extnum].extension))
+ for (auto & elem : extension_lookup)
+ if (core_filename_ends_with(curlist->name.c_str(), elem.extension))
{
- type = extension_lookup[extnum].type;
+ type = elem.type;
break;
}