dwatteau / scummtr

Fan translation tools for SCUMM engine games
MIT License
23 stars 4 forks source link

[Portability] Strict-alignment warnings #10

Closed dwatteau closed 3 years ago

dwatteau commented 3 years ago

Clang reports this:

src/ScummRp/file.cpp:701:12: warning: cast from 'char *' to 'uint32 *' (aka 'unsigned int *') increases required
      alignment from 1 to 4 [-Wcast-align]
        bufferd = (uint32 *)buffer;
                  ^~~~~~~~~~~~~~~~
1 warning generated.

Indeed, we should maybe use memcpy(), or just access to the buffer in a simple and portable way.

dwatteau commented 3 years ago

Fixed in ecff30b86c022aa60941a8f71f7e7bc26e96f492 by rewriting it with a much simpler loop, as suggested by Thomas.