amiro-os / kernel / patches / RTCv1-fixed-illegal-type-casts.patch @ 75d6970a
History | View | Annotate | Download (1.2 KB)
1 |
From 6a763db09751ded7e11e531825c1c12d9fbecca9 Mon Sep 17 00:00:00 2001
|
---|---|
2 |
From: =?UTF-8?q?Thomas=20Sch=C3=B6pping?= <tschoepp@cit-ec.uni-bielefeld.de>
|
3 |
Date: Fri, 13 Jul 2018 16:21:27 +0200
|
4 |
Subject: [PATCH] RTCv1: Fixed illegal type casts (from pointer to arithmetic type to pointer to real type).
|
5 |
|
6 |
---
|
7 |
os/hal/ports/STM32/LLD/RTCv1/hal_rtc_lld.c | 5 +++-- |
8 |
1 file changed, 3 insertions(+), 2 deletions(-) |
9 |
|
10 |
diff --git a/os/hal/ports/STM32/LLD/RTCv1/hal_rtc_lld.c b/os/hal/ports/STM32/LLD/RTCv1/hal_rtc_lld.c
|
11 |
index df4b7e7..fedce93 100644
|
12 |
--- a/os/hal/ports/STM32/LLD/RTCv1/hal_rtc_lld.c
|
13 |
+++ b/os/hal/ports/STM32/LLD/RTCv1/hal_rtc_lld.c
|
14 |
@@ -130,14 +130,15 @@ static void rtc_decode(uint32_t tv_sec, |
15 |
RTCDateTime *timespec) { |
16 |
struct tm tim;
|
17 |
struct tm *t;
|
18 |
+ const time_t time = tv_sec;
|
19 |
|
20 |
/* If the conversion is successful the function returns a pointer
|
21 |
to the object the result was written into.*/ |
22 |
#if defined(__GNUC__) || defined(__CC_ARM)
|
23 |
- t = localtime_r((time_t *)&(tv_sec), &tim);
|
24 |
+ t = localtime_r(&time, &tim);
|
25 |
osalDbgAssert(t != NULL, "conversion failed"); |
26 |
#else
|
27 |
- t = localtime(&tv_sec);
|
28 |
+ t = localtime(&time);
|
29 |
memcpy(&tim, t, sizeof(struct tm)); |
30 |
#endif
|
31 |
|
32 |
--
|
33 |
2.7.4
|
34 |
|