本文整理汇总了C++中NULL_CHECK函数的典型用法代码示例。如果您正苦于以下问题:C++ NULL_CHECK函数的具体用法?C++ NULL_CHECK怎么用?C++ NULL_CHECK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NULL_CHECK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TcgParseSyncSession
/**
Parses the Sync Session response contained in the parseStruct to retrieve Tper session ID. If the Sync Session response
parameters do not match the comID, extended ComID and host session ID then a failure is returned.
@param[in/out] ParseStruct Structure used to parse received TCG response, contains Sync Session response.
@param[in] ComId Expected ComID that is compared to actual ComID of response
@param[in] ComIdExtension Expected Extended ComID that is compared to actual Extended ComID of response
@param[in] HostSessionId Expected Host Session ID that is compared to actual Host Session ID of response
@param[in/out] TperSessionId Tper Session ID retrieved from the Sync Session response.
**/
TCG_RESULT
EFIAPI
TcgParseSyncSession(
const TCG_PARSE_STRUCT *ParseStruct,
UINT16 ComId,
UINT16 ComIdExtension,
UINT32 HostSessionId,
UINT32 *TperSessionId
)
{
UINT8 MethodStatus;
TCG_PARSE_STRUCT TmpParseStruct;
UINT16 ParseComId;
UINT16 ParseExtComId;
TCG_UID InvokingUID;
TCG_UID MethodUID;
UINT32 RecvHostSessionId;
NULL_CHECK(ParseStruct);
NULL_CHECK(TperSessionId);
CopyMem (&TmpParseStruct, ParseStruct, sizeof(TCG_PARSE_STRUCT));
// verify method status is good
ERROR_CHECK(TcgGetMethodStatus(&TmpParseStruct, &MethodStatus));
METHOD_STATUS_ERROR_CHECK (MethodStatus, TcgResultFailure);
// verify comids
ERROR_CHECK(TcgGetComIds(&TmpParseStruct, &ParseComId, &ParseExtComId));
if ((ComId != ParseComId) || (ComIdExtension != ParseExtComId)) {
DEBUG ((DEBUG_INFO, "unmatched comid (exp: 0x%X recv: 0x%X) or comid extension (exp: 0x%X recv: 0x%X)\n", ComId, ParseComId, ComIdExtension, ParseExtComId));
return TcgResultFailure;
}
ERROR_CHECK(TcgGetNextCall(&TmpParseStruct));
ERROR_CHECK(TcgGetNextTcgUid(&TmpParseStruct, &InvokingUID));
ERROR_CHECK(TcgGetNextTcgUid(&TmpParseStruct, &MethodUID));
ERROR_CHECK(TcgGetNextStartList(&TmpParseStruct));
ERROR_CHECK(TcgGetNextUINT32(&TmpParseStruct, &RecvHostSessionId));
ERROR_CHECK(TcgGetNextUINT32(&TmpParseStruct, TperSessionId));
ERROR_CHECK(TcgGetNextEndList(&TmpParseStruct));
ERROR_CHECK(TcgGetNextEndOfData(&TmpParseStruct));
if (InvokingUID != TCG_UID_SMUID) {
DEBUG ((DEBUG_INFO, "Invoking UID did not match UID_SMUID\n"));
return TcgResultFailure;
}
if (MethodUID != TCG_UID_SM_SYNC_SESSION) {
DEBUG ((DEBUG_INFO, "Method UID did not match UID_SM_SYNC_SESSION\n"));
return TcgResultFailure;
}
if (HostSessionId != RecvHostSessionId) {
DEBUG ((DEBUG_INFO, "unmatched HostSessionId (exp: 0x%X recv: 0x%X)\n", HostSessionId, RecvHostSessionId));
return TcgResultFailure;
}
return TcgResultSuccess;
}
示例2: OpalUtilVerifyPassword
/**
Verify whether user input the correct password.
@param[in] Session, The session info for one opal device.
@param[in] Password Admin password
@param[in] PasswordLength Length of password in bytes
@param[in/out] HostSigningAuthority Use the Host signing authority type.
**/
TCG_RESULT
EFIAPI
OpalUtilVerifyPassword (
OPAL_SESSION *Session,
const VOID *Password,
UINT32 PasswordLength,
TCG_UID HostSigningAuthority
)
{
TCG_RESULT Ret;
UINT8 MethodStatus;
NULL_CHECK(Session);
NULL_CHECK(Password);
Ret = OpalStartSession(
Session,
OPAL_UID_LOCKING_SP,
TRUE,
PasswordLength,
Password,
HostSigningAuthority,
&MethodStatus);
if (Ret == TcgResultSuccess && MethodStatus == TCG_METHOD_STATUS_CODE_SUCCESS) {
OpalEndSession(Session);
return TcgResultSuccess;
}
return TcgResultFailure;
}
示例3: main
int
main (int argc, char **argv)
{
int i;
for (i = 1; i < argc; i++)
{
const char *e;
char *username, *groupname;
uid_t uid;
gid_t gid;
char *tmp;
tmp = strdup (argv[i]);
e = parse_user_spec (tmp, &uid, &gid, &username, &groupname);
free (tmp);
printf ("%s: %lu %lu %s %s %s\n",
argv[i],
(unsigned long int) uid,
(unsigned long int) gid,
NULL_CHECK (username),
NULL_CHECK (groupname),
NULL_CHECK (e));
}
exit (0);
}
示例4: TcgInitTcgCreateStruct
/**
Required to be called before calling any other Tcg functions with the TCG_CREATE_STRUCT.
Initializes the packet variables to NULL. Additionally, the buffer will be memset.
@param [in/out] CreateStruct Structure to initialize
@param [in] Buffer Buffer allocated by client of library. It will contain the Tcg encoded packet. This cannot be null.
@param [in] BufferSize Size of buffer provided. It cannot be 0.
@retval Return the action result.
**/
TCG_RESULT
EFIAPI
TcgInitTcgCreateStruct(
TCG_CREATE_STRUCT *CreateStruct,
VOID *Buffer,
UINT32 BufferSize
)
{
NULL_CHECK(CreateStruct);
NULL_CHECK(Buffer);
if (BufferSize == 0) {
DEBUG ((DEBUG_INFO, "BufferSize=0\n"));
return (TcgResultFailureZeroSize);
}
ZeroMem(Buffer, BufferSize);
CreateStruct->BufferSize = BufferSize;
CreateStruct->Buffer = Buffer;
CreateStruct->ComPacket = NULL;
CreateStruct->CurPacket = NULL;
CreateStruct->CurSubPacket = NULL;
return (TcgResultSuccess);
}
示例5: sysdb_sudo_filter_rules_by_time
errno_t sysdb_sudo_filter_rules_by_time(TALLOC_CTX *mem_ctx,
uint32_t in_num_rules,
struct sysdb_attrs **in_rules,
time_t now,
uint32_t *_num_rules,
struct sysdb_attrs ***_rules)
{
uint32_t num_rules = 0;
struct sysdb_attrs **rules = NULL;
TALLOC_CTX *tmp_ctx = NULL;
bool allowed = false;
errno_t ret;
int i;
tmp_ctx = talloc_new(NULL);
NULL_CHECK(tmp_ctx, ret, done);
if (now == 0) {
now = time(NULL);
}
for (i = 0; i < in_num_rules; i++) {
ret = sysdb_sudo_check_time(in_rules[i], now, &allowed);
if (ret == EOK && allowed) {
num_rules++;
rules = talloc_realloc(tmp_ctx, rules, struct sysdb_attrs *,
num_rules);
NULL_CHECK(rules, ret, done);
rules[num_rules - 1] = in_rules[i];
}
}
示例6: failed
/**
Opens a session with OPAL_UID_ADMIN_SP as OPAL_ADMIN_SP_PSID_AUTHORITY, then reverts the device using the RevertSP method.
@param[in] Session The opal session for the opal device.
@param[in] KeepUserData TRUE to keep existing Data on the disk, or FALSE to erase it
@param[in] Password Admin password
@param[in] PasswordLength Length of password in bytes
@param[in] Msid Msid
@param[in] MsidLength Msid Length
@param[out] PasswordFailed indicates if password failed (start session didn't work)
@param[in] DevicePath The device path for the opal devcie.
**/
TCG_RESULT
EFIAPI
OpalSupportRevert(
IN OPAL_SESSION *Session,
IN BOOLEAN KeepUserData,
IN VOID *Password,
IN UINT32 PasswordLength,
IN VOID *Msid,
IN UINT32 MsidLength,
OUT BOOLEAN *PasswordFailed,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
TCG_RESULT Ret;
NULL_CHECK(Session);
NULL_CHECK(Password);
NULL_CHECK(Msid);
NULL_CHECK(PasswordFailed);
Ret = OpalUtilRevert(Session, KeepUserData, Password, PasswordLength, PasswordFailed, Msid, MsidLength);
if (Ret == TcgResultSuccess && !gInSmm) {
OpalSupportSendPasword (DevicePath, 0, NULL);
}
return Ret;
}
示例7: dhd_rtt_stop
int
dhd_rtt_stop(dhd_pub_t *dhd, struct ether_addr *mac_list, int mac_cnt)
{
int err = BCME_OK;
int i = 0, j = 0;
rtt_status_info_t *rtt_status;
NULL_CHECK(dhd, "dhd is NULL", err);
rtt_status = GET_RTTSTATE(dhd);
NULL_CHECK(rtt_status, "rtt_status is NULL", err);
if (rtt_status->status == RTT_STOPPED) {
DHD_ERROR(("rtt is not started\n"));
return BCME_OK;
}
DHD_RTT(("%s enter\n", __FUNCTION__));
mutex_lock(&rtt_status->rtt_mutex);
for (i = 0; i < mac_cnt; i++) {
for ( j = 0; j < rtt_status->rtt_config.rtt_target_cnt; j++) {
if (!bcmp(&mac_list[i],&rtt_status->rtt_config.target_info[j].addr,
ETHER_ADDR_LEN)) {
rtt_status->rtt_config.target_info[j].disable = TRUE;
}
}
}
mutex_unlock(&rtt_status->rtt_mutex);
return err;
}
示例8: retvm_if
Evas_Object *clk_widget_create_button(Evas_Object * parent,
const char *file, const char *group,
Edje_Color_Class * color_class,
Edje_Signal_Cb clicked_cb, void *data)
{
retvm_if(NULL_CHECK(parent), NULL, "parent null");
retvm_if(NULL_CHECK(file), NULL, "file null");
retvm_if(NULL_CHECK(group), NULL, "group null");
retvm_if(NULL_CHECK(color_class), NULL, "color_class null");
CLK_FUN_BEG();
Evas_Object *ret = NULL;
ret = load_edj(parent, file, group);
retvm_if(NULL_CHECK(ret), NULL, "ret null");
edje_object_signal_callback_add(_EDJ(ret), "mouse,down", "rect",
_clk_btn_mouse_down_cb,
(void *)color_class);
edje_object_signal_callback_add(_EDJ(ret), "mouse,up", "rect",
_clk_btn_mouse_up_cb,
(void *)color_class);
if (clicked_cb) {
edje_object_signal_callback_add(_EDJ(ret), "mouse,clicked",
"rect", clicked_cb, data);
}
CLK_FUN_END();
return ret;
}
示例9: OpalSupportSetPassword
/**
Opens a session with OPAL_UID_ADMIN_SP as OPAL_ADMIN_SP_SID_AUTHORITY,
sets OPAL_UID_ADMIN_SP_C_PIN_SID with the new password,
and sets OPAL_LOCKING_SP_C_PIN_ADMIN1 with the new password.
@param[in] Session The opal session for the opal device.
@param[in] OldPassword Current admin password
@param[in] OldPasswordLength Length of current admin password in bytes
@param[in] NewPassword New admin password to set
@param[in] NewPasswordLength Length of new password in bytes
@param[in] DevicePath The device path for the opal devcie.
@param[in] SetAdmin Whether set admin password or user password.
TRUE for admin, FALSE for user.
**/
TCG_RESULT
EFIAPI
OpalSupportSetPassword(
IN OPAL_SESSION *Session,
IN VOID *OldPassword,
IN UINT32 OldPasswordLength,
IN VOID *NewPassword,
IN UINT32 NewPasswordLength,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN BOOLEAN SetAdmin
)
{
TCG_RESULT Ret;
NULL_CHECK(Session);
NULL_CHECK(OldPassword);
NULL_CHECK(NewPassword);
if (SetAdmin) {
Ret = OpalUtilSetAdminPassword(Session, OldPassword, OldPasswordLength, NewPassword, NewPasswordLength);
} else {
Ret = OpalUtilSetUserPassword(Session, OldPassword, OldPasswordLength, NewPassword, NewPasswordLength);
}
if (Ret == TcgResultSuccess && !gInSmm) {
OpalSupportSendPasword (DevicePath, NewPasswordLength, NewPassword);
}
return Ret;
}
示例10: clExtendedPoolDestroy
static
ClRcT
clExtendedPoolDestroy(
ClPoolHeaderT* pPoolHeader,
ClExtendedPoolHeaderT* pExtendedPoolHeader)
{
ClRcT rc = CL_OK;
NULL_CHECK (pPoolHeader);
NULL_CHECK (pExtendedPoolHeader);
CL_POOL_FREE_EXT (pExtendedPoolHeader->pExtendedPoolStart,
pPoolHeader->poolConfig.incrementPoolSize);
/*
* For debug mode this would be set to the free list.
* Rip this off if it exists.
*/
if (pExtendedPoolHeader->pFreeListStart)
{
CL_POOL_FREE_EXTERNAL (pPoolHeader->flags,
pExtendedPoolHeader->pFreeListStart,
sizeof (ClFreeListHeaderT) * pExtendedPoolHeader->numChunks);
}
CL_POOL_FREE_EXTERNAL (pPoolHeader->flags, (void*)pExtendedPoolHeader,
sizeof (*pExtendedPoolHeader));
CL_POOL_STATS_UPDATE_EXTENDED_POOLS_DECR(pPoolHeader);
return rc;
}
示例11: TcgAddAtom
/**
simple tokens - atoms: tiny, short, medium, long and empty atoms.
tiny atom can be a signed or unsigned integer.
short, medium, long can be a signed or unsigned integer OR a complete or non-final byte sequence.
@param CreateStruct The create structure.
@param Data The data need to add.
@param DataSize The data size.
@param ByteOrInt, Data format is byte or int.
@param SignOrCont sign or cont.
**/
TCG_RESULT
TcgAddAtom(
TCG_CREATE_STRUCT *CreateStruct,
const VOID *Data,
UINT32 DataSize,
UINT8 ByteOrInt,
UINT8 SignOrCont
)
{
const UINT8* DataBytes;
TCG_SIMPLE_TOKEN_TINY_ATOM TinyAtom;
TCG_SIMPLE_TOKEN_SHORT_ATOM ShortAtom;
TCG_SIMPLE_TOKEN_MEDIUM_ATOM MediumAtom;
TCG_SIMPLE_TOKEN_LONG_ATOM LongAtom;
NULL_CHECK(CreateStruct);
if (DataSize == 0) {
if (ByteOrInt == TCG_ATOM_TYPE_INTEGER) {
DEBUG ((DEBUG_INFO, "0-Size integer not allowed\n"));
return TcgResultFailure;
}
} else {
// if DataSize != 0, Data must be valid
NULL_CHECK(Data);
}
// encode Data using the shortest possible atom
DataBytes = (const UINT8*)Data;
if ((DataSize == 1) &&
(ByteOrInt == TCG_ATOM_TYPE_INTEGER) &&
((SignOrCont != 0 && ((TCG_TOKEN_TINYATOM_SIGNED_MIN_VALUE <= *(INT8*)Data) && (*(INT8*)Data <= TCG_TOKEN_TINYATOM_SIGNED_MAX_VALUE))) ||
(SignOrCont == 0 && ((*DataBytes <= TCG_TOKEN_TINYATOM_UNSIGNED_MAX_VALUE))))
) {
TinyAtom.TinyAtomBits.IsZero = 0;
TinyAtom.TinyAtomBits.Sign = SignOrCont;
TinyAtom.TinyAtomBits.Data = *DataBytes & TCG_TOKEN_TINYATOM_UNSIGNED_MAX_VALUE;
return TcgAddRawTokenData(CreateStruct, NULL, 0, (UINT8*)&TinyAtom, sizeof(TCG_SIMPLE_TOKEN_TINY_ATOM), FALSE);
}
if (DataSize <= TCG_TOKEN_SHORTATOM_MAX_BYTE_SIZE) {
ShortAtom.ShortAtomBits.IsOne = 1;
ShortAtom.ShortAtomBits.IsZero = 0;
ShortAtom.ShortAtomBits.ByteOrInt = ByteOrInt;
ShortAtom.ShortAtomBits.SignOrCont = SignOrCont;
ShortAtom.ShortAtomBits.Length = DataSize & 0x0F;
return TcgAddRawTokenData(CreateStruct, &ShortAtom, sizeof(TCG_SIMPLE_TOKEN_SHORT_ATOM), Data, DataSize, ByteOrInt == TCG_ATOM_TYPE_INTEGER);
}
if (DataSize <= TCG_TOKEN_MEDIUMATOM_MAX_BYTE_SIZE) {
MediumAtom.MediumAtomBits.IsOne1 = 1;
MediumAtom.MediumAtomBits.IsOne2 = 1;
MediumAtom.MediumAtomBits.IsZero = 0;
MediumAtom.MediumAtomBits.ByteOrInt = ByteOrInt;
MediumAtom.MediumAtomBits.SignOrCont = SignOrCont;
MediumAtom.MediumAtomBits.LengthLow = DataSize & 0xFF;
MediumAtom.MediumAtomBits.LengthHigh = (DataSize >> TCG_MEDIUM_ATOM_LENGTH_HIGH_SHIFT) & TCG_MEDIUM_ATOM_LENGTH_HIGH_MASK;
return TcgAddRawTokenData(CreateStruct, &MediumAtom, sizeof(TCG_SIMPLE_TOKEN_MEDIUM_ATOM), Data, DataSize, ByteOrInt == TCG_ATOM_TYPE_INTEGER);
}
示例12: cdbGDBMNextRecordGet
static ClRcT
cdbGDBMNextRecordGet(ClDBHandleT dbHandle, /* Handle to the database */
ClDBKeyT currentKey, /* Handle to the current key */
ClUint32T currentKeySize, /* Size of the current key */
ClDBKeyT* pDBNextKey, /* pointer to handle in which the next key is returned */
ClUint32T* pNextKeySize, /* pointer to size in which the next key's size is returned */
ClDBRecordT* pDBNextRec, /* pointer to handle in which the next record is returned */
ClUint32T* pNextRecSize) /* pointer to size in which the next record's size is returned */
{
ClRcT errorCode = CL_OK;
GDBMHandle_t* pGDBMHandle = (GDBMHandle_t*)dbHandle;
datum key = {NULL, 0};
datum nextKey = {NULL, 0};
datum data = {NULL, 0};
CL_FUNC_ENTER();
NULL_CHECK(pDBNextKey);
NULL_CHECK(pNextKeySize);
NULL_CHECK(pDBNextRec);
NULL_CHECK(pNextRecSize);
key.dsize = currentKeySize;
key.dptr = (ClCharT *)currentKey;
/* Retrieve the next key */
nextKey = gdbm_nextkey(pGDBMHandle->gdbmInstance, key);
if(NULL == nextKey.dptr) {
/* The next key does not exist. So return error */
errorCode = CL_DBAL_RC(CL_ERR_NOT_EXIST);
CL_DEBUG_PRINT ( CL_DEBUG_TRACE,("\nGDBM get next key failed"));
CL_FUNC_EXIT();
return(errorCode);
}
*pDBNextKey = (ClDBKeyT)nextKey.dptr;
*pNextKeySize = nextKey.dsize;
/* retrieve the associated record */
data = gdbm_fetch(pGDBMHandle->gdbmInstance, nextKey);
if(NULL == data.dptr) {
errorCode = CL_DBAL_RC(CL_ERR_NOT_EXIST);
CL_DEBUG_PRINT ( CL_DEBUG_TRACE,("\nGDBM fetch record failed"));
CL_FUNC_EXIT();
return(errorCode);
}
*pDBNextRec = (ClDBRecordT)data.dptr;
*pNextRecSize = data.dsize;
CL_FUNC_EXIT();
return(CL_OK);
}
示例13: clPoolFree
ClRcT
clPoolFree(
ClUint8T* pChunk,
void* pCookie)
{
ClRcT rc = CL_OK;
ClPoolHeaderT* pPoolHeader = NULL;
ClExtendedPoolHeaderT* pExtendedPoolHeader = NULL;
ClUint32T freeChunk = 0;
ClUint32T chunkSize = 0;
ClFreeListHeaderT* pCurrentFreeList = NULL;
NULL_CHECK (pChunk);
NULL_CHECK (pCookie);
pExtendedPoolHeader = (ClExtendedPoolHeaderT*)pCookie;
pPoolHeader = pExtendedPoolHeader->pPoolHeader;
CL_POOL_LOG(CL_LOG_SEV_TRACE,"freeing chunk pChunk = %p,extended pool = %p\n", pChunk,(void*)pExtendedPoolHeader);
CL_POOL_LOCK (pPoolHeader);
chunkSize = pPoolHeader->poolConfig.chunkSize;
CL_POOL_REVOKE_SIZE(pPoolHeader->flags,chunkSize);
CL_POOL_FREE_LIST_GET (pChunk, pExtendedPoolHeader, pCurrentFreeList);
pCurrentFreeList->pChunk = (ClUint8T*)pChunk;
pCurrentFreeList->pNextFreeChunk = pExtendedPoolHeader->pFirstFreeChunk;
pExtendedPoolHeader->pFirstFreeChunk = pCurrentFreeList;
CL_POOL_STATS_UPDATE_FREES (pPoolHeader);
freeChunk = ++pExtendedPoolHeader->numFreeChunks;
if (freeChunk == 1)
{
/*Was full before. Move it to partial*/
CL_POOL_LOG(CL_LOG_SEV_TRACE,"Dequeuing extended pool %p from full list and moving the extended pool to partial list\n", (void*)pExtendedPoolHeader);
CL_POOL_EXTENDED_FULLLIST_DEQUEUE (pPoolHeader, pExtendedPoolHeader);
CL_POOL_EXTENDED_PARTIALLIST_QUEUE (pPoolHeader, pExtendedPoolHeader);
}
if (freeChunk == pExtendedPoolHeader->numChunks)
{
/*
* Add to the free extended pool list after deleting from the partial
* list
*/
CL_POOL_LOG(CL_LOG_SEV_TRACE, "Dequeuing extended pool %p from partial list and moving the extended pool to free list\n", (void*)pExtendedPoolHeader);
CL_POOL_EXTENDED_PARTIALLIST_DEQUEUE(pPoolHeader,pExtendedPoolHeader);
CL_POOL_EXTENDED_FREELIST_QUEUE(pPoolHeader,pExtendedPoolHeader);
}
CL_POOL_UNLOCK(pPoolHeader);
rc = CL_OK;
return rc;
}
示例14: clPoolStartGet
/*Currently used by the heap debug layer*/
ClRcT
clPoolStartGet(
void* pCookie,
void** ppAddress)
{
ClRcT rc = CL_OK;
NULL_CHECK (pCookie);
NULL_CHECK (ppAddress);
*ppAddress = ((ClExtendedPoolHeaderT*)pCookie)->pExtendedPoolStart;
return rc;
}
示例15: PrintJavaVersion
/*
* Prints the version information from the java.version and other properties.
*/
static void
PrintJavaVersion(JNIEnv *env)
{
jclass ver;
jmethodID print;
NULL_CHECK(ver = (*env)->FindClass(env, "sun/misc/Version"));
NULL_CHECK(print = (*env)->GetStaticMethodID(env, ver, "print", "()V"));
(*env)->CallStaticVoidMethod(env, ver, print);
}