Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b32ed46b
Commit
b32ed46b
authored
Jun 23, 2011
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
Jul 14, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite: Implement CreateXmlWriter.
parent
70730f91
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
504 additions
and
2 deletions
+504
-2
Makefile.in
dlls/xmllite/Makefile.in
+1
-0
Makefile.in
dlls/xmllite/tests/Makefile.in
+2
-1
writer.c
dlls/xmllite/tests/writer.c
+87
-0
writer.c
dlls/xmllite/writer.c
+413
-0
xmllite.spec
dlls/xmllite/xmllite.spec
+1
-1
No files found.
dlls/xmllite/Makefile.in
View file @
b32ed46b
...
...
@@ -2,6 +2,7 @@ MODULE = xmllite.dll
C_SRCS
=
\
reader.c
\
writer.c
\
xmllite_main.c
@MAKE_DLL_RULES@
dlls/xmllite/tests/Makefile.in
View file @
b32ed46b
...
...
@@ -2,6 +2,7 @@ TESTDLL = xmllite.dll
IMPORTS
=
ole32
C_SRCS
=
\
reader.c
reader.c
\
writer.c
@MAKE_TEST_RULES@
dlls/xmllite/tests/writer.c
0 → 100644
View file @
b32ed46b
/*
* XMLLite IXmlWriter tests
*
* Copyright 2011 (C) Alistair Leslie-Hughes
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "ole2.h"
#include "xmllite.h"
#include "wine/test.h"
static
HRESULT
WINAPI
(
*
pCreateXmlWriter
)(
REFIID
riid
,
void
**
ppvObject
,
IMalloc
*
pMalloc
);
static
void
test_writer_create
(
void
)
{
HRESULT
hr
;
IXmlWriter
*
writer
;
/* crashes native */
if
(
0
)
{
pCreateXmlWriter
(
&
IID_IXmlWriter
,
NULL
,
NULL
);
pCreateXmlWriter
(
NULL
,
(
LPVOID
*
)
&
writer
,
NULL
);
}
hr
=
pCreateXmlWriter
(
&
IID_IXmlWriter
,
(
LPVOID
*
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
IXmlWriter_Release
(
writer
);
}
}
static
BOOL
init_pointers
(
void
)
{
/* don't free module here, it's to be unloaded on exit */
HMODULE
mod
=
LoadLibraryA
(
"xmllite.dll"
);
if
(
!
mod
)
{
win_skip
(
"xmllite library not available
\n
"
);
return
FALSE
;
}
#define MAKEFUNC(f) if (!(p##f = (void*)GetProcAddress(mod, #f))) return FALSE;
MAKEFUNC
(
CreateXmlWriter
);
#undef MAKEFUNC
return
TRUE
;
}
START_TEST
(
writer
)
{
HRESULT
r
;
r
=
CoInitialize
(
NULL
);
ok
(
r
==
S_OK
,
"failed to init com
\n
"
);
if
(
!
init_pointers
())
{
CoUninitialize
();
return
;
}
test_writer_create
();
CoUninitialize
();
}
dlls/xmllite/writer.c
0 → 100644
View file @
b32ed46b
/*
* IXmlWriter implementation
*
* Copyright 2011 Alistair Leslie-Hughes
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "xmllite.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
xmllite
);
typedef
struct
_xmlwriter
{
IXmlWriter
IXmlWriter_iface
;
LONG
ref
;
}
xmlwriter
;
static
inline
xmlwriter
*
impl_from_IXmlWriter
(
IXmlWriter
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
xmlwriter
,
IXmlWriter_iface
);
}
static
HRESULT
WINAPI
xmlwriter_QueryInterface
(
IXmlWriter
*
iface
,
REFIID
riid
,
void
**
ppvObject
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
TRACE
(
"%p %s %p
\n
"
,
This
,
debugstr_guid
(
riid
),
ppvObject
);
if
(
IsEqualGUID
(
riid
,
&
IID_IUnknown
)
||
IsEqualGUID
(
riid
,
&
IID_IXmlWriter
))
{
*
ppvObject
=
iface
;
}
IXmlWriter_AddRef
(
iface
);
return
S_OK
;
}
static
ULONG
WINAPI
xmlwriter_AddRef
(
IXmlWriter
*
iface
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
TRACE
(
"%p
\n
"
,
This
);
return
InterlockedIncrement
(
&
This
->
ref
);
}
static
ULONG
WINAPI
xmlwriter_Release
(
IXmlWriter
*
iface
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
LONG
ref
;
TRACE
(
"%p
\n
"
,
This
);
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
ref
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
ref
;
}
/*** IXmlWriter methods ***/
static
HRESULT
WINAPI
xmlwriter_SetOutput
(
IXmlWriter
*
iface
,
IUnknown
*
pOutput
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %p
\n
"
,
This
,
pOutput
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_GetProperty
(
IXmlWriter
*
iface
,
UINT
nProperty
,
LONG_PTR
*
ppValue
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %u %p
\n
"
,
This
,
nProperty
,
ppValue
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_SetProperty
(
IXmlWriter
*
iface
,
UINT
nProperty
,
LONG_PTR
pValue
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %u %lu
\n
"
,
This
,
nProperty
,
pValue
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteAttributes
(
IXmlWriter
*
iface
,
IXmlReader
*
pReader
,
BOOL
fWriteDefaultAttributes
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %p %d
\n
"
,
This
,
pReader
,
fWriteDefaultAttributes
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteAttributeString
(
IXmlWriter
*
iface
,
LPCWSTR
pwszPrefix
,
LPCWSTR
pwszLocalName
,
LPCWSTR
pwszNamespaceUri
,
LPCWSTR
pwszValue
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %s %s %s %s
\n
"
,
This
,
wine_dbgstr_w
(
pwszPrefix
),
wine_dbgstr_w
(
pwszLocalName
),
wine_dbgstr_w
(
pwszNamespaceUri
),
wine_dbgstr_w
(
pwszValue
));
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteCData
(
IXmlWriter
*
iface
,
LPCWSTR
pwszText
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %s
\n
"
,
This
,
wine_dbgstr_w
(
pwszText
));
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteCharEntity
(
IXmlWriter
*
iface
,
WCHAR
wch
)
{
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteChars
(
IXmlWriter
*
iface
,
const
WCHAR
*
pwch
,
UINT
cwch
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %s %d
\n
"
,
This
,
wine_dbgstr_w
(
pwch
),
cwch
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteComment
(
IXmlWriter
*
iface
,
LPCWSTR
pwszComment
)
{
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteDocType
(
IXmlWriter
*
iface
,
LPCWSTR
pwszName
,
LPCWSTR
pwszPublicId
,
LPCWSTR
pwszSystemId
,
LPCWSTR
pwszSubset
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %s %s %s %s
\n
"
,
This
,
wine_dbgstr_w
(
pwszName
),
wine_dbgstr_w
(
pwszPublicId
),
wine_dbgstr_w
(
pwszSystemId
),
wine_dbgstr_w
(
pwszSubset
));
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteElementString
(
IXmlWriter
*
iface
,
LPCWSTR
pwszPrefix
,
LPCWSTR
pwszLocalName
,
LPCWSTR
pwszNamespaceUri
,
LPCWSTR
pwszValue
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %s %s %s %s
\n
"
,
This
,
wine_dbgstr_w
(
pwszPrefix
),
wine_dbgstr_w
(
pwszLocalName
),
wine_dbgstr_w
(
pwszNamespaceUri
),
wine_dbgstr_w
(
pwszValue
));
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteEndDocument
(
IXmlWriter
*
iface
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p
\n
"
,
This
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteEndElement
(
IXmlWriter
*
iface
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p
\n
"
,
This
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteEntityRef
(
IXmlWriter
*
iface
,
LPCWSTR
pwszName
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %s
\n
"
,
This
,
wine_dbgstr_w
(
pwszName
));
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteFullEndElement
(
IXmlWriter
*
iface
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p
\n
"
,
This
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteName
(
IXmlWriter
*
iface
,
LPCWSTR
pwszName
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %s
\n
"
,
This
,
wine_dbgstr_w
(
pwszName
));
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteNmToken
(
IXmlWriter
*
iface
,
LPCWSTR
pwszNmToken
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %s
\n
"
,
This
,
wine_dbgstr_w
(
pwszNmToken
));
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteNode
(
IXmlWriter
*
iface
,
IXmlReader
*
pReader
,
BOOL
fWriteDefaultAttributes
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %p %d
\n
"
,
This
,
pReader
,
fWriteDefaultAttributes
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteNodeShallow
(
IXmlWriter
*
iface
,
IXmlReader
*
pReader
,
BOOL
fWriteDefaultAttributes
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %p %d
\n
"
,
This
,
pReader
,
fWriteDefaultAttributes
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteProcessingInstruction
(
IXmlWriter
*
iface
,
LPCWSTR
pwszName
,
LPCWSTR
pwszText
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %s %s
\n
"
,
This
,
wine_dbgstr_w
(
pwszName
),
wine_dbgstr_w
(
pwszText
));
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteQualifiedName
(
IXmlWriter
*
iface
,
LPCWSTR
pwszLocalName
,
LPCWSTR
pwszNamespaceUri
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %s %s
\n
"
,
This
,
wine_dbgstr_w
(
pwszLocalName
),
wine_dbgstr_w
(
pwszNamespaceUri
));
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteRaw
(
IXmlWriter
*
iface
,
LPCWSTR
pwszData
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %s
\n
"
,
This
,
wine_dbgstr_w
(
pwszData
));
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteRawChars
(
IXmlWriter
*
iface
,
const
WCHAR
*
pwch
,
UINT
cwch
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %s %d
\n
"
,
This
,
wine_dbgstr_w
(
pwch
),
cwch
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteStartDocument
(
IXmlWriter
*
iface
,
XmlStandalone
standalone
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p
\n
"
,
This
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteStartElement
(
IXmlWriter
*
iface
,
LPCWSTR
pwszPrefix
,
LPCWSTR
pwszLocalName
,
LPCWSTR
pwszNamespaceUri
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %s %s %s
\n
"
,
This
,
wine_dbgstr_w
(
pwszPrefix
),
wine_dbgstr_w
(
pwszLocalName
),
wine_dbgstr_w
(
pwszNamespaceUri
));
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteString
(
IXmlWriter
*
iface
,
LPCWSTR
pwszText
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %s
\n
"
,
This
,
wine_dbgstr_w
(
pwszText
));
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteSurrogateCharEntity
(
IXmlWriter
*
iface
,
WCHAR
wchLow
,
WCHAR
wchHigh
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %d %d
\n
"
,
This
,
wchLow
,
wchHigh
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_WriteWhitespace
(
IXmlWriter
*
iface
,
LPCWSTR
pwszWhitespace
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p %s
\n
"
,
This
,
wine_dbgstr_w
(
pwszWhitespace
));
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
xmlwriter_Flush
(
IXmlWriter
*
iface
)
{
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
FIXME
(
"%p
\n
"
,
This
);
return
E_NOTIMPL
;
}
static
const
struct
IXmlWriterVtbl
xmlwriter_vtbl
=
{
xmlwriter_QueryInterface
,
xmlwriter_AddRef
,
xmlwriter_Release
,
xmlwriter_SetOutput
,
xmlwriter_GetProperty
,
xmlwriter_SetProperty
,
xmlwriter_WriteAttributes
,
xmlwriter_WriteAttributeString
,
xmlwriter_WriteCData
,
xmlwriter_WriteCharEntity
,
xmlwriter_WriteChars
,
xmlwriter_WriteComment
,
xmlwriter_WriteDocType
,
xmlwriter_WriteElementString
,
xmlwriter_WriteEndDocument
,
xmlwriter_WriteEndElement
,
xmlwriter_WriteEntityRef
,
xmlwriter_WriteFullEndElement
,
xmlwriter_WriteName
,
xmlwriter_WriteNmToken
,
xmlwriter_WriteNode
,
xmlwriter_WriteNodeShallow
,
xmlwriter_WriteProcessingInstruction
,
xmlwriter_WriteQualifiedName
,
xmlwriter_WriteRaw
,
xmlwriter_WriteRawChars
,
xmlwriter_WriteStartDocument
,
xmlwriter_WriteStartElement
,
xmlwriter_WriteString
,
xmlwriter_WriteSurrogateCharEntity
,
xmlwriter_WriteWhitespace
,
xmlwriter_Flush
};
HRESULT
WINAPI
CreateXmlWriter
(
REFIID
riid
,
void
**
pObject
,
IMalloc
*
pMalloc
)
{
xmlwriter
*
writer
;
TRACE
(
"(%s, %p, %p)
\n
"
,
wine_dbgstr_guid
(
riid
),
pObject
,
pMalloc
);
if
(
pMalloc
)
FIXME
(
"custom IMalloc not supported yet
\n
"
);
if
(
!
IsEqualGUID
(
riid
,
&
IID_IXmlWriter
))
{
ERR
(
"Unexpected IID requested -> (%s)
\n
"
,
wine_dbgstr_guid
(
riid
));
return
E_FAIL
;
}
writer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
writer
));
if
(
!
writer
)
return
E_OUTOFMEMORY
;
writer
->
IXmlWriter_iface
.
lpVtbl
=
&
xmlwriter_vtbl
;
writer
->
ref
=
1
;
*
pObject
=
&
writer
->
IXmlWriter_iface
;
TRACE
(
"returning iface %p
\n
"
,
*
pObject
);
return
S_OK
;
}
dlls/xmllite/xmllite.spec
View file @
b32ed46b
@ stdcall CreateXmlReader(ptr ptr ptr)
@ stub CreateXmlReaderInputWithEncodingCodePage
@ stdcall CreateXmlReaderInputWithEncodingName(ptr ptr ptr long ptr ptr)
@ st
ub CreateXmlWriter
@ st
dcall CreateXmlWriter(ptr ptr ptr)
@ stub CreateXmlWriterOutputWithEncodingCodePage
@ stub CreateXmlWriterOutputWithEncodingName
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment