Hello community,
here is the log from the commit of package libwpd
checked in at Sun Apr 6 03:13:23 CEST 2008.
--------
--- libwpd/libwpd.changes 2007-11-26 10:59:15.000000000 +0100
+++ libwpd/libwpd.changes 2008-04-04 10:15:24.000000000 +0200
@@ -1,0 +2,44 @@
+Fri Apr 4 09:41:27 CEST 2008 - mmarek@suse.cz
+
+- rename the library package to libwpd-0_8-8, as required by the
+ library policy (libwpd-0.8.so.8 -> libwpd-0_8-8)
+- don't version the devel package after discussion with pmladek
+ we'll do it only if the need arises
+
+-------------------------------------------------------------------
+Wed Apr 2 15:33:44 CEST 2008 - mmarek@suse.cz
+
+- update to version 0.8.14:
+ - Fix some warnings due to unused variables
+ - Fix a warning due to a name hiding.
+ - Fix two loops with corrupted documents (Thank you, sum1!)
+ - Implement readahead in the WPXStreamImplementation class (Jan
+ Holesovsky, Fridrich)
+ - Fix some memory issues properly (each class deletes what it
+ allocated) (Fridrich)
+ - Work around an issue with relative seeks backward and certain
+ versions of libstdc++ in the buffered stream implementation
+ (Fridrich, sum1)
+ - Fix a problem of conversion of some page breaks due to an
+ unreachable block in the code (Fridrich)
+ - Fix a crasher in a rare case of a footnote/endnote being
+ defined in a table and the footnote/endnote having itself a
+ table (Fridrich).
+ - Fix some null pointer crashes with corrupted documents in table
+ code and in cases where there is no prefix ID present (sum1,
+ Fridrich).
+ - Fix a out of bounds array in parsing WP5 extended characters
+ with broken documents (sum1).
+ - Remove some abuse of pointers (Fridrich).
+ - In "wpd2raw --callback", return "-1" if no one callback was
+ called (Fridrich).
+ - Fix some issues with incorrect indents in some rear cases
+ (Fridrich).
+ - Fix some signedness problems (Fridrich).
+- don't install static libraries and libtool archives
+- renamed library and devel package to libwpd-0_8 and
+ libwpd-0_8-devel respectively, to allow parallel installation
+- split off libwpd-devel-doc subpackage
+- cleaned up spec a bit
+
+-------------------------------------------------------------------
Old:
----
libwpd-0.8.12.tar.bz2
New:
----
libwpd-0.8.14-install-docs.patch
libwpd-0.8.14.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libwpd.spec ++++++
--- /var/tmp/diff_new_pack.e10872/_old 2008-04-06 03:10:30.000000000 +0200
+++ /var/tmp/diff_new_pack.e10872/_new 2008-04-06 03:10:30.000000000 +0200
@@ -1,7 +1,7 @@
#
-# spec file for package libwpd (Version 0.8.12)
+# spec file for package libwpd (Version 0.8.14)
#
-# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
@@ -10,15 +10,18 @@
# norootforbuild
+
Name: libwpd
+# note: the main package is empty, it only sets a sane name for the source rpm
BuildRequires: doxygen gcc-c++ libgsf-devel
License: LGPL v2.1 or later
Group: System/Libraries
AutoReqProv: on
-Version: 0.8.12
+Version: 0.8.14
Release: 1
Summary: Library for Importing WordPerfect (tm) Documents
-Source: %{name}-%{version}.tar.bz2
+Source: libwpd-%{version}.tar.bz2
+Patch0: libwpd-0.8.14-install-docs.patch
Url: http://libwpd.sourceforge.net
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -36,10 +39,35 @@
Marc Maurer
Fridrich Strba
+%package -n libwpd-0_8-8
+License: LGPL v2.1 or later
+%define libname libwpd-0_8-8
+Group: System/Libraries
+# remove the old non-versioned package (built in the bs for instance)
+Obsoletes: libwpd < %version
+Summary: Library for Importing WordPerfect (tm) Documents
+
+%description -n %libname
+libwpd is a general purpose library for reading or interpreting data
+from WordPerfect files. The library is not a stand-alone utility: it is
+designed to be used by another program (for example, a word processor)
+as an in-process component.
+
+
+
+Authors:
+--------
+ William Lachance
+ Marc Maurer
+ Fridrich Strba
+
+
%package devel
+License: LGPL v2.1 or later
Group: System/Libraries
Summary: Library for importing WordPerfect (tm) documents
-Requires: %{name} = %{version} libstdc++-devel libgsf-devel glibc-devel glib2-devel
+Provides: libwpd-devel = %{version}-%{release}
+Requires: %{libname} = %{version} libstdc++-devel libgsf-devel
%description devel
libwpd is a general purpose library for reading (or, interpreting data
@@ -55,10 +83,27 @@
Marc Maurer
Fridrich Strba
+%package devel-doc
+License: LGPL v2.1 or later
+Group: System/Libraries
+Summary: Documentation for the libwpd API
+Requires: libwpd-devel
+
+%description devel-doc
+This package contains documentation for the libwpd API.
+
+
+
+Authors:
+--------
+ William Lachance
+ Marc Maurer
+ Fridrich Strba
+
%package tools
+License: LGPL v2.1 or later
Group: Productivity/Publishing/Word
Summary: Library for importing WordPerfect (tm) documents
-Requires: %{name} = %{version} libstdc++-devel libgsf-devel glibc-devel glib2-devel
%description tools
Tools to transform WordPerfect Documents into other formats. Currently
@@ -74,50 +119,88 @@
%prep
%setup -q
+%patch0
%build
-touch AUTHORS ChangeLog NEWS ; autoreconf -f -i
-%configure
+AUTOMAKE="automake --foreign" autoreconf -fi
+%configure --disable-static --docdir=%_docdir/%name
make %{?jobs:-j%jobs}
%install
make DESTDIR=$RPM_BUILD_ROOT install
-mkdir -p $RPM_BUILD_ROOT%{_docdir}
-mv $RPM_BUILD_ROOT/usr/share/doc/%{name}-%{version} $RPM_BUILD_ROOT%{_docdir}/%{name}
-cp -p CHANGES COPYING CREDITS HACKING README TODO $RPM_BUILD_ROOT%{_docdir}/%{name}
-chmod -x $RPM_BUILD_ROOT%{_docdir}/%{name}/html/* $RPM_BUILD_ROOT%{_docdir}/%{name}/*.png
+rm $RPM_BUILD_ROOT%_libdir/*.la
+# not needed in binary packages
+rm $RPM_BUILD_ROOT/%_docdir/%name/{HACKING,INSTALL,README}
%clean
rm -rf $RPM_BUILD_ROOT
-%post
-%run_ldconfig
+%post -n %libname -p /sbin/ldconfig
-%postun
-%run_ldconfig
+%postun -n %libname -p /sbin/ldconfig
-%files
-%defattr(-, root, root)
-%doc %dir %{_docdir}/%{name}
-%doc %{_docdir}/%{name}/[A-Z]*
-%{_docdir}/%{name}/libwpd.png
+%files -n %libname
+%defattr(-,root,root)
%{_libdir}/*.so.*
%files devel
-%defattr (-, root, root)
-%doc %{_docdir}/%{name}/html
-%doc %{_docdir}/%{name}/libwpd.dia
+%defattr(-,root,root)
%{_libdir}/*.so
-%{_libdir}/*.*a
-%{_libdir}/pkgconfig/*.pc
-%{_includedir}/libwpd-0.8
+%{_libdir}/pkgconfig/libwpd*.pc
+%{_includedir}/libwpd-*
+
+%files devel-doc
+%defattr(-,root,root)
+%doc %dir %{_docdir}/%{name}
+%doc %{_docdir}/%{name}/html
+%doc %{_docdir}/%{name}/libwpd.*
%files tools
-%defattr (-, root, root)
+%defattr(-,root,root)
%{_bindir}/*
+%doc %dir %{_docdir}/%{name}
+%doc %{_docdir}/%{name}/[A-Z]*
%changelog
-* Mon Nov 26 2007 - pmladek@suse.cz
+* Fri Apr 04 2008 mmarek@suse.cz
+- rename the library package to libwpd-0_8-8, as required by the
+ library policy (libwpd-0.8.so.8 -> libwpd-0_8-8)
+- don't version the devel package after discussion with pmladek
+ we'll do it only if the need arises
+* Wed Apr 02 2008 mmarek@suse.cz
+- update to version 0.8.14:
+ - Fix some warnings due to unused variables
+ - Fix a warning due to a name hiding.
+ - Fix two loops with corrupted documents (Thank you, sum1!)
+ - Implement readahead in the WPXStreamImplementation class (Jan
+ Holesovsky, Fridrich)
+ - Fix some memory issues properly (each class deletes what it
+ allocated) (Fridrich)
+ - Work around an issue with relative seeks backward and certain
+ versions of libstdc++ in the buffered stream implementation
+ (Fridrich, sum1)
+ - Fix a problem of conversion of some page breaks due to an
+ unreachable block in the code (Fridrich)
+ - Fix a crasher in a rare case of a footnote/endnote being
+ defined in a table and the footnote/endnote having itself a
+ table (Fridrich).
+ - Fix some null pointer crashes with corrupted documents in table
+ code and in cases where there is no prefix ID present (sum1,
+ Fridrich).
+ - Fix a out of bounds array in parsing WP5 extended characters
+ with broken documents (sum1).
+ - Remove some abuse of pointers (Fridrich).
+ - In "wpd2raw --callback", return "-1" if no one callback was
+ called (Fridrich).
+ - Fix some issues with incorrect indents in some rear cases
+ (Fridrich).
+ - Fix some signedness problems (Fridrich).
+- don't install static libraries and libtool archives
+- renamed library and devel package to libwpd-0_8 and
+ libwpd-0_8-devel respectively, to allow parallel installation
+- split off libwpd-devel-doc subpackage
+- cleaned up spec a bit
+* Mon Nov 26 2007 pmladek@suse.cz
- update to version 0.8.12:
- Convert Tab Set function for WP5 parser
- Basic conversion of tabulators and indents in WP3 parser
@@ -125,12 +208,12 @@
- Convert the most usual Macintosh fonts from fontId to font name in
WP1 parser
- Fix compilation with the upcoming gcc 4.3
-* Mon Oct 01 2007 - stbinner@suse.de
+* Mon Oct 01 2007 stbinner@suse.de
- update to version 0.8.11:
- Fix incorrect conversion of tables with cells spanning more
then 127 rows due to incorrect information in the file-format
- Fix incorrect reading of font name information in prefix packets
-* Sun Jun 17 2007 - stbinner@suse.de
+* Sun Jun 17 2007 stbinner@suse.de
- update to version 0.8.10:
* Fix a locale dependency in our float to string conversion
* Enhance our reading of document meta data for WP6
@@ -139,7 +222,7 @@
* Prevent the heuristic typedetection from throwing
* Add a new stream implementation based on C++ streams, rendering
libgsf dependency very optional; deprecate GSFInputStream
-* Fri Mar 16 2007 - stbinner@suse.de
+* Fri Mar 16 2007 stbinner@suse.de
- update to version 0.8.9:
* Fix a bug in WP1 document type detection where we could try to
seek to a negative place in document (Fridrich)
@@ -150,7 +233,7 @@
cause an application linked with libwpd, such as OpenOffice, to
crash or possibly execute arbitrary code if the file was opened
by a victim. (CVE-2007-0002) (iDefense's Sean Larsson, Fridrich)
-* Sun Jan 14 2007 - dmueller@suse.de
+* Sun Jan 14 2007 dmueller@suse.de
- update to version 0.8.8:
* Add unit tests for the stream class
* Ignore foot/endnotes that are referenced inside other foot/endnotes
@@ -159,24 +242,24 @@
fixes http://www.openoffice.org/issues/show_bug.cgi?id=72307
* Remove some potential memory leaks in the WPXPropertyList class and optimize
the WPXPropertyList subscription operator
-* Mon Dec 18 2006 - sbrabec@suse.cz
+* Mon Dec 18 2006 sbrabec@suse.cz
- Spec file cleanup.
-* Tue Nov 07 2006 - ro@suse.de
+* Tue Nov 07 2006 ro@suse.de
- fix docu permissions
-* Mon Oct 09 2006 - stbinner@suse.de
+* Mon Oct 09 2006 stbinner@suse.de
- update to version 0.8.7:
* Revert the alignment fix, in order to mimick the way WP for
Mac renders the documents
* Support for WP Mac 1.x documents
* Fix memory leak in standalone converters
* Miscellaneous code cleanups
-* Mon Jul 17 2006 - stbinner@suse.de
+* Mon Jul 17 2006 stbinner@suse.de
- update to version 0.8.6:
* Initial support of WP Mac 2.x documents
* Initial conversion of headers/footers in WP42 parser
* General improvement of libwpd's conversion-success-rate and
extensive QA with more than 46'000 real life documents
-* Thu Jun 01 2006 - stbinner@suse.de
+* Thu Jun 01 2006 stbinner@suse.de
- update to version 0.8.5
* adds header and footer conversion in WP5.x and WP3.x for
Macintosh file formats.
@@ -184,14 +267,14 @@
* improves the conversion of page margins and corrects issues
with conversion of the position of tables and tabstops in
multicolumn sections
-* Wed Jan 25 2006 - mls@suse.de
+* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
-* Thu Dec 08 2005 - stbinner@suse.de
+* Thu Dec 08 2005 stbinner@suse.de
- update to version 0.8.4
-* Wed Oct 19 2005 - sbrabec@suse.cz
+* Wed Oct 19 2005 sbrabec@suse.cz
- Package documentation.
- Split to subpackages.
-* Sat Oct 08 2005 - coolo@suse.de
+* Sat Oct 08 2005 coolo@suse.de
- make it build with gcc 4.1 (sent upstream)
-* Tue Oct 04 2005 - stbinner@suse.de
+* Tue Oct 04 2005 stbinner@suse.de
- initial package of version 0.8.3
++++++ libwpd-0.8.14-install-docs.patch ++++++
Don't install executable documentation.
Respect --docdir configure option
---
Makefile.am | 18 +++++++++---------
docs/Makefile.am | 10 +++++-----
docs/doxygen/Makefile.am | 10 +++++-----
3 files changed, 19 insertions(+), 19 deletions(-)
--- Makefile.am.orig
+++ Makefile.am
@@ -38,14 +38,14 @@ check: all
if WITH_LIBWPD_DOCS
install-data-local:
- mkdir -p $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@
- $(INSTALL) $(srcdir)/CHANGES $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@/
- $(INSTALL) $(srcdir)/COPYING $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@/
- $(INSTALL) $(srcdir)/CREDITS $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@/
- $(INSTALL) $(srcdir)/HACKING $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@/
- $(INSTALL) $(srcdir)/INSTALL $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@/
- $(INSTALL) $(srcdir)/README $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@/
- $(INSTALL) $(srcdir)/TODO $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@/
+ mkdir -p $(DESTDIR)$(docdir)
+ $(INSTALL_DATA) $(srcdir)/CHANGES $(DESTDIR)$(docdir)/
+ $(INSTALL_DATA) $(srcdir)/COPYING $(DESTDIR)$(docdir)/
+ $(INSTALL_DATA) $(srcdir)/CREDITS $(DESTDIR)$(docdir)/
+ $(INSTALL_DATA) $(srcdir)/HACKING $(DESTDIR)$(docdir)/
+ $(INSTALL_DATA) $(srcdir)/INSTALL $(DESTDIR)$(docdir)/
+ $(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(docdir)/
+ $(INSTALL_DATA) $(srcdir)/TODO $(DESTDIR)$(docdir)/
uninstall-local:
- -rm -rf $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@
+ -rm -rf $(DESTDIR)$(docdir)
endif
--- docs/Makefile.am.orig
+++ docs/Makefile.am
@@ -5,12 +5,12 @@ EXTRA_DIST = libwpd.dia libwpd.png
if WITH_LIBWPD_DOCS
install-data-am:
- mkdir -p $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@
- $(INSTALL) $(srcdir)/libwpd.dia $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@/
- $(INSTALL) $(srcdir)/libwpd.png $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@/
+ mkdir -p $(DESTDIR)$(docdir)
+ $(INSTALL_DATA) $(srcdir)/libwpd.dia $(DESTDIR)$(docdir)/libwpd.dia
+ $(INSTALL_DATA) $(srcdir)/libwpd.png $(DESTDIR)$(docdir)/libwpd.png
uninstall-am:
- -rm -f $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@/libwpd.dia
- -rm -f $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@/libwpd.png
+ -rm -f $(DESTDIR)$(docdir)/libwpd.dia
+ -rm -f $(DESTDIR)$(docdir)/libwpd.png
endif
--- docs/doxygen/Makefile.am.orig
+++ docs/doxygen/Makefile.am
@@ -5,13 +5,13 @@ EXTRA_DIST = doxygen.cfg \
if WITH_LIBWPD_DOCS
install-data-am:
- mkdir -p $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@/html
- $(INSTALL) html/*.html $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@/html/
- $(INSTALL) html/*.png $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@/html/
- $(INSTALL) html/*.css $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@/html/
+ mkdir -p $(DESTDIR)$(docdir)/html
+ $(INSTALL_DATA) html/*.html $(DESTDIR)$(docdir)/html/
+ $(INSTALL_DATA) html/*.png $(DESTDIR)$(docdir)/html/
+ $(INSTALL_DATA) html/*.css $(DESTDIR)$(docdir)/html/
uninstall-am:
- -rm -rf $(DESTDIR)$(datadir)/doc/libwpd-@WPD_VERSION@/html
+ -rm -rf $(DESTDIR)$(docdir)/html
all:
test -f header.html.in || $(LN_S) $(srcdir)/header.html.in ./
++++++ libwpd-0.8.12.tar.bz2 -> libwpd-0.8.14.tar.bz2 ++++++
++++ 8527 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/CHANGES new/libwpd-0.8.14/CHANGES
--- old/libwpd-0.8.12/CHANGES 2007-10-10 17:09:32.000000000 +0200
+++ new/libwpd-0.8.14/CHANGES 2008-02-12 10:57:29.000000000 +0100
@@ -1,4 +1,27 @@
CHANGES:
+0.8.13 - 0.8.14
+- Fix some warnings due to unused variables
+- Fix a warning due to a name hiding.
+- Fix two loops with corrupted documents (Thank you, sum1!)
+
+0.8.12 - 0.8.13
+- Implement readahead in the WPXStreamImplementation class (Jan Holesovsky, Fridrich)
+- Fix some memory issues properly (each class deletes what it allocated) (Fridrich)
+- Work around an issue with relative seeks backward and certain versions of libstdc++
+ in the buffered stream implementation (Fridrich, sum1)
+- Fix a problem of conversion of some page breaks due to an unreachable block in the
+ code (Fridrich)
+- Fix a crasher in a rare case of a footnote/endnote being defined in a table and the
+ footnote/endnote having itself a table (Fridrich).
+- Fix some null pointer crashes with corrupted documents in table code and in cases where
+ there is no prefix ID present (sum1, Fridrich).
+- Fix a out of bounds array in parsing WP5 extended characters with broken documents
+ (sum1).
+- Remove some abuse of pointers (Fridrich).
+- In "wpd2raw --callback", return "-1" if no one callback was called (Fridrich).
+- Fix some issues with incorrect indents in some rear cases (Fridrich).
+- Fix some signedness problems (Fridrich).
+
0.8.11 - 0.8.12
- Enable building of statically linked tools even when a shared library is built,
useful for scripting the creation of win32 release packages (Robert Staudinger,
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/configure.in new/libwpd-0.8.14/configure.in
--- old/libwpd-0.8.12/configure.in 2007-10-10 16:30:29.000000000 +0200
+++ new/libwpd-0.8.14/configure.in 2008-02-12 11:20:50.000000000 +0100
@@ -1,10 +1,10 @@
-AC_INIT(src/lib/WPXParser.cpp)
+AC_INIT([src/lib/WPXParser.cpp])
AM_CONFIG_HEADER(config.h)
WPD_MAJOR_VERSION=0
WPD_MINOR_VERSION=8
-WPD_MICRO_VERSION=12
+WPD_MICRO_VERSION=14
WPD_VERSION="$WPD_MAJOR_VERSION.$WPD_MINOR_VERSION.$WPD_MICRO_VERSION"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/libwpd.spec new/libwpd-0.8.14/libwpd.spec
--- old/libwpd-0.8.12/libwpd.spec 2007-10-10 22:29:46.000000000 +0200
+++ new/libwpd-0.8.14/libwpd.spec 2008-02-12 11:45:32.000000000 +0100
@@ -1,5 +1,5 @@
%define name libwpd
-%define version 0.8.12
+%define version 0.8.14
%define RELEASE 1
%define release %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE}
@@ -90,7 +90,7 @@
%if %{!?_without_docs:1}%{?_without_docs:0}
%files docs
-%{_datadir}/doc/libwpd-0.8.12/*
+%{_datadir}/doc/libwpd-0.8.14/*
%endif
%changelog
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/conv/raw/RawListener.cpp new/libwpd-0.8.14/src/conv/raw/RawListener.cpp
--- old/libwpd-0.8.12/src/conv/raw/RawListener.cpp 2007-06-13 10:10:38.000000000 +0200
+++ new/libwpd-0.8.14/src/conv/raw/RawListener.cpp 2007-12-08 12:51:23.000000000 +0100
@@ -32,6 +32,7 @@
#endif
#define _U(M, L) \
+ m_atLeastOneCallback = true; \
if (!m_printCallgraphScore) \
__iuprintf M; \
else \
@@ -42,6 +43,7 @@
#endif
#define _D(M, L) \
+ m_atLeastOneCallback = true; \
if (!m_printCallgraphScore) \
__idprintf M; \
else \
@@ -55,6 +57,7 @@
RawListenerImpl::RawListenerImpl(bool printCallgraphScore) :
m_indent(0),
m_callbackMisses(0),
+ m_atLeastOneCallback(false),
m_printCallgraphScore(printCallgraphScore),
m_callStack()
{
@@ -63,11 +66,12 @@
RawListenerImpl::~RawListenerImpl()
{
if (m_printCallgraphScore)
- printf("%d\n", (int)(m_callStack.size() + m_callbackMisses));
+ printf("%d\n", m_atLeastOneCallback ? (int)(m_callStack.size() + m_callbackMisses) : -1);
}
void RawListenerImpl::__iprintf(const char *format, ...)
{
+ m_atLeastOneCallback = true;
if (m_printCallgraphScore) return;
va_list args;
@@ -80,6 +84,7 @@
void RawListenerImpl::__iuprintf(const char *format, ...)
{
+ m_atLeastOneCallback = true;
va_list args;
va_start(args, format);
for (int i=0; iseek(0, WPX_SEEK_SET);
WP1Parser::parseDocument(tmpStream, listener);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP3ContentListener.cpp new/libwpd-0.8.14/src/lib/WP3ContentListener.cpp
--- old/libwpd-0.8.12/src/lib/WP3ContentListener.cpp 2007-09-23 21:15:51.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WP3ContentListener.cpp 2007-11-27 17:06:45.000000000 +0100
@@ -491,6 +491,8 @@
{
if (!isUndoOn())
{
+ _openPageSpan();
+
int oldColumnNum = m_ps->m_numColumns;
// In WP, the last column ends with a hard column break code.
@@ -550,10 +552,12 @@
if ((m_ps->m_numColumns > 1 && oldColumnNum <= 1) || (m_ps->m_numColumns <= 1 && oldColumnNum > 1))
{
m_ps->m_paragraphMarginLeft -= m_ps->m_leftMarginByPageMarginChange;
+ m_ps->m_listReferencePosition -= m_ps->m_leftMarginByPageMarginChange;
m_ps->m_paragraphMarginRight -= m_ps->m_rightMarginByPageMarginChange;
std::swap(m_ps->m_leftMarginByPageMarginChange, m_ps->m_sectionMarginLeft);
std::swap(m_ps->m_rightMarginByPageMarginChange, m_ps->m_sectionMarginRight);
m_ps->m_paragraphMarginLeft += m_ps->m_leftMarginByPageMarginChange;
+ m_ps->m_listReferencePosition += m_ps->m_leftMarginByPageMarginChange;
m_ps->m_paragraphMarginRight += m_ps->m_rightMarginByPageMarginChange;
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP3SubDocument.cpp new/libwpd-0.8.14/src/lib/WP3SubDocument.cpp
--- old/libwpd-0.8.12/src/lib/WP3SubDocument.cpp 2007-09-19 04:47:34.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WP3SubDocument.cpp 2007-10-15 10:18:16.000000000 +0200
@@ -34,6 +34,8 @@
void WP3SubDocument::parse(WP3Listener *listener) const
{
WPXMemoryInputStream *tmpStream = getStream();
+ if (!tmpStream)
+ return;
tmpStream->seek(0, WPX_SEEK_SET);
WP3Parser::parseDocument(tmpStream, listener);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP42SubDocument.cpp new/libwpd-0.8.14/src/lib/WP42SubDocument.cpp
--- old/libwpd-0.8.12/src/lib/WP42SubDocument.cpp 2007-01-15 11:34:36.000000000 +0100
+++ new/libwpd-0.8.14/src/lib/WP42SubDocument.cpp 2007-10-15 10:18:16.000000000 +0200
@@ -39,6 +39,8 @@
void WP42SubDocument::parse(WP42Listener *listener) const
{
WPXMemoryInputStream *tmpStream = getStream();
+ if (!tmpStream)
+ return;
tmpStream->seek(0, WPX_SEEK_SET);
listener->marginReset(readU8(tmpStream), readU8(tmpStream));
WP42Parser::parseDocument(tmpStream, listener);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP5ContentListener.cpp new/libwpd-0.8.14/src/lib/WP5ContentListener.cpp
--- old/libwpd-0.8.12/src/lib/WP5ContentListener.cpp 2007-10-10 15:44:47.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WP5ContentListener.cpp 2007-12-08 12:51:24.000000000 +0100
@@ -337,6 +337,8 @@
_openTableCell(colSpan, rowSpan, borderBits, cellFgColor, cellBgColor,
cellBorderColor, cellVerticalAlignment);
m_ps->m_isCellWithoutParagraph = true;
+ if (m_ps->m_currentTableCol < 1)
+ return;
if (useCellAttributes)
m_ps->m_cellAttributeBits = cellAttributes;
else
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP5StylesListener.cpp new/libwpd-0.8.14/src/lib/WP5StylesListener.cpp
--- old/libwpd-0.8.12/src/lib/WP5StylesListener.cpp 2007-07-05 15:07:56.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WP5StylesListener.cpp 2007-12-08 13:12:37.000000000 +0100
@@ -261,6 +261,8 @@
if (!isUndoOn())
{
m_currentPageHasContent = true;
+ if (!m_currentTable)
+ throw ParseException();
m_currentTable->insertRow();
}
}
@@ -273,6 +275,8 @@
if (!isUndoOn())
{
m_currentPageHasContent = true;
+ if (!m_currentTable)
+ throw ParseException();
m_currentTable->insertCell(colSpan, rowSpan, borderBits);
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP5StylesListener.h new/libwpd-0.8.14/src/lib/WP5StylesListener.h
--- old/libwpd-0.8.12/src/lib/WP5StylesListener.h 2007-10-09 11:30:11.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WP5StylesListener.h 2008-01-12 14:40:03.000000000 +0100
@@ -46,7 +46,7 @@
void setTabs(const std::vector<WPXTabStop>& /* tabStops */, const uint16_t /* tabOffset */) {}
void insertCharacter(const uint16_t /* character */) { /*if (!isUndoOn())*/ m_currentPageHasContent = true; }
void insertTab(const uint8_t /* tabType */, const float /* tabPosition */) { /*if (!isUndoOn())*/ m_currentPageHasContent = true; }
- virtual void insertIndent(const uint8_t indentType, const float indentPosition) { /*if (!isUndoOn())*/ m_currentPageHasContent = true; }
+ virtual void insertIndent(const uint8_t /* indentType */, const float /* indentPosition */) { /*if (!isUndoOn())*/ m_currentPageHasContent = true; }
void characterColorChange(const uint8_t /* red */, const uint8_t /* green */, const uint8_t /* blue */) {};
void insertEOL() { /*if (!isUndoOn())*/ m_currentPageHasContent = true; }
void insertBreak(const uint8_t breakType);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP5SubDocument.cpp new/libwpd-0.8.14/src/lib/WP5SubDocument.cpp
--- old/libwpd-0.8.12/src/lib/WP5SubDocument.cpp 2007-01-15 11:34:36.000000000 +0100
+++ new/libwpd-0.8.14/src/lib/WP5SubDocument.cpp 2007-10-15 10:18:16.000000000 +0200
@@ -34,6 +34,8 @@
void WP5SubDocument::parse(WP5Listener *listener) const
{
WPXMemoryInputStream *tmpStream = getStream();
+ if (!tmpStream)
+ return;
tmpStream->seek(0, WPX_SEEK_SET);
WP5Parser::parseDocument(tmpStream, listener);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP6CharacterGroup.cpp new/libwpd-0.8.14/src/lib/WP6CharacterGroup.cpp
--- old/libwpd-0.8.12/src/lib/WP6CharacterGroup.cpp 2007-05-09 14:37:27.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WP6CharacterGroup.cpp 2007-12-08 12:51:25.000000000 +0100
@@ -104,8 +104,8 @@
void WP6CharacterGroup_FontFaceChangeSubGroup::parse(WP6Listener *listener, const uint8_t /* numPrefixIDs */, uint16_t const *prefixIDs) const
{
WPD_DEBUG_MSG(("WordPerfect: FontFaceChangeSubGroup parsing\n"));
- // TODO: check that we have 1 prefix id
- // emit an exception otherwise
+ if (!prefixIDs)
+ return;
listener->fontChange(m_matchedFontPointSize, prefixIDs[0]);
}
@@ -123,8 +123,8 @@
void WP6CharacterGroup_FontSizeChangeSubGroup::parse(WP6Listener *listener, const uint8_t /* numPrefixIDs */, uint16_t const *prefixIDs) const
{
WPD_DEBUG_MSG(("WordPerfect: FontSizeChangeSubGroup parsing\n"));
- // TODO: check that we have 1 prefix id
- // emit an exception otherwise
+ if (!prefixIDs)
+ return;
listener->fontChange(m_desiredFontPointSize, prefixIDs[0]);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP6ContentListener.cpp new/libwpd-0.8.14/src/lib/WP6ContentListener.cpp
--- old/libwpd-0.8.12/src/lib/WP6ContentListener.cpp 2007-07-11 15:44:41.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WP6ContentListener.cpp 2008-01-30 22:34:49.000000000 +0100
@@ -169,7 +169,7 @@
const uint8_t month, const uint8_t day,
const uint8_t hour, const uint8_t minute,
const uint8_t second, const uint8_t dayOfWeek,
- const uint8_t timeZone, const uint8_t unused)
+ const uint8_t /* timeZone */, const uint8_t /* unused */)
{
#define DATEBUFLEN 100 // length of buffer allocated for strftime()
#define WPMONDAYOFFSET 1 // WP week starts Monday, tm_wday on Sunday
@@ -913,6 +913,8 @@
{
if (!isUndoOn())
{
+ _openPageSpan(); // we need to have the right dimension, so open page span here if it is not already opened
+
int oldColumnNum = m_ps->m_numColumns;
// In WP, the last column ends with a hard column break code.
@@ -969,13 +971,16 @@
m_ps->m_numColumns = numColumns;
m_ps->m_textColumns = tmpColumnDefinition;
m_ps->m_isTextColumnWithoutParagraph = true;
+
if ((m_ps->m_numColumns > 1 && oldColumnNum <= 1) || (m_ps->m_numColumns <= 1 && oldColumnNum > 1))
{
m_ps->m_paragraphMarginLeft -= m_ps->m_leftMarginByPageMarginChange;
+ m_ps->m_listReferencePosition -= m_ps->m_leftMarginByPageMarginChange;
m_ps->m_paragraphMarginRight -= m_ps->m_rightMarginByPageMarginChange;
std::swap(m_ps->m_leftMarginByPageMarginChange, m_ps->m_sectionMarginLeft);
std::swap(m_ps->m_rightMarginByPageMarginChange, m_ps->m_sectionMarginRight);
m_ps->m_paragraphMarginLeft += m_ps->m_leftMarginByPageMarginChange;
+ m_ps->m_listReferencePosition += m_ps->m_leftMarginByPageMarginChange;
m_ps->m_paragraphMarginRight += m_ps->m_rightMarginByPageMarginChange;
}
}
@@ -1261,6 +1266,8 @@
// pull a table definition off of our stack
m_parseState->m_currentTable = m_parseState->m_tableList[m_parseState->m_nextTableIndice++];
+ if (!m_parseState->m_currentTable)
+ throw ParseException();
m_parseState->m_currentTable->makeBordersConsistent();
m_ps->m_numRowsToSkip.clear();
}
@@ -1309,6 +1316,9 @@
_openSection();
m_ps->m_sectionAttributesChanged = false;
}
+ if (!m_parseState->m_currentTable)
+ throw ParseException();
+
if (!m_parseState->m_currentTable->isEmpty()) // WordPerfect ignores empty tables and inserts an Hard EOL instead
_openTable();
@@ -1404,6 +1414,8 @@
_openSpan();
// Close the sub-document properly
+ if (m_ps->m_isTableOpened)
+ _closeTable();
if (m_ps->m_isParagraphOpened)
_closeParagraph();
if (m_ps->m_isListElementOpened)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP6EOLGroup.cpp new/libwpd-0.8.14/src/lib/WP6EOLGroup.cpp
--- old/libwpd-0.8.12/src/lib/WP6EOLGroup.cpp 2007-09-14 14:50:02.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WP6EOLGroup.cpp 2008-01-31 17:21:14.000000000 +0100
@@ -236,6 +236,8 @@
throw FileException();
}
+ if (startPosition2 + numBytesToSkip - 1 - input->tell() < 0)
+ throw FileException();
input->seek((startPosition2 + numBytesToSkip - 1 - input->tell()), WPX_SEEK_CUR);
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP6ExtendedDocumentSummaryPacket.cpp new/libwpd-0.8.14/src/lib/WP6ExtendedDocumentSummaryPacket.cpp
--- old/libwpd-0.8.12/src/lib/WP6ExtendedDocumentSummaryPacket.cpp 2007-06-13 11:29:44.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WP6ExtendedDocumentSummaryPacket.cpp 2007-10-15 10:18:16.000000000 +0200
@@ -32,6 +32,7 @@
WP6ExtendedDocumentSummaryPacket::WP6ExtendedDocumentSummaryPacket(WPXInputStream *input, int /* id */, uint32_t dataOffset, uint32_t dataSize) :
WP6PrefixDataPacket(input),
m_dataSize(dataSize),
+ m_streamData(0),
m_stream(0)
{
if (dataSize > 0)
@@ -42,6 +43,8 @@
{
if (m_stream)
DELETEP(m_stream);
+ if (m_streamData)
+ delete [] m_streamData;
}
void WP6ExtendedDocumentSummaryPacket::_readContents(WPXInputStream *input)
@@ -50,11 +53,11 @@
return;
if (m_dataSize > ((std::numeric_limits::max)() / 2))
m_dataSize = ((std::numeric_limits::max)() / 2);
- uint8_t *streamData = new uint8_t[m_dataSize];
+ m_streamData = new uint8_t[m_dataSize];
for(unsigned i=0; i<(unsigned)m_dataSize; i++)
- streamData[i] = readU8(input);
+ m_streamData[i] = readU8(input);
- m_stream = new WPXMemoryInputStream(streamData, (size_t)m_dataSize);
+ m_stream = new WPXMemoryInputStream(m_streamData, (size_t)m_dataSize);
}
void WP6ExtendedDocumentSummaryPacket::parse(WP6Listener *listener) const
@@ -113,7 +116,8 @@
uint8_t dayOfWeek = readU8(m_stream);
uint8_t timeZone = readU8(m_stream);
uint8_t unused = readU8(m_stream);
- listener->setDate(tagID, year, month, day, hour, minute, second, dayOfWeek, timeZone, unused);
+ if (month > 0 && day > 0 && year >= 1900)
+ listener->setDate(tagID, year, month, day, hour, minute, second, dayOfWeek, timeZone, unused);
}
catch (FileException)
{
@@ -134,8 +138,9 @@
characterSet, &chars);
for (int j = 0; j < len; j++)
appendUCS4(data, (uint32_t)chars[j]);
- }
- listener->setExtendedInformation(tagID, data);
+ }
+ if (data.len())
+ listener->setExtendedInformation(tagID, data);
}
m_stream->seek((i+groupLength), WPX_SEEK_SET);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP6ExtendedDocumentSummaryPacket.h new/libwpd-0.8.14/src/lib/WP6ExtendedDocumentSummaryPacket.h
--- old/libwpd-0.8.12/src/lib/WP6ExtendedDocumentSummaryPacket.h 2007-05-09 14:37:27.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WP6ExtendedDocumentSummaryPacket.h 2007-10-15 10:18:16.000000000 +0200
@@ -43,6 +43,7 @@
WP6ExtendedDocumentSummaryPacket(const WP6ExtendedDocumentSummaryPacket&);
WP6ExtendedDocumentSummaryPacket& operator=(const WP6ExtendedDocumentSummaryPacket&);
uint32_t m_dataSize;
+ uint8_t *m_streamData;
mutable WPXMemoryInputStream *m_stream;
};
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP6FixedLengthGroup.cpp new/libwpd-0.8.14/src/lib/WP6FixedLengthGroup.cpp
--- old/libwpd-0.8.12/src/lib/WP6FixedLengthGroup.cpp 2006-10-09 05:50:18.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WP6FixedLengthGroup.cpp 2008-01-30 22:32:25.000000000 +0100
@@ -68,12 +68,15 @@
bool WP6FixedLengthGroup::isGroupConsistent(WPXInputStream *input, const uint8_t groupID)
{
+ if (groupID == (uint8_t)0xFF)
+ return false;
+
uint32_t startPosition = input->tell();
try
{
int size = WP6_FIXED_LENGTH_FUNCTION_GROUP_SIZE[groupID-0xF0];
- if (input->seek((startPosition + size - 2 - input->tell()), WPX_SEEK_CUR) || input->atEOS())
+ if (input->seek((startPosition + size - 2 - (uint32_t)input->tell()), WPX_SEEK_CUR) || input->atEOS())
{
input->seek(startPosition, WPX_SEEK_SET);
return false;
@@ -99,11 +102,11 @@
uint32_t startPosition = input->tell();
_readContents(input);
- if (m_group >= 0xF0) // just an extra safety check
+ if (m_group >= 0xF0 && m_group < 0xFF) // just an extra safety check
{
- int size = WP6_FIXED_LENGTH_FUNCTION_GROUP_SIZE[m_group-0xF0];
+ uint32_t size = WP6_FIXED_LENGTH_FUNCTION_GROUP_SIZE[m_group-0xF0];
input->seek((startPosition + size - 2 - input->tell()), WPX_SEEK_CUR);
- if (m_group != readU8(input))
+ if (input->atEOS() || m_group != readU8(input))
{
WPD_DEBUG_MSG(("WordPerfect: Possible corruption detected: bailing out!\n"));
throw FileException();
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP6GeneralTextPacket.cpp new/libwpd-0.8.14/src/lib/WP6GeneralTextPacket.cpp
--- old/libwpd-0.8.12/src/lib/WP6GeneralTextPacket.cpp 2007-02-27 11:56:51.000000000 +0100
+++ new/libwpd-0.8.14/src/lib/WP6GeneralTextPacket.cpp 2007-10-15 10:18:17.000000000 +0200
@@ -30,7 +30,8 @@
WP6GeneralTextPacket::WP6GeneralTextPacket(WPXInputStream *input, int /* id */, uint32_t dataOffset, uint32_t dataSize):
WP6PrefixDataPacket(input),
- m_subDocument(0)
+ m_subDocument(0),
+ m_streamData(0)
{
_read(input, dataOffset, dataSize);
}
@@ -39,6 +40,8 @@
{
if (m_subDocument)
delete m_subDocument;
+ if (m_streamData)
+ delete [] m_streamData;
}
void WP6GeneralTextPacket::_readContents(WPXInputStream *input)
@@ -54,8 +57,8 @@
}
uint32_t *blockSizes = new uint32_t[numTextBlocks];
- unsigned int totalSize = 0;
- unsigned int i;
+ unsigned totalSize = 0;
+ unsigned i;
for(i=0; itell() - startPosition + blockSizes[i]) > getDataSize() || input->atEOS())
throw FileException();
for (unsigned int j=0; j * typeIterPair;
- typeIterPair = prefixData->getPrefixDataPacketsOfType(type);
- if (typeIterPair->first != typeIterPair->second)
+ std::pair< MPDP_CIter, MPDP_CIter > typeIterPair = prefixData->getPrefixDataPacketsOfType(type);
+ if (typeIterPair.first != typeIterPair.second)
{
- typeIterPair->first->second->parse(listener);
+ typeIterPair.first->second->parse(listener);
}
-
- DELETEP(typeIterPair);
}
void WP6Parser::parsePackets(WP6PrefixData *prefixData, int type, WP6Listener *listener)
@@ -173,18 +170,13 @@
if (!prefixData)
return;
- std::pair< MPDP_CIter, MPDP_CIter > * typeIterPair;
-
- typeIterPair = prefixData->getPrefixDataPacketsOfType(type);
- for (MPDP_CIter iter=typeIterPair->first;
- iter != typeIterPair->second;
+ std::pair< MPDP_CIter, MPDP_CIter > typeIterPair = prefixData->getPrefixDataPacketsOfType(type);
+ for (MPDP_CIter iter=typeIterPair.first;
+ iter != typeIterPair.second;
iter++)
{
iter->second->parse(listener);
}
-
- DELETEP(typeIterPair);
-
}
// WP6Parser::parse() reads AND parses a wordperfect document, passing any retrieved low-level
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP6Part.cpp new/libwpd-0.8.14/src/lib/WP6Part.cpp
--- old/libwpd-0.8.12/src/lib/WP6Part.cpp 2006-11-14 15:52:45.000000000 +0100
+++ new/libwpd-0.8.14/src/lib/WP6Part.cpp 2008-01-30 22:32:25.000000000 +0100
@@ -53,7 +53,7 @@
return WP6VariableLengthGroup::constructVariableLengthGroup(input, readVal);
}
- else if (readVal >= (uint8_t)0xF0)
+ else if (readVal >= (uint8_t)0xF0 && readVal < (uint8_t)0xFF)
{
if (!WP6FixedLengthGroup::isGroupConsistent(input, readVal))
{
@@ -63,6 +63,10 @@
WPD_DEBUG_MSG(("WordPerfect: constructFixedLengthGroup(input, val=0x%.2x)\n", readVal));
return WP6FixedLengthGroup::constructFixedLengthGroup(input, readVal);
}
+#ifdef DEBUG
+ else
+ WPD_DEBUG_MSG(("WordPerfect: invalid group (val=0x%2x)\n", readVal));
+#endif
WPD_DEBUG_MSG(("WordPerfect: Returning 0 from constructPart\n"));
return 0;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP6PrefixData.cpp new/libwpd-0.8.14/src/lib/WP6PrefixData.cpp
--- old/libwpd-0.8.12/src/lib/WP6PrefixData.cpp 2007-05-09 14:37:27.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WP6PrefixData.cpp 2007-10-16 20:28:53.000000000 +0200
@@ -80,13 +80,9 @@
return 0;
}
-std::pair * WP6PrefixData::getPrefixDataPacketsOfType(const int type) const
+std::pair WP6PrefixData::getPrefixDataPacketsOfType(const int type) const
{
- std::pair *typePair = new std::pair;
std::pair tempPair = m_prefixDataPacketTypeHash.equal_range(type);
- typePair->first = tempPair.first;
- typePair->second = tempPair.second;
-
- return typePair;
+ return tempPair;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP6PrefixData.h new/libwpd-0.8.14/src/lib/WP6PrefixData.h
--- old/libwpd-0.8.12/src/lib/WP6PrefixData.h 2007-01-04 12:53:50.000000000 +0100
+++ new/libwpd-0.8.14/src/lib/WP6PrefixData.h 2007-10-16 20:28:53.000000000 +0200
@@ -40,7 +40,7 @@
WP6PrefixData(WPXInputStream *input, const int numPrefixIndices);
virtual ~WP6PrefixData();
const WP6PrefixDataPacket *getPrefixDataPacket(const int prefixID) const;
- std::pair< MPDP_CIter, MPDP_CIter > * getPrefixDataPacketsOfType(const int type) const;
+ std::pair< MPDP_CIter, MPDP_CIter > getPrefixDataPacketsOfType(const int type) const;
const uint16_t getDefaultInitialFontPID() const { return (uint16_t)m_defaultInitialFontPID; }
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP6SingleByteFunction.cpp new/libwpd-0.8.14/src/lib/WP6SingleByteFunction.cpp
--- old/libwpd-0.8.12/src/lib/WP6SingleByteFunction.cpp 2006-11-14 15:52:45.000000000 +0100
+++ new/libwpd-0.8.14/src/lib/WP6SingleByteFunction.cpp 2007-11-09 21:03:13.000000000 +0100
@@ -33,79 +33,71 @@
{
switch (groupID)
- {
- case WP6_TOP_SOFT_EOL:
- case WP6_TOP_SOFT_EOL_AT_EOC:
- case WP6_TOP_SOFT_EOL_AT_EOC_AT_EOP:
- case WP6_TOP_SOFT_SPACE:
- return new WP6SpaceFunction();
-
- case WP6_TOP_HARD_SPACE:
- return new WP6HardSpaceFunction();
-
- case WP6_TOP_SOFT_HYPHEN_IN_LINE:
- case WP6_TOP_SOFT_HYPHEN_AT_EOL:
- return new WP6SoftHyphenFunction();
-
- case WP6_TOP_HARD_HYPHEN:
- return new WP6HyphenFunction();
-
- case WP6_TOP_HARD_EOL:
- case WP6_TOP_HARD_EOL_AT_EOC:
- case WP6_TOP_HARD_EOL_AT_EOC_AT_EOP:
- case WP6_TOP_DORMANT_HARD_RETURN:
- case WP6_TOP_DELETABLE_HARD_EOL:
- case WP6_TOP_DELETABLE_HARD_EOL_AT_EOC:
- case WP6_TOP_DELETABLE_HARD_EOL_AT_EOC_AT_EOP:
- return new WP6EOLFunction();
-
- case WP6_TOP_TABLE_OFF_AT_EOC_AT_EOP:
- case WP6_TOP_TABLE_OFF_AT_EOC:
- case WP6_TOP_TABLE_OFF:
- return new WP6TableOffFunction();
-
- case WP6_TOP_TABLE_ROW_AT_HARD_EOP:
- case WP6_TOP_TABLE_ROW_AT_HARD_EOC_AT_HARD_EOP:
- case WP6_TOP_TABLE_ROW_AT_HARD_EOC:
- case WP6_TOP_TABLE_ROW_AT_EOC_AT_EOP:
- case WP6_TOP_TABLE_ROW_AT_EOC:
- case WP6_TOP_TABLE_ROW:
- return new WP6TableRowFunction();
-
- case WP6_TOP_TABLE_CELL:
- return new WP6TableCellFunction();
-
- // Add the remaining cases here
-// case WP6_TOP_DELETABLE_SOFT_EOL:
-// case WP6_TOP_DELETABLE_SOFT_EOL_AT_EOC:
-// case WP6_TOP_DELETABLE_SOFT_EOL_AT_EOC_AT_EOP:
-// case WP6_TOP_AUTO_HYPHEN:
- default:
- // should not happen
- return 0;
- }
-
- // search for soft page breaks and dispatch messages to that effect
- switch(groupID)
- {
- case WP6_TOP_HARD_EOC:
- case WP6_TOP_HARD_EOC_AT_EOP:
- case WP6_TOP_DELETABLE_HARD_EOC:
- case WP6_TOP_DELETABLE_HARD_EOC_AT_EOP:
- case WP6_TOP_TABLE_ROW_AT_HARD_EOC:
- return new WP6EOCFunction();
-
- case WP6_TOP_HARD_EOP:
- case WP6_TOP_TABLE_ROW_AT_HARD_EOP:
- case WP6_TOP_TABLE_ROW_AT_HARD_EOC_AT_HARD_EOP:
- case WP6_TOP_DELETABLE_HARD_EOP:
- return new WP6EOPFunction();
-
- case WP6_TOP_TABLE_OFF_AT_EOC_AT_EOP:
- case WP6_TOP_TABLE_ROW_AT_EOC_AT_EOP:
- return new WP6SoftEOPFunction();
- }
-
+ {
+ case WP6_TOP_SOFT_EOL:
+ case WP6_TOP_SOFT_EOL_AT_EOC:
+ case WP6_TOP_SOFT_EOL_AT_EOC_AT_EOP:
+ case WP6_TOP_SOFT_SPACE:
+ return new WP6SpaceFunction();
+
+ case WP6_TOP_HARD_SPACE:
+ return new WP6HardSpaceFunction();
+
+ case WP6_TOP_SOFT_HYPHEN_IN_LINE:
+ case WP6_TOP_SOFT_HYPHEN_AT_EOL:
+ return new WP6SoftHyphenFunction();
+
+ case WP6_TOP_HARD_HYPHEN:
+ return new WP6HyphenFunction();
+
+ case WP6_TOP_HARD_EOL:
+ case WP6_TOP_HARD_EOL_AT_EOC:
+ case WP6_TOP_HARD_EOL_AT_EOC_AT_EOP:
+ case WP6_TOP_DORMANT_HARD_RETURN:
+ case WP6_TOP_DELETABLE_HARD_EOL:
+ case WP6_TOP_DELETABLE_HARD_EOL_AT_EOC:
+ case WP6_TOP_DELETABLE_HARD_EOL_AT_EOC_AT_EOP:
+ return new WP6EOLFunction();
+
+ case WP6_TOP_TABLE_OFF_AT_EOC:
+ case WP6_TOP_TABLE_OFF:
+ return new WP6TableOffFunction();
+
+ case WP6_TOP_TABLE_OFF_AT_EOC_AT_EOP:
+ return new WP6TableOffAtSoftEOPFunction();
+
+ case WP6_TOP_TABLE_ROW_AT_EOC:
+ case WP6_TOP_TABLE_ROW:
+ return new WP6TableRowFunction();
+
+ case WP6_TOP_TABLE_ROW_AT_HARD_EOC:
+ return new WP6TableRowAtEOCFunction();
+
+ case WP6_TOP_TABLE_ROW_AT_EOC_AT_EOP:
+ return new WP6TableRowAtSoftEOPFunction();
+
+ case WP6_TOP_TABLE_ROW_AT_HARD_EOP:
+ case WP6_TOP_TABLE_ROW_AT_HARD_EOC_AT_HARD_EOP:
+ return new WP6TableRowAtEOPFunction();
+
+ case WP6_TOP_TABLE_CELL:
+ return new WP6TableCellFunction();
+
+ case WP6_TOP_HARD_EOC:
+ case WP6_TOP_HARD_EOC_AT_EOP:
+ case WP6_TOP_DELETABLE_HARD_EOC:
+ case WP6_TOP_DELETABLE_HARD_EOC_AT_EOP:
+ return new WP6EOCFunction();
+
+ case WP6_TOP_HARD_EOP:
+ case WP6_TOP_DELETABLE_HARD_EOP:
+ return new WP6EOPFunction();
+
+ // Add the remaining cases here
+ default:
+ // should not happen
+ return 0;
+ }
}
void WP6SpaceFunction::parse(WP6Listener *listener)
@@ -168,3 +160,40 @@
{
listener->endTable();
}
+
+void WP6TableOffAtSoftEOPFunction::parse(WP6Listener *listener)
+{
+ listener->endTable();
+ listener->insertBreak(WPX_SOFT_PAGE_BREAK);
+}
+
+void WP6TableRowAtSoftEOPFunction::parse(WP6Listener *listener)
+{
+ // use default values: if they were not default values, WordPerfect
+ // would use the multi-byte variant of this function
+ listener->insertRow(0x0000, true, false);
+ RGBSColor tmpCellBorderColor(0x00, 0x00, 0x00, 0x64);
+ listener->insertCell(1, 1, 0x00, 0, 0, &tmpCellBorderColor, TOP, false, 0x00000000);
+ listener->insertBreak(WPX_SOFT_PAGE_BREAK);
+}
+
+void WP6TableRowAtEOPFunction::parse(WP6Listener *listener)
+{
+ // use default values: if they were not default values, WordPerfect
+ // would use the multi-byte variant of this function
+ listener->insertRow(0x0000, true, false);
+ RGBSColor tmpCellBorderColor(0x00, 0x00, 0x00, 0x64);
+ listener->insertCell(1, 1, 0x00, 0, 0, &tmpCellBorderColor, TOP, false, 0x00000000);
+ listener->insertBreak(WPX_PAGE_BREAK);
+}
+
+void WP6TableRowAtEOCFunction::parse(WP6Listener *listener)
+{
+ // use default values: if they were not default values, WordPerfect
+ // would use the multi-byte variant of this function
+ listener->insertRow(0x0000, true, false);
+ RGBSColor tmpCellBorderColor(0x00, 0x00, 0x00, 0x64);
+ listener->insertCell(1, 1, 0x00, 0, 0, &tmpCellBorderColor, TOP, false, 0x00000000);
+ listener->insertBreak(WPX_COLUMN_BREAK);
+}
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP6SingleByteFunction.h new/libwpd-0.8.14/src/lib/WP6SingleByteFunction.h
--- old/libwpd-0.8.12/src/lib/WP6SingleByteFunction.h 2006-10-09 05:50:18.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WP6SingleByteFunction.h 2007-11-09 21:03:13.000000000 +0100
@@ -100,4 +100,28 @@
void parse(WP6Listener *listener);
};
+class WP6TableOffAtSoftEOPFunction : public WP6SingleByteFunction
+{
+public:
+ void parse(WP6Listener *listener);
+};
+
+class WP6TableRowAtSoftEOPFunction : public WP6SingleByteFunction
+{
+public:
+ void parse(WP6Listener *listener);
+};
+
+class WP6TableRowAtEOPFunction : public WP6SingleByteFunction
+{
+public:
+ void parse(WP6Listener *listener);
+};
+
+class WP6TableRowAtEOCFunction : public WP6SingleByteFunction
+{
+public:
+ void parse(WP6Listener *listener);
+};
+
#endif /* WP6SINGLEBYTEFUNCTION_H */
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP6StylesListener.cpp new/libwpd-0.8.14/src/lib/WP6StylesListener.cpp
--- old/libwpd-0.8.12/src/lib/WP6StylesListener.cpp 2007-07-05 15:07:56.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WP6StylesListener.cpp 2007-12-05 18:23:36.000000000 +0100
@@ -280,39 +280,37 @@
{
// We don't want to actual insert anything in the case of a sub-document, but we
// do want to capture whatever table-related information is within it..
-// if (!isUndoOn())
+ std::set oldSubDocuments;
+ oldSubDocuments = m_subDocuments;
+ // prevent entering in an endless loop
+ if ((subDocument) && (oldSubDocuments.find(subDocument) == oldSubDocuments.end()))
{
- std::set oldSubDocuments;
- oldSubDocuments = m_subDocuments;
- // prevent entering in an endless loop
- if ((subDocument) && (oldSubDocuments.find(subDocument) == oldSubDocuments.end()))
+ m_subDocuments.insert(subDocument);
+ bool oldIsSubDocument = m_isSubDocument;
+ m_isSubDocument = true;
+ WPXTable *oldCurrentTable = m_currentTable;
+ if (isHeaderFooter)
{
- m_subDocuments.insert(subDocument);
- bool oldIsSubDocument = m_isSubDocument;
- m_isSubDocument = true;
- if (isHeaderFooter)
- {
- bool oldCurrentPageHasContent = m_currentPageHasContent;
- WPXTable *oldCurrentTable = m_currentTable;
- WPXTableList oldTableList = m_tableList;
- m_tableList = tableList;
+ bool oldCurrentPageHasContent = m_currentPageHasContent;
+ WPXTableList oldTableList = m_tableList;
+ m_tableList = tableList;
- if (subDocument)
- static_cast(subDocument)->parse(this);
-
- m_tableList = oldTableList;
- m_currentTable = oldCurrentTable;
- m_currentPageHasContent = oldCurrentPageHasContent;
- }
- else
- {
- if (subDocument)
- static_cast(subDocument)->parse(this);
- }
- m_isSubDocument = oldIsSubDocument;
- m_subDocuments = oldSubDocuments;
+ if (subDocument)
+ static_cast(subDocument)->parse(this);
+ endTable();
+ m_tableList = oldTableList;
+ m_currentPageHasContent = oldCurrentPageHasContent;
+ }
+ else
+ {
+ if (subDocument)
+ static_cast(subDocument)->parse(this);
+ endTable();
}
+ m_currentTable = oldCurrentTable;
+ m_isSubDocument = oldIsSubDocument;
+ m_subDocuments = oldSubDocuments;
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP6StylesListener.h new/libwpd-0.8.14/src/lib/WP6StylesListener.h
--- old/libwpd-0.8.12/src/lib/WP6StylesListener.h 2007-05-17 15:06:21.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WP6StylesListener.h 2008-01-12 14:40:03.000000000 +0100
@@ -44,12 +44,12 @@
public:
WP6StylesListener(std::list<WPXPageSpan> &pageList, WPXTableList tableList);
- void setDate(const uint16_t type, const uint16_t year,
- const uint8_t month, const uint8_t day,
- const uint8_t hour, const uint8_t minute,
- const uint8_t second, const uint8_t dayOfWeek,
- const uint8_t timeZone, const uint8_t unused) {}
- void setExtendedInformation(const uint16_t type, const WPXString &data) {}
+ void setDate(const uint16_t /* type */, const uint16_t /* year */,
+ const uint8_t /* month */, const uint8_t /* day */,
+ const uint8_t /* hour */, const uint8_t /* minute */,
+ const uint8_t /* second */, const uint8_t /* dayOfWeek */,
+ const uint8_t /* timeZone */, const uint8_t /* unused */) {}
+ void setExtendedInformation(const uint16_t /* type */, const WPXString & /* data */) {}
void startDocument() {}
void setAlignmentCharacter(const uint16_t /* character */) {}
void setLeaderCharacter(const uint16_t /* character */, const uint8_t /* numberOfSpaces */) {}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WP6SubDocument.cpp new/libwpd-0.8.14/src/lib/WP6SubDocument.cpp
--- old/libwpd-0.8.12/src/lib/WP6SubDocument.cpp 2007-01-15 11:34:37.000000000 +0100
+++ new/libwpd-0.8.14/src/lib/WP6SubDocument.cpp 2007-10-15 10:18:17.000000000 +0200
@@ -34,6 +34,8 @@
void WP6SubDocument::parse(WP6Listener *listener) const
{
WPXMemoryInputStream *tmpStream = getStream();
+ if (!tmpStream)
+ return;
tmpStream->seek(0, WPX_SEEK_SET);
WP6Parser::parseDocument(tmpStream, listener);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WPXContentListener.cpp new/libwpd-0.8.14/src/lib/WPXContentListener.cpp
--- old/libwpd-0.8.12/src/lib/WPXContentListener.cpp 2007-09-23 21:15:52.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WPXContentListener.cpp 2007-12-08 13:12:37.000000000 +0100
@@ -478,10 +478,10 @@
propList.insert("fo:margin-top", m_ps->m_paragraphMarginTop);
propList.insert("fo:margin-bottom", m_ps->m_paragraphMarginBottom);
propList.insert("fo:line-height", m_ps->m_paragraphLineSpacing, PERCENT);
- if (m_ps->m_isParagraphColumnBreak)
- propList.insert("fo:break-before", "column");
- else if (m_ps->m_isParagraphPageBreak)
+ if (m_ps->m_isParagraphPageBreak && !m_ps->m_inSubDocument) // no hard page-breaks in subdocuments
propList.insert("fo:break-before", "page");
+ else if (m_ps->m_isParagraphColumnBreak)
+ propList.insert("fo:break-before", "column");
}
void WPXContentListener::_getTabStops(WPXPropertyListVector &tabStops)
@@ -728,7 +728,7 @@
}
// cater for the possibility to have the column/page break just before the table
- if (m_ps->m_isParagraphPageBreak)
+ if (m_ps->m_isParagraphPageBreak && !m_ps->m_inSubDocument) // No hard page-breaks in sub-documents
propList.insert("fo:break-before", "page");
else if (m_ps->m_isParagraphColumnBreak)
propList.insert("fo:break-before", "column");
@@ -821,7 +821,9 @@
{
if (m_ps->m_isTableRowOpened)
{
- while ((long)m_ps->m_currentTableCol < (long)m_ps->m_numRowsToSkip.size())
+ if (m_ps->m_currentTableCol < 0)
+ throw ParseException();
+ while ((unsigned long)m_ps->m_currentTableCol < (unsigned long)m_ps->m_numRowsToSkip.size())
{
if (!m_ps->m_numRowsToSkip[m_ps->m_currentTableCol]) // This case should not happen, but does :-(
{
@@ -883,7 +885,11 @@
if (m_ps->m_isTableCellOpened)
_closeTableCell();
- while ((long)m_ps->m_currentTableCol < (long)m_ps->m_numRowsToSkip.size() && m_ps->m_numRowsToSkip[m_ps->m_currentTableCol])
+ if (m_ps->m_currentTableCol < 0)
+ throw ParseException();
+
+ while ((unsigned long)m_ps->m_currentTableCol < (unsigned long)m_ps->m_numRowsToSkip.size() &&
+ m_ps->m_numRowsToSkip[m_ps->m_currentTableCol])
{
m_ps->m_numRowsToSkip[m_ps->m_currentTableCol]--;
m_ps->m_currentTableCol++;
@@ -923,7 +929,10 @@
m_ps->m_isTableCellOpened = true;
m_ps->m_isCellWithoutParagraph = true;
- while (((long)m_ps->m_currentTableCol < (long)m_ps->m_numRowsToSkip.size()) && (tmpColSpan > 0))
+ if (m_ps->m_currentTableCol < 0)
+ throw ParseException();
+
+ while ((unsigned long)m_ps->m_currentTableCol < (unsigned long)m_ps->m_numRowsToSkip.size() &&(tmpColSpan > 0))
{
if (m_ps->m_numRowsToSkip[m_ps->m_currentTableCol]) // This case should not happen, but it happens in real-life documents :-(
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WPXMemoryStream.cpp new/libwpd-0.8.14/src/lib/WPXMemoryStream.cpp
--- old/libwpd-0.8.12/src/lib/WPXMemoryStream.cpp 2007-09-03 21:14:18.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WPXMemoryStream.cpp 2007-10-15 10:18:17.000000000 +0200
@@ -31,28 +31,21 @@
WPXInputStream(false),
m_offset(0),
m_size(size),
- m_data(data),
- m_tmpBuf(0)
+ m_data(data)
{
}
WPXMemoryInputStream::~WPXMemoryInputStream()
{
- if (m_tmpBuf)
- delete [] m_tmpBuf;
- if (m_data)
- delete [] m_data;
}
const uint8_t * WPXMemoryInputStream::read(size_t numBytes, size_t &numBytesRead)
{
numBytesRead = 0;
- if (0 == numBytes)
- return 0;
- if (m_tmpBuf)
- delete [] m_tmpBuf;
- m_tmpBuf = 0;
+ if (numBytes == 0)
+ return 0;
+
int numBytesToRead;
if ((m_offset+numBytes) < m_size)
@@ -65,14 +58,10 @@
if (numBytesToRead == 0)
return 0;
- m_tmpBuf = new uint8_t[numBytesToRead];
- for (size_t i=0; (long)i<(long)numBytesToRead; i++)
- {
- m_tmpBuf[i] = m_data[m_offset];
- m_offset++;
- }
-
- return m_tmpBuf;
+ long oldOffset = m_offset;
+ m_offset += numBytesToRead;
+
+ return &m_data[oldOffset];
}
int WPXMemoryInputStream::seek(long offset, WPX_SEEK_TYPE seekType)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WPXMemoryStream.h new/libwpd-0.8.14/src/lib/WPXMemoryStream.h
--- old/libwpd-0.8.12/src/lib/WPXMemoryStream.h 2006-11-14 15:52:46.000000000 +0100
+++ new/libwpd-0.8.14/src/lib/WPXMemoryStream.h 2007-10-15 10:18:17.000000000 +0200
@@ -44,7 +44,6 @@
long m_offset;
size_t m_size;
uint8_t *m_data;
- uint8_t *m_tmpBuf;
WPXMemoryInputStream(const WPXMemoryInputStream&);
WPXMemoryInputStream& operator=(const WPXMemoryInputStream&);
};
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WPXStreamImplementation.cpp new/libwpd-0.8.14/src/lib/WPXStreamImplementation.cpp
--- old/libwpd-0.8.12/src/lib/WPXStreamImplementation.cpp 2007-09-03 21:15:34.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WPXStreamImplementation.cpp 2007-12-05 18:23:37.000000000 +0100
@@ -1,5 +1,7 @@
/* libwpd
* Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
+ * Copyright (C) 2007 Fridrich Strba (fridrich.strba@bluewin.ch)
+ * Copyright (C) 2007 Novell, Inc. (http://www.novell.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -39,6 +41,9 @@
std::stringstream buffer;
unsigned long streamSize;
uint8_t *buf;
+ uint8_t *readBuffer;
+ unsigned long readBufferLength;
+ unsigned long readBufferPos;
private:
WPXFileStreamPrivate(const WPXFileStreamPrivate&);
WPXFileStreamPrivate& operator=(const WPXFileStreamPrivate&);
@@ -61,7 +66,10 @@
file(),
buffer(std::ios::binary | std::ios::in | std::ios::out),
streamSize(0),
- buf(0)
+ buf(0),
+ readBuffer(0),
+ readBufferLength(0),
+ readBufferPos(0)
{
}
@@ -69,6 +77,8 @@
{
if (buf)
delete [] buf;
+ if (readBuffer)
+ delete [] readBuffer;
}
WPXStringStreamPrivate::WPXStringStreamPrivate(const std::string str) :
@@ -104,65 +114,105 @@
delete d;
}
+#define BUFFER_MAX 65536
+
const uint8_t *WPXFileStream::read(size_t numBytes, size_t &numBytesRead)
{
numBytesRead = 0;
- if (0 == numBytes)
- return 0;
-
- if (numBytes < 0 || atEOS() || numBytes > (std::numeric_limits<unsigned long>::max)()/2)
+ if (numBytes == 0 || /* atEOS() || */ numBytes > (std::numeric_limits<unsigned long>::max)()/2
+ || !d->file.good())
return 0;
- unsigned long curpos = d->file.tellg();
+ // can we read from the buffer?
+ if (d->readBuffer && (d->readBufferPos + numBytes > d->readBufferPos)
+ && (d->readBufferPos + numBytes <= d->readBufferLength))
+ {
+ const uint8_t *pTmp = d->readBuffer + d->readBufferPos;
+ d->readBufferPos += numBytes;
+ numBytesRead = numBytes;
+ return pTmp;
+ }
+
+ // hmm, we cannot: go back by the bytes we read ahead && invalidate the buffer
+ if (d->readBuffer)
+ {
+ d->file.seekg((unsigned long)d->file.tellg() - d->readBufferLength, std::ios::beg);
+ d->file.seekg(d->readBufferPos, std::ios::cur);
+ delete [] d->readBuffer;
+ d->readBuffer = 0; d->readBufferPos = 0; d->readBufferLength = 0;
+ }
+
+ unsigned long curpos = tell();
if (curpos == (unsigned long)-1) // tellg() returned ERROR
return 0;
if ( (curpos + numBytes < curpos) /*overflow*/ ||
- (curpos + numBytes > d->streamSize) ) /*reading more than available*/
+ (curpos + numBytes >= d->streamSize) ) /*reading more than available*/
{
numBytes = d->streamSize - curpos;
}
- if (d->buf)
- delete [] d->buf;
- d->buf = new uint8_t[numBytes];
-
- if(d->file.good())
+ if (numBytes < BUFFER_MAX)
{
- d->file.read((char *)(d->buf), numBytes);
- numBytesRead = (long)d->file.tellg() - curpos;
+ if (BUFFER_MAX < d->streamSize - curpos)
+ d->readBufferLength = BUFFER_MAX;
+ else /* BUFFER_MAX >= d->streamSize - curpos */
+ d->readBufferLength = d->streamSize - curpos;
}
+ else
+ d->readBufferLength = numBytes;
- return d->buf;
+ d->file.seekg(d->readBufferLength, std::ios::cur);
+ d->file.seekg(curpos, std::ios::beg);
+
+ d->readBuffer = new uint8_t[d->readBufferLength];
+ d->file.read((char *)(d->readBuffer), d->readBufferLength);
+
+ if (!d->file.good())
+ d->file.clear();
+ d->readBufferPos = 0;
+ if (d->readBufferLength == 0)
+ return 0;
+
+ numBytesRead = numBytes;
+
+ d->readBufferPos += numBytesRead;
+ return const_cast( d->readBuffer );
}
long WPXFileStream::tell()
{
- return d->file.good() ? (long)d->file.tellg() : -1L;
+ return d->file.good() ? (long)((long)d->file.tellg() - d->readBufferLength + d->readBufferPos) : -1L;
}
int WPXFileStream::seek(long offset, WPX_SEEK_TYPE seekType)
{
- if (seekType == WPX_SEEK_SET)
+ if (seekType == WPX_SEEK_CUR)
+ offset += tell();
+
+ if (offset < 0)
+ offset = 0;
+ if (offset > (long)d->streamSize)
+ offset = (long)d->streamSize;
+
+ if (d->file.good() && offset < d->file.tellg() && (unsigned long)offset >= (unsigned long)d->file.tellg() - d->readBufferLength)
{
- if (offset < 0)
- offset = 0;
- if (offset > (long)d->streamSize)
- offset = (long)d->streamSize;
+ d->readBufferPos = offset + d->readBufferLength - d->file.tellg();
+ return 0;
}
-
- if (seekType == WPX_SEEK_CUR)
+
+ if (d->readBuffer) // seeking outside of the buffer, so invalidate the buffer
{
- if (tell() + offset < 0)
- offset = -tell();
- if (tell() + offset > (long)d->streamSize)
- offset = d->streamSize - tell();
+ d->file.seekg((unsigned long)d->file.tellg() - d->readBufferLength, std::ios::beg);
+ d->file.seekg(d->readBufferPos, std::ios::cur);
+ delete [] d->readBuffer;
+ d->readBuffer = 0; d->readBufferPos = 0; d->readBufferLength = 0;
}
-
+
if(d->file.good())
{
- d->file.seekg(offset, ((seekType == WPX_SEEK_SET) ? std::ios::beg : std::ios::cur));
+ d->file.seekg(offset, std::ios::beg);
return (int) ((long)d->file.tellg() == -1) ;
}
else
@@ -171,29 +221,42 @@
bool WPXFileStream::atEOS()
{
- return (d->file.tellg() >= (long)d->streamSize);
+ return (tell() >= (long)d->streamSize);
}
bool WPXFileStream::isOLEStream()
{
+ if (d->readBuffer)
+ {
+ d->file.seekg((unsigned long)d->file.tellg() - d->readBufferLength, std::ios::beg);
+ d->file.seekg(d->readBufferPos, std::ios::cur);
+ delete [] d->readBuffer;
+ d->readBuffer = 0; d->readBufferPos = 0; d->readBufferLength = 0;
+ }
+
if (d->buffer.str().empty())
d->buffer << d->file.rdbuf();
Storage tmpStorage( d->buffer );
+ seek(0, WPX_SEEK_SET);
if (tmpStorage.isOLEStream())
- {
- seek(0, WPX_SEEK_SET);
return true;
- }
- seek(0, WPX_SEEK_SET);
return false;
}
-WPXInputStream* WPXFileStream::getDocumentOLEStream(const char * name)
+WPXInputStream* WPXFileStream::getDocumentOLEStream()
{
+ if (d->readBuffer)
+ {
+ d->file.seekg((unsigned long)d->file.tellg() - d->readBufferLength, std::ios::beg);
+ d->file.seekg(d->readBufferPos, std::ios::cur);
+ delete [] d->readBuffer;
+ d->readBuffer = 0; d->readBufferPos = 0; d->readBufferLength = 0;
+ }
+
if (d->buffer.str().empty())
d->buffer << d->file.rdbuf();
Storage *tmpStorage = new Storage( d->buffer );
- Stream tmpStream( tmpStorage, name );
+ Stream tmpStream( tmpStorage, "PerfectOffice_MAIN" );
if (!tmpStorage || (tmpStorage->result() != Storage::Ok) || !tmpStream.size())
{
if (tmpStorage)
@@ -222,11 +285,6 @@
return new WPXStringStream((const char *)(d->buf), tmpLength);
}
-WPXInputStream* WPXFileStream::getDocumentOLEStream()
-{
- return getDocumentOLEStream("PerfectOffice_MAIN");
-}
-
WPXStringStream::WPXStringStream(const char *data, const unsigned int dataSize) :
WPXInputStream(true),
d(new WPXStringStreamPrivate(std::string(data, dataSize)))
@@ -250,7 +308,7 @@
{
numBytesRead = 0;
- if (0 == numBytes)
+ if (numBytes == 0)
return 0;
if (numBytes < 0 || atEOS() || numBytes > (std::numeric_limits<unsigned long>::max)()/2)
@@ -328,10 +386,10 @@
return false;
}
-WPXInputStream* WPXStringStream::getDocumentOLEStream(const char * name)
+WPXInputStream* WPXStringStream::getDocumentOLEStream()
{
Storage *tmpStorage = new Storage( d->buffer );
- Stream tmpStream( tmpStorage, name );
+ Stream tmpStream( tmpStorage, "PerfectOffice_MAIN" );
if (!tmpStorage || (tmpStorage->result() != Storage::Ok) || !tmpStream.size())
{
if (tmpStorage)
@@ -358,8 +416,3 @@
delete tmpStorage;
return new WPXStringStream((const char *)(d->buf), tmpLength);
}
-
-WPXInputStream* WPXStringStream::getDocumentOLEStream()
-{
- return getDocumentOLEStream("PerfectOffice_MAIN");
-}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WPXSubDocument.cpp new/libwpd-0.8.14/src/lib/WPXSubDocument.cpp
--- old/libwpd-0.8.12/src/lib/WPXSubDocument.cpp 2007-02-27 11:56:51.000000000 +0100
+++ new/libwpd-0.8.14/src/lib/WPXSubDocument.cpp 2007-10-15 10:18:17.000000000 +0200
@@ -26,33 +26,40 @@
#include "WP3Parser.h"
#include "libwpd_internal.h"
#include "WPXListener.h"
+#include
WPXSubDocument::WPXSubDocument() :
- m_stream(0)
+ m_stream(0),
+ m_streamData(0)
{
}
WPXSubDocument::WPXSubDocument(WPXInputStream *input, const unsigned dataSize) :
- m_stream(0)
+ m_stream(0),
+ m_streamData(new uint8_t[dataSize])
{
- uint8_t *streamData = new uint8_t[dataSize];
- for (unsigned i=0; iatEOS())
- throw FileException();
- streamData[i] = readU8(input);
+ break;
+ m_streamData[i] = readU8(input);
}
- m_stream = new WPXMemoryInputStream(streamData, dataSize);
+ m_stream = new WPXMemoryInputStream(m_streamData, i);
}
WPXSubDocument::WPXSubDocument(uint8_t * streamData, const unsigned dataSize) :
- m_stream(0)
+ m_stream(0),
+ m_streamData(0)
{
- m_stream = new WPXMemoryInputStream(streamData, dataSize);
+ if (streamData)
+ m_stream = new WPXMemoryInputStream(streamData, dataSize);
}
WPXSubDocument::~WPXSubDocument()
{
if (m_stream)
delete m_stream;
+ if (m_streamData)
+ delete [] m_streamData;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WPXSubDocument.h new/libwpd-0.8.14/src/lib/WPXSubDocument.h
--- old/libwpd-0.8.12/src/lib/WPXSubDocument.h 2007-01-15 11:34:37.000000000 +0100
+++ new/libwpd-0.8.14/src/lib/WPXSubDocument.h 2007-10-15 10:18:18.000000000 +0200
@@ -40,6 +40,7 @@
private:
WPXMemoryInputStream *m_stream;
+ uint8_t *m_streamData;
WPXSubDocument(const WPXSubDocument&);
WPXSubDocument& operator=(const WPXSubDocument&);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WPXTable.cpp new/libwpd-0.8.14/src/lib/WPXTable.cpp
--- old/libwpd-0.8.12/src/lib/WPXTable.cpp 2007-05-09 14:37:28.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WPXTable.cpp 2007-12-08 12:51:25.000000000 +0100
@@ -27,9 +27,6 @@
#include "WPXTable.h"
#include "libwpd_internal.h"
-typedef std::vector::iterator VTCIter;
-typedef std::vector< std::vector * >::iterator VVTCIter;
-
_WPXTableCell::_WPXTableCell(uint8_t colSpan, uint8_t rowSpan, uint8_t borderBits) :
m_colSpan(colSpan),
m_rowSpan(rowSpan),
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libwpd-0.8.12/src/lib/WPXTable.h new/libwpd-0.8.14/src/lib/WPXTable.h
--- old/libwpd-0.8.12/src/lib/WPXTable.h 2007-07-11 14:00:56.000000000 +0200
+++ new/libwpd-0.8.14/src/lib/WPXTable.h 2007-12-08 12:51:25.000000000 +0100
@@ -50,7 +50,7 @@
class WPXTable
{
public:
- WPXTable() : m_tableRows(std::vector< std::vector >()) {}
+ WPXTable() : m_tableRows() {}
~WPXTable();
void insertRow();
void insertCell(uint8_t colSpan, uint8_t rowSpan, uint8_t borderBits);
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org