Module: wine Branch: master Commit: 0fda135f3fc4430641f63a93c9089e6c392974a8 URL: http://source.winehq.org/git/wine.git/?a=commit;h=0fda135f3fc4430641f63a93c9...
Author: André Hentschel nerv@dawncrow.de Date: Mon Aug 22 21:30:55 2011 +0200
wininet: Use the constants from the wininet header.
---
dlls/wininet/cookie.c | 2 +- dlls/wininet/http.c | 28 +++++++++++++--------------- dlls/wininet/internet.c | 24 +++++++++++++----------- 3 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/dlls/wininet/cookie.c b/dlls/wininet/cookie.c index 1895a93..6f9caad 100644 --- a/dlls/wininet/cookie.c +++ b/dlls/wininet/cookie.c @@ -554,7 +554,7 @@ BOOL WINAPI InternetSetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName, LPCWSTR lpCookieData) { BOOL ret; - WCHAR hostName[2048], path[2048]; + WCHAR hostName[INTERNET_MAX_HOST_NAME_LENGTH], path[INTERNET_MAX_PATH_LENGTH];
TRACE("(%s,%s,%s)\n", debugstr_w(lpszUrl), debugstr_w(lpszCookieName), debugstr_w(lpCookieData)); diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index dab96b9..7934c43 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -139,10 +139,6 @@ static const WCHAR szVia[] = { 'V','i','a',0 }; static const WCHAR szWarning[] = { 'W','a','r','n','i','n','g',0 }; static const WCHAR szWWW_Authenticate[] = { 'W','W','W','-','A','u','t','h','e','n','t','i','c','a','t','e',0 };
-#define MAXHOSTNAME 100 -#define MAX_FIELD_VALUE_LEN 256 -#define MAX_FIELD_LEN 256 - #define HTTP_REFERER szReferer #define HTTP_ACCEPT szAccept #define HTTP_USERAGENT szUser_Agent @@ -1689,10 +1685,10 @@ static WCHAR *HTTP_BuildProxyRequestUrl(http_request_t *req) */ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_request_t *request) { - WCHAR buf[MAXHOSTNAME]; - WCHAR protoProxy[MAXHOSTNAME + 15]; - DWORD protoProxyLen = sizeof(protoProxy) / sizeof(protoProxy[0]); - WCHAR proxy[MAXHOSTNAME + 15]; /* 15 == "http://" + sizeof(port#) + ":/\0" */ + WCHAR buf[INTERNET_MAX_HOST_NAME_LENGTH]; + WCHAR protoProxy[INTERNET_MAX_URL_LENGTH]; + DWORD protoProxyLen = INTERNET_MAX_URL_LENGTH; + WCHAR proxy[INTERNET_MAX_URL_LENGTH]; static WCHAR szNul[] = { 0 }; URL_COMPONENTSW UrlComponents; static const WCHAR protoHttp[] = { 'h','t','t','p',0 }; @@ -1702,7 +1698,7 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req memset( &UrlComponents, 0, sizeof UrlComponents ); UrlComponents.dwStructSize = sizeof UrlComponents; UrlComponents.lpszHostName = buf; - UrlComponents.dwHostNameLength = MAXHOSTNAME; + UrlComponents.dwHostNameLength = INTERNET_MAX_HOST_NAME_LENGTH;
if (!INTERNET_FindProxyForProtocol(hIC->proxy, protoHttp, protoProxy, &protoProxyLen)) return FALSE; @@ -3758,7 +3754,7 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl) http_session_t *session = request->session; appinfo_t *hIC = session->appInfo; BOOL using_proxy = hIC->proxy && hIC->proxy[0]; - WCHAR path[INTERNET_MAX_URL_LENGTH]; + WCHAR path[INTERNET_MAX_PATH_LENGTH]; int index;
if(lpszUrl[0]=='/') @@ -3769,7 +3765,9 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl) else { URL_COMPONENTSW urlComponents; - WCHAR protocol[32], hostName[MAXHOSTNAME], userName[1024]; + WCHAR protocol[INTERNET_MAX_SCHEME_LENGTH]; + WCHAR hostName[INTERNET_MAX_HOST_NAME_LENGTH]; + WCHAR userName[INTERNET_MAX_USER_NAME_LENGTH]; static WCHAR szHttp[] = {'h','t','t','p',0}; static WCHAR szHttps[] = {'h','t','t','p','s',0};
@@ -3779,15 +3777,15 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
urlComponents.dwStructSize = sizeof(URL_COMPONENTSW); urlComponents.lpszScheme = protocol; - urlComponents.dwSchemeLength = 32; + urlComponents.dwSchemeLength = INTERNET_MAX_SCHEME_LENGTH; urlComponents.lpszHostName = hostName; - urlComponents.dwHostNameLength = MAXHOSTNAME; + urlComponents.dwHostNameLength = INTERNET_MAX_HOST_NAME_LENGTH; urlComponents.lpszUserName = userName; - urlComponents.dwUserNameLength = 1024; + urlComponents.dwUserNameLength = INTERNET_MAX_USER_NAME_LENGTH; urlComponents.lpszPassword = NULL; urlComponents.dwPasswordLength = 0; urlComponents.lpszUrlPath = path; - urlComponents.dwUrlPathLength = 2048; + urlComponents.dwUrlPathLength = INTERNET_MAX_PATH_LENGTH; urlComponents.lpszExtraInfo = NULL; urlComponents.dwExtraInfoLength = 0; if(!InternetCrackUrlW(lpszUrl, strlenW(lpszUrl), 0, &urlComponents)) diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index c949f5d..3d85dd7 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -29,8 +29,6 @@ #include "config.h" #include "wine/port.h"
-#define MAXHOSTNAME 100 /* from http.c */ - #if defined(__MINGW32__) || defined (_MSC_VER) #include <ws2tcpip.h> #endif @@ -3161,7 +3159,7 @@ BOOL WINAPI InternetCheckConnectionW( LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwRe static const CHAR ping[] = "ping -c 1 "; static const CHAR redirect[] = " >/dev/null 2>/dev/null"; CHAR *command = NULL; - WCHAR hostW[1024]; + WCHAR hostW[INTERNET_MAX_HOST_NAME_LENGTH]; DWORD len; INTERNET_PORT port; int status = -1; @@ -3189,7 +3187,7 @@ BOOL WINAPI InternetCheckConnectionW( LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwRe
ZeroMemory(&components,sizeof(URL_COMPONENTSW)); components.lpszHostName = (LPWSTR)hostW; - components.dwHostNameLength = 1024; + components.dwHostNameLength = INTERNET_MAX_HOST_NAME_LENGTH;
if (!InternetCrackUrlW(lpszUrl,0,0,&components)) goto End; @@ -3286,8 +3284,12 @@ static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl, LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext) { URL_COMPONENTSW urlComponents; - WCHAR protocol[32], hostName[MAXHOSTNAME], userName[1024]; - WCHAR password[1024], path[2048], extra[1024]; + WCHAR protocol[INTERNET_MAX_SCHEME_LENGTH]; + WCHAR hostName[INTERNET_MAX_HOST_NAME_LENGTH]; + WCHAR userName[INTERNET_MAX_USER_NAME_LENGTH]; + WCHAR password[INTERNET_MAX_PASSWORD_LENGTH]; + WCHAR path[INTERNET_MAX_PATH_LENGTH]; + WCHAR extra[1024]; HINTERNET client = NULL, client1 = NULL; DWORD res;
@@ -3296,15 +3298,15 @@ static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl,
urlComponents.dwStructSize = sizeof(URL_COMPONENTSW); urlComponents.lpszScheme = protocol; - urlComponents.dwSchemeLength = 32; + urlComponents.dwSchemeLength = INTERNET_MAX_SCHEME_LENGTH; urlComponents.lpszHostName = hostName; - urlComponents.dwHostNameLength = MAXHOSTNAME; + urlComponents.dwHostNameLength = INTERNET_MAX_HOST_NAME_LENGTH; urlComponents.lpszUserName = userName; - urlComponents.dwUserNameLength = 1024; + urlComponents.dwUserNameLength = INTERNET_MAX_USER_NAME_LENGTH; urlComponents.lpszPassword = password; - urlComponents.dwPasswordLength = 1024; + urlComponents.dwPasswordLength = INTERNET_MAX_PASSWORD_LENGTH; urlComponents.lpszUrlPath = path; - urlComponents.dwUrlPathLength = 2048; + urlComponents.dwUrlPathLength = INTERNET_MAX_PATH_LENGTH; urlComponents.lpszExtraInfo = extra; urlComponents.dwExtraInfoLength = 1024; if(!InternetCrackUrlW(lpszUrl, strlenW(lpszUrl), 0, &urlComponents))