dwrite: Build with msvcrt.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-03-30 14:06:18 +03:00 committed by Alexandre Julliard
parent f4d84acf26
commit db516804cc
10 changed files with 163 additions and 143 deletions

View File

@ -3,6 +3,8 @@ IMPORTLIB = dwrite
IMPORTS = user32 gdi32 advapi32 IMPORTS = user32 gdi32 advapi32
EXTRAINCL = $(FREETYPE_CFLAGS) EXTRAINCL = $(FREETYPE_CFLAGS)
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ C_SRCS = \
analyzer.c \ analyzer.c \
bidi.c \ bidi.c \

View File

@ -467,7 +467,7 @@ static HRESULT analyze_linebreaks(const WCHAR *text, UINT32 count, DWRITE_LINE_B
breakpoints[i].breakConditionBefore = DWRITE_BREAK_CONDITION_NEUTRAL; breakpoints[i].breakConditionBefore = DWRITE_BREAK_CONDITION_NEUTRAL;
breakpoints[i].breakConditionAfter = DWRITE_BREAK_CONDITION_NEUTRAL; breakpoints[i].breakConditionAfter = DWRITE_BREAK_CONDITION_NEUTRAL;
breakpoints[i].isWhitespace = !!isspaceW(text[i]); breakpoints[i].isWhitespace = !!iswspace(text[i]);
breakpoints[i].isSoftHyphen = text[i] == 0x00ad /* Unicode Soft Hyphen */; breakpoints[i].isSoftHyphen = text[i] == 0x00ad /* Unicode Soft Hyphen */;
breakpoints[i].padding = 0; breakpoints[i].padding = 0;
@ -1107,8 +1107,9 @@ static void get_number_substitutes(IDWriteNumberSubstitution *substitution, BOOL
static const WCHAR arabicW[] = {0x640,0x641,0x642,0x643,0x644,0x645,0x646,0x647,0x648,0x649,0}; static const WCHAR arabicW[] = {0x640,0x641,0x642,0x643,0x644,0x645,0x646,0x647,0x648,0x649,0};
/* For some Arabic locales Latin digits are returned for SNATIVEDIGITS */ /* For some Arabic locales Latin digits are returned for SNATIVEDIGITS */
if (!strcmpW(arW, isolang)) { if (!wcscmp(arW, isolang))
strcpyW(digits, arabicW); {
wcscpy(digits, arabicW);
break; break;
} }
} }
@ -1978,7 +1979,7 @@ static ULONG WINAPI fontfallback_Release(IDWriteFontFallback1 *iface)
return IDWriteFactory7_Release(fallback->factory); return IDWriteFactory7_Release(fallback->factory);
} }
static int compare_mapping_range(const void *a, const void *b) static int __cdecl compare_mapping_range(const void *a, const void *b)
{ {
UINT32 ch = *(UINT32 *)a; UINT32 ch = *(UINT32 *)a;
DWRITE_UNICODE_RANGE *range = (DWRITE_UNICODE_RANGE *)b; DWRITE_UNICODE_RANGE *range = (DWRITE_UNICODE_RANGE *)b;

View File

@ -619,7 +619,7 @@ typedef struct tagBracketPair
int end; int end;
} BracketPair; } BracketPair;
static int bracketpair_compr(const void *a, const void* b) static int __cdecl bracketpair_compr(const void *a, const void* b)
{ {
return ((BracketPair*)a)->start - ((BracketPair*)b)->start; return ((BracketPair*)a)->start - ((BracketPair*)b)->start;
} }

View File

@ -18,11 +18,11 @@
#include "dwrite_3.h" #include "dwrite_3.h"
#include "d2d1.h" #include "d2d1.h"
#include "winternl.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h" #include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
#include "wine/unicode.h"
#define MS_GSUB_TAG DWRITE_MAKE_OPENTYPE_TAG('G','S','U','B') #define MS_GSUB_TAG DWRITE_MAKE_OPENTYPE_TAG('G','S','U','B')
#define MS_GPOS_TAG DWRITE_MAKE_OPENTYPE_TAG('G','P','O','S') #define MS_GPOS_TAG DWRITE_MAKE_OPENTYPE_TAG('G','P','O','S')
@ -41,7 +41,7 @@ static inline LPWSTR heap_strdupW(const WCHAR *str)
if(str) { if(str) {
DWORD size; DWORD size;
size = (strlenW(str)+1)*sizeof(WCHAR); size = (lstrlenW(str) + 1)*sizeof(WCHAR);
ret = heap_alloc(size); ret = heap_alloc(size);
if(ret) if(ret)
memcpy(ret, str, size); memcpy(ret, str, size);
@ -743,7 +743,6 @@ struct font_backend_funcs
UINT16 glyph, DWRITE_GLYPH_METRICS *metrics); UINT16 glyph, DWRITE_GLYPH_METRICS *metrics);
}; };
extern NTSTATUS CDECL init_font_lib(HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out) DECLSPEC_HIDDEN;
extern void init_font_backend(void) DECLSPEC_HIDDEN; extern void init_font_backend(void) DECLSPEC_HIDDEN;
extern void release_font_backend(void) DECLSPEC_HIDDEN; extern void release_font_backend(void) DECLSPEC_HIDDEN;

View File

@ -3053,10 +3053,11 @@ static UINT32 collection_find_family(struct dwrite_fontcollection *collection, c
UINT32 j, count = IDWriteLocalizedStrings_GetCount(family_name); UINT32 j, count = IDWriteLocalizedStrings_GetCount(family_name);
HRESULT hr; HRESULT hr;
for (j = 0; j < count; j++) { for (j = 0; j < count; j++)
{
WCHAR buffer[255]; WCHAR buffer[255];
hr = IDWriteLocalizedStrings_GetString(family_name, j, buffer, ARRAY_SIZE(buffer)); hr = IDWriteLocalizedStrings_GetString(family_name, j, buffer, ARRAY_SIZE(buffer));
if (SUCCEEDED(hr) && !strcmpiW(buffer, name)) if (SUCCEEDED(hr) && !wcsicmp(buffer, name))
return i; return i;
} }
} }
@ -3330,14 +3331,14 @@ static int trim_spaces(WCHAR *in, WCHAR *ret)
{ {
int len; int len;
while (isspaceW(*in)) while (iswspace(*in))
in++; in++;
ret[0] = 0; ret[0] = 0;
if (!(len = strlenW(in))) if (!(len = wcslen(in)))
return 0; return 0;
while (isspaceW(in[len-1])) while (iswspace(in[len-1]))
len--; len--;
memcpy(ret, in, len*sizeof(WCHAR)); memcpy(ret, in, len*sizeof(WCHAR));
@ -3369,9 +3370,10 @@ static BOOL match_pattern_list(struct list *tokens, const struct name_pattern *p
struct name_token *token; struct name_token *token;
int i = 0; int i = 0;
while ((pattern = &patterns[i++])->part1) { while ((pattern = &patterns[i++])->part1)
int len_part1 = strlenW(pattern->part1); {
int len_part2 = pattern->part2 ? strlenW(pattern->part2) : 0; int len_part1 = wcslen(pattern->part1);
int len_part2 = pattern->part2 ? wcslen(pattern->part2) : 0;
LIST_FOR_EACH_ENTRY(token, tokens, struct name_token, entry) { LIST_FOR_EACH_ENTRY(token, tokens, struct name_token, entry) {
if (len_part2 == 0) { if (len_part2 == 0) {
@ -3379,7 +3381,8 @@ static BOOL match_pattern_list(struct list *tokens, const struct name_pattern *p
if (token->len != len_part1) if (token->len != len_part1)
continue; continue;
if (!strncmpiW(token->ptr, pattern->part1, len_part1)) { if (!wcsnicmp(token->ptr, pattern->part1, len_part1))
{
if (match) *match = *token; if (match) *match = *token;
list_remove(&token->entry); list_remove(&token->entry);
heap_free(token); heap_free(token);
@ -3395,11 +3398,12 @@ static BOOL match_pattern_list(struct list *tokens, const struct name_pattern *p
continue; continue;
/* it's possible to have combined string as a token, like ExtraCondensed */ /* it's possible to have combined string as a token, like ExtraCondensed */
if (token->len == len_part1 + len_part2) { if (token->len == len_part1 + len_part2)
if (strncmpiW(token->ptr, pattern->part1, len_part1)) {
if (wcsnicmp(token->ptr, pattern->part1, len_part1))
continue; continue;
if (strncmpiW(&token->ptr[len_part1], pattern->part2, len_part2)) if (wcsnicmp(&token->ptr[len_part1], pattern->part2, len_part2))
continue; continue;
/* combined string match */ /* combined string match */
@ -3419,10 +3423,10 @@ static BOOL match_pattern_list(struct list *tokens, const struct name_pattern *p
if (next_token->len != len_part1) if (next_token->len != len_part1)
continue; continue;
if (strncmpiW(token->ptr, pattern->part2, len_part2)) if (wcsnicmp(token->ptr, pattern->part2, len_part2))
continue; continue;
if (strncmpiW(next_token->ptr, pattern->part1, len_part1)) if (wcsnicmp(next_token->ptr, pattern->part1, len_part1))
continue; continue;
/* both parts matched, remove tokens */ /* both parts matched, remove tokens */
@ -3716,12 +3720,13 @@ static DWRITE_FONT_WEIGHT font_extract_weight(struct list *tokens, DWRITE_FONT_W
return weight; return weight;
} }
struct knownweight_entry { struct knownweight_entry
{
const WCHAR *nameW; const WCHAR *nameW;
DWRITE_FONT_WEIGHT weight; DWRITE_FONT_WEIGHT weight;
}; };
static int compare_knownweights(const void *a, const void* b) static int __cdecl compare_knownweights(const void *a, const void* b)
{ {
DWRITE_FONT_WEIGHT target = *(DWRITE_FONT_WEIGHT*)a; DWRITE_FONT_WEIGHT target = *(DWRITE_FONT_WEIGHT*)a;
const struct knownweight_entry *entry = (struct knownweight_entry*)b; const struct knownweight_entry *entry = (struct knownweight_entry*)b;
@ -3768,7 +3773,7 @@ static BOOL is_known_weight_value(DWRITE_FONT_WEIGHT weight, WCHAR *nameW)
return FALSE; return FALSE;
} }
strcpyW(nameW, ptr->nameW); wcscpy(nameW, ptr->nameW);
return TRUE; return TRUE;
} }
@ -3800,21 +3805,24 @@ static const WCHAR *facename_remove_regular_term(WCHAR *facenameW, INT len)
int i = 0; int i = 0;
if (len == -1) if (len == -1)
len = strlenW(facenameW); len = wcslen(facenameW);
/* remove rightmost regular variant from face name */ /* remove rightmost regular variant from face name */
while (!regular_ptr && (ptr = regular_patterns[i++])) { while (!regular_ptr && (ptr = regular_patterns[i++]))
int pattern_len = strlenW(ptr); {
int pattern_len = wcslen(ptr);
WCHAR *src; WCHAR *src;
if (pattern_len > len) if (pattern_len > len)
continue; continue;
src = facenameW + len - pattern_len; src = facenameW + len - pattern_len;
while (src >= facenameW) { while (src >= facenameW)
if (!strncmpiW(src, ptr, pattern_len)) { {
if (!wcsnicmp(src, ptr, pattern_len))
{
memmove(src, src + pattern_len, (len - pattern_len - (src - facenameW) + 1)*sizeof(WCHAR)); memmove(src, src + pattern_len, (len - pattern_len - (src - facenameW) + 1)*sizeof(WCHAR));
len = strlenW(facenameW); len = wcslen(facenameW);
regular_ptr = ptr; regular_ptr = ptr;
break; break;
} }
@ -3892,9 +3900,10 @@ static BOOL font_apply_differentiation_rules(struct dwrite_font_data *font, WCHA
regular_ptr = facename_remove_regular_term(facenameW, len); regular_ptr = facename_remove_regular_term(facenameW, len);
/* append face name to family name, FIXME check if face name is a substring of family name */ /* append face name to family name, FIXME check if face name is a substring of family name */
if (*facenameW) { if (*facenameW)
strcatW(familynameW, spaceW); {
strcatW(familynameW, facenameW); wcscat(familynameW, spaceW);
wcscat(familynameW, facenameW);
} }
/* tokenize with " .-_" */ /* tokenize with " .-_" */
@ -3942,11 +3951,11 @@ static BOOL font_apply_differentiation_rules(struct dwrite_font_data *font, WCHA
/* get final combined string from what's left in token list, list is released */ /* get final combined string from what's left in token list, list is released */
fontname_tokens_to_str(&tokens, finalW); fontname_tokens_to_str(&tokens, finalW);
if (!strcmpW(familyW, finalW)) if (!wcscmp(familyW, finalW))
return FALSE; return FALSE;
/* construct face name */ /* construct face name */
strcpyW(familyW, finalW); wcscpy(familyW, finalW);
/* resolved weight name */ /* resolved weight name */
if (weight_name.ptr) if (weight_name.ptr)
@ -3958,9 +3967,10 @@ static BOOL font_apply_differentiation_rules(struct dwrite_font_data *font, WCHA
else if (is_known_weight_value(font->weight, weightW)) { else if (is_known_weight_value(font->weight, weightW)) {
} }
/* use Wnnn format as a fallback in case weight is not one of known values */ /* use Wnnn format as a fallback in case weight is not one of known values */
else { else
{
static const WCHAR fmtW[] = {'W','%','d',0}; static const WCHAR fmtW[] = {'W','%','d',0};
sprintfW(weightW, fmtW, font->weight); swprintf(weightW, ARRAY_SIZE(weightW), fmtW, font->weight);
} }
/* resolved stretch name */ /* resolved stretch name */
@ -3990,7 +4000,7 @@ static BOOL font_apply_differentiation_rules(struct dwrite_font_data *font, WCHA
extraexpandedW, extraexpandedW,
ultraexpandedW ultraexpandedW
}; };
strcpyW(stretchW, stretchnamesW[font->stretch]); wcscpy(stretchW, stretchnamesW[font->stretch]);
} }
/* resolved style name */ /* resolved style name */
@ -4001,27 +4011,30 @@ static BOOL font_apply_differentiation_rules(struct dwrite_font_data *font, WCHA
/* use predefined names */ /* use predefined names */
else { else {
if (font->style == DWRITE_FONT_STYLE_ITALIC) if (font->style == DWRITE_FONT_STYLE_ITALIC)
strcpyW(styleW, italicW); wcscpy(styleW, italicW);
else else
strcpyW(styleW, obliqueW); wcscpy(styleW, obliqueW);
} }
/* use Regular match if it was found initially */ /* use Regular match if it was found initially */
if (!*weightW && !*stretchW && !*styleW) if (!*weightW && !*stretchW && !*styleW)
strcpyW(faceW, regular_ptr ? regular_ptr : regularW); wcscpy(faceW, regular_ptr ? regular_ptr : regularW);
else { else
{
faceW[0] = 0; faceW[0] = 0;
if (*stretchW)
strcpyW(faceW, stretchW); if (*stretchW) wcscpy(faceW, stretchW);
if (*weightW) {
if (*faceW) if (*weightW)
strcatW(faceW, spaceW); {
strcatW(faceW, weightW); if (*faceW) wcscat(faceW, spaceW);
wcscat(faceW, weightW);
} }
if (*styleW) {
if (*faceW) if (*styleW)
strcatW(faceW, spaceW); {
strcatW(faceW, styleW); if (*faceW) wcscat(faceW, spaceW);
wcscat(faceW, styleW);
} }
} }
@ -4216,9 +4229,8 @@ static void fontfamily_add_bold_simulated_face(struct dwrite_fontfamily_data *fa
fontname_tokens_to_str(&tokens, facenameW); fontname_tokens_to_str(&tokens, facenameW);
/* Bold suffix for new name */ /* Bold suffix for new name */
if (*facenameW) if (*facenameW) wcscat(facenameW, spaceW);
strcatW(facenameW, spaceW); wcscat(facenameW, boldW);
strcatW(facenameW, boldW);
if (init_font_data_from_font(family->fonts[heaviest], DWRITE_FONT_SIMULATIONS_BOLD, facenameW, &boldface) == S_OK) { if (init_font_data_from_font(family->fonts[heaviest], DWRITE_FONT_SIMULATIONS_BOLD, facenameW, &boldface) == S_OK) {
boldface->bold_sim_tested = 1; boldface->bold_sim_tested = 1;
@ -4283,9 +4295,8 @@ static void fontfamily_add_oblique_simulated_face(struct dwrite_fontfamily_data
fontstrings_get_en_string(family->fonts[regular]->names, facenameW, ARRAY_SIZE(facenameW)); fontstrings_get_en_string(family->fonts[regular]->names, facenameW, ARRAY_SIZE(facenameW));
facename_remove_regular_term(facenameW, -1); facename_remove_regular_term(facenameW, -1);
if (*facenameW) if (*facenameW) wcscat(facenameW, spaceW);
strcatW(facenameW, spaceW); wcscat(facenameW, obliqueW);
strcatW(facenameW, obliqueW);
if (init_font_data_from_font(family->fonts[regular], DWRITE_FONT_SIMULATIONS_OBLIQUE, facenameW, &obliqueface) == S_OK) { if (init_font_data_from_font(family->fonts[regular], DWRITE_FONT_SIMULATIONS_OBLIQUE, facenameW, &obliqueface) == S_OK) {
obliqueface->oblique_sim_tested = 1; obliqueface->oblique_sim_tested = 1;
@ -4362,7 +4373,7 @@ static void fontcollection_add_replacements(struct dwrite_fontcollection *collec
while (*replacement) { while (*replacement) {
if (fontcollection_add_replacement(collection, name, replacement)) if (fontcollection_add_replacement(collection, name, replacement))
break; break;
replacement += strlenW(replacement) + 1; replacement += wcslen(replacement) + 1;
} }
} }
else if (type == REG_SZ) else if (type == REG_SZ)
@ -4599,13 +4610,14 @@ static HRESULT create_local_file_reference(IDWriteFactory7 *factory, const WCHAR
HRESULT hr; HRESULT hr;
/* Fonts installed in 'Fonts' system dir don't get full path in registry font files cache */ /* Fonts installed in 'Fonts' system dir don't get full path in registry font files cache */
if (!strchrW(filename, '\\')) { if (!wcschr(filename, '\\'))
{
static const WCHAR fontsW[] = {'\\','f','o','n','t','s','\\',0}; static const WCHAR fontsW[] = {'\\','f','o','n','t','s','\\',0};
WCHAR fullpathW[MAX_PATH]; WCHAR fullpathW[MAX_PATH];
GetWindowsDirectoryW(fullpathW, ARRAY_SIZE(fullpathW)); GetWindowsDirectoryW(fullpathW, ARRAY_SIZE(fullpathW));
strcatW(fullpathW, fontsW); wcscat(fullpathW, fontsW);
strcatW(fullpathW, filename); wcscat(fullpathW, filename);
hr = IDWriteFactory7_CreateFontFileReference(factory, fullpathW, NULL, file); hr = IDWriteFactory7_CreateFontFileReference(factory, fullpathW, NULL, file);
} }
@ -4790,7 +4802,7 @@ static HRESULT eudc_collection_add_family(IDWriteFactory7 *factory, struct dwrit
/* Family names are added for non-specific locale, represented with empty string. /* Family names are added for non-specific locale, represented with empty string.
Default family appears with empty family name. */ Default family appears with empty family name. */
create_localizedstrings(&names); create_localizedstrings(&names);
if (!strcmpiW(keynameW, defaultfontW)) if (!wcsicmp(keynameW, defaultfontW))
add_localizedstring(names, emptyW, emptyW); add_localizedstring(names, emptyW, emptyW);
else else
add_localizedstring(names, emptyW, keynameW); add_localizedstring(names, emptyW, keynameW);
@ -4867,7 +4879,7 @@ HRESULT get_eudc_fontcollection(IDWriteFactory7 *factory, IDWriteFontCollection3
IDWriteFactory7_AddRef(factory); IDWriteFactory7_AddRef(factory);
/* return empty collection if EUDC fonts are not configured */ /* return empty collection if EUDC fonts are not configured */
sprintfW(eudckeypathW, eudckeyfmtW, GetACP()); swprintf(eudckeypathW, ARRAY_SIZE(eudckeypathW), eudckeyfmtW, GetACP());
if (RegOpenKeyExW(HKEY_CURRENT_USER, eudckeypathW, 0, GENERIC_READ, &eudckey)) if (RegOpenKeyExW(HKEY_CURRENT_USER, eudckeypathW, 0, GENERIC_READ, &eudckey))
return S_OK; return S_OK;
@ -5522,7 +5534,7 @@ static HRESULT WINAPI localfontfileloader_GetFilePathLengthFromKey(IDWriteLocalF
TRACE("%p, %p, %u, %p.\n", iface, key, key_size, length); TRACE("%p, %p, %u, %p.\n", iface, key, key_size, length);
*length = strlenW(refkey->name); *length = wcslen(refkey->name);
return S_OK; return S_OK;
} }
@ -5533,10 +5545,10 @@ static HRESULT WINAPI localfontfileloader_GetFilePathFromKey(IDWriteLocalFontFil
TRACE("%p, %p, %u, %p, %u.\n", iface, key, key_size, path, length); TRACE("%p, %p, %u, %p, %u.\n", iface, key, key_size, path, length);
if (length < strlenW(refkey->name)) if (length < wcslen(refkey->name))
return E_INVALIDARG; return E_INVALIDARG;
strcpyW(path, refkey->name); wcscpy(path, refkey->name);
return S_OK; return S_OK;
} }
@ -5583,7 +5595,7 @@ HRESULT get_local_refkey(const WCHAR *path, const FILETIME *writetime, void **ke
if (!path) if (!path)
return E_INVALIDARG; return E_INVALIDARG;
*size = FIELD_OFFSET(struct local_refkey, name) + (strlenW(path)+1)*sizeof(WCHAR); *size = FIELD_OFFSET(struct local_refkey, name) + (wcslen(path)+1)*sizeof(WCHAR);
*key = NULL; *key = NULL;
refkey = heap_alloc(*size); refkey = heap_alloc(*size);
@ -5600,7 +5612,7 @@ HRESULT get_local_refkey(const WCHAR *path, const FILETIME *writetime, void **ke
else else
memset(&refkey->writetime, 0, sizeof(refkey->writetime)); memset(&refkey->writetime, 0, sizeof(refkey->writetime));
} }
strcpyW(refkey->name, path); wcscpy(refkey->name, path);
*key = refkey; *key = refkey;
@ -8014,10 +8026,10 @@ struct font_callback_funcs callback_funcs =
void init_font_backend(void) void init_font_backend(void)
{ {
init_font_lib(dwrite_module, DLL_PROCESS_ATTACH, &callback_funcs, &font_funcs); __wine_init_unix_lib(dwrite_module, DLL_PROCESS_ATTACH, &callback_funcs, &font_funcs);
} }
void release_font_backend(void) void release_font_backend(void)
{ {
init_font_lib(dwrite_module, DLL_PROCESS_DETACH, &callback_funcs, NULL); __wine_init_unix_lib(dwrite_module, DLL_PROCESS_DETACH, &callback_funcs, NULL);
} }

View File

@ -18,7 +18,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define COBJMACROS #if 0
#pragma makedep unix
#endif
#include "config.h" #include "config.h"
#include "wine/port.h" #include "wine/port.h"
@ -860,7 +862,7 @@ static NTSTATUS release_freetype_lib(void)
#endif /* HAVE_FREETYPE */ #endif /* HAVE_FREETYPE */
NTSTATUS CDECL init_font_lib(HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out) NTSTATUS CDECL __wine_init_unix_lib(HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out)
{ {
if (reason == DLL_PROCESS_ATTACH) if (reason == DLL_PROCESS_ATTACH)
return init_freetype_lib(module, reason, ptr_in, ptr_out); return init_freetype_lib(module, reason, ptr_in, ptr_out);

View File

@ -1974,7 +1974,7 @@ static void init_u_splitting_params_from_erun(struct layout_effective_run *erun,
static BOOL is_same_u_splitting(struct layout_underline_splitting_params *left, static BOOL is_same_u_splitting(struct layout_underline_splitting_params *left,
struct layout_underline_splitting_params *right) struct layout_underline_splitting_params *right)
{ {
return left->effect == right->effect && !strcmpiW(left->locale, right->locale); return left->effect == right->effect && !wcsicmp(left->locale, right->locale);
} }
static HRESULT layout_add_underline(struct dwrite_textlayout *layout, struct layout_effective_run *first, static HRESULT layout_add_underline(struct dwrite_textlayout *layout, struct layout_effective_run *first,
@ -2432,9 +2432,9 @@ static BOOL is_same_layout_attrvalue(struct layout_range_header const *h, enum l
case LAYOUT_RANGE_ATTR_FONTCOLL: case LAYOUT_RANGE_ATTR_FONTCOLL:
return range->collection == value->u.collection; return range->collection == value->u.collection;
case LAYOUT_RANGE_ATTR_LOCALE: case LAYOUT_RANGE_ATTR_LOCALE:
return strcmpiW(range->locale, value->u.locale) == 0; return !wcsicmp(range->locale, value->u.locale);
case LAYOUT_RANGE_ATTR_FONTFAMILY: case LAYOUT_RANGE_ATTR_FONTFAMILY:
return strcmpW(range->fontfamily, value->u.fontfamily) == 0; return !wcscmp(range->fontfamily, value->u.fontfamily);
case LAYOUT_RANGE_ATTR_SPACING: case LAYOUT_RANGE_ATTR_SPACING:
return range_spacing->leading == value->u.spacing.leading && return range_spacing->leading == value->u.spacing.leading &&
range_spacing->trailing == value->u.spacing.trailing && range_spacing->trailing == value->u.spacing.trailing &&
@ -2463,8 +2463,8 @@ static inline BOOL is_same_layout_attributes(struct layout_range_header const *h
left->object == right->object && left->object == right->object &&
left->pair_kerning == right->pair_kerning && left->pair_kerning == right->pair_kerning &&
left->collection == right->collection && left->collection == right->collection &&
!strcmpiW(left->locale, right->locale) && !wcsicmp(left->locale, right->locale) &&
!strcmpW(left->fontfamily, right->fontfamily); !wcscmp(left->fontfamily, right->fontfamily);
} }
case LAYOUT_RANGE_UNDERLINE: case LAYOUT_RANGE_UNDERLINE:
case LAYOUT_RANGE_STRIKETHROUGH: case LAYOUT_RANGE_STRIKETHROUGH:
@ -2529,7 +2529,7 @@ static struct layout_range_header *alloc_layout_range(struct dwrite_textlayout *
range->collection = layout->format.collection; range->collection = layout->format.collection;
if (range->collection) if (range->collection)
IDWriteFontCollection_AddRef(range->collection); IDWriteFontCollection_AddRef(range->collection);
strcpyW(range->locale, layout->format.locale); wcscpy(range->locale, layout->format.locale);
h = &range->h; h = &range->h;
break; break;
@ -2792,15 +2792,17 @@ static BOOL set_layout_range_attrval(struct layout_range_header *h, enum layout_
changed = set_layout_range_iface_attr((IUnknown**)&dest->collection, (IUnknown*)value->u.collection); changed = set_layout_range_iface_attr((IUnknown**)&dest->collection, (IUnknown*)value->u.collection);
break; break;
case LAYOUT_RANGE_ATTR_LOCALE: case LAYOUT_RANGE_ATTR_LOCALE:
changed = strcmpiW(dest->locale, value->u.locale) != 0; changed = !!wcsicmp(dest->locale, value->u.locale);
if (changed) { if (changed)
strcpyW(dest->locale, value->u.locale); {
strlwrW(dest->locale); wcscpy(dest->locale, value->u.locale);
wcslwr(dest->locale);
} }
break; break;
case LAYOUT_RANGE_ATTR_FONTFAMILY: case LAYOUT_RANGE_ATTR_FONTFAMILY:
changed = strcmpW(dest->fontfamily, value->u.fontfamily) != 0; changed = !!wcscmp(dest->fontfamily, value->u.fontfamily);
if (changed) { if (changed)
{
heap_free(dest->fontfamily); heap_free(dest->fontfamily);
dest->fontfamily = heap_strdupW(value->u.fontfamily); dest->fontfamily = heap_strdupW(value->u.fontfamily);
} }
@ -3033,7 +3035,7 @@ static HRESULT get_string_attribute_length(struct dwrite_textlayout *layout, enu
} }
str = get_string_attribute_ptr(range, kind); str = get_string_attribute_ptr(range, kind);
*length = strlenW(str); *length = wcslen(str);
return return_range(&range->h, r); return return_range(&range->h, r);
} }
@ -3052,10 +3054,10 @@ static HRESULT get_string_attribute_value(struct dwrite_textlayout *layout, enum
return E_INVALIDARG; return E_INVALIDARG;
str = get_string_attribute_ptr(range, kind); str = get_string_attribute_ptr(range, kind);
if (length < strlenW(str) + 1) if (length < wcslen(str) + 1)
return E_NOT_SUFFICIENT_BUFFER; return E_NOT_SUFFICIENT_BUFFER;
strcpyW(ret, str); wcscpy(ret, str);
return return_range(&range->h, r); return return_range(&range->h, r);
} }
@ -3488,7 +3490,7 @@ static HRESULT WINAPI dwritetextlayout_SetLocaleName(IDWriteTextLayout4 *iface,
TRACE("%p, %s, %s.\n", iface, debugstr_w(locale), debugstr_range(&range)); TRACE("%p, %s, %s.\n", iface, debugstr_w(locale), debugstr_range(&range));
if (!locale || strlenW(locale) > LOCALE_NAME_MAX_LENGTH-1) if (!locale || wcslen(locale) > LOCALE_NAME_MAX_LENGTH-1)
return E_INVALIDARG; return E_INVALIDARG;
value.range = range; value.range = range;
@ -4816,7 +4818,7 @@ static HRESULT WINAPI dwritetextformat_layout_GetFontFamilyName(IDWriteTextForma
TRACE("%p, %p, %u.\n", iface, name, size); TRACE("%p, %p, %u.\n", iface, name, size);
if (size <= layout->format.family_len) return E_NOT_SUFFICIENT_BUFFER; if (size <= layout->format.family_len) return E_NOT_SUFFICIENT_BUFFER;
strcpyW(name, layout->format.family_name); wcscpy(name, layout->format.family_name);
return S_OK; return S_OK;
} }
@ -4872,7 +4874,7 @@ static HRESULT WINAPI dwritetextformat_layout_GetLocaleName(IDWriteTextFormat3 *
TRACE("%p, %p, %u.\n", iface, name, size); TRACE("%p, %p, %u.\n", iface, name, size);
if (size <= layout->format.locale_len) return E_NOT_SUFFICIENT_BUFFER; if (size <= layout->format.locale_len) return E_NOT_SUFFICIENT_BUFFER;
strcpyW(name, layout->format.locale); wcscpy(name, layout->format.locale);
return S_OK; return S_OK;
} }
@ -5285,7 +5287,8 @@ static HRESULT WINAPI dwritetextlayout_source_GetLocaleName(IDWriteTextAnalysisS
*text_len = range->h.range.length - position; *text_len = range->h.range.length - position;
next = LIST_ENTRY(list_next(&layout->ranges, &range->h.entry), struct layout_range, h.entry); next = LIST_ENTRY(list_next(&layout->ranges, &range->h.entry), struct layout_range, h.entry);
while (next && next->h.range.startPosition < layout->len && !strcmpW(range->locale, next->locale)) { while (next && next->h.range.startPosition < layout->len && !wcscmp(range->locale, next->locale))
{
*text_len += next->h.range.length; *text_len += next->h.range.length;
next = LIST_ENTRY(list_next(&layout->ranges, &next->h.entry), struct layout_range, h.entry); next = LIST_ENTRY(list_next(&layout->ranges, &next->h.entry), struct layout_range, h.entry);
} }
@ -5939,7 +5942,7 @@ static HRESULT WINAPI dwritetextformat_GetFontFamilyName(IDWriteTextFormat3 *ifa
if (size <= format->format.family_len) if (size <= format->format.family_len)
return E_NOT_SUFFICIENT_BUFFER; return E_NOT_SUFFICIENT_BUFFER;
strcpyW(name, format->format.family_name); wcscpy(name, format->format.family_name);
return S_OK; return S_OK;
} }
@ -5996,7 +5999,7 @@ static HRESULT WINAPI dwritetextformat_GetLocaleName(IDWriteTextFormat3 *iface,
if (size <= format->format.locale_len) if (size <= format->format.locale_len)
return E_NOT_SUFFICIENT_BUFFER; return E_NOT_SUFFICIENT_BUFFER;
strcpyW(name, format->format.locale); wcscpy(name, format->format.locale);
return S_OK; return S_OK;
} }
@ -6216,11 +6219,11 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle
object->IDWriteTextFormat3_iface.lpVtbl = &dwritetextformatvtbl; object->IDWriteTextFormat3_iface.lpVtbl = &dwritetextformatvtbl;
object->refcount = 1; object->refcount = 1;
object->format.family_name = heap_strdupW(family_name); object->format.family_name = heap_strdupW(family_name);
object->format.family_len = strlenW(family_name); object->format.family_len = wcslen(family_name);
object->format.locale = heap_strdupW(locale); object->format.locale = heap_strdupW(locale);
object->format.locale_len = strlenW(locale); object->format.locale_len = wcslen(locale);
/* Force locale name to lower case, layout will inherit this modified value. */ /* Force locale name to lower case, layout will inherit this modified value. */
strlwrW(object->format.locale); wcslwr(object->format.locale);
object->format.weight = weight; object->format.weight = weight;
object->format.style = style; object->format.style = style;
object->format.fontsize = size; object->format.fontsize = size;

View File

@ -343,7 +343,7 @@ static HRESULT WINAPI localizedstrings_FindLocaleName(IDWriteLocalizedStrings *i
for (i = 0; i < strings->count; ++i) for (i = 0; i < strings->count; ++i)
{ {
if (!strcmpiW(strings->data[i].locale, locale_name)) if (!wcsicmp(strings->data[i].locale, locale_name))
{ {
*exists = TRUE; *exists = TRUE;
*index = i; *index = i;
@ -366,7 +366,7 @@ static HRESULT WINAPI localizedstrings_GetLocaleNameLength(IDWriteLocalizedStrin
return E_FAIL; return E_FAIL;
} }
*length = strlenW(strings->data[index].locale); *length = wcslen(strings->data[index].locale);
return S_OK; return S_OK;
} }
@ -382,13 +382,13 @@ static HRESULT WINAPI localizedstrings_GetLocaleName(IDWriteLocalizedStrings *if
return E_FAIL; return E_FAIL;
} }
if (size < strlenW(strings->data[index].locale) + 1) if (size < wcslen(strings->data[index].locale) + 1)
{ {
if (buffer) *buffer = 0; if (buffer) *buffer = 0;
return E_NOT_SUFFICIENT_BUFFER; return E_NOT_SUFFICIENT_BUFFER;
} }
strcpyW(buffer, strings->data[index].locale); wcscpy(buffer, strings->data[index].locale);
return S_OK; return S_OK;
} }
@ -404,7 +404,7 @@ static HRESULT WINAPI localizedstrings_GetStringLength(IDWriteLocalizedStrings *
return E_FAIL; return E_FAIL;
} }
*length = strlenW(strings->data[index].string); *length = wcslen(strings->data[index].string);
return S_OK; return S_OK;
} }
@ -420,13 +420,13 @@ static HRESULT WINAPI localizedstrings_GetString(IDWriteLocalizedStrings *iface,
return E_FAIL; return E_FAIL;
} }
if (size < strlenW(strings->data[index].string) + 1) if (size < wcslen(strings->data[index].string) + 1)
{ {
if (buffer) *buffer = 0; if (buffer) *buffer = 0;
return E_NOT_SUFFICIENT_BUFFER; return E_NOT_SUFFICIENT_BUFFER;
} }
strcpyW(buffer, strings->data[index].string); wcscpy(buffer, strings->data[index].string);
return S_OK; return S_OK;
} }
@ -470,7 +470,7 @@ HRESULT add_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *locale,
if (*locale) if (*locale)
{ {
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
if (!lstrcmpiW(strings->data[i].locale, locale)) if (!wcsicmp(strings->data[i].locale, locale))
return S_OK; return S_OK;
} }
@ -485,7 +485,7 @@ HRESULT add_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *locale,
heap_free(strings->data[count].string); heap_free(strings->data[count].string);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
strlwrW(strings->data[count].locale); wcslwr(strings->data[count].locale);
strings->count++; strings->count++;
@ -537,7 +537,7 @@ void set_en_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *string)
for (i = 0; i < strings->count; i++) for (i = 0; i < strings->count; i++)
{ {
if (!strcmpiW(strings->data[i].locale, enusW)) if (!wcsicmp(strings->data[i].locale, enusW))
{ {
heap_free(strings->data[i].string); heap_free(strings->data[i].string);
strings->data[i].string = heap_strdupW(string); strings->data[i].string = heap_strdupW(string);
@ -546,11 +546,11 @@ void set_en_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *string)
} }
} }
static int localizedstrings_sorting_compare(const void *left, const void *right) static int __cdecl localizedstrings_sorting_compare(const void *left, const void *right)
{ {
const struct localizedpair *_l = left, *_r = right; const struct localizedpair *_l = left, *_r = right;
return strcmpW(_l->locale, _r->locale); return wcscmp(_l->locale, _r->locale);
}; };
void sort_localizedstrings(IDWriteLocalizedStrings *iface) void sort_localizedstrings(IDWriteLocalizedStrings *iface)
@ -573,7 +573,7 @@ BOOL localizedstrings_contains(IDWriteLocalizedStrings *iface, const WCHAR *str)
for (i = 0; i < strings->count; ++i) for (i = 0; i < strings->count; ++i)
{ {
if (!lstrcmpiW(strings->data[i].string, str)) return TRUE; if (!wcsicmp(strings->data[i].string, str)) return TRUE;
} }
return FALSE; return FALSE;
@ -1571,15 +1571,15 @@ static HRESULT create_system_path_list(WCHAR ***ret, unsigned int *ret_count)
{ {
if (dwrite_array_reserve((void **)&paths, &capacity, count + 1, sizeof(*paths))) if (dwrite_array_reserve((void **)&paths, &capacity, count + 1, sizeof(*paths)))
{ {
if (!strchrW(value, '\\')) if (!wcschr(value, '\\'))
{ {
static const WCHAR fontsW[] = {'\\','f','o','n','t','s','\\',0}; static const WCHAR fontsW[] = {'\\','f','o','n','t','s','\\',0};
WCHAR *ptrW; WCHAR *ptrW;
ptrW = heap_alloc((MAX_PATH + lstrlenW(value)) * sizeof(WCHAR)); ptrW = heap_alloc((MAX_PATH + wcslen(value)) * sizeof(WCHAR));
GetWindowsDirectoryW(ptrW, MAX_PATH); GetWindowsDirectoryW(ptrW, MAX_PATH);
lstrcatW(ptrW, fontsW); wcscat(ptrW, fontsW);
lstrcatW(ptrW, value); wcscat(ptrW, value);
heap_free(value); heap_free(value);
value = ptrW; value = ptrW;
@ -1602,10 +1602,10 @@ static HRESULT create_system_path_list(WCHAR ***ret, unsigned int *ret_count)
return S_OK; return S_OK;
} }
static int create_system_fontset_compare(const void *left, const void *right) static int __cdecl create_system_fontset_compare(const void *left, const void *right)
{ {
const WCHAR *_l = *(WCHAR **)left, *_r = *(WCHAR **)right; const WCHAR *_l = *(WCHAR **)left, *_r = *(WCHAR **)right;
return lstrcmpiW(_l, _r); return wcsicmp(_l, _r);
}; };
static HRESULT create_system_fontset(IDWriteFactory7 *factory, REFIID riid, void **obj) static HRESULT create_system_fontset(IDWriteFactory7 *factory, REFIID riid, void **obj)
@ -1628,7 +1628,7 @@ static HRESULT create_system_fontset(IDWriteFactory7 *factory, REFIID riid, void
for (i = 0, j = 0; i < count; ++i) for (i = 0, j = 0; i < count; ++i)
{ {
if (i != j && !lstrcmpiW(paths[i], paths[j])) continue; if (i != j && !wcsicmp(paths[i], paths[j])) continue;
if (FAILED(hr = IDWriteFontSetBuilder2_AddFontFile(builder, paths[i])) && hr != DWRITE_E_FILEFORMAT) if (FAILED(hr = IDWriteFontSetBuilder2_AddFontFile(builder, paths[i])) && hr != DWRITE_E_FILEFORMAT)
WARN("Failed to add font file, hr %#x, path %s.\n", hr, debugstr_w(paths[i])); WARN("Failed to add font file, hr %#x, path %s.\n", hr, debugstr_w(paths[i]));

View File

@ -21,9 +21,7 @@
#define COBJMACROS #define COBJMACROS
#define NONAMELESSUNION #define NONAMELESSUNION
#include "config.h"
#include "dwrite_private.h" #include "dwrite_private.h"
#include "winternl.h"
WINE_DEFAULT_DEBUG_CHANNEL(dwrite); WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
@ -1574,7 +1572,7 @@ struct cmap_format4_compare_context
unsigned int ch; unsigned int ch;
}; };
static int cmap_format4_compare_range(const void *a, const void *b) static int __cdecl cmap_format4_compare_range(const void *a, const void *b)
{ {
const struct cmap_format4_compare_context *key = a; const struct cmap_format4_compare_context *key = a;
const UINT16 *end = b; const UINT16 *end = b;
@ -1659,7 +1657,7 @@ static unsigned int opentype_cmap_format6_10_get_ranges(const struct dwrite_cmap
return 1; return 1;
} }
static int cmap_format12_13_compare_group(const void *a, const void *b) static int __cdecl cmap_format12_13_compare_group(const void *a, const void *b)
{ {
const unsigned int *ch = a; const unsigned int *ch = a;
const UINT32 *group = b; const UINT32 *group = b;
@ -1737,7 +1735,7 @@ UINT16 opentype_cmap_get_glyph(const struct dwrite_cmap *cmap, unsigned int ch)
return glyph; return glyph;
} }
static int cmap_header_compare(const void *a, const void *b) static int __cdecl cmap_header_compare(const void *a, const void *b)
{ {
const UINT16 *key = a; const UINT16 *key = a;
const UINT16 *record = b; const UINT16 *record = b;
@ -2271,17 +2269,18 @@ static void get_name_record_locale(enum OPENTYPE_PLATFORM_ID platform, USHORT la
if (locale_name) if (locale_name)
MultiByteToWideChar(CP_ACP, 0, name_mac_langid_to_locale[lang_id], -1, locale, locale_len); MultiByteToWideChar(CP_ACP, 0, name_mac_langid_to_locale[lang_id], -1, locale, locale_len);
else else
strcpyW(locale, enusW); wcscpy(locale, enusW);
break; break;
} }
case OPENTYPE_PLATFORM_WIN: case OPENTYPE_PLATFORM_WIN:
if (!LCIDToLocaleName(MAKELCID(lang_id, SORT_DEFAULT), locale, locale_len, 0)) { if (!LCIDToLocaleName(MAKELCID(lang_id, SORT_DEFAULT), locale, locale_len, 0))
{
FIXME("failed to get locale name for lcid=0x%08x\n", MAKELCID(lang_id, SORT_DEFAULT)); FIXME("failed to get locale name for lcid=0x%08x\n", MAKELCID(lang_id, SORT_DEFAULT));
strcpyW(locale, enusW); wcscpy(locale, enusW);
} }
break; break;
case OPENTYPE_PLATFORM_UNICODE: case OPENTYPE_PLATFORM_UNICODE:
strcpyW(locale, enusW); wcscpy(locale, enusW);
break; break;
default: default:
FIXME("unknown platform %d\n", platform); FIXME("unknown platform %d\n", platform);
@ -2351,7 +2350,7 @@ static BOOL opentype_decode_namerecord(const struct dwrite_fonttable *table, uns
add_localizedstring(strings, locale, name_string); add_localizedstring(strings, locale, name_string);
heap_free(name_string); heap_free(name_string);
ret = !lstrcmpW(locale, enusW); ret = !wcscmp(locale, enusW);
} }
else else
FIXME("handle NAME format 1\n"); FIXME("handle NAME format 1\n");
@ -2448,10 +2447,10 @@ static WCHAR *meta_get_lng_name(WCHAR *str, WCHAR **ctx)
WCHAR *ret; WCHAR *ret;
if (!str) str = *ctx; if (!str) str = *ctx;
while (*str && strchrW(delimW, *str)) str++; while (*str && wcschr(delimW, *str)) str++;
if (!*str) return NULL; if (!*str) return NULL;
ret = str++; ret = str++;
while (*str && !strchrW(delimW, *str)) str++; while (*str && !wcschr(delimW, *str)) str++;
if (*str) *str++ = 0; if (*str) *str++ = 0;
*ctx = str; *ctx = str;
@ -2651,10 +2650,12 @@ HRESULT opentype_get_font_facename(struct file_stream_desc *stream_desc, WCHAR *
IDWriteLocalizedStrings_GetStringLength(lfnames, index, &length); IDWriteLocalizedStrings_GetStringLength(lfnames, index, &length);
nameW = heap_alloc((length + 1) * sizeof(WCHAR)); nameW = heap_alloc((length + 1) * sizeof(WCHAR));
if (nameW) { if (nameW)
{
*nameW = 0; *nameW = 0;
IDWriteLocalizedStrings_GetString(lfnames, index, nameW, length + 1); IDWriteLocalizedStrings_GetString(lfnames, index, nameW, length + 1);
lstrcpynW(lfname, nameW, LF_FACESIZE); wcsncpy(lfname, nameW, LF_FACESIZE);
lfname[LF_FACESIZE-1] = 0;
heap_free(nameW); heap_free(nameW);
} }
} }
@ -2901,7 +2902,7 @@ HRESULT opentype_get_cpal_entries(const struct dwrite_fonttable *cpal, unsigned
return S_OK; return S_OK;
} }
static int colr_compare_gid(const void *g, const void *r) static int __cdecl colr_compare_gid(const void *g, const void *r)
{ {
const struct colr_baseglyph_record *record = r; const struct colr_baseglyph_record *record = r;
UINT16 glyph = *(UINT16*)g, GID = GET_BE_WORD(record->glyph); UINT16 glyph = *(UINT16*)g, GID = GET_BE_WORD(record->glyph);
@ -3259,7 +3260,7 @@ unsigned int opentype_layout_find_language(const struct scriptshaping_cache *cac
return 0; return 0;
} }
static int gdef_class_compare_format2(const void *g, const void *r) static int __cdecl gdef_class_compare_format2(const void *g, const void *r)
{ {
const struct ot_gdef_class_range *range = r; const struct ot_gdef_class_range *range = r;
UINT16 glyph = *(UINT16 *)g; UINT16 glyph = *(UINT16 *)g;
@ -3368,7 +3369,7 @@ struct coverage_compare_format1_context
unsigned int *coverage_index; unsigned int *coverage_index;
}; };
static int coverage_compare_format1(const void *left, const void *right) static int __cdecl coverage_compare_format1(const void *left, const void *right)
{ {
const struct coverage_compare_format1_context *context = left; const struct coverage_compare_format1_context *context = left;
UINT16 glyph = GET_BE_WORD(*(UINT16 *)right); UINT16 glyph = GET_BE_WORD(*(UINT16 *)right);
@ -3381,7 +3382,7 @@ static int coverage_compare_format1(const void *left, const void *right)
return ret; return ret;
} }
static int coverage_compare_format2(const void *g, const void *r) static int __cdecl coverage_compare_format2(const void *g, const void *r)
{ {
const struct ot_coverage_range *range = r; const struct ot_coverage_range *range = r;
UINT16 glyph = *(UINT16 *)g; UINT16 glyph = *(UINT16 *)g;
@ -3440,7 +3441,7 @@ static unsigned int opentype_layout_is_glyph_covered(const struct dwrite_fonttab
static inline unsigned int dwrite_popcount(unsigned int x) static inline unsigned int dwrite_popcount(unsigned int x)
{ {
#ifdef HAVE___BUILTIN_POPCOUNT #if defined(__GNUC__) && (__GNUC__ >= 4)
return __builtin_popcount(x); return __builtin_popcount(x);
#else #else
x -= x >> 1 & 0x55555555; x -= x >> 1 & 0x55555555;
@ -3866,7 +3867,7 @@ static BOOL opentype_layout_apply_gpos_single_adjustment(struct scriptshaping_co
return TRUE; return TRUE;
} }
static int gpos_pair_adjustment_compare_format1(const void *g, const void *r) static int __cdecl gpos_pair_adjustment_compare_format1(const void *g, const void *r)
{ {
const struct ot_gpos_pairvalue *pairvalue = r; const struct ot_gpos_pairvalue *pairvalue = r;
UINT16 second_glyph = GET_BE_WORD(pairvalue->second_glyph); UINT16 second_glyph = GET_BE_WORD(pairvalue->second_glyph);
@ -4456,7 +4457,7 @@ struct lookups
size_t count; size_t count;
}; };
static int lookups_sorting_compare(const void *a, const void *b) static int __cdecl lookups_sorting_compare(const void *a, const void *b)
{ {
const struct lookup *left = (const struct lookup *)a; const struct lookup *left = (const struct lookup *)a;
const struct lookup *right = (const struct lookup *)b; const struct lookup *right = (const struct lookup *)b;
@ -4715,7 +4716,7 @@ static void opentype_layout_collect_lookups(struct scriptshaping_context *contex
} }
} }
static int feature_search_compare(const void *a, const void* b) static int __cdecl feature_search_compare(const void *a, const void* b)
{ {
unsigned int tag = *(unsigned int *)a; unsigned int tag = *(unsigned int *)a;
const struct shaping_feature *feature = b; const struct shaping_feature *feature = b;
@ -6525,7 +6526,7 @@ struct kern_format0_compare_key
UINT16 right; UINT16 right;
}; };
static int kern_format0_compare(const void *a, const void *b) static int __cdecl kern_format0_compare(const void *a, const void *b)
{ {
const struct kern_format0_compare_key *key = a; const struct kern_format0_compare_key *key = a;
const WORD *data = b; const WORD *data = b;

View File

@ -148,7 +148,7 @@ void shape_start_next_stage(struct shaping_features *features, stage_func func)
features->stage++; features->stage++;
} }
static int features_sorting_compare(const void *a, const void *b) static int __cdecl features_sorting_compare(const void *a, const void *b)
{ {
const struct shaping_feature *left = a, *right = b; const struct shaping_feature *left = a, *right = b;
return left->tag != right->tag ? (left->tag < right->tag ? -1 : 1) : 0; return left->tag != right->tag ? (left->tag < right->tag ? -1 : 1) : 0;
@ -352,7 +352,7 @@ HRESULT shape_get_glyphs(struct scriptshaping_context *context, const unsigned i
return (context->glyph_count <= context->u.subst.max_glyph_count) ? S_OK : E_NOT_SUFFICIENT_BUFFER; return (context->glyph_count <= context->u.subst.max_glyph_count) ? S_OK : E_NOT_SUFFICIENT_BUFFER;
} }
static int tag_array_sorting_compare(const void *a, const void *b) static int __cdecl tag_array_sorting_compare(const void *a, const void *b)
{ {
unsigned int left = GET_BE_DWORD(*(unsigned int *)a), right = GET_BE_DWORD(*(unsigned int *)b); unsigned int left = GET_BE_DWORD(*(unsigned int *)a), right = GET_BE_DWORD(*(unsigned int *)b);
return left != right ? (left < right ? -1 : 1) : 0; return left != right ? (left < right ? -1 : 1) : 0;