Commit 39ab82f3 authored by Vasil Velichkov's avatar Vasil Velichkov Committed by Lev Walkin

Fix two strict-aliasing errors

NativeReal.c:366:13: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
NativeReal.c:370:13: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
parent 6aac1c3c
......@@ -361,15 +361,24 @@ NativeReal_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
*/
NativeReal__network_swap(wire_size, ptr, scratch);
switch(wire_size) {
case sizeof(double):
if(NativeReal__set(td, sptr, *(const double *)scratch) < 0)
ASN__DECODE_FAILED;
break;
case sizeof(float):
if(NativeReal__set(td, sptr, *(const float *)scratch) < 0)
ASN__DECODE_FAILED;
break;
case sizeof(double):
{
double tmp;
memcpy(&tmp, scratch, sizeof(double));
if(NativeReal__set(td, sptr, tmp) < 0)
ASN__DECODE_FAILED;
}
break;
case sizeof(float):
{
float tmp;
memcpy(&tmp, scratch, sizeof(float));
if(NativeReal__set(td, sptr, tmp) < 0)
ASN__DECODE_FAILED;
}
break;
default:
ASN__DECODE_FAILED;
}
......
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