Fixing build for g++ 4.8.2. This primarily consisted of avoiding iterators having the same name as loop variables, though deprecated conversions from string constants to char* were also avoided.