Commit 73984d4d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Moved conversion to unicode of buffers from binding to navigate.c.

parent f011cced
......@@ -113,3 +113,5 @@ HRESULT channelbsc_load_stream(HTMLInnerWindow*,IStream*) DECLSPEC_HIDDEN;
void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*) DECLSPEC_HIDDEN;
IUri *nsuri_get_uri(nsWineURI*) DECLSPEC_HIDDEN;
HRESULT create_relative_uri(HTMLOuterWindow*,const WCHAR*,IUri**) DECLSPEC_HIDDEN;
HRESULT bind_mon_to_wstr(HTMLInnerWindow*,IMoniker*,WCHAR**) DECLSPEC_HIDDEN;
......@@ -801,8 +801,6 @@ void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
HRESULT bind_mon_to_buffer(HTMLInnerWindow*,IMoniker*,void**,DWORD*) DECLSPEC_HIDDEN;
void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
......
......@@ -772,7 +772,7 @@ typedef struct {
BSCallback bsc;
DWORD size;
BYTE *buf;
char *buf;
HRESULT hres;
} BufferBSC;
......@@ -875,27 +875,35 @@ static BufferBSC *create_bufferbsc(IMoniker *mon)
return ret;
}
HRESULT bind_mon_to_buffer(HTMLInnerWindow *window, IMoniker *mon, void **buf, DWORD *size)
HRESULT bind_mon_to_wstr(HTMLInnerWindow *window, IMoniker *mon, WCHAR **ret)
{
BufferBSC *bsc = create_bufferbsc(mon);
WCHAR *text;
DWORD len;
HRESULT hres;
*buf = NULL;
hres = start_binding(window, &bsc->bsc, NULL);
if(SUCCEEDED(hres)) {
if(SUCCEEDED(hres))
hres = bsc->hres;
if(SUCCEEDED(hres)) {
*buf = bsc->buf;
bsc->buf = NULL;
*size = bsc->bsc.readed;
bsc->size = 0;
}
if(FAILED(hres)) {
IBindStatusCallback_Release(&bsc->bsc.IBindStatusCallback_iface);
return hres;
}
len = MultiByteToWideChar(CP_ACP, 0, bsc->buf, bsc->bsc.readed, NULL, 0);
text = heap_alloc((len+1)*sizeof(WCHAR));
if(text) {
MultiByteToWideChar(CP_ACP, 0, bsc->buf, bsc->bsc.readed, text, len);
text[len] = 0;
}else {
hres = E_OUTOFMEMORY;
}
IBindStatusCallback_Release(&bsc->bsc.IBindStatusCallback_iface);
if(FAILED(hres))
return hres;
return hres;
*ret = text;
return S_OK;
}
static HRESULT read_post_data_stream(nsChannelBSC *This, nsChannel *nschannel)
......
......@@ -32,6 +32,7 @@
#include "wine/debug.h"
#include "mshtml_private.h"
#include "binding.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
......@@ -661,9 +662,7 @@ static void parse_text(ScriptHost *script_host, LPCWSTR text)
static void parse_extern_script(ScriptHost *script_host, LPCWSTR src)
{
IMoniker *mon;
char *buf;
WCHAR *text;
DWORD len, size=0;
HRESULT hres;
static const WCHAR wine_schemaW[] = {'w','i','n','e',':'};
......@@ -675,17 +674,11 @@ static void parse_extern_script(ScriptHost *script_host, LPCWSTR src)
if(FAILED(hres))
return;
hres = bind_mon_to_buffer(script_host->window, mon, (void**)&buf, &size);
hres = bind_mon_to_wstr(script_host->window, mon, &text);
IMoniker_Release(mon);
if(FAILED(hres))
return;
len = MultiByteToWideChar(CP_ACP, 0, buf, size, NULL, 0);
text = heap_alloc((len+1)*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, buf, size, text, len);
heap_free(buf);
text[len] = 0;
parse_text(script_host, text);
heap_free(text);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment