From d7bf72634e18b2baf14570c6fcf3e294259a657d Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 11 Feb 2023 18:09:30 -0800 Subject: [PATCH] use std::replace shorter Signed-off-by: Rosen Penev --- src/pentaxmn_int.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/pentaxmn_int.cpp b/src/pentaxmn_int.cpp index 88cb7e8c..ab3942a8 100644 --- a/src/pentaxmn_int.cpp +++ b/src/pentaxmn_int.cpp @@ -892,20 +892,14 @@ constexpr TagDetails pentaxHighISONoiseReduction[] = { std::ostream& PentaxMakerNote::printVersion(std::ostream& os, const Value& value, const ExifData*) { std::string val = value.toString(); - size_t i = 0; - while ((i = val.find(' ', i)) != std::string::npos && i != val.length() - 1) { - val.replace(i, 1, "."); - } + std::replace(val.begin(), val.end(), ' ', '.'); os << val; return os; } std::ostream& PentaxMakerNote::printResolution(std::ostream& os, const Value& value, const ExifData*) { std::string val = value.toString(); - size_t i = 0; - while ((i = val.find(' ', i)) != std::string::npos && i != val.length() - 1) { - val.replace(i, 1, "x"); - } + std::replace(val.begin(), val.end(), ' ', 'x'); os << val; return os; }