shlwapi: Remove more wide character constants.

This commit is contained in:
Michael Stefaniuc 2007-06-21 22:56:09 +02:00 committed by Alexandre Julliard
parent cc2773008e
commit 14077f67c8
1 changed files with 69 additions and 69 deletions

View File

@ -131,12 +131,12 @@ static DWORD get_scheme_code(LPCWSTR scheme, DWORD scheme_len)
static BOOL URL_JustLocation(LPCWSTR str) static BOOL URL_JustLocation(LPCWSTR str)
{ {
while(*str && (*str == L'/')) str++; while(*str && (*str == '/')) str++;
if (*str) { if (*str) {
while (*str && ((*str == L'-') || while (*str && ((*str == '-') ||
(*str == L'.') || (*str == '.') ||
isalnumW(*str))) str++; isalnumW(*str))) str++;
if (*str == L'/') return FALSE; if (*str == '/') return FALSE;
} }
return TRUE; return TRUE;
} }
@ -211,12 +211,12 @@ HRESULT WINAPI ParseURLW(LPCWSTR x, PARSEDURLW *y)
/* FIXME: leading white space generates error of 0x80041001 which /* FIXME: leading white space generates error of 0x80041001 which
* is undefined * is undefined
*/ */
if (*x <= L' ') return 0x80041001; if (*x <= ' ') return 0x80041001;
cnt = 0; cnt = 0;
y->cchProtocol = 0; y->cchProtocol = 0;
y->pszProtocol = x; y->pszProtocol = x;
while (*x) { while (*x) {
if (*x == L':') { if (*x == ':') {
y->cchProtocol = cnt; y->cchProtocol = cnt;
cnt = -1; cnt = -1;
y->pszSuffix = x+1; y->pszSuffix = x+1;
@ -228,7 +228,7 @@ HRESULT WINAPI ParseURLW(LPCWSTR x, PARSEDURLW *y)
/* check for no scheme in string start */ /* check for no scheme in string start */
/* (apparently schemes *must* be larger than a single character) */ /* (apparently schemes *must* be larger than a single character) */
if ((*x == L'\0') || (y->cchProtocol <= 1)) { if ((*x == '\0') || (y->cchProtocol <= 1)) {
y->pszProtocol = NULL; y->pszProtocol = NULL;
return 0x80041001; return 0x80041001;
} }
@ -379,12 +379,12 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
break; break;
case 1: case 1:
*wk2++ = *wk1; *wk2++ = *wk1;
if (*wk1++ == L':') state = 2; if (*wk1++ == ':') state = 2;
break; break;
case 2: case 2:
if (*wk1 != L'/') {state = 3; break;} if (*wk1 != '/') {state = 3; break;}
*wk2++ = *wk1++; *wk2++ = *wk1++;
if (*wk1 != L'/') {state = 6; break;} if (*wk1 != '/') {state = 6; break;}
*wk2++ = *wk1++; *wk2++ = *wk1++;
if(*wk1 == '/' && (dwFlags & URL_FILE_USE_PATHURL)) if(*wk1 == '/' && (dwFlags & URL_FILE_USE_PATHURL))
wk1++; wk1++;
@ -404,9 +404,9 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
} }
break; break;
case 4: case 4:
if (!isalnumW(*wk1) && (*wk1 != L'-') && (*wk1 != L'.') && (*wk1 != ':')) if (!isalnumW(*wk1) && (*wk1 != '-') && (*wk1 != '.') && (*wk1 != ':'))
{state = 3; break;} {state = 3; break;}
while(isalnumW(*wk1) || (*wk1 == L'-') || (*wk1 == L'.') || (*wk1 == ':')) while(isalnumW(*wk1) || (*wk1 == '-') || (*wk1 == '.') || (*wk1 == ':'))
*wk2++ = *wk1++; *wk2++ = *wk1++;
state = 5; state = 5;
if (!*wk1) if (!*wk1)
@ -451,7 +451,7 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
*wk2++ = slash; *wk2++ = slash;
wk1++; wk1++;
if (*wk1 == L'.') { if (*wk1 == '.') {
TRACE("found '/.'\n"); TRACE("found '/.'\n");
if (wk1[1] == '/' || wk1[1] == '\\') { if (wk1[1] == '/' || wk1[1] == '\\') {
/* case of /./ -> skip the ./ */ /* case of /./ -> skip the ./ */
@ -464,7 +464,7 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
|| wk1[2] == '#' || !wk1[2]) { || wk1[2] == '#' || !wk1[2]) {
/* case /../ -> need to backup wk2 */ /* case /../ -> need to backup wk2 */
TRACE("found '/../'\n"); TRACE("found '/../'\n");
*(wk2-1) = L'\0'; /* set end of string */ *(wk2-1) = '\0'; /* set end of string */
mp = strrchrW(root, slash); mp = strrchrW(root, slash);
if (mp && (mp >= root)) { if (mp && (mp >= root)) {
/* found valid backup point */ /* found valid backup point */
@ -482,14 +482,14 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
} }
} }
} }
*wk2 = L'\0'; *wk2 = '\0';
break; break;
default: default:
FIXME("how did we get here - state=%d\n", state); FIXME("how did we get here - state=%d\n", state);
HeapFree(GetProcessHeap(), 0, lpszUrlCpy); HeapFree(GetProcessHeap(), 0, lpszUrlCpy);
return E_INVALIDARG; return E_INVALIDARG;
} }
*wk2 = L'\0'; *wk2 = '\0';
TRACE("Simplified, orig <%s>, simple <%s>\n", TRACE("Simplified, orig <%s>, simple <%s>\n",
debugstr_w(pszUrl), debugstr_w(lpszUrlCpy)); debugstr_w(pszUrl), debugstr_w(lpszUrlCpy));
} }
@ -619,7 +619,7 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
sizeof(WCHAR)); sizeof(WCHAR));
mbase = preliminary + INTERNET_MAX_URL_LENGTH; mbase = preliminary + INTERNET_MAX_URL_LENGTH;
mrelative = mbase + INTERNET_MAX_URL_LENGTH; mrelative = mbase + INTERNET_MAX_URL_LENGTH;
*preliminary = L'\0'; *preliminary = '\0';
/* Canonicalize the base input prior to looking for the scheme */ /* Canonicalize the base input prior to looking for the scheme */
myflags = dwFlags & (URL_DONT_SIMPLIFY | URL_UNESCAPE); myflags = dwFlags & (URL_DONT_SIMPLIFY | URL_UNESCAPE);
@ -657,12 +657,12 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
/* get size of location field (if it exists) */ /* get size of location field (if it exists) */
work = (LPWSTR)base.pszSuffix; work = (LPWSTR)base.pszSuffix;
sizeloc = 0; sizeloc = 0;
if (*work++ == L'/') { if (*work++ == '/') {
if (*work++ == L'/') { if (*work++ == '/') {
/* At this point have start of location and /* At this point have start of location and
* it ends at next '/' or end of string. * it ends at next '/' or end of string.
*/ */
while(*work && (*work != L'/')) work++; while(*work && (*work != '/')) work++;
sizeloc = (DWORD)(work - base.pszSuffix); sizeloc = (DWORD)(work - base.pszSuffix);
} }
} }
@ -670,7 +670,7 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
/* Change .sizep2 to not have the last leaf in it, /* Change .sizep2 to not have the last leaf in it,
* Note: we need to start after the location (if it exists) * Note: we need to start after the location (if it exists)
*/ */
work = strrchrW((base.pszSuffix+sizeloc), L'/'); work = strrchrW((base.pszSuffix+sizeloc), '/');
if (work) { if (work) {
len = (DWORD)(work - base.pszSuffix + 1); len = (DWORD)(work - base.pszSuffix + 1);
base.cchSuffix = len; base.cchSuffix = len;
@ -691,7 +691,7 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
TRACE("no scheme detected in Relative\n"); TRACE("no scheme detected in Relative\n");
relative.pszSuffix = mrelative; /* case 3,4,5 depends on this */ relative.pszSuffix = mrelative; /* case 3,4,5 depends on this */
relative.cchSuffix = strlenW(mrelative); relative.cchSuffix = strlenW(mrelative);
if (*pszRelative == L':') { if (*pszRelative == ':') {
/* case that is either left alone or uses pszBase */ /* case that is either left alone or uses pszBase */
if (dwFlags & URL_PLUGGABLE_PROTOCOL) { if (dwFlags & URL_PLUGGABLE_PROTOCOL) {
process_case = 5; process_case = 5;
@ -700,23 +700,23 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
process_case = 1; process_case = 1;
break; break;
} }
if (isalnum(*mrelative) && (*(mrelative + 1) == L':')) { if (isalnum(*mrelative) && (*(mrelative + 1) == ':')) {
/* case that becomes "file:///" */ /* case that becomes "file:///" */
strcpyW(preliminary, myfilestr); strcpyW(preliminary, myfilestr);
process_case = 1; process_case = 1;
break; break;
} }
if ((*mrelative == L'/') && (*(mrelative+1) == L'/')) { if ((*mrelative == '/') && (*(mrelative+1) == '/')) {
/* pszRelative has location and rest */ /* pszRelative has location and rest */
process_case = 3; process_case = 3;
break; break;
} }
if (*mrelative == L'/') { if (*mrelative == '/') {
/* case where pszRelative is root to location */ /* case where pszRelative is root to location */
process_case = 4; process_case = 4;
break; break;
} }
process_case = (*base.pszSuffix == L'/') ? 5 : 3; process_case = (*base.pszSuffix == '/') ? 5 : 3;
break; break;
} }
@ -725,12 +725,12 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
(strncmpW(base.pszProtocol, relative.pszProtocol, base.cchProtocol) == 0)) { (strncmpW(base.pszProtocol, relative.pszProtocol, base.cchProtocol) == 0)) {
/* since the schemes are the same */ /* since the schemes are the same */
if ((*relative.pszSuffix == L'/') && (*(relative.pszSuffix+1) == L'/')) { if ((*relative.pszSuffix == '/') && (*(relative.pszSuffix+1) == '/')) {
/* case where pszRelative replaces location and following */ /* case where pszRelative replaces location and following */
process_case = 3; process_case = 3;
break; break;
} }
if (*relative.pszSuffix == L'/') { if (*relative.pszSuffix == '/') {
/* case where pszRelative is root to location */ /* case where pszRelative is root to location */
process_case = 4; process_case = 4;
break; break;
@ -739,7 +739,7 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
process_case = 5; process_case = 5;
break; break;
} }
if ((*relative.pszSuffix == L'/') && (*(relative.pszSuffix+1) == L'/')) { if ((*relative.pszSuffix == '/') && (*(relative.pszSuffix+1) == '/')) {
/* case where pszRelative replaces scheme, location, /* case where pszRelative replaces scheme, location,
* and following and handles PLUGGABLE * and following and handles PLUGGABLE
*/ */
@ -791,7 +791,7 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
memcpy(preliminary, base.pszProtocol, (base.cchProtocol+1+sizeloc)*sizeof(WCHAR)); memcpy(preliminary, base.pszProtocol, (base.cchProtocol+1+sizeloc)*sizeof(WCHAR));
work = preliminary + base.cchProtocol + 1 + sizeloc; work = preliminary + base.cchProtocol + 1 + sizeloc;
if (dwFlags & URL_PLUGGABLE_PROTOCOL) if (dwFlags & URL_PLUGGABLE_PROTOCOL)
*(work++) = L'/'; *(work++) = '/';
strcpyW(work, relative.pszSuffix); strcpyW(work, relative.pszSuffix);
break; break;
@ -802,8 +802,8 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
memcpy(preliminary, base.pszProtocol, memcpy(preliminary, base.pszProtocol,
(base.cchProtocol+1+base.cchSuffix)*sizeof(WCHAR)); (base.cchProtocol+1+base.cchSuffix)*sizeof(WCHAR));
work = preliminary + base.cchProtocol+1+base.cchSuffix - 1; work = preliminary + base.cchProtocol+1+base.cchSuffix - 1;
if (*work++ != L'/') if (*work++ != '/')
*(work++) = L'/'; *(work++) = '/';
strcpyW(work, relative.pszSuffix); strcpyW(work, relative.pszSuffix);
break; break;
@ -1083,7 +1083,7 @@ HRESULT WINAPI UrlEscapeW(
if(cur == '\\' && (int_flags & WINE_URL_BASH_AS_SLASH) && !stop_escaping) cur = '/'; if(cur == '\\' && (int_flags & WINE_URL_BASH_AS_SLASH) && !stop_escaping) cur = '/';
if(URL_NeedEscapeW(cur, dwFlags, int_flags) && stop_escaping == FALSE) { if(URL_NeedEscapeW(cur, dwFlags, int_flags) && stop_escaping == FALSE) {
next[0] = L'%'; next[0] = '%';
next[1] = hexDigits[(cur >> 4) & 0xf]; next[1] = hexDigits[(cur >> 4) & 0xf];
next[2] = hexDigits[cur & 0xf]; next[2] = hexDigits[cur & 0xf];
len = 3; len = 3;
@ -1225,10 +1225,10 @@ HRESULT WINAPI UrlUnescapeW(
for(src = pszUrl, needed = 0; *src; src++, needed++) { for(src = pszUrl, needed = 0; *src; src++, needed++) {
if(dwFlags & URL_DONT_UNESCAPE_EXTRA_INFO && if(dwFlags & URL_DONT_UNESCAPE_EXTRA_INFO &&
(*src == L'#' || *src == L'?')) { (*src == '#' || *src == '?')) {
stop_unescaping = TRUE; stop_unescaping = TRUE;
next = *src; next = *src;
} else if(*src == L'%' && isxdigitW(*(src + 1)) && isxdigitW(*(src + 2)) } else if(*src == '%' && isxdigitW(*(src + 1)) && isxdigitW(*(src + 2))
&& stop_unescaping == FALSE) { && stop_unescaping == FALSE) {
INT ih; INT ih;
WCHAR buf[5] = {'0','x',0}; WCHAR buf[5] = {'0','x',0};
@ -1245,7 +1245,7 @@ HRESULT WINAPI UrlUnescapeW(
} }
if(dwFlags & URL_UNESCAPE_INPLACE || needed < *pcchUnescaped) { if(dwFlags & URL_UNESCAPE_INPLACE || needed < *pcchUnescaped) {
*dst = L'\0'; *dst = '\0';
ret = S_OK; ret = S_OK;
} else { } else {
needed++; /* add one for the '\0' */ needed++; /* add one for the '\0' */
@ -1324,7 +1324,7 @@ LPCWSTR WINAPI UrlGetLocationW(
if (strncmpW(base.pszProtocol, fileW, min(4,base.cchProtocol)) == 0) return NULL; if (strncmpW(base.pszProtocol, fileW, min(4,base.cchProtocol)) == 0) return NULL;
/* Look for '#' and return its addr */ /* Look for '#' and return its addr */
return strchrW(base.pszSuffix, L'#'); return strchrW(base.pszSuffix, '#');
} }
/************************************************************************* /*************************************************************************
@ -1588,8 +1588,8 @@ static HRESULT URL_ApplyDefault(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut)
-1, reg_path, MAX_PATH); -1, reg_path, MAX_PATH);
RegOpenKeyExW(HKEY_LOCAL_MACHINE, reg_path, 0, 1, &newkey); RegOpenKeyExW(HKEY_LOCAL_MACHINE, reg_path, 0, 1, &newkey);
data_len = MAX_PATH; data_len = MAX_PATH;
value[0] = L'@'; value[0] = '@';
value[1] = L'\0'; value[1] = '\0';
RegQueryValueExW(newkey, value, 0, &dwType, (LPBYTE)data, &data_len); RegQueryValueExW(newkey, value, 0, &dwType, (LPBYTE)data, &data_len);
RegCloseKey(newkey); RegCloseKey(newkey);
if (strlenW(data) + strlenW(pszIn) + 1 > *pcchOut) { if (strlenW(data) + strlenW(pszIn) + 1 > *pcchOut) {
@ -1854,9 +1854,9 @@ static LPCWSTR URL_ScanID(LPCWSTR start, LPDWORD size, WINE_URL_SCAN_TYPE type)
while (cont) { while (cont) {
if ( (islowerW(*start) && isalphaW(*start)) || if ( (islowerW(*start) && isalphaW(*start)) ||
isdigitW(*start) || isdigitW(*start) ||
(*start == L'+') || (*start == '+') ||
(*start == L'-') || (*start == '-') ||
(*start == L'.')) { (*start == '.')) {
start++; start++;
(*size)++; (*size)++;
} }
@ -1870,26 +1870,26 @@ static LPCWSTR URL_ScanID(LPCWSTR start, LPDWORD size, WINE_URL_SCAN_TYPE type)
if ( isalphaW(*start) || if ( isalphaW(*start) ||
isdigitW(*start) || isdigitW(*start) ||
/* user/password only characters */ /* user/password only characters */
(*start == L';') || (*start == ';') ||
(*start == L'?') || (*start == '?') ||
(*start == L'&') || (*start == '&') ||
(*start == L'=') || (*start == '=') ||
/* *extra* characters */ /* *extra* characters */
(*start == L'!') || (*start == '!') ||
(*start == L'*') || (*start == '*') ||
(*start == L'\'') || (*start == '\'') ||
(*start == L'(') || (*start == '(') ||
(*start == L')') || (*start == ')') ||
(*start == L',') || (*start == ',') ||
/* *safe* characters */ /* *safe* characters */
(*start == L'$') || (*start == '$') ||
(*start == L'_') || (*start == '_') ||
(*start == L'+') || (*start == '+') ||
(*start == L'-') || (*start == '-') ||
(*start == L'.')) { (*start == '.')) {
start++; start++;
(*size)++; (*size)++;
} else if (*start == L'%') { } else if (*start == '%') {
if (isxdigitW(*(start+1)) && if (isxdigitW(*(start+1)) &&
isxdigitW(*(start+2))) { isxdigitW(*(start+2))) {
start += 3; start += 3;
@ -1915,8 +1915,8 @@ static LPCWSTR URL_ScanID(LPCWSTR start, LPDWORD size, WINE_URL_SCAN_TYPE type)
case HOST: case HOST:
while (cont) { while (cont) {
if (isalnumW(*start) || if (isalnumW(*start) ||
(*start == L'-') || (*start == '-') ||
(*start == L'.') ) { (*start == '.') ) {
start++; start++;
(*size)++; (*size)++;
} }
@ -1943,28 +1943,28 @@ static LONG URL_ParseUrl(LPCWSTR pszUrl, WINE_PARSE_URL *pl)
memset(pl, 0, sizeof(WINE_PARSE_URL)); memset(pl, 0, sizeof(WINE_PARSE_URL));
pl->pScheme = pszUrl; pl->pScheme = pszUrl;
work = URL_ScanID(pl->pScheme, &pl->szScheme, SCHEME); work = URL_ScanID(pl->pScheme, &pl->szScheme, SCHEME);
if (!*work || (*work != L':')) goto ErrorExit; if (!*work || (*work != ':')) goto ErrorExit;
work++; work++;
if ((*work != L'/') || (*(work+1) != L'/')) goto ErrorExit; if ((*work != '/') || (*(work+1) != '/')) goto ErrorExit;
pl->pUserName = work + 2; pl->pUserName = work + 2;
work = URL_ScanID(pl->pUserName, &pl->szUserName, USERPASS); work = URL_ScanID(pl->pUserName, &pl->szUserName, USERPASS);
if (*work == L':' ) { if (*work == ':' ) {
/* parse password */ /* parse password */
work++; work++;
pl->pPassword = work; pl->pPassword = work;
work = URL_ScanID(pl->pPassword, &pl->szPassword, USERPASS); work = URL_ScanID(pl->pPassword, &pl->szPassword, USERPASS);
if (*work != L'@') { if (*work != '@') {
/* what we just parsed must be the hostname and port /* what we just parsed must be the hostname and port
* so reset pointers and clear then let it parse */ * so reset pointers and clear then let it parse */
pl->szUserName = pl->szPassword = 0; pl->szUserName = pl->szPassword = 0;
work = pl->pUserName - 1; work = pl->pUserName - 1;
pl->pUserName = pl->pPassword = 0; pl->pUserName = pl->pPassword = 0;
} }
} else if (*work == L'@') { } else if (*work == '@') {
/* no password */ /* no password */
pl->szPassword = 0; pl->szPassword = 0;
pl->pPassword = 0; pl->pPassword = 0;
} else if (!*work || (*work == L'/') || (*work == L'.')) { } else if (!*work || (*work == '/') || (*work == '.')) {
/* what was parsed was hostname, so reset pointers and let it parse */ /* what was parsed was hostname, so reset pointers and let it parse */
pl->szUserName = pl->szPassword = 0; pl->szUserName = pl->szPassword = 0;
work = pl->pUserName - 1; work = pl->pUserName - 1;
@ -1975,15 +1975,15 @@ static LONG URL_ParseUrl(LPCWSTR pszUrl, WINE_PARSE_URL *pl)
work++; work++;
pl->pHostName = work; pl->pHostName = work;
work = URL_ScanID(pl->pHostName, &pl->szHostName, HOST); work = URL_ScanID(pl->pHostName, &pl->szHostName, HOST);
if (*work == L':') { if (*work == ':') {
/* parse port */ /* parse port */
work++; work++;
pl->pPort = work; pl->pPort = work;
work = URL_ScanID(pl->pPort, &pl->szPort, PORT); work = URL_ScanID(pl->pPort, &pl->szPort, PORT);
} }
if (*work == L'/') { if (*work == '/') {
/* see if query string */ /* see if query string */
pl->pQuery = strchrW(work, L'?'); pl->pQuery = strchrW(work, '?');
if (pl->pQuery) pl->szQuery = strlenW(pl->pQuery); if (pl->pQuery) pl->szQuery = strlenW(pl->pQuery);
} }
TRACE("parse successful: scheme=%p(%d), user=%p(%d), pass=%p(%d), host=%p(%d), port=%p(%d), query=%p(%d)\n", TRACE("parse successful: scheme=%p(%d), user=%p(%d), pass=%p(%d), host=%p(%d), port=%p(%d), query=%p(%d)\n",