Added patch to fix return type of shlwapi.SHAddDataBlock.

Also fixes parsing of multiline From: headers in staging/patchutils.py.
This commit is contained in:
Sebastian Lackner
2017-01-19 06:54:01 +01:00
parent 80a4e6bdd7
commit 49ba202882
4 changed files with 162 additions and 9 deletions

View File

@@ -0,0 +1,132 @@
From 0cf3e133b7ab01d7d1facf955263bd9b8a0ed28e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Herm=C3=A8s=20B=C3=89LUSCA-MA=C3=8FTO?=
<hermes.belusca@sfr.fr>
Date: Tue, 17 Jan 2017 23:46:31 +0100
Subject: shlwapi: Fix the return value of SHAddDataBlock
This patch fixes the return type and value of SHAddDataBlock.
The corresponding test (shlwapi's clist) is adjusted to reflect
those changes. Tested on Windows 2003 and 7.
In addition I set, in SHRemoveDataBlock, the lpList pointer
to NULL, to respect the fact it's a pointer, not just a number.
Signed-off-by: Hermes Belusca-Maito <hermes.belusca@sfr.fr>
---
dlls/shlwapi/clist.c | 14 +++++++-------
dlls/shlwapi/tests/clist.c | 21 +++++++++------------
2 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/dlls/shlwapi/clist.c b/dlls/shlwapi/clist.c
index 52bee37c9e4..77917b35469 100644
--- a/dlls/shlwapi/clist.c
+++ b/dlls/shlwapi/clist.c
@@ -65,19 +65,19 @@ 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;
TRACE("(%p,%p)\n", lppList, lpNewItem);
- if(!lppList || !lpNewItem )
- return E_INVALIDARG;
+ if(!lppList || !lpNewItem)
+ 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;
}
/*************************************************************************
@@ -354,7 +354,7 @@ VOID WINAPI SHFreeDataBlockList(LPDBLIST lpList)
*/
BOOL WINAPI SHRemoveDataBlock(LPDBLIST* lppList, DWORD dwSignature)
{
- LPDATABLOCK_HEADER lpList = 0;
+ LPDATABLOCK_HEADER lpList = NULL;
LPDATABLOCK_HEADER lpItem = NULL;
LPDATABLOCK_HEADER lpNext;
ULONG ulNewSize;
diff --git a/dlls/shlwapi/tests/clist.c b/dlls/shlwapi/tests/clist.c
index b930470806e..309b3335ec1 100644
--- a/dlls/shlwapi/tests/clist.c
+++ b/dlls/shlwapi/tests/clist.c
@@ -218,7 +218,7 @@ static IStreamVtbl iclvt =
static HMODULE SHLWAPI_hshlwapi = 0;
static VOID (WINAPI *pSHLWAPI_19)(LPSHLWAPI_CLIST);
-static HRESULT (WINAPI *pSHLWAPI_20)(LPSHLWAPI_CLIST*,LPCSHLWAPI_CLIST);
+static BOOL (WINAPI *pSHLWAPI_20)(LPSHLWAPI_CLIST*,LPCSHLWAPI_CLIST);
static BOOL (WINAPI *pSHLWAPI_21)(LPSHLWAPI_CLIST*,ULONG);
static LPSHLWAPI_CLIST (WINAPI *pSHLWAPI_22)(LPSHLWAPI_CLIST,ULONG);
static HRESULT (WINAPI *pSHLWAPI_17)(IStream*, SHLWAPI_CLIST*);
@@ -292,6 +292,7 @@ static void test_CList(void)
struct dummystream streamobj;
LPSHLWAPI_CLIST list = NULL;
LPCSHLWAPI_CLIST item = SHLWAPI_CLIST_items;
+ BOOL bRet;
HRESULT hRet;
LPSHLWAPI_CLIST inserted;
BYTE buff[64];
@@ -312,10 +313,10 @@ static void test_CList(void)
buff[sizeof(SHLWAPI_CLIST)+i] = i*2;
/* Add it */
- hRet = pSHLWAPI_20(&list, inserted);
- ok(hRet > S_OK, "failed list add\n");
+ bRet = pSHLWAPI_20(&list, inserted);
+ ok(bRet == TRUE, "failed list add\n");
- if (hRet > S_OK)
+ if (bRet == TRUE)
{
ok(list && list->ulSize, "item not added\n");
@@ -390,11 +391,8 @@ static void test_CList(void)
inserted = (LPSHLWAPI_CLIST)buff;
inserted->ulSize = sizeof(SHLWAPI_CLIST) -1;
inserted->ulId = 33;
-
- /* The call succeeds but the item is not inserted, except on some early
- * versions which return failure. Wine behaves like later versions.
- */
- pSHLWAPI_20(&list, inserted);
+ bRet = pSHLWAPI_20(&list, inserted);
+ ok(bRet == FALSE, "Expected failure\n");
inserted = pSHLWAPI_22(list, 33);
ok(inserted == NULL, "inserted bad element size\n");
@@ -402,9 +400,8 @@ static void test_CList(void)
inserted = (LPSHLWAPI_CLIST)buff;
inserted->ulSize = 44;
inserted->ulId = ~0U;
-
- /* See comment above, some early versions fail this call */
- pSHLWAPI_20(&list, inserted);
+ bRet = pSHLWAPI_20(&list, inserted);
+ ok(bRet == FALSE, "Expected failure\n");
item = SHLWAPI_CLIST_items;
--
2.11.0

View File

@@ -0,0 +1 @@
Fixes: Fix return type of shlwapi.SHAddDataBlock