Merge pull request #1323 from pah/fix-memaccess

Fix warnings/errors on GCC 7/8 (-Wclass-memaccess, -Wsign-conversion, -Wformat-overflow)