usp10: Correct error with ScriptLayout log2vis.

Issue found and test written by Huw Davies.
This commit is contained in:
Aric Stewart 2013-02-14 12:10:31 -06:00 committed by Alexandre Julliard
parent 851866e22a
commit 9a59d81f72
2 changed files with 19 additions and 2 deletions

View file

@ -872,11 +872,13 @@ int BIDI_ReorderL2vLevel(int level, int *pIndexs, const BYTE* plevel, int cch, B
reverse(pIndexs, ich);
}
if (newlevel > 1)
if (newlevel >= 0)
{
ich = 0;
for (; ich < cch; ich++)
if (plevel[ich] > level)
if (plevel[ich] < level)
break;
else if (plevel[ich] > level)
ich += BIDI_ReorderL2vLevel(level + 1, pIndexs + ich, plevel + ich,
cch - ich, fReverse) - 1;
}

View file

@ -2786,6 +2786,11 @@ static void test_ScriptLayout(void)
{ 0, 0, 1, 1, 2, 2, 1, 1, 0, 1 },
{ 1, 0, 1, 2, 2, 1, 2, 1, 0, 1 },
{ 1, 2, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 2, 2, 2, 0, 0, 0, 0, 0, 0, 0 },
{ 2, 2, 2, 4, 4, 4, 1, 1, 0, 0 },
{ 1, 2, 3, 0, 3, 2, 1, 0, 0, 0 }
};
static const int expect_l2v[][10] =
{
@ -2802,6 +2807,11 @@ static void test_ScriptLayout(void)
{ 0, 1, 7, 6, 4, 5, 3 ,2 ,8, 9},
/**/ { 0, 1, 7, 5, 6, 4, 3 ,2 ,8, 9},
{ 1, 0, 2, 3, 4, 5, 6, 7, 8, 9},
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
{ 2, 3, 4, 5, 6, 7, 1, 0, 8, 9},
{ 2, 0, 1, 3, 5, 6, 4, 7, 8, 9}
};
static const int expect_v2l[][10] =
{
@ -2818,6 +2828,11 @@ static void test_ScriptLayout(void)
{ 0, 1, 7, 6, 4, 5, 3 ,2 ,8, 9},
{ 0, 1, 7, 6, 5, 3, 4 ,2 ,8, 9},
{ 1, 0, 2, 3, 4, 5, 6, 7, 8, 9},
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
{ 7, 6, 0, 1, 2, 3, 4, 5, 8, 9},
{ 1, 2, 0, 3, 6, 4, 5, 7, 8, 9}
};
int i, j, vistolog[sizeof(levels[0])], logtovis[sizeof(levels[0])];