[PATCH] shdocvw: Check precisely ParseURLFromOutsideSourceX returned values in tests and make code clearer about that.
Christian Costa
titan.costa at gmail.com
Tue Jun 11 15:08:35 CDT 2013
---
dlls/shdocvw/shdocvw_main.c | 5 +++--
dlls/shdocvw/tests/shdocvw.c | 7 ++++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/shdocvw/shdocvw_main.c b/dlls/shdocvw/shdocvw_main.c
index 5095696..c372c5b 100644
--- a/dlls/shdocvw/shdocvw_main.c
+++ b/dlls/shdocvw/shdocvw_main.c
@@ -380,7 +380,6 @@ DWORD WINAPI ParseURLFromOutsideSourceW(LPCWSTR url, LPWSTR out, LPDWORD plen, L
DWORD len;
DWORD res = 0;
-
TRACE("(%s, %p, %p, %p) len: %d, unknown: 0x%x\n", debugstr_w(url), out, plen, unknown,
plen ? *plen : 0, unknown ? *unknown : 0);
@@ -408,7 +407,8 @@ DWORD WINAPI ParseURLFromOutsideSourceW(LPCWSTR url, LPWSTR out, LPDWORD plen, L
if (*plen >= needed) {
if (out != NULL) {
lstrcpyW(out, buffer_out);
- res++;
+ /* On success, 1 is returned for unicode version */
+ res = 1;
}
needed--;
}
@@ -451,6 +451,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, len + 1 (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 ad89c4a..fcef4f7 100644
--- a/dlls/shdocvw/tests/shdocvw.c
+++ b/dlls/shdocvw/tests/shdocvw.c
@@ -212,10 +212,10 @@ 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, len + 1 (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 == (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);
@@ -308,9 +308,10 @@ 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",
res, len, bufferA, ParseURL_table[0].len, ParseURL_table[0].newurl);
More information about the wine-patches
mailing list