Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Test failure with negative substring offsets
- X-seq: zsh-workers 29350
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Test failure with negative substring offsets
- Date: Mon, 23 May 2011 17:52:03 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:message-id:x-mailer :in-reply-to:references; bh=o1j47XzZEHDe5n711z6Dm7LvVRcwRlng001x/0a9b5Q=; b=d6IlkPufJIPMsZc6YiewYSrDNz4HS2/4E8l9obH8V4FR/4MKP8nwFAUaaKjiqcaM78 v5/9qjkf2jj4upCGUa+ucDrXyxX9a7jV6wGxVF881W3nbNQnKQGYFSSzvwHqDTZDtIh9 HnhjJWG9j1Num6GZOEbd039N8mIkk6+V5l9sA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; b=CSkn3xv5JOOD4CKTabTny0BhipXqKWR7T7LryPOT46YQeKKXQon0+MaLLmVnvGojzD JWBzzqbRbBsxOzc7IrEiqVWZQUIejpYoR79Srga3Urv+PfV05UGRPdGiHU1v9aLHiVn9 A0zT74bH94IGlslbGvX7bKzWaBbBUNKBN8258=
- In-reply-to: <BANLkTinUaE7S0UF67empL53Vqbs=dqA1tw@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <BANLkTinUaE7S0UF67empL53Vqbs=dqA1tw@mail.gmail.com>
Does this make it work? (and if so, why? :)
---
Src/subst.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Src/subst.c b/Src/subst.c
index 5628c11..e4cd061 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -2888,9 +2888,9 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
if (offset_hack_argzero)
alen++;
if (length_set) {
- if (length < 0)
+ if (length < (zlong)0)
length += alen - offset;
- if (length < 0) {
+ if (length < (zlong)0) {
zerr("substring expression: %d < %d",
length + offset, offset);
return NULL;
@@ -2927,20 +2927,20 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
}
given_offset = offset;
MB_METACHARINIT();
- if (length_set && length < 0)
+ if (length_set && length < (zlong)0)
length -= offset;
for (sptr = val; *sptr && offset; ) {
sptr += MB_METACHARLEN(sptr);
offset--;
}
if (length_set) {
- if (length < 0) {
+ if (length < (zlong)0) {
MB_METACHARINIT();
for (eptr = val; *eptr; ) {
eptr += MB_METACHARLEN(eptr);
length++;
}
- if (length < 0) {
+ if (length < (zlong)0) {
zerr("substring expression: %d < %d",
length + given_offset, given_offset);
return NULL;
--
Messages sorted by:
Reverse Date,
Date,
Thread,
Author