diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2019-05-25 23:07:13 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-05-25 23:07:13 +0000 |
commit | 1e8b115764da96d409d22778774a4916f1ab3ccc (patch) | |
tree | 2d29ccd895e25e03eab083732f2618703e8b91da | |
parent | e84b02b2bfca1b51f743ad262ca0b62504d6c6b3 (diff) | |
parent | f2d93a540297e75815eeb6644bf675cdae3be909 (diff) | |
download | tinyalsa-android10-qpr1-release.tar.gz |
Snap for 5606001 from f2d93a540297e75815eeb6644bf675cdae3be909 to qt-qpr1-releaseandroid-10.0.0_r29android-10.0.0_r28android-10.0.0_r27android-10.0.0_r26android-10.0.0_r25android-10.0.0_r24android-10.0.0_r23android-10.0.0_r22android-10.0.0_r21android-10.0.0_r20android-10.0.0_r19android-10.0.0_r18android-10.0.0_r16android-10.0.0_r15android10-qpr1-releaseandroid10-qpr1-d-releaseandroid10-qpr1-c-s1-releaseandroid10-qpr1-c-releaseandroid10-qpr1-b-s1-releaseandroid10-qpr1-b-release
Change-Id: I90d8dbff69884077ac100031f5353f7e9e14c33c
-rw-r--r-- | tinymix.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -125,6 +125,16 @@ int main(int argc, char **argv) return ret; } +static int isnumber(const char *str) { + char *end; + + if (str == NULL || strlen(str) == 0) + return 0; + + strtol(str, &end, 0); + return strlen(end) == 0; +} + static void tinymix_list_controls(struct mixer *mixer) { struct mixer_ctl *ctl; @@ -195,7 +205,7 @@ static int tinymix_detail_control(struct mixer *mixer, const char *control, unsigned int tlv_header_size = 0; const char *space = g_tabs_only ? "\t" : " "; - if (isdigit(control[0])) + if (isnumber(control)) ctl = mixer_get_ctl(mixer, atoi(control)); else ctl = mixer_get_ctl_by_name(mixer, control); @@ -339,7 +349,7 @@ static int tinymix_set_value(struct mixer *mixer, const char *control, unsigned int num_ctl_values; unsigned int i; - if (isdigit(control[0])) + if (isnumber(control)) ctl = mixer_get_ctl(mixer, atoi(control)); else ctl = mixer_get_ctl_by_name(mixer, control); @@ -357,7 +367,7 @@ static int tinymix_set_value(struct mixer *mixer, const char *control, return ENOENT; } - if (isdigit(values[0][0])) { + if (isnumber(values[0])) { if (num_values == 1) { /* Set all values the same */ int value = atoi(values[0]); |