[libgxps] Add helper function to check if a given path is part of the archive
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgxps] Add helper function to check if a given path is part of the archive
- Date: Fri, 21 Dec 2012 11:10:51 +0000 (UTC)
commit ed45f6093a8375d3d7d2d7dfab6c4a8a7ca91031
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Fri Dec 21 10:44:28 2012 +0100
Add helper function to check if a given path is part of the archive
libgxps/gxps-archive.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/libgxps/gxps-archive.c b/libgxps/gxps-archive.c
index b63efe2..dec6064 100644
--- a/libgxps/gxps-archive.c
+++ b/libgxps/gxps-archive.c
@@ -284,6 +284,13 @@ gxps_archive_new (GFile *filename,
NULL);
}
+static inline gboolean
+archive_has_entry (GXPSArchive *archive,
+ const gchar *path)
+{
+ return g_list_find_custom (archive->entries, path, (GCompareFunc)g_ascii_strcasecmp) != NULL;
+}
+
gboolean
gxps_archive_has_entry (GXPSArchive *archive,
const gchar *path)
@@ -291,7 +298,7 @@ gxps_archive_has_entry (GXPSArchive *archive,
if (path && path[0] == '/')
path++;
- return g_list_find_custom (archive->entries, path, (GCompareFunc)g_ascii_strcasecmp) != NULL;
+ return archive_has_entry (archive, path);
}
/* GXPSArchiveInputStream */
@@ -323,8 +330,8 @@ gxps_archive_open (GXPSArchive *archive,
if (path && path[0] == '/')
path++;
- if (!g_list_find_custom (archive->entries, path, (GCompareFunc)g_ascii_strcasecmp))
- return NULL;
+ if (!archive_has_entry (archive, path))
+ return NULL;
stream = (GXPSArchiveInputStream *)g_object_new (GXPS_TYPE_ARCHIVE_INPUT_STREAM, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]