forked from Ivasoft/DSView
Code refactoring 23
This commit is contained in:
@@ -287,7 +287,7 @@ static GSList *scan(GSList *options)
|
||||
if (!devc)
|
||||
return NULL;
|
||||
|
||||
sdi = sr_dev_inst_new(channel_modes[devc->ch_mode].mode, 0, SR_ST_INITIALIZING,
|
||||
sdi = sr_dev_inst_new(channel_modes[devc->ch_mode].mode, SR_ST_INITIALIZING,
|
||||
prof->vendor, prof->model, prof->model_version);
|
||||
|
||||
if (!sdi) {
|
||||
@@ -1046,7 +1046,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
{
|
||||
unsigned int i;
|
||||
int ret;
|
||||
struct DSL_context *devc = sdi->priv;
|
||||
struct DSL_context *devc;
|
||||
|
||||
assert(sdi);
|
||||
assert(sdi->priv);
|
||||
|
||||
devc = sdi->priv;
|
||||
|
||||
ret = dsl_config_get(id, data, sdi, ch, cg);
|
||||
if (ret != SR_OK) {
|
||||
@@ -1202,6 +1207,9 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
||||
unsigned int i;
|
||||
GSList *l;
|
||||
|
||||
assert(sdi);
|
||||
assert(sdi->priv);
|
||||
|
||||
(void)cg;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE) {
|
||||
|
||||
@@ -357,7 +357,7 @@ static GSList *scan(GSList *options)
|
||||
if (!devc)
|
||||
return NULL;
|
||||
|
||||
sdi = sr_dev_inst_new(channel_modes[devc->ch_mode].mode, -1, SR_ST_INITIALIZING,
|
||||
sdi = sr_dev_inst_new(channel_modes[devc->ch_mode].mode, SR_ST_INITIALIZING,
|
||||
prof->vendor, prof->model, prof->model_version);
|
||||
if (!sdi) {
|
||||
g_free(devc);
|
||||
@@ -606,6 +606,9 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
struct DSL_context *devc = sdi->priv;
|
||||
int ret;
|
||||
|
||||
assert(sdi);
|
||||
assert(sdi->priv);
|
||||
|
||||
ret = dsl_config_get(id, data, sdi, ch, cg);
|
||||
if (ret != SR_OK) {
|
||||
switch (id) {
|
||||
@@ -722,6 +725,9 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
||||
struct sr_usb_dev_inst *usb;
|
||||
unsigned int i;
|
||||
|
||||
assert(sdi);
|
||||
assert(sdi->priv);
|
||||
|
||||
(void)cg;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE) {
|
||||
|
||||
@@ -154,7 +154,7 @@ static GSList *hw_scan(GSList *options)
|
||||
devc->max_height = 0;
|
||||
adjust_samplerate(devc);
|
||||
|
||||
sdi = sr_dev_inst_new(channel_modes[devc->ch_mode].mode, 0, SR_ST_INITIALIZING,
|
||||
sdi = sr_dev_inst_new(channel_modes[devc->ch_mode].mode, SR_ST_INITIALIZING,
|
||||
devc->profile->vendor,
|
||||
devc->profile->model,
|
||||
devc->profile->model_version);
|
||||
@@ -257,7 +257,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
{
|
||||
(void) cg;
|
||||
|
||||
struct demo_context *const devc = sdi->priv;
|
||||
struct demo_context *devc;
|
||||
|
||||
assert(sdi);
|
||||
assert(sdi->priv);
|
||||
|
||||
devc = sdi->priv;
|
||||
|
||||
switch (id) {
|
||||
case SR_CONF_SAMPLERATE:
|
||||
@@ -375,14 +380,18 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
||||
struct sr_channel *ch,
|
||||
struct sr_channel_group *cg)
|
||||
{
|
||||
(void) cg;
|
||||
|
||||
uint16_t i;
|
||||
int ret, num_probes;
|
||||
const char *stropt;
|
||||
uint64_t tmp_u64;
|
||||
struct demo_context *devc;
|
||||
|
||||
(void) cg;
|
||||
|
||||
struct demo_context *const devc = sdi->priv;
|
||||
assert(sdi);
|
||||
assert(sdi->priv);
|
||||
|
||||
devc = sdi->priv;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
Reference in New Issue
Block a user