diff options
-rw-r--r-- | stoc/source/uriproc/UriReference.cxx | 14 | ||||
-rw-r--r-- | stoc/source/uriproc/UriReference.hxx | 21 |
2 files changed, 21 insertions, 14 deletions
diff --git a/stoc/source/uriproc/UriReference.cxx b/stoc/source/uriproc/UriReference.cxx index a47198ac2241..75298583b0c4 100644 --- a/stoc/source/uriproc/UriReference.cxx +++ b/stoc/source/uriproc/UriReference.cxx @@ -34,9 +34,9 @@ UriReference::UriReference( OUString const & scheme, bool bHasAuthority, OUString const & authority, OUString const & path, bool bHasQuery, OUString const & query): + m_path(path), m_scheme(scheme), m_authority(authority), - m_path(path), m_query(query), m_hasAuthority(bHasAuthority), m_hasQuery(bHasQuery), @@ -69,14 +69,16 @@ bool UriReference::isAbsolute() const { } -OUString UriReference::getSchemeSpecificPart() const +OUString UriReference::getSchemeSpecificPart() { + std::lock_guard g(m_mutex); OUStringBuffer buf; appendSchemeSpecificPart(buf); return buf.makeStringAndClear(); } -bool UriReference::isHierarchical() const { +bool UriReference::isHierarchical() { + std::lock_guard g(m_mutex); return m_scheme.isEmpty() || m_hasAuthority || m_path.startsWith("/"); } @@ -88,17 +90,20 @@ const OUString& UriReference::getAuthority() const { return m_authority; } -const OUString& UriReference::getPath() const { +OUString UriReference::getPath() { + std::lock_guard g(m_mutex); return m_path; } bool UriReference::hasRelativePath() { + std::lock_guard g(m_mutex); return !m_hasAuthority && (m_path.isEmpty() || m_path[0] != '/'); } sal_Int32 UriReference::getPathSegmentCount() { + std::lock_guard g(m_mutex); if (m_path.isEmpty()) { return 0; } else { @@ -116,6 +121,7 @@ sal_Int32 UriReference::getPathSegmentCount() OUString UriReference::getPathSegment(sal_Int32 index) { + std::lock_guard g(m_mutex); if (!m_path.isEmpty() && index >= 0) { for (sal_Int32 i = m_path[0] == '/' ? 1 : 0;; ++i) { if (index-- == 0) { diff --git a/stoc/source/uriproc/UriReference.hxx b/stoc/source/uriproc/UriReference.hxx index 715819789e66..e1645372038a 100644 --- a/stoc/source/uriproc/UriReference.hxx +++ b/stoc/source/uriproc/UriReference.hxx @@ -46,10 +46,10 @@ public: const OUString& getScheme() const { return m_scheme;} /// @throws css::uno::RuntimeException - OUString getSchemeSpecificPart() const; + OUString getSchemeSpecificPart(); /// @throws css::uno::RuntimeException - bool isHierarchical() const; + bool isHierarchical(); /// @throws css::uno::RuntimeException bool hasAuthority() const; @@ -58,7 +58,7 @@ public: const OUString& getAuthority() const; /// @throws css::uno::RuntimeException - const OUString& getPath() const; + OUString getPath(); /// @throws css::uno::RuntimeException bool hasRelativePath(); @@ -88,20 +88,21 @@ public: void clearFragment(); std::mutex m_mutex; - OUString m_scheme; - OUString m_authority; OUString m_path; - OUString m_query; - OUString m_fragment; - bool m_hasAuthority; - bool m_hasQuery; - bool m_hasFragment; private: UriReference(UriReference const &) = delete; void operator =(UriReference const &) = delete; void appendSchemeSpecificPart(OUStringBuffer & buffer) const; + + OUString m_scheme; + OUString m_authority; + OUString m_query; + OUString m_fragment; + bool m_hasAuthority; + bool m_hasQuery; + bool m_hasFragment; }; } |