[fix] Fix simulator compilation warnings (#6438)

* [fix] Fix simulator compilation warnings

* Update bsp/simulator/rtconfig_project.h

Co-authored-by: Man, Jianting (Meco) <920369182@qq.com>
This commit is contained in:
Tangyuxin
2022-09-20 22:31:11 +08:00
committed by GitHub
parent 746d7a01bd
commit a4829b1c00
22 changed files with 68 additions and 60 deletions

View File

@@ -84,9 +84,9 @@ char *ltoa(long value, char *string, int radix)
i = v % radix;
v = v / radix;
if (i < 10)
*tp++ = i+'0';
*tp++ = (char)(i+'0');
else
*tp++ = i + 'a' - 10;
*tp++ = (char)(i + 'a' - 10);
}
sp = string;
@@ -129,9 +129,9 @@ char *ultoa(unsigned long value, char *string, int radix)
i = v % radix;
v = v / radix;
if (i < 10)
*tp++ = i+'0';
*tp++ = (char)(i+'0');
else
*tp++ = i + 'a' - 10;
*tp++ = (char)(i + 'a' - 10);
}
sp = string;

View File

@@ -171,8 +171,8 @@ static int set_timeval(struct timeval *tv)
struct tm *gmtime_r(const time_t *timep, struct tm *r)
{
time_t i;
time_t work = *timep % (SPD);
int i;
int work = *timep % (SPD);
if(timep == RT_NULL || r == RT_NULL)
{
@@ -186,11 +186,11 @@ struct tm *gmtime_r(const time_t *timep, struct tm *r)
work /= 60;
r->tm_min = work % 60;
r->tm_hour = work / 60;
work = *timep / (SPD);
work = (int)(*timep / (SPD));
r->tm_wday = (4 + work) % 7;
for (i = 1970;; ++i)
{
time_t k = __isleap(i) ? 366 : 365;
int k = __isleap(i) ? 366 : 365;
if (work >= k)
work -= k;
else
@@ -468,7 +468,7 @@ time_t timegm(struct tm * const t)
/* day is now the number of days since 'Jan 1 1970' */
i = 7;
t->tm_wday = (day + 4) % i; /* Sunday=0, Monday=1, ..., Saturday=6 */
t->tm_wday = (int)((day + 4) % i); /* Sunday=0, Monday=1, ..., Saturday=6 */
i = 24;
day *= i;

View File

@@ -100,7 +100,7 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struc
/* Convert the timeout to milliseconds */
if (timeout)
{
msec = timeout->tv_sec * 1000 + timeout->tv_usec / 1000;
msec = (int)timeout->tv_sec * 1000 + (int)timeout->tv_usec / 1000;
}
else
{