Commit 612e3dea authored by Christophe Massiot's avatar Christophe Massiot

* dvb/sim.h: Fix compilation warnings. * examples/dvb_ecmg.c: Fix segfault.

parent a2cc3895
...@@ -48,7 +48,7 @@ static inline void tlvh_set_version(uint8_t *p_tlv, uint8_t i_version) ...@@ -48,7 +48,7 @@ static inline void tlvh_set_version(uint8_t *p_tlv, uint8_t i_version)
p_tlv[0] = i_version; p_tlv[0] = i_version;
} }
static inline uint8_t tlvh_get_version(uint8_t *p_tlv) static inline uint8_t tlvh_get_version(const uint8_t *p_tlv)
{ {
return p_tlv[0]; return p_tlv[0];
} }
...@@ -64,7 +64,7 @@ static inline void tlv_set_type(uint8_t *p_tlv, uint16_t i_type) ...@@ -64,7 +64,7 @@ static inline void tlv_set_type(uint8_t *p_tlv, uint16_t i_type)
p_tlv[1] = i_type & 0xff; p_tlv[1] = i_type & 0xff;
} }
static inline uint16_t tlv_get_type(uint8_t *p_tlv) static inline uint16_t tlv_get_type(const uint8_t *p_tlv)
{ {
return (p_tlv[0] << 8) | p_tlv[1]; return (p_tlv[0] << 8) | p_tlv[1];
} }
...@@ -75,7 +75,7 @@ static inline void tlv_set_length(uint8_t *p_tlv, uint16_t i_length) ...@@ -75,7 +75,7 @@ static inline void tlv_set_length(uint8_t *p_tlv, uint16_t i_length)
p_tlv[3] = i_length & 0xff; p_tlv[3] = i_length & 0xff;
} }
static inline uint16_t tlv_get_length(uint8_t *p_tlv) static inline uint16_t tlv_get_length(const uint8_t *p_tlv)
{ {
return (p_tlv[2] << 8) | p_tlv[3]; return (p_tlv[2] << 8) | p_tlv[3];
} }
...@@ -161,7 +161,7 @@ static inline uint16_t tlv_count_param(uint8_t *p_tlv, uint16_t i_type) ...@@ -161,7 +161,7 @@ static inline uint16_t tlv_count_param(uint8_t *p_tlv, uint16_t i_type)
} }
static inline bool tlv_validate_count_param(uint8_t *p_tlv, static inline bool tlv_validate_count_param(uint8_t *p_tlv,
tlv_param_count_t *p_count) const tlv_param_count_t *p_count)
{ {
uint16_t i_count = tlv_count_param(p_tlv, p_count->i_type); uint16_t i_count = tlv_count_param(p_tlv, p_count->i_type);
return (i_count >= p_count->i_min) && (i_count <= p_count->i_max); return (i_count >= p_count->i_min) && (i_count <= p_count->i_max);
......
...@@ -450,14 +450,16 @@ static void handle_stream_setup(uint8_t *p_tlv) ...@@ -450,14 +450,16 @@ static void handle_stream_setup(uint8_t *p_tlv)
return; return;
} }
p_stream = malloc(sizeof(stream_t));
for (i = 0; i < i_nb_streams; i++) { for (i = 0; i < i_nb_streams; i++) {
p_stream = pp_streams[i]; if (pp_streams[i] == NULL) {
if (p_stream == NULL) pp_streams[i] = p_stream;
break; break;
} }
}
if (i == i_nb_streams) { if (i == i_nb_streams) {
p_stream = malloc(sizeof(stream_t));
pp_streams = realloc(pp_streams, ++i_nb_streams * sizeof(stream_t *)); pp_streams = realloc(pp_streams, ++i_nb_streams * sizeof(stream_t *));
pp_streams[i_nb_streams - 1] = p_stream; pp_streams[i_nb_streams - 1] = p_stream;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment