webservices: Implement WsAlloc.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ff990d3426
commit
e3859dffad
|
@ -170,6 +170,23 @@ void ws_free( WS_HEAP *handle, void *ptr )
|
|||
HeapFree( heap->handle, 0, ptr );
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* WsAlloc [webservices.@]
|
||||
*/
|
||||
HRESULT WINAPI WsAlloc( WS_HEAP *handle, SIZE_T size, void **ptr, WS_ERROR *error )
|
||||
{
|
||||
void *mem;
|
||||
|
||||
TRACE( "%p %u %p %p\n", handle, (ULONG)size, ptr, error );
|
||||
if (error) FIXME( "ignoring error parameter\n" );
|
||||
|
||||
if (!handle || !ptr) return E_INVALIDARG;
|
||||
|
||||
if (!(mem = ws_alloc( handle, size ))) return E_OUTOFMEMORY;
|
||||
*ptr = mem;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static struct heap *alloc_heap(void)
|
||||
{
|
||||
static const ULONG count = sizeof(heap_props)/sizeof(heap_props[0]);
|
||||
|
|
|
@ -1453,6 +1453,32 @@ static void test_WsXmlStringEquals(void)
|
|||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
}
|
||||
|
||||
static void test_WsAlloc(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
WS_HEAP *heap;
|
||||
void *ptr;
|
||||
|
||||
hr = WsCreateHeap( 256, 0, NULL, 0, &heap, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
ptr = NULL;
|
||||
hr = WsAlloc( NULL, 16, &ptr, NULL );
|
||||
ok( hr == E_INVALIDARG, "got %08x\n", hr );
|
||||
ok( ptr == NULL, "ptr set\n" );
|
||||
|
||||
ptr = NULL;
|
||||
hr = WsAlloc( heap, 512, &ptr, NULL );
|
||||
todo_wine ok( hr == WS_E_QUOTA_EXCEEDED, "got %08x\n", hr );
|
||||
todo_wine ok( ptr == NULL, "ptr not set\n" );
|
||||
|
||||
ptr = NULL;
|
||||
hr = WsAlloc( heap, 16, &ptr, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( ptr != NULL, "ptr not set\n" );
|
||||
WsFreeHeap( heap );
|
||||
}
|
||||
|
||||
START_TEST(reader)
|
||||
{
|
||||
test_WsCreateError();
|
||||
|
@ -1468,4 +1494,5 @@ START_TEST(reader)
|
|||
test_WsReadType();
|
||||
test_WsGetXmlAttribute();
|
||||
test_WsXmlStringEquals();
|
||||
test_WsAlloc();
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
@ stub WsAddErrorString
|
||||
@ stub WsAddMappedHeader
|
||||
@ stub WsAddressMessage
|
||||
@ stub WsAlloc
|
||||
@ stdcall WsAlloc(ptr long ptr ptr)
|
||||
@ stub WsAsyncExecute
|
||||
@ stub WsCall
|
||||
@ stub WsCheckMustUnderstandHeaders
|
||||
|
|
|
@ -464,6 +464,7 @@ typedef struct _WS_XML_NODE_POSITION {
|
|||
void *node;
|
||||
} WS_XML_NODE_POSITION;
|
||||
|
||||
HRESULT WINAPI WsAlloc(WS_HEAP*, SIZE_T, void**, WS_ERROR*);
|
||||
HRESULT WINAPI WsCreateError(const WS_ERROR_PROPERTY*, ULONG, WS_ERROR**);
|
||||
HRESULT WINAPI WsCreateHeap(SIZE_T, SIZE_T, const WS_HEAP_PROPERTY*, ULONG, WS_HEAP**, WS_ERROR*);
|
||||
HRESULT WINAPI WsCreateReader(const WS_XML_READER_PROPERTY*, ULONG, WS_XML_READER**, WS_ERROR*);
|
||||
|
|
Loading…
Reference in New Issue