wininet: Use _ltow instead of sprintf for port number in InternetCreateUrl.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-03-20 14:35:43 +01:00 committed by Alexandre Julliard
parent 2be65404d2
commit 9fe900532e
1 changed files with 6 additions and 7 deletions

View File

@ -4263,9 +4263,10 @@ static BOOL calc_url_length(LPURL_COMPONENTSW lpUrlComponents,
if (!url_uses_default_port(nScheme, lpUrlComponents->nPort))
{
char szPort[MAX_WORD_DIGITS+1];
WCHAR port[MAX_WORD_DIGITS + 1];
*lpdwUrlLength += sprintf(szPort, "%d", lpUrlComponents->nPort);
_ltow(lpUrlComponents->nPort, port, 10);
*lpdwUrlLength += lstrlenW(port);
*lpdwUrlLength += strlen(":");
}
@ -4421,10 +4422,8 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
{
DWORD dwLen;
INTERNET_SCHEME nScheme;
WCHAR *start = lpszUrl;
static const WCHAR slashSlashW[] = {'/','/'};
static const WCHAR fmtW[] = {'%','u',0};
TRACE("(%p,%d,%p,%p)\n", lpUrlComponents, dwFlags, lpszUrl, lpdwUrlLength);
@ -4509,9 +4508,9 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
if (!url_uses_default_port(nScheme, lpUrlComponents->nPort))
{
*lpszUrl = ':';
lpszUrl++;
lpszUrl += swprintf(lpszUrl, *lpdwUrlLength - (lpszUrl - start), fmtW, lpUrlComponents->nPort);
*lpszUrl++ = ':';
_ltow(lpUrlComponents->nPort, lpszUrl, 10);
lpszUrl += lstrlenW(lpszUrl);
}
/* add slash between hostname and path if necessary */