From: stom.hwang Date: Wed, 28 Sep 2016 01:11:25 +0000 (+0900) Subject: Fix svace issue X-Git-Tag: accepted/tizen/common/20160928.164502^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F51%2F89951%2F1;p=platform%2Fcore%2Fuifw%2Fvoice-control.git Fix svace issue Change-Id: I2ffefe51b038297695eb547e4e70a9e4e1a79b7b Signed-off-by: stom.hwang --- diff --git a/common/vc_cmd_db.c b/common/vc_cmd_db.c old mode 100644 new mode 100755 index 0168129..240928a --- a/common/vc_cmd_db.c +++ b/common/vc_cmd_db.c @@ -1249,12 +1249,13 @@ static int __vc_db_generate_command(vc_cmd_s* cmd, char** fixed_cmd, GSList** cm temp_close[0] = '\0'; // extract fixed command and remove space in front of '{' - temp = strtok(src_cmd, "{"); + char *tok_ptr = NULL; + temp = strtok_r(src_cmd, "{", &tok_ptr); __vc_db_remove_space(&temp); *fixed_cmd = strdup(temp); // merge command with fixed and vfixed - while (NULL != (temp = strtok(NULL, "|"))) { + while (NULL != (temp = strtok_r(NULL, "|", &tok_ptr))) { __vc_db_remove_space(&temp); snprintf(merge_cmd, 256, "%s %s", *fixed_cmd, temp); @@ -1277,12 +1278,14 @@ static int __vc_db_generate_command(vc_cmd_s* cmd, char** fixed_cmd, GSList** cm *fixed_cmd = strdup(temp_fixed); // remove close brace, '}' - temp = strtok(src_cmd, "}"); + char *tok_ptr = NULL; + temp = strtok_r(src_cmd, "}", &tok_ptr); // remove open brace, '{' temp = strchr(src_cmd, '{') + 1; - temp = strtok(temp, "|"); + tok_ptr = NULL; + temp = strtok_r(temp, "|", &tok_ptr); __vc_db_remove_space(&temp); // merge command with fixed and vfixed @@ -1291,7 +1294,7 @@ static int __vc_db_generate_command(vc_cmd_s* cmd, char** fixed_cmd, GSList** cm temp_list = g_slist_append(temp_list, dst_cmd); SLOG(LOG_ERROR, vc_db_tag(), "New generated cmd: %s", dst_cmd); - while (NULL != (temp = strtok(NULL, "|"))) { + while (NULL != (temp = strtok_r(NULL, "|", &tok_ptr))) { __vc_db_remove_space(&temp); // merge command with fixed and vfixed @@ -1299,7 +1302,7 @@ static int __vc_db_generate_command(vc_cmd_s* cmd, char** fixed_cmd, GSList** cm dst_cmd = strdup(merge_cmd); temp_list = g_slist_append(temp_list, dst_cmd); SLOG(LOG_ERROR, vc_db_tag(), "New generated cmd: %s", dst_cmd); - } + } } else if (VC_CMD_FORMAT_FIXED_AND_NONFIXED == cmd->format || VC_CMD_FORMAT_NONFIXED_AND_FIXED == cmd->format) { dst_cmd = strdup(src_cmd); temp_list = g_slist_append(temp_list, dst_cmd);