mshtml: Moved conversion to unicode of buffers from binding to navigate.c.
This commit is contained in:
parent
f011ccedea
commit
73984d4da8
|
@ -113,3 +113,5 @@ HRESULT channelbsc_load_stream(HTMLInnerWindow*,IStream*) DECLSPEC_HIDDEN;
|
||||||
void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*) DECLSPEC_HIDDEN;
|
void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*) DECLSPEC_HIDDEN;
|
||||||
IUri *nsuri_get_uri(nsWineURI*) DECLSPEC_HIDDEN;
|
IUri *nsuri_get_uri(nsWineURI*) DECLSPEC_HIDDEN;
|
||||||
HRESULT create_relative_uri(HTMLOuterWindow*,const WCHAR*,IUri**) 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 set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
|
||||||
void call_docview_84(HTMLDocumentObj*) 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;
|
void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
|
HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -772,7 +772,7 @@ typedef struct {
|
||||||
BSCallback bsc;
|
BSCallback bsc;
|
||||||
|
|
||||||
DWORD size;
|
DWORD size;
|
||||||
BYTE *buf;
|
char *buf;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
} BufferBSC;
|
} BufferBSC;
|
||||||
|
|
||||||
|
@ -875,27 +875,35 @@ static BufferBSC *create_bufferbsc(IMoniker *mon)
|
||||||
return ret;
|
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);
|
BufferBSC *bsc = create_bufferbsc(mon);
|
||||||
|
WCHAR *text;
|
||||||
|
DWORD len;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
*buf = NULL;
|
|
||||||
|
|
||||||
hres = start_binding(window, &bsc->bsc, NULL);
|
hres = start_binding(window, &bsc->bsc, NULL);
|
||||||
if(SUCCEEDED(hres)) {
|
if(SUCCEEDED(hres))
|
||||||
hres = bsc->hres;
|
hres = bsc->hres;
|
||||||
if(SUCCEEDED(hres)) {
|
if(FAILED(hres)) {
|
||||||
*buf = bsc->buf;
|
IBindStatusCallback_Release(&bsc->bsc.IBindStatusCallback_iface);
|
||||||
bsc->buf = NULL;
|
return hres;
|
||||||
*size = bsc->bsc.readed;
|
|
||||||
bsc->size = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
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)
|
static HRESULT read_post_data_stream(nsChannelBSC *This, nsChannel *nschannel)
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
|
||||||
#include "mshtml_private.h"
|
#include "mshtml_private.h"
|
||||||
|
#include "binding.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
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)
|
static void parse_extern_script(ScriptHost *script_host, LPCWSTR src)
|
||||||
{
|
{
|
||||||
IMoniker *mon;
|
IMoniker *mon;
|
||||||
char *buf;
|
|
||||||
WCHAR *text;
|
WCHAR *text;
|
||||||
DWORD len, size=0;
|
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
static const WCHAR wine_schemaW[] = {'w','i','n','e',':'};
|
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))
|
if(FAILED(hres))
|
||||||
return;
|
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);
|
IMoniker_Release(mon);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return;
|
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);
|
parse_text(script_host, text);
|
||||||
|
|
||||||
heap_free(text);
|
heap_free(text);
|
||||||
|
|
Loading…
Reference in New Issue