X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Fexpand.c;h=70bd86fc13e58a51c1fade5237950c57040cf419;hb=4eb9d6ef85652741d2852f89365a0af08ddc382e;hp=62e8e5747e6cf61e78e3ed9ea3c18d33c450a8f7;hpb=976b7e9fc18bab62d624acf49c6330915b875d41;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/expand.c b/src/src/expand.c index 62e8e5747..70bd86fc1 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -6217,18 +6217,25 @@ else if (value < 0 && isplus) } else { - if (tolower(*endptr) == 'k') + switch (tolower(*endptr)) { - if (value > LLONG_MAX/1024 || value < LLONG_MIN/1024) errno = ERANGE; + default: + break; + case 'k': + if (value > LLONG_MAX/1024 || value < LLONG_MIN/1024) errno = ERANGE; else value *= 1024; - endptr++; - } - else if (tolower(*endptr) == 'm') - { - if (value > LLONG_MAX/(1024*1024) || value < LLONG_MIN/(1024*1024)) - errno = ERANGE; - else value *= 1024*1024; - endptr++; + endptr++; + break; + case 'm': + if (value > LLONG_MAX/(1024*1024) || value < LLONG_MIN/(1024*1024)) errno = ERANGE; + else value *= 1024*1024; + endptr++; + break; + case 'g': + if (value > LLONG_MAX/(1024*1024*1024) || value < LLONG_MIN/(1024*1024*1024)) errno = ERANGE; + else value *= 1024*1024*1024; + endptr++; + break; } if (errno == ERANGE) msg = US"absolute value of integer \"%s\" is too large (overflow)";