summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/C/EfiRom/EfiRom.c
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2017-11-30 14:42:05 +0800
committerHao Wu <hao.a.wu@intel.com>2017-12-25 09:53:37 +0800
commit31c295e71aafed85c75a772dabf6e5e09d2f4a60 (patch)
tree96786ca2a1e768d77fb9ac1477f206ca6ed70274 /BaseTools/Source/C/EfiRom/EfiRom.c
parent58356e9478d62811746db283bce3e751c6206006 (diff)
downloadedk2-31c295e71aafed85c75a772dabf6e5e09d2f4a60.tar.gz
edk2-31c295e71aafed85c75a772dabf6e5e09d2f4a60.tar.bz2
edk2-31c295e71aafed85c75a772dabf6e5e09d2f4a60.zip
BaseTools/EfiRom: Refine the logic in main()
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>
Diffstat (limited to 'BaseTools/Source/C/EfiRom/EfiRom.c')
-rw-r--r--BaseTools/Source/C/EfiRom/EfiRom.c12
1 files 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
//