Hans Leidekker : webservices: Implement WsAlloc.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Nov 10 10:36:21 CST 2015


Module: wine
Branch: master
Commit: e3859dffad37240f8498a20689745b37f7c1c14d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e3859dffad37240f8498a20689745b37f7c1c14d

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Tue Nov 10 10:46:37 2015 +0100

webservices: Implement WsAlloc.

Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/webservices/reader.c         | 17 +++++++++++++++++
 dlls/webservices/tests/reader.c   | 27 +++++++++++++++++++++++++++
 dlls/webservices/webservices.spec |  2 +-
 include/webservices.h             |  1 +
 4 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c
index 48b9c01..96a3dc3 100644
--- a/dlls/webservices/reader.c
+++ b/dlls/webservices/reader.c
@@ -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]);
diff --git a/dlls/webservices/tests/reader.c b/dlls/webservices/tests/reader.c
index 1f9558c..dab57f1 100644
--- a/dlls/webservices/tests/reader.c
+++ b/dlls/webservices/tests/reader.c
@@ -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();
 }
diff --git a/dlls/webservices/webservices.spec b/dlls/webservices/webservices.spec
index 3378ea9..1f0bfdc 100644
--- a/dlls/webservices/webservices.spec
+++ b/dlls/webservices/webservices.spec
@@ -9,7 +9,7 @@
 @ stub WsAddErrorString
 @ stub WsAddMappedHeader
 @ stub WsAddressMessage
-@ stub WsAlloc
+@ stdcall WsAlloc(ptr long ptr ptr)
 @ stub WsAsyncExecute
 @ stub WsCall
 @ stub WsCheckMustUnderstandHeaders
diff --git a/include/webservices.h b/include/webservices.h
index 0ebb6c4..594a6ba 100644
--- a/include/webservices.h
+++ b/include/webservices.h
@@ -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*);




More information about the wine-cvs mailing list