diff --git a/dlls/dwrite/Makefile.in b/dlls/dwrite/Makefile.in index 8b612989386..12af1c6736e 100644 --- a/dlls/dwrite/Makefile.in +++ b/dlls/dwrite/Makefile.in @@ -3,6 +3,8 @@ IMPORTLIB = dwrite IMPORTS = user32 gdi32 advapi32 EXTRAINCL = $(FREETYPE_CFLAGS) +EXTRADLLFLAGS = -mno-cygwin + C_SRCS = \ analyzer.c \ bidi.c \ diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c index ecbe1a389fa..e58ec835acc 100644 --- a/dlls/dwrite/analyzer.c +++ b/dlls/dwrite/analyzer.c @@ -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].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].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}; /* For some Arabic locales Latin digits are returned for SNATIVEDIGITS */ - if (!strcmpW(arW, isolang)) { - strcpyW(digits, arabicW); + if (!wcscmp(arW, isolang)) + { + wcscpy(digits, arabicW); break; } } @@ -1978,7 +1979,7 @@ static ULONG WINAPI fontfallback_Release(IDWriteFontFallback1 *iface) 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; DWRITE_UNICODE_RANGE *range = (DWRITE_UNICODE_RANGE *)b; diff --git a/dlls/dwrite/bidi.c b/dlls/dwrite/bidi.c index e2f3385519d..0cfca0fd95b 100644 --- a/dlls/dwrite/bidi.c +++ b/dlls/dwrite/bidi.c @@ -619,7 +619,7 @@ typedef struct tagBracketPair int end; } 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; } diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 2408251717b..7cca4c5c4f9 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -18,11 +18,11 @@ #include "dwrite_3.h" #include "d2d1.h" +#include "winternl.h" #include "wine/debug.h" #include "wine/heap.h" #include "wine/list.h" -#include "wine/unicode.h" #define MS_GSUB_TAG DWRITE_MAKE_OPENTYPE_TAG('G','S','U','B') #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) { DWORD size; - size = (strlenW(str)+1)*sizeof(WCHAR); + size = (lstrlenW(str) + 1)*sizeof(WCHAR); ret = heap_alloc(size); if(ret) memcpy(ret, str, size); @@ -743,7 +743,6 @@ struct font_backend_funcs 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 release_font_backend(void) DECLSPEC_HIDDEN; diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 68d3b1256ea..adc51d872dc 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -3053,10 +3053,11 @@ static UINT32 collection_find_family(struct dwrite_fontcollection *collection, c UINT32 j, count = IDWriteLocalizedStrings_GetCount(family_name); HRESULT hr; - for (j = 0; j < count; j++) { + for (j = 0; j < count; j++) + { WCHAR buffer[255]; hr = IDWriteLocalizedStrings_GetString(family_name, j, buffer, ARRAY_SIZE(buffer)); - if (SUCCEEDED(hr) && !strcmpiW(buffer, name)) + if (SUCCEEDED(hr) && !wcsicmp(buffer, name)) return i; } } @@ -3330,14 +3331,14 @@ static int trim_spaces(WCHAR *in, WCHAR *ret) { int len; - while (isspaceW(*in)) + while (iswspace(*in)) in++; ret[0] = 0; - if (!(len = strlenW(in))) + if (!(len = wcslen(in))) return 0; - while (isspaceW(in[len-1])) + while (iswspace(in[len-1])) len--; 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; int i = 0; - while ((pattern = &patterns[i++])->part1) { - int len_part1 = strlenW(pattern->part1); - int len_part2 = pattern->part2 ? strlenW(pattern->part2) : 0; + while ((pattern = &patterns[i++])->part1) + { + 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) { 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) continue; - if (!strncmpiW(token->ptr, pattern->part1, len_part1)) { + if (!wcsnicmp(token->ptr, pattern->part1, len_part1)) + { if (match) *match = *token; list_remove(&token->entry); heap_free(token); @@ -3395,11 +3398,12 @@ static BOOL match_pattern_list(struct list *tokens, const struct name_pattern *p continue; /* it's possible to have combined string as a token, like ExtraCondensed */ - if (token->len == len_part1 + len_part2) { - if (strncmpiW(token->ptr, pattern->part1, len_part1)) + if (token->len == len_part1 + len_part2) + { + if (wcsnicmp(token->ptr, pattern->part1, len_part1)) continue; - if (strncmpiW(&token->ptr[len_part1], pattern->part2, len_part2)) + if (wcsnicmp(&token->ptr[len_part1], pattern->part2, len_part2)) continue; /* 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) continue; - if (strncmpiW(token->ptr, pattern->part2, len_part2)) + if (wcsnicmp(token->ptr, pattern->part2, len_part2)) continue; - if (strncmpiW(next_token->ptr, pattern->part1, len_part1)) + if (wcsnicmp(next_token->ptr, pattern->part1, len_part1)) continue; /* both parts matched, remove tokens */ @@ -3716,12 +3720,13 @@ static DWRITE_FONT_WEIGHT font_extract_weight(struct list *tokens, DWRITE_FONT_W return weight; } -struct knownweight_entry { +struct knownweight_entry +{ const WCHAR *nameW; 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; 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; } - strcpyW(nameW, ptr->nameW); + wcscpy(nameW, ptr->nameW); return TRUE; } @@ -3800,21 +3805,24 @@ static const WCHAR *facename_remove_regular_term(WCHAR *facenameW, INT len) int i = 0; if (len == -1) - len = strlenW(facenameW); + len = wcslen(facenameW); /* remove rightmost regular variant from face name */ - while (!regular_ptr && (ptr = regular_patterns[i++])) { - int pattern_len = strlenW(ptr); + while (!regular_ptr && (ptr = regular_patterns[i++])) + { + int pattern_len = wcslen(ptr); WCHAR *src; if (pattern_len > len) continue; src = facenameW + len - pattern_len; - while (src >= facenameW) { - if (!strncmpiW(src, ptr, pattern_len)) { + while (src >= facenameW) + { + if (!wcsnicmp(src, ptr, pattern_len)) + { memmove(src, src + pattern_len, (len - pattern_len - (src - facenameW) + 1)*sizeof(WCHAR)); - len = strlenW(facenameW); + len = wcslen(facenameW); regular_ptr = ptr; 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); /* append face name to family name, FIXME check if face name is a substring of family name */ - if (*facenameW) { - strcatW(familynameW, spaceW); - strcatW(familynameW, facenameW); + if (*facenameW) + { + wcscat(familynameW, spaceW); + wcscat(familynameW, facenameW); } /* 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 */ fontname_tokens_to_str(&tokens, finalW); - if (!strcmpW(familyW, finalW)) + if (!wcscmp(familyW, finalW)) return FALSE; /* construct face name */ - strcpyW(familyW, finalW); + wcscpy(familyW, finalW); /* resolved weight name */ 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)) { } /* use Wnnn format as a fallback in case weight is not one of known values */ - else { + else + { static const WCHAR fmtW[] = {'W','%','d',0}; - sprintfW(weightW, fmtW, font->weight); + swprintf(weightW, ARRAY_SIZE(weightW), fmtW, font->weight); } /* resolved stretch name */ @@ -3990,7 +4000,7 @@ static BOOL font_apply_differentiation_rules(struct dwrite_font_data *font, WCHA extraexpandedW, ultraexpandedW }; - strcpyW(stretchW, stretchnamesW[font->stretch]); + wcscpy(stretchW, stretchnamesW[font->stretch]); } /* resolved style name */ @@ -4001,27 +4011,30 @@ static BOOL font_apply_differentiation_rules(struct dwrite_font_data *font, WCHA /* use predefined names */ else { if (font->style == DWRITE_FONT_STYLE_ITALIC) - strcpyW(styleW, italicW); + wcscpy(styleW, italicW); else - strcpyW(styleW, obliqueW); + wcscpy(styleW, obliqueW); } /* use Regular match if it was found initially */ if (!*weightW && !*stretchW && !*styleW) - strcpyW(faceW, regular_ptr ? regular_ptr : regularW); - else { + wcscpy(faceW, regular_ptr ? regular_ptr : regularW); + else + { faceW[0] = 0; - if (*stretchW) - strcpyW(faceW, stretchW); - if (*weightW) { - if (*faceW) - strcatW(faceW, spaceW); - strcatW(faceW, weightW); + + if (*stretchW) wcscpy(faceW, stretchW); + + if (*weightW) + { + if (*faceW) wcscat(faceW, spaceW); + wcscat(faceW, weightW); } - if (*styleW) { - if (*faceW) - strcatW(faceW, spaceW); - strcatW(faceW, styleW); + + if (*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); /* Bold suffix for new name */ - if (*facenameW) - strcatW(facenameW, spaceW); - strcatW(facenameW, boldW); + if (*facenameW) wcscat(facenameW, spaceW); + wcscat(facenameW, boldW); if (init_font_data_from_font(family->fonts[heaviest], DWRITE_FONT_SIMULATIONS_BOLD, facenameW, &boldface) == S_OK) { 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)); facename_remove_regular_term(facenameW, -1); - if (*facenameW) - strcatW(facenameW, spaceW); - strcatW(facenameW, obliqueW); + if (*facenameW) wcscat(facenameW, spaceW); + wcscat(facenameW, obliqueW); if (init_font_data_from_font(family->fonts[regular], DWRITE_FONT_SIMULATIONS_OBLIQUE, facenameW, &obliqueface) == S_OK) { obliqueface->oblique_sim_tested = 1; @@ -4362,7 +4373,7 @@ static void fontcollection_add_replacements(struct dwrite_fontcollection *collec while (*replacement) { if (fontcollection_add_replacement(collection, name, replacement)) break; - replacement += strlenW(replacement) + 1; + replacement += wcslen(replacement) + 1; } } else if (type == REG_SZ) @@ -4599,13 +4610,14 @@ static HRESULT create_local_file_reference(IDWriteFactory7 *factory, const WCHAR HRESULT hr; /* 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}; WCHAR fullpathW[MAX_PATH]; GetWindowsDirectoryW(fullpathW, ARRAY_SIZE(fullpathW)); - strcatW(fullpathW, fontsW); - strcatW(fullpathW, filename); + wcscat(fullpathW, fontsW); + wcscat(fullpathW, filename); 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. Default family appears with empty family name. */ create_localizedstrings(&names); - if (!strcmpiW(keynameW, defaultfontW)) + if (!wcsicmp(keynameW, defaultfontW)) add_localizedstring(names, emptyW, emptyW); else add_localizedstring(names, emptyW, keynameW); @@ -4867,7 +4879,7 @@ HRESULT get_eudc_fontcollection(IDWriteFactory7 *factory, IDWriteFontCollection3 IDWriteFactory7_AddRef(factory); /* 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)) return S_OK; @@ -5522,7 +5534,7 @@ static HRESULT WINAPI localfontfileloader_GetFilePathLengthFromKey(IDWriteLocalF TRACE("%p, %p, %u, %p.\n", iface, key, key_size, length); - *length = strlenW(refkey->name); + *length = wcslen(refkey->name); 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); - if (length < strlenW(refkey->name)) + if (length < wcslen(refkey->name)) return E_INVALIDARG; - strcpyW(path, refkey->name); + wcscpy(path, refkey->name); return S_OK; } @@ -5583,7 +5595,7 @@ HRESULT get_local_refkey(const WCHAR *path, const FILETIME *writetime, void **ke if (!path) 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; refkey = heap_alloc(*size); @@ -5600,7 +5612,7 @@ HRESULT get_local_refkey(const WCHAR *path, const FILETIME *writetime, void **ke else memset(&refkey->writetime, 0, sizeof(refkey->writetime)); } - strcpyW(refkey->name, path); + wcscpy(refkey->name, path); *key = refkey; @@ -8014,10 +8026,10 @@ struct font_callback_funcs callback_funcs = 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) { - init_font_lib(dwrite_module, DLL_PROCESS_DETACH, &callback_funcs, NULL); + __wine_init_unix_lib(dwrite_module, DLL_PROCESS_DETACH, &callback_funcs, NULL); } diff --git a/dlls/dwrite/freetype.c b/dlls/dwrite/freetype.c index 128388c9c86..ca29b0d97bd 100644 --- a/dlls/dwrite/freetype.c +++ b/dlls/dwrite/freetype.c @@ -18,7 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define COBJMACROS +#if 0 +#pragma makedep unix +#endif #include "config.h" #include "wine/port.h" @@ -860,7 +862,7 @@ static NTSTATUS release_freetype_lib(void) #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) return init_freetype_lib(module, reason, ptr_in, ptr_out); diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index eb6280d7fc1..48741bf0847 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -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, 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, @@ -2432,9 +2432,9 @@ static BOOL is_same_layout_attrvalue(struct layout_range_header const *h, enum l case LAYOUT_RANGE_ATTR_FONTCOLL: return range->collection == value->u.collection; 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: - return strcmpW(range->fontfamily, value->u.fontfamily) == 0; + return !wcscmp(range->fontfamily, value->u.fontfamily); case LAYOUT_RANGE_ATTR_SPACING: return range_spacing->leading == value->u.spacing.leading && 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->pair_kerning == right->pair_kerning && left->collection == right->collection && - !strcmpiW(left->locale, right->locale) && - !strcmpW(left->fontfamily, right->fontfamily); + !wcsicmp(left->locale, right->locale) && + !wcscmp(left->fontfamily, right->fontfamily); } case LAYOUT_RANGE_UNDERLINE: case LAYOUT_RANGE_STRIKETHROUGH: @@ -2529,7 +2529,7 @@ static struct layout_range_header *alloc_layout_range(struct dwrite_textlayout * range->collection = layout->format.collection; if (range->collection) IDWriteFontCollection_AddRef(range->collection); - strcpyW(range->locale, layout->format.locale); + wcscpy(range->locale, layout->format.locale); h = &range->h; 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); break; case LAYOUT_RANGE_ATTR_LOCALE: - changed = strcmpiW(dest->locale, value->u.locale) != 0; - if (changed) { - strcpyW(dest->locale, value->u.locale); - strlwrW(dest->locale); + changed = !!wcsicmp(dest->locale, value->u.locale); + if (changed) + { + wcscpy(dest->locale, value->u.locale); + wcslwr(dest->locale); } break; case LAYOUT_RANGE_ATTR_FONTFAMILY: - changed = strcmpW(dest->fontfamily, value->u.fontfamily) != 0; - if (changed) { + changed = !!wcscmp(dest->fontfamily, value->u.fontfamily); + if (changed) + { heap_free(dest->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); - *length = strlenW(str); + *length = wcslen(str); return return_range(&range->h, r); } @@ -3052,10 +3054,10 @@ static HRESULT get_string_attribute_value(struct dwrite_textlayout *layout, enum return E_INVALIDARG; str = get_string_attribute_ptr(range, kind); - if (length < strlenW(str) + 1) + if (length < wcslen(str) + 1) return E_NOT_SUFFICIENT_BUFFER; - strcpyW(ret, str); + wcscpy(ret, str); 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)); - if (!locale || strlenW(locale) > LOCALE_NAME_MAX_LENGTH-1) + if (!locale || wcslen(locale) > LOCALE_NAME_MAX_LENGTH-1) return E_INVALIDARG; value.range = range; @@ -4816,7 +4818,7 @@ static HRESULT WINAPI dwritetextformat_layout_GetFontFamilyName(IDWriteTextForma TRACE("%p, %p, %u.\n", iface, name, size); 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; } @@ -4872,7 +4874,7 @@ static HRESULT WINAPI dwritetextformat_layout_GetLocaleName(IDWriteTextFormat3 * TRACE("%p, %p, %u.\n", iface, name, size); if (size <= layout->format.locale_len) return E_NOT_SUFFICIENT_BUFFER; - strcpyW(name, layout->format.locale); + wcscpy(name, layout->format.locale); return S_OK; } @@ -5285,7 +5287,8 @@ static HRESULT WINAPI dwritetextlayout_source_GetLocaleName(IDWriteTextAnalysisS *text_len = range->h.range.length - position; 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; 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) return E_NOT_SUFFICIENT_BUFFER; - strcpyW(name, format->format.family_name); + wcscpy(name, format->format.family_name); return S_OK; } @@ -5996,7 +5999,7 @@ static HRESULT WINAPI dwritetextformat_GetLocaleName(IDWriteTextFormat3 *iface, if (size <= format->format.locale_len) return E_NOT_SUFFICIENT_BUFFER; - strcpyW(name, format->format.locale); + wcscpy(name, format->format.locale); return S_OK; } @@ -6216,11 +6219,11 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle object->IDWriteTextFormat3_iface.lpVtbl = &dwritetextformatvtbl; object->refcount = 1; 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_len = strlenW(locale); + object->format.locale_len = wcslen(locale); /* 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.style = style; object->format.fontsize = size; diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c index 41b81ae951b..274e8be91b3 100644 --- a/dlls/dwrite/main.c +++ b/dlls/dwrite/main.c @@ -343,7 +343,7 @@ static HRESULT WINAPI localizedstrings_FindLocaleName(IDWriteLocalizedStrings *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; *index = i; @@ -366,7 +366,7 @@ static HRESULT WINAPI localizedstrings_GetLocaleNameLength(IDWriteLocalizedStrin return E_FAIL; } - *length = strlenW(strings->data[index].locale); + *length = wcslen(strings->data[index].locale); return S_OK; } @@ -382,13 +382,13 @@ static HRESULT WINAPI localizedstrings_GetLocaleName(IDWriteLocalizedStrings *if return E_FAIL; } - if (size < strlenW(strings->data[index].locale) + 1) + if (size < wcslen(strings->data[index].locale) + 1) { if (buffer) *buffer = 0; return E_NOT_SUFFICIENT_BUFFER; } - strcpyW(buffer, strings->data[index].locale); + wcscpy(buffer, strings->data[index].locale); return S_OK; } @@ -404,7 +404,7 @@ static HRESULT WINAPI localizedstrings_GetStringLength(IDWriteLocalizedStrings * return E_FAIL; } - *length = strlenW(strings->data[index].string); + *length = wcslen(strings->data[index].string); return S_OK; } @@ -420,13 +420,13 @@ static HRESULT WINAPI localizedstrings_GetString(IDWriteLocalizedStrings *iface, return E_FAIL; } - if (size < strlenW(strings->data[index].string) + 1) + if (size < wcslen(strings->data[index].string) + 1) { if (buffer) *buffer = 0; return E_NOT_SUFFICIENT_BUFFER; } - strcpyW(buffer, strings->data[index].string); + wcscpy(buffer, strings->data[index].string); return S_OK; } @@ -470,7 +470,7 @@ HRESULT add_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *locale, if (*locale) { for (i = 0; i < count; i++) - if (!lstrcmpiW(strings->data[i].locale, locale)) + if (!wcsicmp(strings->data[i].locale, locale)) return S_OK; } @@ -485,7 +485,7 @@ HRESULT add_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *locale, heap_free(strings->data[count].string); return E_OUTOFMEMORY; } - strlwrW(strings->data[count].locale); + wcslwr(strings->data[count].locale); strings->count++; @@ -537,7 +537,7 @@ void set_en_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *string) 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); 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; - return strcmpW(_l->locale, _r->locale); + return wcscmp(_l->locale, _r->locale); }; void sort_localizedstrings(IDWriteLocalizedStrings *iface) @@ -573,7 +573,7 @@ BOOL localizedstrings_contains(IDWriteLocalizedStrings *iface, const WCHAR *str) 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; @@ -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 (!strchrW(value, '\\')) + if (!wcschr(value, '\\')) { static const WCHAR fontsW[] = {'\\','f','o','n','t','s','\\',0}; WCHAR *ptrW; - ptrW = heap_alloc((MAX_PATH + lstrlenW(value)) * sizeof(WCHAR)); + ptrW = heap_alloc((MAX_PATH + wcslen(value)) * sizeof(WCHAR)); GetWindowsDirectoryW(ptrW, MAX_PATH); - lstrcatW(ptrW, fontsW); - lstrcatW(ptrW, value); + wcscat(ptrW, fontsW); + wcscat(ptrW, value); heap_free(value); value = ptrW; @@ -1602,10 +1602,10 @@ static HRESULT create_system_path_list(WCHAR ***ret, unsigned int *ret_count) 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; - return lstrcmpiW(_l, _r); + return wcsicmp(_l, _r); }; 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) { - 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) WARN("Failed to add font file, hr %#x, path %s.\n", hr, debugstr_w(paths[i])); diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index 8d6133545a2..53c0400c25f 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -21,9 +21,7 @@ #define COBJMACROS #define NONAMELESSUNION -#include "config.h" #include "dwrite_private.h" -#include "winternl.h" WINE_DEFAULT_DEBUG_CHANNEL(dwrite); @@ -1574,7 +1572,7 @@ struct cmap_format4_compare_context 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 UINT16 *end = b; @@ -1659,7 +1657,7 @@ static unsigned int opentype_cmap_format6_10_get_ranges(const struct dwrite_cmap 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 UINT32 *group = b; @@ -1737,7 +1735,7 @@ UINT16 opentype_cmap_get_glyph(const struct dwrite_cmap *cmap, unsigned int ch) 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 *record = b; @@ -2271,17 +2269,18 @@ static void get_name_record_locale(enum OPENTYPE_PLATFORM_ID platform, USHORT la if (locale_name) MultiByteToWideChar(CP_ACP, 0, name_mac_langid_to_locale[lang_id], -1, locale, locale_len); else - strcpyW(locale, enusW); + wcscpy(locale, enusW); break; } 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)); - strcpyW(locale, enusW); + wcscpy(locale, enusW); } break; case OPENTYPE_PLATFORM_UNICODE: - strcpyW(locale, enusW); + wcscpy(locale, enusW); break; default: 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); heap_free(name_string); - ret = !lstrcmpW(locale, enusW); + ret = !wcscmp(locale, enusW); } else FIXME("handle NAME format 1\n"); @@ -2448,10 +2447,10 @@ static WCHAR *meta_get_lng_name(WCHAR *str, WCHAR **ctx) WCHAR *ret; if (!str) str = *ctx; - while (*str && strchrW(delimW, *str)) str++; + while (*str && wcschr(delimW, *str)) str++; if (!*str) return NULL; ret = str++; - while (*str && !strchrW(delimW, *str)) str++; + while (*str && !wcschr(delimW, *str)) str++; if (*str) *str++ = 0; *ctx = str; @@ -2651,10 +2650,12 @@ HRESULT opentype_get_font_facename(struct file_stream_desc *stream_desc, WCHAR * IDWriteLocalizedStrings_GetStringLength(lfnames, index, &length); nameW = heap_alloc((length + 1) * sizeof(WCHAR)); - if (nameW) { + if (nameW) + { *nameW = 0; 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); } } @@ -2901,7 +2902,7 @@ HRESULT opentype_get_cpal_entries(const struct dwrite_fonttable *cpal, unsigned 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; 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; } -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; UINT16 glyph = *(UINT16 *)g; @@ -3368,7 +3369,7 @@ struct coverage_compare_format1_context 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; UINT16 glyph = GET_BE_WORD(*(UINT16 *)right); @@ -3381,7 +3382,7 @@ static int coverage_compare_format1(const void *left, const void *right) 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; 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) { -#ifdef HAVE___BUILTIN_POPCOUNT +#if defined(__GNUC__) && (__GNUC__ >= 4) return __builtin_popcount(x); #else x -= x >> 1 & 0x55555555; @@ -3866,7 +3867,7 @@ static BOOL opentype_layout_apply_gpos_single_adjustment(struct scriptshaping_co 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; UINT16 second_glyph = GET_BE_WORD(pairvalue->second_glyph); @@ -4456,7 +4457,7 @@ struct lookups 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 *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; const struct shaping_feature *feature = b; @@ -6525,7 +6526,7 @@ struct kern_format0_compare_key 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 WORD *data = b; diff --git a/dlls/dwrite/shape.c b/dlls/dwrite/shape.c index abeb7eeac79..2d098fb5688 100644 --- a/dlls/dwrite/shape.c +++ b/dlls/dwrite/shape.c @@ -148,7 +148,7 @@ void shape_start_next_stage(struct shaping_features *features, stage_func func) 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; 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; } -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); return left != right ? (left < right ? -1 : 1) : 0;