[glib] xdgmime - support cache files with minor version 2
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glib] xdgmime - support cache files with minor version 2
- Date: Fri, 2 Oct 2009 13:34:25 +0000 (UTC)
commit 7c27df1feeea1d6ab8b927285cecc4ac34db8b06
Author: Alexander Larsson <alexl redhat com>
Date: Fri Oct 2 09:48:35 2009 +0200
xdgmime - support cache files with minor version 2
gio/xdgmime/xdgmimecache.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gio/xdgmime/xdgmimecache.c b/gio/xdgmime/xdgmimecache.c
index 5bdac5b..0f2d83a 100644
--- a/gio/xdgmime/xdgmimecache.c
+++ b/gio/xdgmime/xdgmimecache.c
@@ -73,11 +73,13 @@
#endif
#define MAJOR_VERSION 1
-#define MINOR_VERSION 1
+#define MINOR_VERSION_MIN 1
+#define MINOR_VERSION_MAX 2
struct _XdgMimeCache
{
int ref_count;
+ int minor;
size_t size;
char *buffer;
@@ -116,6 +118,7 @@ _xdg_mime_cache_new_from_file (const char *file_name)
int fd = -1;
struct stat st;
char *buffer = NULL;
+ int minor;
/* Open the file and map it into memory */
fd = open (file_name, O_RDONLY|_O_BINARY, 0);
@@ -131,9 +134,11 @@ _xdg_mime_cache_new_from_file (const char *file_name)
if (buffer == MAP_FAILED)
goto done;
+ minor = GET_UINT16 (buffer, 2);
/* Verify version */
if (GET_UINT16 (buffer, 0) != MAJOR_VERSION ||
- GET_UINT16 (buffer, 2) != MINOR_VERSION)
+ (minor < MINOR_VERSION_MIN ||
+ minor > MINOR_VERSION_MAX))
{
munmap (buffer, st.st_size);
@@ -141,6 +146,7 @@ _xdg_mime_cache_new_from_file (const char *file_name)
}
cache = (XdgMimeCache *) malloc (sizeof (XdgMimeCache));
+ cache->minor = minor;
cache->ref_count = 1;
cache->buffer = buffer;
cache->size = st.st_size;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]