This commit is contained in:
Lev Walkin 2017-07-25 09:07:45 -07:00
parent 69353a320b
commit b8933edbdc
1 changed files with 6 additions and 7 deletions

View File

@ -18,6 +18,10 @@ NativeInteger_decode_oer(asn_codec_ctx_t *opt_codec_ctx,
asn_dec_rval_t rval = {RC_OK, 0};
long *native = (long *)*nint_ptr;
asn_oer_constraint_t *ct;
INTEGER_t tmpint;
INTEGER_t *tmpintptr = &tmpint;
memset(&tmpint, 0, sizeof(tmpint));
(void)opt_codec_ctx;
@ -29,10 +33,6 @@ NativeInteger_decode_oer(asn_codec_ctx_t *opt_codec_ctx,
if(!constraints) constraints = td->oer_constraints;
ct = constraints ? &constraints->value : 0;
INTEGER_t tmpint;
INTEGER_t *tmpintptr = &tmpint;
memset(&tmpint, 0, sizeof(tmpint));
/*
* OPTIMIZATION: Encode directly rather than passing through INTEGER.
* Saves a memory allocation.
@ -77,17 +77,16 @@ NativeInteger_encode_oer(asn_TYPE_descriptor_t *td,
asn_oer_constraints_t *constraints, void *sptr,
asn_app_consume_bytes_f *cb, void *app_key) {
asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics;
INTEGER_t tmpint;
long native;
if(!sptr) ASN__ENCODE_FAILED;
native = *(const long *)sptr;
memset(&tmpint, 0, sizeof(tmpint));
ASN_DEBUG("Encoding %s %ld as NativeInteger", td ? td->name : "", native);
INTEGER_t tmpint;
memset(&tmpint, 0, sizeof(tmpint));
if((specs && specs->field_unsigned) ? asn_ulong2INTEGER(&tmpint, native)
: asn_long2INTEGER(&tmpint, native)) {
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint);