當前位置: 首頁>>代碼示例>>C++>>正文


C++ CHECK_RESULT函數代碼示例

本文整理匯總了C++中CHECK_RESULT函數的典型用法代碼示例。如果您正苦於以下問題:C++ CHECK_RESULT函數的具體用法?C++ CHECK_RESULT怎麽用?C++ CHECK_RESULT使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了CHECK_RESULT函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: db_select1

void db_select1(int32_t* value) {
    if (debug) {
        fprintf(stderr, "db_select1()\n");
    }
    PGresult* res = PQexecPrepared(conn,
            STMT_ID_SELECT1,
            0,
            NULL,
            NULL,
            NULL,
            1);
    CHECK_RESULT(res);
    *value = -1;
    if (PQntuples(res) == 0) {
        fprintf(stderr, "db_select1() return no rows\n");
        if (exit_on_error) {
            exit(EXIT_FAILURE);
        }
        PQclear(res);
    } else {
        *value = ntohl(*(int32_t *) PQgetvalue(res, 0, 0));
        if (debug) {
            fprintf(stderr, "db_select1() return %d\n", *value);
        }
    }
    PQclear(res);
}
開發者ID:vvromanov,項目名稱:db_test,代碼行數:27,代碼來源:test_dao_libpq.cpp

示例2: gp_port_check_int_fast

/**
 * \brief Check for interrupt without wait
 * \param port a GPPort
 * \param data a pointer to an allocated buffer
 * \param size the number of bytes that should be read
 *
 * Reads a specified number of bytes from the inerrupt endpoint
 * into the supplied buffer.
 * Function waits 50 miliseconds for data on interrupt endpoint.
 *
 * \return a gphoto2 error code
 **/
int
gp_port_check_int_fast (GPPort *port, char *data, int size)
{
        int retval;

        gp_log (GP_LOG_DATA, __func__, "Reading %i = 0x%x bytes from interrupt endpoint...", size, size);

	C_PARAMS (port);
	CHECK_INIT (port);

	/* Check if we read as many bytes as expected */
	CHECK_SUPP (port, "check_int", port->pc->ops->check_int);
	retval = port->pc->ops->check_int (port, data, size, FAST_TIMEOUT);
	CHECK_RESULT (retval);

#ifdef IGNORE_EMPTY_INTR_READS
	/* For Canon cameras, we will make lots of
	   reads that will return zero length. Don't
	   bother to log them as errors. */
	if (retval != 0 )
#endif
		LOG_DATA (data, retval, size, "Read   ", "from interrupt endpoint (fast):");

	return (retval);
}
開發者ID:axxel,項目名稱:libgphoto2,代碼行數:37,代碼來源:gphoto2-port.c

示例3: db_select

void db_select(int32_t id, int32_t* value) {
    if (debug) {
        fprintf(stderr, "db_select(%d)\n", id);
    }
    int32_t _id = htonl(id);
    const char* paramValues[] = {
        (const char*) &_id,
    };
    PGresult* res = PQexecPrepared(conn,
            STMT_ID_SELECT,
            1,
            paramValues,
            paramLengths,
            paramFormats,
            1);
    CHECK_RESULT(res);
    *value = -1;
    if (PQntuples(res) == 0) {
        fprintf(stderr, "db_select(%d) return no rows\n", id);
        if (exit_on_error) {
            exit(EXIT_FAILURE);
        }
        PQclear(res);
    } else {
        *value = ntohl(*(int32_t *) PQgetvalue(res, 0, 0));
        if (debug) {
            fprintf(stderr, "db_select(%d) return %d\n", id, *value);
        }
    }
    PQclear(res);
}
開發者ID:vvromanov,項目名稱:db_test,代碼行數:31,代碼來源:test_dao_libpq.cpp

示例4: Java_org_fmod_playsound_Example_cPlaySound

void Java_org_fmod_playsound_Example_cPlaySound(JNIEnv *env, jobject thiz, int id)
{
	FMOD_RESULT result = FMOD_OK;

	result = FMOD_System_PlaySound(gSystem, FMOD_CHANNEL_FREE, gSound[id], 0, &gChannel);
	CHECK_RESULT(result);
}
開發者ID:mperroteau,項目名稱:Euterpe,代碼行數:7,代碼來源:main.c

示例5: Error

GPResult gpiAuthBuddyRequest
( 
	GPConnection * connection,
	GPProfile profile
)
{
	GPIProfile * pProfile;
	GPIConnection * iconnection = (GPIConnection*)*connection;

	// Get the profile object.
	//////////////////////////
	if(!gpiGetProfile(connection, profile, &pProfile))
		Error(connection, GP_PARAMETER_ERROR, "Invalid profile.");

	// Check for a valid sig.
	/////////////////////////
	if(!pProfile->authSig)
		Error(connection, GP_PARAMETER_ERROR, "Invalid profile.");

	// Send the request.
	////////////////////
	CHECK_RESULT(gpiSendAuthBuddyRequest(connection, pProfile));

	// freeclear the sig if no more requests.
	////////////////////////////////////
	pProfile->requestCount--;
	if(!iconnection->infoCaching && (pProfile->requestCount <= 0))
	{
		freeclear(pProfile->authSig);
		if(gpiCanFreeProfile(pProfile))
			gpiRemoveProfile(connection, pProfile);
	}

	return GP_NO_ERROR;
}
開發者ID:AntonioModer,項目名稱:xray-16,代碼行數:35,代碼來源:gpiBuddy.c

示例6: Java_org_fmod_playsound_Example_cUpdate

void Java_org_fmod_playsound_Example_cUpdate(JNIEnv *env, jobject thiz)
{
	FMOD_RESULT	result = FMOD_OK;

	result = FMOD_System_Update(gSystem);
	CHECK_RESULT(result);
}
開發者ID:mperroteau,項目名稱:Euterpe,代碼行數:7,代碼來源:main.c

示例7: Begin

void Begin()
{
	FMOD_RESULT result = FMOD_OK;

	result = FMOD_System_Create(&gSystem);
	CHECK_RESULT(result);

	result = FMOD_System_Init(gSystem, 32, FMOD_INIT_NORMAL, 0);
	CHECK_RESULT(result);

	result = FMOD_System_CreateSound(gSystem, "/sdcard/fmod/wave.mp3", FMOD_DEFAULT | FMOD_LOOP_NORMAL, 0, &gSound);
	CHECK_RESULT(result);

	result = FMOD_System_PlaySound(gSystem, FMOD_CHANNEL_FREE, gSound, 0, &gChannel);
	CHECK_RESULT(result);
}
開發者ID:mperroteau,項目名稱:Euterpe,代碼行數:16,代碼來源:main.c

示例8: gp_port_usb_msg_read

/**
 * \brief Send a USB control message with input data
 *
 * \param port a GPPort
 * \param request control request code
 * \param value control value
 * \param index control index
 * \param bytes pointer to data
 * \param size size of the data
 *
 * Sends a specific USB interface control command and read associated data.
 *
 * \return a gphoto2 error code
 */
int
gp_port_usb_msg_read (GPPort *port, int request, int value, int index,
	char *bytes, int size)
{
        int retval;

	gp_log (GP_LOG_DEBUG, "gphoto2-port", _("Reading message "
		"(request=0x%x value=0x%x index=0x%x size=%i=0x%x)..."),
		request, value, index, size, size);

	CHECK_NULL (port);
	CHECK_INIT (port);

	CHECK_SUPP (port, "msg_read", port->pc->ops->msg_read);
        retval = port->pc->ops->msg_read (port, request, value, index, bytes, size);
	CHECK_RESULT (retval);

	if (retval != size)
		gp_log (GP_LOG_DEBUG, "gphoto2-port", ngettext(
			"Could only read %i out of %i byte",
			"Could only read %i out of %i bytes",
			size
		), retval, size);

	gp_log_data ("gphoto2-port", bytes, retval);
        return (retval);
}
開發者ID:CastorGemini,項目名稱:libgphoto2,代碼行數:41,代碼來源:gphoto2-port.c

示例9: wsql_result_fetch_row_async

static PyObject* wsql_result_fetch_row_async(wsql_result *self)
{
    PyObject *row = NULL, *result = NULL;
    MYSQL_ROW mysql_row;
    net_async_status status;

    CHECK_RESULT(self, NULL);

    status = mysql_fetch_row_nonblocking(self->result, &mysql_row);

    if (status == NET_ASYNC_NOT_READY)
    {
        row = Py_None;
        Py_INCREF(row);
    }
    else
    {
        row = wsql_result_convert_row(self, mysql_row);
    }

    if (row)
    {
        result = Py_BuildValue("(iO)", status, row);
        Py_DECREF(row);
        return result;
    }

    return NULL;
}
開發者ID:WebSQL,項目名稱:wsql,代碼行數:29,代碼來源:results.c

示例10: marshal_record

int marshal_record(record *data, unsigned char **_out, size_t *_size) {
int _result;
_result = marshal_key(&(*data).k, _out, _size);
CHECK_RESULT();
_result = marshal_unsigned_int(&(*data).data.count, _out, _size);
CHECK_RESULT();
if ((*data).data.count > 1024) return -1;
{
size_t i;
for (i = 0; i < (*data).data.count; i++) {
_result = marshal_opaque(&(*data).data.data[i], _out, _size);
CHECK_RESULT();
}
}
return 0;
}
開發者ID:CyberGrandChallenge,項目名稱:samples,代碼行數:16,代碼來源:db_xdr.c

示例11: Java_org_fmod_programmerselected_Example_cEnd

void Java_org_fmod_programmerselected_Example_cEnd(JNIEnv *env, jobject thiz)
{
	FMOD_RESULT result = FMOD_OK;

	result = FMOD_EventSystem_Release(gEventSystem);
	CHECK_RESULT(result);
}
開發者ID:mperroteau,項目名稱:Euterpe,代碼行數:7,代碼來源:main.c

示例12: marshal_opaque_auth

int marshal_opaque_auth(opaque_auth *data, unsigned char **_out, size_t *_size) {
int _result;
_result = marshal_auth_flavor(&(*data).flavor, _out, _size);
CHECK_RESULT();
_result = marshal_unsigned_int(&(*data).body.count, _out, _size);
CHECK_RESULT();
if ((*data).body.count > 400) return -1;
{
size_t i;
for (i = 0; i < (*data).body.count; i++) {
_result = marshal_opaque(&(*data).body.data[i], _out, _size);
CHECK_RESULT();
}
}
return 0;
}
開發者ID:CyberGrandChallenge,項目名稱:samples,代碼行數:16,代碼來源:rpc_xdr.c

示例13: gp_port_check_int

/**
 * \brief Check for intterupt.
 *
 * \param port a GPPort
 * \param data a pointer to an allocated buffer
 * \param size the number of bytes that should be read
 *
 * Reads a specified number of bytes from the interrupt endpoint
 * into the supplied buffer.
 * Function waits port->timeout miliseconds for data on interrupt endpoint.
 *
 * \return a gphoto2 error code
 **/
int
gp_port_check_int (GPPort *port, char *data, int size)
{
        int retval;

	gp_log (GP_LOG_DEBUG, "gphoto2-port",
		ngettext(
	"Reading %i=0x%x byte from interrupt endpoint...",
	"Reading %i=0x%x bytes from interrupt endpoint...",
	size), size, size);

	CHECK_NULL (port);
	CHECK_INIT (port);

	/* Check if we read as many bytes as expected */
	CHECK_SUPP (port, "check_int", port->pc->ops->check_int);
	retval = port->pc->ops->check_int (port, data, size, port->timeout);
	CHECK_RESULT (retval);
	if (retval != size)
		gp_log (GP_LOG_DEBUG, "gphoto2-port", _("Could only read %i "
			"out of %i byte(s)"), retval, size);

	gp_log_data ("gphoto2-port", data, retval);

	return (retval);
}
開發者ID:CastorGemini,項目名稱:libgphoto2,代碼行數:39,代碼來源:gphoto2-port.c

示例14: gpiCheckConnect

GPResult
gpiCheckConnect(
  GPConnection * connection
)
{
	GPIConnection * iconnection = (GPIConnection*)*connection;
	int state;
	
	// Check if the connection is completed.
	////////////////////////////////////////
	CHECK_RESULT(gpiCheckSocketConnect(connection, iconnection->cmSocket, &state));
	
	// Check for a failed attempt.
	//////////////////////////////
	if(state == GPI_DISCONNECTED)
		CallbackFatalError(connection, GP_SERVER_ERROR, GP_LOGIN_CONNECTION_FAILED, "The server has refused the connection.");

	// Check if not finished connecting.
	////////////////////////////////////
	if(state == GPI_NOT_CONNECTED)
		return GP_NO_ERROR;
	
	// We're now negotiating the connection.
	////////////////////////////////////////
	assert(state == GPI_CONNECTED);
	iconnection->connectState = GPI_NEGOTIATING;

	return GP_NO_ERROR;
}
開發者ID:AntonioModer,項目名稱:xray-16,代碼行數:29,代碼來源:gpiConnect.c

示例15: marshal_result

int marshal_result(result *data, unsigned char **_out, size_t *_size) {
int _result;
_result = marshal_result_status(&(*data).status, _out, _size);
CHECK_RESULT();
_result = marshal_unsigned_int(&(*data).rec.count, _out, _size);
CHECK_RESULT();
if ((*data).rec.count > 1) return -1;
{
size_t i;
for (i = 0; i < (*data).rec.count; i++) {
_result = marshal_record(&(*data).rec.data[i], _out, _size);
CHECK_RESULT();
}
}
return 0;
}
開發者ID:CyberGrandChallenge,項目名稱:samples,代碼行數:16,代碼來源:db_xdr.c


注:本文中的CHECK_RESULT函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。