NIFTI-Imaging / nifti_clib

C libraries for NIFTI support
Other
35 stars 25 forks source link

Fixed various type punning warnings by using memcpy() #172

Open seanm opened 1 year ago

seanm commented 1 year ago

2acc4449 was buggy, and undone with cedc42d2. This essentially restores 2acc4449 without the buggy pointer arithmetic.

Modern compilers optimize memcpy() very well, this will likely produce the same code.

seanm commented 1 year ago

@afni-rickr @hjmjohnson this is a fixed version of PR #166 which was buggy and undone by PR #170.

Don't merge as-is, I added some asserts to verify the address calculation is correct. They are just there as a test and will be removed.

Alas, no test actually enters this code, as I confirmed with the assert(0).