Unverified Commit 1d155c23 authored by Mouse's avatar Mouse Committed by GitHub

Update INTEGER.c

1. Address some compiler warnings (uninitialized vars).
2. Provide workaround for GCC compiler bug that remains outstanding for 3 years now.
parent 29507275
...@@ -103,10 +103,10 @@ INTEGER__dump(const asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_cons ...@@ -103,10 +103,10 @@ INTEGER__dump(const asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_cons
char scratch[32]; char scratch[32];
uint8_t *buf = st->buf; uint8_t *buf = st->buf;
uint8_t *buf_end = st->buf + st->size; uint8_t *buf_end = st->buf + st->size;
intmax_t value; intmax_t value = 0;
ssize_t wrote = 0; ssize_t wrote = 0;
char *p; char *p = NULL;
int ret; int ret = -1;
if(specs && specs->field_unsigned) if(specs && specs->field_unsigned)
ret = asn_INTEGER2umax(st, (uintmax_t *)&value); ret = asn_INTEGER2umax(st, (uintmax_t *)&value);
...@@ -212,7 +212,7 @@ asn__integer_convert(const uint8_t *b, const uint8_t *end) { ...@@ -212,7 +212,7 @@ asn__integer_convert(const uint8_t *b, const uint8_t *end) {
int int
asn_INTEGER2imax(const INTEGER_t *iptr, intmax_t *lptr) { asn_INTEGER2imax(const INTEGER_t *iptr, intmax_t *lptr) {
uint8_t *b, *end; uint8_t *b, *end;
size_t size; size_t size = 0;
/* Sanity checking */ /* Sanity checking */
if(!iptr || !iptr->buf || !lptr) { if(!iptr || !iptr->buf || !lptr) {
...@@ -324,7 +324,7 @@ asn_imax2INTEGER(INTEGER_t *st, intmax_t value) { ...@@ -324,7 +324,7 @@ asn_imax2INTEGER(INTEGER_t *st, intmax_t value) {
uint8_t *buf, *bp; uint8_t *buf, *bp;
uint8_t *p; uint8_t *p;
uint8_t *pstart; uint8_t *pstart;
uint8_t *pend1; volatile uint8_t *pend1;
int littleEndian = 1; /* Run-time detection */ int littleEndian = 1; /* Run-time detection */
int add; int add;
...@@ -364,8 +364,7 @@ asn_imax2INTEGER(INTEGER_t *st, intmax_t value) { ...@@ -364,8 +364,7 @@ asn_imax2INTEGER(INTEGER_t *st, intmax_t value) {
break; break;
} }
/* Copy the integer body */ /* Copy the integer body */
pend1 += add; for(bp = buf, pend1 += add; p != pend1; p += add)
for(bp = buf; p != pend1; p += add)
*bp++ = *p; *bp++ = *p;
if(st->buf) FREEMEM(st->buf); if(st->buf) FREEMEM(st->buf);
......
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