user: fix DrawTextExA/W on empty strings.

Bill Medland billmedland at mercuryspeed.com
Fri Jan 27 12:28:04 CST 2006


On January 25, 2006 10:49 am, Rein Klazes wrote:
> On Wed, 25 Jan 2006 07:49:57 -0800 (PST), you wrote:
> >Hi Rein,
> >
> >-    if (!str) return 0;
> >+    if (!str || count == 0) return 0;
> >     if (count == -1) count = strlenW(str);
> >-    if (count == 0) return 0;
> >+    if (count == 0) {
> >+        if( flags & DT_CALCRECT) {
> >+            rect->right = rect->left;
> >+            rect->bottom = rect->top;
> >+        }
> >+        return 0;
> >+    }
> >
> >This block will never be reached because of the if (!str ||
> > count == 0) test above.
>
> Wrong, look again.
>
> It can be coded a little bit more efficiently though. I will
> make a different patch.
>
> Rein.
>
>
> Rein.

(Apart from the other discussion) are you sure that you really 
mean that?
"If the length is explicitly stated to be zero then don't do the 
calcrect but if the length is to be measured and happens to come 
out as zero then do do the calcrect"
If so then I suggest at least a comment that it is deliberate; it 
sounds counterintuitive to me.
-- 
Bill Medland
mailto:billmedland at mercuryspeed.com
http://webhome.idirect.com/~kbmed



More information about the wine-devel mailing list