[glib] measure_disk_usage: properly report results



commit b72c466653c6e4a493874b35e4e7acdcadda7e67
Author: Ryan Lortie <desrt desrt ca>
Date:   Tue Sep 17 09:53:18 2013 -0400

    measure_disk_usage: properly report results
    
    In the async case, make sure we copy all of the out parameters from the
    results structure, not just 'disk_usage'.

 gio/gfile.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/gio/gfile.c b/gio/gfile.c
index d321c24..afaee21 100644
--- a/gio/gfile.c
+++ b/gio/gfile.c
@@ -7494,19 +7494,25 @@ g_file_real_measure_disk_usage_finish (GFile         *file,
                                        guint64       *num_files,
                                        GError       **error)
 {
-  guint64 *reported_usage;
+  MeasureResult *measure_result;
 
   g_return_val_if_fail (g_task_is_valid (result, file), FALSE);
 
-  reported_usage = g_task_propagate_pointer (G_TASK (result), error);
+  measure_result = g_task_propagate_pointer (G_TASK (result), error);
 
-  if (reported_usage == NULL)
+  if (measure_result == NULL)
     return FALSE;
 
   if (disk_usage)
-    *disk_usage = *reported_usage;
+    *disk_usage = measure_result->disk_usage;
 
-  g_free (reported_usage);
+  if (num_dirs)
+    *num_dirs = measure_result->num_dirs;
+
+  if (num_files)
+    *num_files = measure_result->num_files;
+
+  g_free (measure_result);
 
   return TRUE;
 }


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