From: Henri Verbeet Subject: [PATCH 5/5] usp10: Avoid LPCWSTR. Message-Id: <1490133557-19136-5-git-send-email-hverbeet@codeweavers.com> Date: Tue, 21 Mar 2017 22:59:17 +0100 Signed-off-by: Henri Verbeet --- dlls/usp10/bidi.c | 38 +++++++++++++++++++------------------- dlls/usp10/indic.c | 39 +++++++++++++++++++++++---------------- dlls/usp10/usp10.c | 2 +- dlls/usp10/usp10_internal.h | 11 ++++++----- 4 files changed, 49 insertions(+), 41 deletions(-) diff --git a/dlls/usp10/bidi.c b/dlls/usp10/bidi.c index 39839e0..5941ef8 100644 --- a/dlls/usp10/bidi.c +++ b/dlls/usp10/bidi.c @@ -159,7 +159,7 @@ static inline void dump_types(const char* header, WORD *types, int start, int en } /* Convert the libwine information to the direction enum */ -static void classify(LPCWSTR lpString, WORD *chartype, DWORD uCount, const SCRIPT_CONTROL *c) +static void classify(const WCHAR *string, WORD *chartype, DWORD count, const SCRIPT_CONTROL *c) { static const enum directions dir_map[16] = { @@ -183,14 +183,14 @@ static void classify(LPCWSTR lpString, WORD *chartype, DWORD uCount, const SCRIP unsigned i; - for (i = 0; i < uCount; ++i) + for (i = 0; i < count; ++i) { - chartype[i] = dir_map[get_char_typeW(lpString[i]) >> 12]; + chartype[i] = dir_map[get_char_typeW(string[i]) >> 12]; switch (chartype[i]) { case ES: if (!c->fLegacyBidiClass) break; - switch (lpString[i]) + switch (string[i]) { case '-': case '+': chartype[i] = NI; break; @@ -198,7 +198,7 @@ static void classify(LPCWSTR lpString, WORD *chartype, DWORD uCount, const SCRIP } break; case PDF: - switch (lpString[i]) + switch (string[i]) { case 0x202A: chartype[i] = LRE; break; case 0x202B: chartype[i] = RLE; break; @@ -988,7 +988,8 @@ static void resolveResolved(unsigned baselevel, const WORD * pcls, WORD *plevel, } } -static void computeIsolatingRunsSet(unsigned baselevel, WORD *pcls, WORD *pLevel, LPCWSTR lpString, int uCount, struct list *set) +static void computeIsolatingRunsSet(unsigned baselevel, WORD *pcls, const WORD *pLevel, + const WCHAR *string, unsigned int uCount, struct list *set) { int run_start, run_end, i; int run_count = 0; @@ -1034,7 +1035,7 @@ static void computeIsolatingRunsSet(unsigned baselevel, WORD *pcls, WORD *pLevel for (j = 0; j < current_isolated->length; j++) { current_isolated->item[j].pcls = &pcls[runs[k].start+j]; - current_isolated->item[j].ch = lpString[runs[k].start+j]; + current_isolated->item[j].ch = string[runs[k].start + j]; } run_end = runs[k].end; @@ -1064,7 +1065,7 @@ search: for (m = 0; l < current_isolated->length; l++, m++) { current_isolated->item[l].pcls = &pcls[runs[j].start+m]; - current_isolated->item[l].ch = lpString[runs[j].start+m]; + current_isolated->item[l].ch = string[runs[j].start + m]; } TRACE("[%i -- %i]",runs[j].start, runs[j].end); @@ -1127,8 +1128,8 @@ search: * BIDI_DeterminLevels */ BOOL BIDI_DetermineLevels( - LPCWSTR lpString, /* [in] The string for which information is to be returned */ - INT uCount, /* [in] Number of WCHARs in string. */ + const WCHAR *lpString, /* [in] The string for which information is to be returned */ + unsigned int uCount, /* [in] Number of WCHARs in string. */ const SCRIPT_STATE *s, const SCRIPT_CONTROL *c, WORD *lpOutLevels, /* [out] final string levels */ @@ -1287,15 +1288,14 @@ int BIDI_ReorderL2vLevel(int level, int *pIndexs, const BYTE* plevel, int cch, B return ich; } -BOOL BIDI_GetStrengths(LPCWSTR lpString, INT uCount, const SCRIPT_CONTROL *c, - WORD* lpStrength) +BOOL BIDI_GetStrengths(const WCHAR *string, unsigned int count, const SCRIPT_CONTROL *c, WORD *strength) { - int i; - classify(lpString, lpStrength, uCount, c); + unsigned int i; - for ( i = 0; i < uCount; i++) + classify(string, strength, count, c); + for (i = 0; i < count; i++) { - switch(lpStrength[i]) + switch (strength[i]) { case L: case LRE: @@ -1304,7 +1304,7 @@ BOOL BIDI_GetStrengths(LPCWSTR lpString, INT uCount, const SCRIPT_CONTROL *c, case AL: case RLE: case RLO: - lpStrength[i] = BIDI_STRONG; + strength[i] = BIDI_STRONG; break; case PDF: case EN: @@ -1313,14 +1313,14 @@ BOOL BIDI_GetStrengths(LPCWSTR lpString, INT uCount, const SCRIPT_CONTROL *c, case AN: case CS: case BN: - lpStrength[i] = BIDI_WEAK; + strength[i] = BIDI_WEAK; break; case B: case S: case WS: case ON: default: /* Neutrals and NSM */ - lpStrength[i] = BIDI_NEUTRAL; + strength[i] = BIDI_NEUTRAL; } } return TRUE; diff --git a/dlls/usp10/indic.c b/dlls/usp10/indic.c index 71c2285..b4ce1ec 100644 --- a/dlls/usp10/indic.c +++ b/dlls/usp10/indic.c @@ -36,12 +36,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(uniscribe); -static void debug_output_string(LPCWSTR str, int cChar, lexical_function f) +static void debug_output_string(const WCHAR *str, unsigned int char_count, lexical_function f) { int i; if (TRACE_ON(uniscribe)) { - for (i = 0; i < cChar; i++) + for (i = 0; i < char_count; ++i) { switch (f(str[i])) { @@ -80,8 +80,8 @@ static inline BOOL is_joiner( int type ) return (type == lex_ZWJ || type == lex_ZWNJ); } -static INT consonant_header(LPCWSTR input, INT cChar, INT start, INT next, - lexical_function lex) +static int consonant_header(const WCHAR *input, unsigned int cChar, + unsigned int start, unsigned int next, lexical_function lex) { if (!is_consonant( lex(input[next]) )) return -1; next++; @@ -104,8 +104,8 @@ static INT consonant_header(LPCWSTR input, INT cChar, INT start, INT next, return -1; } -static INT parse_consonant_syllable(LPCWSTR input, INT cChar, INT start, - INT *main, INT next, lexical_function lex) +static int parse_consonant_syllable(const WCHAR *input, unsigned int cChar, + unsigned int start, unsigned int *main, unsigned int next, lexical_function lex) { int check; int headers = 0; @@ -152,8 +152,8 @@ static INT parse_consonant_syllable(LPCWSTR input, INT cChar, INT start, return next; } -static INT parse_vowel_syllable(LPCWSTR input, INT cChar, INT start, - INT next, lexical_function lex) +static int parse_vowel_syllable(const WCHAR *input, unsigned int cChar, + unsigned int start, unsigned int next, lexical_function lex) { if ((next < cChar) && lex(input[next]) == lex_Nukta) next++; @@ -181,7 +181,8 @@ static INT parse_vowel_syllable(LPCWSTR input, INT cChar, INT start, return next; } -static INT Indic_process_next_syllable( LPCWSTR input, INT cChar, INT start, INT* main, INT next, lexical_function lex ) +static int Indic_process_next_syllable(const WCHAR *input, unsigned int cChar, + unsigned int start, unsigned int *main, unsigned int next, lexical_function lex) { if (lex(input[next])==lex_Vowel) { @@ -208,7 +209,8 @@ static INT Indic_process_next_syllable( LPCWSTR input, INT cChar, INT start, INT return parse_consonant_syllable(input, cChar, start, main, next, lex); } -static BOOL Consonant_is_post_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR pwChar, IndicSyllable *s, lexical_function lexical, BOOL modern) +static BOOL Consonant_is_post_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc, + const WCHAR *pwChar, const IndicSyllable *s, lexical_function lexical, BOOL modern) { if (is_consonant(lexical(pwChar[s->base])) && s->base > s->start && lexical(pwChar[s->base-1]) == lex_Halant) { @@ -225,7 +227,8 @@ static BOOL Consonant_is_post_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCac return FALSE; } -static BOOL Consonant_is_below_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR pwChar, IndicSyllable *s, lexical_function lexical, BOOL modern) +static BOOL Consonant_is_below_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc, + const WCHAR *pwChar, const IndicSyllable *s, lexical_function lexical, BOOL modern) { if (is_consonant(lexical(pwChar[s->base])) && s->base > s->start && lexical(pwChar[s->base-1]) == lex_Halant) { @@ -242,7 +245,8 @@ static BOOL Consonant_is_below_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCa return FALSE; } -static BOOL Consonant_is_pre_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR pwChar, IndicSyllable *s, lexical_function lexical, BOOL modern) +static BOOL Consonant_is_pre_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc, + const WCHAR *pwChar, const IndicSyllable *s, lexical_function lexical, BOOL modern) { if (is_consonant(lexical(pwChar[s->base])) && s->base > s->start && lexical(pwChar[s->base-1]) == lex_Halant) { @@ -259,14 +263,16 @@ static BOOL Consonant_is_pre_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCach return FALSE; } -static BOOL Consonant_is_ralf(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR pwChar, IndicSyllable *s, lexical_function lexical) +static BOOL Consonant_is_ralf(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc, + const WCHAR *pwChar, const IndicSyllable *s, lexical_function lexical) { if ((lexical(pwChar[s->start])==lex_Ra) && s->end > s->start && lexical(pwChar[s->start+1]) == lex_Halant) return (SHAPE_does_GSUB_feature_apply_to_chars(hdc, psa, psc, &pwChar[s->start], 1, 2, "rphf") > 0); return FALSE; } -static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR input, IndicSyllable *s, lexical_function lex, BOOL modern) +static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc, + const WCHAR *input, IndicSyllable *s, lexical_function lex, BOOL modern) { int i; BOOL blwf = FALSE; @@ -314,11 +320,12 @@ static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LP return s->base; } -void Indic_ParseSyllables( HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR input, const int cChar, IndicSyllable **syllables, int *syllable_count, lexical_function lex, BOOL modern) +void Indic_ParseSyllables(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc, const WCHAR *input, unsigned int cChar, + IndicSyllable **syllables, int *syllable_count, lexical_function lex, BOOL modern) { + unsigned int center = 0; int index = 0; int next = 0; - int center = 0; *syllable_count = 0; diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c index 0e7001f..931def9 100644 --- a/dlls/usp10/usp10.c +++ b/dlls/usp10/usp10.c @@ -860,7 +860,7 @@ static WCHAR mirror_char( WCHAR ch ) return ch + wine_mirror_map[wine_mirror_map[ch >> 8] + (ch & 0xff)]; } -static inline DWORD decode_surrogate_pair(LPCWSTR str, INT index, INT end) +static DWORD decode_surrogate_pair(const WCHAR *str, unsigned int index, unsigned int end) { if (index < end-1 && IS_SURROGATE_PAIR(str[index],str[index+1])) { diff --git a/dlls/usp10/usp10_internal.h b/dlls/usp10/usp10_internal.h index a15bfd8..4841385 100644 --- a/dlls/usp10/usp10_internal.h +++ b/dlls/usp10/usp10_internal.h @@ -247,10 +247,10 @@ typedef void (*reorder_function)(LPWSTR pwChar, IndicSyllable *syllable, lexical int USP10_FindGlyphInLogClust(const WORD* pwLogClust, int cChars, WORD target) DECLSPEC_HIDDEN; -BOOL BIDI_DetermineLevels( LPCWSTR lpString, INT uCount, const SCRIPT_STATE *s, - const SCRIPT_CONTROL *c, WORD *lpOutLevels, WORD *lpOutOverrides ) DECLSPEC_HIDDEN; -BOOL BIDI_GetStrengths(LPCWSTR lpString, INT uCount, const SCRIPT_CONTROL *c, - WORD* lpStrength) DECLSPEC_HIDDEN; +BOOL BIDI_DetermineLevels(const WCHAR *string, unsigned int count, const SCRIPT_STATE *s, + const SCRIPT_CONTROL *c, WORD *levels, WORD *overrides) DECLSPEC_HIDDEN; +BOOL BIDI_GetStrengths(const WCHAR *string, unsigned int count, + const SCRIPT_CONTROL *c, WORD *strength) DECLSPEC_HIDDEN; INT BIDI_ReorderV2lLevel(int level, int *pIndexs, const BYTE* plevel, int cch, BOOL fReverse) DECLSPEC_HIDDEN; INT BIDI_ReorderL2vLevel(int level, int *pIndexs, const BYTE* plevel, int cch, BOOL fReverse) DECLSPEC_HIDDEN; void SHAPE_ContextualShaping(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust) DECLSPEC_HIDDEN; @@ -264,7 +264,8 @@ HRESULT SHAPE_GetFontLanguageTags( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *p HRESULT SHAPE_GetFontFeatureTags( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, int cMaxTags, OPENTYPE_TAG *pFeatureTags, int *pcTags) DECLSPEC_HIDDEN; void Indic_ReorderCharacters( HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPWSTR input, int cChars, IndicSyllable **syllables, int *syllable_count, lexical_function lexical_f, reorder_function reorder_f, BOOL modern) DECLSPEC_HIDDEN; -void Indic_ParseSyllables( HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR input, const int cChar, IndicSyllable **syllables, int *syllable_count, lexical_function lex, BOOL modern) DECLSPEC_HIDDEN; +void Indic_ParseSyllables(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, const WCHAR *input, unsigned int cChar, + IndicSyllable **syllables, int *syllable_count, lexical_function lex, BOOL modern) DECLSPEC_HIDDEN; void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT_LOGATTR *la) DECLSPEC_HIDDEN; -- 2.1.4