[goffice] Introspection fixes.



commit cae80b44bd396a818cd1e34de482cc940048b5c5
Author: Morten Welinder <terra gnome org>
Date:   Thu Apr 19 10:55:13 2018 -0400

    Introspection fixes.

 goffice/utils/go-font.c          |    7 +++-
 goffice/utils/go-format.c        |    6 +++
 goffice/utils/go-glib-extras.c   |   18 ++++++--
 goffice/utils/go-libxml-extras.c |    3 +
 goffice/utils/go-locale.c        |    3 +
 goffice/utils/go-mml-to-itex.c   |   76 +++++++++++++++++++-------------------
 goffice/utils/go-persist.c       |    1 -
 goffice/utils/go-rsm.c           |    6 +++
 goffice/utils/go-string.c        |    7 +++
 goffice/utils/go-undo.c          |   10 ++--
 goffice/utils/go-unit.c          |   41 ++++++++++++++++----
 goffice/utils/go-unit.h          |    2 +-
 goffice/utils/goffice-utils.c    |    4 +-
 goffice/utils/regutf8.c          |    9 +++-
 14 files changed, 129 insertions(+), 64 deletions(-)
---
diff --git a/goffice/utils/go-font.c b/goffice/utils/go-font.c
index ce8bdd6..822bf76 100644
--- a/goffice/utils/go-font.c
+++ b/goffice/utils/go-font.c
@@ -355,7 +355,9 @@ static GOFontMetrics go_font_metrics_unit_var;
 /* All widths == 1.  */
 const GOFontMetrics *go_font_metrics_unit = &go_font_metrics_unit_var;
 
-/* private */
+/**
+ * _go_fonts_init: (skip)
+ */
 void
 _go_fonts_init (void)
 {
@@ -386,6 +388,9 @@ _go_fonts_init (void)
                pango_font_description_from_string ("Sans 8"));
 }
 
+/**
+ * _go_fonts_shutdown: (skip)
+ */
 void
 _go_fonts_shutdown (void)
 {
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index b71b6b9..46329cc 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -5381,6 +5381,9 @@ SUFFIX(go_format_value) (GOFormat const *fmt, DOUBLE val)
 
 
 #ifdef DEFINE_COMMON
+/**
+ * _go_number_format_init: (skip)
+ */
 void
 _go_number_format_init (void)
 {
@@ -5408,6 +5411,9 @@ cb_format_leak (G_GNUC_UNUSED gpointer key, gpointer value, G_GNUC_UNUSED gpoint
 #endif
 
 #ifdef DEFINE_COMMON
+/**
+ * _go_number_format_shutdown: (skip)
+ */
 void
 _go_number_format_shutdown (void)
 {
diff --git a/goffice/utils/go-glib-extras.c b/goffice/utils/go-glib-extras.c
index 4c2fd73..f6b063d 100644
--- a/goffice/utils/go-glib-extras.c
+++ b/goffice/utils/go-glib-extras.c
@@ -569,7 +569,7 @@ go_mem_chunk_get_type (void)
  * go_mem_chunk_alloc:
  * @chunk: #GOMemChunk
  *
- * Returns: (transfer none): an unused memory block
+ * Returns: (transfer full): an unused memory block
  **/
 gpointer
 go_mem_chunk_alloc (GOMemChunk *chunk)
@@ -629,7 +629,7 @@ go_mem_chunk_alloc (GOMemChunk *chunk)
  * go_mem_chunk_alloc0:
  * @chunk: #GOMemChunk
  *
- * Returns: (transfer none): an unused memory block filled with 0
+ * Returns: (transfer full): an unused memory block filled with 0
  **/
 gpointer
 go_mem_chunk_alloc0 (GOMemChunk *chunk)
@@ -639,6 +639,13 @@ go_mem_chunk_alloc0 (GOMemChunk *chunk)
        return res;
 }
 
+/**
+ * go_mem_chunk_free:
+ * @chunk: #GOMemChunk
+ * @mem: (transfer full): item to release
+ *
+ * Returns the given item to the pool.
+ **/
 void
 go_mem_chunk_free (GOMemChunk *chunk, gpointer mem)
 {
@@ -819,8 +826,7 @@ static char *go_real_name = NULL;
 /**
  * go_get_real_name:
  *
- * Returns: a utf8 encoded string with the current user name.
- *     Caller should _NOT_ free the result.
+ * Returns: (transfer none): a utf8 encoded string with the current user name.
  **/
 char const *
 go_get_real_name (void)
@@ -1190,7 +1196,9 @@ go_debug_check_finalized (gpointer obj, const char *id)
        g_object_weak_ref (obj, cb_finalized, NULL);
 }
 
-
+/**
+ * _go_glib_extras_shutdown: (skip)
+ */
 void
 _go_glib_extras_shutdown (void)
 {
diff --git a/goffice/utils/go-libxml-extras.c b/goffice/utils/go-libxml-extras.c
index 3f661ca..92f2c38 100644
--- a/goffice/utils/go-libxml-extras.c
+++ b/goffice/utils/go-libxml-extras.c
@@ -396,6 +396,9 @@ go_xml_out_add_color (GsfXMLOut *output, char const *id, GOColor c)
 
 static GSList *xml_in_docs;
 
+/**
+ * _go_libxml_extras_shutdown: (skip)
+ */
 void
 _go_libxml_extras_shutdown (void)
 {
diff --git a/goffice/utils/go-locale.c b/goffice/utils/go-locale.c
index 6f129ed..25c734a 100644
--- a/goffice/utils/go-locale.c
+++ b/goffice/utils/go-locale.c
@@ -68,6 +68,9 @@ go_setlocale (int category, char const *val)
        return setlocale (category, val);
 }
 
+/**
+ * _go_locale_shutdown: (skip)
+ */
 void
 _go_locale_shutdown (void)
 {
diff --git a/goffice/utils/go-mml-to-itex.c b/goffice/utils/go-mml-to-itex.c
index 38f8961..9a8da0a 100644
--- a/goffice/utils/go-mml-to-itex.c
+++ b/goffice/utils/go-mml-to-itex.c
@@ -22,48 +22,48 @@
 #include <goffice/goffice-config.h>
 #include <goffice/goffice.h>
 #include <goffice/goffice-priv.h>
-#include <libxslt/xslt.h>
-#include <libxslt/xsltInternals.h>
-#include <libxslt/transform.h>
+#include <libxslt/xslt.h>
+#include <libxslt/xsltInternals.h>
+#include <libxslt/transform.h>
 #include <libxslt/xsltutils.h>
-#include <string.h>
-
+#include <string.h>
+
 gboolean
-go_mathml_to_itex (char const *mml, char **buf, int *length, gboolean *compact, GOCmdContext *gcc)
-{
-    static xsltStylesheet *sheet = NULL;
-    xmlDocPtr doc, res;
+go_mathml_to_itex (char const *mml, char **buf, int *length, gboolean *compact, GOCmdContext *gcc)
+{
+    static xsltStylesheet *sheet = NULL;
+    xmlDocPtr doc, res;
        int ret, len, start, end;
-       char *itex;
-
-       if (mml == NULL || *mml == 0)
-        /* Nothing has failed, but we have nothing to do anyway */
+       char *itex;
+
+       if (mml == NULL || *mml == 0)
+        /* Nothing has failed, but we have nothing to do anyway */
                return FALSE;
     if (sheet == NULL) {
                char *path = g_build_filename (go_sys_data_dir (), "mmlitex/mmlitex.xsl", NULL);
-                       
-               sheet = xsltParseStylesheetFile (path);
+                       
+               sheet = xsltParseStylesheetFile (path);
                if (!sheet) {
-                       if (gcc)
+                       if (gcc)
                        go_cmd_context_error_import (gcc, "MathML to ITeX: parsing stylesheet failed");
-                       return FALSE;
-               }
-    }
-       
-    doc = xmlParseDoc((xmlChar const *) mml);
-    if (!doc) {
-               if (gcc)
-               go_cmd_context_error_import (gcc, "MathML toI TeX: parsing MathML document failed");
-               return FALSE;
-    }  
-       
-    res = xsltApplyStylesheet(sheet, doc, NULL);
-    if (!res) {
-               if (gcc)
-               go_cmd_context_error_import (gcc, "MathML to ITeX: applying stylesheet failed");
-               xmlFreeDoc(doc);
-               return FALSE;
-    }
+                       return FALSE;
+               }
+    }
+       
+    doc = xmlParseDoc((xmlChar const *) mml);
+    if (!doc) {
+               if (gcc)
+               go_cmd_context_error_import (gcc, "MathML toI TeX: parsing MathML document failed");
+               return FALSE;
+    }  
+       
+    res = xsltApplyStylesheet(sheet, doc, NULL);
+    if (!res) {
+               if (gcc)
+               go_cmd_context_error_import (gcc, "MathML to ITeX: applying stylesheet failed");
+               xmlFreeDoc(doc);
+               return FALSE;
+    }
 
     ret = xsltSaveResultToString ((xmlChar **) &itex, &len, res, sheet) != 0;
        /* Remove the extra charaters are start or end */
@@ -100,7 +100,7 @@ go_mathml_to_itex (char const *mml, char **buf, int *length, gboolean *compact,
        if (length)
                *length = len;
        xmlFree (itex);
-       xmlFreeDoc(res);
-       xmlFreeDoc(doc);
-       return ret >= 0;
-}
+       xmlFreeDoc(res);
+       xmlFreeDoc(doc);
+       return ret >= 0;
+}
diff --git a/goffice/utils/go-persist.c b/goffice/utils/go-persist.c
index 8282b81..bb71231 100644
--- a/goffice/utils/go-persist.c
+++ b/goffice/utils/go-persist.c
@@ -61,4 +61,3 @@ go_persist_prep_sax (GOPersist *gp, GsfXMLIn *xin, xmlChar const **attrs)
        g_return_if_fail (GO_IS_PERSIST (gp));
        GO_PERSIST_GET_CLASS (gp)->prep_sax (gp, xin, attrs);
 }
-
diff --git a/goffice/utils/go-rsm.c b/goffice/utils/go-rsm.c
index 2c78e83..ed8d05b 100644
--- a/goffice/utils/go-rsm.c
+++ b/goffice/utils/go-rsm.c
@@ -30,6 +30,9 @@ typedef struct {
 static gboolean debug;
 static GHashTable *rsm;
 
+/**
+ * _go_rsm_init: (skip)
+ */
 void
 _go_rsm_init (void)
 {
@@ -37,6 +40,9 @@ _go_rsm_init (void)
   rsm = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
 }
 
+/**
+ * _go_rsm_shutdown: (skip)
+ */
 void
 _go_rsm_shutdown (void)
 {
diff --git a/goffice/utils/go-string.c b/goffice/utils/go-string.c
index 85fae93..496a8d2 100644
--- a/goffice/utils/go-string.c
+++ b/goffice/utils/go-string.c
@@ -501,6 +501,10 @@ go_string_equal_internal (gconstpointer gstr_a, gconstpointer gstr_b)
                 (GO_STRING_LEN (a) == GO_STRING_LEN (b)) &&
                 0 == strcmp (a->base.str, b->base.str));
 }
+
+/**
+ * _go_string_init: (skip)
+ */
 void
 _go_string_init (void)
 {
@@ -522,6 +526,9 @@ cb_string_pool_leak (G_GNUC_UNUSED gpointer key,
        return TRUE;
 }
 
+/**
+ * _go_string_shutdown: (skip)
+ */
 void
 _go_string_shutdown (void)
 {
diff --git a/goffice/utils/go-undo.c b/goffice/utils/go-undo.c
index 95f0837..020554e 100644
--- a/goffice/utils/go-undo.c
+++ b/goffice/utils/go-undo.c
@@ -85,14 +85,14 @@ go_undo_undo (GOUndo *u)
 
 /**
  * go_undo_combine:
- * @a: (transfer full): optional first undo operation
- * @b: (transfer full): optional last undo operation
+ * @a: (transfer full) (nullable): first undo operation
+ * @b: (transfer full) (nullable): last undo operation
  *
  * This function takes ownership of the argument references and gives ownership
- * of the result to the caller.  Either argument may be NULL in which case the
+ * of the result to the caller.  Either argument may be %NULL in which case the
  * other is returned.
  *
- * Returns: (transfer full): the combination of two undo operations.
+ * Returns: (transfer full) (nullable): the combination of two undo operations.
  **/
 GOUndo *
 go_undo_combine (GOUndo *a, GOUndo *b)
@@ -183,7 +183,7 @@ go_undo_group_new (void)
 /**
  * go_undo_group_add:
  * @g: undo group
- * @u: undo object
+ * @u: (transfer full): undo object
  *
  * This function adds @u to @g.
  **/
diff --git a/goffice/utils/go-unit.c b/goffice/utils/go-unit.c
index fe24aa2..2e8a6cf 100644
--- a/goffice/utils/go-unit.c
+++ b/goffice/utils/go-unit.c
@@ -70,7 +70,7 @@ go_unit_get_type (void)
 
 static int last_unit = GO_UNIT_MAX;
 
-GoUnit units[GO_UNIT_MAX] = {
+static GoUnit units[GO_UNIT_MAX] = {
        {(char *) "m", (char *) "L", 1., GO_UNIT_METER},
        {(char *) "cm", (char *) "L", 0.01, GO_UNIT_CENTIMETER},
        {(char *) "in", (char *) "L", 0.0254, GO_UNIT_INCH},
@@ -107,18 +107,34 @@ GoUnit const *go_unit_get_from_symbol (char const *symbol)
        return (GoUnit const *) g_hash_table_lookup (units_hash, symbol);
 }
 
+/**
+ * go_unit_get:
+ * @id: #GoUnitId for unit to query
+ *
+ * Returns: (transfer none) (nullable): the #GoUnit corresponding to @id.
+ */
 GoUnit const *
-go_unit_get (GoUnitId Id)
+go_unit_get (GoUnitId id)
 {
-       if (Id < 0)
+       if (id < 0)
                return NULL;
-       if (Id < GO_UNIT_MAX)
-               return units + Id;
-       else if (custom_units != NULL && Id < last_unit)
-               return g_ptr_array_index (custom_units, Id - GO_UNIT_MAX);
+       if (id < GO_UNIT_MAX)
+               return units + id;
+       else if (custom_units != NULL && id < last_unit)
+               return g_ptr_array_index (custom_units, id - GO_UNIT_MAX);
        return NULL;
 }
 
+/**
+ * go_unit_define:
+ * @symbol: symbol name for unit.
+ * @dim: dimension measured by unit.
+ * @factor_to_SI: factor to convert to SI unit.
+ *
+ * Returns: (transfer none): the named #GoUnit.  If a #GoUnit of that name
+ * already exists, the existing is returned.  Otherwise a new one is
+ * created.
+ */
 GoUnit const *
 go_unit_define (char const *symbol, char const *dim, double factor_to_SI)
 {
@@ -127,7 +143,7 @@ go_unit_define (char const *symbol, char const *dim, double factor_to_SI)
                _go_unit_init ();
        unit = (GoUnit *) go_unit_get_from_symbol (symbol);
        if (unit == NULL) {
-               unit = (GoUnit *) g_new (GoUnit, 1);
+               unit = g_new (GoUnit, 1);
                unit->symbol = g_strdup (symbol);
                unit->dim = g_strdup (dim);
                unit->factor_to_SI = factor_to_SI;
@@ -150,6 +166,9 @@ go_unit_destroy (GoUnit *unit)
        }
 }
 
+/**
+ * _go_unit_init: (skip)
+ */
 void
 _go_unit_init ()
 {
@@ -161,7 +180,11 @@ _go_unit_init ()
                g_hash_table_insert (units_hash, units[Id].symbol, units + Id);
 }
 
-void _go_unit_shutdown ()
+/**
+ * _go_unit_shutdown: (skip)
+ */
+void
+_go_unit_shutdown ()
 {
        if (units_hash == NULL)
                return;
diff --git a/goffice/utils/go-unit.h b/goffice/utils/go-unit.h
index 9f8ef5f..5986247 100644
--- a/goffice/utils/go-unit.h
+++ b/goffice/utils/go-unit.h
@@ -43,7 +43,7 @@ char const *go_unit_get_symbol (GoUnit const *unit);
 GoUnitId go_unit_get_id (GoUnit const *unit);
 double go_unit_convert (GoUnit const *from, GoUnit const *to, double value);
 GoUnit const *go_unit_get_from_symbol (char const *symbol);
-GoUnit const *go_unit_get (GoUnitId Id);
+GoUnit const *go_unit_get (GoUnitId id);
 GoUnit const *go_unit_define (char const *symbol, char const *dim, double factor_to_SI);
 
 /* private */
diff --git a/goffice/utils/goffice-utils.c b/goffice/utils/goffice-utils.c
index 8f1dfd1..3f3dff6 100644
--- a/goffice/utils/goffice-utils.c
+++ b/goffice/utils/goffice-utils.c
@@ -120,8 +120,8 @@ go_resource_type_get_type (void)
        if (etype == 0) {
                static GEnumValue const values[] = {
                        { GO_RESOURCE_NATIVE,   "GO_RESOURCE_NATIVE",   "native" },
-                       { GO_RESOURCE_RW,               "GO_RESOURCE_RW",               "rw" },
-                       { GO_RESOURCE_RO,               "GO_RESOURCE_RO",               "ro" },
+                       { GO_RESOURCE_RW,       "GO_RESOURCE_RW",       "rw" },
+                       { GO_RESOURCE_RO,       "GO_RESOURCE_RO",       "ro" },
                        { GO_RESOURCE_CHILD,    "GO_RESOURCE_CHILD",    "child" },
                        { GO_RESOURCE_EXTERNAL, "GO_RESOURCE_EXTERNAL", "external" },
                        { GO_RESOURCE_INVALID,  "GO_RESOURCE_INVALID",  "invalid" },
diff --git a/goffice/utils/regutf8.c b/goffice/utils/regutf8.c
index c3e6cb8..f5b859c 100644
--- a/goffice/utils/regutf8.c
+++ b/goffice/utils/regutf8.c
@@ -587,8 +587,13 @@ go_search_match_string (GOSearchReplace *sr, const char *src)
 
 /* ------------------------------------------------------------------------- */
 
-/*
- * Returns NULL if nothing changed, or a g_malloc string otherwise.
+/**
+ * go_search_replace_string:
+ * @sr: A #GOSearchReplace search-and-replace specification
+ * @src: the source string
+ *
+ * Returns: (transfer full) (nullable): the string after search-and-replace.
+ * However, if nothing changed, %NULL is returned.
  */
 char *
 go_search_replace_string (GOSearchReplace *sr, const char *src)


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