Hans Leidekker : webservices: Implement WsSetWriterPosition.
Alexandre Julliard
julliard at winehq.org
Tue Jun 21 11:13:48 CDT 2016
Module: wine
Branch: master
Commit: 511c21d30977cb15c03bd193a7aa2fb3982a6c5e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=511c21d30977cb15c03bd193a7aa2fb3982a6c5e
Author: Hans Leidekker <hans at codeweavers.com>
Date: Tue Jun 21 14:04:48 2016 +0200
webservices: Implement WsSetWriterPosition.
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/webservices/tests/writer.c | 48 +++++++++++++++++++++++++++++++++++++++
dlls/webservices/webservices.spec | 2 +-
dlls/webservices/writer.c | 17 ++++++++++++++
3 files changed, 66 insertions(+), 1 deletion(-)
diff --git a/dlls/webservices/tests/writer.c b/dlls/webservices/tests/writer.c
index f425664..5314bc8 100644
--- a/dlls/webservices/tests/writer.c
+++ b/dlls/webservices/tests/writer.c
@@ -1532,6 +1532,53 @@ static void test_WsGetWriterPosition(void)
WsFreeHeap( heap );
}
+static void test_WsSetWriterPosition(void)
+{
+ WS_HEAP *heap;
+ WS_XML_WRITER *writer;
+ WS_XML_BUFFER *buf1, *buf2;
+ WS_XML_NODE_POSITION pos;
+ HRESULT hr;
+
+ hr = WsCreateHeap( 1 << 16, 0, NULL, 0, &heap, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ hr = WsSetWriterPosition( NULL, NULL, NULL );
+ ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+ hr = WsCreateWriter( NULL, 0, &writer, NULL ) ;
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ hr = WsCreateXmlBuffer( heap, NULL, 0, &buf1, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ hr = WsSetOutputToBuffer( writer, buf1, NULL, 0, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ hr = WsSetWriterPosition( writer, NULL, NULL );
+ ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+ pos.buffer = pos.node = NULL;
+ hr = WsGetWriterPosition( writer, &pos, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( pos.buffer == buf1, "wrong buffer\n" );
+ ok( pos.node != NULL, "node not set\n" );
+
+ hr = WsSetWriterPosition( writer, &pos, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ /* different buffer */
+ hr = WsCreateXmlBuffer( heap, NULL, 0, &buf2, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ pos.buffer = buf2;
+ hr = WsSetWriterPosition( writer, &pos, NULL );
+ ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+ WsFreeWriter( writer );
+ WsFreeHeap( heap );
+}
+
START_TEST(writer)
{
test_WsCreateWriter();
@@ -1552,4 +1599,5 @@ START_TEST(writer)
test_complex_struct_type();
test_WsMoveWriter();
test_WsGetWriterPosition();
+ test_WsSetWriterPosition();
}
diff --git a/dlls/webservices/webservices.spec b/dlls/webservices/webservices.spec
index 618d6ee..3a69302 100644
--- a/dlls/webservices/webservices.spec
+++ b/dlls/webservices/webservices.spec
@@ -157,7 +157,7 @@
@ stdcall WsSetOutput(ptr ptr ptr ptr long ptr)
@ stdcall WsSetOutputToBuffer(ptr ptr ptr long ptr)
@ stub WsSetReaderPosition
-@ stub WsSetWriterPosition
+@ stdcall WsSetWriterPosition(ptr ptr ptr)
@ stub WsShutdownSessionChannel
@ stub WsSkipNode
@ stub WsStartReaderCanonicalization
diff --git a/dlls/webservices/writer.c b/dlls/webservices/writer.c
index f9c9ca9..8c9e202 100644
--- a/dlls/webservices/writer.c
+++ b/dlls/webservices/writer.c
@@ -1819,3 +1819,20 @@ HRESULT WINAPI WsGetWriterPosition( WS_XML_WRITER *handle, WS_XML_NODE_POSITION
pos->node = writer->current;
return S_OK;
}
+
+/**************************************************************************
+ * WsSetWriterPosition [webservices.@]
+ */
+HRESULT WINAPI WsSetWriterPosition( WS_XML_WRITER *handle, const WS_XML_NODE_POSITION *pos, WS_ERROR *error )
+{
+ struct writer *writer = (struct writer *)handle;
+
+ TRACE( "%p %p %p\n", handle, pos, error );
+ if (error) FIXME( "ignoring error parameter\n" );
+
+ if (!writer || !pos || (struct xmlbuf *)pos->buffer != writer->output_buf) return E_INVALIDARG;
+ if (!writer->output_type) return WS_E_INVALID_OPERATION;
+
+ writer->current = pos->node;
+ return S_OK;
+}
More information about the wine-cvs
mailing list