Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/hierarchy-node.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,8 @@ static ValuedMetadataReference* parse_reference_to_metadata (const gchar *tag, x
}
else {
value = (gchar*) xmlGetProp (node, (xmlChar*) "query");

if (value != NULL) {
g_warning("found %s", value);
ref->involved = parse_reference_formula (value, &(ref->query));
}
else {
Expand Down Expand Up @@ -1428,8 +1428,8 @@ static GList* collect_children_from_filesystem (HierarchyNode *node, ItemHandler
n = scandir (path, &namelist, NULL, alphasort);
loop = gfuse_loop_get_current ();

for (i = 2; i < n; i++) {
if (namelist [i]->d_name == NULL)
for (i = 0; i < n; i++) {
if (namelist [i]->d_name == NULL || strcmp (namelist [i]->d_name, ".") || strcmp (namelist [i]->d_name, ".."))
continue;

item_path = g_build_filename (path, namelist [i]->d_name, NULL);
Expand Down Expand Up @@ -1469,8 +1469,8 @@ static GList* collect_children_from_filesystem (HierarchyNode *node, ItemHandler
free (namelist [i]);
}

if (namelist [1] != NULL ) free (namelist [1]);
free (namelist [0]);
free (namelist [1]);
free (namelist);

if (ret != NULL)
Expand Down
19 changes: 14 additions & 5 deletions src/item-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ static void flush_pending_metadata_to_save (ItemHandler *item, ...)
GVariantIter sub_sub_iter;
GError *error;
Property *prop;
GRegex *query_syntax;
gboolean is_query;


statements = NULL;
types = NULL;
va_start (params, item);
Expand All @@ -113,13 +116,20 @@ static void flush_pending_metadata_to_save (ItemHandler *item, ...)
break;

case PROPERTY_TYPE_RESOURCE:
stats = g_strdup_printf ("%s <%s>", (gchar*) key, (gchar*) value);
statements = g_list_prepend (statements, stats);
//FIXME supporting naif config in a better way
query_syntax = g_regex_new ("\\?.*", 0, 0, NULL);
is_query = g_regex_match(query_syntax, (gchar*) value, 0, NULL);
if(!is_query)
stats = g_strdup_printf ("%s <%s>", (gchar*) key, (gchar*) value);
else
stats = g_strdup_printf ("%s %s", (gchar*) key, (gchar*) value);
statements = g_list_prepend (statements, stats);
g_regex_unref (query_syntax);
break;

default:
stats = g_strdup_printf ("%s %s", (gchar*) key, (gchar*) value);
statements = g_list_prepend (statements, stats);
stats = g_strdup_printf ("%s %s", (gchar*) key, (gchar*) value);
statements = g_list_prepend (statements, stats);
break;
}
}
Expand Down Expand Up @@ -149,7 +159,6 @@ static void flush_pending_metadata_to_save (ItemHandler *item, ...)

error = NULL;
results = execute_update_blank (query, &error);


if (error != NULL) {
g_warning ("Error while saving metadata: %s", error->message);
Expand Down
2 changes: 1 addition & 1 deletion src/property.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ gchar* property_format_value (Property *property, const gchar *value)
ret = g_strdup_printf ("<%s>", value);
else
ret = g_strdup (value);
g_free(subject_format);
g_regex_unref (subject_format);
break;

case PROPERTY_TYPE_BOOLEAN:
Expand Down
2 changes: 1 addition & 1 deletion src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void execute_update (gchar *query, GError **error)
NULL,
error);

g_object_unref (ret);
g_variant_unref (ret);
}

GVariant* execute_update_blank (gchar *query, GError **error)
Expand Down