Module: wine Branch: refs/heads/master Commit: 0252e5e875d6db0b774431c820029f98112e17a3 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=0252e5e875d6db0b774431c8...
Author: Robert Shearman rob@codeweavers.com Date: Sat Mar 11 18:11:25 2006 +0000
wininet: Fix the conversion of NULL component values from InternetCreateUrlA.
---
dlls/wininet/internet.c | 7 +++++-- dlls/wininet/tests/http.c | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 5e303ae..51db944 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -1097,14 +1097,17 @@ static void ConvertUrlComponentValue(LPS LPWSTR lpwszComponent, DWORD dwwComponentLen, LPCSTR lpszStart, LPCWSTR lpwszStart) { - TRACE("%p %p %p %ld %p %p\n", lppszComponent, dwComponentLen, lpwszComponent, dwwComponentLen, lpszStart, lpwszStart); + TRACE("%p %ld %p %ld %p %p\n", lppszComponent, *dwComponentLen, lpwszComponent, dwwComponentLen, lpszStart, lpwszStart); if (*dwComponentLen != 0) { DWORD nASCIILength=WideCharToMultiByte(CP_ACP,0,lpwszComponent,dwwComponentLen,NULL,0,NULL,NULL); if (*lppszComponent == NULL) { int nASCIIOffset=WideCharToMultiByte(CP_ACP,0,lpwszStart,lpwszComponent-lpwszStart,NULL,0,NULL,NULL); - *lppszComponent = (LPSTR)lpszStart+nASCIIOffset; + if (lpwszComponent) + *lppszComponent = (LPSTR)lpszStart+nASCIIOffset; + else + *lppszComponent = NULL; *dwComponentLen = nASCIILength; } else diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index 9c7e213..093fb74 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -610,11 +610,9 @@ static void InternetCrackUrl_test(void) ok(!strncmp(urlComponents.lpszHostName,TEST_URL_HOST,strlen(TEST_URL_HOST)),"lpszHostName should be %s but is %s\n", TEST_URL_HOST, urlComponents.lpszHostName); ok(urlComponents.nPort == INTERNET_DEFAULT_HTTP_PORT,"urlComponents->nPort should have been 80 instead of %d\n", urlComponents.nPort); ok(urlComponents.nScheme == INTERNET_SCHEME_HTTP,"urlComponents->nScheme should have been INTERNET_SCHEME_HTTP instead of %d\n", urlComponents.nScheme); - todo_wine { ok(!urlComponents.lpszUserName, ".lpszUserName should have been set to NULL\n"); ok(!urlComponents.lpszPassword, ".lpszPassword should have been set to NULL\n"); ok(!urlComponents.lpszExtraInfo, ".lpszExtraInfo should have been set to NULL\n"); - } ok(!urlComponents.dwUserNameLength,".dwUserNameLength should be 0, but is %ld\n", urlComponents.dwUserNameLength); ok(!urlComponents.dwPasswordLength,".dwPasswordLength should be 0, but is %ld\n", urlComponents.dwPasswordLength); ok(!urlComponents.dwExtraInfoLength,".dwExtraInfoLength should be 0, but is %ld\n", urlComponents.dwExtraInfoLength);