mirror of https://gerrit.osmocom.org/libosmocore
gsmtap_util: SNR can be negative, use a signed integer
In 'struct gsmtap_hdr' field 'snr_db' is defined as a signed integer, however all functions that fill this structure accept an unsigned integer. This is wrong, because SNR can be negative. Let's use 'int8_t' instead of 'uint8_t'. Changing from unsigned to signed should be relatively safe compared to the opposite. Most of the callers I am aware of always do pass 0 anyway. Change-Id: I9f432be5c346d563bf518111c14ff04d4a63f592 Related: SYS#5073
This commit is contained in:
parent
8f5844ed01
commit
833e8fac82
|
@ -17,11 +17,11 @@ void chantype_gsmtap2rsl(uint8_t gsmtap_chantype, uint8_t *rsl_chantype, uint8_t
|
|||
|
||||
struct msgb *gsmtap_makemsg_ex(uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t chan_type,
|
||||
uint8_t ss, uint32_t fn, int8_t signal_dbm,
|
||||
uint8_t snr, const uint8_t *data, unsigned int len);
|
||||
int8_t snr, const uint8_t *data, unsigned int len);
|
||||
|
||||
struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type,
|
||||
uint8_t ss, uint32_t fn, int8_t signal_dbm,
|
||||
uint8_t snr, const uint8_t *data, unsigned int len);
|
||||
int8_t snr, const uint8_t *data, unsigned int len);
|
||||
|
||||
/*! one gsmtap instance */
|
||||
struct gsmtap_inst {
|
||||
|
@ -51,12 +51,12 @@ int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg);
|
|||
|
||||
int gsmtap_send_ex(struct gsmtap_inst *gti, uint8_t type, uint16_t arfcn, uint8_t ts,
|
||||
uint8_t chan_type, uint8_t ss, uint32_t fn,
|
||||
int8_t signal_dbm, uint8_t snr, const uint8_t *data,
|
||||
int8_t signal_dbm, int8_t snr, const uint8_t *data,
|
||||
unsigned int len);
|
||||
|
||||
int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts,
|
||||
uint8_t chan_type, uint8_t ss, uint32_t fn,
|
||||
int8_t signal_dbm, uint8_t snr, const uint8_t *data,
|
||||
int8_t signal_dbm, int8_t snr, const uint8_t *data,
|
||||
unsigned int len);
|
||||
|
||||
extern const struct value_string gsmtap_gsm_channel_names[];
|
||||
|
|
|
@ -176,7 +176,7 @@ void chantype_gsmtap2rsl(uint8_t gsmtap_chantype, uint8_t *rsl_chantype,
|
|||
*/
|
||||
struct msgb *gsmtap_makemsg_ex(uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t chan_type,
|
||||
uint8_t ss, uint32_t fn, int8_t signal_dbm,
|
||||
uint8_t snr, const uint8_t *data, unsigned int len)
|
||||
int8_t snr, const uint8_t *data, unsigned int len)
|
||||
{
|
||||
struct msgb *msg;
|
||||
struct gsmtap_hdr *gh;
|
||||
|
@ -223,7 +223,7 @@ struct msgb *gsmtap_makemsg_ex(uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t
|
|||
*/
|
||||
struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type,
|
||||
uint8_t ss, uint32_t fn, int8_t signal_dbm,
|
||||
uint8_t snr, const uint8_t *data, unsigned int len)
|
||||
int8_t snr, const uint8_t *data, unsigned int len)
|
||||
{
|
||||
return gsmtap_makemsg_ex(GSMTAP_TYPE_UM, arfcn, ts, chan_type,
|
||||
ss, fn, signal_dbm, snr, data, len);
|
||||
|
@ -326,7 +326,7 @@ int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg)
|
|||
*/
|
||||
int gsmtap_send_ex(struct gsmtap_inst *gti, uint8_t type, uint16_t arfcn, uint8_t ts,
|
||||
uint8_t chan_type, uint8_t ss, uint32_t fn,
|
||||
int8_t signal_dbm, uint8_t snr, const uint8_t *data,
|
||||
int8_t signal_dbm, int8_t snr, const uint8_t *data,
|
||||
unsigned int len)
|
||||
{
|
||||
struct msgb *msg;
|
||||
|
@ -351,7 +351,7 @@ int gsmtap_send_ex(struct gsmtap_inst *gti, uint8_t type, uint16_t arfcn, uint8_
|
|||
*/
|
||||
int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts,
|
||||
uint8_t chan_type, uint8_t ss, uint32_t fn,
|
||||
int8_t signal_dbm, uint8_t snr, const uint8_t *data,
|
||||
int8_t signal_dbm, int8_t snr, const uint8_t *data,
|
||||
unsigned int len)
|
||||
{
|
||||
return gsmtap_send_ex(gti, GSMTAP_TYPE_UM, arfcn, ts, chan_type, ss, fn,
|
||||
|
|
Loading…
Reference in New Issue