[gnumeric] Compilation: fix some clang warnings.



commit 8cfc44323f2fa9577cbbdae71a46e2c6338a9919
Author: Morten Welinder <terra gnome org>
Date:   Wed Feb 20 21:02:04 2013 -0500

    Compilation: fix some clang warnings.
    
    This includes a few genuine leaks.

 ChangeLog                             |   12 ++++--
 plugins/openoffice/ChangeLog          |    4 ++
 plugins/openoffice/openoffice-write.c |   60 ++++++++++++++++----------------
 src/dialogs/ChangeLog                 |    5 +++
 src/dialogs/dialog-sheet-order.c      |    1 -
 src/graph.c                           |    9 +++--
 src/sheet-object-graph.c              |    2 +-
 7 files changed, 53 insertions(+), 40 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d03cb33..2ae424b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,11 @@
+2013-02-20  Morten Welinder  <terra gnome org>
+
+       * src/sheet-object-graph.c (dim_start): Survive malformed xml.
+
 2013-02-20  Jean Brefort  <jean brefort normalesup org>
 
-       * configure.ac: make configure --with-python fail when some dependency is
-       missing.
+       * configure.ac: make configure --with-python fail when some
+       dependency is missing.
 
 2013-02-17  Morten Welinder  <terra gnome org>
 
@@ -14,8 +18,8 @@
 
 2013-02-16  Jean Brefort  <jean brefort normalesup org>
 
-       * schemas/org.gnome.gnumeric.dialogs.gschema.xml.in.in: fixed default value
-       for stf export format.
+       * schemas/org.gnome.gnumeric.dialogs.gschema.xml.in.in: fixed
+       default value for stf export format.
        * src/dependent.c: fix introspection warnings.
        * src/sheet-style.c: ditto.
 
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 0cb07a6..f53d35a 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,7 @@
+2013-02-20  Morten Welinder  <terra gnome org>
+
+       * openoffice-write.c (odf_write_sheet): Plug leak.
+
 2013-01-01  Morten Welinder  <terra gnome org>
 
        * openoffice-write.c (odf_attrs_as_string): Don't use deprecated
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 11085ca..7e8d3cc 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -565,9 +565,9 @@ static char *
 odf_go_color_to_string (GOColor color)
 {
        return g_strdup_printf ("#%.2x%.2x%.2x",
-                                        GO_COLOR_UINT_R (color),
-                                        GO_COLOR_UINT_G (color),
-                                        GO_COLOR_UINT_B (color));
+                               GO_COLOR_UINT_R (color),
+                               GO_COLOR_UINT_G (color),
+                               GO_COLOR_UINT_B (color));
 }
 
 static double
@@ -3652,7 +3652,7 @@ odf_write_sheet (GnmOOExport *state)
        Sheet const *sheet = state->sheet;
        int max_cols = gnm_sheet_get_max_cols (sheet);
        int max_rows = gnm_sheet_get_max_rows (sheet);
-       GnmStyle **col_styles = g_new0 (GnmStyle *, max_cols);
+       GnmStyle **col_styles;
        GnmRange r;
        GSList *sheet_merges = NULL;
        GnmPageBreaks *pb = sheet->print_info->page_breaks.v;
@@ -4162,7 +4162,7 @@ odf_validation_append_expression (GnmOOExport *state, GString *str, GnmExprTop c
        char *formula;
 
        formula = gnm_expr_top_as_string (texpr, pp, state->conv);
-       str = g_string_append (str, formula);
+       g_string_append (str, formula);
        g_free (formula);
 }
 
@@ -4171,13 +4171,13 @@ odf_validation_append_expression_pair (GnmOOExport *state, GString *str,
                                       GnmValidation const *val,
                                       GnmParsePos *pp)
 {
-               str = g_string_append_c (str, '(');
+               g_string_append_c (str, '(');
                odf_validation_append_expression (state, str,
                                                  val->deps[0].texpr, pp);
-               str = g_string_append_c (str, ',');
+               g_string_append_c (str, ',');
                odf_validation_append_expression (state, str,
                                                  val->deps[1].texpr, pp);
-               str = g_string_append_c (str, ')');
+               g_string_append_c (str, ')');
 }
 
 
@@ -4189,42 +4189,42 @@ odf_validation_general (GnmOOExport *state, GnmValidation const *val,
 {
        GString *str = g_string_new ("of:");
 
-       str = g_string_append (str, prefix);
+       g_string_append (str, prefix);
 
        switch (val->op) {
        case GNM_VALIDATION_OP_NONE:
-               str = g_string_append (str, "is-true-formula(1)");
+               g_string_append (str, "is-true-formula(1)");
                break;
        case GNM_VALIDATION_OP_BETWEEN:
-               str = g_string_append (str, "cell-content-is-between");
+               g_string_append (str, "cell-content-is-between");
                odf_validation_append_expression_pair (state, str, val, pp);
                break;
        case GNM_VALIDATION_OP_NOT_BETWEEN:
-               str = g_string_append (str, "cell-content-is-not-between");
+               g_string_append (str, "cell-content-is-not-between");
                odf_validation_append_expression_pair (state, str, val, pp);
                break;
        case GNM_VALIDATION_OP_EQUAL:
-               str = g_string_append (str, "cell-content() = ");
+               g_string_append (str, "cell-content() = ");
                odf_validation_append_expression (state, str, val->deps[0].texpr, pp);
                break;
        case GNM_VALIDATION_OP_NOT_EQUAL:
-               str = g_string_append (str, "cell-content() != ");
+               g_string_append (str, "cell-content() != ");
                odf_validation_append_expression (state, str, val->deps[0].texpr, pp);
                break;
        case GNM_VALIDATION_OP_GT:
-               str = g_string_append (str, "cell-content() > ");
+               g_string_append (str, "cell-content() > ");
                odf_validation_append_expression (state, str, val->deps[0].texpr, pp);
                break;
        case GNM_VALIDATION_OP_LT:
-               str = g_string_append (str, "cell-content() < ");
+               g_string_append (str, "cell-content() < ");
                odf_validation_append_expression (state, str, val->deps[0].texpr, pp);
                break;
        case GNM_VALIDATION_OP_GTE:
-               str = g_string_append (str, "cell-content() >= ");
+               g_string_append (str, "cell-content() >= ");
                odf_validation_append_expression (state, str, val->deps[0].texpr, pp);
                break;
        case GNM_VALIDATION_OP_LTE:
-               str = g_string_append (str, "cell-content() <= ");
+               g_string_append (str, "cell-content() <= ");
                odf_validation_append_expression (state, str, val->deps[0].texpr, pp);
                break;
        }
@@ -4242,38 +4242,38 @@ odf_validation_length (GnmOOExport *state, GnmValidation const *val,
 
        switch (val->op) {
        case GNM_VALIDATION_OP_NONE:
-               str = g_string_append (str, "is-true-formula(1)");
+               g_string_append (str, "is-true-formula(1)");
                break;
        case GNM_VALIDATION_OP_BETWEEN:
-               str = g_string_append (str, "cell-content-text-length-is-between");
+               g_string_append (str, "cell-content-text-length-is-between");
                odf_validation_append_expression_pair (state, str, val, pp);
                break;
        case GNM_VALIDATION_OP_NOT_BETWEEN:
-               str = g_string_append (str, "cell-content-text-length-is-not-between");
+               g_string_append (str, "cell-content-text-length-is-not-between");
                odf_validation_append_expression_pair (state, str, val, pp);
                break;
        case GNM_VALIDATION_OP_EQUAL:
-               str = g_string_append (str, "cell-content-text-length() = ");
+               g_string_append (str, "cell-content-text-length() = ");
                odf_validation_append_expression (state, str, val->deps[0].texpr, pp);
                break;
        case GNM_VALIDATION_OP_NOT_EQUAL:
-               str = g_string_append (str, "cell-content-text-length() != ");
+               g_string_append (str, "cell-content-text-length() != ");
                odf_validation_append_expression (state, str, val->deps[0].texpr, pp);
                break;
        case GNM_VALIDATION_OP_GT:
-               str = g_string_append (str, "cell-content-text-length() > ");
+               g_string_append (str, "cell-content-text-length() > ");
                odf_validation_append_expression (state, str, val->deps[0].texpr, pp);
                break;
        case GNM_VALIDATION_OP_LT:
-               str = g_string_append (str, "cell-content-text-length() < ");
+               g_string_append (str, "cell-content-text-length() < ");
                odf_validation_append_expression (state, str, val->deps[0].texpr, pp);
                break;
        case GNM_VALIDATION_OP_GTE:
-               str = g_string_append (str, "of:cell-content-text-length() >= ");
+               g_string_append (str, "of:cell-content-text-length() >= ");
                odf_validation_append_expression (state, str, val->deps[0].texpr, pp);
                break;
        case GNM_VALIDATION_OP_LTE:
-               str = g_string_append (str, "cell-content-text-length() <= ");
+               g_string_append (str, "cell-content-text-length() <= ");
                odf_validation_append_expression (state, str, val->deps[0].texpr, pp);
                break;
        }
@@ -4289,9 +4289,9 @@ odf_validation_custom (GnmOOExport *state, GnmValidation const *val,
 {
        GString *str = g_string_new (NULL);
 
-       str = g_string_append (str, "of:is-true-formula(");
+       g_string_append (str, "of:is-true-formula(");
        odf_validation_append_expression (state, str, val->deps[0].texpr, pp);
-       str = g_string_append_c (str, ')');
+       g_string_append_c (str, ')');
 
        gsf_xml_out_add_cstr (state->xml, TABLE "condition", str->str);
        g_string_free (str, TRUE);
@@ -4306,7 +4306,7 @@ odf_validation_in_list (GnmOOExport *state, GnmValidation const *val,
 
        str = g_string_new ("of:cell-content-is-in-list(");
        odf_validation_append_expression (state, str, val->deps[0].texpr, pp);
-       str = g_string_append_c (str, ')');
+       g_string_append_c (str, ')');
 
        gsf_xml_out_add_cstr (state->xml, TABLE "condition", str->str);
        g_string_free (str, TRUE);
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 9d26fed..87e6204 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,8 @@
+2013-02-20  Morten Welinder  <terra gnome org>
+
+       * dialog-sheet-order.c (create_sheet_list): Don't leak a cell
+       rendered.
+
 2013-02-17  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * dialog-analysis-tools.c (average_tool_update_sensitivity_cb): fix test
diff --git a/src/dialogs/dialog-sheet-order.c b/src/dialogs/dialog-sheet-order.c
index cd76759..bd9b8b5 100644
--- a/src/dialogs/dialog-sheet-order.c
+++ b/src/dialogs/dialog-sheet-order.c
@@ -750,7 +750,6 @@ create_sheet_list (SheetManager *state)
        gtk_tree_view_append_column (state->sheet_list, column);
        state->row_max_column = column;
 
-       renderer = gnumeric_cell_renderer_toggle_new ();
        column = gtk_tree_view_column_new_with_attributes
                /*Translators: Table header for column with number of "Cols"*/
                (C_("sheetlist", "Cols"),
diff --git a/src/graph.c b/src/graph.c
index 1df5e20..d0995b9 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -659,11 +659,12 @@ gnm_go_data_vector_load_values (GODataVector *dat)
        GnmEvalPos ep;
        GnmRange r;
        Sheet *start_sheet, *end_sheet;
-       int len = go_data_vector_get_len (dat); /* force calculation */
        double *vals, minimum, maximum;
        GnmValue *v;
        struct assign_closure closure;
 
+       (void)go_data_vector_get_len (dat); /* force calculation */
+
        if (dat->len <= 0 || !vec->dep.sheet) {
                dat->values = NULL;
                dat->minimum = go_nan;
@@ -710,12 +711,12 @@ gnm_go_data_vector_load_values (GODataVector *dat)
                break;
 
        case VALUE_ARRAY : {
-               int last= 0;
+               int last = 0;
+               int len = vec->as_col? vec->val->v_array.y: vec->val->v_array.x;
                maximum = - G_MAXDOUBLE;
                minimum = G_MAXDOUBLE;
-               len = vec->as_col? vec->val->v_array.y: vec->val->v_array.x;
                while (len-- > 0) {
-                       v = vec->as_col
+                       GnmValue *v = vec->as_col
                                ? vec->val->v_array.vals [0][len]
                                : vec->val->v_array.vals [len][0];
 
diff --git a/src/sheet-object-graph.c b/src/sheet-object-graph.c
index b1857b2..3d89d74 100644
--- a/src/sheet-object-graph.c
+++ b/src/sheet-object-graph.c
@@ -929,7 +929,7 @@ dim_start (GsfXMLIn *xin, xmlChar const **attrs)
 {
        GuppiReadState *state = (GuppiReadState *) xin->user_state;
        unsigned i, id = 0;
-       char const *name = NULL;
+       char const *name = "?";
        GogMSDimType type = GOG_MS_DIM_LABELS;
        GogPlotDesc const *desc = gog_plot_description (state->plot);
        GError *err = NULL;


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