1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-28 19:21:04 +00:00

Merge branch 'OpenCS-no-charconv' into 'master'

OpenCS - Avoid the inclusion of charconv header

See merge request OpenMW/openmw!1087
This commit is contained in:
psi29a 2021-08-03 23:32:40 +00:00
commit 9fa7521fc5
2 changed files with 4 additions and 11 deletions

View File

@ -1,7 +1,5 @@
#include "refcollection.hpp"
#include <charconv>
#include <components/esm/loadcell.hpp>
#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<unsigned int>(std::stoi(std::string(id.substr(separator+1))));
}
int CSMWorld::RefCollection::getIntIndex (unsigned int id) const

View File

@ -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()));