[gimp] Bug 761573 - Problem with Raw Image Loader plugin
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 761573 - Problem with Raw Image Loader plugin
- Date: Thu, 11 Feb 2016 23:37:31 +0000 (UTC)
commit 26ff8eb40dacb842b2b990b5add68142085b56aa
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.
plug-ins/common/file-raw-data.c | 28 +++++++++++++++++++++-------
1 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/plug-ins/common/file-raw-data.c b/plug-ins/common/file-raw-data.c
index 639e7b7..db38787 100644
--- a/plug-ins/common/file-raw-data.c
+++ b/plug-ins/common/file-raw-data.c
@@ -116,7 +116,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,
@@ -375,14 +375,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 */
@@ -878,7 +892,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;
gint bitspp = 8;
@@ -1346,7 +1360,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]