by
Changes to 5 files · Browse files at a7d8c476ee18 Showing diff from parent 72a091dde1e2 887f8ef3312a Diff from another changeset...
@@ -113,7 +113,7 @@ MenuDescriptionMap MenuDescMap;
MenuIdCmdMap MenuIdMap;
-void AddMenuList(int idCmd, std::string name)
+void AddMenuList(int idCmd, std::string const& name)
{
TDEBUG_TRACE("AddMenuList: idCmd = " << idCmd << " name = " << name);
MenuIdMap[idCmd] = MenuDescMap[name];
@@ -123,8 +123,8 @@{
if (MenuDescMap.empty())
{
- int sz = sizeof(menuDescList) / sizeof(MenuDescription);
- for (int i=0; i < sz; i++)
+ std::size_t sz = sizeof(menuDescList) / sizeof(MenuDescription);
+ for (std::size_t i=0; i < sz; i++)
{
MenuDescription md = menuDescList[i];
TDEBUG_TRACE("InitMenuMaps: adding " << md.name);
@@ -136,7 +136,7 @@}
void InsertMenuItemWithIcon(HMENU hMenu, int indexMenu, int idCmd,
- std::string menuText, std::string iconName)
+ std::string const& menuText, std::string const& iconName)
{
MENUITEMINFO mi;
mi.cbSize = sizeof(mi);
@@ -161,7 +161,7 @@}
void InsertSubMenuItemWithIcon(HMENU hMenu, HMENU hSubMenu, int indexMenu, int idCmd,
- std::string menuText, std::string iconName)
+ std::string const& menuText, std::string const& iconName)
{
MENUITEMINFO mi;
mi.cbSize = sizeof(mi);
@@ -186,7 +186,7 @@ InsertMenuItem(hMenu, indexMenu, TRUE, &mi);
}
-void InsertMenuItemByName(HMENU hMenu, std::string name, int indexMenu,
+void InsertMenuItemByName(HMENU hMenu, std::string const& name, int indexMenu,
int idCmd, int idCmdFirst)
{
TDEBUG_TRACE("InsertMenuItemByName: name = " << name);
@@ -225,7 +225,7 @@ if (!bAppendItems)
return NOERROR;
- const int sz = sizeof(menuDescList) / sizeof(MenuDescription);
+ const std::size_t sz = sizeof(menuDescList) / sizeof(MenuDescription);
bool promoted[ sz ];
memset(&promoted, 0, sizeof(promoted));
@@ -460,7 +460,7 @@ HANDLE tempfileHandle = CreateFileA(tempfile.c_str(), GENERIC_WRITE,
FILE_SHARE_READ, &sa, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
- for (int i=0; i<myFiles.size(); i++)
+ for (std::vector<std::string>::size_type i=0; i<myFiles.size(); i++)
{
DWORD dwWritten;
TDEBUG_TRACE("DoHgtk: temp file adding " << myFiles[i]);
|
@@ -43,10 +43,9 @@ };
-bool hasHgDir(std::string path)
+bool hasHgDir(std::string const& path)
{
- path += "\\.hg";
- return PathIsDirectory(path.c_str());
+ return PathIsDirectory((path + "\\.hg").c_str()) != 0;
}
|
@@ -279,7 +279,7 @@ {
UINT uNumFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);
TDEBUG_TRACE(" hDrop uNumFiles = " << uNumFiles);
- for (int i = 0; i < uNumFiles; ++i) {
+ for (UINT i = 0; i < uNumFiles; ++i) {
if (DragQueryFile(hDrop, i, name, MAX_PATH) > 0)
{
TDEBUG_TRACE(" DragQueryFile [" << i << "] = " << name);
|
@@ -109,7 +109,7 @@
// Cuts the first token off a delimited list
-std::string CutFirstToken(std::string& sList, const std::string sDelimiter)
+std::string CutFirstToken(std::string& sList, const std::string& sDelimiter)
{
std::string::size_type p = sList.find(sDelimiter);
std::string sResult;
|
@@ -69,9 +69,10 @@ TCHAR lpszValue[MAX_PATH] = "";
LONG lpcbLonger = MAX_PATH * sizeof(TCHAR);
- RegQueryValue(key, regname, lpszValue, &lpcbLonger);
- std::string result(reinterpret_cast<char*>(lpszValue));
- return result;
+ if (RegQueryValue(key, regname, lpszValue, &lpcbLonger) != ERROR_SUCCESS)
+ return "";
+
+ return lpszValue;
}
@@ -82,9 +83,10 @@ TCHAR lpszValue[MAX_PATH] = "";
LONG lpcbLonger = MAX_PATH * sizeof(TCHAR);
- RegQueryValue(key, regname, lpszValue, &lpcbLonger);
- std::string result(reinterpret_cast<char*>(lpszValue));
- return result;
+ if (RegQueryValue(key, regname, lpszValue, &lpcbLonger) != ERROR_SUCCESS)
+ return "";
+
+ return lpszValue;
}
@@ -159,14 +161,14 @@ }
else if (GetTempFileName(tempDir, prefix, 0, tempFile) != 0)
{
- return std::string(tempFile);
+ return tempFile;
}
else
{
TDEBUG_TRACE("GetTemporaryFile: Failed to get temporary file");
}
- return std::string();
+ return "";
}
@@ -195,8 +197,7 @@ if (filename.empty())
return filename;
std::string::size_type pos = filename.find_last_of("\\");
- std::string myfilename = filename.substr(pos+1);
- return myfilename;
+ return filename.substr(pos+1);
}
HICON GetTortoiseIcon(const std::string& iconname)
|
Loading...