OSDN Git Service

Reduce direct use of Win32API
authorsdottaka <none@none>
Fri, 28 Jun 2013 14:40:03 +0000 (23:40 +0900)
committersdottaka <none@none>
Fri, 28 Jun 2013 14:40:03 +0000 (23:40 +0900)
Src/DirActions.cpp
Src/DirDoc.cpp

index 73b3aa6..450b1f8 100644 (file)
@@ -1311,7 +1311,7 @@ bool CDirView::AreItemsOpenable(const DIFFITEM & di1, const DIFFITEM & di2, cons
        // Allow to compare items if left & right path refer to same directory
        // (which means there is effectively two files involved). No need to check
        // side flags. If files weren't on both sides, we'd have no DIFFITEMs.
-       if (lstrcmpi(sLeftBasePath.c_str(), sMiddleBasePath.c_str()) == 0 && lstrcmpi(sLeftBasePath.c_str(), sRightBasePath.c_str()) == 0)
+       if (string_compare_nocase(sLeftBasePath, sMiddleBasePath) == 0 && string_compare_nocase(sLeftBasePath, sRightBasePath) == 0)
                return true;
 
        return false;
index a330fbb..10f87c6 100644 (file)
@@ -29,7 +29,6 @@
 //
 
 #include "StdAfx.h"
-#include <shlwapi.h>           // PathFindFileName()
 #include <Poco/StringTokenizer.h>
 #include "Merge.h"
 #include "HexMergeDoc.h"
@@ -232,9 +231,9 @@ CDirDoc::AllowUpwardDirectory(PathContext &pathsParent)
        // If we have temp context it means we are comparing archives
        if (IsArchiveFolders())
        {
-               LPCTSTR name0 = PathFindFileName(path0.c_str());
-               LPCTSTR name1 = PathFindFileName(path1.c_str());
-               LPCTSTR name2 = (m_nDirs > 2) ? PathFindFileName(path2.c_str()) : NULL;
+               String name0 = paths_FindFileName(path0);
+               String name1 = paths_FindFileName(path1);
+               String name2 = (m_nDirs > 2) ? paths_FindFileName(path2) : _T("");
 
                /* FIXME: for 3way diff*/
                String::size_type cchLeftRoot = m_pTempPathContext->m_strRoot[0].length();
@@ -253,14 +252,14 @@ CDirDoc::AllowUpwardDirectory(PathContext &pathsParent)
                        pathsParent[1] = m_pTempPathContext->m_strDisplayRoot[1];
                        if (!m_pCtxt->m_piFilterGlobal->includeFile(pathsParent[0].c_str(), pathsParent[1].c_str()))
                                return AllowUpwardDirectory::Never;
-                       if (lstrcmpi(name0, _T("ORIGINAL")) == 0 && lstrcmpi(name1, _T("ALTERED")) == 0)
+                       if (string_compare_nocase(name0, _T("ORIGINAL")) == 0 && string_compare_nocase(name1, _T("ALTERED")) == 0)
                        {
                                pathsParent[0] = paths_GetParentPath(pathsParent[0]);
                                pathsParent[1] = paths_GetParentPath(pathsParent[1]);
                        }
-                       name0 = PathFindFileName(pathsParent[0].c_str());
-                       name1 = PathFindFileName(pathsParent[1].c_str());
-                       if (lstrcmpi(name0, name1) == 0)
+                       name0 = paths_FindFileName(pathsParent[0]);
+                       name1 = paths_FindFileName(pathsParent[1]);
+                       if (string_compare_nocase(name0, name1) == 0)
                        {
                                pathsParent[0] = paths_GetParentPath(pathsParent[0]);
                                pathsParent[1] = paths_GetParentPath(pathsParent[1]);
@@ -1104,7 +1103,7 @@ void CDirDoc::SetTitle(LPCTSTR lpszTitle)
                {
                        String strPath = m_pCtxt->GetPath(index);
                        ApplyDisplayRoot(index, strPath);
-                       sDirName[index] = PathFindFileName(strPath.c_str());
+                       sDirName[index] = paths_FindFileName(strPath);
                }
                if (m_nDirs < 3)
                {