Commit 3fb5d2f9 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp: Get rid of get/set_last_error.

parent ce9ad420
...@@ -225,7 +225,7 @@ struct netconn *netconn_create( struct hostdata *host, const struct sockaddr_sto ...@@ -225,7 +225,7 @@ struct netconn *netconn_create( struct hostdata *host, const struct sockaddr_sto
FD_ZERO( &set ); FD_ZERO( &set );
FD_SET( conn->socket, &set ); FD_SET( conn->socket, &set );
if ((res = select( conn->socket + 1, NULL, &set, NULL, &timeval )) > 0) ret = TRUE; if ((res = select( conn->socket + 1, NULL, &set, NULL, &timeval )) > 0) ret = TRUE;
else if (!res) set_last_error( ERROR_WINHTTP_TIMEOUT ); else if (!res) SetLastError( ERROR_WINHTTP_TIMEOUT );
} }
} }
...@@ -233,7 +233,7 @@ struct netconn *netconn_create( struct hostdata *host, const struct sockaddr_sto ...@@ -233,7 +233,7 @@ struct netconn *netconn_create( struct hostdata *host, const struct sockaddr_sto
if (!ret) if (!ret)
{ {
WARN("unable to connect to host (%u)\n", get_last_error()); WARN("unable to connect to host (%u)\n", GetLastError());
closesocket( conn->socket ); closesocket( conn->socket );
heap_free( conn ); heap_free( conn );
return NULL; return NULL;
...@@ -378,7 +378,7 @@ BOOL netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD securi ...@@ -378,7 +378,7 @@ BOOL netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD securi
heap_free(conn->ssl_buf); heap_free(conn->ssl_buf);
conn->ssl_buf = NULL; conn->ssl_buf = NULL;
DeleteSecurityContext(&ctx); DeleteSecurityContext(&ctx);
set_last_error(res ? res : ERROR_WINHTTP_SECURE_CHANNEL_ERROR); SetLastError(res ? res : ERROR_WINHTTP_SECURE_CHANNEL_ERROR);
return FALSE; return FALSE;
} }
...@@ -690,7 +690,7 @@ BOOL netconn_resolve( WCHAR *hostname, INTERNET_PORT port, struct sockaddr_stora ...@@ -690,7 +690,7 @@ BOOL netconn_resolve( WCHAR *hostname, INTERNET_PORT port, struct sockaddr_stora
if (ret) if (ret)
{ {
set_last_error( ret ); SetLastError( ret );
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
......
...@@ -181,7 +181,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN ...@@ -181,7 +181,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
if (!url || !uc || uc->dwStructSize != sizeof(URL_COMPONENTS)) if (!url || !uc || uc->dwStructSize != sizeof(URL_COMPONENTS))
{ {
set_last_error( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return FALSE; return FALSE;
} }
if (!len) len = strlenW( url ); if (!len) len = strlenW( url );
...@@ -190,7 +190,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN ...@@ -190,7 +190,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
{ {
if ((err = escape_url( url, &len, &url_escaped ))) if ((err = escape_url( url, &len, &url_escaped )))
{ {
set_last_error( err ); SetLastError( err );
return FALSE; return FALSE;
} }
url = url_escaped; url = url_escaped;
...@@ -199,14 +199,14 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN ...@@ -199,14 +199,14 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
{ {
if (!(url_decoded = decode_url( url, &len ))) if (!(url_decoded = decode_url( url, &len )))
{ {
set_last_error( ERROR_OUTOFMEMORY ); SetLastError( ERROR_OUTOFMEMORY );
return FALSE; return FALSE;
} }
url = url_decoded; url = url_decoded;
} }
if (!(p = strchrW( url, ':' ))) if (!(p = strchrW( url, ':' )))
{ {
set_last_error( ERROR_WINHTTP_UNRECOGNIZED_SCHEME ); SetLastError( ERROR_WINHTTP_UNRECOGNIZED_SCHEME );
return FALSE; return FALSE;
} }
if (p - url == 4 && !strncmpiW( url, scheme_http, 4 )) scheme = INTERNET_SCHEME_HTTP; if (p - url == 4 && !strncmpiW( url, scheme_http, 4 )) scheme = INTERNET_SCHEME_HTTP;
...@@ -307,7 +307,7 @@ exit: ...@@ -307,7 +307,7 @@ exit:
} }
heap_free( url_decoded ); heap_free( url_decoded );
heap_free( url_escaped ); heap_free( url_escaped );
set_last_error( err ); SetLastError( err );
return !err; return !err;
} }
...@@ -372,7 +372,7 @@ static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len ) ...@@ -372,7 +372,7 @@ static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len )
{ {
if (uc->lpszPassword) if (uc->lpszPassword)
{ {
set_last_error( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return FALSE; return FALSE;
} }
} }
...@@ -412,7 +412,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW ...@@ -412,7 +412,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
if (!uc || uc->dwStructSize != sizeof(URL_COMPONENTS) || !required) if (!uc || uc->dwStructSize != sizeof(URL_COMPONENTS) || !required)
{ {
set_last_error( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return FALSE; return FALSE;
} }
...@@ -421,12 +421,12 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW ...@@ -421,12 +421,12 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
if (*required < len) if (*required < len)
{ {
*required = len + 1; *required = len + 1;
set_last_error( ERROR_INSUFFICIENT_BUFFER ); SetLastError( ERROR_INSUFFICIENT_BUFFER );
return FALSE; return FALSE;
} }
if (!url) if (!url)
{ {
set_last_error( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return FALSE; return FALSE;
} }
...@@ -497,7 +497,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW ...@@ -497,7 +497,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
{ {
if (!escape_string( uc->lpszUrlPath, len, url, &len_escaped )) if (!escape_string( uc->lpszUrlPath, len, url, &len_escaped ))
{ {
set_last_error( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return FALSE; return FALSE;
} }
url += len_escaped; url += len_escaped;
...@@ -515,7 +515,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW ...@@ -515,7 +515,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
{ {
if (!escape_string( uc->lpszExtraInfo, len, url, &len_escaped )) if (!escape_string( uc->lpszExtraInfo, len, url, &len_escaped ))
{ {
set_last_error( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return FALSE; return FALSE;
} }
url += len_escaped; url += len_escaped;
...@@ -527,6 +527,6 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW ...@@ -527,6 +527,6 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
} }
} }
*url = 0; *url = 0;
set_last_error( ERROR_SUCCESS ); SetLastError( ERROR_SUCCESS );
return TRUE; return TRUE;
} }
...@@ -265,8 +265,6 @@ void release_object( struct object_header * ) DECLSPEC_HIDDEN; ...@@ -265,8 +265,6 @@ void release_object( struct object_header * ) DECLSPEC_HIDDEN;
HINTERNET alloc_handle( struct object_header * ) DECLSPEC_HIDDEN; HINTERNET alloc_handle( struct object_header * ) DECLSPEC_HIDDEN;
BOOL free_handle( HINTERNET ) DECLSPEC_HIDDEN; BOOL free_handle( HINTERNET ) DECLSPEC_HIDDEN;
void set_last_error( DWORD ) DECLSPEC_HIDDEN;
DWORD get_last_error( void ) DECLSPEC_HIDDEN;
void send_callback( struct object_header *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN; void send_callback( struct object_header *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN;
void close_connection( struct request * ) DECLSPEC_HIDDEN; void close_connection( struct request * ) DECLSPEC_HIDDEN;
......
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