- {
- from++;
- if (*from == '#')
- {
- gboolean is_hex = FALSE;
- gulong l;
- gchar *end = NULL;
-
- from++;
-
- if (*from == 'x')
- {
- is_hex = TRUE;
- from++;
- }
-
- /* digit is between start and p */
- errno = 0;
- if (is_hex)
- l = strtoul (from, &end, 16);
- else
- l = strtoul (from, &end, 10);
-
- if (end == from || errno != 0)
- {
- set_unescape_error (context, error,
- from, G_MARKUP_ERROR_PARSE,
- _("Failed to parse '%-.*s', which "
- "should have been a digit "
- "inside a character reference "
- "(ê for example) - perhaps "
- "the digit is too large"),
- end - from, from);
- return FALSE;
- }
- else if (*end != ';')
- {
- set_unescape_error (context, error,
- from, G_MARKUP_ERROR_PARSE,
- _("Character reference did not end with a "
- "semicolon; "
- "most likely you used an ampersand "
- "character without intending to start "
- "an entity - escape ampersand as &"));
- return FALSE;
- }
- else
- {
- /* characters XML 1.1 permits */
- if ((0 < l && l <= 0xD7FF) ||
- (0xE000 <= l && l <= 0xFFFD) ||
- (0x10000 <= l && l <= 0x10FFFF))
- {
- gchar buf[8];
- char_str (l, buf);
- strcpy (to, buf);
- to += strlen (buf) - 1;
- from = end;
- if (l >= 0x80) /* not ascii */
- mask |= 0x80;
- }
- else
- {
- set_unescape_error (context, error,
- from, G_MARKUP_ERROR_PARSE,
- _("Character reference '%-.*s' does not "
- "encode a permitted character"),
- end - from, from);
- return FALSE;
- }
- }
+ {
+ from++;
+ if (*from == '#')
+ {
+ gboolean is_hex = FALSE;
+ gulong l;
+ gchar *end = NULL;
+
+ from++;
+
+ if (*from == 'x')
+ {
+ is_hex = TRUE;
+ from++;
+ }
+
+ /* digit is between start and p */
+ errno = 0;
+ if (is_hex)
+ l = strtoul (from, &end, 16);
+ else
+ l = strtoul (from, &end, 10);
+
+ if (end == from || errno != 0)
+ {
+ set_unescape_error (context, error,
+ from, G_MARKUP_ERROR_PARSE,
+ _("Failed to parse '%-.*s', which "
+ "should have been a digit "
+ "inside a character reference "
+ "(ê for example) - perhaps "
+ "the digit is too large"),
+ (int)(end - from), from);
+ return FALSE;
+ }
+ else if (*end != ';')
+ {
+ set_unescape_error (context, error,
+ from, G_MARKUP_ERROR_PARSE,
+ _("Character reference did not end with a "
+ "semicolon; "
+ "most likely you used an ampersand "
+ "character without intending to start "
+ "an entity - escape ampersand as &"));
+ return FALSE;
+ }
+ else
+ {
+ /* characters XML 1.1 permits */
+ if ((0 < l && l <= 0xD7FF) ||
+ (0xE000 <= l && l <= 0xFFFD) ||
+ (0x10000 <= l && l <= 0x10FFFF))
+ {
+ gchar buf[8];
+ char_str (l, buf);
+ strcpy (to, buf);
+ to += strlen (buf) - 1;
+ from = end;
+ if (l >= 0x80) /* not ascii */
+ mask |= 0x80;
+ }
+ else
+ {
+ set_unescape_error (context, error,
+ from, G_MARKUP_ERROR_PARSE,
+ _("Character reference '%-.*s' does not "
+ "encode a permitted character"),
+ (int)(end - from), from);
+ return FALSE;
+ }
+ }