X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Flecroy-xstream%2Fapi.c;h=3a8061d9b55b107f3d1e1c36a09fcb721c7dab1e;hb=692716f5d1aae4ef06c67b57aaf253f46f538c33;hp=2799f6fbee19c377bb274e7906004e3af2d5ad9b;hpb=373e92a491c0dbcbcdc555e11f405b2208d99259;p=libsigrok.git diff --git a/src/hardware/lecroy-xstream/api.c b/src/hardware/lecroy-xstream/api.c index 2799f6fb..3a8061d9 100644 --- a/src/hardware/lecroy-xstream/api.c +++ b/src/hardware/lecroy-xstream/api.c @@ -235,7 +235,7 @@ static int config_set(uint32_t key, GVariant *data, break; case SR_CONF_TRIGGER_SOURCE: tmp = g_variant_get_string(data, NULL); - for (i = 0; (*model->trigger_sources)[i]; i++) { + for (i = 0; i < model->num_trigger_sources; i++) { if (g_strcmp0(tmp, (*model->trigger_sources)[i]) != 0) continue; state->trigger_source = i; @@ -305,7 +305,7 @@ static int config_set(uint32_t key, GVariant *data, break; case SR_CONF_TRIGGER_SLOPE: tmp = g_variant_get_string(data, NULL); - for (i = 0; (*model->trigger_slopes)[i]; i++) { + for (i = 0; i < model->num_trigger_slopes; i++) { if (g_strcmp0(tmp, (*model->trigger_slopes)[i]) != 0) continue; state->trigger_slope = i; @@ -320,7 +320,7 @@ static int config_set(uint32_t key, GVariant *data, case SR_CONF_COUPLING: tmp = g_variant_get_string(data, NULL); - for (i = 0; (*model->coupling_options)[i]; i++) { + for (i = 0; i < model->num_coupling_options; i++) { if (strcmp(tmp, (*model->coupling_options)[i]) != 0) continue; for (j = 1; j <= model->analog_channels; j++) { @@ -373,20 +373,17 @@ static int config_list(uint32_t key, GVariant **data, *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_analog)); break; case SR_CONF_COUPLING: - *data = g_variant_new_strv(*model->coupling_options, - g_strv_length((char **)*model->coupling_options)); + *data = g_variant_new_strv(*model->coupling_options, model->num_coupling_options); break; case SR_CONF_TRIGGER_SOURCE: if (!model) return SR_ERR_ARG; - *data = g_variant_new_strv(*model->trigger_sources, - g_strv_length((char **)*model->trigger_sources)); + *data = g_variant_new_strv(*model->trigger_sources, model->num_trigger_sources); break; case SR_CONF_TRIGGER_SLOPE: if (!model) return SR_ERR_ARG; - *data = g_variant_new_strv(*model->trigger_slopes, - g_strv_length((char **)*model->trigger_slopes)); + *data = g_variant_new_strv(*model->trigger_slopes, model->num_trigger_slopes); break; case SR_CONF_TIMEBASE: if (!model)