For me it looks like you try to trick Coverity here. No real fix, unless you check for (nColor >= 0)
gedmurphy@svn.reactos.org schrieb:
Author: gedmurphy Date: Tue Sep 23 14:02:32 2008 New Revision: 36435
URL: http://svn.reactos.org/svn/reactos?rev=36435&view=rev Log: Don't risk a negative array subscript. Fixes our one and only REVERSE_NEGATIVE error Fix for Coverity error CID: 766
Modified: trunk/reactos/dll/cpl/desk/advappdlg.c
Modified: trunk/reactos/dll/cpl/desk/advappdlg.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/advappdlg.c?re... ============================================================================== --- trunk/reactos/dll/cpl/desk/advappdlg.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/desk/advappdlg.c [iso-8859-1] Tue Sep 23 14:02:32 2008 @@ -23,7 +23,6 @@ RECT rect; HBRUSH hbrush; HWND hwndColorButton;
COLORREF crColor = g->ThemeAdv.crColor[nColor]; HGDIOBJ hgdiTmp;
if (nColor != -1)
@@ -42,7 +41,7 @@ rect.top = 2; rect.right = 22; rect.bottom = 13;
hbrush = CreateSolidBrush(crColor);
FillRect(hdcCompat, &rect, hbrush); DeleteObject(hbrush);hbrush = CreateSolidBrush(g->ThemeAdv.crColor[nColor]);
That's exactly what I did. I hadn't realised the struct was pre-initialized with -1's. It's not a particularly a good design.
-----Original Message----- From: ros-dev-bounces@reactos.org [mailto:ros-dev-bounces@reactos.org] On Behalf Of Timo Kreuzer Sent: 24 September 2008 01:03 To: ros-dev@reactos.org Subject: Re: [ros-dev] [ros-diffs] [gedmurphy] 36435: Don't risk a negative array subscript. Fixes our one and only REVERSE_NEGATIVE error Fix for Coverity error CID: 766
For me it looks like you try to trick Coverity here. No real fix, unless you check for (nColor >= 0)
gedmurphy@svn.reactos.org schrieb:
Author: gedmurphy Date: Tue Sep 23 14:02:32 2008 New Revision: 36435
URL: http://svn.reactos.org/svn/reactos?rev=36435&view=rev Log: Don't risk a negative array subscript. Fixes our one and only
REVERSE_NEGATIVE error
Fix for Coverity error CID: 766
Modified: trunk/reactos/dll/cpl/desk/advappdlg.c
Modified: trunk/reactos/dll/cpl/desk/advappdlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/advappdlg.c?re v=36435&r1=36434&r2=36435&view=diff
============================================================================ ==
--- trunk/reactos/dll/cpl/desk/advappdlg.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/desk/advappdlg.c [iso-8859-1] Tue Sep 23
14:02:32 2008
@@ -23,7 +23,6 @@ RECT rect; HBRUSH hbrush; HWND hwndColorButton;
COLORREF crColor = g->ThemeAdv.crColor[nColor]; HGDIOBJ hgdiTmp;
if (nColor != -1)
@@ -42,7 +41,7 @@ rect.top = 2; rect.right = 22; rect.bottom = 13;
hbrush = CreateSolidBrush(crColor);
FillRect(hdcCompat, &rect, hbrush); DeleteObject(hbrush);hbrush = CreateSolidBrush(g->ThemeAdv.crColor[nColor]);
_______________________________________________ Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev