From: Yann Collet Date: Tue, 18 Oct 2016 00:48:48 +0000 (-0700) Subject: fix command line interpretation X-Git-Tag: v1.1.1~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33fdd099bbaef46d4a0c94783cca21649824b2fc;p=thirdparty%2Fzstd.git fix command line interpretation --- diff --git a/programs/zstdcli.c b/programs/zstdcli.c index 2df410431..9aa97cdd2 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -25,7 +25,6 @@ **************************************/ #include "util.h" /* Compiler options, UTIL_HAS_CREATEFILELIST */ #include /* strcmp, strlen */ -#include /* toupper */ #include /* errno */ #include "fileio.h" #ifndef ZSTD_NOBENCH @@ -182,10 +181,13 @@ static unsigned readU32FromChar(const char** stringPtr) unsigned result = 0; while ((**stringPtr >='0') && (**stringPtr <='9')) result *= 10, result += **stringPtr - '0', (*stringPtr)++ ; - if (toupper(**stringPtr)=='K') result <<= 10, (*stringPtr)++ ; - else if (toupper(**stringPtr)=='M') result <<= 20, (*stringPtr)++ ; - if (toupper(**stringPtr)=='i') (*stringPtr)++; - if (toupper(**stringPtr)=='B') (*stringPtr)++; + if ((**stringPtr=='K') || (**stringPtr=='M')) { + result <<= 10; + if (**stringPtr=='M') result <<= 10; + (*stringPtr)++ ; + if (**stringPtr=='i') (*stringPtr)++; + if (**stringPtr=='B') (*stringPtr)++; + } return result; }