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
185ef44d
Commit
185ef44d
authored
Oct 19, 2010
by
Piotr Caban
Committed by
Alexandre Julliard
Oct 19, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Improved error handling in VBArray functions.
parent
53f27654
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
7 deletions
+25
-7
jscript.h
dlls/jscript/jscript.h
+6
-0
vbarray.c
dlls/jscript/vbarray.c
+19
-7
No files found.
dlls/jscript/jscript.h
View file @
185ef44d
...
...
@@ -377,6 +377,12 @@ static inline DOUBLE num_val(const VARIANT *v)
return
V_VT
(
v
)
==
VT_I4
?
V_I4
(
v
)
:
V_R8
(
v
);
}
static
inline
void
num_set_int
(
VARIANT
*
v
,
INT
i
)
{
V_VT
(
v
)
=
VT_I4
;
V_I4
(
v
)
=
i
;
}
static
inline
void
num_set_val
(
VARIANT
*
v
,
DOUBLE
d
)
{
if
(
d
==
(
DOUBLE
)(
INT
)
d
)
{
...
...
dlls/jscript/vbarray.c
View file @
185ef44d
...
...
@@ -56,7 +56,7 @@ static HRESULT VBArray_dimensions(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
return
throw_type_error
(
ctx
,
ei
,
IDS_NOT_VBARRAY
,
NULL
);
if
(
retv
)
num_set_
val
(
retv
,
SafeArrayGetDim
(
vbarray
->
safearray
));
num_set_
int
(
retv
,
SafeArrayGetDim
(
vbarray
->
safearray
));
return
S_OK
;
}
...
...
@@ -79,6 +79,9 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DI
return
throw_range_error
(
ctx
,
ei
,
IDS_SUBSCRIPT_OUT_OF_RANGE
,
NULL
);
indexes
=
heap_alloc
(
sizeof
(
int
)
*
size
);
if
(
!
indexes
)
return
E_OUTOFMEMORY
;
for
(
i
=
0
;
i
<
size
;
i
++
)
{
hres
=
to_int32
(
ctx
,
get_arg
(
dp
,
i
),
ei
,
indexes
+
i
);
if
(
FAILED
(
hres
))
{
...
...
@@ -127,7 +130,7 @@ static HRESULT VBArray_lbound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DIS
return
hres
;
if
(
retv
)
num_set_
val
(
retv
,
dim
);
num_set_
int
(
retv
,
dim
);
return
S_OK
;
}
...
...
@@ -206,7 +209,7 @@ static HRESULT VBArray_ubound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DIS
return
hres
;
if
(
retv
)
num_set_
val
(
retv
,
dim
);
num_set_
int
(
retv
,
dim
);
return
S_OK
;
}
...
...
@@ -286,8 +289,8 @@ static HRESULT VBArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags
if
(
arg_cnt
(
dp
)
<
1
||
V_VT
((
arg
=
get_arg
(
dp
,
0
)))
!=
(
VT_ARRAY
|
VT_VARIANT
))
return
throw_type_error
(
ctx
,
ei
,
IDS_NOT_VBARRAY
,
NULL
);
VariantCopy
(
retv
,
arg
);
break
;
hres
=
VariantCopy
(
retv
,
arg
);
return
hres
;
case
DISPATCH_CONSTRUCT
:
if
(
arg_cnt
(
dp
)
<
1
||
V_VT
((
arg
=
get_arg
(
dp
,
0
)))
!=
(
VT_ARRAY
|
VT_VARIANT
))
...
...
@@ -296,7 +299,12 @@ static HRESULT VBArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags
hres
=
alloc_vbarray
(
ctx
,
NULL
,
&
vbarray
);
if
(
FAILED
(
hres
))
return
hres
;
SafeArrayCopy
(
V_ARRAY
(
arg
),
&
vbarray
->
safearray
);
hres
=
SafeArrayCopy
(
V_ARRAY
(
arg
),
&
vbarray
->
safearray
);
if
(
FAILED
(
hres
))
{
jsdisp_release
(
&
vbarray
->
dispex
);
return
hres
;
}
var_set_jsdisp
(
retv
,
&
vbarray
->
dispex
);
break
;
...
...
@@ -335,7 +343,11 @@ HRESULT create_vbarray(script_ctx_t *ctx, SAFEARRAY *sa, jsdisp_t **ret)
if
(
FAILED
(
hres
))
return
hres
;
SafeArrayCopy
(
sa
,
&
vbarray
->
safearray
);
hres
=
SafeArrayCopy
(
sa
,
&
vbarray
->
safearray
);
if
(
FAILED
(
hres
))
{
jsdisp_release
(
&
vbarray
->
dispex
);
return
hres
;
}
*
ret
=
&
vbarray
->
dispex
;
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