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
d49635f0
Commit
d49635f0
authored
May 03, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
May 03, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Better handling of to_integer result in String.lastIndexOf.
parent
baa07477
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
string.c
dlls/jscript/string.c
+5
-7
api.js
dlls/jscript/tests/api.js
+2
-0
No files found.
dlls/jscript/string.c
View file @
d49635f0
...
...
@@ -538,7 +538,7 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
VARIANT
*
retv
,
jsexcept_t
*
ei
)
{
BSTR
search_str
,
val_str
;
DWORD
length
,
pos
,
search_len
;
DWORD
length
,
pos
=
0
,
search_len
;
const
WCHAR
*
str
;
INT
ret
=
-
1
;
HRESULT
hres
;
...
...
@@ -568,15 +568,13 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
arg_cnt
(
dp
)
>=
2
)
{
VARIANT
ival
;
double
d
;
hres
=
to_integer
(
ctx
,
get_arg
(
dp
,
1
),
ei
,
&
ival
);
if
(
SUCCEEDED
(
hres
))
{
if
(
V_VT
(
&
ival
)
==
VT_I4
)
pos
=
V_VT
(
&
ival
)
>
0
?
V_I4
(
&
ival
)
:
0
;
else
pos
=
V_R8
(
&
ival
)
>
0
.
0
?
length
:
0
;
if
(
pos
>
length
)
pos
=
length
;
d
=
num_val
(
&
ival
);
if
(
d
>
0
)
pos
=
is_int32
(
d
)
?
min
((
int
)
d
,
length
)
:
length
;
}
}
else
{
pos
=
length
;
...
...
dlls/jscript/tests/api.js
View file @
d49635f0
...
...
@@ -496,6 +496,8 @@ tmp = "aaaa".lastIndexOf("a",2);
ok
(
tmp
==
2
,
"lastIndexOf = "
+
tmp
);
tmp
=
strObj
.
lastIndexOf
(
"b"
);
ok
(
tmp
===
1
,
"lastIndexOf = "
+
tmp
);
tmp
=
"bbb"
.
lastIndexOf
(
"b"
,
bigInt
);
ok
(
tmp
===
2
,
"lastIndexOf = "
+
tmp
);
tmp
=
""
.
toLowerCase
();
ok
(
tmp
===
""
,
"''.toLowerCase() = "
+
tmp
);
...
...
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