[gnumeric] Cleanups.



commit b65478e6234c18bf51f1b357bcc00464d6b210fe
Author: Morten Welinder <terra gnome org>
Date:   Sun Mar 6 18:29:37 2022 -0500

    Cleanups.

 src/colrow.c        | 30 +++++++++++++++---------------
 src/colrow.h        |  2 +-
 src/xml-sax-write.c |  3 +--
 3 files changed, 17 insertions(+), 18 deletions(-)
---
diff --git a/src/colrow.c b/src/colrow.c
index 26a7414e2..78628cb00 100644
--- a/src/colrow.c
+++ b/src/colrow.c
@@ -64,6 +64,8 @@ colrow_compute_pixel_scale (Sheet const *sheet, gboolean horizontal)
        double scale = gnm_app_display_dpi_get (horizontal) / 72.0;
        if (sheet) {
                scale *= sheet->last_zoom_factor_used;
+       } else {
+               g_error ("Why is sheet NULL here?\n");
        }
        return scale;
 }
@@ -72,10 +74,9 @@ void
 colrow_compute_pixels_from_pts (ColRowInfo *cri, Sheet const *sheet,
                                gboolean horizontal, double scale)
 {
-       int const margin = horizontal ? 2*GNM_COL_MARGIN : 2*GNM_ROW_MARGIN;
+       int const margin = horizontal ? 2 * GNM_COL_MARGIN : 2 * GNM_ROW_MARGIN;
 
-       if (!sheet)
-               g_error ("Why is sheet NULL here?\n");
+       g_return_if_fail (IS_SHEET (sheet));
 
        if (scale == -1)
                scale = colrow_compute_pixel_scale (sheet, horizontal);
@@ -93,6 +94,8 @@ void
 colrow_compute_pts_from_pixels (ColRowInfo *cri, Sheet const *sheet,
                                gboolean horizontal, double scale)
 {
+       g_return_if_fail (IS_SHEET (sheet));
+
        if (scale <= 0.)
                scale = colrow_compute_pixel_scale (sheet, horizontal);
 
@@ -200,10 +203,10 @@ colrow_free (ColRowInfo *cri)
  * @user_data: A baggage pointer.
  *
  * Iterates through the existing rows or columns within the range supplied.
- * Currently only support left -> right iteration.  If a callback returns
- * %TRUE iteration stops.
+ * Currently only support left-to-right iteration.  If a callback returns
+ * %TRUE, iteration stops.
  **/
-gboolean
+void
 colrow_state_list_foreach (ColRowStateList *list,
                           Sheet const *sheet, gboolean is_cols,
                           int base,
@@ -235,10 +238,9 @@ colrow_state_list_foreach (ColRowStateList *list,
                for (l = 0; l < rle->length; l++) {
                        iter.pos = i++;
                        if (iter.cri && (*callback)(&iter, user_data))
-                               return TRUE;
+                               return;
                }
        }
-       return FALSE;
 }
 
 
@@ -1263,18 +1265,16 @@ colrow_set_visibility (Sheet *sheet, gboolean is_cols,
        }
 }
 
-// Introspection scanner crashes if the following "hide" is removed.
-
-/*hide*
+/**
  * colrow_get_global_outline: (skip)
  * @sheet:
  * @is_cols: %TRUE for columns, %FALSE for rows.
  * @depth:
- * @show: (out):
- * @hide: (out):
+ * @show: (out): columns/rows that need to be shown
+ * @hide: (out): columns/rows that need to be hidden
  *
- * Collect the set of visibility changes required to change the visibility of
- * all outlined columns such that those > @depth are visible.
+ * Collect the sets of visibility changes required to change the visibility of
+ * all outlined columns/rows such that those depth less then  @depth are visible.
  **/
 void
 colrow_get_global_outline (Sheet const *sheet, gboolean is_cols, int depth,
diff --git a/src/colrow.h b/src/colrow.h
index 1fefb0088..5366a07cd 100644
--- a/src/colrow.h
+++ b/src/colrow.h
@@ -95,7 +95,7 @@ ColRowStateList       *colrow_get_states           (Sheet *sheet, gboolean is_cols,
                                              int first, int last);
 void            colrow_set_states           (Sheet *sheet, gboolean is_cols,
                                              int first, ColRowStateList *states);
-gboolean colrow_state_list_foreach          (ColRowStateList *list,
+void            colrow_state_list_foreach   (ColRowStateList *list,
                                              Sheet const *sheet,
                                              gboolean is_cols,
                                              int base,
diff --git a/src/xml-sax-write.c b/src/xml-sax-write.c
index eb2f03a87..92f40af60 100644
--- a/src/xml-sax-write.c
+++ b/src/xml-sax-write.c
@@ -1,4 +1,3 @@
-
 /*
  * xml-sax-write.c : export .gnumeric and the clipboard subset using the sax
  *                     like wrappers in libgsf
@@ -30,7 +29,7 @@
 #include <workbook-view.h>
 #include <gnm-format.h>
 #include <workbook.h>
-#include <workbook-priv.h> /* Workbook::names */
+#include <workbook-priv.h>
 #include <cell.h>
 #include <sheet.h>
 #include <sheet-view.h>


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