Added patch to ensure tests check exact return value of ParseURLFromOutsideSourceX.

This commit is contained in:
Sebastian Lackner 2014-10-18 01:22:08 +02:00
parent 6e3502a34b
commit 971d304a1f
4 changed files with 113 additions and 0 deletions

2
debian/changelog vendored
View File

@ -6,6 +6,8 @@ wine-compholio (1.7.29) UNRELEASED; urgency=low
* Added patch to set return value of basic_string_wchar_dtor to return NULL.
* Added patch for UTF7 encoding/decoding support.
* Added patch to implement ID3DXSkinInfoImpl_UpdateSkinnedMesh.
* Added patch for implementation of D3DXGetShaderInputSemantics.
* Added patch to ensure tests check exact return value of ParseURLFromOutsideSourceX.
* Removed patch to fix issues with drag image in ImageLists (accepted upstream).
* Removed patch to set ldr.EntryPoint for main executable (accepted upstream).
* Removed patch to implement stubs for [Get|Set]SystemFileCacheSize (accepted upstream).

View File

@ -64,6 +64,7 @@ PATCHLIST := \
server-OpenProcess.ok \
server-Stored_ACLs.ok \
setupapi-SetupPromptForDisk.ok \
shdocvw-ParseURLFromOutsideSource_Tests.ok \
shell32-Default_Folder_ACLs.ok \
shell32-Default_Path.ok \
shell32-Icons.ok \
@ -1048,6 +1049,21 @@ setupapi-SetupPromptForDisk.ok:
echo '+ { "setupapi-SetupPromptForDisk", "Michael Müller", "Add support for IDF_CHECKFIRST flag in SetupPromptForDiskW." },'; \
) > setupapi-SetupPromptForDisk.ok
# Patchset shdocvw-ParseURLFromOutsideSource_Tests
# |
# | Included patches:
# | * Check for exact return values in ParseURLFromOutsideSourceX tests. [by Christian Costa]
# |
# | Modified files:
# | * dlls/shdocvw/shdocvw_main.c, dlls/shdocvw/tests/shdocvw.c
# |
.INTERMEDIATE: shdocvw-ParseURLFromOutsideSource_Tests.ok
shdocvw-ParseURLFromOutsideSource_Tests.ok:
$(call APPLY_FILE,shdocvw-ParseURLFromOutsideSource_Tests/0001-shdocvw-Check-precisely-ParseURLFromOutsideSourceX-r.patch)
@( \
echo '+ { "shdocvw-ParseURLFromOutsideSource_Tests", "Christian Costa", "Check for exact return values in ParseURLFromOutsideSourceX tests." },'; \
) > shdocvw-ParseURLFromOutsideSource_Tests.ok
# Patchset shell32-Default_Folder_ACLs
# |
# | Included patches:

View File

@ -0,0 +1,92 @@
From 8c77eaf04997422d4febc835d0331dba89a17a79 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Tue, 3 Sep 2013 23:28:14 +0200
Subject: shdocvw: Check precisely ParseURLFromOutsideSourceX returned values
in tests and make code clearer about that. (try 3)
Try 3:
- fix test check for ansi version
- fix error message for both versions
Try 2:
- improve comments
---
dlls/shdocvw/shdocvw_main.c | 8 +++++---
dlls/shdocvw/tests/shdocvw.c | 13 +++++++------
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/dlls/shdocvw/shdocvw_main.c b/dlls/shdocvw/shdocvw_main.c
index 3ce5df1..8020526 100644
--- a/dlls/shdocvw/shdocvw_main.c
+++ b/dlls/shdocvw/shdocvw_main.c
@@ -378,8 +378,7 @@ DWORD WINAPI ParseURLFromOutsideSourceW(LPCWSTR url, LPWSTR out, LPDWORD plen, L
HRESULT hr;
DWORD needed;
DWORD len;
- DWORD res = 0;
-
+ DWORD res;
TRACE("(%s, %p, %p, %p) len: %d, unknown: 0x%x\n", debugstr_w(url), out, plen, unknown,
plen ? *plen : 0, unknown ? *unknown : 0);
@@ -405,10 +404,12 @@ DWORD WINAPI ParseURLFromOutsideSourceW(LPCWSTR url, LPWSTR out, LPDWORD plen, L
needed = lstrlenW(buffer_out)+1;
TRACE("got 0x%x with %s (need %d)\n", hr, debugstr_w(buffer_out), needed);
+ res = 0;
if (*plen >= needed) {
if (out != NULL) {
lstrcpyW(out, buffer_out);
- res++;
+ /* On success, 1 is returned for unicode version */
+ res = 1;
}
needed--;
}
@@ -451,6 +452,7 @@ DWORD WINAPI ParseURLFromOutsideSourceA(LPCSTR url, LPSTR out, LPDWORD plen, LPD
if (*plen >= needed) {
if (out != NULL) {
WideCharToMultiByte(CP_ACP, 0, buffer, -1, out, *plen, NULL, NULL);
+ /* On success, string size including terminating 0 is returned for ansi version */
res = needed;
}
needed--;
diff --git a/dlls/shdocvw/tests/shdocvw.c b/dlls/shdocvw/tests/shdocvw.c
index 7b4eccf..cdf1814 100644
--- a/dlls/shdocvw/tests/shdocvw.c
+++ b/dlls/shdocvw/tests/shdocvw.c
@@ -212,13 +212,13 @@ static void test_ParseURLFromOutsideSourceA(void)
buffer[sizeof(buffer)-1] = '\0';
len = sizeof(buffer);
dummy = 0;
- /* on success, len+1 is returned. No idea, if someone depend on this */
+ /* on success, string size including terminating 0 is returned for ansi version */
res = pParseURLFromOutsideSourceA(ParseURL_table[i].url, buffer, &len, &dummy);
/* len does not include the terminating 0, when buffer is large enough */
- ok( res != 0 && len == ParseURL_table[i].len &&
+ ok( res == (ParseURL_table[i].len+1) && len == ParseURL_table[i].len &&
!lstrcmpA(buffer, ParseURL_table[i].newurl),
- "#%d: got %d and %d with '%s' (expected '!=0' and %d with '%s')\n",
- i, res, len, buffer, ParseURL_table[i].len, ParseURL_table[i].newurl);
+ "#%d: got %d and %d with '%s' (expected %d and %d with '%s')\n",
+ i, res, len, buffer, ParseURL_table[i].len+1, ParseURL_table[i].len, ParseURL_table[i].newurl);
/* use the size test only for the first examples */
@@ -308,11 +308,12 @@ static void test_ParseURLFromOutsideSourceW(void)
/* len is in characters */
len = sizeof(bufferW)/sizeof(bufferW[0]);
dummy = 0;
+ /* on success, 1 is returned for unicode version */
res = pParseURLFromOutsideSourceW(urlW, bufferW, &len, &dummy);
WideCharToMultiByte(CP_ACP, 0, bufferW, -1, bufferA, sizeof(bufferA), NULL, NULL);
- ok( res != 0 && len == ParseURL_table[0].len &&
+ ok( res == 1 && len == ParseURL_table[0].len &&
!lstrcmpA(bufferA, ParseURL_table[0].newurl),
- "got %d and %d with '%s' (expected '!=0' and %d with '%s')\n",
+ "got %d and %d with '%s' (expected 1 and %d with '%s')\n",
res, len, bufferA, ParseURL_table[0].len, ParseURL_table[0].newurl);
--
2.1.2

View File

@ -0,0 +1,3 @@
Author: Christian Costa
Subject: Check for exact return values in ParseURLFromOutsideSourceX tests.
Revision: 1