Fix build...

This commit is contained in:
kaetemi 2019-04-30 12:25:11 +08:00
parent 2eac83a339
commit d2fc5d200e
3 changed files with 31 additions and 20 deletions

View file

@ -312,12 +312,14 @@ inline sint nlstricmp(const char *lhs, const std::string &rhs) { return stricmp(
#ifdef _UNICODE
#define tStrToUtf8(str) (ucstring((ucchar*)(LPCWSTR)str).toUtf8())
#define utf8ToTStr(str) ((const wchar_t *)ucstring::makeFromUtf8(str).c_str())
#define tstring wstring
#else
// FIXME: This is not accurate, it should be a conversion between local charset and utf8
#define tStrToUtf8(str) (std::string((LPCSTR)str))
inline const char *nlutf8ToTStr(const char *str) { return str; }
inline const char *nlutf8ToTStr(const std::string &str) { return str.c_str(); }
#define utf8ToTStr(str) NLMISC::nlutf8ToTStr(str)
#define tstring string
#endif
#if (NL_COMP_VC_VERSION <= 90)

View file

@ -220,6 +220,7 @@
# if defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
# pragma warning (disable : 4005) // don't warn on redefinitions caused by xp platform sdk
# endif // NL_COMP_VC8 || NL_COMP_VC9
# pragma warning (disable : 26495) // Variable is uninitialized. Always initialize a member variable. (On purpose for performance.)
#endif // NL_OS_WINDOWS

View file

@ -208,13 +208,13 @@ int CDirDialog::DoBrowse()
}
BROWSEINFO bInfo;
LPITEMIDLIST pidl;
ZeroMemory((PVOID)&bInfo, sizeof(BROWSEINFO));
if (!m_strInitDir.IsEmpty())
{
OLECHAR olePath[MAX_PATH];
ULONG chEaten;
ULONG dwAttributes;
ULONG dwAttributes = 0;
HRESULT hr;
LPSHELLFOLDER pDesktopFolder;
// // Get a pointer to the Desktop's IShellFolder interface. //
@ -236,7 +236,7 @@ int CDirDialog::DoBrowse()
hr = pDesktopFolder->ParseDisplayName(NULL,
NULL,
olePath,
&chEaten,
NULL,
&pidl,
&dwAttributes);
@ -248,7 +248,6 @@ int CDirDialog::DoBrowse()
}
bInfo.pidlRoot = pidl;
}
}
@ -257,8 +256,10 @@ int CDirDialog::DoBrowse()
bInfo.lpszTitle = (m_strTitle.IsEmpty()) ? "Open" : m_strTitle;
bInfo.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
PIDLIST_ABSOLUTE pidl = ::SHBrowseForFolder(&bInfo);
if (!pidl) return 0;
if ((pidl = ::SHBrowseForFolder(&bInfo)) == NULL)
{
return 0;
}
m_strPath.ReleaseBuffer();
m_iImageIndex = bInfo.iImage;
@ -288,13 +289,17 @@ BOOL SendTextToClipboard(CString source)
if (OpenClipboard(NULL))
{
HGLOBAL clipbuffer;
char* buffer;
TCHAR* buffer;
EmptyClipboard(); // Empty whatever's already there
clipbuffer = GlobalAlloc(GMEM_DDESHARE, source.GetLength() + 1);
buffer = (char*)GlobalLock(clipbuffer);
strcpy(buffer, LPCSTR(source));
clipbuffer = GlobalAlloc(GMEM_DDESHARE, ((SIZE_T)source.GetLength() + 1) * sizeof(TCHAR));
if (clipbuffer)
{
buffer = (TCHAR*)GlobalLock(clipbuffer);
if (buffer)
{
_tcscpy(buffer, LPCTSTR(source));
GlobalUnlock(clipbuffer);
SetClipboardData(CF_TEXT, clipbuffer); // Send the data
@ -302,6 +307,9 @@ BOOL SendTextToClipboard(CString source)
CloseClipboard(); // VERY IMPORTANT
return TRUE;
}
}
CloseClipboard(); // VERY IMPORTANT
}
return FALSE;
}
@ -326,11 +334,11 @@ void CBranch_patcherDlg::OnButtonPatch()
CString text;
text.Format(_T("Get diff from directory %s?\n\nCommand (choose No to copy it into the clipboard):\n%s"), m_SrcDir, diffCmdLine);
int result;
if ((result = ::MessageBox(m_hWnd, text, "Confirmation", MB_YESNOCANCEL | MB_ICONQUESTION)) == IDYES)
if ((result = ::MessageBox(m_hWnd, text, _T("Confirmation"), MB_YESNOCANCEL | MB_ICONQUESTION)) == IDYES)
{
if (_chdir(m_SrcDir) == 0)
if (_tchdir(m_SrcDir) == 0)
{
system(diffCmdLine);
_tsystem(diffCmdLine);
displayFile(TEMP_DIFF_FILE);
SaveDiff = true;
colorizeDiff();
@ -461,11 +469,11 @@ void CBranch_patcherDlg::OnDoPatch()
int result;
if ((result = ::MessageBox(m_hWnd, text, _T("Confirmation"), MB_YESNOCANCEL | MB_ICONQUESTION)) == IDYES)
{
if (_chdir(m_DestDir) == 0)
if (_tchdir(m_DestDir) == 0)
{
system(patchCmdLine);
system(concatOutput);
system(delPatchErrors);
_tsystem(patchCmdLine);
_tsystem(concatOutput);
_tsystem(delPatchErrors);
displayFile(PATCH_RESULT);
SaveDiff = false;
m_Display->LineScroll(0);