summaryrefslogtreecommitdiff
path: root/gtk/gtkiconcache.c
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2004-10-21 19:01:29 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-10-21 19:01:29 +0000
commit92b3cda495da1702abf82db39411981d76488f9c (patch)
tree43c9380155ffaf3b72722c1211feacf6ece19d9e /gtk/gtkiconcache.c
parenta34d841d7964cdf3cef591700ba3e8baaea4723d (diff)
downloadgtk+-92b3cda495da1702abf82db39411981d76488f9c.tar.gz
*** empty log message ***
Diffstat (limited to 'gtk/gtkiconcache.c')
-rw-r--r--gtk/gtkiconcache.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gtk/gtkiconcache.c b/gtk/gtkiconcache.c
index 5175787c7c..03f6f3bf44 100644
--- a/gtk/gtkiconcache.c
+++ b/gtk/gtkiconcache.c
@@ -24,7 +24,9 @@
#ifdef HAVE_MMAP
#include <sys/mman.h>
#endif
-
+#ifdef G_OS_WIN32
+#include <io.h>
+#endif
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
@@ -72,12 +74,13 @@ _gtk_icon_cache_unref (GtkIconCache *cache)
GtkIconCache *
_gtk_icon_cache_new_for_path (const gchar *path)
{
+ GtkIconCache *cache = NULL;
+#ifdef HAVE_MMAP
gchar *cache_filename;
gint fd;
struct stat st;
struct stat path_st;
- gchar *buffer = MAP_FAILED;
- GtkIconCache *cache = NULL;
+ gchar *buffer;
if (g_getenv ("GTK_NO_ICON_CACHE"))
return NULL;
@@ -114,9 +117,7 @@ _gtk_icon_cache_new_for_path (const gchar *path)
goto done;
}
-#ifdef HAVE_MMAP
buffer = (gchar *) mmap (NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
-#endif
if (buffer == MAP_FAILED)
goto done;
@@ -125,9 +126,7 @@ _gtk_icon_cache_new_for_path (const gchar *path)
if (GET_UINT16 (buffer, 0) != MAJOR_VERSION ||
GET_UINT16 (buffer, 2) != MINOR_VERSION)
{
-#ifdef HAVE_MMAP
munmap (buffer, st.st_size);
-#endif
GTK_NOTE (ICONTHEME,
g_print ("wrong cache version\n"));
goto done;
@@ -144,6 +143,8 @@ _gtk_icon_cache_new_for_path (const gchar *path)
g_free (cache_filename);
close (fd);
+#endif /* HAVE_MMAP */
+
return cache;
}