mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-28 18:04:51 +00:00
Merge branch 'next' of https://github.com/carlesfernandez/gnss-sdr into next
This commit is contained in:
commit
4d3d8eb364
@ -10,6 +10,8 @@ Checks: '-*,
|
||||
cert-msc50-cpp,
|
||||
cert-msc51-cpp,
|
||||
clang-analyzer-cplusplus.*,
|
||||
clang-analyzer-optin.performance.*,
|
||||
clang-analyzer-optin.portability.UnixAPI,
|
||||
clang-analyzer-security.*,
|
||||
cppcoreguidelines-pro-type-cstyle-cast,
|
||||
cppcoreguidelines-pro-type-static-cast-downcast,
|
||||
|
@ -4335,7 +4335,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int32_t, Gal
|
||||
}
|
||||
E1B_DVS = "0"; // *************** CHANGE THIS WHEN GALILEO SIGNAL IS VALID
|
||||
|
||||
std::string SVhealth_str = E5B_HS + std::to_string(galileo_ephemeris_iter->second.E5b_DVS_5) + "11" + "1" + E1B_DVS + E1B_HS + std::to_string(galileo_ephemeris_iter->second.E1B_DVS_5);
|
||||
std::string SVhealth_str = E5B_HS + std::to_string(galileo_ephemeris_iter->second.E5b_DVS_5) + "11" + "1" + std::string(E1B_DVS) + std::string(E1B_HS) + std::to_string(galileo_ephemeris_iter->second.E1B_DVS_5);
|
||||
SVhealth_str = "000000000"; // *************** CHANGE THIS WHEN GALILEO SIGNAL IS VALID
|
||||
int32_t SVhealth = Rinex_Printer::toInt(SVhealth_str, 9);
|
||||
line += Rinex_Printer::doub2for(static_cast<double>(SVhealth), 18, 2);
|
||||
|
@ -452,13 +452,15 @@ void geph2pos(gtime_t time, const geph_t *geph, double *rs, double *dts,
|
||||
x[i] = geph->pos[i];
|
||||
x[i + 3] = geph->vel[i];
|
||||
}
|
||||
for (tt = t < 0.0 ? -TSTEP : TSTEP; fabs(t) > 1e-9; t -= tt)
|
||||
tt = t < 0.0 ? -TSTEP : TSTEP;
|
||||
while (fabs(t) > 1e-9)
|
||||
{
|
||||
if (fabs(t) < TSTEP)
|
||||
{
|
||||
tt = t;
|
||||
}
|
||||
glorbit(tt, x, geph->acc);
|
||||
t -= tt;
|
||||
}
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
|
@ -324,8 +324,8 @@ void readsp3b(FILE *fp, char type, int *sats __attribute__((unused)), int ns, co
|
||||
/* compare precise ephemeris -------------------------------------------------*/
|
||||
int cmppeph(const void *p1, const void *p2)
|
||||
{
|
||||
auto *q1 = (peph_t *)p1;
|
||||
auto *q2 = (peph_t *)p2;
|
||||
auto *q1 = static_cast<const peph_t *>(p1);
|
||||
auto *q2 = static_cast<const peph_t *>(p2);
|
||||
double tt = timediff(q1->time, q2->time);
|
||||
return tt < -1e-9 ? -1 : (tt > 1e-9 ? 1 : q1->index - q2->index);
|
||||
}
|
||||
|
@ -3085,7 +3085,7 @@ void save_msm_obs(rtcm_t *rtcm, int sys, msm_h_t *h, const double *r,
|
||||
double tt;
|
||||
double wl;
|
||||
unsigned char code[32];
|
||||
char *msm_type = (char *)"";
|
||||
char *msm_type = const_cast<char *>("");
|
||||
char *q = nullptr;
|
||||
int i;
|
||||
int j;
|
||||
|
@ -643,7 +643,7 @@ char *code2obs(unsigned char code, int *freq)
|
||||
}
|
||||
if (code <= CODE_NONE || MAXCODE < code)
|
||||
{
|
||||
return (char *)"";
|
||||
return const_cast<char *>("");
|
||||
}
|
||||
if (freq)
|
||||
{
|
||||
@ -1450,7 +1450,7 @@ void matsprint(const double A[], int n, int m, int p, int q, std::string &buffer
|
||||
char buf_[256];
|
||||
sprintf(buf_, " %*.*f", p, q, A[i + j * n]);
|
||||
std::string s(buf_);
|
||||
buffer = buffer + s;
|
||||
buffer += s;
|
||||
}
|
||||
buffer += '\n';
|
||||
}
|
||||
@ -3320,8 +3320,8 @@ int geterp(const erp_t *erp, gtime_t time, double *erpv)
|
||||
/* compare ephemeris ---------------------------------------------------------*/
|
||||
int cmpeph(const void *p1, const void *p2)
|
||||
{
|
||||
auto *q1 = (eph_t *)p1;
|
||||
auto *q2 = (eph_t *)p2;
|
||||
auto *q1 = static_cast<const eph_t *>(p1);
|
||||
auto *q2 = static_cast<const eph_t *>(p2);
|
||||
return q1->ttr.time != q2->ttr.time ? static_cast<int>(q1->ttr.time - q2->ttr.time) : (q1->toe.time != q2->toe.time ? static_cast<int>(q1->toe.time - q2->toe.time) : q1->sat - q2->sat);
|
||||
}
|
||||
|
||||
@ -3370,8 +3370,8 @@ void uniqeph(nav_t *nav)
|
||||
/* compare glonass ephemeris -------------------------------------------------*/
|
||||
int cmpgeph(const void *p1, const void *p2)
|
||||
{
|
||||
auto *q1 = (geph_t *)p1;
|
||||
auto *q2 = (geph_t *)p2;
|
||||
auto *q1 = static_cast<const geph_t *>(p1);
|
||||
auto *q2 = static_cast<const geph_t *>(p2);
|
||||
return q1->tof.time != q2->tof.time ? static_cast<int>(q1->tof.time - q2->tof.time) : (q1->toe.time != q2->toe.time ? static_cast<int>(q1->toe.time - q2->toe.time) : q1->sat - q2->sat);
|
||||
}
|
||||
|
||||
@ -3421,8 +3421,8 @@ void uniqgeph(nav_t *nav)
|
||||
/* compare sbas ephemeris ----------------------------------------------------*/
|
||||
int cmpseph(const void *p1, const void *p2)
|
||||
{
|
||||
auto *q1 = (seph_t *)p1;
|
||||
auto *q2 = (seph_t *)p2;
|
||||
auto *q1 = static_cast<const seph_t *>(p1);
|
||||
auto *q2 = static_cast<const seph_t *>(p2);
|
||||
return q1->tof.time != q2->tof.time ? static_cast<int>(q1->tof.time - q2->tof.time) : (q1->t0.time != q2->t0.time ? static_cast<int>(q1->t0.time - q2->t0.time) : q1->sat - q2->sat);
|
||||
}
|
||||
|
||||
@ -3499,8 +3499,8 @@ void uniqnav(nav_t *nav)
|
||||
/* compare observation data -------------------------------------------------*/
|
||||
int cmpobs(const void *p1, const void *p2)
|
||||
{
|
||||
auto *q1 = (obsd_t *)p1;
|
||||
auto *q2 = (obsd_t *)p2;
|
||||
auto *q1 = static_cast<const obsd_t *>(p1);
|
||||
auto *q2 = static_cast<const obsd_t *>(p2);
|
||||
double tt = timediff(q1->time, q2->time);
|
||||
if (fabs(tt) > DTTOL)
|
||||
{
|
||||
@ -5087,7 +5087,7 @@ int rtk_uncompress(const char *file, char *uncfile)
|
||||
char tmpfile[1024] = "";
|
||||
char buff[1024];
|
||||
char *fname;
|
||||
char *dir = (char *)"";
|
||||
char *dir = const_cast<char *>("");
|
||||
|
||||
trace(3, "rtk_uncompress: file=%s\n", file);
|
||||
|
||||
|
@ -749,8 +749,8 @@ void readmsgs(const char *file, int sel, gtime_t ts, gtime_t te,
|
||||
/* compare sbas messages -----------------------------------------------------*/
|
||||
int cmpmsgs(const void *p1, const void *p2)
|
||||
{
|
||||
auto *q1 = (sbsmsg_t *)p1;
|
||||
auto *q2 = (sbsmsg_t *)p2;
|
||||
auto *q1 = static_cast<const sbsmsg_t *>(p1);
|
||||
auto *q2 = static_cast<const sbsmsg_t *>(p2);
|
||||
return q1->week != q2->week ? q1->week - q2->week : (q1->tow < q2->tow ? -1 : (q1->tow > q2->tow ? 1 : q1->prn - q2->prn));
|
||||
}
|
||||
|
||||
|
@ -1001,8 +1001,8 @@ int readsoldata(FILE *fp, gtime_t ts, gtime_t te, double tint, int qflag,
|
||||
/* compare solution data -----------------------------------------------------*/
|
||||
int cmpsol(const void *p1, const void *p2)
|
||||
{
|
||||
auto *q1 = (sol_t *)p1;
|
||||
auto *q2 = (sol_t *)p2;
|
||||
auto *q1 = static_cast<const sol_t *>(p1);
|
||||
auto *q2 = static_cast<const sol_t *>(p2);
|
||||
double tt = timediff(q1->time, q2->time);
|
||||
return tt < -0.0 ? -1 : (tt > 0.0 ? 1 : 0);
|
||||
}
|
||||
@ -1230,8 +1230,8 @@ void freesolstatbuf(solstatbuf_t *solstatbuf)
|
||||
/* compare solution status ---------------------------------------------------*/
|
||||
int cmpsolstat(const void *p1, const void *p2)
|
||||
{
|
||||
auto *q1 = (solstat_t *)p1;
|
||||
auto *q2 = (solstat_t *)p2;
|
||||
auto *q1 = static_cast<const solstat_t *>(p1);
|
||||
auto *q2 = static_cast<const solstat_t *>(p2);
|
||||
double tt = timediff(q1->time, q2->time);
|
||||
return tt < -0.0 ? -1 : (tt > 0.0 ? 1 : 0);
|
||||
}
|
||||
@ -1544,7 +1544,7 @@ int outnmea_rmc(unsigned char *buff, const sol_t *sol)
|
||||
char *p = reinterpret_cast<char *>(buff);
|
||||
char *q;
|
||||
char sum;
|
||||
char *emag = (char *)"E";
|
||||
char *emag = const_cast<char *>("E");
|
||||
|
||||
trace(3, "outnmea_rmc:\n");
|
||||
|
||||
|
@ -274,11 +274,11 @@ int openfile_(file_t *file, gtime_t time, char *msg)
|
||||
}
|
||||
if (file->mode & STR_MODE_R)
|
||||
{
|
||||
rw = (char *)"rb";
|
||||
rw = const_cast<char *>("rb");
|
||||
}
|
||||
else
|
||||
{
|
||||
rw = (char *)"wb";
|
||||
rw = const_cast<char *>("wb");
|
||||
}
|
||||
|
||||
if (!(file->fp = fopen(file->openpath, rw)))
|
||||
@ -1953,7 +1953,7 @@ void *ftpthread(void *arg)
|
||||
char cmd[2048];
|
||||
char env[1024] = "";
|
||||
char opt[1024];
|
||||
char *proxyopt = (char *)"";
|
||||
char *proxyopt = const_cast<char *>("");
|
||||
char *proto;
|
||||
int ret;
|
||||
|
||||
@ -2021,9 +2021,9 @@ void *ftpthread(void *arg)
|
||||
/* proxy settings for wget (ref [2]) */
|
||||
if (*proxyaddr)
|
||||
{
|
||||
proto = ftp->proto ? (char *)"http" : (char *)"ftp";
|
||||
proto = ftp->proto ? const_cast<char *>("http") : const_cast<char *>("ftp");
|
||||
sprintf(env, "set %s_proxy=http://%s & ", proto, proxyaddr);
|
||||
proxyopt = (char *)"--proxy=on ";
|
||||
proxyopt = const_cast<char *>("--proxy=on ");
|
||||
}
|
||||
/* download command (ref [2]) */
|
||||
if (ftp->proto == 0)
|
||||
|
@ -48,12 +48,12 @@ enum
|
||||
RTL_TCP_PAYLOAD_SIZE = 1024 * 4 // 4 KB
|
||||
};
|
||||
|
||||
rtl_tcp_signal_source_c_sptr
|
||||
rtl_tcp_make_signal_source_c(const std::string &address,
|
||||
rtl_tcp_signal_source_c_sptr rtl_tcp_make_signal_source_c(
|
||||
const std::string &address,
|
||||
int16_t port,
|
||||
bool flip_iq)
|
||||
{
|
||||
return gnuradio::get_initial_sptr(new rtl_tcp_signal_source_c(address,
|
||||
return rtl_tcp_signal_source_c_sptr(new rtl_tcp_signal_source_c(address,
|
||||
port,
|
||||
flip_iq));
|
||||
}
|
||||
|
@ -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…
Reference in New Issue
Block a user