Changeset 9d0bb7d14767…
Parent 9f723e2a829d…
by
Changes to 15 files · Browse files at 9d0bb7d14767 Showing diff from parent 9f723e2a829d Diff from another changeset...
|
|
@@ -127,7 +127,7 @@
void CShellExtCMenuBase::AddMenuList(UINT idCmd, const std::string& name)
{
- TDEBUG_TRACE("AddMenuList: idCmd = " << idCmd << " name = " << name);
+ ATLTRACE("AddMenuList: idCmd = %d, name = '%s'\n", idCmd, name.c_str());
myMenuIdMap[idCmd] = myDescMap[name];
}
@@ -144,7 +144,7 @@ subkey += L"\\";
subkey += MultibyteToWide(name);
- TDEBUG_TRACEW(L"GetCMenuTranslation: " << subkey);
+ ATLTRACE(L"GetCMenuTranslation: '%s'\n", subkey.c_str());
HKEY hkey = 0;
LONG rv = RegOpenKeyExW(
@@ -157,10 +157,7 @@ }
else
{
- TDEBUG_TRACEW(
- L"GetCMenuTranslation: RegOpenKeyExW(\""
- << subkey << "\") failed"
- );
+ ATLTRACE(L"GetCMenuTranslation: RegOpenKeyExW('%s') failed\n", subkey.c_str());
}
if (hkey)
@@ -180,11 +177,11 @@
if (md.name.empty())
{
- TDEBUG_TRACE("**** InitMenuMaps: ignoring entry with empty name");
+ ATLTRACE("**** InitMenuMaps: ignoring entry with empty name\n");
break;
}
- TDEBUG_TRACE("InitMenuMaps: adding " << md.name);
+ ATLTRACE("InitMenuMaps: adding '%s'\n", md.name.c_str());
// Look for translation of menu and help text
if (!lang.empty())
@@ -223,7 +220,7 @@ }
else
{
- TDEBUG_TRACE(" ***** InsertMenuItemWithIcon1: can't find " + iconName);
+ ATLTRACE(" ***** InsertMenuItemWithIcon1: can't find '%s'\n", iconName.c_str());
}
}
else
@@ -237,13 +234,12 @@ }
else
{
- TDEBUG_TRACE(" ***** InsertMenuItemWithIcon1: can't find " + iconName);
+ ATLTRACE(" ***** InsertMenuItemWithIcon1: can't find '%s'\n", iconName.c_str());
}
}
InsertMenuItemW(hMenu, indexMenu, TRUE, &mi);
- TDEBUG_TRACEW(
- L"InsertMenuItemWithIcon1(\"" << menuText << L"\") finished");
+ ATLTRACE(L"InsertMenuItemWithIcon1('%s') finished\n", menuText.c_str());
}
@@ -272,7 +268,7 @@ }
else
{
- TDEBUG_TRACE(" ***** InsertSubMenuItemWithIcon2: can't find " + iconName);
+ ATLTRACE(" ***** InsertSubMenuItemWithIcon2: can't find '%s'\n", iconName.c_str());
}
}
else
@@ -286,14 +282,13 @@ }
else
{
- TDEBUG_TRACE(" ***** InsertSubMenuItemWithIcon2: can't find " + iconName);
+ ATLTRACE(" ***** InsertSubMenuItemWithIcon2: can't find '%s'\n", iconName.c_str());
}
}
InsertMenuItemW(hMenu, indexMenu, TRUE, &mi);
- TDEBUG_TRACEW(
- L"InsertMenuItemWithIcon2(\"" << menuText << L"\") finished");
+ ATLTRACE(L"InsertMenuItemWithIcon2('%s') finished\n", menuText.c_str());
}
@@ -304,7 +299,7 @@ MenuDescriptionMap::iterator iter = myDescMap.find(name);
if (iter == myDescMap.end())
{
- TDEBUG_TRACE("***** InsertMenuItemByName: can't find menu info for " << name);
+ ATLTRACE("***** InsertMenuItemByName: can't find menu info for '%s'\n", name.c_str());
return;
}
@@ -326,7 +321,7 @@ const int count = ::GetMenuItemCount(hMenu);
if (count == -1)
{
- TDEBUG_TRACE("***** HasTortoiseMenu: GetMenuItemCount returned -1");
+ ATLTRACE("***** HasTortoiseMenu: GetMenuItemCount returned -1\n");
return -1;
}
@@ -340,8 +335,7 @@ mii.fMask = MIIM_STRING;
BOOL res = ::GetMenuItemInfoW(hMenu, i, true, &mii);
if (res == 0) {
- TDEBUG_TRACE("HasTortoiseMenu: "
- << "first GetMenuItemInfo returned 0");
+ ATLTRACE("HasTortoiseMenu: first GetMenuItemInfo returned 0\n");
continue;
}
@@ -359,8 +353,7 @@ ++mii.cch; // size of buffer is one more than length of string
res = ::GetMenuItemInfoW(hMenu, i, true, &mii);
if (res == 0) {
- TDEBUG_TRACE("HasTortoiseMenu: "
- << "second GetMenuItemInfo returned 0");
+ ATLTRACE("HasTortoiseMenu: second GetMenuItemInfo returned 0\n");
continue;
}
@@ -370,13 +363,13 @@
if (menuitemtext == TortoiseHgMenuEntryString)
{
- TDEBUG_TRACE("HasTortoiseMenu: FOUND TortoiseHg menu entry");
+ ATLTRACE("HasTortoiseMenu: FOUND TortoiseHg menu entry\n");
hasmenu = true;
return 0;
}
}
- TDEBUG_TRACE("HasTortoiseMenu: TortoiseHg menu entry NOT found");
+ ATLTRACE("HasTortoiseMenu: TortoiseHg menu entry NOT found\n");
return 0;
}
@@ -401,7 +394,7 @@CShellExtCMenuBase::QueryContextMenu(
HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
{
- TDEBUG_TRACE("CShellExtCMenu::QueryContextMenu");
+ ATLTRACE("CShellExtCMenu::QueryContextMenu\n");
UINT idCmd = idCmdFirst;
BOOL bAppendItems = TRUE;
@@ -421,8 +414,8 @@ bool hasthgmenu = false;
if (HasTortoiseMenu(hMenu, hasthgmenu) == 0 && hasthgmenu)
{
- TDEBUG_TRACE("CShellExtCMenu::QueryContextMenu: "
- << "TortoiseHg menu entry already in menu -> skipping");
+ ATLTRACE("CShellExtCMenu::QueryContextMenu: "
+ "TortoiseHg menu entry already in menu -> skipping");
return S_OK;
}
@@ -477,10 +470,8 @@ }
}
- TDEBUG_TRACE(
- "CShellExtCMenu::QueryContextMenu: isHgrepo = "
- << isHgrepo << ", fileMenu = " << fileMenu
- );
+ ATLTRACE("CShellExtCMenu::QueryContextMenu: isHgrepo = %d, fileMenu = %d\n",
+ isHgrepo, fileMenu);
/* We have three menu types: files-selected, no-files-selected, no-repo */
const char* entries_string = 0;
@@ -548,7 +539,7 @@
}
- TDEBUG_TRACE(" CShellExtCMenu::QueryContextMenu: adding main THG menu");
+ ATLTRACE(" CShellExtCMenu::QueryContextMenu: adding main THG menu\n");
InsertSubMenuItemWithIcon2(hMenu, hSubMenu, indexMenu++, idCmd++,
TortoiseHgMenuEntryString, "hg.ico");
@@ -565,13 +556,13 @@STDMETHODIMP
CShellExtCMenuBase::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
{
- TDEBUG_TRACE("CShellExtCMenu::InvokeCommand");
+ ATLTRACE("CShellExtCMenu::InvokeCommand");
HRESULT hr = E_INVALIDARG;
if (!HIWORD(lpcmi->lpVerb))
{
UINT idCmd = LOWORD(lpcmi->lpVerb);
- TDEBUG_TRACE("CShellExtCMenu::InvokeCommand: idCmd = " << idCmd);
+ ATLTRACE("CShellExtCMenu::InvokeCommand: idCmd = %d\n", idCmd);
MenuIdCmdMap::iterator iter = myMenuIdMap.find(idCmd);
if (iter != myMenuIdMap.end())
{
@@ -580,10 +571,8 @@ }
else
{
- TDEBUG_TRACE(
- "***** CShellExtCMenu::InvokeCommand: action not found for idCmd "
- << idCmd
- );
+ ATLTRACE("***** CShellExtCMenu::InvokeCommand: action not found "
+ "for idCmd %d\n", idCmd);
}
}
return hr;
@@ -619,21 +608,17 @@ sflags = "GCS_VERBA"; break;
}
- TDEBUG_TRACE(
- "CShellExtCMenu::GetCommandString: idCmd = " << idCmd
- << ", uFlags = " << uFlags << " (" << sflags << ")"
- << ", cchMax = " << cchMax
- );
+ ATLTRACE("CShellExtCMenu::GetCommandString: idCmd = %d, uFlags = %d (%s), "
+ "cchMax = %d\n", idCmd, uFlags, sflags, cchMax);
MenuIdCmdMap::iterator iter = myMenuIdMap.find(static_cast<UINT>(idCmd));
if (iter == myMenuIdMap.end())
{
- TDEBUG_TRACE("***** CShellExtCMenu::GetCommandString: idCmd not found");
+ ATLTRACE("***** CShellExtCMenu::GetCommandString: idCmd not found\n");
}
else
{
- TDEBUG_TRACE(
- "CShellExtCMenu::GetCommandString: name = \"" << iter->second.name << "\"");
+ ATLTRACE("CShellExtCMenu::GetCommandString: name = '%s'\n", iter->second.name.c_str());
if (uFlags == GCS_HELPTEXTW)
{
@@ -643,10 +628,9 @@ size_t size = iter->second.helpText.size();
if (size >= 40)
{
- TDEBUG_TRACE(
- "***** CShellExtCMenu::GetCommandString: warning:"
- << " length of help text is " << size
- << ", which is not reasonably short (<40)");
+ ATLTRACE("***** CShellExtCMenu::GetCommandString: warning: "
+ "length of help text is %d, which is not reasonably "
+ "short (<40)\n", size);
}
}
else if (uFlags == GCS_HELPTEXTA)
@@ -673,8 +657,7 @@
if (cchMax < 1)
{
- TDEBUG_TRACE("CShellExtCMenu::GetCommandString: cchMax = "
- << cchMax << " (is <1)");
+ ATLTRACE("CShellExtCMenu::GetCommandString: cchMax = %d (is <1)\n", cchMax);
return res;
}
@@ -691,8 +674,8 @@
size = wcslen(src);
- TDEBUG_TRACEW(L"CShellExtCMenu::GetCommandString: res = " << int(res)
- << L", pszName (wide) = \"" << dest << L"\"");
+ ATLTRACE(L"CShellExtCMenu::GetCommandString: res = %d, "
+ L"pszName (wide) = '%s'\n", (int)res, dest);
}
else
{
@@ -701,15 +684,14 @@
size = strlen(psz);
- TDEBUG_TRACE("CShellExtCMenu::GetCommandString: res = " << int(res)
- << ", pszName = \"" << psz << "\"");
+ ATLTRACE("CShellExtCMenu::GetCommandString: res = %d, pszName = '%s'\n",
+ (int)res, psz);
}
if (size > cchMax-1)
{
- TDEBUG_TRACE(
- "***** CShellExtCMenu::GetCommandString: string was truncated: size = "
- << size << ", cchMax = " << cchMax);
+ ATLTRACE("***** CShellExtCMenu::GetCommandString: string was truncated: "
+ "size = %d, cchMax = %d\n", size, cchMax);
}
return res;
@@ -780,7 +762,7 @@ std::string dir = GetTHgProgRoot();
if (dir.empty())
{
- TDEBUG_TRACE("RunDialog: THG root is empty");
+ ATLTRACE("RunDialog: THG root is empty\n");
return;
}
std::string hgcmd = dir + "\\thgw.exe";
@@ -812,7 +794,7 @@ }
else
{
- TDEBUG_TRACE("***** RunDialog: can't get cwd");
+ ATLTRACE("***** RunDialog: can't get cwd\n");
return;
}
@@ -832,11 +814,11 @@ const std::string tempfile = GetTemporaryFile();
if (tempfile.empty())
{
- TDEBUG_TRACE("***** RunDialog: error: GetTemporaryFile returned empty string");
+ ATLTRACE("***** RunDialog: error: GetTemporaryFile returned empty string\n");
return;
}
- TDEBUG_TRACE("RunDialog: temp file = " << tempfile);
+ ATLTRACE("RunDialog: temp file = %s\n", tempfile.c_str());
HANDLE tempfileHandle = CreateFileA(
tempfile.c_str(), GENERIC_WRITE,
FILE_SHARE_READ, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0
@@ -844,7 +826,7 @@
if (tempfileHandle == INVALID_HANDLE_VALUE)
{
- TDEBUG_TRACE("***** RunDialog: error: failed to create file " << tempfile);
+ ATLTRACE("***** RunDialog: error: failed to create file '%s'\n", tempfile.c_str());
return;
}
@@ -852,7 +834,7 @@ for (ST i = 0; i < myFiles.size(); i++)
{
DWORD dwWritten;
- TDEBUG_TRACE("RunDialog: temp file adding " << myFiles[i]);
+ ATLTRACE("RunDialog: temp file adding '%s'\n", myFiles[i].c_str());
WriteFile(
tempfileHandle, myFiles[i].c_str(),
static_cast<DWORD>(myFiles[i].size()), &dwWritten, 0
@@ -869,7 +851,7 @@
void CShellExtCMenuBase::PrintDebugHeader(LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj)
{
- TDEBUG_TRACE("CShellExtCMenu::Initialize");
+ ATLTRACE("CShellExtCMenu::Initialize\n");
// get installed MSI product id (for debugging purposes for now)
#ifdef _M_X64
@@ -879,9 +861,9 @@#endif
std::vector<char> product_id(50, 0);
UINT msires = ::MsiGetProductCodeA(shellexid, &product_id[0]);
- TDEBUG_TRACE("MSI shellexid: " << shellexid);
- TDEBUG_TRACE("MSI msires: " << msires);
- TDEBUG_TRACE("MSI installed product id: " << &product_id[0]);
+ ATLTRACE("MSI shellexid: %s\n", shellexid);
+ ATLTRACE("MSI msires: %d", msires);
+ ATLTRACE("MSI installed product id: %s\n", &product_id[0]);
DWORD busize = 300;
std::vector<char> buf(busize, 0);
@@ -889,20 +871,18 @@ &product_id[0], INSTALLPROPERTY_INSTALLLOCATION, &buf[0], &busize);
if (msires == ERROR_SUCCESS)
{
- TDEBUG_TRACE("MSI install location: " << &buf[0]);
+ ATLTRACE("MSI install location: %s\n", &buf[0]);
}
else
{
- TDEBUG_TRACE("MSI install location: error " << msires);
+ ATLTRACE("MSI install location: error %d\n", msires);
}
- TDEBUG_TRACEW(
- L"---- TortoiseHg shell extension version "
- << ThgVersion::get() << L"----"
- );
+ ATLTRACE(L"---- TortoiseHg shell extension version %s ----",
+ ThgVersion::get().c_str());
- TDEBUG_TRACE(" pIDFolder: " << pIDFolder);
- TDEBUG_TRACE(" pDataObj: " << pDataObj);
+ ATLTRACE(" pIDFolder: %p\n", pIDFolder);
+ ATLTRACE(" pDataObj: %p\n", pDataObj);
}
STDMETHODIMP CShellExtCMenuBase::Initialize(
@@ -926,18 +906,18 @@ if (hDrop)
{
UINT uNumFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);
- TDEBUG_TRACE(" hDrop uNumFiles = " << uNumFiles);
+ ATLTRACE(" hDrop uNumFiles = %d\n", uNumFiles);
for (UINT i = 0; i < uNumFiles; ++i) {
if (DragQueryFile(hDrop, i, name, MAX_PATH) > 0)
{
- TDEBUG_TRACE(" DragQueryFile [" << i << "] = " << name);
+ ATLTRACE(" DragQueryFile [%d] = '%s'\n", i, name);
myFiles.push_back(name);
}
}
}
else
{
- TDEBUG_TRACE(" hDrop is NULL ");
+ ATLTRACE(" hDrop is NULL\n");
}
GlobalUnlock(stg.hGlobal);
@@ -949,7 +929,7 @@ }
else
{
- TDEBUG_TRACE(" pDataObj->GetData failed");
+ ATLTRACE(" pDataObj->GetData failed\n");
}
}
@@ -957,14 +937,14 @@ if (pIDFolder)
{
SHGetPathFromIDList(pIDFolder, name);
- TDEBUG_TRACE(" Folder " << name);
+ ATLTRACE(" Folder '%s'\n", name);
myFolder = name;
}
// disable context menu if neither the folder nor the files
// have been found
if (myFolder.empty() && myFiles.empty()) {
- TDEBUG_TRACE(" shell extension not available on this object");
+ ATLTRACE(" shell extension not available on this object\n");
return E_FAIL;
} else {
return S_OK;
|
@@ -33,7 +33,7 @@ CShellExtDnd::QueryContextMenu(
HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
{
- TDEBUG_TRACE("CShellExtDnd::QueryContextMenu");
+ ATLTRACE("CShellExtDnd::QueryContextMenu\n");
if ((uFlags & CMF_DEFAULTONLY)!=0)
return S_OK; //we don't change the default action
@@ -96,7 +96,7 @@ if (pIDFolder)
{
SHGetPathFromIDList(pIDFolder, name);
- TDEBUG_TRACE(" Folder " << name);
+ ATLTRACE(" Folder '%s'\n", name);
myFolder = name;
}
@@ -105,7 +105,7 @@ //short circuit if we're dragging into a non-Hg repository
if (myFolder.empty() || (root = GetHgRepoRoot(myFolder)).empty())
{
- TDEBUG_TRACE(" drag into a non-Hg repos directory");
+ ATLTRACE(" drag into a non-Hg repos directory\n");
return E_FAIL;
}
@@ -120,14 +120,14 @@ if (hDrop)
{
UINT uNumFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);
- TDEBUG_TRACE(" hDrop uNumFiles = " << uNumFiles);
+ ATLTRACE(" hDrop uNumFiles = %d\n", uNumFiles);
for (UINT i = 0; i < uNumFiles; ++i) {
if (DragQueryFile(hDrop, i, name, MAX_PATH) > 0)
{
- TDEBUG_TRACE(" DragQueryFile [" << i << "] = " << name);
+ ATLTRACE(" DragQueryFile [%d] = '%s'\n", i, name);
if (GetHgRepoRoot(name) != root)
{
- TDEBUG_TRACE(" " << name << " isn't in target dir repository");
+ ATLTRACE(" '%s' isn't in target dir repository\n", name);
myFiles.clear();
break;
}
@@ -137,7 +137,7 @@ }
else
{
- TDEBUG_TRACE(" hDrop is NULL ");
+ ATLTRACE(" hDrop is NULL\n");
}
GlobalUnlock(stg.hGlobal);
@@ -149,14 +149,14 @@ }
else
{
- TDEBUG_TRACE(" pDataObj->GetData failed");
+ ATLTRACE(" pDataObj->GetData failed\n");
}
}
// disable context menu if neither the folder nor the files
// have been found
if (myFiles.empty()) {
- TDEBUG_TRACE(" shell extension not available on this object");
+ ATLTRACE(" shell extension not available on this object\n");
return E_FAIL;
} else {
return S_OK;
|
@@ -11,7 +11,7 @@ STDMETHODIMP CShellExtOverlay::GetOverlayInfo(
LPWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags)
{
- TDEBUG_TRACE("CShellExtOverlay::GetOverlayInfo: myTortoiseClass = " << myTortoiseClass);
+ ATLTRACE("CShellExtOverlay::GetOverlayInfo: myTortoiseClass = '%c'\n", myTortoiseClass);
// icons are determined by TortoiseOverlays shim
*pIndex = 0;
*pdwFlags = 0;
|
@@ -81,8 +81,8 @@ {
if (!splitbase(n, base, rest)) {
- TDEBUG_TRACE("Directory(" << path() << ")::add(" << n_in
- << "): splitbase returned 0");
+ ATLTRACE("Directory('%s')::add(%d): splitbase returned 0\n",
+ path().c_str(), n_in.c_str());
return 0;
}
@@ -129,8 +129,8 @@
if (!splitbase(n, base, rest))
{
- TDEBUG_TRACE("Directory(" << path() << ")::get("
- << n_in << "): splitbase returned 0");
+ ATLTRACE("Directory('%s')::get(%d): splitbase returned 0\n",
+ path().c_str(), n_in.c_str());
return 0;
}
@@ -175,8 +175,8 @@
if (!splitbase(n, base, rest))
{
- TDEBUG_TRACE("Directory(" << path() << ")::getdir("
- << n_in << "): splitbase returned 0");
+ ATLTRACE("Directory('%s')::getdir(%d): splitbase returned 0\n",
+ path().c_str(), n_in.c_str());
return 0;
}
@@ -208,7 +208,7 @@ const Directory* d = *i;
if (!d)
{
- TDEBUG_TRACE("Directory(" << path() << ")::print: error: d is 0");
+ ATLTRACE("Directory('%s')::print: error: d is 0\n", path().c_str());
return;
}
d->print();
|
@@ -66,7 +66,7 @@ FILE *f = fopenReadRenameAllowed(p.c_str());
if (!f)
{
- TDEBUG_TRACE("DirectoryStatus::read: can't open '" << p << "'");
+ ATLTRACE("DirectoryStatus::read: can't open '%s'\n", p);
std::string p = (cwd.size() < hgroot.size() ? hgroot : cwd);
Thgstatus::update(p);
return 0;
@@ -128,8 +128,8 @@close:
fclose(f);
- TDEBUG_TRACE("DirectoryStatus::read(" << hgroot << "): done. "
- << v_.size() << " entries read. noicons_ = " << noicons_ );
+ ATLTRACE("DirectoryStatus::read(%d): done. %d entries read. noicons_ = %d\n",
+ v_.size(), noicons_);
return res;
}
|
@@ -55,16 +55,15 @@ {
if (stat.lstat(path.c_str(), true) != 0)
{
- TDEBUG_TRACE("Dirstatecache::get: lstat(" << path <<") failed");
+ ATLTRACE("Dirstatecache::get: lstat('%s') failed\n", path.c_str());
return 0;
}
- TDEBUG_TRACE("Dirstatecache::get: lstat(" << path <<") ok ");
+ ATLTRACE("Dirstatecache::get: lstat('%s') ok\n", path.c_str());
new_stat = true;
if (cache().size() >= 10)
{
- TDEBUG_TRACE("Dirstatecache::get: dropping "
- << cache().back().hgroot);
+ ATLTRACE("Dirstatecache::get: dropping '%s'\n", cache().back().hgroot.c_str());
delete cache().back().dstate;
cache().back().dstate = 0;
cache().pop_back();
@@ -82,15 +81,15 @@ {
if (0 != stat.lstat(path.c_str(), true))
{
- TDEBUG_TRACE("Dirstatecache::get: lstat(" << path <<") failed");
- TDEBUG_TRACE("Dirstatecache::get: dropping " << iter->hgroot);
+ ATLTRACE("Dirstatecache::get: lstat('%s') failed\n", path.c_str());
+ ATLTRACE("Dirstatecache::get: dropping '%s'\n", iter->hgroot.c_str());
delete iter->dstate;
iter->dstate = 0;
cache().erase(iter);
return 0;
}
iter->tickcount = tc;
- TDEBUG_TRACE("Dirstatecache::get: lstat(" << path <<") ok ");
+ ATLTRACE("Dirstatecache::get: lstat('%s') ok\n", path.c_str());
new_stat = true;
}
@@ -107,11 +106,11 @@ return iter->dstate;
}
- TDEBUG_TRACE("Dirstatecache::get: refreshing " << hgroot);
+ ATLTRACE("Dirstatecache::get: refreshing '%s'\n", hgroot.c_str());
}
else
{
- TDEBUG_TRACE("Dirstatecache::get: reading " << hgroot);
+ ATLTRACE("Dirstatecache::get: reading '%s'\n", hgroot.c_str());
}
unset = false;
@@ -125,13 +124,12 @@ {
if (iter->unset)
{
- TDEBUG_TRACE(
- "Dirstatecache::get: **** old and new have unset entries");
+ ATLTRACE("Dirstatecache::get: **** old and new have unset entries\n");
request_thgstatus_update = false;
}
else
{
- TDEBUG_TRACE("Dirstatecache::get: new has unset entries");
+ ATLTRACE("Dirstatecache::get: new has unset entries\n");
}
}
@@ -141,20 +139,20 @@ iter->dstate = ds.release();
unsigned delta = tc1 - tc0;
- TDEBUG_TRACE("Dirstatecache::get: read done in " << delta << " ticks, "
- << cache().size() << " repos in cache");
+ ATLTRACE("Dirstatecache::get: read done in %d ticks, %d repos in cache\n",
+ delta, cache().size());
iter->dstate_mtime = stat.mtime;
iter->dstate_size = stat.size;
if (request_thgstatus_update)
{
- TDEBUG_TRACE("Dirstatecache::get: calling Thgstatus::update");
+ ATLTRACE("Dirstatecache::get: calling Thgstatus::update\n");
Thgstatus::update(cwd);
}
else
{
- TDEBUG_TRACE("Dirstatecache::get: omitting Thgstatus::update");
+ ATLTRACE("Dirstatecache::get: omitting Thgstatus::update\n");
}
return iter->dstate;
@@ -175,7 +173,7 @@ delete i->dstate;
i->dstate = 0;
cache().erase(i);
- TDEBUG_TRACE("Dirstatecache::invalidate(" << hgroot << ")");
+ ATLTRACE("Dirstatecache::invalidate('%s')\n", hgroot.c_str());
break;
}
}
|
@@ -109,7 +109,7 @@
if (pfnBeginBufferedPaint == NULL || pfnEndBufferedPaint == NULL || pfnGetBufferedPaintBits == NULL)
{
- TDEBUG_TRACE(" IconBitmapUtils::IconToBitmapPARGB32: Theme functions not found, returns NULL");
+ ATLTRACE(" IconBitmapUtils::IconToBitmapPARGB32: Theme functions not found, returns NULL\n");
return NULL;
}
|
@@ -55,6 +55,6 @@ std::string reason = "uninitialized handlers: " + missing;
Thgstatus::error(reason);
std::string res = "InitStatus: error: " + reason;
- TDEBUG_TRACE("***** " << res);
+ ATLTRACE("***** %s\n", res.c_str());
return res;
}
|
|
|
@@ -66,10 +66,8 @@ if (ticks > 5 /* ms */)
{
// trace slower PathIsDirectory calls (untypical on local discs)
- TDEBUG_TRACE(
- "[" << cls << "] hasHgDir: PathIsDirectory(\"" << p << "\")" <<
- " -> " << res << ", in " << ticks << " ticks"
- );
+ ATLTRACE("[%c] hasHgDir: PathIsDirectory('%s') -> %d, in %d ticks\n",
+ cls, p.c_str(), (int)res, ticks);
}
return res;
@@ -131,7 +129,7 @@ if (has_hg)
{
cur.hgroot = cur.path;
- TDEBUG_TRACE(dp << "(" << cur.path << "): hgroot = cur.path");
+ ATLTRACE("%s('%s'): hgroot = cur.path\n", dp.c_str(), cur.path.c_str());
return 1;
}
}
@@ -158,10 +156,8 @@ if (has_hg)
{
cur.hgroot = p;
- TDEBUG_TRACE(
- dp << "(" << cur.path << "): hgroot = '" << cur.hgroot
- << "' (found repo)"
- );
+ ATLTRACE("%s('%s'): hgroot = '%s' (found repo)", dp.c_str(),
+ cur.path.c_str(), cur.hgroot.c_str());
return 1;
}
std::string p2 = DirName(p);
@@ -173,13 +169,12 @@exit:
if (file_access_is_unacceptably_slow)
{
- TDEBUG_TRACE(
- "******" << dp << "(" << cur.path << "): ignored, "
- << "call took too long (" << ticks << " ticks)");
+ ATLTRACE("****** %s('%s'): ignored, call took too long (%d ticks)\n",
+ dp.c_str(), cur.path.c_str(), ticks);
}
else
{
- TDEBUG_TRACE(dp << "(" << cur.path << "): NO repo found");
+ ATLTRACE("%s('%s'): NO repo found\n", dp.c_str(), cur.path.c_str());
}
last = cur;
return 0;
@@ -288,10 +283,8 @@ Dirstate* pds = Dirstatecache::get(cur.hgroot, cur.basedir, unset);
if (!pds)
{
- TDEBUG_TRACE(
- dp << "Dirstatecache::get(" << cur.hgroot
- << ") returns no Dirstate"
- );
+ ATLTRACE("%s Dirstatecache::get('%s') returns no Dirstate\n", dp.c_str(),
+ cur.hgroot.c_str());
last = cur;
return 0;
}
@@ -299,16 +292,14 @@ Winstat stat;
if (0 != stat.lstat(path.c_str()))
{
- TDEBUG_TRACE(dp << "lstat(" << path << ") failed");
+ ATLTRACE("%s lstat('%s') failed", dp.c_str(), path.c_str());
last = cur;
return 0;
}
cur.isdir = stat.isdir;
#if 0
- TDEBUG_TRACE(
- dp << "stat.lstat(\"" << cur.path << "\") "
- << "-> stat.isdir is " << stat.isdir
- );
+ ATLTRACE("%s stat.lstat('%s') -> stat.isdir is %d\n" << dp.c_str(),
+ cur.path.c_str(), (int)stat.isdir);
#endif
if (cur.isdir)
@@ -359,10 +350,10 @@ std::string relbase;
if (pdirsta && get_relpath(cur.hgroot, cur.basedir, relbase))
{
- TDEBUG_TRACE(dp << "relbase = '" << relbase << "'");
+ ATLTRACE("%s relbase = '%s'\n", dp.c_str(), relbase.c_str());
char basedir_status = pdirsta->status(relbase);
- TDEBUG_TRACE(dp << "basedir_status = " << basedir_status);
+ ATLTRACE("%s basedir_status = '%c'\n", dp.c_str(), basedir_status);
if (basedir_status != 'M')
update = true;
@@ -381,12 +372,12 @@ lasttickcount = tc;
}
- TDEBUG_TRACE(dp << "outStatus is 'P'");
+ ATLTRACE("%s outStatus is 'P'\n", dp.c_str());
}
if (update)
{
- TDEBUG_TRACE(dp << "calling Thgstatus::update");
+ ATLTRACE("%s calling Thgstatus::update\n", dp.c_str());
Thgstatus::update(path);
}
|
@@ -25,12 +25,12 @@ {
if (dwReason == DLL_PROCESS_ATTACH)
{
- TDEBUG_TRACE("DllMain: DLL_PROCESS_ATTACH");
+ ATLTRACE("DllMain: DLL_PROCESS_ATTACH\n");
_Module.Init(ObjectMap, hInstance, &LIBID_THgShell);
}
else if (dwReason == DLL_PROCESS_DETACH)
{
- TDEBUG_TRACE("DllMain: DLL_PROCESS_ATTACH");
+ ATLTRACE("DllMain: DLL_PROCESS_ATTACH\n");
_Module.Term();
}
@@ -39,21 +39,24 @@
STDAPI DllCanUnloadNow(void)
{
- TDEBUG_TRACE("DllCanUnloadNow");
+ ATLTRACE("DllCanUnloadNow\n");
return _Module.GetLockCount() == 0 ? S_OK : S_FALSE;
}
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
+ ATLTRACE("DllGetClassObject\n");
return _Module.GetClassObject(rclsid, riid, ppv);
}
STDAPI DllRegisterServer(void)
{
+ ATLTRACE("DllRegisterServer\n");
return _Module.RegisterServer();
}
STDAPI DllUnregisterServer(void)
{
+ ATLTRACE("DllUnregisterServer\n");
return _Module.UnregisterServer();
}
|
@@ -43,7 +43,7 @@ BOOL fSuccess;
DWORD cbRead;
- TDEBUG_TRACE("Thgstatus::update: sending '" << request << "' to " << pname);
+ ATLTRACE("Thgstatus::update: sending '%s' to %s\n", request.c_str(), pname.c_str());
fSuccess = ::CallNamedPipeA(
pname.c_str(), (void*)request.c_str(), (DWORD)request.size(), 0, 0, &cbRead,
@@ -57,14 +57,12 @@ }
else if (err == ERROR_PIPE_BUSY)
{
- TDEBUG_TRACE("Thgstatus::update: CallNamedPipeA failed. "
- "ERROR_PIPE_BUSY");
+ ATLTRACE("Thgstatus::update: CallNamedPipeA failed (ERROR_PIPE_BUSY)\n");
return -1;
}
else
{
- TDEBUG_TRACE("Thgstatus::update: CallNamedPipeA failed ("
- << err << ")");
+ ATLTRACE("Thgstatus::update: CallNamedPipeA failed (%d)\n", err);
return -1;
}
}
|
@@ -18,7 +18,7 @@
if (bmpcache_.size() > 200)
{
- TDEBUG_TRACE("**** GetTortoiseIconBitmap: error: too many bitmaps in cache");
+ ATLTRACE("**** GetTortoiseIconBitmap: error: too many bitmaps in cache\n");
return 0;
}
@@ -29,16 +29,15 @@ HBITMAP hBmp = bmpUtils.IconToBitmapPARGB32(hIcon);
if (!hBmp)
{
- TDEBUG_TRACE("**** GetTortoiseIconBitmap: error: something wrong in bmpUtils.ConvertToPARGB32(hIcon)");
+ ATLTRACE("**** GetTortoiseIconBitmap: error: something wrong in "
+ "bmpUtils.ConvertToPARGB32(hIcon)\n");
return 0;
}
bmpcache_[iconname] = hBmp;
- TDEBUG_TRACE(
- "GetTortoiseIconBitmap: added '" << iconname << "' to bmpcache_"
- " (" << bmpcache_.size() << " bitmaps in cache)"
- );
+ ATLTRACE("GetTortoiseIconBitmap: added '%s' to bmpcache_ (%d bitmaps in cache)\n",
+ iconname.c_str(), bmpcache_.size());
return hBmp;
}
|
|
|
@@ -31,8 +31,8 @@ // (see http://www.encocoservices.com/createprocess.html)
bool LaunchCommand(const std::string& command, const std::string& cwd)
{
- TDEBUG_TRACE("LaunchCommand: " << command);
- TDEBUG_TRACE("LaunchCommand: in " << cwd);
+ ATLTRACE("LaunchCommand: %s\n", command.c_str());
+ ATLTRACE("LaunchCommand: in '%s'\n", cwd.c_str());
PROCESS_INFORMATION processInfo;
memset(&processInfo, 0, sizeof(processInfo));
@@ -54,7 +54,7 @@
if (res == 0)
{
- TDEBUG_TRACE("LaunchCommand: failed to launch");
+ ATLTRACE("LaunchCommand: failed to launch\n");
return false;
}
@@ -70,7 +70,7 @@
if (GetTempPath(MAX_PATH, tempDir) == 0)
{
- TDEBUG_TRACE("GetTemporaryFile: Failed to find temporary path");
+ ATLTRACE("GetTemporaryFile: Failed to find temporary path\n");
}
else if (GetTempFileName(tempDir, prefix, 0, tempFile) != 0)
{
@@ -78,7 +78,7 @@ }
else
{
- TDEBUG_TRACE("GetTemporaryFile: Failed to get temporary file");
+ ATLTRACE("GetTemporaryFile: Failed to get temporary file\n");
}
return "";
@@ -124,7 +124,7 @@ std::string thgdir = GetTHgProgRoot();
if (thgdir.empty())
{
- TDEBUG_TRACE("GetTortoiseIcon: THG root is empty");
+ ATLTRACE("GetTortoiseIcon: THG root is empty\n");
return 0;
}
@@ -136,7 +136,7 @@
if (iconcache_.size() > 200)
{
- TDEBUG_TRACE("**** GetTortoiseIcon: error: too many icons in cache");
+ ATLTRACE("**** GetTortoiseIcon: error: too many icons in cache\n");
return 0;
}
@@ -144,16 +144,14 @@ 16, 16, LR_LOADFROMFILE);
if (!h)
{
- TDEBUG_TRACE("GetTortoiseIcon: can't find " + iconpath);
+ ATLTRACE("GetTortoiseIcon: can't find '%s'\n", iconpath.c_str());
return 0;
}
iconcache_[iconpath] = h;
- TDEBUG_TRACE(
- "GetTortoiseIcon: added '" << iconpath << "' to iconcache_"
- " (" << iconcache_.size() << " icons in cache)"
- );
+ ATLTRACE("GetTortoiseIcon: added '%s' to iconcache_ (%d icons in cache)\n",
+ iconpath.c_str(), iconcache_.size());
return h;
}
@@ -161,7 +159,7 @@
std::string GetHgRepoRoot(const std::string& path)
{
- TDEBUG_TRACE("GetHgRepoRoot('" << path << "')");
+ ATLTRACE("GetHgRepoRoot('%s')\n", path.c_str());
std::string p =
(::PathIsUNCServerShare(path.c_str()) || IsDirectory(path))
@@ -171,7 +169,7 @@ std::string tdir = p + "\\.hg";
if (::PathIsUNCServerShare(tdir.c_str()))
{
- TDEBUG_TRACE("GetHgRepoRoot: tdir is UNC share '" << tdir << "'");
+ ATLTRACE("GetHgRepoRoot: tdir is UNC share '%s'\n", tdir.c_str());
p.clear();
break;
}
@@ -186,7 +184,7 @@ }
}
- TDEBUG_TRACE("GetHgRepoRoot: returning '" << p << "'");
+ ATLTRACE("GetHgRepoRoot: returning '%s'\n", p.c_str());
return p;
}
@@ -214,7 +212,7 @@ int fd = ::_open_osfhandle((intptr_t)fh, _O_RDONLY);
if (fd == -1)
{
- TDEBUG_TRACE("fopenReadRenameAllowed: _open_osfhandle failed");
+ ATLTRACE("fopenReadRenameAllowed: _open_osfhandle failed\n");
::CloseHandle(fh);
return 0;
}
@@ -223,7 +221,7 @@ FILE* f = ::_fdopen(fd, "r");
if (f == 0)
{
- TDEBUG_TRACE("fopenReadRenameAllowed: _fdopen failed");
+ ATLTRACE("fopenReadRenameAllowed: _fdopen failed\n");
::_close(fd);
return 0;
}
@@ -251,7 +249,7 @@ return 1;
}
- TDEBUG_TRACEW(L"GetRegSZValueW(\"" << name << L"\") failed");
+ ATLTRACE(L"GetRegSZValueW('%s') failed\n", name);
return 0;
}
|
@@ -28,7 +28,7 @@ FILE *f = fopenReadRenameAllowed(path.c_str());
if (!f)
{
- TDEBUG_TRACE("Dirstate::read: can't open " << path);
+ ATLTRACE("Dirstate::read: can't open '%s'\n", path.c_str());
return std::auto_ptr<Dirstate>(0);
}
|
@@ -15,47 +15,7 @@ extern CComModule _Module;
#include <atlcom.h>
#include <shlobj.h>
-#include <assert.h>
#include <string>
-#include "ThgDebug.h"
-
-#define ASSERT assert
-
-
-#ifdef THG_DEBUG
- #include <sstream>
-
- #ifdef _M_X64
- #define THG_PREFIX "[THGx64] "
- #define THG_PREFIXL L"[THGx64] "
- #else
- #define THG_PREFIX "[THGx86] "
- #define THG_PREFIXL L"[THGx86] "
- #endif
-
- // TDEBUG_TRACE() prints debugging messages to Windows' debugger display.
- // The messages can be viewed with Sysinternals DebugView, which may be
- // downloaded from Microsoft TechNet.
- #define TDEBUG_TRACE(s) if (ThgDebug::enabled()) { \
- std::stringstream _the_msg; \
- _the_msg << THG_PREFIX << s; \
- std::string _the_str = _the_msg.str(); \
- OutputDebugStringA(_the_str.c_str()); \
- }
- #define TDEBUG_TRACEW(s) if (ThgDebug::enabled()) { \
- std::basic_stringstream<wchar_t> _the_msg; \
- _the_msg << THG_PREFIXL << s; \
- std::wstring _the_str = _the_msg.str(); \
- OutputDebugStringW(_the_str.c_str()); \
- }
- #define TDEBUG_ENTER TDEBUG_TRACE
-#else
- #define TDEBUG_TRACE(s)
- #define TDEBUG_TRACEW(s)
- #define TDEBUG_ENTER(s)
-
#endif
-#endif
-
|
Loading...