diff options
| author | 2024-02-10 06:39:43 +1100 | |
|---|---|---|
| committer | 2024-02-10 06:39:43 +1100 | |
| commit | 1b43d174254d8210ed371e11c05b8aad860c2adf (patch) | |
| tree | c971e1bec66bad4646bba6d6d7220c10729c1386 /src/tools/chdman.cpp | |
| parent | 5731492874513cfcd204aae6735cf70db4d6b6e0 (diff) | |
tools/chdman.cpp: Helps to git add everything (fixes variable scoping issue).
Diffstat (limited to 'src/tools/chdman.cpp')
| -rw-r--r-- | src/tools/chdman.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/tools/chdman.cpp b/src/tools/chdman.cpp index c410f371a7e..fbc67e8bd3f 100644 --- a/src/tools/chdman.cpp +++ b/src/tools/chdman.cpp @@ -1936,18 +1936,19 @@ static void do_create_hd(parameters_map ¶ms) uint32_t sectors = 0; uint32_t sector_size = output_parent.opened() ? output_parent.unit_bytes() : IDE_SECTOR_SIZE; const auto template_str = params.find(OPTION_TEMPLATE); + uint32_t template_id; if (template_str != params.end()) { if (output_parent.opened()) report_error(1, "Template cannot be used when a parent CHD is supplied"); - const uint32_t id = parse_number(template_str->second->c_str()); - if (id >= std::size(s_hd_templates)) + template_id = parse_number(template_str->second->c_str()); + if (template_id >= std::size(s_hd_templates)) report_error(1, "Template '%s' is invalid\n", *template_str->second); - cylinders = s_hd_templates[id].cylinders; - heads = s_hd_templates[id].heads; - sectors = s_hd_templates[id].sectors; - sector_size = s_hd_templates[id].sector_size; + cylinders = s_hd_templates[template_id].cylinders; + heads = s_hd_templates[template_id].heads; + sectors = s_hd_templates[template_id].sectors; + sector_size = s_hd_templates[template_id].sector_size; } // process CHS @@ -2072,7 +2073,7 @@ static void do_create_hd(parameters_map ¶ms) } util::stream_format(std::cout, "Compression: %s\n", compression_string(compression)); if (template_str != params.end()) - util::stream_format(std::cout, "Template: %s %s\n", s_hd_templates[id].manufacturer, s_hd_templates[id].model); + util::stream_format(std::cout, "Template: %s %s\n", s_hd_templates[template_id].manufacturer, s_hd_templates[template_id].model); util::stream_format(std::cout, "Cylinders: %u\n", cylinders); util::stream_format(std::cout, "Heads: %u\n", heads); util::stream_format(std::cout, "Sectors: %u\n", sectors); |
