Skip to content

Commit

Permalink
lib: supl: Fix compilation warnings
Browse files Browse the repository at this point in the history
Fixed several memset() related compilation warnings.

Signed-off-by: Tommi Kangas <[email protected]>
  • Loading branch information
tokangas authored and rlubos committed Sep 13, 2024
1 parent d23d847 commit b8aef0c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/supl/os/lte_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,26 @@ static int parse_lte_mcc(struct lte_params *lte,
int buf_len)
{
if (buf_len < MIN_XMONITOR_MCC_MNC_LEN) {
memset(lte->mcc, 0, 3);
memset(lte->mcc, 0, sizeof(lte->mcc));
return -1;
}

uint8_t c;

if (char2hex(buf[1], &c) != 0) {
memset(lte->mcc, 0, 3);
memset(lte->mcc, 0, sizeof(lte->mcc));
return -1;
}
lte->mcc[0] = c;

if (char2hex(buf[2], &c) != 0) {
memset(lte->mcc, 0, 3);
memset(lte->mcc, 0, sizeof(lte->mcc));
return -1;
}
lte->mcc[1] = c;

if (char2hex(buf[3], &c) != 0) {
memset(lte->mcc, 0, 3);
memset(lte->mcc, 0, sizeof(lte->mcc));
return -1;
}
lte->mcc[2] = c;
Expand All @@ -86,20 +86,20 @@ static int parse_lte_mnc(struct lte_params *lte,
int buf_len)
{
if (buf_len < MIN_XMONITOR_MCC_MNC_LEN) {
memset(lte->mnc, 0, 3);
memset(lte->mnc, 0, sizeof(lte->mnc));
return -1;
}

uint8_t c;

if (char2hex(buf[4], &c) != 0) {
memset(lte->mnc, 0, 3);
memset(lte->mnc, 0, sizeof(lte->mnc));
return -1;
}
lte->mnc[0] = c;

if (char2hex(buf[5], &c) != 0) {
memset(lte->mnc, 0, 3);
memset(lte->mnc, 0, sizeof(lte->mnc));
return -1;
}
lte->mnc[1] = c;
Expand All @@ -110,7 +110,7 @@ static int parse_lte_mnc(struct lte_params *lte,
} else {
lte->mnc_length = 3;
if (char2hex(buf[6], &c) != 0) {
memset(lte->mnc, 0, 3);
memset(lte->mnc, 0, sizeof(lte->mnc));
return -1;
}
lte->mnc[2] = c;
Expand All @@ -134,15 +134,15 @@ static int parse_lte_tac(struct lte_params *lte,
int buf_len)
{
if (buf_len < MIN_XMONITOR_TAC_LEN) {
memset(lte->tac, 0, 2);
memset(lte->tac, 0, sizeof(lte->tac));
return -1;
}

if (sizeof(lte->tac) != hexstr2hex(&buf[1],
TAC_STR_LEN,
lte->tac,
sizeof(lte->tac))) {
memset(lte->tac, 0, 2);
memset(lte->tac, 0, sizeof(lte->tac));
return -1;
}

Expand All @@ -165,15 +165,15 @@ static int parse_lte_cid(struct lte_params *lte,
int buf_len)
{
if (buf_len < MIN_XMONITOR_CID_LEN) {
memset(lte->cid, 0, 4);
memset(lte->cid, 0, sizeof(lte->cid));
return -1;
}

if (sizeof(lte->cid) != hexstr2hex(&buf[1],
CID_STR_LEN,
lte->cid,
sizeof(lte->cid))) {
memset(lte->cid, 0, 4);
memset(lte->cid, 0, sizeof(lte->cid));
return -1;
}

Expand Down

0 comments on commit b8aef0c

Please sign in to comment.