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
09110552
Commit
09110552
authored
Feb 10, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unduplicate code
parent
2485777c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
27 deletions
+6
-27
src/config/keys.c
src/config/keys.c
+3
-26
src/libvlc.h
src/libvlc.h
+2
-0
src/text/unicode.c
src/text/unicode.c
+1
-1
No files found.
src/config/keys.c
View file @
09110552
...
...
@@ -32,6 +32,7 @@
#include <vlc_common.h>
#include <vlc_keys.h>
#include "configuration.h"
#include "libvlc.h"
typedef
struct
key_descriptor_s
{
...
...
@@ -147,31 +148,6 @@ static char *utf8_cp (uint_fast32_t cp, char *buf)
return
buf
;
}
/* Convert UTF-8 to Unicode code point */
static
uint_fast32_t
cp_utf8
(
const
char
*
utf8
)
{
uint8_t
f
=
utf8
[
0
];
size_t
l
=
strlen
(
utf8
);
if
(
f
<
0x80
)
/* ASCII (7 bits) */
return
f
;
if
(
f
<
0xC0
||
l
<
2
)
/* bad */
return
0
;
if
(
f
<
0xE0
)
/* two bytes (11 bits) */
return
((
f
&
0x1F
)
<<
6
)
|
(
utf8
[
1
]
&
0x3F
);
if
(
l
<
3
)
/* bad */
return
0
;
if
(
f
<
0xF0
)
/* three bytes (16 bits) */
return
((
f
&
0x0F
)
<<
12
)
|
((
utf8
[
1
]
&
0x3F
)
<<
6
)
|
(
utf8
[
2
]
&
0x3F
);
if
(
l
<
4
)
return
0
;
if
(
f
<
0xF8
)
/* four bytes (21 bits) */
return
((
f
&
0x07
)
<<
18
)
|
((
utf8
[
1
]
&
0x3F
)
<<
12
)
|
((
utf8
[
2
]
&
0x3F
)
<<
6
)
|
(
utf8
[
3
]
&
0x3F
);
return
0
;
}
char
*
KeyToString
(
uint_fast32_t
sym
)
{
key_descriptor_t
*
d
;
...
...
@@ -191,6 +167,7 @@ char *KeyToString (uint_fast32_t sym)
uint_fast32_t
ConfigStringToKey
(
const
char
*
name
)
{
uint_fast32_t
mods
=
0
;
uint32_t
cp
;
for
(;;)
{
...
...
@@ -213,7 +190,7 @@ uint_fast32_t ConfigStringToKey (const char *name)
if
(
!
strcasecmp
(
vlc_keys
[
i
].
psz_key_string
,
name
))
return
vlc_keys
[
i
].
i_key_code
|
mods
;
return
cp_utf8
(
name
)
|
mods
;
return
(
vlc_towc
(
name
,
&
cp
)
>
0
)
?
(
mods
|
cp
)
:
0
;
}
char
*
ConfigKeyToString
(
uint_fast32_t
i_key
)
...
...
src/libvlc.h
View file @
09110552
...
...
@@ -38,6 +38,8 @@ extern const size_t libvlc_actions_count;
extern
int
vlc_InitActions
(
libvlc_int_t
*
);
extern
void
vlc_DeinitActions
(
libvlc_int_t
*
);
size_t
vlc_towc
(
const
char
*
str
,
uint32_t
*
restrict
pwc
);
/*
* OS-specific initialization
*/
...
...
src/text/unicode.c
View file @
09110552
...
...
@@ -221,7 +221,7 @@ int utf8_fprintf( FILE *stream, const char *fmt, ... )
* number of bytes that the first character occupies (from 1 to 4) otherwise;
* -1 if the byte sequence was not a valid UTF-8 sequence.
*/
s
tatic
s
ize_t
vlc_towc
(
const
char
*
str
,
uint32_t
*
restrict
pwc
)
size_t
vlc_towc
(
const
char
*
str
,
uint32_t
*
restrict
pwc
)
{
uint8_t
*
ptr
=
(
uint8_t
*
)
str
;
assert
(
str
!=
NULL
);
...
...
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