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
e3ae0243
Commit
e3ae0243
authored
Apr 15, 2010
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 15, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Use special case for lastIndex<0 only for global regexps in run_exec.
parent
a924e54c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
5 deletions
+18
-5
regexp.c
dlls/jscript/regexp.c
+5
-5
regexp.js
dlls/jscript/tests/regexp.js
+13
-0
No files found.
dlls/jscript/regexp.c
View file @
e3ae0243
...
...
@@ -3637,12 +3637,13 @@ static HRESULT run_exec(script_ctx_t *ctx, vdisp_t *jsthis, VARIANT *arg, jsexce
hres
=
to_string
(
ctx
,
arg
,
ei
,
&
string
);
if
(
FAILED
(
hres
))
return
hres
;
length
=
SysStringLen
(
string
);
}
else
{
string
=
SysAllocStringLen
(
NULL
,
0
);
if
(
!
string
)
return
E_OUTOFMEMORY
;
string
=
NULL
;
length
=
0
;
}
if
(
regexp
->
jsregexp
->
flags
&
JSREG_GLOB
)
{
if
(
regexp
->
last_index
<
0
)
{
SysFreeString
(
string
);
set_last_index
(
regexp
,
0
);
...
...
@@ -3653,9 +3654,8 @@ static HRESULT run_exec(script_ctx_t *ctx, vdisp_t *jsthis, VARIANT *arg, jsexce
return
S_OK
;
}
length
=
SysStringLen
(
string
);
if
(
regexp
->
jsregexp
->
flags
&
JSREG_GLOB
)
last_index
=
regexp
->
last_index
;
}
cp
=
string
+
last_index
;
hres
=
regexp_match_next
(
ctx
,
&
regexp
->
dispex
,
REM_RESET_INDEX
,
string
,
length
,
&
cp
,
parens
,
...
...
dlls/jscript/tests/regexp.js
View file @
e3ae0243
...
...
@@ -410,6 +410,19 @@ m = re.exec(" ");
ok
(
re
.
lastIndex
===
0
,
"re.lastIndex = "
+
re
.
lastIndex
+
" expected 0"
);
ok
(
m
===
null
,
"m = "
+
m
+
" expected null"
);
re
=
/a/
;
re
.
lastIndex
=
-
3
;
ok
(
re
.
lastIndex
===
-
3
,
"re.lastIndex = "
+
re
.
lastIndex
+
" expected -3"
);
m
=
re
.
exec
(
" a a "
);
ok
(
re
.
lastIndex
===
2
,
"re.lastIndex = "
+
re
.
lastIndex
+
" expected 0"
);
ok
(
m
.
index
===
1
,
"m = "
+
m
+
" expected 1"
);
re
.
lastIndex
=
-
1
;
ok
(
re
.
lastIndex
===
-
1
,
"re.lastIndex = "
+
re
.
lastIndex
+
" expected -1"
);
m
=
re
.
exec
(
" "
);
ok
(
re
.
lastIndex
===
0
,
"re.lastIndex = "
+
re
.
lastIndex
+
" expected 0"
);
ok
(
m
===
null
,
"m = "
+
m
+
" expected null"
);
re
=
/aa/g
;
i
=
'baacd'
.
search
(
re
);
ok
(
i
===
1
,
"'baacd'.search(re) = "
+
i
);
...
...
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