1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-15 02:11:07 +02:00

Fix two bugs in typeset_setbase

This commit is contained in:
Mikael Magnusson 2015-05-03 22:34:23 +02:00
parent 5b00bfecac
commit 1e6fb1a4f0
2 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,7 @@
2015-05-04 Mikael Magnusson <mikachu@gmail.com>
* 35021: Src/builtin.c: Fix two bugs in typeset_setbase
2015-05-03 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 35018 (corrected): NEWS: news.

View file

@ -1868,7 +1868,7 @@ typeset_setbase(const char *name, Param pm, Options ops, int on, int always)
if (arg) {
char *eptr;
pm->base = (int)zstrtol(arg, &eptr, 10);
int base = (int)zstrtol(arg, &eptr, 10);
if (*eptr) {
if (on & PM_INTEGER)
zwarnnam(name, "bad base value: %s", arg);
@ -1876,11 +1876,12 @@ typeset_setbase(const char *name, Param pm, Options ops, int on, int always)
zwarnnam(name, "bad precision value: %s", arg);
return 1;
}
if (pm->base < 2 || pm->base > 36) {
if ((on & PM_INTEGER) && (base < 2 || base > 36)) {
zwarnnam(name, "invalid base (must be 2 to 36 inclusive): %d",
pm->base);
base);
return 1;
}
pm->base = base;
} else if (always)
pm->base = 0;