]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/LzmaCompress: Fix the option "d" dictionary size
authorZhang, Shenglei <shenglei.zhang@intel.com>
Mon, 30 Sep 2019 03:52:28 +0000 (11:52 +0800)
committerLiming Gao <liming.gao@intel.com>
Mon, 30 Sep 2019 07:04:08 +0000 (15:04 +0800)
The range of dictionary size is set from [0,30] to [0,27].
And update the help information for this.
The previous logic for processing the parameter dict size is incorrect.
Now fix the logic.
The option "d" is added at 6b80310f34199d1f62e45e40fa902734735091fa.
(https://bugzilla.tianocore.org/show_bug.cgi?id=2077)

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/C/LzmaCompress/LzmaCompress.c

index 856fcf9ffb17bacce3143840a6f3ecdd9ebf218d..bebdb9aa84a15da524443b13b63dc5aede6dbd56 100644 (file)
@@ -42,7 +42,7 @@ const char *kInvalidParamValMessage = "Invalid parameter value";
 static Bool mQuietMode = False;\r
 static CONVERTER_TYPE mConType = NoConverter;\r
 \r
-UINT64 mDictionarySize = 31;\r
+UINT64 mDictionarySize = 28;\r
 UINT64 mCompressionMode = 2;\r
 \r
 #define UTILITY_NAME "LzmaCompress"\r
@@ -64,7 +64,7 @@ void PrintHelp(char *buffer)
              "  -q, --quiet: reduce output messages\n"\r
              "  --debug [0-9]: set debug level\n"\r
              "  -a: set compression mode 0 = fast, 1 = normal, default: 1 (normal)\n"\r
-             "  d: sets Dictionary size - [0, 30], default: 23 (8MB)\n"\r
+             "  d: sets Dictionary size - [0, 27], default: 24 (16MB)\n"\r
              "  --version: display the program version and exit\n"\r
              "  -h, --help: display this help text\n"\r
              );\r
@@ -298,8 +298,12 @@ int main2(int numArgs, const char *args[], char *rs)
       }\r
     } else if (strcmp(args[param], "d") == 0) {\r
       AsciiStringToUint64(args[param + 1],FALSE,&mDictionarySize);\r
-      if (mDictionarySize <= 30){\r
-        props.dictSize = (UINT32)mDictionarySize;\r
+      if (mDictionarySize <= 27) {\r
+        if (mDictionarySize == 0) {\r
+          props.dictSize = 0;\r
+        } else {\r
+          props.dictSize = (1 << mDictionarySize);\r
+        }\r
         param++;\r
         continue;\r
       } else {\r