Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
133d5856
Commit
133d5856
authored
May 19, 2009
by
JP Dinger
Committed by
JP Dinger
May 20, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sprintf +n in file.c, plus add and use vlc_num_keys and vlc_num_modifiers.
Signed-off-by:
JP Dinger
<
jpd@videolan.org
>
parent
224dccda
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
20 deletions
+23
-20
include/vlc_keys.h
include/vlc_keys.h
+7
-4
modules/gui/wince/preferences_widgets.cpp
modules/gui/wince/preferences_widgets.cpp
+3
-6
src/config/file.c
src/config/file.c
+13
-10
No files found.
include/vlc_keys.h
View file @
133d5856
...
...
@@ -108,6 +108,8 @@ static const struct key_descriptor_s vlc_modifiers[] =
{
"Meta"
,
KEY_MODIFIER_META
},
{
"Command"
,
KEY_MODIFIER_COMMAND
}
};
enum
{
vlc_num_modifiers
=
sizeof
(
vlc_modifiers
)
/
sizeof
(
struct
key_descriptor_s
)
};
static
const
struct
key_descriptor_s
vlc_keys
[]
=
{
...
...
@@ -221,11 +223,12 @@ static const struct key_descriptor_s vlc_keys[] =
{
"Media Stop"
,
KEY_MEDIA_STOP
},
{
"Media Play Pause"
,
KEY_MEDIA_PLAY_PAUSE
}
};
enum
{
vlc_num_keys
=
sizeof
(
vlc_keys
)
/
sizeof
(
struct
key_descriptor_s
)
};
static
inline
const
char
*
KeyToString
(
int
i_key
)
{
unsigned
int
i
=
0
;
for
(
i
=
0
;
i
<
sizeof
(
vlc_keys
)
/
sizeof
(
key_descriptor_t
);
i
++
)
size_t
i
;
for
(
i
=
0
;
i
<
vlc_num_keys
;
++
i
)
{
if
(
vlc_keys
[
i
].
i_key_code
==
i_key
)
{
...
...
@@ -237,8 +240,8 @@ static inline const char *KeyToString( int i_key )
static
inline
int
StringToKey
(
char
*
psz_key
)
{
unsigned
int
i
=
0
;
for
(
i
=
0
;
i
<
sizeof
(
vlc_keys
)
/
sizeof
(
key_descriptor_t
);
i
++
)
size_t
i
;
for
(
i
=
0
;
i
<
vlc_num_keys
;
++
i
)
{
if
(
!
strcmp
(
vlc_keys
[
i
].
psz_key_string
,
psz_key
))
{
...
...
modules/gui/wince/preferences_widgets.cpp
View file @
133d5856
...
...
@@ -171,14 +171,11 @@ KeyConfigControl::KeyConfigControl( vlc_object_t *p_this,
int
*
py_pos
)
:
ConfigControl
(
p_this
,
p_item
,
parent
,
hInst
)
{
// Number of keys descriptions
unsigned
int
i_keys
=
sizeof
(
vlc_keys
)
/
sizeof
(
key_descriptor_t
);
// Init the keys decriptions array
if
(
m_keysList
==
NULL
)
{
m_keysList
=
new
string
[
i
_keys
];
for
(
unsigned
int
i
=
0
;
i
<
i_keys
;
i
++
)
m_keysList
=
new
string
[
vlc_num
_keys
];
for
(
size_t
i
=
0
;
i
<
vlc_num_keys
;
++
i
)
{
m_keysList
[
i
]
=
vlc_keys
[
i
].
psz_key_string
;
}
...
...
@@ -233,7 +230,7 @@ KeyConfigControl::KeyConfigControl( vlc_object_t *p_this,
*
py_pos
+=
15
+
10
;
for
(
unsigned
int
i
=
0
;
i
<
i_keys
;
i
++
)
for
(
size_t
i
=
0
;
i
<
vlc_num_keys
;
++
i
)
{
ComboBox_AddString
(
combo
,
_FROMMB
(
m_keysList
[
i
].
c_str
())
);
ComboBox_SetItemData
(
combo
,
i
,
(
void
*
)
vlc_keys
[
i
].
i_key_code
);
...
...
src/config/file.c
View file @
133d5856
...
...
@@ -744,11 +744,11 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name )
int
ConfigStringToKey
(
const
char
*
psz_key
)
{
int
i_key
=
0
;
unsigned
in
t
i
;
size_
t
i
;
const
char
*
psz_parser
=
strchr
(
psz_key
,
'-'
);
while
(
psz_parser
&&
psz_parser
!=
psz_key
)
{
for
(
i
=
0
;
i
<
sizeof
(
vlc_modifiers
)
/
sizeof
(
key_descriptor_t
);
i
++
)
for
(
i
=
0
;
i
<
vlc_num_modifiers
;
++
i
)
{
if
(
!
strncasecmp
(
vlc_modifiers
[
i
].
psz_key_string
,
psz_key
,
strlen
(
vlc_modifiers
[
i
].
psz_key_string
)
)
)
...
...
@@ -759,7 +759,7 @@ int ConfigStringToKey( const char *psz_key )
psz_key
=
psz_parser
+
1
;
psz_parser
=
strchr
(
psz_key
,
'-'
);
}
for
(
i
=
0
;
i
<
sizeof
(
vlc_keys
)
/
sizeof
(
key_descriptor_t
);
i
++
)
for
(
i
=
0
;
i
<
vlc_num_keys
;
++
i
)
{
if
(
!
strcasecmp
(
vlc_keys
[
i
].
psz_key_string
,
psz_key
)
)
{
...
...
@@ -772,7 +772,10 @@ int ConfigStringToKey( const char *psz_key )
char
*
ConfigKeyToString
(
int
i_key
)
{
char
*
psz_key
=
malloc
(
100
);
// Worst case appears to be 45 characters:
// "Command-Meta-Ctrl-Shift-Alt-Browser Favorites"
enum
{
keylen
=
64
};
char
*
psz_key
=
malloc
(
keylen
);
char
*
p
;
size_t
index
;
...
...
@@ -783,20 +786,20 @@ char *ConfigKeyToString( int i_key )
*
psz_key
=
'\0'
;
p
=
psz_key
;
for
(
index
=
0
;
index
<
(
sizeof
(
vlc_modifiers
)
/
sizeof
(
key_descriptor_t
));
index
++
)
for
(
index
=
0
;
index
<
vlc_num_modifiers
;
++
index
)
{
if
(
i_key
&
vlc_modifiers
[
index
].
i_key_code
)
{
p
+=
sprintf
(
p
,
"%s-"
,
vlc_modifiers
[
index
].
psz_key_string
);
p
+=
snprintf
(
p
,
keylen
-
(
psz_key
-
p
),
"%s-"
,
vlc_modifiers
[
index
].
psz_key_string
);
}
}
for
(
index
=
0
;
index
<
(
sizeof
(
vlc_keys
)
/
sizeof
(
key_descriptor_t
));
index
++
)
for
(
index
=
0
;
index
<
vlc_num_keys
;
++
index
)
{
if
(
(
int
)(
i_key
&
~
KEY_MODIFIER
)
==
vlc_keys
[
index
].
i_key_code
)
{
p
+=
sprintf
(
p
,
"%s"
,
vlc_keys
[
index
].
psz_key_string
);
p
+=
snprintf
(
p
,
keylen
-
(
psz_key
-
p
),
"%s"
,
vlc_keys
[
index
].
psz_key_string
);
break
;
}
}
...
...
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