input/csv: Correctly skip over last processed end-of-line sequence
The CSV input module supports variable length end-of-line encodings (either CRLF, or CR, or LF). When a bunch of accumulated text lines got processed, do skip the corresponding number of characters after the end of the last processed line. This fixes one of the issues discussed in bug #635.
This commit is contained in:
parent
4555d3bda0
commit
241c386a4f
|
@ -657,6 +657,7 @@ static int process_buffer(struct sr_input *in)
|
|||
if (!p)
|
||||
return SR_ERR;
|
||||
*p = '\0';
|
||||
p += strlen(inc->termination);
|
||||
g_strstrip(in->buf->str);
|
||||
|
||||
ret = SR_OK;
|
||||
|
@ -725,7 +726,7 @@ static int process_buffer(struct sr_input *in)
|
|||
g_strfreev(columns);
|
||||
}
|
||||
g_strfreev(lines);
|
||||
g_string_erase(in->buf, 0, p - in->buf->str + 1);
|
||||
g_string_erase(in->buf, 0, p - in->buf->str);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue