[PATCH 5/5] usp10: Return early if the number of positioning operations is 0 in GPOS_apply_ChainContextPos().

Aric Stewart aric at codeweavers.com
Wed Apr 5 06:54:49 CDT 2017


Signed-off-by: Aric Stewart <aric at codeweavers.com>

On 4/5/17 3:21 AM, Henri Verbeet wrote:
> This preserves the current logic, but I wonder if we're not supposed to always
> return "input_count". Returning 1 seems questionable if we matched more input
> glyphs than that, and so does including the lookahead count.
> 
> Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
> ---
>  dlls/usp10/opentype.c | 23 +++++++++++------------
>  1 file changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/dlls/usp10/opentype.c b/dlls/usp10/opentype.c
> index 9c1d596..0d98253 100644
> --- a/dlls/usp10/opentype.c
> +++ b/dlls/usp10/opentype.c
> @@ -2226,7 +2226,7 @@ static unsigned int GPOS_apply_ChainContextPos(const ScriptCache *script_cache,
>          }
>          else if (GET_BE_WORD(backtrack->PosFormat) == 3)
>          {
> -            WORD backtrack_count, input_count, lookahead_count;
> +            WORD backtrack_count, input_count, lookahead_count, positioning_count;
>              int k;
>              const GPOS_ChainContextPosFormat3_2 *input;
>              const GPOS_ChainContextPosFormat3_3 *lookahead;
> @@ -2286,20 +2286,19 @@ static unsigned int GPOS_apply_ChainContextPos(const ScriptCache *script_cache,
>                  continue;
>              TRACE("Matched LookAhead\n");
>  
> -            if (GET_BE_WORD(positioning->PosCount))
> +            if (!(positioning_count = GET_BE_WORD(positioning->PosCount)))
> +                return 1;
> +
> +            for (k = 0; k < positioning_count; ++k)
>              {
> -                for (k = 0; k < GET_BE_WORD(positioning->PosCount); ++k)
> -                {
> -                    int lookupIndex = GET_BE_WORD(positioning->PosLookupRecord[k].LookupListIndex);
> -                    int SequenceIndex = GET_BE_WORD(positioning->PosLookupRecord[k].SequenceIndex) * write_dir;
> +                WORD lookup_index = GET_BE_WORD(positioning->PosLookupRecord[k].LookupListIndex);
> +                WORD sequence_index = GET_BE_WORD(positioning->PosLookupRecord[k].SequenceIndex) * write_dir;
>  
> -                    TRACE("Position: %i -> %i %i\n",k, SequenceIndex, lookupIndex);
> -                    GPOS_apply_lookup(script_cache, otm, logfont, analysis, advance, lookup, lookupIndex,
> -                            glyphs, glyph_index + SequenceIndex, glyph_count, goffset);
> -                }
> -                return input_count + lookahead_count;
> +                TRACE("Position: %u -> %u %u.\n", k, sequence_index, lookup_index);
> +                GPOS_apply_lookup(script_cache, otm, logfont, analysis, advance, lookup, lookup_index,
> +                        glyphs, glyph_index + sequence_index, glyph_count, goffset);
>              }
> -            else return 1;
> +            return input_count + lookahead_count;
>          }
>          else
>              FIXME("Unhandled Chaining Contextual Positioning Format %#x.\n", GET_BE_WORD(backtrack->PosFormat));
> 



More information about the wine-patches mailing list