[PATCH 3/3] shlwapi: SHAddDataBlock() returns BOOL, not HRESULT.
Zebediah Figura
zfigura at codeweavers.com
Sat Aug 28 17:10:47 CDT 2021
From: Hermès Bélusca-Maïto <hermes.belusca at sfr.fr>
Signed-off-by: Hermès Bélusca-Maïto <hermes.belusca at sfr.fr>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
dlls/shlwapi/clist.c | 10 +++++-----
dlls/shlwapi/tests/clist.c | 20 +++++++++++---------
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/dlls/shlwapi/clist.c b/dlls/shlwapi/clist.c
index 52bee37c9e4..47bd8d7392f 100644
--- a/dlls/shlwapi/clist.c
+++ b/dlls/shlwapi/clist.c
@@ -65,7 +65,7 @@ static inline LPDATABLOCK_HEADER NextItem(LPDBLIST lpList)
* the call returns S_OK but does not actually add the element.
* See SHWriteDataBlockList.
*/
-HRESULT WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewItem)
+BOOL WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewItem)
{
LPDATABLOCK_HEADER lpInsertAt = NULL;
ULONG ulSize;
@@ -73,11 +73,11 @@ HRESULT WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewIt
TRACE("(%p,%p)\n", lppList, lpNewItem);
if(!lppList || !lpNewItem )
- return E_INVALIDARG;
+ return FALSE;
if (lpNewItem->cbSize < sizeof(DATABLOCK_HEADER) ||
lpNewItem->dwSignature == CLIST_ID_CONTAINER)
- return S_OK;
+ return FALSE;
ulSize = lpNewItem->cbSize;
@@ -134,9 +134,9 @@ HRESULT WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewIt
lpInsertAt = NextItem(lpInsertAt);
lpInsertAt->cbSize = 0;
- return lpNewItem->cbSize;
+ return TRUE;
}
- return S_OK;
+ return FALSE;
}
/*************************************************************************
diff --git a/dlls/shlwapi/tests/clist.c b/dlls/shlwapi/tests/clist.c
index 8c63f31af7b..0c914d608e5 100644
--- a/dlls/shlwapi/tests/clist.c
+++ b/dlls/shlwapi/tests/clist.c
@@ -289,6 +289,7 @@ static void test_CList(void)
DATABLOCK_HEADER *inserted;
BYTE buff[64];
unsigned int i;
+ BOOL ret;
if (!pSHWriteDataBlockList || !pSHReadDataBlockList || !pSHFreeDataBlockList || !pSHAddDataBlock ||
!pSHRemoveDataBlock || !pSHFindDataBlock)
@@ -304,10 +305,10 @@ static void test_CList(void)
for (i = 0; i < item->cbSize; i++)
buff[sizeof(DATABLOCK_HEADER) + i] = i * 2;
- hRet = pSHAddDataBlock(&list, inserted);
- ok(hRet > S_OK, "failed list add\n");
+ ret = pSHAddDataBlock(&list, inserted);
+ ok(ret == TRUE, "got %d\n", ret);
- if (hRet > S_OK)
+ if (ret == TRUE)
{
ok(list && list->cbSize, "item not added\n");
@@ -381,10 +382,11 @@ static void test_CList(void)
inserted->cbSize = sizeof(DATABLOCK_HEADER) - 1;
inserted->dwSignature = 33;
- /* The call succeeds but the item is not inserted, except on some early
- * versions which return failure. Wine behaves like later versions.
- */
- pSHAddDataBlock(&list, inserted);
+ ret = pSHAddDataBlock(NULL, inserted);
+ ok(!ret, "got %d\n", ret);
+
+ ret = pSHAddDataBlock(&list, inserted);
+ ok(!ret, "got %d\n", ret);
inserted = pSHFindDataBlock(list, 33);
ok(inserted == NULL, "inserted bad element size\n");
@@ -393,8 +395,8 @@ static void test_CList(void)
inserted->cbSize = 44;
inserted->dwSignature = ~0U;
- /* See comment above, some early versions fail this call */
- pSHAddDataBlock(&list, inserted);
+ ret = pSHAddDataBlock(&list, inserted);
+ ok(!ret, "got %d\n", ret);
item = clist_items;
--
2.33.0
More information about the wine-devel
mailing list