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
f45f1573
Commit
f45f1573
authored
Nov 21, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some code cleanup
parent
0f7dd9f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
19 deletions
+18
-19
src/misc/configuration.c
src/misc/configuration.c
+18
-19
No files found.
src/misc/configuration.c
View file @
f45f1573
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
#include <tchar.h>
#include <tchar.h>
#endif
#endif
static
int
ConfigStringToKey
(
char
*
);
static
int
ConfigStringToKey
(
c
onst
c
har
*
);
static
char
*
ConfigKeyToString
(
int
);
static
char
*
ConfigKeyToString
(
int
);
/*****************************************************************************
/*****************************************************************************
...
@@ -754,29 +754,24 @@ void __config_ResetAll( vlc_object_t *p_this )
...
@@ -754,29 +754,24 @@ void __config_ResetAll( vlc_object_t *p_this )
int
__config_LoadConfigFile
(
vlc_object_t
*
p_this
,
const
char
*
psz_module_name
)
int
__config_LoadConfigFile
(
vlc_object_t
*
p_this
,
const
char
*
psz_module_name
)
{
{
vlc_list_t
*
p_list
;
vlc_list_t
*
p_list
;
module_t
*
p_parser
;
module_config_t
*
p_item
;
FILE
*
file
;
FILE
*
file
;
char
line
[
1024
];
char
*
p_index
;
char
*
p_index
,
*
psz_option_name
,
*
psz_option_value
;
char
*
psz_filename
;
char
*
psz_filename
,
*
psz_homedir
,
*
psz_configfile
;
int
i_index
;
int
i_index
;
psz_configfile
=
p_this
->
p_libvlc
->
psz_configfile
;
const
char
*
psz_configfile
=
p_this
->
p_libvlc
->
psz_configfile
;
if
(
!
psz_configfile
||
!
psz_configfile
)
if
(
!
psz_configfile
||
!
psz_configfile
)
{
{
psz_homedir
=
p_this
->
p_libvlc
->
psz_homedir
;
const
char
*
psz_homedir
=
p_this
->
p_libvlc
->
psz_homedir
;
if
(
!
psz_homedir
)
if
(
!
psz_homedir
)
{
{
msg_Err
(
p_this
,
"psz_homedir is null"
);
msg_Err
(
p_this
,
"psz_homedir is null"
);
return
-
1
;
return
-
1
;
}
}
psz_filename
=
(
char
*
)
malloc
(
sizeof
(
"/"
CONFIG_DIR
"/"
CONFIG_FILE
)
+
strlen
(
psz_homedir
)
);
if
(
asprintf
(
&
psz_filename
,
"%s"
DIR_SEP
CONFIG_DIR
DIR_SEP
CONFIG_FILE
,
if
(
psz_filename
)
psz_homedir
)
==
-
1
)
sprintf
(
psz_filename
,
psz_filename
=
NULL
;
"%s"
DIR_SEP
CONFIG_DIR
DIR_SEP
CONFIG_FILE
,
psz_homedir
);
}
}
else
else
{
{
...
@@ -795,20 +790,22 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
...
@@ -795,20 +790,22 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
vlc_mutex_lock
(
&
p_this
->
p_libvlc
->
config_lock
);
vlc_mutex_lock
(
&
p_this
->
p_libvlc
->
config_lock
);
file
=
utf8_fopen
(
psz_filename
,
"rt"
);
file
=
utf8_fopen
(
psz_filename
,
"rt"
);
if
(
!
file
)
if
(
file
==
NULL
)
{
{
msg_Warn
(
p_this
,
"config file %s does not exist yet"
,
psz_filename
);
msg_Warn
(
p_this
,
"config file %s does not exist yet"
,
psz_filename
);
free
(
psz_filename
);
free
(
psz_filename
);
vlc_mutex_unlock
(
&
p_this
->
p_libvlc
->
config_lock
);
vlc_mutex_unlock
(
&
p_this
->
p_libvlc
->
config_lock
);
return
-
1
;
return
-
1
;
}
}
free
(
psz_filename
);
/* Look for the selected module, if NULL then save everything */
/* Look for the selected module, if NULL then save everything */
p_list
=
vlc_list_find
(
p_this
,
VLC_OBJECT_MODULE
,
FIND_ANYWHERE
);
p_list
=
vlc_list_find
(
p_this
,
VLC_OBJECT_MODULE
,
FIND_ANYWHERE
);
for
(
i_index
=
0
;
i_index
<
p_list
->
i_count
;
i_index
++
)
for
(
i_index
=
0
;
i_index
<
p_list
->
i_count
;
i_index
++
)
{
{
p_parser
=
(
module_t
*
)
p_list
->
p_values
[
i_index
].
p_object
;
module_t
*
p_parser
=
(
module_t
*
)
p_list
->
p_values
[
i_index
].
p_object
;
char
line
[
1024
];
if
(
psz_module_name
if
(
psz_module_name
&&
strcmp
(
psz_module_name
,
p_parser
->
psz_object_name
)
)
&&
strcmp
(
psz_module_name
,
p_parser
->
psz_object_name
)
)
...
@@ -841,6 +838,9 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
...
@@ -841,6 +838,9 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
/* Now try to load the options in this section */
/* Now try to load the options in this section */
while
(
fgets
(
line
,
1024
,
file
)
)
while
(
fgets
(
line
,
1024
,
file
)
)
{
{
const
char
*
psz_option_name
,
*
psz_option_value
;
module_config_t
*
p_item
;
if
(
line
[
0
]
==
'['
)
break
;
/* end of section */
if
(
line
[
0
]
==
'['
)
break
;
/* end of section */
/* ignore comments or empty lines */
/* ignore comments or empty lines */
...
@@ -945,7 +945,6 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
...
@@ -945,7 +945,6 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
vlc_list_release
(
p_list
);
vlc_list_release
(
p_list
);
fclose
(
file
);
fclose
(
file
);
free
(
psz_filename
);
vlc_mutex_unlock
(
&
p_this
->
p_libvlc
->
config_lock
);
vlc_mutex_unlock
(
&
p_this
->
p_libvlc
->
config_lock
);
...
@@ -1809,11 +1808,11 @@ char *config_GetUserDir( void )
...
@@ -1809,11 +1808,11 @@ char *config_GetUserDir( void )
}
}
static
int
ConfigStringToKey
(
char
*
psz_key
)
static
int
ConfigStringToKey
(
c
onst
c
har
*
psz_key
)
{
{
int
i_key
=
0
;
int
i_key
=
0
;
unsigned
int
i
;
unsigned
int
i
;
char
*
psz_parser
=
strchr
(
psz_key
,
'-'
);
c
onst
c
har
*
psz_parser
=
strchr
(
psz_key
,
'-'
);
while
(
psz_parser
&&
psz_parser
!=
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
<
sizeof
(
vlc_modifiers
)
/
sizeof
(
key_descriptor_t
);
i
++
)
...
...
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