[USP10]
[reactos.git] / reactos / dll / win32 / usp10 / bidi.c
index a2edfa6..6afcf70 100644 (file)
  * has been modified.
  */
 
-#include "config.h"
-
-#include <stdarg.h>
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winnls.h"
-#include "usp10.h"
-#include "wine/unicode.h"
-#include "wine/debug.h"
-
 #include "usp10_internal.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(bidi);
@@ -749,7 +738,8 @@ BOOL BIDI_DetermineLevels(
     )
 {
     WORD *chartype;
-    unsigned baselevel = 0,j;
+    unsigned baselevel = 0;
+    INT j;
     TRACE("%s, %d\n", debugstr_wn(lpString, uCount), uCount);
 
     chartype = HeapAlloc(GetProcessHeap(), 0, uCount * sizeof(WORD));
@@ -872,11 +862,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;
     }