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
8fdb157f
Commit
8fdb157f
authored
Dec 03, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Only unescape VLM parameter when quoted with " ", do not unescape with ' '
- Remove opening and closing quote when unescaping
parent
9040f4ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
11 deletions
+18
-11
src/misc/vlm.c
src/misc/vlm.c
+18
-11
No files found.
src/misc/vlm.c
View file @
8fdb157f
...
...
@@ -254,6 +254,8 @@ int vlm_Load( vlm_t *p_vlm, const char *psz_file )
return
0
;
}
static
const
char
quotes
[]
=
"
\"
'"
;
/**
* FindCommandEnd: look for the end of a possibly quoted string
* @return NULL on mal-formatted string,
...
...
@@ -261,15 +263,12 @@ int vlm_Load( vlm_t *p_vlm, const char *psz_file )
*/
static
const
char
*
FindCommandEnd
(
const
char
*
psz_sent
)
{
char
quote
=
psz_sent
[
0
],
c
;
static
const
char
quotes
[]
=
"'
\"
"
;
if
(
quote
&&
(
strchr
(
quotes
,
quote
)
==
NULL
))
quote
=
'\0'
;
const
char
quote
=
strchr
(
quotes
,
psz_sent
[
0
])
?
psz_sent
[
0
]
:
0
;
char
c
;
while
((
c
=
*
psz_sent
)
!=
'\0'
)
{
if
(
c
==
'\\'
)
if
(
(
quote
==
'"'
)
&&
(
c
==
'\\'
)
)
{
if
(
*
psz_sent
==
'\0'
)
return
NULL
;
// cannot escape "nothing"
...
...
@@ -292,7 +291,7 @@ static const char *FindCommandEnd (const char *psz_sent)
/**
* Unescape
(C-style)
a nul-terminated string.
* Unescape a nul-terminated string.
* Note that in and out can be identical.
*
* @param out output buffer (at least <strlen (in) + 1> characters long)
...
...
@@ -302,11 +301,19 @@ static const char *FindCommandEnd (const char *psz_sent)
*/
static
int
Unescape
(
char
*
out
,
const
char
*
in
)
{
c
har
c
;
c
onst
char
quote
=
strchr
(
quotes
,
in
[
0
])
?
in
[
0
]
:
0
;
while
((
c
=
*
in
++
)
!=
'\0'
)
if
(
quote
)
in
++
;
// skips opening quote
for
(;;)
{
if
(
c
==
'\\'
)
char
c
=
*
in
++
;
if
((
c
==
'\0'
)
||
(
c
==
quote
))
break
;
if
((
quote
==
'"'
)
&&
(
c
==
'\\'
))
{
switch
(
c
=
*
in
++
)
{
...
...
@@ -324,7 +331,7 @@ static int Unescape (char *out, const char *in)
}
// Only allow printable ASCII characters
// (in particular, no nul
and no
extended characters)
// (in particular, no nul
nor
extended characters)
if
(
c
<
32
)
return
-
1
;
}
...
...
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