Commit 5694825a authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Return copies of fonts from GdipGetFontCollectionFamilyList.

parent 3847c2de
...@@ -963,18 +963,33 @@ GpStatus WINGDIPAPI GdipGetFontCollectionFamilyList( ...@@ -963,18 +963,33 @@ GpStatus WINGDIPAPI GdipGetFontCollectionFamilyList(
GpFontFamily* gpfamilies[], INT* numFound) GpFontFamily* gpfamilies[], INT* numFound)
{ {
INT i; INT i;
GpStatus stat=Ok;
TRACE("%p, %d, %p, %p\n", fontCollection, numSought, gpfamilies, numFound); TRACE("%p, %d, %p, %p\n", fontCollection, numSought, gpfamilies, numFound);
if (!(fontCollection && gpfamilies && numFound)) if (!(fontCollection && gpfamilies && numFound))
return InvalidParameter; return InvalidParameter;
for (i = 0; i < numSought && i < fontCollection->count; i++) memset(gpfamilies, 0, sizeof(*gpfamilies) * numSought);
for (i = 0; i < numSought && i < fontCollection->count && stat == Ok; i++)
{ {
gpfamilies[i] = fontCollection->FontFamilies[i]; stat = GdipCloneFontFamily(fontCollection->FontFamilies[i], &gpfamilies[i]);
} }
*numFound = i;
return Ok; if (stat == Ok)
*numFound = i;
else
{
int numToFree=i;
for (i=0; i<numToFree; i++)
{
GdipDeleteFontFamily(gpfamilies[i]);
gpfamilies[i] = NULL;
}
}
return stat;
} }
void free_installed_fonts(void) void free_installed_fonts(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment