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

fogcreek shellext: renamed classes for consistency, part 2

Changeset 520d25731018

Parent 76b734f5c15f

by David Golub

Changes to 26 files · Browse files at 520d25731018 Showing diff from parent 76b734f5c15f Diff from another changeset...

 
204
205
206
207
 
208
209
210
 
252
253
254
255
 
256
257
258
 
366
367
368
369
 
370
371
372
 
529
530
531
532
 
533
534
535
 
784
785
786
787
 
788
789
790
791
792
 
793
794
795
 
825
826
827
828
 
829
830
831
 
858
859
860
861
 
862
863
864
 
204
205
206
 
207
208
209
210
 
252
253
254
 
255
256
257
258
 
366
367
368
 
369
370
371
372
 
529
530
531
 
532
533
534
535
 
784
785
786
 
787
788
789
790
791
 
792
793
794
795
 
825
826
827
 
828
829
830
831
 
858
859
860
 
861
862
863
864
@@ -204,7 +204,7 @@
  mi.cch = menuText.GetLength();   mi.wID = idCmd;   - if (SysInfo::Instance().IsVistaOrLater()) + if (CSysInfo::Instance().IsVistaOrLater())   {   HBITMAP hBmp = GetTortoiseIconBitmap(iconName);   if (hBmp) @@ -252,7 +252,7 @@
  mi.wID = idCmd;   mi.hSubMenu = hSubMenu;   - if (SysInfo::Instance().IsVistaOrLater()) + if (CSysInfo::Instance().IsVistaOrLater())   {   HBITMAP hBmp = GetTortoiseIconBitmap(iconName);   if (hBmp) @@ -366,7 +366,7 @@
   void CTortoiseHgCmenuBase::TweakMenuForVista(HMENU hMenu)  { - if (!SysInfo::Instance().IsVistaOrLater()) + if (!CSysInfo::Instance().IsVistaOrLater())   return;     MENUINFO MenuInfo = {}; @@ -529,7 +529,7 @@
    InsertMenu(hMenu, indexMenu++, MF_SEPARATOR | MF_BYPOSITION, 0, NULL);   - InitStatus::check(); + CInitStatus::check();     TweakMenuForVista(hMenu);   @@ -784,12 +784,12 @@
    if (cmd == "thgstatus")   { - if (Thgstatus::remove(cwd) != 0) + if (CTHgStatus::remove(cwd) != 0)   {   CString p = dir + "\\TortoiseHgOverlayServer.exe";   LaunchCommand(Quote(p), dir);   } - InitStatus::check(); + CInitStatus::check();   return;   }   @@ -825,7 +825,7 @@
  }     LaunchCommand(hgcmd, cwd); - InitStatus::check(); + CInitStatus::check();  }    void CTortoiseHgCmenuBase::PrintDebugHeader(LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj) @@ -858,7 +858,7 @@
  }     ATLTRACE(L"---- TortoiseHg shell extension version %s ----", - (LPCTSTR)ThgVersion::get()); + (LPCTSTR)THgVersion);     ATLTRACE(" pIDFolder: %p\n", pIDFolder);   ATLTRACE(" pDataObj: %p\n", pDataObj);
 
23
24
25
26
27
28
 
29
30
31
 
37
38
39
40
 
41
42
43
 
70
71
72
73
 
74
75
76
77
78
 
79
80
81
82
83
84
 
85
86
87
 
93
94
95
96
 
97
98
99
100
 
101
102
103
 
106
107
108
109
 
110
111
112
 
116
117
118
119
 
120
121
122
123
124
 
125
126
127
 
129
130
131
132
 
133
134
135
 
139
140
141
142
 
143
144
145
 
149
150
151
152
 
153
154
155
 
163
164
165
166
 
167
168
169
170
171
 
172
173
174
 
187
188
189
190
 
191
192
193
 
203
204
205
206
 
207
208
209
210
211
 
212
213
214
 
226
227
228
229
 
230
231
232
 
23
24
25
 
 
 
26
27
28
29
 
35
36
37
 
38
39
40
41
 
68
69
70
 
71
72
73
74
75
 
76
77
78
79
80
81
 
82
83
84
85
 
91
92
93
 
94
95
96
97
 
98
99
100
101
 
104
105
106
 
107
108
109
110
 
114
115
116
 
117
118
119
120
121
 
122
123
124
125
 
127
128
129
 
130
131
132
133
 
137
138
139
 
140
141
142
143
 
147
148
149
 
150
151
152
153
 
161
162
163
 
164
165
166
167
168
 
169
170
171
172
 
185
186
187
 
188
189
190
191
 
201
202
203
 
204
205
206
207
208
 
209
210
211
212
 
224
225
226
 
227
228
229
230
@@ -23,9 +23,7 @@
 #include "Winstat.h"     -Directory::Directory( - Directory* p, const CString& n, const CString& basepath -): +CDirectory::CDirectory(CDirectory* p, const CString& n, const CString& basepath) :   parent_(p), name_(n)  {   if (n.IsEmpty()) @@ -37,7 +35,7 @@
 }     -Directory::~Directory() +CDirectory::~CDirectory()  {   POSITION position = subdirs_.GetHeadPosition();   while (position != NULL) @@ -70,18 +68,18 @@
 }     -int Directory::add(CString n, Direntry& e) +int CDirectory::add(CString n, CDirentry& e)  {   CString base;   CString rest;   - Directory* cur = this; + CDirectory* cur = this;     for (;;)   {     if (!splitbase(n, base, rest)) { - ATLTRACE("Directory('%s')::add(%d): splitbase returned 0\n", + ATLTRACE("CDirectory('%s')::add(%d): splitbase returned 0\n",   (LPCTSTR)path(), (LPCTSTR)n);   return 0;   } @@ -93,11 +91,11 @@
  return 1;   }   - Directory* d = 0; + CDirectory* d = 0;   POSITION position = cur->subdirs_.GetHeadPosition();   while (position != NULL)   { - Directory* pItem = cur->subdirs_.GetNext(position); + CDirectory* pItem = cur->subdirs_.GetNext(position);   if (pItem->name_ == base) {   d = pItem;   break; @@ -106,7 +104,7 @@
    if (!d)   { - d = new Directory(cur, base, cur->path()); + d = new CDirectory(cur, base, cur->path());   cur->subdirs_.AddTail(d);   }   @@ -116,12 +114,12 @@
 }     -const Direntry* Directory::get(CString n) const +const CDirentry* CDirectory::get(CString n) const  {   CString base;   CString rest;   - const Directory* cur = this; + const CDirectory* cur = this;     for (;;)   { @@ -129,7 +127,7 @@
    if (!splitbase(n, base, rest))   { - ATLTRACE("Directory('%s')::get(%d): splitbase returned 0\n", + ATLTRACE("CDirectory('%s')::get(%d): splitbase returned 0\n",   (LPCTSTR)path(), n);   return 0;   } @@ -139,7 +137,7 @@
  POSITION position = cur->files_.GetHeadPosition();   while (position != NULL)   { - const Direntry& rItem = cur->files_.GetNext(position); + const CDirentry& rItem = cur->files_.GetNext(position);   if (rItem.name == n)   return &rItem;   } @@ -149,7 +147,7 @@
  POSITION position = cur->subdirs_.GetHeadPosition();   while (position != NULL)   { - Directory* pItem = cur->subdirs_.GetNext(position); + CDirectory* pItem = cur->subdirs_.GetNext(position);   if (pItem->name_ == base)   {   cur = pItem; @@ -163,12 +161,12 @@
 }     -Directory* Directory::getdir(CString n) +CDirectory* CDirectory::getdir(CString n)  {   CString base;   CString rest;   - const Directory* cur = this; + const CDirectory* cur = this;     for (;;)   { @@ -187,7 +185,7 @@
  POSITION position = cur->subdirs_.GetHeadPosition();   while (position != NULL)   { - Directory* pItem = cur->subdirs_.GetNext(position); + CDirectory* pItem = cur->subdirs_.GetNext(position);   if (pItem->name_ == searchstr)   {   if (leaf) @@ -203,12 +201,12 @@
 }     -void Directory::print() const +void CDirectory::print() const  {   POSITION position = subdirs_.GetHeadPosition();   while (position != NULL)   { - const Directory* d = subdirs_.GetNext(position); + const CDirectory* d = subdirs_.GetNext(position);   if (!d)   {   ATLTRACE("Directory('%s')::print: error: d is 0\n", (LPCTSTR)path()); @@ -226,7 +224,7 @@
  position = files_.GetHeadPosition();   while (position != NULL)   { - const Direntry& rItem = files_.GetNext(position); + const CDirentry& rItem = files_.GetNext(position);   CString p = (!base.IsEmpty() ? base + "/" + rItem.name : rItem.name);   t = rItem.mtime;   errno_t err = ctime_s(ctime_res, 26, &t);
 
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
 
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
@@ -20,25 +20,25 @@
   #include "Direntry.h"   -class Directory +class CDirectory  { - Directory* const parent_; + CDirectory* const parent_;   const CString name_;   CString path_;   - CAtlList<Directory*> subdirs_; - CAtlList<Direntry> files_; + CAtlList<CDirectory*> subdirs_; + CAtlList<CDirentry> files_;    public: - Directory(Directory* p, const CString& n, const CString& basepath); - ~Directory(); + CDirectory(CDirectory* p, const CString& n, const CString& basepath); + ~CDirectory();     const CString& path() const { return path_; }   - int add(CString relpath, Direntry& e); + int add(CString relpath, CDirentry& e);   - const Direntry* get(CString relpath) const; - Directory* getdir(CString n); + const CDirentry* get(CString relpath) const; + CDirectory* getdir(CString n);     void print() const;  };
 
21
22
23
24
 
25
26
27
 
32
33
34
35
 
36
37
38
 
56
57
58
59
 
60
61
62
 
66
67
68
69
 
70
71
 
72
73
74
75
 
76
77
78
 
134
135
136
137
 
138
139
140
 
142
143
144
145
 
146
147
148
 
159
160
161
162
163
 
21
22
23
 
24
25
26
27
 
32
33
34
 
35
36
37
38
 
56
57
58
 
59
60
61
62
 
66
67
68
 
69
70
 
71
72
73
74
 
75
76
77
78
 
134
135
136
 
137
138
139
140
 
142
143
144
 
145
146
147
148
 
159
160
161
 
 
@@ -21,7 +21,7 @@
 #include "TortoiseUtils.h"     -char DirectoryStatus::status(CString relpath) const +char CDirectoryStatus::status(CString relpath) const  {   char res = 'C';   bool added = false; @@ -32,7 +32,7 @@
  POSITION position = v_.GetHeadPosition();   while (position != NULL)   { - const E& rEntry = v_.GetNext(position); + const CEntry& rEntry = v_.GetNext(position);   if (relpath.IsEmpty() || rEntry.path_.Left(relpath.GetLength()) == relpath)   {   if (rEntry.status_ == 'm' || rEntry.status_ == 'r') @@ -56,7 +56,7 @@
 }     -int DirectoryStatus::read(const CString& hgroot, const CString& cwd) +int CDirectoryStatus::read(const CString& hgroot, const CString& cwd)  {   v_.RemoveAll();   noicons_ = false; @@ -66,13 +66,13 @@
  FILE *f = fopenReadRenameAllowed(p);   if (!f)   { - ATLTRACE("DirectoryStatus::read: can't open '%s'\n", p); + ATLTRACE("CDirectoryStatus::read: can't open '%s'\n", p);   CString p = (cwd.GetLength() < hgroot.GetLength() ? hgroot : cwd); - Thgstatus::update(p); + CTHgStatus::update(p);   return 0;   }   - DirectoryStatus::E e; + CDirectoryStatus::CEntry e;     int res = 1;   const CString noicons = "@@noicons"; @@ -134,7 +134,7 @@
 struct CacheEntry  {   CString hgroot_; - DirectoryStatus ds_; + CDirectoryStatus ds_;   bool readfailed_;   unsigned tickcount_;   @@ -142,7 +142,7 @@
 };     -DirectoryStatus* DirectoryStatus::get( +CDirectoryStatus* CDirectoryStatus::get(   const CString& hgroot, const CString& cwd)  {   static CacheEntry ce; @@ -159,5 +159,3 @@
    return (ce.readfailed_ ? 0 : &ce.ds_);  } - -
 
14
15
16
17
 
18
19
 
20
21
22
23
24
 
25
26
27
 
28
29
30
31
 
32
33
 
34
35
36
 
14
15
16
 
17
18
 
19
20
21
22
23
 
24
25
26
 
27
28
29
30
 
31
32
 
33
34
35
36
@@ -14,23 +14,23 @@
 // You should have received a copy of the GNU General Public License  // along with this program. If not, see <http://www.gnu.org/licenses/>.   -class DirectoryStatus +class CDirectoryStatus  { - struct E + struct CEntry   {   CString path_;   char status_;   - E(): status_(0) {} + CEntry(): status_(0) {}   };   - CAtlList<E> v_; + CAtlList<CEntry> v_;   bool noicons_;    public: - DirectoryStatus(): noicons_(false) {} + CDirectoryStatus(): noicons_(false) {}   - static DirectoryStatus* get(const CString& hgroot, const CString& cwd); + static CDirectoryStatus* get(const CString& hgroot, const CString& cwd);   char status(CString relpath) const;   bool noicons() const { return noicons_; }  
 
21
22
23
24
 
25
26
27
 
48
49
50
51
 
52
53
54
 
68
69
70
71
 
21
22
23
 
24
25
26
27
 
48
49
50
 
51
52
53
54
 
68
69
70
 
@@ -21,7 +21,7 @@
 #include "Winstat.h"     -int Direntry::read(FILE* f, CString& relpath) +int CDirentry::read(FILE* f, CString& relpath)  {   if (fread(&state, sizeof(state), 1, f) != 1)   return 0; @@ -48,7 +48,7 @@
 }     -char Direntry::status(const Winstat& stat) const +char CDirentry::status(const CWinstat& stat) const  {   switch (this->state)   { @@ -68,4 +68,3 @@
  return '?';   }  } -
 
23
24
25
26
 
27
28
 
29
30
31
 
36
37
38
39
 
40
41
42
 
23
24
25
 
26
27
 
28
29
30
31
 
36
37
38
 
39
40
41
42
@@ -23,9 +23,9 @@
 #define uint32_t UINT32  #endif   -class Winstat; +class CWinstat;   -class Direntry +class CDirentry  {  public:   unsigned char state; @@ -36,7 +36,7 @@
  CString name;     int read(FILE* f, CString& relpath); - char status(const Winstat& stat) const; + char status(const CWinstat& stat) const;     bool unset() const {   return (state == 'n') && (mode == 0) && (size == -1) && (mtime == -1);
 
22
23
24
25
 
26
27
 
28
29
30
31
32
 
33
34
35
 
37
38
39
40
 
41
42
43
44
45
46
 
47
48
49
 
54
55
56
57
 
58
59
60
 
61
62
63
64
65
66
 
 
67
68
69
70
 
71
72
73
 
75
76
77
78
 
79
80
81
82
83
84
 
 
85
86
87
88
89
90
 
91
92
93
 
104
105
106
107
 
108
109
110
111
 
112
113
114
115
116
 
117
118
119
 
122
123
124
125
 
126
127
128
129
130
 
131
132
133
 
137
138
139
140
 
141
142
143
 
145
146
147
148
149
 
 
150
151
152
153
 
154
155
156
157
158
159
160
 
161
162
163
 
165
166
167
168
 
169
170
171
 
22
23
24
 
25
26
 
27
28
29
30
31
 
32
33
34
35
 
37
38
39
 
40
41
42
43
44
45
 
46
47
48
49
 
54
55
56
 
57
58
59
 
60
61
62
63
64
 
 
65
66
67
68
69
 
70
71
72
73
 
75
76
77
 
78
79
80
81
82
 
 
83
84
85
86
87
88
89
 
90
91
92
93
 
104
105
106
 
107
108
109
110
 
111
112
113
114
115
 
116
117
118
119
 
122
123
124
 
125
126
127
128
129
 
130
131
132
133
 
137
138
139
 
140
141
142
143
 
145
146
147
 
 
148
149
150
151
152
 
153
154
155
156
157
158
159
 
160
161
162
163
 
165
166
167
 
168
169
170
171
@@ -22,14 +22,14 @@
 #include "Thgstatus.h"  #include "Winstat.h"   -CAtlList<Dirstatecache::E>& Dirstatecache::cache() +CAtlList<CDirstateCache::CEntry>& CDirstateCache::cache()  { - static CAtlList<Dirstatecache::E> c; + static CAtlList<CDirstateCache::CEntry> c;   return c;  }     -Dirstate* Dirstatecache::get(const CString& hgroot, const CString& cwd, +CDirstate* CDirstateCache::get(const CString& hgroot, const CString& cwd,   bool& unset, bool usekbfiles)  {   unset = false; @@ -37,13 +37,13 @@
  POSITION position = cache().GetHeadPosition();   while (position != NULL)   { - E& rItem = cache().GetAt(position); + CEntry& rItem = cache().GetAt(position);   if (hgroot == rItem.hgroot && usekbfiles == rItem.usekbfiles)   break;   cache().GetNext(position);   }   - Winstat stat; + CWinstat stat;   CString path = hgroot + (usekbfiles ? "\\.hg\\kilnbfiles\\dirstate"   : "\\.hg\\dirstate");   @@ -54,20 +54,20 @@
  {   if (stat.lstat(path, true) != 0)   { - ATLTRACE("Dirstatecache::get: lstat('%s') failed\n", (LPCTSTR)path); + ATLTRACE("CDirstateCache::get: lstat('%s') failed\n", (LPCTSTR)path);   return 0;   } - ATLTRACE("Dirstatecache::get: lstat('%s') ok\n", (LPCTSTR)path); + ATLTRACE("CDirstateCache::get: lstat('%s') ok\n", (LPCTSTR)path);   new_stat = true;     if (cache().GetCount() >= 10)   { - E e = cache().RemoveTail(); - ATLTRACE("Dirstatecache::get: dropping '%s'\n", (LPCTSTR)e.hgroot); + CEntry e = cache().RemoveTail(); + ATLTRACE("CDirstateCache::get: dropping '%s'\n", (LPCTSTR)e.hgroot);   delete e.dstate;   }   - E e; + CEntry e;   e.hgroot = hgroot;   e.usekbfiles = usekbfiles;   e.tickcount = tc; @@ -75,19 +75,19 @@
  position = cache().GetHeadPosition();   }   - E& rItem = cache().GetAt(position); + CEntry& rItem = cache().GetAt(position);   if (!new_stat && tc - rItem.tickcount > 500)   {   if (0 != stat.lstat(path, true))   { - ATLTRACE("Dirstatecache::get: lstat('%s') failed\n", (LPCTSTR)path); - ATLTRACE("Dirstatecache::get: dropping '%s'\n", (LPCTSTR)rItem.hgroot); + ATLTRACE("CDirstateCache::get: lstat('%s') failed\n", (LPCTSTR)path); + ATLTRACE("CDirstateCache::get: dropping '%s'\n", (LPCTSTR)rItem.hgroot);   delete rItem.dstate;   cache().RemoveAt(position);   return 0;   }   rItem.tickcount = tc; - ATLTRACE("Dirstatecache::get: lstat('%s') ok\n", (LPCTSTR)path); + ATLTRACE("CDirstateCache::get: lstat('%s') ok\n", (LPCTSTR)path);   new_stat = true;   }   @@ -104,16 +104,16 @@
  return rItem.dstate;   }   - ATLTRACE("Dirstatecache::get: refreshing '%s'\n", hgroot); + ATLTRACE("CDirstateCache::get: refreshing '%s'\n", hgroot);   }   else   { - ATLTRACE("Dirstatecache::get: reading '%s'\n", hgroot); + ATLTRACE("CDirstateCache::get: reading '%s'\n", hgroot);   }     unset = false;   unsigned tc0 = GetTickCount(); - CAutoPtr<Dirstate> ds = Dirstate::read(path, unset); + CAutoPtr<CDirstate> ds = CDirstate::read(path, unset);   unsigned tc1 = GetTickCount();     bool request_thgstatus_update = true; @@ -122,12 +122,12 @@
  {   if (rItem.unset)   { - ATLTRACE("Dirstatecache::get: **** old and new have unset entries\n"); + ATLTRACE("CDirstateCache::get: **** old and new have unset entries\n");   request_thgstatus_update = false;   }   else   { - ATLTRACE("Dirstatecache::get: new has unset entries\n"); + ATLTRACE("CDirstateCache::get: new has unset entries\n");   }   }   @@ -137,7 +137,7 @@
  rItem.dstate = ds.Detach();     unsigned delta = tc1 - tc0; - ATLTRACE("Dirstatecache::get: read done in %d ticks, %d repos in cache\n", + ATLTRACE("CDirstateCache::get: read done in %d ticks, %d repos in cache\n",   delta, cache().GetCount());     rItem.dstate_mtime = stat.mtime; @@ -145,19 +145,19 @@
    if (request_thgstatus_update)   { - ATLTRACE("Dirstatecache::get: calling Thgstatus::update\n"); - Thgstatus::update(cwd); + ATLTRACE("CDirstateCache::get: calling Thgstatus::update\n"); + CTHgStatus::update(cwd);   }   else   { - ATLTRACE("Dirstatecache::get: omitting Thgstatus::update\n"); + ATLTRACE("CDirstateCache::get: omitting Thgstatus::update\n");   }     return rItem.dstate;  }     -void Dirstatecache::invalidate(const CString& hgroot, bool usekbfiles) +void CDirstateCache::invalidate(const CString& hgroot, bool usekbfiles)  {   if (hgroot.IsEmpty())   return; @@ -165,7 +165,7 @@
  POSITION position = cache().GetHeadPosition();   while (position != NULL)   { - E& rItem = cache().GetAt(position); + CEntry& rItem = cache().GetAt(position);   if (hgroot == rItem.hgroot && usekbfiles == rItem.usekbfiles)   {   delete rItem.dstate;
 
18
19
20
21
 
22
23
 
24
25
 
26
27
 
28
29
30
 
33
34
35
36
 
37
38
39
 
43
44
45
46
 
47
48
49
 
50
51
52
 
18
19
20
 
21
22
 
23
24
 
25
26
 
27
28
29
30
 
33
34
35
 
36
37
38
39
 
43
44
45
 
46
47
48
 
49
50
51
52
@@ -18,13 +18,13 @@
 #ifndef _DIRSTATECACHE_H  #define _DIRSTATECACHE_H   -class Dirstate; +class CDirstate;   -class Dirstatecache +class CDirstateCache  { - struct E + struct CEntry   { - Dirstate* dstate; + CDirstate* dstate;   __int64 dstate_mtime;   __int64 dstate_size;   @@ -33,7 +33,7 @@
  bool unset;   bool usekbfiles;   - E(): + CEntry() :   dstate(0),   dstate_mtime(0),   dstate_size(0), @@ -43,10 +43,10 @@
  {}   };   - static CAtlList<E>& cache(); + static CAtlList<CEntry>& cache();    public: - static Dirstate* get(const CString& hgroot, const CString& cwd, bool& unset, + static CDirstate* get(const CString& hgroot, const CString& cwd, bool& unset,   bool usekbfiles = false);   static void invalidate(const CString& hgroot, bool usekbfiles = false);  };
 
22
23
24
25
26
 
 
27
28
 
29
30
31
 
38
39
40
41
 
42
43
44
45
46
47
 
48
49
50
 
102
103
104
105
 
106
107
108
 
159
160
161
162
 
163
164
165
 
185
186
187
188
 
189
190
191
 
212
213
214
215
 
216
217
218
 
231
232
233
234
 
235
236
237
 
22
23
24
 
 
25
26
27
 
28
29
30
31
 
38
39
40
 
41
42
43
44
45
46
 
47
48
49
50
 
102
103
104
 
105
106
107
108
 
159
160
161
 
162
163
164
165
 
185
186
187
 
188
189
190
191
 
212
213
214
 
215
216
217
218
 
231
232
233
 
234
235
236
237
@@ -22,10 +22,10 @@
 #include "IconBitmapUtils.h"  #include "SysInfo.h"   -IconBitmapUtils::IconBitmapUtils() - : hUxTheme(NULL) +CIconBitmapUtils::CIconBitmapUtils() : + hUxTheme(NULL)  { - if (SysInfo::Instance().IsVistaOrLater()) + if (CSysInfo::Instance().IsVistaOrLater())   {   hUxTheme = LoadLibrary(_T("UXTHEME.DLL"));   @@ -38,13 +38,13 @@
  }  }   -IconBitmapUtils::~IconBitmapUtils() +CIconBitmapUtils::~CIconBitmapUtils()  {   if (hUxTheme)   FreeLibrary(hUxTheme);  }   -HBITMAP IconBitmapUtils::IconToBitmap(HICON hIcon) +HBITMAP CIconBitmapUtils::IconToBitmap(HICON hIcon)  {   if (!hIcon)   return NULL; @@ -102,7 +102,7 @@
  return bmp;  }   -HBITMAP IconBitmapUtils::IconToBitmapPARGB32(HICON hIcon) +HBITMAP CIconBitmapUtils::IconToBitmapPARGB32(HICON hIcon)  {   if (!hIcon)   return NULL; @@ -159,7 +159,7 @@
  return hBmp;  }   -HRESULT IconBitmapUtils::Create32BitHBITMAP(HDC hdc, const SIZE *psize, __deref_opt_out void **ppvBits, __out HBITMAP* phBmp) +HRESULT CIconBitmapUtils::Create32BitHBITMAP(HDC hdc, const SIZE *psize, __deref_opt_out void **ppvBits, __out HBITMAP* phBmp)  {   *phBmp = NULL;   @@ -185,7 +185,7 @@
  return (NULL == *phBmp) ? E_OUTOFMEMORY : S_OK;  }   -HRESULT IconBitmapUtils::ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hdc, HICON hicon, SIZE& sizIcon) +HRESULT CIconBitmapUtils::ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hdc, HICON hicon, SIZE& sizIcon)  {   RGBQUAD *prgbQuad;   int cxRow; @@ -212,7 +212,7 @@
  return hr;  }   -bool IconBitmapUtils::HasAlpha(__in Gdiplus::ARGB *pargb, SIZE& sizImage, int cxRow) +bool CIconBitmapUtils::HasAlpha(__in Gdiplus::ARGB *pargb, SIZE& sizImage, int cxRow)  {   ULONG cxDelta = cxRow - sizImage.cx;   for (ULONG y = sizImage.cy; y; --y) @@ -231,7 +231,7 @@
  return false;  }   -HRESULT IconBitmapUtils::ConvertToPARGB32(HDC hdc, __inout Gdiplus::ARGB *pargb, HBITMAP hbmp, SIZE& sizImage, int cxRow) +HRESULT CIconBitmapUtils::ConvertToPARGB32(HDC hdc, __inout Gdiplus::ARGB *pargb, HBITMAP hbmp, SIZE& sizImage, int cxRow)  {   BITMAPINFO bmi;   SecureZeroMemory(&bmi, sizeof(bmi));
 
32
33
34
35
 
36
37
38
39
 
 
40
41
42
 
32
33
34
 
35
36
37
 
 
38
39
40
41
42
@@ -32,11 +32,11 @@
  * \ingroup utils   * provides helper functions for converting icons to bitmaps   */ -class IconBitmapUtils +class CIconBitmapUtils  {  public: - IconBitmapUtils(void); - ~IconBitmapUtils(void); + CIconBitmapUtils(); + ~CIconBitmapUtils();     HBITMAP IconToBitmap(HICON hIcon);   HBITMAP IconToBitmapPARGB32(HICON hIcon);
 
20
21
22
23
 
24
25
 
26
27
28
29
30
 
31
32
33
 
35
36
37
38
 
39
40
 
41
42
43
 
53
54
55
56
 
57
58
59
 
20
21
22
 
23
24
 
25
26
27
28
29
 
30
31
32
33
 
35
36
37
 
38
39
 
40
41
42
43
 
53
54
55
 
56
57
58
59
@@ -20,14 +20,14 @@
 #include "Thgstatus.h"     -InitStatus& InitStatus::inst() +CInitStatus& CInitStatus::inst()  { - static InitStatus s; + static CInitStatus s;   return s;  }     -void InitStatus::add(CString& s, const char* missing) +void CInitStatus::add(CString& s, const char* missing)  {   if (!s.IsEmpty())   s += ", "; @@ -35,9 +35,9 @@
 }     -CString InitStatus::check() +CString CInitStatus::check()  { - const InitStatus& self = inst(); + const CInitStatus& self = inst();   CString missing;     if (self.unchanged_ == 0) @@ -53,7 +53,7 @@
  return "";     CString reason = "uninitialized handlers: " + missing; - Thgstatus::error(reason); + CTHgStatus::error(reason);   CString res = "InitStatus: error: " + reason;   ATLTRACE("***** %s\n", (LPCTSTR)res);   return res;
 
14
15
16
17
 
18
19
20
 
22
23
24
25
 
26
27
28
29
30
 
 
31
32
33
 
14
15
16
 
17
18
19
20
 
22
23
24
 
25
26
27
28
 
 
29
30
31
32
33
@@ -14,7 +14,7 @@
 // You should have received a copy of the GNU General Public License  // along with this program. If not, see <http://www.gnu.org/licenses/>.   -class InitStatus +class CInitStatus  {  public:   int unchanged_; @@ -22,12 +22,12 @@
  int modified_;   int notinrepo_;   - static InitStatus& inst(); + static CInitStatus& inst();   static CString check();    private: - InitStatus() - : unchanged_(0), added_(0), modified_(0), notinrepo_(0) {} + CInitStatus() : + unchanged_(0), added_(0), modified_(0), notinrepo_(0) {}     static void add(CString& s, const char* missing);  };
 
93
94
95
96
 
97
98
99
 
148
149
150
151
 
152
153
154
 
258
259
260
261
 
262
263
264
 
276
277
278
279
 
280
281
282
 
285
286
287
288
 
289
290
291
 
303
304
305
306
 
307
308
309
 
318
319
320
321
 
322
323
324
325
 
326
327
328
 
374
375
376
377
 
378
379
380
 
93
94
95
 
96
97
98
99
 
148
149
150
 
151
152
153
154
 
258
259
260
 
261
262
263
264
 
276
277
278
 
279
280
281
282
 
285
286
287
 
288
289
290
291
 
303
304
305
 
306
307
308
309
 
318
319
320
 
321
322
323
324
 
325
326
327
328
 
374
375
376
 
377
378
379
380
@@ -93,7 +93,7 @@
  {   p.Truncate(pos);   p += "\\.hg\\kilnbfiles\\dirstate"; - Winstat stat; + CWinstat stat;   if (stat.lstat(p, true) == 0)   {   // ignore files and dirs named '.kbf' when kbfiles is enabled @@ -148,7 +148,7 @@
  if (ticks > 5000 /* ms */)   {   CString reason = "ignoring slow \"" + p + "\""; - Thgstatus::error(reason); + CTHgStatus::error(reason);   file_access_is_unacceptably_slow = true;   goto exit;   } @@ -258,7 +258,7 @@
  relpath.SetAt(i, '/');   }   - DirectoryStatus* pdirsta = DirectoryStatus::get(cur.hgroot, cur.basedir); + CDirectoryStatus* pdirsta = CDirectoryStatus::get(cur.hgroot, cur.basedir);   if (pdirsta && pdirsta->noicons())   {   last = cur; @@ -276,7 +276,7 @@
    bool unset = false;   - Dirstate* pds = Dirstatecache::get(cur.hgroot, cur.basedir, unset); + CDirstate* pds = CDirstateCache::get(cur.hgroot, cur.basedir, unset);   if (!pds)   {   ATLTRACE("%s Dirstatecache::get('%s') returns no Dirstate\n", (LPCTSTR)dp, @@ -285,7 +285,7 @@
  return 0;   }   - Winstat stat; + CWinstat stat;   if (0 != stat.lstat(path))   {   ATLTRACE("%s lstat('%s') failed", (LPCTSTR)dp, (LPCTSTR)path); @@ -303,7 +303,7 @@
  if (!relpath.IsEmpty() && !pds->root().getdir(relpath))   {   // attempt to get status from kbfiles - pds = Dirstatecache::get(cur.hgroot, cur.basedir, unset, true); + pds = CDirstateCache::get(cur.hgroot, cur.basedir, unset, true);   if (!pds || !pds->root().getdir(relpath))   {   last = cur; @@ -318,11 +318,11 @@
  return 1;   }   - const Direntry* e = pds->root().get(relpath); + const CDirentry* e = pds->root().get(relpath);   if (!e)   {   // attempt to get status from kbfiles - pds = Dirstatecache::get(cur.hgroot, cur.basedir, unset, true); + pds = CDirstateCache::get(cur.hgroot, cur.basedir, unset, true);   if (pds)   {   e = pds->root().get(relpath); @@ -374,7 +374,7 @@
  if (update)   {   ATLTRACE("%s calling Thgstatus::update\n", (LPCTSTR)dp); - Thgstatus::update(path); + CTHgStatus::update(path);   }     exit:
 
19
20
21
22
 
23
24
25
26
27
28
29
 
30
31
32
33
34
35
 
36
37
38
 
19
20
21
 
22
23
24
25
26
27
28
 
29
30
 
 
 
 
 
31
32
33
34
@@ -19,20 +19,16 @@
 #include "StdAfx.h"  #include "SysInfo.h"   -SysInfo::SysInfo(void) +CSysInfo::CSysInfo(void)  {   SecureZeroMemory(&inf, sizeof(OSVERSIONINFOEX));   inf.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);   GetVersionEx((OSVERSIONINFO *)&inf);  }   -SysInfo::~SysInfo(void) +const CSysInfo& CSysInfo::Instance()  { -} - -const SysInfo& SysInfo::Instance() -{ - static SysInfo instance; + static CSysInfo instance;   return instance;  }  
 
23
24
25
26
 
27
28
29
30
 
31
32
 
33
34
35
 
23
24
25
 
26
27
28
 
 
29
30
 
31
32
33
34
@@ -23,13 +23,12 @@
  * \ingroup Utils   * This singleton class handles system information   */ -class SysInfo +class CSysInfo  {  private: - SysInfo(void); - ~SysInfo(void); + CSysInfo();  public: - static const SysInfo& Instance(); + static const CSysInfo& Instance();     DWORD GetFullVersion() const {return MAKEWORD(inf.dwMinorVersion, inf.dwMajorVersion);}   bool IsXP() const {return (GetFullVersion() < 0x0600);} // cover Win5.1 and 5.2 alike
 
7
8
9
10
11
12
13
 
 
7
8
9
 
 
 
 
10
@@ -7,7 +7,4 @@
   #define THG_PARENT_ID_STRING TOSTR2(THG_PARENT_ID)   -CString ThgVersion::get() -{ - return THG_PARENT_ID_STRING; -} +const CString THgVersion = THG_PARENT_ID_STRING;
 
1
2
3
4
5
6
7
8
 
9
10
 
1
2
3
 
 
 
 
 
4
5
6
@@ -1,10 +1,6 @@
 #ifndef _THGVERSION_H  #define _THGVERSION_H   -class ThgVersion -{ -public: - static CString get(); -}; +extern const CString THgVersion;    #endif
 
30
31
32
33
 
34
35
36
 
40
41
42
43
 
44
45
46
 
52
53
54
55
 
56
57
58
59
60
 
61
62
63
 
30
31
32
 
33
34
35
36
 
40
41
42
 
43
44
45
46
 
52
53
54
 
55
56
57
58
59
 
60
61
62
63
@@ -30,7 +30,7 @@
 }     -int Thgstatus::SendRequest(const CString& request) +int CTHgStatus::SendRequest(const CString& request)  {   static const CString pname = GetPipeName();   @@ -40,7 +40,7 @@
  BOOL fSuccess;   DWORD cbRead;   - ATLTRACE("Thgstatus::update: sending '%s' to %s\n", (LPCTSTR)request, (LPCTSTR)pname); + ATLTRACE("CTHgStatus:SendRequest: sending '%s' to %s\n", (LPCTSTR)request, (LPCTSTR)pname);     fSuccess = ::CallNamedPipeA(pname, (void*)(LPCTSTR)request, request.GetLength(),   0, 0, &cbRead, NMPWAIT_NOWAIT); @@ -52,12 +52,12 @@
  }   else if (err == ERROR_PIPE_BUSY)   { - ATLTRACE("Thgstatus::update: CallNamedPipeA failed (ERROR_PIPE_BUSY)\n"); + ATLTRACE("CTHgStatus::SendRequest: CallNamedPipeA failed (ERROR_PIPE_BUSY)\n");   return -1;   }   else   { - ATLTRACE("Thgstatus::update: CallNamedPipeA failed (%d)\n", err); + ATLTRACE("CTHgStatus::SendRequest: CallNamedPipeA failed (%d)\n", err);   return -1;   }  }
 
17
18
19
20
 
21
22
23
 
17
18
19
 
20
21
22
23
@@ -17,7 +17,7 @@
 #ifndef _THGSTATUS_H  #define _THGSTATUS_H   -class Thgstatus +class CTHgStatus  {   static int SendRequest(const CString& request);  
 
4
5
6
7
 
8
9
10
 
4
5
6
 
7
8
9
10
@@ -4,7 +4,7 @@
   HBITMAP GetTortoiseIconBitmap(const CString& iconname)  { - IconBitmapUtils bmpUtils; + CIconBitmapUtils bmpUtils;     typedef CAtlMap<CString, HBITMAP> CBitmapCache;   static CBitmapCache bmpcache;
 
18
19
20
21
22
 
23
24
25
 
18
19
20
 
 
21
22
23
24
@@ -18,8 +18,7 @@
   #include "Winstat.h"   - -int Winstat::lstat(const char* file, bool time64) +int CWinstat::lstat(const char* file, bool time64)  {   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;
 
17
18
19
20
 
21
22
23
 
17
18
19
 
20
21
22
23
@@ -17,7 +17,7 @@
 #ifndef WINSTAT_H  #define WINSTAT_H   -class Winstat +class CWinstat  {  public:   unsigned __int64 size;
 
21
22
23
24
 
25
26
27
 
29
30
31
32
 
33
34
35
 
36
37
38
39
40
 
41
42
43
 
74
75
76
77
78
 
 
79
80
81
 
21
22
23
 
24
25
26
27
 
29
30
31
 
32
33
34
 
35
36
37
38
39
 
40
41
42
43
 
74
75
76
 
 
77
78
79
80
81
@@ -21,7 +21,7 @@
 #include "TortoiseUtils.h"     -CAutoPtr<Dirstate> Dirstate::read(const CString& path, bool& unset) +CAutoPtr<CDirstate> CDirstate::read(const CString& path, bool& unset)  {   unset = false;   @@ -29,15 +29,15 @@
  if (!f)   {   ATLTRACE("Dirstate::read: can't open '%s'\n", (LPCTSTR)path); - return CAutoPtr<Dirstate>(NULL); + return CAutoPtr<CDirstate>(NULL);   }   - CAutoPtr<Dirstate> pd(new Dirstate()); + CAutoPtr<CDirstate> pd(new CDirstate());     fread(&pd->parent1, sizeof(char), HASH_LENGTH, f);   fread(&pd->parent2, sizeof(char), HASH_LENGTH, f);   - Direntry e; + CDirentry e;   CString relpath;   while (e.read(f, relpath))   { @@ -74,8 +74,8 @@
 void testread()  {   bool unset; - CAutoPtr<Dirstate> pd = Dirstate::read(".hg/dirstate", unset); - if ((Dirstate*)pd == NULL) { + CAutoPtr<CDirstate> pd = CDirstate::read(".hg/dirstate", unset); + if ((CDirstate*)pd == NULL) {   printf("error: could not read .hg/dirstate\n");   return;   }
 
22
23
24
25
 
26
27
 
28
29
30
 
33
34
35
36
 
37
38
 
39
40
 
41
42
43
 
46
47
48
49
50
 
 
51
52
53
 
22
23
24
 
25
26
 
27
28
29
30
 
33
34
35
 
36
37
 
38
39
 
40
41
42
43
 
46
47
48
 
 
49
50
51
52
53
@@ -22,9 +22,9 @@
   #define HASH_LENGTH 20   -class Dirstate +class CDirstate  { - Directory root_; + CDirectory root_;     unsigned num_added_; // number of entries that have state 'a'   unsigned num_entries_; @@ -33,11 +33,11 @@
  char parent1[HASH_LENGTH];   char parent2[HASH_LENGTH];   - static CAutoPtr<Dirstate> read(const CString& path, bool& unset); + static CAutoPtr<CDirstate> read(const CString& path, bool& unset);   - Directory& root() { return root_; } + CDirectory& root() { return root_; }   - void add(const CString& relpath, Direntry& e) { + void add(const CString& relpath, CDirentry& e) {   root_.add(relpath, e);   ++num_entries_;   } @@ -46,8 +46,8 @@
  unsigned size() const { return num_entries_; }    private: - Dirstate() - : root_(0, "", ""), num_added_(0), num_entries_(0) {} + CDirstate() : + root_(0, "", ""), num_added_(0), num_entries_(0) {}  };    #endif
 
6
7
8
9
 
10
11
12
 
6
7
8
 
9
10
11
12
@@ -6,7 +6,7 @@
   extern "C" UINT __stdcall TerminateIconServer()  { - if (Thgstatus::terminate() == 0) + if (CTHgStatus::terminate() == 0)   {   // pipe ok, so icon server is running   // -> wait a bit for icon server to shut down