aboutsummaryrefslogtreecommitdiff
path: root/lib/unicode
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-10-30 08:28:15 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-10-30 08:28:15 +0100
commit045f4bb5b1767140c4f6cfe2d2002553925c4205 (patch)
treef51b2034e91a3f67d2bde506cf84d13cfc496c6e /lib/unicode
parent5dbf53a1c512f9163744874e3d502e9f9e2808da (diff)
Make string view lengths signed
Diffstat (limited to 'lib/unicode')
-rw-r--r--lib/unicode/string/u8gnext.c2
-rw-r--r--lib/unicode/string/u8wnext.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/unicode/string/u8gnext.c b/lib/unicode/string/u8gnext.c
index 7c551f7..6e91cf7 100644
--- a/lib/unicode/string/u8gnext.c
+++ b/lib/unicode/string/u8gnext.c
@@ -35,7 +35,7 @@ u8gnext(u8view_t *g, u8view_t *sv)
for (;;) {
rune ch2;
- if ((size_t)(p - sv->p) >= sv->len)
+ if (p - sv->p >= sv->len)
ch2 = 0;
else
m = u8tor(&ch2, p);
diff --git a/lib/unicode/string/u8wnext.c b/lib/unicode/string/u8wnext.c
index 493ec9f..da11f4a 100644
--- a/lib/unicode/string/u8wnext.c
+++ b/lib/unicode/string/u8wnext.c
@@ -22,7 +22,7 @@ struct wbrk_state {
};
static bool advance(struct wbrk_state *);
-static size_t findwbrk(u8view_t);
+static ptrdiff_t findwbrk(u8view_t);
static struct wbrk_state mkwbrkstate(u8view_t);
size_t
@@ -34,7 +34,7 @@ u8wnext(u8view_t *w, u8view_t *sv)
if (sv->len == 0)
return 0;
- size_t off = findwbrk(*sv);
+ ptrdiff_t off = findwbrk(*sv);
if (w != nullptr)
*w = (u8view_t){sv->p, off};
@@ -43,7 +43,7 @@ u8wnext(u8view_t *w, u8view_t *sv)
return off;
}
-size_t
+ptrdiff_t
findwbrk(u8view_t sv)
{
ASSUME(sv.p != nullptr);