X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Finput%2Fcsv.c;h=88c49c43f19456df83dac61a85e118fc18c2233c;hb=ef0b9935cf1b133910d9b02e1ee3b798804716c6;hp=4fc35adbc0997cc8e4ad7c30bf3c71c3a979158e;hpb=836fac9cf6622112f6c167aa5826a68d20f4977f;p=libsigrok.git diff --git a/src/input/csv.c b/src/input/csv.c index 4fc35adb..88c49c43 100644 --- a/src/input/csv.c +++ b/src/input/csv.c @@ -685,7 +685,10 @@ static int initial_parse(const struct sr_input *in, GString *buf) columns = NULL; line_number = 0; - lines = g_strsplit_set(buf->str, delim_set, 0); + if (inc->termination) + lines = g_strsplit(buf->str, inc->termination, 0); + else + lines = g_strsplit_set(buf->str, delim_set, 0); for (line_idx = 0; (line = lines[line_idx]); line_idx++) { line_number++; if (inc->start_line > line_number) { @@ -914,9 +917,13 @@ static int process_buffer(struct sr_input *in, gboolean is_eof) g_strstrip(in->buf->str); ret = SR_OK; - lines = g_strsplit_set(in->buf->str, delim_set, 0); + lines = g_strsplit(in->buf->str, inc->termination, 0); for (line_idx = 0; (line = lines[line_idx]); line_idx++) { inc->line_number++; + if (inc->line_number < inc->start_line) { + sr_spew("Line %zu skipped (before start).", inc->line_number); + continue; + } if (line[0] == '\0') { sr_spew("Blank line %zu skipped.", inc->line_number); continue;