Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
62cd56ce
Commit
62cd56ce
authored
14 years ago
by
Huw Davies
Committed by
Alexandre Julliard
14 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ole32: Store the ole advise sinks in a STATDATA array.
parent
6ac2cb3d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/ole32/oleobj.c
+36
-95
36 additions, 95 deletions
dlls/ole32/oleobj.c
with
36 additions
and
95 deletions
dlls/ole32/oleobj.c
+
36
−
95
View file @
62cd56ce
...
...
@@ -243,8 +243,8 @@ typedef struct
LONG
ref
;
DWORD
maxSink
s
;
IAdviseSink
**
arrayOfSink
s
;
DWORD
max_con
s
;
STATDATA
*
connection
s
;
}
OleAdviseHolderImpl
;
static
inline
OleAdviseHolderImpl
*
impl_from_IOleAdviseHolder
(
IOleAdviseHolder
*
iface
)
...
...
@@ -255,28 +255,19 @@ static inline OleAdviseHolderImpl *impl_from_IOleAdviseHolder(IOleAdviseHolder *
/**************************************************************************
* OleAdviseHolderImpl_Destructor
*/
static
void
OleAdviseHolderImpl_Destructor
(
OleAdviseHolderImpl
*
ptrToDestroy
)
static
void
OleAdviseHolderImpl_Destructor
(
OleAdviseHolderImpl
*
This
)
{
DWORD
index
;
TRACE
(
"%p
\n
"
,
ptrToDestroy
);
DWORD
index
;
TRACE
(
"%p
\n
"
,
This
);
for
(
index
=
0
;
index
<
ptrToDestroy
->
maxSinks
;
index
++
)
{
if
(
ptrToDestroy
->
arrayOfSinks
[
index
]
!=
0
)
for
(
index
=
0
;
index
<
This
->
max_cons
;
index
++
)
{
IAdviseSink_Release
(
ptrToDestroy
->
arrayOfSinks
[
index
]);
ptrToDestroy
->
arrayOfSinks
[
index
]
=
NULL
;
if
(
This
->
connections
[
index
].
pAdvSink
!=
NULL
)
release_statdata
(
This
->
connections
+
index
)
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
ptrToDestroy
->
arrayOfSinks
);
HeapFree
(
GetProcessHeap
(),
0
,
ptrToDestroy
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
connections
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
/**************************************************************************
...
...
@@ -344,6 +335,8 @@ static HRESULT WINAPI OleAdviseHolderImpl_Advise(IOleAdviseHolder *iface,
{
DWORD
index
;
OleAdviseHolderImpl
*
This
=
impl_from_IOleAdviseHolder
(
iface
);
STATDATA
new_conn
;
static
const
FORMATETC
empty_fmtetc
=
{
0
,
NULL
,
0
,
-
1
,
0
};
TRACE
(
"(%p)->(%p, %p)
\n
"
,
This
,
pAdvise
,
pdwConnection
);
...
...
@@ -352,38 +345,27 @@ static HRESULT WINAPI OleAdviseHolderImpl_Advise(IOleAdviseHolder *iface,
*
pdwConnection
=
0
;
for
(
index
=
0
;
index
<
This
->
max
Sink
s
;
index
++
)
for
(
index
=
0
;
index
<
This
->
max
_con
s
;
index
++
)
{
if
(
This
->
arrayOfSinks
[
index
]
==
NULL
)
if
(
This
->
connections
[
index
].
pAdvSink
==
NULL
)
break
;
}
if
(
index
==
This
->
max
Sink
s
)
if
(
index
==
This
->
max
_con
s
)
{
DWORD
i
;
This
->
maxSinks
+=
INITIAL_SINKS
;
This
->
arrayOfSinks
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
This
->
arrayOfSinks
,
This
->
maxSinks
*
sizeof
(
IAdviseSink
*
));
for
(
i
=
index
;
i
<
This
->
maxSinks
;
i
++
)
This
->
arrayOfSinks
[
i
]
=
0
;
This
->
max_cons
+=
INITIAL_SINKS
;
This
->
connections
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
This
->
connections
,
This
->
max_cons
*
sizeof
(
*
This
->
connections
));
}
This
->
arrayOfSinks
[
index
]
=
pAdvise
;
new_conn
.
pAdvSink
=
pAdvise
;
new_conn
.
advf
=
0
;
new_conn
.
formatetc
=
empty_fmtetc
;
new_conn
.
dwConnection
=
index
+
1
;
/* 0 is not a valid cookie, so increment the index */
if
(
This
->
arrayOfSinks
[
index
]
!=
NULL
)
IAdviseSink_AddRef
(
This
->
arrayOfSinks
[
index
]);
copy_statdata
(
This
->
connections
+
index
,
&
new_conn
);
/*
* Return the index as the cookie.
* Since 0 is not a valid cookie, we will increment by
* 1 the index in the table.
*/
*
pdwConnection
=
index
+
1
;
*
pdwConnection
=
new_conn
.
dwConnection
;
return
S_OK
;
}
...
...
@@ -395,30 +377,17 @@ static HRESULT WINAPI OleAdviseHolderImpl_Unadvise(IOleAdviseHolder *iface,
DWORD
dwConnection
)
{
OleAdviseHolderImpl
*
This
=
impl_from_IOleAdviseHolder
(
iface
);
DWORD
index
;
TRACE
(
"(%p)->(%u)
\n
"
,
This
,
dwConnection
);
/*
* So we don't return 0 as a cookie, the index was
* incremented by 1 in OleAdviseHolderImpl_Advise
* we have to compensate.
*/
dwConnection
--
;
/*
* Check for invalid cookies.
*/
if
(
dwConnection
>=
This
->
maxSinks
)
return
OLE_E_NOCONNECTION
;
/* The connection number is 1 more than the index, see OleAdviseHolder_Advise */
index
=
dwConnection
-
1
;
if
(
This
->
arrayOfSinks
[
dwConnection
]
==
NULL
)
return
OLE_E_NOCONNECTION
;
if
(
index
>=
This
->
max_cons
||
This
->
connections
[
index
].
pAdvSink
==
NULL
)
return
OLE_E_NOCONNECTION
;
/*
* Release the sink and mark the spot in the list as free.
*/
IAdviseSink_Release
(
This
->
arrayOfSinks
[
dwConnection
]);
This
->
arrayOfSinks
[
dwConnection
]
=
NULL
;
release_statdata
(
This
->
connections
+
index
);
return
S_OK
;
}
...
...
@@ -426,40 +395,17 @@ static HRESULT WINAPI OleAdviseHolderImpl_Unadvise(IOleAdviseHolder *iface,
/******************************************************************************
* OleAdviseHolderImpl_EnumAdvise
*/
static
HRESULT
WINAPI
OleAdviseHolderImpl_EnumAdvise
(
IOleAdviseHolder
*
iface
,
IEnumSTATDATA
**
pp
enum
A
dvise
)
static
HRESULT
WINAPI
OleAdviseHolderImpl_EnumAdvise
(
IOleAdviseHolder
*
iface
,
IEnumSTATDATA
**
enum
_a
dvise
)
{
OleAdviseHolderImpl
*
This
=
impl_from_IOleAdviseHolder
(
iface
);
IUnknown
*
unk
;
DWORD
i
,
count
;
STATDATA
*
data
;
static
const
FORMATETC
empty_fmtetc
=
{
0
,
NULL
,
0
,
-
1
,
0
};
HRESULT
hr
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
ppenumAdvise
);
*
ppenumAdvise
=
NULL
;
/* Build an array of STATDATA structures */
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
This
->
maxSinks
*
sizeof
(
*
data
));
if
(
!
data
)
return
E_OUTOFMEMORY
;
for
(
i
=
0
,
count
=
0
;
i
<
This
->
maxSinks
;
i
++
)
{
if
(
This
->
arrayOfSinks
[
i
])
{
data
[
count
].
formatetc
=
empty_fmtetc
;
data
[
count
].
advf
=
0
;
data
[
count
].
pAdvSink
=
This
->
arrayOfSinks
[
i
];
/* The constructor will take a ref. */
data
[
count
].
dwConnection
=
i
;
count
++
;
}
}
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
enum_advise
);
IOleAdviseHolder_QueryInterface
(
iface
,
&
IID_IUnknown
,
(
void
**
)
&
unk
);
hr
=
EnumSTATDATA_Construct
(
unk
,
0
,
count
,
data
,
pp
enum
A
dvise
);
hr
=
EnumSTATDATA_Construct
(
unk
,
0
,
This
->
max_cons
,
This
->
connections
,
enum
_a
dvise
);
IUnknown_Release
(
unk
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
return
hr
;
}
...
...
@@ -564,19 +510,14 @@ static const IOleAdviseHolderVtbl oahvt =
static
IOleAdviseHolder
*
OleAdviseHolderImpl_Constructor
(
void
)
{
OleAdviseHolderImpl
*
lpoah
;
DWORD
index
;
lpoah
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
OleAdviseHolderImpl
));
lpoah
->
IOleAdviseHolder_iface
.
lpVtbl
=
&
oahvt
;
lpoah
->
ref
=
1
;
lpoah
->
maxSinks
=
INITIAL_SINKS
;
lpoah
->
arrayOfSinks
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lpoah
->
maxSinks
*
sizeof
(
IAdviseSink
*
));
for
(
index
=
0
;
index
<
lpoah
->
maxSinks
;
index
++
)
lpoah
->
arrayOfSinks
[
index
]
=
0
;
lpoah
->
max_cons
=
INITIAL_SINKS
;
lpoah
->
connections
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
lpoah
->
max_cons
*
sizeof
(
*
lpoah
->
connections
));
TRACE
(
"returning %p
\n
"
,
&
lpoah
->
IOleAdviseHolder_iface
);
return
&
lpoah
->
IOleAdviseHolder_iface
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment