kernelbase: Get rid of the "size" and "type" arguments to scan_url().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-02-16 20:31:41 -06:00 committed by Alexandre Julliard
parent b72f7afc8b
commit 6cb1264585
1 changed files with 7 additions and 28 deletions

View File

@ -74,11 +74,6 @@ struct parsed_url
DWORD query_len; /* [out] size of Query (until eos) */ DWORD query_len; /* [out] size of Query (until eos) */
}; };
enum url_scan_type
{
SCHEME,
};
static WCHAR *heap_strdupAtoW(const char *str) static WCHAR *heap_strdupAtoW(const char *str)
{ {
WCHAR *ret = NULL; WCHAR *ret = NULL;
@ -4158,28 +4153,11 @@ HRESULT WINAPI UrlGetPartA(const char *url, char *out, DWORD *out_len, DWORD par
return hr; return hr;
} }
static const WCHAR * scan_url(const WCHAR *start, DWORD *size, enum url_scan_type type) static const WCHAR *parse_scheme( const WCHAR *p )
{ {
*size = 0; while ((*p >= 'a' && *p <= 'z') || (*p >= '0' && *p <= '9') || *p == '+' || *p == '-' || *p == '.')
++p;
switch (type) return p;
{
case SCHEME:
while ((isalnum( *start ) && !isupper( *start )) || *start == '+' || *start == '-' || *start == '.')
{
start++;
(*size)++;
}
if (*start != ':')
*size = 0;
break;
default:
FIXME("unknown type %d\n", type);
return L"";
}
return start;
} }
static const WCHAR *parse_url_element( const WCHAR *url, const WCHAR *separators ) static const WCHAR *parse_url_element( const WCHAR *url, const WCHAR *separators )
@ -4202,8 +4180,9 @@ static void parse_url( const WCHAR *url, struct parsed_url *pl )
memset(pl, 0, sizeof(*pl)); memset(pl, 0, sizeof(*pl));
pl->scheme = url; pl->scheme = url;
work = scan_url(pl->scheme, &pl->scheme_len, SCHEME); work = parse_scheme( pl->scheme );
if (!*work || (*work != ':')) return; if (*work != ':') return;
pl->scheme_len = work - pl->scheme;
work++; work++;
if (!is_slash( work[0] ) || !is_slash( work[1] )) if (!is_slash( work[0] ) || !is_slash( work[1] ))
return; return;