OSDN Git Service

Fix ANSI build.
authorKimmo Varis <kimmov@gmail.com>
Thu, 22 Oct 2009 18:26:45 +0000 (18:26 +0000)
committerKimmo Varis <kimmov@gmail.com>
Thu, 22 Oct 2009 18:26:45 +0000 (18:26 +0000)
Src/Common/unicoder.cpp
Src/DiffWrapper.cpp
Src/FileFilterHelper.cpp
Src/FileFilterHelper.h
Src/FileFilterMgr.cpp
Src/FolderCmp.cpp

index 5a406c0..0d211d4 100644 (file)
@@ -549,7 +549,8 @@ bool maketstring(String & str, const char* lpd, unsigned int len, int codepage,
        {
                // trivial case, they want the bytes in the file interpreted in our current codepage
                // Only caveat is that input (lpd) is not zero-terminated
-               return String(lpd, len);
+               str = String(lpd, len);
+               return true;
        }
 
        str = CrossConvertToStringA(lpd, len, codepage, defcodepage, lossy);
index b033562..bf18a85 100644 (file)
@@ -138,7 +138,7 @@ void CDiffWrapper::SetCreatePatchFile(const String &filename)
        {
                m_bCreatePatchFile = TRUE;
                m_sPatchFile = filename;
-               string_replace(m_sPatchFile, L"/", L"\\");
+               string_replace(m_sPatchFile, _T("/"), _T("\\"));
        }
 }
 
index 96b8fcf..52906fd 100644 (file)
@@ -170,7 +170,7 @@ void FileFilterHelper::SetUserFilterPath(const String & filterPath)
 {
        m_sUserSelFilterPath = filterPath;
        if (filterPath[filterPath.length() - 1] != '\\')
-               m_sUserSelFilterPath += L"\\";
+               m_sUserSelFilterPath += _T("\\");
 }
 
 /** 
@@ -247,10 +247,10 @@ BOOL FileFilterHelper::includeFile(LPCTSTR szFileName)
                String strFileName = szFileName;
                strFileName = string_makelower(strFileName);
                if (strFileName[0] != '\\')
-                       strFileName = L"\\" + strFileName;
+                       strFileName = _T("\\") + strFileName;
                // append a point if there is no extension
                if (strFileName.find('.') == -1)
-                       strFileName = strFileName + L".";
+                       strFileName = strFileName + _T(".");
 
                char * name_utf = UCS2UTF8_ConvertToUtf8(strFileName.c_str());
                bool match = m_pMaskFilter->Match(name_utf);
@@ -474,8 +474,8 @@ void FileFilterHelper::LoadAllFileFilters()
        m_fileFilterMgr->DeleteAllFilters();
 
        // Program application directory
-       m_sGlobalFilterPath = GetModulePath() + L"\\Filters";
-       String pattern(L"*");
+       m_sGlobalFilterPath = GetModulePath() + _T("\\Filters");
+       String pattern(_T("*"));
        pattern += FileFilterExt;
        LoadFileFilterDirPattern(m_sGlobalFilterPath.c_str(), pattern.c_str());
        LoadFileFilterDirPattern(m_sUserSelFilterPath.c_str(), pattern.c_str());
index f078855..acd25dc 100644 (file)
@@ -35,7 +35,7 @@ struct FileFilter;
 /**
  * @brief File extension of file filter files.
  */
-const TCHAR FileFilterExt[] = L".flt";
+const TCHAR FileFilterExt[] = _T(".flt");
 
 /**
  * @brief Helper structure for UI and management of filters.
index ed9c41e..bf73e3a 100644 (file)
@@ -169,7 +169,7 @@ static void AddFilterPattern(vector<FileFilterElement*> *filterList, String & st
                regexString, sizeof(regexString));
        pcre_opts |= PCRE_UTF8;
 #else
-       strcpy(regexString, (LPCTSTR)str);
+       strcpy(regexString, str.c_str());
        regexLen = strlen(regexString);
 #endif
        pcre_opts |= PCRE_CASELESS;
index 2c049ba..9c4021f 100644 (file)
@@ -71,7 +71,7 @@ bool FolderCmp::RunPlugins(CDiffContext * pCtxt, PluginsContext * plugCtxt, Stri
        // Invoke unpacking plugins
        if (!Unpack(plugCtxt->filepathUnpacked1, filteredFilenames.c_str(), plugCtxt->infoUnpacker))
        {
-               errStr = L"Unpack Error Side 1";
+               errStr = _T("Unpack Error Side 1");
                return false;
        }
 
@@ -80,7 +80,7 @@ bool FolderCmp::RunPlugins(CDiffContext * pCtxt, PluginsContext * plugCtxt, Stri
 
        if (!Unpack(plugCtxt->filepathUnpacked2, filteredFilenames.c_str(), plugCtxt->infoUnpacker))
        {
-               errStr = L"Unpack Error Side 2";
+               errStr = _T("Unpack Error Side 2");
                return false;
        }
 
@@ -91,7 +91,7 @@ bool FolderCmp::RunPlugins(CDiffContext * pCtxt, PluginsContext * plugCtxt, Stri
        if (!m_diffFileData.OpenFiles(plugCtxt->filepathTransformed1.c_str(),
                        plugCtxt->filepathTransformed2.c_str()))
        {
-               errStr = L"OpenFiles Error (before tranform)";
+               errStr = _T("OpenFiles Error (before tranform)");
                return false;
        }
 
@@ -100,7 +100,7 @@ bool FolderCmp::RunPlugins(CDiffContext * pCtxt, PluginsContext * plugCtxt, Stri
                        plugCtxt->filepathUnpacked1, plugCtxt->filepathTransformed1,
                        filteredFilenames.c_str(), plugCtxt->infoPrediffer))
        {
-               errStr = L"Transform Error Side 1";
+               errStr = _T("Transform Error Side 1");
                return false;
        }
 
@@ -111,7 +111,7 @@ bool FolderCmp::RunPlugins(CDiffContext * pCtxt, PluginsContext * plugCtxt, Stri
                        plugCtxt->filepathUnpacked2, plugCtxt->filepathTransformed2,
                        filteredFilenames.c_str(), plugCtxt->infoPrediffer))
        {
-               errStr = L"Transform Error Side 2";
+               errStr = _T("Transform Error Side 2");
                return false;
        }
 
@@ -128,7 +128,7 @@ bool FolderCmp::RunPlugins(CDiffContext * pCtxt, PluginsContext * plugCtxt, Stri
                if (!m_diffFileData.OpenFiles(plugCtxt->filepathTransformed1.c_str(),
                                plugCtxt->filepathTransformed2.c_str()))
                {
-                       errStr = L"OpenFiles Error (after tranform)";
+                       errStr = _T("OpenFiles Error (after tranform)");
                        return false;
                }
        }
@@ -191,7 +191,7 @@ UINT FolderCmp::prepAndCompareTwoFiles(CDiffContext * pCtxt, DIFFITEM &di)
                        if (!m_diffFileData.OpenFiles(plugCtxt.origFileName1.c_str(),
                                        plugCtxt.origFileName2.c_str()))
                        {
-                               di.errorDesc = L"Error opening compared files";
+                               di.errorDesc = _T("Error opening compared files");
                                return false;
                        }
                }
@@ -244,7 +244,7 @@ UINT FolderCmp::prepAndCompareTwoFiles(CDiffContext * pCtxt, DIFFITEM &di)
                        m_ntrivialdiffs = CDiffContext::DIFFS_UNKNOWN;
                }
                if (DIFFCODE::isResultError(code))
-                       di.errorDesc = L"DiffUtils Error";
+                       di.errorDesc = _T("DiffUtils Error");
        }
        else if (nCompMethod == CMP_QUICK_CONTENT)
        {
@@ -288,7 +288,7 @@ UINT FolderCmp::prepAndCompareTwoFiles(CDiffContext * pCtxt, DIFFITEM &di)
        {
                // Print error since we should have handled by date compare earlier
                _RPTF0(_CRT_ERROR, "Invalid compare type, DiffFileData can't handle it");
-               di.errorDesc = L"Bad compare type";
+               di.errorDesc = _T("Bad compare type");
        }
 
        m_diffFileData.Reset();