fix for getline usage with newer compilers

This commit is contained in:
john30
2016-05-15 17:18:57 +02:00
parent f873c2ee39
commit 8864ce55b8
3 changed files with 13 additions and 13 deletions
+3 -3
View File
@@ -199,7 +199,7 @@ string MainLoop::decodeMessage(const string& data, const bool isHttp, bool& conn
bool escaped = false;
char delim = ' ';
while (getline(stream, token, delim) != 0) {
while (getline(stream, token, delim)) {
if (!isHttp) {
if (escaped) {
args.pop_back();
@@ -742,7 +742,7 @@ string MainLoop::executeFind(vector<string> &args)
}
istringstream input(args[argPos]);
string column;
while (getline(input, column, ',') != 0) {
while (getline(input, column, ',')) {
size_t idx = columnCount;
for (size_t i = 0; i < columnCount; i++) {
if (strcasecmp(columnNames[i], column.c_str()) == 0) {
@@ -1170,7 +1170,7 @@ string MainLoop::executeGet(vector<string> &args, bool& connected)
string query = args[argPos++];
istringstream stream(query);
string token;
while (getline(stream, token, '&') != 0) {
while (getline(stream, token, '&')) {
pos = token.find('=');
string qname, value;
if (pos != string::npos) {
+5 -5
View File
@@ -271,7 +271,7 @@ result_t DataField::create(vector<string>::iterator& it,
divisor = parseSignedInt(divisorStr.c_str(), 10, -MAX_DIVISOR, MAX_DIVISOR, result);
else {
istringstream stream(divisorStr);
while (getline(stream, token, VALUE_SEPARATOR) != 0) {
while (getline(stream, token, VALUE_SEPARATOR)) {
FileReader::trim(token);
const char* str = token.c_str();
char* strEnd = NULL;
@@ -324,7 +324,7 @@ result_t DataField::create(vector<string>::iterator& it,
bool firstType = true;
istringstream stream(typeStr);
while (result == RESULT_OK && getline(stream, token, VALUE_SEPARATOR) != 0) {
while (result == RESULT_OK && getline(stream, token, VALUE_SEPARATOR)) {
FileReader::trim(token);
DataField* templ = templates->get(token);
unsigned char length;
@@ -798,7 +798,7 @@ result_t StringDataField::writeSymbols(istringstream& input,
case bt_dat:
if (m_length == 4 && i == 2)
continue; // skip weekday in between
if (input.eof() || getline(input, token, '.') == 0)
if (input.eof() || !getline(input, token, '.'))
return RESULT_ERR_EOF; // incomplete
if ((m_dataType.flags & REQ) == 0 && strcmp(token.c_str(), NULL_VALUE) == 0) {
value = m_dataType.replacement;
@@ -829,7 +829,7 @@ result_t StringDataField::writeSymbols(istringstream& input,
return RESULT_ERR_OUT_OF_RANGE; // invalid date part
break;
case bt_tim:
if (input.eof() || getline(input, token, LENGTH_SEPARATOR) == 0)
if (input.eof() || !getline(input, token, LENGTH_SEPARATOR))
return RESULT_ERR_EOF; // incomplete
if ((m_dataType.flags & REQ) == 0 && strcmp(token.c_str(), NULL_VALUE) == 0) {
value = m_dataType.replacement;
@@ -1629,7 +1629,7 @@ result_t DataFieldSet::write(istringstream& input,
if (m_fields.size() > 1) {
if (field->isIgnored())
token.clear();
else if (getline(input, token, separator) == 0)
else if (!getline(input, token, separator))
token.clear();
istringstream single(token);
+5 -5
View File
@@ -231,7 +231,7 @@ result_t Message::create(vector<string>::iterator& it, const vector<string>::ite
istringstream stream(str);
string token;
bool first = true;
while (getline(stream, token, VALUE_SEPARATOR) != 0) {
while (getline(stream, token, VALUE_SEPARATOR)) {
FileReader::trim(token);
unsigned char dstAddress = (unsigned char)parseInt(token.c_str(), 16, 0, 0xff, result);
if (result != RESULT_OK)
@@ -275,7 +275,7 @@ result_t Message::create(vector<string>::iterator& it, const vector<string>::ite
size_t chainLength = 16;
size_t chainPrefixLength = id.size();
bool first = true, lastChainLengthSpecified = false;
while (getline(stream, token, VALUE_SEPARATOR) != 0 || first) {
while (getline(stream, token, VALUE_SEPARATOR) || first) {
FileReader::trim(token);
token = defaultIdPrefix+token;
size_t lengthPos = token.find(LENGTH_SEPARATOR);
@@ -984,7 +984,7 @@ result_t splitValues(string valueList, vector<string>& values)
{
istringstream stream(valueList);
string str;
while (getline(stream, str, VALUE_SEPARATOR) != 0) {
while (getline(stream, str, VALUE_SEPARATOR)) {
if (str.length()>0 && str[0]=='\'' && str[str.length()-1]=='\'') {
str = str.substr(1, str.length()-2);
}
@@ -1003,7 +1003,7 @@ result_t splitValues(string valueList, vector<unsigned int>& valueRanges)
istringstream stream(valueList);
string str;
result_t result;
while (getline(stream, str, VALUE_SEPARATOR) != 0) {
while (getline(stream, str, VALUE_SEPARATOR)) {
FileReader::trim(str);
if (str.length()==0)
return RESULT_ERR_INVALID_ARG;
@@ -1533,7 +1533,7 @@ result_t MessageMap::addFromFile(vector<string>::iterator& begin, const vector<s
istringstream stream(types);
string type;
vector<Message*> messages;
while (getline(stream, type, VALUE_SEPARATOR) != 0) {
while (getline(stream, type, VALUE_SEPARATOR)) {
FileReader::trim(type);
*restart = type;
begin = restart;