Commit 613e2397 authored by Carlo Bramini's avatar Carlo Bramini Committed by Alexandre Julliard

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

parent f9b87810
...@@ -400,8 +400,7 @@ static BOOL calc_length( URL_COMPONENTS *uc, DWORD flags, LPDWORD len ) ...@@ -400,8 +400,7 @@ static BOOL calc_length( URL_COMPONENTS *uc, DWORD flags, LPDWORD len )
{ {
WCHAR port[sizeof("65535")]; WCHAR port[sizeof("65535")];
sprintfW( port, formatW, uc->nPort ); *len += sprintfW( port, formatW, uc->nPort );
*len += strlenW( port );
*len += 1; /* ":" */ *len += 1; /* ":" */
} }
if (uc->lpszUrlPath && *uc->lpszUrlPath != '/') *len += 1; /* '/' */ if (uc->lpszUrlPath && *uc->lpszUrlPath != '/') *len += 1; /* '/' */
...@@ -497,15 +496,10 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW ...@@ -497,15 +496,10 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
if (!uses_default_port( scheme, uc->nPort )) if (!uses_default_port( scheme, uc->nPort ))
{ {
WCHAR port[sizeof("65535")];
sprintfW( port, formatW, uc->nPort );
*url = ':'; *url = ':';
url++; url++;
len = strlenW( port ); url += sprintfW( url, formatW, uc->nPort );
memcpy( url, port, len * sizeof(WCHAR) );
url += len;
} }
/* add slash between hostname and path if necessary */ /* add slash between hostname and path if necessary */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment