mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-02-21 21:40:18 +00:00
Fix clang-analyzer-optin.portability.UnixAPI clang-tidy check warnings
This commit is contained in:
parent
3abf82ca2c
commit
db2638ad46
@ -61,7 +61,7 @@ asn_enc_rval_t
|
||||
ENUMERATED_encode_uper(asn_TYPE_descriptor_t *td,
|
||||
asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
|
||||
ENUMERATED_t *st = (ENUMERATED_t *)sptr;
|
||||
long value;
|
||||
int64_t value;
|
||||
|
||||
if(asn_INTEGER2long(st, &value))
|
||||
_ASN_ENCODE_FAILED;
|
||||
|
@ -106,7 +106,7 @@ INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_by
|
||||
char scratch[32]; /* Enough for 64-bit integer */
|
||||
uint8_t *buf = st->buf;
|
||||
uint8_t *buf_end = st->buf + st->size;
|
||||
signed long accum;
|
||||
int64_t accum;
|
||||
ssize_t wrote = 0;
|
||||
char *p;
|
||||
int ret;
|
||||
@ -146,7 +146,7 @@ INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_by
|
||||
scr = (char *)alloca(scrsize);
|
||||
if(plainOrXER == 0)
|
||||
ret = snprintf(scr, scrsize,
|
||||
"%ld (%s)", accum, el->enum_name);
|
||||
"%lld (%s)", accum, el->enum_name);
|
||||
else
|
||||
ret = snprintf(scr, scrsize,
|
||||
"<%s/>", el->enum_name);
|
||||
@ -160,7 +160,7 @@ INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_by
|
||||
scr = scratch;
|
||||
ret = snprintf(scr, scrsize,
|
||||
(specs && specs->field_unsigned)
|
||||
?"%lu":"%ld", accum);
|
||||
?"%lld":"%lld", accum);
|
||||
}
|
||||
assert(ret > 0 && (size_t)ret < scrsize);
|
||||
return (cb(scr, ret, app_key) < 0) ? -1 : ret;
|
||||
@ -284,16 +284,16 @@ INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const
|
||||
|
||||
static int
|
||||
INTEGER__compar_value2enum(const void *kp, const void *am) {
|
||||
long a = *(const long *)kp;
|
||||
int64_t a = *(const int64_t *)kp;
|
||||
const asn_INTEGER_enum_map_t *el = (const asn_INTEGER_enum_map_t *)am;
|
||||
long b = el->nat_value;
|
||||
int64_t b = el->nat_value;
|
||||
if(a < b) return -1;
|
||||
else if(a == b) return 0;
|
||||
else return 1;
|
||||
}
|
||||
|
||||
const asn_INTEGER_enum_map_t *
|
||||
INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value) {
|
||||
INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, int64_t value) {
|
||||
int count = specs ? specs->map_count : 0;
|
||||
if(!count) return 0;
|
||||
return (asn_INTEGER_enum_map_t *)bsearch(&value, specs->value2enum,
|
||||
@ -321,8 +321,8 @@ INTEGER_st_prealloc(INTEGER_t *st, int min_size) {
|
||||
static enum xer_pbd_rval
|
||||
INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) {
|
||||
INTEGER_t *st = (INTEGER_t *)sptr;
|
||||
long sign = 1;
|
||||
long value;
|
||||
int64_t sign = 1;
|
||||
int64_t value;
|
||||
const char *lp;
|
||||
const char *lstart = (const char *)chunk_buf;
|
||||
const char *lstop = lstart + chunk_size;
|
||||
@ -339,7 +339,7 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun
|
||||
|
||||
if(chunk_size)
|
||||
ASN_DEBUG("INTEGER body %ld 0x%2x..0x%2x",
|
||||
(long)chunk_size, *lstart, lstop[-1]);
|
||||
(int64_t)chunk_size, *lstart, lstop[-1]);
|
||||
|
||||
/*
|
||||
* We may have received a tag here. It will be processed inline.
|
||||
@ -398,7 +398,7 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun
|
||||
}
|
||||
|
||||
{
|
||||
long new_value = value * 10;
|
||||
int64_t new_value = value * 10;
|
||||
|
||||
if(new_value / 10 != value)
|
||||
/* Overflow */
|
||||
@ -409,8 +409,8 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun
|
||||
if(value < 0) {
|
||||
/* Check whether it is a LONG_MIN */
|
||||
if(sign == -1
|
||||
&& (unsigned long)value
|
||||
== ~((unsigned long)-1 >> 1)) {
|
||||
&& (uint64_t)value
|
||||
== ~((uint64_t)-1 >> 1)) {
|
||||
sign = 1;
|
||||
} else {
|
||||
/* Overflow */
|
||||
@ -601,9 +601,9 @@ INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
|
||||
/* #10.5.6 */
|
||||
ASN_DEBUG("Integer with range %d bits", ct->range_bits);
|
||||
if(ct->range_bits >= 0) {
|
||||
long value;
|
||||
int64_t value;
|
||||
if(ct->range_bits == 32) {
|
||||
long lhalf;
|
||||
int64_t lhalf;
|
||||
value = per_get_few_bits(pd, 16);
|
||||
if(value < 0) _ASN_DECODE_STARVED;
|
||||
lhalf = per_get_few_bits(pd, 16);
|
||||
@ -651,7 +651,7 @@ INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
|
||||
/*
|
||||
* TODO: replace by in-place arithmetics.
|
||||
*/
|
||||
long value;
|
||||
int64_t value;
|
||||
if(asn_INTEGER2long(st, &value))
|
||||
_ASN_DECODE_FAILED;
|
||||
if(asn_long2INTEGER(st, value + ct->lower_bound))
|
||||
@ -670,7 +670,7 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td,
|
||||
const uint8_t *buf;
|
||||
const uint8_t *end;
|
||||
asn_per_constraint_t *ct;
|
||||
long value = 0;
|
||||
int64_t value = 0;
|
||||
|
||||
if(!st || st->size == 0) _ASN_ENCODE_FAILED;
|
||||
|
||||
@ -682,16 +682,16 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td,
|
||||
if(ct) {
|
||||
int inext = 0;
|
||||
if(specs && specs->field_unsigned) {
|
||||
unsigned long uval;
|
||||
uint64_t uval;
|
||||
if(asn_INTEGER2ulong(st, &uval))
|
||||
_ASN_ENCODE_FAILED;
|
||||
/* Check proper range */
|
||||
if(ct->flags & APC_SEMI_CONSTRAINED) {
|
||||
if(uval < (unsigned long)ct->lower_bound)
|
||||
if(uval < (uint64_t)ct->lower_bound)
|
||||
inext = 1;
|
||||
} else if(ct->range_bits >= 0) {
|
||||
if(uval < (unsigned long)ct->lower_bound
|
||||
|| uval > (unsigned long)ct->upper_bound)
|
||||
if(uval < (uint64_t)ct->lower_bound
|
||||
|| uval > (uint64_t)ct->upper_bound)
|
||||
inext = 1;
|
||||
}
|
||||
ASN_DEBUG("Value %lu (%02x/%d) lb %lu ub %lu %s",
|
||||
@ -733,7 +733,7 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td,
|
||||
ct->range_bits);
|
||||
if(ct->range_bits == 32) {
|
||||
/* TODO: extend to >32 bits */
|
||||
long v = value - ct->lower_bound;
|
||||
int64_t v = value - ct->lower_bound;
|
||||
if(per_put_few_bits(po, v >> 1, 31)
|
||||
|| per_put_few_bits(po, v, 1))
|
||||
_ASN_ENCODE_FAILED;
|
||||
@ -764,11 +764,11 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td,
|
||||
}
|
||||
|
||||
int
|
||||
asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) {
|
||||
asn_INTEGER2long(const INTEGER_t *iptr, int64_t *lptr) {
|
||||
uint8_t *b;
|
||||
uint8_t *end;
|
||||
size_t size;
|
||||
long l;
|
||||
int64_t l;
|
||||
|
||||
/* Sanity checking */
|
||||
if(!iptr || !iptr->buf || !lptr) {
|
||||
@ -781,7 +781,7 @@ asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) {
|
||||
size = iptr->size;
|
||||
end = b + size; /* Where to stop */
|
||||
|
||||
if(size > sizeof(long)) {
|
||||
if(size > sizeof(int64_t)) {
|
||||
uint8_t *end1 = end - 1;
|
||||
/*
|
||||
* Slightly more advanced processing,
|
||||
@ -799,7 +799,7 @@ asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) {
|
||||
}
|
||||
|
||||
size = end - b;
|
||||
if(size > sizeof(long)) {
|
||||
if(size > sizeof(int64_t)) {
|
||||
/* Still cannot fit the long */
|
||||
errno = ERANGE;
|
||||
return -1;
|
||||
@ -825,10 +825,10 @@ asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) {
|
||||
}
|
||||
|
||||
int
|
||||
asn_INTEGER2ulong(const INTEGER_t *iptr, unsigned long *lptr) {
|
||||
asn_INTEGER2ulong(const INTEGER_t *iptr, uint64_t *lptr) {
|
||||
uint8_t *b;
|
||||
uint8_t *end;
|
||||
unsigned long l;
|
||||
uint64_t l;
|
||||
size_t size;
|
||||
|
||||
if(!iptr || !iptr->buf || !lptr) {
|
||||
@ -841,9 +841,9 @@ asn_INTEGER2ulong(const INTEGER_t *iptr, unsigned long *lptr) {
|
||||
end = b + size;
|
||||
|
||||
/* If all extra leading bytes are zeroes, ignore them */
|
||||
for(; size > sizeof(unsigned long); b++, size--) {
|
||||
for(; size > sizeof(uint64_t); b++, size--) {
|
||||
if(*b) {
|
||||
/* Value won't fit unsigned long */
|
||||
/* Value won't fit uint64_t */
|
||||
errno = ERANGE;
|
||||
return -1;
|
||||
}
|
||||
@ -858,7 +858,7 @@ asn_INTEGER2ulong(const INTEGER_t *iptr, unsigned long *lptr) {
|
||||
}
|
||||
|
||||
int
|
||||
asn_ulong2INTEGER(INTEGER_t *st, unsigned long value) {
|
||||
asn_ulong2INTEGER(INTEGER_t *st, uint64_t value) {
|
||||
uint8_t *buf;
|
||||
uint8_t *end;
|
||||
uint8_t *b;
|
||||
@ -872,7 +872,7 @@ asn_ulong2INTEGER(INTEGER_t *st, unsigned long value) {
|
||||
|
||||
end = buf + (sizeof(value) + 1);
|
||||
buf[0] = 0;
|
||||
for(b = buf + 1, shr = (sizeof(long)-1)*8; b < end; shr -= 8, b++)
|
||||
for(b = buf + 1, shr = (sizeof(int64_t)-1)*8; b < end; shr -= 8, b++)
|
||||
*b = (uint8_t)(value >> shr);
|
||||
|
||||
if(st->buf) FREEMEM(st->buf);
|
||||
@ -883,7 +883,7 @@ asn_ulong2INTEGER(INTEGER_t *st, unsigned long value) {
|
||||
}
|
||||
|
||||
int
|
||||
asn_long2INTEGER(INTEGER_t *st, long value) {
|
||||
asn_long2INTEGER(INTEGER_t *st, int64_t value) {
|
||||
uint8_t *buf;
|
||||
uint8_t *bp;
|
||||
uint8_t *p;
|
||||
@ -897,7 +897,7 @@ asn_long2INTEGER(INTEGER_t *st, long value) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
buf = (uint8_t *)MALLOC(sizeof(value));
|
||||
buf = (uint8_t *)MALLOC(8);
|
||||
if(!buf) return -1;
|
||||
|
||||
if(*(char *)&littleEndian) {
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include <asn_application.h>
|
||||
#include <asn_codecs_prim.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
@ -20,7 +21,7 @@ extern "C"
|
||||
/* Map with <tag> to integer value association */
|
||||
typedef struct asn_INTEGER_enum_map_s
|
||||
{
|
||||
long nat_value; /* associated native integer value */
|
||||
int64_t nat_value; /* associated native integer value */
|
||||
size_t enum_len; /* strlen("tag") */
|
||||
const char *enum_name; /* "tag" */
|
||||
} asn_INTEGER_enum_map_t;
|
||||
@ -55,15 +56,15 @@ extern "C"
|
||||
* -1/ERANGE: Value encoded is out of range for long representation
|
||||
* -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()).
|
||||
*/
|
||||
int asn_INTEGER2long(const INTEGER_t *i, long *l);
|
||||
int asn_INTEGER2ulong(const INTEGER_t *i, unsigned long *l);
|
||||
int asn_long2INTEGER(INTEGER_t *i, long l);
|
||||
int asn_ulong2INTEGER(INTEGER_t *i, unsigned long l);
|
||||
int asn_INTEGER2long(const INTEGER_t *i, int64_t *l);
|
||||
int asn_INTEGER2ulong(const INTEGER_t *i, uint64_t *l);
|
||||
int asn_long2INTEGER(INTEGER_t *i, int64_t l);
|
||||
int asn_ulong2INTEGER(INTEGER_t *i, uint64_t l);
|
||||
|
||||
/*
|
||||
* Convert the integer value into the corresponding enumeration map entry.
|
||||
*/
|
||||
const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value);
|
||||
const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, int64_t value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -100,14 +100,14 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
||||
const void *constbuf;
|
||||
void *nonconstbuf;
|
||||
} unconst_buf;
|
||||
long l;
|
||||
int64_t l;
|
||||
|
||||
unconst_buf.constbuf = buf_ptr;
|
||||
tmp.buf = (uint8_t *)unconst_buf.nonconstbuf;
|
||||
tmp.size = length;
|
||||
|
||||
if((specs&&specs->field_unsigned)
|
||||
? asn_INTEGER2ulong(&tmp, (unsigned long*)&l)
|
||||
? asn_INTEGER2ulong(&tmp, (uint64_t*)&l)
|
||||
: asn_INTEGER2long(&tmp, &l)) {
|
||||
rval.code = RC_FAIL;
|
||||
rval.consumed = 0;
|
||||
@ -133,7 +133,7 @@ asn_enc_rval_t
|
||||
NativeInteger_encode_der(asn_TYPE_descriptor_t *sd, void *ptr,
|
||||
int tag_mode, ber_tlv_tag_t tag,
|
||||
asn_app_consume_bytes_f *cb, void *app_key) {
|
||||
unsigned long native = *(unsigned long *)ptr; /* Disable sign ext. */
|
||||
uint64_t native = *(uint64_t *)ptr; /* Disable sign ext. */
|
||||
asn_enc_rval_t erval;
|
||||
INTEGER_t tmp;
|
||||
|
||||
@ -185,9 +185,9 @@ NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
||||
rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr,
|
||||
opt_mname, buf_ptr, size);
|
||||
if(rval.code == RC_OK) {
|
||||
long l;
|
||||
int64_t l;
|
||||
if((specs&&specs->field_unsigned)
|
||||
? asn_INTEGER2ulong(&st, (unsigned long*)&l)
|
||||
? asn_INTEGER2ulong(&st, (uint64_t*)&l)
|
||||
: asn_INTEGER2long(&st, &l)) {
|
||||
rval.code = RC_FAIL;
|
||||
rval.consumed = 0;
|
||||
@ -238,7 +238,7 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
|
||||
|
||||
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
|
||||
asn_dec_rval_t rval;
|
||||
long *native = (long *)*sptr;
|
||||
int64_t *native = (int64_t *)*sptr;
|
||||
INTEGER_t tmpint;
|
||||
void *tmpintptr = &tmpint;
|
||||
|
||||
@ -246,7 +246,7 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
|
||||
ASN_DEBUG("Decoding NativeInteger %s (UPER)", td->name);
|
||||
|
||||
if(!native) {
|
||||
native = (long *)(*sptr = CALLOC(1, sizeof(*native)));
|
||||
native = (int64_t *)(*sptr = CALLOC(1, sizeof(*native)));
|
||||
if(!native) _ASN_DECODE_FAILED;
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
|
||||
&tmpintptr, pd);
|
||||
if(rval.code == RC_OK) {
|
||||
if((specs&&specs->field_unsigned)
|
||||
? asn_INTEGER2ulong(&tmpint, (unsigned long*)native)
|
||||
? asn_INTEGER2ulong(&tmpint, (uint64_t*)native)
|
||||
: asn_INTEGER2long(&tmpint, native))
|
||||
rval.code = RC_FAIL;
|
||||
else
|
||||
|
@ -61,7 +61,7 @@ asn_enc_rval_t
|
||||
ENUMERATED_encode_uper(asn_TYPE_descriptor_t *td,
|
||||
asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
|
||||
ENUMERATED_t *st = (ENUMERATED_t *)sptr;
|
||||
long value;
|
||||
int64_t value;
|
||||
|
||||
if(asn_INTEGER2long(st, &value))
|
||||
_ASN_ENCODE_FAILED;
|
||||
|
@ -293,7 +293,7 @@ INTEGER__compar_value2enum(const void *kp, const void *am) {
|
||||
}
|
||||
|
||||
const asn_INTEGER_enum_map_t *
|
||||
INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value) {
|
||||
INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, int64_t value) {
|
||||
int count = specs ? specs->map_count : 0;
|
||||
if(!count) return 0;
|
||||
return (asn_INTEGER_enum_map_t *)bsearch(&value, specs->value2enum,
|
||||
@ -651,7 +651,7 @@ INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
|
||||
/*
|
||||
* TODO: replace by in-place arithmetics.
|
||||
*/
|
||||
long value;
|
||||
int64_t value;
|
||||
if(asn_INTEGER2long(st, &value))
|
||||
_ASN_DECODE_FAILED;
|
||||
if(asn_long2INTEGER(st, value + ct->lower_bound))
|
||||
@ -670,7 +670,7 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td,
|
||||
const uint8_t *buf;
|
||||
const uint8_t *end;
|
||||
asn_per_constraint_t *ct;
|
||||
long value = 0;
|
||||
int64_t value = 0;
|
||||
|
||||
if(!st || st->size == 0) _ASN_ENCODE_FAILED;
|
||||
|
||||
@ -682,7 +682,7 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td,
|
||||
if(ct) {
|
||||
int inext = 0;
|
||||
if(specs && specs->field_unsigned) {
|
||||
unsigned long uval;
|
||||
uint64_t uval;
|
||||
if(asn_INTEGER2ulong(st, &uval))
|
||||
_ASN_ENCODE_FAILED;
|
||||
/* Check proper range */
|
||||
@ -764,7 +764,7 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td,
|
||||
}
|
||||
|
||||
int
|
||||
asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) {
|
||||
asn_INTEGER2long(const INTEGER_t *iptr, int64_t *lptr) {
|
||||
uint8_t *b;
|
||||
uint8_t *end;
|
||||
size_t size;
|
||||
@ -825,7 +825,7 @@ asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) {
|
||||
}
|
||||
|
||||
int
|
||||
asn_INTEGER2ulong(const INTEGER_t *iptr, unsigned long *lptr) {
|
||||
asn_INTEGER2ulong(const INTEGER_t *iptr, uint64_t *lptr) {
|
||||
uint8_t *b;
|
||||
uint8_t *end;
|
||||
unsigned long l;
|
||||
@ -858,7 +858,7 @@ asn_INTEGER2ulong(const INTEGER_t *iptr, unsigned long *lptr) {
|
||||
}
|
||||
|
||||
int
|
||||
asn_ulong2INTEGER(INTEGER_t *st, unsigned long value) {
|
||||
asn_ulong2INTEGER(INTEGER_t *st, uint64_t value) {
|
||||
uint8_t *buf;
|
||||
uint8_t *end;
|
||||
uint8_t *b;
|
||||
@ -883,7 +883,7 @@ asn_ulong2INTEGER(INTEGER_t *st, unsigned long value) {
|
||||
}
|
||||
|
||||
int
|
||||
asn_long2INTEGER(INTEGER_t *st, long value) {
|
||||
asn_long2INTEGER(INTEGER_t *st, int64_t value) {
|
||||
uint8_t *buf;
|
||||
uint8_t *bp;
|
||||
uint8_t *p;
|
||||
@ -897,7 +897,7 @@ asn_long2INTEGER(INTEGER_t *st, long value) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
buf = (uint8_t *)MALLOC(sizeof(value));
|
||||
buf = (uint8_t *)MALLOC(8);
|
||||
if(!buf) return -1;
|
||||
|
||||
if(*(char *)&littleEndian) {
|
||||
|
@ -20,7 +20,7 @@ extern "C"
|
||||
/* Map with <tag> to integer value association */
|
||||
typedef struct asn_INTEGER_enum_map_s
|
||||
{
|
||||
long nat_value; /* associated native integer value */
|
||||
int64_t nat_value; /* associated native integer value */
|
||||
size_t enum_len; /* strlen("tag") */
|
||||
const char *enum_name; /* "tag" */
|
||||
} asn_INTEGER_enum_map_t;
|
||||
@ -55,15 +55,15 @@ extern "C"
|
||||
* -1/ERANGE: Value encoded is out of range for long representation
|
||||
* -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()).
|
||||
*/
|
||||
int asn_INTEGER2long(const INTEGER_t *i, long *l);
|
||||
int asn_INTEGER2ulong(const INTEGER_t *i, unsigned long *l);
|
||||
int asn_long2INTEGER(INTEGER_t *st, long value);
|
||||
int asn_ulong2INTEGER(INTEGER_t *st, unsigned long value);
|
||||
int asn_INTEGER2long(const INTEGER_t *i, int64_t *l);
|
||||
int asn_INTEGER2ulong(const INTEGER_t *i, uint64_t *l);
|
||||
int asn_long2INTEGER(INTEGER_t *st, int64_t value);
|
||||
int asn_ulong2INTEGER(INTEGER_t *st, uint64_t value);
|
||||
|
||||
/*
|
||||
* Convert the integer value into the corresponding enumeration map entry.
|
||||
*/
|
||||
const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value);
|
||||
const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, int64_t value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
||||
asn_TYPE_descriptor_t *td,
|
||||
void **nint_ptr, const void *buf_ptr, size_t size, int tag_mode) {
|
||||
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
|
||||
long *native = (long *)*nint_ptr;
|
||||
int64_t *native = (int64_t *)*nint_ptr;
|
||||
asn_dec_rval_t rval;
|
||||
ber_tlv_len_t length;
|
||||
|
||||
@ -57,7 +57,7 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
||||
* If the structure is not there, allocate it.
|
||||
*/
|
||||
if(native == NULL) {
|
||||
native = (long *)(*nint_ptr = CALLOC(1, sizeof(*native)));
|
||||
native = (int64_t *)(*nint_ptr = CALLOC(1, sizeof(*native)));
|
||||
if(native == NULL) {
|
||||
rval.code = RC_FAIL;
|
||||
rval.consumed = 0;
|
||||
@ -100,14 +100,14 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
||||
const void *constbuf;
|
||||
void *nonconstbuf;
|
||||
} unconst_buf;
|
||||
long l;
|
||||
int64_t l;
|
||||
|
||||
unconst_buf.constbuf = buf_ptr;
|
||||
tmp.buf = (uint8_t *)unconst_buf.nonconstbuf;
|
||||
tmp.size = length;
|
||||
|
||||
if((specs&&specs->field_unsigned)
|
||||
? asn_INTEGER2ulong(&tmp, (unsigned long *)&l)
|
||||
? asn_INTEGER2ulong(&tmp, (uint64_t *)&l)
|
||||
: asn_INTEGER2long(&tmp, &l)) {
|
||||
rval.code = RC_FAIL;
|
||||
rval.consumed = 0;
|
||||
@ -133,7 +133,7 @@ asn_enc_rval_t
|
||||
NativeInteger_encode_der(asn_TYPE_descriptor_t *sd, void *ptr,
|
||||
int tag_mode, ber_tlv_tag_t tag,
|
||||
asn_app_consume_bytes_f *cb, void *app_key) {
|
||||
unsigned long native = *(unsigned long *)ptr; /* Disable sign ext. */
|
||||
uint64_t native = *(uint64_t *)ptr; /* Disable sign ext. */
|
||||
asn_enc_rval_t erval;
|
||||
INTEGER_t tmp;
|
||||
|
||||
@ -174,10 +174,10 @@ NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
||||
asn_dec_rval_t rval;
|
||||
INTEGER_t st;
|
||||
void *st_ptr = (void *)&st;
|
||||
long *native = (long *)*sptr;
|
||||
int64_t *native = (int64_t *)*sptr;
|
||||
|
||||
if(!native) {
|
||||
native = (long *)(*sptr = CALLOC(1, sizeof(*native)));
|
||||
native = (int64_t *)(*sptr = CALLOC(1, sizeof(*native)));
|
||||
if(!native) _ASN_DECODE_FAILED;
|
||||
}
|
||||
|
||||
@ -185,9 +185,9 @@ NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
||||
rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr,
|
||||
opt_mname, buf_ptr, size);
|
||||
if(rval.code == RC_OK) {
|
||||
long l;
|
||||
int64_t l;
|
||||
if((specs&&specs->field_unsigned)
|
||||
? asn_INTEGER2ulong(&st, (unsigned long *)&l)
|
||||
? asn_INTEGER2ulong(&st, (uint64_t *)&l)
|
||||
: asn_INTEGER2long(&st, &l)) {
|
||||
rval.code = RC_FAIL;
|
||||
rval.consumed = 0;
|
||||
@ -238,7 +238,7 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
|
||||
|
||||
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
|
||||
asn_dec_rval_t rval;
|
||||
long *native = (long *)*sptr;
|
||||
int64_t *native = (int64_t *)*sptr;
|
||||
INTEGER_t tmpint;
|
||||
void *tmpintptr = &tmpint;
|
||||
|
||||
@ -246,7 +246,7 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
|
||||
ASN_DEBUG("Decoding NativeInteger %s (UPER)", td->name);
|
||||
|
||||
if(!native) {
|
||||
native = (long *)(*sptr = CALLOC(1, sizeof(*native)));
|
||||
native = (int64_t *)(*sptr = CALLOC(1, sizeof(*native)));
|
||||
if(!native) _ASN_DECODE_FAILED;
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
|
||||
&tmpintptr, pd);
|
||||
if(rval.code == RC_OK) {
|
||||
if((specs&&specs->field_unsigned)
|
||||
? asn_INTEGER2ulong(&tmpint, (unsigned long *)native)
|
||||
? asn_INTEGER2ulong(&tmpint, (uint64_t *)native)
|
||||
: asn_INTEGER2long(&tmpint, native))
|
||||
rval.code = RC_FAIL;
|
||||
else
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <netdb.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
@ -900,7 +901,7 @@ int EXPORT supl_ctx_free(supl_ctx_t *ctx)
|
||||
|
||||
static int supl_more_rrlp(PDU_t *rrlp)
|
||||
{
|
||||
long value;
|
||||
int64_t value;
|
||||
|
||||
return (rrlp->component.present == RRLP_Component_PR_assistanceData &&
|
||||
rrlp->component.choice.assistanceData.moreAssDataToBeSent &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user