Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
eaffe5c6
Commit
eaffe5c6
authored
Sep 23, 2008
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up and speed up resolve_xml_special_chars().
parent
d966d7bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
160 additions
and
129 deletions
+160
-129
src/text/strings.c
src/text/strings.c
+160
-129
No files found.
src/text/strings.c
View file @
eaffe5c6
...
...
@@ -237,6 +237,132 @@ char *encode_URI_component( const char *psz_url )
return
strdup
(
psz_enc
);
}
static
struct
xml_entity_s
{
const
char
*
psz_entity
;
size_t
i_length
;
const
char
*
psz_char
;
}
p_xml_entities
[]
=
{
{
"Æ"
,
7
,
"Æ"
},
{
"Á"
,
8
,
"Á"
},
{
"Â"
,
7
,
"Â"
},
{
"À"
,
8
,
"À"
},
{
"Å"
,
7
,
"Å"
},
{
"Ã"
,
8
,
"Ã"
},
{
"Ä"
,
6
,
"Ä"
},
{
"Ç"
,
8
,
"Ç"
},
{
"‡"
,
8
,
"‡"
},
{
"Ð"
,
5
,
"Ð"
},
{
"É"
,
8
,
"É"
},
{
"Ê"
,
7
,
"Ê"
},
{
"È"
,
8
,
"È"
},
{
"Ë"
,
6
,
"Ë"
},
{
"Í"
,
8
,
"Í"
},
{
"Î"
,
7
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"
,
8
,
"ì"
},
{
"¿"
,
8
,
"¿"
},
{
"ï"
,
6
,
"ï"
},
{
"«"
,
7
,
"«"
},
{
"“"
,
7
,
"“"
},
{
"‹"
,
8
,
"‹"
},
{
"‘"
,
7
,
"‘"
},
{
"¯"
,
6
,
"¯"
},
{
"—"
,
7
,
"—"
},
{
"µ"
,
7
,
"µ"
},
{
"·"
,
8
,
"·"
},
{
"–"
,
7
,
"–"
},
{
"¬"
,
5
,
"¬"
},
{
"ñ"
,
8
,
"ñ"
},
{
"ó"
,
8
,
"ó"
},
{
"ô"
,
7
,
"ô"
},
{
"œ"
,
7
,
"œ"
},
{
"ò"
,
8
,
"ò"
},
{
"ª"
,
6
,
"ª"
},
{
"º"
,
6
,
"º"
},
{
"ø"
,
8
,
"ø"
},
{
"õ"
,
8
,
"õ"
},
{
"ö"
,
6
,
"ö"
},
{
"¶"
,
6
,
"¶"
},
{
"‰"
,
8
,
"‰"
},
{
"±"
,
8
,
"±"
},
{
"£"
,
7
,
"£"
},
{
"»"
,
7
,
"»"
},
{
"”"
,
7
,
"”"
},
{
"®"
,
5
,
"®"
},
{
"›"
,
8
,
"›"
},
{
"’"
,
7
,
"’"
},
{
"‚"
,
7
,
"‚"
},
{
"š"
,
8
,
"š"
},
{
"§"
,
6
,
"§"
},
{
"­"
,
5
,
""
},
{
"¹"
,
6
,
"¹"
},
{
"²"
,
6
,
"²"
},
{
"³"
,
6
,
"³"
},
{
"ß"
,
7
,
"ß"
},
{
"þ"
,
7
,
"þ"
},
{
"˜"
,
7
,
"˜"
},
{
"×"
,
7
,
"×"
},
{
"™"
,
7
,
"™"
},
{
"ú"
,
8
,
"ú"
},
{
"û"
,
7
,
"û"
},
{
"ù"
,
8
,
"ù"
},
{
"¨"
,
5
,
"¨"
},
{
"ü"
,
6
,
"ü"
},
{
"ý"
,
8
,
"ý"
},
{
"¥"
,
5
,
"¥"
},
{
"ÿ"
,
6
,
"ÿ"
},
};
/**
* Converts "<", ">" and "&" to "<", ">" and "&"
* \param string to convert
...
...
@@ -255,18 +381,11 @@ void resolve_xml_special_chars( char *psz_value )
*p_pos = dst; \
psz_value += len; \
}
#define TRY_LONGCHAR( src, len, dst ) \
if( !strncmp( psz_value, src, len ) ) \
{ \
strncpy( p_pos, dst, strlen( dst ) ); \
p_pos += strlen( dst ) - 1; \
psz_value += len; \
}
TRY_CHAR
(
"<"
,
4
,
'<'
)
else
TRY_CHAR
(
">"
,
4
,
'>'
)
else
TRY_CHAR
(
"&"
,
5
,
'&'
)
else
TRY_CHAR
(
"""
,
6
,
'"'
)
else
TRY_CHAR
(
"'"
,
6
,
'\''
)
else
TRY_CHAR
(
">"
,
4
,
'>'
)
else
TRY_CHAR
(
"""
,
6
,
'"'
)
else
if
(
psz_value
[
1
]
==
'#'
)
{
char
*
psz_end
;
...
...
@@ -292,128 +411,40 @@ void resolve_xml_special_chars( char *psz_value )
psz_value
++
;
}
}
else
TRY_LONGCHAR
(
"À"
,
8
,
"À"
)
else
TRY_LONGCHAR
(
"Á"
,
8
,
"Á"
)
else
TRY_LONGCHAR
(
"Â"
,
7
,
"Â"
)
else
TRY_LONGCHAR
(
"Ã"
,
8
,
"Ã"
)
else
TRY_LONGCHAR
(
"Ä"
,
6
,
"Ä"
)
else
TRY_LONGCHAR
(
"Å"
,
7
,
"Å"
)
else
TRY_LONGCHAR
(
"Æ"
,
7
,
"Æ"
)
else
TRY_LONGCHAR
(
"Ç"
,
8
,
"Ç"
)
else
TRY_LONGCHAR
(
"È"
,
8
,
"È"
)
else
TRY_LONGCHAR
(
"É"
,
8
,
"É"
)
else
TRY_LONGCHAR
(
"Ê"
,
7
,
"Ê"
)
else
TRY_LONGCHAR
(
"Ë"
,
6
,
"Ë"
)
else
TRY_LONGCHAR
(
"Ì"
,
8
,
"Ì"
)
else
TRY_LONGCHAR
(
"Í"
,
8
,
"Í"
)
else
TRY_LONGCHAR
(
"Î"
,
7
,
"Î"
)
else
TRY_LONGCHAR
(
"Ï"
,
6
,
"Ï"
)
else
TRY_LONGCHAR
(
"Ð"
,
5
,
"Ð"
)
else
TRY_LONGCHAR
(
"Ñ"
,
8
,
"Ñ"
)
else
TRY_LONGCHAR
(
"Ò"
,
8
,
"Ò"
)
else
TRY_LONGCHAR
(
"Ó"
,
8
,
"Ó"
)
else
TRY_LONGCHAR
(
"Ô"
,
7
,
"Ô"
)
else
TRY_LONGCHAR
(
"Õ"
,
8
,
"Õ"
)
else
TRY_LONGCHAR
(
"Ö"
,
6
,
"Ö"
)
else
TRY_LONGCHAR
(
"Ø"
,
8
,
"Ø"
)
else
TRY_LONGCHAR
(
"Ù"
,
8
,
"Ù"
)
else
TRY_LONGCHAR
(
"Ú"
,
8
,
"Ú"
)
else
TRY_LONGCHAR
(
"Û"
,
7
,
"Û"
)
else
TRY_LONGCHAR
(
"Ü"
,
6
,
"Ü"
)
else
TRY_LONGCHAR
(
"Ý"
,
8
,
"Ý"
)
else
TRY_LONGCHAR
(
"Þ"
,
7
,
"Þ"
)
else
TRY_LONGCHAR
(
"ß"
,
7
,
"ß"
)
else
TRY_LONGCHAR
(
"à"
,
8
,
"à"
)
else
TRY_LONGCHAR
(
"á"
,
8
,
"á"
)
else
TRY_LONGCHAR
(
"â"
,
7
,
"â"
)
else
TRY_LONGCHAR
(
"ã"
,
8
,
"ã"
)
else
TRY_LONGCHAR
(
"ä"
,
6
,
"ä"
)
else
TRY_LONGCHAR
(
"å"
,
7
,
"å"
)
else
TRY_LONGCHAR
(
"æ"
,
7
,
"æ"
)
else
TRY_LONGCHAR
(
"ç"
,
8
,
"ç"
)
else
TRY_LONGCHAR
(
"è"
,
8
,
"è"
)
else
TRY_LONGCHAR
(
"é"
,
8
,
"é"
)
else
TRY_LONGCHAR
(
"ê"
,
7
,
"ê"
)
else
TRY_LONGCHAR
(
"ë"
,
6
,
"ë"
)
else
TRY_LONGCHAR
(
"ì"
,
8
,
"ì"
)
else
TRY_LONGCHAR
(
"í"
,
8
,
"í"
)
else
TRY_LONGCHAR
(
"î"
,
7
,
"î"
)
else
TRY_LONGCHAR
(
"ï"
,
6
,
"ï"
)
else
TRY_LONGCHAR
(
"ð"
,
5
,
"ð"
)
else
TRY_LONGCHAR
(
"ñ"
,
8
,
"ñ"
)
else
TRY_LONGCHAR
(
"ò"
,
8
,
"ò"
)
else
TRY_LONGCHAR
(
"ó"
,
8
,
"ó"
)
else
TRY_LONGCHAR
(
"ô"
,
7
,
"ô"
)
else
TRY_LONGCHAR
(
"õ"
,
8
,
"õ"
)
else
TRY_LONGCHAR
(
"ö"
,
6
,
"ö"
)
else
TRY_LONGCHAR
(
"ø"
,
8
,
"ø"
)
else
TRY_LONGCHAR
(
"ù"
,
8
,
"ù"
)
else
TRY_LONGCHAR
(
"ú"
,
8
,
"ú"
)
else
TRY_LONGCHAR
(
"û"
,
7
,
"û"
)
else
TRY_LONGCHAR
(
"ü"
,
6
,
"ü"
)
else
TRY_LONGCHAR
(
"ý"
,
8
,
"ý"
)
else
TRY_LONGCHAR
(
"þ"
,
7
,
"þ"
)
else
TRY_LONGCHAR
(
"ÿ"
,
6
,
"ÿ"
)
else
TRY_LONGCHAR
(
"¡"
,
7
,
"¡"
)
else
TRY_LONGCHAR
(
"¤"
,
8
,
"¤"
)
else
TRY_LONGCHAR
(
"¢"
,
6
,
"¢"
)
else
TRY_LONGCHAR
(
"£"
,
7
,
"£"
)
else
TRY_LONGCHAR
(
"¥"
,
5
,
"¥"
)
else
TRY_LONGCHAR
(
"¦"
,
8
,
"¦"
)
else
TRY_LONGCHAR
(
"§"
,
6
,
"§"
)
else
TRY_LONGCHAR
(
"¨"
,
5
,
"¨"
)
else
TRY_LONGCHAR
(
"©"
,
6
,
"©"
)
else
TRY_LONGCHAR
(
"ª"
,
6
,
"ª"
)
else
TRY_LONGCHAR
(
"«"
,
7
,
"«"
)
else
TRY_LONGCHAR
(
"¬"
,
5
,
"¬"
)
else
TRY_LONGCHAR
(
"­"
,
5
,
""
)
else
TRY_LONGCHAR
(
"®"
,
5
,
"®"
)
else
TRY_LONGCHAR
(
"™"
,
7
,
"™"
)
else
TRY_LONGCHAR
(
"¯"
,
6
,
"¯"
)
else
TRY_LONGCHAR
(
"°"
,
5
,
"°"
)
else
TRY_LONGCHAR
(
"±"
,
8
,
"±"
)
else
TRY_LONGCHAR
(
"²"
,
6
,
"²"
)
else
TRY_LONGCHAR
(
"³"
,
6
,
"³"
)
else
TRY_LONGCHAR
(
"´"
,
7
,
"´"
)
else
TRY_LONGCHAR
(
"µ"
,
7
,
"µ"
)
else
TRY_LONGCHAR
(
"¶"
,
6
,
"¶"
)
else
TRY_LONGCHAR
(
"·"
,
8
,
"·"
)
else
TRY_LONGCHAR
(
"¸"
,
7
,
"¸"
)
else
TRY_LONGCHAR
(
"¹"
,
6
,
"¹"
)
else
TRY_LONGCHAR
(
"º"
,
6
,
"º"
)
else
TRY_LONGCHAR
(
"»"
,
7
,
"»"
)
else
TRY_LONGCHAR
(
"¼"
,
8
,
"¼"
)
else
TRY_LONGCHAR
(
"½"
,
8
,
"½"
)
else
TRY_LONGCHAR
(
"¾"
,
8
,
"¾"
)
else
TRY_LONGCHAR
(
"¿"
,
8
,
"¿"
)
else
TRY_LONGCHAR
(
"×"
,
7
,
"×"
)
else
TRY_LONGCHAR
(
"÷"
,
8
,
"÷"
)
else
TRY_LONGCHAR
(
"Œ"
,
7
,
"Œ"
)
else
TRY_LONGCHAR
(
"œ"
,
7
,
"œ"
)
else
TRY_LONGCHAR
(
"Š"
,
8
,
"Š"
)
else
TRY_LONGCHAR
(
"š"
,
8
,
"š"
)
else
TRY_LONGCHAR
(
"Ÿ"
,
6
,
"Ÿ"
)
else
TRY_LONGCHAR
(
"ˆ"
,
6
,
"ˆ"
)
else
TRY_LONGCHAR
(
"˜"
,
7
,
"˜"
)
else
TRY_LONGCHAR
(
"–"
,
7
,
"–"
)
else
TRY_LONGCHAR
(
"—"
,
7
,
"—"
)
else
TRY_LONGCHAR
(
"‘"
,
7
,
"‘"
)
else
TRY_LONGCHAR
(
"’"
,
7
,
"’"
)
else
TRY_LONGCHAR
(
"‚"
,
7
,
"‚"
)
else
TRY_LONGCHAR
(
"“"
,
7
,
"“"
)
else
TRY_LONGCHAR
(
"”"
,
7
,
"”"
)
else
TRY_LONGCHAR
(
"„"
,
7
,
"„"
)
else
TRY_LONGCHAR
(
"†"
,
8
,
"†"
)
else
TRY_LONGCHAR
(
"‡"
,
8
,
"‡"
)
else
TRY_LONGCHAR
(
"…"
,
8
,
"…"
)
else
TRY_LONGCHAR
(
"‰"
,
8
,
"‰"
)
else
TRY_LONGCHAR
(
"‹"
,
8
,
"‹"
)
else
TRY_LONGCHAR
(
"›"
,
8
,
"›"
)
else
TRY_LONGCHAR
(
"€"
,
6
,
"€"
)
else
{
*
p_pos
=
*
psz_value
;
psz_value
++
;
const
size_t
i_entities
=
sizeof
(
p_xml_entities
)
/
sizeof
(
p_xml_entities
[
0
]
);
assert
(
i_entities
<
128
);
size_t
step
=
128
>>
1
;
size_t
i
=
step
-
1
;
int
cmp
=
-
1
;
while
(
step
)
{
step
>>=
1
;
if
(
i
>=
i_entities
)
cmp
=
-
1
;
else
cmp
=
strncmp
(
psz_value
,
p_xml_entities
[
i
].
psz_entity
,
p_xml_entities
[
i
].
i_length
);
if
(
cmp
==
0
)
{
strncpy
(
p_pos
,
p_xml_entities
[
i
].
psz_char
,
p_xml_entities
[
i
].
i_length
);
p_pos
+=
strlen
(
p_xml_entities
[
i
].
psz_char
)
-
1
;
psz_value
+=
p_xml_entities
[
i
].
i_length
;
break
;
}
else
if
(
cmp
<
0
)
i
-=
step
;
else
i
+=
step
;
}
if
(
cmp
!=
0
)
{
*
p_pos
=
*
psz_value
;
psz_value
++
;
}
}
}
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment