Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
438
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
88e3a4f0
Commit
88e3a4f0
authored
3 years ago
by
Hugo Beauzée-Luyssen
Committed by
Jean-Baptiste Kempf
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
url: Optimize vlc_url_decode
parent
5f677641
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!664
url: Optimize vlc_url_decode
Pipeline
#192025
passed with stage
Stage:
in 19 minutes and 57 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/text/url.c
+18
-4
18 additions, 4 deletions
src/text/url.c
with
18 additions
and
4 deletions
src/text/url.c
+
18
−
4
View file @
88e3a4f0
...
...
@@ -51,6 +51,20 @@ char *vlc_uri_decode_duplicate (const char *str)
return
buf
;
}
static
char
hex_to_char
(
char
c
)
{
unsigned
char
v
=
(
unsigned
char
)
c
-
'0'
;
if
(
v
<
10
)
return
v
;
v
=
(
unsigned
)
c
-
'a'
;
if
(
v
<=
5
)
return
v
+
10
;
v
=
(
unsigned
)
c
-
'A'
;
if
(
v
<=
5
)
return
v
+
10
;
return
-
1
;
}
char
*
vlc_uri_decode
(
char
*
str
)
{
char
*
in
=
str
,
*
out
=
str
;
...
...
@@ -62,15 +76,15 @@ char *vlc_uri_decode (char *str)
{
if
(
c
==
'%'
)
{
char
hex
[
3
]
;
char
a
,
b
;
if
(
!
(
hex
[
0
]
=
*
(
in
++
))
||
!
(
hex
[
1
]
=
*
(
in
++
)))
if
((
a
=
hex_to_char
(
*
(
in
++
)))
<
0
||
(
b
=
hex_to_char
(
*
(
in
++
)))
<
0
)
{
errno
=
EINVAL
;
return
NULL
;
}
hex
[
2
]
=
'\0'
;
*
(
out
++
)
=
strtoul
(
hex
,
NULL
,
0x10
);
*
(
out
++
)
=
a
<<
4
|
b
;
}
else
*
(
out
++
)
=
c
;
...
...
This diff is collapsed.
Click to expand it.
Rémi Denis-Courmont
@Courmisch
mentioned in merge request
!1526 (merged)
·
2 years ago
mentioned in merge request
!1526 (merged)
mentioned in merge request !1526
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment