X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=output%2Ftext%2Ftext.c;h=31bf3989eb4e77d5d5ca05e1fafe67dbfa735965;hb=d00088ca6daf91270f8c2f063167eedf2644bb8f;hp=71526b10e50d610323d3c4089cc8bebf585e2178;hpb=13d8e03c4f9fb6fe9c5f682ab957173effe42d43;p=libsigrok.git diff --git a/output/text/text.c b/output/text/text.c index 71526b10..31bf3989 100644 --- a/output/text/text.c +++ b/output/text/text.c @@ -79,7 +79,8 @@ SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode) struct context *ctx; struct sr_probe *probe; GSList *l; - uint64_t *samplerate; + GVariant *gvar; + uint64_t samplerate; int num_probes, ret; char *samplerate_s; @@ -124,12 +125,13 @@ SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode) snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING); num_probes = g_slist_length(o->sdi->probes); if (o->sdi->driver || sr_dev_has_option(o->sdi, SR_CONF_SAMPLERATE)) { - ret = o->sdi->driver->config_get(SR_CONF_SAMPLERATE, - (const void **)&samplerate, o->sdi); - if (ret != SR_OK) + if ((ret = o->sdi->driver->config_get(SR_CONF_SAMPLERATE, &gvar, + o->sdi)) != SR_OK) goto err; - if (!(samplerate_s = sr_samplerate_string(*samplerate))) { + samplerate = g_variant_get_uint64(gvar); + if (!(samplerate_s = sr_samplerate_string(samplerate))) { ret = SR_ERR; + g_variant_unref(gvar); goto err; } snprintf(ctx->header + strlen(ctx->header), @@ -137,6 +139,7 @@ SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode) "Acquisition with %d/%d probes at %s\n", ctx->num_enabled_probes, num_probes, samplerate_s); g_free(samplerate_s); + g_variant_unref(gvar); } ctx->linebuf_len = ctx->samples_per_line * 2 + 4;