code review issue fix.

Signed-off-by: zhirenx <xuzhiren@huawei.com>
Change-Id: Iac6221954e821702575e1be4d9d7070c663b4355
This commit is contained in:
zhirenx 2022-01-24 09:33:54 +08:00
parent 1d128d28d6
commit 18e362b214
12 changed files with 19 additions and 30 deletions

View File

@ -68,7 +68,7 @@ typedef struct SessionInfo {
DeviceIdentify identity;
} SessionInfo;
static inline DeviceSessionManager *GetDeviceSessionManagerInstance(void)
static DeviceSessionManager *GetDeviceSessionManagerInstance(void)
{
static DeviceSessionManager manager = {
{
@ -108,7 +108,7 @@ static void ProcessSessionMessageReceived(const uint8_t *data, uint32_t len)
FREE(queueData);
}
static inline void OnSessionMessageReceived(const DeviceIdentify *devId, const uint8_t *msg, uint32_t msgLen)
static void OnSessionMessageReceived(const DeviceIdentify *devId, const uint8_t *msg, uint32_t msgLen)
{
DeviceSessionManager *instance = GetDeviceSessionManagerInstance();
WorkQueue *queue = instance->queue;

View File

@ -40,7 +40,7 @@ typedef struct QueueStatusData {
uint32_t devType;
} QueueStatusData;
static inline DeviceStatusManager *GetDeviceManagerInstance()
static DeviceStatusManager *GetDeviceManagerInstance(void)
{
static DeviceStatusManager manager = {
{

View File

@ -33,9 +33,9 @@ typedef struct DateTime {
uint16_t day;
} DateTime;
uint64_t GetMillisecondSinceBoot();
uint64_t GetMillisecondSinceBoot(void);
uint64_t GetMillisecondSince1970();
uint64_t GetMillisecondSince1970(void);
bool GetDateTimeByMillisecondSince1970(uint64_t input, DateTime *datetime);

View File

@ -28,14 +28,14 @@ extern "C" {
#define MILLISEC_TO_USEC 1000
#define MICROSEC_TO_NANOSEC 1000
uint64_t GetMillisecondSinceBoot()
uint64_t GetMillisecondSinceBoot(void)
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return (ts.tv_sec * SEC_TO_MILLISEC + ts.tv_nsec / MILLISEC_TO_NANOSEC);
}
uint64_t GetMillisecondSince1970()
uint64_t GetMillisecondSince1970(void)
{
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);

View File

@ -78,7 +78,7 @@ int32_t GetJsonFieldIntArray(JsonHandle handle, const char *field, int32_t *arra
if (objValue == NULL) {
return 0;
}
if (!cJSON_IsArray(objValue)){
if (!cJSON_IsArray(objValue)) {
return 0;
}
@ -88,11 +88,11 @@ int32_t GetJsonFieldIntArray(JsonHandle handle, const char *field, int32_t *arra
}
int32_t index = 0;
for (int32_t i = 0; i < size; i++) {
cJSON *item = cJSON_GetArrayItem(objValue, i);
if (!cJSON_IsNumber(item)) {
continue;
}
array[index++] = item->valueint;
cJSON *item = cJSON_GetArrayItem(objValue, i);
if (!cJSON_IsNumber(item)) {
continue;
}
array[index++] = item->valueint;
}
return index;

View File

@ -25,7 +25,6 @@
namespace OHOS {
namespace Security {
namespace DeviceSecurityLevel {
constexpr int32_t SA_ID_DEVICE_SECURITY_MANAGER_SERVICE = 3511;
class IDeviceSecurityLevel : public IRemoteBroker {
@ -43,7 +42,6 @@ public:
CMD_SET_DEVICE_SECURITY_LEVEL = 1,
};
};
} // namespace DeviceSecurityLevel
} // namespace Security
} // namespace OHOS

View File

@ -15,10 +15,11 @@
#include "dslm_ohos_request.h"
#include "utils_log.h"
#include <securec.h>
#include <string.h>
#include "securec.h"
#include "utils_log.h"
#include "utils_mem.h"
int32_t RequestOhosDslmCred(const DeviceIdentify *device, const RequestObject *obj, DslmCredBuff **credBuff)

View File

@ -15,10 +15,10 @@
#include "dslm_ohos_verify.h"
#include "utils_log.h"
#include <securec.h>
#include <string.h>
#include "securec.h"
#include "utils_log.h"
#include "utils_mem.h"
#define OHOS_DEFAULT_LEVEL 1

View File

@ -60,7 +60,6 @@ public:
void MakeDeviceOffline(const DeviceIdentify *devId) const;
void MakeMsgReceivedFrom(const DeviceIdentify *devId, const uint8_t *msg, uint32_t msgLen) const;
};
} // namespace DslmUnitTest
} // namespace Security
} // namespace OHOS

View File

@ -25,7 +25,6 @@ using namespace testing::ext;
namespace OHOS {
namespace Security {
namespace DslmUnitTest {
DslmRequestCallbackMock::DslmRequestCallbackMock()
{
std::lock_guard<std::mutex> lock(mutex_);
@ -50,7 +49,6 @@ void DslmRequestCallbackMock::MockedCallback(uint32_t cookie, uint32_t result, c
DslmRequestCallback *DslmRequestCallbackMock::obj_ = nullptr;
std::mutex DslmRequestCallbackMock::mutex_ {};
} // namespace DslmUnitTest
} // namespace Security
} // namespace OHOS

View File

@ -26,7 +26,6 @@
namespace OHOS {
namespace Security {
namespace DslmUnitTest {
class DslmRequestCallback {
public:
DslmRequestCallback() {};
@ -37,7 +36,7 @@ public:
class DslmRequestCallbackMock : public DslmRequestCallback {
public:
DslmRequestCallbackMock();
virtual ~DslmRequestCallbackMock() override;
~DslmRequestCallbackMock() override;
MOCK_METHOD3(RequestCallback, void(uint32_t cookie, uint32_t result, const DslmCallbackInfo *info));
static void MockedCallback(uint32_t cookie, uint32_t result, const DslmCallbackInfo *info);
@ -46,7 +45,6 @@ private:
static DslmRequestCallback *obj_;
static std::mutex mutex_;
};
} // namespace DslmUnitTest
} // namespace Security
} // namespace OHOS

View File

@ -47,7 +47,6 @@ using namespace testing::ext;
namespace OHOS {
namespace Security {
namespace DslmUnitTest {
#ifdef GTEST_INCLUDE_GTEST_GTEST_H_
void DslmTest::SetUpTestCase()
{
}
@ -567,7 +566,6 @@ HWTEST_F(DslmTest, InitSelfDeviceSecureLevel_case2, TestSize.Level1)
HWTEST_F(DslmTest, InnerKitsTest_case1, TestSize.Level1)
{
DeviceIdentify device = {DEVICE_ID_MAX_LEN, {0}};
DeviceSecurityInfo *info = NULL;
@ -598,7 +596,6 @@ void TestDeviceSecurityInfoCallback(const DeviceIdentify *identify, struct Devic
HWTEST_F(DslmTest, InnerKitsTest_case2, TestSize.Level1)
{
DeviceIdentify device = {DEVICE_ID_MAX_LEN, {0}};
g_cnt = 0;
@ -615,8 +612,6 @@ HWTEST_F(DslmTest, InnerKitsTest_case2, TestSize.Level1)
g_cv.wait_for(lck, std::chrono::milliseconds(2000), []() { return (g_cnt == 3); });
EXPECT_EQ(g_cnt, 3);
}
#endif
} // namespace DslmUnitTest
} // namespace Security
} // namespace OHOS