writerperfect/source/common/WPXSvStream.cxx | 37 +++++++++++++++++++++------- 1 file changed, 29 insertions(+), 8 deletions(-)
New commits: commit 29bd1673e92f1da1c360a77ea3a029db67d7cebe Author: David Tardon <dtar...@redhat.com> Date: Tue Jan 14 20:42:12 2014 +0100 add a brief description Change-Id: I1469910e3c20248133e56145c9ea543cbfdf3c4a diff --git a/writerperfect/source/common/WPXSvStream.cxx b/writerperfect/source/common/WPXSvStream.cxx index 48e8192..d705ba5 100644 --- a/writerperfect/source/common/WPXSvStream.cxx +++ b/writerperfect/source/common/WPXSvStream.cxx @@ -82,12 +82,34 @@ struct StreamData explicit StreamData(const rtl::OString &rName); SotStorageStreamRefWrapper stream; + + /** Name of the stream. + * + * This is not @c rtl::OUString, because we need to be able to + * produce const char* from it. + */ rtl::OString name; }; typedef boost::unordered_map<rtl::OUString, std::size_t, rtl::OUStringHash> NameMap_t; typedef boost::unordered_map<rtl::OUString, SotStorageRefWrapper, rtl::OUStringHash> OLEStorageMap_t; +/** Representation of an OLE2 storage. + * + * This class tries to bring a bit of sanity to use of SotStorage with + * respect to the needs of @c librevenge::RVNGInputStream API. It + * holds all nested storages for the whole lifetime (more precisely, + * since initialization, which is performed by calling @c + * initialize()), thus ensuring that no created stream is destroyed + * just because its parent storage went out of scope. It also holds a + * bidirectional map of stream names to their indexes (index of a + * stream is determined by deep-first traversal), which is also + * populated during initialization (member variables @c maStreams and + * @c maNameMap). + * + * Streams are created on demand (and saved, for the same reason as + * storages). + */ struct OLEStorageImpl { OLEStorageImpl(); @@ -103,10 +125,10 @@ private: SotStorageStreamRef createStream(const rtl::OUString &rPath); public: - SotStorageRefWrapper mxRootStorage; - OLEStorageMap_t maStorageMap; - ::std::vector< StreamData > maStreams; - NameMap_t maNameMap; + SotStorageRefWrapper mxRootStorage; //< root storage of the OLE2 + OLEStorageMap_t maStorageMap; //< map of all sub storages by name + ::std::vector< StreamData > maStreams; //< list of streams and their names + NameMap_t maNameMap; //< map of stream names to indexes (into @c maStreams) bool mbInitialized; }; commit 6b98b8dc620ae2276e1f3be1b935b6a0db3bc054 Author: David Tardon <dtar...@redhat.com> Date: Tue Jan 14 20:24:36 2014 +0100 the stream is already owned by the root storage Change-Id: If4c548c1ed9275f525fe311853545af3f6313f41 diff --git a/writerperfect/source/common/WPXSvStream.cxx b/writerperfect/source/common/WPXSvStream.cxx index acadd9f..48e8192 100644 --- a/writerperfect/source/common/WPXSvStream.cxx +++ b/writerperfect/source/common/WPXSvStream.cxx @@ -103,7 +103,6 @@ private: SotStorageStreamRef createStream(const rtl::OUString &rPath); public: - boost::scoped_ptr<SvStream> mpStream; SotStorageRefWrapper mxRootStorage; OLEStorageMap_t maStorageMap; ::std::vector< StreamData > maStreams; @@ -118,8 +117,7 @@ StreamData::StreamData(const rtl::OString &rName) } OLEStorageImpl::OLEStorageImpl() - : mpStream() - , mxRootStorage() + : mxRootStorage() , maStorageMap() , maStreams() , maNameMap() @@ -132,7 +130,6 @@ void OLEStorageImpl::initialize(SvStream *const pStream) if (!pStream) return; - mpStream.reset(pStream); mxRootStorage.ref = new SotStorage( pStream, sal_True ); traverse(mxRootStorage.ref, ""); commit 9abd5653b1a2c1e3357208b28b1d4e2c3120cade Author: David Tardon <dtar...@redhat.com> Date: Tue Jan 14 20:10:59 2014 +0100 init members Change-Id: I3ee5d05142ebd9738e34ea3276932a4f9e3fc43d diff --git a/writerperfect/source/common/WPXSvStream.cxx b/writerperfect/source/common/WPXSvStream.cxx index bc9354b..acadd9f 100644 --- a/writerperfect/source/common/WPXSvStream.cxx +++ b/writerperfect/source/common/WPXSvStream.cxx @@ -259,6 +259,8 @@ WPXSvInputStreamImpl::WPXSvInputStreamImpl( Reference< XInputStream > xStream ) mxStream(xStream), mxSeekable(xStream, UNO_QUERY), maData(0), + mpOLEStorage(0), + mbCheckedOLE(false), mnLength(0), mpReadBuffer(0), mnReadBufferLength(0), _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits