This commit refines the logic for main(). It makes the logic more
straightforward to prevent possible mis-reports by static code
checkers.

Cc: Liming Gao <[email protected]>
Cc: Yonghong Zhu <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <[email protected]>
---
 BaseTools/Source/C/EfiRom/EfiRom.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Source/C/EfiRom/EfiRom.c 
b/BaseTools/Source/C/EfiRom/EfiRom.c
index 0f89280251..6648f4c738 100644
--- a/BaseTools/Source/C/EfiRom/EfiRom.c
+++ b/BaseTools/Source/C/EfiRom/EfiRom.c
@@ -101,11 +101,13 @@ Returns:
       // Find the last . on the line and replace the filename extension with
       // the default
       //
-      for (Ext = mOptions.OutFileName + strlen (mOptions.OutFileName) - 1;
-           (Ext >= mOptions.OutFileName) && (*Ext != '.') && (*Ext != '\\');
-           Ext--
-          )
-        ;
+      Ext = mOptions.OutFileName + strlen (mOptions.OutFileName) - 1;
+      while (Ext >= mOptions.OutFileName) {
+        if ((*Ext == '.') || (*Ext == '\\')) {
+          break;
+        }
+        Ext--;
+      }
       //
       // If dot here, then insert extension here, otherwise append
       //
-- 
2.12.0.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to