Attempt to fix MSVC compile issue

This commit is contained in:
Daniel Marjamäki 2019-02-01 00:09:07 +01:00
parent 98fc6d1d32
commit 8925299947
1 changed files with 6 additions and 1 deletions

View File

@ -899,11 +899,16 @@ static const char ToolsElementName[] = "tools";
static const char TagsElementName[] = "tags"; static const char TagsElementName[] = "tags";
static const char TagElementName[] = "tag"; static const char TagElementName[] = "tag";
static std::string istream_to_string(std::istream &istr)
{
std::istreambuf_iterator<char> eos;
return std::string(std::istreambuf_iterator<char>(istr), eos);
}
bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings *settings) bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings *settings)
{ {
tinyxml2::XMLDocument doc; tinyxml2::XMLDocument doc;
const std::string xmldata(std::istreambuf_iterator<char>(istr), {}); const std::string xmldata = istream_to_string(istr);
if (doc.Parse(xmldata.data(), xmldata.size()) != tinyxml2::XML_SUCCESS) if (doc.Parse(xmldata.data(), xmldata.size()) != tinyxml2::XML_SUCCESS)
return false; return false;
const tinyxml2::XMLElement * const rootnode = doc.FirstChildElement(); const tinyxml2::XMLElement * const rootnode = doc.FirstChildElement();