Skip to content
Snippets Groups Projects

JobOptionSvc: use stringstream to read job options file

Merged Frank Winklmeier requested to merge fwinkl/Gaudi:joparser_ubsan into master
All threads resolved!
@@ -31,7 +31,7 @@ namespace qi = boost::spirit::qi;
namespace {
// Return last line and column number of text in `s` with newline delimiter `delim`
std::pair<size_t, size_t> GetLastLineAndColumn( std::string_view s, const char delim = '\n' ) {
std::pair<int, int> GetLastLineAndColumn( std::string_view s, const char delim = '\n' ) {
size_t line = 1;
for ( size_t p = s.find( delim ); p != s.npos; p = s.find( delim ) ) {
s.remove_prefix( p + 1 );
@@ -42,9 +42,8 @@ namespace {
template <typename Grammar>
bool ParseStream( std::ifstream& stream, const std::string& stream_name, gp::Messages* messages, gp::Node* root ) {
std::ostringstream ss;
ss << stream.rdbuf();
const std::string input = ss.str();
// Load input stream
const std::string input = ( std::ostringstream{} << stream.rdbuf() ).str();
auto [last_line, last_column] = GetLastLineAndColumn( input );
Loading