Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
oai
cn5g
oai-cn5g-smf
Commits
16abdfa1
Commit
16abdfa1
authored
Jun 24, 2021
by
Raphael Defosseux
Browse files
CPPCHECK: fix a few errors
Signed-off-by:
Raphael Defosseux
<
raphael.defosseux@openairinterface.org
>
parent
b89aa8a2
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/common/utils/bstr/bstrlib.c
View file @
16abdfa1
...
...
@@ -163,7 +163,8 @@ int balloc(bstring b, int olen) {
#if defined(BSTRLIB_TEST_CANARY)
if
(
len
>
b
->
slen
+
1
)
{
memchr
(
b
->
data
+
b
->
slen
+
1
,
'X'
,
len
-
(
b
->
slen
+
1
));
if
((
memchr
(
b
->
data
+
b
->
slen
+
1
,
'X'
,
len
-
(
b
->
slen
+
1
)))
==
NULL
)
return
BSTR_ERR
;
}
#endif
}
...
...
@@ -217,7 +218,8 @@ bstring bfromcstr(const char* str) {
b
=
(
bstring
)
bstr__alloc
(
sizeof
(
struct
tagbstring
));
if
(
NULL
==
b
)
return
NULL
;
b
->
slen
=
(
int
)
j
;
if
(
NULL
==
(
b
->
data
=
(
unsigned
char
*
)
bstr__alloc
(
b
->
mlen
=
i
)))
{
b
->
data
=
(
unsigned
char
*
)
bstr__alloc
(
b
->
mlen
=
i
);
if
(
b
->
data
==
NULL
)
{
bstr__free
(
b
);
return
NULL
;
}
...
...
@@ -1587,7 +1589,8 @@ int binsertblk(
/* Aliasing case */
if
(((
size_t
)((
unsigned
char
*
)
blk
+
len
))
>=
((
size_t
)
b
->
data
)
&&
((
size_t
)
blk
)
<
((
size_t
)(
b
->
data
+
b
->
mlen
)))
{
if
(
NULL
==
(
aux
=
(
unsigned
char
*
)
bstr__alloc
(
len
)))
return
BSTR_ERR
;
aux
=
(
unsigned
char
*
)
bstr__alloc
(
len
);
if
(
aux
==
NULL
)
return
BSTR_ERR
;
bstr__memcpy
(
aux
,
blk
,
len
);
}
...
...
@@ -2475,8 +2478,10 @@ bstring bjoinblk(const struct bstrList* bl, const void* blk, int len) {
* NULL is returned, otherwise a bstring with the correct result is returned.
*/
bstring
bjoin
(
const
struct
bstrList
*
bl
,
const_bstring
sep
)
{
if
(
sep
==
NULL
)
return
NULL
;
if
(
sep
!=
NULL
&&
(
sep
->
slen
<
0
||
sep
->
data
==
NULL
))
return
NULL
;
if
(
sep
==
NULL
)
return
NULL
;
else
if
(
sep
->
slen
<
0
||
sep
->
data
==
NULL
)
return
NULL
;
return
bjoinblk
(
bl
,
sep
->
data
,
sep
->
slen
);
}
...
...
src/common/utils/bstr/bstrwrap.cpp
View file @
16abdfa1
...
...
@@ -113,7 +113,8 @@ CBString::CBString(char c, int len) {
CBString
::
CBString
(
char
c
)
{
mlen
=
2
;
slen
=
1
;
if
(
NULL
==
(
data
=
(
unsigned
char
*
)
bstr__alloc
(
mlen
)))
{
data
=
(
unsigned
char
*
)
bstr__alloc
(
mlen
);
if
(
data
==
NULL
)
{
mlen
=
slen
=
0
;
bstringThrow
(
"Failure in (char) constructor"
);
}
else
{
...
...
@@ -125,7 +126,8 @@ CBString::CBString(char c) {
CBString
::
CBString
(
unsigned
char
c
)
{
mlen
=
2
;
slen
=
1
;
if
(
NULL
==
(
data
=
(
unsigned
char
*
)
bstr__alloc
(
mlen
)))
{
data
=
(
unsigned
char
*
)
bstr__alloc
(
mlen
);
if
(
data
==
NULL
)
{
mlen
=
slen
=
0
;
bstringThrow
(
"Failure in (char) constructor"
);
}
else
{
...
...
@@ -141,7 +143,8 @@ CBString::CBString(const char* s) {
bstringThrow
(
"Failure in (char *) constructor, string too large"
)
slen
=
(
int
)
sslen
;
mlen
=
slen
+
1
;
if
(
NULL
!=
(
data
=
(
unsigned
char
*
)
bstr__alloc
(
mlen
)))
{
data
=
(
unsigned
char
*
)
bstr__alloc
(
mlen
);
if
(
data
!=
NULL
)
{
bstr__memcpy
(
data
,
s
,
mlen
);
return
;
}
...
...
@@ -158,7 +161,8 @@ CBString::CBString(int len, const char* s) {
(
int
)
sslen
;
mlen
=
slen
+
1
;
if
(
mlen
<
len
)
mlen
=
len
;
if
(
NULL
!=
(
data
=
(
unsigned
char
*
)
bstr__alloc
(
mlen
)))
{
data
=
(
unsigned
char
*
)
bstr__alloc
(
mlen
);
if
(
data
!=
NULL
)
{
bstr__memcpy
(
data
,
s
,
slen
+
1
);
return
;
}
...
...
@@ -1519,7 +1523,6 @@ void CBStringList::splitstr(const CBString& b, const CBString& s) {
static
int
streamSplitCb
(
void
*
parm
,
int
ofs
,
const_bstring
entry
)
{
CBStringList
*
r
=
(
CBStringList
*
)
parm
;
ofs
=
ofs
;
r
->
push_back
(
CBString
(
*
entry
));
return
0
;
}
...
...
src/nas/mm/msg/AuthenticationResponse.c
View file @
16abdfa1
...
...
@@ -58,7 +58,7 @@ int decode_authentication_response(
return
decoded_result
;
else
{
decoded
+=
decoded_result
;
printf
(
"decoded(%
d
)
\n
"
,
decoded
);
printf
(
"decoded(%
u
)
\n
"
,
decoded
);
authentication_response
->
presence
|=
AUTHENTICATION_RESPONSE_AUTNENTICATION_RESPONSE_PARAMETER_PRESENT
;
}
...
...
src/nas/mm/msg/RegistrationRequest.c
View file @
16abdfa1
...
...
@@ -32,7 +32,7 @@ int decode_registration_request(
uint32_t
len
)
{
uint32_t
decoded
=
0
;
int
decoded_result
=
0
;
printf
(
"decode_registration_request len:%
d
\n
"
,
len
);
printf
(
"decode_registration_request len:%
u
\n
"
,
len
);
if
((
decoded_result
=
decode__5gs_registration_type
(
&
registration_request
->
_5gsregistrationtype
,
0
,
buffer
+
decoded
,
...
...
src/ngap/asn1c/NativeEnumerated.c
View file @
16abdfa1
...
...
@@ -111,7 +111,7 @@ asn_dec_rval_t NativeEnumerated_decode_uper(
if
(
!
native
)
ASN__DECODE_FAILED
;
}
ASN_DEBUG
(
"Decoding %s as NativeEnumerated"
,
td
->
name
);
if
(
td
->
name
)
ASN_DEBUG
(
"Decoding %s as NativeEnumerated"
,
td
->
name
);
if
(
ct
->
flags
&
APC_EXTENSIBLE
)
{
int
inext
=
per_get_few_bits
(
pd
,
1
);
...
...
@@ -171,7 +171,7 @@ asn_enc_rval_t NativeEnumerated_encode_uper(
else
ASN__ENCODE_FAILED
;
/* Mandatory! */
ASN_DEBUG
(
"Encoding %s as NativeEnumerated"
,
td
->
name
);
if
(
td
->
name
)
ASN_DEBUG
(
"Encoding %s as NativeEnumerated"
,
td
->
name
);
er
.
encoded
=
0
;
...
...
@@ -307,7 +307,7 @@ asn_enc_rval_t NativeEnumerated_encode_aper(
else
ASN__ENCODE_FAILED
;
/* Mandatory! */
ASN_DEBUG
(
"Encoding %s as NativeEnumerated"
,
td
->
name
);
if
(
td
->
name
)
ASN_DEBUG
(
"Encoding %s as NativeEnumerated"
,
td
->
name
);
er
.
encoded
=
0
;
...
...
src/ngap/asn1c/NativeInteger.c
View file @
16abdfa1
...
...
@@ -263,7 +263,7 @@ asn_dec_rval_t NativeInteger_decode_uper(
void
*
tmpintptr
=
&
tmpint
;
(
void
)
opt_codec_ctx
;
ASN_DEBUG
(
"Decoding NativeInteger %s (UPER)"
,
td
->
name
);
if
(
td
->
name
)
ASN_DEBUG
(
"Decoding NativeInteger %s (UPER)"
,
td
->
name
);
if
(
!
native
)
{
native
=
(
long
*
)
(
*
sptr
=
CALLOC
(
1
,
sizeof
(
*
native
)));
...
...
@@ -298,7 +298,8 @@ asn_enc_rval_t NativeInteger_encode_uper(
native
=
*
(
const
long
*
)
sptr
;
ASN_DEBUG
(
"Encoding NativeInteger %s %ld (UPER)"
,
td
->
name
,
native
);
if
(
td
->
name
)
ASN_DEBUG
(
"Encoding NativeInteger %s %ld (UPER)"
,
td
->
name
,
native
);
memset
(
&
tmpint
,
0
,
sizeof
(
tmpint
));
if
((
specs
&&
specs
->
field_unsigned
)
?
asn_ulong2INTEGER
(
&
tmpint
,
native
)
:
...
...
@@ -320,7 +321,7 @@ asn_dec_rval_t NativeInteger_decode_aper(
void
*
tmpintptr
=
&
tmpint
;
(
void
)
opt_codec_ctx
;
ASN_DEBUG
(
"Decoding NativeInteger %s (APER)"
,
td
->
name
);
if
(
td
->
name
)
ASN_DEBUG
(
"Decoding NativeInteger %s (APER)"
,
td
->
name
);
if
(
!
native
)
{
native
=
(
long
*
)
(
*
sptr
=
CALLOC
(
1
,
sizeof
(
*
native
)));
...
...
@@ -355,7 +356,8 @@ asn_enc_rval_t NativeInteger_encode_aper(
native
=
*
(
const
long
*
)
sptr
;
ASN_DEBUG
(
"Encoding NativeInteger %s %ld (APER)"
,
td
->
name
,
native
);
if
(
td
->
name
)
ASN_DEBUG
(
"Encoding NativeInteger %s %ld (APER)"
,
td
->
name
,
native
);
memset
(
&
tmpint
,
0
,
sizeof
(
tmpint
));
if
((
specs
&&
specs
->
field_unsigned
)
?
...
...
src/ngap/asn1c/OBJECT_IDENTIFIER.c
View file @
16abdfa1
...
...
@@ -207,7 +207,10 @@ static enum xer_pbd_rval OBJECT_IDENTIFIER__xer_body_decode(
if
(
!
arcs
)
return
XPBD_SYSTEM_FAILURE
;
ret
=
OBJECT_IDENTIFIER_parse_arcs
(
(
const
char
*
)
chunk_buf
,
chunk_size
,
arcs
,
num_arcs
,
&
endptr
);
if
(
ret
!=
num_arcs
)
return
XPBD_SYSTEM_FAILURE
;
/* assert?.. */
if
(
ret
!=
num_arcs
)
{
FREEMEM
(
arcs
);
return
XPBD_SYSTEM_FAILURE
;
/* assert?.. */
}
}
/*
...
...
src/ngap/asn1c/constr_CHOICE.c
View file @
16abdfa1
...
...
@@ -1139,7 +1139,7 @@ asn_enc_rval_t CHOICE_encode_aper(
return
elm
->
type
->
op
->
aper_encoder
(
elm
->
type
,
elm
->
encoding_constraints
.
per_constraints
,
memb_ptr
,
po
);
}
else
{
}
else
if
(
ct
)
{
asn_enc_rval_t
rval
;
if
(
specs
->
ext_start
==
-
1
)
ASN__ENCODE_FAILED
;
if
(
aper_put_nsnnwn
(
po
,
ct
->
range_bits
,
present
-
specs
->
ext_start
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment