[PATCH 2/5] usp10: Avoid LPWSTR.
Aric Stewart
aric at codeweavers.com
Fri Mar 24 06:30:09 CDT 2017
Signed-off-by: Aric Stewart <aric at codeweavers.com>
On 3/23/17 4:49 PM, Henri Verbeet wrote:
> And cleanup a few style issues along the way.
>
> Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
> ---
> dlls/usp10/indic.c | 3 ++-
> dlls/usp10/shape.c | 51 ++++++++++++++++++++++++++-------------------
> dlls/usp10/usp10.c | 7 +++++--
> dlls/usp10/usp10_internal.h | 6 ++++--
> 4 files changed, 40 insertions(+), 27 deletions(-)
>
> diff --git a/dlls/usp10/indic.c b/dlls/usp10/indic.c
> index b4ce1ec..c9b0810 100644
> --- a/dlls/usp10/indic.c
> +++ b/dlls/usp10/indic.c
> @@ -369,7 +369,8 @@ void Indic_ParseSyllables(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc, const
> TRACE("Processed %i of %i characters into %i syllables\n",index,cChar,*syllable_count);
> }
>
> -void Indic_ReorderCharacters( HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPWSTR input, int cChar, IndicSyllable **syllables, int *syllable_count, lexical_function lex, reorder_function reorder_f, BOOL modern)
> +void Indic_ReorderCharacters(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc, WCHAR *input, unsigned int cChar,
> + IndicSyllable **syllables, int *syllable_count, lexical_function lex, reorder_function reorder_f, BOOL modern)
> {
> int i;
>
> diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c
> index ba370de..7ed2142 100644
> --- a/dlls/usp10/shape.c
> +++ b/dlls/usp10/shape.c
> @@ -120,7 +120,8 @@ typedef struct tagConsonantComponents
> WCHAR output;
> } ConsonantComponents;
>
> -typedef void (*second_reorder_function)(LPWSTR pwChar, IndicSyllable *syllable,WORD* pwGlyphs, IndicSyllable* glyph_index, lexical_function lex);
> +typedef void (*second_reorder_function)(const WCHAR *chars, const IndicSyllable *syllable,
> + WORD *glyphs, const IndicSyllable *glyph_index, lexical_function lex);
>
> typedef int (*combining_lexical_function)(WCHAR c);
>
> @@ -1717,7 +1718,7 @@ static void ComposeConsonants(HDC hdc, WCHAR *pwOutChars, INT *pcChars, const Co
> }
> }
>
> -static void Reorder_Ra_follows_base(LPWSTR pwChar, IndicSyllable *s, lexical_function lexical)
> +static void Reorder_Ra_follows_base(WCHAR *pwChar, IndicSyllable *s, lexical_function lexical)
> {
> if (s->ralf >= 0)
> {
> @@ -1736,7 +1737,7 @@ static void Reorder_Ra_follows_base(LPWSTR pwChar, IndicSyllable *s, lexical_fun
> }
> }
>
> -static void Reorder_Ra_follows_matra(LPWSTR pwChar, IndicSyllable *s, lexical_function lexical)
> +static void Reorder_Ra_follows_matra(WCHAR *pwChar, IndicSyllable *s, lexical_function lexical)
> {
> if (s->ralf >= 0)
> {
> @@ -1761,7 +1762,7 @@ static void Reorder_Ra_follows_matra(LPWSTR pwChar, IndicSyllable *s, lexical_fu
> }
> }
>
> -static void Reorder_Ra_follows_syllable(LPWSTR pwChar, IndicSyllable *s, lexical_function lexical)
> +static void Reorder_Ra_follows_syllable(WCHAR *pwChar, IndicSyllable *s, lexical_function lexical)
> {
> if (s->ralf >= 0)
> {
> @@ -1782,7 +1783,7 @@ static void Reorder_Ra_follows_syllable(LPWSTR pwChar, IndicSyllable *s, lexical
> }
> }
>
> -static void Reorder_Matra_precede_base(LPWSTR pwChar, IndicSyllable *s, lexical_function lexical)
> +static void Reorder_Matra_precede_base(WCHAR *pwChar, IndicSyllable *s, lexical_function lexical)
> {
> int i;
>
> @@ -1809,7 +1810,7 @@ static void Reorder_Matra_precede_base(LPWSTR pwChar, IndicSyllable *s, lexical_
> }
> }
>
> -static void Reorder_Matra_precede_syllable(LPWSTR pwChar, IndicSyllable *s, lexical_function lexical)
> +static void Reorder_Matra_precede_syllable(WCHAR *pwChar, IndicSyllable *s, lexical_function lexical)
> {
> int i;
>
> @@ -1836,14 +1837,16 @@ static void Reorder_Matra_precede_syllable(LPWSTR pwChar, IndicSyllable *s, lexi
> }
> }
>
> -static void SecondReorder_Blwf_follows_matra(LPWSTR pwChar, IndicSyllable *s, WORD *glyphs, IndicSyllable *g, lexical_function lexical)
> +static void SecondReorder_Blwf_follows_matra(const WCHAR *chars, const IndicSyllable *s,
> + WORD *glyphs, const IndicSyllable *g, lexical_function lexical)
> {
> if (s->blwf >= 0 && g->blwf > g->base)
> {
> int j,loc;
> int g_offset;
> for (loc = s->end; loc > s->blwf; loc--)
> - if (lexical(pwChar[loc]) == lex_Matra_below || lexical(pwChar[loc]) == lex_Matra_above || lexical(pwChar[loc]) == lex_Matra_post)
> + if (lexical(chars[loc]) == lex_Matra_below || lexical(chars[loc]) == lex_Matra_above
> + || lexical(chars[loc]) == lex_Matra_post)
> break;
>
> g_offset = (loc - s->blwf) - 1;
> @@ -1860,14 +1863,15 @@ static void SecondReorder_Blwf_follows_matra(LPWSTR pwChar, IndicSyllable *s, WO
> }
> }
>
> -static void SecondReorder_Matra_precede_base(LPWSTR pwChar, IndicSyllable *s, WORD *glyphs, IndicSyllable *g, lexical_function lexical)
> +static void SecondReorder_Matra_precede_base(const WCHAR *chars, const IndicSyllable *s,
> + WORD *glyphs, const IndicSyllable *g, lexical_function lexical)
> {
> int i;
>
> /* reorder previously moved Matras to correct position*/
> for (i = s->start; i < s->base; i++)
> {
> - if (lexical(pwChar[i]) == lex_Matra_pre)
> + if (lexical(chars[i]) == lex_Matra_pre)
> {
> int j;
> int g_start = g->start + i - s->start;
> @@ -1883,7 +1887,8 @@ static void SecondReorder_Matra_precede_base(LPWSTR pwChar, IndicSyllable *s, WO
> }
> }
>
> -static void SecondReorder_Pref_precede_base(LPWSTR pwChar, IndicSyllable *s, WORD *glyphs, IndicSyllable *g, lexical_function lexical)
> +static void SecondReorder_Pref_precede_base(const IndicSyllable *s,
> + WORD *glyphs, const IndicSyllable *g, lexical_function lexical)
> {
> if (s->pref >= 0 && g->pref > g->base)
> {
> @@ -1896,7 +1901,7 @@ static void SecondReorder_Pref_precede_base(LPWSTR pwChar, IndicSyllable *s, WOR
> }
> }
>
> -static void Reorder_Like_Sinhala(LPWSTR pwChar, IndicSyllable *s, lexical_function lexical)
> +static void Reorder_Like_Sinhala(WCHAR *pwChar, IndicSyllable *s, lexical_function lexical)
> {
> TRACE("Syllable (%i..%i..%i)\n",s->start,s->base,s->end);
> if (s->start == s->base && s->base == s->end) return;
> @@ -1906,7 +1911,7 @@ static void Reorder_Like_Sinhala(LPWSTR pwChar, IndicSyllable *s, lexical_functi
> Reorder_Matra_precede_base(pwChar, s, lexical);
> }
>
> -static void Reorder_Like_Devanagari(LPWSTR pwChar, IndicSyllable *s, lexical_function lexical)
> +static void Reorder_Like_Devanagari(WCHAR *pwChar, IndicSyllable *s, lexical_function lexical)
> {
> TRACE("Syllable (%i..%i..%i)\n",s->start,s->base,s->end);
> if (s->start == s->base && s->base == s->end) return;
> @@ -1916,7 +1921,7 @@ static void Reorder_Like_Devanagari(LPWSTR pwChar, IndicSyllable *s, lexical_fun
> Reorder_Matra_precede_syllable(pwChar, s, lexical);
> }
>
> -static void Reorder_Like_Bengali(LPWSTR pwChar, IndicSyllable *s, lexical_function lexical)
> +static void Reorder_Like_Bengali(WCHAR *pwChar, IndicSyllable *s, lexical_function lexical)
> {
> TRACE("Syllable (%i..%i..%i)\n",s->start,s->base,s->end);
> if (s->start == s->base && s->base == s->end) return;
> @@ -1926,7 +1931,7 @@ static void Reorder_Like_Bengali(LPWSTR pwChar, IndicSyllable *s, lexical_functi
> Reorder_Matra_precede_syllable(pwChar, s, lexical);
> }
>
> -static void Reorder_Like_Kannada(LPWSTR pwChar, IndicSyllable *s, lexical_function lexical)
> +static void Reorder_Like_Kannada(WCHAR *pwChar, IndicSyllable *s, lexical_function lexical)
> {
> TRACE("Syllable (%i..%i..%i)\n",s->start,s->base,s->end);
> if (s->start == s->base && s->base == s->end) return;
> @@ -1936,25 +1941,27 @@ static void Reorder_Like_Kannada(LPWSTR pwChar, IndicSyllable *s, lexical_functi
> Reorder_Matra_precede_syllable(pwChar, s, lexical);
> }
>
> -static void SecondReorder_Like_Telugu(LPWSTR pwChar, IndicSyllable *s, WORD* pwGlyphs, IndicSyllable *g, lexical_function lexical)
> +static void SecondReorder_Like_Telugu(const WCHAR *chars, const IndicSyllable *s,
> + WORD *glyphs, const IndicSyllable *g, lexical_function lexical)
> {
> TRACE("Syllable (%i..%i..%i)\n",s->start,s->base,s->end);
> TRACE("Glyphs (%i..%i..%i)\n",g->start,g->base,g->end);
> if (s->start == s->base && s->base == s->end) return;
> - if (lexical(pwChar[s->base]) == lex_Vowel) return;
> + if (lexical(chars[s->base]) == lex_Vowel) return;
>
> - SecondReorder_Blwf_follows_matra(pwChar, s, pwGlyphs, g, lexical);
> + SecondReorder_Blwf_follows_matra(chars, s, glyphs, g, lexical);
> }
>
> -static void SecondReorder_Like_Tamil(LPWSTR pwChar, IndicSyllable *s, WORD* pwGlyphs, IndicSyllable *g, lexical_function lexical)
> +static void SecondReorder_Like_Tamil(const WCHAR *chars, const IndicSyllable *s,
> + WORD *glyphs, const IndicSyllable *g, lexical_function lexical)
> {
> TRACE("Syllable (%i..%i..%i)\n",s->start,s->base,s->end);
> TRACE("Glyphs (%i..%i..%i)\n",g->start,g->base,g->end);
> if (s->start == s->base && s->base == s->end) return;
> - if (lexical(pwChar[s->base]) == lex_Vowel) return;
> + if (lexical(chars[s->base]) == lex_Vowel) return;
>
> - SecondReorder_Matra_precede_base(pwChar, s, pwGlyphs, g, lexical);
> - SecondReorder_Pref_precede_base(pwChar, s, pwGlyphs, g, lexical);
> + SecondReorder_Matra_precede_base(chars, s, glyphs, g, lexical);
> + SecondReorder_Pref_precede_base(s, glyphs, g, lexical);
> }
>
>
> diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
> index 931def9..d7b7d9a 100644
> --- a/dlls/usp10/usp10.c
> +++ b/dlls/usp10/usp10.c
> @@ -1138,7 +1138,8 @@ HRESULT WINAPI ScriptRecordDigitSubstitution(LCID locale, SCRIPT_DIGITSUBSTITUTE
> sds->NationalDigitLanguage = LANG_ENGLISH;
>
> if (!GetLocaleInfoW(locale, LOCALE_IDIGITSUBSTITUTION | LOCALE_RETURN_NUMBER,
> - (LPWSTR)&sub, sizeof(sub)/sizeof(WCHAR))) return E_INVALIDARG;
> + (WCHAR *)&sub, sizeof(sub) / sizeof(WCHAR)))
> + return E_INVALIDARG;
>
> switch (sub)
> {
> @@ -1963,7 +1964,9 @@ HRESULT WINAPI ScriptStringAnalyse(HDC hdc, const void *pString, int cString,
> if ((analysis->logattrs = heap_alloc(sizeof(SCRIPT_LOGATTR) * cString)))
> {
> for (i = 0; i < analysis->numItems; i++)
> - ScriptBreak(&((LPWSTR)pString)[analysis->pItem[i].iCharPos], analysis->pItem[i+1].iCharPos - analysis->pItem[i].iCharPos, &analysis->pItem[i].a, &analysis->logattrs[analysis->pItem[i].iCharPos]);
> + ScriptBreak(&((WCHAR *)pString)[analysis->pItem[i].iCharPos],
> + analysis->pItem[i + 1].iCharPos - analysis->pItem[i].iCharPos,
> + &analysis->pItem[i].a, &analysis->logattrs[analysis->pItem[i].iCharPos]);
> }
> else
> goto error;
> diff --git a/dlls/usp10/usp10_internal.h b/dlls/usp10/usp10_internal.h
> index 4841385..3ad6d10 100644
> --- a/dlls/usp10/usp10_internal.h
> +++ b/dlls/usp10/usp10_internal.h
> @@ -238,7 +238,7 @@ static inline unsigned short get_table_entry( const unsigned short *table, WCHAR
> }
>
> typedef int (*lexical_function)(WCHAR c);
> -typedef void (*reorder_function)(LPWSTR pwChar, IndicSyllable *syllable, lexical_function lex);
> +typedef void (*reorder_function)(WCHAR *chars, IndicSyllable *syllable, lexical_function lex);
>
> #define odd(x) ((x) & 1)
> #define BIDI_STRONG 1
> @@ -263,7 +263,9 @@ HRESULT SHAPE_GetFontScriptTags( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa
> HRESULT SHAPE_GetFontLanguageTags( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, int cMaxTags, OPENTYPE_TAG *pLangSysTags, int *pcTags) DECLSPEC_HIDDEN;
> 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_ReorderCharacters(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc, WCHAR *input, unsigned 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, const WCHAR *input, unsigned int cChar,
> IndicSyllable **syllables, int *syllable_count, lexical_function lex, BOOL modern) DECLSPEC_HIDDEN;
>
>
More information about the wine-patches
mailing list