Commit b89aa8a2 authored by Raphael Defosseux's avatar Raphael Defosseux
Browse files

Fixing the last remaining compilation warnings


Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@openairinterface.org>
parent a576bb03
......@@ -1288,6 +1288,34 @@ int asn_INTEGER2ulong(const INTEGER_t* iptr, unsigned long* l) {
}
}
int asn_INTEGER2longlong(const INTEGER_t* iptr, long long* l) {
intmax_t v;
if (asn_INTEGER2imax(iptr, &v) == 0) {
if (v < LLONG_MIN || v > LLONG_MAX) {
errno = ERANGE;
return -1;
}
*l = v;
return 0;
} else {
return -1;
}
}
int asn_INTEGER2ulonglong(const INTEGER_t* iptr, unsigned long long* l) {
uintmax_t v;
if (asn_INTEGER2umax(iptr, &v) == 0) {
if (v > ULLONG_MAX) {
errno = ERANGE;
return -1;
}
*l = v;
return 0;
} else {
return -1;
}
}
int asn_long2INTEGER(INTEGER_t* st, long value) {
return asn_imax2INTEGER(st, value);
}
......
......@@ -73,6 +73,8 @@ int asn_umax2INTEGER(INTEGER_t* i, uintmax_t l);
*/
int asn_INTEGER2long(const INTEGER_t* i, long* l);
int asn_INTEGER2ulong(const INTEGER_t* i, unsigned long* l);
int asn_INTEGER2longlong(const INTEGER_t* i, long long* l);
int asn_INTEGER2ulonglong(const INTEGER_t* i, unsigned long long* l);
int asn_long2INTEGER(INTEGER_t* i, long l);
int asn_ulong2INTEGER(INTEGER_t* i, unsigned long l);
int asn_int642INTEGER(INTEGER_t* i, int64_t l);
......
......@@ -65,7 +65,7 @@ static int memb_Ngap_usageCountUL_constraint_1(
const asn_TYPE_descriptor_t* td, const void* sptr,
asn_app_constraint_failed_f* ctfailcb, void* app_key) {
const INTEGER_t* st = (const INTEGER_t*) sptr;
long value;
unsigned long long value;
if (!sptr) {
ASN__CTFAIL(
......@@ -74,14 +74,14 @@ static int memb_Ngap_usageCountUL_constraint_1(
return -1;
}
if (asn_INTEGER2long(st, &value)) {
if (asn_INTEGER2ulonglong(st, &value)) {
ASN__CTFAIL(
app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__,
__LINE__);
return -1;
}
if ((value >= 0 && value <= 18446744073709551615)) {
if ((value >= 0 && value <= ULLONG_MAX)) {
/* Constraint check succeeded */
return 0;
} else {
......@@ -96,7 +96,7 @@ static int memb_Ngap_usageCountDL_constraint_1(
const asn_TYPE_descriptor_t* td, const void* sptr,
asn_app_constraint_failed_f* ctfailcb, void* app_key) {
const INTEGER_t* st = (const INTEGER_t*) sptr;
long value;
unsigned long long value;
if (!sptr) {
ASN__CTFAIL(
......@@ -105,14 +105,14 @@ static int memb_Ngap_usageCountDL_constraint_1(
return -1;
}
if (asn_INTEGER2long(st, &value)) {
if (asn_INTEGER2ulonglong(st, &value)) {
ASN__CTFAIL(
app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__,
__LINE__);
return -1;
}
if ((value >= 0 && value <= 18446744073709551615)) {
if ((value >= 0 && value <= ULLONG_MAX)) {
/* Constraint check succeeded */
return 0;
} else {
......@@ -146,7 +146,7 @@ static asn_oer_constraints_t asn_OER_memb_Ngap_usageCountUL_constr_4
static asn_per_constraints_t asn_PER_memb_Ngap_usageCountUL_constr_4
CC_NOTUSED = {
{APC_CONSTRAINED, 64, -1, 0,
18446744073709551615} /* (0..18446744073709551615) */,
ULLONG_MAX} /* (0..18446744073709551615) */,
{APC_UNCONSTRAINED, -1, -1, 0, 0},
0,
0 /* No PER value map */
......@@ -156,7 +156,7 @@ static asn_oer_constraints_t asn_OER_memb_Ngap_usageCountDL_constr_5
static asn_per_constraints_t asn_PER_memb_Ngap_usageCountDL_constr_5
CC_NOTUSED = {
{APC_CONSTRAINED, 64, -1, 0,
18446744073709551615} /* (0..18446744073709551615) */,
ULLONG_MAX} /* (0..18446744073709551615) */,
{APC_UNCONSTRAINED, -1, -1, 0, 0},
0,
0 /* No PER value map */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment