Coverage Report

Created: 2025-07-07 10:01

/work/workdir/UnpackedTarball/harfbuzz/src/hb-buffer-deserialize-text-unicode.hh
Line
Count
Source (jump to first uncovered line)
1
2
#line 1 "hb-buffer-deserialize-text-unicode.rl"
3
/*
4
 * Copyright © 2013  Google, Inc.
5
 *
6
 *  This is part of HarfBuzz, a text shaping library.
7
 *
8
 * Permission is hereby granted, without written agreement and without
9
 * license or royalty fees, to use, copy, modify, and distribute this
10
 * software and its documentation for any purpose, provided that the
11
 * above copyright notice and the following two paragraphs appear in
12
 * all copies of this software.
13
 *
14
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
15
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
17
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18
 * DAMAGE.
19
 *
20
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
21
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
22
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
23
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
24
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25
 *
26
 * Google Author(s): Behdad Esfahbod
27
 */
28
29
#ifndef HB_BUFFER_DESERIALIZE_TEXT_UNICODE_HH
30
#define HB_BUFFER_DESERIALIZE_TEXT_UNICODE_HH
31
32
#include "hb.hh"
33
34
35
#line 36 "hb-buffer-deserialize-text-unicode.hh"
36
static const unsigned char _deserialize_text_unicode_trans_keys[] = {
37
  0u, 0u, 43u, 102u, 48u, 102u, 48u, 124u, 48u, 57u, 62u, 124u, 48u, 124u, 60u, 117u, 
38
  85u, 117u, 85u, 117u, 0
39
};
40
41
static const char _deserialize_text_unicode_key_spans[] = {
42
  0, 60, 55, 77, 10, 63, 77, 58, 
43
  33, 33
44
};
45
46
static const short _deserialize_text_unicode_index_offsets[] = {
47
  0, 0, 61, 117, 195, 206, 270, 348, 
48
  407, 441
49
};
50
51
static const char _deserialize_text_unicode_indicies[] = {
52
  0, 1, 1, 1, 1, 2, 2, 
53
  2, 2, 2, 2, 2, 2, 2, 2, 
54
  1, 1, 1, 1, 1, 1, 1, 2, 
55
  2, 2, 2, 2, 2, 1, 1, 1, 
56
  1, 1, 1, 1, 1, 1, 1, 1, 
57
  1, 1, 1, 1, 1, 1, 1, 1, 
58
  1, 1, 1, 1, 1, 1, 1, 2, 
59
  2, 2, 2, 2, 2, 1, 2, 2, 
60
  2, 2, 2, 2, 2, 2, 2, 2, 
61
  1, 1, 1, 1, 1, 1, 1, 2, 
62
  2, 2, 2, 2, 2, 1, 1, 1, 
63
  1, 1, 1, 1, 1, 1, 1, 1, 
64
  1, 1, 1, 1, 1, 1, 1, 1, 
65
  1, 1, 1, 1, 1, 1, 1, 2, 
66
  2, 2, 2, 2, 2, 1, 3, 3, 
67
  3, 3, 3, 3, 3, 3, 3, 3, 
68
  1, 1, 1, 4, 5, 1, 1, 3, 
69
  3, 3, 3, 3, 3, 1, 1, 1, 
70
  1, 1, 1, 1, 1, 1, 1, 1, 
71
  1, 1, 1, 1, 1, 1, 1, 1, 
72
  1, 1, 1, 1, 1, 1, 1, 3, 
73
  3, 3, 3, 3, 3, 1, 1, 1, 
74
  1, 1, 1, 1, 1, 1, 1, 1, 
75
  1, 1, 1, 1, 1, 1, 1, 1, 
76
  1, 1, 5, 1, 6, 7, 7, 7, 
77
  7, 7, 7, 7, 7, 7, 1, 8, 
78
  1, 1, 1, 1, 1, 1, 1, 1, 
79
  1, 1, 1, 1, 1, 1, 1, 1, 
80
  1, 1, 1, 1, 1, 1, 1, 1, 
81
  1, 1, 1, 1, 1, 1, 1, 1, 
82
  1, 1, 1, 1, 1, 1, 1, 1, 
83
  1, 1, 1, 1, 1, 1, 1, 1, 
84
  1, 1, 1, 1, 1, 1, 1, 1, 
85
  1, 1, 1, 1, 1, 8, 1, 9, 
86
  9, 9, 9, 9, 9, 9, 9, 9, 
87
  9, 1, 1, 1, 1, 8, 1, 1, 
88
  1, 1, 1, 1, 1, 1, 1, 1, 
89
  1, 1, 1, 1, 1, 1, 1, 1, 
90
  1, 1, 1, 1, 1, 1, 1, 1, 
91
  1, 1, 1, 1, 1, 1, 1, 1, 
92
  1, 1, 1, 1, 1, 1, 1, 1, 
93
  1, 1, 1, 1, 1, 1, 1, 1, 
94
  1, 1, 1, 1, 1, 1, 1, 1, 
95
  1, 1, 1, 8, 1, 10, 1, 1, 
96
  1, 1, 1, 1, 1, 1, 1, 1, 
97
  1, 1, 1, 1, 1, 1, 1, 1, 
98
  1, 1, 1, 1, 1, 1, 11, 1, 
99
  1, 1, 1, 1, 1, 1, 1, 1, 
100
  1, 1, 1, 1, 1, 1, 1, 1, 
101
  1, 1, 1, 1, 1, 1, 1, 1, 
102
  1, 1, 1, 1, 1, 1, 11, 1, 
103
  11, 1, 1, 1, 1, 1, 1, 1, 
104
  1, 1, 1, 1, 1, 1, 1, 1, 
105
  1, 1, 1, 1, 1, 1, 1, 1, 
106
  1, 1, 1, 1, 1, 1, 1, 1, 
107
  11, 1, 12, 1, 1, 1, 1, 1, 
108
  1, 1, 1, 1, 1, 1, 1, 1, 
109
  1, 1, 1, 1, 1, 1, 1, 1, 
110
  1, 1, 1, 1, 1, 1, 1, 1, 
111
  1, 1, 12, 1, 0
112
};
113
114
static const char _deserialize_text_unicode_trans_targs[] = {
115
  2, 0, 3, 3, 4, 9, 5, 6, 
116
  9, 6, 8, 1, 1
117
};
118
119
static const char _deserialize_text_unicode_trans_actions[] = {
120
  0, 0, 1, 0, 2, 2, 1, 1, 
121
  3, 0, 0, 4, 6
122
};
123
124
static const char _deserialize_text_unicode_eof_actions[] = {
125
  0, 0, 0, 0, 0, 0, 0, 0, 
126
  0, 5
127
};
128
129
static const int deserialize_text_unicode_start = 7;
130
static const int deserialize_text_unicode_first_final = 7;
131
static const int deserialize_text_unicode_error = 0;
132
133
static const int deserialize_text_unicode_en_main = 7;
134
135
136
#line 80 "hb-buffer-deserialize-text-unicode.rl"
137
138
139
static hb_bool_t
140
_hb_buffer_deserialize_text_unicode (hb_buffer_t *buffer,
141
             const char *buf,
142
             unsigned int buf_len,
143
             const char **end_ptr,
144
             hb_font_t *font)
145
0
{
146
0
  const char *p = buf, *pe = buf + buf_len, *eof = pe;
147
148
0
  const char *tok = nullptr;
149
0
  int cs;
150
0
  hb_glyph_info_t info = {0};
151
0
  const hb_glyph_position_t pos = {0};
152
  
153
0
#line 154 "hb-buffer-deserialize-text-unicode.hh"
154
0
  {
155
0
  cs = deserialize_text_unicode_start;
156
0
  }
157
158
0
#line 159 "hb-buffer-deserialize-text-unicode.hh"
159
0
  {
160
0
  int _slen;
161
0
  int _trans;
162
0
  const unsigned char *_keys;
163
0
  const char *_inds;
164
0
  if ( p == pe )
165
0
    goto _test_eof;
166
0
  if ( cs == 0 )
167
0
    goto _out;
168
0
_resume:
169
0
  _keys = _deserialize_text_unicode_trans_keys + (cs<<1);
170
0
  _inds = _deserialize_text_unicode_indicies + _deserialize_text_unicode_index_offsets[cs];
171
172
0
  _slen = _deserialize_text_unicode_key_spans[cs];
173
0
  _trans = _inds[ _slen > 0 && _keys[0] <=(*p) &&
174
0
    (*p) <= _keys[1] ?
175
0
    (*p) - _keys[0] : _slen ];
176
177
0
  cs = _deserialize_text_unicode_trans_targs[_trans];
178
179
0
  if ( _deserialize_text_unicode_trans_actions[_trans] == 0 )
180
0
    goto _again;
181
182
0
  switch ( _deserialize_text_unicode_trans_actions[_trans] ) {
183
0
  case 4:
184
0
#line 38 "hb-buffer-deserialize-text-unicode.rl"
185
0
  {
186
0
  hb_memset (&info, 0, sizeof (info));
187
0
}
188
0
  break;
189
0
  case 1:
190
0
#line 51 "hb-buffer-deserialize-text-unicode.rl"
191
0
  {
192
0
  tok = p;
193
0
}
194
0
  break;
195
0
  case 2:
196
0
#line 55 "hb-buffer-deserialize-text-unicode.rl"
197
0
  {if (!parse_hex (tok, p, &info.codepoint )) return false; }
198
0
  break;
199
0
  case 3:
200
0
#line 57 "hb-buffer-deserialize-text-unicode.rl"
201
0
  { if (!parse_uint (tok, p, &info.cluster )) return false; }
202
0
  break;
203
0
  case 6:
204
0
#line 42 "hb-buffer-deserialize-text-unicode.rl"
205
0
  {
206
0
  buffer->add_info (info);
207
0
  if (unlikely (!buffer->successful))
208
0
    return false;
209
0
  if (buffer->have_positions)
210
0
    buffer->pos[buffer->len - 1] = pos;
211
0
  *end_ptr = p;
212
0
}
213
0
#line 38 "hb-buffer-deserialize-text-unicode.rl"
214
0
  {
215
0
  hb_memset (&info, 0, sizeof (info));
216
0
}
217
0
  break;
218
0
#line 219 "hb-buffer-deserialize-text-unicode.hh"
219
0
  }
220
221
0
_again:
222
0
  if ( cs == 0 )
223
0
    goto _out;
224
0
  if ( ++p != pe )
225
0
    goto _resume;
226
0
  _test_eof: {}
227
0
  if ( p == eof )
228
0
  {
229
0
  switch ( _deserialize_text_unicode_eof_actions[cs] ) {
230
0
  case 5:
231
0
#line 42 "hb-buffer-deserialize-text-unicode.rl"
232
0
  {
233
0
  buffer->add_info (info);
234
0
  if (unlikely (!buffer->successful))
235
0
    return false;
236
0
  if (buffer->have_positions)
237
0
    buffer->pos[buffer->len - 1] = pos;
238
0
  *end_ptr = p;
239
0
}
240
0
  break;
241
0
#line 242 "hb-buffer-deserialize-text-unicode.hh"
242
0
  }
243
0
  }
244
245
0
  _out: {}
246
0
  }
247
248
0
#line 98 "hb-buffer-deserialize-text-unicode.rl"
249
250
251
0
  *end_ptr = p;
252
253
0
  return p == pe;
254
0
}
255
256
#endif /* HB_BUFFER_DESERIALIZE_TEXT_UNICODE_HH */