diff options
| author | Tangyuxin <[email protected]> | 2022-09-20 22:31:11 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-09-20 10:31:11 -0400 |
| commit | a4829b1c004015cca489679cc335b6089aa9da31 (patch) | |
| tree | 3e346e76bb1c77b5b189ca28b053daeaea5154e9 /components/libc/compilers | |
| parent | 746d7a01bdb29c692b696780f938f11253ae1103 (diff) | |
[fix] Fix simulator compilation warnings (#6438)
* [fix] Fix simulator compilation warnings
* Update bsp/simulator/rtconfig_project.h
Co-authored-by: Man, Jianting (Meco) <[email protected]>
Diffstat (limited to 'components/libc/compilers')
| -rw-r--r-- | components/libc/compilers/common/cstdlib.c | 8 | ||||
| -rw-r--r-- | components/libc/compilers/common/ctime.c | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/components/libc/compilers/common/cstdlib.c b/components/libc/compilers/common/cstdlib.c index 55263011a9..4a978a106c 100644 --- a/components/libc/compilers/common/cstdlib.c +++ b/components/libc/compilers/common/cstdlib.c @@ -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; diff --git a/components/libc/compilers/common/ctime.c b/components/libc/compilers/common/ctime.c index 34d646ff9d..64e3c9424c 100644 --- a/components/libc/compilers/common/ctime.c +++ b/components/libc/compilers/common/ctime.c @@ -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; |
