X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/469856bf9dec2656433baaa976b9af84d79769ae..c2cf03332f51a9fa992220124635f737399fba91:/src/thumbnails.c?ds=inline diff --git a/src/thumbnails.c b/src/thumbnails.c index 8b48dce6..40914049 100644 --- a/src/thumbnails.c +++ b/src/thumbnails.c @@ -55,7 +55,6 @@ #undef MIN /* quit yer whining, gcc */ #undef MAX -#include /* for realpath() */ #ifndef MAX /* We need MAX macro and some system does not offer it */ #define MAX(a,b) (((a)>(b))?(a):(b)) @@ -66,8 +65,6 @@ #ifdef WINDOWS #define THUMB_DIR "\\THUMBNAILS\\" /* viking maps default viking\maps */ #define THUMB_SUB_DIR "normal\\" -#define realpath(X,Y) _fullpath(Y,X,MAX_PATH) - #else #define THUMB_DIR "/.thumbnails/" #define THUMB_SUB_DIR "normal/" @@ -75,12 +72,7 @@ #define PIXMAP_THUMB_SIZE 128 -#ifndef MAXPATHLEN -#define MAXPATHLEN 1024 -#endif - static char *md5_hash(const char *message); -static char *pathdup(const char *path); static GdkPixbuf *save_thumbnail(const char *pathname, GdkPixbuf *full); static GdkPixbuf *child_create_thumbnail(const gchar *path); @@ -122,7 +114,7 @@ GdkPixbuf *a_thumbnails_scale_pixbuf(GdkPixbuf *src, int max_w, int max_h) if (w <= max_w && h <= max_h) { - gdk_pixbuf_ref(src); + g_object_ref ( G_OBJECT ( src ) ); return src; } else @@ -155,7 +147,7 @@ static GdkPixbuf *child_create_thumbnail(const gchar *path) if (image) { GdkPixbuf *thumb = save_thumbnail(path, image); - gdk_pixbuf_unref ( image ); + g_object_unref ( G_OBJECT ( image ) ); return thumb; } @@ -190,7 +182,7 @@ static GdkPixbuf *save_thumbnail(const char *pathname, GdkPixbuf *full) ssize = g_strdup_printf(ST_SIZE_FMT, info.st_size); smtime = g_strdup_printf("%ld", (long) info.st_mtime); - path = pathdup(pathname); + path = file_realpath_dup(pathname); uri = g_strconcat("file://", path, NULL); md5 = md5_hash(uri); g_free(path); @@ -258,7 +250,7 @@ GdkPixbuf *a_thumbnails_get(const gchar *pathname) const char *ssize, *smtime; struct stat info; - path = pathdup(pathname); + path = file_realpath_dup(pathname); uri = g_strconcat("file://", path, NULL); md5 = md5_hash(uri); g_free(uri); @@ -289,7 +281,7 @@ GdkPixbuf *a_thumbnails_get(const gchar *pathname) goto out; err: if (thumb) - gdk_pixbuf_unref(thumb); + g_object_unref ( G_OBJECT ( thumb ) ); thumb = NULL; out: g_free(path); @@ -297,20 +289,6 @@ out: return thumb; } -/* pathdup() stuff */ - -static char *pathdup(const char *path) -{ - char real[MAXPATHLEN]; - - g_return_val_if_fail(path != NULL, NULL); - - if (realpath(path, real)) - return g_strdup(real); - - return g_strdup(path); -} - /* * This code implements the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. The original code was