From c148ab4b535a6e85bdaaabd487983999c4a023d7 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 17 Sep 2010 12:12:53 +0200 Subject: cws-vmiklos01.diff: Better RTF export filter --- sax/source/tools/fastserializer.cxx | 45 +++++++++++++++++++++++++++++++++++++ sax/source/tools/fastserializer.hxx | 7 ++++++ 2 files changed, 52 insertions(+) (limited to 'sax/source/tools') diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index b0318516b72c..d88e3140f956 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -34,6 +34,10 @@ #include +#if DEBUG +#include +#endif + using ::rtl::OString; using ::rtl::OUString; using ::rtl::OUStringBuffer; @@ -321,6 +325,28 @@ namespace sax_fastparser { maMarkStack.push( ForMerge() ); } +#if DEBUG + void FastSaxSerializer::printMarkStack( ) + { + ::std::stack< ForMerge > aCopy( maMarkStack ); + int nSize = aCopy.size(); + int i = 0; + while ( !aCopy.empty() ) + { + fprintf( stderr, "%d\n", nSize - i ); + + ForMerge aMarks = aCopy.top( ); + aMarks.print(); + + + fprintf( stderr, "\n" ); + + aCopy.pop( ); + i++; + } + } +#endif + void FastSaxSerializer::mergeTopMarks( sax_fastparser::MergeMarksEnum eMergeType ) { if ( maMarkStack.empty() ) @@ -360,6 +386,25 @@ namespace sax_fastparser { return maData; } +#if DEBUG + void FastSaxSerializer::ForMerge::print( ) + { + fprintf( stderr, "Data: " ); + for ( sal_Int32 i=0, len=maData.getLength(); i < len; i++ ) + { + fprintf( stderr, "%c", maData[i] ); + } + + fprintf( stderr, "\nPostponed: " ); + for ( sal_Int32 i=0, len=maPostponed.getLength(); i < len; i++ ) + { + fprintf( stderr, "%c", maPostponed[i] ); + } + + fprintf( stderr, "\n" ); + } +#endif + void FastSaxSerializer::ForMerge::prepend( const Int8Sequence &rWhat ) { merge( maData, rWhat, false ); diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx index a98a0ff7a67d..39f471fd7009 100644 --- a/sax/source/tools/fastserializer.hxx +++ b/sax/source/tools/fastserializer.hxx @@ -134,6 +134,9 @@ private: ForMerge() : maData(), maPostponed() {} Int8Sequence& getData(); +#if DEBUG + void print(); +#endif void prepend( const Int8Sequence &rWhat ); void append( const Int8Sequence &rWhat ); @@ -143,6 +146,10 @@ private: static void merge( Int8Sequence &rTop, const Int8Sequence &rMerge, bool bAppend ); }; +#if DEBUG + void printMarkStack( ); +#endif + ::std::stack< ForMerge > maMarkStack; void writeFastAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ); -- cgit From b145ae8acad116c87cbcfbc467130adb872553c0 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 6 Oct 2010 09:18:56 +0100 Subject: use rtl::ByteSequence instead of Sequence For trivial pre-main sequences use rtl::ByteSequence instead of uno::Sequence< sal_Int8 >, see #i113054#. Advantages are its slightly faster, but more importantly uno::Sequence needs the cppu infrastructure to be working during destruction, and global uno::Sequences cause difficulties on shutdown, because their lifecycle is difficult to control and ensure that they die *before* the cppu infrastructure --- sax/source/tools/fastserializer.cxx | 66 +++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 32 deletions(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index d88e3140f956..97a05c36c126 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -27,6 +27,7 @@ #include "fastserializer.hxx" #include +#include #include #include @@ -45,6 +46,7 @@ using ::rtl::OUStringToOString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::toUnoSequence; using ::com::sun::star::xml::FastAttribute; using ::com::sun::star::xml::Attribute; using ::com::sun::star::xml::sax::SAXException; @@ -56,15 +58,15 @@ using ::com::sun::star::io::NotConnectedException; using ::com::sun::star::io::IOException; using ::com::sun::star::io::BufferSizeExceededException; -static Sequence< sal_Int8 > aClosingBracket((sal_Int8 *)">", 1); -static Sequence< sal_Int8 > aSlashAndClosingBracket((sal_Int8 *)"/>", 2); -static Sequence< sal_Int8 > aColon((sal_Int8 *)":", 1); -static Sequence< sal_Int8 > aOpeningBracket((sal_Int8 *)"<", 1); -static Sequence< sal_Int8 > aOpeningBracketAndSlash((sal_Int8 *)" aQuote((sal_Int8 *)"\"", 1); -static Sequence< sal_Int8 > aEqualSignAndQuote((sal_Int8 *)"=\"", 2); -static Sequence< sal_Int8 > aSpace((sal_Int8 *)" ", 1); -static Sequence< sal_Int8 > aXmlHeader((sal_Int8*) "\n", 56); +static rtl::ByteSequence aClosingBracket((const sal_Int8 *)">", 1); +static rtl::ByteSequence aSlashAndClosingBracket((const sal_Int8 *)"/>", 2); +static rtl::ByteSequence aColon((const sal_Int8 *)":", 1); +static rtl::ByteSequence aOpeningBracket((const sal_Int8 *)"<", 1); +static rtl::ByteSequence aOpeningBracketAndSlash((const sal_Int8 *)"\n", 56); #define HAS_NAMESPACE(x) ((x & 0xffff0000) != 0) #define NAMESPACE(x) (x >> 16) @@ -78,7 +80,7 @@ namespace sax_fastparser { { if (!mxOutputStream.is()) return; - writeBytes(aXmlHeader); + writeBytes(toUnoSequence(aXmlHeader)); } OUString FastSaxSerializer::escapeXml( const OUString& s ) @@ -120,7 +122,7 @@ namespace sax_fastparser { { if( HAS_NAMESPACE( nElement ) ) { writeBytes(mxFastTokenHandler->getUTF8Identifier(NAMESPACE(nElement))); - writeBytes(aColon); + writeBytes(toUnoSequence(aColon)); writeBytes(mxFastTokenHandler->getUTF8Identifier(TOKEN(nElement))); } else writeBytes(mxFastTokenHandler->getUTF8Identifier(nElement)); @@ -132,12 +134,12 @@ namespace sax_fastparser { if (!mxOutputStream.is()) return; - writeBytes(aOpeningBracket); + writeBytes(toUnoSequence(aOpeningBracket)); writeId(Element); writeFastAttributeList(Attribs); - writeBytes(aClosingBracket); + writeBytes(toUnoSequence(aClosingBracket)); } void SAL_CALL FastSaxSerializer::startUnknownElement( const OUString& Namespace, const OUString& Name, const Reference< XFastAttributeList >& Attribs ) @@ -146,19 +148,19 @@ namespace sax_fastparser { if (!mxOutputStream.is()) return; - writeBytes(aOpeningBracket); + writeBytes(toUnoSequence(aOpeningBracket)); if (Namespace.getLength()) { write(Namespace); - writeBytes(aColon); + writeBytes(toUnoSequence(aColon)); } write(Name); writeFastAttributeList(Attribs); - writeBytes(aClosingBracket); + writeBytes(toUnoSequence(aClosingBracket)); } void SAL_CALL FastSaxSerializer::endFastElement( ::sal_Int32 Element ) @@ -167,11 +169,11 @@ namespace sax_fastparser { if (!mxOutputStream.is()) return; - writeBytes(aOpeningBracketAndSlash); + writeBytes(toUnoSequence(aOpeningBracketAndSlash)); writeId(Element); - writeBytes(aClosingBracket); + writeBytes(toUnoSequence(aClosingBracket)); } void SAL_CALL FastSaxSerializer::endUnknownElement( const OUString& Namespace, const OUString& Name ) @@ -180,17 +182,17 @@ namespace sax_fastparser { if (!mxOutputStream.is()) return; - writeBytes(aOpeningBracketAndSlash); + writeBytes(toUnoSequence(aOpeningBracketAndSlash)); if (Namespace.getLength()) { write(Namespace); - writeBytes(aColon); + writeBytes(toUnoSequence(aColon)); } write(Name); - writeBytes(aClosingBracket); + writeBytes(toUnoSequence(aClosingBracket)); } void SAL_CALL FastSaxSerializer::singleFastElement( ::sal_Int32 Element, const Reference< XFastAttributeList >& Attribs ) @@ -199,12 +201,12 @@ namespace sax_fastparser { if (!mxOutputStream.is()) return; - writeBytes(aOpeningBracket); + writeBytes(toUnoSequence(aOpeningBracket)); writeId(Element); writeFastAttributeList(Attribs); - writeBytes(aSlashAndClosingBracket); + writeBytes(toUnoSequence(aSlashAndClosingBracket)); } void SAL_CALL FastSaxSerializer::singleUnknownElement( const OUString& Namespace, const OUString& Name, const Reference< XFastAttributeList >& Attribs ) @@ -213,19 +215,19 @@ namespace sax_fastparser { if (!mxOutputStream.is()) return; - writeBytes(aOpeningBracket); + writeBytes(toUnoSequence(aOpeningBracket)); if (Namespace.getLength()) { write(Namespace); - writeBytes(aColon); + writeBytes(toUnoSequence(aColon)); } write(Name); writeFastAttributeList(Attribs); - writeBytes(aSlashAndClosingBracket); + writeBytes(toUnoSequence(aSlashAndClosingBracket)); } void SAL_CALL FastSaxSerializer::characters( const OUString& aChars ) @@ -255,12 +257,12 @@ namespace sax_fastparser { sal_Int32 nAttrLength = aAttrSeq.getLength(); for (sal_Int32 i = 0; i < nAttrLength; i++) { - writeBytes(aSpace); + writeBytes(toUnoSequence(aSpace)); write(pAttr[i].Name); - writeBytes(aEqualSignAndQuote); + writeBytes(toUnoSequence(aEqualSignAndQuote)); write(escapeXml(pAttr[i].Value)); - writeBytes(aQuote); + writeBytes(toUnoSequence(aQuote)); } Sequence< FastAttribute > aFastAttrSeq = Attribs->getFastAttributes(); @@ -268,16 +270,16 @@ namespace sax_fastparser { sal_Int32 nFastAttrLength = aFastAttrSeq.getLength(); for (sal_Int32 j = 0; j < nFastAttrLength; j++) { - writeBytes(aSpace); + writeBytes(toUnoSequence(aSpace)); sal_Int32 nToken = pFastAttr[j].Token; writeId(nToken); - writeBytes(aEqualSignAndQuote); + writeBytes(toUnoSequence(aEqualSignAndQuote)); write(escapeXml(Attribs->getValue(pFastAttr[j].Token))); - writeBytes(aQuote); + writeBytes(toUnoSequence(aQuote)); } } -- cgit From 4905a190326a423b418a6b5531c5d990a5cc0082 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Thu, 14 Oct 2010 08:27:31 +0200 Subject: Add vim/emacs modelines to all source files Fixes #fdo30794 Based on bin/add-modelines script (originally posted in mail 1286706307.1871.1399280959@webmail.messagingengine.com) Signed-off-by: Sebastian Spaeth --- sax/source/tools/converter.cxx | 3 +++ sax/source/tools/fastattribs.cxx | 3 +++ sax/source/tools/fastserializer.cxx | 2 ++ sax/source/tools/fastserializer.hxx | 3 +++ sax/source/tools/fshelper.cxx | 3 +++ 5 files changed, 14 insertions(+) (limited to 'sax/source/tools') diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 5df3044bd6d3..7bb19dd83bb3 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -2096,3 +2097,5 @@ sal_Int16 Converter::GetUnitFromString(const ::rtl::OUString& rString, sal_Int16 } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx index 4bf9d55c75b8..ba9ee4dce7d3 100644 --- a/sax/source/tools/fastattribs.cxx +++ b/sax/source/tools/fastattribs.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -166,3 +167,5 @@ Sequence< FastAttribute > FastAttributeList::getFastAttributes( ) throw (Runtim } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index 97a05c36c126..b475f6d2342c 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -446,3 +447,4 @@ namespace sax_fastparser { } // namespace sax_fastparser +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx index 39f471fd7009..cb57be1f61fb 100644 --- a/sax/source/tools/fastserializer.hxx +++ b/sax/source/tools/fastserializer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -166,3 +167,5 @@ protected: } // namespace sax_fastparser #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx index 743f499fb4f0..16b3acb3e021 100644 --- a/sax/source/tools/fshelper.cxx +++ b/sax/source/tools/fshelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include #include "fastserializer.hxx" #include @@ -199,3 +200,5 @@ FastAttributeList * FastSerializerHelper::createAttrList() } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit From 849a713ffd29a58ae79e48f80835c28bbd9d5a72 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 18 Oct 2010 16:52:05 +0100 Subject: remove non-compiled code --- sax/source/tools/converter.cxx | 199 ----------------------------------------- 1 file changed, 199 deletions(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 7bb19dd83bb3..5dee77ea41d5 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -275,193 +275,6 @@ void Converter::convertMeasure( OUStringBuffer& rBuffer, (void)nMeasure; (void)nSourceUnit; (void)nTargetUnit; -#if 0 - if( nSourceUnit == MeasureUnit::PERCENT ) - { - OSL_ENSURE( nTargetUnit == MeasureUnit::PERCENT, - "MeasureUnit::PERCENT only maps to MeasureUnit::PERCENT!" ); - - rBuffer.append( nMeasure ); - rBuffer.append( sal_Unicode('%' ) ); - } - else - { - // the sign is processed seperatly - if( nMeasure < 0 ) - { - nMeasure = -nMeasure; - rBuffer.append( sal_Unicode('-') ); - } - - // The new length is (nVal * nMul)/(nDiv*nFac*10) - long nMul = 1000; - long nDiv = 1; - long nFac = 100; - const sal_Char* psUnit = 0; - switch( nSourceUnit ) - { - case MeasureUnit::TWIP: - switch( nTargetUnit ) - { - case MeasureUnit::MM_100TH: - case MeasureUnit::MM_10TH: - OSL_ENSURE( MeasureUnit::INCH == nTargetUnit,"output unit not supported for twip values" ); - case MeasureUnit::MM: - // 0.01mm = 0.57twip (exactly) - nMul = 25400; // 25.4 * 1000 - nDiv = 1440; // 72 * 20; - nFac = 100; - psUnit = gpsMM; - break; - - case MeasureUnit::CM: - // 0.001cm = 0.57twip (exactly) - nMul = 25400; // 2.54 * 10000 - nDiv = 1440; // 72 * 20; - nFac = 1000; - psUnit = gpsCM; - break; - - case MeasureUnit::POINT: - // 0.01pt = 0.2twip (exactly) - nMul = 1000; - nDiv = 20; - nFac = 100; - psUnit = gpsPT; - break; - - case MeasureUnit::INCH: - default: - OSL_ENSURE( MeasureUnit::INCH == nTargetUnit, - "output unit not supported for twip values" ); - // 0.0001in = 0.144twip (exactly) - nMul = 100000; - nDiv = 1440; // 72 * 20; - nFac = 10000; - psUnit = gpsINCH; - break; - } - break; - - case MeasureUnit::POINT: - // 1pt = 1pt (exactly) - OSL_ENSURE( MeasureUnit::POINT == nTargetUnit, - "output unit not supported for pt values" ); - nMul = 10; - nDiv = 1; - nFac = 1; - psUnit = gpsPT; - break; - case MeasureUnit::MM_10TH: - case MeasureUnit::MM_100TH: - { - long nFac2 = (MeasureUnit::MM_100TH == nSourceUnit) ? 100 : 10; - switch( nTargetUnit ) - { - case MeasureUnit::MM_100TH: - case MeasureUnit::MM_10TH: - OSL_ENSURE( MeasureUnit::INCH == nTargetUnit, - "output unit not supported for 1/100mm values" ); - case MeasureUnit::MM: - // 0.01mm = 1 mm/100 (exactly) - nMul = 10; - nDiv = 1; - nFac = nFac2; - psUnit = gpsMM; - break; - - case MeasureUnit::CM: - // 0.001mm = 1 mm/100 (exactly) - nMul = 10; - nDiv = 1; // 72 * 20; - nFac = 10*nFac2; - psUnit = gpsCM; - break; - - case MeasureUnit::POINT: - // 0.01pt = 0.35 mm/100 (exactly) - nMul = 72000; - nDiv = 2540; - nFac = nFac2; - psUnit = gpsPT; - break; - - case MeasureUnit::INCH: - default: - OSL_ENSURE( MeasureUnit::INCH == nTargetUnit, - "output unit not supported for 1/100mm values" ); - // 0.0001in = 0.254 mm/100 (exactly) - nMul = 100000; - nDiv = 2540; - nFac = 100*nFac2; - psUnit = gpsINCH; - break; - } - break; - } - } - - long nLongVal = 0; - bool bOutLongVal = true; - if( nMeasure > SAL_INT32_MAX / nMul ) - { - // A big int is required for calculation - BigInt nBigVal( nMeasure ); - BigInt nBigFac( nFac ); - nBigVal *= nMul; - nBigVal /= nDiv; - nBigVal += 5; - nBigVal /= 10; - - if( nBigVal.IsLong() ) - { - // To convert the value into a string a long is sufficient - nLongVal = (long)nBigVal; - } - else - { - BigInt nBigFac2( nFac ); - BigInt nBig10( 10 ); - rBuffer.append( (sal_Int32)(nBigVal / nBigFac2) ); - if( !(nBigVal % nBigFac2).IsZero() ) - { - rBuffer.append( sal_Unicode('.') ); - while( nFac > 1 && !(nBigVal % nBigFac2).IsZero() ) - { - nFac /= 10; - nBigFac2 = nFac; - rBuffer.append( (sal_Int32)((nBigVal / nBigFac2) % nBig10 ) ); - } - } - bOutLongVal = false; - } - } - else - { - nLongVal = nMeasure * nMul; - nLongVal /= nDiv; - nLongVal += 5; - nLongVal /= 10; - } - - if( bOutLongVal ) - { - rBuffer.append( (sal_Int32)(nLongVal / nFac) ); - if( nFac > 1 && (nLongVal % nFac) != 0 ) - { - rBuffer.append( sal_Unicode('.') ); - while( nFac > 1 && (nLongVal % nFac) != 0 ) - { - nFac /= 10; - rBuffer.append( (sal_Int32)((nLongVal / nFac) % 10) ); - } - } - } - - if( psUnit ) - rBuffer.appendAscii( psUnit ); - } -#endif } static const OUString& getTrueString() @@ -1496,13 +1309,6 @@ bool Converter::convertDateOrDateTime( { bSuccess = false; // only 24:00:00 is valid } -#if 0 - else - { - nHours = 0; // normalize 24:00:00 to 00:00:00 of next day - lcl_addDay(bNegative, nYear, nMonth, nDay, 1); - } -#endif } } @@ -1570,11 +1376,6 @@ bool Converter::convertDateOrDateTime( if (bSuccess && bHaveTimezone) { // util::DateTime does not support timezones! -#if 0 - // do not add timezone, just strip it (as suggested by er) - lcl_addTimezone(bNegative, nYear, nMonth, nDay, nHours, nMinutes, - !bHaveTimezoneMinus, nTimezoneHours, nTimezoneMinutes); -#endif } if (bSuccess) -- cgit From 6b7af2b91761f48301e6efbe5569944d46f1a611 Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Sat, 6 Nov 2010 15:20:20 +0100 Subject: DOCX export: order pPr children according to specs This is still a first attempt: the base is present and all the exported properties needs to be checked. rPr properties order needs to be checked as well. --- sax/source/tools/fastserializer.cxx | 98 ++++++++++++++++++++++++++++++++----- sax/source/tools/fastserializer.hxx | 51 ++++++++++++++++--- sax/source/tools/fshelper.cxx | 4 +- 3 files changed, 131 insertions(+), 22 deletions(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index b475f6d2342c..7e8394039831 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -135,6 +135,9 @@ namespace sax_fastparser { if (!mxOutputStream.is()) return; + if ( !maMarkStack.empty() ) + maMarkStack.top()->setCurrentElement( Element ); + writeBytes(toUnoSequence(aOpeningBracket)); writeId(Element); @@ -202,6 +205,9 @@ namespace sax_fastparser { if (!mxOutputStream.is()) return; + if ( !maMarkStack.empty() ) + maMarkStack.top()->setCurrentElement( Element ); + writeBytes(toUnoSequence(aOpeningBracket)); writeId(Element); @@ -323,24 +329,31 @@ namespace sax_fastparser { return aRet; } - void FastSaxSerializer::mark() + void FastSaxSerializer::mark( Int32Sequence aOrder ) { - maMarkStack.push( ForMerge() ); + if ( aOrder.hasElements() ) + { + boost::shared_ptr< ForMerge > pSort( new ForSort( aOrder ) ); + maMarkStack.push( pSort ); + } + else + { + boost::shared_ptr< ForMerge > pMerge( new ForMerge( ) ); + maMarkStack.push( pMerge ); + } } #if DEBUG void FastSaxSerializer::printMarkStack( ) { - ::std::stack< ForMerge > aCopy( maMarkStack ); + ::std::stack< boost::shared_ptr< ForMerge > > aCopy( maMarkStack ); int nSize = aCopy.size(); int i = 0; while ( !aCopy.empty() ) { fprintf( stderr, "%d\n", nSize - i ); - ForMerge aMarks = aCopy.top( ); - aMarks.print(); - + aCopy.top( )->print( ); fprintf( stderr, "\n" ); @@ -357,19 +370,19 @@ namespace sax_fastparser { if ( maMarkStack.size() == 1 ) { - mxOutputStream->writeBytes( maMarkStack.top().getData() ); + mxOutputStream->writeBytes( maMarkStack.top()->getData() ); maMarkStack.pop(); return; } - const Int8Sequence aMerge( maMarkStack.top().getData() ); + const Int8Sequence aMerge( maMarkStack.top()->getData() ); maMarkStack.pop(); switch ( eMergeType ) { - case MERGE_MARKS_APPEND: maMarkStack.top().append( aMerge ); break; - case MERGE_MARKS_PREPEND: maMarkStack.top().prepend( aMerge ); break; - case MERGE_MARKS_POSTPONE: maMarkStack.top().postpone( aMerge ); break; + case MERGE_MARKS_APPEND: maMarkStack.top()->append( aMerge ); break; + case MERGE_MARKS_PREPEND: maMarkStack.top()->prepend( aMerge ); break; + case MERGE_MARKS_POSTPONE: maMarkStack.top()->postpone( aMerge ); break; } } @@ -378,7 +391,7 @@ namespace sax_fastparser { if ( maMarkStack.empty() ) mxOutputStream->writeBytes( aData ); else - maMarkStack.top().append( aData ); + maMarkStack.top()->append( aData ); } FastSaxSerializer::Int8Sequence& FastSaxSerializer::ForMerge::getData() @@ -445,6 +458,67 @@ namespace sax_fastparser { } } + void FastSaxSerializer::ForMerge::resetData( ) + { + maData = Int8Sequence(); + } + + void FastSaxSerializer::ForSort::setCurrentElement( sal_Int32 nElement ) + { + mnCurrentElement = nElement; + if ( maData.find( nElement ) == maData.end() ) + maData[ nElement ] = Int8Sequence(); + } + + void FastSaxSerializer::ForSort::prepend( const Int8Sequence &rWhat ) + { + append( rWhat ); + } + + void FastSaxSerializer::ForSort::append( const Int8Sequence &rWhat ) + { + merge( maData[mnCurrentElement], rWhat, true ); + } + + void FastSaxSerializer::ForSort::sort() + { + // Clear the ForMerge data to avoid duplicate items + resetData(); + + // Sort it all + std::map< sal_Int32, Int8Sequence >::iterator iter; + for ( sal_Int32 i=0, len=maOrder.getLength(); i < len; i++ ) + { + iter = maData.find( maOrder[i] ); + if ( iter != maData.end() ) + ForMerge::append( iter->second ); + } + } + + FastSaxSerializer::Int8Sequence& FastSaxSerializer::ForSort::getData() + { + sort( ); + return ForMerge::getData(); + } + +#if DEBUG + void FastSaxSerializer::ForSort::print( ) + { + std::map< sal_Int32, Int8Sequence >::iterator iter = maData.begin(); + while ( iter != maData.end( ) ) + { + fprintf( stderr, "pair: %d, ", iter->first ); + for ( sal_Int32 i=0, len=iter->second.getLength(); i < len; i++ ) + fprintf( stderr, "%c", iter->second[i] ); + fprintf( stderr, "\n" ); + iter++; + } + + sort( ); + ForMerge::print(); + } +#endif + } // namespace sax_fastparser /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx index cb57be1f61fb..493ef5cb3c92 100644 --- a/sax/source/tools/fastserializer.hxx +++ b/sax/source/tools/fastserializer.hxx @@ -36,6 +36,9 @@ #include #include +#include + +#include #include "sax/dllapi.h" #include "sax/fshelper.hxx" @@ -47,6 +50,9 @@ namespace sax_fastparser { class SAX_DLLPUBLIC FastSaxSerializer : public ::cppu::WeakImplHelper2< ::com::sun::star::xml::sax::XFastSerializer, ::com::sun::star::lang::XServiceInfo > { + typedef ::com::sun::star::uno::Sequence< ::sal_Int8 > Int8Sequence; + typedef ::com::sun::star::uno::Sequence< ::sal_Int32 > Int32Sequence; + public: explicit FastSaxSerializer( ); virtual ~FastSaxSerializer(); @@ -102,7 +108,7 @@ public: mergeTopMarks( true ), mergeTopMarks(), /r, /p and you are done. */ - void mark(); + void mark( Int32Sequence aOrder = Int32Sequence() ); /** Merge 2 topmost marks. @@ -125,7 +131,6 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > mxOutputStream; ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler > mxFastTokenHandler; - typedef ::com::sun::star::uno::Sequence< ::sal_Int8 > Int8Sequence; class ForMerge { Int8Sequence maData; @@ -134,24 +139,54 @@ private: public: ForMerge() : maData(), maPostponed() {} - Int8Sequence& getData(); + virtual void setCurrentElement( ::sal_Int32 /*nToken*/ ) {} + virtual Int8Sequence& getData(); #if DEBUG - void print(); + virtual void print(); #endif - void prepend( const Int8Sequence &rWhat ); - void append( const Int8Sequence &rWhat ); + virtual void prepend( const Int8Sequence &rWhat ); + virtual void append( const Int8Sequence &rWhat ); void postpone( const Int8Sequence &rWhat ); - private: + protected: + void resetData( ); static void merge( Int8Sequence &rTop, const Int8Sequence &rMerge, bool bAppend ); }; + class ForSort : public ForMerge + { + std::map< ::sal_Int32, Int8Sequence > maData; + sal_Int32 mnCurrentElement; + + Int32Sequence maOrder; + + public: + ForSort( Int32Sequence aOrder ) : + ForMerge(), + maData(), + mnCurrentElement( 0 ), + maOrder( aOrder ) {} + + void setCurrentElement( ::sal_Int32 nToken ); + + virtual Int8Sequence& getData(); + +#if DEBUG + virtual void print(); +#endif + + virtual void prepend( const Int8Sequence &rWhat ); + virtual void append( const Int8Sequence &rWhat ); + private: + void sort(); + }; + #if DEBUG void printMarkStack( ); #endif - ::std::stack< ForMerge > maMarkStack; + ::std::stack< boost::shared_ptr< ForMerge > > maMarkStack; void writeFastAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ); void write( const ::rtl::OUString& s ); diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx index 16b3acb3e021..3096dc6a3ee2 100644 --- a/sax/source/tools/fshelper.cxx +++ b/sax/source/tools/fshelper.cxx @@ -183,9 +183,9 @@ FastSerializerHelper* FastSerializerHelper::writeId(sal_Int32 tokenId) return mpSerializer->getOutputStream(); } -void FastSerializerHelper::mark() +void FastSerializerHelper::mark( Sequence< sal_Int32 > aOrder ) { - mpSerializer->mark(); + mpSerializer->mark( aOrder ); } void FastSerializerHelper::mergeTopMarks( MergeMarksEnum eMergeType ) -- cgit From b35a7344eda5eaa1e0dcf916b48d8cf089db5562 Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Wed, 10 Nov 2010 09:45:11 +0100 Subject: Docx Export: fixed some elements ordering problem Nested elements that weren't in the order sequence weren't appended to the parent... and then skipped. --- sax/source/tools/fastserializer.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index 7e8394039831..5f31a232bdf4 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -30,6 +30,8 @@ #include #include +#include + #include #include #include @@ -40,6 +42,7 @@ #include #endif +using ::comphelper::SequenceAsVector; using ::rtl::OString; using ::rtl::OUString; using ::rtl::OUStringBuffer; @@ -465,9 +468,13 @@ namespace sax_fastparser { void FastSaxSerializer::ForSort::setCurrentElement( sal_Int32 nElement ) { - mnCurrentElement = nElement; - if ( maData.find( nElement ) == maData.end() ) - maData[ nElement ] = Int8Sequence(); + SequenceAsVector< sal_Int32 > aOrder( maOrder ); + if( std::find( aOrder.begin(), aOrder.end(), nElement ) != aOrder.end() ) + { + mnCurrentElement = nElement; + if ( maData.find( nElement ) == maData.end() ) + maData[ nElement ] = Int8Sequence(); + } } void FastSaxSerializer::ForSort::prepend( const Int8Sequence &rWhat ) -- cgit From 089f03d72c4a2d69002c184854a244c84927b6ec Mon Sep 17 00:00:00 2001 From: Gert Faller Date: Tue, 23 Nov 2010 19:50:59 +0100 Subject: RTL_CONSTASCII_USTRINGPARAM in libs-gui 15 --- sax/source/tools/fastserializer.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index 5f31a232bdf4..47e865c25785 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -296,7 +296,7 @@ namespace sax_fastparser { // XServiceInfo OUString FastSaxSerializer::getImplementationName() throw (RuntimeException) { - return OUString::createFromAscii( SERIALIZER_IMPLEMENTATION_NAME ); + return OUString(RTL_CONSTASCII_USTRINGPARAM( SERIALIZER_IMPLEMENTATION_NAME )); } // XServiceInfo @@ -316,13 +316,13 @@ namespace sax_fastparser { Sequence< OUString > FastSaxSerializer::getSupportedServiceNames(void) throw (RuntimeException) { Sequence seq(1); - seq.getArray()[0] = OUString::createFromAscii( SERIALIZER_SERVICE_NAME ); + seq.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( SERIALIZER_SERVICE_NAME )); return seq; } OUString FastSaxSerializer::getImplementationName_Static() { - return OUString::createFromAscii( SERIALIZER_IMPLEMENTATION_NAME ); + return OUString(RTL_CONSTASCII_USTRINGPARAM( SERIALIZER_IMPLEMENTATION_NAME )); } Sequence< OUString > FastSaxSerializer::getSupportedServiceNames_Static(void) -- cgit From fc55481db2555bf78a09b18ab1a8b9068a1515dc Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 24 Nov 2010 16:51:43 +0000 Subject: cppcheck: unused variable --- sax/source/tools/converter.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 5dee77ea41d5..40e8f5009d10 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -1179,11 +1179,10 @@ bool Converter::convertDateOrDateTime( const ::rtl::OUString string = rString.trim().toAsciiUpperCase(); sal_Int32 nPos(0); - bool bNegative(false); if ((string.getLength() > nPos) && (sal_Unicode('-') == string[nPos])) { + //Negative Number ++nPos; - bNegative = true; } sal_Int32 nYear(0); -- cgit From 42cde3cd0aa53427275de1f181125911551e62d7 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 26 Nov 2010 21:39:55 +0000 Subject: cppcheck: use prefix variant --- sax/source/tools/fastattribs.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx index ba9ee4dce7d3..53fc40350022 100644 --- a/sax/source/tools/fastattribs.cxx +++ b/sax/source/tools/fastattribs.cxx @@ -148,7 +148,7 @@ Sequence< Attribute > FastAttributeList::getUnknownAttributes( ) throw (Runtime { Sequence< Attribute > aSeq( maUnknownAttributes.size() ); Attribute* pAttr = aSeq.getArray(); - for( UnknownAttributeList::iterator attrIter = maUnknownAttributes.begin(); attrIter != maUnknownAttributes.end(); attrIter++ ) + for( UnknownAttributeList::iterator attrIter = maUnknownAttributes.begin(); attrIter != maUnknownAttributes.end(); ++attrIter ) (*attrIter).FillAttribute( pAttr++ ); return aSeq; } @@ -157,7 +157,7 @@ Sequence< FastAttribute > FastAttributeList::getFastAttributes( ) throw (Runtim Sequence< FastAttribute > aSeq( maAttributes.size() ); FastAttribute* pAttr = aSeq.getArray(); FastAttributeMap::iterator fastAttrIter = maAttributes.begin(); - for(; fastAttrIter != maAttributes.end(); fastAttrIter++ ) + for(; fastAttrIter != maAttributes.end(); ++fastAttrIter ) { pAttr->Token = fastAttrIter->first; pAttr->Value = OStringToOUString( fastAttrIter->second, RTL_TEXTENCODING_UTF8 ); -- cgit From b75f3f82f82676784f79c9624bfc8914e23d15d6 Mon Sep 17 00:00:00 2001 From: Muthu Subramanian K Date: Fri, 10 Dec 2010 21:38:16 +0530 Subject: XLSX VML Export fixes. Make generation of xml header optional. --- sax/source/tools/fshelper.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx index 3096dc6a3ee2..88b15a00be71 100644 --- a/sax/source/tools/fshelper.cxx +++ b/sax/source/tools/fshelper.cxx @@ -10,7 +10,7 @@ using namespace ::com::sun::star::uno; namespace sax_fastparser { -FastSerializerHelper::FastSerializerHelper(const Reference< io::XOutputStream >& xOutputStream ) : +FastSerializerHelper::FastSerializerHelper(const Reference< io::XOutputStream >& xOutputStream, bool bWriteHeader ) : mpSerializer(new FastSaxSerializer()) { Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); @@ -18,7 +18,8 @@ FastSerializerHelper::FastSerializerHelper(const Reference< io::XOutputStream >& mpSerializer->setFastTokenHandler( mxTokenHandler ); mpSerializer->setOutputStream( xOutputStream ); - mpSerializer->startDocument(); + if( bWriteHeader ) + mpSerializer->startDocument(); } FastSerializerHelper::~FastSerializerHelper() -- cgit From bdec213c8ede144425278e2c98a4297f74989e86 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 23 Dec 2010 21:04:56 +0000 Subject: cppcheck: prefer prefix variant --- sax/source/tools/fastserializer.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index 47e865c25785..55a9811e4d3d 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -515,10 +515,10 @@ namespace sax_fastparser { while ( iter != maData.end( ) ) { fprintf( stderr, "pair: %d, ", iter->first ); - for ( sal_Int32 i=0, len=iter->second.getLength(); i < len; i++ ) + for ( sal_Int32 i=0, len=iter->second.getLength(); i < len; ++i ) fprintf( stderr, "%c", iter->second[i] ); fprintf( stderr, "\n" ); - iter++; + ++iter; } sort( ); -- cgit From dedffc5920d285b5194fff7ff9e23cce8fb5c092 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Mon, 7 Feb 2011 23:05:53 +0100 Subject: Remove some dead code --- sax/source/tools/converter.cxx | 2 -- 1 file changed, 2 deletions(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 40e8f5009d10..1e46a7e091df 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -41,8 +41,6 @@ using namespace rtl; using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::util; -//using namespace com::sun::star::text; -//using namespace com::sun::star::style; using namespace ::com::sun::star::i18n; namespace sax { -- cgit From ac83bc28e77a2b00646ac690f88517c0ba4313c1 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sun, 27 Feb 2011 17:05:28 +0100 Subject: Remove "using namespace ::rtl" --- sax/source/tools/converter.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 1e46a7e091df..fd93521261de 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -37,12 +37,14 @@ #include #include "sax/tools/converter.hxx" -using namespace rtl; using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::util; using namespace ::com::sun::star::i18n; +using ::rtl::OUString; +using ::rtl::OUStringBuffer; + namespace sax { static const sal_Char* gpsMM = "mm"; -- cgit From a0e2265a6c84203a693ed07fc6e8ce5c807aa913 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 1 Mar 2011 15:06:49 +0000 Subject: avoid implicit cast --- sax/source/tools/fastserializer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index 55a9811e4d3d..e894c2ca0d13 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -90,7 +90,7 @@ namespace sax_fastparser { OUString FastSaxSerializer::escapeXml( const OUString& s ) { ::rtl::OUStringBuffer sBuf( s.getLength() ); - const sal_Unicode* pStr = s; + const sal_Unicode* pStr = s.getStr(); sal_Int32 nLen = s.getLength(); for( sal_Int32 i = 0; i < nLen; ++i) { -- cgit From d86e9a3906b5c2c51a7a04dac0a63c9f74196991 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Sat, 12 Mar 2011 11:47:36 +0100 Subject: Move OSL_ENSURE(false,...) to OSL_FAIL(...) --- sax/source/tools/converter.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index fd93521261de..fd4c1de5a509 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -270,7 +270,7 @@ void Converter::convertMeasure( OUStringBuffer& rBuffer, sal_Int16 nSourceUnit /* = MeasureUnit::MM_100TH */, sal_Int16 nTargetUnit /* = MeasureUnit::INCH */ ) { - OSL_ENSURE( false, "Converter::convertMeasure - not implemented, tools/BigInt needs replacement" ); + OSL_FAIL( "Converter::convertMeasure - not implemented, tools/BigInt needs replacement" ); (void)rBuffer; (void)nMeasure; (void)nSourceUnit; @@ -661,7 +661,7 @@ bool Converter::convertDuration(double& rfTime, { //! how many days is a year or month? - OSL_ENSURE( false, "years or months in duration: not implemented"); + OSL_FAIL( "years or months in duration: not implemented"); bSuccess = false; } else -- cgit From 3efabdf926a4fa946fd2b52232309fc8858d80c6 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 16 Mar 2011 11:46:46 +0000 Subject: add a virtual dtor to baseclass --- sax/source/tools/fastserializer.hxx | 1 + 1 file changed, 1 insertion(+) (limited to 'sax/source/tools') diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx index 493ef5cb3c92..961875194a20 100644 --- a/sax/source/tools/fastserializer.hxx +++ b/sax/source/tools/fastserializer.hxx @@ -138,6 +138,7 @@ private: public: ForMerge() : maData(), maPostponed() {} + virtual ~ForMerge() {} virtual void setCurrentElement( ::sal_Int32 /*nToken*/ ) {} virtual Int8Sequence& getData(); -- cgit From cab6466023d2c13c39ba495a3f60bb1fb9370a1b Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Mon, 11 Apr 2011 21:46:23 +0200 Subject: small bug, "%d" instead of "%ld" in a printf --- sax/source/tools/fastserializer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index e894c2ca0d13..a44d148e1aba 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -514,7 +514,7 @@ namespace sax_fastparser { std::map< sal_Int32, Int8Sequence >::iterator iter = maData.begin(); while ( iter != maData.end( ) ) { - fprintf( stderr, "pair: %d, ", iter->first ); + fprintf( stderr, "pair: %ld, ", iter->first ); for ( sal_Int32 i=0, len=iter->second.getLength(); i < len; ++i ) fprintf( stderr, "%c", iter->second[i] ); fprintf( stderr, "\n" ); -- cgit From 7ec24fbe56590c4d8a49b0360225d41d7b316540 Mon Sep 17 00:00:00 2001 From: Nigel Hawkins Date: Fri, 27 May 2011 21:01:54 +0100 Subject: Fix build breakage with debug enabled. --- sax/source/tools/fastserializer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index a44d148e1aba..e894c2ca0d13 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -514,7 +514,7 @@ namespace sax_fastparser { std::map< sal_Int32, Int8Sequence >::iterator iter = maData.begin(); while ( iter != maData.end( ) ) { - fprintf( stderr, "pair: %ld, ", iter->first ); + fprintf( stderr, "pair: %d, ", iter->first ); for ( sal_Int32 i=0, len=iter->second.getLength(); i < len; ++i ) fprintf( stderr, "%c", iter->second[i] ); fprintf( stderr, "\n" ); -- cgit From 55076cad2ddf82188cb872a32afbe92c1258b5ea Mon Sep 17 00:00:00 2001 From: Nigel Hawkins Date: Sat, 28 May 2011 13:33:09 +0100 Subject: Replace cstdio with iostream in fastserializer.cxx --- sax/source/tools/fastserializer.cxx | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index e894c2ca0d13..68e2f5ebfac5 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -39,7 +39,7 @@ #include #if DEBUG -#include +#include #endif using ::comphelper::SequenceAsVector; @@ -354,12 +354,9 @@ namespace sax_fastparser { int i = 0; while ( !aCopy.empty() ) { - fprintf( stderr, "%d\n", nSize - i ); - + std::cerr << nSize - i << "\n"; aCopy.top( )->print( ); - - fprintf( stderr, "\n" ); - + std::cerr << "\n"; aCopy.pop( ); i++; } @@ -408,19 +405,19 @@ namespace sax_fastparser { #if DEBUG void FastSaxSerializer::ForMerge::print( ) { - fprintf( stderr, "Data: " ); + std::cerr << "Data: "; for ( sal_Int32 i=0, len=maData.getLength(); i < len; i++ ) { - fprintf( stderr, "%c", maData[i] ); + std::cerr << maData[i]; } - fprintf( stderr, "\nPostponed: " ); + std::cerr << "\nPostponed: "; for ( sal_Int32 i=0, len=maPostponed.getLength(); i < len; i++ ) { - fprintf( stderr, "%c", maPostponed[i] ); + std::cerr << maPostponed[i]; } - fprintf( stderr, "\n" ); + std::cerr << "\n"; } #endif @@ -514,10 +511,10 @@ namespace sax_fastparser { std::map< sal_Int32, Int8Sequence >::iterator iter = maData.begin(); while ( iter != maData.end( ) ) { - fprintf( stderr, "pair: %d, ", iter->first ); + std::cerr << "pair: " << iter->first; for ( sal_Int32 i=0, len=iter->second.getLength(); i < len; ++i ) - fprintf( stderr, "%c", iter->second[i] ); - fprintf( stderr, "\n" ); + std::cerr << iter->second[i]; + std::cerr << "\n"; ++iter; } -- cgit