Skip to content

Commit fb4cb3a

Browse files
metapsychologenashif
authored andcommitted
c++: convert implicit conversion to explicit ones in header files
c++ does not allow implicit conversions and setting -fpermissive just causes a huge load of warnings to appear and hides real errors. This commit converts those implicit conversions to c-style explicit conversions. Signed-off-by: Alexander Polleti <[email protected]>
1 parent 25d17db commit fb4cb3a

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

include/dma.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ struct dma_driver_api {
195195
static inline int dma_config(struct device *dev, u32_t channel,
196196
struct dma_config *config)
197197
{
198-
const struct dma_driver_api *api = dev->driver_api;
198+
const struct dma_driver_api *api =
199+
(const struct dma_driver_api *)dev->driver_api;
199200

200201
return api->config(dev, channel, config);
201202
}
@@ -216,7 +217,8 @@ static inline int dma_config(struct device *dev, u32_t channel,
216217
static inline int dma_reload(struct device *dev, u32_t channel,
217218
u32_t src, u32_t dst, size_t size)
218219
{
219-
const struct dma_driver_api *api = dev->driver_api;
220+
const struct dma_driver_api *api =
221+
(const struct dma_driver_api *)dev->driver_api;
220222

221223
return api->reload(dev, channel, src, dst, size);
222224
}
@@ -239,7 +241,8 @@ __syscall int dma_start(struct device *dev, u32_t channel);
239241

240242
static inline int _impl_dma_start(struct device *dev, u32_t channel)
241243
{
242-
const struct dma_driver_api *api = dev->driver_api;
244+
const struct dma_driver_api *api =
245+
(const struct dma_driver_api *)dev->driver_api;
243246

244247
return api->start(dev, channel);
245248
}
@@ -261,7 +264,8 @@ __syscall int dma_stop(struct device *dev, u32_t channel);
261264

262265
static inline int _impl_dma_stop(struct device *dev, u32_t channel)
263266
{
264-
const struct dma_driver_api *api = dev->driver_api;
267+
const struct dma_driver_api *api =
268+
(const struct dma_driver_api *)dev->driver_api;
265269

266270
return api->stop(dev, channel);
267271
}

include/logging/log_core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ extern "C" {
253253

254254
#define _LOG(_level, ...) \
255255
__LOG(_level, \
256-
LOG_CURRENT_MODULE_ID(), \
256+
(u16_t)LOG_CURRENT_MODULE_ID(), \
257257
LOG_CURRENT_DYNAMIC_DATA_ADDR(), \
258258
__VA_ARGS__)
259259

include/net/net_context.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,9 @@ enum net_context_state net_context_get_state(struct net_context *context)
314314
{
315315
NET_ASSERT(context);
316316

317-
return (context->flags >> NET_CONTEXT_STATE_SHIFT) &
318-
NET_CONTEXT_STATE_MASK;
317+
return (enum net_context_state)
318+
((context->flags >> NET_CONTEXT_STATE_SHIFT) &
319+
NET_CONTEXT_STATE_MASK);
319320
}
320321

321322
/**

include/net/net_ip.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ static inline enum net_priority net_vlan2priority(u8_t priority)
11191119
return NET_PRIORITY_BE;
11201120
}
11211121

1122-
return vlan2priority[priority];
1122+
return (enum net_priority)vlan2priority[priority];
11231123
}
11241124

11251125
/**

0 commit comments

Comments
 (0)