Zhiyi Zhang : user32: Use common cleanup code in DrawTextExW().
Alexandre Julliard
julliard at winehq.org
Tue May 8 15:58:57 CDT 2018
Module: wine
Branch: master
Commit: 18df0bc05ba4bf294e1b08d0d6e1acb88ffef8b8
URL: https://source.winehq.org/git/wine.git/?a=commit;h=18df0bc05ba4bf294e1b08d0d6e1acb88ffef8b8
Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date: Fri May 4 11:12:06 2018 +0800
user32: Use common cleanup code in DrawTextExW().
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/text.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/dlls/user32/text.c b/dlls/user32/text.c
index e9c6c71..3ba4a12 100644
--- a/dlls/user32/text.c
+++ b/dlls/user32/text.c
@@ -886,6 +886,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
int prefix_offset;
ellipsis_data ellip;
BOOL invert_y=FALSE;
+ int ret = 0;
TRACE("%s, %d, [%s] %08x\n", debugstr_wn (str, count), count,
wine_dbgstr_rect(rect), flags);
@@ -1002,11 +1003,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
const WCHAR *p;
p = str; while (p < str+len && *p != TAB) p++;
len_seg = p - str;
- if (len_seg != len && !GetTextExtentPointW(hdc, str, len_seg, &size))
- {
- heap_free(retstr);
- return 0;
- }
+ if (len_seg != len && !GetTextExtentPointW(hdc, str, len_seg, &size)) goto done;
}
else
len_seg = len;
@@ -1015,10 +1012,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
((flags & DT_NOCLIP) ? 0 : ETO_CLIPPED) |
((flags & DT_RTLREADING) ? ETO_RTLREADING : 0),
rect, str, len_seg, NULL ))
- {
- heap_free(retstr);
- return 0;
- }
+ goto done;
if (prefix_offset != -1 && prefix_offset < len_seg)
{
TEXT_DrawUnderscore (hdc, xseg, y + tm.tmAscent + 1, str, prefix_offset, (flags & DT_NOCLIP) ? NULL : rect);
@@ -1067,12 +1061,13 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,
if (dtp)
rect->right += lmargin + rmargin;
}
- if (retstr)
- {
- memcpy (str, retstr, size_retstr);
- heap_free(retstr);
- }
- return y - rect->top;
+
+ if (retstr) memcpy(str, retstr, size_retstr);
+
+ ret = y - rect->top;
+done:
+ heap_free(retstr);
+ return ret;
}
/***********************************************************************
More information about the wine-cvs
mailing list