[rygel-gst-0-10-plugins] Replace deprecated GValueArray with GArray holding GValues.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel-gst-0-10-plugins] Replace deprecated GValueArray with GArray holding GValues.
- Date: Wed, 23 Jan 2013 15:27:44 +0000 (UTC)
commit 4f03ffc9efd9f0dbad18b8bba3a5250903b6a8a3
Author: Krzesimir Nowak <krnowak openismus com>
Date: Wed Jan 23 16:26:08 2013 +0100
Replace deprecated GValueArray with GArray holding GValues.
src/media-export/rygel-media-export-media-cache.c | 267 ++++++++-------------
src/media-export/rygel-media-export-media-cache.h | 6 +-
2 files changed, 98 insertions(+), 175 deletions(-)
---
diff --git a/src/media-export/rygel-media-export-media-cache.c b/src/media-export/rygel-media-export-media-cache.c
index 6202f24..fc3996f 100644
--- a/src/media-export/rygel-media-export-media-cache.c
+++ b/src/media-export/rygel-media-export-media-cache.c
@@ -51,7 +51,6 @@ G_DEFINE_TYPE (RygelMediaExportMediaCache,
typedef struct _RygelMediaExportExistsCacheEntry RygelMediaExportExistsCacheEntry;
#define _rygel_media_export_exists_cache_entry_free0(var) ((var == NULL) ? NULL : (var = (rygel_media_export_exists_cache_entry_free (var), NULL)))
-#define _g_value_array_free0(var) ((var == NULL) ? NULL : (var = (g_value_array_free (var), NULL)))
#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
@@ -93,21 +92,41 @@ static RygelMediaExportDatabaseCursor* rygel_media_export_media_cache_exec_curso
static RygelMediaObject* rygel_media_export_media_cache_get_object_from_statement (RygelMediaExportMediaCache* self, RygelMediaContainer* parent, sqlite3_stmt* statement);
static gint rygel_media_export_media_cache_query_value (RygelMediaExportMediaCache* self, RygelMediaExportSQLString id, GValue* values, int values_length1, GError** error);
static gchar* rygel_media_export_media_cache_translate_sort_criteria (RygelMediaExportMediaCache* self, const gchar* sort_criteria);
-static gchar* rygel_media_export_media_cache_translate_search_expression (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, GValueArray* args, const gchar* prefix, GError** error);
+static gchar* rygel_media_export_media_cache_translate_search_expression (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, GArray* args, const gchar* prefix, GError** error);
static guint rygel_media_export_media_cache_modify_limit (RygelMediaExportMediaCache* self, guint max_count);
static GValue* _g_value_dup (GValue* self);
static void _vala_GValue_free (GValue* self);
static gchar* rygel_media_export_media_cache_map_operand_to_column (RygelMediaExportMediaCache* self, const gchar* operand, gchar** collate, GError** error);
static gboolean rygel_media_export_media_cache_create_schema (RygelMediaExportMediaCache* self);
static void rygel_media_export_media_cache_fill_item (RygelMediaExportMediaCache* self, sqlite3_stmt* statement, RygelMediaItem* item);
-static gchar* rygel_media_export_media_cache_search_expression_to_sql (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, GValueArray* args, GError** error);
-static gchar* rygel_media_export_media_cache_logical_expression_to_sql (RygelMediaExportMediaCache* self, RygelLogicalExpression* expression, GValueArray* args, GError** error);
-static gchar* rygel_media_export_media_cache_relational_expression_to_sql (RygelMediaExportMediaCache* self, RygelRelationalExpression* exp, GValueArray* args, GError** error);
+static gchar* rygel_media_export_media_cache_search_expression_to_sql (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, GArray* args, GError** error);
+static gchar* rygel_media_export_media_cache_logical_expression_to_sql (RygelMediaExportMediaCache* self, RygelLogicalExpression* expression, GArray* args, GError** error);
+static gchar* rygel_media_export_media_cache_relational_expression_to_sql (RygelMediaExportMediaCache* self, RygelRelationalExpression* exp, GArray* args, GError** error);
static void rygel_media_export_media_cache_dispose (GObject* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);
+static GArray *
+our_g_value_array_new (void)
+{
+ GArray *array = g_array_new (FALSE, FALSE, sizeof (GValue));
+
+ g_array_set_clear_func (array, (GDestroyNotify) g_value_unset);
+
+ return array;
+}
+
+#define our_g_array_index(a, i) (g_array_index ((a), GValue, (i)))
+
+static void
+our_g_value_clear (GValue *value) {
+ if (value) {
+ GValue v = G_VALUE_INIT;
+
+ *value = v;
+ }
+}
GType rygel_media_export_object_type_get_type (void) {
static volatile gsize rygel_media_export_object_type_type_id__volatile = 0;
@@ -921,10 +940,8 @@ RygelMediaObjects* rygel_media_export_media_cache_get_children (RygelMediaExport
RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_search_expression (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, const gchar* container_id, const gchar* sort_criteria, guint offset, guint max_count, guint* total_matches, GError** error) {
guint _vala_total_matches = 0U;
RygelMediaObjects* result = NULL;
- GValueArray* _tmp0_;
- GValueArray* args;
+ GArray *args;
RygelSearchExpression* _tmp1_;
- GValueArray* _tmp2_;
gchar* _tmp3_ = NULL;
gchar* filter;
RygelSearchExpression* _tmp4_;
@@ -932,12 +949,10 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_search_expressi
guint _tmp10_ = 0U;
guint max_objects;
const gchar* _tmp11_;
- GValueArray* _tmp12_;
const gchar* _tmp13_;
glong _tmp14_ = 0L;
glong _tmp15_;
const gchar* _tmp16_;
- GValueArray* _tmp17_;
const gchar* _tmp18_;
const gchar* _tmp19_;
guint _tmp20_;
@@ -947,15 +962,13 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_search_expressi
GError * _inner_error_ = NULL;
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (sort_criteria != NULL, NULL);
- _tmp0_ = g_value_array_new ((guint) 0);
- args = _tmp0_;
+ args = our_g_value_array_new ();
_tmp1_ = expression;
- _tmp2_ = args;
- _tmp3_ = rygel_media_export_media_cache_translate_search_expression (self, _tmp1_, _tmp2_, "WHERE", &_inner_error_);
+ _tmp3_ = rygel_media_export_media_cache_translate_search_expression (self, _tmp1_, args, "WHERE", &_inner_error_);
filter = _tmp3_;
if (_inner_error_ != NULL) {
g_propagate_error (error, _inner_error_);
- _g_value_array_free0 (args);
+ g_array_unref (args);
return NULL;
}
_tmp4_ = expression;
@@ -976,34 +989,32 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_search_expressi
_tmp10_ = rygel_media_export_media_cache_modify_limit (self, _tmp9_);
max_objects = _tmp10_;
_tmp11_ = filter;
- _tmp12_ = args;
_tmp13_ = container_id;
- _tmp14_ = rygel_media_export_media_cache_get_object_count_by_filter (self, _tmp11_, _tmp12_, _tmp13_, &_inner_error_);
+ _tmp14_ = rygel_media_export_media_cache_get_object_count_by_filter (self, _tmp11_, args, _tmp13_, &_inner_error_);
_tmp15_ = _tmp14_;
if (_inner_error_ != NULL) {
g_propagate_error (error, _inner_error_);
g_free (filter);
- _g_value_array_free0 (args);
+ g_array_unref (args);
return NULL;
}
_vala_total_matches = (guint) _tmp15_;
_tmp16_ = filter;
- _tmp17_ = args;
_tmp18_ = container_id;
_tmp19_ = sort_criteria;
_tmp20_ = offset;
_tmp21_ = max_objects;
- _tmp22_ = rygel_media_export_media_cache_get_objects_by_filter (self, _tmp16_, _tmp17_, _tmp18_, _tmp19_, (glong) _tmp20_, (glong) _tmp21_, &_inner_error_);
+ _tmp22_ = rygel_media_export_media_cache_get_objects_by_filter (self, _tmp16_, args, _tmp18_, _tmp19_, (glong) _tmp20_, (glong) _tmp21_, &_inner_error_);
_tmp23_ = _tmp22_;
if (_inner_error_ != NULL) {
g_propagate_error (error, _inner_error_);
g_free (filter);
- _g_value_array_free0 (args);
+ g_array_unref (args);
return NULL;
}
result = _tmp23_;
g_free (filter);
- _g_value_array_free0 (args);
+ g_array_unref (args);
if (total_matches) {
*total_matches = _vala_total_matches;
}
@@ -1029,29 +1040,24 @@ static void _vala_GValue_free (GValue* self) {
glong rygel_media_export_media_cache_get_object_count_by_search_expression (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, const gchar* container_id, GError** error) {
glong result = 0L;
- GValueArray* _tmp0_;
- GValueArray* args;
+ GArray *args;
RygelSearchExpression* _tmp1_;
- GValueArray* _tmp2_;
gchar* _tmp3_ = NULL;
gchar* filter;
RygelSearchExpression* _tmp4_;
const gchar* _tmp29_;
- GValueArray* _tmp30_;
const gchar* _tmp31_;
glong _tmp32_ = 0L;
glong _tmp33_;
GError * _inner_error_ = NULL;
g_return_val_if_fail (self != NULL, 0L);
- _tmp0_ = g_value_array_new ((guint) 0);
- args = _tmp0_;
+ args = our_g_value_array_new ();
_tmp1_ = expression;
- _tmp2_ = args;
- _tmp3_ = rygel_media_export_media_cache_translate_search_expression (self, _tmp1_, _tmp2_, "WHERE", &_inner_error_);
+ _tmp3_ = rygel_media_export_media_cache_translate_search_expression (self, _tmp1_, args, "WHERE", &_inner_error_);
filter = _tmp3_;
if (_inner_error_ != NULL) {
g_propagate_error (error, _inner_error_);
- _g_value_array_free0 (args);
+ g_array_unref (args);
return 0L;
}
_tmp4_ = expression;
@@ -1077,9 +1083,7 @@ glong rygel_media_export_media_cache_get_object_count_by_search_expression (Ryge
while (TRUE) {
gboolean _tmp10_;
gint _tmp12_;
- GValueArray* _tmp13_;
guint _tmp14_;
- GValueArray* _tmp15_;
gint _tmp16_;
GValue* _tmp17_ = NULL;
GValue* _tmp18_;
@@ -1097,14 +1101,12 @@ glong rygel_media_export_media_cache_get_object_count_by_search_expression (Ryge
}
_tmp9_ = FALSE;
_tmp12_ = i;
- _tmp13_ = args;
- _tmp14_ = _tmp13_->n_values;
+ _tmp14_ = args->len;
if (!(((guint) _tmp12_) < _tmp14_)) {
break;
}
- _tmp15_ = args;
_tmp16_ = i;
- _tmp17_ = g_value_array_get_nth (_tmp15_, (guint) _tmp16_);
+ _tmp17_ = &our_g_array_index (args, (guint) _tmp16_);
_tmp18_ = __g_value_dup0 (_tmp17_);
arg = _tmp18_;
_tmp20_ = arg;
@@ -1135,27 +1137,24 @@ glong rygel_media_export_media_cache_get_object_count_by_search_expression (Ryge
}
}
_tmp29_ = filter;
- _tmp30_ = args;
_tmp31_ = container_id;
- _tmp32_ = rygel_media_export_media_cache_get_object_count_by_filter (self, _tmp29_, _tmp30_, _tmp31_, &_inner_error_);
+ _tmp32_ = rygel_media_export_media_cache_get_object_count_by_filter (self, _tmp29_, args, _tmp31_, &_inner_error_);
_tmp33_ = _tmp32_;
if (_inner_error_ != NULL) {
g_propagate_error (error, _inner_error_);
g_free (filter);
- _g_value_array_free0 (args);
+ g_array_unref (args);
return 0L;
}
result = _tmp33_;
g_free (filter);
- _g_value_array_free0 (args);
+ g_array_unref (args);
return result;
}
-glong rygel_media_export_media_cache_get_object_count_by_filter (RygelMediaExportMediaCache* self, const gchar* filter, GValueArray* args, const gchar* container_id, GError** error) {
+glong rygel_media_export_media_cache_get_object_count_by_filter (RygelMediaExportMediaCache* self, const gchar* filter, GArray* args, const gchar* container_id, GError** error) {
glong result = 0L;
- const gchar* _tmp0_;
- GValueArray* _tmp5_;
guint _tmp6_;
const gchar* pattern = NULL;
RygelMediaExportSQLString string_id = 0;
@@ -1167,7 +1166,6 @@ glong rygel_media_export_media_cache_get_object_count_by_filter (RygelMediaExpor
const gchar* _tmp12_;
gchar* _tmp13_ = NULL;
gchar* _tmp14_;
- GValueArray* _tmp15_;
GValue* _tmp16_;
gint _tmp16__length1;
gint _tmp17_ = 0;
@@ -1177,24 +1175,14 @@ glong rygel_media_export_media_cache_get_object_count_by_filter (RygelMediaExpor
g_return_val_if_fail (self != NULL, 0L);
g_return_val_if_fail (filter != NULL, 0L);
g_return_val_if_fail (args != NULL, 0L);
- _tmp0_ = container_id;
- if (_tmp0_ != NULL) {
- const gchar* _tmp1_;
- GValue _tmp2_ = {0};
- GValue v;
- GValueArray* _tmp3_;
- GValue _tmp4_;
- _tmp1_ = container_id;
- g_value_init (&_tmp2_, G_TYPE_STRING);
- g_value_set_string (&_tmp2_, _tmp1_);
- v = _tmp2_;
- _tmp3_ = args;
- _tmp4_ = v;
- g_value_array_prepend (_tmp3_, &_tmp4_);
- G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
+ if (container_id != NULL) {
+ GValue v = G_VALUE_INIT;
+
+ g_value_init (&v, G_TYPE_STRING);
+ g_value_set_string (&v, container_id);
+ g_array_prepend_val (args, v);
}
- _tmp5_ = args;
- _tmp6_ = _tmp5_->n_values;
+ _tmp6_ = args->len;
g_debug ("rygel-media-export-media-cache.vala:269: Parameters to bind: %u", _tmp6_);
_tmp7_ = container_id;
if (_tmp7_ != NULL) {
@@ -1210,9 +1198,8 @@ glong rygel_media_export_media_cache_get_object_count_by_filter (RygelMediaExpor
_tmp12_ = filter;
_tmp13_ = g_strdup_printf (pattern, _tmp12_);
_tmp14_ = _tmp13_;
- _tmp15_ = args;
- _tmp16_ = _tmp15_->values;
- _tmp16__length1 = (gint) _tmp15_->n_values;
+ _tmp16_ = (GValue *) args->data;
+ _tmp16__length1 = (gint) args->len;
_tmp17_ = rygel_media_export_database_query_value (_tmp11_, _tmp14_, _tmp16_, _tmp16__length1, &_inner_error_);
_tmp18_ = _tmp17_;
g_free (_tmp14_);
@@ -1226,21 +1213,13 @@ glong rygel_media_export_media_cache_get_object_count_by_filter (RygelMediaExpor
}
-RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMediaExportMediaCache* self, const gchar* filter, GValueArray* args, const gchar* container_id, const gchar* sort_criteria, glong offset, glong max_count, GError** error) {
+RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMediaExportMediaCache* self, const gchar* filter, GArray* args, const gchar* container_id, const gchar* sort_criteria, glong offset, glong max_count, GError** error) {
RygelMediaObjects* result = NULL;
RygelMediaObjects* _tmp0_;
RygelMediaObjects* children;
glong _tmp1_;
- GValue _tmp2_ = {0};
GValue v;
- GValueArray* _tmp3_;
- GValue _tmp4_;
- glong _tmp5_;
- GValue _tmp6_ = {0};
- GValueArray* _tmp7_;
- GValue _tmp8_;
RygelMediaContainer* parent;
- GValueArray* _tmp9_;
guint _tmp10_;
const gchar* sql = NULL;
const gchar* _tmp31_;
@@ -1253,7 +1232,6 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMe
const gchar* _tmp41_;
gchar* _tmp42_ = NULL;
gchar* _tmp43_;
- GValueArray* _tmp44_;
GValue* _tmp45_;
gint _tmp45__length1;
RygelMediaExportDatabaseCursor* _tmp46_ = NULL;
@@ -1267,23 +1245,16 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMe
_tmp0_ = rygel_media_objects_new ();
children = _tmp0_;
_tmp1_ = offset;
- g_value_init (&_tmp2_, G_TYPE_LONG);
- g_value_set_long (&_tmp2_, _tmp1_);
- v = _tmp2_;
- _tmp3_ = args;
- _tmp4_ = v;
- g_value_array_append (_tmp3_, &_tmp4_);
- _tmp5_ = max_count;
- g_value_init (&_tmp6_, G_TYPE_LONG);
- g_value_set_long (&_tmp6_, _tmp5_);
- G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
- v = _tmp6_;
- _tmp7_ = args;
- _tmp8_ = v;
- g_value_array_append (_tmp7_, &_tmp8_);
+ g_value_init (&v, G_TYPE_LONG);
+ g_value_set_long (&v, _tmp1_);
+ g_array_append_val (args, v);
+ our_g_value_clear (&v);
+ g_value_init (&v, G_TYPE_LONG);
+ g_value_set_long (&v, max_count);
+ g_array_append_val (args, v);
+ our_g_value_clear (&v);
parent = NULL;
- _tmp9_ = args;
- _tmp10_ = _tmp9_->n_values;
+ _tmp10_ = args->len;
g_debug ("rygel-media-export-media-cache.vala:296: Parameters to bind: %u", _tmp10_);
{
gint i;
@@ -1294,9 +1265,7 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMe
while (TRUE) {
gboolean _tmp12_;
gint _tmp14_;
- GValueArray* _tmp15_;
guint _tmp16_;
- GValueArray* _tmp17_;
gint _tmp18_;
GValue* _tmp19_ = NULL;
GValue* _tmp20_;
@@ -1314,14 +1283,12 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMe
}
_tmp11_ = FALSE;
_tmp14_ = i;
- _tmp15_ = args;
- _tmp16_ = _tmp15_->n_values;
+ _tmp16_ = args->len;
if (!(((guint) _tmp14_) < _tmp16_)) {
break;
}
- _tmp17_ = args;
_tmp18_ = i;
- _tmp19_ = g_value_array_get_nth (_tmp17_, (guint) _tmp18_);
+ _tmp19_ = &our_g_array_index (args, (guint) _tmp18_);
_tmp20_ = __g_value_dup0 (_tmp19_);
arg = _tmp20_;
_tmp22_ = arg;
@@ -1374,9 +1341,8 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMe
_tmp41_ = sort_order;
_tmp42_ = g_strdup_printf (_tmp39_, _tmp40_, _tmp41_);
_tmp43_ = _tmp42_;
- _tmp44_ = args;
- _tmp45_ = _tmp44_->values;
- _tmp45__length1 = (gint) _tmp44_->n_values;
+ _tmp45_ = (GValue *) args->data;
+ _tmp45__length1 = (gint) args->len;
_tmp46_ = rygel_media_export_database_exec_cursor (_tmp38_, _tmp43_, _tmp45_, _tmp45__length1, &_inner_error_);
_tmp47_ = _tmp46_;
g_free (_tmp43_);
@@ -1385,7 +1351,6 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMe
g_propagate_error (error, _inner_error_);
g_free (sort_order);
g_object_unref (parent);
- G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
g_object_unref (children);
return NULL;
}
@@ -1412,7 +1377,6 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMe
g_object_unref (cursor);
g_free (sort_order);
g_object_unref (parent);
- G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
g_object_unref (children);
return NULL;
}
@@ -1484,7 +1448,6 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMe
g_object_unref (cursor);
g_free (sort_order);
g_object_unref (parent);
- G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
return result;
}
@@ -1632,17 +1595,10 @@ GeeArrayList* rygel_media_export_media_cache_get_child_ids (RygelMediaExportMedi
}
-GeeList* rygel_media_export_media_cache_get_meta_data_column_by_filter (RygelMediaExportMediaCache* self, const gchar* column, const gchar* filter, GValueArray* args, glong offset, glong max_count, GError** error) {
+GeeList* rygel_media_export_media_cache_get_meta_data_column_by_filter (RygelMediaExportMediaCache* self, const gchar* column, const gchar* filter, GArray* args, glong offset, glong max_count, GError** error) {
GeeList* result = NULL;
glong _tmp0_;
- GValue _tmp1_ = {0};
GValue v;
- GValueArray* _tmp2_;
- GValue _tmp3_;
- glong _tmp4_;
- GValue _tmp5_ = {0};
- GValueArray* _tmp6_;
- GValue _tmp7_;
GeeArrayList* _tmp8_;
GeeArrayList* data;
RygelMediaExportSQLFactory* _tmp9_;
@@ -1654,7 +1610,6 @@ GeeList* rygel_media_export_media_cache_get_meta_data_column_by_filter (RygelMed
const gchar* _tmp14_;
gchar* _tmp15_ = NULL;
gchar* _tmp16_;
- GValueArray* _tmp17_;
GValue* _tmp18_;
gint _tmp18__length1;
RygelMediaExportDatabaseCursor* _tmp19_ = NULL;
@@ -1666,20 +1621,14 @@ GeeList* rygel_media_export_media_cache_get_meta_data_column_by_filter (RygelMed
g_return_val_if_fail (filter != NULL, NULL);
g_return_val_if_fail (args != NULL, NULL);
_tmp0_ = offset;
- g_value_init (&_tmp1_, G_TYPE_LONG);
- g_value_set_long (&_tmp1_, _tmp0_);
- v = _tmp1_;
- _tmp2_ = args;
- _tmp3_ = v;
- g_value_array_append (_tmp2_, &_tmp3_);
- _tmp4_ = max_count;
- g_value_init (&_tmp5_, G_TYPE_LONG);
- g_value_set_long (&_tmp5_, _tmp4_);
- G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
- v = _tmp5_;
- _tmp6_ = args;
- _tmp7_ = v;
- g_value_array_append (_tmp6_, &_tmp7_);
+ g_value_init (&v, G_TYPE_LONG);
+ g_value_set_long (&v, _tmp0_);
+ g_array_append_val (args, v);
+ our_g_value_clear (&v);
+ g_value_init (&v, G_TYPE_LONG);
+ g_value_set_long (&v, max_count);
+ g_array_append_val (args, v);
+ our_g_value_clear (&v);
_tmp8_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
data = _tmp8_;
_tmp9_ = self->priv->sql;
@@ -1691,9 +1640,8 @@ GeeList* rygel_media_export_media_cache_get_meta_data_column_by_filter (RygelMed
_tmp14_ = filter;
_tmp15_ = g_strdup_printf (_tmp12_, _tmp13_, _tmp14_);
_tmp16_ = _tmp15_;
- _tmp17_ = args;
- _tmp18_ = _tmp17_->values;
- _tmp18__length1 = (gint) _tmp17_->n_values;
+ _tmp18_ = (GValue *) args->data;
+ _tmp18__length1 = (gint) args->len;
_tmp19_ = rygel_media_export_database_exec_cursor (_tmp11_, _tmp16_, _tmp18_, _tmp18__length1, &_inner_error_);
_tmp20_ = _tmp19_;
g_free (_tmp16_);
@@ -1701,7 +1649,6 @@ GeeList* rygel_media_export_media_cache_get_meta_data_column_by_filter (RygelMed
if (_inner_error_ != NULL) {
g_propagate_error (error, _inner_error_);
g_object_unref (data);
- G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
return NULL;
}
{
@@ -1722,7 +1669,6 @@ GeeList* rygel_media_export_media_cache_get_meta_data_column_by_filter (RygelMed
g_propagate_error (error, _inner_error_);
g_object_unref (cursor);
g_object_unref (data);
- G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
return NULL;
}
_tmp27_ = data;
@@ -1733,17 +1679,14 @@ GeeList* rygel_media_export_media_cache_get_meta_data_column_by_filter (RygelMed
}
result = (GeeList*) data;
g_object_unref (cursor);
- G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
return result;
}
GeeList* rygel_media_export_media_cache_get_object_attribute_by_search_expression (RygelMediaExportMediaCache* self, const gchar* attribute, RygelSearchExpression* expression, glong offset, guint max_count, GError** error) {
GeeList* result = NULL;
- GValueArray* _tmp0_;
- GValueArray* args;
+ GArray* args;
RygelSearchExpression* _tmp1_;
- GValueArray* _tmp2_;
gchar* _tmp3_ = NULL;
gchar* filter;
const gchar* _tmp4_;
@@ -1755,7 +1698,6 @@ GeeList* rygel_media_export_media_cache_get_object_attribute_by_search_expressio
guint max_objects;
const gchar* _tmp9_;
const gchar* _tmp10_;
- GValueArray* _tmp11_;
glong _tmp12_;
guint _tmp13_;
GeeList* _tmp14_ = NULL;
@@ -1763,15 +1705,13 @@ GeeList* rygel_media_export_media_cache_get_object_attribute_by_search_expressio
GError * _inner_error_ = NULL;
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (attribute != NULL, NULL);
- _tmp0_ = g_value_array_new ((guint) 0);
- args = _tmp0_;
+ args = our_g_value_array_new ();
_tmp1_ = expression;
- _tmp2_ = args;
- _tmp3_ = rygel_media_export_media_cache_translate_search_expression (self, _tmp1_, _tmp2_, "AND", &_inner_error_);
+ _tmp3_ = rygel_media_export_media_cache_translate_search_expression (self, _tmp1_, args, "AND", &_inner_error_);
filter = _tmp3_;
if (_inner_error_ != NULL) {
g_propagate_error (error, _inner_error_);
- _g_value_array_free0 (args);
+ g_array_unref (args);
return NULL;
}
_tmp4_ = filter;
@@ -1782,7 +1722,7 @@ GeeList* rygel_media_export_media_cache_get_object_attribute_by_search_expressio
if (_inner_error_ != NULL) {
g_propagate_error (error, _inner_error_);
g_free (filter);
- _g_value_array_free0 (args);
+ g_array_unref (args);
return NULL;
}
_tmp7_ = max_count;
@@ -1790,22 +1730,21 @@ GeeList* rygel_media_export_media_cache_get_object_attribute_by_search_expressio
max_objects = _tmp8_;
_tmp9_ = column;
_tmp10_ = filter;
- _tmp11_ = args;
_tmp12_ = offset;
_tmp13_ = max_objects;
- _tmp14_ = rygel_media_export_media_cache_get_meta_data_column_by_filter (self, _tmp9_, _tmp10_, _tmp11_, _tmp12_, (glong) _tmp13_, &_inner_error_);
+ _tmp14_ = rygel_media_export_media_cache_get_meta_data_column_by_filter (self, _tmp9_, _tmp10_, args, _tmp12_, (glong) _tmp13_, &_inner_error_);
_tmp15_ = _tmp14_;
if (_inner_error_ != NULL) {
g_propagate_error (error, _inner_error_);
g_free (column);
g_free (filter);
- _g_value_array_free0 (args);
+ g_array_unref (args);
return NULL;
}
result = _tmp15_;
g_free (column);
g_free (filter);
- _g_value_array_free0 (args);
+ g_array_unref (args);
return result;
}
@@ -3107,11 +3046,10 @@ static void rygel_media_export_media_cache_fill_item (RygelMediaExportMediaCache
}
-static gchar* rygel_media_export_media_cache_translate_search_expression (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, GValueArray* args, const gchar* prefix, GError** error) {
+static gchar* rygel_media_export_media_cache_translate_search_expression (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, GArray* args, const gchar* prefix, GError** error) {
gchar* result = NULL;
RygelSearchExpression* _tmp0_;
RygelSearchExpression* _tmp2_;
- GValueArray* _tmp3_;
gchar* _tmp4_ = NULL;
gchar* filter;
const gchar* _tmp5_;
@@ -3129,8 +3067,7 @@ static gchar* rygel_media_export_media_cache_translate_search_expression (RygelM
return result;
}
_tmp2_ = expression;
- _tmp3_ = args;
- _tmp4_ = rygel_media_export_media_cache_search_expression_to_sql (self, _tmp2_, _tmp3_, &_inner_error_);
+ _tmp4_ = rygel_media_export_media_cache_search_expression_to_sql (self, _tmp2_, args, &_inner_error_);
filter = _tmp4_;
if (_inner_error_ != NULL) {
g_propagate_error (error, _inner_error_);
@@ -3145,7 +3082,7 @@ static gchar* rygel_media_export_media_cache_translate_search_expression (RygelM
}
-static gchar* rygel_media_export_media_cache_search_expression_to_sql (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, GValueArray* args, GError** error) {
+static gchar* rygel_media_export_media_cache_search_expression_to_sql (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, GArray* args, GError** error) {
gchar* result = NULL;
RygelSearchExpression* _tmp0_;
RygelSearchExpression* _tmp2_;
@@ -3162,12 +3099,10 @@ static gchar* rygel_media_export_media_cache_search_expression_to_sql (RygelMedi
_tmp2_ = expression;
if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, RYGEL_TYPE_LOGICAL_EXPRESSION)) {
RygelSearchExpression* _tmp3_;
- GValueArray* _tmp4_;
gchar* _tmp5_ = NULL;
gchar* _tmp6_;
_tmp3_ = expression;
- _tmp4_ = args;
- _tmp5_ = rygel_media_export_media_cache_logical_expression_to_sql (self, G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, RYGEL_TYPE_LOGICAL_EXPRESSION) ? ((RygelLogicalExpression*) _tmp3_) : NULL, _tmp4_, &_inner_error_);
+ _tmp5_ = rygel_media_export_media_cache_logical_expression_to_sql (self, G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, RYGEL_TYPE_LOGICAL_EXPRESSION) ? ((RygelLogicalExpression*) _tmp3_) : NULL, args, &_inner_error_);
_tmp6_ = _tmp5_;
if (_inner_error_ != NULL) {
g_propagate_error (error, _inner_error_);
@@ -3177,12 +3112,10 @@ static gchar* rygel_media_export_media_cache_search_expression_to_sql (RygelMedi
return result;
} else {
RygelSearchExpression* _tmp7_;
- GValueArray* _tmp8_;
gchar* _tmp9_ = NULL;
gchar* _tmp10_;
_tmp7_ = expression;
- _tmp8_ = args;
- _tmp9_ = rygel_media_export_media_cache_relational_expression_to_sql (self, G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, RYGEL_TYPE_RELATIONAL_EXPRESSION) ? ((RygelRelationalExpression*) _tmp7_) : NULL, _tmp8_, &_inner_error_);
+ _tmp9_ = rygel_media_export_media_cache_relational_expression_to_sql (self, G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, RYGEL_TYPE_RELATIONAL_EXPRESSION) ? ((RygelRelationalExpression*) _tmp7_) : NULL, args, &_inner_error_);
_tmp10_ = _tmp9_;
if (_inner_error_ != NULL) {
g_propagate_error (error, _inner_error_);
@@ -3194,16 +3127,14 @@ static gchar* rygel_media_export_media_cache_search_expression_to_sql (RygelMedi
}
-static gchar* rygel_media_export_media_cache_logical_expression_to_sql (RygelMediaExportMediaCache* self, RygelLogicalExpression* expression, GValueArray* args, GError** error) {
+static gchar* rygel_media_export_media_cache_logical_expression_to_sql (RygelMediaExportMediaCache* self, RygelLogicalExpression* expression, GArray* args, GError** error) {
gchar* result = NULL;
RygelLogicalExpression* _tmp0_;
gconstpointer _tmp1_;
- GValueArray* _tmp2_;
gchar* _tmp3_ = NULL;
gchar* left_sql_string;
RygelLogicalExpression* _tmp4_;
gconstpointer _tmp5_;
- GValueArray* _tmp6_;
gchar* _tmp7_ = NULL;
gchar* right_sql_string;
gchar* _tmp8_;
@@ -3219,8 +3150,7 @@ static gchar* rygel_media_export_media_cache_logical_expression_to_sql (RygelMed
g_return_val_if_fail (args != NULL, NULL);
_tmp0_ = expression;
_tmp1_ = ((RygelSearchExpression*) _tmp0_)->operand1;
- _tmp2_ = args;
- _tmp3_ = rygel_media_export_media_cache_search_expression_to_sql (self, (RygelSearchExpression*) _tmp1_, _tmp2_, &_inner_error_);
+ _tmp3_ = rygel_media_export_media_cache_search_expression_to_sql (self, (RygelSearchExpression*) _tmp1_, args, &_inner_error_);
left_sql_string = _tmp3_;
if (_inner_error_ != NULL) {
g_propagate_error (error, _inner_error_);
@@ -3228,8 +3158,7 @@ static gchar* rygel_media_export_media_cache_logical_expression_to_sql (RygelMed
}
_tmp4_ = expression;
_tmp5_ = ((RygelSearchExpression*) _tmp4_)->operand2;
- _tmp6_ = args;
- _tmp7_ = rygel_media_export_media_cache_search_expression_to_sql (self, (RygelSearchExpression*) _tmp5_, _tmp6_, &_inner_error_);
+ _tmp7_ = rygel_media_export_media_cache_search_expression_to_sql (self, (RygelSearchExpression*) _tmp5_, args, &_inner_error_);
right_sql_string = _tmp7_;
if (_inner_error_ != NULL) {
g_propagate_error (error, _inner_error_);
@@ -3481,7 +3410,7 @@ static gchar* rygel_media_export_media_cache_map_operand_to_column (RygelMediaEx
}
-static gchar* rygel_media_export_media_cache_relational_expression_to_sql (RygelMediaExportMediaCache* self, RygelRelationalExpression* exp, GValueArray* args, GError** error) {
+static gchar* rygel_media_export_media_cache_relational_expression_to_sql (RygelMediaExportMediaCache* self, RygelRelationalExpression* exp, GArray* args, GError** error) {
gchar* result = NULL;
GValue* v;
gchar* collate;
@@ -3660,13 +3589,7 @@ static gchar* rygel_media_export_media_cache_relational_expression_to_sql (Rygel
}
_tmp40_ = v;
if (_tmp40_ != NULL) {
- GValueArray* _tmp41_;
- GValue* _tmp42_;
- GValue _tmp43_;
- _tmp41_ = args;
- _tmp42_ = v;
- _tmp43_ = *_tmp42_;
- g_value_array_append (_tmp41_, &_tmp43_);
+ g_array_append_val (args, *v);
}
_tmp44_ = operator;
_tmp45_ = rygel_media_export_sql_operator_to_string (_tmp44_);
diff --git a/src/media-export/rygel-media-export-media-cache.h b/src/media-export/rygel-media-export-media-cache.h
index cb28122..605384d 100644
--- a/src/media-export/rygel-media-export-media-cache.h
+++ b/src/media-export/rygel-media-export-media-cache.h
@@ -125,14 +125,14 @@ rygel_media_export_media_cache_get_objects_by_search_expression (RygelMediaExpor
glong
rygel_media_export_media_cache_get_object_count_by_filter (RygelMediaExportMediaCache *self,
const gchar *filter,
- GValueArray *args,
+ GArray *args,
const gchar *container_id,
GError **error);
RygelMediaObjects *
rygel_media_export_media_cache_get_objects_by_filter (RygelMediaExportMediaCache *self,
const gchar *filter,
- GValueArray *args,
+ GArray *args,
const gchar *container_id,
const gchar *sort_criteria,
glong offset,
@@ -157,7 +157,7 @@ GeeList *
rygel_media_export_media_cache_get_meta_data_column_by_filter (RygelMediaExportMediaCache *self,
const gchar *column,
const gchar *filter,
- GValueArray *args,
+ GArray *args,
glong offset,
glong max_count,
GError **error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]