[USP10] Sync with Wine Staging 3.3. CORE-14434
[reactos.git] / dll / win32 / usp10 / breaking.c
index e60b390..9b12d9e 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  *
  */
+#include "config.h"
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
 
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "wingdi.h"
+#include "winnls.h"
+#include "usp10.h"
+#include "winternl.h"
+
+#include "wine/debug.h"
+#include "wine/heap.h"
 #include "usp10_internal.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(uniscribe);
 
-extern const unsigned short wine_linebreak_table[];
+extern const unsigned short wine_linebreak_table[] DECLSPEC_HIDDEN;
 
-enum breaking_types { b_BK=1, b_CR, b_LF, b_CM, b_SG, b_GL, b_CB, b_SP, b_ZW, b_NL, b_WJ, b_JL, b_JV, b_JT, b_H2, b_H3, b_XX, b_OP, b_CL, b_CP, b_QU, b_NS, b_EX, b_SY, b_IS, b_PR, b_PO, b_NU, b_AL, b_ID, b_IN, b_HY, b_BB, b_BA, b_SA, b_AI, b_B2, b_HL, b_CJ, b_RI};
+enum breaking_types {
+    b_BK=1, b_CR, b_LF, b_CM, b_SG, b_GL, b_CB, b_SP, b_ZW, b_NL, b_WJ, b_JL, b_JV, b_JT, b_H2, b_H3, b_XX, b_OP, b_CL,
+    b_CP, b_QU, b_NS, b_EX, b_SY, b_IS, b_PR, b_PO, b_NU, b_AL, b_ID, b_IN, b_HY, b_BB, b_BA, b_SA, b_AI, b_B2, b_HL,
+    b_CJ, b_RI, b_EB, b_EM, b_ZWJ
+};
 
 enum breaking_class {b_r=1, b_s, b_x};
 
@@ -64,8 +82,8 @@ void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT
 
     TRACE("In      %s\n",debugstr_wn(chars,count));
 
-    break_class = HeapAlloc(GetProcessHeap(),0, count * sizeof(short));
-    break_before = HeapAlloc(GetProcessHeap(),0, count * sizeof(short));
+    break_class = heap_alloc(count * sizeof(*break_class));
+    break_before = heap_alloc(count * sizeof(*break_before));
 
     for (i = 0; i < count; i++)
     {
@@ -265,6 +283,7 @@ void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT
                 else_break(&break_before[i],b_s);
                 if (i < count-1)
                     else_break(&break_before[i+1],b_s);
+                break;
             /* LB21 */
             case b_BA:
             case b_HY:
@@ -366,7 +385,7 @@ void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT
                     if (break_class[i+1] == b_IN || break_class[i+1] == b_PO)
                         else_break(&break_before[i+1],b_x);
             }
-            if (break_class[i] == b_PO)
+            if (break_class[i] == b_PR)
             {
                 switch (break_class[i+1])
                 {
@@ -396,7 +415,7 @@ void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT
                  break_class[i+1] == b_OP)
                 else_break(&break_before[i+1],b_x);
             if (break_class[i] == b_CP &&
-                (break_class[i+1] == b_AL || break_class[i] == b_HL || break_class[i] == b_NU))
+                (break_class[i+1] == b_AL || break_class[i+1] == b_HL || break_class[i+1] == b_NU))
                 else_break(&break_before[i+1],b_x);
 
             /* LB30a */
@@ -420,6 +439,6 @@ void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT
         }
     }
 
-    HeapFree(GetProcessHeap(), 0, break_before);
-    HeapFree(GetProcessHeap(), 0, break_class);
+    heap_free(break_before);
+    heap_free(break_class);
 }