From 3a8a8b29a25f295a25c0dea99311ca4cc61bc57a Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 14 Apr 2022 18:06:04 -0700 Subject: [PATCH] std::pair conversion Signed-off-by: Rosen Penev --- app/exiv2.cpp | 5 +++-- app/exiv2app.hpp | 6 +----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/exiv2.cpp b/app/exiv2.cpp index 126ca154..d30cfcb5 100644 --- a/app/exiv2.cpp +++ b/app/exiv2.cpp @@ -1437,9 +1437,10 @@ bool parseLine(ModifyCmd& modifyCmd, const std::string& line, int num) { CmdId commandId(const std::string& cmdString) { int i = 0; - for (; cmdIdAndString[i].cmdId_ != invalidCmdId && cmdIdAndString[i].cmdString_ != cmdString; ++i) { + while (cmdIdAndString[i].first != invalidCmdId && cmdIdAndString[i].second != cmdString) { + ++i; } - return cmdIdAndString[i].cmdId_; + return cmdIdAndString[i].first; } std::string parseEscapes(const std::string& input) { diff --git a/app/exiv2app.hpp b/app/exiv2app.hpp index 1f1fd2a4..f93db850 100644 --- a/app/exiv2app.hpp +++ b/app/exiv2app.hpp @@ -51,11 +51,7 @@ struct ModifyCmd { //! Container for modification commands using ModifyCmds = std::vector; //! Structure to link command identifiers to strings -struct CmdIdAndString { - CmdId cmdId_; //!< Commands identifier - std::string cmdString_; //!< Command string -}; - +using CmdIdAndString = std::pair; /*! @brief Implements the command line handling for the program.