summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-07-10 00:26:10 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-08-18 02:57:42 +0200
commit583e72a8c49d3eee7679056f9b0178002e39f54a (patch)
treed89f822f59c9f32ad9b6cd7e7227181b8c67809c /xmlsecurity
parent34390079fef2c02bc2bf0b1c336759afb49a7477 (diff)
callcatcher: remove unused xmlchar_to_ous
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/xmlsec/saxhelper.cxx126
1 files changed, 48 insertions, 78 deletions
diff --git a/xmlsecurity/source/xmlsec/saxhelper.cxx b/xmlsecurity/source/xmlsec/saxhelper.cxx
index 6b09fea26718..8a8a00b22d24 100644
--- a/xmlsecurity/source/xmlsec/saxhelper.cxx
+++ b/xmlsecurity/source/xmlsec/saxhelper.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -46,7 +46,7 @@ namespace cssxcsax = com::sun::star::xml::csax;
* The return value is NULL terminated. The application has the responsibilty to
* deallocte the return value.
*/
-xmlChar* ous_to_xmlstr( const rtl::OUString& oustr )
+xmlChar* ous_to_xmlstr( const rtl::OUString& oustr )
{
rtl::OString ostr = rtl::OUStringToOString( oustr , RTL_TEXTENCODING_UTF8 ) ;
return xmlStrndup( ( xmlChar* )ostr.getStr(), ( int )ostr.getLength() ) ;
@@ -56,7 +56,7 @@ xmlChar* ous_to_xmlstr( const rtl::OUString& oustr )
* The return value is NULL terminated. The application has the responsibilty to
* deallocte the return value.
*/
-xmlChar* ous_to_nxmlstr( const rtl::OUString& oustr, int& length )
+xmlChar* ous_to_nxmlstr( const rtl::OUString& oustr, int& length )
{
rtl::OString ostr = rtl::OUStringToOString( oustr , RTL_TEXTENCODING_UTF8 ) ;
length = ostr.getLength();
@@ -65,49 +65,19 @@ xmlChar* ous_to_nxmlstr( const rtl::OUString& oustr, int& length )
}
/**
- * The input parameter isn't necessaryly NULL terminated.
- */
-rtl::OUString xmlchar_to_ous( const xmlChar* pChar, int length )
-{
- if( pChar != NULL )
- {
- return rtl::OUString( ( sal_Char* )pChar , length , RTL_TEXTENCODING_UTF8 ) ;
- }
- else
- {
- return rtl::OUString() ;
- }
-}
-
-/**
- * The input parameter is NULL terminated
- */
-rtl::OUString xmlstr_to_ous( const xmlChar* pStr )
-{
- if( pStr != NULL )
- {
- return xmlchar_to_ous( pStr , xmlStrlen( pStr ) ) ;
- }
- else
- {
- return rtl::OUString() ;
- }
-}
-
-/**
* The return value and the referenced value must be NULL terminated.
* The application has the responsibilty to deallocte the return value.
*/
-const xmlChar** attrlist_to_nxmlstr( const cssu::Sequence< cssxcsax::XMLAttribute >& aAttributes )
+const xmlChar** attrlist_to_nxmlstr( const cssu::Sequence< cssxcsax::XMLAttribute >& aAttributes )
{
xmlChar* attname = NULL ;
xmlChar* attvalue = NULL ;
const xmlChar** attrs = NULL ;
rtl::OUString oustr ;
-
+
sal_Int32 nLength = aAttributes.getLength();;
- if( nLength != 0 )
+ if( nLength != 0 )
{
attrs = ( const xmlChar** )xmlMalloc( ( nLength * 2 + 2 ) * sizeof( xmlChar* ) ) ;
}
@@ -116,12 +86,12 @@ const xmlChar** attrlist_to_nxmlstr( const cssu::Sequence< cssxcsax::XMLAttribut
return NULL ;
}
- for( int i = 0 , j = 0 ; j < nLength ; ++j )
+ for( int i = 0 , j = 0 ; j < nLength ; ++j )
{
attname = ous_to_xmlstr( aAttributes[j].sName ) ;
attvalue = ous_to_xmlstr( aAttributes[j].sValue ) ;
- if( attname != NULL && attvalue != NULL )
+ if( attname != NULL && attvalue != NULL )
{
attrs[i++] = attname ;
attrs[i++] = attvalue ;
@@ -152,7 +122,7 @@ SAXHelper::SAXHelper( )
{
xmlInitParser() ;
LIBXML_TEST_VERSION ;
-
+
/*
* compile error:
* xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS ;
@@ -170,27 +140,27 @@ SAXHelper::SAXHelper( )
*
* mmi : re-initialize the SAX handler to version 1
*/
-
+
xmlSAXVersion(m_pParserCtxt->sax, 1);
/* end */
- if( m_pParserCtxt->inputTab[0] != NULL )
+ if( m_pParserCtxt->inputTab[0] != NULL )
{
m_pParserCtxt->inputTab[0] = NULL ;
}
-
- if( m_pParserCtxt == NULL )
+
+ if( m_pParserCtxt == NULL )
{
#ifndef XMLSEC_NO_XSLT
- xsltCleanupGlobals() ;
+ xsltCleanupGlobals() ;
#endif
// see issue i74334, we cannot call xmlCleanupParser when libxml is still used
-// in other parts of the office.
-// xmlCleanupParser() ;
+// in other parts of the office.
+// xmlCleanupParser() ;
throw cssu::RuntimeException() ;
}
- else if( m_pParserCtxt->sax == NULL )
+ else if( m_pParserCtxt->sax == NULL )
{
xmlFreeParserCtxt( m_pParserCtxt ) ;
@@ -198,8 +168,8 @@ SAXHelper::SAXHelper( )
xsltCleanupGlobals() ;
#endif
// see issue i74334, we cannot call xmlCleanupParser when libxml is still used
-// in other parts of the office.
-// xmlCleanupParser() ;
+// in other parts of the office.
+// xmlCleanupParser() ;
m_pParserCtxt = NULL ;
throw cssu::RuntimeException() ;
}
@@ -221,7 +191,7 @@ SAXHelper::SAXHelper( )
* destruct the xml tree.
*/
SAXHelper::~SAXHelper() {
- if( m_pParserCtxt != NULL )
+ if( m_pParserCtxt != NULL )
{
/*
* In the situation that no object refer the Document, this destructor
@@ -236,14 +206,14 @@ SAXHelper::~SAXHelper() {
m_pParserCtxt = NULL ;
}
- if( m_pSaxHandler != NULL )
+ if( m_pSaxHandler != NULL )
{
xmlFree( m_pSaxHandler ) ;
m_pSaxHandler = NULL ;
}
// see issue i74334, we cannot call xmlCleanupParser when libxml is still used
-// in other parts of the office.
-// xmlCleanupParser() ;
+// in other parts of the office.
+// xmlCleanupParser() ;
}
xmlNodePtr SAXHelper::getCurrentNode()
@@ -260,7 +230,7 @@ void SAXHelper::setCurrentNode(const xmlNodePtr pNode)
* node, in order to make compatibility.
*/
m_pParserCtxt->nodeTab[m_pParserCtxt->nodeNr - 1]
- = m_pParserCtxt->node
+ = m_pParserCtxt->node
= pNode;
}
@@ -273,14 +243,14 @@ xmlDocPtr SAXHelper::getDocument()
* XDocumentHandler -- start an xml document
*/
void SAXHelper::startDocument( void )
- throw( cssxs::SAXException , cssu::RuntimeException )
+ throw( cssxs::SAXException , cssu::RuntimeException )
{
/*
* Adjust inputTab
*/
xmlParserInputPtr pInput = xmlNewInputStream( m_pParserCtxt ) ;
- if( m_pParserCtxt->inputTab != NULL && m_pParserCtxt->inputMax != 0 )
+ if( m_pParserCtxt->inputTab != NULL && m_pParserCtxt->inputMax != 0 )
{
m_pParserCtxt->inputTab[0] = pInput ;
m_pParserCtxt->input = pInput ;
@@ -288,7 +258,7 @@ void SAXHelper::startDocument( void )
m_pSaxHandler->startDocument( m_pParserCtxt ) ;
- if( m_pParserCtxt == NULL || m_pParserCtxt->myDoc == NULL )
+ if( m_pParserCtxt == NULL || m_pParserCtxt->myDoc == NULL )
{
throw cssu::RuntimeException() ;
}
@@ -297,8 +267,8 @@ void SAXHelper::startDocument( void )
/**
* XDocumentHandler -- end an xml document
*/
-void SAXHelper::endDocument( void )
- throw( cssxs::SAXException , cssu::RuntimeException )
+void SAXHelper::endDocument( void )
+ throw( cssxs::SAXException , cssu::RuntimeException )
{
m_pSaxHandler->endDocument( m_pParserCtxt ) ;
}
@@ -309,33 +279,33 @@ void SAXHelper::endDocument( void )
void SAXHelper::startElement(
const rtl::OUString& aName,
const cssu::Sequence< cssxcsax::XMLAttribute >& aAttributes )
- throw( cssxs::SAXException , cssu::RuntimeException )
+ throw( cssxs::SAXException , cssu::RuntimeException )
{
const xmlChar* fullName = NULL ;
const xmlChar** attrs = NULL ;
fullName = ous_to_xmlstr( aName ) ;
attrs = attrlist_to_nxmlstr( aAttributes ) ;
-
+
if( fullName != NULL || attrs != NULL )
{
m_pSaxHandler->startElement( m_pParserCtxt , fullName , attrs ) ;
}
- if( fullName != NULL )
+ if( fullName != NULL )
{
xmlFree( ( xmlChar* )fullName ) ;
fullName = NULL ;
}
-
- if( attrs != NULL )
+
+ if( attrs != NULL )
{
- for( int i = 0 ; attrs[i] != NULL ; ++i )
+ for( int i = 0 ; attrs[i] != NULL ; ++i )
{
xmlFree( ( xmlChar* )attrs[i] ) ;
attrs[i] = NULL ;
}
-
+
xmlFree( ( void* ) attrs ) ;
attrs = NULL ;
}
@@ -345,14 +315,14 @@ void SAXHelper::startElement(
* XDocumentHandler -- end an xml element
*/
void SAXHelper::endElement( const rtl::OUString& aName )
- throw( cssxs::SAXException , cssu::RuntimeException )
+ throw( cssxs::SAXException , cssu::RuntimeException )
{
xmlChar* fullname = NULL ;
fullname = ous_to_xmlstr( aName ) ;
m_pSaxHandler->endElement( m_pParserCtxt , fullname ) ;
- if( fullname != NULL )
+ if( fullname != NULL )
{
xmlFree( ( xmlChar* )fullname ) ;
fullname = NULL ;
@@ -363,7 +333,7 @@ void SAXHelper::endElement( const rtl::OUString& aName )
* XDocumentHandler -- an xml element or cdata characters
*/
void SAXHelper::characters( const rtl::OUString& aChars )
- throw( cssxs::SAXException , cssu::RuntimeException )
+ throw( cssxs::SAXException , cssu::RuntimeException )
{
const xmlChar* chars = NULL ;
int length = 0 ;
@@ -371,7 +341,7 @@ void SAXHelper::characters( const rtl::OUString& aChars )
chars = ous_to_nxmlstr( aChars, length ) ;
m_pSaxHandler->characters( m_pParserCtxt , chars , length ) ;
- if( chars != NULL )
+ if( chars != NULL )
{
xmlFree( ( xmlChar* )chars ) ;
}
@@ -380,8 +350,8 @@ void SAXHelper::characters( const rtl::OUString& aChars )
/**
* XDocumentHandler -- ignorable xml white space
*/
-void SAXHelper::ignorableWhitespace( const rtl::OUString& aWhitespaces )
- throw( cssxs::SAXException , cssu::RuntimeException )
+void SAXHelper::ignorableWhitespace( const rtl::OUString& aWhitespaces )
+ throw( cssxs::SAXException , cssu::RuntimeException )
{
const xmlChar* chars = NULL ;
int length = 0 ;
@@ -389,7 +359,7 @@ void SAXHelper::ignorableWhitespace( const rtl::OUString& aWhitespaces )
chars = ous_to_nxmlstr( aWhitespaces, length ) ;
m_pSaxHandler->ignorableWhitespace( m_pParserCtxt , chars , length ) ;
- if( chars != NULL )
+ if( chars != NULL )
{
xmlFree( ( xmlChar* )chars ) ;
}
@@ -401,7 +371,7 @@ void SAXHelper::ignorableWhitespace( const rtl::OUString& aWhitespaces )
void SAXHelper::processingInstruction(
const rtl::OUString& aTarget,
const rtl::OUString& aData )
- throw( cssxs::SAXException , cssu::RuntimeException )
+ throw( cssxs::SAXException , cssu::RuntimeException )
{
xmlChar* target = NULL ;
xmlChar* data = NULL ;
@@ -411,13 +381,13 @@ void SAXHelper::processingInstruction(
m_pSaxHandler->processingInstruction( m_pParserCtxt , target , data ) ;
- if( target != NULL )
+ if( target != NULL )
{
xmlFree( ( xmlChar* )target ) ;
target = NULL ;
}
-
- if( data != NULL )
+
+ if( data != NULL )
{
xmlFree( ( xmlChar* )data ) ;
data = NULL ;
@@ -430,7 +400,7 @@ void SAXHelper::processingInstruction(
*/
void SAXHelper::setDocumentLocator(
const cssu::Reference< cssxs::XLocator > &)
- throw( cssxs::SAXException , cssu::RuntimeException )
+ throw( cssxs::SAXException , cssu::RuntimeException )
{
}