From e7cd2abfcff1673238e4c517ab614a818a4597f9 Mon Sep 17 00:00:00 2001 From: alonso Date: Fri, 30 May 2014 12:26:34 +0200 Subject: [PATCH 1/5] fix creation of substreams for OLE2 Change-Id: Idade93bcc1981543357e849b2faf075e7a021d3e (cherry picked from commit 78fe1a5edf1dcdec44441fdb57554333a25ac3b1) --- writerperfect/source/common/WPXSvInputStream.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx index 4fad167..e5cf65b 100644 --- a/writerperfect/source/common/WPXSvInputStream.cxx +++ b/writerperfect/source/common/WPXSvInputStream.cxx @@ -174,7 +174,11 @@ void OLEStorageImpl::initialize(SvStream *const pStream) SotStorageStreamRef OLEStorageImpl::getStream(const rtl::OUString &rPath) { - NameMap_t::iterator aIt = maNameMap.find(rPath); + rtl::OUString aPath(rPath); + // accept paths which begin by '/' + if (aPath.startsWith("/") && aPath.getLength() >= 2) + aPath=rPath.copy(1); + 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, @@ -183,7 +187,7 @@ SotStorageStreamRef OLEStorageImpl::getStream(const rtl::OUString &rPath) return SotStorageStreamRef(); if (!maStreams[aIt->second].stream.ref.Is()) - maStreams[aIt->second].stream.ref = createStream(rPath); + maStreams[aIt->second].stream.ref = createStream(aPath); return maStreams[aIt->second].stream.ref; } @@ -206,7 +210,7 @@ void OLEStorageImpl::traverse(const SotStorageRef &rStorage, const rtl::OUString { if (aIt->IsStream()) { - maStreams.push_back(OLEStreamData(rtl::OUStringToOString(aIt->GetName(), RTL_TEXTENCODING_UTF8))); + maStreams.push_back(OLEStreamData(rtl::OUStringToOString(concatPath(rPath, aIt->GetName()), RTL_TEXTENCODING_UTF8))); maNameMap[concatPath(rPath, aIt->GetName())] = maStreams.size() - 1; } else if (aIt->IsStorage()) -- 1.9.3