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
diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c
index 9a0ac02..336e1d0 100644
--- a/src/gsmtap_util.c
+++ b/src/gsmtap_util.c
@@ -176,7 +176,7 @@
*/
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(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_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(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,