summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2016-09-01 06:49:54 -0400
committer Nathan Woods <npwoods@mess.org>2016-09-01 06:49:54 -0400
commit9c06ec0b6a8c8b3cdc0a84f5cbc296747910c058 (patch)
treea012b3cbadd179922416b38d2b0ec3af05915fed
parentb60879e595edc98fb12b7990bd3b45188191bbf1 (diff)
Incorporating Vas Crabb feedback
-rw-r--r--src/lib/formats/flopimg.cpp4
-rw-r--r--src/lib/util/opresolv.cpp2
-rw-r--r--src/tools/imgtool/main.cpp7
3 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/formats/flopimg.cpp b/src/lib/formats/flopimg.cpp
index 6ffa7bd6cc2..9fb487ba971 100644
--- a/src/lib/formats/flopimg.cpp
+++ b/src/lib/formats/flopimg.cpp
@@ -224,8 +224,8 @@ floperr_t floppy_create(void *fp, const struct io_procs *procs, const struct Flo
/* if this format expects creation parameters and none were specified, create some */
if (!parameters && format->param_guidelines)
{
- alloc_resolution = std::make_unique<util::option_resolution>(floppy_option_guide);
- if (!alloc_resolution)
+ try { alloc_resolution = std::make_unique<util::option_resolution>(floppy_option_guide); }
+ catch (...)
{
err = FLOPPY_ERROR_OUTOFMEMORY;
goto done;
diff --git a/src/lib/util/opresolv.cpp b/src/lib/util/opresolv.cpp
index fa6e1fa0f28..b707508dcac 100644
--- a/src/lib/util/opresolv.cpp
+++ b/src/lib/util/opresolv.cpp
@@ -116,7 +116,7 @@ option_resolution::entry *option_resolution::find(int parameter)
auto iter = std::find_if(
m_entries.begin(),
m_entries.end(),
- [&](const entry &e) { return e.parameter() == parameter; });
+ [parameter](const entry &e) { return e.parameter() == parameter; });
return iter != m_entries.end()
? &*iter
diff --git a/src/tools/imgtool/main.cpp b/src/tools/imgtool/main.cpp
index 7e30a729619..a57e6d8154a 100644
--- a/src/tools/imgtool/main.cpp
+++ b/src/tools/imgtool/main.cpp
@@ -747,11 +747,10 @@ static void listoptions(const util::option_guide &opt_guide, const char *opt_spe
fprintf(stdout, "Option Allowed values Description\n");
fprintf(stdout, "---------------- ------------------------------ -----------\n");
-
+ std::stringstream description_buffer;
for (auto iter = resolution.entries_begin(); iter != resolution.entries_end(); iter++)
{
- const auto &entry = *iter;
- std::stringstream description_buffer;
+ const util::option_resolution::entry &entry = *iter;
std::string opt_name = string_format("--%s", entry.identifier());
const char *opt_desc = entry.display_name();
@@ -779,7 +778,7 @@ static void listoptions(const util::option_guide &opt_guide, const char *opt_spe
for (auto enum_value = entry.enum_value_begin(); enum_value != entry.enum_value_end(); enum_value++)
{
if (!description_buffer.str().empty())
- description_buffer << "/";
+ description_buffer << '/';
description_buffer << enum_value->identifier();
}
break;