NCD4_dumpbytes: use correct swapline for object size

This addresses a type-punning warning in gcc:
gcc11 warns about one of the strict aliasing violations:
d4util.h:44:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   44 |     *((unsigned int*)ip) = u.i; \
      |      ~^~~~~~~~~~~~~~~~~~
d4dump.c:51:13: note: in expansion of macro 'swapinline32'
   51 |             swapinline32(v.u64);
      |             ^~~~~~~~~~~~

Signed-off-by: Egbert Eich <eich@suse.com>
This commit is contained in:
Egbert Eich 2021-07-10 09:08:33 +02:00
parent dfdc278907
commit 9c319b134a

View File

@ -48,12 +48,12 @@ NCD4_dumpbytes(size_t size, const void* data0, int swap)
if(swap) { if(swap) {
swapinline16(v.u16); swapinline16(v.u16);
swapinline32(v.u32); swapinline32(v.u32);
swapinline32(v.u64); swapinline64(v.u64);
swapinline16(v.i16); swapinline16(v.i16);
swapinline32(v.i32); swapinline32(v.i32);
swapinline32(v.i64); swapinline64(v.i64);
swapinline32(v.f32); swapinline32(v.f32);
swapinline32(v.f64); swapinline64(v.f64);
} }
if(v.s[0] == '\r') strcpy(v.s,"\\r"); if(v.s[0] == '\r') strcpy(v.s,"\\r");
else if(v.s[0] == '\n') strcpy(v.s,"\\n"); else if(v.s[0] == '\n') strcpy(v.s,"\\n");