[goffice] Misc fixes.



commit ddd037de7768b2d75607a09328b5c8c80cfb8da5
Author: Morten Welinder <terra gnome org>
Date:   Sun Oct 2 14:36:28 2016 -0400

    Misc fixes.

 ChangeLog                 |    8 ++++++++
 goffice/math/go-matrix.c  |    6 ++++--
 goffice/utils/go-format.c |   23 +++++++++++++++++------
 3 files changed, 29 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 03961d9..5b19fe7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-10-02  Morten Welinder  <terra gnome org>
+
+       * goffice/utils/go-format.c (go_render_general): Fix warning.
+       (go_format_get_details): Avoid pango_trom_string.
+
+       * goffice/math/go-matrix.c (go_quad_matrix_dump): Fix printf
+       argument.  (Somehow magically worked -- on x86 at least.)
+
 2016-08-20  Morten Welinder <terra gnome org>
 
        * configure.ac: Post-release bump.
diff --git a/goffice/math/go-matrix.c b/goffice/math/go-matrix.c
index aa46a0b..f48639b 100644
--- a/goffice/math/go-matrix.c
+++ b/goffice/math/go-matrix.c
@@ -588,8 +588,10 @@ SUFFIX(go_quad_matrix_dump) (const QMATRIX *A, const char *fmt)
        int i, j;
 
        for (i = 0; i < A->m; i++) {
-               for (j = 0; j < A->n; j++)
-                       g_printerr (fmt, A->data[i][j]);
+               for (j = 0; j < A->n; j++) {
+                       DOUBLE x = SUFFIX(go_quad_value) (&A->data[i][j]);
+                       g_printerr (fmt, x);
+               }
                g_printerr ("\n");
        }
 }
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index 017b5c4..e2ba401 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -4941,15 +4941,15 @@ SUFFIX(go_render_general) (PangoLayout *layout, GString *str,
                /* FIXME: We should adjust min_digit_width if num_shape != 0 */
        }
 
+       sign_width = unicode_minus
+               ? metrics->minus_width
+               : metrics->hyphen_width;
+
        if (col_width == -1) {
                try_needed = TRUE;
        } else {
                int w;
 
-               sign_width = unicode_minus
-                       ? metrics->minus_width
-                       : metrics->hyphen_width;
-
                w = (col_width - (val <= -0.5 ? sign_width : 0)) / min_digit_width;
                if (w <= maxdigits) {
                        /* We're limited by width.  */
@@ -7461,13 +7461,24 @@ go_format_get_details (GOFormat const *fmt,
        }
 
        case GO_FORMAT_FRACTION: {
-               char *c_str = pango_trim_string (str);
-               gchar **tokens = g_strsplit_set (c_str, " /", 3);
+               char *c_str = g_strdup (str), *p;
+               gchar **tokens;
                int numerator_base;
                char const *integer;
                int d;
                gboolean pi_token;
 
+               // Trim spaces
+               for (p = c_str + strlen (c_str); p > c_str && p[-1] == ' '; p--)
+                       p[-1] = 0;
+               p = c_str;
+               while (p[0] == ' ')
+                       p++;
+
+               // This is really a hack that doesn't take quoted string
+               // into account.
+               tokens = g_strsplit_set (c_str, " /", 3);
+
                /* Since it is a fraction we get at least 2 tokens */
                g_return_if_fail (tokens[1] != NULL);
 


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