Convert C++11 style loops to C++99 style loops

Restores ability to build with older versions of GCC (such as that
supplied by RHEL/CentOS).