]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
minor presentation refactoring
authorYann Collet <cyan@fb.com>
Wed, 10 Apr 2019 17:03:06 +0000 (10:03 -0700)
committerYann Collet <cyan@fb.com>
Wed, 10 Apr 2019 17:03:06 +0000 (10:03 -0700)
and removed some // comment style

programs/zstdcli.c

index ef2fe2e91c7a53b75046c823bc463a7ac6279c4b..f4452636bac82d13380cdefe8e85c5c70f77ba86 100644 (file)
@@ -241,18 +241,20 @@ static void errorOut(const char* msg)
  * @return 1 if an overflow error occurs */
 static int readU32FromCharChecked(const char** stringPtr, unsigned* value)
 {
-    static unsigned const max = (((unsigned)(-1)) / 10) - 1;
     unsigned result = 0;
     while ((**stringPtr >='0') && (**stringPtr <='9')) {
-        if (result > max) return 1; // overflow error
-        result *= 10, result += **stringPtr - '0', (*stringPtr)++ ;
+        unsigned const max = (((unsigned)(-1)) / 10) - 1;
+        if (result > max) return 1; /* overflow error */
+        result *= 10;
+        result += (unsigned)(**stringPtr - '0');
+        (*stringPtr)++ ;
     }
     if ((**stringPtr=='K') || (**stringPtr=='M')) {
         unsigned const maxK = ((unsigned)(-1)) >> 10;
-        if (result > maxK) return 1; // overflow error
+        if (result > maxK) return 1; /* overflow error */
         result <<= 10;
         if (**stringPtr=='M') {
-            if (result > maxK) return 1; // overflow error
+            if (result > maxK) return 1; /* overflow error */
             result <<= 10;
         }
         (*stringPtr)++;  /* skip `K` or `M` */
@@ -483,7 +485,7 @@ static int init_cLevel(void) {
 
         if ((*ptr>='0') && (*ptr<='9')) {
             unsigned absLevel;
-            if (readU32FromCharChecked(&ptr, &absLevel)) { 
+            if (readU32FromCharChecked(&ptr, &absLevel)) {
                 DISPLAYLEVEL(2, "Ignore environment variable setting %s=%s: numeric value too large\n", ENV_CLEVEL, env);
                 return ZSTDCLI_CLEVEL_DEFAULT;
             } else if (*ptr == 0) {