| line |
true |
false |
branch |
|
65
|
0 |
0 |
if (byte < 0x80) return (uint32_t)byte; |
|
66
|
0 |
0 |
if (byte < 0xA0) return winansi_0x80[byte - 0x80]; |
|
85
|
60 |
0 |
if (r) { |
|
95
|
2327 |
707 |
for (i = 0; i < len; i++) { |
|
103
|
707 |
266 |
for (i = 0; i < len; i++) { |
|
111
|
0 |
60 |
if (!result) return; |
|
112
|
266 |
60 |
for (i = 0; i < result->len; i++) { |
|
124
|
0 |
60 |
if (!result) return; |
|
139
|
19529 |
129 |
for (i = 0; i < r->font_cache_len; i++) { |
|
140
|
10322 |
9207 |
if (r->font_cache[i].font_dict == font_dict) return &r->font_cache[i]; |
|
149
|
74 |
55 |
if (r->font_cache_len >= r->font_cache_cap) { |
|
150
|
14 |
60 |
size_t new_cap = r->font_cache_cap == 0 ? 4 : r->font_cache_cap * 2; |
|
153
|
0 |
74 |
if (!n) return NULL; |
|
173
|
3354 |
129 |
if (rf->to_unicode_tried) return rf->to_unicode; |
|
176
|
129 |
0 |
if (!r->reader || !rf->font_dict || !r->arena) return NULL; |
|
|
129 |
0 |
if (!r->reader || !rf->font_dict || !r->arena) return NULL; |
|
|
0 |
129 |
if (!r->reader || !rf->font_dict || !r->arena) return NULL; |
|
180
|
19 |
110 |
if (!tu || tu->kind != PDFMAKE_REF) return NULL; |
|
|
0 |
19 |
if (!tu || tu->kind != PDFMAKE_REF) return NULL; |
|
185
|
19 |
0 |
if (err != PDFMAKE_OK || buf.len == 0) { |
|
|
0 |
19 |
if (err != PDFMAKE_OK || buf.len == 0) { |
|
199
|
0 |
46 |
if (rf->widths_resolved) return; |
|
202
|
46 |
0 |
if (!rf->font_dict || !r->arena) { |
|
|
0 |
46 |
if (!rf->font_dict || !r->arena) { |
|
207
|
1 |
45 |
if (rf->is_cid) { |
|
216
|
46 |
0 |
if (r->reader) { |
|
218
|
45 |
1 |
if (!rf->is_cid && rf->encoding_resolved) { |
|
|
45 |
0 |
if (!rf->is_cid && rf->encoding_resolved) { |
|
241
|
0 |
128 |
if (rf->encoding_resolved) return; |
|
244
|
128 |
0 |
if (!rf->font_dict || !r->arena) { |
|
|
0 |
128 |
if (!rf->font_dict || !r->arena) { |
|
253
|
35 |
93 |
if (enc_obj && enc_obj->kind == PDFMAKE_REF && r->reader) { |
|
|
14 |
21 |
if (enc_obj && enc_obj->kind == PDFMAKE_REF && r->reader) { |
|
|
14 |
0 |
if (enc_obj && enc_obj->kind == PDFMAKE_REF && r->reader) { |
|
258
|
14 |
0 |
if (resolved) enc_obj = resolved; |
|
261
|
35 |
93 |
if (enc_obj) { |
|
265
|
48 |
45 |
if (rf->std14_id >= 0) { |
|
268
|
48 |
0 |
if (d && d->name) { |
|
|
48 |
0 |
if (d && d->name) { |
|
269
|
0 |
48 |
if (strcmp(d->name, "Symbol") == 0) |
|
271
|
0 |
48 |
else if (strcmp(d->name, "ZapfDingbats") == 0) |
|
291
|
10454 |
0 |
if (obj && obj->kind == PDFMAKE_REF && r->reader) { |
|
|
10452 |
2 |
if (obj && obj->kind == PDFMAKE_REF && r->reader) { |
|
|
10452 |
0 |
if (obj && obj->kind == PDFMAKE_REF && r->reader) { |
|
293
|
10452 |
0 |
if (rd->parser) return pdfmake_parser_resolve(rd->parser, obj->as.ref); |
|
326
|
1 |
0 |
if (enc && enc->kind == PDFMAKE_NAME) { |
|
|
1 |
0 |
if (enc && enc->kind == PDFMAKE_NAME) { |
|
328
|
1 |
0 |
ln = nm ? strlen(nm) : 0; |
|
329
|
1 |
0 |
if (ln >= 2 && nm[ln - 2] == '-' && |
|
|
1 |
0 |
if (ln >= 2 && nm[ln - 2] == '-' && |
|
330
|
0 |
1 |
(nm[ln - 1] == 'V' || nm[ln - 1] == 'v')) { |
|
|
0 |
0 |
(nm[ln - 1] == 'V' || nm[ln - 1] == 'v')) { |
|
333
|
0 |
0 |
} else if (enc && enc->kind == PDFMAKE_STREAM) { |
|
|
0 |
0 |
} else if (enc && enc->kind == PDFMAKE_STREAM) { |
|
335
|
0 |
0 |
if (sd) { |
|
340
|
0 |
0 |
if (wm && wm->kind == PDFMAKE_INT && wm->as.i == 1) rf->wmode = 1; |
|
|
0 |
0 |
if (wm && wm->kind == PDFMAKE_INT && wm->as.i == 1) rf->wmode = 1; |
|
|
0 |
0 |
if (wm && wm->kind == PDFMAKE_INT && wm->as.i == 1) rf->wmode = 1; |
|
343
|
0 |
1 |
if (!rf->wmode) return; |
|
347
|
1 |
0 |
if (!df || df->kind != PDFMAKE_ARRAY || pdfmake_array_len(df) == 0) return; |
|
|
1 |
0 |
if (!df || df->kind != PDFMAKE_ARRAY || pdfmake_array_len(df) == 0) return; |
|
|
0 |
1 |
if (!df || df->kind != PDFMAKE_ARRAY || pdfmake_array_len(df) == 0) return; |
|
350
|
1 |
0 |
if (!desc || desc->kind != PDFMAKE_DICT) return; |
|
|
0 |
1 |
if (!desc || desc->kind != PDFMAKE_DICT) return; |
|
354
|
1 |
0 |
if (dw2 && dw2->kind == PDFMAKE_ARRAY && pdfmake_array_len(dw2) >= 2) { |
|
|
1 |
0 |
if (dw2 && dw2->kind == PDFMAKE_ARRAY && pdfmake_array_len(dw2) >= 2) { |
|
|
1 |
0 |
if (dw2 && dw2->kind == PDFMAKE_ARRAY && pdfmake_array_len(dw2) >= 2) { |
|
356
|
1 |
0 |
if (a) rf->default_v_advance = (int16_t)pdfmake_get_number(a); |
|
371
|
10451 |
0 |
if (!font_dict || !r->arena) return NULL; |
|
|
0 |
10451 |
if (!font_dict || !r->arena) return NULL; |
|
375
|
10451 |
0 |
if (!font_dict || font_dict->kind != PDFMAKE_DICT) return NULL; |
|
|
0 |
10451 |
if (!font_dict || font_dict->kind != PDFMAKE_DICT) return NULL; |
|
378
|
10322 |
129 |
if (rf) return rf; |
|
380
|
0 |
129 |
if (!rf) return NULL; |
|
385
|
129 |
0 |
if (bf && bf->kind == PDFMAKE_NAME) { |
|
|
129 |
0 |
if (bf && bf->kind == PDFMAKE_NAME) { |
|
387
|
129 |
0 |
if (name) rf->std14_id = pdfmake_std14_lookup(name); |
|
393
|
129 |
0 |
if (sub && sub->kind == PDFMAKE_NAME) { |
|
|
129 |
0 |
if (sub && sub->kind == PDFMAKE_NAME) { |
|
395
|
129 |
0 |
if (st && strcmp(st, "Type0") == 0) rf->is_cid = 1; |
|
|
1 |
128 |
if (st && strcmp(st, "Type0") == 0) rf->is_cid = 1; |
|
401
|
1 |
128 |
if (rf->is_cid) resolve_cid_font_modes(r, font_dict, rf); |
|
404
|
128 |
1 |
if (!rf->is_cid) resolve_encoding(r, rf); |
|
407
|
46 |
83 |
if (rf->std14_id < 0) resolve_widths(r, rf); |
|
418
|
136 |
14620 |
if (r->raw_len >= r->raw_cap) { |
|
419
|
76 |
60 |
size_t new_cap = r->raw_cap == 0 ? 64 : r->raw_cap * 2; |
|
422
|
0 |
136 |
if (!new_arr) return 0; |
|
444
|
0 |
0 |
if (!gs->font || !arena) return -1; |
|
|
0 |
0 |
if (!gs->font || !arena) return -1; |
|
445
|
0 |
0 |
if (gs->font->kind != PDFMAKE_DICT) return -1; |
|
450
|
0 |
0 |
if (!basefont || basefont->kind != PDFMAKE_NAME) return -1; |
|
|
0 |
0 |
if (!basefont || basefont->kind != PDFMAKE_NAME) return -1; |
|
453
|
0 |
0 |
if (!name) return -1; |
|
476
|
103 |
14651 |
if (to_uni) { |
|
478
|
103 |
0 |
if (pdfmake_cmap_lookup(to_uni, code, uni_list, &cnt) && cnt > 0) { |
|
|
103 |
0 |
if (pdfmake_cmap_lookup(to_uni, code, uni_list, &cnt) && cnt > 0) { |
|
484
|
14651 |
0 |
if (!is_cid && rf && rf->encoding_resolved) { |
|
|
14651 |
0 |
if (!is_cid && rf && rf->encoding_resolved) { |
|
|
14651 |
0 |
if (!is_cid && rf && rf->encoding_resolved) { |
|
486
|
14651 |
0 |
uni_list[0] = cp ? cp : 0xFFFD; |
|
489
|
0 |
0 |
if (!is_cid) { |
|
511
|
14754 |
0 |
if (rf && rf->widths_resolved) { |
|
|
6349 |
8405 |
if (rf && rf->widths_resolved) { |
|
514
|
6349 |
8405 |
if (w1000 > 0) { |
|
517
|
8405 |
0 |
} else if (std14_id >= 0 && !is_cid) { |
|
|
8405 |
0 |
} else if (std14_id >= 0 && !is_cid) { |
|
519
|
8405 |
0 |
if (w > 0) { |
|
533
|
14754 |
0 |
if (rf) { |
|
534
|
14754 |
0 |
double mag = (double)(rf->default_v_advance < 0 |
|
536
|
14754 |
0 |
if (mag > 0) adv.vertical = mag / 1000.0 * font_size; |
|
594
|
3484 |
0 |
if (!gs || !bytes || len == 0) return; |
|
|
3484 |
0 |
if (!gs || !bytes || len == 0) return; |
|
|
0 |
3484 |
if (!gs || !bytes || len == 0) return; |
|
599
|
3 |
3481 |
if (!result->include_invisible && |
|
600
|
1 |
2 |
gs->render_mode == PDFMAKE_RENDER_INVISIBLE) { |
|
612
|
3483 |
0 |
std14_id = rf ? rf->std14_id : -1; |
|
613
|
3483 |
0 |
is_cid = rf ? rf->is_cid : 0; |
|
614
|
3483 |
0 |
is_vertical = rf ? rf->wmode : 0; /* Phase 14 */ |
|
615
|
3483 |
0 |
to_uni = rf ? resolve_to_unicode(result, rf) : NULL; |
|
621
|
935 |
2548 |
if (std14_id >= 0) { |
|
623
|
935 |
0 |
if (data) { |
|
627
|
2548 |
0 |
} else if (rf && rf->widths_resolved) { |
|
|
2548 |
0 |
} else if (rf && rf->widths_resolved) { |
|
628
|
0 |
2548 |
if (rf->widths.ascent) ascent_ratio = rf->widths.ascent / 1000.0; |
|
629
|
0 |
2548 |
if (rf->widths.descent) descent_ratio = rf->widths.descent / 1000.0; |
|
637
|
0 |
3483 |
if (sy == 0) sy = sx; |
|
648
|
14754 |
3483 |
while (pos < len) { |
|
651
|
3 |
14751 |
if (is_cid && pos + 1 < len) { |
|
|
3 |
0 |
if (is_cid && pos + 1 < len) { |
|
673
|
3 |
14751 |
gx = is_vertical ? rise : accum_x; |
|
674
|
3 |
14751 |
gy = is_vertical ? accum_x : rise; |
|
680
|
3 |
14751 |
adv = (is_vertical ? glyph_adv.vertical : glyph_adv.horizontal) * sx * h_scale; |
|
683
|
14754 |
0 |
sub_adv = (uni_list_n > 0) ? adv / (double)uni_list_n : adv; |
|
684
|
14756 |
14754 |
for (k = 0; k < uni_list_n; k++) { |
|
686
|
3 |
14753 |
if (is_vertical) { |
|
707
|
0 |
14756 |
if (!result_push_glyph(result, &g)) break; |
|
713
|
1468 |
13286 |
ws = (unicode == 0x20) ? word_space : 0.0; |
|
714
|
3 |
14751 |
if (is_vertical) { |
|
748
|
3484 |
0 |
if (!gs || !bytes || len == 0) return 0; |
|
|
3484 |
0 |
if (!gs || !bytes || len == 0) return 0; |
|
|
0 |
3484 |
if (!gs || !bytes || len == 0) return 0; |
|
751
|
3484 |
0 |
std14_id = rf ? rf->std14_id : -1; |
|
752
|
3484 |
0 |
is_cid = rf ? rf->is_cid : 0; |
|
753
|
3484 |
0 |
is_vertical = rf ? rf->wmode : 0; |
|
760
|
14765 |
3484 |
while (pos < len) { |
|
761
|
3 |
14762 |
if (is_cid && pos + 1 < len) { |
|
|
3 |
0 |
if (is_cid && pos + 1 < len) { |
|
771
|
14765 |
0 |
if (rf && rf->widths_resolved) { |
|
|
6349 |
8416 |
if (rf && rf->widths_resolved) { |
|
774
|
6349 |
8416 |
if (w1000 > 0) { |
|
776
|
8416 |
0 |
} else if (std14_id >= 0 && !is_cid) { |
|
|
8416 |
0 |
} else if (std14_id >= 0 && !is_cid) { |
|
778
|
8416 |
0 |
uni = rf && rf->encoding_resolved |
|
780
|
8416 |
0 |
: (uint32_t)code; |
|
783
|
8416 |
0 |
: 0.25 * font_size; |
|
792
|
3 |
14762 |
if (is_vertical && rf) { |
|
|
3 |
0 |
if (is_vertical && rf) { |
|
793
|
3 |
0 |
mag = (double)(rf->default_v_advance < 0 |
|
795
|
3 |
0 |
if (mag > 0) glyph_advance = mag / 1000.0 * font_size; |
|
800
|
1423 |
13342 |
ws = is_space ? word_space : 0.0; |
|
820
|
0 |
3 |
if (!result) return; |
|
822
|
3 |
0 |
if (properties && properties->kind == PDFMAKE_DICT && result->arena) { |
|
|
3 |
0 |
if (properties && properties->kind == PDFMAKE_DICT && result->arena) { |
|
|
3 |
0 |
if (properties && properties->kind == PDFMAKE_DICT && result->arena) { |
|
825
|
3 |
0 |
if (v && v->kind == PDFMAKE_INT) { |
|
|
3 |
0 |
if (v && v->kind == PDFMAKE_INT) { |
|
830
|
3 |
0 |
if (result->mcid_depth < |
|
835
|
3 |
0 |
if (mcid >= 0) result->current_mcid = mcid; |
|
842
|
0 |
3 |
if (!result) return; |
|
843
|
3 |
0 |
if (result->mcid_depth > 0) { |
|
855
|
3484 |
0 |
if (!result || !gs) return 0; |
|
|
0 |
3484 |
if (!result || !gs) return 0; |
|
857
|
3484 |
0 |
return rf ? rf->wmode : 0; |
|
885
|
100130 |
29228 |
for (i = 0; i < g_sort_column_count; i++) { |
|
886
|
29228 |
70902 |
if (g->x0 >= g_sort_column_splits[i]) col++; |
|
906
|
2 |
80834 |
if (ga->vertical && gb->vertical) { |
|
|
2 |
0 |
if (ga->vertical && gb->vertical) { |
|
911
|
0 |
2 |
if (fabs(dx_cx) > col_tol) { |
|
912
|
0 |
0 |
return dx_cx > 0 ? -1 : 1; /* larger x first */ |
|
916
|
2 |
0 |
if (dy2 < 0) return -1; |
|
917
|
0 |
0 |
if (dy2 > 0) return 1; |
|
923
|
0 |
80834 |
if (ga->vertical != gb->vertical) { |
|
924
|
0 |
0 |
return ga->vertical ? 1 : -1; |
|
928
|
50065 |
30769 |
if (g_sort_column_count > 0) { |
|
931
|
6346 |
43719 |
if (ca != cb) return ca - cb; |
|
936
|
39102 |
35386 |
if (fabs(dy) > ga->font_size * 0.3) { |
|
937
|
11278 |
27824 |
return dy > 0 ? 1 : -1; |
|
941
|
35386 |
0 |
if (dx < 0) return -1; |
|
942
|
0 |
0 |
if (dx > 0) return 1; |
|
981
|
0 |
59 |
if (*out_count >= max_count) return; |
|
982
|
4 |
55 |
if (x_hi - x_lo < 100) return; |
|
985
|
55 |
0 |
if (n_bins < 16 || n_bins > 10000) return; |
|
|
0 |
55 |
if (n_bins < 16 || n_bins > 10000) return; |
|
988
|
0 |
55 |
if (!hist) return; |
|
991
|
31208 |
55 |
for (i = 0; i < n; i++) { |
|
997
|
25197 |
6011 |
if (g->x1 < x_lo || g->x0 > x_hi) continue; |
|
|
2370 |
22827 |
if (g->x1 < x_lo || g->x0 > x_hi) continue; |
|
998
|
21942 |
885 |
a = g->x0 > x_lo ? g->x0 : x_lo; |
|
999
|
22736 |
91 |
b = g->x1 < x_hi ? g->x1 : x_hi; |
|
1000
|
0 |
22827 |
if (b <= a) continue; |
|
1003
|
0 |
22827 |
if (bb >= n_bins) bb = n_bins - 1; |
|
1006
|
47191 |
22827 |
for (k = ba; k <= bb; k++) hist[k]++; |
|
1011
|
3285 |
55 |
for (i = 0; i < n_bins; i++) |
|
1012
|
186 |
3099 |
if (hist[i] > max_cnt) max_cnt = hist[i]; |
|
1013
|
1 |
54 |
if (max_cnt < 4) { free(hist); return; } |
|
1028
|
3241 |
54 |
for (i = 0; i < n_bins; i++) { |
|
1029
|
1315 |
1926 |
if (hist[i] < empty_thr) { |
|
1030
|
199 |
1116 |
if (cur_run == 0) cur_start = i; |
|
1033
|
73 |
1853 |
if (cur_run > best_run) { |
|
1035
|
71 |
2 |
if (mid >= safe_lo_bin && mid <= safe_hi_bin) { |
|
|
71 |
0 |
if (mid >= safe_lo_bin && mid <= safe_hi_bin) { |
|
1043
|
44 |
10 |
if (cur_run > best_run) { |
|
1045
|
44 |
0 |
if (mid >= safe_lo_bin && mid <= safe_hi_bin) { |
|
|
23 |
21 |
if (mid >= safe_lo_bin && mid <= safe_hi_bin) { |
|
1052
|
44 |
10 |
if (best_run >= min_gutter_bins) { |
|
1055
|
1307 |
44 |
for (i = 0; i < best_start; i++) |
|
1056
|
1141 |
166 |
if (hist[i] >= empty_thr) active_left++; |
|
1057
|
615 |
44 |
for (i = best_start + best_run; i < n_bins; i++) |
|
1058
|
215 |
400 |
if (hist[i] >= empty_thr) active_right++; |
|
1059
|
43 |
1 |
if (active_left >= 4 && active_right >= 4) { |
|
|
17 |
26 |
if (active_left >= 4 && active_right >= 4) { |
|
1063
|
0 |
17 |
while (pos > 0 && out_splits[pos - 1] > mid_x) { |
|
|
0 |
0 |
while (pos > 0 && out_splits[pos - 1] > mid_x) { |
|
1087
|
29 |
31 |
if (result->raw_len < 16) return; |
|
1091
|
14445 |
31 |
for (i = 0; i < result->raw_len; i++) { |
|
1092
|
51 |
14394 |
if (result->raw_glyphs[i].x0 < x_lo) x_lo = result->raw_glyphs[i].x0; |
|
1093
|
486 |
13959 |
if (result->raw_glyphs[i].x1 > x_hi) x_hi = result->raw_glyphs[i].x1; |
|
1095
|
6 |
25 |
if (x_hi - x_lo < 100) return; |
|
1104
|
2327 |
10961 |
if (g->x0 < *x0) *x0 = g->x0; |
|
1105
|
2329 |
10959 |
if (g->y0 < *y0) *y0 = g->y0; |
|
1106
|
13286 |
2 |
if (g->x1 > *x1) *x1 = g->x1; |
|
1107
|
2327 |
10961 |
if (g->y1 > *y1) *y1 = g->y1; |
|
1111
|
2766 |
10522 |
if (w->len >= w->cap) { |
|
1112
|
439 |
2327 |
size_t new_cap = w->cap == 0 ? 8 : w->cap * 2; |
|
1114
|
0 |
2766 |
if (!arr) return 0; |
|
1123
|
756 |
1571 |
if (l->len >= l->cap) { |
|
1124
|
49 |
707 |
size_t new_cap = l->cap == 0 ? 8 : l->cap * 2; |
|
1126
|
0 |
756 |
if (!arr) return 0; |
|
1135
|
299 |
408 |
if (b->len >= b->cap) { |
|
1136
|
33 |
266 |
size_t new_cap = b->cap == 0 ? 8 : b->cap * 2; |
|
1138
|
0 |
299 |
if (!arr) return 0; |
|
1147
|
98 |
168 |
if (r->len >= r->cap) { |
|
1148
|
38 |
60 |
size_t new_cap = r->cap == 0 ? 4 : r->cap * 2; |
|
1150
|
0 |
98 |
if (!arr) return 0; |
|
1173
|
60 |
0 |
if (!result || result->raw_len == 0) return PDFMAKE_OK; |
|
|
0 |
60 |
if (!result || result->raw_len == 0) return PDFMAKE_OK; |
|
1175
|
60 |
0 |
opts = options ? *options : pdfmake_textract_default_options(); |
|
1221
|
14756 |
60 |
for (i = 0; i < result->raw_len; i++) { |
|
1225
|
1514 |
13242 |
if (cur_word.len == 0) { |
|
1230
|
2 |
13240 |
if (g->vertical) { |
|
1238
|
0 |
2 |
if (col_diff > g->font_size * 0.5) { |
|
1241
|
2 |
0 |
if (!new_word && v_gap > opts.word_gap_factor * g->font_size) { |
|
|
0 |
2 |
if (!new_word && v_gap > opts.word_gap_factor * g->font_size) { |
|
1249
|
523 |
12717 |
if (baseline_diff > opts.line_tolerance * g->font_size) { |
|
1254
|
12717 |
523 |
if (!new_word && |
|
1255
|
12717 |
0 |
(prev->unicode == 0x20 || g->unicode == 0x20)) { |
|
|
1395 |
11322 |
(prev->unicode == 0x20 || g->unicode == 0x20)) { |
|
1263
|
11322 |
1918 |
if (!new_word && gap > 0) { |
|
|
6166 |
5156 |
if (!new_word && gap > 0) { |
|
1265
|
6166 |
0 |
if (prev->reliable_advance) { |
|
1271
|
363 |
5803 |
if (gap > threshold) new_word = 1; |
|
1276
|
2281 |
12475 |
if (new_word && cur_word.len > 0) { |
|
|
2281 |
0 |
if (new_word && cur_word.len > 0) { |
|
1278
|
113 |
2168 |
if (words_len >= words_cap) { |
|
1279
|
58 |
55 |
words_cap = words_cap == 0 ? 16 : words_cap * 2; |
|
1281
|
0 |
113 |
if (!words) return PDFMAKE_ENOMEM; |
|
1291
|
1468 |
13288 |
if (g->unicode == 0x20) continue; |
|
1294
|
2327 |
10961 |
if (cur_word.len == 0) cur_word.mcid = g->mcid; |
|
1301
|
46 |
14 |
if (cur_word.len > 0) { |
|
1302
|
6 |
40 |
if (words_len >= words_cap) { |
|
1303
|
1 |
5 |
words_cap = words_cap == 0 ? 16 : words_cap * 2; |
|
1306
|
46 |
0 |
if (words) words[words_len++] = cur_word; |
|
1309
|
0 |
60 |
if (words_len == 0) { |
|
1323
|
2327 |
60 |
for (i = 0; i < words_len; i++) { |
|
1329
|
2327 |
0 |
int w_vertical = (w->len > 0 && w->glyphs[0].vertical); |
|
|
1 |
2326 |
int w_vertical = (w->len > 0 && w->glyphs[0].vertical); |
|
1332
|
60 |
2267 |
if (cur_line.len == 0) { |
|
1336
|
0 |
2267 |
if (w_vertical) { |
|
1339
|
0 |
0 |
if (col_diff > ref_size * 0.5) new_line = 1; |
|
1342
|
647 |
1620 |
if (baseline_diff > opts.line_tolerance * ref_size) { |
|
1348
|
647 |
1680 |
if (new_line && cur_line.len > 0) { |
|
|
647 |
0 |
if (new_line && cur_line.len > 0) { |
|
1349
|
79 |
568 |
if (lines_len >= lines_cap) { |
|
1350
|
45 |
34 |
lines_cap = lines_cap == 0 ? 8 : lines_cap * 2; |
|
1352
|
0 |
79 |
if (!lines) { free(words); return PDFMAKE_ENOMEM; } |
|
1362
|
707 |
1620 |
if (w->x0 < cur_line.x0) cur_line.x0 = w->x0; |
|
1363
|
726 |
1601 |
if (w->y0 < cur_line.y0) cur_line.y0 = w->y0; |
|
1364
|
2282 |
45 |
if (w->x1 > cur_line.x1) cur_line.x1 = w->x1; |
|
1365
|
710 |
1617 |
if (w->y1 > cur_line.y1) cur_line.y1 = w->y1; |
|
1367
|
60 |
0 |
if (cur_line.len > 0) { |
|
1368
|
27 |
33 |
if (lines_len >= lines_cap) { |
|
1369
|
1 |
26 |
lines_cap = lines_cap == 0 ? 8 : lines_cap * 2; |
|
1372
|
60 |
0 |
if (lines) lines[lines_len++] = cur_line; |
|
1381
|
707 |
60 |
for (i = 0; i < lines_len; i++) { |
|
1385
|
647 |
60 |
if (cur_block.len > 0) { |
|
1388
|
647 |
0 |
int l_vertical = (l->words[0].len > 0 && |
|
1389
|
0 |
647 |
l->words[0].glyphs[0].vertical); |
|
1391
|
0 |
647 |
if (l_vertical) { |
|
1397
|
206 |
441 |
if (gap > opts.block_leading * ref_size) { |
|
1402
|
206 |
501 |
if (new_block && cur_block.len > 0) { |
|
|
206 |
0 |
if (new_block && cur_block.len > 0) { |
|
1410
|
269 |
438 |
if (l->x0 < cur_block.x0) cur_block.x0 = l->x0; |
|
1411
|
707 |
0 |
if (l->y0 < cur_block.y0) cur_block.y0 = l->y0; |
|
1412
|
330 |
377 |
if (l->x1 > cur_block.x1) cur_block.x1 = l->x1; |
|
1413
|
266 |
441 |
if (l->y1 > cur_block.y1) cur_block.y1 = l->y1; |
|
1415
|
60 |
0 |
if (cur_block.len > 0) { |
|
1435
|
60 |
0 |
if (!interp || !content || !result) return PDFMAKE_EINVAL; |
|
|
60 |
0 |
if (!interp || !content || !result) return PDFMAKE_EINVAL; |
|
|
0 |
60 |
if (!interp || !content || !result) return PDFMAKE_EINVAL; |
|
1439
|
60 |
0 |
if (options) { |
|
1449
|
0 |
60 |
if (err != PDFMAKE_OK) return err; |
|
1467
|
3 |
0 |
if (mcid < 0 || role_id == 0) return 1; |
|
|
0 |
3 |
if (mcid < 0 || role_id == 0) return 1; |
|
1468
|
1 |
2 |
if (r->struct_map_len >= r->struct_map_cap) { |
|
1469
|
0 |
1 |
size_t new_cap = r->struct_map_cap == 0 ? 16 : r->struct_map_cap * 2; |
|
1472
|
0 |
1 |
if (!n) return 0; |
|
1508
|
7 |
0 |
if (!node || depth > 32) return; |
|
|
0 |
7 |
if (!node || depth > 32) return; |
|
1511
|
3 |
4 |
if (node->kind == PDFMAKE_REF && r->reader) { |
|
|
3 |
0 |
if (node->kind == PDFMAKE_REF && r->reader) { |
|
1513
|
0 |
3 |
if (!rd->parser) return; |
|
1515
|
0 |
3 |
if (!node) return; |
|
1519
|
3 |
4 |
if (node->kind == PDFMAKE_INT) { |
|
1525
|
1 |
3 |
if (node->kind == PDFMAKE_ARRAY) { |
|
1527
|
3 |
1 |
for (i = 0; i < n; i++) { |
|
1529
|
3 |
0 |
if (item) walk_struct_node(r, item, role_id, page_dict, depth + 1); |
|
1534
|
0 |
3 |
if (node->kind != PDFMAKE_DICT) return; |
|
1541
|
3 |
0 |
if (type_v && type_v->kind == PDFMAKE_NAME) { |
|
|
3 |
0 |
if (type_v && type_v->kind == PDFMAKE_NAME) { |
|
1548
|
3 |
0 |
if (type_name && strcmp(type_name, "MCR") == 0) { |
|
|
0 |
3 |
if (type_name && strcmp(type_name, "MCR") == 0) { |
|
1551
|
0 |
0 |
if (pg && page_dict && pg->kind == PDFMAKE_REF && r->reader) { |
|
|
0 |
0 |
if (pg && page_dict && pg->kind == PDFMAKE_REF && r->reader) { |
|
|
0 |
0 |
if (pg && page_dict && pg->kind == PDFMAKE_REF && r->reader) { |
|
|
0 |
0 |
if (pg && page_dict && pg->kind == PDFMAKE_REF && r->reader) { |
|
1555
|
0 |
0 |
? pdfmake_parser_resolve(rd->parser, pg->as.ref) : NULL; |
|
1556
|
0 |
0 |
if (resolved && resolved != page_dict) return; |
|
|
0 |
0 |
if (resolved && resolved != page_dict) return; |
|
1558
|
0 |
0 |
if (mcid_v && mcid_v->kind == PDFMAKE_INT) { |
|
|
0 |
0 |
if (mcid_v && mcid_v->kind == PDFMAKE_INT) { |
|
1565
|
3 |
0 |
if (type_name && strcmp(type_name, "OBJR") == 0) return; |
|
|
0 |
3 |
if (type_name && strcmp(type_name, "OBJR") == 0) return; |
|
1571
|
3 |
0 |
if (s_v && s_v->kind == PDFMAKE_NAME) this_role = s_v->as.name.id; |
|
|
3 |
0 |
if (s_v && s_v->kind == PDFMAKE_NAME) this_role = s_v->as.name.id; |
|
1577
|
0 |
3 |
if (!k) return; |
|
1592
|
0 |
1 |
if (!result) return PDFMAKE_EINVAL; |
|
1593
|
1 |
0 |
if (!struct_root || !result->arena) return PDFMAKE_OK; /* no-op */ |
|
|
0 |
1 |
if (!struct_root || !result->arena) return PDFMAKE_OK; /* no-op */ |
|
1596
|
1 |
0 |
if (struct_root->kind == PDFMAKE_REF && result->reader) { |
|
|
1 |
0 |
if (struct_root->kind == PDFMAKE_REF && result->reader) { |
|
1598
|
1 |
0 |
if (rd->parser) { |
|
1600
|
0 |
1 |
if (!struct_root) return PDFMAKE_OK; |
|
1603
|
0 |
1 |
if (struct_root->kind != PDFMAKE_DICT) return PDFMAKE_OK; |
|
1609
|
1 |
0 |
if (k) walk_struct_node(result, k, 0, page_dict, 0); |
|
1618
|
5 |
0 |
if (!result || mcid < 0) return 0; |
|
|
0 |
5 |
if (!result || mcid < 0) return 0; |
|
1619
|
11 |
0 |
for (i = 0; i < result->struct_map_len; i++) { |
|
1620
|
5 |
6 |
if (result->struct_map[i].mcid == mcid) { |
|
1644
|
8 |
0 |
if (!arena || !b) return NULL; |
|
|
0 |
8 |
if (!arena || !b) return NULL; |
|
1647
|
8 |
0 |
if (n >= 2 && b[0] == 0xFE && b[1] == 0xFF) { |
|
|
0 |
8 |
if (n >= 2 && b[0] == 0xFE && b[1] == 0xFF) { |
|
|
0 |
0 |
if (n >= 2 && b[0] == 0xFE && b[1] == 0xFF) { |
|
1650
|
0 |
0 |
for (i = 2; i + 1 < n; i += 2) { |
|
1652
|
0 |
0 |
if (cp >= 0xD800 && cp <= 0xDBFF && i + 3 < n) { |
|
|
0 |
0 |
if (cp >= 0xD800 && cp <= 0xDBFF && i + 3 < n) { |
|
|
0 |
0 |
if (cp >= 0xD800 && cp <= 0xDBFF && i + 3 < n) { |
|
1654
|
0 |
0 |
if (lo >= 0xDC00 && lo <= 0xDFFF) { |
|
|
0 |
0 |
if (lo >= 0xDC00 && lo <= 0xDFFF) { |
|
1659
|
0 |
0 |
if (cp < 0x80) { |
|
1661
|
0 |
0 |
} else if (cp < 0x800) { |
|
1664
|
0 |
0 |
} else if (cp < 0x10000) { |
|
1676
|
0 |
0 |
if (s) { memcpy(s, out.data, out.len); s[out.len] = 0; } |
|
1682
|
8 |
0 |
if (n >= 3 && b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF) { |
|
|
0 |
8 |
if (n >= 3 && b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF) { |
|
|
0 |
0 |
if (n >= 3 && b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF) { |
|
|
0 |
0 |
if (n >= 3 && b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF) { |
|
1688
|
98 |
8 |
for (i = 0; i < n; i++) { |
|
1690
|
98 |
0 |
if (c < 0x80) { |
|
1698
|
8 |
0 |
if (s) { memcpy(s, out.data, out.len); s[out.len] = 0; } |
|
1712
|
8 |
0 |
if (!dict || dict->kind != PDFMAKE_DICT) return NULL; |
|
|
0 |
8 |
if (!dict || dict->kind != PDFMAKE_DICT) return NULL; |
|
1715
|
7 |
1 |
if (v && v->kind == PDFMAKE_REF && rd && rd->parser) { |
|
|
0 |
7 |
if (v && v->kind == PDFMAKE_REF && rd && rd->parser) { |
|
|
0 |
0 |
if (v && v->kind == PDFMAKE_REF && rd && rd->parser) { |
|
|
0 |
0 |
if (v && v->kind == PDFMAKE_REF && rd && rd->parser) { |
|
1718
|
7 |
1 |
if (!v || v->kind != PDFMAKE_STR) return NULL; |
|
|
0 |
7 |
if (!v || v->kind != PDFMAKE_STR) return NULL; |
|
1730
|
1 |
0 |
if (!dict || dict->kind != PDFMAKE_DICT) return NULL; |
|
|
0 |
1 |
if (!dict || dict->kind != PDFMAKE_DICT) return NULL; |
|
1733
|
1 |
0 |
if (v && v->kind == PDFMAKE_REF && rd && rd->parser) { |
|
|
1 |
0 |
if (v && v->kind == PDFMAKE_REF && rd && rd->parser) { |
|
|
1 |
0 |
if (v && v->kind == PDFMAKE_REF && rd && rd->parser) { |
|
|
1 |
0 |
if (v && v->kind == PDFMAKE_REF && rd && rd->parser) { |
|
1741
|
2 |
0 |
if (l) l->arena = arena; |
|
1746
|
0 |
2 |
if (!list) return; |
|
1754
|
1 |
2 |
if (l->len >= l->cap) { |
|
1755
|
0 |
1 |
size_t ncap = l->cap == 0 ? 8 : l->cap * 2; |
|
1757
|
0 |
1 |
if (!n) return 0; |
|
1772
|
3 |
0 |
if (!v || v->kind != PDFMAKE_ARRAY) return; |
|
|
0 |
3 |
if (!v || v->kind != PDFMAKE_ARRAY) return; |
|
1773
|
0 |
3 |
if (pdfmake_array_len(v) < 4) return; |
|
1774
|
12 |
3 |
for (i = 0; i < 4; i++) { |
|
1776
|
12 |
0 |
if (n) out[i] = pdfmake_get_number(n); |
|
1801
|
2 |
0 |
if (!page || !page->page_dict) return; |
|
|
0 |
2 |
if (!page || !page->page_dict) return; |
|
1806
|
1 |
1 |
if (annots && annots->kind == PDFMAKE_REF) { |
|
|
0 |
1 |
if (annots && annots->kind == PDFMAKE_REF) { |
|
1809
|
1 |
1 |
if (!annots || annots->kind != PDFMAKE_ARRAY) return; |
|
|
0 |
1 |
if (!annots || annots->kind != PDFMAKE_ARRAY) return; |
|
1813
|
3 |
1 |
for (i = 0; i < n; i++) { |
|
1815
|
3 |
0 |
if (a && a->kind == PDFMAKE_REF) { |
|
|
3 |
0 |
if (a && a->kind == PDFMAKE_REF) { |
|
1818
|
3 |
0 |
if (!a || a->kind != PDFMAKE_DICT) continue; |
|
|
0 |
3 |
if (!a || a->kind != PDFMAKE_DICT) continue; |
|
1824
|
3 |
0 |
if (sub && sub->kind == PDFMAKE_NAME) { |
|
|
3 |
0 |
if (sub && sub->kind == PDFMAKE_NAME) { |
|
1826
|
3 |
0 |
if (nm) kind = nm; |
|
1831
|
3 |
0 |
if (strcmp(kind, "Link") == 0 || |
|
1832
|
2 |
1 |
strcmp(kind, "Widget") == 0 || |
|
1833
|
2 |
0 |
strcmp(kind, "PrinterMark") == 0 || |
|
1834
|
0 |
2 |
strcmp(kind, "TrapNet") == 0) { |
|
1845
|
0 |
2 |
if (!contents && !author && !subject) continue; |
|
|
0 |
0 |
if (!contents && !author && !subject) continue; |
|
|
0 |
0 |
if (!contents && !author && !subject) continue; |
|
1851
|
2 |
0 |
rec.text = contents ? contents : ""; |
|
1886
|
1 |
0 |
if (!field || depth > 32) return; |
|
|
0 |
1 |
if (!field || depth > 32) return; |
|
1888
|
1 |
0 |
if (field->kind == PDFMAKE_REF) { |
|
1891
|
1 |
0 |
if (!field || field->kind != PDFMAKE_DICT) return; |
|
|
0 |
1 |
if (!field || field->kind != PDFMAKE_DICT) return; |
|
1896
|
0 |
1 |
if (parent_name && t) { |
|
|
0 |
0 |
if (parent_name && t) { |
|
1900
|
0 |
0 |
if (buf) { |
|
1907
|
0 |
1 |
} else if (parent_name && !t) { |
|
|
0 |
0 |
} else if (parent_name && !t) { |
|
1915
|
1 |
0 |
if (v && v->kind == PDFMAKE_REF) { |
|
|
0 |
1 |
if (v && v->kind == PDFMAKE_REF) { |
|
1919
|
1 |
0 |
if (v) { |
|
1920
|
1 |
0 |
if (v->kind == PDFMAKE_STR) { |
|
1922
|
0 |
0 |
} else if (v->kind == PDFMAKE_NAME) { |
|
1924
|
0 |
0 |
if (nm) value = pdfmake_arena_strdup(arena, nm); |
|
1932
|
0 |
1 |
if (value || tooltip) { |
|
|
0 |
0 |
if (value || tooltip) { |
|
1936
|
1 |
0 |
rec.text = value ? value : ""; |
|
1947
|
1 |
0 |
if (p) { |
|
1948
|
1 |
0 |
for (pi = 0; pi < rd->page_count; pi++) { |
|
1949
|
1 |
0 |
if (rd->pages[pi].page_dict == p) { |
|
1961
|
0 |
1 |
if (kids && kids->kind == PDFMAKE_REF) { |
|
|
0 |
0 |
if (kids && kids->kind == PDFMAKE_REF) { |
|
1964
|
0 |
1 |
if (kids && kids->kind == PDFMAKE_ARRAY) { |
|
|
0 |
0 |
if (kids && kids->kind == PDFMAKE_ARRAY) { |
|
1966
|
0 |
0 |
for (i = 0; i < n; i++) { |
|
1984
|
2 |
0 |
if (!reader || !out) return PDFMAKE_EINVAL; |
|
|
0 |
2 |
if (!reader || !out) return PDFMAKE_EINVAL; |
|
1985
|
2 |
0 |
if (!reader->parser || !reader->parser->doc) return PDFMAKE_EINVAL; |
|
|
0 |
2 |
if (!reader->parser || !reader->parser->doc) return PDFMAKE_EINVAL; |
|
1990
|
2 |
2 |
for (i = 0; i < reader->page_count; i++) { |
|
1995
|
2 |
0 |
if (reader->catalog) { |
|
1998
|
1 |
1 |
if (af && af->kind == PDFMAKE_REF) { |
|
|
1 |
0 |
if (af && af->kind == PDFMAKE_REF) { |
|
2001
|
1 |
1 |
if (af && af->kind == PDFMAKE_DICT) { |
|
|
1 |
0 |
if (af && af->kind == PDFMAKE_DICT) { |
|
2004
|
1 |
0 |
if (fields && fields->kind == PDFMAKE_REF) { |
|
|
0 |
1 |
if (fields && fields->kind == PDFMAKE_REF) { |
|
2007
|
1 |
0 |
if (fields && fields->kind == PDFMAKE_ARRAY) { |
|
|
1 |
0 |
if (fields && fields->kind == PDFMAKE_ARRAY) { |
|
2009
|
1 |
1 |
for (i = 0; i < n; i++) { |
|
2044
|
2 |
0 |
if (l) l->arena = arena; |
|
2050
|
0 |
2 |
if (!list) return; |
|
2051
|
1 |
2 |
for (i = 0; i < list->len; i++) { |
|
2079
|
9 |
8 |
if (r->ncells >= r->cap) { |
|
2080
|
0 |
9 |
size_t nc = r->cap == 0 ? 4 : r->cap * 2; |
|
2082
|
0 |
9 |
if (!n) return; |
|
2096
|
0 |
591 |
if (ga->vertical != gb->vertical) return ga->vertical ? 1 : -1; |
|
|
0 |
0 |
if (ga->vertical != gb->vertical) return ga->vertical ? 1 : -1; |
|
2098
|
591 |
0 |
tol = (ga->font_size > 0 ? ga->font_size : 10.0) * 0.3; |
|
2099
|
202 |
389 |
if (fabs(dy) > tol) return dy > 0 ? 1 : -1; |
|
|
51 |
151 |
if (fabs(dy) > tol) return dy > 0 ? 1 : -1; |
|
2101
|
389 |
0 |
if (dx < 0) return -1; |
|
2102
|
0 |
0 |
if (dx > 0) return 1; |
|
2145
|
2 |
0 |
if (!result || !out) return PDFMAKE_EINVAL; |
|
|
0 |
2 |
if (!result || !out) return PDFMAKE_EINVAL; |
|
2146
|
0 |
2 |
opts = options ? *options : pdfmake_textract_table_default_opts(); |
|
2147
|
0 |
2 |
if (result->raw_len == 0) return PDFMAKE_OK; |
|
2153
|
0 |
2 |
if (!glyphs) return PDFMAKE_ENOMEM; |
|
2164
|
0 |
2 |
if (!rows) { free(glyphs); return PDFMAKE_ENOMEM; } |
|
2167
|
9 |
2 |
while (gi < result->raw_len) { |
|
2169
|
9 |
0 |
rfs = glyphs[gi].font_size > 0 ? glyphs[gi].font_size : 10.0; |
|
2170
|
0 |
9 |
if (glyphs[gi].vertical) { gi++; continue; } |
|
2174
|
174 |
2 |
while (rend < result->raw_len && !glyphs[rend].vertical && |
|
|
174 |
0 |
while (rend < result->raw_len && !glyphs[rend].vertical && |
|
2175
|
167 |
7 |
fabs(glyphs[rend].y0 - ry) <= rfs * opts.row_tolerance) { |
|
2180
|
0 |
9 |
if (nrows >= row_cap) { |
|
2183
|
0 |
0 |
if (!tmp) { free(rows); free(glyphs); return PDFMAKE_ENOMEM; } |
|
2194
|
176 |
9 |
for (k = gi + 1; k <= rend; k++) { |
|
2196
|
167 |
9 |
if (!split) { |
|
2198
|
8 |
159 |
if (gap > 1.5 * rfs) split = 1; |
|
2200
|
17 |
159 |
if (split) { |
|
2208
|
176 |
17 |
for (j = cstart; j < k; j++) { |
|
2210
|
0 |
176 |
if (glyphs[j].x0 < cell.x0) cell.x0 = glyphs[j].x0; |
|
2211
|
0 |
176 |
if (glyphs[j].x1 > cell.x1) cell.x1 = glyphs[j].x1; |
|
2212
|
0 |
176 |
if (glyphs[j].y0 < cell.y0) cell.y0 = glyphs[j].y0; |
|
2213
|
0 |
176 |
if (glyphs[j].y1 > cell.y1) cell.y1 = glyphs[j].y1; |
|
2214
|
176 |
176 |
for (m = 0; m < n; m++) |
|
2218
|
17 |
0 |
if (cell.text) { memcpy(cell.text, tb.data, tb.len); cell.text[tb.len] = 0; } |
|
2231
|
6 |
2 |
while (i < nrows) { |
|
2232
|
5 |
1 |
if (rows[i].ncells < opts.min_cols) { i++; continue; } |
|
2236
|
4 |
0 |
while (j < nrows) { |
|
2237
|
1 |
3 |
if (rows[j].ncells != ncols) break; |
|
2239
|
9 |
3 |
for (c = 0; c < ncols; c++) { |
|
2241
|
0 |
9 |
if (dx < 0) dx = -dx; |
|
2242
|
0 |
9 |
if (dx > opts.x_tolerance) { ok = 0; break; } |
|
2244
|
0 |
3 |
if (!ok) break; |
|
2249
|
0 |
1 |
if (run < opts.min_rows) { i = j; continue; } |
|
2260
|
1 |
0 |
if (!t.cells || !t.cell_x0 || !t.cell_y0 || !t.cell_x1 || !t.cell_y1) { |
|
|
1 |
0 |
if (!t.cells || !t.cell_x0 || !t.cell_y0 || !t.cell_x1 || !t.cell_y1) { |
|
|
1 |
0 |
if (!t.cells || !t.cell_x0 || !t.cell_y0 || !t.cell_x1 || !t.cell_y1) { |
|
|
1 |
0 |
if (!t.cells || !t.cell_x0 || !t.cell_y0 || !t.cell_x1 || !t.cell_y1) { |
|
|
0 |
1 |
if (!t.cells || !t.cell_x0 || !t.cell_y0 || !t.cell_x1 || !t.cell_y1) { |
|
2263
|
0 |
0 |
for (k = 0; k < nrows; k++) free(rows[k].cells); |
|
2269
|
4 |
1 |
for (r = 0; r < run; r++) { |
|
2271
|
12 |
4 |
for (c = 0; c < ncols; c++) { |
|
2274
|
12 |
0 |
t.cells[idx] = cellp->text ? cellp->text : ""; |
|
2279
|
1 |
11 |
if (cellp->x0 < t.x0) t.x0 = cellp->x0; |
|
2280
|
4 |
8 |
if (cellp->y0 < t.y0) t.y0 = cellp->y0; |
|
2281
|
3 |
9 |
if (cellp->x1 > t.x1) t.x1 = cellp->x1; |
|
2282
|
1 |
11 |
if (cellp->y1 > t.y1) t.y1 = cellp->y1; |
|
2286
|
1 |
0 |
if (out->len >= out->cap) { |
|
2287
|
0 |
1 |
nc = out->cap == 0 ? 4 : out->cap * 2; |
|
2289
|
0 |
1 |
if (!nt) { |
|
2292
|
0 |
0 |
for (k = 0; k < nrows; k++) free(rows[k].cells); |
|
2303
|
9 |
2 |
for (k = 0; k < nrows; k++) free(rows[k].cells); |
|
2315
|
1152 |
6 |
if (cp < 0x80) { |
|
2318
|
0 |
6 |
} else if (cp < 0x800) { |
|
2322
|
6 |
0 |
} else if (cp < 0x10000) { |
|
2327
|
0 |
0 |
} else if (cp < 0x110000) { |
|
2352
|
0 |
4 |
if (!result) return 0; |
|
2356
|
15 |
4 |
for (bi = 0; bi < result->len; bi++) { |
|
2358
|
22 |
15 |
for (li = 0; li < block->len; li++) { |
|
2360
|
194 |
22 |
for (wi = 0; wi < line->len; wi++) { |
|
2362
|
172 |
22 |
if (wi > 0 && written < buf_cap) { |
|
|
172 |
0 |
if (wi > 0 && written < buf_cap) { |
|
2365
|
982 |
194 |
for (gi = 0; gi < word->len; gi++) { |
|
2367
|
994 |
982 |
for (k = 0; k < n && written < buf_cap; k++) { |
|
|
994 |
0 |
for (k = 0; k < n && written < buf_cap; k++) { |
|
2373
|
7 |
15 |
if (li + 1 < block->len && written < buf_cap) { |
|
|
7 |
0 |
if (li + 1 < block->len && written < buf_cap) { |
|
2378
|
11 |
4 |
if (bi + 1 < result->len && written + 1 < buf_cap) { |
|
|
11 |
0 |
if (bi + 1 < result->len && written + 1 < buf_cap) { |
|
2385
|
4 |
0 |
if (written < buf_cap) buf[written] = '\0'; |