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
6962020b
Commit
6962020b
authored
Mar 28, 2008
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
module: Make sure we can escape ':' correctly.
parent
242a2d12
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
20 deletions
+59
-20
src/modules/modules.c
src/modules/modules.c
+59
-20
No files found.
src/modules/modules.c
View file @
6962020b
...
...
@@ -906,59 +906,99 @@ void module_PutConfig( module_config_t *config )
* Following functions are local.
*****************************************************************************/
/*****************************************************************************
* copy_next_paths_token: from a PATH_SEP_CHAR (a ':' or a ';') separated paths
* return first path.
*****************************************************************************/
static
char
*
copy_next_paths_token
(
char
*
paths
,
char
**
remaining_paths
)
{
char
*
path
;
int
i
;
bool
escaped
=
false
;
assert
(
paths
);
/* Alloc a buffer to store the path */
path
=
malloc
(
strlen
(
paths
)
);
if
(
!
path
)
return
NULL
;
/* Look for PATH_SEP_CHAR (a ':' or a ';') */
for
(
i
=
0
;
paths
[
i
];
i
++
)
{
/* Take care of \\ and \: or \; escapement */
if
(
escaped
)
{
escaped
=
false
;
path
[
i
]
=
paths
[
i
];
}
else
if
(
paths
[
i
]
==
'\\'
)
escaped
=
true
;
else
if
(
paths
[
i
]
==
PATH_SEP_CHAR
)
break
;
else
path
[
i
]
=
paths
[
i
];
}
/* Return the remaining paths */
if
(
remaining_paths
)
{
*
remaining_paths
=
paths
[
i
]
?
&
paths
[
i
]
+
1
:
NULL
;
}
return
path
;
}
/*****************************************************************************
* AllocateAllPlugins: load all plugin modules we can find.
*****************************************************************************/
#ifdef HAVE_DYNAMIC_PLUGINS
static
void
AllocateAllPlugins
(
vlc_object_t
*
p_this
)
{
char
*
path
,
*
ppsz_path
,
*
psz
_iter
;
char
*
path
s
,
*
path
,
*
paths
_iter
;
#if defined( WIN32 ) || defined( UNDER_CE )
const
char
*
extra_path
=
""
;
#else
const
char
*
extra_path
=
PLUGIN_PATH
;
const
char
*
extra_path
=
":"
PLUGIN_PATH
;
#endif
/* If the user provided a plugin path, we add it to the list */
char
*
userpath
=
config_GetPsz
(
p_this
,
"plugin-path"
);
bool
end
=
false
;
char
*
userpaths
=
config_GetPsz
(
p_this
,
"plugin-path"
);
if
(
asprintf
(
&
path
,
"modules%s:plugins:%s"
,
extra_path
,
userpath
)
<
0
)
if
(
asprintf
(
&
path
s
,
"modules%s:plugins:%s"
,
extra_path
,
userpaths
)
<
0
)
{
msg_Err
(
p_this
,
"Not enough memory"
);
free
(
userpath
);
free
(
userpath
s
);
return
;
}
/* Free plugin-path */
free
(
userpath
);
free
(
userpath
s
);
for
(
p
psz_path
=
path
;
!
end
;
)
for
(
p
aths_iter
=
paths
;
paths_iter
;
)
{
char
*
psz_fullpath
;
/* Look for PATH_SEP_CHAR (a ':' or a ';') */
for
(
psz_iter
=
ppsz_path
;
*
psz_iter
&&
*
psz_iter
!=
PATH_SEP_CHAR
;
psz_iter
++
);
if
(
!*
psz_iter
)
end
=
true
;
else
*
psz_iter
=
0
;
path
=
copy_next_paths_token
(
paths_iter
,
&
paths_iter
);
if
(
!
path
)
{
msg_Err
(
p_this
,
"Not enough memory"
);
return
;
}
#if defined( SYS_BEOS ) || defined( __APPLE__ ) || defined( WIN32 )
/* Handle relative as well as absolute paths */
#ifdef WIN32
if
(
p
psz_path
[
0
]
!=
'\\'
&&
ppsz_path
[
0
]
!=
'/'
&&
ppsz_
path
[
0
]
!=
':'
)
if
(
p
ath
[
0
]
!=
'\\'
&&
path
[
0
]
!=
'/'
&&
path
[
0
]
!=
':'
)
#else
if
(
p
psz_p
ath
[
0
]
!=
'/'
)
if
(
path
[
0
]
!=
'/'
)
#endif
{
if
(
0
>=
asprintf
(
&
psz_fullpath
,
"%s"
DIR_SEP
"%s"
,
vlc_global
()
->
psz_vlcpath
,
p
psz_p
ath
)
)
vlc_global
()
->
psz_vlcpath
,
path
)
)
psz_fullpath
=
NULL
;
}
else
#endif
psz_fullpath
=
strdup
(
p
psz_p
ath
);
psz_fullpath
=
strdup
(
path
);
if
(
psz_fullpath
==
NULL
)
continue
;
...
...
@@ -969,11 +1009,10 @@ static void AllocateAllPlugins( vlc_object_t *p_this )
AllocatePluginDir
(
p_this
,
psz_fullpath
,
5
);
free
(
psz_fullpath
);
if
(
!
end
)
ppsz_path
=
psz_iter
+
1
;
free
(
path
)
;
}
/* Free plugin-path */
free
(
path
);
free
(
paths
);
}
/*****************************************************************************
...
...
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