fix code check

Signed-off-by: wanxiaoqing <wanxiaoqing@huawei.com>
This commit is contained in:
wanxiaoqing 2024-08-20 13:44:18 +08:00
parent 8a7b9fb909
commit 2b66ad5be9
5 changed files with 12 additions and 9 deletions

View File

@ -19,7 +19,8 @@
namespace OHOS {
namespace UDMF {
using namespace RadarReporter;
void RadarReporterAdapter::ReportNormal(std::string func, int32_t scene, int32_t stage, int32_t stageRes, int32_t state)
void RadarReporterAdapter::ReportNormal(const std::string &func, int32_t scene,
int32_t stage, int32_t stageRes, int32_t state)
{
struct HiSysEventParam params[] = {
{ .name = { "ORG_PKG" },
@ -57,7 +58,7 @@ void RadarReporterAdapter::ReportNormal(std::string func, int32_t scene, int32_t
}
void RadarReporterAdapter::ReportFail(
std::string func, int32_t scene, int32_t stage, int32_t stageRes, int32_t errorCode, int32_t state)
const std::string &func, int32_t scene, int32_t stage, int32_t stageRes, int32_t errorCode, int32_t state)
{
struct HiSysEventParam params[] = {
{ .name = { "ORG_PKG" },
@ -99,7 +100,7 @@ void RadarReporterAdapter::ReportFail(
}
void RadarReporterAdapter::ReportFail(
std::string func, int32_t scene, int32_t stage, int32_t stageRes, int32_t errorCode)
const std::string &func, int32_t scene, int32_t stage, int32_t stageRes, int32_t errorCode)
{
struct HiSysEventParam params[] = {
{ .name = { "ORG_PKG" },

View File

@ -73,10 +73,10 @@ const constexpr char ORG_PKG[] = "distributeddata";
class API_EXPORT RadarReporterAdapter {
public:
static void ReportNormal(std::string func, int32_t scene, int32_t stage, int32_t stageRes, int32_t state);
static void ReportNormal(const std::string &func, int32_t scene, int32_t stage, int32_t stageRes, int32_t state);
static void ReportFail(
std::string func, int32_t scene, int32_t stage, int32_t stageRes, int32_t errorCode, int32_t state);
static void ReportFail(std::string func, int32_t scene, int32_t stage, int32_t stageRes, int32_t errorCode);
const std::string &func, int32_t scene, int32_t stage, int32_t stageRes, int32_t errorCode, int32_t state);
static void ReportFail(const std::string &func, int32_t scene, int32_t stage, int32_t stageRes, int32_t errorCode);
};
} // namespace UDMF
} // namespace OHOS

View File

@ -293,7 +293,8 @@ void OH_UdmfRecord_Destroy(OH_UdmfRecord* record)
delete record;
}
int OH_UdmfRecord_AddGeneralEntry(OH_UdmfRecord* record, const char* typeId, unsigned char* entry, unsigned int count)
int OH_UdmfRecord_AddGeneralEntry(OH_UdmfRecord* record, const char* typeId,
const unsigned char* entry, unsigned int count)
{
if (!IsUnifiedRecordValid(record) || typeId == nullptr || entry == nullptr || count == 0 ||
count > MAX_RECORDS_SIZE) {

View File

@ -49,7 +49,7 @@ static void DestroyArrayPtr(const char** &arrayPtr, unsigned int& count)
static const char** CreateStrArrByVector(const std::vector<std::string>& paramVector, unsigned int* count)
{
unsigned int size = paramVector.size();
if (size <= 0 || size > MAX_UTD_SIZE) {
if (size == 0 || size > MAX_UTD_SIZE) {
LOG_ERROR(UDMF_CAPI, "Cannot create array, because size is illegal or exceeds the max value of UTD.");
*count = 0;
return nullptr;

View File

@ -211,7 +211,8 @@ void OH_UdmfRecord_Destroy(OH_UdmfRecord* pThis);
* @see OH_UdmfRecord Udmf_ErrCode.
* @since 12
*/
int OH_UdmfRecord_AddGeneralEntry(OH_UdmfRecord* pThis, const char* typeId, unsigned char* entry, unsigned int count);
int OH_UdmfRecord_AddGeneralEntry(OH_UdmfRecord* record, const char* typeId,
const unsigned char* entry, unsigned int count);
/**
* @brief Add one {OH_UdsPlainText} data to the {@link OH_UdmfRecord} record.