Internal. cl fixes in far plugins

This commit is contained in:
Maximus5 2021-07-12 23:03:00 +02:00
parent bd96e6fdab
commit 8ee47398be
6 changed files with 21 additions and 29 deletions

View File

@ -169,7 +169,7 @@ wchar_t* CPluginW1900::GetPanelDir(GetPanelDirFlags Flags, wchar_t* pszBuffer /*
}
else
{
pszDir = lstrdup(pDir->Name);
pszDir = lstrdup(pDir->Name).Detach();
}
free(pDir);
}
@ -310,7 +310,7 @@ bool CPluginW1900::GetPanelItemInfo(const CEPanelInfo& PnlInfo, bool bSelected,
pszName = PointToName(pItem->FileName);
lstrcpyn(Info.cFileName, pszName, countof(Info.cFileName));
if (ppszFullPathName)
*ppszFullPathName = lstrdup(pItem->FileName);
*ppszFullPathName = lstrdup(pItem->FileName).Detach();
}
else if (ppszFullPathName)
{
@ -670,7 +670,7 @@ void CPluginW1900::PostMacroApi(const wchar_t* asMacro, INPUT_RECORD* apRec, boo
//Far3 build 2576: удален $Text
//т.к. макросы у нас фаро-независимые - нужны танцы с бубном
pszMacroCopy = lstrdup(asMacro);
pszMacroCopy = lstrdup(asMacro).Detach();
CharUpperBuff(pszMacroCopy, lstrlen(pszMacroCopy));
if (wcsstr(pszMacroCopy, L"$TEXT") && !InfoW1900->MacroControl(&guid_ConEmu, MCTL_SENDSTRING, MSSC_CHECK, &mcr))
{
@ -1010,7 +1010,7 @@ bool CPluginW1900::InputBox(LPCWSTR Title, LPCWSTR SubTitle, LPCWSTR HistoryName
wchar_t strTemp[MAX_PATH+1];
if (!InfoW1900->InputBox(&guid_ConEmu, &guid_ConEmuInput, Title, SubTitle, HistoryName, SrcText, strTemp, countof(strTemp), NULL, FIB_BUTTONS))
return false;
DestText = lstrdup(strTemp);
DestText = lstrdup(strTemp).Detach();
return true;
}

View File

@ -215,7 +215,7 @@ wchar_t* CPluginW2800::GetPanelDir(GetPanelDirFlags Flags, wchar_t* pszBuffer /*
}
else
{
pszDir = lstrdup(pDir->Name);
pszDir = lstrdup(pDir->Name).Detach();
}
free(pDir);
}
@ -356,7 +356,7 @@ bool CPluginW2800::GetPanelItemInfo(const CEPanelInfo& PnlInfo, bool bSelected,
pszName = PointToName(pItem->FileName);
lstrcpyn(Info.cFileName, pszName, countof(Info.cFileName));
if (ppszFullPathName)
*ppszFullPathName = lstrdup(pItem->FileName);
*ppszFullPathName = lstrdup(pItem->FileName).Detach();
}
else if (ppszFullPathName)
{
@ -1090,7 +1090,7 @@ bool CPluginW2800::InputBox(LPCWSTR Title, LPCWSTR SubTitle, LPCWSTR HistoryName
wchar_t strTemp[MAX_PATH+1];
if (!InfoW2800->InputBox(&guid_ConEmu, &guid_ConEmuInput, Title, SubTitle, HistoryName, SrcText, strTemp, countof(strTemp), NULL, FIB_BUTTONS))
return false;
DestText = lstrdup(strTemp);
DestText = lstrdup(strTemp).Detach();
return true;
}

View File

@ -273,7 +273,7 @@ bool CPluginW995::GetPanelItemInfo(const CEPanelInfo& PnlInfo, bool bSelected, I
pszName = PointToName(pItem->FindData.lpwszFileName);
lstrcpyn(Info.cFileName, pszName, countof(Info.cFileName));
if (ppszFullPathName)
*ppszFullPathName = lstrdup(pItem->FindData.lpwszFileName);
*ppszFullPathName = lstrdup(pItem->FindData.lpwszFileName).Detach();
}
else if (ppszFullPathName)
{
@ -349,7 +349,7 @@ void CPluginW995::SetStartupInfoPtr(void *aInfo)
}
}
SetRootRegKey(lstrdup(InfoW995->RootKey));
SetRootRegKey(lstrdup(InfoW995->RootKey).Detach());
}
DWORD CPluginW995::GetEditorModifiedState()
@ -746,7 +746,7 @@ bool CPluginW995::InputBox(LPCWSTR Title, LPCWSTR SubTitle, LPCWSTR HistoryName,
wchar_t strTemp[MAX_PATH+1];
if (!InfoW995->InputBox(Title, SubTitle, HistoryName, SrcText, strTemp, countof(strTemp), NULL, FIB_BUTTONS))
return false;
DestText = lstrdup(strTemp);
DestText = lstrdup(strTemp).Detach();
return true;
}

View File

@ -227,7 +227,7 @@ bool CPluginAnsi::GetPanelItemInfo(const CEPanelInfo& PnlInfo, bool bSelected, I
MultiByteToWideChar(CP_OEMCP, 0, pItem->FindData.cAlternateFileName, -1, Info.cAlternateFileName, countof(Info.cAlternateFileName));
if (ppszFullPathName)
*ppszFullPathName = lstrdup(Info.cFileName);
*ppszFullPathName = lstrdup(Info.cFileName).Detach();
return true;
}

View File

@ -358,7 +358,7 @@ bool CPluginBase::DllCheckUnique(bool bFromMenu)
|| !lstrcmpi(pszName, L"ConEmu.x64.dll"))
{
iCount++;
lstrmerge(&lsFiles.ms_Val, module.szExePath[0] ? module.szExePath : module.szModule, L"\n");
lsFiles.Append(module.szExePath[0] ? module.szExePath : module.szModule, L"\n");
}
}
@ -377,7 +377,7 @@ bool CPluginBase::DllCheckUnique(bool bFromMenu)
wchar_t szExePath[MAX_PATH] = L"";
GetModuleFileName(nullptr, szExePath, countof(szExePath));
CEStr lsMsg = lstrmerge(
const CEStr lsMsg(
L"Several instances of ConEmu plugin were loaded!\n"
L"Please, either remove old versions,\n"
L"or change Far.exe arguments (/p switch)!\n\n",
@ -698,7 +698,7 @@ bool CPluginBase::StorePanelDirs(LPCWSTR asActive, LPCWSTR asPassive)
if (pszSet && (lstrcmp(pszSet, pDst) != 0))
{
#ifdef _DEBUG
CEStr lsDbg = lstrmerge(i ? L"PPanelDir changed -> " : L"APanelDir changed -> ", pszSet);
const CEStr lsDbg(i ? L"PPanelDir changed -> " : L"APanelDir changed -> ", pszSet);
DEBUGSTRCURDIR(lsDbg);
#endif
@ -2306,7 +2306,7 @@ void CPluginBase::ShowProtocolWarning()
LPCWSTR pszConEmuExe = ((gpConMapInfo->cbSize >= (size_t)((LPBYTE)&gpConMapInfo->hConEmuRoot - (LPBYTE)gpConMapInfo))
&& IsFilePath(gpConMapInfo->sConEmuExe)) ? gpConMapInfo->sConEmuExe : nullptr;
CEStr lsMsg = lstrmerge(
const CEStr lsMsg(
szProtocolWarning,
pszConEmuExe,
szExePath,
@ -2542,9 +2542,9 @@ void CPluginBase::InitRootRegKey()
SafeFree(ms_RootRegKey);
if (szFarUser[0])
ms_RootRegKey = lstrmerge(L"Software\\", pszFarName, L"\\Users\\", szFarUser);
ms_RootRegKey = CEStr(L"Software\\", pszFarName, L"\\Users\\", szFarUser).Detach();
else
ms_RootRegKey = lstrmerge(L"Software\\", pszFarName);
ms_RootRegKey = CEStr(L"Software\\", pszFarName).Detach();
}
void CPluginBase::SetRootRegKey(wchar_t* asKeyPtr)
@ -2572,7 +2572,7 @@ void CPluginBase::LoadPanelTabsFromRegistry()
if (!ms_RootRegKey || !*ms_RootRegKey)
return;
wchar_t* pszTabsKey = lstrmerge(ms_RootRegKey, L"\\Plugins\\PanelTabs");
CEStr pszTabsKey(ms_RootRegKey, L"\\Plugins\\PanelTabs");
if (!pszTabsKey)
return;
@ -2589,8 +2589,6 @@ void CPluginBase::LoadPanelTabsFromRegistry()
RegCloseKey(hk);
}
free(pszTabsKey);
}
void CPluginBase::InitHWND()
@ -5508,15 +5506,9 @@ LPWSTR CPluginBase::ToUnicode(LPCSTR asOemStr)
if (!asOemStr)
return nullptr;
if (!*asOemStr)
return lstrdup(L"");
return lstrdup(L"").Detach();
int nLen = lstrlenA(asOemStr);
wchar_t* pszUnicode = (wchar_t*)calloc((nLen+1),sizeof(*pszUnicode));
if (!pszUnicode)
return nullptr;
MultiByteToWideChar(CP_OEMCP, 0, asOemStr, nLen, pszUnicode, nLen);
return pszUnicode;
return lstrdupW(asOemStr, CP_OEMCP).Detach();
}
void CPluginBase::ToOem(LPCWSTR asUnicode, char* rsOem, INT_PTR cchOemMax)

View File

@ -568,7 +568,7 @@ BOOL CImgCache::FindInCache(CePluginPanelItem* pItem, int* pnIndex, ImgLoadType
if (CacheInfo[i].lpwszFileName == NULL)
{
CacheInfo[i].lpwszFileName = lstrdup(pszName);
CacheInfo[i].lpwszFileName = lstrdup(pszName).Detach();
lbReady = FALSE;
}