[dia/dia-next: 1/59] Fix glib deprecations



commit 7d051766413ba15b4a97b8ed31ee149c1c6da626
Author: Zander Brown <zbrown gnome org>
Date:   Sun Dec 9 10:05:39 2018 +0000

    Fix glib deprecations

 app/load_save.c | 60 ++++++++++++++++++---------------------------------------
 lib/dia_image.c |  2 +-
 2 files changed, 20 insertions(+), 42 deletions(-)
---
diff --git a/app/load_save.c b/app/load_save.c
index a41e0280..24b22fea 100644
--- a/app/load_save.c
+++ b/app/load_save.c
@@ -19,7 +19,6 @@
 
 /* so we get fdopen declared even when compiling with -ansi */
 #define _POSIX_C_SOURCE 200809L
-#define _BSD_SOURCE 1 /* to get the prototype for fchmod() */
 #include <sys/stat.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -1234,50 +1233,29 @@ diagram_autosave(Diagram *dia)
   Diagram *diagram;
   while (diagrams != NULL) {
     diagram = (Diagram *)diagrams->data;
-    if (diagram == dia &&
-       diagram_is_modified(diagram) && 
-       !diagram->autosaved) {
-      save_filename = g_strdup_printf("%s.autosave", dia->filename);
+    if (diagram == dia && 
+        diagram_is_modified(diagram) && 
+        !diagram->autosaved) {
+      AutoSaveInfo *asi = g_new (AutoSaveInfo, 1);
+      GError *error = NULL;
 
+      save_filename = g_strdup_printf("%s.autosave", dia->filename);
+      
       if (dia->autosavefilename != NULL) 
-       g_free(dia->autosavefilename);
-      dia->autosavefilename = save_filename;
-#ifdef G_THREADS_ENABLED
-      if (g_thread_supported ()) {
-       AutoSaveInfo *asi = g_new (AutoSaveInfo, 1);
-       GError *error = NULL;
+        g_free(dia->autosavefilename);
 
-       asi->clone = diagram_data_clone (dia->data);
-       asi->filename = g_strdup (save_filename);
-       asi->ctx = dia_context_new (_("Auto save"));
-
-#if GLIB_CHECK_VERSION(2,32,0)
-       if (!g_thread_try_new ("Autosave", _autosave_in_thread, asi, &error)) {
-#else
-       if (!g_thread_create (_autosave_in_thread, asi, FALSE, &error)) {
-#endif
-         message_error ("%s", error->message);
-         g_error_free (error);
-       }
-       /* FIXME: need better synchronization */
-        dia->autosaved = TRUE;
-      } else {
-       /* no extra threads supported, stay in this one */
-       DiaContext *ctx = dia_context_new (_("Auto save"));
-       dia_context_set_filename (ctx, save_filename);
-       diagram_data_raw_save(dia->data, save_filename, ctx);
-       dia->autosaved = TRUE;
-       dia_context_release (ctx);
-      }
-#else
-      {
-       DiaContext *ctx = dia_context_new (_("Auto save"));
-       dia_context_set_filename (ctx, save_filename);
-       diagram_data_raw_save(dia->data, save_filename, ctx);
-       dia->autosaved = TRUE;
-       dia_context_release (ctx);
+      dia->autosavefilename = save_filename;
+      
+      asi->clone = diagram_data_clone (dia->data);
+      asi->filename = g_strdup (save_filename);
+      asi->ctx = dia_context_new (_("Auto save"));
+      
+      if (!g_thread_try_new ("Autosave", _autosave_in_thread, asi, &error)) {
+        message_error ("%s", error->message);
+        g_error_free (error);
       }
-#endif
+      /* FIXME: need better synchronization */
+      dia->autosaved = TRUE;
       return;
     }
     diagrams = g_list_next(diagrams);
diff --git a/lib/dia_image.c b/lib/dia_image.c
index c733e697..7d1699e7 100644
--- a/lib/dia_image.c
+++ b/lib/dia_image.c
@@ -469,7 +469,7 @@ dia_image_rgb_data(const DiaImage *image)
   } else {
     guint8 *pixels = gdk_pixbuf_get_pixels(image->image);
 
-    g_memmove(rgb_pixels, pixels, height*rowstride);
+    memmove(rgb_pixels, pixels, height*rowstride);
     return rgb_pixels;
   }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]