Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
cee1b3a7
Commit
cee1b3a7
authored
Jun 22, 1999
by
Eric Pouech
Committed by
Alexandre Julliard
Jun 22, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better handling of double quotes in MCI string commands.
parent
032a1821
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
63 deletions
+54
-63
mcistring.c
multimedia/mcistring.c
+54
-63
No files found.
multimedia/mcistring.c
View file @
cee1b3a7
...
@@ -57,6 +57,21 @@ do { \
...
@@ -57,6 +57,21 @@ do { \
} \
} \
} while(0)
} while(0)
static
LPSTR
_MCISTR_Unquote
(
LPSTR
str
)
{
if
(
str
)
{
int
i
,
len
=
strlen
(
str
);
if
(
len
>
1
&&
str
[
0
]
==
'"'
&&
str
[
len
-
1
]
==
'"'
)
{
for
(
i
=
1
;
i
<
len
-
1
;
i
++
)
{
str
[
i
-
1
]
=
str
[
i
];
}
str
[
len
-
2
]
=
0
;
}
}
return
str
;
}
/* print a DWORD in the specified timeformat */
/* print a DWORD in the specified timeformat */
static
void
static
void
_MCISTR_printtf
(
char
*
buf
,
UINT16
uDevType
,
DWORD
timef
,
DWORD
val
)
_MCISTR_printtf
(
char
*
buf
,
UINT16
uDevType
,
DWORD
timef
,
DWORD
val
)
...
@@ -414,6 +429,9 @@ MCISTR_Open(_MCISTR_PROTO_)
...
@@ -414,6 +429,9 @@ MCISTR_Open(_MCISTR_PROTO_)
keywords
[
i
]);
keywords
[
i
]);
i
++
;
i
++
;
}
}
_MCISTR_Unquote
(
pU
->
openParams
.
lpstrElementName
);
res
=
mciSendCommandA
(
0
,
MCI_OPEN
,
dwFlags
,
(
DWORD
)
pU
);
res
=
mciSendCommandA
(
0
,
MCI_OPEN
,
dwFlags
,
(
DWORD
)
pU
);
free
(
pU
->
openParams
.
lpstrElementName
);
free
(
pU
->
openParams
.
lpstrElementName
);
...
@@ -2348,31 +2366,13 @@ MCISTR_Window(_MCISTR_PROTO_) {
...
@@ -2348,31 +2366,13 @@ MCISTR_Window(_MCISTR_PROTO_) {
}
}
/* text is enclosed in " ... " as it seems */
/* text is enclosed in " ... " as it seems */
if
(
!
STRCMP
(
keywords
[
i
],
"text"
))
{
if
(
!
STRCMP
(
keywords
[
i
],
"text"
))
{
char
*
t
;
int
len
,
j
,
k
;
if
(
keywords
[
i
+
1
][
0
]
!=
'"'
)
{
if
(
keywords
[
i
+
1
][
0
]
!=
'"'
)
{
i
++
;
i
++
;
continue
;
continue
;
}
}
dwFlags
|=
MCI_ANIM_WINDOW_TEXT
;
dwFlags
|=
MCI_ANIM_WINDOW_TEXT
;
len
=
strlen
(
keywords
[
i
+
1
])
+
1
;
pU
->
animwindowParams
.
lpstrText
=
_MCISTR_Unquote
(
keywords
[
i
+
1
]);
for
(
j
=
i
+
2
;
j
<
nrofkeywords
;
j
++
)
{
i
+=
2
;
len
+=
strlen
(
keywords
[
j
])
+
1
;
if
(
strchr
(
keywords
[
j
],
'"'
))
break
;
}
s
=
(
char
*
)
xmalloc
(
len
);
strcpy
(
s
,
keywords
[
i
+
1
]
+
1
);
k
=
j
;
for
(
j
=
i
+
2
;
j
<=
k
;
j
++
)
{
strcat
(
s
,
" "
);
strcat
(
s
,
keywords
[
j
]);
}
/* FIXME: hhmmm not so sure (strrchr ?) */
if
((
t
=
strchr
(
s
,
'"'
)))
*
t
=
'\0'
;
pU
->
animwindowParams
.
lpstrText
=
s
;
i
=
k
+
1
;
continue
;
continue
;
}
}
FLAG1
(
"stretch"
,
MCI_ANIM_WINDOW_ENABLE_STRETCH
);
FLAG1
(
"stretch"
,
MCI_ANIM_WINDOW_ENABLE_STRETCH
);
...
@@ -2417,31 +2417,13 @@ MCISTR_Window(_MCISTR_PROTO_) {
...
@@ -2417,31 +2417,13 @@ MCISTR_Window(_MCISTR_PROTO_) {
}
}
/* text is enclosed in " ... " as it seems */
/* text is enclosed in " ... " as it seems */
if
(
!
STRCMP
(
keywords
[
i
],
"text"
))
{
if
(
!
STRCMP
(
keywords
[
i
],
"text"
))
{
char
*
t
;
int
len
,
j
,
k
;
if
(
keywords
[
i
+
1
][
0
]
!=
'"'
)
{
if
(
keywords
[
i
+
1
][
0
]
!=
'"'
)
{
i
++
;
i
++
;
continue
;
continue
;
}
}
dwFlags
|=
MCI_DGV_WINDOW_TEXT
;
dwFlags
|=
MCI_DGV_WINDOW_TEXT
;
len
=
strlen
(
keywords
[
i
+
1
])
+
1
;
pU
->
dgvwindowParams
.
lpstrText
=
_MCISTR_Unquote
(
keywords
[
i
+
1
]);
for
(
j
=
i
+
2
;
j
<
nrofkeywords
;
j
++
)
{
i
+=
2
;
len
+=
strlen
(
keywords
[
j
])
+
1
;
if
(
strchr
(
keywords
[
j
],
'"'
))
break
;
}
s
=
(
char
*
)
xmalloc
(
len
);
strcpy
(
s
,
keywords
[
i
+
1
]
+
1
);
k
=
j
;
for
(
j
=
i
+
2
;
j
<=
k
;
j
++
)
{
strcat
(
s
,
" "
);
strcat
(
s
,
keywords
[
j
]);
}
/* FIXME: hhmmm not so sure (strrchr ?) */
if
((
t
=
strchr
(
s
,
'"'
)))
*
t
=
'\0'
;
pU
->
dgvwindowParams
.
lpstrText
=
s
;
i
=
k
+
1
;
continue
;
continue
;
}
}
break
;
break
;
...
@@ -2484,30 +2466,13 @@ MCISTR_Window(_MCISTR_PROTO_) {
...
@@ -2484,30 +2466,13 @@ MCISTR_Window(_MCISTR_PROTO_) {
}
}
/* text is enclosed in " ... " as it seems */
/* text is enclosed in " ... " as it seems */
if
(
!
STRCMP
(
keywords
[
i
],
"text"
))
{
if
(
!
STRCMP
(
keywords
[
i
],
"text"
))
{
char
*
t
;
int
len
,
j
,
k
;
if
(
keywords
[
i
+
1
][
0
]
!=
'"'
)
{
if
(
keywords
[
i
+
1
][
0
]
!=
'"'
)
{
i
++
;
i
++
;
continue
;
continue
;
}
}
dwFlags
|=
MCI_OVLY_WINDOW_TEXT
;
dwFlags
|=
MCI_OVLY_WINDOW_TEXT
;
len
=
strlen
(
keywords
[
i
+
1
])
+
1
;
pU
->
ovlywindowParams
.
lpstrText
=
_MCISTR_Unquote
(
keywords
[
i
+
1
]);
for
(
j
=
i
+
2
;
j
<
nrofkeywords
;
j
++
)
{
i
+=
2
;
len
+=
strlen
(
keywords
[
j
])
+
1
;
if
(
strchr
(
keywords
[
j
],
'"'
))
break
;
}
s
=
(
char
*
)
xmalloc
(
len
);
strcpy
(
s
,
keywords
[
i
+
1
]
+
1
);
k
=
j
;
for
(
j
=
i
+
2
;
j
<=
k
;
j
++
)
{
strcat
(
s
,
" "
);
strcat
(
s
,
keywords
[
j
]);
}
if
((
t
=
strchr
(
s
,
'"'
)))
*
t
=
'\0'
;
pU
->
ovlywindowParams
.
lpstrText
=
s
;
i
=
k
+
1
;
continue
;
continue
;
}
}
FLAG1
(
"stretch"
,
MCI_OVLY_WINDOW_ENABLE_STRETCH
);
FLAG1
(
"stretch"
,
MCI_OVLY_WINDOW_ENABLE_STRETCH
);
...
@@ -2589,25 +2554,48 @@ DWORD WINAPI mciSendString16(LPCSTR lpstrCommand, LPSTR lpstrReturnString,
...
@@ -2589,25 +2554,48 @@ DWORD WINAPI mciSendString16(LPCSTR lpstrCommand, LPSTR lpstrReturnString,
}
}
*
dev
++
=
'\0'
;
*
dev
++
=
'\0'
;
args
=
strchr
(
dev
,
' '
);
args
=
strchr
(
dev
,
' '
);
if
(
args
!=
NULL
)
*
args
++
=
'\0'
;
if
(
args
!=
NULL
)
*
args
=
'\0'
;
while
(
*++
args
==
' '
);
if
(
args
!=
NULL
)
{
if
(
args
!=
NULL
)
{
char
*
s
;
char
*
s
;
i
=
1
;
/* nrofkeywords = nrofspaces+1 */
i
=
1
;
/* nrofkeywords = nrofspaces+1 */
s
=
args
;
s
=
args
;
while
((
s
=
strchr
(
s
,
' '
))
!=
NULL
)
i
++
,
s
++
;
while
((
s
=
strchr
(
s
,
' '
))
!=
NULL
)
{
i
++
;
while
(
*++
s
==
' '
);
/* see if we have a quoted string */
if
(
*
s
==
'"'
)
{
s
=
strchr
(
s
+
1
,
'"'
);
if
(
!
s
||
s
[
1
]
!=
' '
)
{
/* missed closing '"'*/
free
(
cmd
);
return
MCIERR_NO_CLOSING_QUOTE
;
}
}
}
keywords
=
(
char
**
)
xmalloc
(
sizeof
(
char
*
)
*
(
i
+
2
));
keywords
=
(
char
**
)
xmalloc
(
sizeof
(
char
*
)
*
(
i
+
2
));
nrofkeywords
=
i
;
nrofkeywords
=
i
;
s
=
args
;
i
=
0
;
s
=
args
;
i
=
0
;
while
(
s
&&
i
<
nrofkeywords
)
{
while
(
s
&&
i
<
nrofkeywords
)
{
keywords
[
i
++
]
=
s
;
keywords
[
i
++
]
=
s
;
if
(
*
s
==
'"'
)
{
if
((
s
=
strchr
(
s
+
1
,
'"'
))
!=
NULL
)
s
++
;
}
else
{
s
=
strchr
(
s
,
' '
);
s
=
strchr
(
s
,
' '
);
if
(
s
)
*
s
++
=
'\0'
;
}
if
(
s
)
{
*
s
=
'\0'
;
while
(
*++
s
==
' '
);
}
TRACE
(
mci
,
"[%d] => '%s'
\n
"
,
i
-
1
,
keywords
[
i
-
1
]);
}
}
keywords
[
i
]
=
NULL
;
keywords
[
i
]
=
NULL
;
}
else
{
}
else
{
nrofkeywords
=
0
;
nrofkeywords
=
0
;
keywords
=
(
char
**
)
xmalloc
(
sizeof
(
char
*
));
keywords
=
(
char
**
)
xmalloc
(
sizeof
(
char
*
));
keywords
[
0
]
=
NULL
;
}
}
dwFlags
=
0
;
/* default flags */
dwFlags
=
0
;
/* default flags */
for
(
i
=
0
;
i
<
nrofkeywords
;)
{
for
(
i
=
0
;
i
<
nrofkeywords
;)
{
...
@@ -2637,6 +2625,9 @@ DWORD WINAPI mciSendString16(LPCSTR lpstrCommand, LPSTR lpstrReturnString,
...
@@ -2637,6 +2625,9 @@ DWORD WINAPI mciSendString16(LPCSTR lpstrCommand, LPSTR lpstrReturnString,
uDevTyp
=
MCI_GetDrv
(
wDevID
)
->
modp
.
wType
;
uDevTyp
=
MCI_GetDrv
(
wDevID
)
->
modp
.
wType
;
}
}
if
(
lpstrReturnString
&&
uReturnLength
>
0
)
*
lpstrReturnString
=
0
;
for
(
i
=
0
;
MCISTR_cmdtable
[
i
].
cmd
!=
NULL
;
i
++
)
{
for
(
i
=
0
;
MCISTR_cmdtable
[
i
].
cmd
!=
NULL
;
i
++
)
{
if
(
!
STRCMP
(
MCISTR_cmdtable
[
i
].
cmd
,
cmd
))
{
if
(
!
STRCMP
(
MCISTR_cmdtable
[
i
].
cmd
,
cmd
))
{
res
=
MCISTR_cmdtable
[
i
].
fun
(
wDevID
,
uDevTyp
,
lpstrReturnString
,
res
=
MCISTR_cmdtable
[
i
].
fun
(
wDevID
,
uDevTyp
,
lpstrReturnString
,
...
...
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