]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/EfiRom: Refine the logic in main()
authorHao Wu <hao.a.wu@intel.com>
Thu, 30 Nov 2017 06:42:05 +0000 (14:42 +0800)
committerHao Wu <hao.a.wu@intel.com>
Mon, 25 Dec 2017 01:53:37 +0000 (09:53 +0800)
This commit refines the logic for main(). It makes the logic more
straightforward to prevent possible mis-reports by static code
checkers.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/C/EfiRom/EfiRom.c

index 0f8928025119a8f9fbbfc3b98d1de02fa77b83e3..6648f4c738f69e5914ee2c4ec7203453f032787e 100644 (file)
@@ -101,11 +101,13 @@ Returns:
       // Find the last . on the line and replace the filename extension with\r
       // the default\r
       //\r
-      for (Ext = mOptions.OutFileName + strlen (mOptions.OutFileName) - 1;\r
-           (Ext >= mOptions.OutFileName) && (*Ext != '.') && (*Ext != '\\');\r
-           Ext--\r
-          )\r
-        ;\r
+      Ext = mOptions.OutFileName + strlen (mOptions.OutFileName) - 1;\r
+      while (Ext >= mOptions.OutFileName) {\r
+        if ((*Ext == '.') || (*Ext == '\\')) {\r
+          break;\r
+        }\r
+        Ext--;\r
+      }\r
       //\r
       // If dot here, then insert extension here, otherwise append\r
       //\r