Skip to content
Snippets Groups Projects
Commit 111f2903 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[BL] Add to string conversion for iostate

The debug output with boolean conversion is incorrect with newer compiler/stdlib versions.
It seems the iostate became a new type and is no longer an unsigned int.
parent dc7d929a
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@
#include "PrjProcessing.h"
#include <fmt/core.h>
#include <libxml/globals.h>
#include <libxml/parser.h>
#include <libxml/xmlstring.h>
......@@ -24,6 +25,40 @@
#include "FileTools.h"
#include "Logging.h"
namespace
{
std::string iostateToString(std::ios_base::iostate const state)
{
std::string result;
if (state == std::ios_base::goodbit)
{
result = "goodbit";
}
else
{
if (state & std::ios_base::eofbit)
{
result += "eofbit ";
}
if (state & std::ios_base::failbit)
{
result += "failbit ";
}
if (state & std::ios_base::badbit)
{
result += "badbit";
}
// Remove trailing space if there is one
if (!result.empty() && result.back() == ' ')
{
result.pop_back();
}
}
return result;
}
} // namespace
namespace BaseLib
{
void traverseIncludes(xmlDoc* doc, xmlNode* node,
......@@ -274,7 +309,7 @@ void readAndPatchPrj(std::stringstream& prj_stream, std::string& prj_file,
{
ERR("File {:s} does not exist.", prj_file);
}
DBUG("Stream state flags: {:b}.", file.rdstate());
DBUG("Stream state flags: {:s}.", iostateToString(file.rdstate()));
OGS_FATAL("Could not open project file '{:s}' for reading.", prj_file);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment