if (only_geometry) continue;
/* Read filenames */
- buf = quoted_value(p, NULL);
- if (buf)
+ while (*p && *p != '"') p++;
+ if (*p) p++;
+ buf = p;
+ while (*p && *p != '"') p++;
+ *p = 0;
+ if (*buf)
{
gint valid;
valid = (buf[0] == G_DIR_SEPARATOR && collection_add_check(cd, file_data_new_simple(buf), FALSE, TRUE));
if (!valid) DEBUG_1("collection invalid file: %s", buf);
- g_free(buf);
total++;
if (!valid)
}
}
- sidecar_ext_parse(options->sidecar.ext, FALSE); /* this must be updated after changed file extensions */
+ sidecar_ext_parse(options->sidecar.ext); /* this must be updated after changed file extensions */
}
static gboolean filter_name_find(GList *filter, const gchar *name)
sidecar_ext_list = NULL;
}
-void sidecar_ext_parse(const gchar *text, gboolean quoted)
+void sidecar_ext_parse(const gchar *text)
{
- gchar *value;
-
sidecar_ext_free_list();
+ if (text == NULL) return;
- if (quoted)
- value = quoted_value(text, NULL);
- else
- value = (gchar *) text;
-
- if (value == NULL) return;
-
- sidecar_ext_list = filter_to_list(value);
-
- if (quoted) g_free(value);
+ sidecar_ext_list = filter_to_list(text);
}
void filter_load_file_type(const gchar **attribute_names, const gchar **attribute_values);
-void sidecar_ext_parse(const gchar *text, gboolean quoted);
+void sidecar_ext_parse(const gchar *text);
gchar *sidecar_ext_to_string(void);
GList *sidecar_ext_get_list(void);
#endif
}
-/*
- returns text without quotes or NULL for empty or broken string
- any text up to first '"' is skipped
- tail is set to point at the char after the second '"'
- or at the ending \0
-
-*/
-
-gchar *quoted_value(const gchar *text, const gchar **tail)
-{
- const gchar *ptr;
- gint c = 0;
- gint l = strlen(text);
- gchar *retval = NULL;
-
- if (tail) *tail = text;
-
- if (l == 0) return retval;
-
- while (c < l && text[c] != '"') c++;
- if (text[c] == '"')
- {
- gint e;
- c++;
- ptr = text + c;
- e = c;
- while (e < l)
- {
- if (text[e-1] != '\\' && text[e] == '"') break;
- e++;
- }
- if (text[e] == '"')
- {
- if (e - c > 0)
- {
- gchar *substring = g_strndup(ptr, e - c);
-
- if (substring)
- {
- retval = g_strcompress(substring);
- g_free(substring);
- }
- }
- }
- if (tail) *tail = text + e + 1;
- }
- else
- /* for compatibility with older formats (<0.3.7)
- * read a line without quotes too */
- {
- c = 0;
- while (c < l && text[c] != '\n' && !g_ascii_isspace(text[c])) c++;
- if (c != 0)
- {
- retval = g_strndup(text, c);
- }
- if (tail) *tail = text + c;
- }
-
- return retval;
-}
-
-gchar *escquote_value(const gchar *text)
-{
- gchar *e;
-
- if (!text) return g_strdup("\"\"");
-
- e = g_strescape(text, "");
- if (e)
- {
- gchar *retval = g_strdup_printf("\"%s\"", e);
- g_free(e);
- return retval;
- }
- return g_strdup("\"\"");
-}
/* Run a command like system() but may output debug messages. */
int runcmd(gchar *cmd)
gchar *utf8_validate_or_convert(const gchar *text);
gint utf8_compare(const gchar *s1, const gchar *s2, gboolean case_sensitive);
gchar *expand_tilde(const gchar *filename);
-gchar *quoted_value(const gchar *text, const gchar **tail);
-gchar *escquote_value(const gchar *text);
int runcmd(gchar *cmd);
#endif /* MISC_H */
options->file_filter.disable = c_options->file_filter.disable;
config_entry_to_option(sidecar_ext_entry, &options->sidecar.ext, NULL);
- sidecar_ext_parse(options->sidecar.ext, FALSE);
+ sidecar_ext_parse(options->sidecar.ext);
options->slideshow.random = c_options->slideshow.random;
options->slideshow.repeat = c_options->slideshow.repeat;