[Libreoffice-commits] .: Branch 'libreoffice-3-5' - cppuhelper/source

2012-04-18 Thread Michael Meeks
 cppuhelper/source/bootstrap.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7ed7df6ba854a799e8e9fb92c68650cc5e6e5695
Author: Michael Meeks michael.me...@suse.com
Date:   Wed Apr 18 11:04:08 2012 +0100

avoid using the new rdb reading logic for empty/non-existent directories

Signed-off-by: Stephan Bergmann sberg...@redhat.com

diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx
index 7ead585..cd0313e 100644
--- a/cppuhelper/source/bootstrap.cxx
+++ b/cppuhelper/source/bootstrap.cxx
@@ -322,7 +322,7 @@ Reference registry::XSimpleRegistry  readRdbDirectory(
 }
 nXML++;
 }
-if (nXML == aURLs.size())
+if (nXML  0  nXML == aURLs.size())
 {
 OSL_TRACE (OSL_LOG_PREFIX no legacy rdbs in directory '%s'\n,
rtl::OUStringToOString( url, RTL_TEXTENCODING_UTF8 
).getStr());
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-5' - cppuhelper/source stoc/source

2012-04-16 Thread Stephan Bergmann
 cppuhelper/source/bootstrap.cxx|   60 ---
 stoc/source/simpleregistry/simpleregistry.cxx  |   98 +
 stoc/source/simpleregistry/textualservices.cxx |   11 ++
 stoc/source/simpleregistry/textualservices.hxx |3 
 4 files changed, 146 insertions(+), 26 deletions(-)

New commits:
commit 4baeaf5484fb23f8265ab693bb7d2a36fbfef9c5
Author: Michael Meeks michael.me...@suse.com
Date:   Fri Apr 13 15:25:23 2012 +0200

stoc: accelerate opening of multiple XML .rdb files in a directory

Instead of nesting these, we aggregate them into a single non-nested
registry, which saves lots of CPU at startup, sadly we can only do
that for the new-style XML registries, so we have to sniff files,
nevertheless this is still far faster. The merged xml files also
break the XSimpleRegistry::getURL() method - but it appears not
to get called.

Signed-off-by: Stephan Bergmann sberg...@redhat.com

diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx
index 7d8ef9c..7ead585 100644
--- a/cppuhelper/source/bootstrap.cxx
+++ b/cppuhelper/source/bootstrap.cxx
@@ -263,16 +263,17 @@ Reference registry::XSimpleRegistry  readRdbDirectory(
  url),
 css::uno::Reference css::uno::XInterface ());
 }
-for (css::uno::Reference css::registry::XSimpleRegistry  last(
- lastRegistry);;)
+std::vectorrtl::OUString aURLs;
+css::uno::Reference css::registry::XSimpleRegistry  last(lastRegistry);
+for (;;)
 {
 osl::DirectoryItem i;
-switch (dir.getNextItem(i, SAL_MAX_UINT32)) {
-case osl::FileBase::E_None:
+osl::FileBase::RC eResult;
+eResult = dir.getNextItem(i, SAL_MAX_UINT32);
+if (eResult == osl::FileBase::E_NOENT)
 break;
-case osl::FileBase::E_NOENT:
-return last;
-default:
+if (eResult != osl::FileBase::E_None)
+{
 throw css::uno::RuntimeException(
 (rtl::OUString(
 RTL_CONSTASCII_USTRINGPARAM(cannot iterate directory )) +
@@ -296,12 +297,49 @@ Reference registry::XSimpleRegistry  readRdbDirectory(
 if (aName.toChar() == '.' || aName.endsWithAsciiL(~, 1))
 continue;
 
-if (stat.getFileType() != osl::FileStatus::Directory) { //TODO: 
symlinks
-last = readRdbFile(
-stat.getFileURL(), fatalErrors, last, simpleRegistryFactory,
-nestedRegistryFactory);
+if (stat.getFileType() != osl::FileStatus::Directory) //TODO: symlinks
+aURLs.push_back(stat.getFileURL());
+}
+
+size_t nXML = 0;
+for (std::vectorrtl::OUString::iterator it = aURLs.begin(); it != 
aURLs.end(); it++)
+{
+// Read / sniff the nasty files ...
+osl::File aIn( *it );
+if (aIn.open(osl_File_OpenFlag_Read) != osl::FileBase::E_None)
+continue;
+
+sal_uInt64 nRead = 0;
+char buffer[6];
+bool bIsXML = aIn.read(buffer, 6, nRead) == osl::FileBase::E_None 
+  nRead == 6  !strncmp(buffer, ?xml , 6);
+aIn.close();
+if (!bIsXML)
+{
+OSL_TRACE (OSL_LOG_PREFIX rdb '%s' is a legacy format\n,
+   rtl::OUStringToOString( *it, RTL_TEXTENCODING_UTF8 
).getStr());
+break;
+}
+nXML++;
+}
+if (nXML == aURLs.size())
+{
+OSL_TRACE (OSL_LOG_PREFIX no legacy rdbs in directory '%s'\n,
+   rtl::OUStringToOString( url, RTL_TEXTENCODING_UTF8 
).getStr());
+// read whole directory...
+last = readRdbFile( url, fatalErrors, last,
+simpleRegistryFactory, nestedRegistryFactory);
+}
+else
+{
+for (std::vectorrtl::OUString::iterator it = aURLs.begin(); it != 
aURLs.end(); it++)
+{
+// Read / sniff the nasty files ...
+last = readRdbFile(*it, fatalErrors, last,
+   simpleRegistryFactory, nestedRegistryFactory);
 }
 }
+return last;
 }
 
 Reference registry::XSimpleRegistry  nestRegistries(
diff --git a/stoc/source/simpleregistry/simpleregistry.cxx 
b/stoc/source/simpleregistry/simpleregistry.cxx
index 085b73a..1c1e983 100644
--- a/stoc/source/simpleregistry/simpleregistry.cxx
+++ b/stoc/source/simpleregistry/simpleregistry.cxx
@@ -48,6 +48,7 @@
 #include cppuhelper/implbase2.hxx
 #include cppuhelper/weak.hxx
 #include osl/mutex.hxx
+#include osl/file.hxx
 #include registry/registry.hxx
 #include registry/regtype.h
 #include rtl/ref.hxx
@@ -84,6 +85,12 @@ public:
 private:
 virtual rtl::OUString SAL_CALL getURL() throw (css::uno::RuntimeException);
 
+virtual void SAL_CALL openRdb(
+rtl::OUString const  rURL, sal_Bool bReadOnly, sal_Bool bCreate)
+throw (
+css::registry::InvalidRegistryException,
+

[Libreoffice-commits] .: Branch 'libreoffice-3-5' - cppuhelper/source

2011-12-07 Thread Michael Meeks
 cppuhelper/source/bootstrap.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 7713d3378d8aa7da1855adbeb885ac2c3b79a623
Author: Michael Meeks michael.me...@suse.com
Date:   Wed Dec 7 14:38:16 2011 +

ignore backup files in services/ directory to avoid debugging grief

diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx
index 8217ee7..399af07 100644
--- a/cppuhelper/source/bootstrap.cxx
+++ b/cppuhelper/source/bootstrap.cxx
@@ -289,6 +289,13 @@ Reference registry::XSimpleRegistry  readRdbDirectory(
  url),
 css::uno::Reference css::uno::XInterface ());
 }
+rtl::OUString aName = stat.getFileName();
+
+// Ignore backup files - to allow people to edit their
+// services/ without extremely confusing behaviour
+if (aName.toChar() == '.' || aName.endsWithAsciiL(~, 1))
+continue;
+
 if (stat.getFileType() != osl::FileStatus::Directory) { //TODO: 
symlinks
 last = readRdbFile(
 stat.getFileURL(), fatalErrors, last, simpleRegistryFactory,
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits