Module: wine
Branch: master
Commit: 37f3f3d92a8854104de0ef6774bc54f4a1400354
URL: http://source.winehq.org/git/wine.git/?a=commit;h=37f3f3d92a8854104de0ef677…
Author: Vincent Povirk <vincent(a)codeweavers.com>
Date: Wed Oct 28 13:42:42 2009 -0500
ole32: Write the new data in getFreeProperty and rename the function.
This is to avoid calling WriteProperty with an index to a directory entry
that has not yet been reserved in the file. We reserve the entry by writing
the new data to it.
---
dlls/ole32/storage32.c | 73 +++++++++++++++++++----------------------------
1 files changed, 30 insertions(+), 43 deletions(-)
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 3e00cf6..89ae657 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -180,8 +180,10 @@ static HRESULT adjustPropertyChain(
* Declaration of the functions used to manipulate StgProperty
*/
-static ULONG getFreeProperty(
- StorageImpl *storage);
+static HRESULT createDirEntry(
+ StorageImpl *storage,
+ const StgProperty *newData,
+ ULONG *index);
static void updatePropertyChain(
StorageImpl *storage,
@@ -757,17 +759,9 @@ static HRESULT WINAPI StorageBaseImpl_RenameElement(
*/
/*
- * Obtain a free property in the property chain
- */
- renamedPropertyIndex = getFreeProperty(This->ancestorStorage);
-
- /*
- * Save the new property into the new property spot
+ * Save the new property into a new property spot
*/
- StorageImpl_WriteProperty(
- This->ancestorStorage,
- renamedPropertyIndex,
- &renamedProperty);
+ createDirEntry(This->ancestorStorage, &renamedProperty, &renamedPropertyIndex);
/*
* Find a spot in the property chain for our newly created property.
@@ -945,17 +939,9 @@ static HRESULT WINAPI StorageBaseImpl_CreateStream(
/* newStreamProperty.propertyUniqueID */
/*
- * Get a free property or create a new one
+ * Save the new property into a new property spot
*/
- newPropertyIndex = getFreeProperty(This->ancestorStorage);
-
- /*
- * Save the new property into the new property spot
- */
- StorageImpl_WriteProperty(
- This->ancestorStorage,
- newPropertyIndex,
- &newStreamProperty);
+ createDirEntry(This->ancestorStorage, &newStreamProperty, &newPropertyIndex);
/*
* Find a spot in the property chain for our newly created property.
@@ -1136,17 +1122,9 @@ static HRESULT WINAPI StorageImpl_CreateStorage(
/* newStorageProperty.propertyUniqueID */
/*
- * Obtain a free property in the property chain
+ * Save the new property into a new property spot
*/
- newPropertyIndex = getFreeProperty(This->base.ancestorStorage);
-
- /*
- * Save the new property into the new property spot
- */
- StorageImpl_WriteProperty(
- This->base.ancestorStorage,
- newPropertyIndex,
- &newProperty);
+ createDirEntry(This->base.ancestorStorage, &newProperty, &newPropertyIndex);
/*
* Find a spot in the property chain for our newly created property.
@@ -1175,24 +1153,26 @@ static HRESULT WINAPI StorageImpl_CreateStorage(
*
* Internal Method
*
- * Get a free property or create a new one.
+ * Reserve a directory entry in the file and initialize it.
*/
-static ULONG getFreeProperty(
- StorageImpl *storage)
+static HRESULT createDirEntry(
+ StorageImpl *storage,
+ const StgProperty *newData,
+ ULONG *index)
{
ULONG currentPropertyIndex = 0;
ULONG newPropertyIndex = PROPERTY_NULL;
- HRESULT readRes = S_OK;
+ HRESULT hr = S_OK;
BYTE currentData[PROPSET_BLOCK_SIZE];
WORD sizeOfNameString;
do
{
- readRes = StorageImpl_ReadRawDirEntry(storage->base.ancestorStorage,
- currentPropertyIndex,
- currentData);
+ hr = StorageImpl_ReadRawDirEntry(storage->base.ancestorStorage,
+ currentPropertyIndex,
+ currentData);
- if (SUCCEEDED(readRes))
+ if (SUCCEEDED(hr))
{
StorageUtl_ReadWord(
currentData,
@@ -1221,7 +1201,7 @@ static ULONG getFreeProperty(
/*
* grow the property chain
*/
- if (!SUCCEEDED(readRes))
+ if (FAILED(hr))
{
BYTE emptyData[PROPSET_BLOCK_SIZE];
ULARGE_INTEGER newSize;
@@ -1258,7 +1238,7 @@ static ULONG getFreeProperty(
lastProperty = storage->bigBlockSize / PROPSET_BLOCK_SIZE * blockCount;
for(
- propertyIndex = newPropertyIndex;
+ propertyIndex = newPropertyIndex + 1;
propertyIndex < lastProperty;
propertyIndex++)
{
@@ -1269,7 +1249,14 @@ static ULONG getFreeProperty(
}
}
- return newPropertyIndex;
+ UpdateRawDirEntry(currentData, newData);
+
+ hr = StorageImpl_WriteRawDirEntry(storage, newPropertyIndex, currentData);
+
+ if (SUCCEEDED(hr))
+ *index = newPropertyIndex;
+
+ return hr;
}
/****************************************************************************
Module: wine
Branch: master
Commit: a7e69339dcda3d3360f3b03bac5272f9c1c0176d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a7e69339dcda3d3360f3b03ba…
Author: Vincent Povirk <vincent(a)codeweavers.com>
Date: Tue Oct 27 16:48:39 2009 -0500
ole32: Reduce duplicated code in adjustPropertyChain.
Most of the work is the same regardless of relation type, so bring
those parts out of the relation type test.
---
dlls/ole32/storage32.c | 106 +++++++++--------------------------------------
1 files changed, 21 insertions(+), 85 deletions(-)
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index fe74fb9..470dc83 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -2135,107 +2135,43 @@ static HRESULT adjustPropertyChain(
HRESULT hr = S_OK;
BOOL res = TRUE;
- if (typeOfRelation == PROPERTY_RELATION_PREVIOUS)
+ if (propertyToDelete.leftChild != PROPERTY_NULL)
{
- if (propertyToDelete.leftChild != PROPERTY_NULL)
- {
- /*
- * Set the parent previous to the property to delete previous
- */
- newLinkProperty = propertyToDelete.leftChild;
+ /*
+ * Replace the deleted entry with its left child
+ */
+ newLinkProperty = propertyToDelete.leftChild;
- if (propertyToDelete.rightChild != PROPERTY_NULL)
- {
- /*
- * We also need to find a storage for the other link, setup variables
- * to do this at the end...
- */
- needToFindAPlaceholder = TRUE;
- storeNode = propertyToDelete.leftChild;
- toStoreNode = propertyToDelete.rightChild;
- relationType = PROPERTY_RELATION_NEXT;
- }
- }
- else if (propertyToDelete.rightChild != PROPERTY_NULL)
+ if (propertyToDelete.rightChild != PROPERTY_NULL)
{
/*
- * Set the parent previous to the property to delete next
+ * We also need to find a place for the other link, setup variables
+ * to do this at the end...
*/
- newLinkProperty = propertyToDelete.rightChild;
+ needToFindAPlaceholder = TRUE;
+ storeNode = propertyToDelete.leftChild;
+ toStoreNode = propertyToDelete.rightChild;
+ relationType = PROPERTY_RELATION_NEXT;
}
-
+ }
+ else if (propertyToDelete.rightChild != PROPERTY_NULL)
+ {
/*
- * Link it for real...
+ * Replace the deleted entry with its right child
*/
- parentProperty.leftChild = newLinkProperty;
+ newLinkProperty = propertyToDelete.rightChild;
+ }
+ if (typeOfRelation == PROPERTY_RELATION_PREVIOUS)
+ {
+ parentProperty.leftChild = newLinkProperty;
}
else if (typeOfRelation == PROPERTY_RELATION_NEXT)
{
- if (propertyToDelete.leftChild != PROPERTY_NULL)
- {
- /*
- * Set the parent next to the property to delete next previous
- */
- newLinkProperty = propertyToDelete.leftChild;
-
- if (propertyToDelete.rightChild != PROPERTY_NULL)
- {
- /*
- * We also need to find a storage for the other link, setup variables
- * to do this at the end...
- */
- needToFindAPlaceholder = TRUE;
- storeNode = propertyToDelete.leftChild;
- toStoreNode = propertyToDelete.rightChild;
- relationType = PROPERTY_RELATION_NEXT;
- }
- }
- else if (propertyToDelete.rightChild != PROPERTY_NULL)
- {
- /*
- * Set the parent next to the property to delete next
- */
- newLinkProperty = propertyToDelete.rightChild;
- }
-
- /*
- * Link it for real...
- */
parentProperty.rightChild = newLinkProperty;
}
else /* (typeOfRelation == PROPERTY_RELATION_DIR) */
{
- if (propertyToDelete.leftChild != PROPERTY_NULL)
- {
- /*
- * Set the parent dir to the property to delete previous
- */
- newLinkProperty = propertyToDelete.leftChild;
-
- if (propertyToDelete.rightChild != PROPERTY_NULL)
- {
- /*
- * We also need to find a storage for the other link, setup variables
- * to do this at the end...
- */
- needToFindAPlaceholder = TRUE;
- storeNode = propertyToDelete.leftChild;
- toStoreNode = propertyToDelete.rightChild;
- relationType = PROPERTY_RELATION_NEXT;
- }
- }
- else if (propertyToDelete.rightChild != PROPERTY_NULL)
- {
- /*
- * Set the parent dir to the property to delete next
- */
- newLinkProperty = propertyToDelete.rightChild;
- }
-
- /*
- * Link it for real...
- */
parentProperty.dirProperty = newLinkProperty;
}
Module: wine
Branch: master
Commit: d1f95617474d77867ccc84c5846d0b295f101a9b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d1f95617474d77867ccc84c58…
Author: Huw Davies <huw(a)codeweavers.com>
Date: Wed Oct 28 13:49:02 2009 +0000
include: Add rowchg.idl.
---
include/Makefile.in | 1 +
include/oledb.idl | 1 +
include/rowchg.idl | 30 ++++++++++++++++++++++++++++++
tools/make_makefiles | 1 +
4 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/include/Makefile.in b/include/Makefile.in
index c32137f..eb2cabe 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -396,6 +396,7 @@ SRCDIR_INCLUDES = \
richedit.h \
rmxfguid.h \
row.idl \
+ rowchg.idl \
rpc.h \
rpcasync.h \
rpcdce.h \
diff --git a/include/oledb.idl b/include/oledb.idl
index 1aeacd7..b525b56 100644
--- a/include/oledb.idl
+++ b/include/oledb.idl
@@ -57,6 +57,7 @@ typedef DWORD DBHASHVALUE;
#include "sesprp.idl"
#include "opnrst.idl"
#include "row.idl"
+#include "rowchg.idl"
#include "binres.idl"
#include "crtrow.idl"
diff --git a/include/rowchg.idl b/include/rowchg.idl
new file mode 100644
index 0000000..7bfa506
--- /dev/null
+++ b/include/rowchg.idl
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2009 Huw Davies
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+[
+ local,
+ object,
+ uuid(0c733ab5-2a1c-11ce-ade5-00aa0044773d),
+ pointer_default(unique)
+]
+interface IRowChange : IUnknown
+{
+ [local]
+ HRESULT SetColumns([in] DBORDINAL cColumns,
+ [in, out, size_is(cColumns), annotation("__in_ecount(cColumns)")] DBCOLUMNACCESS rgColumns[]);
+}
diff --git a/tools/make_makefiles b/tools/make_makefiles
index f707564..828e6b0 100755
--- a/tools/make_makefiles
+++ b/tools/make_makefiles
@@ -126,6 +126,7 @@ my %private_idl_headers = (
"dyngraph.idl" => 1,
"opnrst.idl" => 1,
"row.idl" => 1,
+ "rowchg.idl" => 1,
"rstbas.idl" => 1,
"rstinf.idl" => 1,
"rstloc.idl" => 1,