Commit f1861166 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

ole32: Rename property variables in internal storage functions.

parent b984e46b
...@@ -1093,8 +1093,8 @@ static HRESULT createDirEntry( ...@@ -1093,8 +1093,8 @@ static HRESULT createDirEntry(
const DirEntry *newData, const DirEntry *newData,
ULONG *index) ULONG *index)
{ {
ULONG currentPropertyIndex = 0; ULONG currentEntryIndex = 0;
ULONG newPropertyIndex = DIRENTRY_NULL; ULONG newEntryIndex = DIRENTRY_NULL;
HRESULT hr = S_OK; HRESULT hr = S_OK;
BYTE currentData[RAW_DIRENTRY_SIZE]; BYTE currentData[RAW_DIRENTRY_SIZE];
WORD sizeOfNameString; WORD sizeOfNameString;
...@@ -1102,7 +1102,7 @@ static HRESULT createDirEntry( ...@@ -1102,7 +1102,7 @@ static HRESULT createDirEntry(
do do
{ {
hr = StorageImpl_ReadRawDirEntry(storage, hr = StorageImpl_ReadRawDirEntry(storage,
currentPropertyIndex, currentEntryIndex,
currentData); currentData);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
...@@ -1115,79 +1115,79 @@ static HRESULT createDirEntry( ...@@ -1115,79 +1115,79 @@ static HRESULT createDirEntry(
if (sizeOfNameString == 0) if (sizeOfNameString == 0)
{ {
/* /*
* The property existis and is available, we found it. * The entry exists and is available, we found it.
*/ */
newPropertyIndex = currentPropertyIndex; newEntryIndex = currentEntryIndex;
} }
} }
else else
{ {
/* /*
* We exhausted the property list, we will create more space below * We exhausted the directory entries, we will create more space below
*/ */
newPropertyIndex = currentPropertyIndex; newEntryIndex = currentEntryIndex;
} }
currentPropertyIndex++; currentEntryIndex++;
} while (newPropertyIndex == DIRENTRY_NULL); } while (newEntryIndex == DIRENTRY_NULL);
/* /*
* grow the property chain * grow the directory stream
*/ */
if (FAILED(hr)) if (FAILED(hr))
{ {
BYTE emptyData[RAW_DIRENTRY_SIZE]; BYTE emptyData[RAW_DIRENTRY_SIZE];
ULARGE_INTEGER newSize; ULARGE_INTEGER newSize;
ULONG propertyIndex; ULONG entryIndex;
ULONG lastProperty = 0; ULONG lastEntry = 0;
ULONG blockCount = 0; ULONG blockCount = 0;
/* /*
* obtain the new count of property blocks * obtain the new count of blocks in the directory stream
*/ */
blockCount = BlockChainStream_GetCount( blockCount = BlockChainStream_GetCount(
storage->rootBlockChain)+1; storage->rootBlockChain)+1;
/* /*
* initialize the size used by the property stream * initialize the size used by the directory stream
*/ */
newSize.u.HighPart = 0; newSize.u.HighPart = 0;
newSize.u.LowPart = storage->bigBlockSize * blockCount; newSize.u.LowPart = storage->bigBlockSize * blockCount;
/* /*
* add a property block to the property chain * add a block to the directory stream
*/ */
BlockChainStream_SetSize(storage->rootBlockChain, newSize); BlockChainStream_SetSize(storage->rootBlockChain, newSize);
/* /*
* memset the empty property in order to initialize the unused newly * memset the empty entry in order to initialize the unused newly
* created property * created entries
*/ */
memset(&emptyData, 0, RAW_DIRENTRY_SIZE); memset(&emptyData, 0, RAW_DIRENTRY_SIZE);
/* /*
* initialize them * initialize them
*/ */
lastProperty = storage->bigBlockSize / RAW_DIRENTRY_SIZE * blockCount; lastEntry = storage->bigBlockSize / RAW_DIRENTRY_SIZE * blockCount;
for( for(
propertyIndex = newPropertyIndex + 1; entryIndex = newEntryIndex + 1;
propertyIndex < lastProperty; entryIndex < lastEntry;
propertyIndex++) entryIndex++)
{ {
StorageImpl_WriteRawDirEntry( StorageImpl_WriteRawDirEntry(
storage, storage,
propertyIndex, entryIndex,
emptyData); emptyData);
} }
} }
UpdateRawDirEntry(currentData, newData); UpdateRawDirEntry(currentData, newData);
hr = StorageImpl_WriteRawDirEntry(storage, newPropertyIndex, currentData); hr = StorageImpl_WriteRawDirEntry(storage, newEntryIndex, currentData);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
*index = newPropertyIndex; *index = newEntryIndex;
return hr; return hr;
} }
...@@ -1245,7 +1245,7 @@ static LONG entryNameCmp( ...@@ -1245,7 +1245,7 @@ static LONG entryNameCmp(
* *
* Internal Method * Internal Method
* *
* Properly link this new element in the property chain. * Add a directory entry to a storage
*/ */
static HRESULT insertIntoTree( static HRESULT insertIntoTree(
StorageImpl *This, StorageImpl *This,
...@@ -1256,14 +1256,14 @@ static HRESULT insertIntoTree( ...@@ -1256,14 +1256,14 @@ static HRESULT insertIntoTree(
DirEntry newEntry; DirEntry newEntry;
/* /*
* Read the inserted property * Read the inserted entry
*/ */
StorageImpl_ReadDirEntry(This, StorageImpl_ReadDirEntry(This,
newEntryIndex, newEntryIndex,
&newEntry); &newEntry);
/* /*
* Read the root property * Read the storage entry
*/ */
StorageImpl_ReadDirEntry(This, StorageImpl_ReadDirEntry(This,
parentStorageIndex, parentStorageIndex,
...@@ -1279,7 +1279,7 @@ static HRESULT insertIntoTree( ...@@ -1279,7 +1279,7 @@ static HRESULT insertIntoTree(
ULONG current, next, previous, currentEntryId; ULONG current, next, previous, currentEntryId;
/* /*
* Keep the DirEntry sequence number of the storage first property * Keep a reference to the root of the storage's element tree
*/ */
currentEntryId = currentEntry.dirRootEntry; currentEntryId = currentEntry.dirRootEntry;
...@@ -1350,7 +1350,7 @@ static HRESULT insertIntoTree( ...@@ -1350,7 +1350,7 @@ static HRESULT insertIntoTree(
else else
{ {
/* /*
* The root storage is empty, link the new property to its dir property * The storage is empty, make the new entry the root of its element tree
*/ */
currentEntry.dirRootEntry = newEntryIndex; currentEntry.dirRootEntry = newEntryIndex;
StorageImpl_WriteDirEntry(This, StorageImpl_WriteDirEntry(This,
...@@ -1944,18 +1944,18 @@ static HRESULT deleteStreamContents( ...@@ -1944,18 +1944,18 @@ static HRESULT deleteStreamContents(
return S_OK; return S_OK;
} }
static void setPropertyLink(DirEntry *property, ULONG relation, ULONG new_target) static void setEntryLink(DirEntry *entry, ULONG relation, ULONG new_target)
{ {
switch (relation) switch (relation)
{ {
case DIRENTRY_RELATION_PREVIOUS: case DIRENTRY_RELATION_PREVIOUS:
property->leftChild = new_target; entry->leftChild = new_target;
break; break;
case DIRENTRY_RELATION_NEXT: case DIRENTRY_RELATION_NEXT:
property->rightChild = new_target; entry->rightChild = new_target;
break; break;
case DIRENTRY_RELATION_DIR: case DIRENTRY_RELATION_DIR:
property->dirRootEntry = new_target; entry->dirRootEntry = new_target;
break; break;
default: default:
assert(0); assert(0);
...@@ -1976,69 +1976,69 @@ static HRESULT removeFromTree( ...@@ -1976,69 +1976,69 @@ static HRESULT removeFromTree(
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
BOOL res = TRUE; BOOL res = TRUE;
DirEntry propertyToDelete; DirEntry entryToDelete;
DirEntry parentProperty; DirEntry parentEntry;
ULONG parentPropertyId; ULONG parentEntryRef;
ULONG typeOfRelation; ULONG typeOfRelation;
res = StorageImpl_ReadDirEntry(This, deletedIndex, &propertyToDelete); res = StorageImpl_ReadDirEntry(This, deletedIndex, &entryToDelete);
/* /*
* Find the property that links to the one we want to delete. * Find the element that links to the one we want to delete.
*/ */
hr = findTreeParent(This, parentStorageIndex, propertyToDelete.name, hr = findTreeParent(This, parentStorageIndex, entryToDelete.name,
&parentProperty, &parentPropertyId, &typeOfRelation); &parentEntry, &parentEntryRef, &typeOfRelation);
if (hr != S_OK) if (hr != S_OK)
return hr; return hr;
if (propertyToDelete.leftChild != DIRENTRY_NULL) if (entryToDelete.leftChild != DIRENTRY_NULL)
{ {
/* /*
* Replace the deleted entry with its left child * Replace the deleted entry with its left child
*/ */
setPropertyLink(&parentProperty, typeOfRelation, propertyToDelete.leftChild); setEntryLink(&parentEntry, typeOfRelation, entryToDelete.leftChild);
res = StorageImpl_WriteDirEntry( res = StorageImpl_WriteDirEntry(
This, This,
parentPropertyId, parentEntryRef,
&parentProperty); &parentEntry);
if(!res) if(!res)
{ {
return E_FAIL; return E_FAIL;
} }
if (propertyToDelete.rightChild != DIRENTRY_NULL) if (entryToDelete.rightChild != DIRENTRY_NULL)
{ {
/* /*
* We need to reinsert the right child somewhere. We already know it and * We need to reinsert the right child somewhere. We already know it and
* its children are greater than everything in the left tree, so we * its children are greater than everything in the left tree, so we
* insert it at the rightmost point in the left tree. * insert it at the rightmost point in the left tree.
*/ */
ULONG newRightChildParent = propertyToDelete.leftChild; ULONG newRightChildParent = entryToDelete.leftChild;
DirEntry newRightChildParentProperty; DirEntry newRightChildParentEntry;
do do
{ {
res = StorageImpl_ReadDirEntry( res = StorageImpl_ReadDirEntry(
This, This,
newRightChildParent, newRightChildParent,
&newRightChildParentProperty); &newRightChildParentEntry);
if (!res) if (!res)
{ {
return E_FAIL; return E_FAIL;
} }
if (newRightChildParentProperty.rightChild != DIRENTRY_NULL) if (newRightChildParentEntry.rightChild != DIRENTRY_NULL)
newRightChildParent = newRightChildParentProperty.rightChild; newRightChildParent = newRightChildParentEntry.rightChild;
} while (newRightChildParentProperty.rightChild != DIRENTRY_NULL); } while (newRightChildParentEntry.rightChild != DIRENTRY_NULL);
newRightChildParentProperty.rightChild = propertyToDelete.rightChild; newRightChildParentEntry.rightChild = entryToDelete.rightChild;
res = StorageImpl_WriteDirEntry( res = StorageImpl_WriteDirEntry(
This, This,
newRightChildParent, newRightChildParent,
&newRightChildParentProperty); &newRightChildParentEntry);
if (!res) if (!res)
{ {
return E_FAIL; return E_FAIL;
...@@ -2050,12 +2050,12 @@ static HRESULT removeFromTree( ...@@ -2050,12 +2050,12 @@ static HRESULT removeFromTree(
/* /*
* Replace the deleted entry with its right child * Replace the deleted entry with its right child
*/ */
setPropertyLink(&parentProperty, typeOfRelation, propertyToDelete.rightChild); setEntryLink(&parentEntry, typeOfRelation, entryToDelete.rightChild);
res = StorageImpl_WriteDirEntry( res = StorageImpl_WriteDirEntry(
This, This,
parentPropertyId, parentEntryRef,
&parentProperty); &parentEntry);
if(!res) if(!res)
{ {
return E_FAIL; return E_FAIL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment