Commit a45f839b7badd1ac99a07723bc45972fd4e3c316

Giuseppe D'Angelo 2020-12-14T12:21:50

Fix mixed signed/unsigned comparisons Force both operands to unsigned. n_codepoints does not seem to ever contain negative offsets anyhow, should it actually be unsigned?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/src/md4c.c b/src/md4c.c
index d7b814a..2be567b 100644
--- a/src/md4c.c
+++ b/src/md4c.c
@@ -1614,12 +1614,12 @@ md_link_label_cmp(const CHAR* a_label, SZ a_size, const CHAR* b_label, SZ b_size
     b_off = md_skip_unicode_whitespace(b_label, 0, b_size);
     while(!a_reached_end  ||  !b_reached_end) {
         /* If needed, load fold info for next char. */
-        if(a_fi_off >= a_fi.n_codepoints) {
+        if(a_fi_off >= (OFF)a_fi.n_codepoints) {
             a_fi_off = 0;
             a_off = md_link_label_cmp_load_fold_info(a_label, a_off, a_size, &a_fi);
             a_reached_end = (a_off >= a_size);
         }
-        if(b_fi_off >= b_fi.n_codepoints) {
+        if(b_fi_off >= (OFF)b_fi.n_codepoints) {
             b_fi_off = 0;
             b_off = md_link_label_cmp_load_fold_info(b_label, b_off, b_size, &b_fi);
             b_reached_end = (b_off >= b_size);