Author: hpoussin Date: Sat Jul 1 01:54:25 2006 New Revision: 22731
URL: http://svn.reactos.org/svn/reactos?rev=22731&view=rev Log: - Simplify GetFileExt
Modified: trunk/reactos/dll/win32/newdev/newdev.c
Modified: trunk/reactos/dll/win32/newdev/newdev.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/newdev/newdev.c?r... ============================================================================== --- trunk/reactos/dll/win32/newdev/newdev.c (original) +++ trunk/reactos/dll/win32/newdev/newdev.c Sat Jul 1 01:54:25 2006 @@ -325,22 +325,16 @@ return TRUE; }
-static LPTSTR +static LPCTSTR GetFileExt(IN LPTSTR FileName) { - if (FileName == 0) + LPCTSTR Dot; + + Dot = _tcsrchr(FileName, _T('.')); + if (!Dot) return _T("");
- int i = _tcsclen(FileName); - while ((i >= 0) && (FileName[i] != _T('.'))) - i--; - - FileName = _tcslwr(FileName); - - if (i >= 0) - return &FileName[i]; - else - return _T(""); + return Dot; }
static BOOL @@ -390,7 +384,7 @@ { LPCTSTR pszExtension = GetFileExt(FileName);
- if ((_tcscmp(pszExtension, _T(".inf")) == 0) && (_tcscmp(LastDirPath, DirPath) != 0)) + if ((_tcsicmp(pszExtension, _T(".inf")) == 0) && (_tcscmp(LastDirPath, DirPath) != 0)) { _tcscpy(LastDirPath, DirPath);