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
2f28956f
Commit
2f28956f
authored
Jul 12, 2009
by
Piotr Caban
Committed by
Alexandre Julliard
Jul 13, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Make String_slice generic.
parent
54a3fa84
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
10 deletions
+29
-10
string.c
dlls/jscript/string.c
+29
-10
No files found.
dlls/jscript/string.c
View file @
2f28956f
...
@@ -982,6 +982,7 @@ static HRESULT String_slice(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
...
@@ -982,6 +982,7 @@ static HRESULT String_slice(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
{
const
WCHAR
*
str
;
const
WCHAR
*
str
;
BSTR
val_str
=
NULL
;
DWORD
length
;
DWORD
length
;
INT
start
=
0
,
end
;
INT
start
=
0
,
end
;
VARIANT
v
;
VARIANT
v
;
...
@@ -989,20 +990,32 @@ static HRESULT String_slice(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
...
@@ -989,20 +990,32 @@ static HRESULT String_slice(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
if
(
is_class
(
dispex
,
JSCLASS_STRING
))
{
if
(
!
is_class
(
dispex
,
JSCLASS_STRING
))
{
StringInstance
*
string
=
(
StringInstance
*
)
dispex
;
VARIANT
this
;
str
=
string
->
str
;
V_VT
(
&
this
)
=
VT_DISPATCH
;
length
=
string
->
length
;
V_DISPATCH
(
&
this
)
=
(
IDispatch
*
)
_IDispatchEx_
(
dispex
);
}
else
{
FIXME
(
"this is not a string class
\n
"
);
hres
=
to_string
(
dispex
->
ctx
,
&
this
,
ei
,
&
val_str
);
return
E_NOTIMPL
;
if
(
FAILED
(
hres
))
return
hres
;
str
=
val_str
;
length
=
SysStringLen
(
val_str
);
}
else
{
StringInstance
*
this
=
(
StringInstance
*
)
dispex
;
str
=
this
->
str
;
length
=
this
->
length
;
}
}
if
(
arg_cnt
(
dp
))
{
if
(
arg_cnt
(
dp
))
{
hres
=
to_integer
(
dispex
->
ctx
,
dp
->
rgvarg
+
dp
->
cArgs
-
1
,
ei
,
&
v
);
hres
=
to_integer
(
dispex
->
ctx
,
dp
->
rgvarg
+
dp
->
cArgs
-
1
,
ei
,
&
v
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
return
hres
;
}
if
(
V_VT
(
&
v
)
==
VT_I4
)
{
if
(
V_VT
(
&
v
)
==
VT_I4
)
{
start
=
V_I4
(
&
v
);
start
=
V_I4
(
&
v
);
...
@@ -1022,8 +1035,10 @@ static HRESULT String_slice(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
...
@@ -1022,8 +1035,10 @@ static HRESULT String_slice(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
if
(
arg_cnt
(
dp
)
>=
2
)
{
if
(
arg_cnt
(
dp
)
>=
2
)
{
hres
=
to_integer
(
dispex
->
ctx
,
dp
->
rgvarg
+
dp
->
cArgs
-
2
,
ei
,
&
v
);
hres
=
to_integer
(
dispex
->
ctx
,
dp
->
rgvarg
+
dp
->
cArgs
-
2
,
ei
,
&
v
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
return
hres
;
}
if
(
V_VT
(
&
v
)
==
VT_I4
)
{
if
(
V_VT
(
&
v
)
==
VT_I4
)
{
end
=
V_I4
(
&
v
);
end
=
V_I4
(
&
v
);
...
@@ -1046,12 +1061,16 @@ static HRESULT String_slice(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
...
@@ -1046,12 +1061,16 @@ static HRESULT String_slice(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
if
(
retv
)
{
if
(
retv
)
{
BSTR
retstr
=
SysAllocStringLen
(
str
+
start
,
end
-
start
);
BSTR
retstr
=
SysAllocStringLen
(
str
+
start
,
end
-
start
);
if
(
!
str
)
if
(
!
retstr
)
{
SysFreeString
(
val_str
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
V_VT
(
retv
)
=
VT_BSTR
;
V_VT
(
retv
)
=
VT_BSTR
;
V_BSTR
(
retv
)
=
retstr
;
V_BSTR
(
retv
)
=
retstr
;
}
}
SysFreeString
(
val_str
);
return
S_OK
;
return
S_OK
;
}
}
...
...
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