Incorporating Vas Crabb feedback

This commit is contained in:
Nathan Woods 2016-09-01 06:49:54 -04:00
parent b60879e595
commit 9c06ec0b6a
3 changed files with 6 additions and 7 deletions

View File

@ -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 this format expects creation parameters and none were specified, create some */
if (!parameters && format->param_guidelines) if (!parameters && format->param_guidelines)
{ {
alloc_resolution = std::make_unique<util::option_resolution>(floppy_option_guide); try { alloc_resolution = std::make_unique<util::option_resolution>(floppy_option_guide); }
if (!alloc_resolution) catch (...)
{ {
err = FLOPPY_ERROR_OUTOFMEMORY; err = FLOPPY_ERROR_OUTOFMEMORY;
goto done; goto done;

View File

@ -116,7 +116,7 @@ option_resolution::entry *option_resolution::find(int parameter)
auto iter = std::find_if( auto iter = std::find_if(
m_entries.begin(), m_entries.begin(),
m_entries.end(), m_entries.end(),
[&](const entry &e) { return e.parameter() == parameter; }); [parameter](const entry &e) { return e.parameter() == parameter; });
return iter != m_entries.end() return iter != m_entries.end()
? &*iter ? &*iter

View File

@ -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, "Option Allowed values Description\n");
fprintf(stdout, "---------------- ------------------------------ -----------\n"); fprintf(stdout, "---------------- ------------------------------ -----------\n");
std::stringstream description_buffer;
for (auto iter = resolution.entries_begin(); iter != resolution.entries_end(); iter++) for (auto iter = resolution.entries_begin(); iter != resolution.entries_end(); iter++)
{ {
const auto &entry = *iter; const util::option_resolution::entry &entry = *iter;
std::stringstream description_buffer;
std::string opt_name = string_format("--%s", entry.identifier()); std::string opt_name = string_format("--%s", entry.identifier());
const char *opt_desc = entry.display_name(); 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++) for (auto enum_value = entry.enum_value_begin(); enum_value != entry.enum_value_end(); enum_value++)
{ {
if (!description_buffer.str().empty()) if (!description_buffer.str().empty())
description_buffer << "/"; description_buffer << '/';
description_buffer << enum_value->identifier(); description_buffer << enum_value->identifier();
} }
break; break;