Thomas Mullaly : urlmon: Implemented function to the file extension of a file in a URI path.
Alexandre Julliard
julliard at winehq.org
Tue Aug 3 13:10:33 CDT 2010
Module: wine
Branch: master
Commit: eb6e23e1de0c05f10288a1493b5c98fda9f87d8f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=eb6e23e1de0c05f10288a1493b5c98fda9f87d8f
Author: Thomas Mullaly <thomas.mullaly at gmail.com>
Date: Sun Jul 25 18:19:48 2010 -0400
urlmon: Implemented function to the file extension of a file in a URI path.
---
dlls/urlmon/uri.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c
index 07e9944..20a2d87 100644
--- a/dlls/urlmon/uri.c
+++ b/dlls/urlmon/uri.c
@@ -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;
}
More information about the wine-cvs
mailing list