io.cpp: fix warnings about narrowing conversions

These were noted when playing around with C++11.