summaryrefslogtreecommitdiff
path: root/writerperfect/source
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2014-05-30 12:29:40 +0200
committerDavid Tardon <dtardon@redhat.com>2014-05-30 12:53:44 +0200
commitaa81b089d3da838129ca44badc60a6489af11d84 (patch)
tree1ee33aaabc7514d469ce8813822cede6b603da8f /writerperfect/source
parent78fe1a5edf1dcdec44441fdb57554333a25ac3b1 (diff)
generalize this for Zip too
Change-Id: I9ca0676f056fe3f09821c208ff095beb1f3c19ac
Diffstat (limited to 'writerperfect/source')
-rw-r--r--writerperfect/source/common/WPXSvInputStream.cxx24
1 files changed, 18 insertions, 6 deletions
diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx
index e5cf65b8bb8b..c9ff75ae23ca 100644
--- a/writerperfect/source/common/WPXSvInputStream.cxx
+++ b/writerperfect/source/common/WPXSvInputStream.cxx
@@ -83,6 +83,20 @@ typedef struct
namespace
{
+rtl::OUString lcl_normalizeSubStreamPath(const rtl::OUString &rPath)
+{
+ // accept paths which begin by '/'
+ // TODO: maybe this should to a full normalization
+ if (rPath.startsWith("/") && rPath.getLength() >= 2)
+ return rPath.copy(1);
+ return rPath;
+}
+
+}
+
+namespace
+{
+
const rtl::OUString concatPath(const rtl::OUString &lhs, const rtl::OUString &rhs)
{
if (lhs.isEmpty())
@@ -174,10 +188,7 @@ void OLEStorageImpl::initialize(SvStream *const pStream)
SotStorageStreamRef OLEStorageImpl::getStream(const rtl::OUString &rPath)
{
- rtl::OUString aPath(rPath);
- // accept paths which begin by '/'
- if (aPath.startsWith("/") && aPath.getLength() >= 2)
- aPath=rPath.copy(1);
+ const rtl::OUString aPath(lcl_normalizeSubStreamPath(rPath));
NameMap_t::iterator aIt = maNameMap.find(aPath);
// For the while don't return stream in this situation.
@@ -324,7 +335,8 @@ void ZipStorageImpl::initialize()
Reference<XInputStream> ZipStorageImpl::getStream(const rtl::OUString &rPath)
{
- NameMap_t::iterator aIt = maNameMap.find(rPath);
+ const rtl::OUString aPath(lcl_normalizeSubStreamPath(rPath));
+ NameMap_t::iterator aIt = maNameMap.find(aPath);
// For the while don't return stream in this situation.
// Later, given how libcdr's zip stream implementation behaves,
@@ -333,7 +345,7 @@ Reference<XInputStream> ZipStorageImpl::getStream(const rtl::OUString &rPath)
return Reference<XInputStream>();
if (!maStreams[aIt->second].xStream.is())
- maStreams[aIt->second].xStream = createStream(rPath);
+ maStreams[aIt->second].xStream = createStream(aPath);
return maStreams[aIt->second].xStream;
}