Log Message: Fix integer type misuse caught by gcc 4.4. PR 43291 from Makoto Fujiwara; the patches in the PR used unsafe (but less wrong) integer/pointer casts, so I did things somewhat differently.