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
c1974090
Commit
c1974090
authored
Jan 13, 2016
by
Piotr Caban
Committed by
Alexandre Julliard
Jan 14, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Reuse safearray passed to LPSAFEARRAY_UserUnmarshal if possible.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
37e2acb2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
usrmarshal.c
dlls/oleaut32/tests/usrmarshal.c
+1
-2
usrmarshal.c
dlls/oleaut32/usrmarshal.c
+21
-3
No files found.
dlls/oleaut32/tests/usrmarshal.c
View file @
c1974090
...
...
@@ -1371,8 +1371,7 @@ static void test_marshal_VARIANT(void)
ok
(
next
==
buffer
+
expected
,
"got %p expect %p
\n
"
,
next
,
buffer
+
expected
);
ok
(
V_VT
(
&
v
)
==
V_VT
(
&
v2
),
"got vt %d expect %d
\n
"
,
V_VT
(
&
v
),
V_VT
(
&
v2
));
ok
(
lpsa2
==
lpsa_copy
,
"safearray should be reused
\n
"
);
todo_wine
ok
(
mem
==
lpsa2
->
pvData
,
"safearray data should be reused
\n
"
);
if
(
mem
!=
lpsa2
->
pvData
)
CoTaskMemFree
(
mem
);
ok
(
mem
==
lpsa2
->
pvData
,
"safearray data should be reused
\n
"
);
ok
(
SafeArrayGetDim
(
*
V_ARRAYREF
(
&
v
))
==
SafeArrayGetDim
(
*
V_ARRAYREF
(
&
v2
)),
"array dims differ
\n
"
);
SafeArrayGetLBound
(
*
V_ARRAYREF
(
&
v
),
1
,
&
bound
);
SafeArrayGetLBound
(
*
V_ARRAYREF
(
&
v2
),
1
,
&
bound2
);
...
...
dlls/oleaut32/usrmarshal.c
View file @
c1974090
...
...
@@ -1008,7 +1008,26 @@ unsigned char * WINAPI LPSAFEARRAY_UserUnmarshal(ULONG *pFlags, unsigned char *B
wiresab
=
(
SAFEARRAYBOUND
*
)
Buffer
;
Buffer
+=
sizeof
(
wiresab
[
0
])
*
wiresa
->
cDims
;
if
(
vt
)
if
(
*
ppsa
&&
(
*
ppsa
)
->
cDims
==
wiresa
->
cDims
)
{
if
(((
*
ppsa
)
->
fFeatures
&
~
FADF_AUTOSETFLAGS
)
!=
(
wiresa
->
fFeatures
&
~
FADF_AUTOSETFLAGS
))
RpcRaiseException
(
DISP_E_BADCALLEE
);
if
(
SAFEARRAY_GetCellCount
(
*
ppsa
)
*
(
*
ppsa
)
->
cbElements
!=
cell_count
*
elem_mem_size
(
wiresa
,
sftype
))
{
if
((
*
ppsa
)
->
fFeatures
&
(
FADF_AUTO
|
FADF_STATIC
|
FADF_EMBEDDED
|
FADF_FIXEDSIZE
))
RpcRaiseException
(
DISP_E_BADCALLEE
);
hr
=
SafeArrayDestroyData
(
*
ppsa
);
if
(
FAILED
(
hr
))
RpcRaiseException
(
hr
);
}
memcpy
((
*
ppsa
)
->
rgsabound
,
wiresab
,
sizeof
(
*
wiresab
)
*
wiresa
->
cDims
);
if
((
*
ppsa
)
->
fFeatures
&
FADF_HAVEVARTYPE
)
((
DWORD
*
)(
*
ppsa
))[
-
1
]
=
vt
;
}
else
if
(
vt
)
{
SafeArrayDestroy
(
*
ppsa
);
*
ppsa
=
SafeArrayCreateEx
(
vt
,
wiresa
->
cDims
,
wiresab
,
NULL
);
...
...
@@ -1028,11 +1047,10 @@ unsigned char * WINAPI LPSAFEARRAY_UserUnmarshal(ULONG *pFlags, unsigned char *B
(
*
ppsa
)
->
fFeatures
|=
(
wiresa
->
fFeatures
&
~
(
FADF_AUTOSETFLAGS
));
/* FIXME: there should be a limit on how large wiresa->cbElements can be */
(
*
ppsa
)
->
cbElements
=
elem_mem_size
(
wiresa
,
sftype
);
(
*
ppsa
)
->
cLocks
=
0
;
/* SafeArrayCreateEx allocates the data for us, but
* SafeArrayAllocDescriptor doesn't */
if
(
!
vt
)
if
(
!
(
*
ppsa
)
->
pvData
)
{
hr
=
SafeArrayAllocData
(
*
ppsa
);
if
(
FAILED
(
hr
))
...
...
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