Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

30276: Src/glob.c: Use zlong rather than int when calculating brace e…

…xpansions of the form {1..9}.
  • Loading branch information...
commit 47a48ced0e498e6e90671045617a2152c0d9ae7a 1 parent 6f93994
Mikachu Mikachu authored
Showing with 10 additions and 4 deletions.
  1. +6 −1 ChangeLog
  2. +4 −3 Src/glob.c
7 ChangeLog
View
@@ -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 $
*****************************************************
7 Src/glob.c
View
@@ -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. */
Please sign in to comment.
Something went wrong with that request. Please try again.