Huw Davies : gdi32: Correctly propagate the enumproc's return value.
Alexandre Julliard
julliard at winehq.org
Wed Mar 14 13:56:12 CDT 2012
Module: wine
Branch: master
Commit: 41fb856961449fdb303ec9c1ffa7d6073ff86254
URL: http://source.winehq.org/git/wine.git/?a=commit;h=41fb856961449fdb303ec9c1ffa7d6073ff86254
Author: Huw Davies <huw at codeweavers.com>
Date: Wed Mar 14 14:15:13 2012 +0000
gdi32: Correctly propagate the enumproc's return value.
---
dlls/gdi32/font.c | 7 +++++--
dlls/gdi32/tests/font.c | 9 +++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 4191904..74a7e27 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -121,6 +121,7 @@ struct font_enum
LPARAM lpData;
BOOL unicode;
HDC hdc;
+ INT retval;
};
/*
@@ -721,6 +722,7 @@ static INT CALLBACK FONT_EnumInstance( const LOGFONTW *plf, const TEXTMETRICW *p
ptm = (TEXTMETRICW *)&tmA;
}
ret = pfe->lpEnumFunc( plf, ptm, fType, pfe->lpData );
+ pfe->retval = ret;
}
return ret;
}
@@ -745,10 +747,11 @@ static INT FONT_EnumFontFamiliesEx( HDC hDC, LPLOGFONTW plf, FONTENUMPROCW efpro
fe.lpData = lParam;
fe.unicode = unicode;
fe.hdc = hDC;
- ret = physdev->funcs->pEnumFonts( physdev, plf, FONT_EnumInstance, (LPARAM)&fe );
+ fe.retval = 1;
+ ret = physdev->funcs->pEnumFonts( physdev, plf, FONT_EnumInstance, (LPARAM)&fe );
release_dc_ptr( dc );
}
- return ret;
+ return ret ? fe.retval : 0;
}
/***********************************************************************
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index d004cf4..d104452 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -3756,6 +3756,11 @@ static INT CALLBACK enum_all_fonts_proc(const LOGFONT *elf, const TEXTMETRIC *nt
return 1;
}
+static INT CALLBACK enum_with_magic_retval_proc(const LOGFONT *elf, const TEXTMETRIC *ntm, DWORD type, LPARAM lparam)
+{
+ return lparam;
+}
+
static void test_EnumFonts(void)
{
int ret;
@@ -3777,6 +3782,10 @@ static void test_EnumFonts(void)
hdc = CreateCompatibleDC(0);
+ /* check that the enumproc's retval is returned */
+ ret = EnumFontFamilies(hdc, NULL, enum_with_magic_retval_proc, 0xcafe);
+ ok(ret == 0xcafe, "got %08x\n", ret);
+
ret = EnumFontFamilies(hdc, "Arial", enum_fonts_proc, (LPARAM)&lf);
ok(!ret, "font Arial is not enumerated\n");
ret = strcmp(lf.lfFaceName, "Arial");
More information about the wine-cvs
mailing list