OSDN Git Service

Compiler warnings removal Numerous tweaks to remove compiler warnings where solution...
authorColin Law <colin@clanlaw.org.uk>
Thu, 22 Jan 2009 16:30:56 +0000 (16:30 +0000)
committerFrank Li <lznuaa@gmail.com>
Fri, 23 Jan 2009 02:47:58 +0000 (10:47 +0800)
17 files changed:
ext/hunspell/hunspell.vcproj
ext/scintilla/vcbuild/SciLexer.vcproj
src/Git/Git.cpp
src/Git/GitAdminDir.cpp
src/Git/GitStatus.cpp
src/TortoiseGitBlame/PropertiesWnd.cpp
src/TortoiseGitBlame/TortoiseGitBlameView.cpp
src/TortoiseProc/Commands/PrevDiffCommand.cpp
src/TortoiseProc/ExportDlg.cpp
src/TortoiseProc/GitLogListBase.cpp
src/TortoiseProc/ImportPatchDlg.cpp
src/TortoiseProc/LogDataVector.cpp
src/TortoiseProc/LogDlg.cpp
src/TortoiseProc/PullFetchDlg.cpp
src/TortoiseProc/PushDlg.cpp
src/TortoiseProc/lanes.cpp
src/Utils/MiscUI/HistoryCombo.cpp

index e9f3fe0..0d76867 100644 (file)
@@ -56,6 +56,7 @@
                                ObjectFile="$(IntDir)\"\r
                                WarningLevel="3"\r
                                SuppressStartupBanner="true"\r
+                               DisableSpecificWarnings="4996"\r
                        />\r
                        <Tool\r
                                Name="VCManagedResourceCompilerTool"\r
                                WarningLevel="3"\r
                                SuppressStartupBanner="true"\r
                                DebugInformationFormat="4"\r
+                               DisableSpecificWarnings="4996"\r
                        />\r
                        <Tool\r
                                Name="VCManagedResourceCompilerTool"\r
index 5dfa715..eadfbef 100644 (file)
@@ -62,6 +62,7 @@
                                WarningLevel="4"\r
                                SuppressStartupBanner="true"\r
                                DebugInformationFormat="4"\r
+                               DisableSpecificWarnings="4996"\r
                        />\r
                        <Tool\r
                                Name="VCManagedResourceCompilerTool"\r
index c2afaaf..208ec43 100644 (file)
@@ -329,8 +329,6 @@ CString GetTempFile()
 \r
 int CGit::RunLogFile(CString cmd,CString &filename)\r
 {\r
-       HANDLE hRead, hWrite;\r
-\r
        STARTUPINFO si;\r
        PROCESS_INFORMATION pi;\r
        si.cb=sizeof(STARTUPINFO);\r
index 1f6ddcc..d050f77 100644 (file)
@@ -88,7 +88,6 @@ bool GitAdminDir::HasAdminDir(const CString& path) const
 \r
 bool GitAdminDir::HasAdminDir(const CString& path,CString *ProjectTopDir) const\r
 {\r
-       bool b=PathIsDirectory(path);\r
        return HasAdminDir(path, !!PathIsDirectory(path),ProjectTopDir);\r
 }\r
 \r
index 0deea23..8e7ae07 100644 (file)
@@ -189,7 +189,7 @@ stdstring GitStatus::GetLastErrorMsg() const
 // static method\r
 git_wc_status_kind GitStatus::GetAllStatus(const CTGitPath& path, git_depth_t depth)\r
 {\r
-       git_wc_status_kind                      statuskind;\r
+       git_wc_status_kind                      statuskind = git_wc_status_none;\r
 #if 0\r
        git_client_ctx_t *                      ctx;\r
        \r
@@ -208,7 +208,6 @@ git_wc_status_kind GitStatus::GetAllStatus(const CTGitPath& path, git_depth_t de
        git_revnum_t youngest = Git_INVALID_REVNUM;\r
        git_opt_revision_t rev;\r
        rev.kind = git_opt_revision_unspecified;\r
-       statuskind = git_wc_status_none;\r
        err = git_client_status4 (&youngest,\r
                                                        path.GetGitApiPath(pool),\r
                                                        &rev,\r
index cb56cc4..f6c30d7 100644 (file)
@@ -368,7 +368,7 @@ void CPropertiesWnd::UpdateProperties(GitRev *rev)
        \r
                CLogDataVector          *pLogEntry = &((CMainFrame*)AfxGetApp()->GetMainWnd())->m_wndOutput.m_LogList.m_logEntries;\r
 \r
-               for(int i=0;i<rev->m_ParentHash.size();i++)\r
+               for(unsigned int i=0;i<rev->m_ParentHash.size();i++)\r
                {\r
                        CString str;\r
                        CString parentsubject;\r
index 4653405..87a3b8a 100644 (file)
@@ -657,7 +657,7 @@ bool CTortoiseGitBlameView::DoSearch(CString what, DWORD flags)
                delete [] linebuf;\r
 \r
                i++;\r
-               if(i>=m_CommitHash.size())\r
+               if(i>=(signed int)m_CommitHash.size())\r
                        i=0;\r
        }while(i!=line &&(!bFound));\r
 \r
@@ -964,7 +964,7 @@ LONG CTortoiseGitBlameView::GetBlameWidth()
        //blamewidth += m_revwidth;\r
 \r
        int maxnum=0;\r
-       for (int i=0;i<this->m_Authors.size();i++)\r
+       for (unsigned int i=0;i<this->m_Authors.size();i++)\r
        {\r
                if(m_ID[i]>maxnum)\r
                        maxnum=m_ID[i];\r
@@ -992,7 +992,7 @@ LONG CTortoiseGitBlameView::GetBlameWidth()
        {\r
                SIZE maxwidth = {0};\r
 \r
-               for (int i=0;i<this->m_Authors.size();i++)\r
+               for (unsigned int i=0;i<this->m_Authors.size();i++)\r
                //for (std::vector<CString>::iterator I = authors.begin(); I != authors.end(); ++I)\r
                {\r
                        ::GetTextExtentPoint32(hDC,m_Authors[i] , m_Authors[i].GetLength(), &width);\r
@@ -2435,7 +2435,7 @@ void CTortoiseGitBlameView::UpdateInfo()
                        line=one.Right(one.GetLength()-start-2);\r
                        this->m_TextView.InsertText(line,true);\r
                }\r
-               int id=pRevs->m_HashMap[one.Left(40)];          \r
+               unsigned int id=pRevs->m_HashMap[one.Left(40)];         \r
                if(id>=0 && id <GetLogData()->size())\r
                {\r
                        m_ID.push_back(pRevs->size()-id);\r
index 28ddea6..4a35ea4 100644 (file)
@@ -60,7 +60,7 @@ bool PrevDiffCommand::Execute()
                        if( revs.size() == 1 )\r
                        {\r
                                CGitDiff diff;\r
-                               bRet = diff.DiffNull(&cmdLinePath,revs[0].m_CommitHash);\r
+                               bRet = (diff.DiffNull(&cmdLinePath,revs[0].m_CommitHash) != 0);\r
                        }\r
 \r
                        if( revs.size() == 2 )\r
index 5adb368..97330a0 100644 (file)
@@ -116,7 +116,6 @@ void CExportDlg::OnOK()
                return;\r
        }\r
 \r
-       bool bAutoCreateTargetName = m_bAutoCreateTargetName;\r
        m_bAutoCreateTargetName = false;\r
 \r
 //     m_URLCombo.SaveHistory();\r
index 3a2f1fa..09a4e3e 100644 (file)
@@ -382,7 +382,7 @@ void CGitLogListBase::DrawTagBranch(HDC hdc,CRect &rect,INT_PTR index)
        rItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED;\r
        GetItem(&rItem);\r
 \r
-       for(int i=0;i<m_HashMap[data->m_CommitHash].size();i++)\r
+       for(unsigned int i=0;i<m_HashMap[data->m_CommitHash].size();i++)\r
        {\r
                CString str;\r
                str=m_HashMap[data->m_CommitHash][i];\r
@@ -1329,7 +1329,7 @@ int CGitLogListBase::FillGitLog(CTGitPath *path,int info)
 \r
        this->m_arShownList.RemoveAll();\r
 \r
-       for(int i=0;i<m_logEntries.size();i++)\r
+       for(unsigned int i=0;i<m_logEntries.size();i++)\r
        {\r
                m_logEntries[i].m_IsFull=TRUE;\r
                this->m_arShownList.Add(&m_logEntries[i]);\r
@@ -1366,7 +1366,7 @@ int CGitLogListBase::FillGitShortLog()
 \r
        this->m_arShownList.RemoveAll();\r
 \r
-       for(int i=0;i<m_logEntries.size();i++)\r
+       for(unsigned int i=0;i<m_logEntries.size();i++)\r
                this->m_arShownList.Add(&m_logEntries[i]);\r
 \r
        return 0;\r
@@ -1446,7 +1446,7 @@ void CGitLogListBase::GetTimeRange(CTime &oldest, CTime &latest)
        //CTime time;\r
        oldest=CTime::GetCurrentTime();\r
        latest=CTime(1971,1,2,0,0,0);\r
-       for(int i=0;i<m_logEntries.size();i++)\r
+       for(unsigned int i=0;i<m_logEntries.size();i++)\r
        {\r
                if(m_logEntries[i].m_AuthorDate.GetTime() < oldest.GetTime())\r
                        oldest = m_logEntries[i].m_AuthorDate.GetTime();\r
@@ -1506,11 +1506,11 @@ UINT CGitLogListBase::LogThread()
        InterlockedExchange(&m_bNoDispUpdates, FALSE);\r
 \r
        int index=0;\r
-       int updated=0;\r
+       unsigned int updated=0;\r
        int percent=0;\r
        while(1)\r
        {\r
-               for(int i=0;i<m_logEntries.size();i++)\r
+               for(unsigned int i=0;i<m_logEntries.size();i++)\r
                {\r
                        if(!m_logEntries.FetchFullInfo(i))\r
                        {\r
index 8503a3a..e987d4f 100644 (file)
@@ -145,8 +145,6 @@ void CImportPatchDlg::OnBnClickedButtonRemove()
 \r
 void CImportPatchDlg::OnBnClickedOk()\r
 {\r
-       // TODO: Add your control notification handler code here\r
-       int i;\r
        for(int i=0;i<m_cList.GetItemCount();i++)\r
        {\r
                CTGitPath path;\r
index 095d55a..06db57f 100644 (file)
@@ -191,7 +191,7 @@ void CLogDataVector::updateLanes(GitRev& c, Lanes& lns, CString &sha)
        if (isDiscontinuity)
                lns.changeActiveLane(sha); // uses previous isBoundary state
 
-       lns.setBoundary(c.IsBoundary()); // update must be here
+       lns.setBoundary(c.IsBoundary() == TRUE); // update must be here
        TRACE(_T("%s %d"),c.m_CommitHash,c.IsBoundary());
 
        if (isFork)
index 4eec793..bcd8d73 100644 (file)
@@ -2799,7 +2799,7 @@ void CLogDlg::UpdateLogInfoLabel()
 \r
        git_revnum_t rev1 ;\r
        git_revnum_t rev2 ;\r
-       long selectedrevs ;\r
+       long selectedrevs = 0;\r
        int count =m_LogList.m_arShownList.GetCount();\r
        if (count)\r
        {\r
index 1267a00..ff2b2f3 100644 (file)
@@ -68,7 +68,7 @@ BOOL CPullFetchDlg::OnInitDialog()
 \r
        if(!g_Git.GetRemoteList(list))\r
        {       \r
-               for(int i=0;i<list.size();i++)\r
+               for(unsigned int i=0;i<list.size();i++)\r
                        m_Remote.AddString(list[i]);\r
        }\r
 \r
index fc10f83..66e5b1f 100644 (file)
@@ -71,14 +71,14 @@ BOOL CPushDlg::OnInitDialog()
 \r
        if(!g_Git.GetRemoteList(list))\r
        {       \r
-               for(int i=0;i<list.size();i++)\r
+               for(unsigned int i=0;i<list.size();i++)\r
                        m_Remote.AddString(list[i]);\r
        }\r
 \r
        int current=0;\r
        if(!g_Git.GetBranchList(list,&current))\r
        {\r
-               for(int i=0;i<list.size();i++)\r
+               for(unsigned int i=0;i<list.size();i++)\r
                        m_BranchSource.AddString(list[i]);\r
        }\r
        m_BranchSource.SetCurSel(current);\r
index 585590d..a1d5425 100644 (file)
@@ -204,7 +204,7 @@ void Lanes::afterMerge() {
        if (boundary)
                return; // will be reset by changeActiveLane()
 
-       for (int i = 0; i < typeVec.size(); i++) {
+       for (unsigned int i = 0; i < typeVec.size(); i++) {
 
                int& t = typeVec[i];
 
@@ -221,7 +221,7 @@ void Lanes::afterMerge() {
 
 void Lanes::afterFork() {
 
-       for (int i = 0; i < typeVec.size(); i++) {
+       for (unsigned int i = 0; i < typeVec.size(); i++) {
 
                int& t = typeVec[i];
 
@@ -262,7 +262,7 @@ void Lanes::nextParent(const QString& sha) {
 
 int Lanes::findNextSha(const QString& next, int pos) {
 
-       for (int i = pos; i < nextShaVec.size(); i++)
+       for (unsigned int i = pos; i < nextShaVec.size(); i++)
                if (nextShaVec[i] == next)
                        return i;
        return -1;
@@ -270,7 +270,7 @@ int Lanes::findNextSha(const QString& next, int pos) {
 
 int Lanes::findType(int type, int pos) {
 
-       for (int i = pos; i < typeVec.size(); i++)
+       for (unsigned int i = pos; i < typeVec.size(); i++)
                if (typeVec[i] == type)
                        return i;
        return -1;
index e15f7e0..482b280 100644 (file)
@@ -317,7 +317,7 @@ void CHistoryCombo::SetMaxHistoryItems(int nMaxItems)
 }\r
 void CHistoryCombo::AddString(STRING_VECTOR &list)\r
 {\r
-       for(int i=0;i<list.size();i++)\r
+       for(unsigned int i=0;i<list.size();i++)\r
        {\r
                AddString(list[i]);\r
        }\r