mirror of
https://github.com/reactos/reactos.git
synced 2025-06-18 16:36:35 +00:00
[CTFMON][MSCTFIME][SDK] Define new(cicNoThrow) and use it (#6286)
Use new(cicNoThrow) instead of plain operator new. JIRA issue: CORE-19360 - Define CicNoThrow structure and cicNoThrow macro in <cicero/cicbase.h>. - Use new(cicNoThrow) instead of plain operator new.
This commit is contained in:
parent
6cde331a89
commit
b48e77e15b
3 changed files with 29 additions and 16 deletions
|
@ -224,7 +224,7 @@ InitApp(
|
||||||
CRegWatcher::Init();
|
CRegWatcher::Init();
|
||||||
|
|
||||||
// Create Tipbar loader window
|
// Create Tipbar loader window
|
||||||
g_pLoaderWnd = new CLoaderWnd();
|
g_pLoaderWnd = new(cicNoThrow) CLoaderWnd();
|
||||||
if (!g_pLoaderWnd || !g_pLoaderWnd->Init())
|
if (!g_pLoaderWnd || !g_pLoaderWnd->Init())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
|
@ -1598,7 +1598,7 @@ CFunctionProvider::GetFunction(
|
||||||
if (IsEqualGUID(guid, GUID_NULL) &&
|
if (IsEqualGUID(guid, GUID_NULL) &&
|
||||||
IsEqualIID(riid, IID_IAImmFnDocFeed))
|
IsEqualIID(riid, IID_IAImmFnDocFeed))
|
||||||
{
|
{
|
||||||
*func = new CFnDocFeed();
|
*func = new(cicNoThrow) CFnDocFeed();
|
||||||
if (*func)
|
if (*func)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -2147,7 +2147,7 @@ CicProfile::InitProfileInstance(_Inout_ TLS *pTLS)
|
||||||
if (!m_pActiveLanguageProfileNotifySink)
|
if (!m_pActiveLanguageProfileNotifySink)
|
||||||
{
|
{
|
||||||
CActiveLanguageProfileNotifySink *pSink =
|
CActiveLanguageProfileNotifySink *pSink =
|
||||||
new CActiveLanguageProfileNotifySink(
|
new(cicNoThrow) CActiveLanguageProfileNotifySink(
|
||||||
CicProfile::ActiveLanguageProfileNotifySinkCallback, this);
|
CicProfile::ActiveLanguageProfileNotifySinkCallback, this);
|
||||||
if (!pSink)
|
if (!pSink)
|
||||||
{
|
{
|
||||||
|
@ -2326,7 +2326,7 @@ CicBridge::CreateInputContext(
|
||||||
CicInputContext *pCicIC = imeContext.get().m_pCicIC;
|
CicInputContext *pCicIC = imeContext.get().m_pCicIC;
|
||||||
if (!pCicIC)
|
if (!pCicIC)
|
||||||
{
|
{
|
||||||
pCicIC = new CicInputContext(m_cliendId, &m_LibThread, hIMC);
|
pCicIC = new(cicNoThrow) CicInputContext(m_cliendId, &m_LibThread, hIMC);
|
||||||
if (!pCicIC)
|
if (!pCicIC)
|
||||||
{
|
{
|
||||||
imeContext.unlock();
|
imeContext.unlock();
|
||||||
|
@ -2531,7 +2531,7 @@ CicBridge::ActivateIMMX(
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFunctionProvider *pProvider = new CFunctionProvider(m_cliendId);
|
CFunctionProvider *pProvider = new(cicNoThrow) CFunctionProvider(m_cliendId);
|
||||||
if (!pProvider)
|
if (!pProvider)
|
||||||
{
|
{
|
||||||
hr = E_FAIL;
|
hr = E_FAIL;
|
||||||
|
@ -2645,7 +2645,7 @@ CicBridge::InitIMMX(_Inout_ TLS *pTLS)
|
||||||
if (!m_pThreadMgrEventSink)
|
if (!m_pThreadMgrEventSink)
|
||||||
{
|
{
|
||||||
m_pThreadMgrEventSink =
|
m_pThreadMgrEventSink =
|
||||||
new CThreadMgrEventSink(CThreadMgrEventSink::DIMCallback, NULL, NULL);
|
new(cicNoThrow) CThreadMgrEventSink(CThreadMgrEventSink::DIMCallback, NULL, NULL);
|
||||||
if (!m_pThreadMgrEventSink)
|
if (!m_pThreadMgrEventSink)
|
||||||
{
|
{
|
||||||
UnInitIMMX(pTLS);
|
UnInitIMMX(pTLS);
|
||||||
|
@ -2658,7 +2658,7 @@ CicBridge::InitIMMX(_Inout_ TLS *pTLS)
|
||||||
|
|
||||||
if (!pTLS->m_pProfile)
|
if (!pTLS->m_pProfile)
|
||||||
{
|
{
|
||||||
pTLS->m_pProfile = new CicProfile();
|
pTLS->m_pProfile = new(cicNoThrow) CicProfile();
|
||||||
if (!pTLS->m_pProfile)
|
if (!pTLS->m_pProfile)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
@ -3297,7 +3297,7 @@ CtfImeCreateThreadMgr(VOID)
|
||||||
|
|
||||||
if (!pTLS->m_pBridge)
|
if (!pTLS->m_pBridge)
|
||||||
{
|
{
|
||||||
pTLS->m_pBridge = new CicBridge();
|
pTLS->m_pBridge = new(cicNoThrow) CicBridge();
|
||||||
if (!pTLS->m_pBridge)
|
if (!pTLS->m_pBridge)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
@ -3337,7 +3337,7 @@ CtfImeDestroyThreadMgr(VOID)
|
||||||
|
|
||||||
if (pTLS->m_pBridge)
|
if (pTLS->m_pBridge)
|
||||||
{
|
{
|
||||||
pTLS->m_pBridge = new CicBridge();
|
pTLS->m_pBridge = new(cicNoThrow) CicBridge();
|
||||||
if (!pTLS->m_pBridge)
|
if (!pTLS->m_pBridge)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
@ -3604,7 +3604,7 @@ UI::~UI()
|
||||||
*/
|
*/
|
||||||
HRESULT UI::_Create()
|
HRESULT UI::_Create()
|
||||||
{
|
{
|
||||||
m_pComp = new UIComposition();
|
m_pComp = new(cicNoThrow) UIComposition();
|
||||||
if (!m_pComp)
|
if (!m_pComp)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
@ -3630,7 +3630,7 @@ void UI::OnCreate(HWND hWnd)
|
||||||
UI *pUI = (UI*)GetWindowLongPtrW(hWnd, UIGWLP_UI);
|
UI *pUI = (UI*)GetWindowLongPtrW(hWnd, UIGWLP_UI);
|
||||||
if (pUI)
|
if (pUI)
|
||||||
return;
|
return;
|
||||||
pUI = new UI(hWnd);
|
pUI = new(cicNoThrow) UI(hWnd);
|
||||||
if (pUI)
|
if (pUI)
|
||||||
pUI->_Create();
|
pUI->_Create();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,17 +34,30 @@ static inline void cicMemFree(LPVOID ptr)
|
||||||
LocalFree(ptr);
|
LocalFree(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void* __cdecl operator new(size_t size) noexcept
|
struct CicNoThrow { };
|
||||||
|
#define cicNoThrow CicNoThrow{}
|
||||||
|
|
||||||
|
inline void* operator new(size_t size, const CicNoThrow&) noexcept
|
||||||
{
|
{
|
||||||
return cicMemAllocClear(size);
|
return cicMemAllocClear(size);
|
||||||
}
|
}
|
||||||
|
inline void* operator new[](size_t size, const CicNoThrow&) noexcept
|
||||||
inline void __cdecl operator delete(void* ptr) noexcept
|
{
|
||||||
|
return cicMemAllocClear(size);
|
||||||
|
}
|
||||||
|
inline void operator delete(void* ptr) noexcept
|
||||||
{
|
{
|
||||||
cicMemFree(ptr);
|
cicMemFree(ptr);
|
||||||
}
|
}
|
||||||
|
inline void operator delete[](void* ptr) noexcept
|
||||||
inline void __cdecl operator delete(void* ptr, size_t size) noexcept
|
{
|
||||||
|
cicMemFree(ptr);
|
||||||
|
}
|
||||||
|
inline void operator delete(void* ptr, size_t size) noexcept
|
||||||
|
{
|
||||||
|
cicMemFree(ptr);
|
||||||
|
}
|
||||||
|
inline void operator delete[](void* ptr, size_t size) noexcept
|
||||||
{
|
{
|
||||||
cicMemFree(ptr);
|
cicMemFree(ptr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue