X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=output%2Ftext%2Ftext.c;h=31bf3989eb4e77d5d5ca05e1fafe67dbfa735965;hb=d00088ca6daf91270f8c2f063167eedf2644bb8f;hp=3ca9f4f505c98b44374c87410310967f9a5ae314;hpb=4d15e5c9077a543a452a976933286c705c2e7088;p=libsigrok.git diff --git a/output/text/text.c b/output/text/text.c index 3ca9f4f5..31bf3989 100644 --- a/output/text/text.c +++ b/output/text/text.c @@ -1,7 +1,7 @@ /* * This file is part of the sigrok project. * - * Copyright (C) 2010-2012 Bert Vermeulen + * Copyright (C) 2013 Bert Vermeulen * Copyright (C) 2011 HÃ¥vard Espeland * * This program is free software: you can redistribute it and/or modify @@ -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;