[Libreoffice-commits] .: 2 commits - fpicker/source sfx2/source xmloff/source

Thomas Arnhold tarnhold at kemper.freedesktop.org
Fri Jan 28 07:00:16 PST 2011


 fpicker/source/office/iodlg.cxx            |    2 +-
 sfx2/source/bastyp/frmhtmlw.cxx            |    2 +-
 sfx2/source/doc/DocumentMetadataAccess.cxx |    8 ++++----
 sfx2/source/doc/Metadatable.cxx            |   26 +++++++++++++-------------
 sfx2/source/doc/SfxDocumentMetaData.cxx    |   14 +++++++-------
 sfx2/source/doc/objuno.cxx                 |    2 +-
 xmloff/source/core/xmlexp.cxx              |    2 +-
 7 files changed, 28 insertions(+), 28 deletions(-)

New commits:
commit e1bd27206e8aa866f30102eaa1214b91b39829bb
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Fri Jan 28 15:59:35 2011 +0100

    Replace empty equalsAscii() with getLength().

diff --git a/sfx2/source/bastyp/frmhtmlw.cxx b/sfx2/source/bastyp/frmhtmlw.cxx
index 5e32c5d..9ec69bc 100644
--- a/sfx2/source/bastyp/frmhtmlw.cxx
+++ b/sfx2/source/bastyp/frmhtmlw.cxx
@@ -164,7 +164,7 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL,
     {
         // Reload
         if( (i_xDocProps->getAutoloadSecs() != 0) ||
-            !i_xDocProps->getAutoloadURL().equalsAscii("") )
+            i_xDocProps->getAutoloadURL().getLength() )
         {
             String sContent = String::CreateFromInt32(
                                 i_xDocProps->getAutoloadSecs() );
diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx
index aaa74e1..894a4d2 100644
--- a/sfx2/source/doc/DocumentMetadataAccess.cxx
+++ b/sfx2/source/doc/DocumentMetadataAccess.cxx
@@ -545,7 +545,7 @@ readStream(struct DocumentMetadataAccess_Impl & i_rImpl,
     ::rtl::OUString rest;
     try {
         if (!splitPath(i_rPath, dir, rest)) throw uno::RuntimeException();
-        if (dir.equalsAscii("")) {
+        if (dir.getLength() == 0) {
             if (i_xStorage->isStreamElement(i_rPath)) {
                 const uno::Reference<io::XStream> xStream(
                     i_xStorage->openStreamElement(i_rPath,
@@ -665,7 +665,7 @@ writeStream(struct DocumentMetadataAccess_Impl & i_rImpl,
     ::rtl::OUString rest;
     if (!splitPath(i_rPath, dir, rest)) throw uno::RuntimeException();
     try {
-        if (dir.equalsAscii("")) {
+        if (dir.getLength() == 0) {
             exportStream(i_rImpl, i_xStorage, i_xGraphName, i_rPath,
                 i_rBaseURI);
         } else {
@@ -1307,7 +1307,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
     if (md.addInputStream()) {
         md[ ::comphelper::MediaDescriptor::PROP_INPUTSTREAM() ] >>= xIn;
     }
-    if (!xIn.is() && URL.equalsAscii("")) {
+    if (!xIn.is() && (URL.getLength() == 0)) {
         throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
             "DocumentMetadataAccess::loadMetadataFromMedium: "
             "inalid medium: no URL, no input stream")), *this, 0);
@@ -1363,7 +1363,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
     ::comphelper::MediaDescriptor md(i_rMedium);
     ::rtl::OUString URL;
     md[ ::comphelper::MediaDescriptor::PROP_URL() ] >>= URL;
-    if (URL.equalsAscii("")) {
+    if (URL.getLength() == 0) {
         throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
             "DocumentMetadataAccess::storeMetadataToMedium: "
             "invalid medium: no URL")), *this, 0);
diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx
index 1df20fc..7a3c0db 100644
--- a/sfx2/source/doc/Metadatable.cxx
+++ b/sfx2/source/doc/Metadatable.cxx
@@ -555,9 +555,9 @@ XmlIdRegistryDocument::XmlIdRegistry_Impl::LookupXmlId(
         m_XmlIdReverseMap.find(&i_rObject) );
     if (iter != m_XmlIdReverseMap.end())
     {
-        OSL_ENSURE(!iter->second.first.equalsAscii(""),
+        OSL_ENSURE(iter->second.first.getLength(),
             "null stream in m_XmlIdReverseMap");
-        OSL_ENSURE(!iter->second.second.equalsAscii(""),
+        OSL_ENSURE(iter->second.second.getLength(),
             "null id in m_XmlIdReverseMap");
         o_rStream = iter->second.first;
         o_rIdref  = iter->second.second;
@@ -710,7 +710,7 @@ XmlIdRegistryDocument::TryRegisterMetadatable(Metadatable & i_rObject,
         return (m_pImpl->LookupElement(old_path, old_idref) == &i_rObject);
     }
     XmlIdMap_t::iterator old_id( m_pImpl->m_XmlIdMap.end() );
-    if (!old_idref.equalsAscii(""))
+    if (old_idref.getLength())
     {
         old_id = m_pImpl->m_XmlIdMap.find(old_idref);
         OSL_ENSURE(old_id != m_pImpl->m_XmlIdMap.end(), "old id not found");
@@ -747,7 +747,7 @@ XmlIdRegistryDocument::RegisterMetadatableAndCreateID(Metadatable & i_rObject)
     m_pImpl->LookupXmlId(i_rObject, old_path, old_idref);
 
     XmlIdMap_t::iterator old_id( m_pImpl->m_XmlIdMap.end() );
-    if (!old_idref.equalsAscii(""))
+    if (old_idref.getLength())
     {
         old_id = m_pImpl->m_XmlIdMap.find(old_idref);
         OSL_ENSURE(old_id != m_pImpl->m_XmlIdMap.end(), "old id not found");
@@ -798,7 +798,7 @@ void XmlIdRegistryDocument::RemoveXmlIdForElement(const Metadatable& i_rObject)
         m_pImpl->m_XmlIdReverseMap.find(&i_rObject) );
     if (iter != m_pImpl->m_XmlIdReverseMap.end())
     {
-        OSL_ENSURE(!iter->second.second.equalsAscii(""),
+        OSL_ENSURE(iter->second.second.getLength(),
             "null id in m_XmlIdReverseMap");
         m_pImpl->m_XmlIdReverseMap.erase(iter);
     }
@@ -1032,9 +1032,9 @@ XmlIdRegistryClipboard::XmlIdRegistry_Impl::LookupXmlId(
         m_XmlIdReverseMap.find(&i_rObject) );
     if (iter != m_XmlIdReverseMap.end())
     {
-        OSL_ENSURE(!iter->second.m_Stream.equalsAscii(""),
+        OSL_ENSURE(iter->second.m_Stream.getLength(),
             "null stream in m_XmlIdReverseMap");
-        OSL_ENSURE(!iter->second.m_XmlId.equalsAscii(""),
+        OSL_ENSURE(iter->second.m_XmlId.getLength(),
             "null id in m_XmlIdReverseMap");
         o_rStream = iter->second.m_Stream;
         o_rIdref  = iter->second.m_XmlId;
@@ -1145,7 +1145,7 @@ XmlIdRegistryClipboard::TryRegisterMetadatable(Metadatable & i_rObject,
         return (m_pImpl->LookupElement(old_path, old_idref) == &i_rObject);
     }
     ClipboardXmlIdMap_t::iterator old_id( m_pImpl->m_XmlIdMap.end() );
-    if (!old_idref.equalsAscii(""))
+    if (old_idref.getLength())
     {
         old_id = m_pImpl->m_XmlIdMap.find(old_idref);
         OSL_ENSURE(old_id != m_pImpl->m_XmlIdMap.end(), "old id not found");
@@ -1180,7 +1180,7 @@ XmlIdRegistryClipboard::RegisterMetadatableAndCreateID(Metadatable & i_rObject)
     ::rtl::OUString old_path;
     ::rtl::OUString old_idref;
     LookupXmlId(i_rObject, old_path, old_idref);
-    if (!old_idref.equalsAscii("") &&
+    if (old_idref.getLength() &&
         (m_pImpl->LookupElement(old_path, old_idref) == &i_rObject))
     {
         return;
@@ -1226,7 +1226,7 @@ void XmlIdRegistryClipboard::RemoveXmlIdForElement(const Metadatable& i_rObject)
         m_pImpl->m_XmlIdReverseMap.find(&i_rObject) );
     if (iter != m_pImpl->m_XmlIdReverseMap.end())
     {
-        OSL_ENSURE(!iter->second.m_XmlId.equalsAscii(""),
+        OSL_ENSURE(iter->second.m_XmlId.getLength(),
             "null id in m_XmlIdReverseMap");
         m_pImpl->m_XmlIdReverseMap.erase(iter);
     }
@@ -1333,14 +1333,14 @@ void
 Metadatable::SetMetadataReference(
     const ::com::sun::star::beans::StringPair & i_rReference)
 {
-    if (i_rReference.Second.equalsAscii(""))
+    if (i_rReference.Second.getLength() == 0)
     {
         RemoveMetadataReference();
     }
     else
     {
         ::rtl::OUString streamName( i_rReference.First );
-        if (streamName.equalsAscii(""))
+        if (streamName.getLength() == 0)
         {
             // handle empty stream name as auto-detect.
             // necessary for importing flat file format.
@@ -1421,7 +1421,7 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource,
             {
                 beans::StringPair SourceRef(
                     i_rSource.m_pReg->GetXmlIdForElement(i_rSource) );
-                bool isLatent( SourceRef.Second.equalsAscii("") );
+                bool isLatent( SourceRef.Second.getLength() == 0 );
                 XmlIdRegistryDocument * pSourceRegDoc(
                     dynamic_cast<XmlIdRegistryDocument*>(i_rSource.m_pReg) );
                 OSL_ENSURE(pSourceRegDoc, "RegisterAsCopyOf: 2 clipboards?");
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index b64c37f..71cbd7b 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -750,7 +750,7 @@ SfxDocumentMetaData::setMetaText(const char* i_name,
     css::uno::Reference<css::xml::dom::XNode> xNode = m_meta.find(name)->second;
 
     try {
-        if (i_rValue.equalsAscii("")) {
+        if (i_rValue.getLength() == 0) {
             if (xNode.is()) { // delete
                 m_xParent->removeChild(xNode);
                 xNode.clear();
@@ -1086,7 +1086,7 @@ void SAL_CALL SfxDocumentMetaData::updateUserDefinedAndAttributes()
 
     // update elements with attributes
     std::vector<std::pair<const char *, ::rtl::OUString> > attributes;
-    if (!m_TemplateName.equalsAscii("") || !m_TemplateURL.equalsAscii("")
+    if (m_TemplateName.getLength() || m_TemplateURL.getLength()
             || isValidDateTime(m_TemplateDate)) {
         attributes.push_back(std::make_pair(
                 static_cast<const char*>("xlink:type"),
@@ -1109,7 +1109,7 @@ void SAL_CALL SfxDocumentMetaData::updateUserDefinedAndAttributes()
     }
     attributes.clear();
 
-    if (!m_AutoloadURL.equalsAscii("") || (0 != m_AutoloadSecs)) {
+    if (m_AutoloadURL.getLength() || (0 != m_AutoloadSecs)) {
         attributes.push_back(std::make_pair(
                 static_cast<const char*>("xlink:href" ), m_AutoloadURL ));
         attributes.push_back(std::make_pair(
@@ -1121,7 +1121,7 @@ void SAL_CALL SfxDocumentMetaData::updateUserDefinedAndAttributes()
     }
     attributes.clear();
 
-    if (!m_DefaultTarget.equalsAscii("")) {
+    if (m_DefaultTarget.getLength()) {
         attributes.push_back(std::make_pair(
                 static_cast<const char*>("office:target-frame-name"),
                 m_DefaultTarget));
@@ -1772,7 +1772,7 @@ SfxDocumentMetaData::getDocumentStatistics() throw (css::uno::RuntimeException)
     for (size_t i = 0; s_stdStats[i] != 0; ++i) {
         const char * aName = s_stdStatAttrs[i];
         ::rtl::OUString text = getMetaAttr("meta:document-statistic", aName);
-        if (text.equalsAscii("")) continue;
+        if (text.getLength() == 0) continue;
         css::beans::NamedValue stat;
         stat.Name = ::rtl::OUString::createFromAscii(s_stdStats[i]);
         sal_Int32 val;
@@ -2077,7 +2077,7 @@ SfxDocumentMetaData::loadFromMedium(const ::rtl::OUString & URL,
     css::uno::Reference<css::io::XInputStream> xIn;
     ::comphelper::MediaDescriptor md(Medium);
     // if we have an URL parameter, it replaces the one in the media descriptor
-    if (!URL.equalsAscii("")) {
+    if (URL.getLength()) {
         md[ ::comphelper::MediaDescriptor::PROP_URL() ] <<= URL;
     }
     if (sal_True == md.addInputStream()) {
@@ -2120,7 +2120,7 @@ SfxDocumentMetaData::storeToMedium(const ::rtl::OUString & URL,
            css::lang::WrappedTargetException, css::io::IOException)
 {
     ::comphelper::MediaDescriptor md(Medium);
-    if (!URL.equalsAscii("")) {
+    if (URL.getLength()) {
         md[ ::comphelper::MediaDescriptor::PROP_URL() ] <<= URL;
     }
     SfxMedium aMedium(md.getAsConstPropertyValueList());
diff --git a/sfx2/source/doc/objuno.cxx b/sfx2/source/doc/objuno.cxx
index c681bbf..43d763c 100644
--- a/sfx2/source/doc/objuno.cxx
+++ b/sfx2/source/doc/objuno.cxx
@@ -1028,7 +1028,7 @@ void SAL_CALL  SfxDocumentInfoObject::setFastPropertyValue(sal_Int32 nHandle, co
         case MID_DOCINFO_AUTOLOADENABLED:
             aValue <<= static_cast<sal_Bool>
                         (   (_pImp->m_xDocProps->getAutoloadSecs() != 0)
-                        || !(_pImp->m_xDocProps->getAutoloadURL().equalsAscii("")));
+                        || _pImp->m_xDocProps->getAutoloadURL().getLength());
             break;
         case MID_DOCINFO_AUTOLOADURL:
             aValue <<= _pImp->m_xDocProps->getAutoloadURL();
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 79f7747..c065de2 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -2509,7 +2509,7 @@ SvXMLExport::AddAttributeXmlId(uno::Reference<uno::XInterface> const & i_xIfc)
     if ( xMeta.is() )
     {
         const beans::StringPair mdref( xMeta->getMetadataReference() );
-        if ( !mdref.Second.equalsAscii("") )
+        if ( mdref.Second.getLength() )
         {
             const ::rtl::OUString streamName( GetStreamName() );
             if ( streamName.getLength() )
commit 7458bd6fb1c9f7c2eddf726bd138cdb9fa0c6f0f
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Mon Jan 24 17:17:03 2011 +0100

    Remove FS_PRIV_DEBUG directive.

diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 4c1f1ad..7db9889 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -1048,7 +1048,7 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
                     return 0;
             }
 
-#if defined( UNX ) || defined( FS_PRIV_DEBUG )
+#if defined( UNX )
             if ( ( 1 == aText.Len() ) && ( '~' == aText.GetBuffer()[0] ) )
             {
                 // go to the home directory


More information about the Libreoffice-commits mailing list