Re: warning: cast from 'unsigned char *' to 'unsigned short *'
Nick Wellnhofer via xml <[email protected]> Tue, 23 Mar 2021 11:46:43 +0100
| Newsgroups | gmane.comp.gnome.lib.xml.general |
|---|---|
| Message-ID | <[email protected]> |
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