From: luozheng <1732036298@qq.com> Date: Thu, 16 Jan 2025 03:53:14 +0000 (+0800) Subject: 录音界面优化:使用memset初始化防止踩内存 X-Git-Tag: v1.3.113-repair_tp~32 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F1632%2F4;p=mirrors%2FFD230.git 录音界面优化:使用memset初始化防止踩内存 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp index e07dc4047..dd797c0e7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp @@ -19,6 +19,7 @@ #include "uiservice/include/ui_service.h" #include "custom_runtime.h" #include "vibrator_service.h" +#include namespace OHOS { std::string RecordingModel::recordTempDuration = 0; @@ -903,7 +904,8 @@ namespace OHOS std::string recordingFileName = GetRecordFileName(); // 录音文件名 std::string yyymmhhh_date = Getyyyymmhhh_date(); // 保存录音年月日时间 std::string TotalRecordDuration = RecordingModel::recordTempDuration; // 录音的总时长 - recordingInfo = {0}; + // recordingInfo = {0}; + memset(&recordingInfo, 0, sizeof(RecordingInfo)); strncpy_s(recordingInfo.recordingFileName, 32, recordingFileName.c_str(), recordingFileName.length()); strncpy_s(recordingInfo.recordingDuration, 16, TotalRecordDuration.c_str(), TotalRecordDuration.length()); strncpy_s(recordingInfo.recordingTime, 16, yyymmhhh_date.c_str(), yyymmhhh_date.length());