Fix some signed/unsigned inconsistencies (and warnings).
See https://svn.boost.org/trac/boost/ticket/9646.