summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
Diffstat (limited to 'pango')
-rw-r--r--pango/break.c24
-rw-r--r--pango/glyphstring.c8
-rw-r--r--pango/pango-attributes.c18
-rw-r--r--pango/pango-bidi-type.c1
-rw-r--r--pango/pango-emoji.c3
-rw-r--r--pango/pango-layout.c53
-rw-r--r--pango/pango-markup.c3
-rw-r--r--pango/pango-renderer.c8
-rw-r--r--pango/pangofc-fontmap.c2
9 files changed, 73 insertions, 47 deletions
diff --git a/pango/break.c b/pango/break.c
index b8f70855..b2586da2 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -356,7 +356,7 @@ pango_default_break (const gchar *text,
makes_hangul_syllable = (prev_end == this_start) || (prev_end + 1 == this_start);
}
- switch (type)
+ switch ((int)type)
{
case G_UNICODE_SPACE_SEPARATOR:
case G_UNICODE_LINE_SEPARATOR:
@@ -387,7 +387,7 @@ pango_default_break (const gchar *text,
/* Find the GraphemeBreakType of wc */
GB_type = GB_Other;
- switch ((int) type)
+ switch ((int)type)
{
case G_UNICODE_FORMAT:
if (G_UNLIKELY (wc == 0x200C))
@@ -471,8 +471,6 @@ pango_default_break (const gchar *text,
{
if (prev_GB_type == GB_RI_Odd)
GB_type = GB_RI_Even;
- else if (prev_GB_type == GB_RI_Even)
- GB_type = GB_RI_Odd;
else
GB_type = GB_RI_Odd;
break;
@@ -484,6 +482,9 @@ pango_default_break (const gchar *text,
if (wc >= 0x1F3FB && wc <= 0x1F3FF)
GB_type = GB_Extend;
break;
+
+ default:
+ break;
}
/* Rule GB11 */
@@ -587,6 +588,8 @@ pango_default_break (const gchar *text,
if (wc == 0x058A)
WB_type = WB_ALetter; /* ALetter exceptions */
break;
+ default:
+ break;
}
if (WB_type == WB_Other)
@@ -600,6 +603,8 @@ pango_default_break (const gchar *text,
if (wc != 0x003A && wc != 0xFE13 && wc != 0x002E)
WB_type = WB_MidNum; /* MidNum */
break;
+ default:
+ break;
}
if (WB_type == WB_Other)
@@ -683,6 +688,8 @@ pango_default_break (const gchar *text,
if (break_type != G_UNICODE_BREAK_COMPLEX_CONTEXT && script != PANGO_SCRIPT_HIRAGANA)
WB_type = WB_ALetter; /* ALetter */
break;
+ default:
+ break;
}
if (WB_type == WB_Other)
@@ -870,6 +877,9 @@ pango_default_break (const gchar *text,
SB_type = SB_STerm;
break;
+
+ default:
+ break;
}
if (SB_type == SB_Other)
@@ -1016,7 +1026,7 @@ pango_default_break (const gchar *text,
/* Rule LB1:
assign a line breaking class to each code point of the input. */
- switch (break_type)
+ switch ((int)break_type)
{
case G_UNICODE_BREAK_AMBIGUOUS:
case G_UNICODE_BREAK_SURROGATE:
@@ -1037,7 +1047,7 @@ pango_default_break (const gchar *text,
break;
default:
- ;
+ break;
}
/* If it's not a grapheme boundary, it's not a line break either */
@@ -1080,8 +1090,6 @@ pango_default_break (const gchar *text,
{
if (prev_LB_type == LB_RI_Odd)
LB_type = LB_RI_Even;
- else if (prev_LB_type == LB_RI_Even)
- LB_type = LB_RI_Odd;
else
LB_type = LB_RI_Odd;
}
diff --git a/pango/glyphstring.c b/pango/glyphstring.c
index e937549a..89dec64e 100644
--- a/pango/glyphstring.c
+++ b/pango/glyphstring.c
@@ -391,7 +391,7 @@ pango_glyph_string_index_to_x (PangoGlyphString *glyphs,
int cluster_chars = 0;
int cluster_offset = 0;
- char *p;
+ const char *p;
g_return_if_fail (glyphs != NULL);
g_return_if_fail (length >= 0);
@@ -520,7 +520,7 @@ pango_glyph_string_x_to_index (PangoGlyphString *glyphs,
int end_index = -1;
int cluster_chars = 0;
- char *p;
+ const char *p;
gboolean found = FALSE;
@@ -616,7 +616,7 @@ pango_glyph_string_x_to_index (PangoGlyphString *glyphs,
{
if (index)
{
- char *p = text + start_index;
+ const char *p = text + start_index;
int i = 0;
while (i + 1 <= cp)
@@ -635,7 +635,7 @@ pango_glyph_string_x_to_index (PangoGlyphString *glyphs,
{
if (index)
{
- char *p = text + start_index;
+ const char *p = text + start_index;
int i = 0;
while (i + 1 < cp)
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 15814e38..28dc4105 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -1456,7 +1456,7 @@ pango_attr_text_transform_new (PangoTextTransform transform)
PangoAttrInt *
pango_attribute_as_int (PangoAttribute *attr)
{
- switch (attr->klass->type)
+ switch ((int)attr->klass->type)
{
case PANGO_ATTR_STYLE:
case PANGO_ATTR_WEIGHT:
@@ -1500,7 +1500,7 @@ pango_attribute_as_int (PangoAttribute *attr)
PangoAttrFloat *
pango_attribute_as_float (PangoAttribute *attr)
{
- switch (attr->klass->type)
+ switch ((int)attr->klass->type)
{
case PANGO_ATTR_SCALE:
case PANGO_ATTR_LINE_HEIGHT:
@@ -1525,7 +1525,7 @@ pango_attribute_as_float (PangoAttribute *attr)
PangoAttrString *
pango_attribute_as_string (PangoAttribute *attr)
{
- switch (attr->klass->type)
+ switch ((int)attr->klass->type)
{
case PANGO_ATTR_FAMILY:
return (PangoAttrString *)attr;
@@ -1551,7 +1551,7 @@ pango_attribute_as_string (PangoAttribute *attr)
PangoAttrSize *
pango_attribute_as_size (PangoAttribute *attr)
{
- switch (attr->klass->type)
+ switch ((int)attr->klass->type)
{
case PANGO_ATTR_SIZE:
case PANGO_ATTR_ABSOLUTE_SIZE:
@@ -1578,7 +1578,7 @@ pango_attribute_as_size (PangoAttribute *attr)
PangoAttrColor *
pango_attribute_as_color (PangoAttribute *attr)
{
- switch (attr->klass->type)
+ switch ((int)attr->klass->type)
{
case PANGO_ATTR_FOREGROUND:
case PANGO_ATTR_BACKGROUND:
@@ -1608,7 +1608,7 @@ pango_attribute_as_color (PangoAttribute *attr)
PangoAttrFontDesc *
pango_attribute_as_font_desc (PangoAttribute *attr)
{
- switch (attr->klass->type)
+ switch ((int)attr->klass->type)
{
case PANGO_ATTR_FONT_DESC:
return (PangoAttrFontDesc *)attr;
@@ -1634,7 +1634,7 @@ pango_attribute_as_font_desc (PangoAttribute *attr)
PangoAttrFontFeatures *
pango_attribute_as_font_features (PangoAttribute *attr)
{
- switch (attr->klass->type)
+ switch ((int)attr->klass->type)
{
case PANGO_ATTR_FONT_FEATURES:
return (PangoAttrFontFeatures *)attr;
@@ -1660,7 +1660,7 @@ pango_attribute_as_font_features (PangoAttribute *attr)
PangoAttrLanguage *
pango_attribute_as_language (PangoAttribute *attr)
{
- switch (attr->klass->type)
+ switch ((int)attr->klass->type)
{
case PANGO_ATTR_LANGUAGE:
return (PangoAttrLanguage *)attr;
@@ -1686,7 +1686,7 @@ pango_attribute_as_language (PangoAttribute *attr)
PangoAttrShape *
pango_attribute_as_shape (PangoAttribute *attr)
{
- switch (attr->klass->type)
+ switch ((int)attr->klass->type)
{
case PANGO_ATTR_SHAPE:
return (PangoAttrShape *)attr;
diff --git a/pango/pango-bidi-type.c b/pango/pango-bidi-type.c
index 32858f7e..40123a60 100644
--- a/pango/pango-bidi-type.c
+++ b/pango/pango-bidi-type.c
@@ -79,6 +79,7 @@ pango_bidi_type_for_unichar (gunichar ch)
case FRIBIDI_TYPE_RLI: return PANGO_BIDI_TYPE_RLI;
case FRIBIDI_TYPE_FSI: return PANGO_BIDI_TYPE_FSI;
case FRIBIDI_TYPE_PDI: return PANGO_BIDI_TYPE_PDI;
+ case _FRIBIDI_TYPE_SENTINEL:
default:
return PANGO_BIDI_TYPE_ON;
}
diff --git a/pango/pango-emoji.c b/pango/pango-emoji.c
index 334970d6..e1f16dba 100644
--- a/pango/pango-emoji.c
+++ b/pango/pango-emoji.c
@@ -205,7 +205,10 @@ typedef gboolean bool;
enum { false = FALSE, true = TRUE };
typedef unsigned char *emoji_text_iter_t;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wswitch-default"
#include "emoji_presentation_scanner.c"
+#pragma GCC diagnostic pop
PangoEmojiIter *
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index bf7a97e7..9114e9a1 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -2641,7 +2641,8 @@ direction_simple (PangoDirection d)
return -1;
case PANGO_DIRECTION_NEUTRAL :
return 0;
- /* no default, compiler should complain if a new values is added */
+ default:
+ break;
}
/* not reached */
return 0;
@@ -3661,7 +3662,7 @@ get_need_hyphen (PangoItem *item,
}
}
- switch (g_unichar_type (wc))
+ switch ((int)g_unichar_type (wc))
{
case G_UNICODE_SPACE_SEPARATOR:
case G_UNICODE_LINE_SEPARATOR:
@@ -4200,6 +4201,9 @@ process_line (PangoLayout *layout,
* justification */
wrapped = TRUE;
goto done;
+
+ default:
+ break;
}
}
@@ -4278,7 +4282,7 @@ static gboolean
affects_itemization (PangoAttribute *attr,
gpointer data)
{
- switch (attr->klass->type)
+ switch ((int)attr->klass->type)
{
/* These affect font selection */
case PANGO_ATTR_LANGUAGE:
@@ -4310,7 +4314,7 @@ static gboolean
affects_break_or_shape (PangoAttribute *attr,
gpointer data)
{
- switch (attr->klass->type)
+ switch ((int)attr->klass->type)
{
/* Affects breaks */
case PANGO_ATTR_ALLOW_BREAKS:
@@ -5322,30 +5326,27 @@ pango_layout_line_get_extents_and_height (PangoLayoutLine *line,
switch (private->cache_status)
{
case CACHED:
- {
- if (ink_rect)
- *ink_rect = private->ink_rect;
- if (logical_rect)
- *logical_rect = private->logical_rect;
- if (height)
- *height = private->height;
- return;
- }
+ if (ink_rect)
+ *ink_rect = private->ink_rect;
+ if (logical_rect)
+ *logical_rect = private->logical_rect;
+ if (height)
+ *height = private->height;
+ return;
+
case NOT_CACHED:
- {
- caching = TRUE;
- if (!ink_rect)
- ink_rect = &private->ink_rect;
- if (!logical_rect)
- logical_rect = &private->logical_rect;
- if (!height)
- height = &private->height;
- break;
- }
+ caching = TRUE;
+ if (!ink_rect)
+ ink_rect = &private->ink_rect;
+ if (!logical_rect)
+ logical_rect = &private->logical_rect;
+ if (!height)
+ height = &private->height;
+ break;
+
case LEAKED:
- {
- break;
- }
+ default:
+ break;
}
if (ink_rect)
diff --git a/pango/pango-markup.c b/pango/pango-markup.c
index f82aacef..22064103 100644
--- a/pango/pango-markup.c
+++ b/pango/pango-markup.c
@@ -378,6 +378,9 @@ start_element_handler (GMarkupParseContext *context,
if (strcmp ("u", element_name) == 0)
parse_func = u_parse_func;
break;
+
+ default:
+ break;
}
if (parse_func == NULL)
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index 21d09573..c91cb6ee 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -250,6 +250,8 @@ draw_underline (PangoRenderer *renderer,
rect->width,
3 * rect->height);
break;
+ default:
+ break;
}
}
@@ -274,6 +276,8 @@ draw_overline (PangoRenderer *renderer,
rect->width,
rect->height);
break;
+ default:
+ break;
}
}
@@ -388,6 +392,8 @@ add_underline (PangoRenderer *renderer,
current_rect->height = new_rect.height;
}
break;
+ default:
+ break;
}
if (renderer->underline == state->underline &&
@@ -439,6 +445,8 @@ add_overline (PangoRenderer *renderer,
current_rect->height = new_rect.height;
}
break;
+ default:
+ break;
}
if (renderer->priv->overline == state->overline &&
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 9c008411..dcc2c08d 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -1649,6 +1649,8 @@ is_alias_family (const char *family_name)
return (g_ascii_strcasecmp (family_name, "sans") == 0 ||
g_ascii_strcasecmp (family_name, "serif") == 0 ||
g_ascii_strcasecmp (family_name, "system-ui") == 0);
+ default:
+ return FALSE;
}
return FALSE;