Re: [Rebar] Don't store band text if "" is passed into SetBandInfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 21 October 2003 8:26 pm, you wrote:
> On Tue, Oct 21, 2003 at 07:24:31PM +0100, Robert Shearman wrote:
> > @@ -3447,8 +3450,11 @@
> >  	}
> >  	if (lprbbi->lpText) {
> >  	    INT len = lstrlenW (lprbbi->lpText);
> > -	    lpBand->lpText = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
> > -	    strcpyW (lpBand->lpText, lprbbi->lpText);
> > +	    if (len > 1)
>
> Shouldn't this be len >= 1 ?

You are absolutely correct, although I have made it len > 0 to be consistent 
with InsertBandW.

Rob

Changelog:
- Don't store band text if "" is passed into SetBandInfo
Index: wine/dlls/comctl32/rebar.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/rebar.c,v
retrieving revision 1.78
diff -u -r1.78 rebar.c
--- wine/dlls/comctl32/rebar.c	7 Oct 2003 03:30:47 -0000	1.78
+++ wine/dlls/comctl32/rebar.c	21 Oct 2003 21:15:35 -0000
@@ -3402,8 +3402,11 @@
 	}
 	if (lprbbi->lpText) {
             INT len = MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, NULL, 0 );
-            lpBand->lpText = (LPWSTR)Alloc (len*sizeof(WCHAR));
-            MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, lpBand->lpText, len );
+            if (len > 1)
+            {
+                lpBand->lpText = (LPWSTR)Alloc (len*sizeof(WCHAR));
+                MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, lpBand->lpText, len );
+            }
 	}
     }
 
@@ -3447,8 +3450,11 @@
 	}
 	if (lprbbi->lpText) {
 	    INT len = lstrlenW (lprbbi->lpText);
-	    lpBand->lpText = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
-	    strcpyW (lpBand->lpText, lprbbi->lpText);
+	    if (len > 0)
+	    {
+	        lpBand->lpText = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
+	        strcpyW (lpBand->lpText, lprbbi->lpText);
+	    }
 	}
     }
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux