Merge pull request #829 from sappo/master

Problem: strndup is not available on all system
Problem: allocated string buffers are not NULL checked

Solution: check if malloc doesn’t return NULL
Merge pull request #830 from Asmod4n/master

Problem: allocated string buffers are not NULL checked
Problem: mingw 64Bit relies on int[32/64]/uint[32/64] definitions
whereas mingw 32Bit does not.
Solution: include those defines in case of mingw 64Bit and exclude them
in case of mingw 32Bit.