Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
98f5bc38
Commit
98f5bc38
authored
Nov 12, 2010
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 12, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Use IUriBuilder for IURI::SetQuery implementation.
parent
16fbd050
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
59 deletions
+78
-59
nsio.c
dlls/mshtml/nsio.c
+78
-59
No files found.
dlls/mshtml/nsio.c
View file @
98f5bc38
...
...
@@ -63,8 +63,9 @@ struct nsWineURI {
NSContainer
*
container
;
windowref_t
*
window_ref
;
nsChannelBSC
*
channel_bsc
;
LPW
STR
wine_url
;
B
STR
wine_url
;
IUri
*
uri
;
IUriBuilder
*
uri_builder
;
BOOL
is_doc_uri
;
};
...
...
@@ -248,12 +249,12 @@ HRESULT set_wine_url(nsWineURI *This, LPCWSTR url)
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_w
(
url
));
if
(
url
)
{
WCHAR
*
new_url
;
BSTR
new_url
;
new_url
=
heap_strdupW
(
url
);
new_url
=
SysAllocString
(
url
);
if
(
!
new_url
)
return
E_OUTOFMEMORY
;
heap_free
(
This
->
wine_url
);
SysFreeString
(
This
->
wine_url
);
This
->
wine_url
=
new_url
;
}
else
{
heap_free
(
This
->
wine_url
);
...
...
@@ -1529,19 +1530,74 @@ static const nsIHttpChannelInternalVtbl nsHttpChannelInternalVtbl = {
static
BOOL
ensure_uri
(
nsWineURI
*
This
)
{
if
(
!
This
->
uri
)
{
HRESULT
hres
;
if
(
This
->
uri
)
return
TRUE
;
if
(
This
->
uri_builder
)
{
hres
=
IUriBuilder_CreateUriSimple
(
This
->
uri_builder
,
0
,
0
,
&
This
->
uri
);
if
(
FAILED
(
hres
))
{
WARN
(
"CreateUriSimple failed: %08x
\n
"
,
hres
);
return
FALSE
;
}
return
TRUE
;
}
hres
=
CreateUri
(
This
->
wine_url
,
0
,
0
,
&
This
->
uri
);
if
(
FAILED
(
hres
))
{
WARN
(
"CreateUri failed: %08x
\n
"
,
hres
);
return
FALSE
;
}
return
TRUE
;
}
static
void
invalidate_uri
(
nsWineURI
*
This
)
{
if
(
This
->
uri
)
{
IUri_Release
(
This
->
uri
);
This
->
uri
=
NULL
;
}
}
static
BOOL
ensure_uri_builder
(
nsWineURI
*
This
)
{
if
(
!
This
->
uri_builder
)
{
HRESULT
hres
;
hres
=
CreateUri
(
This
->
wine_url
,
0
,
0
,
&
This
->
uri
);
if
(
!
ensure_uri
(
This
))
return
FALSE
;
hres
=
CreateIUriBuilder
(
This
->
uri
,
0
,
0
,
&
This
->
uri_builder
);
if
(
FAILED
(
hres
))
{
WARN
(
"Create
Uri
failed: %08x
\n
"
,
hres
);
WARN
(
"Create
IUriBulder
failed: %08x
\n
"
,
hres
);
return
FALSE
;
}
}
invalidate_uri
(
This
);
return
TRUE
;
}
/* Temporary helper */
static
void
sync_wine_url
(
nsWineURI
*
This
)
{
BSTR
new_url
;
HRESULT
hres
;
if
(
!
ensure_uri
(
This
))
return
;
hres
=
IUri_GetDisplayUri
(
This
->
uri
,
&
new_url
);
if
(
FAILED
(
hres
))
return
;
SysFreeString
(
This
->
wine_url
);
This
->
wine_url
=
new_url
;
}
static
nsresult
get_uri_string
(
nsWineURI
*
This
,
Uri_PROPERTY
prop
,
nsACString
*
ret
)
{
char
*
vala
;
...
...
@@ -1568,14 +1624,6 @@ static nsresult get_uri_string(nsWineURI *This, Uri_PROPERTY prop, nsACString *r
return
NS_OK
;
}
static
void
invalidate_uri
(
nsWineURI
*
This
)
{
if
(
This
->
uri
)
{
IUri_Release
(
This
->
uri
);
This
->
uri
=
NULL
;
}
}
#define NSURI_THIS(iface) DEFINE_THIS(nsWineURI, IURL, iface)
static
nsresult
NSAPI
nsURI_QueryInterface
(
nsIURL
*
iface
,
nsIIDRef
riid
,
void
**
result
)
...
...
@@ -1635,7 +1683,7 @@ static nsrefcnt NSAPI nsURI_Release(nsIURL *iface)
nsIURI_Release
(
This
->
nsuri
);
if
(
This
->
uri
)
IUri_Release
(
This
->
uri
);
heap_free
(
This
->
wine_url
);
SysFreeString
(
This
->
wine_url
);
heap_free
(
This
);
}
...
...
@@ -2189,55 +2237,26 @@ static nsresult NSAPI nsURL_GetQuery(nsIURL *iface, nsACString *aQuery)
static
nsresult
NSAPI
nsURL_SetQuery
(
nsIURL
*
iface
,
const
nsACString
*
aQuery
)
{
nsWineURI
*
This
=
NSURI_THIS
(
iface
);
const
WCHAR
*
ptr1
,
*
ptr2
;
const
char
*
query
;
WCHAR
*
new_url
,
*
ptr
;
DWORD
len
,
size
;
const
char
*
querya
;
WCHAR
*
query
;
HRESULT
hres
;
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_nsacstr
(
aQuery
));
invalidate_uri
(
This
);
if
(
This
->
nsurl
)
nsIURL_SetQuery
(
This
->
nsurl
,
aQuery
);
if
(
!
This
->
wine_url
)
return
NS_OK
;
nsACString_GetData
(
aQuery
,
&
query
);
size
=
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
query
,
-
1
,
NULL
,
0
);
ptr1
=
strchrW
(
This
->
wine_url
,
'?'
);
if
(
ptr1
)
{
size
+=
ptr1
-
This
->
wine_url
;
ptr2
=
strchrW
(
ptr1
,
'#'
);
if
(
ptr2
)
size
+=
strlenW
(
ptr2
);
}
else
{
ptr1
=
This
->
wine_url
+
strlenW
(
This
->
wine_url
);
ptr2
=
NULL
;
size
+=
strlenW
(
This
->
wine_url
);
}
if
(
*
query
)
size
++
;
if
(
!
ensure_uri_builder
(
This
))
return
NS_ERROR_UNEXPECTED
;
new_url
=
heap_alloc
(
size
*
sizeof
(
WCHAR
));
memcpy
(
new_url
,
This
->
wine_url
,
(
ptr1
-
This
->
wine_url
)
*
sizeof
(
WCHAR
));
ptr
=
new_url
+
(
ptr1
-
This
->
wine_url
);
if
(
*
query
)
{
*
ptr
++
=
'?'
;
MultiByteToWideChar
(
CP_ACP
,
0
,
query
,
-
1
,
ptr
,
len
);
ptr
+=
len
-
1
;
}
if
(
ptr2
)
strcpyW
(
ptr
,
ptr2
);
else
*
ptr
=
0
;
nsACString_GetData
(
aQuery
,
&
querya
);
query
=
heap_strdupAtoW
(
querya
);
if
(
!
query
)
return
NS_ERROR_OUT_OF_MEMORY
;
TRACE
(
"setting %s
\n
"
,
debugstr_w
(
new_url
));
hres
=
IUriBuilder_SetQuery
(
This
->
uri_builder
,
query
);
heap_free
(
query
);
if
(
FAILED
(
hres
))
return
NS_ERROR_UNEXPECTED
;
heap_free
(
This
->
wine_url
);
This
->
wine_url
=
new_url
;
sync_wine_url
(
This
);
return
NS_OK
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment