summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6ad2eb0)
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 <jk@ozlabs.org>
bytes = mbrtowc(&wc, end, len - (end - text), &ps);
bytes = mbrtowc(&wc, end, len - (end - text), &ps);
+ assert(bytes != (size_t)-1);
/* we'll get a zero size for the nul terminator */
if (!bytes) {
/* we'll get a zero size for the nul terminator */
if (!bytes) {