From 629cdb8490cc95d9801163553bbeec1e00141d38 Mon Sep 17 00:00:00 2001 From: DXY <1731678236@qq.com> Date: Mon, 6 May 2024 10:12:06 +0800 Subject: [PATCH] =?utf8?q?=E8=BF=98=E5=8E=9F=E6=96=87=E4=BB=B6=E4=BF=AE?= =?utf8?q?=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../msg_center/src/msg_center_customer.cpp | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) mode change 100755 => 100644 code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp old mode 100755 new mode 100644 index 366c2a0cf..476463ee1 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -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(); -- 2.17.1