Commit 2b37b075 authored by Hermès Bélusca-Maïto's avatar Hermès Bélusca-Maïto Committed by Alexandre Julliard

shlwapi: SHAddDataBlock() returns BOOL, not HRESULT.

parent 00df0edb
...@@ -65,7 +65,7 @@ static inline LPDATABLOCK_HEADER NextItem(LPDBLIST lpList) ...@@ -65,7 +65,7 @@ static inline LPDATABLOCK_HEADER NextItem(LPDBLIST lpList)
* the call returns S_OK but does not actually add the element. * the call returns S_OK but does not actually add the element.
* See SHWriteDataBlockList. * See SHWriteDataBlockList.
*/ */
HRESULT WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewItem) BOOL WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewItem)
{ {
LPDATABLOCK_HEADER lpInsertAt = NULL; LPDATABLOCK_HEADER lpInsertAt = NULL;
ULONG ulSize; ULONG ulSize;
...@@ -73,11 +73,11 @@ HRESULT WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewIt ...@@ -73,11 +73,11 @@ HRESULT WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewIt
TRACE("(%p,%p)\n", lppList, lpNewItem); TRACE("(%p,%p)\n", lppList, lpNewItem);
if(!lppList || !lpNewItem ) if(!lppList || !lpNewItem )
return E_INVALIDARG; return FALSE;
if (lpNewItem->cbSize < sizeof(DATABLOCK_HEADER) || if (lpNewItem->cbSize < sizeof(DATABLOCK_HEADER) ||
lpNewItem->dwSignature == CLIST_ID_CONTAINER) lpNewItem->dwSignature == CLIST_ID_CONTAINER)
return S_OK; return FALSE;
ulSize = lpNewItem->cbSize; ulSize = lpNewItem->cbSize;
...@@ -134,9 +134,9 @@ HRESULT WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewIt ...@@ -134,9 +134,9 @@ HRESULT WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewIt
lpInsertAt = NextItem(lpInsertAt); lpInsertAt = NextItem(lpInsertAt);
lpInsertAt->cbSize = 0; lpInsertAt->cbSize = 0;
return lpNewItem->cbSize; return TRUE;
} }
return S_OK; return FALSE;
} }
/************************************************************************* /*************************************************************************
......
...@@ -289,6 +289,7 @@ static void test_CList(void) ...@@ -289,6 +289,7 @@ static void test_CList(void)
DATABLOCK_HEADER *inserted; DATABLOCK_HEADER *inserted;
BYTE buff[64]; BYTE buff[64];
unsigned int i; unsigned int i;
BOOL ret;
if (!pSHWriteDataBlockList || !pSHReadDataBlockList || !pSHFreeDataBlockList || !pSHAddDataBlock || if (!pSHWriteDataBlockList || !pSHReadDataBlockList || !pSHFreeDataBlockList || !pSHAddDataBlock ||
!pSHRemoveDataBlock || !pSHFindDataBlock) !pSHRemoveDataBlock || !pSHFindDataBlock)
...@@ -304,10 +305,10 @@ static void test_CList(void) ...@@ -304,10 +305,10 @@ static void test_CList(void)
for (i = 0; i < item->cbSize; i++) for (i = 0; i < item->cbSize; i++)
buff[sizeof(DATABLOCK_HEADER) + i] = i * 2; buff[sizeof(DATABLOCK_HEADER) + i] = i * 2;
hRet = pSHAddDataBlock(&list, inserted); ret = pSHAddDataBlock(&list, inserted);
ok(hRet > S_OK, "failed list add\n"); ok(ret == TRUE, "got %d\n", ret);
if (hRet > S_OK) if (ret == TRUE)
{ {
ok(list && list->cbSize, "item not added\n"); ok(list && list->cbSize, "item not added\n");
...@@ -381,10 +382,11 @@ static void test_CList(void) ...@@ -381,10 +382,11 @@ static void test_CList(void)
inserted->cbSize = sizeof(DATABLOCK_HEADER) - 1; inserted->cbSize = sizeof(DATABLOCK_HEADER) - 1;
inserted->dwSignature = 33; inserted->dwSignature = 33;
/* The call succeeds but the item is not inserted, except on some early ret = pSHAddDataBlock(NULL, inserted);
* versions which return failure. Wine behaves like later versions. ok(!ret, "got %d\n", ret);
*/
pSHAddDataBlock(&list, inserted); ret = pSHAddDataBlock(&list, inserted);
ok(!ret, "got %d\n", ret);
inserted = pSHFindDataBlock(list, 33); inserted = pSHFindDataBlock(list, 33);
ok(inserted == NULL, "inserted bad element size\n"); ok(inserted == NULL, "inserted bad element size\n");
...@@ -393,8 +395,8 @@ static void test_CList(void) ...@@ -393,8 +395,8 @@ static void test_CList(void)
inserted->cbSize = 44; inserted->cbSize = 44;
inserted->dwSignature = ~0U; inserted->dwSignature = ~0U;
/* See comment above, some early versions fail this call */ ret = pSHAddDataBlock(&list, inserted);
pSHAddDataBlock(&list, inserted); ok(!ret, "got %d\n", ret);
item = clist_items; item = clist_items;
......
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