[Libreoffice-commits] core.git: 3 commits - comphelper/source include/comphelper include/sal sfx2/source tools/source
Stephan Bergmann
sbergman at redhat.com
Fri Aug 30 15:10:35 PDT 2013
comphelper/source/misc/mediadescriptor.cxx | 56 +++++++++--------------------
include/comphelper/mediadescriptor.hxx | 12 ------
include/sal/log-areas.dox | 1
sfx2/source/doc/SfxDocumentMetaData.cxx | 6 +--
tools/source/fsys/urlobj.cxx | 12 +++++-
5 files changed, 32 insertions(+), 55 deletions(-)
New commits:
commit 1bdc9d4380abccfbb095a76000a75dec8f10defb
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Sat Aug 31 00:10:11 2013 +0200
Some trivial string clean up
Change-Id: I68c738152250e0cbd317e903cb088c60e9b40566
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index f1fe123..6697fda 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -651,15 +651,13 @@ SfxDocumentMetaData::getURLProperties(
{
css::uno::Reference< css::beans::XPropertyBag> xPropArg = css::beans::PropertyBag::createDefault( m_xContext );
try {
- OUString dburl("DocumentBaseURL");
- OUString hdn("HierarchicalDocumentName");
for (sal_Int32 i = 0; i < i_rMedium.getLength(); ++i) {
- if (i_rMedium[i].Name.equals(dburl)) {
+ if (i_rMedium[i].Name == "DocumentBaseURL") {
xPropArg->addProperty(
OUString("BaseURI"),
css::beans::PropertyAttribute::MAYBEVOID,
i_rMedium[i].Value);
- } else if (i_rMedium[i].Name.equals(hdn)) {
+ } else if (i_rMedium[i].Name == "HierarchicalDocumentName") {
xPropArg->addProperty(
OUString("StreamRelPath"),
css::beans::PropertyAttribute::MAYBEVOID,
commit 11d743af1056b7f48debe2e98900065bb03833c9
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Sat Aug 31 00:09:48 2013 +0200
Some OSL_WARN -> SAL_WARN_IF
Change-Id: I076adcd2f94c38a74f2dce618bc16efec577ed91
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index 83b3ac0..99ceb69 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -272,6 +272,7 @@ certain functionality.
@li @c tools.memtools
@li @c tools.rc - resource manager
@li @c tools.stream - SvStream class
+ at li @c tools.urlobj - INetURLObject class
@section ucb
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 136bfb1..fee81b7 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -1732,7 +1732,11 @@ bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef,
// Detect cases where a relative input could not be made absolute
// because the given base URL is broken (most probably because it is
// empty):
- OSL_ASSERT(!HasError());
+ SAL_WARN_IF(
+ HasError(), "tools.urlobj",
+ "cannot make <" << rTheRelURIRef
+ << "> absolute against broken base <"
+ << GetMainURL(NO_DECODE) << ">");
rWasAbsolute = false;
return false;
}
@@ -1859,7 +1863,11 @@ bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef,
// Detect cases where a relative input could not be made absolute
// because the given base URL is broken (most probably because it is
// empty):
- OSL_ASSERT(!HasError());
+ SAL_WARN_IF(
+ HasError(), "tools.urlobj",
+ "cannot make <" << rTheRelURIRef
+ << "> absolute against broken base <" << GetMainURL(NO_DECODE)
+ << ">");
rWasAbsolute = false;
return false;
}
commit 2c6363eb16f50a8cfd81bc8511554af4f9e06478
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Sat Aug 31 00:08:53 2013 +0200
Be less pathetic
Change-Id: Ifeadfa9f95f85514f7d01ea777e2563803e0898c
diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx
index 8fefd7d..fd2ff28 100644
--- a/comphelper/source/misc/mediadescriptor.cxx
+++ b/comphelper/source/misc/mediadescriptor.cxx
@@ -47,6 +47,24 @@
namespace comphelper{
+namespace {
+
+OUString removeFragment(OUString const & uri) {
+ css::uno::Reference< css::uri::XUriReference > ref(
+ css::uri::UriReferenceFactory::create(
+ comphelper::getProcessComponentContext())->
+ parse(uri));
+ if (ref.is()) {
+ ref->clearFragment();
+ return ref->getUriReference();
+ } else {
+ SAL_WARN("comphelper", "cannot parse <" << uri << ">");
+ return uri;
+ }
+}
+
+}
+
const OUString& MediaDescriptor::PROP_ABORTED()
{
static const OUString sProp("Aborted");
@@ -466,9 +484,7 @@ sal_Bool MediaDescriptor::impl_addInputStream( sal_Bool bLockFile )
throw css::uno::Exception("Found no URL.",
css::uno::Reference< css::uno::XInterface >());
- // Parse URL! Only the main part has to be used further. E.g. a jumpmark can make trouble
- OUString sNormalizedURL = impl_normalizeURL( sURL );
- return impl_openStreamWithURL( sNormalizedURL, bLockFile );
+ return impl_openStreamWithURL( removeFragment(sURL), bLockFile );
}
catch(const css::uno::Exception& ex)
{
@@ -707,40 +723,6 @@ sal_Bool MediaDescriptor::impl_openStreamWithURL( const OUString& sURL, sal_Bool
return xInputStream.is();
}
-OUString MediaDescriptor::impl_normalizeURL(const OUString& sURL)
-{
- /* Remove Jumpmarks (fragments) of an URL only here.
- They are not part of any URL and as a result may be
- no ucb content can be created then.
- On the other side arguments must exists ... because
- they are part of an URL.
-
- Do not use the URLTransformer service here. Because
- it parses the URL in another way. It's main part isnt enough
- and it's complete part contains the jumpmark (fragment) parameter ...
- */
-
- try
- {
- css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
- css::uno::Reference< css::uri::XUriReferenceFactory > xUriFactory = css::uri::UriReferenceFactory::create(xContext);;
- css::uno::Reference< css::uri::XUriReference > xUriRef = xUriFactory->parse(sURL);
- if (xUriRef.is())
- {
- xUriRef->clearFragment();
- return xUriRef->getUriReference();
- }
- }
- catch(const css::uno::RuntimeException&)
- { throw; }
- catch(const css::uno::Exception&)
- {}
-
- // If an error ocurred ... return the original URL.
- // It's a try .-)
- return sURL;
-}
-
} // namespace comphelper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/mediadescriptor.hxx b/include/comphelper/mediadescriptor.hxx
index dbd59dc..5f353e5 100644
--- a/include/comphelper/mediadescriptor.hxx
+++ b/include/comphelper/mediadescriptor.hxx
@@ -272,18 +272,6 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap
) throw(::com::sun::star::uno::RuntimeException);
//---------------------------------------
- /** @short some URL parts can make trouble for opening streams (e.g. jumpmarks.)
- An URL should be "normalized" before its used.
-
- @param sURL
- the original URL (e.g. including a jumpmark)
-
- @return [string]
- the "normalized" URL (e.g. without jumpmark)
- */
- COMPHELPER_DLLPRIVATE OUString impl_normalizeURL(const OUString& sURL);
-
- //---------------------------------------
/** @short it checks if the descriptor already has a valid
InputStream item and creates a new one, if not.
More information about the Libreoffice-commits
mailing list