• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ IS_ERROR函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: PRINT_ARRAY

bool IsoDepTag::sendAckApdu() {
	uint8_t Ack[] = { 0x90, 0x00 };
	PRINT_ARRAY("R-APDU Send : ", Ack, 2);
	if (IS_ERROR(ulhw->tgSetData(Ack, 2))) {
		return false;
	}
	return true;
}
开发者ID:fritzprix,项目名称:PN532_Arduino,代码行数:8,代码来源:IsoDepTag.cpp


示例17: CoInitializeEx

void WasapiOutputDevice::wasapiMixingThreadFunction() {
	//Stuff here can run outside the apartment.
	auto res = CoInitializeEx(NULL, COINIT_MULTITHREADED);
	if(IS_ERROR(res)) {
		logDebug("Wassapi device mixing thread: could not initialize COM. Error %i", (int)res);
		return; //We really can't recover from this.
	}
	IAudioRenderClient *renderClient_raw = nullptr;
	UINT32 padding, bufferSize;
	client->GetBufferSize(&bufferSize);
	client->GetCurrentPadding(&padding);
	client->GetService(IID_IAudioRenderClient, (void**)&renderClient_raw);
	auto renderClient = wrapComPointer(renderClient_raw);
	//We use double buffering, as processing can take a long time.
	//MSDN warns us not to do intensive processing between GetBuffer and ReleaseBuffer.
	float* workspace = new float[output_channels*bufferSize]();
	BYTE* audioBuffer = nullptr;
	sample_format_converter->write(bufferSize-padding, workspace);
	renderClient->GetBuffer(bufferSize-padding, &audioBuffer);
	memcpy(audioBuffer, workspace, sizeof(float)*output_channels*(bufferSize-padding));
	renderClient->ReleaseBuffer(bufferSize-padding, 0);
	//The buffer is filled, so we begin processing.
	client->Start();
	logDebug("Wasapi mixing thread: audio client is started.  Mixing audio.");
	bool workspaceContainsChunk = false;
	while(should_continue.test_and_set()) {
		//Get the number of frames we want before continuing.
		double targetLatency = latency_predictor->predictLatency();
		int targetLatencyFrames = (int)(output_sr*targetLatency);
		//Predicted latency can go too high for us to write anything, so clamp it at the buffer size less half a period.
		int targetLatencyFramesMax = (int)(wasapi_buffer_size-period_in_secs*output_sr*0.5);
		int targetPadding = std::min(targetLatencyFrames, targetLatencyFramesMax);
		client->GetCurrentPadding(&padding);
		//Wait until we have enough data.
		if(padding > targetPadding) {
			std::this_thread::sleep_for(std::chrono::milliseconds((padding-targetPadding)*1000/output_sr));
			continue;
		}
		latency_predictor->beginPass();
		if(workspaceContainsChunk == false) sample_format_converter->write(wasapi_chunk_length, workspace);
		workspaceContainsChunk = true;
		if(renderClient->GetBuffer(wasapi_chunk_length, &audioBuffer) != S_OK) {
			latency_predictor->endPass();
			std::this_thread::yield();
			continue;
		}
		memcpy(audioBuffer, workspace, sizeof(float)*wasapi_chunk_length*output_channels);
		renderClient->ReleaseBuffer(wasapi_chunk_length, 0);
		workspaceContainsChunk = false;
		latency_predictor->endPass();
	}
	client->Stop();
	client->Reset();
	delete[] workspace;
	CoUninitialize();
	logDebug("Wasapi mixing thread: exiting.");
}
开发者ID:ShenggaoZhu,项目名称:libaudioverse,代码行数:57,代码来源:output_device.cpp


示例18: set_dtv_action

static void set_dtv_action(int ampIndex, action_t action)
{
	DFBResult err;
	struct SMediaSession *media;
	media = &mediaTab[ampIndex];

	// reset the query result
	media->queryResult[0] = 0;

	if (action == ACTION_POST)
	{
		err = media->amp->PostPresentationCmd(media->amp, &ampCommand.generic);
		if (err != DFB_OK)
		{
			if (err == DFB_BUSY)
			{
				media->tempStatus = TSTS_BUSY;
			} else
			{
				media->tempStatus = TSTS_AMP_ERROR;
			}
		}
	} else if (action == ACTION_EXECUTE)
	{
		err = media->amp->ExecutePresentationCmd(media->amp, &ampCommand.generic, &media->result.generic);
		if (err != DFB_OK || IS_ERROR(media->result.generic.value))
		{
			if (err == DFB_BUSY)
            {
                D_ERROR("\tAMP BUSY!!!\n");
				media->tempStatus = TSTS_BUSY;
            }
			else
            {
                D_ERROR("\tExecute error %d (%ld)\n", err, media->result.generic.value);
				media->tempStatus = TSTS_AMP_ERROR;
            }
		} 
		else
		{
			if ((media->msRT->mediaSpace == MEDIA_SPACE_DTV) && (*(media->msRT->pCmd) == (int) DTVCmd_SET_PARTIALTSCBF))
			{
				if (!ampCommand.dtv.param3.fPTSCallback)
					close_TS_file(ampIndex);
			}
			processMediaQuery(media);
		}
	} else
	{
		assert(false);
	}

	// set up adjustment structure for the next time
	adjustment.type = ADJ_MIXER_PAN_MAIN;

	return;
}
开发者ID:dangvanuy,项目名称:CLibrary,代码行数:57,代码来源:dtv_cmd.c


示例19: ISISandBoxSetRedirectPath

int ISISandBoxSetRedirectPath(const wchar_t *aRedirectPath)
{
	int errCode = ERROR_SUCCESS;
	HANDLE driverPort = NULL;

	__try
	{
		if (!aRedirectPath)
		{
			errCode = ERROR_INVALID_PARAMETER;
			__leave;
		}

		if (wcslen(aRedirectPath) > 260)
		{
			errCode = ERROR_BAD_LENGTH;
			__leave;
		}

		// 测试连接
		HRESULT ret = FilterConnectCommunicationPort(ISISandBoxPortName, 0, NULL, 0, NULL, &driverPort);
		if (IS_ERROR(ret))
		{
			errCode = ERROR_NOT_CONNECTED;
			__leave;
		}

		MESSAGE_REDIRECT_PATH_SEND message;
		message.Message.MessageType = MESSAGE_INSERT_REDIRECT_PATH;
		wcscpy_s(message.Message.RedirectPath, 260, aRedirectPath);
		_wcsupr_s(message.Message.RedirectPath, 260);			// 在用户态强制改为大写
		message.Message.Length = (ULONG)wcslen(aRedirectPath);

		DWORD replyLength = 0;
		MESSAGE_REPLY reply;

		ret = FilterSendMessage(driverPort, (PFILTER_MESSAGE_HEADER)&message, sizeof(MESSAGE_PROTECT_PATH_SEND), (PVOID)&reply, sizeof(MESSAGE_REPLY), &replyLength);
		if (ret != S_OK)
		{
			errCode = GetLastError();
			__leave;
		}

		if (reply.MessageType != MESSAGE_INSERT_REDIRECT_PATH && reply.status != 0)
		{
			errCode = ERROR_NOT_SUPPORTED;
			__leave;
		}
	}
	__finally
	{
		CloseHandle(driverPort);
		driverPort = NULL;
	}
	
	return errCode;
}
开发者ID:killbug2004,项目名称:wy-windows-driver,代码行数:57,代码来源:ISISandBox.cpp


示例20: sqlite3_column_bfile

/*
 * Access BFILE element of the current row in the row set
 */
SQLITE_API int sqlite3_column_bfile(
    sqlite3_stmt *pStmt,
    int iCol,
    sqlite3_bfile **ppBfile
)
{
    BfileHdl *pHdl;
    char * pLoc;
    int loc_size, rc;
    sqlite3 *db;
#define IS_ERROR(rc) \
	((rc)!= SQLITE_OK && (rc) != SQLITE_ROW && (rc) != SQLITE_DONE)

    if (pStmt == NULL || iCol < 0 || iCol >= sqlite3_column_count(pStmt)
            || ppBfile == NULL)
        return SQLITE_ERROR;

    db = sqlite3_db_handle(pStmt);

    /*
     * If a memory allocation error occurs during the evaluation of any of
     * these routines, a default value is returned. The default value is
     * either the integer 0, the floating point number 0.0, or a NULL
     * pointer. Subsequent calls to sqlite3_errcode() will return
     * SQLITE_NOMEM.
     */
    pLoc = (char *)sqlite3_column_blob(pStmt, iCol);
    if (pLoc == NULL) {
        *ppBfile = NULL;
        rc = sqlite3_errcode(db);
        return (IS_ERROR(rc) ? SQLITE_ERROR : SQLITE_OK);
    }

    pHdl = sqlite3_malloc(sizeof(BfileHdl));
    if (pHdl == NULL) {
        *ppBfile = NULL;
        return SQLITE_ERROR;
    }

    pHdl->fd = -1;

    loc_size = sqlite3_column_bytes(pStmt, iCol);

    rc = get_full_path(db, pLoc, loc_size,&(pHdl->full_path));

    if (rc) {
        if (pHdl != NULL)
            sqlite3_free(pHdl);
        *ppBfile = NULL;
        return SQLITE_ERROR;
    }

    *ppBfile = (sqlite3_bfile *)pHdl;

    return SQLITE_OK;
}
开发者ID:rohitlodha,项目名称:DenverDB,代码行数:59,代码来源:bfile.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IS_ERR_OR_NULL函数代码示例发布时间:2022-05-30
下一篇:
C++ IS_ERR函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap