about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2012-02-29 17:06:07 +0000
committerMikael Magnusson <mikachu@gmail.com>2012-02-29 17:06:07 +0000
commit47a48ced0e498e6e90671045617a2152c0d9ae7a (patch)
tree2eb6081fbd93820e25b81b61f7f7f67ee72409ac
parent6f93994a5aeb3a8290153ec159af35bbd96a6673 (diff)
downloadzsh-47a48ced0e498e6e90671045617a2152c0d9ae7a.tar.gz
zsh-47a48ced0e498e6e90671045617a2152c0d9ae7a.tar.xz
zsh-47a48ced0e498e6e90671045617a2152c0d9ae7a.zip
30276: Src/glob.c: Use zlong rather than int when calculating brace expansions of the form {1..9}.
-rw-r--r--ChangeLog7
-rw-r--r--Src/glob.c7
2 files changed, 10 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index b1d8ce9d4..5f34246b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-02-29  Mikael Magnusson  <mikachu@gmail.com>
+
+	* 30276: Src/glob.c: Use zlong rather than int when calculating
+	brace expansions of the form {1..9}.
+
 2012-02-29  Peter Stephenson  <pws@csr.com>
 
 	* 30299: Src/subst.c, Test/D04parameter.ztst: "$*" was split
@@ -16025,5 +16030,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5597 $
+* $Revision: 1.5598 $
 *****************************************************
diff --git a/Src/glob.c b/Src/glob.c
index d003d95da..55983815f 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -2089,7 +2089,8 @@ xpandbraces(LinkList list, LinkNode *np)
 	char *dots, *p, *dots2 = NULL;
 	LinkNode olast = last;
 	/* Get the first number of the range */
-	int rstart = zstrtol(str+1,&dots,10), rend = 0, err = 0, rev = 0, rincr = 1;
+	zlong rstart = zstrtol(str+1,&dots,10), rend = 0;
+	int err = 0, rev = 0, rincr = 1;
 	int wid1 = (dots - str) - 1, wid2 = (str2 - dots) - 2, wid3 = 0;
 	int strp = str - str3;
 
@@ -2134,7 +2135,7 @@ xpandbraces(LinkList list, LinkNode *np)
 	    }
 	    if (rstart > rend) {
 		/* Handle decreasing ranges correctly. */
-		int rt = rend;
+		zlong rt = rend;
 		rend = rstart;
 		rstart = rt;
 		rev = !rev;
@@ -2147,7 +2148,7 @@ xpandbraces(LinkList list, LinkNode *np)
 	    for (; rend >= rstart; rend -= rincr) {
 		/* Node added in at end, so do highest first */
 		p = dupstring(str3);
-		sprintf(p + strp, "%0*d", minw, rend);
+		sprintf(p + strp, "%0*ld", minw, (long)rend);
 		strcat(p + strp, str2 + 1);
 		insertlinknode(list, last, p);
 		if (rev)	/* decreasing:  add in reverse order. */