Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
423954f0
Commit
423954f0
authored
Sep 23, 2008
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Further optimize function
we already know that the string starts with a &
parent
c9b87bed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
137 additions
and
135 deletions
+137
-135
src/text/strings.c
src/text/strings.c
+137
-135
No files found.
src/text/strings.c
View file @
423954f0
...
@@ -239,129 +239,129 @@ char *encode_URI_component( const char *psz_url )
...
@@ -239,129 +239,129 @@ char *encode_URI_component( const char *psz_url )
static
const
struct
xml_entity_s
static
const
struct
xml_entity_s
{
{
char
psz_entity
[
9
];
char
psz_entity
[
8
];
uint8_t
i_length
;
uint8_t
i_length
;
char
psz_char
[
4
];
char
psz_char
[
4
];
}
p_xml_entities
[]
=
{
}
p_xml_entities
[]
=
{
/* Important: this list has to be in alphabetical order (psz_entity-wise) */
/* Important: this list has to be in alphabetical order (psz_entity-wise) */
{
"
Æ"
,
7
,
"Æ"
},
{
"
AElig;"
,
6
,
"Æ"
},
{
"
Á"
,
8
,
"Á"
},
{
"
Aacute;"
,
7
,
"Á"
},
{
"
Â"
,
7
,
"Â"
},
{
"
Acirc;"
,
6
,
"Â"
},
{
"
À"
,
8
,
"À"
},
{
"
Agrave;"
,
7
,
"À"
},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"
,
5
,
"©"
},
{
"
¤"
,
8
,
"¤"
},
{
"
curren;"
,
7
,
"¤"
},
{
"
†"
,
8
,
"†"
},
{
"
dagger;"
,
7
,
"†"
},
{
"
°"
,
5
,
"°"
},
{
"
deg;"
,
4
,
"°"
},
{
"
÷"
,
8
,
"÷"
},
{
"
divide;"
,
7
,
"÷"
},
{
"
é"
,
8
,
"é"
},
{
"
eacute;"
,
7
,
"é"
},
{
"
ê"
,
7
,
"ê"
},
{
"
ecirc;"
,
6
,
"ê"
},
{
"
è"
,
8
,
"è"
},
{
"
egrave;"
,
7
,
"è"
},
{
"
ð"
,
5
,
"ð"
},
{
"
eth;"
,
4
,
"ð"
},
{
"
ë"
,
6
,
"ë"
},
{
"
euml;"
,
5
,
"ë"
},
{
"
€"
,
6
,
"€"
},
{
"
euro;"
,
5
,
"€"
},
{
"
½"
,
8
,
"½"
},
{
"
frac12;"
,
7
,
"½"
},
{
"
¼"
,
8
,
"¼"
},
{
"
frac14;"
,
7
,
"¼"
},
{
"
¾"
,
8
,
"¾"
},
{
"
frac34;"
,
7
,
"¾"
},
{
"
…"
,
8
,
"…"
},
{
"
hellip;"
,
7
,
"…"
},
{
"
í"
,
8
,
"í"
},
{
"
iacute;"
,
7
,
"í"
},
{
"
î"
,
7
,
"î"
},
{
"
icirc;"
,
6
,
"î"
},
{
"
¡"
,
7
,
"¡"
},
{
"
iexcl;"
,
6
,
"¡"
},
{
"
ì"
,
8
,
"ì"
},
{
"
igrave;"
,
7
,
"ì"
},
{
"
¿"
,
8
,
"¿"
},
{
"
iquest;"
,
7
,
"¿"
},
{
"
ï"
,
6
,
"ï"
},
{
"
iuml;"
,
5
,
"ï"
},
{
"
«"
,
7
,
"«"
},
{
"
laquo;"
,
6
,
"«"
},
{
"
“"
,
7
,
"“"
},
{
"
ldquo;"
,
6
,
"“"
},
{
"
‹"
,
8
,
"‹"
},
{
"
lsaquo;"
,
7
,
"‹"
},
{
"
‘"
,
7
,
"‘"
},
{
"
lsquo;"
,
6
,
"‘"
},
{
"
¯"
,
6
,
"¯"
},
{
"
macr;"
,
5
,
"¯"
},
{
"
—"
,
7
,
"—"
},
{
"
mdash;"
,
6
,
"—"
},
{
"
µ"
,
7
,
"µ"
},
{
"
micro;"
,
6
,
"µ"
},
{
"
·"
,
8
,
"·"
},
{
"
middot;"
,
7
,
"·"
},
{
"
–"
,
7
,
"–"
},
{
"
ndash;"
,
6
,
"–"
},
{
"
¬"
,
5
,
"¬"
},
{
"
not;"
,
4
,
"¬"
},
{
"
ñ"
,
8
,
"ñ"
},
{
"
ntilde;"
,
7
,
"ñ"
},
{
"
ó"
,
8
,
"ó"
},
{
"
oacute;"
,
7
,
"ó"
},
{
"
ô"
,
7
,
"ô"
},
{
"
ocirc;"
,
6
,
"ô"
},
{
"
œ"
,
7
,
"œ"
},
{
"
oelig;"
,
6
,
"œ"
},
{
"
ò"
,
8
,
"ò"
},
{
"
ograve;"
,
7
,
"ò"
},
{
"
ª"
,
6
,
"ª"
},
{
"
ordf;"
,
5
,
"ª"
},
{
"
º"
,
6
,
"º"
},
{
"
ordm;"
,
5
,
"º"
},
{
"
ø"
,
8
,
"ø"
},
{
"
oslash;"
,
7
,
"ø"
},
{
"
õ"
,
8
,
"õ"
},
{
"
otilde;"
,
7
,
"õ"
},
{
"
ö"
,
6
,
"ö"
},
{
"
ouml;"
,
5
,
"ö"
},
{
"
¶"
,
6
,
"¶"
},
{
"
para;"
,
5
,
"¶"
},
{
"
‰"
,
8
,
"‰"
},
{
"
permil;"
,
7
,
"‰"
},
{
"
±"
,
8
,
"±"
},
{
"
plusmn;"
,
7
,
"±"
},
{
"
£"
,
7
,
"£"
},
{
"
pound;"
,
6
,
"£"
},
{
"
»"
,
7
,
"»"
},
{
"
raquo;"
,
6
,
"»"
},
{
"
”"
,
7
,
"”"
},
{
"
rdquo;"
,
6
,
"”"
},
{
"
®"
,
5
,
"®"
},
{
"
reg;"
,
4
,
"®"
},
{
"
›"
,
8
,
"›"
},
{
"
rsaquo;"
,
7
,
"›"
},
{
"
’"
,
7
,
"’"
},
{
"
rsquo;"
,
6
,
"’"
},
{
"
‚"
,
7
,
"‚"
},
{
"
sbquo;"
,
6
,
"‚"
},
{
"
š"
,
8
,
"š"
},
{
"
scaron;"
,
7
,
"š"
},
{
"
§"
,
6
,
"§"
},
{
"
sect;"
,
5
,
"§"
},
{
"
­"
,
5
,
""
},
{
"
shy;"
,
4
,
""
},
{
"
¹"
,
6
,
"¹"
},
{
"
sup1;"
,
5
,
"¹"
},
{
"
²"
,
6
,
"²"
},
{
"
sup2;"
,
5
,
"²"
},
{
"
³"
,
6
,
"³"
},
{
"
sup3;"
,
5
,
"³"
},
{
"
ß"
,
7
,
"ß"
},
{
"
szlig;"
,
6
,
"ß"
},
{
"
þ"
,
7
,
"þ"
},
{
"
thorn;"
,
6
,
"þ"
},
{
"
˜"
,
7
,
"˜"
},
{
"
tilde;"
,
6
,
"˜"
},
{
"
×"
,
7
,
"×"
},
{
"
times;"
,
6
,
"×"
},
{
"
™"
,
7
,
"™"
},
{
"
trade;"
,
6
,
"™"
},
{
"
ú"
,
8
,
"ú"
},
{
"
uacute;"
,
7
,
"ú"
},
{
"
û"
,
7
,
"û"
},
{
"
ucirc;"
,
6
,
"û"
},
{
"
ù"
,
8
,
"ù"
},
{
"
ugrave;"
,
7
,
"ù"
},
{
"
¨"
,
5
,
"¨"
},
{
"
uml;"
,
4
,
"¨"
},
{
"
ü"
,
6
,
"ü"
},
{
"
uuml;"
,
5
,
"ü"
},
{
"
ý"
,
8
,
"ý"
},
{
"
yacute;"
,
7
,
"ý"
},
{
"
¥"
,
5
,
"¥"
},
{
"
yen;"
,
4
,
"¥"
},
{
"
ÿ"
,
6
,
"ÿ"
},
{
"
yuml;"
,
5
,
"ÿ"
},
};
};
/**
/**
...
@@ -376,19 +376,20 @@ void resolve_xml_special_chars( char *psz_value )
...
@@ -376,19 +376,20 @@ void resolve_xml_special_chars( char *psz_value )
{
{
if
(
*
psz_value
==
'&'
)
if
(
*
psz_value
==
'&'
)
{
{
#define TRY_CHAR( src, len, dst ) \
char
*
psz_value1
=
psz_value
+
1
;
if( !strncmp( psz_value, src, len ) ) \
#define TRY_CHAR( src, len, dst ) \
{ \
if( !strncmp( psz_value1, src, len ) ) \
*p_pos = dst; \
{ \
psz_value += len; \
*p_pos = dst; \
psz_value += len; \
}
}
TRY_CHAR
(
"
&
lt;"
,
4
,
'<'
)
TRY_CHAR
(
"lt;"
,
4
,
'<'
)
else
TRY_CHAR
(
"
&
amp;"
,
5
,
'&'
)
else
TRY_CHAR
(
"amp;"
,
5
,
'&'
)
else
TRY_CHAR
(
"
&
apos;"
,
6
,
'\''
)
else
TRY_CHAR
(
"apos;"
,
6
,
'\''
)
else
TRY_CHAR
(
"
&
gt;"
,
4
,
'>'
)
else
TRY_CHAR
(
"gt;"
,
4
,
'>'
)
else
TRY_CHAR
(
"
&
quot;"
,
6
,
'"'
)
else
TRY_CHAR
(
"quot;"
,
6
,
'"'
)
#undef TRY_CHAR
#undef TRY_CHAR
else
if
(
psz_value
[
1
]
==
'#'
)
else
if
(
*
psz_value1
==
'#'
)
{
{
char
*
psz_end
;
char
*
psz_end
;
int
i
=
strtol
(
psz_value
+
2
,
&
psz_end
,
10
);
int
i
=
strtol
(
psz_value
+
2
,
&
psz_end
,
10
);
...
@@ -427,14 +428,15 @@ void resolve_xml_special_chars( char *psz_value )
...
@@ -427,14 +428,15 @@ void resolve_xml_special_chars( char *psz_value )
if
(
i
>=
i_entities
)
if
(
i
>=
i_entities
)
cmp
=
-
1
;
cmp
=
-
1
;
else
else
cmp
=
strncmp
(
psz_value
,
p_xml_entities
[
i
].
psz_entity
,
cmp
=
strncmp
(
psz_value1
,
/* Skip the & */
p_xml_entities
[
i
].
psz_entity
,
p_xml_entities
[
i
].
i_length
);
p_xml_entities
[
i
].
i_length
);
if
(
cmp
==
0
)
if
(
cmp
==
0
)
{
{
s
trncpy
(
p_pos
,
p_xml_entities
[
i
].
psz_char
,
s
ize_t
i_len
=
strlen
(
p_xml_entities
[
i
].
psz_char
);
p_xml_entities
[
i
].
i_length
);
strncpy
(
p_pos
,
p_xml_entities
[
i
].
psz_char
,
i_len
);
p_pos
+=
strlen
(
p_xml_entities
[
i
].
psz_char
)
-
1
;
p_pos
+=
i_len
-
1
;
psz_value
+=
p_xml_entities
[
i
].
i_length
;
psz_value
+=
p_xml_entities
[
i
].
i_length
+
1
;
break
;
break
;
}
}
else
if
(
cmp
<
0
)
else
if
(
cmp
<
0
)
...
...
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