Skip to content

Commit 1f28bd8

Browse files
authored
Merge pull request #5174 from mysterywolf/timewarning
[libc][time] Ensure the data types are consistent
2 parents a987cfe + 396b7da commit 1f28bd8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

components/drivers/src/ringbuffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ rt_size_t rt_ringbuffer_peak(struct rt_ringbuffer *rb, rt_uint8_t **ptr)
244244

245245
*ptr = &rb->buffer_ptr[rb->read_index];
246246

247-
if(rb->buffer_size - rb->read_index > size)
247+
if((rt_size_t)(rb->buffer_size - rb->read_index) > size)
248248
{
249249
rb->read_index += size;
250250
return size;

components/libc/compilers/common/time.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ RTM_EXPORT(mktime);
240240
char* asctime_r(const struct tm *t, char *buf)
241241
{
242242
/* Checking input validity */
243-
if (rt_strlen(days) <= (t->tm_wday << 2) || rt_strlen(months) <= (t->tm_mon << 2))
243+
if ((int)rt_strlen(days) <= (t->tm_wday << 2) || (int)rt_strlen(months) <= (t->tm_mon << 2))
244244
{
245245
LOG_W("asctime_r: the input parameters exceeded the limit, please check it.");
246246
*(int*) buf = *(int*) days;

0 commit comments

Comments
 (0)