diff options
author | Mahesh Kumar Sharma <smahesh@codeaurora.org> | 2015-08-13 17:05:53 -0700 |
---|---|---|
committer | Mahesh Kumar Sharma <smahesh@codeaurora.org> | 2015-08-14 17:12:32 -0700 |
commit | 256218b7e537546600beecd838f0ef2e7d8ec959 (patch) | |
tree | 749bad5050ddd6eb030eafcea47711fbd5025400 /libfm_jni | |
parent | c0f0b37318e801161333c351fb4b94c0ca68e6f7 (diff) | |
download | android_hardware_qcom_fm-256218b7e537546600beecd838f0ef2e7d8ec959.tar.gz android_hardware_qcom_fm-256218b7e537546600beecd838f0ef2e7d8ec959.tar.bz2 android_hardware_qcom_fm-256218b7e537546600beecd838f0ef2e7d8ec959.zip |
FM: Resolve KW issues.
Use more safe snprintf and thread safe strtok_r.
Change-Id: I7ae8d94c7ab1e1c7e3b6a3b4b0dce703f9dcddce
Diffstat (limited to 'libfm_jni')
-rw-r--r-- | libfm_jni/ConfigFmThs.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libfm_jni/ConfigFmThs.cpp b/libfm_jni/ConfigFmThs.cpp index 19ee12b..dd6b283 100644 --- a/libfm_jni/ConfigFmThs.cpp +++ b/libfm_jni/ConfigFmThs.cpp @@ -488,12 +488,13 @@ unsigned int ConfigFmThs :: extract_comma_sep_freqs ) { char *next_freq; + char *saveptr; unsigned int freq; unsigned int *freqs_new_arr; unsigned int size = 0; unsigned int len = 0; - next_freq = strtok(freqs, str); + next_freq = strtok_r(freqs, str, &saveptr); while(next_freq != NULL) { freq = atoi(next_freq); ALOGD("HYBRID_SRCH freq: %u\n", freq); @@ -512,7 +513,7 @@ unsigned int ConfigFmThs :: extract_comma_sep_freqs } (*freqs_arr)[len] = freq; len++; - next_freq = strtok(NULL, str); + next_freq = strtok_r(NULL, str, &saveptr); } return len; } @@ -525,12 +526,13 @@ unsigned int ConfigFmThs :: extract_comma_sep_sinrs ) { char *next_sinr; + char *saveptr; signed char *sinrs_new_arr; unsigned int size = 0; unsigned int len = 0; signed char sinr; - next_sinr = strtok(sinrs, str); + next_sinr = strtok_r(sinrs, str, &saveptr); while(next_sinr != NULL) { sinr = atoi(next_sinr); ALOGD("HYBRID_SRCH sinr: %d\n", sinr); @@ -549,7 +551,7 @@ unsigned int ConfigFmThs :: extract_comma_sep_sinrs } (*sinrs_arr)[len] = sinr; len++; - next_sinr = strtok(NULL, str); + next_sinr = strtok_r(NULL, str,&saveptr); } return len; } |