]> Pileus Git - ~andy/gtk/commitdiff
Use g_file_open_tmp() (just added to GLib) instead of mkstemp() (or
authorTor Lillqvist <tml@iki.fi>
Sat, 11 Nov 2000 00:34:47 +0000 (00:34 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Sat, 11 Nov 2000 00:34:47 +0000 (00:34 +0000)
2000-11-11  Tor Lillqvist  <tml@iki.fi>

* io-tiff.c (gdk_pixbuf__tiff_image_begin_load): Use
g_file_open_tmp() (just added to GLib) instead of mkstemp() (or
mktemp() and open()).

* io-xpm.c (gdk_pixbuf__xpm_image_begin_load): Ditto.

gdk-pixbuf/ChangeLog
gdk-pixbuf/io-tiff.c
gdk-pixbuf/io-xpm.c

index 3ce42c569fb5651d9011dfc5d999f52d498bebf4..ea9b49f81a6ee22d521e3764d86804166bd22e6b 100644 (file)
@@ -1,3 +1,11 @@
+2000-11-11  Tor Lillqvist  <tml@iki.fi>
+
+       * io-tiff.c (gdk_pixbuf__tiff_image_begin_load): Use
+       g_file_open_tmp() (just added to GLib) instead of mkstemp() (or
+       mktemp() and open()).
+       
+       * io-xpm.c (gdk_pixbuf__xpm_image_begin_load): Ditto.
+
 2000-11-01  Havoc Pennington  <hp@pobox.com>
 
        * gdk-pixbuf.c (gdk_pixbuf_new_subpixbuf): New function to create 
index 615714742779edc239e722e5d407a21986ca8fa1..08fe3bc4af0e0e32386c688ce4f0e223ce96e3eb 100644 (file)
@@ -153,26 +153,15 @@ 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_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
+       fd = g_file_open_tmp ("gdkpixbuf-tif-tmp.XXXXXX", &context->tempname,
+                             NULL);
        if (fd < 0) {
-                g_free (context->tempname);
                g_free (context);
                return NULL;
        }
index b762c87054451435187398fa0b3aee8e9a5bea12..df561498f8c67ed9c537603848f6e0cfc1a5d91c 100644 (file)
@@ -1413,10 +1413,9 @@ gdk_pixbuf__xpm_image_begin_load (ModulePreparedNotifyFunc prepare_func,
        context->update_func = update_func;
        context->user_data = user_data;
        context->all_okay = TRUE;
-       context->tempname = g_strdup ("/tmp/gdkpixbuf-xpm-tmp.XXXXXX");
-       fd = mkstemp (context->tempname);
+       fd = g_file_open_tmp ("gdkpixbuf-xpm-tmp.XXXXXX", &context->tempname,
+                            NULL);
        if (fd < 0) {
-               g_free (context->tempname);
                g_free (context);
                return NULL;
        }