https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2e1a4e74a44f97fc4da1d…
commit 2e1a4e74a44f97fc4da1d045edb1fb2656c56f24
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Thu Jan 23 21:17:03 2025 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Thu Jan 23 21:17:15 2025 +0100
[WIN32SS:NTGDI] freetype.c: Fix the ordering of, and add some missing set-last-error
calls.
---
win32ss/gdi/ntgdi/freetype.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c
index 83c024a4c94..a7c5326d903 100644
--- a/win32ss/gdi/ntgdi/freetype.c
+++ b/win32ss/gdi/ntgdi/freetype.c
@@ -1752,7 +1752,7 @@ IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont,
{
SharedFace_Release(SharedFace);
EngSetLastError(ERROR_NOT_ENOUGH_MEMORY);
- return 0; /* failure */
+ return 0; /* failure */
}
/* allocate a FONTGDI */
@@ -1762,7 +1762,7 @@ IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont,
SharedFace_Release(SharedFace);
ExFreePoolWithTag(Entry, TAG_FONT);
EngSetLastError(ERROR_NOT_ENOUGH_MEMORY);
- return 0; /* failure */
+ return 0; /* failure */
}
/* set file name */
@@ -1777,7 +1777,7 @@ IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont,
SharedFace_Release(SharedFace);
ExFreePoolWithTag(Entry, TAG_FONT);
EngSetLastError(ERROR_NOT_ENOUGH_MEMORY);
- return 0; /* failure */
+ return 0; /* failure */
}
RtlCopyMemory(FontGDI->Filename, pFileName->Buffer,
pFileName->Length);
@@ -1795,7 +1795,8 @@ IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont,
EngFreeMem(FontGDI);
SharedFace_Release(SharedFace);
ExFreePoolWithTag(Entry, TAG_FONT);
- return 0;
+ EngSetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return 0; /* failure */
}
PrivateEntry->Entry = Entry;
@@ -4495,20 +4496,26 @@ ftGdiGetGlyphOutline(
ASSERT_FREETYPE_LOCK_NOT_HELD();
Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL, FALSE);
+ if (!Size)
+ {
+ TEXTOBJ_UnlockText(TextObj);
+ EngSetLastError(ERROR_GEN_FAILURE);
+ return GDI_ERROR;
+ }
potm = ExAllocatePoolWithTag(PagedPool, Size, GDITAG_TEXT);
if (!potm)
{
- EngSetLastError(ERROR_NOT_ENOUGH_MEMORY);
TEXTOBJ_UnlockText(TextObj);
+ EngSetLastError(ERROR_NOT_ENOUGH_MEMORY);
return GDI_ERROR;
}
ASSERT_FREETYPE_LOCK_NOT_HELD();
Size = IntGetOutlineTextMetrics(FontGDI, Size, potm, FALSE);
if (!Size)
{
- /* FIXME: last error? */
ExFreePoolWithTag(potm, GDITAG_TEXT);
TEXTOBJ_UnlockText(TextObj);
+ EngSetLastError(ERROR_GEN_FAILURE);
return GDI_ERROR;
}