本文整理汇总了C++中xmlrpc_DECREF函数的典型用法代码示例。如果您正苦于以下问题:C++ xmlrpc_DECREF函数的具体用法?C++ xmlrpc_DECREF怎么用?C++ xmlrpc_DECREF使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xmlrpc_DECREF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xr_setBoolInResult
void
xr_setBoolInResult (void *data, int val)
{
CallerP c = (Caller *) data;
if (c->result)
xmlrpc_DECREF (c->result);
if (!xr_errstat)
c->result = xmlrpc_bool_new (c->env, (xmlrpc_bool)val);
}
示例2: xr_setIntInResult
/****************************************************************************
** Set result for the caller. These procedures are used in the method
** implementation to create a result object and append values. The
** server then unpacks the result array when building the array for
** the return.
*****************************************************************************
*/
void
xr_setIntInResult (void *data, int val)
{
CallerP c = (Caller *) data;
if (c->result)
xmlrpc_DECREF (c->result);
if (!xr_errstat)
c->result = xmlrpc_int_new (c->env, val);
}
示例3: xr_setDoubleInResult
void
xr_setDoubleInResult (void *data, double val)
{
CallerP c = (Caller *) data;
if (c->result)
xmlrpc_DECREF (c->result);
if (!xr_errstat)
c->result = xmlrpc_double_new (c->env, val);
}
示例4: func_entry
GList *rhbz_bug_cc(xmlrpc_value* result_xml)
{
func_entry();
xmlrpc_env env;
xmlrpc_env_init(&env);
xmlrpc_value* cc_member = rhbz_get_member("cc", result_xml);
if (!cc_member)
return NULL;
unsigned array_size = rhbz_array_size(cc_member);
VERB3 log("count members on cc %i", array_size);
GList *cc_list = NULL;
for (unsigned i = 0; i < array_size; ++i)
{
xmlrpc_value* item = NULL;
xmlrpc_array_read_item(&env, cc_member, i, &item);
if (env.fault_occurred)
abrt_xmlrpc_die(&env);
if (!item)
continue;
const char* cc = NULL;
xmlrpc_read_string(&env, item, &cc);
xmlrpc_DECREF(item);
if (env.fault_occurred)
abrt_xmlrpc_die(&env);
if (*cc != '\0')
{
cc_list = g_list_append(cc_list, (char*)cc);
VERB3 log("member on cc is %s", cc);
continue;
}
free((char*)cc);
}
xmlrpc_DECREF(cc_member);
return cc_list;
}
示例5: test_serialize_double
static void
test_serialize_double(void) {
/* Test serialize of a double. */
xmlrpc_env env;
xmlrpc_value * v;
xmlrpc_mem_block *output;
char * result;
/* serialized result, as asciiz string */
size_t resultLength;
/* Length in characters of the serialized result */
float serializedValue;
char nextChar;
int itemsMatched;
xmlrpc_env_init(&env);
/* Build a double to serialize */
v = xmlrpc_build_value(&env, "d", 3.14159);
TEST_NO_FAULT(&env);
/* Serialize the value. */
output = XMLRPC_TYPED_MEM_BLOCK_NEW(char, &env, 0);
TEST_NO_FAULT(&env);
xmlrpc_serialize_value(&env, output, v);
TEST_NO_FAULT(&env);
/* Make sure we serialized the correct value. Note that because
doubles aren't precise, this might serialize as 3.1415899999
or something like that. So we check it arithmetically.
*/
resultLength = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, output);
result = malloc(resultLength + 1);
memcpy(result, XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, output),
resultLength);
result[resultLength] = '\0';
itemsMatched = sscanf(result,
"<value><double>%f</double></value>\r\n%c",
&serializedValue, &nextChar);
TEST(itemsMatched == 1);
TEST(serializedValue - 3.14159 < .000001);
/* We'd like to test more precision, but sscanf doesn't do doubles */
free(result);
/* Clean up our value. */
XMLRPC_TYPED_MEM_BLOCK_FREE(char, output);
xmlrpc_DECREF(v);
xmlrpc_env_clean(&env);
}
示例6: test_value_array
static void
test_value_array(void) {
xmlrpc_value *v;
xmlrpc_env env;
size_t len;
xmlrpc_value * itemP;
/* Basic array-building test. */
xmlrpc_env_init(&env);
TEST(streq(xmlrpc_type_name(XMLRPC_TYPE_ARRAY), "ARRAY"));
v = xmlrpc_array_new(&env);
TEST_NO_FAULT(&env);
TEST(XMLRPC_TYPE_ARRAY == xmlrpc_value_type(v));
len = xmlrpc_array_size(&env, v);
TEST_NO_FAULT(&env);
TEST(len == 0);
itemP = xmlrpc_int_new(&env, 7);
TEST_NO_FAULT(&env);
xmlrpc_array_append_item(&env, v, itemP);
TEST_NO_FAULT(&env);
len = xmlrpc_array_size(&env, v);
TEST_NO_FAULT(&env);
TEST(len == 1);
xmlrpc_DECREF(itemP);
xmlrpc_DECREF(v);
v = xmlrpc_build_value(&env, "()");
TEST_NO_FAULT(&env);
TEST(XMLRPC_TYPE_ARRAY == xmlrpc_value_type(v));
len = xmlrpc_array_size(&env, v);
TEST_NO_FAULT(&env);
TEST(len == 0);
xmlrpc_DECREF(v);
xmlrpc_env_clean(&env);
}
示例7: test_value_string_wide_build
static void
test_value_string_wide_build(void) {
xmlrpc_env env;
xmlrpc_value * valueP;
const wchar_t * wcs;
size_t len;
xmlrpc_env_init(&env);
/* Build with build_value w# */
valueP = xmlrpc_build_value(&env, "w#", wcs_data, (size_t)3);
TEST_NO_FAULT(&env);
TEST(valueP != NULL);
/* Verify it */
xmlrpc_read_string_w_lp(&env, valueP, &len, &wcs);
TEST_NO_FAULT(&env);
TEST(wcs != NULL);
TEST(len == 3);
TEST(wcs[len] == '\0');
TEST(wcsneq(wcs, wcs_data, len));
free((void*)wcs);
xmlrpc_DECREF(valueP);
/* Build with build_value w */
valueP = xmlrpc_build_value(&env, "w", wcs_data);
TEST_NO_FAULT(&env);
TEST(valueP != NULL);
/* Verify it */
xmlrpc_read_string_w_lp(&env, valueP, &len, &wcs);
TEST_NO_FAULT(&env);
TEST(wcs != NULL);
TEST(len == 3);
TEST(wcs[len] == '\0');
TEST(wcsneq(wcs, wcs_data, len));
free((void*)wcs);
xmlrpc_DECREF(valueP);
}
示例8: server_status
xmlrpc_value *
server_status(xmlrpc_env * envP, struct call_info *cip, char ** statusp)
{
xmlrpc_value *resultP = NULL;
struct client_method_info *cmi = NULL;
struct meths_tab *meth = NULL;
struct call_info *cip_status = callinfo_clone(cip);
cip_status->files = NULL;
cip_status->methodargs = NULL;
cip_status->method = "status";
if (!(meth = meths(cip_status->method, strlen(cip_status->method))))
{
fprintf(stderr, "oracc-client: unknown method name `%s'\n", cip_status->method);
exit(1);
}
cmi = meth->info;
meth->info->instance = cip_status;
resultP = cmi->call(envP, cmi);
dieIfFaultOccurred(envP);
if (resultP)
{
char *str = NULL;
xmlrpc_value *status = NULL;
xmlrpc_struct_find_value(envP, resultP, "method-status", &status);
if (status)
{
trace();
xmlrpc_read_string(envP, status, (const char **)&str);
/* This diagnostic needs to be suppressable */
fprintf(stderr, "server-status: status=%s\n", str);
*statusp = NULL;
if (!strcmp(str, "completed"))
return resultP;
}
else
{
fprintf(stderr, "!server-status: no method-status\n");
*statusp = "no method status returned by status request";
/* should return an error condition to caller here
so that when server bombs/loses session client can
terminate gracefully */
}
}
else
*statusp = "!no result from status request";
/* Dispose of our result value. */
xmlrpc_DECREF(resultP);
return NULL;
}
示例9: wpGetBlogId
char *
wpGetBlogId(char *username, char *password, char *url) {
char *blogid;
int i;
int noOfBlogs;
xmlrpc_env env;
xmlrpc_client *clientP;
char *methodName = "wp.getUsersBlogs";
xmlrpc_value *result, *result2;
wp_env_init(&env, &clientP);
/* Make the remote procedure call */
xmlrpc_client_call2f(&env, clientP, url, methodName, &result,
"(ss)", username, password);
die_if_fault_occurred(&env);
noOfBlogs = xmlrpc_array_size(&env, result);
if ( noOfBlogs > 1 ) {
fprintf(stderr, "Currently only single blog wp accounts are supported\n");
blogid = NULL;
goto out;
}
for(i = 0; i < noOfBlogs; i++) {
xmlrpc_value *blog_id_xml;
xmlrpc_array_read_item(&env, result, i, &result2);
xmlrpc_struct_read_value(&env, result2, "blogid", &blog_id_xml);
xmlrpc_read_string(&env, blog_id_xml,(const char **) &blogid);
xmlrpc_DECREF(blog_id_xml);
}
/* Dispose of our result value. */
xmlrpc_DECREF(result2);
out:
xmlrpc_DECREF(result);
/* Clean up our error-handling environment. */
wp_env_clean(&env, &clientP);
return blogid;
}
示例10: test_value_string_no_null
static void
test_value_string_no_null(void) {
xmlrpc_value * v;
xmlrpc_env env;
const char * str;
size_t len;
/* Test strings (without '\0' bytes). */
xmlrpc_env_init(&env);
v = xmlrpc_string_new(&env, test_string_1);
TEST_NO_FAULT(&env);
TEST(XMLRPC_TYPE_STRING == xmlrpc_value_type(v));
xmlrpc_read_string(&env, v, &str);
TEST_NO_FAULT(&env);
TEST(strcmp(str, test_string_1) == 0);
xmlrpc_DECREF(v);
strfree(str);
v = xmlrpc_build_value(&env, "s", test_string_1);
TEST_NO_FAULT(&env);
TEST(v != NULL);
TEST(XMLRPC_TYPE_STRING == xmlrpc_value_type(v));
xmlrpc_decompose_value(&env, v, "s", &str);
TEST_NO_FAULT(&env);
TEST(strcmp(str, test_string_1) == 0);
strfree(str);
xmlrpc_decompose_value(&env, v, "s#", &str, &len);
TEST_NO_FAULT(&env);
TEST(memcmp(str, test_string_1, strlen(test_string_1)) == 0);
TEST(strlen(str) == strlen(test_string_1));
strfree(str);
xmlrpc_DECREF(v);
xmlrpc_env_clean(&env);
}
示例11: xr_setStructInResult
void
xr_setStructInResult (void *data, int snum)
{
CallerP c = (Caller *) data;
extern int res_snum;
res_snum = snum;
if (c->result)
xmlrpc_DECREF (c->result);
if (!xr_errstat)
c->result = xr_getSParam (snum);
}
示例12: xr_getDatetimeFromParam
char *
xr_getDatetimeFromParam (void *data, int index)
{
CallerP c = (Caller *) data;
xmlrpc_value *val = xr_getArrValue (c->param, index);
const char *s;
xmlrpc_read_datetime_str (c->env, val, &s);
xmlrpc_DECREF (val);
return (((xr_errstat=c->env->fault_occurred) ? (char *)NULL : (char *)s));
}
示例13: xr_getBoolFromParam
int
xr_getBoolFromParam (void *data, int index)
{
CallerP c = (Caller *) data;
xmlrpc_value *val = xr_getArrValue (c->param, index);
xmlrpc_bool bval;
xmlrpc_read_bool (c->env, val, &bval);
xmlrpc_DECREF (val);
return ( ((xr_errstat=c->env->fault_occurred) ? (int)NULL : bval) );
}
示例14: xr_getDoubleFromParam
double
xr_getDoubleFromParam (void *data, int index)
{
CallerP c = (Caller *) data;
xmlrpc_value *val = xr_getArrValue (c->param, index);
double dval;
xmlrpc_read_double (c->env, val, &dval);
xmlrpc_DECREF (val);
return ( ((xr_errstat=c->env->fault_occurred) ? (double)0.0 : dval) );
}
示例15: LogEvent_clean
void LogEvent_clean() {
#ifdef DEFINE_XMLRPC
/* Dispose of our result value. */
xmlrpc_DECREF(_xmlrpc_result);
/* Clean up our error-handling environment. */
xmlrpc_env_clean(&_xmlrpc_env);
/* Shutdown our XML-RPC client library. */
xmlrpc_client_cleanup();
#endif /* DEFINE_XMLRPC */
}