]> sigrok.org Git - sigrok-cli.git/commitdiff
sigrok-cli: Allow both hex and decimals parameters
authorMatt Ranostay <redacted>
Wed, 11 Sep 2013 05:38:05 +0000 (22:38 -0700)
committerBert Vermeulen <redacted>
Wed, 11 Sep 2013 07:48:06 +0000 (09:48 +0200)
When strtoll() base parameter is set to 0 it can handle both hex and
decimals values.

Signed-off-by: Matt Ranostay <redacted>
sigrok-cli.c

index 8521b9546128d17ff2c4f5fa5cae259d7d41d1a8..0a5a795878c63b0a0bf8cf4e6c25f5635d57f3b8 100644 (file)
@@ -977,7 +977,7 @@ static int opts_to_gvar(struct srd_decoder *dec, GHashTable *hash,
                if (g_variant_is_of_type(o->def, G_VARIANT_TYPE_STRING)) {
                        gvar = g_variant_new_string(val_str);
                } else if (g_variant_is_of_type(o->def, G_VARIANT_TYPE_INT64)) {
-                       val_int = strtoll(val_str, &conv, 10);
+                       val_int = strtoll(val_str, &conv, 0);
                        if (!conv || conv == val_str) {
                                g_critical("Protocol decoder '%s' option '%s' "
                                                "requires a number.", dec->name, o->id);