From 6cc857aa6648b17e70b1b2b13a4e8b7a74a4a240 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 29 Aug 2016 08:50:38 -0400 Subject: Avoid deprecation warnings Now that we're using new-style deprecations, we have to fight a little harder to get rid of them inside pango. --- pango/Makefile.am | 1 + pango/break.c | 2 ++ pango/pango-context.c | 2 ++ pango/pango-engine.c | 8 ++++++-- pango/pango-markup.c | 9 +++++---- pango/pango-utils-internal.h | 45 ++++++++++++++++++++++++++++++++++++++++++++ pango/pango-utils.c | 26 +++++++++++++++++++++++-- 7 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 pango/pango-utils-internal.h (limited to 'pango') diff --git a/pango/Makefile.am b/pango/Makefile.am index 423d374f..4fddcaab 100644 --- a/pango/Makefile.am +++ b/pango/Makefile.am @@ -94,6 +94,7 @@ libpango_1_0_la_SOURCES = \ pango-script-private.h \ pango-tabs.c \ pango-utils.c \ + pango-utils-internal.h \ reorder-items.c \ shape.c \ pango-enum-types.c diff --git a/pango/break.c b/pango/break.c index b4b3c822..498f7642 100644 --- a/pango/break.c +++ b/pango/break.c @@ -1935,7 +1935,9 @@ break_script (const char *item_text, typedef PangoEngineLang PangoLanguageEngine; typedef PangoEngineLangClass PangoLanguageEngineClass; static GType pango_language_engine_get_type (void) G_GNUC_CONST; +G_GNUC_BEGIN_IGNORE_DEPRECATIONS G_DEFINE_TYPE (PangoLanguageEngine, pango_language_engine, PANGO_TYPE_ENGINE_LANG); +G_GNUC_END_IGNORE_DEPRECATIONS static void _pango_language_engine_break (PangoEngineLang *engine G_GNUC_UNUSED, const char *item_text, diff --git a/pango/pango-context.c b/pango/pango-context.c index 0344e334..f91d0fe6 100644 --- a/pango/pango-context.c +++ b/pango/pango-context.c @@ -1433,9 +1433,11 @@ itemize_state_process_run (ItemizeState *state) if (!g_object_get_data (G_OBJECT (fontmap), script_name)) { +G_GNUC_BEGIN_IGNORE_DEPRECATIONS g_warning ("failed to choose a font, expect ugly output. engine-type='%s', script='%s'", pango_font_map_get_shape_engine_type (fontmap), script_name); +G_GNUC_END_IGNORE_DEPRECATIONS g_object_set_data_full (G_OBJECT (fontmap), script_name, GINT_TO_POINTER (1), NULL); diff --git a/pango/pango-engine.c b/pango/pango-engine.c index 3f3a3c3b..a22270eb 100644 --- a/pango/pango-engine.c +++ b/pango/pango-engine.c @@ -83,8 +83,9 @@ pango_engine_class_init (PangoEngineClass *klass) { } - +G_GNUC_BEGIN_IGNORE_DEPRECATIONS G_DEFINE_ABSTRACT_TYPE (PangoEngineLang, pango_engine_lang, PANGO_TYPE_ENGINE); +G_GNUC_END_IGNORE_DEPRECATIONS static void pango_engine_lang_init (PangoEngineLang *self) @@ -111,8 +112,9 @@ pango_engine_shape_real_covers (PangoEngineShape *engine G_GNUC_UNUSED, return result; } - +G_GNUC_BEGIN_IGNORE_DEPRECATIONS G_DEFINE_ABSTRACT_TYPE (PangoEngineShape, pango_engine_shape, PANGO_TYPE_ENGINE); +G_GNUC_END_IGNORE_DEPRECATIONS static void pango_engine_shape_init (PangoEngineShape *klass) @@ -231,7 +233,9 @@ fallback_engine_covers (PangoEngineShape *engine G_GNUC_UNUSED, static GType pango_fallback_engine_get_type (void); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS G_DEFINE_TYPE (PangoFallbackEngine, pango_fallback_engine, PANGO_TYPE_ENGINE_SHAPE); +G_GNUC_END_IGNORE_DEPRECATIONS static void pango_fallback_engine_init (PangoFallbackEngine *self) diff --git a/pango/pango-markup.c b/pango/pango-markup.c index b4fe881e..c174736d 100644 --- a/pango/pango-markup.c +++ b/pango/pango-markup.c @@ -28,6 +28,7 @@ #include "pango-font.h" #include "pango-enum-types.h" #include "pango-impl-utils.h" +#include "pango-utils-internal.h" /* FIXME */ #define _(x) x @@ -952,7 +953,7 @@ span_parse_int (const char *attr_name, { const char *end = attr_val; - if (!pango_scan_int (&end, val) || *end != '\0') + if (!_pango_scan_int (&end, val) || *end != '\0') { g_set_error (error, G_MARKUP_ERROR, @@ -1037,7 +1038,7 @@ span_parse_alpha (const char *attr_name, const char *end = attr_val; int int_val; - if (pango_scan_int (&end, &int_val)) + if (_pango_scan_int (&end, &int_val)) { if (*end == '\0' && int_val > 0 && int_val <= 0xffff) { @@ -1087,7 +1088,7 @@ span_parse_enum (const char *attr_name, { char *possible_values = NULL; - if (!pango_parse_enum (type, attr_val, val, FALSE, &possible_values)) + if (!_pango_parse_enum (type, attr_val, val, FALSE, &possible_values)) { g_set_error (error, G_MARKUP_ERROR, @@ -1261,7 +1262,7 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED, const char *end; gint n; - if ((end = size, !pango_scan_int (&end, &n)) || *end != '\0' || n < 0) + if ((end = size, !_pango_scan_int (&end, &n)) || *end != '\0' || n < 0) { g_set_error (error, G_MARKUP_ERROR, diff --git a/pango/pango-utils-internal.h b/pango/pango-utils-internal.h new file mode 100644 index 00000000..6af6ed59 --- /dev/null +++ b/pango/pango-utils-internal.h @@ -0,0 +1,45 @@ +/* Pango + * pango-utils.c: Utilities for internal functions and modules + * + * Copyright (C) 2000 Red Hat Software + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __PANGO_UTILS_INTERNAL_H__ +#define __PANGO_UTILS_INTERNAL_H__ + +#include +#include +#include + +G_BEGIN_DECLS + +gboolean _pango_scan_int (const char **pos, + int *out); + +gboolean _pango_parse_enum (GType type, + const char *str, + int *value, + gboolean warn, + char **possible_values); + +char *_pango_trim_string (const char *str); + + +G_END_DECLS + +#endif /* __PANGO_UTILS_H__ */ diff --git a/pango/pango-utils.c b/pango/pango-utils.c index c7c7d654..9bdc6f15 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -47,6 +47,7 @@ #include "pango-font.h" #include "pango-features.h" #include "pango-impl-utils.h" +#include "pango-utils-internal.h" #include @@ -164,6 +165,12 @@ pango_version_check (int required_major, **/ char * pango_trim_string (const char *str) +{ + return _pango_trim_string (str); +} + +char * +_pango_trim_string (const char *str) { int len; @@ -202,7 +209,7 @@ pango_split_file_list (const char *str) while (files[i]) { - char *file = pango_trim_string (files[i]); + char *file = _pango_trim_string (files[i]); /* If the resulting file is empty, skip it */ if (file[0] == '\0') @@ -530,6 +537,12 @@ pango_scan_string (const char **pos, GString *out) **/ gboolean pango_scan_int (const char **pos, int *out) +{ + return _pango_scan_int (pos, out); +} + +gboolean +_pango_scan_int (const char **pos, int *out) { char *end; long temp; @@ -553,7 +566,6 @@ pango_scan_int (const char **pos, int *out) return TRUE; } - /** * pango_config_key_get_system: * @key: Key to look up, in the form "SECTION/KEY". @@ -700,6 +712,16 @@ pango_parse_enum (GType type, int *value, gboolean warn, char **possible_values) +{ + return _pango_parse_enum (type, str, value, warn, possible_values); +} + +gboolean +_pango_parse_enum (GType type, + const char *str, + int *value, + gboolean warn, + char **possible_values) { GEnumClass *class = NULL; gboolean ret = TRUE; -- cgit v1.2.1