From: Gerhard Sittig Date: Sun, 28 Oct 2018 09:45:42 +0000 (+0100) Subject: input/wav: undo "create channels once" workaround X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=81ceb6a51dd666987fb5c67b83c5ba14d105b301;p=libsigrok.git input/wav: undo "create channels once" workaround Undo the essence of commit 9e850040db5c which added a workaround to create sigrok channels only once, and keep reusing them across every file import (without checking details). Which was obsoleted by the recent channel list check on file re-load, including proper response when essential file properties have changed. Indentation changes. See a whitespace ignoring diff for the essence. --- diff --git a/src/input/wav.c b/src/input/wav.c index 4e9d6c12..0675ec8f 100644 --- a/src/input/wav.c +++ b/src/input/wav.c @@ -51,7 +51,6 @@ struct context { int num_channels; int unitsize; gboolean found_data; - gboolean create_channels; GSList *prev_sr_channels; }; @@ -152,15 +151,10 @@ static int format_match(GHashTable *metadata, unsigned int *confidence) static int init(struct sr_input *in, GHashTable *options) { - struct context *inc; - (void)options; in->sdi = g_malloc0(sizeof(struct sr_dev_inst)); in->priv = g_malloc0(sizeof(struct context)); - inc = in->priv; - - inc->create_channels = TRUE; return SR_OK; } @@ -369,15 +363,12 @@ static int receive(struct sr_input *in, GString *buf) else if (ret != SR_OK) return ret; - if (inc->create_channels) { - for (int i = 0; i < inc->num_channels; i++) { - snprintf(channelname, sizeof(channelname), "CH%d", i + 1); - sr_channel_new(in->sdi, i, SR_CHANNEL_ANALOG, TRUE, channelname); - } - if (!check_header_in_reread(in)) - return SR_ERR_DATA; + for (int i = 0; i < inc->num_channels; i++) { + snprintf(channelname, sizeof(channelname), "CH%d", i + 1); + sr_channel_new(in->sdi, i, SR_CHANNEL_ANALOG, TRUE, channelname); } - inc->create_channels = FALSE; + if (!check_header_in_reread(in)) + return SR_ERR_DATA; /* sdi is ready, notify frontend. */ in->sdi_ready = TRUE; @@ -420,7 +411,6 @@ static int reset(struct sr_input *in) * properties should change. */ keep_header_for_reread(in); - inc->create_channels = TRUE; g_string_truncate(in->buf, 0);