summaryrefslogtreecommitdiffstats
path: root/media/libmedia
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@android.com>2013-09-17 14:50:42 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-09-17 14:50:42 -0700
commit440b5a496ac4f10f1221ecb110f67bcd253ef70a (patch)
treea2fc23395c423620e90dd3e0ae3fe3ae1c2689ea /media/libmedia
parent83774965fefc5d0315ec41641bdd99cf0a657462 (diff)
parentfc270954192ef7e15ac2c88daadd8890d22096e3 (diff)
downloadframeworks_av-440b5a496ac4f10f1221ecb110f67bcd253ef70a.zip
frameworks_av-440b5a496ac4f10f1221ecb110f67bcd253ef70a.tar.gz
frameworks_av-440b5a496ac4f10f1221ecb110f67bcd253ef70a.tar.bz2
am fc270954: am e56f3c96: Merge "strtok stores its values in thread local storage. So it can not guarantee works well when multithread environment. AudioFlinger has multithread. so strtok_r is more safe."
* commit 'fc270954192ef7e15ac2c88daadd8890d22096e3': strtok stores its values in thread local storage. So it can not guarantee works well when multithread environment. AudioFlinger has multithread. so strtok_r is more safe.
Diffstat (limited to 'media/libmedia')
-rw-r--r--media/libmedia/AudioParameter.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/media/libmedia/AudioParameter.cpp b/media/libmedia/AudioParameter.cpp
index e3fea77..33dbf0b 100644
--- a/media/libmedia/AudioParameter.cpp
+++ b/media/libmedia/AudioParameter.cpp
@@ -37,9 +37,10 @@ AudioParameter::AudioParameter(const String8& keyValuePairs)
{
char *str = new char[keyValuePairs.length()+1];
mKeyValuePairs = keyValuePairs;
+ char *last;
strcpy(str, keyValuePairs.string());
- char *pair = strtok(str, ";");
+ char *pair = strtok_r(str, ";", &last);
while (pair != NULL) {
if (strlen(pair) != 0) {
size_t eqIdx = strcspn(pair, "=");
@@ -58,7 +59,7 @@ AudioParameter::AudioParameter(const String8& keyValuePairs)
} else {
ALOGV("AudioParameter() cstor empty key value pair");
}
- pair = strtok(NULL, ";");
+ pair = strtok_r(NULL, ";", &last);
}
delete[] str;