Nikolay Sivov : comctl32/rebar: Do not use global variable for debug buffer (Coverity).

Alexandre Julliard julliard at winehq.org
Mon Jan 28 16:17:00 CST 2019


Module: wine
Branch: master
Commit: fc87823654ccb4830d54bf91a880e82577635f0b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=fc87823654ccb4830d54bf91a880e82577635f0b

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Jan 27 08:57:24 2019 +0300

comctl32/rebar: Do not use global variable for debug buffer (Coverity).

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/rebar.c | 39 ++++++++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c
index 20ce49b..aaa1047 100644
--- a/dlls/comctl32/rebar.c
+++ b/dlls/comctl32/rebar.c
@@ -281,6 +281,9 @@ static const char * const band_stylename[] = {
     "RBBS_VARIABLEHEIGHT",     /* 0040 */
     "RBBS_GRIPPERALWAYS",      /* 0080 */
     "RBBS_NOGRIPPER",          /* 0100 */
+    "RBBS_USECHEVRON",         /* 0200 */
+    "RBBS_HIDETITLE",          /* 0400 */
+    "RBBS_TOPALIGN",           /* 0800 */
     NULL };
 
 static const char * const band_maskname[] = {
@@ -296,50 +299,52 @@ static const char * const band_maskname[] = {
     "RBBIM_IDEALSIZE",     /*    0x00000200 */
     "RBBIM_LPARAM",        /*    0x00000400 */
     "RBBIM_HEADERSIZE",    /*    0x00000800 */
+    "RBBIM_CHEVRONLOCATION", /*  0x00001000 */
+    "RBBIM_CHEVRONSTATE",  /*    0x00002000 */
     NULL };
 
 
-static CHAR line[200];
-
 static const WCHAR themeClass[] = { 'R','e','b','a','r',0 };
 
 static CHAR *
-REBAR_FmtStyle( UINT style)
+REBAR_FmtStyle(char *buffer, UINT style)
 {
     INT i = 0;
 
-    *line = 0;
+    *buffer = 0;
     while (band_stylename[i]) {
 	if (style & (1<<i)) {
-	    if (*line != 0) strcat(line, " | ");
-	    strcat(line, band_stylename[i]);
+	    if (*buffer) strcat(buffer, " | ");
+	    strcat(buffer, band_stylename[i]);
 	}
 	i++;
     }
-    return line;
+    return buffer;
 }
 
 
 static CHAR *
-REBAR_FmtMask( UINT mask)
+REBAR_FmtMask(char *buffer, UINT mask)
 {
     INT i = 0;
 
-    *line = 0;
+    *buffer = 0;
     while (band_maskname[i]) {
 	if (mask & (1<<i)) {
-	    if (*line != 0) strcat(line, " | ");
-	    strcat(line, band_maskname[i]);
+	    if (*buffer) strcat(buffer, " | ");
+	    strcat(buffer, band_maskname[i]);
 	}
 	i++;
     }
-    return line;
+    return buffer;
 }
 
 
 static VOID
 REBAR_DumpBandInfo(const REBARBANDINFOW *pB)
 {
+    char buff[300];
+
     if( !TRACE_ON(rebar) ) return;
     TRACE("band info: ");
     if (pB->fMask & RBBIM_ID)
@@ -349,9 +354,9 @@ REBAR_DumpBandInfo(const REBARBANDINFOW *pB)
         TRACE(", clrF=0x%06x, clrB=0x%06x", pB->clrFore, pB->clrBack);
     TRACE("\n");
 
-    TRACE("band info: mask=0x%08x (%s)\n", pB->fMask, REBAR_FmtMask(pB->fMask));
+    TRACE("band info: mask=0x%08x (%s)\n", pB->fMask, REBAR_FmtMask(buff, pB->fMask));
     if (pB->fMask & RBBIM_STYLE)
-	TRACE("band info: style=0x%08x (%s)\n", pB->fStyle, REBAR_FmtStyle(pB->fStyle));
+	TRACE("band info: style=0x%08x (%s)\n", pB->fStyle, REBAR_FmtStyle(buff, pB->fStyle));
     if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_HEADERSIZE | RBBIM_LPARAM )) {
 	TRACE("band info:");
 	if (pB->fMask & RBBIM_SIZE)
@@ -373,6 +378,7 @@ REBAR_DumpBandInfo(const REBARBANDINFOW *pB)
 static VOID
 REBAR_DumpBand (const REBAR_INFO *iP)
 {
+    char buff[300];
     REBAR_BAND *pB;
     UINT i;
 
@@ -398,10 +404,9 @@ REBAR_DumpBand (const REBAR_INFO *iP)
 	if (pB->fMask & RBBIM_COLORS)
             TRACE(" clrF=0x%06x clrB=0x%06x", pB->clrFore, pB->clrBack);
 	TRACE("\n");
-	TRACE("band # %u: mask=0x%08x (%s)\n", i, pB->fMask, REBAR_FmtMask(pB->fMask));
+	TRACE("band # %u: mask=0x%08x (%s)\n", i, pB->fMask, REBAR_FmtMask(buff, pB->fMask));
 	if (pB->fMask & RBBIM_STYLE)
-	    TRACE("band # %u: style=0x%08x (%s)\n",
-		  i, pB->fStyle, REBAR_FmtStyle(pB->fStyle));
+	    TRACE("band # %u: style=0x%08x (%s)\n", i, pB->fStyle, REBAR_FmtStyle(buff, pB->fStyle));
 	TRACE("band # %u: xHeader=%u",
 	      i, pB->cxHeader);
 	if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_LPARAM )) {




More information about the wine-cvs mailing list