X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Finput%2Fcsv.c;h=e3da2bce5182f1dc6a6faf657e2e52fc7e54d35f;hb=0d0170ae9e4743e3918a3c9709c026f93d714a4f;hp=ece68a98102ccfe670d14660f84a5b72711bc218;hpb=41d214f61a1683fca49b9dc687045afc2ce42007;p=libsigrok.git diff --git a/src/input/csv.c b/src/input/csv.c index ece68a98..e3da2bce 100644 --- a/src/input/csv.c +++ b/src/input/csv.c @@ -138,9 +138,9 @@ static int format_match(GHashTable *metadata) buf = g_hash_table_lookup(metadata, GINT_TO_POINTER(SR_INPUT_META_MIMETYPE)); if (!strcmp(buf, "text/csv")) - return TRUE; + return SR_OK; - return FALSE; + return SR_ERR; } static void strip_comment(char *buf, const GString *prefix) @@ -429,11 +429,7 @@ static int init(struct sr_input *in, GHashTable *options) g_string_truncate(inc->comment, 0); } - s = g_variant_get_string(g_hash_table_lookup(options, "samplerate"), NULL); - if (sr_parse_sizestring(s, &inc->samplerate) != SR_OK) { - sr_err("Invalid samplerate '%s'.", s); - return SR_ERR_ARG; - } + inc->samplerate = g_variant_get_uint64(g_hash_table_lookup(options, "samplerate")); inc->first_channel = g_variant_get_int32(g_hash_table_lookup(options, "first-channel")); @@ -767,7 +763,7 @@ static struct sr_option options[] = { { "first-channel", "First channel", "Column number of first channel", NULL, NULL }, { "header", "Header", "Treat first line as header with channel names", NULL, NULL }, { "startline", "Start line", "Line number at which to start processing samples", NULL, NULL }, - { 0 } + ALL_ZERO }; static struct sr_option *get_options(void) @@ -778,7 +774,7 @@ static struct sr_option *get_options(void) options[2].def = g_variant_ref_sink(g_variant_new_string(",")); options[3].def = g_variant_ref_sink(g_variant_new_string("bin")); options[4].def = g_variant_ref_sink(g_variant_new_string(";")); - options[5].def = g_variant_ref_sink(g_variant_new_string("0")); + options[5].def = g_variant_ref_sink(g_variant_new_uint64(0)); options[6].def = g_variant_ref_sink(g_variant_new_int32(0)); options[7].def = g_variant_ref_sink(g_variant_new_boolean(FALSE)); options[8].def = g_variant_ref_sink(g_variant_new_int32(1));