当前位置: 首页>>代码示例>>C++>>正文


C++ IS_ERROR函数代码示例

本文整理汇总了C++中IS_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ IS_ERROR函数的具体用法?C++ IS_ERROR怎么用?C++ IS_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了IS_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MapQueueMove

/* 
** MapQueueMove
** 
** Applies a function to each element in a queue.  If the function returns
** moveVal, it enqueues the element to q2, otherwise it requeues it to 
** the original queue.
*/
int MapQueueMove(QUEUE q, int (*pFunc)(void *, void**), void **argv, 
		 int moveVal, QUEUE q2) 
{
void *item;
int count = QueueCount(q);
int status = SUCCESS;

TypeCheck(q,TYPE_QUEUE);
TypeCheck(q2,TYPE_QUEUE);
assert(! IS_ERROR(moveVal));
while (count--)
   {
   item = DeQueue(q);
   if (NULL == item)
      return(-1);
   status = (*pFunc)(item,argv);
   if (IS_ERROR(status))
      return(status);
   if (status == moveVal)
      status = EnQueue(q2,item);
   else
      status = EnQueue(q,item);
   if (IS_ERROR(status))
      return(status);
   }
return(status);
}
开发者ID:huilang22,项目名称:Projects,代码行数:34,代码来源:queue.c

示例2: MapQueue

/*
** MapQueue
** Applies a function to all elements of a queue.
**
** As long as each function continues to return a non-negative value,
** MapQueue will apply it to the next element.  When a negative return
** value occurs, MapQueue will stop.
** 
** In any case, it returns the return value from the last call to the 
** applied function, or SUCCESS if the queue is empty.
**
** Important note:
** Do not attempt to enqueue or dequeue in a MapQueue'd
** function.  It will be ruinous.
*/
int MapQueue(QUEUE queue, int (*pFunc)(void *, void**), void **argv)
{
TRAY tray;
int status;
int count;

assert(queue);
TypeCheck(queue,TYPE_QUEUE);
tray = queue->front;
for (tray = queue->front,
     count = queue->count,
     status = SUCCESS;
     
     (! IS_ERROR(status)) &&
     tray != NULL &&
     count > 0;

     tray = (tray->next),
     count--
     )
  status = (*pFunc)(tray->item,argv);

if (! IS_ERROR(status))
  /* consistency check */
  assert (NULL == tray && count == 0);
return(status);
}
开发者ID:huilang22,项目名称:Projects,代码行数:42,代码来源:queue.c

示例3: LOGE

/*  
    Construct IsoDepTag 
	@param hw : Instantiated NFC 
*/
IsoDepTag::IsoDepTag(NFC* hw) {
	ovrImpl = NULL;
	if (hw == NULL) {
		LOGE("NFC H/W not initialized");
		return;
	}
	ulhw = hw;
	 /*Generate NDEF Records for default IsoDepApp Implementation*/
    NdefRecord* rcds[] = {NdefRecord::createTextRecord("Date : 2014.1.17", "en",NdefRecord::UTF8),NdefRecord::createAndroidApplicationRecord("com.example.nfc_client"),NdefRecord::createUriRecord(URI_HTTP,"com.example.nfc_client")};
    NdefMessage msg(rcds, 3);
	 /*Construct Default Implementation of IsoDepApp*/
	defaultImpl = new DefaultDepAppImpl(msg);

	/**
	 * To configure pn532 as a picc which support NFC Type Tag, PICC Emulation Mode "Must be" enabled
	 * otherwise it'll send error code when any command which is relevant to Picc Operation is received.
	 * @param : Auto ATR_RES | ISO_14443-4 Picc Emulation
	 *
	 */
	if (IS_ERROR(ulhw->setParameter(1 << 2 | 1 << 5))) {
		LOGE("Fail to config Pn532 as PICC Target");
		return;
	}
#if DBG 
        LOGD("Parameter Configured");
#endif 
	if (IS_ERROR(ulhw->SAMConfiguration(0x01, 0xF, true))) {
		LOGE("PN532 fails to enter to normal state");
	}
#if DBG
        LOGD("Configuration of SAM is done");
#endif 
}
开发者ID:fritzprix,项目名称:PN532_Arduino,代码行数:37,代码来源:IsoDepTag.cpp

示例4: znet_assoc_indication

/* Обработка уведомления о запросе ассоциации */
void    znet_assoc_indication( zcall_t  *zc )
{
    neighbor_t  *child_ptr;
    zargs_passoc_t  *arg = (zargs_passoc_t *)(zc->args);
    bool_t  alloc_addr;     /* Логический флаг - выделять ли короткий адрес */

    if( nwkMaxChildren <= child_count() )
        goto assoc_denied;  /* Достигнут максимальный порог числа детей. Больше детей заводить нельзя. */

    child_ptr = nbr_place_by_eaddr( &(arg->dev_addr) ); /* Ищем место в таблице соседей */
    if( !IN_TABLE( child_ptr) )
        goto assoc_denied;  /* Не удалось найти место в таблице соседей */

    alloc_addr = TRUE; 
    if( child_ptr->ext_addr == arg->dev_addr ) {
        /* Уже есть запись об узле в таблице соседей */
        if( ( child_ptr->relationship == NWK_PARENT )||( child_ptr->relationship == NWK_SIBLING ) )
            goto assoc_denied;  /* Родителя и братьев не присоединяем */
        if( ( child_ptr->relationship == NWK_CHILD )
            ||( ( child_ptr->relationship == NWK_PREVIOUS_CHILD )&&( child_ptr->net_addr != 0xFFFF ) ) )
            alloc_addr = FALSE; /* Не выделяем короткий адрес детям, у которых он уже есть */
    }

    if( alloc_addr == TRUE ) {
        arg->assoc_addr = znet_addr_alloc( arg->cap_info.dev_type );
        if( child_ptr->net_addr == 0xFFFF ) {
            /* Не удалось выделить короткий адрес */
            bcn_cap_off( arg->cap_info.dev_type );  /* Сбрасываем флаг разрешения присоединения для данного типа устройств */
            child_ptr->busy = 0;    /* Запись не очень важная. Можно и удалить. */
            goto assoc_denied;
        }
    }
    /* Заносим в таблицу соседей информацию о новом дочернем узле */
    child_ptr->rx_on_when_idle = arg->cap_info.rx_on_when_idle;
    child_ptr->potential_parent = 0;
    child_ptr->permit_joining = 0;
    child_ptr->dev_type = ( arg->cap_info.dev_type == FFD )? ZIGBEE_ROUTER : ZIGBEE_ENDDEV;
    child_ptr->relationship = NWK_CHILD;
    child_ptr->channel = nwkExtraAttr.channel;
    child_ptr->beacon_order = macBeaconOrder;
    child_ptr->depth = nwkExtraAttr.depth+1;
    child_ptr->ext_addr = arg->dev_addr;
    child_ptr->net_addr = arg->assoc_addr;
    child_ptr->e_panid = nwkExtendedPANID;
    /* Отправляем положительный ответ узлу */
    ZCALL_INIT( zc, ZCALL_MLME_ASSOC_PARENT, znet_pjoin_done );
    arg->status = SUCCESS;
    if( IS_ERROR(zcall_invoke( zc )) )
        zcall_del( zc );
    return;       
assoc_denied:
    /* Присоединить узел не получилось. Отправляем узлу отрицательный ответ. */
    arg->assoc_addr = 0xFFFF;
    arg->status = MAC_PAN_ACCESS_DENIED;
    ZCALL_INIT( zc, ZCALL_MLME_ASSOC_PARENT, 0 );   /* Подтверждение нам не нужно */
    if( IS_ERROR(zcall_invoke( zc )) )
        zcall_del( zc );
    return;
}
开发者ID:MaxGekk,项目名称:wiseos,代码行数:60,代码来源:znet_assoc_parent.c

示例5: main

int main(int argc, char *argv[])
{
	int ecode;

	bfcc_options bfopts = {0};
	if (parse_arguments(argc, argv, &bfopts) != 0)
	{
		return -2;
	}

	FILE *f = stdin;
	if (bfopts.input_file != 0)
	{
		f = fopen(bfopts.input_file, "r");
		if (!f)
		{
			fprintf(stderr, "Unknown file.\n");
			return ERROR_FILE_NOT_FOUND;
		}
	}

	c99_options opts;
	c99_options_default(&opts);
	
	backend back = create_c99_backend(&opts);

	ecode = back.begin(&back, stdout);
	FATAL_IF_ERROR(ecode, "Backend preamble generation");

	tokeniser *t = tokeniser_setup(f);
	CHECK_ALLOCATION(t, "Tokeniser setup");

	while (1)
	{
		token tok;
		int error = tokeniser_next(t, &tok);

		if (IS_ERROR(error))
		{
			fprintf(stderr,  "Tokenisation error detected: %d.\n", error);
			return ERROR_TOKENISATION;
		}
		if (tok == token_eof)
			break;
		
		if (IS_ERROR(back.emit(&back, stdout, (token) tok)))
		{
			fprintf(stderr, "Failure encountered when translating token: %s\n", token_name((token) tok));
		}
	}

	ecode = back.end(&back, stdout);
	FATAL_IF_ERROR(ecode, "Backend could not finish")
	return 0;
}
开发者ID:skurmedel,项目名称:bfcc,代码行数:55,代码来源:main.c

示例6: stimer_fired

void    stimer_fired( const uint8_t tnum )
{
    port_t  ledport;
    result_t    res;

    if( tnum != TIMER_NUM ) return;

    if( state == GERCON_OPEN ) {
        port_read( RED_PORT, RED_PIN, &ledport );
        ledport ^= RED_PIN;
        port_write( RED_PORT, RED_PIN, ledport );
        res = stimer_set( TIMER_NUM, RED_PERIOD );
    } else if( state == GERCON_CLOSE ) {
        if( MAX_GREEN_COUNT <= green_count )
            port_write( GREEN_PORT, GREEN_PIN, PIN_HI );
        green_count++;
        port_read( GREEN_PORT, GREEN_PIN, &ledport );
        ledport ^= GREEN_PIN;
        port_write( GREEN_PORT, GREEN_PIN, ledport );
        res = stimer_set( TIMER_NUM, GREEN_PERIOD );
    }
    if( IS_ERROR(res) )
        port_write( RED_PORT, RED_PIN, PIN_HI );
    return;
}
开发者ID:MaxGekk,项目名称:ZigZag,代码行数:25,代码来源:ipmce_gercon.c

示例7: delete_config

static void delete_config( void * priv, int delta )
{
    char* path = get_config_dir();
    struct fio_file file;
    struct fio_dirent * dirent = FIO_FindFirstEx( path, &file );
    if( IS_ERROR(dirent) )
        return;

    do
    {
        if (file.mode & ATTR_DIRECTORY)
        {
            continue; // is a directory
        }

        char fn[0x80];
        snprintf(fn, sizeof(fn), "%s%s", path, file.name);
        FIO_RemoveFile(fn);
    }
    while( FIO_FindNextEx( dirent, &file ) == 0);
    FIO_FindClose(dirent);

    config_deleted = 1;

    if (config_autosave)
    {
        /* at shutdown, config autosave may re-create the config files we just deleted */
        /* => disable this feature in RAM only, until next reboot, without commiting it to card */
        config_autosave = 0;
    }
}
开发者ID:HulaSamsquanch,项目名称:1100d_lantern,代码行数:31,代码来源:config.c

示例8: config

uint8_t IsoDepTag::listenRATS() {
	NfcTargetConfig config(1 << 2 | 1 << 0, MIFARE_PARAM, FELICA_PARAM, NFCID);
	if (IS_ERROR(ulhw->tgInitAsTarget(&config, rxBuf))) {
		return 0xFF;
	}
	return rxBuf[2] == CMD_RATS ? rxBuf[3] : 0xFF;
}
开发者ID:fritzprix,项目名称:PN532_Arduino,代码行数:7,代码来源:IsoDepTag.cpp

示例9: Get_Word_Name

*/	void Do_Function(REBVAL *func)
/*
***********************************************************************/
{
	REBVAL *result;
	REBVAL *ds;

#if !defined(NDEBUG)
	const REBYTE *name = Get_Word_Name(DSF_LABEL(DSF));
#endif

	Eval_Functions++;

	//Dump_Block(VAL_FUNC_BODY(func));
	result = Do_Blk(VAL_FUNC_BODY(func), 0);
	ds = DS_OUT;

	if (IS_ERROR(result) && IS_RETURN(result)) {
		// Value below is kept safe from GC because no-allocation is
		// done between point of SET_THROW and here.
		if (VAL_ERR_VALUE(result))
			*ds = *VAL_ERR_VALUE(result);
		else
			SET_UNSET(ds);
	}
	else *ds = *result; // Set return value (atomic)
}
开发者ID:draegtun,项目名称:ren-c,代码行数:27,代码来源:c-function.c

示例10: Parse_Args

*/	int main(int argc, char **argv)
/*
***********************************************************************/
{
	char *cmd;

	// Parse command line arguments. Done early. May affect REBOL boot.
	Parse_Args(argc, argv, &Main_Args);

	Print_Str("REBOL 3.0\n");

	REBOL_Init(&Main_Args);

	// Evaluate user input:
	while (TRUE) {
		cmd = Prompt_User();
		REBOL_Do_String(cmd);
		if (!IS_UNSET(DS_TOP)) {
			//if (DSP > 0) {
				if (!IS_ERROR(DS_TOP)) {
					Prin("== ");
					Print_Value(DS_TOP, 0, TRUE);
				} else
					Print_Value(DS_TOP, 0, FALSE);
			//}
		}
		//DS_DROP; // result
	}

	return 0;
}
开发者ID:RamchandraApte,项目名称:rebol,代码行数:31,代码来源:b-main.c

示例11: find_scripts

static void find_scripts(void)
{
    struct fio_file file;
    struct fio_dirent * dirent = FIO_FindFirstEx( "ML/SCRIPTS/", &file );
    if( IS_ERROR(dirent) )
    {
        NotifyBox(2000, "Scripts dir missing" );
        return;
    }
    script_cnt = 0;
    do {
        if (file.mode & ATTR_DIRECTORY) continue; // is a directory
        if (is_valid_script_filename(file.name)) {
            
            snprintf(script_list[script_cnt++], FILENAME_SIZE, "%s", file.name);

            if (script_cnt >= MAX_SCRIPT_NUM)
            {
                NotifyBox(2000, "Too many scripts" );
                break;
            }
        }
    } while( FIO_FindNextEx( dirent, &file ) == 0);
    FIO_FindClose(dirent);
    
    for (int i = 0; i < script_cnt; i++)
        script_parse_header(i);
}
开发者ID:HulaSamsquanch,项目名称:1100d_lantern,代码行数:28,代码来源:script.c

示例12: GetHandle

/*
 * Open a drive or volume with optional write and lock access
 * Return INVALID_HANDLE_VALUE (/!\ which is DIFFERENT from NULL /!\) on failure.
 */
static HANDLE GetHandle(char* Path, BOOL bWriteAccess, BOOL bLockDrive)
{
	int i;
	DWORD size;
	HANDLE hDrive = INVALID_HANDLE_VALUE;

	if (Path == NULL)
		goto out;
	hDrive = CreateFileA(Path, GENERIC_READ|(bWriteAccess?GENERIC_WRITE:0),
		FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0);
	if (hDrive == INVALID_HANDLE_VALUE) {
		uprintf("Could not open drive %s: %s\n", Path, WindowsErrorString());
		goto out;
	}

	if (bWriteAccess) {
		uprintf("Caution: Opened drive %s for write access\n", Path);
	}

	if (bLockDrive) {
		for (i = 0; i < DRIVE_ACCESS_RETRIES; i++) {
			if (DeviceIoControl(hDrive, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &size, NULL))
				goto out;
			if (IS_ERROR(FormatStatus))	// User cancel
				break;
			Sleep(DRIVE_ACCESS_TIMEOUT/DRIVE_ACCESS_RETRIES);
		}
		// If we reached this section, either we didn't manage to get a lock or the user cancelled
		uprintf("Could not get exclusive access to device %s: %s\n", Path, WindowsErrorString());
		safe_closehandle(hDrive);
	}

out:
	return hDrive;
}
开发者ID:Kronimo,项目名称:rufus,代码行数:39,代码来源:drive.c

示例13:

*/	REBINT Check_Error(REBVAL *val)
/*
**		Process a loop exceptions. Pass in the TOS value, returns:
**
**			 2 - if break/return, change val to that set by break
**			 1 - if break
**			-1 - if continue, change val to unset
**			 0 - if not break or continue
**			else: error if not an ERROR value
**
***********************************************************************/
{
	// It's UNSET, not an error:
	if (!IS_ERROR(val))
		Trap0(RE_NO_RETURN); //!!! change to special msg

	// If it's a BREAK, check for /return value:
	if (IS_BREAK(val)) {
		if (VAL_ERR_VALUE(val)) {
			*val = *VAL_ERR_VALUE(val);
			return 2;
		} else {
			SET_UNSET(val);
			return 1;
		}
	}

	if (IS_CONTINUE(val)) {
		SET_UNSET(val);
		return -1;
	}

	return 0;
	// Else: Let all other errors return as values.
}
开发者ID:51weekend,项目名称:r3,代码行数:35,代码来源:c-error.c

示例14: FilterConnectCommunicationPort

bool DriverMinifilterCommunicator::InstallDriver(void)
{
	// don't install the driver if it already exists
	if(m_isInstalled)
	{
		return true;
	}

	// check if current user is administrator
	Logger::Instance().Log(_T("Check if running under administrator context..."), INFO);
	if(!Utils::IsAdmin())
	{
		Logger::Instance().Log(_T("Not admin - try to run the program as administrator"), CRITICAL_ERROR);
		return false;
	}
	Logger::Instance().Log(_T("Running as administrator -- connecting to driver port"), SUCCESS);

	// connect to communication port
	HRESULT hResult = FilterConnectCommunicationPort(	PORT_NAME,						// port name
														0,								// options must be zero (documentation)
														NULL,							// don't pass context to connect routine
														0,								// size of context
														NULL,							// don't inherit this handle
														&m_driverPort					// handle to communication port
													 );

	if (IS_ERROR( hResult ))
	{
		Logger::Instance().Log(_T("Cannot connect to driver port"), CRITICAL_ERROR);
		return false;
	}

	m_isInstalled = true;
	return true;
}
开发者ID:angry7panda,项目名称:dementia-forensics,代码行数:35,代码来源:DriverMinifilterCommunicator.cpp

示例15: SaveToFile

BOOL CCookieMgr::SaveToFile(LPCSTR lpszFile, BOOL bKeepExists)
{
	if(bKeepExists)
	{
		if(!LoadFromFile(lpszFile, TRUE) && !IS_ERROR(ERROR_FILE_NOT_FOUND))
			return FALSE;
	}

	BOOL isOK	= FALSE;
	FILE* pFile = nullptr;

	if((pFile = fopen(lpszFile, "w")) == nullptr)
		goto _ERROR_END;

	{
		__time64_t tmCurrent = _time64(nullptr);

		CReadLock locallock(m_cs);

		for(CCookieDomainMapCI it = m_cookies.begin(), end = m_cookies.end(); it != end; ++it)
		{
			const CStringA& strDomain	= it->first;
			const CCookiePathMap& paths	= it->second;

			for(CCookiePathMapCI it2 = paths.begin(), end2 = paths.end(); it2 != end2; ++it2)
			{
				const CStringA& strPath		= it2->first;
				const CCookieSet& cookies	= it2->second;

				if(fprintf(pFile, "%s %s\n", (LPCSTR)strDomain, (LPCSTR)strPath) < 0)
					goto _ERROR_END;

				for(CCookieSetCI it3 = cookies.begin(), end3 = cookies.end(); it3 != end3; ++it3)
				{
					const CCookie& cookie = *it3;

					if(cookie.expires <= tmCurrent)
						continue;

					LPCSTR lpszValue = (LPCSTR)cookie.value;

					if(lpszValue[0] == 0)
						lpszValue = " ";

					if(fprintf(pFile, "\t%s;%s;%lld;%d;%d;%d\n", (LPCSTR)cookie.name, lpszValue, cookie.expires, cookie.httpOnly, cookie.secure, cookie.sameSite) < 0)
						goto _ERROR_END;
				}
			}
		}
	}

	isOK = TRUE;

_ERROR_END:

	if(pFile) fclose(pFile);

	return isOK;
}
开发者ID:ldcsaa,项目名称:HP-Socket,代码行数:59,代码来源:HttpCookie.cpp


注:本文中的IS_ERROR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。