Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
dfb78a8b
Commit
dfb78a8b
authored
Feb 10, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
De-inline base64 decoder
parent
6be4bda5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
46 deletions
+50
-46
include/vlc_strings.h
include/vlc_strings.h
+2
-0
include/vlc_url.h
include/vlc_url.h
+0
-46
src/text/strings.c
src/text/strings.c
+48
-0
No files found.
include/vlc_strings.h
View file @
dfb78a8b
...
...
@@ -38,6 +38,8 @@
VLC_EXPORT
(
void
,
resolve_xml_special_chars
,
(
char
*
psz_value
)
);
VLC_EXPORT
(
char
*
,
convert_xml_special_chars
,
(
const
char
*
psz_content
)
);
VLC_EXPORT
(
char
*
,
vlc_b64_encode
,
(
const
char
*
)
);
VLC_EXPORT
(
char
*
,
str_format_time
,
(
const
char
*
)
);
#define str_format_meta( a, b ) __str_format_meta( VLC_OBJECT( a ), b )
VLC_EXPORT
(
char
*
,
__str_format_meta
,
(
vlc_object_t
*
,
const
char
*
)
);
...
...
include/vlc_url.h
View file @
dfb78a8b
...
...
@@ -211,51 +211,5 @@ static inline int vlc_UrlIsNotEncoded( const char *psz_url )
return
0
;
/* looks fine - but maybe it is not encoded */
}
/* Base64 encoding */
static
inline
char
*
vlc_b64_encode
(
const
char
*
src
)
{
static
const
char
b64
[]
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
;
size_t
len
=
strlen
(
src
);
const
uint8_t
*
in
=
(
const
uint8_t
*
)
src
;
char
*
ret
;
char
*
dst
=
(
char
*
)
malloc
(
(
len
+
4
)
*
4
/
3
);
if
(
dst
==
NULL
)
return
NULL
;
ret
=
dst
;
while
(
len
>
0
)
{
/* pops (up to) 3 bytes of input, push 4 bytes */
uint32_t
v
=
*
in
++
<<
24
;
// 1/3
*
dst
++
=
b64
[
v
>>
26
];
// 1/4
v
=
v
<<
6
;
if
(
len
>=
2
)
v
|=
*
in
++
<<
22
;
// 2/3
*
dst
++
=
b64
[
v
>>
26
];
// 2/4
v
=
v
<<
6
;
if
(
len
>=
3
)
v
|=
*
in
++
<<
20
;
// 3/3
*
dst
++
=
(
len
>=
2
)
?
b64
[
v
>>
26
]
:
'='
;
// 3/4
v
=
v
<<
6
;
*
dst
++
=
(
len
>=
3
)
?
b64
[
v
>>
26
]
:
'='
;
// 4/4
len
--
;
if
(
len
>
0
)
{
len
--
;
if
(
len
>
0
)
len
--
;
}
}
*
dst
=
'\0'
;
return
ret
;
}
#endif
src/text/strings.c
View file @
dfb78a8b
...
...
@@ -328,6 +328,54 @@ char *convert_xml_special_chars( const char *psz_content )
return
psz_temp
;
}
/* Base64 encoding */
char
*
vlc_b64_encode
(
const
char
*
src
)
{
static
const
char
b64
[]
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
;
size_t
len
=
strlen
(
src
);
const
uint8_t
*
in
=
(
const
uint8_t
*
)
src
;
char
*
ret
;
char
*
dst
=
(
char
*
)
malloc
(
(
len
+
4
)
*
4
/
3
);
if
(
dst
==
NULL
)
return
NULL
;
ret
=
dst
;
while
(
len
>
0
)
{
/* pops (up to) 3 bytes of input, push 4 bytes */
uint32_t
v
=
*
in
++
<<
24
;
// 1/3
*
dst
++
=
b64
[
v
>>
26
];
// 1/4
v
=
v
<<
6
;
if
(
len
>=
2
)
v
|=
*
in
++
<<
22
;
// 2/3
*
dst
++
=
b64
[
v
>>
26
];
// 2/4
v
=
v
<<
6
;
if
(
len
>=
3
)
v
|=
*
in
++
<<
20
;
// 3/3
*
dst
++
=
(
len
>=
2
)
?
b64
[
v
>>
26
]
:
'='
;
// 3/4
v
=
v
<<
6
;
*
dst
++
=
(
len
>=
3
)
?
b64
[
v
>>
26
]
:
'='
;
// 4/4
len
--
;
if
(
len
>
0
)
{
len
--
;
if
(
len
>
0
)
len
--
;
}
}
*
dst
=
'\0'
;
return
ret
;
}
/****************************************************************************
* String formating functions
****************************************************************************/
...
...
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