wininet: Code clean up by using heap_strdup* functions.
This commit is contained in:
parent
13974e9d5a
commit
97936252dd
|
@ -1074,7 +1074,7 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession,
|
||||||
{
|
{
|
||||||
LPWSTR szVerb = NULL, szObjectName = NULL;
|
LPWSTR szVerb = NULL, szObjectName = NULL;
|
||||||
LPWSTR szVersion = NULL, szReferrer = NULL, *szAcceptTypes = NULL;
|
LPWSTR szVersion = NULL, szReferrer = NULL, *szAcceptTypes = NULL;
|
||||||
INT len, acceptTypesCount;
|
INT acceptTypesCount;
|
||||||
HINTERNET rc = FALSE;
|
HINTERNET rc = FALSE;
|
||||||
LPCSTR *types;
|
LPCSTR *types;
|
||||||
|
|
||||||
|
@ -1085,38 +1085,30 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession,
|
||||||
|
|
||||||
if (lpszVerb)
|
if (lpszVerb)
|
||||||
{
|
{
|
||||||
len = MultiByteToWideChar(CP_ACP, 0, lpszVerb, -1, NULL, 0 );
|
szVerb = heap_strdupAtoW(lpszVerb);
|
||||||
szVerb = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR) );
|
|
||||||
if ( !szVerb )
|
if ( !szVerb )
|
||||||
goto end;
|
goto end;
|
||||||
MultiByteToWideChar(CP_ACP, 0, lpszVerb, -1, szVerb, len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpszObjectName)
|
if (lpszObjectName)
|
||||||
{
|
{
|
||||||
len = MultiByteToWideChar(CP_ACP, 0, lpszObjectName, -1, NULL, 0 );
|
szObjectName = heap_strdupAtoW(lpszObjectName);
|
||||||
szObjectName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR) );
|
|
||||||
if ( !szObjectName )
|
if ( !szObjectName )
|
||||||
goto end;
|
goto end;
|
||||||
MultiByteToWideChar(CP_ACP, 0, lpszObjectName, -1, szObjectName, len );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpszVersion)
|
if (lpszVersion)
|
||||||
{
|
{
|
||||||
len = MultiByteToWideChar(CP_ACP, 0, lpszVersion, -1, NULL, 0 );
|
szVersion = heap_strdupAtoW(lpszVersion);
|
||||||
szVersion = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
|
||||||
if ( !szVersion )
|
if ( !szVersion )
|
||||||
goto end;
|
goto end;
|
||||||
MultiByteToWideChar(CP_ACP, 0, lpszVersion, -1, szVersion, len );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpszReferrer)
|
if (lpszReferrer)
|
||||||
{
|
{
|
||||||
len = MultiByteToWideChar(CP_ACP, 0, lpszReferrer, -1, NULL, 0 );
|
szReferrer = heap_strdupAtoW(lpszReferrer);
|
||||||
szReferrer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
|
||||||
if ( !szReferrer )
|
if ( !szReferrer )
|
||||||
goto end;
|
goto end;
|
||||||
MultiByteToWideChar(CP_ACP, 0, lpszReferrer, -1, szReferrer, len );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpszAcceptTypes)
|
if (lpszAcceptTypes)
|
||||||
|
@ -1151,13 +1143,7 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession,
|
||||||
__TRY
|
__TRY
|
||||||
{
|
{
|
||||||
if (*types && **types)
|
if (*types && **types)
|
||||||
{
|
szAcceptTypes[acceptTypesCount++] = heap_strdupAtoW(*types);
|
||||||
len = MultiByteToWideChar(CP_ACP, 0, *types, -1, NULL, 0 );
|
|
||||||
szAcceptTypes[acceptTypesCount] = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
|
||||||
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, *types, -1, szAcceptTypes[acceptTypesCount], len);
|
|
||||||
acceptTypesCount++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
__EXCEPT_PAGE_FAULT
|
__EXCEPT_PAGE_FAULT
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue