From: Michael Wallner Date: Tue, 22 Mar 2005 15:59:39 +0000 (+0000) Subject: - use size_t and return 0 on fail X-Git-Tag: RELEASE_0_7_0~13 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=1877c25f3174e7ec12dfcfe2797e2454bd9d94eb;p=m6w6%2Fext-http - use size_t and return 0 on fail --- diff --git a/phpstr/phpstr.c b/phpstr/phpstr.c index af090fa..7c9bad0 100644 --- a/phpstr/phpstr.c +++ b/phpstr/phpstr.c @@ -139,10 +139,10 @@ PHPSTR_API phpstr *phpstr_dup(const phpstr *buf) return dup; } -PHPSTR_API ssize_t phpstr_cut(phpstr *buf, size_t offset, size_t length) +PHPSTR_API size_t phpstr_cut(phpstr *buf, size_t offset, size_t length) { if (offset >= buf->used) { - return -1; + return 0; } if (offset + length > buf->used) { length = buf->used - offset; diff --git a/phpstr/phpstr.h b/phpstr/phpstr.h index bd749d6..c53d311 100644 --- a/phpstr/phpstr.h +++ b/phpstr/phpstr.h @@ -98,7 +98,7 @@ PHPSTR_API phpstr *phpstr_right(const phpstr *buf, size_t length); PHPSTR_API phpstr *phpstr_sub(const phpstr *buf, size_t offset, size_t len); /* remove a substring */ -PHPSTR_API ssize_t phpstr_cut(phpstr *buf, size_t offset, size_t length); +PHPSTR_API size_t phpstr_cut(phpstr *buf, size_t offset, size_t length); /* get a complete phpstr duplicate */ PHPSTR_API phpstr *phpstr_dup(const phpstr *buf);