!655 fix: repair codex warning of osal

Merge pull request !655 from Zhang/master
This commit is contained in:
openharmony_ci
2022-02-19 10:39:08 +00:00
committed by Gitee
8 changed files with 23 additions and 23 deletions
+2 -2
View File
@@ -95,8 +95,8 @@ int32_t OsalMutexTimedLock(struct OsalMutex *mutex, uint32_t ms)
struct timespec time;
(void)memset_s(&time, sizeof(time), 0, sizeof(time));
clock_gettime(CLOCK_REALTIME, &time);
time.tv_sec += ms / HDF_KILO_UNIT;
time.tv_nsec += (ms % HDF_KILO_UNIT) * HDF_KILO_UNIT * HDF_KILO_UNIT;
time.tv_sec += (time_t)ms / HDF_KILO_UNIT;
time.tv_nsec += (time_t)(ms % HDF_KILO_UNIT) * HDF_KILO_UNIT * HDF_KILO_UNIT;
if (time.tv_nsec >= HDF_NANO_UNITS) {
time.tv_nsec -= HDF_NANO_UNITS;
time.tv_sec += 1;
+2 -2
View File
@@ -61,8 +61,8 @@ int32_t OsalSemWait(struct OsalSem *sem, uint32_t ms)
struct timespec time;
(void)memset_s(&time, sizeof(time), 0, sizeof(time));
clock_gettime(CLOCK_REALTIME, &time);
time.tv_sec += ms / HDF_KILO_UNIT;
time.tv_nsec += (ms % HDF_KILO_UNIT) * HDF_KILO_UNIT * HDF_KILO_UNIT;
time.tv_sec += (time_t)ms / HDF_KILO_UNIT;
time.tv_nsec += (time_t)(ms % HDF_KILO_UNIT) * HDF_KILO_UNIT * HDF_KILO_UNIT;
if (time.tv_nsec >= HDF_NANO_UNITS) {
time.tv_nsec -= HDF_NANO_UNITS;
time.tv_sec += 1;
+6 -6
View File
@@ -27,8 +27,8 @@ int32_t OsalGetTime(OsalTimespec *time)
(void)memset_s(&ts, sizeof(ts), 0, sizeof(ts));
clock_gettime(CLOCK_MONOTONIC, &ts);
time->sec = ts.tv_sec;
time->usec = ts.tv_nsec / HDF_KILO_UNIT;
time->sec = (uint64_t)ts.tv_sec;
time->usec = (uint64_t)ts.tv_nsec / HDF_KILO_UNIT;
return HDF_SUCCESS;
}
@@ -67,8 +67,8 @@ void OsalMSleep(uint32_t ms)
int result;
struct timespec ts;
ts.tv_sec = ms / HDF_KILO_UNIT;
ts.tv_nsec = HDF_KILO_UNIT * HDF_KILO_UNIT * ((long)(ms % HDF_KILO_UNIT));
ts.tv_sec = (time_t)ms / HDF_KILO_UNIT;
ts.tv_nsec = (time_t)HDF_KILO_UNIT * HDF_KILO_UNIT * ((long)(ms % HDF_KILO_UNIT));
result = nanosleep(&ts, &ts);
if (result != 0) {
HDF_LOGE("%s OsalMSleep failed %d", __func__, errno);
@@ -80,8 +80,8 @@ void OsalUSleep(uint32_t us)
int result;
struct timespec ts;
ts.tv_sec = us / ((long)HDF_KILO_UNIT * HDF_KILO_UNIT);
ts.tv_nsec = HDF_KILO_UNIT * ((long)(us % HDF_KILO_UNIT));
ts.tv_sec = (time_t)us / ((long)HDF_KILO_UNIT * HDF_KILO_UNIT);
ts.tv_nsec = (time_t)HDF_KILO_UNIT * ((long)(us % HDF_KILO_UNIT));
result = nanosleep(&ts, &ts);
if (result != 0) {
HDF_LOGE("%s OsalUSleep failed %d", __func__, errno);
@@ -268,7 +268,7 @@ int HcsTestGetUint8ArrayElemSuccess(void)
uint8_t data[DATA_TEST_ARRAY_LENGTH] = { 0 };
// the test data is 0, 1, 2, 3, 4, 5, 6, 7.
uint8_t testData[DATA_TEST_ARRAY_LENGTH] = { 0, 1, 2, 3, 4, 5, 6, 7 };
uint32_t i;
int32_t i;
int32_t count;
if (!TestGetRootNode()) {
return HDF_FAILURE;
@@ -294,7 +294,7 @@ int HcsTestGetUint8ArrayElemFail(void)
const struct DeviceResourceNode *dataType = NULL;
uint8_t data1[DATA_TYPE_NUM_U64] = { 0 };
uint8_t data;
uint32_t i;
int32_t i;
int32_t ret;
int32_t count;
if (!TestGetRootNode()) {
@@ -423,7 +423,7 @@ int HcsTestGetUint16ArrayElemSuccess(void)
uint16_t data[DATA_TEST_ARRAY_LENGTH] = { 0 };
// the test data is 0, 1, 2, 3, 4, 5, 256, 257.
uint16_t testData[DATA_TEST_ARRAY_LENGTH] = { 0, 1, 2, 3, 4, 5, 256, 257 };
uint32_t i;
int32_t i;
int32_t count;
if (!TestGetRootNode()) {
return HDF_FAILURE;
@@ -448,7 +448,7 @@ int HcsTestGetUint16ArrayElemFail(void)
const struct DeviceResourceNode *dataType = NULL;
uint16_t data1[DATA_TYPE_NUM_U64] = { 0 };
uint16_t data;
uint32_t i;
int32_t i;
int32_t ret;
int32_t count;
if (!TestGetRootNode()) {
@@ -699,7 +699,7 @@ int HcsTestGetUint64ArrayElemSuccess(void)
const struct DeviceResourceNode *dataType = NULL;
uint64_t data[DATA_TYPE_NUM_U64] = { 0 };
uint64_t testData[DATA_TYPE_NUM_U64] = { U8_DATA, U16_DATA, U32_DATA, U64_DATA };
uint32_t i;
int32_t i;
int32_t count;
if (!TestGetRootNode()) {
return HDF_FAILURE;
+3 -3
View File
@@ -111,7 +111,7 @@ int32_t HcsGetNodeLength(const char *blob)
HDF_LOGE("%s failed, the rootLen is %d", __func__, rootLen);
return HDF_FAILURE;
}
rootLen += HcsByteCodeToUint32(blob + HCS_PREFIX_LENGTH + HCS_STRING_LENGTH(blob + HCS_PREFIX_LENGTH));
rootLen += (int32_t)HcsByteCodeToUint32(blob + HCS_PREFIX_LENGTH + HCS_STRING_LENGTH(blob + HCS_PREFIX_LENGTH));
return rootLen;
}
@@ -176,11 +176,11 @@ static bool CheckHcsBlobLength(uint32_t length, struct HbcHeader *header)
uint32_t minLength = rootNodeLen + HBC_HEADER_LENGTH;
uint32_t blobLength;
if (header->totalSize >= 0) {
blobLength = HBC_HEADER_LENGTH + header->totalSize;
blobLength = (uint32_t)(HBC_HEADER_LENGTH + header->totalSize);
g_byteAlign = false;
HDF_LOGI("%s: the blobLength: %u, byteAlign: %d", __func__, blobLength, g_byteAlign);
} else {
blobLength = HBC_HEADER_LENGTH - header->totalSize;
blobLength = (uint32_t)(HBC_HEADER_LENGTH - header->totalSize);
g_byteAlign = true;
HDF_LOGI("%s: the blobLength: %u, byteAlign: %d", __func__, blobLength, g_byteAlign);
}
+2 -2
View File
@@ -34,7 +34,7 @@ static struct DeviceResourceNode *CreateTreeNode(const char *start, int32_t offs
struct DeviceResourceNode *curNode = NULL;
*treeMem += sizeof(struct DeviceResourceNode);
newNode->name = start + offset + HCS_PREFIX_LENGTH;
newNode->hashValue = offset + sizeof(struct HbcHeader);
newNode->hashValue = (uint32_t)offset + sizeof(struct HbcHeader);
if (parentNode != NULL) {
newNode->parent = parentNode;
curNode = parentNode->child;
@@ -103,7 +103,7 @@ static int32_t ParseByteCode(const char *treeStart, int32_t offset, char **treeM
newNode = CreateTreeNode(treeStart, offset, parentOrCurNode, treeMem);
(void)HcsSwapToUint32(&newNodeOffset, treeStart + offset + HCS_STRING_LENGTH(newNode->name) +
HCS_PREFIX_LENGTH, CONFIG_DWORD);
newNodeOffset += offset + termOffset;
newNodeOffset += (uint32_t)(offset + termOffset);
if (!UpdateTreeStack(treeStack, treeLayerOrMemLen, newNode, newNodeOffset)) {
return HDF_FAILURE;
}
+1 -1
View File
@@ -43,7 +43,7 @@ struct HdfCString *HdfCStringObtain(const char *str)
OsalMemFree(instance);
return NULL;
}
instance->size = strLen;
instance->size = (int)strLen;
}
return instance;
}
+2 -2
View File
@@ -59,7 +59,7 @@ struct HdfMessage* HdfMessageQueueNext(struct HdfMessageQueue *queue)
struct HdfSListIterator it;
struct HdfMessage *message = NULL;
uint64_t currentTime = OsalGetSysTimeMs();
long miniTimeoutMs = OSAL_WAIT_FOREVER;
OsalMutexLock(&queue->mutex);
HdfSListIteratorInit(&it, &queue->list);
while (HdfSListIteratorHasNext(&it)) {
@@ -72,7 +72,7 @@ struct HdfMessage* HdfMessageQueueNext(struct HdfMessageQueue *queue)
}
OsalMutexUnlock(&queue->mutex);
OsalSemWait(&queue->semaphore, miniTimeoutMs);
OsalSemWait(&queue->semaphore, OSAL_WAIT_FOREVER);
return NULL;
}