Cleanup conversion from A->W.

This commit is contained in:
Kevin Koltzau 2004-05-10 19:59:05 +00:00 committed by Alexandre Julliard
parent 64af08e69c
commit 33972309f5
1 changed files with 27 additions and 21 deletions

View File

@ -2032,7 +2032,7 @@ BOOL WINAPI InternetCheckConnectionW(LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwRes
/********************************************************** /**********************************************************
* INTERNET_InternetOpenUrlA (internal) * INTERNET_InternetOpenUrlW (internal)
* *
* Opens an URL * Opens an URL
* *
@ -2114,7 +2114,7 @@ HINTERNET WINAPI INTERNET_InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl,
} }
/********************************************************** /**********************************************************
* InternetOpenUrlA (WININET.@) * InternetOpenUrlW (WININET.@)
* *
* Opens an URL * Opens an URL
* *
@ -2171,7 +2171,7 @@ HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl,
} }
/********************************************************** /**********************************************************
* InternetOpenUrlW (WININET.@) * InternetOpenUrlA (WININET.@)
* *
* Opens an URL * Opens an URL
* *
@ -2183,30 +2183,36 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
{ {
HINTERNET rc = (HINTERNET)NULL; HINTERNET rc = (HINTERNET)NULL;
INT lenUrl = MultiByteToWideChar(CP_ACP, 0, lpszUrl, -1, NULL, 0 ); INT lenUrl;
INT lenHeaders = MultiByteToWideChar(CP_ACP, 0, lpszHeaders, -1, NULL, 0 ); INT lenHeaders = 0;
LPWSTR szUrl = HeapAlloc(GetProcessHeap(), 0, lenUrl*sizeof(WCHAR)); LPWSTR szUrl = NULL;
LPWSTR szHeaders = HeapAlloc(GetProcessHeap(), 0, lenHeaders*sizeof(WCHAR)); LPWSTR szHeaders = NULL;
TRACE("\n"); TRACE("\n");
if (!szUrl || !szHeaders) if(lpszUrl) {
{ lenUrl = MultiByteToWideChar(CP_ACP, 0, lpszUrl, -1, NULL, 0 );
if (szUrl) szUrl = HeapAlloc(GetProcessHeap(), 0, lenUrl*sizeof(WCHAR));
HeapFree(GetProcessHeap(), 0, szUrl); if(!szUrl)
if (szHeaders) return (HINTERNET)NULL;
HeapFree(GetProcessHeap(), 0, szHeaders); MultiByteToWideChar(CP_ACP, 0, lpszUrl, -1, szUrl, lenUrl);
return (HINTERNET)NULL;
} }
MultiByteToWideChar(CP_ACP, 0, lpszUrl, -1, szUrl, lenUrl); if(lpszHeaders) {
MultiByteToWideChar(CP_ACP, 0, lpszHeaders, -1, szHeaders, lenHeaders); lenHeaders = MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, NULL, 0 );
szHeaders = HeapAlloc(GetProcessHeap(), 0, lenHeaders*sizeof(WCHAR));
if(!szHeaders) {
if(szUrl) HeapFree(GetProcessHeap(), 0, szUrl);
return (HINTERNET)NULL;
}
MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, szHeaders, lenHeaders);
}
rc = InternetOpenUrlW(hInternet, szUrl, szHeaders, rc = InternetOpenUrlW(hInternet, szUrl, szHeaders,
dwHeadersLength, dwFlags, dwContext); lenHeaders, dwFlags, dwContext);
HeapFree(GetProcessHeap(), 0, szUrl); if(szUrl) HeapFree(GetProcessHeap(), 0, szUrl);
HeapFree(GetProcessHeap(), 0, szHeaders); if(szHeaders) HeapFree(GetProcessHeap(), 0, szHeaders);
return rc; return rc;
} }