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
c3eecec6
Commit
c3eecec6
authored
Mar 07, 2013
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 07, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Use (index,length) pair as match result.
parent
c496899d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
jscript.h
dlls/jscript/jscript.h
+2
-2
jsregexp.c
dlls/jscript/jsregexp.c
+10
-10
No files found.
dlls/jscript/jscript.h
View file @
c3eecec6
...
...
@@ -362,8 +362,8 @@ typedef struct {
}
jsexcept_t
;
typedef
struct
{
const
WCHAR
*
str
;
DWORD
len
;
unsigned
index
;
unsigned
length
;
}
match_result_t
;
struct
_script_ctx_t
{
...
...
dlls/jscript/jsregexp.c
View file @
c3eecec6
...
...
@@ -98,11 +98,11 @@ static HRESULT do_regexp_match_next(script_ctx_t *ctx, RegExpInstance *regexp,
for
(
i
=
0
;
i
<
n
;
i
++
)
{
if
(
ret
->
parens
[
i
].
index
==
-
1
)
{
ctx
->
match_parens
[
i
].
str
=
NULL
;
ctx
->
match_parens
[
i
].
len
=
0
;
ctx
->
match_parens
[
i
].
index
=
0
;
ctx
->
match_parens
[
i
].
len
gth
=
0
;
}
else
{
ctx
->
match_parens
[
i
].
str
=
ctx
->
last_match
->
str
+
ret
->
parens
[
i
].
index
;
ctx
->
match_parens
[
i
].
len
=
ret
->
parens
[
i
].
length
;
ctx
->
match_parens
[
i
].
index
=
ret
->
parens
[
i
].
index
;
ctx
->
match_parens
[
i
].
len
gth
=
ret
->
parens
[
i
].
length
;
}
}
...
...
@@ -216,8 +216,8 @@ static HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, jsstr_t *str, B
}
}
ret
[
i
].
str
=
result
->
cp
-
result
->
match_len
;
ret
[
i
++
].
len
=
result
->
match_len
;
ret
[
i
].
index
=
result
->
cp
-
str
->
str
-
result
->
match_len
;
ret
[
i
++
].
len
gth
=
result
->
match_len
;
if
(
!
gflag
&&
!
(
This
->
jsregexp
->
flags
&
REG_GLOB
))
{
hres
=
S_OK
;
...
...
@@ -736,7 +736,7 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, jsstr_t *str, jsval
for
(
i
=
0
;
i
<
match_cnt
;
i
++
)
{
jsstr_t
*
tmp_str
;
tmp_str
=
jsstr_
alloc_len
(
match_result
[
i
].
str
,
match_result
[
i
].
len
);
tmp_str
=
jsstr_
substr
(
str
,
match_result
[
i
].
index
,
match_result
[
i
].
length
);
if
(
!
tmp_str
)
{
hres
=
E_OUTOFMEMORY
;
break
;
...
...
@@ -749,12 +749,12 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, jsstr_t *str, jsval
}
while
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_propput_name
(
array
,
indexW
,
jsval_number
(
match_result
[
match_cnt
-
1
].
str
-
str
->
str
));
hres
=
jsdisp_propput_name
(
array
,
indexW
,
jsval_number
(
match_result
[
match_cnt
-
1
].
index
));
if
(
FAILED
(
hres
))
break
;
hres
=
jsdisp_propput_name
(
array
,
lastIndexW
,
jsval_number
(
match_result
[
match_cnt
-
1
].
str
-
str
->
str
+
match_result
[
match_cnt
-
1
].
len
));
jsval_number
(
match_result
[
match_cnt
-
1
].
index
+
match_result
[
match_cnt
-
1
].
length
));
if
(
FAILED
(
hres
))
break
;
...
...
@@ -777,7 +777,7 @@ static HRESULT global_idx(script_ctx_t *ctx, DWORD flags, DWORD idx, jsval_t *r)
case
DISPATCH_PROPERTYGET
:
{
jsstr_t
*
ret
;
ret
=
jsstr_
alloc_len
(
ctx
->
match_parens
[
idx
].
str
,
ctx
->
match_parens
[
idx
].
len
);
ret
=
jsstr_
substr
(
ctx
->
last_match
,
ctx
->
match_parens
[
idx
].
index
,
ctx
->
match_parens
[
idx
].
length
);
if
(
!
ret
)
return
E_OUTOFMEMORY
;
...
...
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