Skip to content

Commit

Permalink
Merge pull request #224 from analogdevicesinc/rft-issue-219
Browse files Browse the repository at this point in the history
channel: Fix #219 get_modifier and get_type seems to work incorrectly
  • Loading branch information
mhennerich authored Nov 21, 2018
2 parents 20c9079 + 25c20d6 commit effcce8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void iio_channel_init_finalize(struct iio_channel *chn)
if (strncmp(iio_chan_type_name_spec[i], chn->id, len) != 0)
continue;
/* Type must be followed by either a '_' or a digit */
if (chn->id[len] != '_' && chn->id[len] < '0' && chn->id[len] > '9')
if (chn->id[len] != '_' && (chn->id[len] < '0' || chn->id[len] > '9'))
continue;

chn->type = (enum iio_chan_type) i;
Expand All @@ -159,9 +159,6 @@ void iio_channel_init_finalize(struct iio_channel *chn)
len = strlen(modifier_names[i]);
if (strncmp(modifier_names[i], mod, len) != 0)
continue;
/* Modifier must be followed by a '_' */
if (mod[len] != '_')
continue;

chn->modifier = (enum iio_modifier) i;
break;
Expand Down

0 comments on commit effcce8

Please sign in to comment.