summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/io-tiff.c
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2000-07-22 23:50:19 +0000
committerTor Lillqvist <tml@src.gnome.org>2000-07-22 23:50:19 +0000
commit67a4b0c3d109a6758b2ba6534f3e62c1ffe77829 (patch)
tree41d535e92712df3e6ac5b520d46e4d7b11bec604 /gdk-pixbuf/io-tiff.c
parenta0e5fd24904084388ef0089b3bcb2018a9e2b0f4 (diff)
downloadgdk-pixbuf-67a4b0c3d109a6758b2ba6534f3e62c1ffe77829.tar.gz
Win32 build setup:
2000-07-23 Tor Lillqvist <tml@iki.fi> Win32 build setup: * makefile.mingw.in * pixops/makefile.mingw.in * pixbuf_*.def: New files. * Makefile.am * pixops/Makefile.am: Add them. Add rule to generate makefile.mingw. * gdk-pixbuf-io.c (gtk_win32_get_installation_directory): New function, to get the GTK+ installation directory from the Windows Registry, where the installation program for whatever software includes GTK+ has stored it. Used to avoid having hardcoding the directory where to look for loaders. This function is needed by gtk, too, so it should really be just in one place. Maybe a small static library one level up from here? * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file) * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Open file in binary mode. This *is* standard C. (No-op on Unix, of course.) * io-jpeg.c: If we don't HAVE_SIGSETJMP, use normal setjmp(). * io-tiff.c: Use g_get_tmp_dir(). If we don't HAVE_MKSTEMP, use mktemp() and open(). (gdk_pixbuf__tiff_image_stop_load): g_free() also the tempname. * pixops/*.S: The Gas from mingw32 doesn't like the .type pseudo-op. Conditionalise on __MINGW32__, but probably should conditionalise on Gas version instead? Or could we do without .type on all systems? * pixops/timescale.c: Use g_get_current_time() instead of gettimeofday().
Diffstat (limited to 'gdk-pixbuf/io-tiff.c')
-rw-r--r--gdk-pixbuf/io-tiff.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gdk-pixbuf/io-tiff.c b/gdk-pixbuf/io-tiff.c
index 602adb846..3dd397fda 100644
--- a/gdk-pixbuf/io-tiff.c
+++ b/gdk-pixbuf/io-tiff.c
@@ -33,6 +33,10 @@
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
+#ifdef G_OS_WIN32
+#include <fcntl.h>
+#define O_RDWR _O_RDWR
+#endif
typedef struct _TiffData TiffData;
@@ -146,14 +150,24 @@ gdk_pixbuf__tiff_image_begin_load (ModulePreparedNotifyFunc prepare_func,
{
TiffData *context;
gint fd;
+ gchar *tmp = g_get_tmp_dir ();
context = g_new (TiffData, 1);
context->prepare_func = prepare_func;
context->update_func = update_func;
context->user_data = user_data;
context->all_okay = TRUE;
- context->tempname = g_strdup ("/tmp/gdkpixbuf-tif-tmp.XXXXXX");
+ context->tempname =
+ g_strconcat (tmp,
+ tmp[strlen (tmp)] == G_DIR_SEPARATOR ? G_DIR_SEPARATOR_S : "",
+ "gdkpixbuf-tif-tmp.XXXXXX",
+ NULL);
+#ifdef HAVE_MKSTEMP
fd = mkstemp (context->tempname);
+#else
+ mktemp (context->tempname);
+ fd = open (context->tempname, O_RDWR);
+#endif
if (fd < 0) {
g_free (context);
return NULL;
@@ -182,6 +196,7 @@ gdk_pixbuf__tiff_image_stop_load (gpointer data)
fclose (context->file);
unlink (context->tempname);
+ g_free (context->tempname);
g_free ((TiffData *) context);
}