From ef0748d81d7f13a753de3bcb028847c52c90eab0 Mon Sep 17 00:00:00 2001 From: Christopher Mosher Date: Sat, 2 Feb 2019 23:16:49 -0500 Subject: [PATCH] remove std::transform (too new) --- src/configep2.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/configep2.cpp b/src/configep2.cpp index 470a84a..0904b6f 100644 --- a/src/configep2.cpp +++ b/src/configep2.cpp @@ -36,6 +36,8 @@ #include #include #include +#include + #define K 1024u @@ -195,6 +197,13 @@ void Config::parseLine(const std::string& line, MemoryRandomAccess& ram, Memory& } } +static std::string filter_row(const std::string &row) { + if (row.length() != 1) { + return ""; + } + return std::string(1, static_cast(std::toupper(row[0]))); +} + void Config::tryParseLine(const std::string& line, MemoryRandomAccess& ram, Memory& rom, Slots& slts, int& revision, ScreenImage& gui, CassetteIn& cassetteIn, CassetteOut& cassetteOut) { std::istringstream tok(line); @@ -220,7 +229,7 @@ void Config::tryParseLine(const std::string& line, MemoryRandomAccess& ram, Memo */ std::string row; tok >> row; - std::transform(row.begin(), row.end(), row.begin(), ::toupper); + row = filter_row(row); if (row != "C" && row != "D" && row != "E") { throw ConfigException("expected row to be C, D, or E"); } @@ -248,7 +257,7 @@ void Config::tryParseLine(const std::string& line, MemoryRandomAccess& ram, Memo */ std::string row; tok >> row; - std::transform(row.begin(), row.end(), row.begin(), ::toupper); + row = filter_row(row); if (row != "C" && row != "D" && row != "E") { throw ConfigException("expected row to be C, D, or E"); }