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

fogcreek shellext: renamed local variables for consistency, part 1

Changeset 2464ea0f16e1

Parent 4037f1bffabc

by David Golub

Changes to 2 files · Browse files at 2464ea0f16e1 Showing diff from parent 4037f1bffabc Diff from another changeset...

 
135
136
137
138
139
140
141
 
 
 
 
142
143
 
144
145
146
 
147
148
149
 
152
153
154
155
 
156
157
158
 
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
 
196
197
198
199
200
201
202
203
204
205
 
 
 
 
 
 
 
206
207
208
209
210
211
212
213
 
 
214
215
216
 
222
223
224
225
226
227
 
 
 
228
229
230
231
232
233
234
 
235
236
237
 
243
244
245
246
247
248
249
250
251
252
253
 
 
 
 
 
 
 
 
254
255
256
257
258
259
260
261
 
 
262
263
264
 
267
268
269
270
271
 
 
272
273
274
275
 
 
 
276
277
278
 
280
281
282
283
 
284
285
286
 
300
301
302
303
 
304
305
306
 
311
312
313
314
315
 
 
316
317
318
319
320
321
322
 
323
324
325
326
327
328
329
330
 
 
331
332
333
 
345
346
347
348
 
349
350
 
351
352
353
 
369
370
371
372
373
374
375
 
 
 
 
 
376
377
 
378
379
380
 
401
402
403
404
405
 
 
406
407
408
 
414
415
416
417
418
 
 
419
420
421
422
423
 
 
 
424
425
426
 
427
428
 
429
430
 
431
432
433
 
434
435
436
437
438
 
 
 
439
440
441
 
 
442
443
444
 
446
447
448
449
 
450
451
452
453
 
 
454
455
456
457
458
459
460
461
 
 
462
463
464
465
466
467
 
 
 
 
468
469
 
470
471
 
472
473
474
475
476
477
 
 
478
479
 
480
481
482
483
 
 
484
485
486
 
490
491
492
493
494
 
 
495
496
497
 
498
499
500
 
501
502
503
504
505
506
 
507
508
509
510
511
 
512
513
514
515
 
516
517
518
519
 
520
521
522
 
550
551
552
553
 
554
555
556
 
570
571
572
573
 
574
575
576
577
578
 
579
580
581
582
 
583
584
 
585
586
 
587
588
 
589
590
 
591
592
 
593
594
595
596
 
597
598
599
 
602
603
604
605
 
606
607
608
609
610
 
 
611
612
 
613
614
615
 
621
622
623
624
 
625
626
627
 
631
632
633
634
 
635
636
637
638
 
639
640
641
642
643
644
645
 
646
647
648
 
649
650
651
652
653
654
 
 
 
655
656
657
 
 
658
659
 
660
661
662
 
663
664
665
666
667
668
669
 
670
671
672
 
673
674
675
 
676
677
678
 
679
680
681
 
682
683
684
685
686
687
688
689
 
 
690
691
692
 
697
698
699
700
 
701
702
 
703
704
705
 
743
744
745
746
747
 
 
748
749
750
751
752
 
753
754
755
756
 
 
757
758
759
760
761
 
 
 
 
762
763
 
764
765
766
 
767
768
 
769
770
 
771
772
773
 
774
775
776
777
 
778
779
780
 
784
785
786
787
 
788
789
790
 
 
791
792
793
 
795
796
797
798
799
 
 
800
801
802
803
804
805
806
 
 
807
808
809
 
810
811
812
 
813
814
815
 
817
818
819
820
821
 
 
822
823
824
 
 
825
826
827
 
828
829
830
 
834
835
836
837
 
838
839
 
840
841
842
843
 
 
844
845
846
 
867
868
869
870
 
871
872
873
 
887
888
889
890
 
891
892
893
 
 
894
895
896
 
915
916
917
918
919
920
 
 
 
921
922
923
 
135
136
137
 
 
 
 
138
139
140
141
142
 
143
144
145
 
146
147
148
149
 
152
153
154
 
155
156
157
158
 
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
 
196
197
198
 
 
 
 
 
 
 
199
200
201
202
203
204
205
206
207
208
209
210
211
 
 
212
213
214
215
216
 
222
223
224
 
 
 
225
226
227
228
229
230
231
232
233
 
234
235
236
237
 
243
244
245
 
 
 
 
 
 
 
 
246
247
248
249
250
251
252
253
254
255
256
257
258
259
 
 
260
261
262
263
264
 
267
268
269
 
 
270
271
272
 
 
 
273
274
275
276
277
278
 
280
281
282
 
283
284
285
286
 
300
301
302
 
303
304
305
306
 
311
312
313
 
 
314
315
316
317
318
319
320
321
 
322
323
324
325
326
327
328
 
 
329
330
331
332
333
 
345
346
347
 
348
349
 
350
351
352
353
 
369
370
371
 
 
 
 
372
373
374
375
376
377
 
378
379
380
381
 
402
403
404
 
 
405
406
407
408
409
 
415
416
417
 
 
418
419
420
421
 
 
 
422
423
424
425
426
 
427
428
 
429
430
 
431
432
433
 
434
435
436
 
 
 
437
438
439
440
 
 
441
442
443
444
445
 
447
448
449
 
450
451
452
 
 
453
454
455
456
457
458
459
460
 
 
461
462
463
464
 
 
 
 
465
466
467
468
469
 
470
471
 
472
473
474
475
476
 
 
477
478
479
 
480
481
482
 
 
483
484
485
486
487
 
491
492
493
 
 
494
495
496
497
 
498
499
500
 
501
502
503
504
505
506
 
507
508
509
510
511
 
512
513
514
515
 
516
517
518
519
 
520
521
522
523
 
551
552
553
 
554
555
556
557
 
571
572
573
 
574
575
576
577
578
 
579
580
581
582
 
583
584
 
585
586
 
587
588
 
589
590
 
591
592
 
593
594
595
596
 
597
598
599
600
 
603
604
605
 
606
607
608
609
 
 
610
611
612
 
613
614
615
616
 
622
623
624
 
625
626
627
628
 
632
633
634
 
635
636
637
638
 
639
640
641
642
643
644
645
 
646
647
648
 
649
650
651
652
 
 
 
653
654
655
656
 
 
657
658
659
 
660
661
662
 
663
664
665
666
667
668
669
 
670
671
672
 
673
674
675
 
676
677
678
 
679
680
681
 
682
683
684
685
686
687
688
 
 
689
690
691
692
693
 
698
699
700
 
701
702
 
703
704
705
706
 
744
745
746
 
 
747
748
749
750
751
752
 
753
754
755
 
 
756
757
758
 
 
 
 
759
760
761
762
763
 
764
765
766
 
767
768
 
769
770
 
771
772
773
 
774
775
776
777
 
778
779
780
781
 
785
786
787
 
788
789
 
 
790
791
792
793
794
 
796
797
798
 
 
799
800
801
802
803
804
805
 
 
806
807
808
809
 
810
811
812
 
813
814
815
816
 
818
819
820
 
 
821
822
823
 
 
824
825
826
827
 
828
829
830
831
 
835
836
837
 
838
839
 
840
841
842
 
 
843
844
845
846
847
 
868
869
870
 
871
872
873
874
 
888
889
890
 
891
892
 
 
893
894
895
896
897
 
916
917
918
 
 
 
919
920
921
922
923
924
@@ -135,15 +135,15 @@
 void GetCMenuTranslation(const CString& strLang, LPCTSTR lpszName,   CStringW& strMenuText, CStringW& strHelpText)  { - CStringW subkey = L"Software\\TortoiseHg\\CMenu\\"; - subkey += strLang; - subkey += L"\\"; - subkey += lpszName; + CStringW strSubKey = L"Software\\TortoiseHg\\CMenu\\"; + strSubKey += strLang; + strSubKey += L"\\"; + strSubKey += lpszName;   - ATLTRACE(L"GetCMenuTranslation: '%s'\n", (LPCWSTR)subkey); + ATLTRACE(L"GetCMenuTranslation: '%s'\n", (LPCWSTR)strSubKey);     HKEY hkey = 0; - LONG rv = RegOpenKeyExW(HKEY_CURRENT_USER, subkey, 0, KEY_READ, &hkey); + LONG rv = RegOpenKeyExW(HKEY_CURRENT_USER, strSubKey, 0, KEY_READ, &hkey);     if (rv == ERROR_SUCCESS && hkey)   { @@ -152,7 +152,7 @@
  }   else   { - ATLTRACE(L"GetCMenuTranslation: RegOpenKeyExW('%s') failed\n", (LPCWSTR)subkey); + ATLTRACE(L"GetCMenuTranslation: RegOpenKeyExW('%s') failed\n", (LPCWSTR)strSubKey);   }     if (hkey) @@ -163,26 +163,26 @@
 {   if (m_mapMenuDesc.IsEmpty())   { - CString lang; - GetRegistryConfig("CMenuLang", lang); + CString strLang; + GetRegistryConfig("CMenuLang", strLang);     for (int i = 0; i < nCount; i++)   {   CMenuDescription md = pMenuDescs[i];   - if (md.name.IsEmpty()) + if (md.strName.IsEmpty())   {   ATLTRACE("**** InitMenuMaps: ignoring entry with empty name\n");   break;   }   - ATLTRACE("InitMenuMaps: adding '%s'\n", (LPCTSTR)md.name); + ATLTRACE("InitMenuMaps: adding '%s'\n", (LPCTSTR)md.strName);     // Look for translation of menu and help text - if (!lang.IsEmpty()) - GetCMenuTranslation(lang, md.name, md.menuText, md.helpText); + if (!strLang.IsEmpty()) + GetCMenuTranslation(strLang, md.strName, md.strMenuText, md.strHelpText);   - m_mapMenuDesc[md.name] = md; + m_mapMenuDesc[md.strName] = md;   }     } @@ -196,21 +196,21 @@
 {   // MFT_STRING is obsolete and should not be used (replaced by MIIM_STRING   // from Win2K onward) - MENUITEMINFOW mi; - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_ID | MIIM_STRING; - mi.dwTypeData = (LPWSTR)(LPCWSTR)strMenuText; - mi.cch = strMenuText.GetLength(); - mi.wID = idCmd; + MENUITEMINFOW mii; + memset(&mii, 0, sizeof(MENUITEMINFOW)); + mii.cbSize = sizeof(MENUITEMINFOW); + mii.fMask = MIIM_ID | MIIM_STRING; + mii.dwTypeData = (LPWSTR)(LPCWSTR)strMenuText; + mii.cch = strMenuText.GetLength(); + mii.wID = idCmd;     if (CSysInfo::Instance().IsVistaOrLater())   {   HBITMAP hBmp = GetTortoiseIconBitmap(strIconName);   if (hBmp)   { - mi.fMask |= MIIM_BITMAP; - mi.hbmpItem = hBmp; + mii.fMask |= MIIM_BITMAP; + mii.hbmpItem = hBmp;   }   else   { @@ -222,16 +222,16 @@
  HICON h = GetTortoiseIcon(strIconName);   if (h)   { - mi.fMask |= MIIM_BITMAP | MIIM_DATA; - mi.dwItemData = (ULONG_PTR) h; - mi.hbmpItem = HBMMENU_CALLBACK; + mii.fMask |= MIIM_BITMAP | MIIM_DATA; + mii.dwItemData = (ULONG_PTR) h; + mii.hbmpItem = HBMMENU_CALLBACK;   }   else   {   ATLTRACE(" ***** InsertMenuItemWithIcon1: can't find '%s'\n", strIconName);   }   } - InsertMenuItemW(hMenu, indexMenu, TRUE, &mi); + InsertMenuItemW(hMenu, indexMenu, TRUE, &mii);     ATLTRACE(L"InsertMenuItemWithIcon1('%s') finished\n", strMenuText);  } @@ -243,22 +243,22 @@
 {   // MFT_STRING is obsolete and should not be used (replaced by MIIM_STRING   // from Win2K onward) - MENUITEMINFOW mi; - memset(&mi, 0, sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_SUBMENU | MIIM_ID | MIIM_STRING; - mi.dwTypeData = (LPWSTR)(LPCWSTR)strMenuText; - mi.cch = strMenuText.GetLength(); - mi.wID = idCmd; - mi.hSubMenu = hSubMenu; + MENUITEMINFOW mii; + memset(&mii, 0, sizeof(MENUITEMINFOW)); + mii.cbSize = sizeof(MENUITEMINFOW); + mii.fMask = MIIM_SUBMENU | MIIM_ID | MIIM_STRING; + mii.dwTypeData = (LPWSTR)(LPCWSTR)strMenuText; + mii.cch = strMenuText.GetLength(); + mii.wID = idCmd; + mii.hSubMenu = hSubMenu;     if (CSysInfo::Instance().IsVistaOrLater())   {   HBITMAP hBmp = GetTortoiseIconBitmap(strIconName);   if (hBmp)   { - mi.fMask |= MIIM_BITMAP; - mi.hbmpItem = hBmp; + mii.fMask |= MIIM_BITMAP; + mii.hbmpItem = hBmp;   }   else   { @@ -267,12 +267,12 @@
  }   else   { - HICON h = GetTortoiseIcon(strIconName); - if (h) + HICON hIcon = GetTortoiseIcon(strIconName); + if (hIcon)   { - mi.fMask |= MIIM_BITMAP | MIIM_DATA; - mi.dwItemData = (ULONG_PTR) h; - mi.hbmpItem = HBMMENU_CALLBACK; + mii.fMask |= MIIM_BITMAP | MIIM_DATA; + mii.dwItemData = (ULONG_PTR)hIcon; + mii.hbmpItem = HBMMENU_CALLBACK;   }   else   { @@ -280,7 +280,7 @@
  }   }   - InsertMenuItemW(hMenu, indexMenu, TRUE, &mi); + InsertMenuItemW(hMenu, indexMenu, TRUE, &mii);     ATLTRACE(L"InsertMenuItemWithIcon2('%s') finished\n", (LPCWSTR)strMenuText);  } @@ -300,7 +300,7 @@
  const CMenuDescription& md = pPair->m_value;   AddMenuList(idCmd - idCmdFirst, strName);   InsertMenuItemWithIcon1( - hMenu, indexMenu, idCmd, strPrefix + md.menuText, md.iconName); + hMenu, indexMenu, idCmd, strPrefix + md.strMenuText, md.strIconName);  }     @@ -311,23 +311,23 @@
 {   bHasMenu = false;   - const int count = ::GetMenuItemCount(hMenu); - if (count == -1) + int nCount = ::GetMenuItemCount(hMenu); + if (nCount == -1)   {   ATLTRACE("***** HasTortoiseMenu: GetMenuItemCount returned -1\n");   return -1;   }     MENUITEMINFOW mii; - for (int i = 0; i < count; ++i) + for (int i = 0; i < nCount; ++i)   {   memset(&mii, 0, sizeof(MENUITEMINFOW));   mii.cbSize = sizeof(MENUITEMINFOW);     // first GetMenuItemInfoW call: get size of menu item string   mii.fMask = MIIM_STRING; - BOOL res = ::GetMenuItemInfoW(hMenu, i, true, &mii); - if (res == 0) { + BOOL bRes = ::GetMenuItemInfoW(hMenu, i, true, &mii); + if (bRes == 0) {   ATLTRACE("HasTortoiseMenu: first GetMenuItemInfo returned 0\n");   continue;   } @@ -345,9 +345,9 @@
  // second GetMenuItemInfoW call: get string into buffer   mii.dwTypeData = lpszBuf;   ++mii.cch; // size of buffer is one more than length of string - res = ::GetMenuItemInfoW(hMenu, i, true, &mii); + bRes = ::GetMenuItemInfoW(hMenu, i, true, &mii);   strMenuItemText.ReleaseBuffer(); - if (res == 0) { + if (bRes == 0) {   ATLTRACE("HasTortoiseMenu: second GetMenuItemInfo returned 0\n");   continue;   } @@ -369,12 +369,13 @@
  if (!CSysInfo::Instance().IsVistaOrLater())   return;   - MENUINFO MenuInfo = {}; - MenuInfo.cbSize = sizeof(MenuInfo); - MenuInfo.fMask = MIM_STYLE | MIM_APPLYTOSUBMENUS; - MenuInfo.dwStyle = MNS_CHECKORBMP; + MENUINFO mi; + memset(&mi, 0, sizeof(MENUINFO)); + mi.cbSize = sizeof(MENUINFO); + mi.fMask = MIM_STYLE | MIM_APPLYTOSUBMENUS; + mi.dwStyle = MNS_CHECKORBMP;   - SetMenuInfo(hMenu, &MenuInfo); + SetMenuInfo(hMenu, &mi);  }    #define ResultFromShort(i) ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i))) @@ -401,8 +402,8 @@
  if (!bAppendItems)   return S_OK;   - bool hasthgmenu = false; - if (HasTortoiseMenu(hMenu, hasthgmenu) == 0 && hasthgmenu) + bool bHasTHgMenu = false; + if (HasTortoiseMenu(hMenu, bHasTHgMenu) == 0 && bHasTHgMenu)   {   ATLTRACE("CTortoiseHgCmenuBase::QueryContextMenu: "   "TortoiseHg menu entry already in menu -> skipping"); @@ -414,31 +415,31 @@
  CString promoted_string = "commit,workbench"; // default value if key not found   GetRegistryConfig("PromotedItems", promoted_string);   - CAtlList<CString> promoted; - Tokenize(promoted_string, promoted, ","); + CAtlList<CString> listPromoted; + Tokenize(promoted_string, listPromoted, ",");     // Select menu to show - bool fileMenu = !m_arrFiles.IsEmpty(); - bool isHgrepo = false; - CString cwd; + bool bFileMenu = !m_arrFiles.IsEmpty(); + bool bIsHgRepo = false; + CString strCwd;   if (!m_strFolder.IsEmpty())   { - cwd = m_strFolder; + strCwd = m_strFolder;   } - else if (fileMenu) + else if (bFileMenu)   { - cwd = ::PathIsDirectory(m_arrFiles[0]) ? m_arrFiles[0] : DirName(m_arrFiles[0]); + strCwd = ::PathIsDirectory(m_arrFiles[0]) ? m_arrFiles[0] : DirName(m_arrFiles[0]);   }   - if (!cwd.IsEmpty()) + if (!strCwd.IsEmpty())   {   // check if target directory is a Mercurial repository - CString root = GetHgRepoRoot(cwd); - isHgrepo = !root.IsEmpty(); - if (m_arrFiles.GetCount() == 1 && root == m_arrFiles[0]) + CString strRoot = GetHgRepoRoot(strCwd); + bIsHgRepo = !strRoot.IsEmpty(); + if (m_arrFiles.GetCount() == 1 && strRoot == m_arrFiles[0])   { - fileMenu = false; - m_strFolder = cwd; + bFileMenu = false; + m_strFolder = strCwd;   m_arrFiles.RemoveAll();   }   } @@ -446,41 +447,41 @@
  if ((uFlags & CMF_EXTENDEDVERBS) == 0)   {   // shift key is not down - if (!isHgrepo) + if (!bIsHgRepo)   {   // we are not inside a repo - CString cval; - if (GetRegistryConfig("HideMenuOutsideRepo", cval) != 0 && cval == "1") + CString strCval; + if (GetRegistryConfig("HideMenuOutsideRepo", strCval) != 0 && strCval == "1")   {   return S_OK; // don't show thg cmenu entries   }   }   }   - ATLTRACE("CTortoiseHgCmenuBase::QueryContextMenu: isHgrepo = %d, fileMenu = %d\n", - isHgrepo, fileMenu); + ATLTRACE("CTortoiseHgCmenuBase::QueryContextMenu: bIsHgRepo = %d, bFileMenu = %d\n", + bIsHgRepo, bFileMenu);     /* We have three menu types: files-selected, no-files-selected, no-repo */ - const char* entries_string = 0; - if (isHgrepo) - if (fileMenu) - entries_string = RepoFilesMenu; + LPCTSTR lpszEntries = 0; + if (bIsHgRepo) + if (bFileMenu) + lpszEntries = RepoFilesMenu;   else - entries_string = RepoNoFilesMenu; + lpszEntries = RepoNoFilesMenu;   else - entries_string = NoRepoMenu; + lpszEntries = NoRepoMenu;     // start building TortoiseHg menus and submenus   InsertMenu(hMenu, indexMenu++, MF_SEPARATOR | MF_BYPOSITION, 0, NULL);   - CAtlList<CString> entries; - Tokenize(entries_string, entries, " "); + CAtlList<CString> listEntries; + Tokenize(lpszEntries, listEntries, " ");   - POSITION position = entries.GetHeadPosition(); + POSITION position = listEntries.GetHeadPosition();   while (position != NULL)   { - CString strName = entries.GetNext(position); - if (promoted.Find(strName) != NULL) + CString strName = listEntries.GetNext(position); + if (listPromoted.Find(strName) != NULL)   {   InsertMenuItemByName(hMenu, strName, indexMenu++, idCmd++, idCmdFirst, L"Hg ");   } @@ -490,33 +491,33 @@
  if (hSubMenu)   {   UINT indexSubMenu = 0; - bool isSeparator = true; - POSITION position = entries.GetHeadPosition(); + bool bIsSeparator = true; + POSITION position = listEntries.GetHeadPosition();   while (position != NULL)   { - CString strName = entries.GetNext(position); + CString strName = listEntries.GetNext(position);   if (strName == "sep")   { - if (!isSeparator) + if (!bIsSeparator)   {   InsertMenu(   hSubMenu, indexSubMenu++,   MF_SEPARATOR | MF_BYPOSITION, 0, NULL   ); - isSeparator = true; + bIsSeparator = true;   }   }   else   { - if (promoted.Find(strName) == NULL) + if (listPromoted.Find(strName) == NULL)   {   InsertMenuItemByName(hSubMenu, strName, indexSubMenu++, idCmd++,   idCmdFirst, L""); - isSeparator = false; + bIsSeparator = false;   }   }   } - if (isSeparator && indexSubMenu > 0) + if (bIsSeparator && indexSubMenu > 0)   RemoveMenu(hSubMenu, indexSubMenu - 1, MF_BYPOSITION);     TweakMenuForVista(hSubMenu); @@ -550,7 +551,7 @@
  const CMenuIdCmdMap::CPair* p = m_mapMenuId.Lookup(idCmd);   if (p != NULL)   { - RunDialog(p->m_value.name); + RunDialog(p->m_value.strName);   hr = S_OK;   }   else @@ -570,30 +571,30 @@
 {   // see http://msdn.microsoft.com/en-us/library/bb776094%28VS.85%29.aspx   - HRESULT res = S_FALSE; + HRESULT hr = S_FALSE;     const char* psz = "";   const wchar_t* pszw = 0;   - CString sflags = "?"; + CString strFlags = "?";   switch (uFlags)   {   case GCS_HELPTEXTW: - sflags = "GCS_HELPTEXTW"; break; + strFlags = "GCS_HELPTEXTW"; break;   case GCS_HELPTEXTA: - sflags = "GCS_HELPTEXTA"; break; + strFlags = "GCS_HELPTEXTA"; break;   case GCS_VALIDATEW: - sflags = "GCS_VALIDATEW"; break; + strFlags = "GCS_VALIDATEW"; break;   case GCS_VALIDATEA: - sflags = "GCS_VALIDATEA"; break; + strFlags = "GCS_VALIDATEA"; break;   case GCS_VERBW: - sflags = "GCS_VERBW"; break; + strFlags = "GCS_VERBW"; break;   case GCS_VERBA: - sflags = "GCS_VERBA"; break; + strFlags = "GCS_VERBA"; break;   }     ATLTRACE("CTortoiseHgCmenuBase::GetCommandString: idCmd = %d, uFlags = %d (%s), " - "cchMax = %d\n", idCmd, uFlags, sflags, cchMax); + "cchMax = %d\n", idCmd, uFlags, strFlags, cchMax);     const CMenuIdCmdMap::CPair* p = m_mapMenuId.Lookup((UINT)idCmd);   if (p == NULL) @@ -602,14 +603,14 @@
  }   else   { - ATLTRACE("CTortoiseHgCmenuBase::GetCommandString: name = '%s'\n", p->m_value.name); + ATLTRACE("CTortoiseHgCmenuBase::GetCommandString: name = '%s'\n", p->m_value.strName);     if (uFlags == GCS_HELPTEXTW)   { - pszw = p->m_value.helpText; - res = S_OK; + pszw = p->m_value.strHelpText; + hr = S_OK;   - size_t size = p->m_value.helpText.GetLength(); + size_t size = p->m_value.strHelpText.GetLength();   if (size >= 40)   {   ATLTRACE("***** CTortoiseHgCmenuBase::GetCommandString: warning: " @@ -621,7 +622,7 @@
  {   // we don't provide ansi help texts   psz = ""; - res = S_OK; + hr = S_OK;   }   else if (uFlags == GCS_VERBW || uFlags == GCS_VERBA)   { @@ -631,62 +632,62 @@
  // bugfix: don't provide verbs ("rename" conflicted with rename of explorer)   psz = "";  #endif - res = S_OK; + hr = S_OK;   }   else if (uFlags == GCS_VALIDATEW || uFlags == GCS_VALIDATEA)   { - res = S_OK; + hr = S_OK;   }   }     if (cchMax < 1)   {   ATLTRACE("CTortoiseHgCmenuBase::GetCommandString: cchMax = %d (is <1)\n", cchMax); - return res; + return hr;   }   - size_t size = 0; + size_t nSize = 0;     if (uFlags & GCS_UNICODE)   { - wchar_t* const dest = reinterpret_cast<wchar_t*>(pszName); - CStringW wpsz = psz; - const wchar_t* const src = pszw ? pszw : wpsz; + LPWSTR lpszDest = (LPWSTR)pszName; + CStringW strUnicode = psz; + LPCWSTR lpszSrc = pszw ? pszw : strUnicode;   - wcsncpy_s(dest, cchMax, src, cchMax-1); - *(dest + cchMax-1) = 0; + wcsncpy_s(lpszDest, cchMax, lpszSrc, cchMax-1); + *(lpszDest + cchMax-1) = 0;   - size = wcslen(src); + nSize = wcslen(lpszSrc);     ATLTRACE(L"CTortoiseHgCmenuBase::GetCommandString: res = %d, " - L"pszName (wide) = '%s'\n", (int)res, dest); + L"pszName (wide) = '%s'\n", (int)hr, lpszDest);   }   else   {   strncpy_s(pszName, cchMax, psz, cchMax-1);   *(pszName + cchMax-1) = 0;   - size = strlen(psz); + nSize = strlen(psz);     ATLTRACE("CShellExtCMenu::GetCommandString: res = %d, pszName = '%s'\n", - (int)res, psz); + (int)hr, psz);   }   - if (size > cchMax-1) + if (nSize > cchMax-1)   {   ATLTRACE("***** CShellExtCMenu::GetCommandString: string was truncated: " - "size = %d, cchMax = %d\n", size, cchMax); + "size = %d, cchMax = %d\n", nSize, cchMax);   }   - return res; + return hr;  }      STDMETHODIMP  CTortoiseHgCmenuBase::HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam)  { - LRESULT res; - return HandleMenuMsg2(uMsg, wParam, lParam, &res); + LRESULT lResult; + return HandleMenuMsg2(uMsg, wParam, lParam, &lResult);  }     @@ -697,9 +698,9 @@
  // A great tutorial on owner drawn menus in shell extension can be found   // here: http://www.codeproject.com/shell/shellextguide7.asp   - LRESULT res; + LRESULT lResult;   if (!pResult) - pResult = &res; + pResult = &lResult;   *pResult = FALSE;     switch (uMsg) @@ -743,38 +744,38 @@
   void CTortoiseHgCmenuBase::RunDialog(const CString& strCmd)  { - CString dir = GetTHgProgRoot(); - if (dir.IsEmpty()) + CString strDir = GetTHgProgRoot(); + if (strDir.IsEmpty())   {   ATLTRACE("RunDialog: THG root is empty\n");   return;   } - CString hgcmd = dir + "\\thgw.exe"; + CString strHgCmd = strDir + "\\thgw.exe";     WIN32_FIND_DATAA data; - HANDLE hfind = FindFirstFileA(hgcmd, &data); - if (hfind == INVALID_HANDLE_VALUE) + HANDLE hFind = FindFirstFileA(strHgCmd, &data); + if (hFind == INVALID_HANDLE_VALUE)   { - hgcmd = dir + "\\hgtk.exe"; - hfind = FindFirstFileA(hgcmd, &data); - if (hfind == INVALID_HANDLE_VALUE) - hgcmd = dir + "\\thg.cmd"; + strHgCmd = strDir + "\\hgtk.exe"; + hFind = FindFirstFileA(strHgCmd, &data); + if (hFind == INVALID_HANDLE_VALUE) + strHgCmd = strDir + "\\thg.cmd";   else - FindClose(hfind); + FindClose(hFind);   }   else - FindClose(hfind); + FindClose(hFind);   - hgcmd = Quote(hgcmd) + " --nofork " + strCmd; + strHgCmd = Quote(strHgCmd) + " --nofork " + strCmd;   - CString cwd; + CString strCwd;   if (!m_strFolder.IsEmpty())   { - cwd = m_strFolder; + strCwd = m_strFolder;   }   else if (!m_arrFiles.IsEmpty())   { - cwd = ::PathIsDirectory(m_arrFiles[0]) ? m_arrFiles[0] : DirName(m_arrFiles[0]); + strCwd = ::PathIsDirectory(m_arrFiles[0]) ? m_arrFiles[0] : DirName(m_arrFiles[0]);   }   else   { @@ -784,10 +785,10 @@
    if (strCmd == "thgstatus")   { - if (CTHgStatus::Remove(cwd) != 0) + if (CTHgStatus::Remove(strCwd) != 0)   { - CString p = dir + "\\TortoiseHgOverlayServer.exe"; - LaunchCommand(Quote(p), dir); + CString strPath = strDir + "\\TortoiseHgOverlayServer.exe"; + LaunchCommand(Quote(strPath), strDir);   }   CInitStatus::Check();   return; @@ -795,21 +796,21 @@
    if (!m_arrFiles.IsEmpty())   { - CString tempfile = GetTemporaryFile(); - if (tempfile.IsEmpty()) + CString strTempFile = GetTemporaryFile(); + if (strTempFile.IsEmpty())   {   ATLTRACE("***** RunDialog: error: GetTemporaryFile returned empty string\n");   return;   }   - ATLTRACE("RunDialog: temp file = %s\n", (LPCTSTR)tempfile); - HANDLE tempfileHandle = CreateFileA(tempfile, GENERIC_WRITE, FILE_SHARE_READ, 0, + ATLTRACE("RunDialog: temp file = %s\n", (LPCTSTR)strTempFile); + HANDLE hTempFile = CreateFileA(strTempFile, GENERIC_WRITE, FILE_SHARE_READ, 0,   CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);   - if (tempfileHandle == INVALID_HANDLE_VALUE) + if (hTempFile == INVALID_HANDLE_VALUE)   {   ATLTRACE("***** RunDialog: error: failed to create file '%s'\n", - (LPCTSTR)tempfile); + (LPCTSTR)strTempFile);   return;   }   @@ -817,14 +818,14 @@
  {   DWORD dwWritten;   ATLTRACE("RunDialog: temp file adding '%s'\n", (LPCTSTR)m_arrFiles[i]); - WriteFile(tempfileHandle, (LPCTSTR)m_arrFiles[i], m_arrFiles[i].GetLength(), &dwWritten, 0); - WriteFile(tempfileHandle, "\n", 1, &dwWritten, 0); + WriteFile(hTempFile, (LPCTSTR)m_arrFiles[i], m_arrFiles[i].GetLength(), &dwWritten, 0); + WriteFile(hTempFile, "\n", 1, &dwWritten, 0);   } - CloseHandle(tempfileHandle); - hgcmd += " --listfile " + Quote(tempfile); + CloseHandle(hTempFile); + strHgCmd += " --listfile " + Quote(strTempFile);   }   - LaunchCommand(hgcmd, cwd); + LaunchCommand(strHgCmd, strCwd);   CInitStatus::Check();  }   @@ -834,13 +835,13 @@
    // get installed MSI product id (for debugging purposes for now)  #ifdef _M_X64 - const char* shellexid = "{D5D1E532-CDAD-4FFD-9695-757B8A29B4BA}"; + LPCTSTR lpszShellExId = "{D5D1E532-CDAD-4FFD-9695-757B8A29B4BA}";  #else - const char* shellexid = "{728E8840-5878-4EA7-918F-281C2697ABB1}"; + LPCTSTR lpszShellExId = "{728E8840-5878-4EA7-918F-281C2697ABB1}";  #endif   char szProductId[50]; - UINT msires = ::MsiGetProductCodeA(shellexid, szProductId); - ATLTRACE("MSI shellexid: %s\n", shellexid); + UINT msires = ::MsiGetProductCodeA(lpszShellExId, szProductId); + ATLTRACE("MSI shellexid: %s\n", lpszShellExId);   ATLTRACE("MSI msires: %d", msires);   ATLTRACE("MSI installed product id: %s\n", szProductId);   @@ -867,7 +868,7 @@
 STDMETHODIMP CTortoiseHgCmenuBase::Initialize(   LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hRegKey)  { - TCHAR name[MAX_PATH+1]; + TCHAR szName[MAX_PATH+1];     PrintDebugHeader(pIDFolder, pDataObj);   @@ -887,10 +888,10 @@
  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); - m_arrFiles.Add(name); + ATLTRACE(" DragQueryFile [%d] = '%s'\n", i, szName); + m_arrFiles.Add(szName);   }   }   } @@ -915,9 +916,9 @@
  // 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;   }     // disable context menu if neither the folder nor the files
 
3
4
5
6
7
8
9
 
 
 
 
10
11
12
 
3
4
5
 
 
 
 
6
7
8
9
10
11
12
@@ -3,10 +3,10 @@
   struct CMenuDescription  { - CString name; - CStringW menuText; - CStringW helpText; - CString iconName; + CString strName; + CStringW strMenuText; + CStringW strHelpText; + CString strIconName;   UINT idCmd;  };