https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ae80eb824e882f7ed2f6f…
commit ae80eb824e882f7ed2f6f163922bee30c63284ad
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Apr 9 17:39:42 2019 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Apr 9 17:39:42 2019 +0900
[GDI32] Improve IntFontFamilyListUnique function (#1491)
Make gdi32!IntFontFamilyListUnique function std::unique compatible. Previous code
didn't set the first entry correctly. CORE-15785
---
win32ss/gdi/gdi32/objects/font.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/win32ss/gdi/gdi32/objects/font.c b/win32ss/gdi/gdi32/objects/font.c
index a42b02c043d..2f187b0edbc 100644
--- a/win32ss/gdi/gdi32/objects/font.c
+++ b/win32ss/gdi/gdi32/objects/font.c
@@ -264,18 +264,19 @@ IntFontFamilyListUnique(FONTFAMILYINFO *InfoList, INT nCount,
if ((dwFlags & IEFF_EXTENDED) && plf->lfCharSet == DEFAULT_CHARSET)
dwCompareFlags |= IFFCX_CHARSET;
+ first = InfoList;
+ last = &InfoList[nCount];
+
// std::unique(first, last, IntFontFamilyCompareEx);
- if (nCount == 0)
+ if (first == last)
return 0;
- result = first = InfoList;
- last = &InfoList[nCount];
+ result = first;
while (++first != last)
{
- if (IntFontFamilyCompareEx(result, first, dwCompareFlags) != 0 &&
- ++result != first)
+ if (IntFontFamilyCompareEx(result, first, dwCompareFlags) != 0)
{
- *result = *first;
+ *(++result) = *first;
}
}
nCount = (int)(++result - InfoList);