Hi Thomas,
On 9/3/10 1:19 AM, Thomas Mullaly wrote:
dlls/urlmon/tests/uri.c | 22 ++++++++++++- dlls/urlmon/uri.c | 80 ++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 93 insertions(+), 9 deletions(-)
+static HRESULT setup_builder_properties(UriBuilder*builder, const Uri* uri) { + if(uri->fragment_start> -1) { + builder->fragment = heap_alloc((uri->fragment_len+1)*sizeof(WCHAR)); + if(!builder->fragment) + return E_OUTOFMEMORY; + + memcpy(builder->fragment, uri->canon_uri+uri->fragment_start, uri->fragment_len*sizeof(WCHAR)); + builder->fragment[uri->fragment_len] = '\0'; + builder->fragment_len = uri->fragment_len; + } + + return S_OK; +}
I don't think it's a good idea. It should be possible to avoid fetching all URI properties here. You can do it, eg. on demand, when you get a call to GetFragment and the fragment is not everwriten by SetFragment call. Thinking about it, the way these APIs work suggests that Uri object should store null-terminated properties that we could return here, but it may be too far conclusion.
Jacek