From 6a9ca73e10c3c4e8a95101313e9c5d46cf018f86 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 7 Jan 2017 20:31:02 +0000 Subject: Types fix: first pass This pass makes variable size_t-ready, so everything works when the prototypes are fixed in skalibs. Some code uses "unsigned int *" where it should be "size_t *"; it cannot be changed now, but it's been marked with XXX. It must change at the same time as the skalibs API. --- src/libexecline/el_transform.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/libexecline/el_transform.c') diff --git a/src/libexecline/el_transform.c b/src/libexecline/el_transform.c index ac84d1d..210cbdf 100644 --- a/src/libexecline/el_transform.c +++ b/src/libexecline/el_transform.c @@ -1,14 +1,15 @@ /* ISC license. */ +#include #include #include #include #include #include -static void el_crunch (stralloc *sa, unsigned int base, char const *delim) +static void el_crunch (stralloc *sa, size_t base, char const *delim) { - register unsigned int i = base, j = base ; + register size_t i = base, j = base ; register int crunching = 0 ; for (; i < sa->len ; i++) { @@ -23,10 +24,10 @@ static void el_crunch (stralloc *sa, unsigned int base, char const *delim) sa->len = j ; } -static int el_split (stralloc *sa, unsigned int base, eltransforminfo_t const *si, int chomped) +static int el_split (stralloc *sa, size_t base, eltransforminfo_t const *si, int chomped) { - unsigned int n = 0 ; - register unsigned int i = base ; + int n = 0 ; + register size_t i = base ; for (; i < sa->len ; i++) if (si->delim[str_chr(si->delim, sa->s[i])]) { @@ -44,13 +45,13 @@ static int el_split (stralloc *sa, unsigned int base, eltransforminfo_t const *s return n ; } -static int el_splitnetstring (stralloc *sa, unsigned int base) +static int el_splitnetstring (stralloc *sa, size_t base) { - unsigned int tmpbase = satmp.len ; - unsigned int n = 0, i = base ; + size_t tmpbase = satmp.len, i = base ; + int n = 0 ; while (i < sa->len) { - register int r = netstring_decode(&satmp, sa->s + i, sa->len - i) ; + register ssize_t r = netstring_decode(&satmp, sa->s + i, sa->len - i) ; if (r < 0) goto err ; if (!stralloc_0(&satmp)) goto err ; i += r ; n++ ; @@ -69,7 +70,7 @@ err: return -1 ; } -int el_transform (stralloc *sa, unsigned int i, eltransforminfo_t const *si) +int el_transform (stralloc *sa, size_t i, eltransforminfo_t const *si) { int chomped = 0 ; if (si->crunch && *si->delim) el_crunch(sa, i, si->delim) ; -- cgit v1.2.3