* Eliminate warnings such as ...
`warning C4239: nonstandard extension used: 'argument': conversion
from 'DirItemIterator' to 'DirItemIterator &'`
`note: A non-const reference may only be bound to an lvalue`
* These are warnings that only occur with Warning Level == 4.
* This commit only deals with issues with mixing CString and String
data.
* Discard the PopString class, a self-admitted hack from
stackoverflow.com, that was simply confusing and not all that "pretty"
anyway.
}
else{
if(state&ODS_CHECKED){
- pDC->FillRect(rect2,&CBrush(LightenColor(clrBack,0.6)));
+ CBrush cbTemp = LightenColor(clrBack, 0.6);
+ pDC->FillRect(rect2,&cbTemp);
rect2.SetRect(rect.left,rect.top+dy,rect.left+m_iconX+4,
rect.top+m_iconY+4+dy);
pDC->Draw3dRect(rect2,GetSysColor(COLOR_3DSHADOW),
col=RGB(255,0,255); // Original was RGB(192,192,192)
CBitmap * pddcOldBmp2 = ddc2.SelectObject(&bmp2);
CRect rect(0,0,BitMap.bmWidth,BitMap.bmHeight);
- ddc2.FillRect(rect,&CBrush(col));
+ CBrush cbTemp = col;
+ ddc2.FillRect(rect, &cbTemp);
ddc2.SelectObject(pddcOldBmp2);
newcol=GetSysColor(COLOR_3DFACE);
bmp2.CreateCompatibleBitmap(&ddc,BitMap.bmWidth,BitMap.bmHeight);
CBitmap * pddcOldBmp2 = ddc2.SelectObject(&bmp2);
CRect rect(0,0,BitMap.bmWidth,BitMap.bmHeight);
- ddc2.FillRect(rect,&CBrush(GetSysColor(COLOR_3DFACE)));
+ CBrush cbTemp = GetSysColor(COLOR_3DFACE);
+ ddc2.FillRect(rect, &cbTemp);
ddc2.SelectObject(pddcOldBmp2);
discol=GetSysColor(COLOR_BTNSHADOW);
CRect rcDest = rc;
COLORREF col=GetSysColor(COLOR_MENU);
if(!bSelected)col = LightenColor(col,0.6);
- dc->FillRect(rcDest,&CBrush(col));
+ CBrush cbTemp = col;
+ dc->FillRect(rcDest, &cbTemp);
dc->DrawEdge(&rcDest, BDR_SUNKENOUTER, BF_RECT);
if (!hbmCheck)DrawCheckMark(dc,rc.left+4,rc.top+4,GetSysColor(COLOR_MENUTEXT));
else DrawRadioDot(dc,rc.left+5,rc.top+4,GetSysColor(COLOR_MENUTEXT));
\r
#include "UnicodeString.h"\r
\r
-// from http://stackoverflow.com/questions/6117270/mfc-stdstring-vs-cstring\r
-class PopString : public CString\r
-{\r
-public:\r
- explicit PopString(String & final) : CString(final.c_str()), m_final(final)\r
- {\r
- }\r
-\r
- ~PopString()\r
- {\r
- m_final = (PCTSTR) *this;\r
- }\r
-private:\r
- PopString(const PopString &); // private copy constructor to prevent copying\r
- PopString & operator=(const PopString &); // private copy operator\r
-\r
- String & m_final;\r
-};\r
\r
inline void DDX_Check(CDataExchange* pDX, int nIDC, bool& value)\r
{\r
\r
inline void DDX_Text(CDataExchange* pDX, int nIDC, String& value)\r
{\r
- DDX_Text(pDX, nIDC, PopString(value));\r
+ CString cstrValue = value.c_str();\r
+ DDX_Text(pDX, nIDC, cstrValue);\r
+ value = cstrValue;\r
}\r
\r
inline void DDX_CBString(CDataExchange* pDX, int nIDC, String& value)\r
{\r
- DDX_CBString(pDX, nIDC, PopString(value));\r
+ CString cstrValue = value.c_str();\r
+ DDX_CBString(pDX, nIDC, cstrValue);\r
+ value = cstrValue;\r
}\r
\r
inline void DDX_CBStringExact(CDataExchange* pDX, int nIDC, String& value)\r
{\r
- DDX_CBStringExact(pDX, nIDC, PopString(value));\r
+ CString cstrValue = value.c_str();\r
+ DDX_CBStringExact(pDX, nIDC, cstrValue);\r
+ value = cstrValue;\r
}\r
\r
// Set selected path to variable so file selection dialog shows
// correct filename and path.
- m_ctlReportFile.GetWindowText(PopString(m_sReportFile));
+ CString cstrReportFile;
+ m_ctlReportFile.GetWindowText(cstrReportFile);
+ m_sReportFile = cstrReportFile;
UpdateData(FALSE);
file.SetCodepage(ucr::CP_UTF_8);
- String header =
- strutils::format(
+ CString headerText =
_T("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n")
_T("\t\"http://www.w3.org/TR/html4/loose.dtd\">\n")
_T("<html>\n")
_T("<div class=\"border\">")
_T("<table cellspacing=\"0\" cellpadding=\"0\" style=\"width: 100%%; margin: 0; border: none;\">\n")
_T("<thead>\n")
- _T("<tr>\n"),
- nFontSize, m_pView[0]->GetHTMLStyles());
+ _T("<tr>\n");
+ String header =
+ strutils::format((LPCTSTR)headerText, nFontSize, (LPCTSTR)m_pView[0]->GetHTMLStyles());
file.WriteString(header);
// Get paths
int sel = m_ctlPath[index].GetCurSel();
if (sel != CB_ERR)
{
- m_ctlPath[index].GetLBText(sel, PopString(m_strPath[index]));
- m_ctlPath[index].SetWindowText(m_strPath[index].c_str());
+ CString cstrPath;
+ m_ctlPath[index].GetLBText(sel, cstrPath);
+ m_strPath[index] = cstrPath;
+ m_ctlPath[index].SetWindowText(cstrPath);
UpdateData(TRUE);
}
UpdateButtonStates();
int contextSel = m_comboContext.GetCurSel();
if (contextSel != CB_ERR)
{
- String contextText;
- m_comboContext.GetLBText(contextSel, PopString(contextText));
- m_contextLines = std::stoi(contextText);
+ CString contextText;
+ m_comboContext.GetLBText(contextSel, contextText);
+ m_contextLines = std::stoi((String)contextText);
}
else
m_contextLines = 0;
int sel = m_ctlFile1.GetCurSel();
if (sel != CB_ERR)
{
- m_ctlFile1.GetLBText(sel, PopString(m_file1));
- m_ctlFile1.SetWindowText(m_file1.c_str());
+ CString cstrFile1 = m_file1.c_str();
+ m_ctlFile1.GetLBText(sel, cstrFile1);
+ m_ctlFile1.SetWindowText(cstrFile1);
+ m_file1 = cstrFile1;
ChangeFile(m_file1, true);
}
}
int sel = m_ctlFile2.GetCurSel();
if (sel != CB_ERR)
{
- m_ctlFile2.GetLBText(sel, PopString(m_file2));
- m_ctlFile2.SetWindowText(m_file2.c_str());
+ CString cstrFile2 = m_file1.c_str();
+ m_ctlFile1.GetLBText(sel, cstrFile2);
+ m_ctlFile1.SetWindowText(cstrFile2);
+ m_file2 = cstrFile2;
ChangeFile(m_file2, false);
}
}
int sel = m_ctlResult.GetCurSel();
if (sel != CB_ERR)
{
- m_ctlResult.GetLBText(sel, PopString(m_fileResult));
- m_ctlResult.SetWindowText(m_fileResult.c_str());
+ CString cstrFileResult = m_fileResult.c_str();
+ m_ctlResult.GetLBText(sel, cstrFileResult);
+ m_ctlResult.SetWindowText(cstrFileResult);
+ m_fileResult = cstrFileResult;
}
}
{
PATCHFILES files;
- m_ctlFile1.GetWindowText(PopString(m_file1));
- m_ctlFile2.GetWindowText(PopString(m_file2));
+ CString cstrFile1 = m_file1.c_str();
+ CString cstrFile2 = m_file2.c_str();
+ m_ctlFile1.GetWindowText(cstrFile1);
+ m_ctlFile2.GetWindowText(cstrFile2);
- m_ctlFile1.SetWindowText(m_file2.c_str());
- m_ctlFile2.SetWindowText(m_file1.c_str());
+ m_ctlFile1.SetWindowText(cstrFile2);
+ m_ctlFile2.SetWindowText(cstrFile1);
// swapped files
Swap();
// initialize with the default unpacker
m_pPlugin = static_cast<PluginInfo*> (m_UnpackerPlugins.GetAt(0));
PluginInfo * pPlugin;
- m_cboUnpackerName.GetWindowText(PopString(m_strPluginName));
+ CString cstrPluginName;
+ m_cboUnpackerName.GetWindowText(cstrPluginName);
+ m_strPluginName = cstrPluginName;
for (int j = 0 ; j < m_UnpackerPlugins.GetSize() ; j++)
{
pPlugin = static_cast<PluginInfo*> (m_UnpackerPlugins.GetAt(j));
\r
unsigned GetDlgItemText(unsigned id, String& text)\r
{\r
- return dlg()->GetDlgItemTextW(id, PopString(text));\r
+ CString cstrText = text.c_str();\r
+ unsigned uResult = dlg()->GetDlgItemTextW(id, cstrText);\r
+ text = cstrText;\r
+ return uResult;\r
}\r
\r
void SetDlgItemText(unsigned id, const String& text)\r