fpicker/source/aqua/resourceprovider.mm | 1 stoc/Library_stocservices.mk | 1 stoc/source/uriproc/ExternalUriReferenceTranslator.cxx | 6 stoc/source/uriproc/UriReferenceFactory.cxx | 137 +++------- stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx | 18 - stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx | 17 - stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx | 6 stoc/source/uriproc/supportsService.cxx | 43 --- stoc/source/uriproc/supportsService.hxx | 36 -- 9 files changed, 70 insertions(+), 195 deletions(-)
New commits: commit 212f0e9f0028373fd86ba8a7d7682a0664fccddd Author: Stephan Bergmann <sberg...@redhat.com> Date: Sun Oct 20 22:54:08 2013 +0200 Missing include Change-Id: I5674385df64bb47813f551fb666ffef7d7434728 diff --git a/fpicker/source/aqua/resourceprovider.mm b/fpicker/source/aqua/resourceprovider.mm index f0a1df8..1b64ffc 100644 --- a/fpicker/source/aqua/resourceprovider.mm +++ b/fpicker/source/aqua/resourceprovider.mm @@ -23,6 +23,7 @@ #include <vcl/fpicker.hrc> #include <vcl/svapp.hxx> #include <tools/resmgr.hxx> +#include <tools/string.hxx> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> commit a242f53c0435d270ce2297acaf80dba0775dbd92 Author: Stephan Bergmann <sberg...@redhat.com> Date: Sun Oct 20 22:41:00 2013 +0200 Clean up stoc::uriproc::supportsService Change-Id: I1f324aae149e766d4755dc06ac5793c218ed5cf7 diff --git a/stoc/Library_stocservices.mk b/stoc/Library_stocservices.mk index fc39ef6..9c0cb84 100644 --- a/stoc/Library_stocservices.mk +++ b/stoc/Library_stocservices.mk @@ -34,7 +34,6 @@ $(eval $(call gb_Library_add_exception_objects,stocservices,\ stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand \ stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript \ stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory \ - stoc/source/uriproc/supportsService \ )) # vim:set noet sw=4 ts=4: diff --git a/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx b/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx index fde8219..5f75887 100644 --- a/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx +++ b/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx @@ -20,8 +20,6 @@ #include "stocservices.hxx" -#include "supportsService.hxx" - #include "com/sun/star/lang/XServiceInfo.hpp" #include "com/sun/star/uno/Exception.hpp" #include "com/sun/star/uno/Reference.hxx" @@ -31,6 +29,7 @@ #include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uri/XExternalUriReferenceTranslator.hpp" #include "cppuhelper/implbase2.hxx" +#include "cppuhelper/supportsservice.hxx" #include "cppuhelper/weak.hxx" #include "osl/thread.h" #include "rtl/string.h" @@ -89,8 +88,7 @@ OUString Translator::getImplementationName() sal_Bool Translator::supportsService(OUString const & serviceName) throw (css::uno::RuntimeException) { - return stoc::uriproc::supportsService( - getSupportedServiceNames(), serviceName); + return cppu::supportsService(this, serviceName); } css::uno::Sequence< OUString > Translator::getSupportedServiceNames() diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx b/stoc/source/uriproc/UriReferenceFactory.cxx index 5088ba1..13e5453 100644 --- a/stoc/source/uriproc/UriReferenceFactory.cxx +++ b/stoc/source/uriproc/UriReferenceFactory.cxx @@ -42,6 +42,7 @@ #include "com/sun/star/uri/XUriSchemeParser.hpp" #include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase2.hxx" +#include "cppuhelper/supportsservice.hxx" #include "cppuhelper/weak.hxx" #include "rtl/character.hxx" #include "rtl/ustrbuf.hxx" @@ -50,7 +51,6 @@ #include "UriReference.hxx" #include "stocservices.hxx" -#include "supportsService.hxx" namespace { @@ -320,8 +320,7 @@ OUString Factory::getImplementationName() sal_Bool Factory::supportsService(OUString const & serviceName) throw (css::uno::RuntimeException) { - return stoc::uriproc::supportsService( - getSupportedServiceNames(), serviceName); + return cppu::supportsService(this, serviceName); } css::uno::Sequence< OUString > Factory::getSupportedServiceNames() diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx index ee95a0c..1b3034e 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx @@ -36,6 +36,7 @@ #include "com/sun/star/util/XMacroExpander.hpp" #include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase2.hxx" +#include "cppuhelper/supportsservice.hxx" #include "cppuhelper/weak.hxx" #include "rtl/textenc.h" #include "rtl/uri.h" @@ -45,7 +46,6 @@ #include "sal/types.h" #include "UriReference.hxx" -#include "supportsService.hxx" namespace { @@ -192,8 +192,7 @@ OUString Parser::getImplementationName() ::sal_Bool Parser::supportsService(OUString const & serviceName) throw (css::uno::RuntimeException) { - return ::stoc::uriproc::supportsService( - getSupportedServiceNames(), serviceName); + return cppu::supportsService(this, serviceName); } css::uno::Sequence< OUString > Parser::getSupportedServiceNames() diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx index 3351390..3ee11ed 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx @@ -21,7 +21,6 @@ #include "stocservices.hxx" #include "UriReference.hxx" -#include "supportsService.hxx" #include "com/sun/star/lang/IllegalArgumentException.hpp" #include "com/sun/star/lang/XServiceInfo.hpp" @@ -34,6 +33,7 @@ #include "com/sun/star/uri/XVndSunStarScriptUrlReference.hpp" #include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase2.hxx" +#include "cppuhelper/supportsservice.hxx" #include "cppuhelper/weak.hxx" #include "osl/mutex.hxx" #include "rtl/uri.hxx" @@ -414,8 +414,7 @@ OUString Parser::getImplementationName() sal_Bool Parser::supportsService(OUString const & serviceName) throw (css::uno::RuntimeException) { - return stoc::uriproc::supportsService( - getSupportedServiceNames(), serviceName); + return cppu::supportsService(this, serviceName); } css::uno::Sequence< OUString > Parser::getSupportedServiceNames() diff --git a/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx b/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx index 2dd5ac6..88d5883 100644 --- a/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx +++ b/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx @@ -20,8 +20,6 @@ #include "stocservices.hxx" -#include "supportsService.hxx" - #include "com/sun/star/lang/XServiceInfo.hpp" #include "com/sun/star/uno/Exception.hpp" #include "com/sun/star/uno/Reference.hxx" @@ -34,6 +32,7 @@ #include "com/sun/star/uri/XUriReferenceFactory.hpp" #include "com/sun/star/uri/XVndSunStarPkgUrlReferenceFactory.hpp" #include "cppuhelper/implbase2.hxx" +#include "cppuhelper/supportsservice.hxx" #include "cppuhelper/weak.hxx" #include "rtl/string.h" #include "rtl/textenc.h" @@ -89,8 +88,7 @@ OUString Factory::getImplementationName() sal_Bool Factory::supportsService(OUString const & serviceName) throw (css::uno::RuntimeException) { - return stoc::uriproc::supportsService( - getSupportedServiceNames(), serviceName); + return cppu::supportsService(this, serviceName); } css::uno::Sequence< OUString > Factory::getSupportedServiceNames() diff --git a/stoc/source/uriproc/supportsService.cxx b/stoc/source/uriproc/supportsService.cxx deleted file mode 100644 index b5a835f..0000000 --- a/stoc/source/uriproc/supportsService.cxx +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include "supportsService.hxx" - -#include "com/sun/star/uno/Sequence.hxx" -#include "rtl/ustring.hxx" -#include "sal/types.h" - -namespace stoc { namespace uriproc { - -bool supportsService( - com::sun::star::uno::Sequence< OUString > const & serviceNames, - OUString const & serviceName) -{ - for (sal_Int32 i = 0; i < serviceNames.getLength(); ++i) { - if (serviceNames[i] == serviceName) { - return true; - } - } - return false; -} - -} } - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/uriproc/supportsService.hxx b/stoc/source/uriproc/supportsService.hxx deleted file mode 100644 index ba93837..0000000 --- a/stoc/source/uriproc/supportsService.hxx +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_stoc_source_uriproc_supportsService_hxx -#define INCLUDED_stoc_source_uriproc_supportsService_hxx - -#include "com/sun/star/uno/Sequence.hxx" - - -namespace stoc { namespace uriproc { - -bool supportsService( - com::sun::star::uno::Sequence< OUString > const & serviceNames, - OUString const & serviceName); - -} } - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 68c3efccbee39a036895275e5cc4f483ec6fcff7 Author: Stephan Bergmann <sberg...@redhat.com> Date: Sun Oct 20 22:36:21 2013 +0200 Some clean-up Change-Id: Iea0daab5dbabefe119def6b07db73a573b703d32 diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx b/stoc/source/uriproc/UriReferenceFactory.cxx index 856f5fb..5088ba1 100644 --- a/stoc/source/uriproc/UriReferenceFactory.cxx +++ b/stoc/source/uriproc/UriReferenceFactory.cxx @@ -17,11 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include "sal/config.h" -#include "stocservices.hxx" - -#include "UriReference.hxx" -#include "supportsService.hxx" +#include <algorithm> +#include <cassert> +#include <cstdlib> +#include <exception> +#include <new> +#include <vector> #include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" #include "com/sun/star/lang/XMultiComponentFactory.hpp" @@ -40,40 +43,27 @@ #include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase2.hxx" #include "cppuhelper/weak.hxx" -#include "osl/diagnose.h" #include "rtl/character.hxx" -#include "rtl/string.h" #include "rtl/ustrbuf.hxx" #include "rtl/ustring.hxx" #include "sal/types.h" -#include <algorithm> -#include /*MSVC trouble: <cstdlib>*/ <stdlib.h> -#include <exception> -#include <new> -#include <vector> +#include "UriReference.hxx" +#include "stocservices.hxx" +#include "supportsService.hxx" namespace { -//TODO: move comphelper::string::misc into something like -//sal/salhelper and use those instead - -sal_Unicode toLowerCase(sal_Unicode c) { - return rtl::isAsciiUpperCase(c) ? c + ('a' - 'A') : c; -} - -bool equalIgnoreCase(sal_Unicode c1, sal_Unicode c2) { - return toLowerCase(c1) == toLowerCase(c2); -} - bool equalIgnoreEscapeCase(OUString const & s1, OUString const & s2) { if (s1.getLength() == s2.getLength()) { for (sal_Int32 i = 0; i < s1.getLength();) { if (s1[i] == '%' && s2[i] == '%' && s1.getLength() - i > 2 - && rtl::isAsciiHexDigit(s1[i + 1]) && rtl::isAsciiHexDigit(s1[i + 2]) - && rtl::isAsciiHexDigit(s2[i + 1]) && rtl::isAsciiHexDigit(s2[i + 2]) - && equalIgnoreCase(s1[i + 1], s2[i + 1]) - && equalIgnoreCase(s1[i + 2], s2[i + 2])) + && rtl::isAsciiHexDigit(s1[i + 1]) + && rtl::isAsciiHexDigit(s1[i + 2]) + && rtl::isAsciiHexDigit(s2[i + 1]) + && rtl::isAsciiHexDigit(s2[i + 2]) + && rtl::compareIgnoreAsciiCase(s1[i + 1], s2[i + 1]) == 0 + && rtl::compareIgnoreAsciiCase(s1[i + 2], s2[i + 2]) == 0) { i += 3; } else if (s1[i] != s2[i]) { @@ -94,8 +84,8 @@ sal_Int32 parseScheme(OUString const & uriReference) { sal_Unicode c = uriReference[i]; if (c == ':') { return i; - } else if (!rtl::isAsciiAlpha(c) && !rtl::isAsciiDigit(c) && c != '+' && c != '-' - && c != '.') + } else if (!rtl::isAsciiAlpha(c) && !rtl::isAsciiDigit(c) + && c != '+' && c != '-' && c != '.') { break; } @@ -248,7 +238,7 @@ void processSegments( bool base, bool processSpecialSegments) { sal_Int32 count = uriReference->getPathSegmentCount() - (base ? 1 : 0); - OSL_ASSERT(count <= SAL_MAX_INT32 - 1 && -count >= SAL_MIN_INT32 + 1); + assert(count <= SAL_MAX_INT32 - 1 && -count >= SAL_MIN_INT32 + 1); for (sal_Int32 i = 0; i < count; ++i) { if (processSpecialSegments) { OUString segment(uriReference->getPathSegment(i)); @@ -258,9 +248,7 @@ void processSegments( } continue; } else if ( segment == ".." ) { - if (segments.empty() - || /*MSVC trouble: std::*/abs(segments.back()) == 1) - { + if (segments.empty() || std::abs(segments.back()) == 1) { segments.push_back(base ? -1 : 1); } else { segments.pop_back(); @@ -354,25 +342,24 @@ css::uno::Reference< css::uri::XUriReference > Factory::parse( OUString schemeSpecificPart; OUString serviceName; sal_Int32 n = parseScheme(uriReference); - OSL_ASSERT(n < fragment); + assert(n < fragment); if (n >= 0) { scheme = uriReference.copy(0, n); schemeSpecificPart = uriReference.copy(n + 1, fragment - (n + 1)); OUStringBuffer buf; - buf.appendAscii( - RTL_CONSTASCII_STRINGPARAM("com.sun.star.uri.UriSchemeParser_")); + buf.append("com.sun.star.uri.UriSchemeParser_"); for (sal_Int32 i = 0; i < scheme.getLength(); ++i) { sal_Unicode c = scheme[i]; if (rtl::isAsciiUpperCase(c)) { - buf.append(toLowerCase(c)); + buf.append(static_cast<sal_Unicode>(rtl::toAsciiLowerCase(c))); } else if (c == '+') { - buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("PLUS")); + buf.append("PLUS"); } else if (c == '-') { - buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("HYPHEN")); + buf.append("HYPHEN"); } else if (c == '.') { - buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("DOT")); + buf.append("DOT"); } else { - OSL_ASSERT(rtl::isAsciiLowerCase(c) || rtl::isAsciiDigit(c)); + assert(rtl::isAsciiLowerCase(c) || rtl::isAsciiDigit(c)); buf.append(c); } } @@ -393,8 +380,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::parse( throw; } catch (const css::uno::Exception & e) { throw css::lang::WrappedTargetRuntimeException( - OUString("creating service ") - + serviceName, + "creating service " + serviceName, static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e)); //TODO: preserve type of e } @@ -441,10 +427,10 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeAbsolute( OUStringBuffer abs(baseUriReference->getScheme()); abs.append(static_cast< sal_Unicode >(':')); if (uriReference->hasAuthority()) { - abs.appendAscii(RTL_CONSTASCII_STRINGPARAM("//")); + abs.append("//"); abs.append(uriReference->getAuthority()); } else if (baseUriReference->hasAuthority()) { - abs.appendAscii(RTL_CONSTASCII_STRINGPARAM("//")); + abs.append("//"); abs.append(baseUriReference->getAuthority()); } if (uriReference->hasRelativePath()) { @@ -498,7 +484,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeAbsolute( if (!slash) { abs.append(static_cast< sal_Unicode >('/')); } - abs.appendAscii(RTL_CONSTASCII_STRINGPARAM("..")); + abs.append(".."); slash = *i < 0; if (slash) { abs.append(static_cast< sal_Unicode >('/')); @@ -509,7 +495,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeAbsolute( break; default: - OSL_ASSERT(false); + assert(false); break; } } @@ -553,7 +539,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeRelative( uriReference->getAuthority())) { if (uriReference->hasAuthority()) { - rel.appendAscii(RTL_CONSTASCII_STRINGPARAM("//")); + rel.append("//"); rel.append(uriReference->getAuthority()); } rel.append(uriReference->getPath()); @@ -582,8 +568,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeRelative( } if (i == 0 && preferAbsoluteOverRelativePath && (preferAuthorityOverRelativePath - || !uriReference->getPath().matchAsciiL( - RTL_CONSTASCII_STRINGPARAM("//")))) + || !uriReference->getPath().startsWith("//"))) { if (baseUriReference->getPath().getLength() > 1 || uriReference->getPath().getLength() > 1) @@ -591,11 +576,10 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeRelative( if (uriReference->getPath().isEmpty()) { rel.append(static_cast< sal_Unicode >('/')); } else { - OSL_ASSERT(uriReference->getPath()[0] == '/'); - if (uriReference->getPath().matchAsciiL( - RTL_CONSTASCII_STRINGPARAM("//"))) { - OSL_ASSERT(uriReference->hasAuthority()); - rel.appendAscii(RTL_CONSTASCII_STRINGPARAM("//")); + assert(uriReference->getPath()[0] == '/'); + if (uriReference->getPath().startsWith("//")) { + assert(uriReference->hasAuthority()); + rel.append("//"); rel.append(uriReference->getAuthority()); } rel.append(uriReference->getPath()); @@ -607,7 +591,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeRelative( if (segments) { rel.append(static_cast< sal_Unicode >('/')); } - rel.appendAscii(RTL_CONSTASCII_STRINGPARAM("..")); + rel.append(".."); segments = true; } if (i < count2 - 1 @@ -626,16 +610,10 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeRelative( rel.append(static_cast< sal_Unicode >('/')); } OUString s(uriReference->getPathSegment(i)); - if (encodeRetainedSpecialSegments - && s.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("."))) - { - rel.appendAscii(RTL_CONSTASCII_STRINGPARAM("%2E")); - } else if (encodeRetainedSpecialSegments - && s.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM(".."))) - { - rel.appendAscii( - RTL_CONSTASCII_STRINGPARAM("%2E%2E")); + if (encodeRetainedSpecialSegments && s == ".") { + rel.append("%2E"); + } else if (encodeRetainedSpecialSegments && s == "..") { + rel.append("%2E%2E"); } else { rel.append(s); } @@ -667,8 +645,7 @@ css::uno::Reference< css::uno::XInterface > create( try { return static_cast< cppu::OWeakObject * >(new Factory(context)); } catch (std::bad_alloc &) { - throw css::uno::RuntimeException( - OUString("std::bad_alloc"), 0); + throw css::uno::RuntimeException("std::bad_alloc", 0); } } @@ -678,7 +655,7 @@ OUString getImplementationName() { css::uno::Sequence< OUString > getSupportedServiceNames() { css::uno::Sequence< OUString > s(1); - s[0] = OUString("com.sun.star.uri.UriReferenceFactory"); + s[0] = "com.sun.star.uri.UriReferenceFactory"; return s; } commit 79502678d091b90f9b76c37fbd97f8710a075655 Author: Stephan Bergmann <sberg...@redhat.com> Date: Sun Oct 20 22:22:05 2013 +0200 Clean-up std::bad_alloc handling ...post 0bc89aac4c64bb833e387657f680e194c26aef97 "cppumaker: Allow UNO interface functions to throw std::exception." Change-Id: I5fede822d279c3c758103192a813447bb4906679 diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx b/stoc/source/uriproc/UriReferenceFactory.cxx index 6d42c49..856f5fb 100644 --- a/stoc/source/uriproc/UriReferenceFactory.cxx +++ b/stoc/source/uriproc/UriReferenceFactory.cxx @@ -49,6 +49,7 @@ #include <algorithm> #include /*MSVC trouble: <cstdlib>*/ <stdlib.h> +#include <exception> #include <new> #include <vector> @@ -191,7 +192,6 @@ private: stoc::uriproc::UriReference m_base; }; -// throws std::bad_alloc css::uno::Reference< css::uri::XUriReference > parseGeneric( OUString const & scheme, OUString const & schemeSpecificPart) { @@ -291,7 +291,7 @@ public: virtual css::uno::Reference< css::uri::XUriReference > SAL_CALL parse(OUString const & uriReference) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException, std::exception); virtual css::uno::Reference< css::uri::XUriReference > SAL_CALL makeAbsolute( @@ -343,7 +343,8 @@ css::uno::Sequence< OUString > Factory::getSupportedServiceNames() } css::uno::Reference< css::uri::XUriReference > Factory::parse( - OUString const & uriReference) throw (css::uno::RuntimeException) + OUString const & uriReference) + throw (css::uno::RuntimeException, std::exception) { sal_Int32 fragment = uriReference.indexOf('#'); if (fragment == -1) { @@ -403,18 +404,10 @@ css::uno::Reference< css::uri::XUriReference > Factory::parse( } } } - css::uno::Reference< css::uri::XUriReference > uriRef; - if (parser.is()) { - uriRef = parser->parse(scheme, schemeSpecificPart); - } else { - try { - uriRef = parseGeneric(scheme, schemeSpecificPart); - } catch (std::bad_alloc &) { - throw css::uno::RuntimeException( - OUString("std::bad_alloc"), - static_cast< cppu::OWeakObject * >(this)); - } - } + css::uno::Reference< css::uri::XUriReference > uriRef( + parser.is() + ? parser->parse(scheme, schemeSpecificPart) + : parseGeneric(scheme, schemeSpecificPart)); if (uriRef.is() && fragment != uriReference.getLength()) { uriRef->setFragment(uriReference.copy(fragment + 1)); } diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx index d8545d6..ee95a0c 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx @@ -21,6 +21,7 @@ #include "stocservices.hxx" +#include <exception> #include <new> #include "com/sun/star/lang/IllegalArgumentException.hpp" @@ -172,7 +173,7 @@ public: parse( OUString const & scheme, OUString const & schemeSpecificPart) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException, std::exception); private: Parser(Parser &); // not defined @@ -204,18 +205,12 @@ css::uno::Sequence< OUString > Parser::getSupportedServiceNames() css::uno::Reference< css::uri::XUriReference > Parser::parse( OUString const & scheme, OUString const & schemeSpecificPart) - throw (css::uno::RuntimeException) + throw (css::uno::RuntimeException, std::exception) { if (!parseSchemeSpecificPart(schemeSpecificPart)) { return css::uno::Reference< css::uri::XUriReference >(); } - try { - return new UrlReference(scheme, schemeSpecificPart); - } catch (::std::bad_alloc &) { - throw css::uno::RuntimeException( - OUString("std::bad_alloc"), - css::uno::Reference< css::uno::XInterface >()); - } + return new UrlReference(scheme, schemeSpecificPart); } } diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx index f82178f..3351390 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx @@ -41,6 +41,7 @@ #include "rtl/ustring.hxx" #include "sal/types.h" +#include <exception> #include <new> namespace { @@ -394,7 +395,7 @@ public: virtual css::uno::Reference< css::uri::XUriReference > SAL_CALL parse( OUString const & scheme, OUString const & schemeSpecificPart) - throw (css::uno::RuntimeException); + throw (css::uno::RuntimeException, std::exception); private: Parser(Parser &); // not implemented @@ -427,17 +428,12 @@ css::uno::Sequence< OUString > Parser::getSupportedServiceNames() css::uno::Reference< css::uri::XUriReference > Parser::parse( OUString const & scheme, OUString const & schemeSpecificPart) - throw (css::uno::RuntimeException) + throw (css::uno::RuntimeException, std::exception) { if (!parseSchemeSpecificPart(schemeSpecificPart)) { return 0; } - try { - return new UrlReference(scheme, schemeSpecificPart); - } catch (std::bad_alloc &) { - throw css::uno::RuntimeException( - OUString("std::bad_alloc"), 0); - } + return new UrlReference(scheme, schemeSpecificPart); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits