From: Bert Vermeulen Date: Sat, 2 Aug 2014 01:43:53 +0000 (+0200) Subject: Handle floating point options for output modules. X-Git-Tag: sigrok-cli-0.6.0~82 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a30daa0376eab28fb655a3a5a3d6716426877b77;p=sigrok-cli.git Handle floating point options for output modules. --- diff --git a/session.c b/session.c index 6465055..46bb4d9 100644 --- a/session.c +++ b/session.c @@ -87,9 +87,12 @@ GHashTable *generic_arg_to_opt(const struct sr_option *opts, GHashTable *genargs gvar = g_variant_new_uint32(strtoul(s, NULL, 10)); g_hash_table_insert(hash, g_strdup(opt->id), g_variant_ref_sink(gvar)); + } else if (g_variant_is_of_type(opt->def, G_VARIANT_TYPE_DOUBLE)) { + gvar = g_variant_new_double(strtod(s, NULL)); + g_hash_table_insert(hash, g_strdup(opt->id), + g_variant_ref_sink(gvar)); } else { - g_critical("Don't know how to convert option '%s' to %s!", - opt->id, g_variant_get_type_string(opt->def)); + g_critical("Don't know GVariant type for option '%s'!", opt->id); } }