Re: [xml] warning: cast from 'unsigned char *' to 'unsigned short *'



On 23/03/2021 00:38, Jeffrey Walton via xml wrote:
encoding.c:500:26: warning: cast from 'const unsigned char *' to
       'unsigned short *' increases required alignment from 1 to 2 [-Wcast-align]
     unsigned short* in = (unsigned short*) inb;

If the buffers are aligned, then you can use the following to squash
the warning:

This is a known issue. Internal use of these functions should be safe but the encoding API is also exposed publically and could be used with unaligned pointers. So the warning is valid.

Nick


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]