From: Jeremy Kerr Date: Fri, 28 Nov 2014 03:42:06 +0000 (+0800) Subject: lib/fold: fix warning with -DDEBUG X-Git-Tag: v1.0.0~92 X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=commitdiff_plain;h=d28e414354d791a8c010cf6069bfc549d4343811;hp=6ad2eb0b495e47c5be35acd5d63d53530a45e137 lib/fold: fix warning with -DDEBUG When compiling the fold code with DEBUG defined, we get: ../lib/fold/fold.c: In function 'fold_text': ../lib/fold/fold.c:37:3: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits] assert(bytes >= 0); ^ We should be comparing with != (size_t)-1, not >= 0 Signed-off-by: Jeremy Kerr --- diff --git a/lib/fold/fold.c b/lib/fold/fold.c index 8bf133c..fd23b06 100644 --- a/lib/fold/fold.c +++ b/lib/fold/fold.c @@ -34,7 +34,7 @@ void fold_text(const char *text, bytes = mbrtowc(&wc, end, len - (end - text), &ps); - assert(bytes >= 0); + assert(bytes != (size_t)-1); /* we'll get a zero size for the nul terminator */ if (!bytes) {