zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: zsh-workers@zsh.org
Subject: Re: Test failure with negative substring offsets
Date: Mon, 23 May 2011 17:52:03 +0200	[thread overview]
Message-ID: <1306165923-21449-1-git-send-email-mikachu@gmail.com> (raw)
In-Reply-To: <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;

--


  reply	other threads:[~2011-05-23 15:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 15:10 Peter Stephenson
2011-05-23 15:24 ` Mikael Magnusson
2011-05-23 15:41   ` İsmail Dönmez
2011-05-23 15:52     ` Mikael Magnusson [this message]
2011-05-23 15:58       ` Bart Schaefer
2011-05-23 16:00         ` Mikael Magnusson
2011-05-23 15:56     ` Peter Stephenson
2011-05-23 16:08       ` Peter Stephenson
2011-05-23 16:10       ` Bart Schaefer
2011-05-23 16:16         ` Peter Stephenson
2011-05-23 16:19         ` Mikael Magnusson
2011-05-23 16:27           ` Peter Stephenson
2011-05-23 16:34             ` Mikael Magnusson
2011-05-23 16:40               ` Peter Stephenson
2011-05-23 16:52                 ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1306165923-21449-1-git-send-email-mikachu@gmail.com \
    --to=mikachu@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).