diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-01-04 17:40:05 +0100 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-01-04 17:49:18 +0100 |
commit | 833e8fac82480f9d19edc233a4fc3aca287efa81 (patch) | |
tree | 8e7661b31847e766e9b844832d45fe146e0fc693 /src/gsmtap_util.c | |
parent | 8f5844ed01f0bc85c595d853921c41924d60a65d (diff) |
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
Diffstat (limited to 'src/gsmtap_util.c')
-rw-r--r-- | src/gsmtap_util.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c index 9a0ac027..336e1d03 100644 --- a/src/gsmtap_util.c +++ b/src/gsmtap_util.c @@ -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, |