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: I67f0f30445cfb6ce86c3de9984b4f87f9f302c1d
1 file changed