diff --git a/src/cmd/netrcparser.cpp b/src/cmd/netrcparser.cpp index 266fe4f3e29fa..15417e1343883 100644 --- a/src/cmd/netrcparser.cpp +++ b/src/cmd/netrcparser.cpp @@ -14,8 +14,7 @@ #include #include -#include -#include +#include #include @@ -58,32 +57,33 @@ bool NetrcParser::parse() } QString content = netrc.readAll(); - auto tokenizer = QStringTokenizer{content, u" \n\t"}; + auto tokens = content.split(QRegularExpression("\\s+")); LoginPair pair; QString machine; bool isDefault = false; - for(auto itToken = tokenizer.cbegin(); itToken != tokenizer.cend(); ++itToken) { - const auto key = *itToken; + for(int i=0; i tokens.count()) { qDebug() << "error fetching value for" << key; return false; } - auto value = *(++itToken); + auto value = tokens[i]; if (key == machineKeyword) { tryAddEntryAndClear(machine, pair, isDefault); - machine = value.toString(); + machine = value; } else if (key == loginKeyword) { - pair.first = value.toString(); + pair.first = value; } else if (key == passwordKeyword) { - pair.second = value.toString(); + pair.second = value; } // ignore unsupported tokens } tryAddEntryAndClear(machine, pair, isDefault);