mirror of
https://gitee.com/openharmony/distributeddatamgr_udmf
synced 2024-10-07 05:43:56 +00:00
告警清理
Signed-off-by: wanxiaoqing <wanxiaoqing@huawei.com>
This commit is contained in:
parent
9af9892fa1
commit
c872a010b9
@ -33,7 +33,13 @@ void TLVObject::SetFile(std::FILE *file)
|
||||
if (fseek(file_, 0, SEEK_END) != 0) {
|
||||
LOG_ERROR(UDMF_SERVICE, "fseek to end error!");
|
||||
}
|
||||
total_ = ftell(file_);
|
||||
|
||||
auto total = ftell(file_);
|
||||
if (total < 0) {
|
||||
LOG_ERROR(UDMF_SERVICE, "Values are out of range, total:%{public}ld", total);
|
||||
return;
|
||||
}
|
||||
total_ = static_cast<size_t>(total);
|
||||
ResetCursor();
|
||||
}
|
||||
|
||||
|
@ -596,6 +596,10 @@ template <> bool Reading(std::shared_ptr<OHOS::AAFwk::Want> &output, TLVObject &
|
||||
|
||||
std::shared_ptr<Parcel> parcel = std::make_shared<Parcel>();
|
||||
auto buffer = malloc(val.size());
|
||||
if (buffer == nullptr) {
|
||||
LOG_ERROR(UDMF_FRAMEWORK, "malloc error in tlv read. tag=%{public}hu", head.tag);
|
||||
return false;
|
||||
}
|
||||
auto err = memcpy_s(buffer, val.size(), val.data(), val.size());
|
||||
if (err != EOK) {
|
||||
LOG_ERROR(UDMF_FRAMEWORK, "memcpy_s error in tlv read want. tag=%{public}hu", head.tag);
|
||||
|
@ -308,7 +308,10 @@ size_t CountVariant(TLVObject &data, uint32_t step, const _InTp &input)
|
||||
|
||||
template <typename... _Types> size_t CountBufferSize(const std::variant<_Types...> &input, TLVObject &data)
|
||||
{
|
||||
uint32_t index = input.index();
|
||||
if (input.index() > size_t(std::numeric_limits<uint32_t>::max())) {
|
||||
return 0;
|
||||
}
|
||||
uint32_t index = static_cast<uint32_t>(input.index());
|
||||
return data.CountHead() + data.CountBasic(index) + CountVariant<decltype(input), _Types...>(data, 0, input);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user