A simple patch would have been to just remove count -= 1, but this
one also replace the while (count--) with a for(i = 0; i < count; i++)
which I believe is more easy to understand.
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
uint##bpp##_t *src; \
uint##bpp##_t rgb; \
uint8_t key[6]; \
- int rep = 0; \
+ int i, rep; \
uint8_t idx; \
\
src = (uint##bpp##_t *) buf; \
\
- count -= 1; \
- while (count--) { \
+ for (i = 0; i < count; i++) { \
rgb = *src++; \
rep = 0; \
- while (count && *src == rgb) { \
- rep++, src++, count--; \
+ while (i < count && *src == rgb) { \
+ rep++, src++, i++; \
} \
tight_palette_rgb2buf(rgb, bpp, key); \
if (!qdict_haskey(palette, (char *)key)) { \