ole32: Rename property variables in the StorageBaseImpl methods.

This commit is contained in:
Vincent Povirk 2009-11-12 14:32:35 -06:00 committed by Alexandre Julliard
parent de3ed0bb50
commit b984e46b86
1 changed files with 104 additions and 107 deletions

View File

@ -395,8 +395,8 @@ static HRESULT WINAPI StorageBaseImpl_OpenStream(
{ {
StorageBaseImpl *This = (StorageBaseImpl *)iface; StorageBaseImpl *This = (StorageBaseImpl *)iface;
StgStreamImpl* newStream; StgStreamImpl* newStream;
DirEntry currentProperty; DirEntry currentEntry;
ULONG foundPropertyIndex; ULONG streamEntryRef;
HRESULT res = STG_E_UNKNOWN; HRESULT res = STG_E_UNKNOWN;
TRACE("(%p, %s, %p, %x, %d, %p)\n", TRACE("(%p, %s, %p, %x, %d, %p)\n",
@ -441,19 +441,19 @@ static HRESULT WINAPI StorageBaseImpl_OpenStream(
/* /*
* Search for the element with the given name * Search for the element with the given name
*/ */
foundPropertyIndex = findElement( streamEntryRef = findElement(
This->ancestorStorage, This->ancestorStorage,
This->storageDirEntry, This->storageDirEntry,
pwcsName, pwcsName,
&currentProperty); &currentEntry);
/* /*
* If it was found, construct the stream object and return a pointer to it. * If it was found, construct the stream object and return a pointer to it.
*/ */
if ( (foundPropertyIndex!=DIRENTRY_NULL) && if ( (streamEntryRef!=DIRENTRY_NULL) &&
(currentProperty.stgType==STGTY_STREAM) ) (currentEntry.stgType==STGTY_STREAM) )
{ {
newStream = StgStreamImpl_Construct(This, grfMode, foundPropertyIndex); newStream = StgStreamImpl_Construct(This, grfMode, streamEntryRef);
if (newStream!=0) if (newStream!=0)
{ {
@ -497,8 +497,8 @@ static HRESULT WINAPI StorageBaseImpl_OpenStorage(
{ {
StorageBaseImpl *This = (StorageBaseImpl *)iface; StorageBaseImpl *This = (StorageBaseImpl *)iface;
StorageInternalImpl* newStorage; StorageInternalImpl* newStorage;
DirEntry currentProperty; DirEntry currentEntry;
ULONG foundPropertyIndex; ULONG storageEntryRef;
HRESULT res = STG_E_UNKNOWN; HRESULT res = STG_E_UNKNOWN;
TRACE("(%p, %s, %p, %x, %p, %d, %p)\n", TRACE("(%p, %s, %p, %x, %p, %d, %p)\n",
@ -549,19 +549,19 @@ static HRESULT WINAPI StorageBaseImpl_OpenStorage(
*ppstg = NULL; *ppstg = NULL;
foundPropertyIndex = findElement( storageEntryRef = findElement(
This->ancestorStorage, This->ancestorStorage,
This->storageDirEntry, This->storageDirEntry,
pwcsName, pwcsName,
&currentProperty); &currentEntry);
if ( (foundPropertyIndex!=DIRENTRY_NULL) && if ( (storageEntryRef!=DIRENTRY_NULL) &&
(currentProperty.stgType==STGTY_STORAGE) ) (currentEntry.stgType==STGTY_STORAGE) )
{ {
newStorage = StorageInternalImpl_Construct( newStorage = StorageInternalImpl_Construct(
This->ancestorStorage, This->ancestorStorage,
grfMode, grfMode,
foundPropertyIndex); storageEntryRef);
if (newStorage != 0) if (newStorage != 0)
{ {
@ -588,7 +588,7 @@ end:
* Storage32BaseImpl_EnumElements (IStorage) * Storage32BaseImpl_EnumElements (IStorage)
* *
* This method will create an enumerator object that can be used to * This method will create an enumerator object that can be used to
* retrieve information about all the properties in the storage object. * retrieve information about all the elements in the storage object.
* *
* See Windows documentation for more details on IStorage methods. * See Windows documentation for more details on IStorage methods.
*/ */
@ -637,7 +637,7 @@ static HRESULT WINAPI StorageBaseImpl_Stat(
DWORD grfStatFlag) /* [in] */ DWORD grfStatFlag) /* [in] */
{ {
StorageBaseImpl *This = (StorageBaseImpl *)iface; StorageBaseImpl *This = (StorageBaseImpl *)iface;
DirEntry curProperty; DirEntry currentEntry;
BOOL readSuccessful; BOOL readSuccessful;
HRESULT res = STG_E_UNKNOWN; HRESULT res = STG_E_UNKNOWN;
@ -653,13 +653,13 @@ static HRESULT WINAPI StorageBaseImpl_Stat(
readSuccessful = StorageImpl_ReadDirEntry( readSuccessful = StorageImpl_ReadDirEntry(
This->ancestorStorage, This->ancestorStorage,
This->storageDirEntry, This->storageDirEntry,
&curProperty); &currentEntry);
if (readSuccessful) if (readSuccessful)
{ {
StorageUtl_CopyDirEntryToSTATSTG( StorageUtl_CopyDirEntryToSTATSTG(
pstatstg, pstatstg,
&curProperty, &currentEntry,
grfStatFlag); grfStatFlag);
pstatstg->grfMode = This->openFlags; pstatstg->grfMode = This->openFlags;
@ -693,21 +693,21 @@ static HRESULT WINAPI StorageBaseImpl_RenameElement(
const OLECHAR* pwcsNewName) /* [in] */ const OLECHAR* pwcsNewName) /* [in] */
{ {
StorageBaseImpl *This = (StorageBaseImpl *)iface; StorageBaseImpl *This = (StorageBaseImpl *)iface;
DirEntry currentProperty; DirEntry currentEntry;
ULONG foundPropertyIndex; ULONG currentEntryRef;
TRACE("(%p, %s, %s)\n", TRACE("(%p, %s, %s)\n",
iface, debugstr_w(pwcsOldName), debugstr_w(pwcsNewName)); iface, debugstr_w(pwcsOldName), debugstr_w(pwcsNewName));
foundPropertyIndex = findElement(This->ancestorStorage, currentEntryRef = findElement(This->ancestorStorage,
This->storageDirEntry, This->storageDirEntry,
pwcsNewName, pwcsNewName,
&currentProperty); &currentEntry);
if (foundPropertyIndex != DIRENTRY_NULL) if (currentEntryRef != DIRENTRY_NULL)
{ {
/* /*
* There is already a property with the new name * There is already an element with the new name
*/ */
return STG_E_FILEALREADYEXISTS; return STG_E_FILEALREADYEXISTS;
} }
@ -715,31 +715,31 @@ static HRESULT WINAPI StorageBaseImpl_RenameElement(
/* /*
* Search for the old element name * Search for the old element name
*/ */
foundPropertyIndex = findElement(This->ancestorStorage, currentEntryRef = findElement(This->ancestorStorage,
This->storageDirEntry, This->storageDirEntry,
pwcsOldName, pwcsOldName,
&currentProperty); &currentEntry);
if (foundPropertyIndex != DIRENTRY_NULL) if (currentEntryRef != DIRENTRY_NULL)
{ {
/* Remove the element from its current position in the tree */ /* Remove the element from its current position in the tree */
removeFromTree(This->ancestorStorage, This->storageDirEntry, removeFromTree(This->ancestorStorage, This->storageDirEntry,
foundPropertyIndex); currentEntryRef);
/* Change the name of the element */ /* Change the name of the element */
strcpyW(currentProperty.name, pwcsNewName); strcpyW(currentEntry.name, pwcsNewName);
StorageImpl_WriteDirEntry(This->ancestorStorage, foundPropertyIndex, StorageImpl_WriteDirEntry(This->ancestorStorage, currentEntryRef,
&currentProperty); &currentEntry);
/* Insert the element in a new position in the tree */ /* Insert the element in a new position in the tree */
insertIntoTree(This->ancestorStorage, This->storageDirEntry, insertIntoTree(This->ancestorStorage, This->storageDirEntry,
foundPropertyIndex); currentEntryRef);
} }
else else
{ {
/* /*
* There is no property with the old name * There is no element with the old name
*/ */
return STG_E_FILENOTFOUND; return STG_E_FILENOTFOUND;
} }
@ -764,8 +764,8 @@ static HRESULT WINAPI StorageBaseImpl_CreateStream(
{ {
StorageBaseImpl *This = (StorageBaseImpl *)iface; StorageBaseImpl *This = (StorageBaseImpl *)iface;
StgStreamImpl* newStream; StgStreamImpl* newStream;
DirEntry currentProperty, newStreamProperty; DirEntry currentEntry, newStreamEntry;
ULONG foundPropertyIndex, newPropertyIndex; ULONG currentEntryRef, newStreamEntryRef;
TRACE("(%p, %s, %x, %d, %d, %p)\n", TRACE("(%p, %s, %x, %d, %d, %p)\n",
iface, debugstr_w(pwcsName), grfMode, iface, debugstr_w(pwcsName), grfMode,
@ -811,12 +811,12 @@ static HRESULT WINAPI StorageBaseImpl_CreateStream(
*ppstm = 0; *ppstm = 0;
foundPropertyIndex = findElement(This->ancestorStorage, currentEntryRef = findElement(This->ancestorStorage,
This->storageDirEntry, This->storageDirEntry,
pwcsName, pwcsName,
&currentProperty); &currentEntry);
if (foundPropertyIndex != DIRENTRY_NULL) if (currentEntryRef != DIRENTRY_NULL)
{ {
/* /*
* An element with this name already exists * An element with this name already exists
@ -827,7 +827,7 @@ static HRESULT WINAPI StorageBaseImpl_CreateStream(
LIST_FOR_EACH_ENTRY(strm, &This->strmHead, StgStreamImpl, StrmListEntry) LIST_FOR_EACH_ENTRY(strm, &This->strmHead, StgStreamImpl, StrmListEntry)
{ {
if (strm->dirEntry == foundPropertyIndex) if (strm->dirEntry == currentEntryRef)
{ {
TRACE("Stream deleted %p\n", strm); TRACE("Stream deleted %p\n", strm);
strm->parentStorage = NULL; strm->parentStorage = NULL;
@ -846,51 +846,51 @@ static HRESULT WINAPI StorageBaseImpl_CreateStream(
} }
/* /*
* memset the empty property * memset the empty entry
*/ */
memset(&newStreamProperty, 0, sizeof(DirEntry)); memset(&newStreamEntry, 0, sizeof(DirEntry));
newStreamProperty.sizeOfNameString = newStreamEntry.sizeOfNameString =
( lstrlenW(pwcsName)+1 ) * sizeof(WCHAR); ( lstrlenW(pwcsName)+1 ) * sizeof(WCHAR);
if (newStreamProperty.sizeOfNameString > DIRENTRY_NAME_BUFFER_LEN) if (newStreamEntry.sizeOfNameString > DIRENTRY_NAME_BUFFER_LEN)
return STG_E_INVALIDNAME; return STG_E_INVALIDNAME;
strcpyW(newStreamProperty.name, pwcsName); strcpyW(newStreamEntry.name, pwcsName);
newStreamProperty.stgType = STGTY_STREAM; newStreamEntry.stgType = STGTY_STREAM;
newStreamProperty.startingBlock = BLOCK_END_OF_CHAIN; newStreamEntry.startingBlock = BLOCK_END_OF_CHAIN;
newStreamProperty.size.u.LowPart = 0; newStreamEntry.size.u.LowPart = 0;
newStreamProperty.size.u.HighPart = 0; newStreamEntry.size.u.HighPart = 0;
newStreamProperty.leftChild = DIRENTRY_NULL; newStreamEntry.leftChild = DIRENTRY_NULL;
newStreamProperty.rightChild = DIRENTRY_NULL; newStreamEntry.rightChild = DIRENTRY_NULL;
newStreamProperty.dirRootEntry = DIRENTRY_NULL; newStreamEntry.dirRootEntry = DIRENTRY_NULL;
/* call CoFileTime to get the current time /* call CoFileTime to get the current time
newStreamProperty.ctime newStreamEntry.ctime
newStreamProperty.mtime newStreamEntry.mtime
*/ */
/* newStreamProperty.propertyUniqueID */ /* newStreamEntry.clsid */
/* /*
* Save the new property into a new property spot * Create an entry with the new data
*/ */
createDirEntry(This->ancestorStorage, &newStreamProperty, &newPropertyIndex); createDirEntry(This->ancestorStorage, &newStreamEntry, &newStreamEntryRef);
/* /*
* Find a spot in the property chain for our newly created property. * Insert the new entry in the parent storage's tree.
*/ */
insertIntoTree( insertIntoTree(
This->ancestorStorage, This->ancestorStorage,
This->storageDirEntry, This->storageDirEntry,
newPropertyIndex); newStreamEntryRef);
/* /*
* Open the stream to return it. * Open the stream to return it.
*/ */
newStream = StgStreamImpl_Construct(This, grfMode, newPropertyIndex); newStream = StgStreamImpl_Construct(This, grfMode, newStreamEntryRef);
if (newStream != 0) if (newStream != 0)
{ {
@ -909,7 +909,7 @@ static HRESULT WINAPI StorageBaseImpl_CreateStream(
/************************************************************************ /************************************************************************
* Storage32BaseImpl_SetClass (IStorage) * Storage32BaseImpl_SetClass (IStorage)
* *
* This method will write the specified CLSID in the property of this * This method will write the specified CLSID in the directory entry of this
* storage. * storage.
* *
* See Windows documentation for more details on IStorage methods. * See Windows documentation for more details on IStorage methods.
@ -920,21 +920,21 @@ static HRESULT WINAPI StorageBaseImpl_SetClass(
{ {
StorageBaseImpl *This = (StorageBaseImpl *)iface; StorageBaseImpl *This = (StorageBaseImpl *)iface;
HRESULT hRes = E_FAIL; HRESULT hRes = E_FAIL;
DirEntry curProperty; DirEntry currentEntry;
BOOL success; BOOL success;
TRACE("(%p, %p)\n", iface, clsid); TRACE("(%p, %p)\n", iface, clsid);
success = StorageImpl_ReadDirEntry(This->ancestorStorage, success = StorageImpl_ReadDirEntry(This->ancestorStorage,
This->storageDirEntry, This->storageDirEntry,
&curProperty); &currentEntry);
if (success) if (success)
{ {
curProperty.clsid = *clsid; currentEntry.clsid = *clsid;
success = StorageImpl_WriteDirEntry(This->ancestorStorage, success = StorageImpl_WriteDirEntry(This->ancestorStorage,
This->storageDirEntry, This->storageDirEntry,
&curProperty); &currentEntry);
if (success) if (success)
hRes = S_OK; hRes = S_OK;
} }
@ -963,10 +963,10 @@ static HRESULT WINAPI StorageBaseImpl_CreateStorage(
{ {
StorageBaseImpl* const This=(StorageBaseImpl*)iface; StorageBaseImpl* const This=(StorageBaseImpl*)iface;
DirEntry currentProperty; DirEntry currentEntry;
DirEntry newProperty; DirEntry newEntry;
ULONG foundPropertyIndex; ULONG currentEntryRef;
ULONG newPropertyIndex; ULONG newEntryRef;
HRESULT hr; HRESULT hr;
TRACE("(%p, %s, %x, %d, %d, %p)\n", TRACE("(%p, %s, %x, %d, %d, %p)\n",
@ -997,12 +997,12 @@ static HRESULT WINAPI StorageBaseImpl_CreateStorage(
return STG_E_ACCESSDENIED; return STG_E_ACCESSDENIED;
} }
foundPropertyIndex = findElement(This->ancestorStorage, currentEntryRef = findElement(This->ancestorStorage,
This->storageDirEntry, This->storageDirEntry,
pwcsName, pwcsName,
&currentProperty); &currentEntry);
if (foundPropertyIndex != DIRENTRY_NULL) if (currentEntryRef != DIRENTRY_NULL)
{ {
/* /*
* An element with this name already exists * An element with this name already exists
@ -1026,49 +1026,46 @@ static HRESULT WINAPI StorageBaseImpl_CreateStorage(
return STG_E_ACCESSDENIED; return STG_E_ACCESSDENIED;
} }
/* memset(&newEntry, 0, sizeof(DirEntry));
* memset the empty property
*/
memset(&newProperty, 0, sizeof(DirEntry));
newProperty.sizeOfNameString = (lstrlenW(pwcsName)+1)*sizeof(WCHAR); newEntry.sizeOfNameString = (lstrlenW(pwcsName)+1)*sizeof(WCHAR);
if (newProperty.sizeOfNameString > DIRENTRY_NAME_BUFFER_LEN) if (newEntry.sizeOfNameString > DIRENTRY_NAME_BUFFER_LEN)
{ {
FIXME("name too long\n"); FIXME("name too long\n");
return STG_E_INVALIDNAME; return STG_E_INVALIDNAME;
} }
strcpyW(newProperty.name, pwcsName); strcpyW(newEntry.name, pwcsName);
newProperty.stgType = STGTY_STORAGE; newEntry.stgType = STGTY_STORAGE;
newProperty.startingBlock = BLOCK_END_OF_CHAIN; newEntry.startingBlock = BLOCK_END_OF_CHAIN;
newProperty.size.u.LowPart = 0; newEntry.size.u.LowPart = 0;
newProperty.size.u.HighPart = 0; newEntry.size.u.HighPart = 0;
newProperty.leftChild = DIRENTRY_NULL; newEntry.leftChild = DIRENTRY_NULL;
newProperty.rightChild = DIRENTRY_NULL; newEntry.rightChild = DIRENTRY_NULL;
newProperty.dirRootEntry = DIRENTRY_NULL; newEntry.dirRootEntry = DIRENTRY_NULL;
/* call CoFileTime to get the current time /* call CoFileTime to get the current time
newProperty.ctime newEntry.ctime
newProperty.mtime newEntry.mtime
*/ */
/* newStorageProperty.propertyUniqueID */ /* newEntry.clsid */
/* /*
* Save the new property into a new property spot * Create a new directory entry for the storage
*/ */
createDirEntry(This->ancestorStorage, &newProperty, &newPropertyIndex); createDirEntry(This->ancestorStorage, &newEntry, &newEntryRef);
/* /*
* Find a spot in the property chain for our newly created property. * Insert the new directory entry into the parent storage's tree
*/ */
insertIntoTree( insertIntoTree(
This->ancestorStorage, This->ancestorStorage,
This->storageDirEntry, This->storageDirEntry,
newPropertyIndex); newEntryRef);
/* /*
* Open it to get a pointer to return. * Open it to get a pointer to return.
@ -1721,8 +1718,8 @@ static HRESULT WINAPI StorageBaseImpl_DestroyElement(
StorageBaseImpl* const This=(StorageBaseImpl*)iface; StorageBaseImpl* const This=(StorageBaseImpl*)iface;
HRESULT hr = S_OK; HRESULT hr = S_OK;
DirEntry propertyToDelete; DirEntry entryToDelete;
ULONG foundPropertyIndexToDelete; ULONG entryToDeleteRef;
TRACE("(%p, %s)\n", TRACE("(%p, %s)\n",
iface, debugstr_w(pwcsName)); iface, debugstr_w(pwcsName));
@ -1733,49 +1730,49 @@ static HRESULT WINAPI StorageBaseImpl_DestroyElement(
if ( STGM_ACCESS_MODE( This->openFlags ) == STGM_READ ) if ( STGM_ACCESS_MODE( This->openFlags ) == STGM_READ )
return STG_E_ACCESSDENIED; return STG_E_ACCESSDENIED;
foundPropertyIndexToDelete = findElement( entryToDeleteRef = findElement(
This->ancestorStorage, This->ancestorStorage,
This->storageDirEntry, This->storageDirEntry,
pwcsName, pwcsName,
&propertyToDelete); &entryToDelete);
if ( foundPropertyIndexToDelete == DIRENTRY_NULL ) if ( entryToDeleteRef == DIRENTRY_NULL )
{ {
return STG_E_FILENOTFOUND; return STG_E_FILENOTFOUND;
} }
if ( propertyToDelete.stgType == STGTY_STORAGE ) if ( entryToDelete.stgType == STGTY_STORAGE )
{ {
hr = deleteStorageContents( hr = deleteStorageContents(
This, This,
foundPropertyIndexToDelete, entryToDeleteRef,
propertyToDelete); entryToDelete);
} }
else if ( propertyToDelete.stgType == STGTY_STREAM ) else if ( entryToDelete.stgType == STGTY_STREAM )
{ {
hr = deleteStreamContents( hr = deleteStreamContents(
This, This,
foundPropertyIndexToDelete, entryToDeleteRef,
propertyToDelete); entryToDelete);
} }
if (hr!=S_OK) if (hr!=S_OK)
return hr; return hr;
/* /*
* Adjust the property chain * Remove the entry from its parent storage
*/ */
hr = removeFromTree( hr = removeFromTree(
This->ancestorStorage, This->ancestorStorage,
This->storageDirEntry, This->storageDirEntry,
foundPropertyIndexToDelete); entryToDeleteRef);
/* /*
* Invalidate the property * Invalidate the entry
*/ */
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
destroyDirEntry(This->ancestorStorage, destroyDirEntry(This->ancestorStorage,
foundPropertyIndexToDelete); entryToDeleteRef);
return hr; return hr;
} }