From f8bc3665386a75da03e1007042464fee502aec44 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Wed, 18 Sep 2024 10:01:57 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E9=80=9A=E8=AF=9D=E8=AE=B0?= =?utf8?q?=E5=BD=95=E5=AD=98=E5=9C=A8=E7=9A=84=E5=86=85=E5=AD=98=E6=B3=84?= =?utf8?q?=E6=BC=8F(=E8=A1=A5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../phoneservice/src/PhoneService.cpp | 88 ++++++++----------- 1 file changed, 39 insertions(+), 49 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp index e654b8d20..9daa23c9e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp @@ -975,67 +975,57 @@ int GetCallLog(CallLogInfo **info, int *num) int number = fileSize / sizeof(CallLogInfo); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[GetCallLog] fileSize:%d, number:%d", fileSize, number); - CallLogInfo *callInfo = (CallLogInfo *)OHOS::UIMalloc(fileSize); - if (callInfo == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[GetCallLog] malloc callInfo fail!"); - *info = nullptr; - *num = 0; - fclose(fp); - return OHOS_FAILURE; - } - (void)memset_s(callInfo, fileSize, 0, fileSize); - int ret = fread(callInfo, sizeof(CallLogInfo), number, fp); - if (ret != number) { + for(int i=0;i