Carlo Bramini : winhttp: Use return value of sprintf() instead of calling strlen() and simplify code.
Module: wine Branch: master Commit: 613e23976e01d126b0c4dd1de5b83d70fd392a39 URL: http://source.winehq.org/git/wine.git/?a=commit;h=613e23976e01d126b0c4dd1de5... Author: Carlo Bramini <carlo.bramix(a)libero.it> Date: Sat Nov 12 10:47:00 2016 +0100 winhttp: Use return value of sprintf() instead of calling strlen() and simplify code. Signed-off-by: Carlo Bramini <carlo_bramini(a)users.sourceforge.net> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winhttp/url.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/dlls/winhttp/url.c b/dlls/winhttp/url.c index 26969cd..e7bb2a5 100644 --- a/dlls/winhttp/url.c +++ b/dlls/winhttp/url.c @@ -400,8 +400,7 @@ static BOOL calc_length( URL_COMPONENTS *uc, DWORD flags, LPDWORD len ) { WCHAR port[sizeof("65535")]; - sprintfW( port, formatW, uc->nPort ); - *len += strlenW( port ); + *len += sprintfW( port, formatW, uc->nPort ); *len += 1; /* ":" */ } if (uc->lpszUrlPath && *uc->lpszUrlPath != '/') *len += 1; /* '/' */ @@ -497,15 +496,10 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW if (!uses_default_port( scheme, uc->nPort )) { - WCHAR port[sizeof("65535")]; - - sprintfW( port, formatW, uc->nPort ); *url = ':'; url++; - len = strlenW( port ); - memcpy( url, port, len * sizeof(WCHAR) ); - url += len; + url += sprintfW( url, formatW, uc->nPort ); } /* add slash between hostname and path if necessary */
participants (1)
-
Alexandre Julliard