mirror of
https://github.com/reactos/wine.git
synced 2025-02-25 23:35:31 +00:00
msxml3: Optimize bstr_from_xmlChar implementation.
This commit is contained in:
parent
489c1a8d43
commit
7447145d64
@ -59,7 +59,6 @@ xmlNodePtr xmlNodePtr_from_domnode( IXMLDOMNode *iface, xmlElementType type );
|
|||||||
|
|
||||||
/* helpers */
|
/* helpers */
|
||||||
extern xmlChar *xmlChar_from_wchar( LPWSTR str );
|
extern xmlChar *xmlChar_from_wchar( LPWSTR str );
|
||||||
extern BSTR bstr_from_xmlChar( const xmlChar *buf );
|
|
||||||
|
|
||||||
extern LONG xmldoc_add_ref( xmlDocPtr doc );
|
extern LONG xmldoc_add_ref( xmlDocPtr doc );
|
||||||
extern LONG xmldoc_release( xmlDocPtr doc );
|
extern LONG xmldoc_release( xmlDocPtr doc );
|
||||||
@ -87,6 +86,20 @@ static inline xmlnode *impl_from_IXMLDOMNode( IXMLDOMNode *iface )
|
|||||||
|
|
||||||
extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument2 **document);
|
extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument2 **document);
|
||||||
|
|
||||||
|
static inline BSTR bstr_from_xmlChar(const xmlChar *str)
|
||||||
|
{
|
||||||
|
BSTR ret = NULL;
|
||||||
|
|
||||||
|
if(str) {
|
||||||
|
DWORD len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)str, -1, NULL, 0);
|
||||||
|
ret = SysAllocStringLen(NULL, len-1);
|
||||||
|
if(ret)
|
||||||
|
MultiByteToWideChar( CP_UTF8, 0, (LPCSTR)str, -1, ret, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void* libxslt_handle;
|
void* libxslt_handle;
|
||||||
|
@ -247,25 +247,6 @@ static HRESULT WINAPI xmlnode_get_nodeName(
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSTR bstr_from_xmlChar( const xmlChar *buf )
|
|
||||||
{
|
|
||||||
DWORD len;
|
|
||||||
LPWSTR str;
|
|
||||||
BSTR bstr;
|
|
||||||
|
|
||||||
if ( !buf )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
len = MultiByteToWideChar( CP_UTF8, 0, (LPCSTR) buf, -1, NULL, 0 );
|
|
||||||
str = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) );
|
|
||||||
if ( !str )
|
|
||||||
return NULL;
|
|
||||||
MultiByteToWideChar( CP_UTF8, 0, (LPCSTR) buf, -1, str, len );
|
|
||||||
bstr = SysAllocString( str );
|
|
||||||
HeapFree( GetProcessHeap(), 0, str );
|
|
||||||
return bstr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI xmlnode_get_nodeValue(
|
static HRESULT WINAPI xmlnode_get_nodeValue(
|
||||||
IXMLDOMNode *iface,
|
IXMLDOMNode *iface,
|
||||||
VARIANT* value)
|
VARIANT* value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user