urlmon: Implemented function to the file extension of a file in a URI path.
This commit is contained in:
parent
1e09e44510
commit
eb6e23e1de
@ -61,6 +61,7 @@ typedef struct {
|
||||
|
||||
INT path_start;
|
||||
DWORD path_len;
|
||||
INT extension_offset;
|
||||
} Uri;
|
||||
|
||||
typedef struct {
|
||||
@ -535,6 +536,18 @@ static DWORD remove_dot_segments(WCHAR *path, DWORD path_len) {
|
||||
return len;
|
||||
}
|
||||
|
||||
/* Attempts to find the file extension in a given path. */
|
||||
static INT find_file_extension(const WCHAR *path, DWORD path_len) {
|
||||
const WCHAR *end;
|
||||
|
||||
for(end = path+path_len-1; end >= path && *end != '/' && *end != '\\'; --end) {
|
||||
if(*end == '.')
|
||||
return end-path;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Computes the location where the elision should occur in the IPv6
|
||||
* address using the numerical values of each component stored in
|
||||
* 'values'. If the address shouldn't contain an elision then 'index'
|
||||
@ -2576,6 +2589,12 @@ static BOOL canonicalize_hierpart(const parse_data *data, Uri *uri, DWORD flags,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(uri->path_start > -1 && !computeOnly)
|
||||
/* Finding file extensions happens for both types of URIs. */
|
||||
uri->extension_offset = find_file_extension(uri->canon_uri+uri->path_start, uri->path_len);
|
||||
else
|
||||
uri->extension_offset = -1;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user