[v2 PATCH] dwrite: Fix locale data buffer length passed to GetLocaleInfoEx()
Nikolay Sivov
nsivov at codeweavers.com
Mon May 15 04:41:01 CDT 2017
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
v2 - define instead of a constant
dlls/dwrite/analyzer.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c
index 5ae16a1aae..ede2e6dc0a 100644
--- a/dlls/dwrite/analyzer.c
+++ b/dlls/dwrite/analyzer.c
@@ -31,6 +31,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
extern const unsigned short wine_linebreak_table[] DECLSPEC_HIDDEN;
extern const unsigned short wine_scripts_table[] DECLSPEC_HIDDEN;
+/* Number of characters needed for LOCALE_SNATIVEDIGITS */
+#define NATIVE_DIGITS_LEN 11
+
struct dwritescript_properties {
DWRITE_SCRIPT_PROPERTIES props;
UINT32 scripttag; /* OpenType script tag */
@@ -1065,7 +1068,7 @@ static DWRITE_NUMBER_SUBSTITUTION_METHOD get_number_substitutes(IDWriteNumberSub
switch (method)
{
case DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL:
- GetLocaleInfoEx(numbersubst->locale, lctype | LOCALE_SNATIVEDIGITS, digits, sizeof(digits)/sizeof(digits[0]));
+ GetLocaleInfoEx(numbersubst->locale, lctype | LOCALE_SNATIVEDIGITS, digits, NATIVE_DIGITS_LEN);
break;
case DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL:
case DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL:
@@ -1079,7 +1082,7 @@ static DWRITE_NUMBER_SUBSTITUTION_METHOD get_number_substitutes(IDWriteNumberSub
break;
}
}
- GetLocaleInfoEx(numbersubst->locale, lctype | LOCALE_SNATIVEDIGITS, digits, sizeof(digits)/sizeof(digits[0]));
+ GetLocaleInfoEx(numbersubst->locale, lctype | LOCALE_SNATIVEDIGITS, digits, NATIVE_DIGITS_LEN);
break;
default:
;
@@ -1106,8 +1109,8 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphs(IDWriteTextAnalyzer2 *iface,
struct scriptshaping_context context;
struct scriptshaping_cache *cache = NULL;
BOOL update_cluster, need_vertical;
+ WCHAR digits[NATIVE_DIGITS_LEN];
IDWriteFontFace1 *fontface1;
- WCHAR digits[11];
WCHAR *string;
UINT32 i, g;
HRESULT hr = S_OK;
--
2.11.0
More information about the wine-patches
mailing list