[Gdiplus 4/6] Don't use a pointer-to-pointer construct, and use better variable names.
Adam Petaccia
adam at tpetaccia.com
Fri Jun 27 19:14:27 CDT 2008
These next few patches are cleanups to gdiplus/tests/font.c which
recently got merged.
Subject: [Gdiplus 4/6] Don't use a pointer-to-pointer construct, and use
better variable names.
This saves us having to constantly dereference, and allows us to remove
some
tests and allocations -- in reference to Dan Kegel's discovery of how
long
tests/font.c takes to Valgrind
---
dlls/gdiplus/tests/font.c | 36 ++++++++++++------------------------
1 files changed, 12 insertions(+), 24 deletions(-)
diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c
index ffa605f..c9ebaff 100644
--- a/dlls/gdiplus/tests/font.c
+++ b/dlls/gdiplus/tests/font.c
@@ -148,51 +148,39 @@ static void test_logfont(void)
static void test_fontfamily (void)
{
- GpFontFamily** family = NULL;
- WCHAR itsName[LF_FACESIZE];
+ GpFontFamily* FontFamily;
+ WCHAR FamilyName[LF_FACESIZE];
GpStatus stat;
- ZeroMemory(itsName, sizeof(itsName));
+ ZeroMemory(FamilyName, sizeof(FamilyName));
/* FontFamily can not be NULL */
- stat = GdipCreateFontFamilyFromName (arial , NULL, family);
+ stat = GdipCreateFontFamilyFromName (arial , NULL, NULL);
expect (InvalidParameter, stat);
- family = GdipAlloc (sizeof (GpFontFamily*));
-
/* FontFamily must be able to actually find the family.
- * If it can't, any subsequent calls should fail
- *
- * We currently fail (meaning we don't) because we don't actually
- * test to see if we can successfully get a family
+ * If it can't, any subsequent calls should fail.
*/
- stat = GdipCreateFontFamilyFromName (nonexistant, NULL, family);
+ stat = GdipCreateFontFamilyFromName (nonexistant, NULL,
&FontFamily);
expect (FontFamilyNotFound, stat);
- stat = GdipGetFamilyName (*family,itsName, LANG_NEUTRAL);
- expect (InvalidParameter, stat);
- ok ((lstrcmpiW(itsName,nonexistant) != 0),
+ ok ((lstrcmpiW(FamilyName,nonexistant) != 0),
"Expected a non-zero value for nonexistant font!\n");
- stat = GdipDeleteFontFamily(*family);
- expect (InvalidParameter, stat);
- stat = GdipCreateFontFamilyFromName (arial, NULL, family);
+ stat = GdipCreateFontFamilyFromName (arial, NULL, &FontFamily);
expect (Ok, stat);
- stat = GdipGetFamilyName (*family, itsName, LANG_NEUTRAL);
+ stat = GdipGetFamilyName (FontFamily, FamilyName, LANG_NEUTRAL);
expect (Ok, stat);
- expect (0, lstrcmpiW(itsName,arial));
+ expect (0, lstrcmpiW(FamilyName,arial));
if (0)
{
/* Crashes on Windows XP SP2, Vista, and so Wine as well */
- stat = GdipGetFamilyName (*family, NULL, LANG_NEUTRAL);
+ stat = GdipGetFamilyName (FontFamily, NULL, LANG_NEUTRAL);
expect (Ok, stat);
}
- stat = GdipDeleteFontFamily(*family);
- expect (Ok, stat);
-
- if (family) GdipFree (family);
+ GdipDeleteFontFamily(FontFamily);
}
--
1.5.4.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20080627/0141f72a/attachment.pgp
More information about the wine-patches
mailing list