Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

fogcreek shellext: renamed local variables for consistency, part 2

Changeset 03316fb2ce1d

Parent 2464ea0f16e1

by David Golub

Changes to 18 files · Browse files at 03316fb2ce1d Showing diff from parent 2464ea0f16e1 Diff from another changeset...

 
46
47
48
49
50
51
 
 
 
52
53
 
54
55
56
 
57
58
59
 
82
83
84
85
 
86
87
88
 
92
93
94
95
96
97
 
 
 
98
99
100
 
101
102
103
 
104
105
106
 
119
120
121
122
 
123
124
125
 
 
126
127
 
128
129
130
131
 
132
133
134
 
46
47
48
 
 
 
49
50
51
52
 
53
54
55
 
56
57
58
59
 
82
83
84
 
85
86
87
88
 
92
93
94
 
 
 
95
96
97
98
99
 
100
101
102
 
103
104
105
106
 
119
120
121
 
122
123
 
 
124
125
126
 
127
128
129
130
 
131
132
133
134
@@ -46,14 +46,14 @@
    InitMenuMaps(CDndMenuDescList, sizeof(CDndMenuDescList) / sizeof(CMenuDescription));   - const char* entries_string = DropMenu; - CAtlList<CString> entries; - Tokenize(entries_string, entries, " "); + LPCTSTR lpszEntries = DropMenu; + CAtlList<CString> listEntries; + Tokenize(lpszEntries, listEntries, " ");   - POSITION position = entries.GetHeadPosition(); + POSITION position = listEntries.GetHeadPosition();   while (position != NULL)   { - CString strName = entries.GetNext(position); + CString strName = listEntries.GetNext(position);   if (strName.IsEmpty())   break;   InsertMenuItemByName(hMenu, strName, indexMenu++, idCmd++, idCmdFirst, L""); @@ -82,7 +82,7 @@
 STDMETHODIMP CTortoiseHgDropHandler::Initialize(   LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hRegKey)  { - TCHAR name[MAX_PATH+1]; + TCHAR szName[MAX_PATH+1];     PrintDebugHeader(pIDFolder, pDataObj);   @@ -92,15 +92,15 @@
  // if a directory background   if (pIDFolder)   { - SHGetPathFromIDList(pIDFolder, name); - ATLTRACE(" Folder '%s'\n", name); - m_strFolder = name; + SHGetPathFromIDList(pIDFolder, szName); + ATLTRACE(" Folder '%s'\n", szName); + m_strFolder = szName;   }   - CString root; + CString strRoot;     //short circuit if we're dragging into a non-Hg repository - if (m_strFolder.IsEmpty() || (root = GetHgRepoRoot(m_strFolder)).IsEmpty()) + if (m_strFolder.IsEmpty() || (strRoot = GetHgRepoRoot(m_strFolder)).IsEmpty())   {   ATLTRACE(" drag into a non-Hg repos directory\n");   return E_FAIL; @@ -119,16 +119,16 @@
  UINT uNumFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);   ATLTRACE(" hDrop uNumFiles = %d\n", uNumFiles);   for (UINT i = 0; i < uNumFiles; ++i) { - if (DragQueryFile(hDrop, i, name, MAX_PATH) > 0) + if (DragQueryFile(hDrop, i, szName, MAX_PATH) > 0)   { - ATLTRACE(" DragQueryFile [%d] = '%s'\n", i, name); - if (GetHgRepoRoot(name) != root) + ATLTRACE(" DragQueryFile [%d] = '%s'\n", i, szName); + if (GetHgRepoRoot(szName) != strRoot)   { - ATLTRACE(" '%s' isn't in target dir repository\n", name); + ATLTRACE(" '%s' isn't in target dir repository\n", szName);   m_arrFiles.RemoveAll();   break;   } - m_arrFiles.Add(name); + m_arrFiles.Add(szName);   }   }   }
 
31
32
33
34
35
 
 
36
37
38
39
40
41
42
 
43
44
 
45
46
 
47
48
49
 
50
51
52
53
 
 
 
54
55
56
57
58
 
59
60
 
61
62
63
 
 
64
65
66
 
67
68
69
 
31
32
33
 
 
34
35
36
37
38
39
40
41
 
42
43
 
44
45
 
46
47
48
 
49
50
 
 
 
51
52
53
54
55
56
57
 
58
59
 
60
61
 
 
62
63
64
65
 
66
67
68
69
@@ -31,39 +31,39 @@
 {   CComCritSecLock<CComAutoCriticalSection> lock(m_cs);   - CString cval; - if (GetRegistryConfig("EnableOverlays", cval) != 0 && cval == "0") + CString strCval; + if (GetRegistryConfig("EnableOverlays", strCval) != 0 && strCval == "0")   return S_FALSE;     // This overlay handler processes all filenames in lowercase, so that a path   // "C:\FOO\BAR\Baz.TXT" will be considered equal to "C:\foo\bar\baz.txt"   // (note that mercurial preserves the case of filenames in .hg/dirstate)   - CString path = CString(pwszPath).MakeLower(); + CString strPath = CString(pwszPath).MakeLower();   - if (GetRegistryConfig("LocalDisksOnly", cval) != 0 && cval != "0") + if (GetRegistryConfig("LocalDisksOnly", strCval) != 0 && strCval != "0")   { - if (::PathIsNetworkPath(path)) + if (::PathIsNetworkPath(strPath))   return S_FALSE;   - if (path.GetLength() > 2 && path[1] == ':') + if (strPath.GetLength() > 2 && strPath[1] == ':')   { - CString t = "C:\\"; - t.SetAt(0, path[0]); - if (::GetDriveType(t) == 4) + CString strDrive = "C:\\"; + strDrive.SetAt(0, strPath[0]); + if (::GetDriveType(strDrive) == 4)   return S_FALSE;   }   }   - char filterStatus = 0; + char chFilterStatus = 0;   if (m_chTortoiseClass == 'A') - filterStatus = 'A'; + chFilterStatus = 'A';   - char status = 0; - if (!HgQueryDirstate(m_chTortoiseClass, path, filterStatus, status)) + char chStatus = 0; + if (!HgQueryDirstate(m_chTortoiseClass, strPath, chFilterStatus, chStatus))   return S_FALSE;   - if (status == m_chTortoiseClass) + if (chStatus == m_chTortoiseClass)   return S_OK;     return S_FALSE;
 
51
52
53
54
55
 
 
56
57
58
59
60
61
62
 
63
64
65
66
 
 
67
68
69
 
71
72
73
74
75
 
 
76
77
78
79
80
81
82
 
83
84
85
86
87
88
 
89
90
91
92
93
94
95
 
96
97
98
99
100
101
 
 
102
103
104
105
106
 
107
108
109
 
 
110
111
112
113
 
 
114
115
116
117
118
119
120
121
 
 
122
123
 
124
125
126
127
128
129
 
130
131
132
133
134
135
136
 
137
138
 
139
140
141
 
142
143
144
145
146
147
148
 
149
150
151
152
 
 
153
154
155
 
 
156
157
158
 
164
165
166
167
168
 
 
169
170
 
171
172
173
174
175
176
 
177
178
179
180
181
182
183
184
 
 
185
186
 
187
188
189
190
 
 
191
192
 
193
194
195
 
 
196
197
198
 
51
52
53
 
 
54
55
56
57
58
59
60
61
 
62
63
64
 
 
65
66
67
68
69
 
71
72
73
 
 
74
75
76
77
78
79
80
81
 
82
83
84
85
86
87
 
88
89
90
91
92
93
94
 
95
96
97
98
99
 
 
100
101
102
103
104
105
 
106
107
 
 
108
109
110
111
 
 
112
113
114
115
116
117
118
119
 
 
120
121
122
 
123
124
125
126
127
128
 
129
130
131
132
133
134
135
 
136
137
 
138
139
140
 
141
142
143
144
145
146
147
 
148
149
150
 
 
151
152
153
 
 
154
155
156
157
158
 
164
165
166
 
 
167
168
169
 
170
171
172
173
174
175
 
176
177
178
179
180
181
182
 
 
183
184
185
 
186
187
188
 
 
189
190
191
 
192
193
 
 
194
195
196
197
198
@@ -51,19 +51,19 @@
  if (strPath.IsEmpty())   return 0;   - int x = strPath.Find('/'); - if (x == -1) + int nPos = strPath.Find('/'); + if (nPos == -1)   {   strBase.Empty();   strRest = strPath;   return 1;   }   - if (x == 0 || x == strPath.GetLength()-1) + if (nPos == 0 || nPos == strPath.GetLength()-1)   return 0;   - strBase = strPath.Left(x); - strRest = strPath.Mid(x+1); + strBase = strPath.Left(nPos); + strRest = strPath.Mid(nPos+1);     return 1;  } @@ -71,88 +71,88 @@
   int CDirectory::Add(CString strName, CDirentry& rEntry)  { - CString base; - CString rest; + CString strBase; + CString strRest;     CDirectory* cur = this;     for (;;)   {   - if (!SplitBase(strName, base, rest)) { + if (!SplitBase(strName, strBase, strRest)) {   ATLTRACE("CDirectory('%s')::Add(%d): splitbase returned 0\n",   (LPCTSTR)Path(), (LPCTSTR)strName);   return 0;   }   - if (base.IsEmpty()) + if (strBase.IsEmpty())   {   rEntry.m_strName = strName;   cur->m_listFiles.AddTail(rEntry);   return 1;   }   - CDirectory* d = 0; + CDirectory* pDir = 0;   POSITION position = cur->m_listSubdirs.GetHeadPosition();   while (position != NULL)   {   CDirectory* pItem = cur->m_listSubdirs.GetNext(position); - if (pItem->m_strName == base) { - d = pItem; + if (pItem->m_strName == strBase) { + pDir = pItem;   break;   }   }   - if (!d) + if (!pDir)   { - d = new CDirectory(cur, base, cur->Path()); - cur->m_listSubdirs.AddTail(d); + pDir = new CDirectory(cur, strBase, cur->Path()); + cur->m_listSubdirs.AddTail(pDir);   }   - strName = rest; - cur = d; + strName = strRest; + cur = pDir;   }  }      const CDirentry* CDirectory::Get(CString strRelPath) const  { - CString base; - CString rest; + CString strBase; + CString strRest;   - const CDirectory* cur = this; + const CDirectory* pCur = this;     for (;;)   {   loopstart:   - if (!SplitBase(strRelPath, base, rest)) + if (!SplitBase(strRelPath, strBase, strRest))   {   ATLTRACE("CDirectory('%s')::Get(%d): splitbase returned 0\n",   (LPCTSTR)Path(), (LPCTSTR)strRelPath);   return 0;   }   - if (base.IsEmpty()) + if (strBase.IsEmpty())   { - POSITION position = cur->m_listFiles.GetHeadPosition(); + POSITION position = pCur->m_listFiles.GetHeadPosition();   while (position != NULL)   { - const CDirentry& rItem = cur->m_listFiles.GetNext(position); + const CDirentry& rItem = pCur->m_listFiles.GetNext(position);   if (rItem.m_strName == strRelPath)   return &rItem;   }   return 0;   }   - POSITION position = cur->m_listSubdirs.GetHeadPosition(); + POSITION position = pCur->m_listSubdirs.GetHeadPosition();   while (position != NULL)   { - CDirectory* pItem = cur->m_listSubdirs.GetNext(position); - if (pItem->m_strName == base) + CDirectory* pItem = pCur->m_listSubdirs.GetNext(position); + if (pItem->m_strName == strBase)   { - cur = pItem; - strRelPath = rest; + pCur = pItem; + strRelPath = strRest;   goto loopstart;   }   } @@ -164,35 +164,35 @@
   CDirectory* CDirectory::GetDir(CString strRelPath)  { - CString base; - CString rest; + CString strBase; + CString strRest;   - const CDirectory* cur = this; + const CDirectory* pCur = this;     for (;;)   {   loopstart:   - if (!SplitBase(strRelPath, base, rest)) + if (!SplitBase(strRelPath, strBase, strRest))   {   ATLTRACE("Directory('%s')::getdir('%s'): splitbase returned 0\n",   (LPCTSTR)Path(), (LPCTSTR)strRelPath);   return 0;   }   - const bool leaf = base.IsEmpty(); - const CString& searchstr = (leaf ? strRelPath : base); + bool bLeaf = strBase.IsEmpty(); + const CString& strSearch = (bLeaf ? strRelPath : strBase);   - POSITION position = cur->m_listSubdirs.GetHeadPosition(); + POSITION position = pCur->m_listSubdirs.GetHeadPosition();   while (position != NULL)   { - CDirectory* pItem = cur->m_listSubdirs.GetNext(position); - if (pItem->m_strName == searchstr) + CDirectory* pItem = pCur->m_listSubdirs.GetNext(position); + if (pItem->m_strName == strSearch)   { - if (leaf) + if (bLeaf)   return pItem; - cur = pItem; - strRelPath = rest; + pCur = pItem; + strRelPath = strRest;   goto loopstart;   }   }
 
21
22
23
24
 
25
26
27
28
 
 
29
30
 
31
32
33
34
35
36
 
37
38
39
40
 
41
42
43
44
 
45
46
47
48
49
50
51
52
53
54
55
 
 
 
 
 
56
57
58
59
 
60
61
62
63
64
 
65
66
67
 
 
68
69
70
71
 
 
 
72
73
74
75
76
77
78
 
 
79
80
 
81
82
83
84
85
 
 
86
87
88
89
 
90
91
 
92
93
94
 
 
95
96
 
97
98
99
100
101
 
102
103
104
105
106
107
 
108
109
110
 
111
112
113
 
 
114
115
 
116
117
 
118
119
 
120
121
122
123
124
125
 
126
127
128
129
130
 
131
132
133
 
21
22
23
 
24
25
 
 
 
26
27
28
 
29
30
31
32
33
34
 
35
36
37
38
 
39
40
41
42
 
43
44
45
46
 
 
 
 
 
 
 
 
47
48
49
50
51
52
53
54
 
55
56
57
58
59
 
60
61
 
 
62
63
64
 
 
 
65
66
67
68
69
70
71
72
 
 
73
74
75
 
76
77
78
79
 
 
80
81
82
83
84
 
85
86
 
87
88
 
 
89
90
91
 
92
93
94
95
96
 
97
98
99
100
101
102
 
103
104
105
 
106
107
 
 
108
109
110
 
111
112
 
113
114
 
115
116
117
118
119
120
 
121
122
123
124
125
 
126
127
128
129
@@ -21,113 +21,109 @@
 #include "TortoiseUtils.h"     -char CDirectoryStatus::Status(CString relpath) const +char CDirectoryStatus::Status(CString strRelPath) const  { - char res = 'C'; - bool added = false; - bool modified = false; + bool bAdded = false; + bool bModified = false;   - relpath += '/'; + strRelPath += '/';     POSITION position = m_listEntries.GetHeadPosition();   while (position != NULL)   {   const CEntry& rEntry = m_listEntries.GetNext(position); - if (relpath.IsEmpty() || rEntry.strPath.Left(relpath.GetLength()) == relpath) + if (strRelPath.IsEmpty() || rEntry.strPath.Left(strRelPath.GetLength()) == strRelPath)   {   if (rEntry.chStatus == 'm' || rEntry.chStatus == 'r')   { - modified = true; + bModified = true;   break;   }   if (rEntry.chStatus == 'a') - added = true; + bAdded = true;   }   }   - if (modified) - res = 'M'; - else if (added) - res = 'A'; - else - res = 'C'; - - return res; + if (bModified) + return 'M'; + if (bAdded) + return 'A'; + return 'C';  }     -int CDirectoryStatus::Read(const CString& hgroot, const CString& cwd) +int CDirectoryStatus::Read(const CString& strHgRoot, const CString& strCwd)  {   m_listEntries.RemoveAll();   m_bNoIcons = false;   - CString p = hgroot + "\\.hg\\thgstatus"; + CString strStatusPath = strHgRoot + "\\.hg\\thgstatus";   - FILE *f = fopenReadRenameAllowed(p); - if (!f) + FILE *pFile = fopenReadRenameAllowed(strStatusPath); + if (!pFile)   { - ATLTRACE("CDirectoryStatus::read: can't open '%s'\n", p); - CString p = (cwd.GetLength() < hgroot.GetLength() ? hgroot : cwd); - CTHgStatus::Update(p); + ATLTRACE("CDirectoryStatus::read: can't open '%s'\n", (LPCTSTR)strStatusPath); + CString p = (strCwd.GetLength() < strHgRoot.GetLength() ? strHgRoot : strCwd); + CTHgStatus::Update(strStatusPath);   return 0;   }     CDirectoryStatus::CEntry e;   - int res = 1; - const CString noicons = "@@noicons"; + int nRes = 1; + const CString strNoIcons = "@@noicons";   - CString line; + CString strLine;     for (;;)   { - line.Empty(); - char t; + strLine.Empty(); + char chStatus;     for (;;)   { - if (fread(&t, sizeof(t), 1, f) != 1) + if (fread(&chStatus, sizeof(char), 1, pFile) != 1)   goto close; - if (t == '\n') + if (chStatus == '\n')   break; - line.AppendChar(t); - if (line.GetLength() > 1000) + strLine.AppendChar(chStatus); + if (strLine.GetLength() > 1000)   { - res = 0; + nRes = 0;   goto close;   }   }   - if (StartsWith(line, noicons)) + if (StartsWith(strLine, strNoIcons))   {   m_bNoIcons = true;   goto close;   }   - if (line.IsEmpty()) + if (strLine.IsEmpty())   goto close;   - e.chStatus = line[0]; + e.chStatus = strLine[0];   - CString path; - if (line.GetLength() > 1) + CString strPath; + if (strLine.GetLength() > 1)   { - path = line.Mid(1).MakeLower(); + strPath = strLine.Mid(1).MakeLower();   } - path.AppendChar('/'); + strPath.AppendChar('/');   - e.strPath = path; + e.strPath = strPath;     m_listEntries.AddTail(e);   }    close: - fclose(f); + fclose(pFile);     ATLTRACE("DirectoryStatus::read(%d): done. %d entries read. noicons_ = %d\n",   m_listEntries.GetCount(), m_bNoIcons);   - return res; + return nRes;  }    
 
31
32
33
34
 
35
36
37
38
 
39
 
31
32
33
 
34
35
36
37
 
38
39
@@ -31,9 +31,9 @@
  CDirectoryStatus() : m_bNoIcons(false) {}     static CDirectoryStatus* Get(const CString& strHgRoot, const CString& strCwd); - char Status(CString relpath) const; + char Status(CString strRelPath) const;   bool NoIcons() const { return m_bNoIcons; }    private: - int Read(const CString& hgroot, const CString& cwd); + int Read(const CString& strHgRoot, const CString& strCwd);  };
 
26
27
28
29
 
30
31
32
33
34
 
35
36
37
38
39
 
40
41
42
43
 
 
 
44
45
46
 
26
27
28
 
29
30
31
32
33
 
34
35
36
37
38
 
39
40
 
 
 
41
42
43
44
45
46
@@ -26,21 +26,21 @@
  if (fread(&m_chState, sizeof(char), 1, pFile) != 1)   return 0;   - unsigned length = 0; + unsigned nLength = 0;     fread(&m_uMode, sizeof(unsigned), 1, pFile);   fread(&m_uSize, sizeof(unsigned), 1, pFile);   fread(&m_uMTime, sizeof(unsigned), 1, pFile); - fread(&length, sizeof(length), 1, pFile); + fread(&nLength, sizeof(unsigned), 1, pFile);     m_uMode = ntohl(m_uMode);   m_uSize = ntohl(m_uSize);   m_uMTime = ntohl(m_uMTime); - length = ntohl(length); + nLength = ntohl(nLength);   - LPSTR lpszBuf = strRelPath.GetBuffer(length); - fread(lpszBuf, sizeof(char), length, pFile); - strRelPath.ReleaseBuffer(length); + LPSTR lpszBuf = strRelPath.GetBuffer(nLength); + fread(lpszBuf, sizeof(char), nLength, pFile); + strRelPath.ReleaseBuffer(nLength);     strRelPath = strRelPath.MakeLower();  
 
44
45
46
47
 
48
49
50
51
 
52
53
54
55
 
56
57
 
58
59
60
61
 
 
62
63
64
 
76
77
78
79
 
80
81
 
82
83
 
84
85
86
87
88
89
90
91
 
 
92
93
94
95
96
97
98
 
99
100
101
 
104
105
106
107
 
108
109
110
111
 
112
113
114
115
116
 
117
118
119
 
120
121
122
123
124
125
126
 
127
128
129
 
143
144
145
146
 
147
148
149
 
44
45
46
 
47
48
49
50
 
51
52
53
54
 
55
56
 
57
58
59
 
 
60
61
62
63
64
 
76
77
78
 
79
80
 
81
82
 
83
84
85
86
87
88
89
 
 
90
91
92
93
94
95
96
97
 
98
99
100
101
 
104
105
106
 
107
108
109
110
 
111
112
113
114
115
 
116
117
118
 
119
120
121
122
123
124
125
 
126
127
128
129
 
143
144
145
 
146
147
148
149
@@ -44,21 +44,21 @@
  }     CWinstat stat; - CString path = strHgRoot + (bUseKbfiles ? "\\.hg\\kilnbfiles\\dirstate" + CString strPath = strHgRoot + (bUseKbfiles ? "\\.hg\\kilnbfiles\\dirstate"   : "\\.hg\\dirstate");     unsigned tc = GetTickCount(); - bool new_stat = false; + bool bNewStat = false;     if (position == NULL)   { - if (stat.lstat(path, true) != 0) + if (stat.lstat(strPath, true) != 0)   { - ATLTRACE("CDirstateCache::get: lstat('%s') failed\n", (LPCTSTR)path); + ATLTRACE("CDirstateCache::get: lstat('%s') failed\n", (LPCTSTR)strPath);   return 0;   } - ATLTRACE("CDirstateCache::get: lstat('%s') ok\n", (LPCTSTR)path); - new_stat = true; + ATLTRACE("CDirstateCache::get: lstat('%s') ok\n", (LPCTSTR)strPath); + bNewStat = true;     if (Cache().GetCount() >= 10)   { @@ -76,26 +76,26 @@
  }     CEntry& rItem = Cache().GetAt(position); - if (!new_stat && tc - rItem.uTickCount > 500) + if (!bNewStat && tc - rItem.uTickCount > 500)   { - if (0 != stat.lstat(path, true)) + if (0 != stat.lstat(strPath, true))   { - ATLTRACE("CDirstateCache::get: lstat('%s') failed\n", (LPCTSTR)path); + ATLTRACE("CDirstateCache::get: lstat('%s') failed\n", (LPCTSTR)strPath);   ATLTRACE("CDirstateCache::get: dropping '%s'\n", (LPCTSTR)rItem.strHgRoot);   delete rItem.pDirstate;   Cache().RemoveAt(position);   return 0;   }   rItem.uTickCount = tc; - ATLTRACE("CDirstateCache::get: lstat('%s') ok\n", (LPCTSTR)path); - new_stat = true; + ATLTRACE("CDirstateCache::get: lstat('%s') ok\n", (LPCTSTR)strPath); + bNewStat = true;   }     if (rItem.pDirstate)   {   bUnset = rItem.bUnset;   - if (!new_stat) + if (!bNewStat)   return rItem.pDirstate;     if (rItem.llMTime == stat.ullMTime @@ -104,26 +104,26 @@
  return rItem.pDirstate;   }   - ATLTRACE("CDirstateCache::get: refreshing '%s'\n", strHgRoot); + ATLTRACE("CDirstateCache::get: refreshing '%s'\n", (LPCTSTR)strHgRoot);   }   else   { - ATLTRACE("CDirstateCache::get: reading '%s'\n", strHgRoot); + ATLTRACE("CDirstateCache::get: reading '%s'\n", (LPCTSTR)strHgRoot);   }     bUnset = false;   unsigned tc0 = GetTickCount(); - CAutoPtr<CDirstate> ds = CDirstate::Read(path, bUnset); + CAutoPtr<CDirstate> ds = CDirstate::Read(strPath, bUnset);   unsigned tc1 = GetTickCount();   - bool request_thgstatus_update = true; + bool bRequestTHgStatusUpdate = true;     if (bUnset)   {   if (rItem.bUnset)   {   ATLTRACE("CDirstateCache::get: **** old and new have unset entries\n"); - request_thgstatus_update = false; + bRequestTHgStatusUpdate = false;   }   else   { @@ -143,7 +143,7 @@
  rItem.llMTime = stat.ullMTime;   rItem.llSize = stat.ullSize;   - if (request_thgstatus_update) + if (bRequestTHgStatusUpdate)   {   ATLTRACE("CDirstateCache::get: calling Thgstatus::update\n");   CTHgStatus::Update(strCwd);
 
56
57
58
59
60
 
 
61
62
63
64
 
 
65
66
67
68
69
 
 
70
71
 
72
73
74
75
76
77
 
 
78
79
80
 
 
81
82
83
84
85
86
 
 
87
88
89
90
91
92
 
 
93
94
95
 
96
97
98
99
100
 
 
 
101
102
 
103
104
105
 
113
114
115
116
117
118
 
 
 
119
120
121
122
 
 
123
124
125
 
 
126
127
 
128
129
130
 
 
131
132
133
134
 
135
136
137
138
139
 
 
140
141
142
143
 
 
144
145
146
 
147
148
149
150
151
152
 
153
154
155
156
 
157
158
159
 
160
161
162
 
163
164
 
165
166
167
 
168
169
170
171
172
173
 
 
174
175
176
177
 
 
178
179
180
 
 
181
182
 
183
184
185
 
186
187
188
 
189
190
191
 
193
194
195
196
 
197
198
199
 
200
201
202
203
 
204
205
206
 
212
213
214
215
 
216
217
218
 
 
219
220
 
221
222
223
 
231
232
233
234
 
235
236
237
 
238
239
240
241
242
243
 
 
244
245
246
 
249
250
251
252
 
253
254
255
 
56
57
58
 
 
59
60
61
62
 
 
63
64
65
66
67
 
 
68
69
70
 
71
72
73
74
75
 
 
76
77
78
 
 
79
80
81
82
83
84
 
 
85
86
87
88
89
90
 
 
91
92
93
94
 
95
96
97
 
 
 
98
99
100
101
 
102
103
104
105
 
113
114
115
 
 
 
116
117
118
119
120
 
 
121
122
123
 
 
124
125
126
 
127
128
 
 
129
130
131
132
133
 
134
135
136
137
 
 
138
139
140
141
 
 
142
143
144
145
 
146
147
148
149
150
151
 
152
153
154
155
 
156
157
158
 
159
160
161
 
162
163
 
164
165
166
 
167
168
169
170
171
 
 
172
173
174
175
 
 
176
177
178
 
 
179
180
181
 
182
183
184
 
185
186
187
 
188
189
190
191
 
193
194
195
 
196
197
198
 
199
200
201
202
 
203
204
205
206
 
212
213
214
 
215
216
 
 
217
218
219
 
220
221
222
223
 
231
232
233
 
234
235
236
 
237
238
239
240
241
 
 
242
243
244
245
246
 
249
250
251
 
252
253
254
255
@@ -56,50 +56,50 @@
    rect.left = rect.top = 0;   - HWND desktop = ::GetDesktopWindow(); - if (desktop == NULL) + HWND hwndDesktop = ::GetDesktopWindow(); + if (hwndDesktop == NULL)   return NULL;   - HDC screen_dev = ::GetDC(desktop); - if (screen_dev == NULL) + HDC hScreenDC = ::GetDC(hwndDesktop); + if (hScreenDC == NULL)   return NULL;     // Create a compatible DC - HDC dst_hdc = ::CreateCompatibleDC(screen_dev); - if (dst_hdc == NULL) + HDC hDestDC = ::CreateCompatibleDC(hScreenDC); + if (hDestDC == NULL)   { - ::ReleaseDC(desktop, screen_dev); + ::ReleaseDC(hwndDesktop, hScreenDC);   return NULL;   }     // Create a new bitmap of icon size - HBITMAP bmp = ::CreateCompatibleBitmap(screen_dev, rect.right, rect.bottom); - if (bmp == NULL) + HBITMAP hBitmap = ::CreateCompatibleBitmap(hScreenDC, rect.right, rect.bottom); + if (hBitmap == NULL)   { - ::DeleteDC(dst_hdc); - ::ReleaseDC(desktop, screen_dev); + ::DeleteDC(hDestDC); + ::ReleaseDC(hwndDesktop, hScreenDC);   return NULL;   }     // Select it into the compatible DC - HBITMAP old_dst_bmp = (HBITMAP)::SelectObject(dst_hdc, bmp); - if (old_dst_bmp == NULL) + HBITMAP hOldBitmap = (HBITMAP)::SelectObject(hDestDC, hBitmap); + if (hOldBitmap == NULL)   return NULL;     // Fill the background of the compatible DC with the white color   // that is taken by menu routines as transparent - ::SetBkColor(dst_hdc, RGB(255, 255, 255)); - ::ExtTextOut(dst_hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL); + ::SetBkColor(hDestDC, RGB(255, 255, 255)); + ::ExtTextOut(hDestDC, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);     // Draw the icon into the compatible DC - ::DrawIconEx(dst_hdc, 0, 0, hIcon, rect.right, rect.bottom, 0, NULL, DI_NORMAL); + ::DrawIconEx(hDestDC, 0, 0, hIcon, rect.right, rect.bottom, 0, NULL, DI_NORMAL);     // Restore settings - ::SelectObject(dst_hdc, old_dst_bmp); - ::DeleteDC(dst_hdc); - ::ReleaseDC(desktop, screen_dev); + ::SelectObject(hDestDC, hOldBitmap); + ::DeleteDC(hDestDC); + ::ReleaseDC(hwndDesktop, hScreenDC);   - return bmp; + return hBitmap;  }    HBITMAP CIconBitmapUtils::IconToBitmapPARGB32(HICON hIcon) @@ -113,79 +113,79 @@
  return NULL;   }   - SIZE sizIcon; - sizIcon.cx = GetSystemMetrics(SM_CXSMICON); - sizIcon.cy = GetSystemMetrics(SM_CYSMICON); + SIZE sizeIcon; + sizeIcon.cx = GetSystemMetrics(SM_CXSMICON); + sizeIcon.cy = GetSystemMetrics(SM_CYSMICON);     RECT rcIcon; - SetRect(&rcIcon, 0, 0, sizIcon.cx, sizIcon.cy); - HBITMAP hBmp = NULL; + SetRect(&rcIcon, 0, 0, sizeIcon.cx, sizeIcon.cy); + HBITMAP hBitmap = NULL;   - HDC hdcDest = CreateCompatibleDC(NULL); - if (hdcDest) + HDC hDestDC = CreateCompatibleDC(NULL); + if (hDestDC)   { - if (SUCCEEDED(Create32BitHBITMAP(hdcDest, &sizIcon, NULL, &hBmp))) + if (SUCCEEDED(Create32BitHBITMAP(hDestDC, &sizeIcon, NULL, &hBitmap)))   { - HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcDest, hBmp); - if (hbmpOld) + HBITMAP hOldBitmap = (HBITMAP)SelectObject(hDestDC, hBitmap); + if (hOldBitmap)   {   BLENDFUNCTION bfAlpha = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };   BP_PAINTPARAMS paintParams = {0}; - paintParams.cbSize = sizeof(paintParams); + paintParams.cbSize = sizeof(BP_PAINTPARAMS);   paintParams.dwFlags = BPPF_ERASE;   paintParams.pBlendFunction = &bfAlpha;   - HDC hdcBuffer; - HPAINTBUFFER hPaintBuffer = m_pfnBeginBufferedPaint(hdcDest, &rcIcon, BPBF_DIB, &paintParams, &hdcBuffer); + HDC hBufferDC; + HPAINTBUFFER hPaintBuffer = m_pfnBeginBufferedPaint(hDestDC, &rcIcon, BPBF_DIB, &paintParams, &hBufferDC);   if (hPaintBuffer)   { - if (DrawIconEx(hdcBuffer, 0, 0, hIcon, sizIcon.cx, sizIcon.cy, 0, NULL, DI_NORMAL)) - //if (FillRect(hdcBuffer, &rcIcon, (HBRUSH) (0x000000FF)) != 0) + if (DrawIconEx(hBufferDC, 0, 0, hIcon, sizeIcon.cx, sizeIcon.cy, 0, NULL, DI_NORMAL)) + //if (FillRect(hBufferDC, &rcIcon, (HBRUSH) (0x000000FF)) != 0)   {   // If icon did not have an alpha channel we need to convert buffer to PARGB - ConvertBufferToPARGB32(hPaintBuffer, hdcDest, hIcon, sizIcon); + ConvertBufferToPARGB32(hPaintBuffer, hDestDC, hIcon, sizeIcon);   }   // This will write the buffer contents to the destination bitmap   m_pfnEndBufferedPaint(hPaintBuffer, TRUE);   }   - SelectObject(hdcDest, hbmpOld); + SelectObject(hDestDC, hOldBitmap);   }   }   - DeleteDC(hdcDest); + DeleteDC(hDestDC);   }   - return hBmp; + return hBitmap;  }   -HRESULT CIconBitmapUtils::Create32BitHBITMAP(HDC hdc, const SIZE *psize, __deref_opt_out void **ppvBits, __out HBITMAP* phBmp) +HRESULT CIconBitmapUtils::Create32BitHBITMAP(HDC hDC, const SIZE *pSize, void **ppvBits, HBITMAP* phBitmap)  { - *phBmp = NULL; + *phBitmap = NULL;     BITMAPINFO bmi; - SecureZeroMemory(&bmi, sizeof(bmi)); + SecureZeroMemory(&bmi, sizeof(BITMAPINFO));   bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);   bmi.bmiHeader.biPlanes = 1;   bmi.bmiHeader.biCompression = BI_RGB;   - bmi.bmiHeader.biWidth = psize->cx; - bmi.bmiHeader.biHeight = psize->cy; + bmi.bmiHeader.biWidth = pSize->cx; + bmi.bmiHeader.biHeight = pSize->cy;   bmi.bmiHeader.biBitCount = 32;   - HDC hdcUsed = hdc ? hdc : GetDC(NULL); - if (hdcUsed) + HDC hUsedDC = hDC ? hDC : GetDC(NULL); + if (hUsedDC)   { - *phBmp = CreateDIBSection(hdcUsed, &bmi, DIB_RGB_COLORS, ppvBits, NULL, 0); - if (hdc != hdcUsed) + *phBitmap = CreateDIBSection(hUsedDC, &bmi, DIB_RGB_COLORS, ppvBits, NULL, 0); + if (hDC != hUsedDC)   { - ReleaseDC(NULL, hdcUsed); + ReleaseDC(NULL, hUsedDC);   }   } - return (NULL == *phBmp) ? E_OUTOFMEMORY : S_OK; + return (NULL == *phBitmap) ? E_OUTOFMEMORY : S_OK;  }   -HRESULT CIconBitmapUtils::ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hdc, HICON hicon, SIZE& sizIcon) +HRESULT CIconBitmapUtils::ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hDC, HICON hIcon, SIZE& sizeIcon)  {   RGBQUAD *prgbQuad;   int cxRow; @@ -193,14 +193,14 @@
  if (SUCCEEDED(hr))   {   Gdiplus::ARGB *pargb = reinterpret_cast<Gdiplus::ARGB *>(prgbQuad); - if (!HasAlpha(pargb, sizIcon, cxRow)) + if (!HasAlpha(pargb, sizeIcon, cxRow))   {   ICONINFO info; - if (GetIconInfo(hicon, &info)) + if (GetIconInfo(hIcon, &info))   {   if (info.hbmMask)   { - hr = ConvertToPARGB32(hdc, pargb, info.hbmMask, sizIcon, cxRow); + hr = ConvertToPARGB32(hDC, pargb, info.hbmMask, sizeIcon, cxRow);   }     DeleteObject(info.hbmColor); @@ -212,12 +212,12 @@
  return hr;  }   -bool CIconBitmapUtils::HasAlpha(__in Gdiplus::ARGB *pargb, SIZE& sizImage, int cxRow) +bool CIconBitmapUtils::HasAlpha(Gdiplus::ARGB *pargb, SIZE& sizeImage, int cxRow)  { - ULONG cxDelta = cxRow - sizImage.cx; - for (ULONG y = sizImage.cy; y; --y) + ULONG cxDelta = cxRow - sizeImage.cx; + for (ULONG y = sizeImage.cy; y; --y)   { - for (ULONG x = sizImage.cx; x; --x) + for (ULONG x = sizeImage.cx; x; --x)   {   if (*pargb++ & 0xFF000000)   { @@ -231,16 +231,16 @@
  return false;  }   -HRESULT CIconBitmapUtils::ConvertToPARGB32(HDC hdc, __inout Gdiplus::ARGB *pargb, HBITMAP hbmp, SIZE& sizImage, int cxRow) +HRESULT CIconBitmapUtils::ConvertToPARGB32(HDC hDC, Gdiplus::ARGB *pargb, HBITMAP hBitmap, SIZE& sizeImage, int cxRow)  {   BITMAPINFO bmi; - SecureZeroMemory(&bmi, sizeof(bmi)); + SecureZeroMemory(&bmi, sizeof(BITMAPINFO));   bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);   bmi.bmiHeader.biPlanes = 1;   bmi.bmiHeader.biCompression = BI_RGB;   - bmi.bmiHeader.biWidth = sizImage.cx; - bmi.bmiHeader.biHeight = sizImage.cy; + bmi.bmiHeader.biWidth = sizeImage.cx; + bmi.bmiHeader.biHeight = sizeImage.cy;   bmi.bmiHeader.biBitCount = 32;     HRESULT hr = E_OUTOFMEMORY; @@ -249,7 +249,7 @@
  if (pvBits)   {   hr = E_UNEXPECTED; - if (GetDIBits(hdc, hbmp, 0, bmi.bmiHeader.biHeight, pvBits, &bmi, DIB_RGB_COLORS) == bmi.bmiHeader.biHeight) + if (GetDIBits(hDC, hBitmap, 0, bmi.bmiHeader.biHeight, pvBits, &bmi, DIB_RGB_COLORS) == bmi.bmiHeader.biHeight)   {   ULONG cxDelta = cxRow - bmi.bmiHeader.biWidth;   Gdiplus::ARGB *pargbMask = static_cast<Gdiplus::ARGB *>(pvBits);
 
40
41
42
43
44
45
46
 
 
 
 
47
48
49
 
40
41
42
 
 
 
 
43
44
45
46
47
48
49
@@ -40,10 +40,10 @@
    HBITMAP IconToBitmap(HICON hIcon);   HBITMAP IconToBitmapPARGB32(HICON hIcon); - HRESULT Create32BitHBITMAP(HDC hdc, const SIZE *psize, __deref_opt_out void **ppvBits, __out HBITMAP* phBmp); - HRESULT ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hdc, HICON hicon, SIZE& sizIcon); - bool HasAlpha(__in Gdiplus::ARGB *pargb, SIZE& sizImage, int cxRow); - HRESULT ConvertToPARGB32(HDC hdc, __inout Gdiplus::ARGB *pargb, HBITMAP hbmp, SIZE& sizImage, int cxRow); + HRESULT Create32BitHBITMAP(HDC hDC, const SIZE *pSize, void **ppvBits, __out HBITMAP* phBitmap); + HRESULT ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hDC, HICON hIcon, SIZE& sizeIcon); + bool HasAlpha(Gdiplus::ARGB *pargb, SIZE& sizeImage, int cxRow); + HRESULT ConvertToPARGB32(HDC hDC, Gdiplus::ARGB *pargb, HBITMAP hBitmap, SIZE& sizeImage, int cxRow);      private:
 
47
48
49
50
 
51
52
53
 
54
55
 
56
57
58
 
 
59
60
61
 
62
63
64
 
66
67
68
69
70
 
 
71
72
73
 
74
75
76
 
79
80
81
82
83
84
85
 
 
 
 
86
87
88
89
90
91
92
 
 
93
94
95
 
 
96
97
 
98
99
100
 
111
112
113
114
115
 
 
116
117
118
119
120
121
 
122
123
 
124
125
 
126
127
128
129
 
130
131
132
 
142
143
144
145
 
146
147
148
 
 
149
150
151
152
 
 
 
153
154
155
156
 
157
158
 
159
160
161
162
163
164
 
 
165
166
 
167
168
169
170
 
171
172
173
 
174
175
176
 
184
185
186
187
 
188
189
190
191
 
 
192
193
194
 
195
196
197
198
 
 
199
200
 
201
202
203
 
207
208
209
210
 
211
212
213
214
215
 
216
217
218
 
 
219
220
 
221
222
 
223
224
 
225
226
227
 
229
230
231
232
 
233
234
235
236
 
237
238
239
 
240
241
 
242
243
 
244
245
246
247
248
249
 
 
 
250
251
 
252
253
254
 
 
255
256
257
258
 
 
259
260
 
261
262
263
264
 
265
266
267
268
269
 
 
 
 
270
271
272
273
 
274
275
276
 
 
277
278
279
280
 
 
281
282
283
 
285
286
287
288
 
289
290
291
 
292
293
294
 
 
295
296
297
 
298
299
 
300
301
302
303
 
 
304
305
 
306
307
308
309
310
311
312
313
 
 
 
 
314
315
316
317
 
318
319
320
321
322
 
 
323
324
 
325
326
327
328
 
329
330
331
332
333
334
335
 
336
337
338
 
339
340
341
342
343
 
 
344
345
 
346
347
348
 
 
349
350
351
 
 
352
353
354
355
356
 
357
358
359
 
 
360
361
 
362
363
364
 
 
365
366
367
 
368
369
370
 
371
372
 
373
374
375
376
377
 
378
379
380
381
 
 
382
383
 
47
48
49
 
50
51
52
 
53
54
 
55
56
 
 
57
58
59
60
 
61
62
63
64
 
66
67
68
 
 
69
70
71
72
 
73
74
75
76
 
79
80
81
 
 
 
 
82
83
84
85
86
87
88
89
90
 
 
91
92
93
 
 
94
95
96
 
97
98
99
100
 
111
112
113
 
 
114
115
116
117
118
119
120
 
121
122
 
123
124
 
125
126
127
128
 
129
130
131
132
 
142
143
144
 
145
146
 
 
147
148
149
 
 
 
150
151
152
153
154
155
 
156
157
 
158
159
160
161
162
 
 
163
164
165
 
166
167
168
169
 
170
171
172
 
173
174
175
176
 
184
185
186
 
187
188
189
 
 
190
191
192
193
 
194
195
196
 
 
197
198
199
 
200
201
202
203
 
207
208
209
 
210
211
212
213
214
 
215
216
 
 
217
218
219
 
220
221
 
222
223
 
224
225
226
227
 
229
230
231
 
232
233
234
235
 
236
237
238
 
239
240
 
241
242
 
243
244
245
246
 
 
 
247
248
249
250
 
251
252
 
 
253
254
255
256
 
 
257
258
259
 
260
261
262
263
 
264
265
 
 
 
 
266
267
268
269
270
271
272
 
273
274
 
 
275
276
277
278
 
 
279
280
281
282
283
 
285
286
287
 
288
289
290
 
291
292
 
 
293
294
295
296
 
297
298
 
299
300
301
 
 
302
303
304
 
305
306
307
308
309
 
 
 
 
310
311
312
313
314
315
316
 
317
318
319
320
 
 
321
322
323
 
324
325
326
327
 
328
329
330
331
332
333
334
 
335
336
337
 
338
339
340
341
 
 
342
343
344
 
345
346
 
 
347
348
349
 
 
350
351
352
353
354
355
 
356
357
 
 
358
359
360
 
361
362
 
 
363
364
365
366
 
367
368
369
 
370
371
 
372
373
374
375
376
 
377
378
379
 
 
380
381
382
383
@@ -47,18 +47,18 @@
 {   uTicks = 0;   - bool res = false; + bool bRes = false;     if (strPath.IsEmpty() || strPath == "\\") - return res; + return bRes;   - const CString p = strPath + "\\.hg"; + CString strHgPath = strPath + "\\.hg";   - if (::PathIsUNCServerShare(p)) - return res; + if (::PathIsUNCServerShare(strHgPath)) + return bRes;     unsigned tc0 = ::GetTickCount(); - res = ::PathIsDirectory(p) != 0; + bRes = ::PathIsDirectory(strHgPath) != 0;   unsigned tc1 = ::GetTickCount();     uTicks = tc1 - tc0; @@ -66,11 +66,11 @@
  if (uTicks > 5 /* ms */)   {   // trace slower PathIsDirectory calls (untypical on local discs) - ATLTRACE("[%c] hasHgDir: PathIsDirectory('%s') -> %d, in %d ticks\n", - chClass, (LPCTSTR)p, (int)res, uTicks); + ATLTRACE("[%c] HasHgDir: PathIsDirectory('%s') -> %d, in %d ticks\n", + chClass, (LPCTSTR)strHgPath, (int)bRes, uTicks);   }   - return res; + return bRes;  }     @@ -79,22 +79,22 @@
  CString dp = "["; dp += chClass; dp += "] findHgRoot";     { - CString p = qsCur.strPath; - p.AppendChar('\\'); - bool unset = false; - if (p.Find("\\.hg\\") != -1) + CString strPath = qsCur.strPath; + strPath.AppendChar('\\'); + bool bUnset = false; + if (strPath.Find("\\.hg\\") != -1)   {   // ignore files and dirs named '.hg'   qsLast = qsCur;   return 0;   } - int pos; - if ((pos = p.Find("\\.kbf\\")) != -1) + int nPos; + if ((nPos = strPath.Find("\\.kbf\\")) != -1)   { - p.Truncate(pos); - p += "\\.hg\\kilnbfiles\\dirstate"; + strPath.Truncate(nPos); + strPath += "\\.hg\\kilnbfiles\\dirstate";   CWinstat stat; - if (stat.lstat(p, true) == 0) + if (stat.lstat(strPath, true) == 0)   {   // ignore files and dirs named '.kbf' when kbfiles is enabled   qsLast = qsCur; @@ -111,22 +111,22 @@
  return 1;   }   - unsigned ticks = 0; - bool file_access_is_unacceptably_slow = false; + unsigned uTicks = 0; + bool bFileAccessIsUnacceptablySlow = false;     if (!::PathIsNetworkPath(qsCur.strPath))   {   // checking if we have a repo root, visible from its parent dir   - const bool has_hg = HasHgDir(chClass, qsCur.strPath, ticks); + bool bHasHg = HasHgDir(chClass, qsCur.strPath, uTicks);   - if (ticks > 5000 /* ms */) + if (uTicks > 5000 /* ms */)   { - file_access_is_unacceptably_slow = true; + bFileAccessIsUnacceptablySlow = true;   goto exit;   }   - if (has_hg) + if (bHasHg)   {   qsCur.strHgRoot = qsCur.strPath;   ATLTRACE("%s('%s'): hgroot = cur.path\n", (LPCTSTR)dp, (LPCTSTR)qsCur.strPath); @@ -142,35 +142,35 @@
  return 1;   }   - for (CString p = qsCur.strBaseDir;;) + for (CString strPath = qsCur.strBaseDir;;)   { - bool has_hg = HasHgDir(chClass, p, ticks); - if (ticks > 5000 /* ms */) + bool bHasHg = HasHgDir(chClass, strPath, uTicks); + if (uTicks > 5000 /* ms */)   { - CString reason = "ignoring slow \"" + p + "\""; - CTHgStatus::Error(reason); - file_access_is_unacceptably_slow = true; + CString strReason = "ignoring slow \"" + strPath + "\""; + CTHgStatus::Error(strReason); + bFileAccessIsUnacceptablySlow = true;   goto exit;   }   - if (has_hg) + if (bHasHg)   { - qsCur.strHgRoot = p; + qsCur.strHgRoot = strPath;   ATLTRACE("%s('%s'): hgroot = '%s' (found repo)", (LPCTSTR)dp,   (LPCTSTR)qsCur.strPath, (LPCTSTR)qsCur.strHgRoot);   return 1;   } - CString p2 = DirName(p); - if (p2.GetLength() == p.GetLength()) + CString strPath2 = DirName(strPath); + if (strPath2.GetLength() == strPath.GetLength())   break; - p = p2; + strPath = strPath2;   }    exit: - if (file_access_is_unacceptably_slow) + if (bFileAccessIsUnacceptablySlow)   {   ATLTRACE("****** %s('%s'): ignored, call took too long (%d ticks)\n", - (LPCTSTR)dp, (LPCTSTR)qsCur.strPath, ticks); + (LPCTSTR)dp, (LPCTSTR)qsCur.strPath, uTicks);   }   else   { @@ -184,20 +184,20 @@
 int GetRelPath(   const CString& strHgRoot,   const CString& strPath, - CString& res + CString& strRes  )  { - int offset = strHgRoot.GetLength(); - if (offset == 0) + int nOffset = strHgRoot.GetLength(); + if (nOffset == 0)   return 0;   - if (offset > strPath.GetLength()) + if (nOffset > strPath.GetLength())   return 0;   - if (strPath[offset] == '\\') - offset++; + if (strPath[nOffset] == '\\') + nOffset++;   - res = strPath.Mid(offset); + strRes = strPath.Mid(nOffset);   return 1;  }   @@ -207,21 +207,21 @@
 {   CString dp = "["; dp += chClass; dp += "] HgQueryDirstate: ";   - static CQueryState last; + static CQueryState qsLast;     if (strPath.IsEmpty())   return 0;   - CQueryState cur; + CQueryState qsCur;   - cur.strPath = strPath; - cur.uTickCount = ::GetTickCount(); + qsCur.strPath = strPath; + qsCur.uTickCount = ::GetTickCount();   - const bool outdated = cur.uTickCount - last.uTickCount > 2000; + bool bOutdated = qsCur.uTickCount - qsLast.uTickCount > 2000;   - if (!outdated && last.strPath == strPath) + if (!bOutdated && qsLast.strPath == strPath)   { - chOutStatus = last.chStatus; + chOutStatus = qsLast.chStatus;   if (chOutStatus == 'P')   chOutStatus = 'M';   return 1; @@ -229,55 +229,55 @@
    if (::PathIsRoot(strPath))   { - last = cur; + qsLast = qsCur;   return 0;   }   - if (FindHgRoot(chClass, cur, last, outdated) == 0) + if (FindHgRoot(chClass, qsCur, qsLast, bOutdated) == 0)   return 0;   - int offset = cur.strHgRoot.GetLength(); + int nOffset = qsCur.strHgRoot.GetLength();   - if (offset == 0) + if (nOffset == 0)   { - last = cur; + qsLast = qsCur;   return 0;   }   - if (strPath[offset] == '\\') - offset++; - CString relpath = strPath.Mid(offset); + if (strPath[nOffset] == '\\') + nOffset++; + CString strRelPath = strPath.Mid(nOffset);   - for (int i = 0; i < relpath.GetLength(); ++i) + for (int i = 0; i < strRelPath.GetLength(); ++i)   { - if (relpath[i] == '\\') - relpath.SetAt(i, '/'); + if (strRelPath[i] == '\\') + strRelPath.SetAt(i, '/');   }   - CDirectoryStatus* pdirsta = CDirectoryStatus::Get(cur.strHgRoot, cur.strBaseDir); - if (pdirsta && pdirsta->NoIcons()) + CDirectoryStatus* pDirStatus = CDirectoryStatus::Get(qsCur.strHgRoot, qsCur.strBaseDir); + if (pDirStatus && pDirStatus->NoIcons())   { - last = cur; + qsLast = qsCur;   return 0;   }   - if (relpath.IsEmpty()) + if (strRelPath.IsEmpty())   { - chOutStatus = (pdirsta ? pdirsta->Status(relpath) : '?'); - cur.chStatus = chOutStatus; - cur.uTickCount = ::GetTickCount(); - last = cur; + chOutStatus = (pDirStatus ? pDirStatus->Status(strRelPath) : '?'); + qsCur.chStatus = chOutStatus; + qsCur.uTickCount = ::GetTickCount(); + qsLast = qsCur;   return 1;   }   - bool unset = false; + bool bUnset = false;   - CDirstate* pds = CDirstateCache::Get(cur.strHgRoot, cur.strBaseDir, unset); - if (!pds) + CDirstate* pDirstate = CDirstateCache::Get(qsCur.strHgRoot, qsCur.strBaseDir, bUnset); + if (!pDirstate)   {   ATLTRACE("%s Dirstatecache::Get('%s') returns no Dirstate\n", (LPCTSTR)dp, - (LPCTSTR)cur.strHgRoot); - last = cur; + (LPCTSTR)qsCur.strHgRoot); + qsLast = qsCur;   return 0;   }   @@ -285,99 +285,99 @@
  if (0 != stat.lstat(strPath))   {   ATLTRACE("%s lstat('%s') failed", (LPCTSTR)dp, (LPCTSTR)strPath); - last = cur; + qsLast = qsCur;   return 0;   } - cur.bIsDir = stat.bIsDir; + qsCur.bIsDir = stat.bIsDir;  #if 0 - ATLTRACE("%s stat.lstat('%s') -> stat.isdir is %d\n" << (LPCTSTR)dp, - (LPCTSTR)cur.path, (int)stat.isdir); + ATLTRACE("%s stat.lstat('%s') -> stat.bIsDir is %d\n" << (LPCTSTR)dp, + (LPCTSTR)qsCur.strPath, (int)stat.bIsDir);  #endif   - if (cur.bIsDir) + if (qsCur.bIsDir)   { - if (!relpath.IsEmpty() && !pds->Root().GetDir(relpath)) + if (!strRelPath.IsEmpty() && !pDirstate->Root().GetDir(strRelPath))   {   // attempt to get status from kbfiles - pds = CDirstateCache::Get(cur.strHgRoot, cur.strBaseDir, unset, true); - if (!pds || !pds->Root().GetDir(relpath)) + pDirstate = CDirstateCache::Get(qsCur.strHgRoot, qsCur.strBaseDir, bUnset, true); + if (!pDirstate || !pDirstate->Root().GetDir(strRelPath))   { - last = cur; + qsLast = qsCur;   return 0; // unknown dir -> no icon   }   }   - chOutStatus = (pdirsta ? pdirsta->Status(relpath) : '?'); - cur.chStatus = chOutStatus; - cur.uTickCount = ::GetTickCount(); - last = cur; + chOutStatus = (pDirStatus ? pDirStatus->Status(strRelPath) : '?'); + qsCur.chStatus = chOutStatus; + qsCur.uTickCount = ::GetTickCount(); + qsLast = qsCur;   return 1;   }   - const CDirentry* e = pds->Root().Get(relpath); + const CDirentry* e = pDirstate->Root().Get(strRelPath);   if (!e)   {   // attempt to get status from kbfiles - pds = CDirstateCache::Get(cur.strHgRoot, cur.strBaseDir, unset, true); - if (pds) + pDirstate = CDirstateCache::Get(qsCur.strHgRoot, qsCur.strBaseDir, bUnset, true); + if (pDirstate)   { - e = pds->Root().Get(relpath); + e = pDirstate->Root().Get(strRelPath);   }   if (!e)   { - last = cur; + qsLast = qsCur;   return 0;   }   }     chOutStatus = e->Status(stat);   - if (unset) + if (bUnset)   goto exit;   - bool update = false; + bool bUpdate = false;     if (chOutStatus == 'M')   { - CString relbase; - if (pdirsta && GetRelPath(cur.strHgRoot, cur.strBaseDir, relbase)) + CString strRelBase; + if (pDirStatus && GetRelPath(qsCur.strHgRoot, qsCur.strBaseDir, strRelBase))   { - ATLTRACE("%s relbase = '%s'\n", (LPCTSTR)dp, (LPCTSTR)relbase); + ATLTRACE("%s strRelBase = '%s'\n", (LPCTSTR)dp, (LPCTSTR)strRelBase);   - char basedir_status = pdirsta->Status(relbase); - ATLTRACE("%s basedir_status = '%c'\n", (LPCTSTR)dp, basedir_status); + char chBaseDirStatus = pDirStatus->Status(strRelBase); + ATLTRACE("%s chBaseDirStatus = '%c'\n", (LPCTSTR)dp, chBaseDirStatus);   - if (basedir_status != 'M') - update = true; + if (chBaseDirStatus != 'M') + bUpdate = true;   }   }   else if (chOutStatus == 'P')   { - static unsigned lasttickcount; + static unsigned uLastTickCount;   - const unsigned tc = ::GetTickCount(); - const bool outdated = tc - lasttickcount > 6000; + unsigned tc = ::GetTickCount(); + bool bOutdated = tc - uLastTickCount > 6000;   - if (outdated) // protect against endless update loops + if (bOutdated) // protect against endless update loops   { - update = true; - lasttickcount = tc; + bUpdate = true; + uLastTickCount = tc;   }   - ATLTRACE("%s outStatus is 'P'\n", (LPCTSTR)dp); + ATLTRACE("%s chOutStatus is 'P'\n", (LPCTSTR)dp);   }   - if (update) + if (bUpdate)   { - ATLTRACE("%s calling Thgstatus::Update\n", (LPCTSTR)dp); + ATLTRACE("%s calling CTHgStatus::Update\n", (LPCTSTR)dp);   CTHgStatus::Update(strPath);   }     exit: - cur.chStatus = chOutStatus; + qsCur.chStatus = chOutStatus;   if (chOutStatus == 'P')   chOutStatus = 'M'; - cur.uTickCount = ::GetTickCount(); - last = cur; + qsCur.uTickCount = ::GetTickCount(); + qsLast = qsCur;   return 1;  }
 
3
4
5
6
 
7
8
9
10
 
 
11
12
 
13
14
15
16
17
 
18
19
20
21
 
 
22
 
3
4
5
 
6
7
 
 
 
8
9
10
 
11
12
13
14
15
 
16
17
18
 
 
19
20
21
@@ -3,20 +3,19 @@
   int GetRegistryConfig(const CString& strName, CString& strRes)  { - LPCTSTR subkey = "Software\\TortoiseHg"; + LPCTSTR lpszSubKey = "Software\\TortoiseHg";   - HKEY hkey = 0; - LONG rv = RegOpenKeyExA( - HKEY_CURRENT_USER, subkey, 0, KEY_READ, &hkey); + HKEY hKey = 0; + LONG lRes = RegOpenKeyExA(HKEY_CURRENT_USER, lpszSubKey, 0, KEY_READ, &hKey);   - if (rv != ERROR_SUCCESS || hkey == 0) + if (lRes != ERROR_SUCCESS || hKey == 0)   return 0;     DWORD cbData = MAX_PATH;   LPTSTR lpszData = strRes.GetBuffer(cbData); - rv = RegQueryValueExA(hkey, strName, 0, 0, (LPBYTE)lpszData, &cbData); + lRes = RegQueryValueExA(hKey, strName, 0, 0, (LPBYTE)lpszData, &cbData);   strRes.ReleaseBuffer(cbData);   - RegCloseKey(hkey); - return rv == ERROR_SUCCESS; + RegCloseKey(hKey); + return lRes == ERROR_SUCCESS;  }
 
21
22
23
24
25
 
 
26
 
21
22
23
 
 
24
25
26
@@ -21,6 +21,6 @@
 // Quotes a string  CString Quote(const CString& str)  { - CString sResult = "\"" + str + "\""; - return sResult; + CString strResult = "\"" + str + "\""; + return strResult;  }
 
20
21
22
23
24
25
 
 
 
26
27
28
29
 
 
 
30
31
32
33
34
35
 
36
37
 
38
39
40
41
42
43
44
 
45
46
 
47
48
49
50
 
 
51
52
53
54
 
55
56
57
58
59
60
61
 
62
63
64
 
20
21
22
 
 
 
23
24
25
26
 
 
 
27
28
29
30
31
32
33
34
 
35
36
 
37
38
39
40
41
42
43
 
44
45
 
46
47
48
 
 
49
50
51
52
53
 
54
55
56
57
58
59
60
 
61
62
63
64
@@ -20,45 +20,45 @@
   CString GetPipeName()  { - DWORD size = 260; - char buf[260]; - if (!::GetUserNameA(buf, &size)) + DWORD dwSize = 260; + char szBuf[260]; + if (!::GetUserNameA(szBuf, &dwSize))   return ""; - CString res = "\\\\.\\pipe\\TortoiseHgRpcServer-bc0c27107423-"; - res += buf; - return res; + CString strRes = "\\\\.\\pipe\\TortoiseHgRpcServer-bc0c27107423-"; + strRes += szBuf; + return strRes;  }      int CTHgStatus::SendRequest(const CString& strRequest)  { - static const CString pname = GetPipeName(); + static const CString strPipeName = GetPipeName();   - if (pname.IsEmpty()) + if (strPipeName.IsEmpty())   return 0;     BOOL fSuccess;   DWORD cbRead;     ATLTRACE("CTHgStatus:SendRequest: sending '%s' to %s\n", - (LPCTSTR)strRequest, (LPCTSTR)pname); + (LPCTSTR)strRequest, (LPCTSTR)strPipeName);   - fSuccess = ::CallNamedPipeA(pname, (void*)(LPCTSTR)strRequest, + fSuccess = ::CallNamedPipeA(strPipeName, (void*)(LPCTSTR)strRequest,   strRequest.GetLength(), 0, 0, &cbRead, NMPWAIT_NOWAIT);   - DWORD err = GetLastError(); - if (fSuccess || err == ERROR_MORE_DATA || err == ERROR_PIPE_NOT_CONNECTED) + DWORD dwErr = GetLastError(); + if (fSuccess || dwErr == ERROR_MORE_DATA || dwErr == ERROR_PIPE_NOT_CONNECTED)   {   return 0;   } - else if (err == ERROR_PIPE_BUSY) + else if (dwErr == ERROR_PIPE_BUSY)   {   ATLTRACE("CTHgStatus::SendRequest: CallNamedPipeA failed (ERROR_PIPE_BUSY)\n");   return -1;   }   else   { - ATLTRACE("CTHgStatus::SendRequest: CallNamedPipeA failed (%d)\n", err); + ATLTRACE("CTHgStatus::SendRequest: CallNamedPipeA failed (%d)\n", dwErr);   return -1;   }  }
 
23
24
25
26
27
 
 
28
29
30
31
32
33
34
 
35
36
37
38
39
 
40
41
 
23
24
25
 
 
26
27
28
29
30
31
32
33
 
34
35
36
37
38
 
39
40
41
@@ -23,19 +23,19 @@
  if (!hIcon)   return 0;   - HBITMAP hBmp = bmpUtils.IconToBitmapPARGB32(hIcon); - if (!hBmp) + HBITMAP hBitmap = bmpUtils.IconToBitmapPARGB32(hIcon); + if (!hBitmap)   {   ATLTRACE("**** GetTortoiseIconBitmap: error: something wrong in "   "bmpUtils.ConvertToPARGB32(hIcon)\n");   return 0;   }   - bmpcache[strIconName] = hBmp; + bmpcache[strIconName] = hBitmap;     ATLTRACE("GetTortoiseIconBitmap: added '%s' to bmpcache_ (%d bitmaps in cache)\n",   (LPCTSTR)strIconName, bmpcache.GetCount());   - return hBmp; + return hBitmap;  }  
 
10
11
12
13
14
 
 
15
16
17
18
 
19
20
21
 
30
31
32
33
34
 
 
35
36
37
 
 
38
39
 
40
41
42
 
45
46
47
48
49
50
 
 
51
52
 
53
54
55
56
57
58
59
 
 
60
61
62
63
64
65
66
 
 
67
68
 
69
70
71
72
 
73
74
 
75
76
77
 
85
86
87
88
89
 
 
90
91
92
93
94
 
 
 
 
95
96
97
98
99
100
101
102
 
 
103
104
 
105
106
107
 
10
11
12
 
 
13
14
15
16
17
 
18
19
20
21
 
30
31
32
 
 
33
34
35
 
 
36
37
38
 
39
40
41
42
 
45
46
47
 
 
 
48
49
50
 
51
52
53
54
55
56
 
 
57
58
59
60
61
62
63
 
 
64
65
66
 
67
68
69
70
 
71
72
 
73
74
75
76
 
84
85
86
 
 
87
88
89
 
 
 
 
90
91
92
93
94
95
96
97
98
99
 
 
100
101
102
 
103
104
105
106
@@ -10,12 +10,12 @@
   CString GetTHgProgRoot()  { - LPCSTR regname = "Software\\TortoiseHg"; - HKEY key = HKEY_LOCAL_MACHINE; + LPCTSTR lpszKeyName = "Software\\TortoiseHg"; + HKEY hKey = HKEY_LOCAL_MACHINE;   TCHAR lpszValue[MAX_PATH] = "";   LONG lpcbLonger = MAX_PATH * sizeof(TCHAR);   - if (RegQueryValue(key, regname, lpszValue, &lpcbLonger) != ERROR_SUCCESS) + if (RegQueryValue(hKey, lpszKeyName, lpszValue, &lpcbLonger) != ERROR_SUCCESS)   return "";     return lpszValue; @@ -30,13 +30,13 @@
 {   ATLTRACE("LaunchCommand: %s\n", (LPCTSTR)strCommand);   ATLTRACE("LaunchCommand: in '%s'\n", (LPCTSTR)strCwd); - PROCESS_INFORMATION processInfo; - memset(&processInfo, 0, sizeof(processInfo)); + PROCESS_INFORMATION pi; + memset(&pi, 0, sizeof(PROCESS_INFORMATION));   - STARTUPINFOA startupInfo; - memset(&startupInfo, 0, sizeof(startupInfo)); + STARTUPINFOA si; + memset(&si, 0, sizeof(STARTUPINFO));   - int res = CreateProcessA( + BOOL bRes = CreateProcessA(   NULL, // No module name, use command line   (LPTSTR)(LPCTSTR)strCommand,   NULL, // Process handle not inherited @@ -45,33 +45,32 @@
  CREATE_NO_WINDOW,   NULL, // use parent's environment   strCwd, - &startupInfo, - &processInfo - ); + &si, + &pi);   - if (res == 0) + if (bRes == 0)   {   ATLTRACE("LaunchCommand: failed to launch\n");   return false;   }   - CloseHandle(processInfo.hProcess); - CloseHandle(processInfo.hThread); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread);   return true;  }    CString GetTemporaryFile(LPCTSTR strPrefix)  { - char tempDir[MAX_PATH + 1]; - char tempFile[MAX_PATH + 1]; + char szTempDir[MAX_PATH + 1]; + char szTempFile[MAX_PATH + 1];   - if (GetTempPath(MAX_PATH, tempDir) == 0) + if (GetTempPath(MAX_PATH, szTempDir) == 0)   {   ATLTRACE("GetTemporaryFile: Failed to find temporary path\n");   } - else if (GetTempFileName(tempDir, strPrefix, 0, tempFile) != 0) + else if (GetTempFileName(szTempDir, strPrefix, 0, szTempFile) != 0)   { - return tempFile; + return szTempFile;   }   else   { @@ -85,23 +84,23 @@
 {   if (strFileName.IsEmpty())   return strFileName; - int pos = strFileName.ReverseFind('\\'); - if (pos == -1) + int nPos = strFileName.ReverseFind('\\'); + if (nPos == -1)   return ""; - CString myfilename = strFileName.Left(pos); - if (!myfilename.IsEmpty() && myfilename[myfilename.GetLength()-1] == ':') - myfilename.AppendChar('\\'); - return myfilename; + CString strDirName = strFileName.Left(nPos); + if (!strDirName.IsEmpty() && strDirName[strDirName.GetLength()-1] == ':') + strDirName.AppendChar('\\'); + return strDirName;  }    CString BaseName(const CString& strFileName)  {   if (strFileName.IsEmpty())   return strFileName; - int pos = strFileName.ReverseFind('\\'); - if (pos == -1) + int nPos = strFileName.ReverseFind('\\'); + if (nPos == -1)   return strFileName; - return strFileName.Mid(pos+1); + return strFileName.Mid(nPos+1);  }    
 
18
19
20
21
 
22
23
24
25
 
 
 
26
27
28
 
29
30
31
 
 
32
33
 
34
35
36
37
 
38
39
40
 
 
41
42
43
 
18
19
20
 
21
22
 
 
 
23
24
25
26
27
 
28
29
 
 
30
31
32
 
33
34
35
36
 
37
38
 
 
39
40
41
42
43
@@ -18,26 +18,26 @@
   #include "Winstat.h"   -int CWinstat::lstat(const char* file, bool time64) +int CWinstat::lstat(LPCTSTR lpszFile, bool bTime64)  { - const __int64 days_between_epochs = 134774L; /* days between 1.1.1601 and 1.1.1970 */ - const __int64 secs_between_epochs = (__int64)days_between_epochs * 86400L; - const __int64 divisor = 10000000L; + const LONGLONG llDaysBetweenEpochs = 134774L; /* days between 1.1.1601 and 1.1.1970 */ + const LONGLONG llSecsBetweenEpochs = llDaysBetweenEpochs * 86400L; + const LONGLONG llDivisor = 10000000L;     WIN32_FIND_DATAA data; - HANDLE hfind; + HANDLE hFind;   - hfind = FindFirstFileA(file, &data); - if (hfind == INVALID_HANDLE_VALUE) + hFind = FindFirstFileA(lpszFile, &data); + if (hFind == INVALID_HANDLE_VALUE)   return -1; - FindClose(hfind); + FindClose(hFind);     ullMTime = (((LONGLONG)data.ftLastWriteTime.dwHighDateTime << 32) +   data.ftLastWriteTime.dwLowDateTime); - if (!time64) + if (!bTime64)   { - ullMTime /= divisor; - ullMTime -= secs_between_epochs; + ullMTime /= llDivisor; + ullMTime -= llSecsBetweenEpochs;   }   ullSize = ((LONGLONG)data.nFileSizeHigh << 32) + data.nFileSizeLow;   bIsDir = (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
 
24
25
26
27
 
28
29
30
 
24
25
26
 
27
28
29
30
@@ -24,7 +24,7 @@
  ULONGLONG ullMTime;   bool bIsDir;   - int lstat(const char* file, bool time64 = false); + int lstat(LPCTSTR lpszFile, bool bTime64 = false);  };    #endif
 
25
26
27
28
29
 
 
30
31
32
 
34
35
36
37
38
 
 
39
40
41
42
 
 
43
44
45
 
47
48
49
50
 
51
52
53
 
54
55
56
 
58
59
60
61
62
63
64
 
 
 
65
66
67
 
 
68
69
70
 
 
71
72
73
74
75
76
77
78
 
 
 
79
80
81
82
83
84
 
 
 
85
86
 
87
88
89
 
25
26
27
 
 
28
29
30
31
32
 
34
35
36
 
 
37
38
39
40
 
 
41
42
43
44
45
 
47
48
49
 
50
51
52
 
53
54
55
56
 
58
59
60
 
 
 
 
61
62
63
64
 
 
65
66
67
 
 
68
69
70
71
72
73
74
 
 
 
75
76
77
78
79
80
 
 
 
81
82
83
84
 
85
86
87
88
@@ -25,8 +25,8 @@
 {   bUnset = false;   - FILE *f = fopenReadRenameAllowed(strPath); - if (!f) + FILE *pFile = fopenReadRenameAllowed(strPath); + if (!pFile)   {   ATLTRACE("Dirstate::read: can't open '%s'\n", (LPCTSTR)strPath);   return CAutoPtr<CDirstate>(NULL); @@ -34,12 +34,12 @@
    CAutoPtr<CDirstate> pd(new CDirstate());   - fread(&pd->m_szParent1, sizeof(char), HASH_LENGTH, f); - fread(&pd->m_szParent2, sizeof(char), HASH_LENGTH, f); + fread(&pd->m_szParent1, sizeof(char), HASH_LENGTH, pFile); + fread(&pd->m_szParent2, sizeof(char), HASH_LENGTH, pFile);     CDirentry e; - CString relpath; - while (e.Read(f, relpath)) + CString strRelPath; + while (e.Read(pFile, strRelPath))   {   if (e.Unset())   bUnset = true; @@ -47,10 +47,10 @@
  if (e.m_chState == 'a')   ++pd->m_nNumAdded;   - pd->Add(relpath, e); + pd->Add(strRelPath, e);   }   - fclose(f); + fclose(pFile);     return pd;  } @@ -58,32 +58,31 @@
   static char *RevHashString(const char achRevHash[HASH_LENGTH])  { - unsigned ix; - static char rev_string[HASH_LENGTH * 2 + 1]; - static char *hexval = "0123456789abcdef"; - for (ix = 0; ix < HASH_LENGTH; ++ix) + static char szRevString[HASH_LENGTH * 2 + 1]; + static LPCTSTR lpszHexVal = "0123456789abcdef"; + for (int i = 0; i < HASH_LENGTH; ++i)   { - rev_string[ix * 2] = hexval[(achRevHash[ix] >> 4) & 0xf]; - rev_string[ix * 2 + 1] = hexval[achRevHash[ix] & 0xf]; + szRevString[i * 2] = lpszHexVal[(achRevHash[i] >> 4) & 0xf]; + szRevString[i * 2 + 1] = lpszHexVal[achRevHash[i] & 0xf];   } - rev_string[HASH_LENGTH * 2] = 0; - return rev_string; + szRevString[HASH_LENGTH * 2] = 0; + return szRevString;  }      void TestRead()  { - bool unset; - CAutoPtr<CDirstate> pd = CDirstate::Read(".hg/dirstate", unset); - if ((CDirstate*)pd == NULL) { + bool bUnset; + CAutoPtr<CDirstate> pDirstate = CDirstate::Read(".hg/dirstate", bUnset); + if ((CDirstate*)pDirstate == NULL) {   printf("error: could not read .hg/dirstate\n");   return;   } - printf("parent1: %s\n", RevHashString(pd->m_szParent1)); - printf("parent2: %s\n", RevHashString(pd->m_szParent2)); - printf("entries: %d\n\n", pd->Size()); + printf("parent1: %s\n", RevHashString(pDirstate->m_szParent1)); + printf("parent2: %s\n", RevHashString(pDirstate->m_szParent2)); + printf("entries: %d\n\n", pDirstate->Size());   - pd->Root().Print(); + pDirstate->Root().Print();  }