From 592e6aa94234299c7696abce28df762f16054d10 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 23 Jul 2012 14:51:50 +0200 Subject: [PATCH] gdi32: Work around a gcc array out of bounds warning. --- dlls/gdi32/palette.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/dlls/gdi32/palette.c b/dlls/gdi32/palette.c index 338d8601ad6..afb723bb2c0 100644 --- a/dlls/gdi32/palette.c +++ b/dlls/gdi32/palette.c @@ -89,18 +89,11 @@ HPALETTE PALETTE_Init(void) palPtr->palVersion = 0x300; palPtr->palNumEntries = 20; - for (i = 0; i < 10; i++) + for (i = 0; i < 20; i++) { - palPtr->palPalEntry[i].peRed = entries[i].rgbRed; - palPtr->palPalEntry[i].peGreen = entries[i].rgbGreen; - palPtr->palPalEntry[i].peBlue = entries[i].rgbBlue; - palPtr->palPalEntry[i].peFlags = 0; - } - for (i = 10; i < 20; i++) - { - palPtr->palPalEntry[i].peRed = entries[236 + i].rgbRed; - palPtr->palPalEntry[i].peGreen = entries[236 + i].rgbGreen; - palPtr->palPalEntry[i].peBlue = entries[236 + i].rgbBlue; + palPtr->palPalEntry[i].peRed = entries[i < 10 ? i : 236 + i].rgbRed; + palPtr->palPalEntry[i].peGreen = entries[i < 10 ? i : 236 + i].rgbGreen; + palPtr->palPalEntry[i].peBlue = entries[i < 10 ? i : 236 + i].rgbBlue; palPtr->palPalEntry[i].peFlags = 0; } return CreatePalette( palPtr );