X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Finput%2Fcsv.c;h=49bd73c8739623eaa3cedb93622666aa1bb6f861;hb=6508992d04bf972ae98b8c7e97201c5164501687;hp=5b5a8f31682ed2a404590de48abdd0c091ec1175;hpb=18078d0532d3daa013ad712356d93c28e1ae64fd;p=libsigrok.git diff --git a/src/input/csv.c b/src/input/csv.c index 5b5a8f31..49bd73c8 100644 --- a/src/input/csv.c +++ b/src/input/csv.c @@ -557,7 +557,7 @@ static int initial_parse(const struct sr_input *in, GString *buf) if (inc->header && inc->multi_column_mode && strlen(columns[i])) g_string_assign(channel_name, columns[i]); else - g_string_printf(channel_name, "%lu", i); + g_string_printf(channel_name, "%zu", i); ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, channel_name->str); in->sdi->channels = g_slist_append(in->sdi->channels, ch); } @@ -667,6 +667,13 @@ static int process_buffer(struct sr_input *in) continue; } + /* Skip the header line, its content was used as the channel names. */ + if (inc->header) { + sr_spew("Header line %zu skipped.", inc->line_number); + inc->header = FALSE; + continue; + } + if (!(columns = parse_line(lines[l], inc, max_columns))) { sr_err("Error while parsing line %zu.", inc->line_number); return SR_ERR;