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


C++ xmmsv_unref函数代码示例

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


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

示例1: assertNonEmptyFetchList

	DictListResult
	Collection::queryInfos( const Coll::Coll& coll,
	                        const std::list< std::string >& fetch,
	                        const std::list< std::string >& order,
	                        int limit_len,
	                        int limit_start,
	                        const std::list< std::string >& group
	                      ) const
	{
		assertNonEmptyFetchList( fetch );

		xmmsv_t *xorder, *xfetch, *xgroup;
		xorder = makeStringList( order );
		xfetch = makeStringList( fetch );
		xgroup = makeStringList( group );

		xmmsc_result_t* res
		    = call( connected_,
		            boost::bind( xmmsc_coll_query_infos, conn_, coll.coll_,
		                         xorder, limit_start, limit_len,
		                         xfetch, xgroup ) );

		xmmsv_unref( xorder );
		xmmsv_unref( xfetch );
		xmmsv_unref( xgroup );

		return DictListResult( res, ml_ );
	}
开发者ID:dreamerc,项目名称:xmms2,代码行数:28,代码来源:collection.cpp

示例2: xmmsv_build_dict_va

xmmsv_t *
xmmsv_build_dict_va (const char *firstkey, va_list ap)
{
	const char *key;
	xmmsv_t *val, *res;

	res = xmmsv_new_dict ();
	if (!res)
		return NULL;

	key = firstkey;
	do {
		val = va_arg (ap, xmmsv_t *);

		if (!xmmsv_dict_set (res, key, val)) {
			xmmsv_unref (res);
			res = NULL;
			break;
		}
		xmmsv_unref (val);
		key = va_arg (ap, const char *);
	} while (key);

	return res;
}
开发者ID:randalboyle,项目名称:xmms2-devel,代码行数:25,代码来源:xmmsv_build.c

示例3: filter_testcase

static void
filter_testcase (const gchar *path, xmmsv_t *list)
{
	gchar *content, *filename;
	xmmsv_t *dict, *data, *coll;

	g_assert (g_file_get_contents (path, &content, NULL, NULL));
	dict = xmmsv_from_json (content);
	if (dict == NULL) {
		g_error ("Could not parse '%s'!\n", path);
		g_assert_not_reached ();
	}
	g_free (content);

	g_assert (xmmsv_dict_has_key (dict, "medialib"));
	g_assert (xmmsv_dict_has_key (dict, "collection"));
	g_assert (xmmsv_dict_has_key (dict, "specification"));
	g_assert (xmmsv_dict_has_key (dict, "expected"));

	g_assert (xmmsv_dict_get (dict, "collection", &data));
	g_assert (xmmsv_is_type (data, XMMSV_TYPE_DICT));

	coll = xmmsv_coll_from_dict (data);

	xmmsv_dict_set (dict, "collection", coll);
	xmmsv_unref (coll);

	filename = g_path_get_basename (path);
	xmmsv_dict_set_string (dict, "name", filename);
	g_free (filename);

	xmmsv_list_append (list, dict);
	xmmsv_unref (dict);
}
开发者ID:kfihihc,项目名称:xmms2-devel,代码行数:34,代码来源:medialib-runner.c

示例4: m_decode_url

/*
 * call-seq:
 *  Xmms.decode_url(url) -> String
 *
 * Decodes a url-encoded string _url_ and returns it in UNKNOWN ENCODING.
 * Use with caution.
 */
static VALUE
m_decode_url (VALUE self, VALUE str)
{
	const unsigned char *burl;
	unsigned int blen;
	xmmsv_t *strv, *decoded;
	VALUE url = Qnil;

	strv = xmmsv_new_string (StringValuePtr (str));

	decoded = xmmsv_decode_url (strv);

	if (!decoded)
		goto out;

	if (!xmmsv_get_bin (decoded, &burl, &blen))
		goto out;

	url = rb_str_new ((char *) burl, blen);

out:
	if (decoded)
		xmmsv_unref (decoded);

	xmmsv_unref (strv);

	return url;
}
开发者ID:eggpi,项目名称:xmms2-guilherme,代码行数:35,代码来源:rb_xmmsclient_main.c

示例5: xmmsc_deserialize_list

static int
xmmsc_deserialize_list (xmmsv_t *bb, xmmsv_t **val)
{
	xmmsv_t *list;
	int32_t len;

	list = xmmsv_new_list ();

	if (!_internal_get_from_bb_int32_positive (bb, &len)) {
		goto err;
	}

	while (len--) {
		xmmsv_t *v;
		if (xmmsv_bitbuffer_deserialize_value (bb, &v)) {
			xmmsv_list_append (list, v);
		} else {
			goto err;
		}
		xmmsv_unref (v);
	}

	*val = list;

	return true;

err:
	x_internal_error ("Message from server did not parse correctly!");
	xmmsv_unref (list);
	return false;
}
开发者ID:dsheeler,项目名称:xmms2,代码行数:31,代码来源:value_serialize.c

示例6: updater_remove_directory

static void
updater_remove_directory (updater_t *updater, GFile *file)
{
	xmmsc_result_t *res;
	xmmsv_t *univ, *coll;
	gchar *path, *pattern, *encoded;

	path = g_file_get_path (file);
	encoded = xmmsv_encode_url (path);
	g_free (path);

	pattern = g_strdup_printf ("file://%s/*", encoded);
	g_free (encoded);

	univ = xmmsv_new_coll (XMMS_COLLECTION_TYPE_UNIVERSE);
	coll = xmmsv_new_coll (XMMS_COLLECTION_TYPE_MATCH);

	xmmsv_coll_add_operand (coll, univ);
	xmmsv_coll_attribute_set_string (coll, "field", "url");
	xmmsv_coll_attribute_set_string (coll, "value", pattern);
	xmmsv_coll_attribute_set_string (coll, "case-sensitive", "true");

	g_debug ("remove '%s' from mlib", pattern);

	res = xmmsc_coll_query_ids (updater->conn, coll, NULL, 0, 0);
	xmmsc_result_notifier_set (res, updater_remove_directory_by_id, updater);
	xmmsc_result_unref (res);

	xmmsv_unref (coll);
	xmmsv_unref (univ);

	g_free (pattern);
}
开发者ID:eggpi,项目名称:xmms2-guilherme,代码行数:33,代码来源:main.c

示例7: xmmsv_build_list_va

xmmsv_t *
xmmsv_build_list_va (xmmsv_t *first_entry, va_list ap)
{
	xmmsv_t *val, *res;

	res = xmmsv_new_list ();
	if (!res)
		return NULL;

	val = first_entry;

	while (val) {
		if (!xmmsv_list_append (res, val)) {
			xmmsv_unref (res);
			res = NULL;
			break;
		}

		xmmsv_unref (val);

		val = va_arg (ap, xmmsv_t *);
	}

	return res;
}
开发者ID:randalboyle,项目名称:xmms2-devel,代码行数:25,代码来源:xmmsv_build.c

示例8: convert_ghashtable_to_xmmsv

static xmmsv_t *
convert_ghashtable_to_xmmsv (GHashTable *table, xmms_fetch_spec_t *spec)
{
	GHashTableIter iter;
	s4_resultset_t *value;
	const gchar *key;
	xmmsv_t *ret;

	g_hash_table_iter_init (&iter, table);

	ret = xmmsv_new_dict ();

	while (g_hash_table_iter_next (&iter, (gpointer *) &key, (gpointer *) &value)) {
		xmmsv_t *converted;

		if (value == NULL) {
			continue;
		}

		converted = xmms_medialib_query_to_xmmsv (value, spec);
		xmmsv_dict_set (ret, key, converted);
		xmmsv_unref (converted);
	}

	if (xmmsv_dict_get_size (ret) == 0) {
		xmmsv_unref (ret);
		ret = NULL;
	}

	return ret;
}
开发者ID:Malvineous,项目名称:xmms2-devel,代码行数:31,代码来源:medialib_query_result.c

示例9: xmmsv_new_dict

/**
 * Creates a cluster-dict fetch specification.
 *
 * @param cluster_by A list of attributes to cluster by
 * @param cluster_data The fetch specifcation to use when filling the list
 * @return A cluster-list fetch specification
 */
xmmsv_t *xmmsv_build_cluster_dict (xmmsv_t *cluster_by, xmmsv_t *cluster_field, xmmsv_t *cluster_data)
{
	xmmsv_t *res = xmmsv_new_dict ();
	if (res == NULL)
		return NULL;

	xmmsv_dict_set_string (res, "type", "cluster-dict");

	if (cluster_by != NULL) {
		xmmsv_dict_set (res, "cluster-by", cluster_by);
		xmmsv_unref (cluster_by);
	}


	if (cluster_field != NULL) {
		xmmsv_dict_set (res, "cluster-field", cluster_field);
		xmmsv_unref (cluster_field);
	}

	if (cluster_data != NULL) {
		xmmsv_dict_set (res, "data", cluster_data);
		xmmsv_unref (cluster_data);
	}

	return res;
}
开发者ID:randalboyle,项目名称:xmms2-devel,代码行数:33,代码来源:xmmsv_build.c

示例10: xmms_fetch_spec_new_metadata

static xmms_fetch_spec_t *
xmms_fetch_spec_new_metadata (xmmsv_t *fetch, xmms_fetch_info_t *info,
                              s4_sourcepref_t *prefs, xmms_error_t *err)
{
	xmms_fetch_spec_t *ret = NULL;
	s4_sourcepref_t *sp;
	const gchar *key;
	xmmsv_t *gets, *fields;
	gint i, size, aggregate, get;

	aggregate = normalize_aggregate_function (fetch, err);
	if (xmms_error_iserror (err)) {
		return NULL;
	}

	fields = normalize_metadata_fields (fetch, err);
	if (xmms_error_iserror (err)) {
		return NULL;
	}

	gets = normalize_metadata_get (fetch, err);
	if (xmms_error_iserror (err)) {
		return NULL;
	}

	sp = normalize_source_preferences (fetch, prefs, err);
	if (xmms_error_iserror (err)) {
		xmmsv_unref (gets);
		return NULL;
	}

	ret = g_new0 (xmms_fetch_spec_t, 1);
	ret->type = FETCH_METADATA;
	ret->data.metadata.aggr_func = aggregate;

	for (i = 0; i < 4 && xmmsv_list_get_int (gets, i, &get); i++) {
		ret->data.metadata.get[i] = get;
	}
	ret->data.metadata.get_size = i;

	if (fields != NULL) {
		size = xmmsv_list_get_size (fields);
		ret->data.metadata.col_count = size;
		ret->data.metadata.cols = g_new (gint32, size);
		for (i = 0; xmmsv_list_get_string (fields, i, &key); i++) {
			ret->data.metadata.cols[i] = xmms_fetch_info_add_key (info, fetch, key, sp);
		}
	} else {
		/* No fields requested, fetching all available */
		ret->data.metadata.col_count = 1;
		ret->data.metadata.cols = g_new0 (gint32, 1);
		ret->data.metadata.cols[0] = xmms_fetch_info_add_key (info, fetch, NULL, sp);
	}

	s4_sourcepref_unref (sp);
	xmmsv_unref (gets);

	return ret;
}
开发者ID:vdust,项目名称:xmms2-devel,代码行数:59,代码来源:fetchspec.c

示例11: _xmmsv_coll_free

/**
 * Free the memory owned by the collection.
 * You probably want to use #xmmsv_coll_unref instead, which handles
 * reference counting.
 *
 * @param coll the collection to free.
 */
void
_xmmsv_coll_free (xmmsv_coll_internal_t *coll)
{
	x_return_if_fail (coll);

	/* Unref all the operands and attributes */
	xmmsv_unref (coll->operands);
	xmmsv_unref (coll->attributes);
	xmmsv_unref (coll->idlist);

	free (coll);
}
开发者ID:vdust,项目名称:xmms2-devel,代码行数:19,代码来源:xmmsv_coll.c

示例12: xmms_medialib_query_to_xmmsv

/* Converts an S4 resultset into an xmmsv_t, based on the fetch specification */
xmmsv_t *
xmms_medialib_query_to_xmmsv (s4_resultset_t *set, xmms_fetch_spec_t *spec)
{
	GHashTable *set_table;
	GList *sets;
	xmmsv_t *val, *ret = NULL;
	gint i;

	switch (spec->type) {
		case FETCH_COUNT:
			ret = xmmsv_new_int (s4_resultset_get_rowcount (set));
			break;
		case FETCH_METADATA:
			ret = metadata_to_xmmsv (set, spec);
			break;
		case FETCH_ORGANIZE:
			ret = xmmsv_new_dict ();

			for (i = 0; i < spec->data.organize.count; i++) {
				val = xmms_medialib_query_to_xmmsv (set, spec->data.organize.data[i]);
				if (val != NULL) {
					xmmsv_dict_set (ret, spec->data.organize.keys[i], val);
					xmmsv_unref (val);
				}
			}
			break;
		case FETCH_CLUSTER_LIST:
			sets = cluster_list (set, spec);
			ret = xmmsv_new_list ();
			for (; sets != NULL; sets = g_list_delete_link (sets, sets)) {
				set = sets->data;

				val = xmms_medialib_query_to_xmmsv (set, spec->data.cluster.data);
				if (val != NULL) {
					xmmsv_list_append (ret, val);
					xmmsv_unref (val);
				}
				s4_resultset_free (set);
			}
			break;
		case FETCH_CLUSTER_DICT:
			set_table = cluster_dict (set, spec);
			ret = convert_ghashtable_to_xmmsv (set_table, spec->data.cluster.data);

			g_hash_table_destroy (set_table);
			break;
		default:
			g_assert_not_reached ();
	}

	return ret;
}
开发者ID:Malvineous,项目名称:xmms2-devel,代码行数:53,代码来源:medialib_query_result.c

示例13: xmms_medialib_entry_to_tree

static xmmsv_t *
xmms_medialib_entry_to_tree (xmms_medialib_session_t *session,
                             xmms_medialib_entry_t entry)
{
	s4_resultset_t *set;
	s4_val_t *song_id;
	xmmsv_t *ret, *id;
	gint i;

	song_id = s4_val_new_int (entry);
	set = xmms_medialib_filter (session, "song_id", song_id, S4_COND_PARENT,
	                            NULL, NULL, S4_FETCH_PARENT | S4_FETCH_DATA);
	s4_val_free (song_id);

	ret = xmmsv_new_dict ();

	for (i = 0; i < s4_resultset_get_rowcount (set); i++) {
		const s4_result_t *res;

		res = s4_resultset_get_result (set, 0, 0);
		while (res != NULL) {
			xmmsv_t *v_entry = NULL;
			const s4_val_t *val;
			const char *s;
			gint32 i;

			val = s4_result_get_val (res);
			if (s4_val_get_str (val, &s)) {
				v_entry = xmmsv_new_string (s);
			} else if (s4_val_get_int (val, &i)) {
				v_entry = xmmsv_new_int (i);
			}

			xmms_medialib_tree_add_tuple (ret, s4_result_get_key (res),
			                              s4_result_get_src (res), v_entry);
			xmmsv_unref (v_entry);

			res = s4_result_next (res);
		}
	}

	s4_resultset_free (set);

	id = xmmsv_new_int (entry);
	xmms_medialib_tree_add_tuple (ret, "id", "server", id);
	xmmsv_unref (id);

	return ret;
}
开发者ID:Malvineous,项目名称:xmms2-devel,代码行数:49,代码来源:medialib.c

示例14: normalize_metadata_get

/**
 * Sanitize the 'get' property of a 'metadata' fetch specification.
 */
static xmmsv_t *
normalize_metadata_get (xmmsv_t *fetch, xmms_error_t *err)
{
	xmmsv_list_iter_t *it;
	xmmsv_t *get, *list;
	guint32 values;

	if (!xmmsv_dict_get (fetch, "get", &get) ||
	    xmmsv_get_type (get) != XMMSV_TYPE_LIST ||
	    xmmsv_list_get_size (get) < 1) {
		const gchar *message = "'get' must be a non-empty list of strings.";
		xmms_error_set (err, XMMS_ERROR_INVAL, message);
		return NULL;
	}

	list = xmmsv_new_list ();
	values = 0;

	/* Scan for duplicates or invalid values */
	xmmsv_get_list_iter (get, &it);
	while (xmmsv_list_iter_valid (it)) {
		const gchar *value = NULL;
		guint32 get_as_int, mask;

		xmmsv_list_iter_entry_string (it, &value);

		if (!metadata_value_from_string (value, &get_as_int)) {
			const gchar *message = "'get' entries must be 'id', 'field', 'value' or 'source'.";
			xmms_error_set (err, XMMS_ERROR_INVAL, message);
			xmmsv_unref (list);
			return NULL;
		}

		mask = 1 << (get_as_int + 1);
		if (values & mask) {
			const gchar *message = "'get' entries must be unique.";
			xmms_error_set (err, XMMS_ERROR_INVAL, message);
			xmmsv_unref (list);
			return NULL;
		}

		values |= mask;

		xmmsv_list_append_int (list, get_as_int);
		xmmsv_list_iter_next (it);
	}

	return list;
}
开发者ID:vdust,项目名称:xmms2-devel,代码行数:52,代码来源:fetchspec.c

示例15: c_dict_free

static void
c_dict_free (RbDict *dict)
{
	xmmsv_unref (dict->real);

	free (dict);
}
开发者ID:vdust,项目名称:xmms2-devel,代码行数:7,代码来源:rb_result.c


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