webservices: Implement WsCreateXmlBuffer.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e7d44ee61e
commit
096348607b
|
@ -158,6 +158,18 @@ struct heap
|
||||||
WS_HEAP_PROPERTY prop[sizeof(heap_props)/sizeof(heap_props[0])];
|
WS_HEAP_PROPERTY prop[sizeof(heap_props)/sizeof(heap_props[0])];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void *ws_alloc( WS_HEAP *handle, SIZE_T size )
|
||||||
|
{
|
||||||
|
struct heap *heap = (struct heap *)handle;
|
||||||
|
return HeapAlloc( heap->handle, 0, size );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ws_free( WS_HEAP *handle, void *ptr )
|
||||||
|
{
|
||||||
|
struct heap *heap = (struct heap *)handle;
|
||||||
|
HeapFree( heap->handle, 0, ptr );
|
||||||
|
}
|
||||||
|
|
||||||
static struct heap *alloc_heap(void)
|
static struct heap *alloc_heap(void)
|
||||||
{
|
{
|
||||||
static const ULONG count = sizeof(heap_props)/sizeof(heap_props[0]);
|
static const ULONG count = sizeof(heap_props)/sizeof(heap_props[0]);
|
||||||
|
@ -1103,12 +1115,6 @@ HRESULT WINAPI WsReadToStartElement( WS_XML_READER *handle, const WS_XML_STRING
|
||||||
return read_to_startelement( reader, found );
|
return read_to_startelement( reader, found );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *read_alloc( WS_HEAP *handle, SIZE_T size )
|
|
||||||
{
|
|
||||||
struct heap *heap = (struct heap *)handle;
|
|
||||||
return HeapAlloc( heap->handle, 0, size );
|
|
||||||
}
|
|
||||||
|
|
||||||
static WCHAR *xmltext_to_widechar( WS_HEAP *heap, const WS_XML_TEXT *text )
|
static WCHAR *xmltext_to_widechar( WS_HEAP *heap, const WS_XML_TEXT *text )
|
||||||
{
|
{
|
||||||
WCHAR *ret;
|
WCHAR *ret;
|
||||||
|
@ -1119,7 +1125,7 @@ static WCHAR *xmltext_to_widechar( WS_HEAP *heap, const WS_XML_TEXT *text )
|
||||||
{
|
{
|
||||||
const WS_XML_UTF8_TEXT *utf8 = (const WS_XML_UTF8_TEXT *)text;
|
const WS_XML_UTF8_TEXT *utf8 = (const WS_XML_UTF8_TEXT *)text;
|
||||||
int len = MultiByteToWideChar( CP_UTF8, 0, (char *)utf8->value.bytes, utf8->value.length, NULL, 0 );
|
int len = MultiByteToWideChar( CP_UTF8, 0, (char *)utf8->value.bytes, utf8->value.length, NULL, 0 );
|
||||||
if (!(ret = read_alloc( heap, (len + 1) * sizeof(WCHAR) ))) return NULL;
|
if (!(ret = ws_alloc( heap, (len + 1) * sizeof(WCHAR) ))) return NULL;
|
||||||
MultiByteToWideChar( CP_UTF8, 0, (char *)utf8->value.bytes, utf8->value.length, ret, len );
|
MultiByteToWideChar( CP_UTF8, 0, (char *)utf8->value.bytes, utf8->value.length, ret, len );
|
||||||
ret[len] = 0;
|
ret[len] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
@ stub WsCreateServiceProxy
|
@ stub WsCreateServiceProxy
|
||||||
@ stub WsCreateServiceProxyFromTemplate
|
@ stub WsCreateServiceProxyFromTemplate
|
||||||
@ stdcall WsCreateWriter(ptr long ptr ptr)
|
@ stdcall WsCreateWriter(ptr long ptr ptr)
|
||||||
@ stub WsCreateXmlBuffer
|
@ stdcall WsCreateXmlBuffer(ptr ptr long ptr ptr)
|
||||||
@ stub WsCreateXmlSecurityToken
|
@ stub WsCreateXmlSecurityToken
|
||||||
@ stub WsDateTimeToFileTime
|
@ stub WsDateTimeToFileTime
|
||||||
@ stub WsDecodeUrl
|
@ stub WsDecodeUrl
|
||||||
|
|
|
@ -16,6 +16,17 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
struct xmlbuf
|
||||||
|
{
|
||||||
|
WS_HEAP *heap;
|
||||||
|
void *ptr;
|
||||||
|
SIZE_T size_allocated;
|
||||||
|
SIZE_T size;
|
||||||
|
};
|
||||||
|
|
||||||
|
void *ws_alloc( WS_HEAP *, SIZE_T ) DECLSPEC_HIDDEN;
|
||||||
|
void ws_free( WS_HEAP *, void * ) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
static inline void *heap_alloc( SIZE_T size )
|
static inline void *heap_alloc( SIZE_T size )
|
||||||
{
|
{
|
||||||
return HeapAlloc( GetProcessHeap(), 0, size );
|
return HeapAlloc( GetProcessHeap(), 0, size );
|
||||||
|
|
|
@ -152,6 +152,40 @@ void WINAPI WsFreeWriter( WS_XML_WRITER *handle )
|
||||||
heap_free( writer );
|
heap_free( writer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define XML_BUFFER_INITIAL_ALLOCATED_SIZE 256
|
||||||
|
static struct xmlbuf *alloc_xmlbuf( WS_HEAP *heap )
|
||||||
|
{
|
||||||
|
struct xmlbuf *ret;
|
||||||
|
|
||||||
|
if (!(ret = ws_alloc( heap, sizeof(*ret) ))) return NULL;
|
||||||
|
if (!(ret->ptr = ws_alloc( heap, XML_BUFFER_INITIAL_ALLOCATED_SIZE )))
|
||||||
|
{
|
||||||
|
ws_free( heap, ret );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
ret->heap = heap;
|
||||||
|
ret->size_allocated = XML_BUFFER_INITIAL_ALLOCATED_SIZE;
|
||||||
|
ret->size = 0;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* WsCreateXmlBuffer [webservices.@]
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI WsCreateXmlBuffer( WS_HEAP *heap, const WS_XML_BUFFER_PROPERTY *properties,
|
||||||
|
ULONG count, WS_XML_BUFFER **handle, WS_ERROR *error )
|
||||||
|
{
|
||||||
|
struct xmlbuf *xmlbuf;
|
||||||
|
|
||||||
|
if (!heap || !handle) return E_INVALIDARG;
|
||||||
|
if (count) FIXME( "properties not implemented\n" );
|
||||||
|
|
||||||
|
if (!(xmlbuf = alloc_xmlbuf( heap ))) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
*handle = (WS_XML_BUFFER *)xmlbuf;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* WsGetWriterProperty [webservices.@]
|
* WsGetWriterProperty [webservices.@]
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue