From 74a7edd41ba79881c0a54ebf93878d394674ef77 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 24 Aug 2011 13:25:29 +0400 Subject: [PATCH] msxml3: Implement put_version() for MXWriter. --- dlls/msxml3/mxwriter.c | 13 ++++++++++--- dlls/msxml3/tests/saxreader.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/dlls/msxml3/mxwriter.c b/dlls/msxml3/mxwriter.c index b99366e9a72..54b7758218c 100644 --- a/dlls/msxml3/mxwriter.c +++ b/dlls/msxml3/mxwriter.c @@ -1,7 +1,7 @@ /* * MXWriter implementation * - * Copyright 2011 Nikolay Sivov for CodeWeaversы + * Copyright 2011 Nikolay Sivov for CodeWeavers * Copyright 2011 Thomas Mullaly * * This library is free software; you can redistribute it and/or @@ -525,8 +525,15 @@ static HRESULT WINAPI mxwriter_get_omitXMLDeclaration(IMXWriter *iface, VARIANT_ static HRESULT WINAPI mxwriter_put_version(IMXWriter *iface, BSTR version) { mxwriter *This = impl_from_IMXWriter( iface ); - FIXME("(%p)->(%s)\n", This, debugstr_w(version)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_w(version)); + + if (!version) return E_INVALIDARG; + + SysFreeString(This->version); + This->version = SysAllocString(version); + + return S_OK; } static HRESULT WINAPI mxwriter_get_version(IMXWriter *iface, BSTR *version) diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c index 53ce8dca465..cc123ff43ea 100644 --- a/dlls/msxml3/tests/saxreader.c +++ b/dlls/msxml3/tests/saxreader.c @@ -1191,6 +1191,34 @@ static void test_mxwriter_properties(void) ok(!lstrcmpW(str, _bstr_("1.0")), "got %s\n", wine_dbgstr_w(str)); SysFreeString(str); + /* store version string as is */ + hr = IMXWriter_put_version(writer, NULL); + ok(hr == E_INVALIDARG, "got %08x\n", hr); + + hr = IMXWriter_put_version(writer, _bstr_("1.0")); + ok(hr == S_OK, "got %08x\n", hr); + + hr = IMXWriter_put_version(writer, _bstr_("")); + ok(hr == S_OK, "got %08x\n", hr); + hr = IMXWriter_get_version(writer, &str); + ok(hr == S_OK, "got %08x\n", hr); + ok(!lstrcmpW(str, _bstr_("")), "got %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + + hr = IMXWriter_put_version(writer, _bstr_("a.b")); + ok(hr == S_OK, "got %08x\n", hr); + hr = IMXWriter_get_version(writer, &str); + ok(hr == S_OK, "got %08x\n", hr); + ok(!lstrcmpW(str, _bstr_("a.b")), "got %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + + hr = IMXWriter_put_version(writer, _bstr_("2.0")); + ok(hr == S_OK, "got %08x\n", hr); + hr = IMXWriter_get_version(writer, &str); + ok(hr == S_OK, "got %08x\n", hr); + ok(!lstrcmpW(str, _bstr_("2.0")), "got %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + IMXWriter_Release(writer); free_bstrs(); } -- 2.11.4.GIT