diff --git a/app/actions.cpp b/app/actions.cpp index 6b67bcb4ab..56ba832b5f 100644 --- a/app/actions.cpp +++ b/app/actions.cpp @@ -1864,7 +1864,7 @@ int renameFile(std::string& newPath, const tm* tm) { std::cout << Params::instance().progname() << ": " << _("File") << " `" << newPath << "' " << _("exists. [O]verwrite, [r]ename or [s]kip?") << " "; std::cin >> s; - switch (s.at(0)) { + switch (s.front()) { case 'o': case 'O': go = false; @@ -1915,7 +1915,7 @@ int dontOverwrite(const std::string& path) { std::cout << Params::instance().progname() << ": " << _("Overwrite") << " `" << path << "'? "; std::string s; std::cin >> s; - if (s.at(0) != 'y' && s.at(0) != 'Y') + if (s.front() != 'y' && s.front() != 'Y') return 1; } return 0; diff --git a/samples/iptctest.cpp b/samples/iptctest.cpp index 3a1b872e09..92c1fb1bc7 100644 --- a/samples/iptctest.cpp +++ b/samples/iptctest.cpp @@ -46,7 +46,7 @@ int main(int argc, char* const argv[]) { } bool processLine(const std::string& line, int num, IptcData& iptcData) { - switch (line.at(0)) { + switch (line.front()) { case 'a': case 'A': processAdd(line, num, iptcData); @@ -64,7 +64,7 @@ bool processLine(const std::string& line, int num, IptcData& iptcData) { return false; default: std::ostringstream os; - os << "Unknown command (" << line.at(0) << ") at line " << num; + os << "Unknown command (" << line.front() << ") at line " << num; throw Error(ErrorCode::kerErrorMessage, os.str()); } return true; @@ -86,7 +86,7 @@ void processAdd(const std::string& line, int num, IptcData& iptcData) { std::string data(line.substr(dataStart)); // if data starts and ends with quotes, remove them - if (data.at(0) == '\"' && data.at(data.size() - 1) == '\"') { + if (data.front() == '\"' && data.back() == '\"') { data = data.substr(1, data.size() - 2); } TypeId type = IptcDataSets::dataSetType(iptcKey.tag(), iptcKey.record()); @@ -133,7 +133,7 @@ void processModify(const std::string& line, int num, IptcData& iptcData) { std::string data(line.substr(dataStart)); // if data starts and ends with quotes, remove them - if (data.at(0) == '\"' && data.at(data.size() - 1) == '\"') { + if (data.front() == '\"' && data.back() == '\"') { data = data.substr(1, data.size() - 2); } TypeId type = IptcDataSets::dataSetType(iptcKey.tag(), iptcKey.record()); diff --git a/src/basicio.cpp b/src/basicio.cpp index 8d92d9c90d..a69b43c0a2 100644 --- a/src/basicio.cpp +++ b/src/basicio.cpp @@ -136,12 +136,12 @@ int FileIo::Impl::switchMode(OpMode opMode) { case opRead: // Flush if current mode allows reading, else reopen (in mode "r+b" // as in this case we know that we can write to the file) - if (openMode_.at(0) == 'r' || openMode_.at(1) == '+') + if (openMode_.front() == 'r' || openMode_.at(1) == '+') reopen = false; break; case opWrite: // Flush if current mode allows writing, else reopen - if (openMode_.at(0) != 'r' || openMode_.at(1) == '+') + if (openMode_.front() != 'r' || openMode_.at(1) == '+') reopen = false; break; case opSeek: @@ -499,7 +499,7 @@ size_t FileIo::tell() const { size_t FileIo::size() const { // Flush and commit only if the file is open for writing - if (p_->fp_ && (p_->openMode_.at(0) != 'r' || p_->openMode_.at(1) == '+')) { + if (p_->fp_ && (p_->openMode_.front() != 'r' || p_->openMode_.at(1) == '+')) { std::fflush(p_->fp_); #ifdef _MSC_VER // This is required on msvcrt before stat after writing to a file diff --git a/src/sigmamn_int.cpp b/src/sigmamn_int.cpp index 69d8ea8546..c7d3b7d7d9 100644 --- a/src/sigmamn_int.cpp +++ b/src/sigmamn_int.cpp @@ -82,7 +82,7 @@ std::ostream& SigmaMakerNote::printStripLabel(std::ostream& os, const Value& val } std::ostream& SigmaMakerNote::print0x0008(std::ostream& os, const Value& value, const ExifData*) { - switch (value.toString().at(0)) { + switch (value.toString().front()) { case 'P': os << _("Program"); break; @@ -103,7 +103,7 @@ std::ostream& SigmaMakerNote::print0x0008(std::ostream& os, const Value& value, } std::ostream& SigmaMakerNote::print0x0009(std::ostream& os, const Value& value, const ExifData*) { - switch (value.toString().at(0)) { + switch (value.toString().front()) { case 'A': os << _("Average"); break; diff --git a/src/tiffvisitor_int.cpp b/src/tiffvisitor_int.cpp index c880eb1bb0..15263dd794 100644 --- a/src/tiffvisitor_int.cpp +++ b/src/tiffvisitor_int.cpp @@ -357,7 +357,7 @@ void TiffDecoder::decodeCanonAFInfo(const TiffEntryBase* object) { uint.push_back(static_cast(object->pValue()->toInt64(i))); } // Check this is AFInfo2 (ints[0] = bytes in object) - if (ints.at(0) != static_cast(object->pValue()->count()) * 2) + if (ints.front() != static_cast(object->pValue()->count()) * 2) return; std::string familyGroup(std::string("Exif.") + groupName(object->group()) + ".");