还原文件修改bug 123/2 123/head
authorDXY <1731678236@qq.com>
Mon, 6 May 2024 02:12:06 +0000 (10:12 +0800)
committerDXY <1731678236@qq.com>
Mon, 6 May 2024 02:12:06 +0000 (10:12 +0800)
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 366c2a0..476463e
@@ -380,14 +380,21 @@ void MsgCenterNotifyCardProc(const Topic topic, Request* req)
     //green,red,ir
     int green,red,ir;
     char* str= (char *)req->data;
+    char *pchStrTmpIn = NULL;
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",str);
     char *tokbuf=NULL;
-    tokbuf=strtok(str,",");
+    tokbuf=strtok_r(str,",",&pchStrTmpIn);
+    if(tokbuf!=NULL)
     green=atoi(tokbuf);
-    tokbuf=strtok(NULL,",");
-    red=atoi(tokbuf);   
-    tokbuf=strtok(NULL,"\0");
+
+    tokbuf=strtok_r(NULL,",",&pchStrTmpIn);
+    if(tokbuf!=NULL)
+    red=atoi(tokbuf); 
+
+    tokbuf=strtok_r(NULL,"\0",&pchStrTmpIn);
+    if(tokbuf!=NULL)
     ir=atoi(tokbuf);
+
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d,%d,%d",green,red,ir);
 
     testhrsenson1View * t= testhrsenson1View::GetInstance();
@@ -406,14 +413,23 @@ void MsgCenterNotifyleaklightProc(const Topic topic, Request* req)
     //green,red,ir
     int green,red,ir;
     char* str= (char *)req->data;
+    char *pchStrTmpIn = NULL;
+    
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",str);
+
     char *tokbuf=NULL;
-    tokbuf=strtok(str,",");
+    tokbuf=strtok_r(str,",",&pchStrTmpIn);
+    if(tokbuf!=NULL)
     green=atoi(tokbuf);
-    tokbuf=strtok(NULL,",");
-    red=atoi(tokbuf);   
-    tokbuf=strtok(NULL,"\0");
+
+    tokbuf=strtok_r(NULL,",",&pchStrTmpIn);
+    if(tokbuf!=NULL)
+    red=atoi(tokbuf); 
+
+    tokbuf=strtok_r(NULL,"\0",&pchStrTmpIn);
+    if(tokbuf!=NULL)
     ir=atoi(tokbuf);
+    
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d,%d,%d",green,red,ir);
 
     testhrsenson1View * t= testhrsenson1View::GetInstance();