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
85e000fa
Commit
85e000fa
authored
Dec 04, 2006
by
Marian Durkovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VLM quoting magic for partially quoted strings
parent
a658df6d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
38 deletions
+77
-38
src/input/vlm.c
src/input/vlm.c
+77
-38
No files found.
src/input/vlm.c
View file @
85e000fa
...
@@ -261,26 +261,37 @@ static const char quotes[] = "\"'";
...
@@ -261,26 +261,37 @@ static const char quotes[] = "\"'";
*/
*/
static
const
char
*
FindCommandEnd
(
const
char
*
psz_sent
)
static
const
char
*
FindCommandEnd
(
const
char
*
psz_sent
)
{
{
const
char
quote
=
strchr
(
quotes
,
psz_sent
[
0
])
?
psz_sent
[
0
]
:
0
;
char
c
,
quote
=
0
;
char
c
;
if
(
quote
)
psz_sent
++
;
// skip opening quote
while
((
c
=
*
psz_sent
)
!=
'\0'
)
while
((
c
=
*
psz_sent
)
!=
'\0'
)
{
{
if
(
(
quote
==
'"'
)
&&
(
c
==
'\\'
)
)
if
(
!
quote
)
{
{
psz_sent
++
;
// move past backslash
if
(
strchr
(
quotes
,
c
))
// opening quote
quote
=
c
;
else
if
(
isspace
(
c
))
// non-escaped space
return
psz_sent
;
else
if
(
c
==
'\\'
)
{
psz_sent
++
;
// skip escaped character
if
(
*
psz_sent
==
'\0'
)
if
(
*
psz_sent
==
'\0'
)
return
NULL
;
// cannot escape "nothing"
return
psz_sent
;
}
}
}
else
else
{
if
(
c
==
quote
)
// non-escaped matching quote
if
(
c
==
quote
)
// non-escaped matching quote
return
psz_sent
+
1
;
quote
=
0
;
else
else
if
((
!
quote
)
&&
isspace
(
c
))
// non-escaped blank
if
((
quote
==
'"'
)
&&
(
c
==
'\\'
))
return
psz_sent
;
{
psz_sent
++
;
// skip escaped character
if
(
*
psz_sent
==
'\0'
)
return
NULL
;
// error, closing quote missing
}
}
psz_sent
++
;
psz_sent
++
;
}
}
...
@@ -301,28 +312,55 @@ static const char *FindCommandEnd (const char *psz_sent)
...
@@ -301,28 +312,55 @@ static const char *FindCommandEnd (const char *psz_sent)
*/
*/
static
int
Unescape
(
char
*
out
,
const
char
*
in
)
static
int
Unescape
(
char
*
out
,
const
char
*
in
)
{
{
c
onst
char
quote
=
strchr
(
quotes
,
in
[
0
])
?
in
[
0
]
:
0
;
c
har
c
,
quote
=
0
;
if
(
quote
)
while
((
c
=
*
in
++
)
!=
'\0'
)
in
++
;
// skips opening quote
for
(;;)
{
{
char
c
=
*
in
++
;
if
(
!
quote
)
{
if
((
c
==
'\0'
)
||
(
c
==
quote
))
if
(
strchr
(
quotes
,
c
))
// opening quote
break
;
{
quote
=
c
;
if
((
quote
==
'"'
)
&&
(
c
==
'\\'
))
continue
;
}
else
if
(
c
==
'\\'
)
{
{
switch
(
c
=
*
in
++
)
switch
(
c
=
*
in
++
)
{
{
case
'"'
:
case
'"'
:
*
out
++
=
'"'
;
case
'\''
:
case
'\\'
:
*
out
++
=
c
;
continue
;
continue
;
case
'\\'
:
case
'\0'
:
*
out
=
'\0'
;
return
0
;
}
if
(
isspace
(
c
))
{
*
out
++
=
c
;
continue
;
}
/* None of the special cases - copy the backslash */
*
out
++
=
'\\'
;
*
out
++
=
'\\'
;
}
}
else
{
if
(
c
==
quote
)
// non-escaped matching quote
{
quote
=
0
;
continue
;
}
if
((
quote
==
'"'
)
&&
(
c
==
'\\'
))
{
switch
(
c
=
*
in
++
)
{
case
'"'
:
case
'\\'
:
*
out
++
=
c
;
continue
;
continue
;
case
'\0'
:
// should never happen
case
'\0'
:
// should never happen
...
@@ -332,6 +370,7 @@ static int Unescape (char *out, const char *in)
...
@@ -332,6 +370,7 @@ static int Unescape (char *out, const char *in)
/* None of the special cases - copy the backslash */
/* None of the special cases - copy the backslash */
*
out
++
=
'\\'
;
*
out
++
=
'\\'
;
}
}
}
*
out
++
=
c
;
*
out
++
=
c
;
}
}
...
...
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