mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
90 lines
1.5 KiB
C
90 lines
1.5 KiB
C
#pragma once
|
|
|
|
typedef float REAL;
|
|
typedef int INT;
|
|
typedef unsigned int UINT, *PUINT;
|
|
typedef unsigned long ARGB;
|
|
|
|
typedef unsigned char BYTE;
|
|
typedef int BOOL;
|
|
typedef unsigned long DWORD;
|
|
typedef long LONG;
|
|
|
|
#define ADDREFINTERFACE(pinterface)\
|
|
{\
|
|
if (pinterface!=NULL)\
|
|
{\
|
|
pinterface->AddRef();\
|
|
}\
|
|
}
|
|
#define RELEASEINTERFACE(pinterface)\
|
|
{\
|
|
if (pinterface!=NULL)\
|
|
{\
|
|
pinterface->Release();\
|
|
pinterface=NULL;\
|
|
}\
|
|
}
|
|
#define QUERYINTERFACE(pinterface, pinterface_res, iid)\
|
|
{\
|
|
if (pinterface!=NULL)\
|
|
pinterface->QueryInterface(iid, (void**)&pinterface_res);\
|
|
else\
|
|
pinterface_res=NULL;\
|
|
}
|
|
#define RELEASEMEM(pobject)\
|
|
{\
|
|
if (pobject!=NULL)\
|
|
{\
|
|
free(pobject);\
|
|
pobject=NULL;\
|
|
}\
|
|
}
|
|
#define RELEASEOBJECT(pobject)\
|
|
{\
|
|
if (pobject!=NULL)\
|
|
{\
|
|
delete pobject;\
|
|
pobject=NULL;\
|
|
}\
|
|
}
|
|
#define RELEASEARRAYOBJECTS(pobject)\
|
|
{\
|
|
if (pobject!=NULL)\
|
|
{\
|
|
delete []pobject;\
|
|
pobject=NULL;\
|
|
}\
|
|
}
|
|
#define RELEASEHEAP(pmem)\
|
|
{\
|
|
if (pmem!=NULL)\
|
|
{\
|
|
HeapFree(GetProcessHeap(), 0, pmem);\
|
|
pmem=NULL;\
|
|
}\
|
|
}
|
|
#define RELEASEARRAY(parray)\
|
|
{\
|
|
if (parray!=NULL)\
|
|
{\
|
|
SafeArrayDestroy(parray);\
|
|
parray=NULL;\
|
|
}\
|
|
}
|
|
#define RELEASESYSSTRING(pstring)\
|
|
{\
|
|
if (pstring!=NULL)\
|
|
{\
|
|
SysFreeString(pstring);\
|
|
pstring=NULL;\
|
|
}\
|
|
}
|
|
#define RELEASEHANDLE(phandle)\
|
|
{\
|
|
if (phandle!=NULL)\
|
|
{\
|
|
CloseHandle(phandle);\
|
|
phandle=NULL;\
|
|
}\
|
|
} |