View | Details | Raw Unified | Return to bug 237949
Collapse All | Expand All

(-)files/patch-src_raqm.c (+177 lines)
Line 0 Link Here
1
--- src/raqm.c.orig	2019-05-17 11:29:46 UTC
2
+++ src/raqm.c
3
@@ -1599,14 +1599,14 @@ _raqm_shape (raqm_t *rq)
4
 /* Convert index from UTF-32 to UTF-8 */
5
 static uint32_t
6
 _raqm_u32_to_u8_index (raqm_t   *rq,
7
-                       uint32_t  index)
8
+                       uint32_t  raqm_index)
9
 {
10
   FriBidiStrIndex length;
11
-  char *output = malloc ((sizeof (char) * 4 * index) + 1);
12
+  char *output = malloc ((sizeof (char) * 4 * raqm_index) + 1);
13
 
14
   length = fribidi_unicode_to_charset (FRIBIDI_CHAR_SET_UTF8,
15
                                        rq->text,
16
-                                       index,
17
+                                       raqm_index,
18
                                        output);
19
 
20
   free (output);
21
@@ -1616,14 +1616,14 @@ _raqm_u32_to_u8_index (raqm_t   *rq,
22
 /* Convert index from UTF-8 to UTF-32 */
23
 static uint32_t
24
 _raqm_u8_to_u32_index (raqm_t   *rq,
25
-                       uint32_t  index)
26
+                       uint32_t  raqm_index)
27
 {
28
   FriBidiStrIndex length;
29
-  uint32_t *output = malloc (sizeof (uint32_t) * (index + 1));
30
+  uint32_t *output = malloc (sizeof (uint32_t) * (raqm_index + 1));
31
 
32
   length = fribidi_charset_to_unicode (FRIBIDI_CHAR_SET_UTF8,
33
                                        rq->text_utf8,
34
-                                       index,
35
+                                       raqm_index,
36
                                        output);
37
 
38
   free (output);
39
@@ -1655,7 +1655,7 @@ _raqm_in_hangul_syllable (hb_codepoint_t ch);
40
  */
41
 bool
42
 raqm_index_to_position (raqm_t *rq,
43
-                        size_t *index,
44
+                        size_t *raqm_index,
45
                         int *x,
46
                         int *y)
47
 {
48
@@ -1667,19 +1667,19 @@ raqm_index_to_position (raqm_t *rq,
49
     return false;
50
 
51
   if (rq->flags & RAQM_FLAG_UTF8)
52
-    *index = _raqm_u8_to_u32_index (rq, *index);
53
+    *raqm_index = _raqm_u8_to_u32_index (rq, *raqm_index);
54
 
55
-  if (*index >= rq->text_len)
56
+  if (*raqm_index >= rq->text_len)
57
     return false;
58
 
59
   RAQM_TEST ("\n");
60
 
61
-  while (*index < rq->text_len)
62
+  while (*raqm_index < rq->text_len)
63
   {
64
-    if (_raqm_allowed_grapheme_boundary (rq->text[*index], rq->text[*index + 1]))
65
+    if (_raqm_allowed_grapheme_boundary (rq->text[*raqm_index], rq->text[*raqm_index + 1]))
66
       break;
67
 
68
-    ++*index;
69
+    ++*raqm_index;
70
   }
71
 
72
   for (raqm_run_t *run = rq->runs; run != NULL; run = run->next)
73
@@ -1712,11 +1712,11 @@ raqm_index_to_position (raqm_t *rq,
74
       if (next_cluster == curr_cluster)
75
         next_cluster = run->pos + run->len;
76
 
77
-      if (*index < next_cluster && *index >= curr_cluster)
78
+      if (*raqm_index < next_cluster && *raqm_index >= curr_cluster)
79
       {
80
         if (run->direction == HB_DIRECTION_RTL)
81
           *x -= position[i].x_advance;
82
-        *index = curr_cluster;
83
+        *raqm_index = curr_cluster;
84
         goto found;
85
       }
86
     }
87
@@ -1724,8 +1724,8 @@ raqm_index_to_position (raqm_t *rq,
88
 
89
 found:
90
   if (rq->flags & RAQM_FLAG_UTF8)
91
-    *index = _raqm_u32_to_u8_index (rq, *index);
92
-  RAQM_TEST ("The position is %d at index %zu\n",*x ,*index);
93
+    *raqm_index = _raqm_u32_to_u8_index (rq, *raqm_index);
94
+  RAQM_TEST ("The position is %d at index %zu\n",*x ,*raqm_index);
95
   return true;
96
 }
97
 
98
@@ -1749,7 +1749,7 @@ bool
99
 raqm_position_to_index (raqm_t *rq,
100
                         int x,
101
                         int y,
102
-                        size_t *index)
103
+                        size_t *raqm_index)
104
 {
105
   int delta_x = 0, current_x = 0;
106
   (void)y;
107
@@ -1760,9 +1760,9 @@ raqm_position_to_index (raqm_t *rq,
108
   if (x < 0) /* Get leftmost index */
109
   {
110
     if (rq->resolved_dir == RAQM_DIRECTION_RTL)
111
-      *index = rq->text_len;
112
+      *raqm_index = rq->text_len;
113
     else
114
-      *index = 0;
115
+      *raqm_index = 0;
116
     return true;
117
   }
118
 
119
@@ -1789,7 +1789,7 @@ raqm_position_to_index (raqm_t *rq,
120
           before = (x > current_x + (delta_x / 2));
121
 
122
         if (before)
123
-          *index = info[i].cluster;
124
+          *raqm_index = info[i].cluster;
125
         else
126
         {
127
           uint32_t curr_cluster = info[i].cluster;
128
@@ -1805,25 +1805,25 @@ raqm_position_to_index (raqm_t *rq,
129
           if (next_cluster == curr_cluster)
130
             next_cluster = run->pos + run->len;
131
 
132
-          *index = next_cluster;
133
+          *raqm_index = next_cluster;
134
         }
135
-        if (_raqm_allowed_grapheme_boundary (rq->text[*index],rq->text[*index + 1]))
136
+        if (_raqm_allowed_grapheme_boundary (rq->text[*raqm_index],rq->text[*raqm_index + 1]))
137
         {
138
-          RAQM_TEST ("The start-index is %zu  at position %d \n", *index, x);
139
+          RAQM_TEST ("The start-index is %zu  at position %d \n", *raqm_index, x);
140
             return true;
141
         }
142
 
143
-        while (*index < (unsigned)run->pos + run->len)
144
+        while (*raqm_index < (unsigned)run->pos + run->len)
145
         {
146
-          if (_raqm_allowed_grapheme_boundary (rq->text[*index],
147
-                                               rq->text[*index + 1]))
148
+          if (_raqm_allowed_grapheme_boundary (rq->text[*raqm_index],
149
+                                               rq->text[*raqm_index + 1]))
150
           {
151
-            *index += 1;
152
+            *raqm_index += 1;
153
             break;
154
           }
155
-          *index += 1;
156
+          *raqm_index += 1;
157
         }
158
-        RAQM_TEST ("The start-index is %zu  at position %d \n", *index, x);
159
+        RAQM_TEST ("The start-index is %zu  at position %d \n", *raqm_index, x);
160
         return true;
161
       }
162
       else
163
@@ -1833,11 +1833,11 @@ raqm_position_to_index (raqm_t *rq,
164
 
165
   /* Get rightmost index*/
166
   if (rq->resolved_dir == RAQM_DIRECTION_RTL)
167
-    *index = 0;
168
+    *raqm_index = 0;
169
   else
170
-    *index = rq->text_len;
171
+    *raqm_index = rq->text_len;
172
 
173
-  RAQM_TEST ("The start-index is %zu  at position %d \n", *index, x);
174
+  RAQM_TEST ("The start-index is %zu  at position %d \n", *raqm_index, x);
175
 
176
   return true;
177
 }

Return to bug 237949