Reactos

[USP10] Fix notepad without word-wrap 'select all' (#8016)

CORE-20176 & CORE-20177

authored by

Doug Lyons and committed by
GitHub
284f15be 6bd0ffc4

+21
+21
dll/win32/usp10/usp10.c
··· 1993 1993 StringAnalysis *analysis = NULL; 1994 1994 SCRIPT_CONTROL sControl; 1995 1995 SCRIPT_STATE sState; 1996 + #ifdef __REACTOS__ // CORE-20176 & CORE-20177 1997 + int i, num_items = cString + 1; 1998 + #else 1996 1999 int i, num_items = 255; 2000 + #endif 1997 2001 BYTE *BidiLevel; 1998 2002 WCHAR *iString = NULL; 2003 + #ifdef __REACTOS__ // CORE-20176 & CORE-20177 2004 + SCRIPT_ITEM *items; 2005 + #endif 1999 2006 2000 2007 TRACE("(%p,%p,%d,%d,%d,0x%x,%d,%p,%p,%p,%p,%p,%p)\n", 2001 2008 hdc, pString, cString, cGlyphs, iCharset, dwFlags, iReqWidth, ··· 2011 2018 2012 2019 if (!(analysis = heap_alloc_zero(sizeof(*analysis)))) 2013 2020 return E_OUTOFMEMORY; 2021 + #ifdef __REACTOS__ // CORE-20176 & CORE-20177 2022 + if (!(analysis->pItem = heap_calloc(num_items, sizeof(*analysis->pItem)))) 2023 + #else 2014 2024 if (!(analysis->pItem = heap_calloc(num_items + 1, sizeof(*analysis->pItem)))) 2025 + #endif 2015 2026 goto error; 2016 2027 2017 2028 /* FIXME: handle clipping */ ··· 2045 2056 &analysis->numItems); 2046 2057 2047 2058 if (FAILED(hr)) 2059 + #ifdef __REACTOS__ // CORE-20176 & CORE-20177 2060 + goto error; 2061 + #else 2048 2062 { 2049 2063 if (hr == E_OUTOFMEMORY) 2050 2064 hr = E_INVALIDARG; 2051 2065 goto error; 2052 2066 } 2067 + #endif 2068 + 2069 + #ifdef __REACTOS__ // CORE-20176 & CORE-20177 2070 + /* Having as many items as codepoints is the worst case scenario, try to reclaim some memory. */ 2071 + if ((items = heap_realloc(analysis->pItem, (analysis->numItems + 1) * sizeof(*analysis->pItem)))) 2072 + analysis->pItem = items; 2073 + #endif 2053 2074 2054 2075 /* set back to out of memory for default goto error behaviour */ 2055 2076 hr = E_OUTOFMEMORY;