[devhelp] util: add missing g_returns in view_set_font()



commit 2bf29a9983f2624502dae59445e140795d3cc7e3
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Feb 1 21:54:24 2018 +0100

    util: add missing g_returns in view_set_font()

 src/dh-util.c |   29 ++++++++++++++++++++---------
 1 files changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/src/dh-util.c b/src/dh-util.c
index fbdee79..8c56448 100644
--- a/src/dh-util.c
+++ b/src/dh-util.c
@@ -113,16 +113,24 @@ dh_util_view_set_font (WebKitWebView *view,
                        const gchar   *font_name_fixed,
                        const gchar   *font_name_variable)
 {
-        /* Get the font size. */
-        PangoFontDescription *font_desc_fixed = pango_font_description_from_string (font_name_fixed);
-        PangoFontDescription *font_desc_variable = pango_font_description_from_string (font_name_variable);
-        guint font_size_fixed = pango_font_description_get_size (font_desc_fixed) / PANGO_SCALE;
-        guint font_size_variable = pango_font_description_get_size (font_desc_variable) / PANGO_SCALE;
-        guint font_size_fixed_px = webkit_settings_font_size_to_pixels (font_size_fixed);
-        guint font_size_variable_px = webkit_settings_font_size_to_pixels (font_size_variable);
+        PangoFontDescription *font_desc_fixed;
+        PangoFontDescription *font_desc_variable;
+        guint font_size_fixed;
+        guint font_size_variable;
+        guint font_size_fixed_px;
+        guint font_size_variable_px;
 
-        pango_font_description_free (font_desc_fixed);
-        pango_font_description_free (font_desc_variable);
+        g_return_if_fail (WEBKIT_IS_WEB_VIEW (view));
+        g_return_if_fail (font_name_fixed != NULL);
+        g_return_if_fail (font_name_variable != NULL);
+
+        /* Get the font size. */
+        font_desc_fixed = pango_font_description_from_string (font_name_fixed);
+        font_desc_variable = pango_font_description_from_string (font_name_variable);
+        font_size_fixed = pango_font_description_get_size (font_desc_fixed) / PANGO_SCALE;
+        font_size_variable = pango_font_description_get_size (font_desc_variable) / PANGO_SCALE;
+        font_size_fixed_px = webkit_settings_font_size_to_pixels (font_size_fixed);
+        font_size_variable_px = webkit_settings_font_size_to_pixels (font_size_variable);
 
         /* Set the fonts. */
         g_object_set (webkit_web_view_get_settings (view),
@@ -135,6 +143,9 @@ dh_util_view_set_font (WebKitWebView *view,
 
         g_debug ("Set font-fixed to '%s' (%i) and font-variable to '%s' (%i).",
                  font_name_fixed, font_size_fixed_px, font_name_variable, font_size_variable_px);
+
+        pango_font_description_free (font_desc_fixed);
+        pango_font_description_free (font_desc_variable);
 }
 
 static void


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