mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 10:31:43 +00:00
[MSCTFIME][SDK] Implement CCompartmentEventSink (#6205)
- Modify <cicero/cicbase.h> and <cicero/cicarray.h>. - Add CCompartmentEventSink class. CORE-19360
This commit is contained in:
parent
209e9a7c1d
commit
954598037f
4 changed files with 178 additions and 9 deletions
|
@ -11,18 +11,17 @@
|
|||
|
||||
class CicArray
|
||||
{
|
||||
LPVOID lpVtbl;
|
||||
public:
|
||||
LPBYTE m_pb;
|
||||
INT m_cItems;
|
||||
INT m_cbItem;
|
||||
INT m_cCapacity;
|
||||
|
||||
public:
|
||||
CicArray(INT cbItem);
|
||||
virtual CicArray();
|
||||
virtual ~CicArray();
|
||||
|
||||
void Insert(INT iItem, INT cGrow);
|
||||
void Append(INT cGrow);
|
||||
BOOL Insert(INT iItem, INT cGrow);
|
||||
LPVOID Append(INT cGrow);
|
||||
void Remove(INT iItem, INT cRemove);
|
||||
};
|
||||
|
||||
|
@ -40,12 +39,14 @@ inline CicArray::~CicArray()
|
|||
cicMemFree(m_pb);
|
||||
}
|
||||
|
||||
inline void CicArray::Append(INT cGrow)
|
||||
inline LPVOID CicArray::Append(INT cGrow)
|
||||
{
|
||||
Insert(m_cItems, cGrow);
|
||||
if (!Insert(m_cItems, cGrow))
|
||||
return NULL;
|
||||
return &m_pb[(m_cItems - cGrow) * m_cbItem];
|
||||
}
|
||||
|
||||
inline void CicArray::Insert(INT iItem, INT cGrow)
|
||||
inline BOOL CicArray::Insert(INT iItem, INT cGrow)
|
||||
{
|
||||
INT cNewCapacity = m_cItems + cGrow;
|
||||
if (m_cCapacity < cNewCapacity)
|
||||
|
@ -60,7 +61,7 @@ inline void CicArray::Insert(INT iItem, INT cGrow)
|
|||
pbNew = (BYTE *)cicMemAlloc(cNewCapacity * m_cbItem);
|
||||
|
||||
if (!pbNew)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
m_pb = pbNew;
|
||||
m_cCapacity = cNewCapacity;
|
||||
|
@ -74,6 +75,7 @@ inline void CicArray::Insert(INT iItem, INT cGrow)
|
|||
}
|
||||
|
||||
m_cItems += cGrow;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline void CicArray::Remove(INT iItem, INT cRemove)
|
||||
|
|
|
@ -5,11 +5,25 @@
|
|||
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
static inline LPVOID cicMemAlloc(SIZE_T size)
|
||||
{
|
||||
return LocalAlloc(0, size);
|
||||
}
|
||||
|
||||
static inline LPVOID cicMemAllocClear(SIZE_T size)
|
||||
{
|
||||
return LocalAlloc(LMEM_ZEROINIT, size);
|
||||
}
|
||||
|
||||
static inline LPVOID cicMemReAlloc(LPVOID ptr, SIZE_T newSize)
|
||||
{
|
||||
if (!ptr)
|
||||
return LocalAlloc(LMEM_ZEROINIT, newSize);
|
||||
return LocalReAlloc(ptr, newSize, LMEM_ZEROINIT);
|
||||
}
|
||||
|
||||
static inline void cicMemFree(LPVOID ptr)
|
||||
{
|
||||
if (ptr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue