fix -Wunreachable-code-loop-increment

`glGetError()` may return more than one error, yet these loops never
iterated more than once. This CL fixes that, and cleans up some useless
casting.

Same fix as Ib2d3a6a95726fa954426a3644635dcf41fb571db.

Bug: 150166387
Test: TreeHugger
Change-Id: Ie569d385bb67fe2fdf2003577614e6b35ed9f17c
1 file changed