[Libreoffice-commits] core.git: sax/source
sax/source/tools/converter.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 71448690d7c5904df45bf98243c5bb05a99245e5 Author: Stephan Bergmann Date: Tue Dec 17 17:20:42 2013 +0100 readUnsignedNumberMaxDigits can read more than maxDigits chars ...so that is what the std::min was good for that the previous commit erroneously removed. Change-Id: I0cb08ab79f85ce4b919232845994c9b8bae35646 diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 3ebe40c..fda7cb4 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -1123,8 +1123,8 @@ bool Converter::convertDuration(util::Duration& rDuration, if (-1 != nTemp) { nNanoSeconds = nTemp; -sal_Int32 nDigits = nPos - nStart; -assert(nDigits >= 0 && nDigits <= 9); +sal_Int32 nDigits = std::min(nPos - nStart, 9); +assert(nDigits >= 0); for (; nDigits < 9; ++nDigits) { nNanoSeconds *= 10; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/tools/converter.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit b9bcc9c5c10841dcdfa9ff5814344ce667678df3 Author: Stephan Bergmann Date: Tue Dec 17 17:29:58 2013 +0100 ...and nDigits > 9 is harmless in following for loop and need not be capped Change-Id: I30c4005e5983f5007edfed692b74f07b31899755 diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index fda7cb4..8b0b616 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -1123,7 +1123,7 @@ bool Converter::convertDuration(util::Duration& rDuration, if (-1 != nTemp) { nNanoSeconds = nTemp; -sal_Int32 nDigits = std::min(nPos - nStart, 9); +sal_Int32 nDigits = nPos - nStart; assert(nDigits >= 0); for (; nDigits < 9; ++nDigits) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/expatwrap/sax_expat.cxx | 32 +--- sax/source/expatwrap/saxwriter.cxx | 31 --- sax/source/fastparser/fastparser.cxx | 35 ++- 3 files changed, 51 insertions(+), 47 deletions(-) New commits: commit 71f33636dae11f3a53740ce73437255ad53641ed Author: Stephan Bergmann Date: Wed Dec 18 11:13:37 2013 +0100 Change from ServiceManager- to ComponentContext-based implementations Change-Id: Iba701c520ad27925bb5e67697e22132b53160ab2 diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index 83dff1a..4f00ad9 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -129,7 +129,11 @@ OUString XmlChar2OUString( const XML_Char *p ) class SaxExpatParser_Impl; -static Sequence< OUString > SaxExpatParser_getSupportedServiceNames(void) +OUString SaxExpatParser_getImplementationName() { +return OUString("com.sun.star.comp.extensions.xml.sax.ParserExpat"); +} + +Sequence< OUString > SaxExpatParser_getSupportedServiceNames(void) { Sequence seq(1); seq[0] = OUString("com.sun.star.xml.sax.Parser"); @@ -594,7 +598,7 @@ void SaxExpatParser::setLocale( const Locale & locale ) throw (RuntimeException) // XServiceInfo OUString SaxExpatParser::getImplementationName() throw () { -return OUString("com.sun.star.comp.extensions.xml.sax.ParserExpat"); +return SaxExpatParser_getImplementationName(); } // XServiceInfo @@ -1019,27 +1023,25 @@ void SaxExpatParser_Impl::callbackEndCDATA( void *pvThis ) CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS(pImpl,rExtendedDocumentHandler->endCDATA() ); } -} // namespace - -static Reference< XInterface > SaxExpatParser_CreateInstance( -SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & ) -throw(Exception) +Reference< XInterface > SAL_CALL SaxExpatParser_CreateInstance( +SAL_UNUSED_PARAMETER const Reference & ) +SAL_THROW((css::uno::Exception)) { SaxExpatParser *p = new SaxExpatParser; return Reference< XInterface > ( (OWeakObject * ) p ); } +} // namespace + extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory( -const char * , void *pServiceManager, void * ) +const char *, void *, void * ) { -Reference< XSingleServiceFactory > xFactory; -Reference< XMultiServiceFactory > xSMgr = -reinterpret_cast< XMultiServiceFactory * >( pServiceManager ); -xFactory = createSingleFactory( xSMgr, -"com.sun.star.comp.extensions.xml.sax.ParserExpat", -SaxExpatParser_CreateInstance, -SaxExpatParser_getSupportedServiceNames() ); +Reference xFactory( +cppu::createSingleComponentFactory( +&SaxExpatParser_CreateInstance, +SaxExpatParser_getImplementationName(), +SaxExpatParser_getSupportedServiceNames())); xFactory->acquire(); return xFactory.get(); } diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx index a6b9a31..b17f378 100644 --- a/sax/source/expatwrap/saxwriter.cxx +++ b/sax/source/expatwrap/saxwriter.cxx @@ -867,7 +867,11 @@ static inline sal_Int32 getFirstLineBreak( const OUString & str ) throw () return -1; } -static Sequence< OUString > SAXWriter_getSupportedServiceNames(void) throw () +OUString SAXWriter_getImplementationName() { +return OUString("com.sun.star.extensions.xml.sax.Writer"); +} + +Sequence< OUString > SAXWriter_getSupportedServiceNames(void) throw () { Sequence seq(1); seq.getArray()[0] = OUString("com.sun.star.xml.sax.Writer"); @@ -994,7 +998,7 @@ static inline sal_Bool isFirstCharWhitespace( const sal_Unicode *p ) throw() // XServiceInfo OUString SAXWriter::getImplementationName() throw() { -return OUString("com.sun.star.extensions.xml.sax.Writer"); +return SAXWriter_getImplementationName(); } // XServiceInfo @@ -1372,27 +1376,24 @@ void SAXWriter::unknown(const OUString& sString) throw (SAXException, RuntimeExc } } -} // namespace - -static Reference < XInterface > SAXWriter_CreateInstance( -SAL_UNUSED_PARAMETER const Reference < XMultiServiceFactory > & ) -throw (Exception) +Reference < XInterface > SAL_CALL SAXWriter_CreateInstance( +SAL_UNUSED_PARAMETER const Reference & ) +SAL_THROW((css::uno::Exception)) { SAXWriter *p = new SAXWriter; return Reference< XInterface > ( (static_cast< OWeakObject * >(p)) ); } +} // namespace + extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL com_sun_star_extensions_xml_sax_Writer_component_getFactory( -const char * , void *pServiceManager, void * ) +const char *, void *, void * ) { -Reference< XSingleServiceFactory > xFactory; -Reference< XMultiServiceFactory > xSMgr = -reinterpret_cast< XMultiServiceFactory * >( pServiceManager ); -xFactory = createSingleFacto
[Libreoffice-commits] core.git: sax/source
sax/source/fastparser/fastparser.cxx | 145 ++- 1 file changed, 77 insertions(+), 68 deletions(-) New commits: commit 59003de73eff0da22d01f2fd3cddc78bf3a3a3f8 Author: Michael Meeks Date: Fri Dec 20 16:18:48 2013 + fastparser: fix load regression Remove erroneous assert: maSavedException is indeed empty for XML parser reported exceptions. Clean cut/paste code, and comment. Change-Id: Ia538bcc87a7efcd079d3021e00ac4d2eb62f3e8d diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 04cfbee..3b93765 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -77,12 +77,12 @@ enum CallbackType { INVALID, START_ELEMENT, END_ELEMENT, CHARACTERS, DONE, EXCEP struct Event { -OUString msChars; +CallbackType maType; sal_Int32 mnElementToken; OUString msNamespace; OUString msElementName; rtl::Reference< FastAttributeList > mxAttributes; -CallbackType maType; +OUString msChars; }; struct NameWithToken @@ -165,9 +165,13 @@ struct Entity : public ParserData XML_Parser mpParser; ::sax_expatwrap::XMLFile2UTFConverter maConverter; -// Exceptions cannot be thrown through the C-XmlParser (possible resource leaks), -// therefore the exception must be saved somewhere. -::com::sun::star::uno::Any maSavedException; +// Exceptions cannot be thrown through the C-XmlParser (possible +// resource leaks), therefore any exception thrown by a UNO callback +// must be saved somewhere until the C-XmlParser is stopped. +::com::sun::star::uno::Any maSavedException; +void saveException( const Exception &e ); +void throwException( const ::rtl::Reference< FastLocatorImpl > &xDocumentLocator, + bool mbDuringParse ); ::std::stack< NameWithToken > maNamespaceStack; /* Context for main thread consuming events. @@ -272,9 +276,10 @@ private: { mpParser->parse(); } -catch (const SAXParseException&) +catch (const Exception &e) { -mpParser->getEntity().getEvent( EXCEPTION ); +Entity &rEntity = mpParser->getEntity(); +rEntity.getEvent( EXCEPTION ); mpParser->produce( EXCEPTION ); } } @@ -454,7 +459,7 @@ void Entity::startElement( Event *pEvent ) } catch (const Exception& e) { -maSavedException <<= e; +saveException( e ); } } @@ -467,7 +472,7 @@ void Entity::characters( const OUString& sChars ) } catch (const Exception& e) { -maSavedException <<= e; +saveException( e ); } } @@ -485,7 +490,7 @@ void Entity::endElement() } catch (const Exception& e) { -maSavedException <<= e; +saveException( e ); } maContextStack.pop(); } @@ -781,7 +786,7 @@ void FastSaxParserImpl::parseStream( const InputSource& maStructSource) throw (S { popEntity(); XML_ParserFree( entity.mpParser ); - throw; +throw; } catch (const IOException&) { @@ -958,7 +963,7 @@ bool FastSaxParserImpl::consume(EventList *pEventList) { Entity& rEntity = getEntity(); for (EventList::iterator aEventIt = pEventList->begin(); -aEventIt != pEventList->end(); ++aEventIt) + aEventIt != pEventList->end(); ++aEventIt) { switch ((*aEventIt).maType) { @@ -974,28 +979,8 @@ bool FastSaxParserImpl::consume(EventList *pEventList) case DONE: return false; case EXCEPTION: -{ -assert( rEntity.maSavedException.hasValue() ); -// Error during parsing ! -XML_Error xmlE = XML_GetErrorCode( rEntity.mpParser ); -OUString sSystemId = mxDocumentLocator->getSystemId(); -sal_Int32 nLine = mxDocumentLocator->getLineNumber(); - -SAXParseException aExcept( -lclGetErrorMessage( xmlE, sSystemId, nLine ), -Reference< XInterface >(), -Any( &rEntity.maSavedException, getCppuType( &rEntity.maSavedException ) ), -mxDocumentLocator->getPublicId(), -mxDocumentLocator->getSystemId(), -mxDocumentLocator->getLineNumber(), -mxDocumentLocator->getColumnNumber() -); -// error handler is set, it may throw the exception -if( rEntity.mxErrorHandler.is() ) -rEntity.mxErrorHandler->fatalError( Any( aExcept ) ); - -throw aExcept; -} +rEntity.throwException( mxDocumentLocator, false ); +return false; default: assert(false); ret
[Libreoffice-commits] core.git: sax/source
sax/source/fastparser/fastparser.cxx | 92 +-- 1 file changed, 46 insertions(+), 46 deletions(-) New commits: commit 169eb25c86c28aae02345c92e04572abbf08d77a Author: Michael Meeks Date: Fri Dec 20 16:36:42 2013 + fastparser:: move Entity:: code into the anonymous namespace. Change-Id: I564e35aa63e4c01cc1a0fb45f674dc1a2a0e89ec diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 3b93765..9171652 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -528,6 +528,52 @@ Event& Entity::getEvent( CallbackType aType ) return rEvent; } +// throw an exception, but avoid callback if +// during a threaded produce +void Entity::throwException( const ::rtl::Reference< FastLocatorImpl > &xDocumentLocator, + bool mbDuringParse ) +{ +// Error during parsing ! +SAXParseException aExcept( +lclGetErrorMessage( XML_GetErrorCode( mpParser ), +xDocumentLocator->getSystemId(), +xDocumentLocator->getLineNumber() ), +Reference< XInterface >(), +Any( &maSavedException, getCppuType( &maSavedException ) ), +xDocumentLocator->getPublicId(), +xDocumentLocator->getSystemId(), +xDocumentLocator->getLineNumber(), +xDocumentLocator->getColumnNumber() +); + +// error handler is set, it may throw the exception +if( !mbDuringParse || !mbEnableThreads ) +{ +if (mxErrorHandler.is() ) +mxErrorHandler->fatalError( Any( aExcept ) ); +} + +// error handler has not thrown, but parsing must stop => throw ourselves +throw aExcept; +} + +// In the single threaded case we emit events via our C +// callbacks, so any exception caught must be queued up until +// we can safely re-throw it from our C++ parent of parse() +// +// If multi-threaded, we need to push an EXCEPTION event, at +// which point we transfer ownership of maSavedException to +// the consuming thread. +void Entity::saveException( const Exception &e ) +{ +// only store the first exception +if( !maSavedException.hasValue() ) +{ +maSavedException <<= e; +XML_StopParser( mpParser, /* resumable? */ XML_FALSE ); +} +} + } // namespace namespace sax_fastparser { @@ -1009,35 +1055,6 @@ const Entity& FastSaxParserImpl::getEntity() const return maEntities.top(); } -// throw an exception, but avoid callback if -// during a threaded produce -void Entity::throwException( const ::rtl::Reference< FastLocatorImpl > &xDocumentLocator, - bool mbDuringParse ) -{ -// Error during parsing ! -SAXParseException aExcept( -lclGetErrorMessage( XML_GetErrorCode( mpParser ), -xDocumentLocator->getSystemId(), -xDocumentLocator->getLineNumber() ), -Reference< XInterface >(), -Any( &maSavedException, getCppuType( &maSavedException ) ), -xDocumentLocator->getPublicId(), -xDocumentLocator->getSystemId(), -xDocumentLocator->getLineNumber(), -xDocumentLocator->getColumnNumber() -); - -// error handler is set, it may throw the exception -if( !mbDuringParse || !mbEnableThreads ) -{ -if (mxErrorHandler.is() ) -mxErrorHandler->fatalError( Any( aExcept ) ); -} - -// error handler has not thrown, but parsing must stop => throw ourselves -throw aExcept; -} - // starts parsing with actual parser ! void FastSaxParserImpl::parse() { @@ -1068,23 +1085,6 @@ void FastSaxParserImpl::parse() produce( DONE ); } -// In the single threaded case we emit events via our C -// callbacks, so any exception caught must be queued up until -// we can safely re-throw it from our C++ parent of parse() -// -// If multi-threaded, we need to push an EXCEPTION event, at -// which point we transfer ownership of maSavedException to -// the consuming thread. -void Entity::saveException( const Exception &e ) -{ -// only store the first exception -if( !maSavedException.hasValue() ) -{ -maSavedException <<= e; -XML_StopParser( mpParser, /* resumable? */ XML_FALSE ); -} -} - //-- // // The C-Callbacks ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/fastparser/fastparser.cxx | 82 +-- 1 file changed, 41 insertions(+), 41 deletions(-) New commits: commit 838a6011c19870ea36695aab4b4497dcbd1880f5 Author: Michael Meeks Date: Fri Dec 20 16:45:15 2013 + fastparser: move lclGetErrorMessage into the anonymous namespace. Change-Id: I70e1597f917c2a8dedb5b38807dfde7ec05a1a39 diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 9171652..f2f90c4 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -528,6 +528,47 @@ Event& Entity::getEvent( CallbackType aType ) return rEvent; } +OUString lclGetErrorMessage( XML_Error xmlE, const OUString& sSystemId, sal_Int32 nLine ) +{ +const sal_Char* pMessage = ""; +switch( xmlE ) +{ +case XML_ERROR_NONE:pMessage = "No"; break; +case XML_ERROR_NO_MEMORY: pMessage = "no memory"; break; +case XML_ERROR_SYNTAX: pMessage = "syntax"; break; +case XML_ERROR_NO_ELEMENTS: pMessage = "no elements"; break; +case XML_ERROR_INVALID_TOKEN: pMessage = "invalid token"; break; +case XML_ERROR_UNCLOSED_TOKEN: pMessage = "unclosed token";break; +case XML_ERROR_PARTIAL_CHAR:pMessage = "partial char"; break; +case XML_ERROR_TAG_MISMATCH:pMessage = "tag mismatch"; break; +case XML_ERROR_DUPLICATE_ATTRIBUTE: pMessage = "duplicate attribute"; break; +case XML_ERROR_JUNK_AFTER_DOC_ELEMENT: pMessage = "junk after doc element";break; +case XML_ERROR_PARAM_ENTITY_REF:pMessage = "parameter entity reference";break; +case XML_ERROR_UNDEFINED_ENTITY:pMessage = "undefined entity"; break; +case XML_ERROR_RECURSIVE_ENTITY_REF:pMessage = "recursive entity reference";break; +case XML_ERROR_ASYNC_ENTITY:pMessage = "async entity"; break; +case XML_ERROR_BAD_CHAR_REF:pMessage = "bad char reference";break; +case XML_ERROR_BINARY_ENTITY_REF: pMessage = "binary entity reference"; break; +case XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF: pMessage = "attribute external entity reference"; break; +case XML_ERROR_MISPLACED_XML_PI:pMessage = "misplaced xml processing instruction"; break; +case XML_ERROR_UNKNOWN_ENCODING:pMessage = "unknown encoding"; break; +case XML_ERROR_INCORRECT_ENCODING: pMessage = "incorrect encoding";break; +case XML_ERROR_UNCLOSED_CDATA_SECTION: pMessage = "unclosed cdata section";break; +case XML_ERROR_EXTERNAL_ENTITY_HANDLING:pMessage = "external entity reference"; break; +case XML_ERROR_NOT_STANDALONE: pMessage = "not standalone";break; +default:; +} + +OUStringBuffer aBuffer( '[' ); +aBuffer.append( sSystemId ); +aBuffer.append( " line " ); +aBuffer.append( nLine ); +aBuffer.append( "]: " ); +aBuffer.appendAscii( pMessage ); +aBuffer.append( " error" ); +return aBuffer.makeStringAndClear(); +} + // throw an exception, but avoid callback if // during a threaded produce void Entity::throwException( const ::rtl::Reference< FastLocatorImpl > &xDocumentLocator, @@ -902,47 +943,6 @@ void FastSaxParserImpl::setLocale( const Locale & Locale ) throw (RuntimeExcepti maData.maLocale = Locale; } -static OUString lclGetErrorMessage( XML_Error xmlE, const OUString& sSystemId, sal_Int32 nLine ) -{ -const sal_Char* pMessage = ""; -switch( xmlE ) -{ -case XML_ERROR_NONE:pMessage = "No"; break; -case XML_ERROR_NO_MEMORY: pMessage = "no memory"; break; -case XML_ERROR_SYNTAX: pMessage = "syntax"; break; -case XML_ERROR_NO_ELEMENTS: pMessage = "no elements"; break; -case XML_ERROR_INVALID_TOKEN: pMessage = "invalid token"; break; -case XML_ERROR_UNCLOSED_TOKEN: pMessage = "unclosed token";
[Libreoffice-commits] core.git: sax/source
sax/source/tools/fastattribs.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ada73e588fe0f948bf49591974f466602452fd10 Author: Miklos Vajna Date: Wed Nov 20 07:49:00 2013 +0100 sax: -Werror=sign-compare Change-Id: I2e7d482b29fc5859c32fa1731a5f1fd551509e88 diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx index c0a92a1..4b591a0 100644 --- a/sax/source/tools/fastattribs.cxx +++ b/sax/source/tools/fastattribs.cxx @@ -194,7 +194,7 @@ sal_Int32 FastTokenLookup::getTokenFromChars( if( !nLen ) nLen = strlen( pToken ); -if ( nLen < mnUtf8BufferSize ) +if ( static_cast(nLen) < mnUtf8BufferSize ) { // Get intimiate with the underlying sequence cf. sal/types.h sal_Sequence *pSeq = maUtf8Buffer.get(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/fastparser/fastparser.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit b7a8fc55854bbd7b977783e76e9a19354d0e74a6 Author: Michael Meeks Date: Sat Nov 23 10:02:34 2013 + fastparser: avoid allocation and conversion of elementnames we don't need. Change-Id: I4c09aaa12b53181e50662de2721d170c195c7c86 diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 8f68051..da224d0 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -998,14 +998,18 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char rEvent.mnElementToken = GetToken( pName ); if( rEvent.mnElementToken == FastToken::DONTKNOW ) +{ if( nPrefixLen > 0 ) { rEvent.msNamespace = GetNamespaceURL( pPrefix, nPrefixLen ); nNamespaceToken = GetNamespaceToken( rEvent.msNamespace ); } +rEvent.msElementName = OUString( pName, nNameLen, RTL_TEXTENCODING_UTF8 ); +} +else // token is always preferred. +rEvent.msElementName = OUString( "" ); rEntity.maNamespaceStack.push( NameWithToken(rEvent.msNamespace, nNamespaceToken) ); -rEvent.msElementName = OUString(pName, nNameLen, RTL_TEXTENCODING_UTF8); if (rEntity.mbEnableThreads) produce( START_ELEMENT ); else ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/tools/converter.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 87cce82dbc0ae24b207c45dc3f27c8f51c0fbb8b Author: Julien Nabet Date: Sun Nov 24 15:07:07 2013 +0100 cppcheck: fix same expression on both sides Change-Id: I3de69e2ae186ea1ae8f792588c04b4e799ce1331 diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index a2b3dd0..c77e02a 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -2330,7 +2330,7 @@ sal_Int16 Converter::GetUnitFromString(const OUString& rString, sal_Int16 nDefau case sal_Unicode('I'): { if(nPos+1 < nLen && (rString[nPos+1] == 'n' -|| rString[nPos+1] == 'n')) +|| rString[nPos+1] == 'N')) nRetUnit = MeasureUnit::INCH; break; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/fastparser/fastparser.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 9eaf15563ac51a802e3ce84af3ee49cedf4f4484 Author: Stephan Bergmann Date: Tue Nov 26 17:31:11 2013 +0100 Presumably wants to use strcmp Change-Id: I978a692fbf464b476811b445b16c7e1b0eec9e25 diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 1bfb15e..a6bbfbb 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -950,7 +950,7 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char assert(awAttributes[i+1]); if( awAttributes[i][0] != 'x' || -strncmp( awAttributes[i], "xmlns") != 0 ) +strcmp( awAttributes[i], "xmlns") != 0 ) continue; splitName( awAttributes[i], pPrefix, nPrefixLen, pName, nNameLen ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/fastparser/fastparser.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit d8db8ea918faf1e1ea100de20d156725d9d51fc9 Author: Michael Meeks Date: Tue Nov 26 17:39:26 2013 + fastparser: strncmp needs a length. diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index a6bbfbb..afe9454 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -950,7 +950,7 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char assert(awAttributes[i+1]); if( awAttributes[i][0] != 'x' || -strcmp( awAttributes[i], "xmlns") != 0 ) +strncmp( awAttributes[i], "xmlns", 5) != 0 ) continue; splitName( awAttributes[i], pPrefix, nPrefixLen, pName, nNameLen ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/tools/fastattribs.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 1afc1c033b1ce636eb258a218a26f24c7ad648ed Author: Michael Meeks Date: Wed Nov 27 10:06:24 2013 + Urgh - add embarassingly missing ~ Change-Id: I6ffcb1561920eba2cbc3fa019431d84f07386570 diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx index 595c736..617376f 100644 --- a/sax/source/tools/fastattribs.cxx +++ b/sax/source/tools/fastattribs.cxx @@ -28,7 +28,7 @@ namespace sax_fastparser { // wasteage to keep MSVC happy vs. an in-line {} -FastTokenHandlerBase::FastTokenHandlerBase() +FastTokenHandlerBase::~FastTokenHandlerBase() { } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/fastparser/fastparser.cxx | 22 +- 1 file changed, 9 insertions(+), 13 deletions(-) New commits: commit 4754b8ac5074d86234cafe1b1401f6d22f14b929 Author: Michael Meeks Date: Tue Dec 31 12:59:03 2013 + fastparser: avoid std::stack::top() - cache it's results. amazingly std::stack::top() takes 146 pseudo-cycles to do not much, so instead cache the result in a single pointer in lieu of burning that code. Change-Id: Ie326be47da6cbad0850e5f1026a1632bb840b6b8 diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index f2f90c4..96993f8 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -224,8 +224,8 @@ public: void pushEntity( const Entity& rEntity ); void popEntity(); -Entity& getEntity(); -const Entity& getEntity() const; +Entity& getEntity() { return *mpTop; } +const Entity& getEntity() const { return *mpTop; } void parse(); void produce( CallbackType aType ); @@ -256,6 +256,8 @@ private: NamespaceMapmaNamespaceMap; ParserData maData; /// Cached parser configuration for next call of parseStream(). + +Entity *mpTop; /// std::stack::top() is amazingly slow => cache this. ::std::stack< Entity > maEntities; /// Entity stack for each call of parseStream(). FastTokenLookup maTokenLookup; }; @@ -619,7 +621,9 @@ void Entity::saveException( const Exception &e ) namespace sax_fastparser { -FastSaxParserImpl::FastSaxParserImpl( FastSaxParser* pFront ) : mpFront(pFront) +FastSaxParserImpl::FastSaxParserImpl( FastSaxParser* pFront ) : +mpFront(pFront), +mpTop(NULL) { mxDocumentLocator.set( new FastLocatorImpl( this ) ); } @@ -1038,21 +1042,13 @@ bool FastSaxParserImpl::consume(EventList *pEventList) void FastSaxParserImpl::pushEntity( const Entity& rEntity ) { maEntities.push( rEntity ); +mpTop = &maEntities.top(); } void FastSaxParserImpl::popEntity() { maEntities.pop(); -} - -Entity& FastSaxParserImpl::getEntity() -{ -return maEntities.top(); -} - -const Entity& FastSaxParserImpl::getEntity() const -{ -return maEntities.top(); +mpTop = &maEntities.top(); } // starts parsing with actual parser ! ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/fastparser/fastparser.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c6aea0bac0b168c3b0e5172d10e2d974cf5fd331 Author: Caolán McNamara Date: Tue Dec 31 19:48:17 2013 + don't call top on an empty stack Change-Id: Ibe4b4d3785535816b40d46fd0baa60f01e1f9d33 diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 96993f8..93b58d8 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -1048,7 +1048,7 @@ void FastSaxParserImpl::pushEntity( const Entity& rEntity ) void FastSaxParserImpl::popEntity() { maEntities.pop(); -mpTop = &maEntities.top(); +mpTop = !maEntities.empty() ? &maEntities.top() : NULL; } // starts parsing with actual parser ! ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/fastparser/fastparser.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 308fdfb1a9176f65c11d82b95e3aa73b87e2fe47 Author: Tor Lillqvist Date: Fri Jan 3 11:34:10 2014 +0200 WaE: C4101: 'e' : unreferenced local variable Change-Id: I06c0f9dc742736f632ed9210ae954e0dc19ca19d diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 93b58d8..3472524 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -278,7 +278,7 @@ private: { mpParser->parse(); } -catch (const Exception &e) +catch (const Exception &) { Entity &rEntity = mpParser->getEntity(); rEntity.getEvent( EXCEPTION ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/fastparser/fastparser.cxx | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) New commits: commit be090d5a50d5c38d22303e88c1866c827aeab057 Author: Caolán McNamara Date: Thu Jan 23 16:14:29 2014 + coverity#1158444 Uninitialized scalar field Change-Id: I15f6c6288e2a951543702a15e777167f2240899e diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index a3e201c..2c18bb2 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -390,19 +390,20 @@ Entity::Entity( const ParserData& rData ) : mpProducedEvents = 0; } -Entity::Entity( const Entity& e ) : -ParserData( e ) -,mbEnableThreads(e.mbEnableThreads) -,maStructSource(e.maStructSource) -,mpParser(e.mpParser) -,maConverter(e.maConverter) -,maSavedException(e.maSavedException) -,maNamespaceStack(e.maNamespaceStack) -,maContextStack(e.maContextStack) -,maNamespaceCount(e.maNamespaceCount) -,maNamespaceDefines(e.maNamespaceDefines) +Entity::Entity(const Entity& e) +: ParserData(e) +, mnProducedEventsSize(0) +, mpProducedEvents(NULL) +, mbEnableThreads(e.mbEnableThreads) +, maStructSource(e.maStructSource) +, mpParser(e.mpParser) +, maConverter(e.maConverter) +, maSavedException(e.maSavedException) +, maNamespaceStack(e.maNamespaceStack) +, maContextStack(e.maContextStack) +, maNamespaceCount(e.maNamespaceCount) +, maNamespaceDefines(e.maNamespaceDefines) { -mpProducedEvents = 0; } Entity::~Entity() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/expatwrap/xml2utf.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit c958c4ed117a46889afc59ae52502b7262c9ea5c Author: Julien Nabet Date: Fri Aug 23 07:54:04 2013 +0200 cppcheck: fix duplicate if/else I don't know if it's possible to parse EBCDIC knowing that there are several implementations So I commented the block and added a TODO. => no time wasted for this block (ok "micro waste")+ 1 less cppcheck report Change-Id: I72b72b68295eab7be5332166b955adaddf6ee5c3 diff --git a/sax/source/expatwrap/xml2utf.cxx b/sax/source/expatwrap/xml2utf.cxx index 76713d9..34440bf 100644 --- a/sax/source/expatwrap/xml2utf.cxx +++ b/sax/source/expatwrap/xml2utf.cxx @@ -314,12 +314,14 @@ sal_Bool XMLFile2UTFConverter::scanForEncoding( Sequence< sal_Int8 > &seq ) // UCS-4 little endian m_sEncoding = "ucs-4"; } +/* TODO: no need to test for the moment since we return sal_False like default case anyway else if( 0x4c == pSource[0] && 0x6f == pSource[1] && 0xa7 == static_cast (pSource[2]) && 0x94 == static_cast (pSource[3]) ) { // EBCDIC bReturn = sal_False; // must be extended } +*/ else { // other // UTF8 is directly recognized by the parser. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/fastparser/fastparser.cxx | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) New commits: commit 94f99a6baeb27af70f4aa74e74a3090d50f24470 Author: Matúš Kukan Date: Thu Oct 17 22:56:58 2013 +0200 sax: build fix: don't prefix enum values Change-Id: I6f4eac6103821227bc72de8c3bb0fb89a7a8bc9d diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index d7635d9..fa8990d 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -76,8 +76,8 @@ private: } catch (const SAXParseException& e) { -mpParser->getEntity().getEvent( CallbackType::EXCEPTION ); -mpParser->produce( CallbackType::EXCEPTION ); +mpParser->getEntity().getEvent( EXCEPTION ); +mpParser->produce( EXCEPTION ); } } }; @@ -798,8 +798,8 @@ void FastSaxParser::deleteUsedEvents() void FastSaxParser::produce( CallbackType aType ) { Entity& rEntity = getEntity(); -if (aType == CallbackType::DONE || -aType == CallbackType::EXCEPTION || +if (aType == DONE || +aType == EXCEPTION || rEntity.mnProducedEventsSize == rEntity.mnEventListSize) { osl::ResettableMutexGuard aGuard(rEntity.maEventProtector); @@ -829,18 +829,18 @@ bool FastSaxParser::consume(EventList *pEventList) { switch ((*aEventIt).maType) { -case CallbackType::START_ELEMENT: +case START_ELEMENT: rEntity.startElement( &(*aEventIt) ); break; -case CallbackType::END_ELEMENT: +case END_ELEMENT: rEntity.endElement(); break; -case CallbackType::CHARACTERS: +case CHARACTERS: rEntity.characters( (*aEventIt).msChars ); break; -case CallbackType::DONE: +case DONE: return false; -case CallbackType::EXCEPTION: +case EXCEPTION: { assert( rEntity.maSavedException.hasValue() ); // Error during parsing ! @@ -918,9 +918,9 @@ void FastSaxParser::parse() } } while( nRead > 0 ); -rEntity.getEvent( CallbackType::DONE ); +rEntity.getEvent( DONE ); if (rEntity.mbEnableThreads) -produce( CallbackType::DONE ); +produce( DONE ); } //-- @@ -943,7 +943,7 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char } // create attribute map and process namespace instructions -Event& rEvent = getEntity().getEvent( CallbackType::START_ELEMENT ); +Event& rEvent = getEntity().getEvent( START_ELEMENT ); if (rEvent.mxAttributes.is()) rEvent.mxAttributes->clear(); else @@ -1038,7 +1038,7 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char rEntity.maNamespaceStack.push( NameWithToken(rEvent.msNamespace, nNamespaceToken) ); rEvent.msElementName = OUString(pName, nNameLen, RTL_TEXTENCODING_UTF8); if (rEntity.mbEnableThreads) -produce( CallbackType::START_ELEMENT ); +produce( START_ELEMENT ); else rEntity.startElement( &rEvent ); } @@ -1059,9 +1059,9 @@ void FastSaxParser::callbackEndElement( SAL_UNUSED_PARAMETER const XML_Char* ) if( !rEntity.maNamespaceStack.empty() ) rEntity.maNamespaceStack.pop(); -rEntity.getEvent( CallbackType::END_ELEMENT ); +rEntity.getEvent( END_ELEMENT ); if (rEntity.mbEnableThreads) -produce( CallbackType::END_ELEMENT ); +produce( END_ELEMENT ); else rEntity.endElement(); } @@ -1070,10 +1070,10 @@ void FastSaxParser::callbackEndElement( SAL_UNUSED_PARAMETER const XML_Char* ) void FastSaxParser::callbackCharacters( const XML_Char* s, int nLen ) { Entity& rEntity = getEntity(); -Event& rEvent = rEntity.getEvent( CallbackType::CHARACTERS ); +Event& rEvent = rEntity.getEvent( CHARACTERS ); rEvent.msChars = OUString(s, nLen, RTL_TEXTENCODING_UTF8); if (rEntity.mbEnableThreads) -produce( CallbackType::CHARACTERS ); +produce( CHARACTERS ); else rEntity.characters( rEvent.msChars ); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/fastparser/fastparser.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit e2d061fe93c077c3946376bdb2c63da943b4b0b1 Author: Tor Lillqvist Date: Mon Oct 21 09:13:43 2013 +0300 WaE: unreferenced local variable Change-Id: I9783f03e656049b4f3b7f0a26a7ae626db5a13f6 diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index fa8990d..7ddfcff 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -74,7 +74,7 @@ private: { mpParser->parse(); } -catch (const SAXParseException& e) +catch (const SAXParseException&) { mpParser->getEntity().getEvent( EXCEPTION ); mpParser->produce( EXCEPTION ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/expatwrap/sax_expat.cxx |5 + sax/source/expatwrap/saxwriter.cxx |5 + sax/source/fastparser/fastparser.cxx |5 + 3 files changed, 3 insertions(+), 12 deletions(-) New commits: commit f740673ed74b1e2daf2a65d9b167dc3a38e1dd25 Author: Stephan Bergmann Date: Thu Aug 7 18:35:59 2014 +0200 Avoid incomplete type in fn sig to keep ubsan's RTTI-based checks happy Change-Id: I2d4e4be562cc752e7545792b148d5ed0cf551f25 diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index 9735e07..78906eb 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -48,10 +49,6 @@ using namespace ::com::sun::star::io; #include "attrlistimpl.hxx" #include "xml2utf.hxx" -namespace com { namespace sun { namespace star { namespace uno { -class XComponentContext; -} } } } - namespace { // Useful macros for correct String conversion depending on the chosen expat-mode diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx index 331173e..0409240 100644 --- a/sax/source/expatwrap/saxwriter.cxx +++ b/sax/source/expatwrap/saxwriter.cxx @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -51,10 +52,6 @@ using namespace ::com::sun::star::io; #include "xml2utf.hxx" #include -namespace com { namespace sun { namespace star { namespace uno { -class XComponentContext; -} } } } - #define LINEFEED 10 #define SEQUENCESIZE 1024 #define MAXCOLUMNCOUNT 72 diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index d3103d1..1e08851 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -22,6 +22,7 @@ #include "xml2utf.hxx" #include +#include #include #include #include @@ -45,10 +46,6 @@ #include #include -namespace com { namespace sun { namespace star { namespace uno { -class XComponentContext; -} } } } - using namespace ::std; using namespace ::osl; using namespace ::cppu; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/fastparser/fastparser.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit 3ede68e1cc879e6adbf6336eccaf88ced974b8b6 Author: Kohei Yoshida Date: Mon Jun 30 13:43:55 2014 -0400 Don't go further and pop the stack if it's empty. Change-Id: I27bd30ca65cf0066cd022b4b060757913ea01fed diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 336f5ee..e8662b4 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -472,6 +472,12 @@ void Entity::characters( const OUString& sChars ) void Entity::endElement() { +if (maContextStack.empty()) +{ +// Malformed XML stream !? +return; +} + const SaxContext& aContext = maContextStack.top(); const Reference< XFastContextHandler >& xContext( aContext.mxContext ); if( xContext.is() ) try ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/fastparser/fastparser.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit 3f177756dbdb67d901453000c3f11694770d2761 Author: Kohei Yoshida Date: Mon Jun 30 14:01:16 2014 -0400 Check for empty() before calling top(). Else it might crash sometimes. Change-Id: I6a24fff83c3d36346debae5c0f2b8c0646a15c01 diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index e8662b4..82378b1 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -660,6 +660,9 @@ sal_Int32 FastSaxParserImpl::GetTokenWithPrefix( const sal_Char*pPrefix, int nPr sal_Int32 nNamespaceToken = FastToken::DONTKNOW; Entity& rEntity = getEntity(); +if (rEntity.maNamespaceCount.empty()) +return nNamespaceToken; + sal_uInt32 nNamespace = rEntity.maNamespaceCount.top(); while( nNamespace-- ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/tools/fastserializer.hxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit 0f6888a25b3d39eca2b7aac596121dc0128c7c6a Author: Miklos Vajna Date: Thu Jul 3 15:35:44 2014 +0200 FastSaxSerializer: update documentation Change-Id: I5e374c426a4741a88d43848392fc83e2368dbf92 diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx index fbbaede..da8c527 100644 --- a/sax/source/tools/fastserializer.hxx +++ b/sax/source/tools/fastserializer.hxx @@ -120,20 +120,20 @@ public: This is to be able to change the order of the data being written. If you need to write eg. - p, r, rPr, [something], /rPr, t, [text], /r, /p, + p, r, rPr, [something], /rPr, t, [text], /t, /r, /p, but get it in order p, r, t, [text], /t, rPr, [something], /rPr, /r, /p, simply do p, r, mark(), t, [text], /t, mark(), rPr, [something], /rPr, - mergeTopMarks( true ), mergeTopMarks(), /r, /p + mergeTopMarks( MERGE_MARKS_PREPEND ), mergeTopMarks( MERGE_MARKS_APPEND ), /r, /p and you are done. */ void mark( const Int32Sequence& aOrder = Int32Sequence() ); /** Merge 2 topmost marks. -There are 3 possibilities - prepend the top before the second top-most -mark, append it, or append it later; prepending brings the possibility +The possibilities: prepend the top before the second top-most +mark, append it, append it later or ignore; prepending brings the possibility to switch parts of the output, appending later allows to write some output in advance. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/fastparser/fastparser.cxx | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) New commits: commit 9af1cbf233620e7c9d3fa9d8f55ab0e05dca6c84 Author: Michael Meeks Date: Fri Jul 11 20:49:33 2014 +0100 fdo#81214 - tolerate exceptions thrown inside XFastParser callbacks. Not an ideal solution; ideally we should not throw the exceptions, and stop the parser as soon as something bad like this happens; but hopefully exception throwing is reasonable exceptional. Change-Id: If619592533b2929c671e2b03eb8a83480bd92c54 diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 17e0213..d3103d1 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -607,12 +607,11 @@ void Entity::throwException( const ::rtl::Reference< FastLocatorImpl > &xDocumen // the consuming thread. void Entity::saveException( const Exception &e ) { -// only store the first exception -if( !maSavedException.hasValue() ) -{ -maSavedException <<= e; -XML_StopParser( mpParser, /* resumable? */ XML_FALSE ); -} +// fdo#81214 - allow the parser to run on after an exception, +// unexpectedly some 'startElements' produce an UNO_QUERY_THROW +// for XComponent; and yet expect to continue parsing. +SAL_WARN("sax", "Unexpected exception from XML parser " << e.Message); +maSavedException <<= e; } } // namespace ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/fastparser/fastparser.cxx | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) New commits: commit 59f1e330f0ecbb7d2387c1569c19fd055c162f8f Author: Matúš Kukan Date: Tue Aug 26 15:03:24 2014 +0200 Use plain bool parameter here Change-Id: Ic948889a0fac32adc48a7a4fb1e7f82ce8b08ba4 diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 1e08851..37b5133 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -224,7 +224,7 @@ public: Entity& getEntity() { return *mpTop; } const Entity& getEntity() const { return *mpTop; } void parse(); -void produce( CallbackType aType ); +void produce( bool bForceFlush = false ); bool hasNamespaceURL( const OUString& rPrefix ) const; @@ -276,7 +276,7 @@ private: { Entity &rEntity = mpParser->getEntity(); rEntity.getEvent( EXCEPTION ); -mpParser->produce( EXCEPTION ); +mpParser->produce( true ); } } }; @@ -947,11 +947,10 @@ void FastSaxParserImpl::deleteUsedEvents() } } -void FastSaxParserImpl::produce( CallbackType aType ) +void FastSaxParserImpl::produce( bool bForceFlush ) { Entity& rEntity = getEntity(); -if (aType == DONE || -aType == EXCEPTION || +if (bForceFlush || rEntity.mnProducedEventsSize == rEntity.mnEventListSize) { osl::ResettableMutexGuard aGuard(rEntity.maEventProtector); @@ -1063,7 +1062,7 @@ void FastSaxParserImpl::parse() while( nRead > 0 ); rEntity.getEvent( DONE ); if( rEntity.mbEnableThreads ) -produce( DONE ); +produce( true ); } // The C-Callbacks @@ -1186,7 +1185,7 @@ void FastSaxParserImpl::callbackStartElement( const XML_Char* pwName, const XML_ rEntity.maNamespaceStack.push( NameWithToken(rEvent.msNamespace, nNamespaceToken) ); if (rEntity.mbEnableThreads) -produce( START_ELEMENT ); +produce(); else rEntity.startElement( &rEvent ); } @@ -1209,7 +1208,7 @@ void FastSaxParserImpl::callbackEndElement( SAL_UNUSED_PARAMETER const XML_Char* rEntity.getEvent( END_ELEMENT ); if (rEntity.mbEnableThreads) -produce( END_ELEMENT ); +produce(); else rEntity.endElement(); } @@ -1220,7 +1219,7 @@ void FastSaxParserImpl::callbackCharacters( const XML_Char* s, int nLen ) Event& rEvent = rEntity.getEvent( CHARACTERS ); rEvent.msChars = OUString(s, nLen, RTL_TEXTENCODING_UTF8); if (rEntity.mbEnableThreads) -produce( CHARACTERS ); +produce(); else rEntity.characters( rEvent.msChars ); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/expatwrap/attrlistimpl.cxx |2 -- sax/source/expatwrap/saxwriter.cxx|2 -- sax/source/fastparser/fastparser.cxx |3 --- 3 files changed, 7 deletions(-) New commits: commit a39ced415fcdb456028fb4970071d83171d1f2f4 Author: Stephan Bergmann Date: Wed Apr 9 11:12:41 2014 +0200 Remove unused functions Change-Id: Iddf4e29005aaa510af00c7345487996b75f41c41 diff --git a/sax/source/expatwrap/attrlistimpl.cxx b/sax/source/expatwrap/attrlistimpl.cxx index b06e54e..8df8064 100644 --- a/sax/source/expatwrap/attrlistimpl.cxx +++ b/sax/source/expatwrap/attrlistimpl.cxx @@ -34,8 +34,6 @@ using namespace ::com::sun::star::xml::sax; namespace sax_expatwrap { struct TagAttribute { -TagAttribute() -{} TagAttribute( const OUString &aName, const OUString &aType , const OUString &aValue ) { this->sName = aName; diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx index 059ba79..140bcfb 100644 --- a/sax/source/expatwrap/saxwriter.cxx +++ b/sax/source/expatwrap/saxwriter.cxx @@ -953,8 +953,6 @@ public: // XServiceInfo sal_BoolSAL_CALL supportsService(const OUString& ServiceName) throw(std::exception) SAL_OVERRIDE; private: - -void writeSequence( const Sequence & seq ); sal_Int32 getIndentPrefixLength( sal_Int32 nFirstLineBreakOccurrence ) throw(); Reference< XOutputStream > m_out; diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index ce945af..336f5ee 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -243,9 +243,6 @@ private: sal_Int32 GetTokenWithContextNamespace( sal_Int32 nNamespaceToken, const sal_Char* pName, int nNameLen ); void DefineNamespace( const OString& rPrefix, const sal_Char* pNamespaceURL ); -void pushContext(); -void popContext(); - void splitName( const XML_Char *pwName, const XML_Char *&rpPrefix, sal_Int32 &rPrefixLen, const XML_Char *&rpName, sal_Int32 &rNameLen ); private: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source
sax/source/tools/converter.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 785c4f10b87ab47b853abf947dfb21117d55cca1 Author: Arnaud Versini Date: Sun Feb 2 12:14:01 2014 +0100 fdo#72468 avoid out of bounds array access Change-Id: I2bccdf1aaeb290a3cb8f76cd831a419e1776e92f Reviewed-on: https://gerrit.libreoffice.org/7775 Reviewed-by: Michael Stahl Tested-by: Michael Stahl diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 8a0d828..48ad958 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -1367,7 +1367,7 @@ lcl_MaxDaysPerMonth(const sal_Int32 nMonth, const sal_Int32 nYear) { static const sal_uInt16 s_MaxDaysPerMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; -OSL_ASSERT(0 < nMonth && nMonth <= 12); +assert(0 < nMonth && nMonth <= 12); if ((2 == nMonth) && lcl_isLeapYear(nYear)) { return 29; @@ -1545,8 +1545,8 @@ static bool lcl_parseDate( if (!bIgnoreInvalidOrMissingDate) { bSuccess &= (0 < nDay); +bSuccess &= (nDay <= lcl_MaxDaysPerMonth(nMonth, nYear)); } -bSuccess &= (nDay <= lcl_MaxDaysPerMonth(nMonth, nYear)); } if (bSuccess && (nPos < string.getLength())) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source sc/source
sax/source/expatwrap/saxwriter.cxx | 14 +++--- sc/source/filter/inc/unitconverter.hxx |2 +- 2 files changed, 8 insertions(+), 8 deletions(-) New commits: commit fb79d2001aca24aacb8548c1876744b2cc3520de Author: Julien Nabet Date: Sat Feb 23 14:40:45 2013 +0100 Fix typo, "charcter" -> "character" Change-Id: Idde59a616b16c52b7369dd67e7a06eab52b334c8 diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx index 1caf6cdd..cfdf619 100644 --- a/sax/source/expatwrap/saxwriter.cxx +++ b/sax/source/expatwrap/saxwriter.cxx @@ -1137,13 +1137,13 @@ void SAXWriter::startElement(const OUString& aName, const Reference< XAttributeL if (eRet == SAX_WARNING) { SAXInvalidCharacterException except; -except.Message = OUString( "Invalid charcter during XML-Export in a attribute value" ); +except.Message = OUString( "Invalid character during XML-Export in a attribute value" ); throw except; } else if (eRet == SAX_ERROR) { SAXException except; -except.Message = OUString( "Invalid charcter during XML-Export" ); +except.Message = OUString( "Invalid character during XML-Export" ); throw except; } } @@ -1179,7 +1179,7 @@ void SAXWriter::endElement(const OUString& aName) throw (SAXException, Runtime if (!bRet) { SAXException except; -except.Message = OUString( "Invalid charcter during XML-Export" ); +except.Message = OUString( "Invalid character during XML-Export" ); throw except; } } @@ -1231,7 +1231,7 @@ void SAXWriter::characters(const OUString& aChars) throw(SAXException, RuntimeE if (bThrowException) { SAXInvalidCharacterException except; -except.Message = OUString( "Invalid charcter during XML-Export" ); +except.Message = OUString( "Invalid character during XML-Export" ); throw except; } } @@ -1276,7 +1276,7 @@ void SAXWriter::processingInstruction(const OUString& aTarget, const OUString& a if (!mp_SaxWriterHelper->processingInstruction(aTarget, aData)) { SAXException except; -except.Message = OUString( "Invalid charcter during XML-Export" ); +except.Message = OUString( "Invalid character during XML-Export" ); throw except; } } @@ -1348,7 +1348,7 @@ void SAXWriter::comment(const OUString& sComment) throw(SAXException, RuntimeExc if (!mp_SaxWriterHelper->comment(sComment)) { SAXException except; -except.Message = OUString( "Invalid charcter during XML-Export" ); +except.Message = OUString( "Invalid character during XML-Export" ); throw except; } } @@ -1389,7 +1389,7 @@ void SAXWriter::unknown(const OUString& sString) throw (SAXException, RuntimeExc if (!mp_SaxWriterHelper->writeString( sString, sal_False, sal_False)) { SAXException except; -except.Message = OUString( "Invalid charcter during XML-Export" ); +except.Message = OUString( "Invalid character during XML-Export" ); throw except; } } diff --git a/sc/source/filter/inc/unitconverter.hxx b/sc/source/filter/inc/unitconverter.hxx index bac9d5b..4056430 100644 --- a/sc/source/filter/inc/unitconverter.hxx +++ b/sc/source/filter/inc/unitconverter.hxx @@ -57,7 +57,7 @@ enum Unit default font of the imported/exported document. The default font is always the first font in the styles font list, and is always referenced by the default cell style ("Normal" style in Excel) which is used by all empty -unformatted cells in the document. To be able to calculate the charcter +unformatted cells in the document. To be able to calculate the character width correctly, the default font must be known, which is the case after the finalizeImport() or finalizeExport() functions have been called. Caller must make sure to not call the character width conversion functions before. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sax/source sax/test
sax/source/expatwrap/sax_expat.cxx |4 ++-- sax/source/expatwrap/saxwriter.cxx |2 +- sax/source/expatwrap/xml2utf.cxx |8 sax/source/fastparser/fastparser.cxx |6 +++--- sax/test/saxdemo.cxx |4 ++-- sax/test/testcomponent.cxx |4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) New commits: commit ff0562fa4f7d8b7aceca16771d84db87d3f19756 Author: Alexander Wilms Date: Tue Feb 25 19:53:41 2014 +0100 Remove visual noise from sax Change-Id: Ica31580f72b43456c33b2f6abbf2140a79efae1a Reviewed-on: https://gerrit.libreoffice.org/8299 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index 9719335..f19305f 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -759,9 +759,9 @@ void SaxExpatParser_Impl::parse( ) } -// + // The C-Callbacks -// + void SaxExpatParser_Impl::callbackStartElement( void *pvThis , const XML_Char *pwName , diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx index d871cce..cd8cf23 100644 --- a/sax/source/expatwrap/saxwriter.cxx +++ b/sax/source/expatwrap/saxwriter.cxx @@ -806,7 +806,7 @@ inline sal_Int32 calcXMLByteLength( const sal_Unicode *pStr, sal_Int32 nStrLen, case 9: // if( bNormalizeWhitespace ) { -nOutputLength += 6; // +nOutputLength += 6; } else { diff --git a/sax/source/expatwrap/xml2utf.cxx b/sax/source/expatwrap/xml2utf.cxx index 6c5fece..b390912 100644 --- a/sax/source/expatwrap/xml2utf.cxx +++ b/sax/source/expatwrap/xml2utf.cxx @@ -344,9 +344,9 @@ void XMLFile2UTFConverter::initializeDecoding() -// + // Text2UnicodeConverter -// + Text2UnicodeConverter::Text2UnicodeConverter( const OString &sEncoding ) { @@ -450,9 +450,9 @@ Sequence Text2UnicodeConverter::convert( const Sequence & -// + // Unicode2TextConverter -// + Unicode2TextConverter::Unicode2TextConverter( rtl_TextEncoding encoding ) { diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index ba63596..2e26c50 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -607,7 +607,7 @@ void Entity::throwException( const ::rtl::Reference< FastLocatorImpl > &xDocumen // In the single threaded case we emit events via our C // callbacks, so any exception caught must be queued up until // we can safely re-throw it from our C++ parent of parse() -// + // If multi-threaded, we need to push an EXCEPTION event, at // which point we transfer ownership of maSavedException to // the consuming thread. @@ -1087,9 +1087,9 @@ void FastSaxParserImpl::parse() } -// + // The C-Callbacks -// + void FastSaxParserImpl::callbackStartElement( const XML_Char* pwName, const XML_Char** awAttributes ) diff --git a/sax/test/saxdemo.cxx b/sax/test/saxdemo.cxx index eb89b67..0c1ec2f 100644 --- a/sax/test/saxdemo.cxx +++ b/sax/test/saxdemo.cxx @@ -21,9 +21,9 @@ // testcomponent - Loads a service and its testcomponent from dlls performs a test. // Expands the dll-names depending on the actual environment. // Example : testcomponent com.sun.star.io.Pipe stm -// + // Therefor the testcode must exist in teststm and the testservice must be named test.com.sun.star.uno.io.Pipe -// + #include #include diff --git a/sax/test/testcomponent.cxx b/sax/test/testcomponent.cxx index a0ca81f..b979603 100644 --- a/sax/test/testcomponent.cxx +++ b/sax/test/testcomponent.cxx @@ -21,9 +21,9 @@ // testcomponent - Loads a service and its testcomponent from dlls performs a test. // Expands the dll-names depending on the actual environment. // Example : testcomponent com.sun.star.io.Pipe stm -// + // Therefor the testcode must exist in teststm and the testservice must be named com.sun.star.io.Pipe -// + #include #include ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits