gcc doesn't complain about using %lx to write out a signed long, but it does complain about using it to read into a signed long. Technically it's right about the latter, so fix this properly rather than just suppress the message with a cast.