wininet: Use return value of sprintf() instead of calling strlen() and simplify code.

Signed-off-by: Carlo Bramini <carlo_bramini@users.sourceforge.net>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Carlo Bramini 2016-11-12 10:36:20 +01:00 committed by Alexandre Julliard
parent 3273dff7b6
commit 47ff95429a
1 changed files with 2 additions and 8 deletions

View File

@ -4112,8 +4112,7 @@ static BOOL calc_url_length(LPURL_COMPONENTSW lpUrlComponents,
{
char szPort[MAX_WORD_DIGITS+1];
sprintf(szPort, "%d", lpUrlComponents->nPort);
*lpdwUrlLength += strlen(szPort);
*lpdwUrlLength += sprintf(szPort, "%d", lpUrlComponents->nPort);
*lpdwUrlLength += strlen(":");
}
@ -4356,14 +4355,9 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
if (!url_uses_default_port(nScheme, lpUrlComponents->nPort))
{
WCHAR szPort[MAX_WORD_DIGITS+1];
sprintfW(szPort, fmtW, lpUrlComponents->nPort);
*lpszUrl = ':';
lpszUrl++;
dwLen = strlenW(szPort);
memcpy(lpszUrl, szPort, dwLen * sizeof(WCHAR));
lpszUrl += dwLen;
lpszUrl += sprintfW(lpszUrl, fmtW, lpUrlComponents->nPort);
}
/* add slash between hostname and path if necessary */