Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 440b5a49 authored by Glenn Kasten's avatar Glenn Kasten Committed by Android Git Automerger
Browse files

am fc270954: am e56f3c96: Merge "strtok stores its values in thread local...

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 'fc270954':
  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.
parents 83774965 fc270954
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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;