summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2014-06-04 13:50:26 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2014-06-04 13:50:26 +0100
commit4641769ae540dc4e6d9cd31f14f041746adcd279 (patch)
tree52c64548b0b03e4559bcfcb87be6ca93c763b2f1
parenteee7189f05ad0de23c4a56ce0255a25d0ee4b4d8 (diff)
downloadnetsurf-4641769ae540dc4e6d9cd31f14f041746adcd279.tar.gz
netsurf-4641769ae540dc4e6d9cd31f14f041746adcd279.tar.bz2
Make chris' work compile without warning and not infinite-loop where I spotted it
-rw-r--r--utils/idna.c21
-rw-r--r--utils/utf8proc.c2
-rw-r--r--utils/utf8proc_data.c2
3 files changed, 13 insertions, 12 deletions
diff --git a/utils/idna.c b/utils/idna.c
index 5ec05e612..d5d75ceb6 100644
--- a/utils/idna.c
+++ b/utils/idna.c
@@ -94,13 +94,13 @@ static idna_unicode_jt idna__jt_property(int32_t cp)
*/
static bool idna__contexto_rule(int32_t cp)
{
- bool rule = false;
- int32_t *t = idna_contexto;
- while (*t) {
- if (*t == cp) rule = true;
- };
+ int32_t *t;
+ for (t = idna_contexto; *t != 0; t++) {
+ if (*t == cp)
+ return true;
+ }
- return rule;
+ return false;
}
@@ -485,20 +485,21 @@ static bool idna__verify(const char *label, size_t len)
nserror error;
int32_t *ucs4;
char *ace;
- size_t ucs4_len, ace_len;
+ ssize_t ucs4_len;
+ size_t u_ucs4_len, ace_len;
/* Convert our ACE label back to UCS-4 */
error = idna__ace_to_ucs4(label, len,
- &ucs4, &ucs4_len);
+ &ucs4, &u_ucs4_len);
if (error != NSERROR_OK) return false;
/* Perform NFC normalisation */
- ucs4_len = utf8proc_normalise(ucs4, ucs4_len,
+ ucs4_len = utf8proc_normalise(ucs4, u_ucs4_len,
UTF8PROC_STABLE | UTF8PROC_COMPOSE);
if(ucs4_len < 0) return false;
/* Convert the UCS-4 label back to ACE */
- error = idna__ucs4_to_ace(ucs4, ucs4_len,
+ error = idna__ucs4_to_ace(ucs4, (size_t)ucs4_len,
&ace, &ace_len);
free(ucs4);
if (error != NSERROR_OK) return false;
diff --git a/utils/utf8proc.c b/utils/utf8proc.c
index 0ea1556b9..3e0b25f58 100644
--- a/utils/utf8proc.c
+++ b/utils/utf8proc.c
@@ -387,7 +387,7 @@ ssize_t utf8proc_decompose(
if (decomp_result < 0) return decomp_result;
wpos += decomp_result;
/* prohibiting integer overflows due to too long strings: */
- if (wpos < 0 || wpos > SSIZE_MAX/sizeof(int32_t)/2)
+ if (wpos < 0 || wpos > (ssize_t)(SSIZE_MAX/sizeof(int32_t)/2))
return UTF8PROC_ERROR_OVERFLOW;
}
}
diff --git a/utils/utf8proc_data.c b/utils/utf8proc_data.c
index 1426b76e0..69411279c 100644
--- a/utils/utf8proc_data.c
+++ b/utils/utf8proc_data.c
@@ -4946,7 +4946,7 @@ const uint16_t utf8proc_stage2table[] = {
0, };
const utf8proc_property_t utf8proc_properties[] = {
- {0, 0, 0, 0, NULL, false, -1, -1, -1, -1, -1, false},
+ {0, 0, 0, 0, NULL, false, -1, -1, -1, -1, -1, false, false, false, false, NULL},
{UTF8PROC_CATEGORY_CC, 0, UTF8PROC_BIDI_CLASS_BN, 0, NULL, false, -1, -1, -1, -1, -1, false, true, true, false, NULL},
{UTF8PROC_CATEGORY_CC, 0, UTF8PROC_BIDI_CLASS_S, 0, NULL, false, -1, -1, -1, -1, -1, false, false, true, false, NULL},
{UTF8PROC_CATEGORY_CC, 0, UTF8PROC_BIDI_CLASS_B, 0, NULL, false, -1, -1, -1, -1, -1, false, false, true, false, NULL},