Jacek Caban : mshtml: Moved conversion to unicode of buffers from binding to navigate.c.
Alexandre Julliard
julliard at winehq.org
Fri Jul 27 13:13:55 CDT 2012
Module: wine
Branch: master
Commit: 73984d4da898a6e66e43856437950bee3b20b6b7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=73984d4da898a6e66e43856437950bee3b20b6b7
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Jul 27 10:51:24 2012 +0200
mshtml: Moved conversion to unicode of buffers from binding to navigate.c.
---
dlls/mshtml/binding.h | 2 ++
dlls/mshtml/mshtml_private.h | 2 --
dlls/mshtml/navigate.c | 32 ++++++++++++++++++++------------
dlls/mshtml/script.c | 11 ++---------
4 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/dlls/mshtml/binding.h b/dlls/mshtml/binding.h
index 040fcf2..892a114 100644
--- a/dlls/mshtml/binding.h
+++ b/dlls/mshtml/binding.h
@@ -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;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 91cbbfe..b636685 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -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;
diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c
index b32446e..3827e47 100644
--- a/dlls/mshtml/navigate.c
+++ b/dlls/mshtml/navigate.c
@@ -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)
diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c
index 4c94662..55c7872 100644
--- a/dlls/mshtml/script.c
+++ b/dlls/mshtml/script.c
@@ -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);
More information about the wine-cvs
mailing list