当前位置: 首页>>代码示例>>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;未经允许,请勿转载。