[Libreoffice-commits] core.git: 3 commits - writerperfect/source
David Tardon
dtardon at redhat.com
Fri May 30 03:54:15 PDT 2014
writerperfect/source/common/WPXSvInputStream.cxx | 28 ++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
New commits:
commit ee016fbbe3f3af67b2b8b6fb516bf523a0e704ff
Author: David Tardon <dtardon at redhat.com>
Date: Fri May 30 12:43:22 2014 +0200
reading from a stream must start at the beginning
Change-Id: I0c668244fffcda04a8fe34ef629754f5935cab4b
diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx
index c9ff75a..b5786bf 100644
--- a/writerperfect/source/common/WPXSvInputStream.cxx
+++ b/writerperfect/source/common/WPXSvInputStream.cxx
@@ -468,6 +468,8 @@ WPXSvInputStreamImpl::WPXSvInputStreamImpl( Reference< XInputStream > xStream )
try
{
mnLength = mxSeekable->getLength();
+ if (0 < mxSeekable->getPosition())
+ mxSeekable->seek(0);
}
catch ( ... )
{
commit aa81b089d3da838129ca44badc60a6489af11d84
Author: David Tardon <dtardon at redhat.com>
Date: Fri May 30 12:29:40 2014 +0200
generalize this for Zip too
Change-Id: I9ca0676f056fe3f09821c208ff095beb1f3c19ac
diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx
index e5cf65b..c9ff75a 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;
}
commit 78fe1a5edf1dcdec44441fdb57554333a25ac3b1
Author: alonso <laurent.alonso at inria.fr>
Date: Fri May 30 12:26:34 2014 +0200
fix creation of substreams for OLE2
Change-Id: Idade93bcc1981543357e849b2faf075e7a021d3e
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())
More information about the Libreoffice-commits
mailing list