[gimp/gimp-2-8] Bug 761573 - Problem with Raw Image Loader plugin
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] Bug 761573 - Problem with Raw Image Loader plugin
- Date: Thu, 11 Feb 2016 23:41:08 +0000 (UTC)
commit c6a0e85d4c92f1881e25a9f2ef17e1e084fa2edb
Author: Michael Natterer <mitch gimp org>
Date: Fri Feb 12 00:36:11 2016 +0100
Bug 761573 - Problem with Raw Image Loader plugin
Use g_file_query_info() to get the file's size, stat() has some
windows 64 bit problem I've forgotten.
(cherry picked from commit 26ff8eb40dacb842b2b990b5add68142085b56aa)
plug-ins/common/file-raw.c | 28 +++++++++++++++++++++-------
1 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/plug-ins/common/file-raw.c b/plug-ins/common/file-raw.c
index c0c233a..4bd16a6 100644
--- a/plug-ins/common/file-raw.c
+++ b/plug-ins/common/file-raw.c
@@ -105,7 +105,7 @@ static gboolean raw_load_palette (RawGimpData *data,
const gchar *palette_filename);
/* support functions */
-static gint32 get_file_info (const gchar *filename);
+static goffset get_file_info (const gchar *filename);
static void raw_read_row (FILE *fp,
guchar *buf,
gint32 offset,
@@ -361,14 +361,28 @@ run (const gchar *name,
/* get file size from a filename */
-static gint32
+static goffset
get_file_info (const gchar *filename)
{
- struct stat status;
+ GFile *file = g_file_new_for_path (filename);
+ GFileInfo *info;
+ goffset size = 0;
+
+ info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_SIZE,
+ G_FILE_QUERY_INFO_NONE,
+ NULL, NULL);
+
+ if (info)
+ {
+ size = g_file_info_get_size (info);
+
+ g_object_unref (info);
+ }
- g_stat (filename, &status);
+ g_object_unref (file);
- return status.st_size;
+ return size;
}
/* new image handle functions */
@@ -702,7 +716,7 @@ load_image (const gchar *filename,
gint32 layer_id = -1;
GimpImageType ltype = GIMP_RGB;
GimpImageBaseType itype = GIMP_RGB_IMAGE;
- gint32 size;
+ goffset size;
gint bpp = 0;
data = g_new0 (RawGimpData, 1);
@@ -1049,7 +1063,7 @@ load_dialog (const gchar *filename)
GtkWidget *combo;
GtkWidget *button;
GtkObject *adj;
- gint32 file_size;
+ goffset file_size;
gboolean run;
file_size = get_file_info (filename);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]