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
5d550cdc
Commit
5d550cdc
authored
Oct 27, 2009
by
Vincent Povirk
Committed by
Alexandre Julliard
Oct 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Further simplify adjustPropertyChain and fold in findPlaceholder.
The logic is unchanged from the original version.
parent
a7e69339
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
140 deletions
+64
-140
storage32.c
dlls/ole32/storage32.c
+64
-140
No files found.
dlls/ole32/storage32.c
View file @
5d550cdc
...
@@ -169,12 +169,6 @@ static HRESULT deleteStreamProperty(
...
@@ -169,12 +169,6 @@ static HRESULT deleteStreamProperty(
ULONG
foundPropertyIndexToDelete
,
ULONG
foundPropertyIndexToDelete
,
StgProperty
propertyToDelete
);
StgProperty
propertyToDelete
);
static
HRESULT
findPlaceholder
(
StorageImpl
*
storage
,
ULONG
propertyIndexToStore
,
ULONG
storagePropertyIndex
,
INT
typeOfRelation
);
static
HRESULT
adjustPropertyChain
(
static
HRESULT
adjustPropertyChain
(
StorageImpl
*
This
,
StorageImpl
*
This
,
StgProperty
propertyToDelete
,
StgProperty
propertyToDelete
,
...
@@ -2025,92 +2019,22 @@ static HRESULT deleteStreamProperty(
...
@@ -2025,92 +2019,22 @@ static HRESULT deleteStreamProperty(
return
S_OK
;
return
S_OK
;
}
}
/*********************************************************************
static
void
setPropertyLink
(
StgProperty
*
property
,
ULONG
relation
,
ULONG
new_target
)
*
* Internal Method
*
* Finds a placeholder for the StgProperty within the Storage
*
*/
static
HRESULT
findPlaceholder
(
StorageImpl
*
storage
,
ULONG
propertyIndexToStore
,
ULONG
storePropertyIndex
,
INT
typeOfRelation
)
{
{
StgProperty
storeProperty
;
switch
(
relation
)
BOOL
res
=
TRUE
;
/*
* Read the storage property
*/
res
=
StorageImpl_ReadProperty
(
storage
->
base
.
ancestorStorage
,
storePropertyIndex
,
&
storeProperty
);
if
(
!
res
)
{
return
E_FAIL
;
}
if
(
typeOfRelation
==
PROPERTY_RELATION_PREVIOUS
)
{
if
(
storeProperty
.
leftChild
!=
PROPERTY_NULL
)
{
return
findPlaceholder
(
storage
,
propertyIndexToStore
,
storeProperty
.
leftChild
,
typeOfRelation
);
}
else
{
storeProperty
.
leftChild
=
propertyIndexToStore
;
}
}
else
if
(
typeOfRelation
==
PROPERTY_RELATION_NEXT
)
{
if
(
storeProperty
.
rightChild
!=
PROPERTY_NULL
)
{
return
findPlaceholder
(
storage
,
propertyIndexToStore
,
storeProperty
.
rightChild
,
typeOfRelation
);
}
else
{
storeProperty
.
rightChild
=
propertyIndexToStore
;
}
}
else
if
(
typeOfRelation
==
PROPERTY_RELATION_DIR
)
{
if
(
storeProperty
.
dirProperty
!=
PROPERTY_NULL
)
{
return
findPlaceholder
(
storage
,
propertyIndexToStore
,
storeProperty
.
dirProperty
,
typeOfRelation
);
}
else
{
storeProperty
.
dirProperty
=
propertyIndexToStore
;
}
}
res
=
StorageImpl_WriteProperty
(
storage
->
base
.
ancestorStorage
,
storePropertyIndex
,
&
storeProperty
);
if
(
!
res
)
{
{
return
E_FAIL
;
case
PROPERTY_RELATION_PREVIOUS
:
property
->
leftChild
=
new_target
;
break
;
case
PROPERTY_RELATION_NEXT
:
property
->
rightChild
=
new_target
;
break
;
case
PROPERTY_RELATION_DIR
:
property
->
dirProperty
=
new_target
;
break
;
default:
assert
(
0
);
}
}
return
S_OK
;
}
}
/*************************************************************************
/*************************************************************************
...
@@ -2127,11 +2051,6 @@ static HRESULT adjustPropertyChain(
...
@@ -2127,11 +2051,6 @@ static HRESULT adjustPropertyChain(
ULONG
parentPropertyId
,
ULONG
parentPropertyId
,
INT
typeOfRelation
)
INT
typeOfRelation
)
{
{
ULONG
newLinkProperty
=
PROPERTY_NULL
;
BOOL
needToFindAPlaceholder
=
FALSE
;
ULONG
storeNode
=
PROPERTY_NULL
;
ULONG
toStoreNode
=
PROPERTY_NULL
;
INT
relationType
=
0
;
HRESULT
hr
=
S_OK
;
HRESULT
hr
=
S_OK
;
BOOL
res
=
TRUE
;
BOOL
res
=
TRUE
;
...
@@ -2140,64 +2059,69 @@ static HRESULT adjustPropertyChain(
...
@@ -2140,64 +2059,69 @@ static HRESULT adjustPropertyChain(
/*
/*
* Replace the deleted entry with its left child
* Replace the deleted entry with its left child
*/
*/
newLinkProperty
=
propertyToDelete
.
leftChild
;
setPropertyLink
(
&
parentProperty
,
typeOfRelation
,
propertyToDelete
.
leftChild
);
res
=
StorageImpl_WriteProperty
(
This
->
base
.
ancestorStorage
,
parentPropertyId
,
&
parentProperty
);
if
(
!
res
)
{
return
E_FAIL
;
}
if
(
propertyToDelete
.
rightChild
!=
PROPERTY_NULL
)
if
(
propertyToDelete
.
rightChild
!=
PROPERTY_NULL
)
{
{
/*
/*
* We also need to find a place for the other link, setup variables
* We need to reinsert the right child somewhere. We already know it and
* to do this at the end...
* its children are greater than everything in the left tree, so we
* insert it at the rightmost point in the left tree.
*/
*/
needToFindAPlaceholder
=
TRUE
;
ULONG
newRightChildParent
=
propertyToDelete
.
leftChild
;
storeNode
=
propertyToDelete
.
leftChild
;
StgProperty
newRightChildParentProperty
;
toStoreNode
=
propertyToDelete
.
rightChild
;
relationType
=
PROPERTY_RELATION_NEXT
;
do
{
res
=
StorageImpl_ReadProperty
(
This
->
base
.
ancestorStorage
,
newRightChildParent
,
&
newRightChildParentProperty
);
if
(
!
res
)
{
return
E_FAIL
;
}
if
(
newRightChildParentProperty
.
rightChild
!=
PROPERTY_NULL
)
newRightChildParent
=
newRightChildParentProperty
.
rightChild
;
}
while
(
newRightChildParentProperty
.
rightChild
!=
PROPERTY_NULL
);
newRightChildParentProperty
.
rightChild
=
propertyToDelete
.
rightChild
;
res
=
StorageImpl_WriteProperty
(
This
->
base
.
ancestorStorage
,
newRightChildParent
,
&
newRightChildParentProperty
);
if
(
!
res
)
{
return
E_FAIL
;
}
}
}
}
}
else
if
(
propertyToDelete
.
rightChild
!=
PROPERTY_NULL
)
else
{
{
/*
/*
* Replace the deleted entry with its right child
* Replace the deleted entry with its right child
*/
*/
newLinkProperty
=
propertyToDelete
.
rightChild
;
setPropertyLink
(
&
parentProperty
,
typeOfRelation
,
propertyToDelete
.
rightChild
);
}
if
(
typeOfRelation
==
PROPERTY_RELATION_PREVIOUS
)
res
=
StorageImpl_WriteProperty
(
{
This
->
base
.
ancestorStorage
,
parentProperty
.
leftChild
=
newLinkProperty
;
parentPropertyId
,
}
&
parentProperty
);
else
if
(
typeOfRelation
==
PROPERTY_RELATION_NEXT
)
if
(
!
res
)
{
{
parentProperty
.
rightChild
=
newLinkProperty
;
return
E_FAIL
;
}
}
else
/* (typeOfRelation == PROPERTY_RELATION_DIR) */
{
parentProperty
.
dirProperty
=
newLinkProperty
;
}
/*
* Write back the parent property
*/
res
=
StorageImpl_WriteProperty
(
This
->
base
.
ancestorStorage
,
parentPropertyId
,
&
parentProperty
);
if
(
!
res
)
{
return
E_FAIL
;
}
/*
* If a placeholder is required for the other link, then, find one and
* get out of here...
*/
if
(
needToFindAPlaceholder
)
{
hr
=
findPlaceholder
(
This
,
toStoreNode
,
storeNode
,
relationType
);
}
}
return
hr
;
return
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