diff --git a/apps/opencs/model/world/refcollection.cpp b/apps/opencs/model/world/refcollection.cpp index 1f6fc76c4d..4782bde6b9 100644 --- a/apps/opencs/model/world/refcollection.cpp +++ b/apps/opencs/model/world/refcollection.cpp @@ -1,7 +1,5 @@ #include "refcollection.hpp" -#include - #include #include "ref.hpp" @@ -185,17 +183,12 @@ std::string CSMWorld::RefCollection::getNewId() unsigned int CSMWorld::RefCollection::extractIdNum(std::string_view id) const { - const auto separator = id.find_last_of('#'); + std::string::size_type separator = id.find_last_of('#'); - if (separator == std::string_view::npos) + if (separator == std::string::npos) throw std::runtime_error("invalid ref ID: " + std::string(id)); - const std::string_view number = id.substr(separator + 1); - unsigned int result; - if (std::from_chars(number.data(), number.data() + number.size(), result).ec != std::errc()) - throw std::runtime_error("invalid ref ID number: " + std::string(number)); - - return result; + return static_cast(std::stoi(std::string(id.substr(separator+1)))); } int CSMWorld::RefCollection::getIntIndex (unsigned int id) const diff --git a/apps/opencs/view/doc/loader.cpp b/apps/opencs/view/doc/loader.cpp index 7929b13f6c..2420b87c6c 100644 --- a/apps/opencs/view/doc/loader.cpp +++ b/apps/opencs/view/doc/loader.cpp @@ -17,7 +17,7 @@ void CSVDoc::LoadingDocument::closeEvent (QCloseEvent *event) } CSVDoc::LoadingDocument::LoadingDocument (CSMDoc::Document *document) -: mDocument (document), mAborted (false), mMessages (nullptr), mRecordsLabel (0), mTotalRecordsLabel (0) +: mDocument (document), mTotalRecordsLabel (0), mRecordsLabel (0), mAborted (false), mMessages (nullptr), mRecords(0) { setWindowTitle (QString::fromUtf8((std::string("Opening ") + document->getSavePath().filename().string()).c_str()));