Skip to content

Commit 701fbc4

Browse files
authored
silence warnings: use int32_t for chars more consistently (#282)
1 parent c8d815a commit 701fbc4

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

data/data_generator.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ function print_c_data_tables(io, sequences, prop_page_indices, prop_pages, dedup
469469
end
470470
print(io, "};\n\n")
471471

472-
print(io, "static const utf8proc_uint32_t utf8proc_combinations_second[] = {\n")
472+
print(io, "static const utf8proc_int32_t utf8proc_combinations_second[] = {\n")
473473
for dm0 in sort!(collect(keys(comb_mapping)))
474474
print(io, " ");
475475
for dm1 in sort!(collect(keys(comb_mapping[dm0])))
@@ -479,7 +479,7 @@ function print_c_data_tables(io, sequences, prop_page_indices, prop_pages, dedup
479479
end
480480
print(io, "};\n\n")
481481

482-
print(io, "static const utf8proc_uint32_t utf8proc_combinations_combined[] = {\n")
482+
print(io, "static const utf8proc_int32_t utf8proc_combinations_combined[] = {\n")
483483
for dm0 in sort!(collect(keys(comb_mapping)))
484484
print(io, " ");
485485
for dm1 in sort!(collect(keys(comb_mapping[dm0])))

utf8proc.c

+6-7
Original file line numberDiff line numberDiff line change
@@ -646,14 +646,13 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_normalize_utf32(utf8proc_int32_t *b
646646
}
647647
if (options & UTF8PROC_COMPOSE) {
648648
utf8proc_int32_t *starter = NULL;
649-
utf8proc_int32_t current_char;
650-
const utf8proc_property_t *starter_property = NULL, *current_property;
649+
const utf8proc_property_t *starter_property = NULL;
651650
utf8proc_propval_t max_combining_class = -1;
652651
utf8proc_ssize_t rpos;
653652
utf8proc_ssize_t wpos = 0;
654653
for (rpos = 0; rpos < length; rpos++) {
655-
current_char = buffer[rpos];
656-
current_property = unsafe_get_property(current_char);
654+
utf8proc_int32_t current_char = buffer[rpos];
655+
const utf8proc_property_t *current_property = unsafe_get_property(current_char);
657656
if (starter && current_property->combining_class > max_combining_class) {
658657
/* combination perhaps possible */
659658
utf8proc_int32_t hangul_lindex;
@@ -687,18 +686,18 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_normalize_utf32(utf8proc_int32_t *b
687686
int idx = starter_property->comb_index;
688687
if (idx < 0x3FF && current_property->comb_issecond) {
689688
int len = starter_property->comb_length;
690-
utf8proc_uint32_t max_second = utf8proc_combinations_second[idx + len - 1];
689+
utf8proc_int32_t max_second = utf8proc_combinations_second[idx + len - 1];
691690
if (current_char <= max_second) {
692691
// TODO: binary search? arithmetic search?
693692
for (int off = 0; off < len; ++off) {
694-
utf8proc_uint32_t second = utf8proc_combinations_second[idx + off];
693+
utf8proc_int32_t second = utf8proc_combinations_second[idx + off];
695694
if (current_char < second) {
696695
/* not found */
697696
break;
698697
}
699698
if (current_char == second) {
700699
/* found */
701-
utf8proc_uint32_t composition = utf8proc_combinations_combined[idx + off];
700+
utf8proc_int32_t composition = utf8proc_combinations_combined[idx + off];
702701
*starter = composition;
703702
starter_property = NULL;
704703
break;

utf8proc_data.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -16316,7 +16316,7 @@ static const utf8proc_property_t utf8proc_properties[] = {
1631616316
{UTF8PROC_CATEGORY_CF, 0, UTF8PROC_BIDI_CLASS_BN, 0, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, 1023, 0, false, false, false, true, true, 0, false, 0, UTF8PROC_BOUNDCLASS_EXTEND, UTF8PROC_INDIC_CONJUNCT_BREAK_EXTEND},
1631716317
};
1631816318

16319-
static const utf8proc_uint32_t utf8proc_combinations_second[] = {
16319+
static const utf8proc_int32_t utf8proc_combinations_second[] = {
1632016320
824,
1632116321
824,
1632216322
824,
@@ -16710,7 +16710,7 @@ static const utf8proc_uint32_t utf8proc_combinations_second[] = {
1671016710
93543,
1671116711
};
1671216712

16713-
static const utf8proc_uint32_t utf8proc_combinations_combined[] = {
16713+
static const utf8proc_int32_t utf8proc_combinations_combined[] = {
1671416714
8814,
1671516715
8800,
1671616716
8815,

0 commit comments

Comments
 (0)