std::vector<MenuItem> WinMergeContextMenu::GetMenuItemList() const
{
std::vector<MenuItem> list;
+ list.reserve(3);
bool isdir = m_strPaths.empty() ? false : !!PathIsDirectory(m_strPaths[0].c_str());
bool enabled = (m_strPaths.size() <= MaxFileCount);
int icon = isdir ? IDI_WINMERGEDIR : IDI_WINMERGE;
INT_PTR menulistsize=m_MenuList.GetSize();
if(uiId<(UINT)menulistsize){
CString str=m_MenuList[uiId]->GetString();
- if(str==""){
+ if(str.IsEmpty()){
delete m_MenuList.GetAt(uiId);
m_MenuList.RemoveAt(uiId);
}
strTooltip = pITabBar ? pITabBar->GetTooltipString() : _T("");
if (strTooltip == strTitle && strTitle.GetLength() <= GetMaxTitleLength())
- strTooltip = "";
+ strTooltip.Empty();
m_tooltips.UpdateTipText(strTooltip, this);
CRect rc;
m_sFullStateText.resize(m_nMaxItems);
for (int i = 0; i < m_nMaxItems; i++)
{
- m_sFullStateText[i] = _T("");
+ m_sFullStateText[i].Empty();
}
}
CComboBoxEx::ResetContent();
mycpyt2w(_T("script:"), wc, DIMOF(wc));
else
mycpyt2w(_T(""), wc, DIMOF(wc));
- mycpyt2w(source, wc+wcslen(wc), DIMOF(wc)-wcslen(wc));
+ size_t len = wcslen(wc);
+ mycpyt2w(source, wc + len, DIMOF(wc) - len);
// I observed that CoGetObject() may internally provoke an access
// violation and succeed anyway. No idea how to avoid this.
text = GetWindowsVer();
FileWriteString(text);
text = GetProcessorInfo();
- if (text != _T(""))
+ if (!text.empty())
{
FileWriteString(_T("\r\n Processor: "));
FileWriteString(text);
String sProductName = _T("");
if (key.QueryRegMachine(_T("Hardware\\Description\\System\\CentralProcessor\\0")))
sProductName = key.ReadString(_T("Identifier"), _T(""));
- if (sProductName != _T(""))
+ if (!sProductName.empty())
{
// This is the full identifier of the processor
// (e.g. "Intel64 Family 6 Model 158 Stepping 9")
// but we'll only keep the first word (e.g. "Intel64")
- int x = (int)sProductName.find_first_of(_T(" "));
+ int x = (int)sProductName.find_first_of(_T(' '));
sProductName = sProductName.substr(0, x);
}
TCHAR dir[_MAX_DIR] = {0};
TCHAR drive[_MAX_DRIVE] = {0};
_tsplitpath_s(s.c_str(), drive, _MAX_DRIVE, dir, _MAX_DIR, file, _MAX_FNAME, ext, _MAX_EXT);
- if (_tcslen(ext) == 0)
+ if (ext[0] == '\0')
{
s += FileFilterExt;
}
if (m_pGhostTextBuffer != nullptr)
m_pGhostTextBuffer->GetTextWithoutEmptys (nStartLine, nStartChar, nEndLine, nEndChar, text, nCrlfStyle, bExcludeInvisibleLines);
else
- text = _T ("");
+ text.Empty();
}
void CGhostTextView::GetTextWithoutEmptysInColumnSelection (CString & text, bool bExcludeInvisibleLines /*= true*/)
{
if (m_pGhostTextBuffer == nullptr)
{
- text = _T ("");
+ text.Empty();
return;
}
return static_cast<HexMergeDocList &>(GetDocList(theApp.m_pHexMergeTemplate));
}
-std::list<CImgMergeFrame *> CMainFrame::GetAllImgMergeFrames()
+std::vector<CImgMergeFrame *> CMainFrame::GetAllImgMergeFrames()
{
- std::list<CImgMergeFrame *> list;
+ std::vector<CImgMergeFrame *> list;
// Close Non-Document/View frame with confirmation
CMDIChildWnd *pChild = static_cast<CMDIChildWnd *>(CWnd::FromHandle(m_hWndMDIClient)->GetWindow(GW_CHILD));
while (pChild != nullptr)
pMenu->AppendMenu(MF_STRING, ID_NOT_SUGGESTED_PLUGINS, _("All plugins").c_str());
}
- std::vector<String> processTypes;
+ std::list<String> processTypes;
for (const auto& [processType, pluginList] : allPlugins)
processTypes.push_back(processType);
auto it = std::find(processTypes.begin(), processTypes.end(), _("&Others"));
processTypes.push_back(_("&Others"));
}
- for (const auto& processType: processTypes)
+ for (const auto& processType : processTypes)
{
CMenu popup;
popup.CreatePopupMenu();
MergeDocList &GetAllMergeDocs();
DirDocList &GetAllDirDocs();
HexMergeDocList &GetAllHexMergeDocs();
- std::list<CImgMergeFrame *> GetAllImgMergeFrames();
+ std::vector<CImgMergeFrame *> GetAllImgMergeFrames();
void UpdateFont(FRAMETYPE frame);
BOOL CreateToolbar();
CMergeEditView * GetActiveMergeEditView();
else if (param == _T("image"))
m_nWindowType = WindowType::IMAGE;
else
- m_sErrorMessages.push_back(_T("Unknown window type '") + param + _T("' specified"));
+ m_sErrorMessages.emplace_back(_T("Unknown window type '") + param + _T("' specified"));
}
else if (param == _T("m"))
{
else if (param == _T("size"))
m_nCompMethod = CompareMethodType::SIZE;
else
- m_sErrorMessages.push_back(_T("Unknown compare method '") + param + _T("' specified"));
+ m_sErrorMessages.emplace_back(_T("Unknown compare method '") + param + _T("' specified"));
}
else if (param == _T("r"))
{
}
else
{
- m_sErrorMessages.push_back(_T("Unknown option '/") + param + _T("'"));
+ m_sErrorMessages.emplace_back(_T("Unknown option '/") + param + _T("'"));
}
}
// If "compare file dir" make it "compare file dir\file".
{
std::vector<int> *pWordDiffs;
if (list.find(firstDiff) == list.end())
- list.insert(std::pair<int, std::vector<int> *>(firstDiff, new std::vector<int>()));
+ list.emplace(firstDiff, new std::vector<int>());
pWordDiffs = list[firstDiff];
for (int i = firstWordDiff; i <= lastWordDiff; ++i)
{
}
}
for (auto& it : list)
- ret.insert(std::pair<int, std::vector<int>>(it.first, *it.second));
+ ret.emplace(it.first, *it.second);
return ret;
}
m_cboPluginName.AddString(automaticPlugin->m_name.c_str());
}
- std::vector<String> processTypes;
+ std::list<String> processTypes;
for (const auto& [processType, pluginList] : m_Plugins)
processTypes.push_back(processType);
return;
for (size_t i = m_dropListFixedPattern.size(); i <= static_cast<size_t>(nItem); i++)
- m_dropListFixedPattern.push_back(std::vector<String>());
+ m_dropListFixedPattern.emplace_back(std::initializer_list<String>{});
for (size_t i = m_dropListFixedPattern[nItem].size(); i <= static_cast<size_t>(nSubItem); i++)
m_dropListFixedPattern[nItem].push_back(_T(""));
*/
String ExpandShortcut(const String &inFile)
{
- assert(inFile != _T(""));
+ assert(!inFile.empty());
// No path, nothing to return
- if (inFile == _T(""))
+ if (inFile.empty())
return _T("");
String outFile;