diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-01-30 14:07:42 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-01-30 14:10:49 +0100 |
commit | 0843da18a6da6f01c6ad8d141a741c92e857d66e (patch) | |
tree | 5989a32ed8c92d2b0e95e5b670cb98de99f67a26 /oox | |
parent | 6b2e9ebf77879a8df330310f9b67f11322e8bc3e (diff) |
fprintf -> SAL_INFO
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/mathml/importutils.cxx | 56 |
1 files changed, 24 insertions, 32 deletions
diff --git a/oox/source/mathml/importutils.cxx b/oox/source/mathml/importutils.cxx index 55eb1fa67cf6..23db8f2b92d6 100644 --- a/oox/source/mathml/importutils.cxx +++ b/oox/source/mathml/importutils.cxx @@ -35,20 +35,15 @@ #include <oox/token/tokenmap.hxx> #include <oox/token/tokens.hxx> #include <oox/token/namespaces.hxx> +#include <rtl/oustringostreaminserter.hxx> #include <rtl/string.hxx> // *sigh* #define STR( str ) OUString( RTL_CONSTASCII_USTRINGPARAM( str )) -#define CSTR( str ) ( rtl::OUStringToOString( str, RTL_TEXTENCODING_UTF8 ).getStr()) #define OPENING( token ) XML_STREAM_OPENING( token ) #define CLOSING( token ) XML_STREAM_CLOSING( token ) -// HACK - TODO convert to the real debug stuff -#undef SAL_LOG_LEVEL -#define SAL_LOG_LEVEL 2 - - using namespace com::sun::star; using rtl::OUString; @@ -84,7 +79,6 @@ AttributeListBuilder::AttributeListBuilder( const uno::Reference< xml::sax::XFas } } -#if 0 static OUString tokenToString( int token ) { OUString tokenname = StaticTokenMap::get().getUnicodeTokenName( token & TOKEN_MASK ); @@ -117,7 +111,6 @@ static OUString tokenToString( int token ) // just the name itself, not specified whether opening or closing return namespacename + STR( ":" ) + tokenname; } -#endif } // namespace @@ -145,7 +138,7 @@ bool XmlStream::AttributeList::attribute( int token, bool def ) const if( find->second.equalsIgnoreAsciiCaseAscii( "false" ) || find->second.equalsIgnoreAsciiCaseAscii( "off" ) || find->second.equalsIgnoreAsciiCaseAscii( "f" ) || find->second.equalsIgnoreAsciiCaseAscii( "0" )) return false; -// fprintf( stderr, "Cannot convert \'%s\' to bool.\n", CSTR( find->second )); + SAL_WARN( "oox.xmlstream", "Cannot convert \'" << find->second << "\' to bool." ); } return def; } @@ -157,8 +150,8 @@ sal_Unicode XmlStream::AttributeList::attribute( int token, sal_Unicode def ) co { if( !find->second.isEmpty() ) { -// if( find->second.getLength() != 1 ) -// fprintf( stderr, "Cannot convert \'%s\' to sal_Unicode, stripping.\n", CSTR( find->second )); + if( find->second.getLength() != 1 ) + SAL_WARN( "oox.xmlstream", "Cannot convert \'" << find->second << "\' to sal_Unicode, stripping." ); return find->second[ 0 ]; } } @@ -229,7 +222,6 @@ XmlStream::Tag XmlStream::checkTag( int token, bool optional ) { // either it's the following tag, or find it int savedPos = pos; -#if SAL_LOG_LEVEL >= 2 if( optional ) { // avoid printing debug messages about skipping tags if the optional one // will not be found and the position will be reset back @@ -239,7 +231,6 @@ XmlStream::Tag XmlStream::checkTag( int token, bool optional ) return Tag(); } } -#endif if( currentToken() == token || findTag( token )) { Tag ret = currentTag(); @@ -251,7 +242,7 @@ XmlStream::Tag XmlStream::checkTag( int token, bool optional ) pos = savedPos; return Tag(); } -// fprintf( stderr, "Expected tag %s not found.\n", CSTR( tokenToString( token ))); + SAL_WARN( "oox.xmlstream", "Expected tag " << tokenToString( token ) << " not found." ); return Tag(); } @@ -260,7 +251,7 @@ bool XmlStream::findTag( int token ) return findTagInternal( token, false ); } -bool XmlStream::findTagInternal( int token, bool /*silent*/ ) +bool XmlStream::findTagInternal( int token, bool silent ) { int depth = 0; for(; @@ -271,20 +262,21 @@ bool XmlStream::findTagInternal( int token, bool /*silent*/ ) { if( currentToken() == OPENING( currentToken())) { -// if( !silent ) -// fprintf( stderr, "Skipping tag %s\n", CSTR( tokenToString( currentToken()))); + if( !silent ) + SAL_INFO( "oox.xmlstream", "Skipping tag " << tokenToString( currentToken())); ++depth; } else if( currentToken() == CLOSING( currentToken())) { -// if( !silent ) -// fprintf( stderr, "Skipping tag %s\n", CSTR( tokenToString( currentToken()))); + if( !silent ) + SAL_INFO( "oox.xmlstream", "Skipping tag " << tokenToString( currentToken())); --depth; } else { -// if( !silent ) -// fprintf( stderr, "Malformed token %d (%s)\n", currentToken(), CSTR( tokenToString( currentToken()))); + if( !silent ) + SAL_WARN( "oox.xmlstream", "Malformed token " << currentToken() << " (" + << tokenToString( currentToken()) << ")" ); abort(); } continue; @@ -295,15 +287,15 @@ bool XmlStream::findTagInternal( int token, bool /*silent*/ ) return false; // that would be leaving current element, so not found if( currentToken() == OPENING( currentToken())) { -// if( !silent ) -// fprintf( stderr, "Skipping tag %s\n", CSTR( tokenToString( currentToken()))); + if( !silent ) + SAL_INFO( "oox.xmlstream", "Skipping tag " << tokenToString( currentToken())); ++depth; } else abort(); } -// if( !silent ) -// fprintf( stderr, "Unexpected end of stream reached.\n" ); + if( !silent ) + SAL_WARN( "oox.xmlstream", "Unexpected end of stream reached." ); return false; } @@ -312,23 +304,23 @@ void XmlStream::skipElement( int token ) return skipElementInternal( token, true ); // no debug about skipping if called from outside } -void XmlStream::skipElementInternal( int token, bool /*silent*/ ) +void XmlStream::skipElementInternal( int token, bool silent ) { int closing = ( token & ~TAG_OPENING ) | TAG_CLOSING; // make it a closing tag assert( currentToken() == OPENING( token )); -// if( !silent ) -// fprintf( stderr, "Skipping unexpected element %s\n", CSTR( tokenToString( currentToken()))); + if( !silent ) + SAL_INFO( "oox.xmlstream", "Skipping unexpected element " << tokenToString( currentToken())); moveToNextTag(); // and just find the matching closing tag if( findTag( closing )) { -// if( !silent ) -// fprintf( stderr, "Skipped unexpected element %s\n", CSTR( tokenToString( token ))); + if( !silent ) + SAL_INFO( "oox.xmlstream", "Skipped unexpected element " << tokenToString( token )); moveToNextTag(); // and skip it too return; } // this one is an unexpected problem, do not silent it -// fprintf( stderr, "Expected end of element %s not found.\n", CSTR( tokenToString( token ))); + SAL_WARN( "oox.xmlstream", "Expected end of element " << tokenToString( token ) << " not found." ); } void XmlStream::handleUnexpectedTag() @@ -337,7 +329,7 @@ void XmlStream::handleUnexpectedTag() return; if( currentToken() == CLOSING( currentToken())) { -// fprintf( stderr, "Skipping unexpected tag %s\n", CSTR( tokenToString( currentToken()))); + SAL_INFO( "oox.xmlstream", "Skipping unexpected tag " << tokenToString( currentToken())); moveToNextTag(); // just skip it return; } |