pnmdec: use explicit casts to remove const to avoid warning with clang