diff options
author | Takamichi Horikawa <takamichiho@gmail.com> | 2017-03-30 21:31:45 +0900 |
---|---|---|
committer | Takamichi Horikawa <takamichiho@gmail.com> | 2017-03-30 21:31:45 +0900 |
commit | 49dcbbb9ed087c7823bcb70cf781e00f75a8cfec (patch) | |
tree | f0ec70c56aa076957dc5be578af3c3be0cf2f270 /common/fmplayer_file_gio.c | |
parent | 2f4cb518649c157c4b898434e46e0dc8cb5cf30b (diff) |
gio: use older interface to enumerate files
Diffstat (limited to 'common/fmplayer_file_gio.c')
-rw-r--r-- | common/fmplayer_file_gio.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/common/fmplayer_file_gio.c b/common/fmplayer_file_gio.c index 053e4ae..5e9dd84 100644 --- a/common/fmplayer_file_gio.c +++ b/common/fmplayer_file_gio.c @@ -79,7 +79,8 @@ void *fmplayer_fileread(const void *pathptr, const char *pcmname, const char *ex goto err; } direnum = g_file_enumerate_children(dir, - G_FILE_ATTRIBUTE_STANDARD_NAME, + G_FILE_ATTRIBUTE_STANDARD_NAME "," + G_FILE_ATTRIBUTE_STANDARD_TARGET_URI, G_FILE_QUERY_INFO_NONE, 0, 0); if (!direnum) { @@ -87,24 +88,24 @@ void *fmplayer_fileread(const void *pathptr, const char *pcmname, const char *ex goto err; } for (;;) { - GFileInfo *info; - GFile *pcmfile; - if (!g_file_enumerator_iterate(direnum, &info, &pcmfile, 0, 0)) { - if (error) *error = FMPLAYER_FILE_ERR_FILEIO; - goto err; - } - if (!info || !pcmfile) { + GFileInfo *info = g_file_enumerator_next_file(direnum, 0, 0); + if (!info) { if (error) *error = FMPLAYER_FILE_ERR_FILEIO; goto err; } + GFile *pcmfile = g_file_enumerator_get_child(direnum, info); if (!strcasecmp(g_file_info_get_name(info), pcmname)) { void *buf = fileread(pcmfile, maxsize, filesize, error); + g_object_unref(G_OBJECT(pcmfile)); + g_object_unref(G_OBJECT(info)); g_object_unref(G_OBJECT(direnum)); g_object_unref(G_OBJECT(dir)); g_object_unref(G_OBJECT(file)); free(pcmnamebuf); return buf; } + g_object_unref(G_OBJECT(pcmfile)); + g_object_unref(G_OBJECT(info)); } if (error) *error = FMPLAYER_FILE_ERR_FILEIO; err: |