Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
3a980d9f
Commit
3a980d9f
authored
May 21, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
KeyToString: divide and conquer
parent
f433cde3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
include/vlc_keys.h
include/vlc_keys.h
+15
-11
No files found.
include/vlc_keys.h
View file @
3a980d9f
...
...
@@ -90,7 +90,7 @@
typedef
struct
key_descriptor_s
{
const
char
*
psz_key_string
;
in
t
i_key_code
;
uint32_
t
i_key_code
;
}
key_descriptor_t
;
#define ADD_KEY(a) { a, *a }
...
...
@@ -220,17 +220,21 @@ static const struct key_descriptor_s vlc_keys[] =
};
enum
{
vlc_num_keys
=
sizeof
(
vlc_keys
)
/
sizeof
(
struct
key_descriptor_s
)
};
static
inline
const
char
*
KeyToString
(
int
i_key
)
#include <stdlib.h>
static
inline
int
cmpkey
(
const
void
*
key
,
const
void
*
elem
)
{
size_t
i
;
for
(
i
=
0
;
i
<
vlc_num_keys
;
++
i
)
{
if
(
vlc_keys
[
i
].
i_key_code
==
i_key
)
{
return
vlc_keys
[
i
].
psz_key_string
;
}
}
return
NULL
;
return
((
uintptr_t
)
key
)
-
((
key_descriptor_t
*
)
elem
)
->
i_key_code
;
}
static
inline
const
char
*
KeyToString
(
uint32_t
i_key
)
{
key_descriptor_t
*
d
;
d
=
(
key_descriptor_t
*
)
bsearch
((
void
*
)(
uintptr_t
)
i_key
,
vlc_keys
,
vlc_num_keys
,
sizeof
(
vlc_keys
[
0
]),
cmpkey
);
return
d
?
d
->
psz_key_string
:
NULL
;
}
static
inline
int
StringToKey
(
char
*
psz_key
)
...
...
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