diff -Nru libwpd-0.10.1/aclocal.m4 libwpd-0.10.2/aclocal.m4 --- libwpd-0.10.1/aclocal.m4 2015-12-30 08:16:47.000000000 +0000 +++ libwpd-0.10.2/aclocal.m4 2017-09-12 15:07:51.000000000 +0000 @@ -20,32 +20,101 @@ If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 1 (pkg-config-0.24) -# -# Copyright © 2004 Scott James Remnant . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_require_defined.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_REQUIRE_DEFINED(MACRO) +# +# DESCRIPTION +# +# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have +# been defined and thus are available for use. This avoids random issues +# where a macro isn't expanded. Instead the configure script emits a +# non-fatal: +# +# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found +# +# It's like AC_REQUIRE except it doesn't expand the required macro. +# +# Here's an example: +# +# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) +# +# LICENSE +# +# Copyright (c) 2014 Mike Frysinger +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 2 -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- +AC_DEFUN([AX_REQUIRE_DEFINED], [dnl + m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) +])dnl AX_REQUIRE_DEFINED + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 11 (pkg-config-0.29.1) + +dnl Copyright © 2004 Scott James Remnant . +dnl Copyright © 2012-2015 Dan Nicholson +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29.1]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) @@ -67,18 +136,19 @@ PKG_CONFIG="" fi fi[]dnl -])# PKG_PROG_PKG_CONFIG +])dnl PKG_PROG_PKG_CONFIG -# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -# Check to see whether a particular set of modules exists. Similar -# to PKG_CHECK_MODULES(), but does not set variables or print errors. -# -# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -# only at the first occurence in configure.ac, so if the first place -# it's called might be skipped (such as if it is within an "if", you -# have to call PKG_CHECK_EXISTS manually -# -------------------------------------------------------------- +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ @@ -88,8 +158,10 @@ $3])dnl fi]) -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" @@ -101,10 +173,11 @@ else pkg_failed=untried fi[]dnl -])# _PKG_CONFIG +])dnl _PKG_CONFIG -# _PKG_SHORT_ERRORS_SUPPORTED -# ----------------------------- +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -112,19 +185,17 @@ else _pkg_short_errors_supported=no fi[]dnl -])# _PKG_SHORT_ERRORS_SUPPORTED +])dnl _PKG_SHORT_ERRORS_SUPPORTED -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac -# -# -# -------------------------------------------------------------- +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl @@ -178,16 +249,40 @@ AC_MSG_RESULT([yes]) $3 fi[]dnl -])# PKG_CHECK_MODULES +])dnl PKG_CHECK_MODULES -# PKG_INSTALLDIR(DIRECTORY) -# ------------------------- -# Substitutes the variable pkgconfigdir as the location where a module -# should install pkg-config .pc files. By default the directory is -# $libdir/pkgconfig, but the default can be changed by passing -# DIRECTORY. The user can override through the --with-pkgconfigdir -# parameter. +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], @@ -198,16 +293,18 @@ AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) -]) dnl PKG_INSTALLDIR +])dnl PKG_INSTALLDIR -# PKG_NOARCH_INSTALLDIR(DIRECTORY) -# ------------------------- -# Substitutes the variable noarch_pkgconfigdir as the location where a -# module should install arch-independent pkg-config .pc files. By -# default the directory is $datadir/pkgconfig, but the default can be -# changed by passing DIRECTORY. The user can override through the -# --with-noarch-pkgconfigdir parameter. +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], @@ -218,13 +315,15 @@ AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) -]) dnl PKG_NOARCH_INSTALLDIR +])dnl PKG_NOARCH_INSTALLDIR -# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, -# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# ------------------------------------------- -# Retrieves the value of the pkg-config variable for the given module. +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl @@ -233,7 +332,75 @@ AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl -])# PKG_CHECK_VAR +])dnl PKG_CHECK_VAR + +dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------ +dnl +dnl Prepare a "--with-" configure option using the lowercase +dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and +dnl PKG_CHECK_MODULES in a single macro. +AC_DEFUN([PKG_WITH_MODULES], +[ +m4_pushdef([with_arg], m4_tolower([$1])) + +m4_pushdef([description], + [m4_default([$5], [build with ]with_arg[ support])]) + +m4_pushdef([def_arg], [m4_default([$6], [auto])]) +m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) +m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) + +m4_case(def_arg, + [yes],[m4_pushdef([with_without], [--without-]with_arg)], + [m4_pushdef([with_without],[--with-]with_arg)]) + +AC_ARG_WITH(with_arg, + AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, + [AS_TR_SH([with_]with_arg)=def_arg]) + +AS_CASE([$AS_TR_SH([with_]with_arg)], + [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], + [auto],[PKG_CHECK_MODULES([$1],[$2], + [m4_n([def_action_if_found]) $3], + [m4_n([def_action_if_not_found]) $4])]) + +m4_popdef([with_arg]) +m4_popdef([description]) +m4_popdef([def_arg]) + +])dnl PKG_WITH_MODULES + +dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ----------------------------------------------- +dnl +dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES +dnl check._[VARIABLE-PREFIX] is exported as make variable. +AC_DEFUN([PKG_HAVE_WITH_MODULES], +[ +PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) + +AM_CONDITIONAL([HAVE_][$1], + [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) +])dnl PKG_HAVE_WITH_MODULES + +dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------------------ +dnl +dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after +dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make +dnl and preprocessor variable. +AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], +[ +PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) + +AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], + [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) +])dnl PKG_HAVE_DEFINE_WITH_MODULES # Copyright (C) 2002-2014 Free Software Foundation, Inc. # @@ -1425,6 +1592,9 @@ AC_SUBST([am__untar]) ]) # _AM_PROG_TAR +m4_include([m4/ax_cxx_compile_stdcxx.m4]) +m4_include([m4/ax_cxx_compile_stdcxx_11.m4]) +m4_include([m4/ax_gcc_func_attribute.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) diff -Nru libwpd-0.10.1/build/Makefile.in libwpd-0.10.2/build/Makefile.in --- libwpd-0.10.1/build/Makefile.in 2015-12-30 08:16:49.000000000 +0000 +++ libwpd-0.10.2/build/Makefile.in 2017-09-12 15:07:53.000000000 +0000 @@ -89,10 +89,12 @@ host_triplet = @host@ subdir = build ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -191,6 +193,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BOOST_CFLAGS = @BOOST_CFLAGS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -215,6 +218,7 @@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff -Nru libwpd-0.10.1/build/win32/Makefile.in libwpd-0.10.2/build/win32/Makefile.in --- libwpd-0.10.1/build/win32/Makefile.in 2015-12-30 08:16:50.000000000 +0000 +++ libwpd-0.10.2/build/win32/Makefile.in 2017-09-12 15:07:53.000000000 +0000 @@ -89,10 +89,12 @@ host_triplet = @host@ subdir = build/win32 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -131,6 +133,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BOOST_CFLAGS = @BOOST_CFLAGS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -155,6 +158,7 @@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff -Nru libwpd-0.10.1/ChangeLog libwpd-0.10.2/ChangeLog --- libwpd-0.10.1/ChangeLog 2015-12-30 09:48:45.000000000 +0000 +++ libwpd-0.10.2/ChangeLog 2017-09-12 17:48:56.000000000 +0000 @@ -1,3 +1,330 @@ +2017-09-12 David Tardon [2d0cb46f55515d278cf1b0b384d0cebcdca0d03c] + + cid#1371599 remove useless check + + +2017-09-12 David Tardon [f1eef1b4b4c8eef4209fb9773fbf1ca20d8876c0] + + prepare for a release + + +2017-09-12 David Tardon [24ee5c2013be37010810d30fce21c7c58172ecee] + + ofz#2604 avoid unsigned overflow + + +2017-09-10 Miklos Vajna [963ab78b9a757c6ec3f6192216cc40cc9b550518] + + m4: MSVC defines __cplusplus as 199711L still + + See e.g. + , + on MSVC we can't depend on the value of __cplusplus, since that one is a + too low value, even if everything else works fine. + +2017-09-08 David Tardon [f8e9c8f116d958b695fa0dc35359a0ac9c52581e] + + add const + + +2017-09-08 David Tardon [78ee402a04c86b51575032d722e232251273028f] + + rename var + + +2017-09-08 Caolán McNamara [d09bcb7e34b35e8859770fefc2ffc8891e672c1a] + + fix debug build + + +2017-09-07 David Tardon [f40827b3eae260ce657c67d9fecc855b09dea3c3] + + avoid possibly invalidated iterators + + +2017-09-07 Caolán McNamara [0329a9c57f9b3b0efa0f09a5235dfd90236803a5] + + Resolves: tdf#112269 invalidated iterators + + +2017-08-04 Miklos Vajna [c7973bf662432b806f215c46f05fb7cb64037318] + + Convert explicit for loops to range-based ones where possible + + This allows removing some (now) unused typedefs. + +2017-08-03 Miklos Vajna [79da15b407ad369e1b09f60c78d540f5c0ae7d78] + + Mark overriding member functions as 'override' + + This does not affect the generated code (API or ABI), but: + + 1) Makes sure that in case the signature of one of these functions would + change by accident, the build breaks as the function no longer overrides + a base function. + + 2) Makes the code readable by explicitly marking all overriding + functions as 'override', where previously the reader had to read the + interface of the base class(es) as well to find out if the function is + virtual or not. + + 3) Since 'override' implies 'virtual', remove the 'virtual' keyword + where 'override' is present. + +2017-08-02 Miklos Vajna [9cbaf8ced3e1ff3ab7cc18971d2cdac64c5de0ea] + + Convert 0 to nullptr where it's used as a pointer value + + To make the code easier to read, because this means the remaining zeros + all mean numbers. + +2017-05-16 David Tardon [3879235d9bb544da927a46fa43877c6faf7c1eb5] + + drop :: prefix + + +2017-04-24 David Tardon [38d671c164dc81957f81e55b3fbb3eba52ca0558] + + ofz#1258 this must not be deleted + + +2017-04-23 David Tardon [ba7961a282d45fb0eccb521bffab7cc836fff693] + + avoid manual memory management + + +2017-04-23 David Tardon [791cd3047d752e7635135e8416535a5b5ca9662d] + + avoid manual memory management + + +2017-04-23 David Tardon [4dc1b93026d9afbbc5c51562237878652e064463] + + streamline the code a bit by using unique_ptr + + +2017-04-23 David Tardon [8e4d70045906e8d8f05a72eaf8deba3481c7d393] + + use vector for dynamically allocated buffer + + +2017-04-23 David Tardon [6c06d8cb8f39f1d3b480112fb96a49e64631035c] + + avoid manual memory management + + +2017-04-23 David Tardon [d491fe5ad44f9fd56bd2c988aac34e09906ac554] + + avoid manual memory management + + +2017-04-23 David Tardon [a45a855ccfda0ceafe55debce90a15f7b3c85427] + + avoid manual memory management + + +2017-04-23 David Tardon [f34948beaab0fef019196cbcf55f319494712091] + + avoid manual memory management + + +2017-04-23 David Tardon [1a7167bffda652f59f831ae06e1bf5bd3f65cc8f] + + avoid manual memory management + + +2017-04-23 David Tardon [8d700d60114e11f7830a3377b5387f6654dc668b] + + avoid manual memory management + + +2017-04-23 David Tardon [0b16543ba771f2dbc894844487879cb9457cf91f] + + avoid manual memory management + + +2017-04-23 David Tardon [b9246394de548813d2542e82d2025d09153201a1] + + avoid manual memory management + + +2017-04-23 David Tardon [44bf877d0cf15f38bc1b7f328b330e994cee00a9] + + don't throw if parsing of ref. number failed + + It seems it is possible for the ref. number string to be empty--there + are several files in the test suite that demonstrate that--so we have to + handle parsing failure more gracefully. + + Note: it would make more sense to return 1 instead of 0, though... + +2017-04-23 David Tardon [14692a9961505926012455ef11d0cd33cab28c46] + + drop now unused DELETEP + + +2017-04-23 David Tardon [a8ad9fbaf69953d4739a3fe85fa7a3a379c129dd] + + replace dynamically allocated array by vector + + +2017-04-23 David Tardon [a46e41ade1a6d9520146892861a6a4843736e471] + + avoid manual memory management + + +2017-04-23 David Tardon [916cfefe558dfd150b81710242722648d287c584] + + avoid manual memory management + + +2017-04-23 David Tardon [b18d63914cc7d5c048b3f694ac1cd53f130ba83d] + + operator new already handles cleanup on exception + + +2017-04-23 David Tardon [15510fa9365185dd7cd120ab9bca6d4865f02557] + + operator new already handles cleanup on exception + + +2017-04-23 David Tardon [fce12063d80ca29a445751a341f253ecdb30a1e3] + + avoid manual memory management + + +2017-04-23 David Tardon [4e554ef6c3ba2c050f548e9d0f3292e03c0079bc] + + avoid manual memory management + + +2017-04-23 David Tardon [d9bd200629d8b0cf743346c0af63437b0ad1704d] + + avoid manual memory management + + +2017-04-23 David Tardon [2a8a25befb95b93d206b509b22b3a19f5d14e6df] + + streamline the code a bit by using smart ptrs + + +2017-04-23 David Tardon [f69f2618d2c239c5ff5465dd443d1e344856379a] + + drop unnecessary casts + + +2017-04-23 David Tardon [0977689fa886a18b466dd9563b0c0692aff4e195] + + avoid unnecessary reallocations + + +2017-04-23 David Tardon [461391af0891191e33be0d4ef9374f8bf775f96c] + + drop useless variable prefix + + +2017-04-22 David Tardon [3a1ad527e62c87be76334daef596131cc076181a] + + nitpick + + +2017-04-22 David Tardon [7972bac25bf99483cf59372a3c93567018c98233] + + list boost in deps + + +2017-04-22 David Tardon [0ec7efdb2604fa1aaeaaf728e725c55ca0239ee8] + + ofz#1215 replace home-grown int parser + + +2017-04-15 David Tardon [30ada14a8cd41136ec173ea9da223843a0efc0d6] + + move check for __attribute__((format)) to configure + + +2017-04-15 David Tardon [ba48b97d0dd650cdede49ae26547581bc7e86627] + + the argument is not needed + + +2017-04-12 David Tardon [792bc9a9970ce504fae52fb21f9c2945f56d55f5] + + add additional check for lower-/uppercase label too + + +2017-04-12 David Tardon [04cd7506aeff815a517b9666c012956554ad5511] + + ofz#1082 make parsing of arabic labels more robust + + +2017-04-11 David Tardon [2e344fdb3e769429161f4a5621df48009882e050] + + ofz#1005 avoid memory leak + + +2017-04-07 David Tardon [b7f70b18a7af9c76e23b0d26842ae6bf20f8f1bf] + + avoid possible leak on exception + + +2017-04-07 David Tardon [c6faa3c9a6bbeec391fc2eb6480fbb4c3d7df151] + + ofz#1028 fix leak + + +2017-04-07 David Tardon [dc7a29b7fb4415682c7da971ec0aae3286d307a6] + + update C++11 check macros + + +2017-04-07 David Tardon [cf80301ea639e262c4b20a5b0734bff0d1e26cef] + + ignore only generated .m4 files + + +2017-04-05 David Tardon [b2b5f834819d62683e593bc822296a3eb13d5258] + + add forgotten m4 file + + +2017-04-05 David Tardon [f5d3402f6dca827bb47ee9a35d092b1a413c3ed3] + + ofz#991 fix leak if called repeatedly with isOn==true + + +2017-04-05 David Tardon [ce718f0960c3b65ba59c53e58f5b59f66f82e909] + + ofz#997 fix leak + + +2017-04-05 David Tardon [f80d5c3df92ee2ee9470d1247f8d11119fcb0774] + + ofz#1005 fix leak + + +2017-04-05 David Tardon [ba64e63ffb543ca1cc1ae55f734d24379f7c81e0] + + drop useless delete calls + + If an exception is thrown during the construction of WP6PrefixData, + prefix data remains null. + +2017-04-05 David Tardon [d28002fd98d9788d2b12e024df0abd663ce6a7dd] + + switch to C++11 + + +2017-03-30 David Tardon [0c2040ca0ba5b38bda7dafee08996c54bcc452bc] + + astyle + + +2017-03-30 David Tardon [9e449ae127c65190cd6a1e79a9a8de1b72f3f785] + + create fuzzing driver for oss-fuzz + + 2015-12-30 David Tardon [4e94a34d5e90f4e269bcbac69d8b2c031dc61304] error: use of undeclared identifier 'size_t' diff -Nru libwpd-0.10.1/config.h.in libwpd-0.10.2/config.h.in --- libwpd-0.10.1/config.h.in 2015-12-30 08:16:48.000000000 +0000 +++ libwpd-0.10.2/config.h.in 2017-09-12 15:08:50.000000000 +0000 @@ -1,8 +1,20 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_BOOST_SPIRIT_INCLUDE_QI_HPP + +/* define if the compiler supports basic C++11 syntax */ +#undef HAVE_CXX11 + /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H +/* Define to 1 if you have the header file. */ +#undef HAVE_DNL + +/* Define to 1 if the system has the `format' function attribute */ +#undef HAVE_FUNC_ATTRIBUTE_FORMAT + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H diff -Nru libwpd-0.10.1/configure libwpd-0.10.2/configure --- libwpd-0.10.1/configure 2015-12-30 08:16:51.000000000 +0000 +++ libwpd-0.10.2/configure 2017-09-12 15:07:56.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libwpd 0.10.1. +# Generated by GNU Autoconf 2.69 for libwpd 0.10.2. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ # Identity of this package. PACKAGE_NAME='libwpd' PACKAGE_TARNAME='libwpd' -PACKAGE_VERSION='0.10.1' -PACKAGE_STRING='libwpd 0.10.1' +PACKAGE_VERSION='0.10.2' +PACKAGE_STRING='libwpd 0.10.2' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -632,12 +632,15 @@ am__EXEEXT_TRUE LTLIBOBJS LIBOBJS -BUILD_TOOLS_FALSE -BUILD_TOOLS_TRUE REVENGE_STREAM_LIBS REVENGE_STREAM_CFLAGS REVENGE_GENERATORS_LIBS REVENGE_GENERATORS_CFLAGS +BUILD_FUZZERS_FALSE +BUILD_FUZZERS_TRUE +BUILD_TOOLS_FALSE +BUILD_TOOLS_TRUE +BOOST_CFLAGS REVENGE_LIBS REVENGE_CFLAGS PKG_CONFIG_LIBDIR @@ -658,6 +661,7 @@ LIBWPD_WIN32_RESOURCE OS_WIN32_FALSE OS_WIN32_TRUE +HAVE_CXX11 LT_AGE LT_REVISION LT_CURRENT @@ -805,6 +809,7 @@ enable_debug with_docs enable_tools +enable_fuzzers ' ac_precious_vars='build_alias host_alias @@ -1369,7 +1374,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libwpd 0.10.1 to adapt to many kinds of systems. +\`configure' configures libwpd 0.10.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1439,7 +1444,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libwpd 0.10.1:";; + short | recursive ) echo "Configuration of libwpd 0.10.2:";; esac cat <<\_ACEOF @@ -1465,6 +1470,7 @@ --enable-wparanoic Enable a lot of warnings... --enable-debug Turn on debugging --disable-tools Build conversion tools + --enable-fuzzers Build fuzzer(s) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1577,7 +1583,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libwpd configure 0.10.1 +libwpd configure 0.10.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1972,11 +1978,42 @@ as_fn_set_status $ac_retval } # ac_fn_cxx_try_link + +# ac_fn_cxx_check_header_compile LINENO HEADER VAR INCLUDES +# --------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_cxx_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_cxx_check_header_compile cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libwpd $as_me 0.10.1, which was +It was created by libwpd $as_me 0.10.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2842,7 +2879,7 @@ # Define the identity of the package. PACKAGE='libwpd' - VERSION='0.10.1' + VERSION='0.10.2' cat >>confdefs.h <<_ACEOF @@ -17026,9 +17063,9 @@ WPD_MINOR_VERSION=10 -WPD_MICRO_VERSION=1 +WPD_MICRO_VERSION=2 -WPD_VERSION=0.10.1 +WPD_VERSION=0.10.2 # AC_SUBST(LT_RELEASE, [libwpd_version_major.libwpd_version_minor]) LT_CURRENT=`expr 100 '*' 0 + 10` @@ -17036,232 +17073,1268 @@ LT_AGE=0 # LT_AGE=libwpd_version_minor -LT_REVISION=1 +LT_REVISION=2 -# ========================== -# Platform check for windows -# ========================== -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for native Win32" >&5 -$as_echo_n "checking for native Win32... " >&6; } -case $host in #( - *-*-mingw*) : + ax_cxx_compile_alternatives="11 0x" ax_cxx_compile_cxx11_required=true + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + ac_success=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5 +$as_echo_n "checking whether $CXX supports C++11 features by default... " >&6; } +if ${ax_cv_cxx_compile_cxx11+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - native_win32=yes - LIBWPD_WIN32_RESOURCE=libwpd-win32res.lo - WPD2HTML_WIN32_RESOURCE=wpd2html-win32res.lo - WPD2TEXT_WIN32_RESOURCE=wpd2text-win32res.lo - WPD2RAW_WIN32_RESOURCE=wpd2raw-win32res.lo - ;; #( - *) : - native_win32=no - LIBWPD_WIN32_RESOURCE= - WPD2HTML_WIN32_RESOURCE= - WPD2TEXT_WIN32_RESOURCE= - WPD2RAW_WIN32_RESOURCE= +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $native_win32" >&5 -$as_echo "$native_win32" >&6; } - if test "x$native_win32" = "xyes"; then - OS_WIN32_TRUE= - OS_WIN32_FALSE='#' -else - OS_WIN32_TRUE='#' - OS_WIN32_FALSE= -fi +#ifndef __cplusplus +#error "This is not a C++ compiler" +#elif __cplusplus < 201103L && !(defined _MSC_VER) +#error "This is not a C++11 compiler" +#else +namespace cxx11 +{ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Win32 platform in general" >&5 -$as_echo_n "checking for Win32 platform in general... " >&6; } -case $host in #( - *-*-mingw*|*-*-cygwin*) : - platform_win32=yes ;; #( - *) : - platform_win32=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $platform_win32" >&5 -$as_echo "$platform_win32" >&6; } - if test "x$platform_win32" = "xyes"; then - PLATFORM_WIN32_TRUE= - PLATFORM_WIN32_FALSE='#' -else - PLATFORM_WIN32_TRUE='#' - PLATFORM_WIN32_FALSE= -fi + namespace test_static_assert + { + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; -if test "x$platform_win32" = "xyes"; then : + } -else + namespace test_final_override + { - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fvisibility=hidden compiler flag" >&5 -$as_echo_n "checking for -fvisibility=hidden compiler flag... " >&6; } - saved_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS -fvisibility=hidden" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + struct Base + { + virtual void f() {} + }; -int -main () -{ + struct Derived : public Base + { + virtual void f() override {} + }; - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : + } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - CXXFLAGS="$CXXFLAGS -DLIBWPD_VISIBILITY" + namespace test_double_right_angle_brackets + { -else + template < typename T > + struct check {}; - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - CXXFLAGS="$saved_CXXFLAGS" + typedef check single_type; + typedef check> double_type; + typedef check>> triple_type; + typedef check>>> quadruple_type; + } -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + namespace test_decltype + { + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } -fi + } -# ========================= -# Platform check for darwin -# ========================= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Darwin (Mac OS X) platform" >&5 -$as_echo_n "checking for Darwin (Mac OS X) platform... " >&6; } -case $host in #( - *-*-darwin*) : - platform_darwin=yes ;; #( - *) : - platform_darwin=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $platform_darwin" >&5 -$as_echo "$platform_darwin" >&6; } - if test "x$platform_darwin" = "xyes"; then - PLATFORM_DARWIN_TRUE= - PLATFORM_DARWIN_FALSE='#' -else - PLATFORM_DARWIN_TRUE='#' - PLATFORM_DARWIN_FALSE= -fi + namespace test_type_deduction + { + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; -# ================ -# Check for cflags -# ================ -# Check whether --enable-werror was given. -if test "${enable_werror+set}" = set; then : - enableval=$enable_werror; enable_werror="$enableval" -else - enable_werror=yes + template < typename T > + struct is_same + { + static const bool value = true; + }; -fi + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } -if test x"$enable_werror" != "xno"; then : + int + test(const int c, volatile int v) + { + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } - CFLAGS="$CFLAGS -Werror" - CXXFLAGS="$CXXFLAGS -Werror" + } -fi -# Check whether --enable-weffc was given. -if test "${enable_weffc+set}" = set; then : - enableval=$enable_weffc; enable_weffc="$enableval" -else - enable_weffc=yes + namespace test_noexcept + { -fi + int f() { return 0; } + int g() noexcept { return 0; } -# Check whether --enable-wparanoic was given. -if test "${enable_wparanoic+set}" = set; then : - enableval=$enable_wparanoic; enable_wparanoic="$enableval" -else - enable_wparanoic=no + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); -fi + } -# Courtesy of Glib: Ensure MSVC-compatible struct packing convention -# is used when compiling for Win32 with gcc. -if test "x$native_win32" = "xyes"; then : + namespace test_constexpr + { - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. -set dummy ${ac_tool_prefix}windres; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_WINDRES+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$WINDRES"; then - ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_WINDRES="${ac_tool_prefix}windres" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } -fi -fi -WINDRES=$ac_cv_prog_WINDRES -if test -n "$WINDRES"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WINDRES" >&5 -$as_echo "$WINDRES" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); -fi -if test -z "$ac_cv_prog_WINDRES"; then - ac_ct_WINDRES=$WINDRES - # Extract the first word of "windres", so it can be a program name with args. -set dummy windres; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_WINDRES+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_WINDRES"; then - ac_cv_prog_ac_ct_WINDRES="$ac_ct_WINDRES" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_WINDRES="windres" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template + struct sum; + + template + struct sum + { + static constexpr auto value = N0 + sum::value; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + + } + + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { + + struct foo {}; + + template + using member = typename T::member_type; + + template + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + + + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ax_cv_cxx_compile_cxx11=yes +else + ax_cv_cxx_compile_cxx11=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx11" >&5 +$as_echo "$ax_cv_cxx_compile_cxx11" >&6; } + if test x$ax_cv_cxx_compile_cxx11 = xyes; then + ac_success=yes + fi + + if test x$ac_success = xno; then + for alternative in ${ax_cxx_compile_alternatives}; do + switch="-std=gnu++${alternative}" + cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5 +$as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; } +if eval \${$cachevar+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_CXX="$CXX" + CXX="$CXX $switch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201103L && !(defined _MSC_VER) + +#error "This is not a C++11 compiler" + +#else + +namespace cxx11 +{ + + namespace test_static_assert + { + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual void f() {} + }; + + struct Derived : public Base + { + virtual void f() override {} + }; + + } + + namespace test_double_right_angle_brackets + { + + template < typename T > + struct check {}; + + typedef check single_type; + typedef check> double_type; + typedef check>> triple_type; + typedef check>>> quadruple_type; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + int + test(const int c, volatile int v) + { + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template + struct sum; + + template + struct sum + { + static constexpr auto value = N0 + sum::value; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + + } + + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { + + struct foo {}; + + template + using member = typename T::member_type; + + template + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + + + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + eval $cachevar=yes +else + eval $cachevar=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CXX="$ac_save_CXX" +fi +eval ac_res=\$$cachevar + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi + done + fi + + if test x$ac_success = xno; then + for alternative in ${ax_cxx_compile_alternatives}; do + for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do + cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5 +$as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; } +if eval \${$cachevar+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_CXX="$CXX" + CXX="$CXX $switch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201103L && !(defined _MSC_VER) + +#error "This is not a C++11 compiler" + +#else + +namespace cxx11 +{ + + namespace test_static_assert + { + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual void f() {} + }; + + struct Derived : public Base + { + virtual void f() override {} + }; + + } + + namespace test_double_right_angle_brackets + { + + template < typename T > + struct check {}; + + typedef check single_type; + typedef check> double_type; + typedef check>> triple_type; + typedef check>>> quadruple_type; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + int + test(const int c, volatile int v) + { + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template + struct sum; + + template + struct sum + { + static constexpr auto value = N0 + sum::value; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + + } + + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { + + struct foo {}; + + template + using member = typename T::member_type; + + template + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + + + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + eval $cachevar=yes +else + eval $cachevar=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CXX="$ac_save_CXX" +fi +eval ac_res=\$$cachevar + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi + done + if test x$ac_success = xyes; then + break + fi + done + fi + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + if test x$ax_cxx_compile_cxx11_required = xtrue; then + if test x$ac_success = xno; then + as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5 + fi + fi + if test x$ac_success = xno; then + HAVE_CXX11=0 + { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5 +$as_echo "$as_me: No compiler with C++11 support was found" >&6;} + else + HAVE_CXX11=1 + +$as_echo "#define HAVE_CXX11 1" >>confdefs.h + + fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((format))" >&5 +$as_echo_n "checking for __attribute__((format))... " >&6; } +if ${ax_cv_have_func_attribute_format+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + int foo(const char *p, ...) __attribute__((format(printf, 1, 2))); + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + if test -s conftest.err; then : + ax_cv_have_func_attribute_format=no +else + ax_cv_have_func_attribute_format=yes +fi +else + ax_cv_have_func_attribute_format=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_have_func_attribute_format" >&5 +$as_echo "$ax_cv_have_func_attribute_format" >&6; } + + if test yes = $ax_cv_have_func_attribute_format; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_FUNC_ATTRIBUTE_FORMAT 1 +_ACEOF + +fi + + + + +# ========================== +# Platform check for windows +# ========================== +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for native Win32" >&5 +$as_echo_n "checking for native Win32... " >&6; } +case $host in #( + *-*-mingw*) : + + native_win32=yes + LIBWPD_WIN32_RESOURCE=libwpd-win32res.lo + WPD2HTML_WIN32_RESOURCE=wpd2html-win32res.lo + WPD2TEXT_WIN32_RESOURCE=wpd2text-win32res.lo + WPD2RAW_WIN32_RESOURCE=wpd2raw-win32res.lo + ;; #( + *) : + + native_win32=no + LIBWPD_WIN32_RESOURCE= + WPD2HTML_WIN32_RESOURCE= + WPD2TEXT_WIN32_RESOURCE= + WPD2RAW_WIN32_RESOURCE= + + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $native_win32" >&5 +$as_echo "$native_win32" >&6; } + if test "x$native_win32" = "xyes"; then + OS_WIN32_TRUE= + OS_WIN32_FALSE='#' +else + OS_WIN32_TRUE='#' + OS_WIN32_FALSE= +fi + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Win32 platform in general" >&5 +$as_echo_n "checking for Win32 platform in general... " >&6; } +case $host in #( + *-*-mingw*|*-*-cygwin*) : + platform_win32=yes ;; #( + *) : + platform_win32=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $platform_win32" >&5 +$as_echo "$platform_win32" >&6; } + if test "x$platform_win32" = "xyes"; then + PLATFORM_WIN32_TRUE= + PLATFORM_WIN32_FALSE='#' +else + PLATFORM_WIN32_TRUE='#' + PLATFORM_WIN32_FALSE= +fi + + +if test "x$platform_win32" = "xyes"; then : + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fvisibility=hidden compiler flag" >&5 +$as_echo_n "checking for -fvisibility=hidden compiler flag... " >&6; } + saved_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -fvisibility=hidden" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CXXFLAGS="$CXXFLAGS -DLIBWPD_VISIBILITY" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CXXFLAGS="$saved_CXXFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi + +# ========================= +# Platform check for darwin +# ========================= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Darwin (Mac OS X) platform" >&5 +$as_echo_n "checking for Darwin (Mac OS X) platform... " >&6; } +case $host in #( + *-*-darwin*) : + platform_darwin=yes ;; #( + *) : + platform_darwin=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $platform_darwin" >&5 +$as_echo "$platform_darwin" >&6; } + if test "x$platform_darwin" = "xyes"; then + PLATFORM_DARWIN_TRUE= + PLATFORM_DARWIN_FALSE='#' +else + PLATFORM_DARWIN_TRUE='#' + PLATFORM_DARWIN_FALSE= +fi + + +# ================ +# Check for cflags +# ================ +# Check whether --enable-werror was given. +if test "${enable_werror+set}" = set; then : + enableval=$enable_werror; enable_werror="$enableval" +else + enable_werror=yes + +fi + +if test x"$enable_werror" != "xno"; then : + + CFLAGS="$CFLAGS -Werror" + CXXFLAGS="$CXXFLAGS -Werror" + +fi +# Check whether --enable-weffc was given. +if test "${enable_weffc+set}" = set; then : + enableval=$enable_weffc; enable_weffc="$enableval" +else + enable_weffc=yes + +fi + +# Check whether --enable-wparanoic was given. +if test "${enable_wparanoic+set}" = set; then : + enableval=$enable_wparanoic; enable_wparanoic="$enableval" +else + enable_wparanoic=no + +fi + +# Courtesy of Glib: Ensure MSVC-compatible struct packing convention +# is used when compiling for Win32 with gcc. +if test "x$native_win32" = "xyes"; then : + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. +set dummy ${ac_tool_prefix}windres; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_WINDRES+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$WINDRES"; then + ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_WINDRES="${ac_tool_prefix}windres" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +WINDRES=$ac_cv_prog_WINDRES +if test -n "$WINDRES"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WINDRES" >&5 +$as_echo "$WINDRES" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_WINDRES"; then + ac_ct_WINDRES=$WINDRES + # Extract the first word of "windres", so it can be a program name with args. +set dummy windres; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_WINDRES+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_WINDRES"; then + ac_cv_prog_ac_ct_WINDRES="$ac_ct_WINDRES" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_WINDRES="windres" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS fi fi @@ -17699,6 +18772,32 @@ +# ================== +# Find boost headers +# ================== +saved_CPPFLAGS="${CPPFLAGS}" +CPPFLAGS="${BOOST_CFLAGS} ${CPPFLAGS}" +for ac_header in boost/spirit/include/qi.hpp \ + +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_cxx_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " + +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + as_fn_error $? "Required boost headers not found." "$LINENO" 5 +fi + +done + +CPPFLAGS="${saved_CPPFLAGS}" + + # ===== # Tools # ===== @@ -17710,7 +18809,36 @@ fi -if test "x$enable_tools" = "xyes"; then : + if test "x$enable_tools" = "xyes"; then + BUILD_TOOLS_TRUE= + BUILD_TOOLS_FALSE='#' +else + BUILD_TOOLS_TRUE='#' + BUILD_TOOLS_FALSE= +fi + + +# ======= +# Fuzzers +# ======= +# Check whether --enable-fuzzers was given. +if test "${enable_fuzzers+set}" = set; then : + enableval=$enable_fuzzers; enable_fuzzers="$enableval" +else + enable_fuzzers=no + +fi + + if test "x$enable_fuzzers" = "xyes"; then + BUILD_FUZZERS_TRUE= + BUILD_FUZZERS_FALSE='#' +else + BUILD_FUZZERS_TRUE='#' + BUILD_FUZZERS_FALSE= +fi + + +if test "x$enable_tools" = "xyes" -o "x$enable_fuzzers" = "xyes"; then : pkg_failed=no @@ -17936,19 +19064,11 @@ - if test "x$enable_tools" = "xyes"; then - BUILD_TOOLS_TRUE= - BUILD_TOOLS_FALSE='#' -else - BUILD_TOOLS_TRUE='#' - BUILD_TOOLS_FALSE= -fi - # ===================== # Prepare all .in files # ===================== -ac_config_files="$ac_config_files Makefile src/Makefile src/conv/Makefile src/conv/html/Makefile src/conv/html/wpd2html.rc src/conv/raw/Makefile src/conv/raw/wpd2raw.rc src/conv/text/Makefile src/conv/text/wpd2text.rc src/lib/Makefile src/lib/libwpd.rc inc/Makefile inc/libwpd/Makefile docs/Makefile docs/doxygen/Makefile build/Makefile build/win32/Makefile libwpd-$WPD_MAJOR_VERSION.$WPD_MINOR_VERSION.pc:libwpd.pc.in" +ac_config_files="$ac_config_files Makefile src/Makefile src/conv/Makefile src/conv/html/Makefile src/conv/html/wpd2html.rc src/conv/raw/Makefile src/conv/raw/wpd2raw.rc src/conv/text/Makefile src/conv/text/wpd2text.rc src/fuzz/Makefile src/lib/Makefile src/lib/libwpd.rc inc/Makefile inc/libwpd/Makefile docs/Makefile docs/doxygen/Makefile build/Makefile build/win32/Makefile libwpd-$WPD_MAJOR_VERSION.$WPD_MINOR_VERSION.pc:libwpd.pc.in" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -18111,6 +19231,10 @@ as_fn_error $? "conditional \"BUILD_TOOLS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${BUILD_FUZZERS_TRUE}" && test -z "${BUILD_FUZZERS_FALSE}"; then + as_fn_error $? "conditional \"BUILD_FUZZERS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 @@ -18508,7 +19632,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libwpd $as_me 0.10.1, which was +This file was extended by libwpd $as_me 0.10.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18574,7 +19698,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libwpd config.status 0.10.1 +libwpd config.status 0.10.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -19098,6 +20222,7 @@ "src/conv/raw/wpd2raw.rc") CONFIG_FILES="$CONFIG_FILES src/conv/raw/wpd2raw.rc" ;; "src/conv/text/Makefile") CONFIG_FILES="$CONFIG_FILES src/conv/text/Makefile" ;; "src/conv/text/wpd2text.rc") CONFIG_FILES="$CONFIG_FILES src/conv/text/wpd2text.rc" ;; + "src/fuzz/Makefile") CONFIG_FILES="$CONFIG_FILES src/fuzz/Makefile" ;; "src/lib/Makefile") CONFIG_FILES="$CONFIG_FILES src/lib/Makefile" ;; "src/lib/libwpd.rc") CONFIG_FILES="$CONFIG_FILES src/lib/libwpd.rc" ;; "inc/Makefile") CONFIG_FILES="$CONFIG_FILES inc/Makefile" ;; @@ -20555,6 +21680,7 @@ Build configuration: debug: ${enable_debug} docs: ${build_docs} + fuzzers: ${enable_fuzzers} tools: ${enable_tools} werror: ${enable_werror} ============================================================================== @@ -20564,6 +21690,7 @@ Build configuration: debug: ${enable_debug} docs: ${build_docs} + fuzzers: ${enable_fuzzers} tools: ${enable_tools} werror: ${enable_werror} ============================================================================== diff -Nru libwpd-0.10.1/configure.ac libwpd-0.10.2/configure.ac --- libwpd-0.10.1/configure.ac 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/configure.ac 2017-09-12 14:58:27.000000000 +0000 @@ -7,7 +7,7 @@ # ==================== m4_define([libwpd_version_major],[0]) m4_define([libwpd_version_minor],[10]) -m4_define([libwpd_version_micro],[1]) +m4_define([libwpd_version_micro],[2]) m4_define([libwpd_version],[libwpd_version_major.libwpd_version_minor.libwpd_version_micro]) # ============= @@ -49,6 +49,9 @@ AC_SUBST(LT_REVISION, [libwpd_version_micro]) AC_SUBST(LT_AGE) +AX_CXX_COMPILE_STDCXX_11 +AX_GCC_FUNC_ATTRIBUTE([format]) + # ========================== # Platform check for windows # ========================== @@ -229,6 +232,21 @@ AC_SUBST([REVENGE_CFLAGS]) AC_SUBST([REVENGE_LIBS]) +# ================== +# Find boost headers +# ================== +saved_CPPFLAGS="${CPPFLAGS}" +CPPFLAGS="${BOOST_CFLAGS} ${CPPFLAGS}" +AC_CHECK_HEADERS([dnl + boost/spirit/include/qi.hpp \ + ], + [], + [AC_MSG_ERROR([Required boost headers not found.])], + [] +) +CPPFLAGS="${saved_CPPFLAGS}" +AC_SUBST([BOOST_CFLAGS]) + # ===== # Tools # ===== @@ -237,7 +255,19 @@ [enable_tools="$enableval"], [enable_tools=yes] ) -AS_IF([test "x$enable_tools" = "xyes"], [ +AM_CONDITIONAL(BUILD_TOOLS, [test "x$enable_tools" = "xyes"]) + +# ======= +# Fuzzers +# ======= +AC_ARG_ENABLE([fuzzers], + [AS_HELP_STRING([--enable-fuzzers], [Build fuzzer(s)])], + [enable_fuzzers="$enableval"], + [enable_fuzzers=no] +) +AM_CONDITIONAL(BUILD_FUZZERS, [test "x$enable_fuzzers" = "xyes"]) + +AS_IF([test "x$enable_tools" = "xyes" -o "x$enable_fuzzers" = "xyes"], [ PKG_CHECK_MODULES([REVENGE_GENERATORS],[ librevenge-generators-0.0 ]) @@ -249,7 +279,6 @@ AC_SUBST([REVENGE_GENERATORS_LIBS]) AC_SUBST([REVENGE_STREAM_CFLAGS]) AC_SUBST([REVENGE_STREAM_LIBS]) -AM_CONDITIONAL(BUILD_TOOLS, [test "x$enable_tools" = "xyes"]) # ===================== # Prepare all .in files @@ -264,6 +293,7 @@ src/conv/raw/wpd2raw.rc src/conv/text/Makefile src/conv/text/wpd2text.rc +src/fuzz/Makefile src/lib/Makefile src/lib/libwpd.rc inc/Makefile @@ -284,6 +314,7 @@ Build configuration: debug: ${enable_debug} docs: ${build_docs} + fuzzers: ${enable_fuzzers} tools: ${enable_tools} werror: ${enable_werror} ============================================================================== diff -Nru libwpd-0.10.1/debian/changelog libwpd-0.10.2/debian/changelog --- libwpd-0.10.1/debian/changelog 2016-09-12 20:58:36.000000000 +0000 +++ libwpd-0.10.2/debian/changelog 2017-09-17 10:45:10.000000000 +0000 @@ -1,3 +1,16 @@ +libwpd (0.10.2-2) unstable; urgency=medium + + * add missing new Build-Depends: of libboost-dev + + -- Rene Engelhard Sun, 17 Sep 2017 12:45:10 +0200 + +libwpd (0.10.2-1) unstable; urgency=medium + + * New upstream version 0.10.2 + - fixes CVE-2017-14226 (closes: #876001) + + -- Rene Engelhard Sun, 17 Sep 2017 11:31:28 +0200 + libwpd (0.10.1-5) unstable; urgency=medium * [7d35591] move Maintainer: to Debian LibreOffice Maintainers diff -Nru libwpd-0.10.1/debian/control libwpd-0.10.2/debian/control --- libwpd-0.10.1/debian/control 2016-09-12 20:54:21.000000000 +0000 +++ libwpd-0.10.2/debian/control 2017-09-17 10:44:51.000000000 +0000 @@ -3,7 +3,7 @@ Priority: optional Maintainer: Debian LibreOffice Maintainers Uploaders: Rene Engelhard -Build-Depends: debhelper (>= 10), libcppunit-dev, dh-autoreconf, zlib1g-dev, pkg-config, dpkg-dev (>= 1.16.1), librevenge-dev +Build-Depends: debhelper (>= 10), libcppunit-dev, dh-autoreconf, zlib1g-dev, pkg-config, dpkg-dev (>= 1.16.1), librevenge-dev, libboost-dev Build-Depends-Indep: doxygen Standards-Version: 3.9.7 diff -Nru libwpd-0.10.1/docs/doxygen/Makefile.in libwpd-0.10.2/docs/doxygen/Makefile.in --- libwpd-0.10.1/docs/doxygen/Makefile.in 2015-12-30 08:16:50.000000000 +0000 +++ libwpd-0.10.2/docs/doxygen/Makefile.in 2017-09-12 15:07:54.000000000 +0000 @@ -89,10 +89,12 @@ host_triplet = @host@ subdir = docs/doxygen ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -131,6 +133,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BOOST_CFLAGS = @BOOST_CFLAGS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -155,6 +158,7 @@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff -Nru libwpd-0.10.1/docs/Makefile.in libwpd-0.10.2/docs/Makefile.in --- libwpd-0.10.1/docs/Makefile.in 2015-12-30 08:16:50.000000000 +0000 +++ libwpd-0.10.2/docs/Makefile.in 2017-09-12 15:07:54.000000000 +0000 @@ -90,10 +90,12 @@ host_triplet = @host@ subdir = docs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -221,6 +223,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BOOST_CFLAGS = @BOOST_CFLAGS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -245,6 +248,7 @@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff -Nru libwpd-0.10.1/inc/libwpd/Makefile.in libwpd-0.10.2/inc/libwpd/Makefile.in --- libwpd-0.10.1/inc/libwpd/Makefile.in 2015-12-30 08:16:50.000000000 +0000 +++ libwpd-0.10.2/inc/libwpd/Makefile.in 2017-09-12 15:07:54.000000000 +0000 @@ -90,10 +90,12 @@ host_triplet = @host@ subdir = inc/libwpd ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(dist_libwpd_HEADERS) \ @@ -180,6 +182,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BOOST_CFLAGS = @BOOST_CFLAGS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -204,6 +207,7 @@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff -Nru libwpd-0.10.1/inc/Makefile.in libwpd-0.10.2/inc/Makefile.in --- libwpd-0.10.1/inc/Makefile.in 2015-12-30 08:16:50.000000000 +0000 +++ libwpd-0.10.2/inc/Makefile.in 2017-09-12 15:07:54.000000000 +0000 @@ -89,10 +89,12 @@ host_triplet = @host@ subdir = inc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -191,6 +193,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BOOST_CFLAGS = @BOOST_CFLAGS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -215,6 +218,7 @@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff -Nru libwpd-0.10.1/m4/ax_cxx_compile_stdcxx_11.m4 libwpd-0.10.2/m4/ax_cxx_compile_stdcxx_11.m4 --- libwpd-0.10.1/m4/ax_cxx_compile_stdcxx_11.m4 1970-01-01 00:00:00.000000000 +0000 +++ libwpd-0.10.2/m4/ax_cxx_compile_stdcxx_11.m4 2017-04-15 16:32:49.000000000 +0000 @@ -0,0 +1,39 @@ +# ============================================================================= +# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html +# ============================================================================= +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the C++11 +# standard; if necessary, add switches to CXX and CXXCPP to enable +# support. +# +# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX +# macro with the version set to C++11. The two optional arguments are +# forwarded literally as the second and third argument respectively. +# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for +# more information. If you want to use this macro, you also need to +# download the ax_cxx_compile_stdcxx.m4 file. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik +# Copyright (c) 2012 Zack Weinberg +# Copyright (c) 2013 Roy Stogner +# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov +# Copyright (c) 2015 Paul Norman +# Copyright (c) 2015 Moritz Klammler +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 18 + +AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) +AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])]) diff -Nru libwpd-0.10.1/m4/ax_cxx_compile_stdcxx.m4 libwpd-0.10.2/m4/ax_cxx_compile_stdcxx.m4 --- libwpd-0.10.1/m4/ax_cxx_compile_stdcxx.m4 1970-01-01 00:00:00.000000000 +0000 +++ libwpd-0.10.2/m4/ax_cxx_compile_stdcxx.m4 2017-09-10 14:51:59.000000000 +0000 @@ -0,0 +1,982 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the specified +# version of the C++ standard. If necessary, add switches to CXX and +# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) +# or '14' (for the C++14 standard). +# +# The second argument, if specified, indicates whether you insist on an +# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. +# -std=c++11). If neither is specified, you get whatever works, with +# preference for an extended mode. +# +# The third argument, if specified 'mandatory' or if left unspecified, +# indicates that baseline support for the specified C++ standard is +# required and that the macro should error out if no mode with that +# support is found. If specified 'optional', then configuration proceeds +# regardless, after defining HAVE_CXX${VERSION} if and only if a +# supporting mode is found. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik +# Copyright (c) 2012 Zack Weinberg +# Copyright (c) 2013 Roy Stogner +# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov +# Copyright (c) 2015 Paul Norman +# Copyright (c) 2015 Moritz Klammler +# Copyright (c) 2016 Krzesimir Nowak +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 7 + +dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro +dnl (serial version number 13). + +AX_REQUIRE_DEFINED([AC_MSG_WARN]) +AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl + m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], + [$1], [14], [ax_cxx_compile_alternatives="14 1y"], + [$1], [17], [ax_cxx_compile_alternatives="17 1z"], + [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl + m4_if([$2], [], [], + [$2], [ext], [], + [$2], [noext], [], + [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl + m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], + [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], + [$3], [optional], [ax_cxx_compile_cxx$1_required=false], + [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) + AC_LANG_PUSH([C++])dnl + ac_success=no + AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, + ax_cv_cxx_compile_cxx$1, + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [ax_cv_cxx_compile_cxx$1=yes], + [ax_cv_cxx_compile_cxx$1=no])]) + if test x$ax_cv_cxx_compile_cxx$1 = xyes; then + ac_success=yes + fi + + m4_if([$2], [noext], [], [dnl + if test x$ac_success = xno; then + for alternative in ${ax_cxx_compile_alternatives}; do + switch="-std=gnu++${alternative}" + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, + $cachevar, + [ac_save_CXX="$CXX" + CXX="$CXX $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXX="$ac_save_CXX"]) + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi + done + fi]) + + m4_if([$2], [ext], [], [dnl + if test x$ac_success = xno; then + dnl HP's aCC needs +std=c++11 according to: + dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf + dnl Cray's crayCC needs "-h std=c++11" + for alternative in ${ax_cxx_compile_alternatives}; do + for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, + $cachevar, + [ac_save_CXX="$CXX" + CXX="$CXX $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXX="$ac_save_CXX"]) + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi + done + if test x$ac_success = xyes; then + break + fi + done + fi]) + AC_LANG_POP([C++]) + if test x$ax_cxx_compile_cxx$1_required = xtrue; then + if test x$ac_success = xno; then + AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) + fi + fi + if test x$ac_success = xno; then + HAVE_CXX$1=0 + AC_MSG_NOTICE([No compiler with C++$1 support was found]) + else + HAVE_CXX$1=1 + AC_DEFINE(HAVE_CXX$1,1, + [define if the compiler supports basic C++$1 syntax]) + fi + AC_SUBST(HAVE_CXX$1) + m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may change in incompatible ways anytime])]) +]) + + +dnl Test body for checking C++11 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 +) + + +dnl Test body for checking C++14 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 +) + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 +) + +dnl Tests for new features in C++11 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ + +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201103L && !(defined _MSC_VER) + +#error "This is not a C++11 compiler" + +#else + +namespace cxx11 +{ + + namespace test_static_assert + { + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual void f() {} + }; + + struct Derived : public Base + { + virtual void f() override {} + }; + + } + + namespace test_double_right_angle_brackets + { + + template < typename T > + struct check {}; + + typedef check single_type; + typedef check> double_type; + typedef check>> triple_type; + typedef check>>> quadruple_type; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + int + test(const int c, volatile int v) + { + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template + struct sum; + + template + struct sum + { + static constexpr auto value = N0 + sum::value; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + + } + + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { + + struct foo {}; + + template + using member = typename T::member_type; + + template + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + +]]) + + +dnl Tests for new features in C++14 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ + +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201402L + +#error "This is not a C++14 compiler" + +#else + +namespace cxx14 +{ + + namespace test_polymorphic_lambdas + { + + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } + + } + + namespace test_binary_literals + { + + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); + + } + + namespace test_generalized_constexpr + { + + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); + + } + + namespace test_lambda_init_capture + { + + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } + + } + + namespace test_digit_separators + { + + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + + } + + namespace test_return_type_deduction + { + + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } + + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; + + template < typename T > + struct is_same + { + static constexpr auto value = true; + }; + + int + test() + { + auto x = 0; + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); + return x; + } + + } + +} // namespace cxx14 + +#endif // __cplusplus >= 201402L + +]]) + + +dnl Tests for new features in C++17 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ + +// If the compiler admits that it is not ready for C++17, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus <= 201402L + +#error "This is not a C++17 compiler" + +#else + +#if defined(__clang__) + #define REALLY_CLANG +#else + #if defined(__GNUC__) + #define REALLY_GCC + #endif +#endif + +#include +#include +#include + +namespace cxx17 +{ + +#if !defined(REALLY_CLANG) + namespace test_constexpr_lambdas + { + + // TODO: test it with clang++ from git + + constexpr int foo = [](){return 42;}(); + + } +#endif // !defined(REALLY_CLANG) + + namespace test::nested_namespace::definitions + { + + } + + namespace test_fold_expression + { + + template + int multiply(Args... args) + { + return (args * ... * 1); + } + + template + bool all(Args... args) + { + return (args && ...); + } + + } + + namespace test_extended_static_assert + { + + static_assert (true); + + } + + namespace test_auto_brace_init_list + { + + auto foo = {5}; + auto bar {5}; + + static_assert(std::is_same, decltype(foo)>::value); + static_assert(std::is_same::value); + } + + namespace test_typename_in_template_template_parameter + { + + template typename X> struct D; + + } + + namespace test_fallthrough_nodiscard_maybe_unused_attributes + { + + int f1() + { + return 42; + } + + [[nodiscard]] int f2() + { + [[maybe_unused]] auto unused = f1(); + + switch (f1()) + { + case 17: + f1(); + [[fallthrough]]; + case 42: + f1(); + } + return f1(); + } + + } + + namespace test_extended_aggregate_initialization + { + + struct base1 + { + int b1, b2 = 42; + }; + + struct base2 + { + base2() { + b3 = 42; + } + int b3; + }; + + struct derived : base1, base2 + { + int d; + }; + + derived d1 {{1, 2}, {}, 4}; // full initialization + derived d2 {{}, {}, 4}; // value-initialized bases + + } + + namespace test_general_range_based_for_loop + { + + struct iter + { + int i; + + int& operator* () + { + return i; + } + + const int& operator* () const + { + return i; + } + + iter& operator++() + { + ++i; + return *this; + } + }; + + struct sentinel + { + int i; + }; + + bool operator== (const iter& i, const sentinel& s) + { + return i.i == s.i; + } + + bool operator!= (const iter& i, const sentinel& s) + { + return !(i == s); + } + + struct range + { + iter begin() const + { + return {0}; + } + + sentinel end() const + { + return {5}; + } + }; + + void f() + { + range r {}; + + for (auto i : r) + { + [[maybe_unused]] auto v = i; + } + } + + } + + namespace test_lambda_capture_asterisk_this_by_value + { + + struct t + { + int i; + int foo() + { + return [*this]() + { + return i; + }(); + } + }; + + } + + namespace test_enum_class_construction + { + + enum class byte : unsigned char + {}; + + byte foo {42}; + + } + + namespace test_constexpr_if + { + + template + int f () + { + if constexpr(cond) + { + return 13; + } + else + { + return 42; + } + } + + } + + namespace test_selection_statement_with_initializer + { + + int f() + { + return 13; + } + + int f2() + { + if (auto i = f(); i > 0) + { + return 3; + } + + switch (auto i = f(); i + 4) + { + case 17: + return 2; + + default: + return 1; + } + } + + } + +#if !defined(REALLY_CLANG) + namespace test_template_argument_deduction_for_class_templates + { + + // TODO: test it with clang++ from git + + template + struct pair + { + pair (T1 p1, T2 p2) + : m1 {p1}, + m2 {p2} + {} + + T1 m1; + T2 m2; + }; + + void f() + { + [[maybe_unused]] auto p = pair{13, 42u}; + } + + } +#endif // !defined(REALLY_CLANG) + + namespace test_non_type_auto_template_parameters + { + + template + struct B + {}; + + B<5> b1; + B<'a'> b2; + + } + +#if !defined(REALLY_CLANG) + namespace test_structured_bindings + { + + // TODO: test it with clang++ from git + + int arr[2] = { 1, 2 }; + std::pair pr = { 1, 2 }; + + auto f1() -> int(&)[2] + { + return arr; + } + + auto f2() -> std::pair& + { + return pr; + } + + struct S + { + int x1 : 2; + volatile double y1; + }; + + S f3() + { + return {}; + } + + auto [ x1, y1 ] = f1(); + auto& [ xr1, yr1 ] = f1(); + auto [ x2, y2 ] = f2(); + auto& [ xr2, yr2 ] = f2(); + const auto [ x3, y3 ] = f3(); + + } +#endif // !defined(REALLY_CLANG) + +#if !defined(REALLY_CLANG) + namespace test_exception_spec_type_system + { + + // TODO: test it with clang++ from git + + struct Good {}; + struct Bad {}; + + void g1() noexcept; + void g2(); + + template + Bad + f(T*, T*); + + template + Good + f(T1*, T2*); + + static_assert (std::is_same_v); + + } +#endif // !defined(REALLY_CLANG) + + namespace test_inline_variables + { + + template void f(T) + {} + + template inline T g(T) + { + return T{}; + } + + template<> inline void f<>(int) + {} + + template<> int g<>(int) + { + return 5; + } + + } + +} // namespace cxx17 + +#endif // __cplusplus <= 201402L + +]]) diff -Nru libwpd-0.10.1/m4/ax_gcc_func_attribute.m4 libwpd-0.10.2/m4/ax_gcc_func_attribute.m4 --- libwpd-0.10.1/m4/ax_gcc_func_attribute.m4 1970-01-01 00:00:00.000000000 +0000 +++ libwpd-0.10.2/m4/ax_gcc_func_attribute.m4 2017-04-15 16:30:14.000000000 +0000 @@ -0,0 +1,226 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE) +# +# DESCRIPTION +# +# This macro checks if the compiler supports one of GCC's function +# attributes; many other compilers also provide function attributes with +# the same syntax. Compiler warnings are used to detect supported +# attributes as unsupported ones are ignored by default so quieting +# warnings when using this macro will yield false positives. +# +# The ATTRIBUTE parameter holds the name of the attribute to be checked. +# +# If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_. +# +# The macro caches its result in the ax_cv_have_func_attribute_ +# variable. +# +# The macro currently supports the following function attributes: +# +# alias +# aligned +# alloc_size +# always_inline +# artificial +# cold +# const +# constructor +# constructor_priority for constructor attribute with priority +# deprecated +# destructor +# dllexport +# dllimport +# error +# externally_visible +# flatten +# format +# format_arg +# gnu_inline +# hot +# ifunc +# leaf +# malloc +# noclone +# noinline +# nonnull +# noreturn +# nothrow +# optimize +# pure +# unused +# used +# visibility +# warning +# warn_unused_result +# weak +# weakref +# +# Unsuppored function attributes will be tested with a prototype returning +# an int and not accepting any arguments and the result of the check might +# be wrong or meaningless so use with care. +# +# LICENSE +# +# Copyright (c) 2013 Gabriele Svelto +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 5 + +AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [ + AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1]) + + AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + m4_case([$1], + [alias], [ + int foo( void ) { return 0; } + int bar( void ) __attribute__(($1("foo"))); + ], + [aligned], [ + int foo( void ) __attribute__(($1(32))); + ], + [alloc_size], [ + void *foo(int a) __attribute__(($1(1))); + ], + [always_inline], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [artificial], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [cold], [ + int foo( void ) __attribute__(($1)); + ], + [const], [ + int foo( void ) __attribute__(($1)); + ], + [constructor_priority], [ + int foo( void ) __attribute__((__constructor__(65535/2))); + ], + [constructor], [ + int foo( void ) __attribute__(($1)); + ], + [deprecated], [ + int foo( void ) __attribute__(($1(""))); + ], + [destructor], [ + int foo( void ) __attribute__(($1)); + ], + [dllexport], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [dllimport], [ + int foo( void ) __attribute__(($1)); + ], + [error], [ + int foo( void ) __attribute__(($1(""))); + ], + [externally_visible], [ + int foo( void ) __attribute__(($1)); + ], + [flatten], [ + int foo( void ) __attribute__(($1)); + ], + [format], [ + int foo(const char *p, ...) __attribute__(($1(printf, 1, 2))); + ], + [format_arg], [ + char *foo(const char *p) __attribute__(($1(1))); + ], + [gnu_inline], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [hot], [ + int foo( void ) __attribute__(($1)); + ], + [ifunc], [ + int my_foo( void ) { return 0; } + static int (*resolve_foo(void))(void) { return my_foo; } + int foo( void ) __attribute__(($1("resolve_foo"))); + ], + [leaf], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [malloc], [ + void *foo( void ) __attribute__(($1)); + ], + [noclone], [ + int foo( void ) __attribute__(($1)); + ], + [noinline], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [nonnull], [ + int foo(char *p) __attribute__(($1(1))); + ], + [noreturn], [ + void foo( void ) __attribute__(($1)); + ], + [nothrow], [ + int foo( void ) __attribute__(($1)); + ], + [optimize], [ + __attribute__(($1(3))) int foo( void ) { return 0; } + ], + [pure], [ + int foo( void ) __attribute__(($1)); + ], + [returns_nonnull], [ + void *foo( void ) __attribute__(($1)); + ], + [unused], [ + int foo( void ) __attribute__(($1)); + ], + [used], [ + int foo( void ) __attribute__(($1)); + ], + [visibility], [ + int foo_def( void ) __attribute__(($1("default"))); + int foo_hid( void ) __attribute__(($1("hidden"))); + int foo_int( void ) __attribute__(($1("internal"))); + int foo_pro( void ) __attribute__(($1("protected"))); + ], + [warning], [ + int foo( void ) __attribute__(($1(""))); + ], + [warn_unused_result], [ + int foo( void ) __attribute__(($1)); + ], + [weak], [ + int foo( void ) __attribute__(($1)); + ], + [weakref], [ + static int foo( void ) { return 0; } + static int bar( void ) __attribute__(($1("foo"))); + ], + [ + m4_warn([syntax], [Unsupported attribute $1, the test may fail]) + int foo( void ) __attribute__(($1)); + ] + )], []) + ], + dnl GCC doesn't exit with an error if an unknown attribute is + dnl provided but only outputs a warning, so accept the attribute + dnl only if no warning were issued. + [AS_IF([test -s conftest.err], + [AS_VAR_SET([ac_var], [no])], + [AS_VAR_SET([ac_var], [yes])])], + [AS_VAR_SET([ac_var], [no])]) + ]) + + AS_IF([test yes = AS_VAR_GET([ac_var])], + [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1, + [Define to 1 if the system has the `$1' function attribute])], []) + + AS_VAR_POPDEF([ac_var]) +]) diff -Nru libwpd-0.10.1/Makefile.in libwpd-0.10.2/Makefile.in --- libwpd-0.10.1/Makefile.in 2015-12-30 08:16:49.000000000 +0000 +++ libwpd-0.10.2/Makefile.in 2017-09-12 15:07:53.000000000 +0000 @@ -90,10 +90,12 @@ host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ @@ -192,7 +194,7 @@ DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/libwpd.pc.in INSTALL NEWS README TODO ar-lib compile \ - config.guess config.sub install-sh ltmain.sh missing + config.guess config.sub depcomp install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -244,6 +246,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BOOST_CFLAGS = @BOOST_CFLAGS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -268,6 +271,7 @@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -652,7 +656,7 @@ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 @@ -676,7 +680,7 @@ @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir @@ -694,7 +698,7 @@ distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ @@ -704,7 +708,7 @@ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac diff -Nru libwpd-0.10.1/NEWS libwpd-0.10.2/NEWS --- libwpd-0.10.1/NEWS 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/NEWS 2017-09-12 15:01:49.000000000 +0000 @@ -1,4 +1,9 @@ CHANGES: +0.10.1 - 0.10.2 +- Require C++11 for build. +- Fix various crashes, leaks and hangs when reading damaged files found + by oss-fuzz. + 0.10.0 - 0.10.1 - Fix crash when NULL is passed as input stream. - Use symbol visibility on Linux. The library only exports public functions diff -Nru libwpd-0.10.1/README libwpd-0.10.2/README --- libwpd-0.10.1/README 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/README 2017-07-29 06:20:15.000000000 +0000 @@ -1,8 +1,8 @@ libwpd is a library for import of WordPerfect documents. It is used by, for example, AbiWord and LibreOffice. -libwpd requires librevenge and doxygen (optional) to build. Most up to -date code is available from Git repository at sourceforge.net +libwpd requires boost, librevenge and doxygen (optional) to build. Most +up-to-date code is available from Git repository at sourceforge.net (http://sourceforge.net/p/libwpd/code/). See http://sourceforge.net/p/libwpd/ for more information. diff -Nru libwpd-0.10.1/src/conv/html/Makefile.in libwpd-0.10.2/src/conv/html/Makefile.in --- libwpd-0.10.1/src/conv/html/Makefile.in 2015-12-30 08:16:50.000000000 +0000 +++ libwpd-0.10.2/src/conv/html/Makefile.in 2017-09-12 15:07:54.000000000 +0000 @@ -91,10 +91,12 @@ @BUILD_TOOLS_TRUE@bin_PROGRAMS = wpd2html$(EXEEXT) subdir = src/conv/html ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -184,6 +186,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BOOST_CFLAGS = @BOOST_CFLAGS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -208,6 +211,7 @@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff -Nru libwpd-0.10.1/src/conv/html/wpd2html.cpp libwpd-0.10.2/src/conv/html/wpd2html.cpp --- libwpd-0.10.1/src/conv/html/wpd2html.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/conv/html/wpd2html.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -67,8 +67,8 @@ if (argc < 2) return printUsage(); - char *file = 0; - char *password = 0; + char *file = nullptr; + char *password = nullptr; for (int i = 1; i < argc; i++) { diff -Nru libwpd-0.10.1/src/conv/Makefile.in libwpd-0.10.2/src/conv/Makefile.in --- libwpd-0.10.1/src/conv/Makefile.in 2015-12-30 08:16:50.000000000 +0000 +++ libwpd-0.10.2/src/conv/Makefile.in 2017-09-12 15:07:54.000000000 +0000 @@ -89,10 +89,12 @@ host_triplet = @host@ subdir = src/conv ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -191,6 +193,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BOOST_CFLAGS = @BOOST_CFLAGS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -215,6 +218,7 @@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff -Nru libwpd-0.10.1/src/conv/raw/Makefile.in libwpd-0.10.2/src/conv/raw/Makefile.in --- libwpd-0.10.1/src/conv/raw/Makefile.in 2015-12-30 08:16:50.000000000 +0000 +++ libwpd-0.10.2/src/conv/raw/Makefile.in 2017-09-12 15:07:54.000000000 +0000 @@ -91,10 +91,12 @@ @BUILD_TOOLS_TRUE@bin_PROGRAMS = wpd2raw$(EXEEXT) subdir = src/conv/raw ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -184,6 +186,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BOOST_CFLAGS = @BOOST_CFLAGS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -208,6 +211,7 @@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff -Nru libwpd-0.10.1/src/conv/raw/wpd2raw.cpp libwpd-0.10.2/src/conv/raw/wpd2raw.cpp --- libwpd-0.10.1/src/conv/raw/wpd2raw.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/conv/raw/wpd2raw.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -70,8 +70,8 @@ int main(int argc, char *argv[]) { bool printIndentLevel = false; - char *file = 0; - char *password = 0; + char *file = nullptr; + char *password = nullptr; if (argc < 2) return printUsage(); diff -Nru libwpd-0.10.1/src/conv/text/Makefile.in libwpd-0.10.2/src/conv/text/Makefile.in --- libwpd-0.10.1/src/conv/text/Makefile.in 2015-12-30 08:16:50.000000000 +0000 +++ libwpd-0.10.2/src/conv/text/Makefile.in 2017-09-12 15:07:54.000000000 +0000 @@ -91,10 +91,12 @@ @BUILD_TOOLS_TRUE@bin_PROGRAMS = wpd2text$(EXEEXT) subdir = src/conv/text ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -184,6 +186,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BOOST_CFLAGS = @BOOST_CFLAGS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -208,6 +211,7 @@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff -Nru libwpd-0.10.1/src/conv/text/wpd2text.cpp libwpd-0.10.2/src/conv/text/wpd2text.cpp --- libwpd-0.10.1/src/conv/text/wpd2text.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/conv/text/wpd2text.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -73,9 +73,9 @@ if (argc < 2) return printUsage(); - char *szInputFile = 0; + char *szInputFile = nullptr; bool isInfo = false; - char *password = 0; + char *password = nullptr; for (int i = 1; i < argc; i++) { diff -Nru libwpd-0.10.1/src/fuzz/Makefile.am libwpd-0.10.2/src/fuzz/Makefile.am --- libwpd-0.10.1/src/fuzz/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ libwpd-0.10.2/src/fuzz/Makefile.am 2017-04-15 10:17:38.000000000 +0000 @@ -0,0 +1,17 @@ +noinst_PROGRAMS = wpdfuzzer + +AM_CXXFLAGS = -I$(top_srcdir)/inc \ + $(REVENGE_GENERATORS_CFLAGS) \ + $(REVENGE_CFLAGS) \ + $(REVENGE_STREAM_CFLAGS) \ + $(DEBUG_CXXFLAGS) + +wpdfuzzer_LDADD = \ + $(top_builddir)/src/lib/libwpd-@WPD_MAJOR_VERSION@.@WPD_MINOR_VERSION@.la \ + $(REVENGE_GENERATORS_LIBS) \ + $(REVENGE_LIBS) \ + $(REVENGE_STREAM_LIBS) \ + -lFuzzingEngine + +wpdfuzzer_SOURCES = \ + wpdfuzzer.cpp diff -Nru libwpd-0.10.1/src/fuzz/Makefile.in libwpd-0.10.2/src/fuzz/Makefile.in --- libwpd-0.10.1/src/fuzz/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ libwpd-0.10.2/src/fuzz/Makefile.in 2017-09-12 15:07:55.000000000 +0000 @@ -0,0 +1,632 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = wpdfuzzer$(EXEEXT) +subdir = src/fuzz +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_wpdfuzzer_OBJECTS = wpdfuzzer.$(OBJEXT) +wpdfuzzer_OBJECTS = $(am_wpdfuzzer_OBJECTS) +am__DEPENDENCIES_1 = +wpdfuzzer_DEPENDENCIES = $(top_builddir)/src/lib/libwpd-@WPD_MAJOR_VERSION@.@WPD_MINOR_VERSION@.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(wpdfuzzer_SOURCES) +DIST_SOURCES = $(wpdfuzzer_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BOOST_CFLAGS = @BOOST_CFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_CXXFLAGS = @DEBUG_CXXFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOXYGEN = @DOXYGEN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBWPD_WIN32_RESOURCE = @LIBWPD_WIN32_RESOURCE@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +REVENGE_CFLAGS = @REVENGE_CFLAGS@ +REVENGE_GENERATORS_CFLAGS = @REVENGE_GENERATORS_CFLAGS@ +REVENGE_GENERATORS_LIBS = @REVENGE_GENERATORS_LIBS@ +REVENGE_LIBS = @REVENGE_LIBS@ +REVENGE_STREAM_CFLAGS = @REVENGE_STREAM_CFLAGS@ +REVENGE_STREAM_LIBS = @REVENGE_STREAM_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WINDRES = @WINDRES@ +WPD2HTML_WIN32_RESOURCE = @WPD2HTML_WIN32_RESOURCE@ +WPD2RAW_WIN32_RESOURCE = @WPD2RAW_WIN32_RESOURCE@ +WPD2TEXT_WIN32_RESOURCE = @WPD2TEXT_WIN32_RESOURCE@ +WPD_MAJOR_VERSION = @WPD_MAJOR_VERSION@ +WPD_MICRO_VERSION = @WPD_MICRO_VERSION@ +WPD_MINOR_VERSION = @WPD_MINOR_VERSION@ +WPD_VERSION = @WPD_VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CXXFLAGS = -I$(top_srcdir)/inc \ + $(REVENGE_GENERATORS_CFLAGS) \ + $(REVENGE_CFLAGS) \ + $(REVENGE_STREAM_CFLAGS) \ + $(DEBUG_CXXFLAGS) + +wpdfuzzer_LDADD = \ + $(top_builddir)/src/lib/libwpd-@WPD_MAJOR_VERSION@.@WPD_MINOR_VERSION@.la \ + $(REVENGE_GENERATORS_LIBS) \ + $(REVENGE_LIBS) \ + $(REVENGE_STREAM_LIBS) \ + -lFuzzingEngine + +wpdfuzzer_SOURCES = \ + wpdfuzzer.cpp + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/fuzz/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/fuzz/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +wpdfuzzer$(EXEEXT): $(wpdfuzzer_OBJECTS) $(wpdfuzzer_DEPENDENCIES) $(EXTRA_wpdfuzzer_DEPENDENCIES) + @rm -f wpdfuzzer$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(wpdfuzzer_OBJECTS) $(wpdfuzzer_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wpdfuzzer.Po@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru libwpd-0.10.1/src/fuzz/wpdfuzzer.cpp libwpd-0.10.2/src/fuzz/wpdfuzzer.cpp --- libwpd-0.10.1/src/fuzz/wpdfuzzer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libwpd-0.10.2/src/fuzz/wpdfuzzer.cpp 2017-04-15 10:17:38.000000000 +0000 @@ -0,0 +1,27 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * This file is part of the libmspub project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include +#include + +#include + +#include + +#include + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + librevenge::RVNGStringStream input(data, size); + librevenge::RVNGRawTextGenerator generator(true); + libwpd::WPDocument::parse(&input, &generator, ""); + return 0; +} + +/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/libwpd_internal.cpp libwpd-0.10.2/src/lib/libwpd_internal.cpp --- libwpd-0.10.1/src/lib/libwpd_internal.cpp 2015-12-30 08:38:37.000000000 +0000 +++ libwpd-0.10.2/src/lib/libwpd_internal.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -30,6 +30,9 @@ #include #include #include +#include + +#include #ifdef DEBUG namespace libwpd @@ -150,13 +153,11 @@ void appendUCS4(librevenge::RVNGString &str, unsigned ucs4) { - int charLength = libwpd_unichar_to_utf8(ucs4, 0); - char *utf8 = new char[charLength+1]; + int charLength = libwpd_unichar_to_utf8(ucs4, nullptr); + std::vector utf8(charLength+1); utf8[charLength] = '\0'; - libwpd_unichar_to_utf8(ucs4, utf8); - str.append(utf8); - - delete[] utf8; + libwpd_unichar_to_utf8(ucs4, utf8.data()); + str.append(utf8.data()); } librevenge::RVNGString readPascalString(librevenge::RVNGInputStream *input, WPXEncryption *encryption) @@ -1280,6 +1281,8 @@ if (buf.len()==0) throw ParseException(); char c = buf.cstr()[0]; + if (!isalpha(c)) + throw ParseException(); if (listType==LOWERCASE) c = (char)toupper(c); return (c - 64); @@ -1287,13 +1290,11 @@ else if (listType == ARABIC) { int currentSum = 0; - librevenge::RVNGString::Iter i(buf); - for (i.rewind(); i.next();) - { - currentSum *= 10; - currentSum+=(*(i())-48); - } - return currentSum; + const char *first = buf.cstr(); + const char *const last = first + buf.size(); + namespace qi = boost::spirit::qi; + const bool succeed = qi::parse(first, last, qi::int_, currentSum); + return succeed ? currentSum : 0; } return 1; diff -Nru libwpd-0.10.1/src/lib/libwpd_internal.h libwpd-0.10.2/src/lib/libwpd_internal.h --- libwpd-0.10.1/src/lib/libwpd_internal.h 2015-12-30 08:38:37.000000000 +0000 +++ libwpd-0.10.2/src/lib/libwpd_internal.h 2017-07-29 06:20:15.000000000 +0000 @@ -33,9 +33,7 @@ /* Various functions/defines that need not/should not be exported externally */ -#define DELETEP(m) if (m) { delete m; m = 0; } - -#if defined(__clang__) || defined(__GNUC__) +#if defined(HAVE_FUNC_ATTRIBUTE_FORMAT) #define WPD_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg))) #else #define WPD_ATTRIBUTE_PRINTF(fmt, arg) @@ -54,6 +52,14 @@ #define WPD_NUM_ELEMENTS(array) sizeof(array)/sizeof(array[0]) +namespace libwpd +{ +struct WPXDummyDeleter +{ + void operator()(void *) {} +}; +} + // add more of these as needed for byteswapping // (the 8-bit functions are just there to make things consistent) unsigned char readU8(librevenge::RVNGInputStream *input, WPXEncryption *encryption); diff -Nru libwpd-0.10.1/src/lib/libwpd.rc libwpd-0.10.2/src/lib/libwpd.rc --- libwpd-0.10.1/src/lib/libwpd.rc 2015-12-30 08:17:26.000000000 +0000 +++ libwpd-0.10.2/src/lib/libwpd.rc 2017-09-12 15:08:41.000000000 +0000 @@ -1,8 +1,8 @@ #include VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,10,1,BUILDNUMBER - PRODUCTVERSION 0,10,1,0 + FILEVERSION 0,10,2,BUILDNUMBER + PRODUCTVERSION 0,10,2,0 FILEFLAGSMASK 0 FILEFLAGS 0 FILEOS VOS__WINDOWS32 @@ -15,12 +15,12 @@ BEGIN VALUE "CompanyName", "The libwpd developer community" VALUE "FileDescription", "libwpd" - VALUE "FileVersion", "0.10.1.BUILDNUMBER" + VALUE "FileVersion", "0.10.2.BUILDNUMBER" VALUE "InternalName", "libwpd-0.10" VALUE "LegalCopyright", "Copyright (C) 2002-2006 William Lachance, Marc Maurer, Fridrich Strba, other contributers" VALUE "OriginalFilename", "libwpd-0.10.dll" VALUE "ProductName", "libwpd" - VALUE "ProductVersion", "0.10.1" + VALUE "ProductVersion", "0.10.2" END END BLOCK "VarFileInfo" diff -Nru libwpd-0.10.1/src/lib/Makefile.in libwpd-0.10.2/src/lib/Makefile.in --- libwpd-0.10.1/src/lib/Makefile.in 2015-12-30 08:16:50.000000000 +0000 +++ libwpd-0.10.2/src/lib/Makefile.in 2017-09-12 15:07:55.000000000 +0000 @@ -90,10 +90,12 @@ host_triplet = @host@ subdir = src/lib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -289,6 +291,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BOOST_CFLAGS = @BOOST_CFLAGS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -313,6 +316,7 @@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff -Nru libwpd-0.10.1/src/lib/WP1BottomMarginGroup.h libwpd-0.10.2/src/lib/WP1BottomMarginGroup.h --- libwpd-0.10.1/src/lib/WP1BottomMarginGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1BottomMarginGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,9 +32,9 @@ { public: WP1BottomMarginGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1BottomMarginGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener *listener); + ~WP1BottomMarginGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener *listener) override; private: unsigned short m_bottomMargin; diff -Nru libwpd-0.10.1/src/lib/WP1CenterTextGroup.h libwpd-0.10.2/src/lib/WP1CenterTextGroup.h --- libwpd-0.10.1/src/lib/WP1CenterTextGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1CenterTextGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,8 +32,8 @@ { public: WP1CenterTextGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1CenterTextGroup(); - void parse(WP1Listener *listener); + ~WP1CenterTextGroup() override; + void parse(WP1Listener *listener) override; }; #endif /* WP1CENTERTEXTGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP1ContentListener.cpp libwpd-0.10.2/src/lib/WP1ContentListener.cpp --- libwpd-0.10.1/src/lib/WP1ContentListener.cpp 2015-12-30 08:28:39.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1ContentListener.cpp 2017-07-29 06:20:15.000000000 +0000 @@ -57,7 +57,6 @@ WP1ContentListener::~WP1ContentListener() { - delete m_parseState; } @@ -560,9 +559,8 @@ WPXTableList /* tableList */, unsigned /* nextTableIndice */) { // save our old parsing state on our "stack" - WP1ContentParsingState *oldParseState = m_parseState; - - m_parseState = new WP1ContentParsingState(); + auto oldParseState = std::move(m_parseState); + m_parseState = std::unique_ptr(new WP1ContentParsingState()); if (subDocument) { @@ -584,8 +582,7 @@ #endif // restore our old parsing state - delete m_parseState; - m_parseState = oldParseState; + m_parseState = std::move(oldParseState); } /**************************************** diff -Nru libwpd-0.10.1/src/lib/WP1ContentListener.h libwpd-0.10.2/src/lib/WP1ContentListener.h --- libwpd-0.10.1/src/lib/WP1ContentListener.h 2015-12-30 08:28:24.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1ContentListener.h 2017-09-08 17:04:25.000000000 +0000 @@ -28,6 +28,8 @@ #ifndef WP1CONTENTLISTENER_H #define WP1CONTENTLISTENER_H +#include + #include "WP1Listener.h" #include "WPXContentListener.h" @@ -49,65 +51,65 @@ { public: WP1ContentListener(std::list &pageList, std::vector &subDocuments, librevenge::RVNGTextInterface *documentInterface); - ~WP1ContentListener(); + ~WP1ContentListener() override; - void startDocument() + void startDocument() override { WPXContentListener::startDocument(); } - void startSubDocument() + void startSubDocument() override { WPXContentListener::startSubDocument(); } - void insertCharacter(unsigned character); - void insertExtendedCharacter(unsigned char extendedCharacter); - void insertTab(); - void insertBreak(unsigned char breakType) + void insertCharacter(unsigned character) override; + void insertExtendedCharacter(unsigned char extendedCharacter) override; + void insertTab() override; + void insertBreak(unsigned char breakType) override { WPXContentListener::insertBreak(breakType); } - void insertEOL(); - void insertNote(WPXNoteType noteType, WP1SubDocument *subDocument); - void attributeChange(bool isOn, unsigned char attribute); - void fontPointSize(unsigned char pointSize); - void fontId(unsigned short id); - void marginReset(unsigned short leftMargin, unsigned short rightMargin); - void topMarginSet(unsigned short /* topMargin */) {} - void bottomMarginSet(unsigned short /* bottomMargin */) {} - void leftIndent(unsigned short leftMarginOffset); - void leftRightIndent(unsigned short leftRightMarginOffset); - void leftMarginRelease(unsigned short release); - void setTabs(const std::vector &tabStops); - void headerFooterGroup(unsigned char headerFooterDefinition, WP1SubDocument *subDocument); - void suppressPageCharacteristics(unsigned char /* suppressCode */) {} - void justificationChange(unsigned char justification); - void lineSpacingChange(unsigned char spacing) + void insertEOL() override; + void insertNote(WPXNoteType noteType, WP1SubDocument *subDocument) override; + void attributeChange(bool isOn, unsigned char attribute) override; + void fontPointSize(unsigned char pointSize) override; + void fontId(unsigned short id) override; + void marginReset(unsigned short leftMargin, unsigned short rightMargin) override; + void topMarginSet(unsigned short /* topMargin */) override {} + void bottomMarginSet(unsigned short /* bottomMargin */) override {} + void leftIndent(unsigned short leftMarginOffset) override; + void leftRightIndent(unsigned short leftRightMarginOffset) override; + void leftMarginRelease(unsigned short release) override; + void setTabs(const std::vector &tabStops) override; + void headerFooterGroup(unsigned char headerFooterDefinition, WP1SubDocument *subDocument) override; + void suppressPageCharacteristics(unsigned char /* suppressCode */) override {} + void justificationChange(unsigned char justification) override; + void lineSpacingChange(unsigned char spacing) override { WPXContentListener::lineSpacingChange((double)((double)spacing/2.0)); } - void flushRightOn(); - void flushRightOff() {} - void centerOn(); - void centerOff() {} - void endDocument() + void flushRightOn() override; + void flushRightOff() override {} + void centerOn() override; + void centerOff() override {} + void endDocument() override { WPXContentListener::endDocument(); } - void endSubDocument() + void endSubDocument() override { WPXContentListener::endSubDocument(); } - void insertPicture(unsigned short width, unsigned short height, const librevenge::RVNGBinaryData &binaryData); + void insertPicture(unsigned short width, unsigned short height, const librevenge::RVNGBinaryData &binaryData) override; protected: using WPXContentListener::lineSpacingChange; - void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0); + void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0) override; - void _flushText(); - void _changeList() {} + void _flushText() override; + void _changeList() override {} private: - WP1ContentParsingState *m_parseState; + std::unique_ptr m_parseState; std::vector &m_subDocuments; WP1ContentListener(const WP1ContentListener &); WP1ContentListener &operator=(WP1ContentListener &); diff -Nru libwpd-0.10.1/src/lib/WP1ExtendedCharacterGroup.h libwpd-0.10.2/src/lib/WP1ExtendedCharacterGroup.h --- libwpd-0.10.1/src/lib/WP1ExtendedCharacterGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1ExtendedCharacterGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,9 +32,9 @@ { public: WP1ExtendedCharacterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1ExtendedCharacterGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener *listener); + ~WP1ExtendedCharacterGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener *listener) override; private: unsigned char m_extendedCharacter; diff -Nru libwpd-0.10.1/src/lib/WP1FixedLengthGroup.h libwpd-0.10.2/src/lib/WP1FixedLengthGroup.h --- libwpd-0.10.1/src/lib/WP1FixedLengthGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1FixedLengthGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,7 +34,7 @@ { public: WP1FixedLengthGroup(unsigned char group); // WP1FixedLengthGroup should _never_ be constructed, only its inherited classes - virtual ~WP1FixedLengthGroup() {} + ~WP1FixedLengthGroup() override {} static WP1FixedLengthGroup *constructFixedLengthGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); diff -Nru libwpd-0.10.1/src/lib/WP1FlushRightGroup.h libwpd-0.10.2/src/lib/WP1FlushRightGroup.h --- libwpd-0.10.1/src/lib/WP1FlushRightGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1FlushRightGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,8 +32,8 @@ { public: WP1FlushRightGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1FlushRightGroup(); - void parse(WP1Listener *listener); + ~WP1FlushRightGroup() override; + void parse(WP1Listener *listener) override; }; #endif /* WP1FLUSHRIGHTGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP1FontIdGroup.h libwpd-0.10.2/src/lib/WP1FontIdGroup.h --- libwpd-0.10.1/src/lib/WP1FontIdGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1FontIdGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,9 +32,9 @@ { public: WP1FontIdGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1FontIdGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener *listener); + ~WP1FontIdGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener *listener) override; private: unsigned short m_oldFontId, m_newFontId; diff -Nru libwpd-0.10.1/src/lib/WP1FootnoteEndnoteGroup.cpp libwpd-0.10.2/src/lib/WP1FootnoteEndnoteGroup.cpp --- libwpd-0.10.1/src/lib/WP1FootnoteEndnoteGroup.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1FootnoteEndnoteGroup.cpp 2017-07-29 06:20:15.000000000 +0000 @@ -31,15 +31,13 @@ WP1VariableLengthGroup(group), m_noteType(FOOTNOTE), m_noteNumber(0), - m_subDocument(0) + m_subDocument() { _read(input, encryption); } WP1FootnoteEndnoteGroup::~WP1FootnoteEndnoteGroup() { - if (m_subDocument) - delete m_subDocument; } void WP1FootnoteEndnoteGroup::_readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) @@ -57,12 +55,12 @@ WPD_DEBUG_MSG(("WP1SubDocument subDocumentSize = %u\n", tmpSubDocumentSize)); if (tmpSubDocumentSize) - m_subDocument = new WP1SubDocument(input, encryption, tmpSubDocumentSize); + m_subDocument.reset(new WP1SubDocument(input, encryption, tmpSubDocumentSize)); } void WP1FootnoteEndnoteGroup::parse(WP1Listener *listener) { WPD_DEBUG_MSG(("WordPerfect: handling a Footnote Endnote group\n")); - listener->insertNote(m_noteType, m_subDocument); + listener->insertNote(m_noteType, m_subDocument.get()); } /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP1FootnoteEndnoteGroup.h libwpd-0.10.2/src/lib/WP1FootnoteEndnoteGroup.h --- libwpd-0.10.1/src/lib/WP1FootnoteEndnoteGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1FootnoteEndnoteGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -26,6 +26,8 @@ #ifndef WP1FOOTNOTEENDNOTEGROUP_H #define WP1FOOTNOTEENDNOTEGROUP_H +#include + #include "WP1VariableLengthGroup.h" #include "libwpd_internal.h" @@ -35,16 +37,16 @@ { public: WP1FootnoteEndnoteGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1FootnoteEndnoteGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener *listener); + ~WP1FootnoteEndnoteGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener *listener) override; private: WP1FootnoteEndnoteGroup(const WP1FootnoteEndnoteGroup &); WP1FootnoteEndnoteGroup &operator=(const WP1FootnoteEndnoteGroup &); WPXNoteType m_noteType; unsigned short m_noteNumber; - WP1SubDocument *m_subDocument; + std::unique_ptr m_subDocument; }; #endif /* WP1FOOTNOTEENDNOTEGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP1HeaderFooterGroup.cpp libwpd-0.10.2/src/lib/WP1HeaderFooterGroup.cpp --- libwpd-0.10.1/src/lib/WP1HeaderFooterGroup.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1HeaderFooterGroup.cpp 2017-09-12 14:52:32.000000000 +0000 @@ -30,7 +30,7 @@ WP1HeaderFooterGroup::WP1HeaderFooterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group) : WP1VariableLengthGroup(group), m_definition(0), - m_subDocument(0) + m_subDocument(nullptr) { _read(input, encryption); } @@ -43,7 +43,7 @@ { m_definition = readU8(input, encryption); - unsigned tmpSubDocumentSize = getSize() - 0x13; + const unsigned tmpSubDocumentSize = getSize() > 0x13 ? getSize() - 0x13 : 0; input->seek(18, librevenge::RVNG_SEEK_CUR); WPD_DEBUG_MSG(("WP1SubDocument subDocumentSize = %u\n", tmpSubDocumentSize)); if (tmpSubDocumentSize) diff -Nru libwpd-0.10.1/src/lib/WP1HeaderFooterGroup.h libwpd-0.10.2/src/lib/WP1HeaderFooterGroup.h --- libwpd-0.10.1/src/lib/WP1HeaderFooterGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1HeaderFooterGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,9 +34,9 @@ { public: WP1HeaderFooterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1HeaderFooterGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener *listener); + ~WP1HeaderFooterGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener *listener) override; private: WP1HeaderFooterGroup(const WP1HeaderFooterGroup &); diff -Nru libwpd-0.10.1/src/lib/WP1Heuristics.cpp libwpd-0.10.2/src/lib/WP1Heuristics.cpp --- libwpd-0.10.1/src/lib/WP1Heuristics.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1Heuristics.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -29,216 +29,157 @@ #include "WP1FileStructure.h" #include "libwpd_internal.h" #include +#include using namespace libwpd; -WPDPasswordMatch WP1Heuristics::verifyPassword(librevenge::RVNGInputStream *input, const char *password) +WPDPasswordMatch WP1Heuristics::verifyPassword(librevenge::RVNGInputStream *input, const char *password) try { if (!password) return WPD_PASSWORD_MATCH_DONTKNOW; input->seek(0, librevenge::RVNG_SEEK_SET); - WPXEncryption *encryption = 0; - try + if (readU8(input, nullptr) == 0xFE && readU8(input, nullptr) == 0xFF && + readU8(input, nullptr) == 0x61 && readU8(input, nullptr) == 0x61) { - if (readU8(input, 0) == 0xFE && readU8(input, 0) == 0xFF && - readU8(input, 0) == 0x61 && readU8(input, 0) == 0x61) - { - encryption = new WPXEncryption(password, 6); - if (readU16(input, 0, true) == encryption->getCheckSum()) - { - delete encryption; - return WPD_PASSWORD_MATCH_OK; - } - else - { - delete encryption; - return WPD_PASSWORD_MATCH_NONE; - } - } + WPXEncryption encryption(password, 6); + if (readU16(input, nullptr, true) == encryption.getCheckSum()) + return WPD_PASSWORD_MATCH_OK; else - return WPD_PASSWORD_MATCH_DONTKNOW; + return WPD_PASSWORD_MATCH_NONE; } - catch (...) - { - if (encryption) - delete encryption; + else return WPD_PASSWORD_MATCH_DONTKNOW; - } +} +catch (...) +{ + return WPD_PASSWORD_MATCH_DONTKNOW; } -WPDConfidence WP1Heuristics::isWP1FileFormat(librevenge::RVNGInputStream *input, const char *password) +WPDConfidence WP1Heuristics::isWP1FileFormat(librevenge::RVNGInputStream *input, const char *password) try { input->seek(0, librevenge::RVNG_SEEK_SET); - WPXEncryption *encryption = 0; + std::unique_ptr encryption; - try + if (readU8(input, nullptr) == 0xFE && readU8(input, nullptr) == 0xFF && + readU8(input, nullptr) == 0x61 && readU8(input, nullptr) == 0x61) { - if (readU8(input, 0) == 0xFE && readU8(input, 0) == 0xFF && - readU8(input, 0) == 0x61 && readU8(input, 0) == 0x61) + if (password) { - if (password) - { - encryption = new WPXEncryption(password, 6); - if (readU16(input, 0, true) != encryption->getCheckSum()) - { - delete encryption; - return WPD_CONFIDENCE_SUPPORTED_ENCRYPTION; - } - } - else - { - if (readU16(input,0) != 0x0000) - return WPD_CONFIDENCE_SUPPORTED_ENCRYPTION; - } + encryption.reset(new WPXEncryption(password, 6)); + if (readU16(input, nullptr, true) != encryption->getCheckSum()) + return WPD_CONFIDENCE_SUPPORTED_ENCRYPTION; } - - input->seek(0, librevenge::RVNG_SEEK_SET); - if (password && encryption) - input->seek(6, librevenge::RVNG_SEEK_SET); - - int functionGroupCount = 0; - - WPD_DEBUG_MSG(("WP1Heuristics::isWP1FileFormat()\n")); - - while (!input->isEnd()) + else { - unsigned char readVal = readU8(input, encryption); + if (readU16(input,nullptr) != 0x0000) + return WPD_CONFIDENCE_SUPPORTED_ENCRYPTION; + } + } - WPD_DEBUG_MSG(("WP1Heuristics, Offset 0x%.8x, value 0x%.2x (%c)\n", (unsigned int)input->tell() - 1, readVal, readVal)); + input->seek(0, librevenge::RVNG_SEEK_SET); + if (password && encryption) + input->seek(6, librevenge::RVNG_SEEK_SET); - if (readVal < (unsigned char)0x20) - { - // line breaks et al, skip - } - else if (readVal >= (unsigned char)0x20 && readVal <= (unsigned char)0x7F) - { - // normal ASCII characters, skip - } - else if (readVal >= (unsigned char)0x80 && readVal <= (unsigned char)0xBF) - { - // single character function codes, skip - functionGroupCount++; - } - else if (readVal >= (unsigned char)0xFF) - { - if (encryption) - delete encryption; - // special codes that should not be found as separate functions - return WPD_CONFIDENCE_NONE; - } - else - { - // multi character function group - // check that the size constrains are valid, and that every group_member - // is properly closed at the right place + int functionGroupCount = 0; - if (WP1_FUNCTION_GROUP_SIZE[readVal-0xC0] == -1) - { - // variable length function group + WPD_DEBUG_MSG(("WP1Heuristics::isWP1FileFormat()\n")); - // We are checking following structure: - // {function length}...{function length} - // that we observed in variable length WP1 functions - - unsigned functionLength = readU32(input, encryption, true); - if (functionLength > ((std::numeric_limits::max)() / 2)) - { - if (encryption) - delete encryption; - return WPD_CONFIDENCE_NONE; - } - if (functionLength == 0) - { - if (encryption) - delete encryption; - return WPD_CONFIDENCE_NONE; - } - WPD_DEBUG_MSG(("WP1Heuristics functionLength = 0x%.8x\n", (unsigned int)functionLength)); + while (!input->isEnd()) + { + unsigned char readVal = readU8(input, encryption.get()); - input->seek(functionLength, librevenge::RVNG_SEEK_CUR); - unsigned long closingFunctionLength = readU32(input, encryption, true); - WPD_DEBUG_MSG(("WP1Heuristics closingFunctionLength = 0x%.8x\n", (unsigned int)closingFunctionLength)); - if (functionLength != closingFunctionLength) - { - if (encryption) - delete encryption; - return WPD_CONFIDENCE_NONE; - } + WPD_DEBUG_MSG(("WP1Heuristics, Offset 0x%.8x, value 0x%.2x (%c)\n", (unsigned int)input->tell() - 1, readVal, readVal)); - unsigned char closingGate = 0; - if (!input->isEnd()) - { - closingGate = readU8(input, encryption); - WPD_DEBUG_MSG(("WP1Heuristics closingGate = 0x%.2x\n", closingGate)); - if (closingGate != readVal) - { - if (encryption) - delete encryption; - return WPD_CONFIDENCE_NONE; - } - } - - // when passed the complete file, we don't allow for open groups when we've reached EOF - if (input->isEnd() && (closingGate != readVal)) - { - if (encryption) - delete encryption; - return WPD_CONFIDENCE_NONE; - } + if (readVal < (unsigned char)0x20) + { + // line breaks et al, skip + } + else if (readVal >= (unsigned char)0x20 && readVal <= (unsigned char)0x7F) + { + // normal ASCII characters, skip + } + else if (readVal >= (unsigned char)0x80 && readVal <= (unsigned char)0xBF) + { + // single character function codes, skip + functionGroupCount++; + } + else if (readVal >= (unsigned char)0xFF) + { + // special codes that should not be found as separate functions + return WPD_CONFIDENCE_NONE; + } + else + { + // multi character function group + // check that the size constrains are valid, and that every group_member + // is properly closed at the right place + + if (WP1_FUNCTION_GROUP_SIZE[readVal-0xC0] == -1) + { + // variable length function group + + // We are checking following structure: + // {function length}...{function length} + // that we observed in variable length WP1 functions + + unsigned functionLength = readU32(input, encryption.get(), true); + if (functionLength == 0 || functionLength > ((std::numeric_limits::max)() / 2)) + return WPD_CONFIDENCE_NONE; + WPD_DEBUG_MSG(("WP1Heuristics functionLength = 0x%.8x\n", (unsigned int)functionLength)); + + input->seek(functionLength, librevenge::RVNG_SEEK_CUR); + unsigned long closingFunctionLength = readU32(input, encryption.get(), true); + WPD_DEBUG_MSG(("WP1Heuristics closingFunctionLength = 0x%.8x\n", (unsigned int)closingFunctionLength)); + if (functionLength != closingFunctionLength) + return WPD_CONFIDENCE_NONE; - functionGroupCount++; - } - else + unsigned char closingGate = 0; + if (!input->isEnd()) { - // fixed length function group - - // seek to the position where the closing gate should be - int res = input->seek(WP1_FUNCTION_GROUP_SIZE[readVal-0xC0]-2, librevenge::RVNG_SEEK_CUR); - // when passed the complete file, we should be able to do that - if (res) - { - if (encryption) - delete encryption; + closingGate = readU8(input, encryption.get()); + WPD_DEBUG_MSG(("WP1Heuristics closingGate = 0x%.2x\n", closingGate)); + if (closingGate != readVal) return WPD_CONFIDENCE_NONE; - } + } - // read the closing gate - unsigned char readNextVal = readU8(input, encryption); - if (readNextVal != readVal) - { - if (encryption) - delete encryption; - return WPD_CONFIDENCE_NONE; - } + // when passed the complete file, we don't allow for open groups when we've reached EOF + if (input->isEnd() && (closingGate != readVal)) + return WPD_CONFIDENCE_NONE; - functionGroupCount++; - } + functionGroupCount++; } - } - - /* When we get here, the document is in a format that we *could* import properly. - However, if we didn't encounter a single WP1 function group) we need to be more carefull: - this would be the case when passed a plaintext file for example, which libwpd is not - supposed to handle. */ - if (!functionGroupCount) - { - if (encryption) + else { - delete encryption; - return WPD_CONFIDENCE_EXCELLENT; + // fixed length function group + + // seek to the position where the closing gate should be + int res = input->seek(WP1_FUNCTION_GROUP_SIZE[readVal-0xC0]-2, librevenge::RVNG_SEEK_CUR); + // when passed the complete file, we should be able to do that + if (res) + return WPD_CONFIDENCE_NONE; + + // read the closing gate + unsigned char readNextVal = readU8(input, encryption.get()); + if (readNextVal != readVal) + return WPD_CONFIDENCE_NONE; + + functionGroupCount++; } - return WPD_CONFIDENCE_NONE; } - if (encryption) - delete encryption; - return WPD_CONFIDENCE_EXCELLENT; } - catch (...) - { - if (encryption) - delete encryption; + + /* When we get here, the document is in a format that we *could* import properly. + However, if we didn't encounter a single WP1 function group) we need to be more carefull: + this would be the case when passed a plaintext file for example, which libwpd is not + supposed to handle. */ + if (!functionGroupCount && !encryption) return WPD_CONFIDENCE_NONE; - } + return WPD_CONFIDENCE_EXCELLENT; +} +catch (...) +{ + return WPD_CONFIDENCE_NONE; } + /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP1Heuristics.h libwpd-0.10.2/src/lib/WP1Heuristics.h --- libwpd-0.10.1/src/lib/WP1Heuristics.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1Heuristics.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,7 +34,7 @@ class WP1Heuristics { public: - static libwpd::WPDConfidence isWP1FileFormat(librevenge::RVNGInputStream *input, const char *password = 0); + static libwpd::WPDConfidence isWP1FileFormat(librevenge::RVNGInputStream *input, const char *password = nullptr); static libwpd::WPDPasswordMatch verifyPassword(librevenge::RVNGInputStream *input, const char *password); }; diff -Nru libwpd-0.10.1/src/lib/WP1JustificationGroup.h libwpd-0.10.2/src/lib/WP1JustificationGroup.h --- libwpd-0.10.1/src/lib/WP1JustificationGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1JustificationGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,9 +32,9 @@ { public: WP1JustificationGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1JustificationGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener *listener); + ~WP1JustificationGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener *listener) override; private: unsigned char m_justification; diff -Nru libwpd-0.10.1/src/lib/WP1LeftIndentGroup.h libwpd-0.10.2/src/lib/WP1LeftIndentGroup.h --- libwpd-0.10.1/src/lib/WP1LeftIndentGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1LeftIndentGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,9 +32,9 @@ { public: WP1LeftIndentGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1LeftIndentGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener *listener); + ~WP1LeftIndentGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener *listener) override; private: unsigned short m_oldLeftMargin, m_newLeftMargin; diff -Nru libwpd-0.10.1/src/lib/WP1LeftRightIndentGroup.h libwpd-0.10.2/src/lib/WP1LeftRightIndentGroup.h --- libwpd-0.10.1/src/lib/WP1LeftRightIndentGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1LeftRightIndentGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,9 +32,9 @@ { public: WP1LeftRightIndentGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1LeftRightIndentGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener *listener); + ~WP1LeftRightIndentGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener *listener) override; private: unsigned short m_leftRightMarginOffset; diff -Nru libwpd-0.10.1/src/lib/WP1MarginReleaseGroup.h libwpd-0.10.2/src/lib/WP1MarginReleaseGroup.h --- libwpd-0.10.1/src/lib/WP1MarginReleaseGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1MarginReleaseGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,9 +32,9 @@ { public: WP1MarginReleaseGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1MarginReleaseGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener *listener); + ~WP1MarginReleaseGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener *listener) override; private: unsigned short m_release; diff -Nru libwpd-0.10.1/src/lib/WP1MarginResetGroup.h libwpd-0.10.2/src/lib/WP1MarginResetGroup.h --- libwpd-0.10.1/src/lib/WP1MarginResetGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1MarginResetGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -35,9 +35,9 @@ { public: WP1MarginResetGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1MarginResetGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener *listener); + ~WP1MarginResetGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener *listener) override; private: unsigned short m_leftMargin, m_rightMargin; diff -Nru libwpd-0.10.1/src/lib/WP1Parser.cpp libwpd-0.10.2/src/lib/WP1Parser.cpp --- libwpd-0.10.1/src/lib/WP1Parser.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1Parser.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -26,6 +26,9 @@ */ #include "WP1Parser.h" + +#include + #include "WP1Part.h" #include "libwpd_internal.h" #include "WP1FileStructure.h" @@ -33,7 +36,7 @@ #include "WP1ContentListener.h" WP1Parser::WP1Parser(librevenge::RVNGInputStream *input, WPXEncryption *encryption) : - WPXParser(input, 0, encryption) + WPXParser(input, nullptr, encryption) { } @@ -173,12 +176,9 @@ } else if (readVal >= (unsigned char)0xC0 && readVal <= (unsigned char)0xFE) { - WP1Part *part = WP1Part::constructPart(input, encryption, readVal); + std::unique_ptr part(WP1Part::constructPart(input, encryption, readVal)); if (part) - { part->parse(listener); - DELETEP(part); - } } // ignore the rest since they are not documented and at least 0xFF is a special character that // marks end of variable length part in variable length multi-byte functions @@ -221,20 +221,20 @@ parse(input, encryption, &listener); // cleanup section: free the used resources - for (std::vector::iterator iterSubDoc = subDocuments.begin(); iterSubDoc != subDocuments.end(); ++iterSubDoc) + for (auto &subDocument : subDocuments) { - if (*iterSubDoc) - delete(*iterSubDoc); + if (subDocument) + delete subDocument; } } catch (FileException) { WPD_DEBUG_MSG(("WordPerfect: File Exception. Parse terminated prematurely.")); - for (std::vector::iterator iterSubDoc = subDocuments.begin(); iterSubDoc != subDocuments.end(); ++iterSubDoc) + for (auto &subDocument : subDocuments) { - if (*iterSubDoc) - delete(*iterSubDoc); + if (subDocument) + delete subDocument; } throw FileException(); @@ -253,26 +253,26 @@ { WP1StylesListener stylesListener(pageList, subDocuments); stylesListener.startSubDocument(); - parseDocument(input, 0, &stylesListener); + parseDocument(input, nullptr, &stylesListener); stylesListener.endSubDocument(); input->seek(0, librevenge::RVNG_SEEK_SET); WP1ContentListener listener(pageList, subDocuments, documentInterface); listener.startSubDocument(); - parseDocument(input, 0, &listener); + parseDocument(input, nullptr, &listener); listener.endSubDocument(); - for (std::vector::iterator iterSubDoc = subDocuments.begin(); iterSubDoc != subDocuments.end(); ++iterSubDoc) - if (*iterSubDoc) - delete(*iterSubDoc); + for (auto &subDocument : subDocuments) + if (subDocument) + delete subDocument; } catch (FileException) { WPD_DEBUG_MSG(("WordPerfect: File Exception. Parse terminated prematurely.")); - for (std::vector::iterator iterSubDoc = subDocuments.begin(); iterSubDoc != subDocuments.end(); ++iterSubDoc) - if (*iterSubDoc) - delete(*iterSubDoc); + for (auto &subDocument : subDocuments) + if (subDocument) + delete subDocument; throw FileException(); } diff -Nru libwpd-0.10.1/src/lib/WP1Parser.h libwpd-0.10.2/src/lib/WP1Parser.h --- libwpd-0.10.1/src/lib/WP1Parser.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1Parser.h 2017-09-08 17:04:25.000000000 +0000 @@ -37,10 +37,10 @@ { public: WP1Parser(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP1Parser(); + ~WP1Parser() override; - void parse(librevenge::RVNGTextInterface *documentInterface); - void parseSubDocument(librevenge::RVNGTextInterface *documentInterface); + void parse(librevenge::RVNGTextInterface *documentInterface) override; + void parseSubDocument(librevenge::RVNGTextInterface *documentInterface) override; static void parseDocument(librevenge::RVNGInputStream *input, WPXEncryption *encryption, WP1Listener *listener); diff -Nru libwpd-0.10.1/src/lib/WP1Part.cpp libwpd-0.10.2/src/lib/WP1Part.cpp --- libwpd-0.10.1/src/lib/WP1Part.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1Part.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -43,7 +43,7 @@ if (((unsigned char)0xC0 > readVal) || ((unsigned char)0xFE < readVal)) { WPD_DEBUG_MSG(("WordPerfect: Returning 0 from constructPart\n")); - return 0; + return nullptr; } else if (WP1_FUNCTION_GROUP_SIZE[readVal-0xC0] == -1) { @@ -52,7 +52,7 @@ if (!WP1VariableLengthGroup::isGroupConsistent(input, encryption, readVal)) { WPD_DEBUG_MSG(("WordPerfect: Consistency Check (variable length) failed; ignoring this byte\n")); - return 0; + return nullptr; } WPD_DEBUG_MSG(("WordPerfect: constructVariableLengthGroup\n")); return WP1VariableLengthGroup::constructVariableLengthGroup(input, encryption, readVal); diff -Nru libwpd-0.10.1/src/lib/WP1PictureGroup.h libwpd-0.10.2/src/lib/WP1PictureGroup.h --- libwpd-0.10.1/src/lib/WP1PictureGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1PictureGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -35,9 +35,9 @@ { public: WP1PictureGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1PictureGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener *listener); + ~WP1PictureGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener *listener) override; private: WP1PictureGroup(const WP1PictureGroup &); diff -Nru libwpd-0.10.1/src/lib/WP1PointSizeGroup.h libwpd-0.10.2/src/lib/WP1PointSizeGroup.h --- libwpd-0.10.1/src/lib/WP1PointSizeGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1PointSizeGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,9 +32,9 @@ { public: WP1PointSizeGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1PointSizeGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener *listener); + ~WP1PointSizeGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener *listener) override; private: unsigned char m_pointSize; diff -Nru libwpd-0.10.1/src/lib/WP1SetTabsGroup.h libwpd-0.10.2/src/lib/WP1SetTabsGroup.h --- libwpd-0.10.1/src/lib/WP1SetTabsGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1SetTabsGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,9 +32,9 @@ { public: WP1SetTabsGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1SetTabsGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener *listener); + ~WP1SetTabsGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener *listener) override; private: std::vector m_tabStops; diff -Nru libwpd-0.10.1/src/lib/WP1SpacingResetGroup.h libwpd-0.10.2/src/lib/WP1SpacingResetGroup.h --- libwpd-0.10.1/src/lib/WP1SpacingResetGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1SpacingResetGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,9 +32,9 @@ { public: WP1SpacingResetGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1SpacingResetGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener *listener); + ~WP1SpacingResetGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener *listener) override; private: unsigned char m_spacing; diff -Nru libwpd-0.10.1/src/lib/WP1StylesListener.cpp libwpd-0.10.2/src/lib/WP1StylesListener.cpp --- libwpd-0.10.1/src/lib/WP1StylesListener.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1StylesListener.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -83,19 +83,19 @@ m_currentPage = WPXPageSpan(m_pageList.back(), 0.0, 0.0); m_currentPage.setPageSpan(1); - for (std::vector::const_iterator HFiter = (m_nextPage.getHeaderFooterList()).begin(); - HFiter != (m_nextPage.getHeaderFooterList()).end(); ++HFiter) + auto headerFooterList = m_nextPage.getHeaderFooterList(); + for (const auto &hf : headerFooterList) { - if ((*HFiter).getOccurrence() != NEVER) + if (hf.getOccurrence() != NEVER) { - m_currentPage.setHeaderFooter((*HFiter).getType(), (*HFiter).getInternalType(), - (*HFiter).getOccurrence(), (*HFiter).getSubDocument(), (*HFiter).getTableList()); - _handleSubDocument((*HFiter).getSubDocument(), WPX_SUBDOCUMENT_HEADER_FOOTER, (*HFiter).getTableList()); + m_currentPage.setHeaderFooter(hf.getType(), hf.getInternalType(), + hf.getOccurrence(), hf.getSubDocument(), hf.getTableList()); + _handleSubDocument(hf.getSubDocument(), WPX_SUBDOCUMENT_HEADER_FOOTER, hf.getTableList()); } else { - m_currentPage.setHeaderFooter((*HFiter).getType(), (*HFiter).getInternalType(), - (*HFiter).getOccurrence(), 0, (*HFiter).getTableList()); + m_currentPage.setHeaderFooter(hf.getType(), hf.getInternalType(), + hf.getOccurrence(), nullptr, hf.getTableList()); } } m_nextPage = WPXPageSpan(); @@ -222,7 +222,7 @@ _handleSubDocument(subDocument, WPX_SUBDOCUMENT_HEADER_FOOTER, tableList); } else - m_currentPage.setHeaderFooter(wpxType, headerFooterType, wpxOccurrence, 0, tableList); + m_currentPage.setHeaderFooter(wpxType, headerFooterType, wpxOccurrence, nullptr, tableList); } m_currentPageHasContent = tempCurrentPageHasContent; } diff -Nru libwpd-0.10.1/src/lib/WP1StylesListener.h libwpd-0.10.2/src/lib/WP1StylesListener.h --- libwpd-0.10.1/src/lib/WP1StylesListener.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1StylesListener.h 2017-09-08 17:04:25.000000000 +0000 @@ -39,55 +39,55 @@ { public: WP1StylesListener(std::list &pageList, std::vector &subDocuments); - ~WP1StylesListener() {} + ~WP1StylesListener() override {} - void startDocument() {} - void startSubDocument() {} - void insertCharacter(unsigned /* character */) + void startDocument() override {} + void startSubDocument() override {} + void insertCharacter(unsigned /* character */) override { if (!isUndoOn()) m_currentPageHasContent = true; } - void insertExtendedCharacter(unsigned char /* extendedCharacter */) + void insertExtendedCharacter(unsigned char /* extendedCharacter */) override { if (!isUndoOn()) m_currentPageHasContent = true; } - void insertTab() + void insertTab() override { if (!isUndoOn()) m_currentPageHasContent = true; } - void insertEOL() + void insertEOL() override { if (!isUndoOn()) m_currentPageHasContent = true; } - void insertBreak(unsigned char breakType); - void insertNote(WPXNoteType /* noteType */, WP1SubDocument * /* subDocument */) {} - void attributeChange(bool /* isOn */, unsigned char /* attribute */) {} - void fontPointSize(unsigned char /* pointSize */) {} - void fontId(unsigned short /* id */) {} - void marginReset(unsigned short leftMargin, unsigned short rightMargin); - void topMarginSet(unsigned short topMargin); - void bottomMarginSet(unsigned short bottomMargin); - void leftIndent(unsigned short /* leftMarginOffset */) + void insertBreak(unsigned char breakType) override; + void insertNote(WPXNoteType /* noteType */, WP1SubDocument * /* subDocument */) override {} + void attributeChange(bool /* isOn */, unsigned char /* attribute */) override {} + void fontPointSize(unsigned char /* pointSize */) override {} + void fontId(unsigned short /* id */) override {} + void marginReset(unsigned short leftMargin, unsigned short rightMargin) override; + void topMarginSet(unsigned short topMargin) override; + void bottomMarginSet(unsigned short bottomMargin) override; + void leftIndent(unsigned short /* leftMarginOffset */) override { if (!isUndoOn()) m_currentPageHasContent = true; } - void leftRightIndent(unsigned short /* leftRightMarginOffset */) + void leftRightIndent(unsigned short /* leftRightMarginOffset */) override { if (!isUndoOn()) m_currentPageHasContent = true; } - void leftMarginRelease(unsigned short /* release */) {} - void setTabs(const std::vector & /* tabStops */) {} - void headerFooterGroup(unsigned char headerFooterDefinition, WP1SubDocument *subDocument); - void suppressPageCharacteristics(unsigned char suppressCode); - void justificationChange(unsigned char /* justification */) {} - void lineSpacingChange(unsigned char /* spacing */) {} - void flushRightOn() {} - void flushRightOff() {} - void centerOn() {} - void centerOff() {} - void endDocument(); - void endSubDocument(); - void insertPicture(unsigned short /* width */, unsigned short /* height */, const librevenge::RVNGBinaryData & /* binaryData */) {} + void leftMarginRelease(unsigned short /* release */) override {} + void setTabs(const std::vector & /* tabStops */) override {} + void headerFooterGroup(unsigned char headerFooterDefinition, WP1SubDocument *subDocument) override; + void suppressPageCharacteristics(unsigned char suppressCode) override; + void justificationChange(unsigned char /* justification */) override {} + void lineSpacingChange(unsigned char /* spacing */) override {} + void flushRightOn() override {} + void flushRightOff() override {} + void centerOn() override {} + void centerOff() override {} + void endDocument() override; + void endSubDocument() override; + void insertPicture(unsigned short /* width */, unsigned short /* height */, const librevenge::RVNGBinaryData & /* binaryData */) override {} protected: void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0); diff -Nru libwpd-0.10.1/src/lib/WP1SubDocument.cpp libwpd-0.10.2/src/lib/WP1SubDocument.cpp --- libwpd-0.10.1/src/lib/WP1SubDocument.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1SubDocument.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -38,6 +38,6 @@ if (!tmpStream) return; tmpStream->seek(0, librevenge::RVNG_SEEK_SET); - WP1Parser::parseDocument(tmpStream, 0, listener); + WP1Parser::parseDocument(tmpStream, nullptr, listener); } /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP1SuppressPageCharacteristicsGroup.h libwpd-0.10.2/src/lib/WP1SuppressPageCharacteristicsGroup.h --- libwpd-0.10.1/src/lib/WP1SuppressPageCharacteristicsGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1SuppressPageCharacteristicsGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,9 +32,9 @@ { public: WP1SuppressPageCharacteristicsGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1SuppressPageCharacteristicsGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener *listener); + ~WP1SuppressPageCharacteristicsGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener *listener) override; private: unsigned char m_suppressCode; diff -Nru libwpd-0.10.1/src/lib/WP1TopMarginGroup.h libwpd-0.10.2/src/lib/WP1TopMarginGroup.h --- libwpd-0.10.1/src/lib/WP1TopMarginGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1TopMarginGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,9 +32,9 @@ { public: WP1TopMarginGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP1TopMarginGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener *listener); + ~WP1TopMarginGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener *listener) override; private: unsigned short m_topMargin; diff -Nru libwpd-0.10.1/src/lib/WP1UnsupportedFixedLengthGroup.h libwpd-0.10.2/src/lib/WP1UnsupportedFixedLengthGroup.h --- libwpd-0.10.1/src/lib/WP1UnsupportedFixedLengthGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1UnsupportedFixedLengthGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -38,8 +38,8 @@ public: WP1UnsupportedFixedLengthGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener * /* listener */) {} + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener * /* listener */) override {} }; #endif /* WP1UNSUPPORTEDFIXEDLENGTHGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP1UnsupportedVariableLengthGroup.h libwpd-0.10.2/src/lib/WP1UnsupportedVariableLengthGroup.h --- libwpd-0.10.1/src/lib/WP1UnsupportedVariableLengthGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1UnsupportedVariableLengthGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -38,8 +38,8 @@ public: WP1UnsupportedVariableLengthGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP1Listener * /* listener */) {} + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP1Listener * /* listener */) override {} }; #endif /* WP1UNSUPPORTEDVARIABLELENGTHGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP1VariableLengthGroup.h libwpd-0.10.2/src/lib/WP1VariableLengthGroup.h --- libwpd-0.10.1/src/lib/WP1VariableLengthGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP1VariableLengthGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,7 +34,7 @@ { public: WP1VariableLengthGroup(unsigned char group); // WP1VariableLengthGroup should _never_ be constructed, only its inherited classes - virtual ~WP1VariableLengthGroup() {} + ~WP1VariableLengthGroup() override {} static WP1VariableLengthGroup *constructVariableLengthGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); diff -Nru libwpd-0.10.1/src/lib/WP3AttributeGroup.h libwpd-0.10.2/src/lib/WP3AttributeGroup.h --- libwpd-0.10.1/src/lib/WP3AttributeGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3AttributeGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,10 +33,10 @@ { public: WP3AttributeGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP3Listener *listener); + void parse(WP3Listener *listener) override; protected: - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: unsigned char m_attribute; diff -Nru libwpd-0.10.1/src/lib/WP3ContentListener.cpp libwpd-0.10.2/src/lib/WP3ContentListener.cpp --- libwpd-0.10.1/src/lib/WP3ContentListener.cpp 2015-12-30 08:29:11.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3ContentListener.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -38,7 +38,7 @@ m_colSpan(1), m_rowSpan(1), m_textBuffer(), - m_cellFillColor(0), + m_cellFillColor(), m_noteReference(), m_tableList() { @@ -46,7 +46,6 @@ WP3ContentParsingState::~WP3ContentParsingState() { - DELETEP(m_cellFillColor); } WP3ContentListener::WP3ContentListener(std::list &pageList, std::vector &subDocuments, librevenge::RVNGTextInterface *documentInterface) : @@ -59,7 +58,6 @@ WP3ContentListener::~WP3ContentListener() { - delete m_parseState; } @@ -253,8 +251,8 @@ RGBSColor tmpCellBorderColor(0x00, 0x00, 0x00, 0x64); _openTableCell((unsigned char)m_parseState->m_colSpan, (unsigned char)m_parseState->m_rowSpan, 0x00000000, - m_parseState->m_cellFillColor, 0, &tmpCellBorderColor, TOP); - DELETEP(m_parseState->m_cellFillColor); + m_parseState->m_cellFillColor.get(), nullptr, &tmpCellBorderColor, TOP); + m_parseState->m_cellFillColor.reset(); m_ps->m_isCellWithoutParagraph = true; m_ps->m_cellAttributeBits = 0x00000000; @@ -294,11 +292,7 @@ void WP3ContentListener::setTableCellFillColor(const RGBSColor *cellFillColor) { if (!isUndoOn()) - { - if (m_parseState->m_cellFillColor) - DELETEP(m_parseState->m_cellFillColor); - m_parseState->m_cellFillColor = new RGBSColor(*cellFillColor); - } + m_parseState->m_cellFillColor.reset(new RGBSColor(*cellFillColor)); } void WP3ContentListener::endTable() @@ -1118,9 +1112,9 @@ WPXTableList /* tableList */, unsigned /* nextTableIndice */) { // save our old parsing state on our "stack" - WP3ContentParsingState *oldParseState = m_parseState; + auto oldParseState = std::move(m_parseState); - m_parseState = new WP3ContentParsingState(); + m_parseState = std::unique_ptr(new WP3ContentParsingState()); if (subDocumentType == WPX_SUBDOCUMENT_TEXT_BOX || subDocumentType == WPX_SUBDOCUMENT_COMMENT_ANNOTATION) { m_ps->m_pageMarginRight = 0.0; @@ -1155,8 +1149,7 @@ #endif // restore our old parsing state - delete m_parseState; - m_parseState = oldParseState; + m_parseState = std::move(oldParseState); setUndoOn(oldIsUndoOn); } diff -Nru libwpd-0.10.1/src/lib/WP3ContentListener.h libwpd-0.10.2/src/lib/WP3ContentListener.h --- libwpd-0.10.1/src/lib/WP3ContentListener.h 2015-12-30 08:28:21.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3ContentListener.h 2017-09-08 17:04:25.000000000 +0000 @@ -27,6 +27,8 @@ #ifndef WP3CONTENTLISTENER_H #define WP3CONTENTLISTENER_H +#include + #include "WP3Listener.h" #include "WPXContentListener.h" #include "WP3SubDocument.h" @@ -38,7 +40,7 @@ unsigned short m_colSpan; unsigned short m_rowSpan; librevenge::RVNGString m_textBuffer; - RGBSColor *m_cellFillColor; + std::unique_ptr m_cellFillColor; librevenge::RVNGString m_noteReference; WPXTableList m_tableList; @@ -51,84 +53,84 @@ { public: WP3ContentListener(std::list &pageList, std::vector &subDocuments, librevenge::RVNGTextInterface *documentInterface); - ~WP3ContentListener(); + ~WP3ContentListener() override; - void startDocument() + void startDocument() override { WPXContentListener::startDocument(); } - void startSubDocument() + void startSubDocument() override { WPXContentListener::startSubDocument(); } - void insertCharacter(unsigned character); - void insertTab(); - void insertTab(unsigned char tabType, double tabPosition); - void insertBreak(unsigned char breakType) + void insertCharacter(unsigned character) override; + void insertTab() override; + void insertTab(unsigned char tabType, double tabPosition) override; + void insertBreak(unsigned char breakType) override { WPXContentListener::insertBreak(breakType); } - void insertEOL(); - void attributeChange(bool isOn, unsigned char attribute); - void lineSpacingChange(double lineSpacing) + void insertEOL() override; + void attributeChange(bool isOn, unsigned char attribute) override; + void lineSpacingChange(double lineSpacing) override { WPXContentListener::lineSpacingChange(lineSpacing); } - void pageMarginChange(unsigned char /* side */, unsigned short /* margin */) {} - void pageFormChange(unsigned short /* length */, unsigned short /* width */, WPXFormOrientation /* orientation */) {} - void marginChange(unsigned char side, unsigned short margin); - void indentFirstLineChange(double offset); - void setTabs(bool isRelative, const std::vector tabStops); + void pageMarginChange(unsigned char /* side */, unsigned short /* margin */) override {} + void pageFormChange(unsigned short /* length */, unsigned short /* width */, WPXFormOrientation /* orientation */) override {} + void marginChange(unsigned char side, unsigned short margin) override; + void indentFirstLineChange(double offset) override; + void setTabs(bool isRelative, const std::vector tabStops) override; void columnChange(WPXTextColumnType columnType, unsigned char numColumns, const std::vector &columnWidth, - const std::vector &isFixedWidth); - void endDocument() + const std::vector &isFixedWidth) override; + void endDocument() override { WPXContentListener::endDocument(); } - void endSubDocument() + void endSubDocument() override { WPXContentListener::endSubDocument(); } - void defineTable(unsigned char position, unsigned short leftOffset); + void defineTable(unsigned char position, unsigned short leftOffset) override; void addTableColumnDefinition(unsigned width, unsigned leftGutter, unsigned rightGutter, - unsigned attributes, unsigned char alignment); - void startTable(); + unsigned attributes, unsigned char alignment) override; + void startTable() override; void insertRow(); void insertCell(); - void closeCell(); - void closeRow(); - void setTableCellSpan(unsigned short colSpan, unsigned short rowSpan); - void setTableCellFillColor(const RGBSColor *cellFillColor); - void endTable(); - void undoChange(unsigned char undoType, unsigned short undoLevel); - void justificationChange(unsigned char justification); - void setTextColor(const RGBSColor *fontColor); - void setTextFont(const librevenge::RVNGString &fontName); - void setFontSize(unsigned short fontSize); - void insertPageNumber(const librevenge::RVNGString &pageNumber); - void insertNoteReference(const librevenge::RVNGString ¬eReference); - void insertNote(WPXNoteType noteType, const WP3SubDocument *subDocument); - void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP3SubDocument *subDocument); - void suppressPage(unsigned short /* suppressCode */) {} - void backTab(); - void leftIndent(); - void leftIndent(double offset); - void leftRightIndent(); - void leftRightIndent(double offset); + void closeCell() override; + void closeRow() override; + void setTableCellSpan(unsigned short colSpan, unsigned short rowSpan) override; + void setTableCellFillColor(const RGBSColor *cellFillColor) override; + void endTable() override; + void undoChange(unsigned char undoType, unsigned short undoLevel) override; + void justificationChange(unsigned char justification) override; + void setTextColor(const RGBSColor *fontColor) override; + void setTextFont(const librevenge::RVNGString &fontName) override; + void setFontSize(unsigned short fontSize) override; + void insertPageNumber(const librevenge::RVNGString &pageNumber) override; + void insertNoteReference(const librevenge::RVNGString ¬eReference) override; + void insertNote(WPXNoteType noteType, const WP3SubDocument *subDocument) override; + void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP3SubDocument *subDocument) override; + void suppressPage(unsigned short /* suppressCode */) override {} + void backTab() override; + void leftIndent() override; + void leftIndent(double offset) override; + void leftRightIndent() override; + void leftRightIndent(double offset) override; void insertPicture(double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn, - unsigned short figureFlags, const librevenge::RVNGBinaryData &binaryData); + unsigned short figureFlags, const librevenge::RVNGBinaryData &binaryData) override; void insertTextBox(double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn, - unsigned short figureFlags, const WP3SubDocument *subDocument, const WP3SubDocument *caption); + unsigned short figureFlags, const WP3SubDocument *subDocument, const WP3SubDocument *caption) override; void insertWP51Table(double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn, - unsigned short figureFlags, const WP3SubDocument *subDocument, const WP3SubDocument *caption); + unsigned short figureFlags, const WP3SubDocument *subDocument, const WP3SubDocument *caption) override; protected: - void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0); - void _openParagraph(); + void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0) override; + void _openParagraph() override; - void _flushText(); - void _changeList() {} + void _flushText() override; + void _changeList() override {} void _handleFrameParameters(librevenge::RVNGPropertyList &propList, double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn, unsigned short figureFlags); @@ -136,7 +138,7 @@ private: WP3ContentListener(const WP3ContentListener &); WP3ContentListener &operator=(const WP3ContentListener &); - WP3ContentParsingState *m_parseState; + std::unique_ptr m_parseState; std::vector &m_subDocuments; }; diff -Nru libwpd-0.10.1/src/lib/WP3DefinitionGroup.h libwpd-0.10.2/src/lib/WP3DefinitionGroup.h --- libwpd-0.10.1/src/lib/WP3DefinitionGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3DefinitionGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -36,9 +36,9 @@ { public: WP3DefinitionGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP3DefinitionGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP3Listener *listener); + ~WP3DefinitionGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP3Listener *listener) override; private: /* Variables used for subgroup 0x01 Set Columns On/Off */ diff -Nru libwpd-0.10.1/src/lib/WP3DisplayGroup.h libwpd-0.10.2/src/lib/WP3DisplayGroup.h --- libwpd-0.10.1/src/lib/WP3DisplayGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3DisplayGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,9 +34,9 @@ { public: WP3DisplayGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP3DisplayGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP3Listener *listener); + ~WP3DisplayGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP3Listener *listener) override; private: librevenge::RVNGString m_noteReference; diff -Nru libwpd-0.10.1/src/lib/WP3DoubleByteScriptCharacterGroup.h libwpd-0.10.2/src/lib/WP3DoubleByteScriptCharacterGroup.h --- libwpd-0.10.1/src/lib/WP3DoubleByteScriptCharacterGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3DoubleByteScriptCharacterGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -35,10 +35,10 @@ { public: WP3DoubleByteScriptCharacterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP3Listener *listener); + void parse(WP3Listener *listener) override; protected: - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: unsigned short m_scriptCharacter; diff -Nru libwpd-0.10.1/src/lib/WP3EndOfLinePageGroup.h libwpd-0.10.2/src/lib/WP3EndOfLinePageGroup.h --- libwpd-0.10.1/src/lib/WP3EndOfLinePageGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3EndOfLinePageGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,7 +33,7 @@ { public: WP3EndOfLinePageGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP3Listener *listener); + void parse(WP3Listener *listener) override; }; #endif /* WP3ENDOFLINEPAGEGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP3ExtendedCharacterGroup.h libwpd-0.10.2/src/lib/WP3ExtendedCharacterGroup.h --- libwpd-0.10.1/src/lib/WP3ExtendedCharacterGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3ExtendedCharacterGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -35,10 +35,10 @@ { public: WP3ExtendedCharacterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP3Listener *listener); + void parse(WP3Listener *listener) override; protected: - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: unsigned char m_macCharacter; diff -Nru libwpd-0.10.1/src/lib/WP3FontGroup.h libwpd-0.10.2/src/lib/WP3FontGroup.h --- libwpd-0.10.1/src/lib/WP3FontGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3FontGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,9 +33,9 @@ { public: WP3FontGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP3FontGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP3Listener *listener); + ~WP3FontGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP3Listener *listener) override; private: /* Set Text Color */ diff -Nru libwpd-0.10.1/src/lib/WP3FootnoteEndnoteGroup.cpp libwpd-0.10.2/src/lib/WP3FootnoteEndnoteGroup.cpp --- libwpd-0.10.1/src/lib/WP3FootnoteEndnoteGroup.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3FootnoteEndnoteGroup.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -30,7 +30,7 @@ WP3FootnoteEndnoteGroup::WP3FootnoteEndnoteGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption) : WP3VariableLengthGroup(), - m_subDocument(0) + m_subDocument(nullptr) { _read(input, encryption); } diff -Nru libwpd-0.10.1/src/lib/WP3FootnoteEndnoteGroup.h libwpd-0.10.2/src/lib/WP3FootnoteEndnoteGroup.h --- libwpd-0.10.1/src/lib/WP3FootnoteEndnoteGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3FootnoteEndnoteGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,9 +34,9 @@ { public: WP3FootnoteEndnoteGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP3FootnoteEndnoteGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP3Listener *listener); + ~WP3FootnoteEndnoteGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP3Listener *listener) override; private: WP3FootnoteEndnoteGroup(const WP3FootnoteEndnoteGroup &); diff -Nru libwpd-0.10.1/src/lib/WP3HeaderFooterGroup.cpp libwpd-0.10.2/src/lib/WP3HeaderFooterGroup.cpp --- libwpd-0.10.1/src/lib/WP3HeaderFooterGroup.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3HeaderFooterGroup.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -30,7 +30,7 @@ WP3HeaderFooterGroup::WP3HeaderFooterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption) : WP3VariableLengthGroup(), m_definition(0), - m_subDocument(0) + m_subDocument(nullptr) { _read(input, encryption); } diff -Nru libwpd-0.10.1/src/lib/WP3HeaderFooterGroup.h libwpd-0.10.2/src/lib/WP3HeaderFooterGroup.h --- libwpd-0.10.1/src/lib/WP3HeaderFooterGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3HeaderFooterGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,9 +33,9 @@ { public: WP3HeaderFooterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP3HeaderFooterGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP3Listener *listener); + ~WP3HeaderFooterGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP3Listener *listener) override; private: WP3HeaderFooterGroup(const WP3HeaderFooterGroup &); diff -Nru libwpd-0.10.1/src/lib/WP3Header.h libwpd-0.10.2/src/lib/WP3Header.h --- libwpd-0.10.1/src/lib/WP3Header.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3Header.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,7 +33,7 @@ public: WP3Header(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned documentOffset, unsigned char productType, unsigned char fileType, unsigned char majorVersion, unsigned char minorVersion, unsigned short documentEncryption); - ~WP3Header() {} + ~WP3Header() override {} }; #endif /* _WP3HEADER_H */ /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP3IndentGroup.h libwpd-0.10.2/src/lib/WP3IndentGroup.h --- libwpd-0.10.1/src/lib/WP3IndentGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3IndentGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,10 +33,10 @@ { public: WP3IndentGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP3Listener *listener); + void parse(WP3Listener *listener) override; protected: - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: unsigned char m_subGroup; diff -Nru libwpd-0.10.1/src/lib/WP3MiscellaneousGroup.h libwpd-0.10.2/src/lib/WP3MiscellaneousGroup.h --- libwpd-0.10.1/src/lib/WP3MiscellaneousGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3MiscellaneousGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -35,9 +35,9 @@ { public: WP3MiscellaneousGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP3MiscellaneousGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP3Listener *listener); + ~WP3MiscellaneousGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP3Listener *listener) override; private: // variables needed for subgroup 4 (Page Size Override) diff -Nru libwpd-0.10.1/src/lib/WP3PageFormatGroup.h libwpd-0.10.2/src/lib/WP3PageFormatGroup.h --- libwpd-0.10.1/src/lib/WP3PageFormatGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3PageFormatGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -36,9 +36,9 @@ { public: WP3PageFormatGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP3PageFormatGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP3Listener *listener); + ~WP3PageFormatGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP3Listener *listener) override; private: // variables needed for subgroup 0x01 (Horizontal Margins) diff -Nru libwpd-0.10.1/src/lib/WP3Parser.cpp libwpd-0.10.2/src/lib/WP3Parser.cpp --- libwpd-0.10.1/src/lib/WP3Parser.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3Parser.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -25,6 +25,9 @@ */ #include "WP3Parser.h" + +#include + #include "WPXHeader.h" #include "WP3Part.h" #include "WP3ContentListener.h" @@ -44,25 +47,14 @@ WP3ResourceFork *WP3Parser::getResourceFork(librevenge::RVNGInputStream *input, WPXEncryption *encryption) { - WP3ResourceFork *resourceFork = 0; - // Certain WP2 documents actually don't contain resource fork, so check for its existence if (!getHeader() || getHeader()->getDocumentOffset() <= 0x10) { WPD_DEBUG_MSG(("WP3Parser: Document does not contain resource fork\n")); - return 0; + return nullptr; } - try - { - resourceFork = new WP3ResourceFork(input, encryption); - return resourceFork; - } - catch (FileException) - { - DELETEP(resourceFork); - throw FileException(); - } + return new WP3ResourceFork(input, encryption); } void WP3Parser::parse(librevenge::RVNGInputStream *input, WPXEncryption *encryption, WP3Listener *listener) @@ -101,12 +93,9 @@ } else { - WP3Part *part = WP3Part::constructPart(input, encryption, readVal); + std::unique_ptr part(WP3Part::constructPart(input, encryption, readVal)); if (part) - { part->parse(listener); - DELETEP(part); - } } } } @@ -117,7 +106,7 @@ WPXEncryption *encryption = getEncryption(); std::list pageList; WPXTableList tableList; - WP3ResourceFork *resourceFork = 0; + WP3ResourceFork *resourceFork = nullptr; std::vector subDocuments; try @@ -153,10 +142,10 @@ parse(input, encryption, &listener); // cleanup section: free the used resources - for (std::vector::iterator iterSubDoc = subDocuments.begin(); iterSubDoc != subDocuments.end(); ++iterSubDoc) + for (auto &subDocument : subDocuments) { - if (*iterSubDoc) - delete *iterSubDoc; + if (subDocument) + delete subDocument; } delete resourceFork; @@ -165,10 +154,10 @@ { WPD_DEBUG_MSG(("WordPerfect: File Exception. Parse terminated prematurely.")); - for (std::vector::iterator iterSubDoc = subDocuments.begin(); iterSubDoc != subDocuments.end(); ++iterSubDoc) + for (auto &subDocument : subDocuments) { - if (*iterSubDoc) - delete *iterSubDoc; + if (subDocument) + delete subDocument; } delete resourceFork; @@ -189,26 +178,26 @@ { WP3StylesListener stylesListener(pageList, tableList, subDocuments); stylesListener.startSubDocument(); - parseDocument(input, 0, &stylesListener); + parseDocument(input, nullptr, &stylesListener); stylesListener.endSubDocument(); input->seek(0, librevenge::RVNG_SEEK_SET); WP3ContentListener listener(pageList, subDocuments, textInterface); listener.startSubDocument(); - parseDocument(input, 0, &listener); + parseDocument(input, nullptr, &listener); listener.endSubDocument(); - for (std::vector::iterator iterSubDoc = subDocuments.begin(); iterSubDoc != subDocuments.end(); ++iterSubDoc) - if (*iterSubDoc) - delete *iterSubDoc; + for (auto &subDocument : subDocuments) + if (subDocument) + delete subDocument; } catch (FileException) { WPD_DEBUG_MSG(("WordPerfect: File Exception. Parse terminated prematurely.")); - for (std::vector::iterator iterSubDoc = subDocuments.begin(); iterSubDoc != subDocuments.end(); ++iterSubDoc) - if (*iterSubDoc) - delete *iterSubDoc; + for (auto &subDocument : subDocuments) + if (subDocument) + delete subDocument; throw FileException(); } } diff -Nru libwpd-0.10.1/src/lib/WP3Parser.h libwpd-0.10.2/src/lib/WP3Parser.h --- libwpd-0.10.1/src/lib/WP3Parser.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3Parser.h 2017-09-08 17:04:25.000000000 +0000 @@ -36,10 +36,10 @@ { public: WP3Parser(librevenge::RVNGInputStream *input, WPXHeader *header, WPXEncryption *encryption); - ~WP3Parser(); + ~WP3Parser() override; - void parse(librevenge::RVNGTextInterface *documentInterface); - void parseSubDocument(librevenge::RVNGTextInterface *documentInterface); + void parse(librevenge::RVNGTextInterface *documentInterface) override; + void parseSubDocument(librevenge::RVNGTextInterface *documentInterface) override; static void parseDocument(librevenge::RVNGInputStream *input, WPXEncryption *encryption, WP3Listener *listener); diff -Nru libwpd-0.10.1/src/lib/WP3Part.cpp libwpd-0.10.2/src/lib/WP3Part.cpp --- libwpd-0.10.1/src/lib/WP3Part.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3Part.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -51,7 +51,7 @@ if (!WP3FixedLengthGroup::isGroupConsistent(input, encryption, readVal)) { WPD_DEBUG_MSG(("WordPerfect: Consistency Check (fixed length) failed; ignoring this byte\n")); - return 0; + return nullptr; } WPD_DEBUG_MSG(("WordPerfect: constructFixedLengthGroup(input, val)\n")); return WP3FixedLengthGroup::constructFixedLengthGroup(input, encryption, readVal); @@ -63,13 +63,13 @@ if (!WP3VariableLengthGroup::isGroupConsistent(input, encryption, readVal)) { WPD_DEBUG_MSG(("WordPerfect: Consistency Check (variable length) failed; ignoring this byte\n")); - return 0; + return nullptr; } WPD_DEBUG_MSG(("WordPerfect: constructVariableLengthGroup(input, val)\n")); return WP3VariableLengthGroup::constructVariableLengthGroup(input, encryption, readVal); } WPD_DEBUG_MSG(("WordPerfect: Returning 0 from constructPart\n")); - return 0; + return nullptr; } /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP3ResourceFork.cpp libwpd-0.10.2/src/lib/WP3ResourceFork.cpp --- libwpd-0.10.1/src/lib/WP3ResourceFork.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3ResourceFork.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -145,8 +145,8 @@ WP3ResourceFork::~WP3ResourceFork() { // delete the pointers from one of the multimaps. - for (std::multimap::iterator iter = m_resourcesTypeMultimap.begin(); iter != m_resourcesTypeMultimap.end(); ++iter) - delete iter->second; + for (auto &iter : m_resourcesTypeMultimap) + delete iter.second; } const WP3Resource *WP3ResourceFork::getResource(unsigned type, unsigned ID) const @@ -155,13 +155,13 @@ = m_resourcesTypeMultimap.equal_range(type); if (tempPair.first == m_resourcesTypeMultimap.end()) - return NULL; + return nullptr; for (std::multimap::const_iterator iter = tempPair.first; iter != tempPair.second; ++iter) if (iter->second->getResourceReferenceID() == ID) return iter->second; - return NULL; + return nullptr; } /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP3SingleByteFunction.cpp libwpd-0.10.2/src/lib/WP3SingleByteFunction.cpp --- libwpd-0.10.1/src/lib/WP3SingleByteFunction.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3SingleByteFunction.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -63,7 +63,7 @@ default: // should not happen - return 0; + return nullptr; } } diff -Nru libwpd-0.10.1/src/lib/WP3SingleByteFunction.h libwpd-0.10.2/src/lib/WP3SingleByteFunction.h --- libwpd-0.10.1/src/lib/WP3SingleByteFunction.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3SingleByteFunction.h 2017-09-08 17:04:25.000000000 +0000 @@ -39,55 +39,55 @@ class WP3HardSpaceFunction : public WP3SingleByteFunction { public: - void parse(WP3Listener *listener); + void parse(WP3Listener *listener) override; }; class WP3EOLFunction : public WP3SingleByteFunction { public: - void parse(WP3Listener *listener); + void parse(WP3Listener *listener) override; }; class WP3EOPFunction : public WP3SingleByteFunction { public: - void parse(WP3Listener *listener); + void parse(WP3Listener *listener) override; }; class WP3HyphenFunction : public WP3SingleByteFunction { public: - void parse(WP3Listener *listener); + void parse(WP3Listener *listener) override; }; class WP3SoftHyphenFunction : public WP3SingleByteFunction { public: - void parse(WP3Listener *listener); + void parse(WP3Listener *listener) override; }; class WP3CondensedTabFunction : public WP3SingleByteFunction { public: - void parse(WP3Listener *listener); + void parse(WP3Listener *listener) override; }; class WP3CondensedBackTabFunction : public WP3SingleByteFunction { public: - void parse(WP3Listener *listener); + void parse(WP3Listener *listener) override; }; class WP3CondensedIndentFunction : public WP3SingleByteFunction { public: - void parse(WP3Listener *listener); + void parse(WP3Listener *listener) override; }; class WP3CondensedLRIndentFunction : public WP3SingleByteFunction { public: - void parse(WP3Listener *listener); + void parse(WP3Listener *listener) override; }; #endif /* WP3SINGLEBYTEFUNCTION_H */ diff -Nru libwpd-0.10.1/src/lib/WP3StylesListener.cpp libwpd-0.10.2/src/lib/WP3StylesListener.cpp --- libwpd-0.10.1/src/lib/WP3StylesListener.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3StylesListener.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -36,7 +36,7 @@ WPXStylesListener(pageList), m_currentPage(WPXPageSpan()), m_tableList(tableList), - m_currentTable(0), + m_currentTable(nullptr), m_tempMarginLeft(1.0), m_tempMarginRight(1.0), m_currentPageHasContent(false), @@ -222,7 +222,7 @@ _handleSubDocument(subDocument, WPX_SUBDOCUMENT_HEADER_FOOTER, tableList); } else - m_currentPage.setHeaderFooter(wpxType, headerFooterType, wpxOccurrence, 0, tableList); + m_currentPage.setHeaderFooter(wpxType, headerFooterType, wpxOccurrence, nullptr, tableList); } m_currentPageHasContent = tempCurrentPageHasContent; } diff -Nru libwpd-0.10.1/src/lib/WP3StylesListener.h libwpd-0.10.2/src/lib/WP3StylesListener.h --- libwpd-0.10.1/src/lib/WP3StylesListener.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3StylesListener.h 2017-09-08 17:04:25.000000000 +0000 @@ -39,73 +39,73 @@ public: WP3StylesListener(std::list &pageList, WPXTableList tableList, std::vector &subDocuments); - void startDocument() {} - void startSubDocument() {} - void insertCharacter(unsigned /* character */) + void startDocument() override {} + void startSubDocument() override {} + void insertCharacter(unsigned /* character */) override { if (!isUndoOn()) m_currentPageHasContent = true; } - void insertTab() + void insertTab() override { if (!isUndoOn()) m_currentPageHasContent = true; } - void insertTab(unsigned char /* tabType */, double /* tabPosition */) + void insertTab(unsigned char /* tabType */, double /* tabPosition */) override { if (!isUndoOn()) m_currentPageHasContent = true; } - void insertEOL() + void insertEOL() override { if (!isUndoOn()) m_currentPageHasContent = true; } - void insertBreak(unsigned char breakType); - void attributeChange(bool /* isOn */, unsigned char /* attribute */) {} - void lineSpacingChange(double /* lineSpacing */) {} - void justificationChange(unsigned char /* justification */) {} - void pageMarginChange(unsigned char side, unsigned short margin); - void pageFormChange(unsigned short length, unsigned short width, WPXFormOrientation orientation); - void marginChange(unsigned char side, unsigned short margin); - void indentFirstLineChange(double /* offset */) {} - void setTabs(bool /* isRelative */, const std::vector /* tabStops */) {} + void insertBreak(unsigned char breakType) override; + void attributeChange(bool /* isOn */, unsigned char /* attribute */) override {} + void lineSpacingChange(double /* lineSpacing */) override {} + void justificationChange(unsigned char /* justification */) override {} + void pageMarginChange(unsigned char side, unsigned short margin) override; + void pageFormChange(unsigned short length, unsigned short width, WPXFormOrientation orientation) override; + void marginChange(unsigned char side, unsigned short margin) override; + void indentFirstLineChange(double /* offset */) override {} + void setTabs(bool /* isRelative */, const std::vector /* tabStops */) override {} void columnChange(WPXTextColumnType /* columnType */, unsigned char /* numColumns */, - const std::vector & /* columnWidth */, const std::vector & /* isFixedWidth */) {} - void endDocument(); - void endSubDocument(); + const std::vector & /* columnWidth */, const std::vector & /* isFixedWidth */) override {} + void endDocument() override; + void endSubDocument() override; - void defineTable(unsigned char /* position */, unsigned short /* leftOffset */) {} + void defineTable(unsigned char /* position */, unsigned short /* leftOffset */) override {} void addTableColumnDefinition(unsigned /* width */, unsigned /* leftGutter */, unsigned /* rightGutter */, - unsigned /* attributes */, unsigned char /* alignment */) {} - void startTable(); - void closeCell() {} - void closeRow() {} - void setTableCellSpan(unsigned short /* colSpan */, unsigned short /* rowSpan */) {} - void setTableCellFillColor(const RGBSColor * /* cellFillColor */) {} - void endTable() {} - void undoChange(unsigned char undoType, unsigned short undoLevel); - void setTextColor(const RGBSColor * /* fontColor */) {} - void setTextFont(const librevenge::RVNGString & /* fontName */) {} - void setFontSize(unsigned short /* fontSize */) {} - void insertPageNumber(const librevenge::RVNGString & /* pageNumber */) {} - void insertNoteReference(const librevenge::RVNGString & /* noteReference */) {} - void insertNote(WPXNoteType /* noteType */, const WP3SubDocument * /* subDocument */) + unsigned /* attributes */, unsigned char /* alignment */) override {} + void startTable() override; + void closeCell() override {} + void closeRow() override {} + void setTableCellSpan(unsigned short /* colSpan */, unsigned short /* rowSpan */) override {} + void setTableCellFillColor(const RGBSColor * /* cellFillColor */) override {} + void endTable() override {} + void undoChange(unsigned char undoType, unsigned short undoLevel) override; + void setTextColor(const RGBSColor * /* fontColor */) override {} + void setTextFont(const librevenge::RVNGString & /* fontName */) override {} + void setFontSize(unsigned short /* fontSize */) override {} + void insertPageNumber(const librevenge::RVNGString & /* pageNumber */) override {} + void insertNoteReference(const librevenge::RVNGString & /* noteReference */) override {} + void insertNote(WPXNoteType /* noteType */, const WP3SubDocument * /* subDocument */) override { if (!isUndoOn()) m_currentPageHasContent = true; } - void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP3SubDocument *subDocument); - void suppressPage(unsigned short suppressCode); - void backTab() + void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP3SubDocument *subDocument) override; + void suppressPage(unsigned short suppressCode) override; + void backTab() override { if (!isUndoOn()) m_currentPageHasContent = true; } - void leftIndent() {} - void leftIndent(double /* offset */) {} - void leftRightIndent() {} - void leftRightIndent(double /* offset */) {} + void leftIndent() override {} + void leftIndent(double /* offset */) override {} + void leftRightIndent() override {} + void leftRightIndent(double /* offset */) override {} void insertPicture(double /* height */, double /* width */, double /* verticalOffset */, double /* horizontalOffset */, unsigned char /* leftColumn */, unsigned char /* rightColumn */, - unsigned short /* figureFlags */, const librevenge::RVNGBinaryData & /* binaryData */) {} + unsigned short /* figureFlags */, const librevenge::RVNGBinaryData & /* binaryData */) override {} void insertTextBox(double /* height */, double /* width */, double /* verticalOffset */, double /* horizontalOffset */, unsigned char /* leftColumn */, unsigned char /* rightColumn */, - unsigned short /* figureFlags */, const WP3SubDocument * /* subDocument */, const WP3SubDocument * /* caption */) {} + unsigned short /* figureFlags */, const WP3SubDocument * /* subDocument */, const WP3SubDocument * /* caption */) override {} void insertWP51Table(double /* height */, double /* width */, double /* verticalOffset */, double /* horizontalOffset */, unsigned char /* leftColumn */, unsigned char /* rightColumn */, - unsigned short /* figureFlags */, const WP3SubDocument * /* subDocument */, const WP3SubDocument * /* caption */) {} + unsigned short /* figureFlags */, const WP3SubDocument * /* subDocument */, const WP3SubDocument * /* caption */) override {} protected: void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0); diff -Nru libwpd-0.10.1/src/lib/WP3SubDocument.cpp libwpd-0.10.2/src/lib/WP3SubDocument.cpp --- libwpd-0.10.1/src/lib/WP3SubDocument.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3SubDocument.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -38,6 +38,6 @@ if (!tmpStream) return; tmpStream->seek(0, librevenge::RVNG_SEEK_SET); - WP3Parser::parseDocument(tmpStream, 0, listener); + WP3Parser::parseDocument(tmpStream, nullptr, listener); } /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP3TabGroup.h libwpd-0.10.2/src/lib/WP3TabGroup.h --- libwpd-0.10.1/src/lib/WP3TabGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3TabGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,10 +33,10 @@ { public: WP3TabGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP3Listener *listener); + void parse(WP3Listener *listener) override; protected: - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: unsigned char m_subGroup; diff -Nru libwpd-0.10.1/src/lib/WP3TablesGroup.h libwpd-0.10.2/src/lib/WP3TablesGroup.h --- libwpd-0.10.1/src/lib/WP3TablesGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3TablesGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,9 +34,9 @@ { public: WP3TablesGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP3TablesGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP3Listener *listener); + ~WP3TablesGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP3Listener *listener) override; private: // variables needed for subgroup 1 (Table Function) diff -Nru libwpd-0.10.1/src/lib/WP3UndoGroup.h libwpd-0.10.2/src/lib/WP3UndoGroup.h --- libwpd-0.10.1/src/lib/WP3UndoGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3UndoGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,10 +34,10 @@ { public: WP3UndoGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP3Listener *listener); + void parse(WP3Listener *listener) override; protected: - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: unsigned char m_undoType; diff -Nru libwpd-0.10.1/src/lib/WP3UnsupportedFixedLengthGroup.h libwpd-0.10.2/src/lib/WP3UnsupportedFixedLengthGroup.h --- libwpd-0.10.1/src/lib/WP3UnsupportedFixedLengthGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3UnsupportedFixedLengthGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,10 +32,10 @@ { public: WP3UnsupportedFixedLengthGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP3Listener * /* listener */) {} + void parse(WP3Listener * /* listener */) override {} protected: - void _readContents(librevenge::RVNGInputStream * /* input */, WPXEncryption * /* encryption */) {} + void _readContents(librevenge::RVNGInputStream * /* input */, WPXEncryption * /* encryption */) override {} }; #endif /* WP3UNSUPPORTEDFIXEDLENGTHGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP3UnsupportedVariableLengthGroup.h libwpd-0.10.2/src/lib/WP3UnsupportedVariableLengthGroup.h --- libwpd-0.10.1/src/lib/WP3UnsupportedVariableLengthGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3UnsupportedVariableLengthGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -35,7 +35,7 @@ { public: WP3UnsupportedVariableLengthGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP3Listener * /* listener */) {} + void parse(WP3Listener * /* listener */) override {} }; #endif /* WP3UNSUPPORTEDVARIABLELENGTHGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP3VariableLengthGroup.cpp libwpd-0.10.2/src/lib/WP3VariableLengthGroup.cpp --- libwpd-0.10.1/src/lib/WP3VariableLengthGroup.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3VariableLengthGroup.cpp 2017-09-12 17:40:30.000000000 +0000 @@ -79,8 +79,6 @@ bool WP3VariableLengthGroup::isGroupConsistent(librevenge::RVNGInputStream *input, WPXEncryption *encryption, const unsigned char group) { long startPosition = input->tell(); - if (0 > startPosition || startPosition > ((std::numeric_limits::max)())) - return false; try { diff -Nru libwpd-0.10.1/src/lib/WP3VariableLengthGroup.h libwpd-0.10.2/src/lib/WP3VariableLengthGroup.h --- libwpd-0.10.1/src/lib/WP3VariableLengthGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3VariableLengthGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -35,7 +35,7 @@ { public: WP3VariableLengthGroup(); // WP3VariableLengthGroup should _never_ be constructed, only its inherited classes - virtual ~WP3VariableLengthGroup() {} + ~WP3VariableLengthGroup() override {} static WP3VariableLengthGroup *constructVariableLengthGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, const unsigned char group); diff -Nru libwpd-0.10.1/src/lib/WP3WindowGroup.cpp libwpd-0.10.2/src/lib/WP3WindowGroup.cpp --- libwpd-0.10.1/src/lib/WP3WindowGroup.cpp 2015-12-30 08:47:36.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3WindowGroup.cpp 2017-07-29 06:20:15.000000000 +0000 @@ -41,18 +41,14 @@ m_horizontalOffset(0.0), m_verticalOffset(0.0), m_resourceID(0), - m_subDocument(0), - m_caption(0) + m_subDocument(), + m_caption() { _read(input, encryption); } WP3WindowGroup::~WP3WindowGroup() { - if (m_subDocument) - delete m_subDocument; - if (m_caption) - delete m_caption; } void WP3WindowGroup::_readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) @@ -84,10 +80,10 @@ input->seek(tmpNumSubRect * 8, librevenge::RVNG_SEEK_CUR); unsigned short tmpBoxCaptionSize = readU16(input, encryption, true); if (tmpBoxCaptionSize) - m_caption = new WP3SubDocument(input, encryption, tmpBoxCaptionSize); + m_caption.reset(new WP3SubDocument(input, encryption, tmpBoxCaptionSize)); unsigned short tmpTextBoxLength = readU16(input, encryption, true); if (tmpTextBoxLength) - m_subDocument = new WP3SubDocument(input, encryption, tmpTextBoxLength); + m_subDocument.reset(new WP3SubDocument(input, encryption, tmpTextBoxLength)); } break; @@ -136,12 +132,12 @@ else if (m_boxType == 0x00) { if (m_subDocument || m_caption) - listener->insertTextBox(m_height, m_width, m_verticalOffset, m_horizontalOffset, m_leftColumn, m_rightColumn, m_figureFlags, m_subDocument, m_caption); + listener->insertTextBox(m_height, m_width, m_verticalOffset, m_horizontalOffset, m_leftColumn, m_rightColumn, m_figureFlags, m_subDocument.get(), m_caption.get()); } else if (m_boxType == 0x04 || m_boxType == 0x05) { if (m_subDocument || m_caption) - listener->insertWP51Table(m_height, m_width, m_verticalOffset, m_horizontalOffset, m_leftColumn, m_rightColumn, m_figureFlags, m_subDocument, m_caption); + listener->insertWP51Table(m_height, m_width, m_verticalOffset, m_horizontalOffset, m_leftColumn, m_rightColumn, m_figureFlags, m_subDocument.get(), m_caption.get()); } break; diff -Nru libwpd-0.10.1/src/lib/WP3WindowGroup.h libwpd-0.10.2/src/lib/WP3WindowGroup.h --- libwpd-0.10.1/src/lib/WP3WindowGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP3WindowGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -29,6 +29,7 @@ #include #include "WP3VariableLengthGroup.h" #include "WP3SubDocument.h" +#include #include class WP3Listener; @@ -37,16 +38,17 @@ { public: WP3WindowGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP3WindowGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP3Listener *listener); + ~WP3WindowGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP3Listener *listener) override; private: unsigned short m_figureFlags; unsigned char m_leftColumn, m_rightColumn, m_boxType; double m_width, m_height, m_horizontalOffset, m_verticalOffset; unsigned m_resourceID; - WP3SubDocument *m_subDocument, *m_caption; + std::unique_ptr m_subDocument; + std::unique_ptr m_caption; // Unimplemented to prevent compiler from creating crasher ones WP3WindowGroup(const WP3WindowGroup &); WP3WindowGroup &operator=(const WP3WindowGroup &); diff -Nru libwpd-0.10.1/src/lib/WP42ContentListener.cpp libwpd-0.10.2/src/lib/WP42ContentListener.cpp --- libwpd-0.10.1/src/lib/WP42ContentListener.cpp 2015-12-30 08:29:33.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42ContentListener.cpp 2017-07-29 06:20:15.000000000 +0000 @@ -54,7 +54,6 @@ WP42ContentListener::~WP42ContentListener() { - delete m_parseState; } @@ -168,9 +167,8 @@ WPXTableList /* tableList */, unsigned /* nextTableIndice */) { // save our old parsing state on our "stack" - WP42ContentParsingState *oldParseState = m_parseState; - - m_parseState = new WP42ContentParsingState(); + auto oldParseState = std::move(m_parseState); + m_parseState = std::unique_ptr(new WP42ContentParsingState()); if (subDocument) { @@ -192,8 +190,7 @@ #endif // restore our old parsing state - delete m_parseState; - m_parseState = oldParseState; + m_parseState = std::move(oldParseState); } /**************************************** diff -Nru libwpd-0.10.1/src/lib/WP42ContentListener.h libwpd-0.10.2/src/lib/WP42ContentListener.h --- libwpd-0.10.1/src/lib/WP42ContentListener.h 2015-12-30 08:28:16.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42ContentListener.h 2017-09-08 17:04:25.000000000 +0000 @@ -28,6 +28,8 @@ #ifndef WP42CONTENTLISTENER_H #define WP42CONTENTLISTENER_H +#include + #include "WP42Listener.h" #include "WP42SubDocument.h" #include "WPXContentListener.h" @@ -44,46 +46,46 @@ { public: WP42ContentListener(std::list &pageList, std::vector &subDocuments, librevenge::RVNGTextInterface *documentInterface); - ~WP42ContentListener(); + ~WP42ContentListener() override; - void startDocument() + void startDocument() override { WPXContentListener::startDocument(); } - void startSubDocument() + void startSubDocument() override { WPXContentListener::startSubDocument(); } - void insertCharacter(unsigned character); - void insertTab(unsigned char tabType, double tabPosition); - void insertBreak(unsigned char breakType) + void insertCharacter(unsigned character) override; + void insertTab(unsigned char tabType, double tabPosition) override; + void insertBreak(unsigned char breakType) override { WPXContentListener::insertBreak(breakType); } - void insertEOL(); - void attributeChange(bool isOn, unsigned char attribute); - void marginReset(unsigned char leftMargin, unsigned char rightMargin); - void headerFooterGroup(unsigned char headerFooterDefinition, WP42SubDocument *subDocument); - void suppressPageCharacteristics(unsigned char /* suppressCode */) {} - void endDocument() + void insertEOL() override; + void attributeChange(bool isOn, unsigned char attribute) override; + void marginReset(unsigned char leftMargin, unsigned char rightMargin) override; + void headerFooterGroup(unsigned char headerFooterDefinition, WP42SubDocument *subDocument) override; + void suppressPageCharacteristics(unsigned char /* suppressCode */) override {} + void endDocument() override { WPXContentListener::endDocument(); } - void endSubDocument() + void endSubDocument() override { WPXContentListener::endSubDocument(); } protected: - void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0); + void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0) override; - void _flushText(); - void _changeList() {} + void _flushText() override; + void _changeList() override {} private: WP42ContentListener(const WP42ContentListener &); WP42ContentListener &operator=(const WP42ContentListener &); - WP42ContentParsingState *m_parseState; + std::unique_ptr m_parseState; std::vector &m_subDocuments; }; diff -Nru libwpd-0.10.1/src/lib/WP42DefineColumnsGroup.h libwpd-0.10.2/src/lib/WP42DefineColumnsGroup.h --- libwpd-0.10.1/src/lib/WP42DefineColumnsGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42DefineColumnsGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,9 +33,9 @@ { public: WP42DefineColumnsGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP42DefineColumnsGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP42Listener *listener); + ~WP42DefineColumnsGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP42Listener *listener) override; private: unsigned char m_groupId; diff -Nru libwpd-0.10.1/src/lib/WP42ExtendedCharacterGroup.h libwpd-0.10.2/src/lib/WP42ExtendedCharacterGroup.h --- libwpd-0.10.1/src/lib/WP42ExtendedCharacterGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42ExtendedCharacterGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,9 +32,9 @@ { public: WP42ExtendedCharacterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP42ExtendedCharacterGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP42Listener *listener); + ~WP42ExtendedCharacterGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP42Listener *listener) override; private: unsigned char m_extendedCharacter; diff -Nru libwpd-0.10.1/src/lib/WP42HeaderFooterGroup.cpp libwpd-0.10.2/src/lib/WP42HeaderFooterGroup.cpp --- libwpd-0.10.1/src/lib/WP42HeaderFooterGroup.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42HeaderFooterGroup.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -30,7 +30,7 @@ WP42HeaderFooterGroup::WP42HeaderFooterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group) : WP42MultiByteFunctionGroup(group), m_definition(0), - m_subDocument(0) + m_subDocument(nullptr) { _read(input, encryption); } diff -Nru libwpd-0.10.1/src/lib/WP42HeaderFooterGroup.h libwpd-0.10.2/src/lib/WP42HeaderFooterGroup.h --- libwpd-0.10.1/src/lib/WP42HeaderFooterGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42HeaderFooterGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,9 +33,9 @@ { public: WP42HeaderFooterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP42HeaderFooterGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP42Listener *listener); + ~WP42HeaderFooterGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP42Listener *listener) override; private: WP42HeaderFooterGroup(const WP42HeaderFooterGroup &); diff -Nru libwpd-0.10.1/src/lib/WP42Heuristics.cpp libwpd-0.10.2/src/lib/WP42Heuristics.cpp --- libwpd-0.10.1/src/lib/WP42Heuristics.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42Heuristics.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -26,184 +26,147 @@ */ #include "WP42Heuristics.h" + +#include + #include "WP42FileStructure.h" #include "libwpd_internal.h" using namespace libwpd; -WPDPasswordMatch WP42Heuristics::verifyPassword(librevenge::RVNGInputStream *input, const char *password) +WPDPasswordMatch WP42Heuristics::verifyPassword(librevenge::RVNGInputStream *input, const char *password) try { if (!password) return WPD_PASSWORD_MATCH_DONTKNOW; input->seek(0, librevenge::RVNG_SEEK_SET); - WPXEncryption *encryption = 0; - try + + if (readU8(input, nullptr) == 0xFE && readU8(input, nullptr) == 0xFF && + readU8(input, nullptr) == 0x61 && readU8(input, nullptr) == 0x61) { - if (readU8(input, 0) == 0xFE && readU8(input, 0) == 0xFF && - readU8(input, 0) == 0x61 && readU8(input, 0) == 0x61) - { - encryption = new WPXEncryption(password, 6); - if (readU16(input, 0) == encryption->getCheckSum()) - { - delete encryption; - return WPD_PASSWORD_MATCH_OK; - } - else - { - delete encryption; - return WPD_PASSWORD_MATCH_NONE; - } - } + WPXEncryption encryption(password, 6); + if (readU16(input, nullptr) == encryption.getCheckSum()) + return WPD_PASSWORD_MATCH_OK; else - return WPD_PASSWORD_MATCH_DONTKNOW; + return WPD_PASSWORD_MATCH_NONE; } - catch (...) - { - if (encryption) - delete encryption; + else return WPD_PASSWORD_MATCH_DONTKNOW; - } +} +catch (...) +{ + return WPD_PASSWORD_MATCH_DONTKNOW; } -WPDConfidence WP42Heuristics::isWP42FileFormat(librevenge::RVNGInputStream *input, const char *password) +WPDConfidence WP42Heuristics::isWP42FileFormat(librevenge::RVNGInputStream *input, const char *password) try { input->seek(0, librevenge::RVNG_SEEK_SET); - WPXEncryption *encryption = 0; - try + std::unique_ptr encryption; + if (readU8(input, nullptr) == 0xFE && readU8(input, nullptr) == 0xFF && + readU8(input, nullptr) == 0x61 && readU8(input, nullptr) == 0x61) { - if (readU8(input, 0) == 0xFE && readU8(input, 0) == 0xFF && - readU8(input, 0) == 0x61 && readU8(input, 0) == 0x61) + if (password) { - if (password) - { - encryption = new WPXEncryption(password, 6); - if (readU16(input, 0) != encryption->getCheckSum()) - { - delete encryption; - return WPD_CONFIDENCE_SUPPORTED_ENCRYPTION; - } - } - else - { - if (readU16(input,0) != 0x0000) - return WPD_CONFIDENCE_SUPPORTED_ENCRYPTION; - } + encryption.reset(new WPXEncryption(password, 6)); + if (readU16(input, nullptr) != encryption->getCheckSum()) + return WPD_CONFIDENCE_SUPPORTED_ENCRYPTION; } + else + { + if (readU16(input,nullptr) != 0x0000) + return WPD_CONFIDENCE_SUPPORTED_ENCRYPTION; + } + } - input->seek(0, librevenge::RVNG_SEEK_SET); - if (password && encryption) - input->seek(6, librevenge::RVNG_SEEK_SET); + input->seek(0, librevenge::RVNG_SEEK_SET); + if (password && encryption) + input->seek(6, librevenge::RVNG_SEEK_SET); - int functionGroupCount = 0; + int functionGroupCount = 0; - WPD_DEBUG_MSG(("WP42Heuristics::isWP42FileFormat()\n")); + WPD_DEBUG_MSG(("WP42Heuristics::isWP42FileFormat()\n")); - while (!input->isEnd()) - { - unsigned char readVal = readU8(input, encryption); + while (!input->isEnd()) + { + unsigned char readVal = readU8(input, encryption.get()); - WPD_DEBUG_MSG(("WP42Heuristics, Offset 0x%.8x, value 0x%.2x\n", (unsigned int)(input->tell() - 1), readVal)); + WPD_DEBUG_MSG(("WP42Heuristics, Offset 0x%.8x, value 0x%.2x\n", (unsigned int)(input->tell() - 1), readVal)); - if (readVal < (unsigned char)0x20) - { - // line breaks et al, skip - } - else if (readVal >= (unsigned char)0x20 && readVal <= (unsigned char)0x7F) - { - // normal ASCII characters, skip - } - else if (readVal >= (unsigned char)0x80 && readVal <= (unsigned char)0xBF) - { - // single character function codes, skip - functionGroupCount++; - } - else if (readVal >= (unsigned char)0xFF) - { - // special codes that should not be found as separate functions - if (encryption) - delete encryption; - return WPD_CONFIDENCE_NONE; - } - else + if (readVal < (unsigned char)0x20) + { + // line breaks et al, skip + } + else if (readVal >= (unsigned char)0x20 && readVal <= (unsigned char)0x7F) + { + // normal ASCII characters, skip + } + else if (readVal >= (unsigned char)0x80 && readVal <= (unsigned char)0xBF) + { + // single character function codes, skip + functionGroupCount++; + } + else if (readVal >= (unsigned char)0xFF) + { + // special codes that should not be found as separate functions + return WPD_CONFIDENCE_NONE; + } + else + { + // multi character function group + // check that the size constrains are valid, and that every group_member + // is properly closed at the right place + + if (WP42_FUNCTION_GROUP_SIZE[readVal-0xC0] == -1) { - // multi character function group - // check that the size constrains are valid, and that every group_member - // is properly closed at the right place + // variable length function group - if (WP42_FUNCTION_GROUP_SIZE[readVal-0xC0] == -1) + // skip over all the bytes in the group, and scan for the closing gate + unsigned char readNextVal = 0; + while (!input->isEnd()) { - // variable length function group - - // skip over all the bytes in the group, and scan for the closing gate - unsigned char readNextVal = 0; - while (!input->isEnd()) - { - readNextVal = readU8(input, encryption); - if (readNextVal == readVal) - break; - } - - // when passed the complete file, we don't allow for open groups when we've reached EOF - if ((readNextVal == 0) || (input->isEnd() && (readNextVal != readVal))) - { - if (encryption) - delete encryption; - return WPD_CONFIDENCE_NONE; - } - - functionGroupCount++; + readNextVal = readU8(input, encryption.get()); + if (readNextVal == readVal) + break; } - else - { - // fixed length function group - // seek to the position where the closing gate should be - int res = input->seek(WP42_FUNCTION_GROUP_SIZE[readVal-0xC0]-2, librevenge::RVNG_SEEK_CUR); - // when passed the complete file, we should be able to do that - if (res) - { - if (encryption) - delete encryption; - return WPD_CONFIDENCE_NONE; - } - - // read the closing gate - unsigned char readNextVal = readU8(input, encryption); - if (readNextVal != readVal) - { - if (encryption) - delete encryption; - return WPD_CONFIDENCE_NONE; - } + // when passed the complete file, we don't allow for open groups when we've reached EOF + if ((readNextVal == 0) || (input->isEnd() && (readNextVal != readVal))) + return WPD_CONFIDENCE_NONE; - functionGroupCount++; - } + functionGroupCount++; } - } - - /* When we get here, the document is in a format that we *could* import properly. - However, if we didn't entcounter a single WP4.2 function group) we need to be more carefull: - this would be the case when passed a plaintext file for example, which libwpd is not - supposed to handle. */ - if (!functionGroupCount) - { - if (encryption) + else { - delete encryption; - return WPD_CONFIDENCE_EXCELLENT; + // fixed length function group + + // seek to the position where the closing gate should be + int res = input->seek(WP42_FUNCTION_GROUP_SIZE[readVal-0xC0]-2, librevenge::RVNG_SEEK_CUR); + // when passed the complete file, we should be able to do that + if (res) + return WPD_CONFIDENCE_NONE; + + // read the closing gate + unsigned char readNextVal = readU8(input, encryption.get()); + if (readNextVal != readVal) + return WPD_CONFIDENCE_NONE; + + functionGroupCount++; } - return WPD_CONFIDENCE_NONE; } - if (encryption) - delete encryption; - return WPD_CONFIDENCE_EXCELLENT; } - catch (...) - { - if (encryption) - delete encryption; + + /* When we get here, the document is in a format that we *could* import properly. + However, if we didn't entcounter a single WP4.2 function group) we need to be more carefull: + this would be the case when passed a plaintext file for example, which libwpd is not + supposed to handle. */ + if (!functionGroupCount && !encryption) return WPD_CONFIDENCE_NONE; - } + + return WPD_CONFIDENCE_EXCELLENT; +} +catch (...) +{ + return WPD_CONFIDENCE_NONE; } + /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP42Heuristics.h libwpd-0.10.2/src/lib/WP42Heuristics.h --- libwpd-0.10.1/src/lib/WP42Heuristics.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42Heuristics.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,7 +33,7 @@ class WP42Heuristics { public: - static libwpd::WPDConfidence isWP42FileFormat(librevenge::RVNGInputStream *input, const char *password = 0); + static libwpd::WPDConfidence isWP42FileFormat(librevenge::RVNGInputStream *input, const char *password = nullptr); static libwpd::WPDPasswordMatch verifyPassword(librevenge::RVNGInputStream *input, const char *password); }; diff -Nru libwpd-0.10.1/src/lib/WP42MarginResetGroup.h libwpd-0.10.2/src/lib/WP42MarginResetGroup.h --- libwpd-0.10.1/src/lib/WP42MarginResetGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42MarginResetGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,9 +33,9 @@ { public: WP42MarginResetGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP42MarginResetGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP42Listener *listener); + ~WP42MarginResetGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP42Listener *listener) override; private: unsigned char m_leftMargin, m_rightMargin; diff -Nru libwpd-0.10.1/src/lib/WP42MultiByteFunctionGroup.h libwpd-0.10.2/src/lib/WP42MultiByteFunctionGroup.h --- libwpd-0.10.1/src/lib/WP42MultiByteFunctionGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42MultiByteFunctionGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,7 +34,7 @@ { public: WP42MultiByteFunctionGroup(unsigned char group); // WP42MultiByteFunctionGroup should _never_ be constructed, only its inherited classes - virtual ~WP42MultiByteFunctionGroup() {} + ~WP42MultiByteFunctionGroup() override {} static WP42MultiByteFunctionGroup *constructMultiByteFunctionGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); diff -Nru libwpd-0.10.1/src/lib/WP42Parser.cpp libwpd-0.10.2/src/lib/WP42Parser.cpp --- libwpd-0.10.1/src/lib/WP42Parser.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42Parser.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -26,6 +26,9 @@ */ #include "WP42Parser.h" + +#include + #include "WP42Part.h" #include "WPXHeader.h" #include "libwpd_internal.h" @@ -35,7 +38,7 @@ #include "WP42ContentListener.h" WP42Parser::WP42Parser(librevenge::RVNGInputStream *input, WPXEncryption *encryption) : - WPXParser(input, 0, encryption) + WPXParser(input, nullptr, encryption) { } @@ -151,12 +154,9 @@ } else if (readVal >= (unsigned char)0xC0 && readVal <= (unsigned char)0xFE) { - WP42Part *part = WP42Part::constructPart(input, encryption, readVal); + std::unique_ptr part(WP42Part::constructPart(input, encryption, readVal)); if (part) - { part->parse(listener); - DELETEP(part); - } } // ignore the rest since they are not documented and at least 0xFF is a special character that // marks end of variable length part in variable length multi-byte functions @@ -199,20 +199,20 @@ parse(input, encryption, &listener); // cleanup section: free the used resources - for (std::vector::iterator iterSubDoc = subDocuments.begin(); iterSubDoc != subDocuments.end(); ++iterSubDoc) + for (auto &subDocument : subDocuments) { - if (*iterSubDoc) - delete(*iterSubDoc); + if (subDocument) + delete subDocument; } } catch (FileException) { WPD_DEBUG_MSG(("WordPerfect: File Exception. Parse terminated prematurely.")); - for (std::vector::iterator iterSubDoc = subDocuments.begin(); iterSubDoc != subDocuments.end(); ++iterSubDoc) + for (auto &subDocument : subDocuments) { - if (*iterSubDoc) - delete(*iterSubDoc); + if (subDocument) + delete subDocument; } throw FileException(); @@ -231,23 +231,23 @@ { WP42StylesListener stylesListener(pageList, subDocuments); stylesListener.startSubDocument(); - parseDocument(input, 0, &stylesListener); + parseDocument(input, nullptr, &stylesListener); stylesListener.endSubDocument(); WP42ContentListener listener(pageList, subDocuments, documentInterface); listener.startSubDocument(); - parseDocument(input, 0, &listener); + parseDocument(input, nullptr, &listener); listener.endSubDocument(); - for (std::vector::iterator iterSubDoc = subDocuments.begin(); iterSubDoc != subDocuments.end(); ++iterSubDoc) - if (*iterSubDoc) - delete(*iterSubDoc); + for (auto &subDocument : subDocuments) + if (subDocument) + delete subDocument; } catch (FileException) { WPD_DEBUG_MSG(("WordPerfect: File Exception. Parse terminated prematurely.")); - for (std::vector::iterator iterSubDoc = subDocuments.begin(); iterSubDoc != subDocuments.end(); ++iterSubDoc) - if (*iterSubDoc) - delete(*iterSubDoc); + for (auto &subDocument : subDocuments) + if (subDocument) + delete subDocument; throw FileException(); } } diff -Nru libwpd-0.10.1/src/lib/WP42Parser.h libwpd-0.10.2/src/lib/WP42Parser.h --- libwpd-0.10.1/src/lib/WP42Parser.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42Parser.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,10 +34,10 @@ { public: WP42Parser(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP42Parser(); + ~WP42Parser() override; - void parse(librevenge::RVNGTextInterface *documentInterface); - void parseSubDocument(librevenge::RVNGTextInterface *documentInterface); + void parse(librevenge::RVNGTextInterface *documentInterface) override; + void parseSubDocument(librevenge::RVNGTextInterface *documentInterface) override; static void parseDocument(librevenge::RVNGInputStream *input, WPXEncryption *encryption, WP42Listener *listener); diff -Nru libwpd-0.10.1/src/lib/WP42Part.cpp libwpd-0.10.2/src/lib/WP42Part.cpp --- libwpd-0.10.1/src/lib/WP42Part.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42Part.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -42,7 +42,7 @@ if (((unsigned char)0xC0 > readVal) || ((unsigned char)0xFE < readVal)) { WPD_DEBUG_MSG(("WordPerfect: Returning 0 from constructPart\n")); - return 0; + return nullptr; } WPD_DEBUG_MSG(("WordPerfect: constructMultiByteFunctionGroup(input, val)\n")); diff -Nru libwpd-0.10.1/src/lib/WP42StylesListener.cpp libwpd-0.10.2/src/lib/WP42StylesListener.cpp --- libwpd-0.10.1/src/lib/WP42StylesListener.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42StylesListener.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -84,19 +84,19 @@ m_currentPage = WPXPageSpan(m_pageList.back(), 0.0, 0.0); m_currentPage.setPageSpan(1); - for (std::vector::const_iterator HFiter = (m_nextPage.getHeaderFooterList()).begin(); - HFiter != (m_nextPage.getHeaderFooterList()).end(); ++HFiter) + auto headerFooterList = m_nextPage.getHeaderFooterList(); + for (const auto &hf : headerFooterList) { - if ((*HFiter).getOccurrence() != NEVER) + if (hf.getOccurrence() != NEVER) { - m_currentPage.setHeaderFooter((*HFiter).getType(), (*HFiter).getInternalType(), - (*HFiter).getOccurrence(), (*HFiter).getSubDocument(), (*HFiter).getTableList()); - _handleSubDocument((*HFiter).getSubDocument(), WPX_SUBDOCUMENT_HEADER_FOOTER, (*HFiter).getTableList()); + m_currentPage.setHeaderFooter(hf.getType(), hf.getInternalType(), + hf.getOccurrence(), hf.getSubDocument(), hf.getTableList()); + _handleSubDocument(hf.getSubDocument(), WPX_SUBDOCUMENT_HEADER_FOOTER, hf.getTableList()); } else { - m_currentPage.setHeaderFooter((*HFiter).getType(), (*HFiter).getInternalType(), - (*HFiter).getOccurrence(), 0, (*HFiter).getTableList()); + m_currentPage.setHeaderFooter(hf.getType(), hf.getInternalType(), + hf.getOccurrence(), nullptr, hf.getTableList()); } } m_nextPage = WPXPageSpan(); @@ -156,7 +156,7 @@ _handleSubDocument(subDocument, WPX_SUBDOCUMENT_HEADER_FOOTER, tableList); } else - m_currentPage.setHeaderFooter(wpxType, headerFooterType, wpxOccurrence, 0, tableList); + m_currentPage.setHeaderFooter(wpxType, headerFooterType, wpxOccurrence, nullptr, tableList); } m_currentPageHasContent = tempCurrentPageHasContent; } diff -Nru libwpd-0.10.1/src/lib/WP42StylesListener.h libwpd-0.10.2/src/lib/WP42StylesListener.h --- libwpd-0.10.1/src/lib/WP42StylesListener.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42StylesListener.h 2017-09-08 17:04:25.000000000 +0000 @@ -40,27 +40,27 @@ public: WP42StylesListener(std::list &pageList, std::vector &subDocuments); - void startDocument() {} - void startSubDocument() {} - void insertCharacter(unsigned /* character */) + void startDocument() override {} + void startSubDocument() override {} + void insertCharacter(unsigned /* character */) override { if (!isUndoOn()) m_currentPageHasContent = true; } - void insertTab(unsigned char /* tabType */, double /* tabPosition */) + void insertTab(unsigned char /* tabType */, double /* tabPosition */) override { if (!isUndoOn()) m_currentPageHasContent = true; } - void insertEOL() + void insertEOL() override { if (!isUndoOn()) m_currentPageHasContent = true; } - void insertBreak(unsigned char breakType); - void attributeChange(bool /* isOn */, unsigned char /* attribute */) {} - void marginReset(unsigned char /* leftMargin */, unsigned char /* rightMargin */) {} - void headerFooterGroup(unsigned char headerFooterDefinition, WP42SubDocument *subDocument); - void suppressPageCharacteristics(unsigned char suppressCode); - void endDocument(); - void endSubDocument(); + void insertBreak(unsigned char breakType) override; + void attributeChange(bool /* isOn */, unsigned char /* attribute */) override {} + void marginReset(unsigned char /* leftMargin */, unsigned char /* rightMargin */) override {} + void headerFooterGroup(unsigned char headerFooterDefinition, WP42SubDocument *subDocument) override; + void suppressPageCharacteristics(unsigned char suppressCode) override; + void endDocument() override; + void endSubDocument() override; protected: void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0); diff -Nru libwpd-0.10.1/src/lib/WP42SubDocument.cpp libwpd-0.10.2/src/lib/WP42SubDocument.cpp --- libwpd-0.10.1/src/lib/WP42SubDocument.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42SubDocument.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -38,7 +38,7 @@ if (!tmpStream) return; tmpStream->seek(0, librevenge::RVNG_SEEK_SET); - listener->marginReset(readU8(tmpStream, 0), readU8(tmpStream, 0)); - WP42Parser::parseDocument(tmpStream, 0, listener); + listener->marginReset(readU8(tmpStream, nullptr), readU8(tmpStream, nullptr)); + WP42Parser::parseDocument(tmpStream, nullptr, listener); } /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP42SuppressPageCharacteristicsGroup.h libwpd-0.10.2/src/lib/WP42SuppressPageCharacteristicsGroup.h --- libwpd-0.10.1/src/lib/WP42SuppressPageCharacteristicsGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42SuppressPageCharacteristicsGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,9 +32,9 @@ { public: WP42SuppressPageCharacteristicsGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - ~WP42SuppressPageCharacteristicsGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP42Listener *listener); + ~WP42SuppressPageCharacteristicsGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP42Listener *listener) override; private: unsigned char m_suppressCode; diff -Nru libwpd-0.10.1/src/lib/WP42UnsupportedMultiByteFunctionGroup.h libwpd-0.10.2/src/lib/WP42UnsupportedMultiByteFunctionGroup.h --- libwpd-0.10.1/src/lib/WP42UnsupportedMultiByteFunctionGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP42UnsupportedMultiByteFunctionGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -38,8 +38,8 @@ public: WP42UnsupportedMultiByteFunctionGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char group); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP42Listener * /* listener */) {} + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP42Listener * /* listener */) override {} }; #endif /* WP42UNSUPPORTEDMULTIBYTEFUNCTIONGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP5AttributeGroup.h libwpd-0.10.2/src/lib/WP5AttributeGroup.h --- libwpd-0.10.1/src/lib/WP5AttributeGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5AttributeGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,14 +34,14 @@ { public: WP5AttributeGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - virtual void parse(WP5Listener *listener) = 0; + void parse(WP5Listener *listener) override = 0; unsigned char getAttribute() const { return m_attribute; } protected: - virtual void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: unsigned char m_attribute; @@ -51,14 +51,14 @@ { public: WP5AttributeOnGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP5Listener *listener); + void parse(WP5Listener *listener) override; }; class WP5AttributeOffGroup : public WP5AttributeGroup { public: WP5AttributeOffGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP5Listener *listener); + void parse(WP5Listener *listener) override; }; #endif /* WP5ATTRIBUTEGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP5BoxGroup.cpp libwpd-0.10.2/src/lib/WP5BoxGroup.cpp --- libwpd-0.10.1/src/lib/WP5BoxGroup.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5BoxGroup.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -42,7 +42,7 @@ m_y(0), m_boxType(0), m_graphicsOffset(0), - m_data(NULL) + m_data(nullptr) { _read(input, encryption); } diff -Nru libwpd-0.10.1/src/lib/WP5BoxGroup.h libwpd-0.10.2/src/lib/WP5BoxGroup.h --- libwpd-0.10.1/src/lib/WP5BoxGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5BoxGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,10 +33,10 @@ { public: WP5BoxGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP5Listener *listener); + void parse(WP5Listener *listener) override; protected: - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: unsigned short m_boxNumber; diff -Nru libwpd-0.10.1/src/lib/WP5ContentListener.cpp libwpd-0.10.2/src/lib/WP5ContentListener.cpp --- libwpd-0.10.1/src/lib/WP5ContentListener.cpp 2015-12-30 08:29:40.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5ContentListener.cpp 2017-07-29 06:20:15.000000000 +0000 @@ -55,7 +55,6 @@ WP5ContentListener::~WP5ContentListener() { - delete m_parseState; } @@ -561,9 +560,9 @@ WPXTableList /* tableList */, unsigned /* nextTableIndice */) { // save our old parsing state on our "stack" - WP5ContentParsingState *oldParseState = m_parseState; + auto oldParseState = std::move(m_parseState); - m_parseState = new WP5ContentParsingState(); + m_parseState = std::unique_ptr(new WP5ContentParsingState()); setFont(m_defaultFontName, m_defaultFontSize); if (subDocumentType == WPX_SUBDOCUMENT_HEADER_FOOTER) @@ -590,8 +589,7 @@ #endif // restore our old parsing state - delete m_parseState; - m_parseState = oldParseState; + m_parseState = std::move(oldParseState); } void WP5ContentListener::headerFooterGroup(unsigned char /* headerFooterType */, unsigned char /* occurrenceBits */, diff -Nru libwpd-0.10.1/src/lib/WP5ContentListener.h libwpd-0.10.2/src/lib/WP5ContentListener.h --- libwpd-0.10.1/src/lib/WP5ContentListener.h 2015-12-30 08:28:13.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5ContentListener.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,6 +32,7 @@ #include "WPXContentListener.h" #include "WP5SubDocument.h" #include "libwpd_internal.h" +#include #include struct WP5ContentParsingState @@ -50,81 +51,81 @@ { public: WP5ContentListener(std::list &pageList, std::vector &subDocuments, librevenge::RVNGTextInterface *documentInterface); - ~WP5ContentListener(); + ~WP5ContentListener() override; - void startDocument() + void startDocument() override { WPXContentListener::startDocument(); } - void startSubDocument() + void startSubDocument() override { WPXContentListener::startSubDocument(); } - void setFont(const librevenge::RVNGString &fontName, double fontSize); - void setTabs(const std::vector &tabStops, unsigned short tabOffset); - void insertCharacter(unsigned character); - void insertTab(unsigned char tabType, double tabPosition); - void insertIndent(unsigned char indentType, double indentPosition); - void insertEOL(); - void insertBreak(unsigned char breakType) + void setFont(const librevenge::RVNGString &fontName, double fontSize) override; + void setTabs(const std::vector &tabStops, unsigned short tabOffset) override; + void insertCharacter(unsigned character) override; + void insertTab(unsigned char tabType, double tabPosition) override; + void insertIndent(unsigned char indentType, double indentPosition) override; + void insertEOL() override; + void insertBreak(unsigned char breakType) override { WPXContentListener::insertBreak(breakType); } - void lineSpacingChange(double lineSpacing) + void lineSpacingChange(double lineSpacing) override { WPXContentListener::lineSpacingChange(lineSpacing); } - void justificationChange(unsigned char justification) + void justificationChange(unsigned char justification) override { WPXContentListener::justificationChange(justification); } - void characterColorChange(unsigned char red, unsigned char green, unsigned char blue); - void attributeChange(bool isOn, unsigned char attribute); - void pageMarginChange(unsigned char /* side */, unsigned short /* margin */) {} - void pageFormChange(unsigned short /* length */, unsigned short /* width */, WPXFormOrientation /* orientation */) {} - void marginChange(unsigned char side, unsigned short margin); + void characterColorChange(unsigned char red, unsigned char green, unsigned char blue) override; + void attributeChange(bool isOn, unsigned char attribute) override; + void pageMarginChange(unsigned char /* side */, unsigned short /* margin */) override {} + void pageFormChange(unsigned short /* length */, unsigned short /* width */, WPXFormOrientation /* orientation */) override {} + void marginChange(unsigned char side, unsigned short margin) override; void paragraphMarginChange(unsigned char /* side */, signed short /* margin */) {} - void endDocument() + void endDocument() override { WPXContentListener::endDocument(); } - void endSubDocument() + void endSubDocument() override { WPXContentListener::endSubDocument(); } - void defineTable(unsigned char position, unsigned short leftOffset); + void defineTable(unsigned char position, unsigned short leftOffset) override; void addTableColumnDefinition(unsigned width, unsigned leftGutter, unsigned rightGutter, - unsigned attributes, unsigned char alignment); - void startTable(); - void insertRow(unsigned short rowHeight, bool isMinimumHeight, bool isHeaderRow); + unsigned attributes, unsigned char alignment) override; + void startTable() override; + void insertRow(unsigned short rowHeight, bool isMinimumHeight, bool isHeaderRow) override; void insertCell(unsigned char colSpan, unsigned char rowSpan, unsigned char borderBits, const RGBSColor *cellFgColor, const RGBSColor *cellBgColor, const RGBSColor *cellBorderColor, WPXVerticalAlignment cellVerticalAlignment, - bool useCellAttributes, unsigned cellAttributes); - void endTable(); + bool useCellAttributes, unsigned cellAttributes) override; + void endTable() override; - void insertNoteReference(const librevenge::RVNGString ¬eReference); - void insertNote(WPXNoteType noteType, const WP5SubDocument *subDocument); - void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP5SubDocument *subDocument); - void suppressPageCharacteristics(unsigned char /* suppressCode */) {} + void insertNoteReference(const librevenge::RVNGString ¬eReference) override; + void insertNote(WPXNoteType noteType, const WP5SubDocument *subDocument) override; + void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP5SubDocument *subDocument) override; + void suppressPageCharacteristics(unsigned char /* suppressCode */) override {} void setDefaultFont(const librevenge::RVNGString &fontName, double fontSize); - void boxOn(unsigned char positionAndType, unsigned char alignment, unsigned short width, unsigned short height, unsigned short x, unsigned short y); - virtual void boxOff(); - virtual void insertGraphicsData(const librevenge::RVNGBinaryData *data); + void boxOn(unsigned char positionAndType, unsigned char alignment, unsigned short width, unsigned short height, unsigned short x, unsigned short y) override; + void boxOff() override; + void insertGraphicsData(const librevenge::RVNGBinaryData *data) override; protected: - void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0); + void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0) override; - void _flushText(); - void _changeList() {} + void _flushText() override; + void _changeList() override {} private: WP5ContentListener(const WP5ContentListener &); WP5ContentListener &operator=(const WP5ContentListener &); - WP5ContentParsingState *m_parseState; + std::unique_ptr m_parseState; std::vector &m_subDocuments; double m_defaultFontSize; librevenge::RVNGString m_defaultFontName; diff -Nru libwpd-0.10.1/src/lib/WP5DefinitionGroup.cpp libwpd-0.10.2/src/lib/WP5DefinitionGroup.cpp --- libwpd-0.10.1/src/lib/WP5DefinitionGroup.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5DefinitionGroup.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -88,7 +88,7 @@ WP5DefinitionGroup::WP5DefinitionGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption) : WP5VariableLengthGroup(), - m_subGroupData(0) + m_subGroupData(nullptr) { _read(input, encryption); } diff -Nru libwpd-0.10.1/src/lib/WP5DefinitionGroup.h libwpd-0.10.2/src/lib/WP5DefinitionGroup.h --- libwpd-0.10.1/src/lib/WP5DefinitionGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5DefinitionGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,7 +33,7 @@ { public: WP5DefinitionGroup_DefineTablesSubGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned short subGroupSize); - void parse(WP5Listener *listener); + void parse(WP5Listener *listener) override; private: unsigned char m_position; @@ -51,11 +51,11 @@ { public: WP5DefinitionGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP5DefinitionGroup(); - void parse(WP5Listener *listener); + ~WP5DefinitionGroup() override; + void parse(WP5Listener *listener) override; protected: - virtual void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: WP5DefinitionGroup(const WP5DefinitionGroup &); diff -Nru libwpd-0.10.1/src/lib/WP5ExtendedCharacterGroup.h libwpd-0.10.2/src/lib/WP5ExtendedCharacterGroup.h --- libwpd-0.10.1/src/lib/WP5ExtendedCharacterGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5ExtendedCharacterGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -35,10 +35,10 @@ { public: WP5ExtendedCharacterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP5Listener *listener); + void parse(WP5Listener *listener) override; protected: - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: unsigned char m_character; diff -Nru libwpd-0.10.1/src/lib/WP5FontGroup.h libwpd-0.10.2/src/lib/WP5FontGroup.h --- libwpd-0.10.1/src/lib/WP5FontGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5FontGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,10 +32,10 @@ { public: WP5FontGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP5Listener *listener); + void parse(WP5Listener *listener) override; protected: - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: unsigned char m_red, m_green, m_blue; diff -Nru libwpd-0.10.1/src/lib/WP5FontNameStringPoolPacket.h libwpd-0.10.2/src/lib/WP5FontNameStringPoolPacket.h --- libwpd-0.10.1/src/lib/WP5FontNameStringPoolPacket.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5FontNameStringPoolPacket.h 2017-09-08 17:04:25.000000000 +0000 @@ -36,8 +36,8 @@ { public: WP5FontNameStringPoolPacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int id, unsigned dataOffset, unsigned dataSize); - ~WP5FontNameStringPoolPacket(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned dataSize); + ~WP5FontNameStringPoolPacket() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned dataSize) override; librevenge::RVNGString getFontName(const unsigned int offset) const; private: diff -Nru libwpd-0.10.1/src/lib/WP5FootnoteEndnoteGroup.cpp libwpd-0.10.2/src/lib/WP5FootnoteEndnoteGroup.cpp --- libwpd-0.10.1/src/lib/WP5FootnoteEndnoteGroup.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5FootnoteEndnoteGroup.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -30,7 +30,7 @@ WP5FootnoteEndnoteGroup::WP5FootnoteEndnoteGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption) : WP5VariableLengthGroup(), - m_subDocument(0), + m_subDocument(nullptr), m_noteReference() { _read(input, encryption); diff -Nru libwpd-0.10.1/src/lib/WP5FootnoteEndnoteGroup.h libwpd-0.10.2/src/lib/WP5FootnoteEndnoteGroup.h --- libwpd-0.10.1/src/lib/WP5FootnoteEndnoteGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5FootnoteEndnoteGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -35,9 +35,9 @@ { public: WP5FootnoteEndnoteGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP5FootnoteEndnoteGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP5Listener *listener); + ~WP5FootnoteEndnoteGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP5Listener *listener) override; private: WP5FootnoteEndnoteGroup(const WP5FootnoteEndnoteGroup &); diff -Nru libwpd-0.10.1/src/lib/WP5GeneralPacketData.cpp libwpd-0.10.2/src/lib/WP5GeneralPacketData.cpp --- libwpd-0.10.1/src/lib/WP5GeneralPacketData.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5GeneralPacketData.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -51,7 +51,7 @@ return new WP5GraphicsInformationPacket(input, encryption, packetIndex->getID(), packetIndex->getDataOffset(), packetIndex->getDataSize()); default: - return 0; + return nullptr; } } diff -Nru libwpd-0.10.1/src/lib/WP5GraphicsInformationPacket.cpp libwpd-0.10.2/src/lib/WP5GraphicsInformationPacket.cpp --- libwpd-0.10.1/src/lib/WP5GraphicsInformationPacket.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5GraphicsInformationPacket.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -38,17 +38,17 @@ WP5GraphicsInformationPacket::~WP5GraphicsInformationPacket() { - for (std::vector::iterator iter1 = m_data.begin(); iter1 != m_data.end(); ++iter1) + for (auto &iter1 : m_data) { - if ((*iter1)) - delete [](*iter1); - (*iter1) = 0; + if (iter1) + delete []iter1; + iter1 = 0; } - for (std::vector::iterator iter2 = m_images.begin(); iter2 != m_images.end(); ++iter2) + for (auto &image : m_images) { - if ((*iter2)) - delete(*iter2); - (*iter2) = 0; + if (image) + delete image; + image = 0; } } diff -Nru libwpd-0.10.1/src/lib/WP5GraphicsInformationPacket.h libwpd-0.10.2/src/lib/WP5GraphicsInformationPacket.h --- libwpd-0.10.1/src/lib/WP5GraphicsInformationPacket.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5GraphicsInformationPacket.h 2017-09-08 17:04:25.000000000 +0000 @@ -36,8 +36,8 @@ { public: WP5GraphicsInformationPacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int id, unsigned dataOffset, unsigned dataSize); - ~WP5GraphicsInformationPacket(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned dataSize); + ~WP5GraphicsInformationPacket() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned dataSize) override; const std::vector &getImages() const { return m_images; @@ -45,7 +45,7 @@ const librevenge::RVNGBinaryData *getImage(unsigned long imageIndex) const { if (imageIndex < m_images.size()) return m_images[imageIndex]; - return 0; + return nullptr; } private: diff -Nru libwpd-0.10.1/src/lib/WP5HeaderFooterGroup.cpp libwpd-0.10.2/src/lib/WP5HeaderFooterGroup.cpp --- libwpd-0.10.1/src/lib/WP5HeaderFooterGroup.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5HeaderFooterGroup.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -29,7 +29,7 @@ WP5HeaderFooterGroup::WP5HeaderFooterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption) : WP5VariableLengthGroup(), m_occurrenceBits(0), - m_subDocument(0) + m_subDocument(nullptr) { _read(input, encryption); } diff -Nru libwpd-0.10.1/src/lib/WP5HeaderFooterGroup.h libwpd-0.10.2/src/lib/WP5HeaderFooterGroup.h --- libwpd-0.10.1/src/lib/WP5HeaderFooterGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5HeaderFooterGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,9 +33,9 @@ { public: WP5HeaderFooterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP5HeaderFooterGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP5Listener *listener); + ~WP5HeaderFooterGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP5Listener *listener) override; private: WP5HeaderFooterGroup(const WP5HeaderFooterGroup &); diff -Nru libwpd-0.10.1/src/lib/WP5Header.h libwpd-0.10.2/src/lib/WP5Header.h --- libwpd-0.10.1/src/lib/WP5Header.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5Header.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,7 +34,7 @@ public: WP5Header(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned documentOffset, unsigned char productType, unsigned char fileType, unsigned char majorVersion, unsigned char minorVersion, unsigned short documentEncryption); - ~WP5Header() {} + ~WP5Header() override {} }; #endif /* _WP5HEADER_H */ /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP5IndentGroup.h libwpd-0.10.2/src/lib/WP5IndentGroup.h --- libwpd-0.10.1/src/lib/WP5IndentGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5IndentGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,10 +33,10 @@ { public: WP5IndentGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP5Listener *listener); + void parse(WP5Listener *listener) override; protected: - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: unsigned char m_indentType; diff -Nru libwpd-0.10.1/src/lib/WP5Listener.cpp libwpd-0.10.2/src/lib/WP5Listener.cpp --- libwpd-0.10.1/src/lib/WP5Listener.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5Listener.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -32,7 +32,7 @@ #include "WP5PrefixData.h" WP5Listener::WP5Listener() : - m_prefixData(0) + m_prefixData(nullptr) { } @@ -41,6 +41,6 @@ if (m_prefixData) return m_prefixData->getGeneralPacketData(type); else - return 0; + return nullptr; } /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP5ListFontsUsedPacket.h libwpd-0.10.2/src/lib/WP5ListFontsUsedPacket.h --- libwpd-0.10.1/src/lib/WP5ListFontsUsedPacket.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5ListFontsUsedPacket.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,8 +33,8 @@ { public: WP5ListFontsUsedPacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int id, unsigned dataOffset, unsigned dataSize, unsigned short packetType); - ~WP5ListFontsUsedPacket(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned dataSize); + ~WP5ListFontsUsedPacket() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned dataSize) override; unsigned getFontNameOffset(unsigned fontNumber) const; double getFontSize(unsigned fontNumber) const; diff -Nru libwpd-0.10.1/src/lib/WP5PageFormatGroup.cpp libwpd-0.10.2/src/lib/WP5PageFormatGroup.cpp --- libwpd-0.10.1/src/lib/WP5PageFormatGroup.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5PageFormatGroup.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -158,8 +158,8 @@ m_marginOffset = readU16(input, encryption); if (0xFFFF != (m_marginOffset & 0xFFFF)) { - for (std::vector::iterator iter = m_tabStops.begin(); iter != m_tabStops.end(); ++iter) - iter->m_position -= (double)((double)m_marginOffset/(double)WPX_NUM_WPUS_PER_INCH); + for (auto &tabStop : m_tabStops) + tabStop.m_position -= (double)((double)m_marginOffset/(double)WPX_NUM_WPUS_PER_INCH); } } else diff -Nru libwpd-0.10.1/src/lib/WP5PageFormatGroup.h libwpd-0.10.2/src/lib/WP5PageFormatGroup.h --- libwpd-0.10.1/src/lib/WP5PageFormatGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5PageFormatGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -35,9 +35,9 @@ { public: WP5PageFormatGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP5PageFormatGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP5Listener *listener); + ~WP5PageFormatGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP5Listener *listener) override; private: // variables needed for subgroup 1 (Left/Right Margin Set) diff -Nru libwpd-0.10.1/src/lib/WP5Parser.cpp libwpd-0.10.2/src/lib/WP5Parser.cpp --- libwpd-0.10.1/src/lib/WP5Parser.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5Parser.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -26,6 +26,9 @@ */ #include "WP5Parser.h" + +#include + #include "WPXHeader.h" #include "WP5Part.h" #include "WP5ContentListener.h" @@ -47,17 +50,7 @@ WP5PrefixData *WP5Parser::getPrefixData(librevenge::RVNGInputStream *input, WPXEncryption *encryption) { - WP5PrefixData *prefixData = 0; - try - { - prefixData = new WP5PrefixData(input, encryption); - return prefixData; - } - catch (FileException) - { - DELETEP(prefixData); - throw FileException(); - } + return new WP5PrefixData(input, encryption); } void WP5Parser::parse(librevenge::RVNGInputStream *input, WPXEncryption *encryption, WP5Listener *listener) @@ -115,12 +108,9 @@ } else { - WP5Part *part = WP5Part::constructPart(input, encryption, readVal); + std::unique_ptr part(WP5Part::constructPart(input, encryption, readVal)); if (part) - { part->parse(listener); - DELETEP(part); - } } } } @@ -131,7 +121,7 @@ WPXEncryption *encryption = getEncryption(); std::list pageList; WPXTableList tableList; - WP5PrefixData *prefixData = 0; + WP5PrefixData *prefixData = nullptr; std::vector subDocuments; try @@ -198,10 +188,10 @@ // cleanup section: free the used resources delete prefixData; - for (std::vector::iterator iterSubDoc = subDocuments.begin(); iterSubDoc != subDocuments.end(); ++iterSubDoc) + for (auto &subDocument : subDocuments) { - if (*iterSubDoc) - delete(*iterSubDoc); + if (subDocument) + delete subDocument; } } catch (FileException) @@ -209,10 +199,10 @@ WPD_DEBUG_MSG(("WordPerfect: File Exception. Parse terminated prematurely.")); delete prefixData; - for (std::vector::iterator iterSubDoc = subDocuments.begin(); iterSubDoc != subDocuments.end(); ++iterSubDoc) + for (auto &subDocument : subDocuments) { - if (*iterSubDoc) - delete(*iterSubDoc); + if (subDocument) + delete subDocument; } throw FileException(); @@ -231,26 +221,26 @@ { WP5StylesListener stylesListener(pageList, tableList, subDocuments); stylesListener.startSubDocument(); - parseDocument(input, 0, &stylesListener); + parseDocument(input, nullptr, &stylesListener); stylesListener.endSubDocument(); input->seek(0, librevenge::RVNG_SEEK_SET); WP5ContentListener listener(pageList, subDocuments, documentInterface); listener.startSubDocument(); - parseDocument(input, 0, &listener); + parseDocument(input, nullptr, &listener); listener.endSubDocument(); - for (std::vector::iterator iterSubDoc = subDocuments.begin(); iterSubDoc != subDocuments.end(); ++iterSubDoc) - if (*iterSubDoc) - delete(*iterSubDoc); + for (auto &subDocument : subDocuments) + if (subDocument) + delete subDocument; } catch (FileException) { WPD_DEBUG_MSG(("WordPerfect: File Exception. Parse terminated prematurely.")); - for (std::vector::iterator iterSubDoc = subDocuments.begin(); iterSubDoc != subDocuments.end(); ++iterSubDoc) - if (*iterSubDoc) - delete(*iterSubDoc); + for (auto &subDocument : subDocuments) + if (subDocument) + delete subDocument; throw FileException(); } } diff -Nru libwpd-0.10.1/src/lib/WP5Parser.h libwpd-0.10.2/src/lib/WP5Parser.h --- libwpd-0.10.1/src/lib/WP5Parser.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5Parser.h 2017-09-08 17:04:25.000000000 +0000 @@ -36,10 +36,10 @@ { public: WP5Parser(librevenge::RVNGInputStream *input, WPXHeader *header, WPXEncryption *encryption); - ~WP5Parser(); + ~WP5Parser() override; - void parse(librevenge::RVNGTextInterface *documentInterface); - void parseSubDocument(librevenge::RVNGTextInterface *documentInterface); + void parse(librevenge::RVNGTextInterface *documentInterface) override; + void parseSubDocument(librevenge::RVNGTextInterface *documentInterface) override; static void parseDocument(librevenge::RVNGInputStream *input, WPXEncryption *encryption, WP5Listener *listener); diff -Nru libwpd-0.10.1/src/lib/WP5Part.cpp libwpd-0.10.2/src/lib/WP5Part.cpp --- libwpd-0.10.1/src/lib/WP5Part.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5Part.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -53,7 +53,7 @@ if (!WP5FixedLengthGroup::isGroupConsistent(input, encryption, readVal)) { WPD_DEBUG_MSG(("WordPerfect: Consistency Check (fixed length) failed; ignoring this byte\n")); - return 0; + return nullptr; } WPD_DEBUG_MSG(("WordPerfect: constructFixedLengthGroup(input, val)\n")); return WP5FixedLengthGroup::constructFixedLengthGroup(input, encryption, readVal); @@ -70,7 +70,7 @@ if (!WP5VariableLengthGroup::isGroupConsistent(input, encryption, readVal)) { WPD_DEBUG_MSG(("WordPerfect: Consistency Check (variable length) failed; ignoring this byte\n")); - return 0; + return nullptr; } WPD_DEBUG_MSG(("WordPerfect: constructVariableLengthGroup(input, val)\n")); return WP5VariableLengthGroup::constructVariableLengthGroup(input, encryption, readVal); @@ -78,6 +78,6 @@ WPD_DEBUG_MSG(("WordPerfect: Returning 0 from constructPart\n")); - return 0; + return nullptr; } /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP5PrefixData.cpp libwpd-0.10.2/src/lib/WP5PrefixData.cpp --- libwpd-0.10.1/src/lib/WP5PrefixData.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5PrefixData.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -96,7 +96,7 @@ { std::map::const_iterator Iter; for (Iter = m_generalPacketData.begin(); Iter != m_generalPacketData.end(); ++Iter) - delete(Iter->second); + delete (Iter->second); } const WP5GeneralPacketData *WP5PrefixData::getGeneralPacketData(const int type) const @@ -105,6 +105,6 @@ if (Iter != m_generalPacketData.end()) return static_cast(Iter->second); else - return 0; + return nullptr; } /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP5SingleByteFunction.cpp libwpd-0.10.2/src/lib/WP5SingleByteFunction.cpp --- libwpd-0.10.1/src/lib/WP5SingleByteFunction.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5SingleByteFunction.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -59,7 +59,7 @@ default: // should not happen - return 0; + return nullptr; } } diff -Nru libwpd-0.10.1/src/lib/WP5SingleByteFunction.h libwpd-0.10.2/src/lib/WP5SingleByteFunction.h --- libwpd-0.10.1/src/lib/WP5SingleByteFunction.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5SingleByteFunction.h 2017-09-08 17:04:25.000000000 +0000 @@ -39,32 +39,32 @@ class WP5EOLFunction : public WP5SingleByteFunction { public: - void parse(WP5Listener *listener); + void parse(WP5Listener *listener) override; }; class WP5SpaceFunction : public WP5SingleByteFunction { public: - void parse(WP5Listener *listener); + void parse(WP5Listener *listener) override; }; class WP5HardSpaceFunction : public WP5SingleByteFunction { public: - void parse(WP5Listener *listener); + void parse(WP5Listener *listener) override; }; class WP5HyphenFunction : public WP5SingleByteFunction { public: - void parse(WP5Listener *listener); + void parse(WP5Listener *listener) override; }; class WP5SoftHyphenFunction : public WP5SingleByteFunction { public: - void parse(WP5Listener *listener); + void parse(WP5Listener *listener) override; }; #endif /* WP5SINGLEBYTEFUNCTION_H */ diff -Nru libwpd-0.10.1/src/lib/WP5StylesListener.cpp libwpd-0.10.2/src/lib/WP5StylesListener.cpp --- libwpd-0.10.1/src/lib/WP5StylesListener.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5StylesListener.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -38,7 +38,7 @@ m_currentPage(), m_nextPage(), m_tableList(tableList), - m_currentTable(0), + m_currentTable(nullptr), m_tempMarginLeft(1.0), m_tempMarginRight(1.0), m_currentPageHasContent(false), @@ -85,18 +85,18 @@ m_currentPage = WPXPageSpan(m_pageList.back(), 0.0, 0.0); m_currentPage.setPageSpan(1); - for (std::vector::const_iterator HFiter = (m_nextPage.getHeaderFooterList()).begin(); - HFiter != (m_nextPage.getHeaderFooterList()).end(); ++HFiter) + std::vector headerFooterList = m_nextPage.getHeaderFooterList(); + for (const auto &hf : headerFooterList) { - if ((*HFiter).getOccurrence() != NEVER) + if (hf.getOccurrence() != NEVER) { - m_currentPage.setHeaderFooter((*HFiter).getType(), (*HFiter).getInternalType(), - (*HFiter).getOccurrence(), (*HFiter).getSubDocument(), (*HFiter).getTableList()); - _handleSubDocument((*HFiter).getSubDocument(), WPX_SUBDOCUMENT_HEADER_FOOTER, (*HFiter).getTableList()); + m_currentPage.setHeaderFooter(hf.getType(), hf.getInternalType(), + hf.getOccurrence(), hf.getSubDocument(), hf.getTableList()); + _handleSubDocument(hf.getSubDocument(), WPX_SUBDOCUMENT_HEADER_FOOTER, hf.getTableList()); } else - m_currentPage.setHeaderFooter((*HFiter).getType(), (*HFiter).getInternalType(), - (*HFiter).getOccurrence(), 0, (*HFiter).getTableList()); + m_currentPage.setHeaderFooter(hf.getType(), hf.getInternalType(), + hf.getOccurrence(), nullptr, hf.getTableList()); } m_nextPage = WPXPageSpan(); m_currentPageHasContent = false; @@ -226,7 +226,7 @@ if (wpxOccurrence != NEVER) m_nextPage.setHeaderFooter(wpxType, headerFooterType, wpxOccurrence, subDocument, tableList); else - m_nextPage.setHeaderFooter(wpxType, headerFooterType, wpxOccurrence, 0, tableList); + m_nextPage.setHeaderFooter(wpxType, headerFooterType, wpxOccurrence, nullptr, tableList); } else /* FOOTER || !tempCurrentPageHasContent */ { @@ -236,7 +236,7 @@ _handleSubDocument(subDocument, WPX_SUBDOCUMENT_HEADER_FOOTER, tableList); } else - m_currentPage.setHeaderFooter(wpxType, headerFooterType, wpxOccurrence, 0, tableList); + m_currentPage.setHeaderFooter(wpxType, headerFooterType, wpxOccurrence, nullptr, tableList); } } m_currentPageHasContent = tempCurrentPageHasContent; diff -Nru libwpd-0.10.1/src/lib/WP5StylesListener.h libwpd-0.10.2/src/lib/WP5StylesListener.h --- libwpd-0.10.1/src/lib/WP5StylesListener.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5StylesListener.h 2017-09-08 17:04:25.000000000 +0000 @@ -41,56 +41,56 @@ public: WP5StylesListener(std::list &pageList, WPXTableList tableList, std::vector &subDocuments); - void startDocument() {} - void startSubDocument() {} - void setFont(const librevenge::RVNGString & /* fontName */, double /* fontSize */) {} - void setTabs(const std::vector & /* tabStops */, unsigned short /* tabOffset */) {} - void insertCharacter(unsigned /* character */) + void startDocument() override {} + void startSubDocument() override {} + void setFont(const librevenge::RVNGString & /* fontName */, double /* fontSize */) override {} + void setTabs(const std::vector & /* tabStops */, unsigned short /* tabOffset */) override {} + void insertCharacter(unsigned /* character */) override { /*if (!isUndoOn())*/ m_currentPageHasContent = true; } - void insertTab(unsigned char /* tabType */, double /* tabPosition */) + void insertTab(unsigned char /* tabType */, double /* tabPosition */) override { /*if (!isUndoOn())*/ m_currentPageHasContent = true; } - virtual void insertIndent(unsigned char /* indentType */, double /* indentPosition */) + void insertIndent(unsigned char /* indentType */, double /* indentPosition */) override { /*if (!isUndoOn())*/ m_currentPageHasContent = true; } - void characterColorChange(unsigned char /* red */, unsigned char /* green */, unsigned char /* blue */) {} - void insertEOL() + void characterColorChange(unsigned char /* red */, unsigned char /* green */, unsigned char /* blue */) override {} + void insertEOL() override { /*if (!isUndoOn())*/ m_currentPageHasContent = true; } - void insertBreak(unsigned char breakType); - void attributeChange(bool /* isOn */, unsigned char /* attribute */) {} - void lineSpacingChange(double /* lineSpacing */) {} - void justificationChange(unsigned char /* justification */) {} - void pageMarginChange(unsigned char side, unsigned short margin); - void pageFormChange(unsigned short length, unsigned short width, WPXFormOrientation orientation); - void marginChange(unsigned char side, unsigned short margin); - void endDocument(); - void endSubDocument(); + void insertBreak(unsigned char breakType) override; + void attributeChange(bool /* isOn */, unsigned char /* attribute */) override {} + void lineSpacingChange(double /* lineSpacing */) override {} + void justificationChange(unsigned char /* justification */) override {} + void pageMarginChange(unsigned char side, unsigned short margin) override; + void pageFormChange(unsigned short length, unsigned short width, WPXFormOrientation orientation) override; + void marginChange(unsigned char side, unsigned short margin) override; + void endDocument() override; + void endSubDocument() override; - void defineTable(unsigned char /* position */, unsigned short /* leftOffset */) {} + void defineTable(unsigned char /* position */, unsigned short /* leftOffset */) override {} void addTableColumnDefinition(unsigned /* width */, unsigned /* leftGutter */, unsigned /* rightGutter */, - unsigned /* attributes */, unsigned char /* alignment */) {} - void startTable(); - void insertRow(unsigned short rowHeight, bool isMinimumHeight, bool isHeaderRow); + unsigned /* attributes */, unsigned char /* alignment */) override {} + void startTable() override; + void insertRow(unsigned short rowHeight, bool isMinimumHeight, bool isHeaderRow) override; void insertCell(unsigned char colSpan, unsigned char rowSpan, unsigned char borderBits, const RGBSColor *cellFgColor, const RGBSColor *cellBgColor, const RGBSColor *cellBorderColor, WPXVerticalAlignment cellVerticalAlignment, - bool useCellAttributes, unsigned cellAttributes); - void endTable() {} + bool useCellAttributes, unsigned cellAttributes) override; + void endTable() override {} - void insertNoteReference(const librevenge::RVNGString & /* noteReference */) {} - void insertNote(WPXNoteType /* noteType */, const WP5SubDocument * /* subDocument */) {} - void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP5SubDocument *subDocument); - void suppressPageCharacteristics(unsigned char suppressCode); + void insertNoteReference(const librevenge::RVNGString & /* noteReference */) override {} + void insertNote(WPXNoteType /* noteType */, const WP5SubDocument * /* subDocument */) override {} + void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP5SubDocument *subDocument) override; + void suppressPageCharacteristics(unsigned char suppressCode) override; - void boxOn(unsigned char /* positionAndType */, unsigned char /* alignment */, unsigned short /* width */, unsigned short /* height */, unsigned short /* x */, unsigned short /* y */) {} - virtual void boxOff() {} - virtual void insertGraphicsData(const librevenge::RVNGBinaryData * /* data */) {} + void boxOn(unsigned char /* positionAndType */, unsigned char /* alignment */, unsigned short /* width */, unsigned short /* height */, unsigned short /* x */, unsigned short /* y */) override {} + void boxOff() override {} + void insertGraphicsData(const librevenge::RVNGBinaryData * /* data */) override {} protected: void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0); diff -Nru libwpd-0.10.1/src/lib/WP5SubDocument.cpp libwpd-0.10.2/src/lib/WP5SubDocument.cpp --- libwpd-0.10.1/src/lib/WP5SubDocument.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5SubDocument.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -38,6 +38,6 @@ if (!tmpStream) return; tmpStream->seek(0, librevenge::RVNG_SEEK_SET); - WP5Parser::parseDocument(tmpStream, 0, listener); + WP5Parser::parseDocument(tmpStream, nullptr, listener); } /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP5TabGroup.h libwpd-0.10.2/src/lib/WP5TabGroup.h --- libwpd-0.10.1/src/lib/WP5TabGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5TabGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,10 +33,10 @@ { public: WP5TabGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP5Listener *listener); + void parse(WP5Listener *listener) override; protected: - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: unsigned char m_tabType; diff -Nru libwpd-0.10.1/src/lib/WP5TableEOLGroup.cpp libwpd-0.10.2/src/lib/WP5TableEOLGroup.cpp --- libwpd-0.10.1/src/lib/WP5TableEOLGroup.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5TableEOLGroup.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -90,7 +90,7 @@ if (!m_spannedFromAbove) { RGBSColor tmpCellBorderColor(0x00, 0x00, 0x00, 0x64); - listener->insertCell(m_colSpan, m_rowSpan, 0x00, 0, 0, &tmpCellBorderColor , + listener->insertCell(m_colSpan, m_rowSpan, 0x00, nullptr, nullptr, &tmpCellBorderColor, TOP, m_useCellAttributes, m_cellAttributes); } break; diff -Nru libwpd-0.10.1/src/lib/WP5TableEOLGroup.h libwpd-0.10.2/src/lib/WP5TableEOLGroup.h --- libwpd-0.10.1/src/lib/WP5TableEOLGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5TableEOLGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,9 +33,9 @@ { public: WP5TableEOLGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP5TableEOLGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP5Listener *listener); + ~WP5TableEOLGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP5Listener *listener) override; private: // Beginning column sub-function diff -Nru libwpd-0.10.1/src/lib/WP5TableEOPGroup.h libwpd-0.10.2/src/lib/WP5TableEOPGroup.h --- libwpd-0.10.1/src/lib/WP5TableEOPGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5TableEOPGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,9 +33,9 @@ { public: WP5TableEOPGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP5TableEOPGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP5Listener *listener); + ~WP5TableEOPGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP5Listener *listener) override; }; diff -Nru libwpd-0.10.1/src/lib/WP5UnsupportedFixedLengthGroup.h libwpd-0.10.2/src/lib/WP5UnsupportedFixedLengthGroup.h --- libwpd-0.10.1/src/lib/WP5UnsupportedFixedLengthGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5UnsupportedFixedLengthGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,10 +33,10 @@ { public: WP5UnsupportedFixedLengthGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP5Listener * /* listener */) {} + void parse(WP5Listener * /* listener */) override {} protected: - void _readContents(librevenge::RVNGInputStream * /* input */, WPXEncryption * /* encryption */) {} + void _readContents(librevenge::RVNGInputStream * /* input */, WPXEncryption * /* encryption */) override {} }; #endif /* WP5UNSUPPORTEDFIXEDLENGTHGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP5UnsupportedVariableLengthGroup.h libwpd-0.10.2/src/lib/WP5UnsupportedVariableLengthGroup.h --- libwpd-0.10.1/src/lib/WP5UnsupportedVariableLengthGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5UnsupportedVariableLengthGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -36,7 +36,7 @@ { public: WP5UnsupportedVariableLengthGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP5Listener * /* listener */) {} + void parse(WP5Listener * /* listener */) override {} }; #endif /* WP5UNSUPPORTEDVARIABLELENGTHGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP5VariableLengthGroup.h libwpd-0.10.2/src/lib/WP5VariableLengthGroup.h --- libwpd-0.10.1/src/lib/WP5VariableLengthGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP5VariableLengthGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -41,7 +41,7 @@ { public: WP5VariableLengthGroup(); // WP5VariableLengthGroup should _never_ be constructed, only its inherited classes - virtual ~WP5VariableLengthGroup() {} + ~WP5VariableLengthGroup() override {} static WP5VariableLengthGroup *constructVariableLengthGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, const unsigned char group); diff -Nru libwpd-0.10.1/src/lib/WP60Header.h libwpd-0.10.2/src/lib/WP60Header.h --- libwpd-0.10.1/src/lib/WP60Header.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP60Header.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,7 +33,7 @@ public: WP60Header(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned documentOffset, unsigned char productType, unsigned char fileType, unsigned char majorVersion, unsigned char minorVersion, unsigned short documentEncryption); - ~WP60Header(); + ~WP60Header() override; }; #endif /* _WP60HEADER_H */ /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP61Header.h libwpd-0.10.2/src/lib/WP61Header.h --- libwpd-0.10.1/src/lib/WP61Header.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP61Header.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,7 +33,7 @@ public: WP61Header(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned documentOffset, unsigned char productType, unsigned char fileType, unsigned char majorVersion, unsigned char minorVersion, unsigned short documentEncryption); - ~WP61Header(); + ~WP61Header() override; unsigned getDocumentSize() const { diff -Nru libwpd-0.10.1/src/lib/WP6AttributeGroup.h libwpd-0.10.2/src/lib/WP6AttributeGroup.h --- libwpd-0.10.1/src/lib/WP6AttributeGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6AttributeGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,14 +33,14 @@ { public: WP6AttributeGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - virtual void parse(WP6Listener *listener) = 0; + void parse(WP6Listener *listener) override = 0; unsigned char getAttribute() const { return m_attribute; } protected: - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: unsigned char m_attribute; @@ -50,14 +50,14 @@ { public: WP6AttributeOnGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; class WP6AttributeOffGroup : public WP6AttributeGroup { public: WP6AttributeOffGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; #endif /* WP6ATTRIBUTEGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP6BoxGroup.cpp libwpd-0.10.2/src/lib/WP6BoxGroup.cpp --- libwpd-0.10.1/src/lib/WP6BoxGroup.cpp 2015-12-30 08:21:51.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6BoxGroup.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -287,7 +287,7 @@ (getSubGroup() != WP6_BOX_GROUP_PAGE_ANCHORED_BOX)) // Don't handle Graphics Rule for the while return; - const WP6GraphicsBoxStylePacket *gbsPacket = 0; + const WP6GraphicsBoxStylePacket *gbsPacket = nullptr; for (int j=0; j(listener->getPrefixDataPacket(getPrefixIDs()[j])))) break; @@ -308,7 +308,7 @@ std::vector graphicsDataIds; std::vector::iterator gdiIter; - WP6SubDocument *subDocument = 0; + WP6SubDocument *subDocument = nullptr; // Get the box content for (int i=0; i 24) { - m_packet = new WP6FontDescriptorPacket(input, encryption, 0, (unsigned)input->tell(), sizeDeletable); + m_packet.reset(new WP6FontDescriptorPacket(input, encryption, 0, (unsigned)input->tell(), sizeDeletable)); WPD_DEBUG_MSG(("WordPerfect: Character Group Font Face Change subgroup info (font name: %s)\n", m_packet->getFontName().cstr())); } @@ -112,7 +112,6 @@ WP6CharacterGroup_FontFaceChangeSubGroup::~WP6CharacterGroup_FontFaceChangeSubGroup() { - DELETEP(m_packet); } void WP6CharacterGroup_FontFaceChangeSubGroup::parse(WP6Listener *listener, const unsigned char /* numPrefixIDs */, unsigned short const *prefixIDs) const @@ -277,7 +276,7 @@ WP6CharacterGroup::WP6CharacterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption) : WP6VariableLengthGroup(), - m_subGroupData(0) + m_subGroupData(nullptr) { _read(input, encryption); } diff -Nru libwpd-0.10.1/src/lib/WP6CharacterGroup.h libwpd-0.10.2/src/lib/WP6CharacterGroup.h --- libwpd-0.10.1/src/lib/WP6CharacterGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6CharacterGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -27,6 +27,8 @@ #ifndef WP6CHARACTERGROUP_H #define WP6CHARACTERGROUP_H +#include + #include "WP6VariableLengthGroup.h" #include "WP6FontDescriptorPacket.h" @@ -34,7 +36,7 @@ { public: WP6CharacterGroup_SetAlignmentCharacterSubGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const; + void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const override; private: unsigned char m_character; @@ -45,7 +47,7 @@ { public: WP6CharacterGroup_ColorSubGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const; + void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const override; private: unsigned char m_red; @@ -57,7 +59,7 @@ { public: WP6CharacterGroup_CharacterShadingChangeSubGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const; + void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const override; private: unsigned char m_shading; @@ -67,15 +69,15 @@ { public: WP6CharacterGroup_FontFaceChangeSubGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned short sizeDeletable); - ~WP6CharacterGroup_FontFaceChangeSubGroup(); - void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const; + ~WP6CharacterGroup_FontFaceChangeSubGroup() override; + void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const override; private: unsigned short m_oldMatchedPointSize; unsigned short m_hash; unsigned short m_matchedFontIndex; unsigned short m_matchedFontPointSize; - WP6FontDescriptorPacket *m_packet; + std::unique_ptr m_packet; // Unimplemented to prevent compiler from creating crasher ones WP6CharacterGroup_FontFaceChangeSubGroup(const WP6CharacterGroup_FontFaceChangeSubGroup &); WP6CharacterGroup_FontFaceChangeSubGroup &operator=(const WP6CharacterGroup_FontFaceChangeSubGroup &); @@ -86,7 +88,7 @@ { public: WP6CharacterGroup_FontSizeChangeSubGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const; + void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const override; private: unsigned short m_desiredFontPointSize; @@ -96,7 +98,7 @@ { public: WP6CharacterGroup_SetDotLeaderCharactersSubGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const; + void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const override; private: unsigned char m_character; @@ -108,7 +110,7 @@ { public: WP6CharacterGroup_ParagraphNumberOnSubGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const; + void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const override; private: unsigned short m_outlineHash; @@ -120,7 +122,7 @@ { public: WP6CharacterGroup_TableDefinitionOnSubGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const; + void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const override; private: unsigned char m_flags; @@ -132,7 +134,7 @@ { public: WP6CharacterGroup_TableDefinitionOffSubGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const; + void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const override; private: @@ -142,7 +144,7 @@ { public: WP6CharacterGroup_TableColumnSubGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const; + void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const override; private: unsigned char m_flags; @@ -160,7 +162,7 @@ { public: WP6CharacterGroup_CommentSubGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const; + void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const override; private: @@ -170,9 +172,9 @@ { public: WP6CharacterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP6CharacterGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener); + ~WP6CharacterGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener *listener) override; private: WP6CharacterGroup(const WP6CharacterGroup &); diff -Nru libwpd-0.10.1/src/lib/WP6ColumnGroup.h libwpd-0.10.2/src/lib/WP6ColumnGroup.h --- libwpd-0.10.1/src/lib/WP6ColumnGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6ColumnGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -38,8 +38,8 @@ { public: WP6ColumnGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener *listener) override; private: // variables needed for subgroup 0 and 1 (Left/Right Margin Set) diff -Nru libwpd-0.10.1/src/lib/WP6CommentAnnotationPacket.h libwpd-0.10.2/src/lib/WP6CommentAnnotationPacket.h --- libwpd-0.10.1/src/lib/WP6CommentAnnotationPacket.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6CommentAnnotationPacket.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,9 +33,9 @@ { public: WP6CommentAnnotationPacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int id, unsigned dataOffset, unsigned dataSize); - ~WP6CommentAnnotationPacket(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener * /*listener*/) const {} + ~WP6CommentAnnotationPacket() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener * /*listener*/) const override {} unsigned char getAnnotationFlag() const { return m_flags; diff -Nru libwpd-0.10.1/src/lib/WP6ContentListener.cpp libwpd-0.10.2/src/lib/WP6ContentListener.cpp --- libwpd-0.10.1/src/lib/WP6ContentListener.cpp 2015-12-30 08:29:59.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6ContentListener.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -54,8 +54,8 @@ WP6OutlineDefinition::WP6OutlineDefinition() { unsigned char numberingMethods[WP6_NUM_LIST_LEVELS]; - for (int i=0; im_highlightColor.reset(); if (isOn) - m_ps->m_highlightColor = new RGBSColor(color.m_r, color.m_g, color.m_b, color.m_s); - else - DELETEP(m_ps->m_highlightColor); + m_ps->m_highlightColor.reset(new RGBSColor(color.m_r, color.m_g, color.m_b, color.m_s)); } } @@ -1251,7 +1249,7 @@ m_documentInterface->openEndnote(propList); unsigned short textPID = (unsigned short)m_parseState->m_noteTextPID; - handleSubDocument(((textPID && WP6Listener::getPrefixDataPacket(textPID)) ? WP6Listener::getPrefixDataPacket(textPID)->getSubDocument() : 0), + handleSubDocument(((textPID && WP6Listener::getPrefixDataPacket(textPID)) ? WP6Listener::getPrefixDataPacket(textPID)->getSubDocument() : nullptr), WPX_SUBDOCUMENT_NOTE, m_parseState->m_tableList, m_parseState->m_nextTableIndice); if (noteType == FOOTNOTE) @@ -1755,7 +1753,7 @@ m_ps->m_isNote = true; - handleSubDocument(((textPID && WP6Listener::getPrefixDataPacket(textPID)) ? WP6Listener::getPrefixDataPacket(textPID)->getSubDocument() : 0), + handleSubDocument(((textPID && WP6Listener::getPrefixDataPacket(textPID)) ? WP6Listener::getPrefixDataPacket(textPID)->getSubDocument() : nullptr), WPX_SUBDOCUMENT_COMMENT_ANNOTATION, m_parseState->m_tableList, m_parseState->m_nextTableIndice); m_ps->m_isNote = false; @@ -1768,9 +1766,9 @@ WPXTableList tableList, unsigned nextTableIndice) { // save our old parsing state on our "stack" - WP6ContentParsingState *oldParseState = m_parseState; + auto oldParseState = std::move(m_parseState); - m_parseState = new WP6ContentParsingState(tableList, nextTableIndice); + m_parseState = std::unique_ptr(new WP6ContentParsingState(tableList, nextTableIndice)); m_parseState->m_numNestedNotes = oldParseState->m_numNestedNotes; if (subDocumentType == WPX_SUBDOCUMENT_HEADER_FOOTER) @@ -1807,8 +1805,7 @@ oldParseState->m_numNestedNotes = m_parseState->m_numNestedNotes; // restore our old parsing state - delete m_parseState; - m_parseState = oldParseState; + m_parseState = std::move(oldParseState); m_parseState->m_noteTextPID = 0; } diff -Nru libwpd-0.10.1/src/lib/WP6ContentListener.h libwpd-0.10.2/src/lib/WP6ContentListener.h --- libwpd-0.10.1/src/lib/WP6ContentListener.h 2015-12-30 08:28:04.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6ContentListener.h 2017-09-08 17:04:25.000000000 +0000 @@ -35,6 +35,7 @@ #include #include +#include #include class WPXTable; @@ -161,13 +162,13 @@ { public: WP6ContentListener(std::list &pageList, WPXTableList tableList, librevenge::RVNGTextInterface *documentInterface); - ~WP6ContentListener(); + ~WP6ContentListener() override; - void startDocument() + void startDocument() override { WPXContentListener::startDocument(); } - void startSubDocument() + void startSubDocument() override { WPXContentListener::startSubDocument(); } @@ -175,104 +176,104 @@ const unsigned char month, const unsigned char day, const unsigned char hour, const unsigned char minute, const unsigned char second, const unsigned char dayOfWeek, - const unsigned char timeZone, const unsigned char unused); - void setExtendedInformation(const unsigned short type, const librevenge::RVNGString &data); - void setAlignmentCharacter(const unsigned character); - void setLeaderCharacter(const unsigned character, const unsigned char numSpaces); + const unsigned char timeZone, const unsigned char unused) override; + void setExtendedInformation(const unsigned short type, const librevenge::RVNGString &data) override; + void setAlignmentCharacter(const unsigned character) override; + void setLeaderCharacter(const unsigned character, const unsigned char numSpaces) override; void defineTabStops(const bool isRelative, const std::vector &tabStops, - const std::vector &usePreWP9LeaderMethods); - void insertCharacter(unsigned character); - void insertTab(const unsigned char tabType, double tabPosition); - void handleLineBreak(); - void insertEOL(); - void insertBreak(const unsigned char breakType) + const std::vector &usePreWP9LeaderMethods) override; + void insertCharacter(unsigned character) override; + void insertTab(const unsigned char tabType, double tabPosition) override; + void handleLineBreak() override; + void insertEOL() override; + void insertBreak(const unsigned char breakType) override { WPXContentListener::insertBreak(breakType); } - void lineSpacingChange(const double lineSpacing) + void lineSpacingChange(const double lineSpacing) override { WPXContentListener::lineSpacingChange(lineSpacing); } - void justificationChange(const unsigned char justification) + void justificationChange(const unsigned char justification) override { WPXContentListener::justificationChange(justification); } - void characterColorChange(const unsigned char red, const unsigned char green, const unsigned char blue); - void characterShadingChange(const unsigned char shading); - void highlightChange(const bool isOn, const RGBSColor &color); - void fontChange(const unsigned short matchedFontPointSize, const unsigned short fontPID, const librevenge::RVNGString &fontName); - void attributeChange(const bool isOn, const unsigned char attribute); - void spacingAfterParagraphChange(const double spacingRelative, const double spacingAbsolute); - void pageNumberingChange(const WPXPageNumberPosition /* page numbering position */, const unsigned short /* matchedFontPointSize */, const unsigned short /* fontPID */) {} - void pageMarginChange(const unsigned char /* side */, const unsigned short /* margin */) {} - void pageFormChange(const unsigned short /* length */, const unsigned short /* width */, const WPXFormOrientation /* orientation */) {} - void marginChange(const unsigned char side, const unsigned short margin); - void paragraphMarginChange(const unsigned char side, const signed short margin); - void indentFirstLineChange(const signed short offset); + void characterColorChange(const unsigned char red, const unsigned char green, const unsigned char blue) override; + void characterShadingChange(const unsigned char shading) override; + void highlightChange(const bool isOn, const RGBSColor &color) override; + void fontChange(const unsigned short matchedFontPointSize, const unsigned short fontPID, const librevenge::RVNGString &fontName) override; + void attributeChange(const bool isOn, const unsigned char attribute) override; + void spacingAfterParagraphChange(const double spacingRelative, const double spacingAbsolute) override; + void pageNumberingChange(const WPXPageNumberPosition /* page numbering position */, const unsigned short /* matchedFontPointSize */, const unsigned short /* fontPID */) override {} + void pageMarginChange(const unsigned char /* side */, const unsigned short /* margin */) override {} + void pageFormChange(const unsigned short /* length */, const unsigned short /* width */, const WPXFormOrientation /* orientation */) override {} + void marginChange(const unsigned char side, const unsigned short margin) override; + void paragraphMarginChange(const unsigned char side, const signed short margin) override; + void indentFirstLineChange(const signed short offset) override; void columnChange(const WPXTextColumnType columnType, const unsigned char numColumns, const std::vector &columnWidth, - const std::vector &isFixedWidth); - void updateOutlineDefinition(const unsigned short outlineHash, const unsigned char *numberingMethods, const unsigned char tabBehaviourFlag); + const std::vector &isFixedWidth) override; + void updateOutlineDefinition(const unsigned short outlineHash, const unsigned char *numberingMethods, const unsigned char tabBehaviourFlag) override; - void paragraphNumberOn(const unsigned short outlineHash, const unsigned char level, const unsigned char flag); - void paragraphNumberOff(); - void displayNumberReferenceGroupOn(const unsigned char subGroup, const unsigned char level); - void displayNumberReferenceGroupOff(const unsigned char subGroup); - void styleGroupOn(const unsigned char subGroup); - void styleGroupOff(const unsigned char subGroup); - void globalOn(const unsigned char systemStyle); - void globalOff(); - void noteOn(const unsigned short textPID); - void noteOff(const WPXNoteType noteType); - void headerFooterGroup(const unsigned char /* headerFooterType */, const unsigned char /* occurrenceBits */, const unsigned short /* textPID */) {} - void suppressPageCharacteristics(const unsigned char /* suppressCode */) {} - void setPageNumber(const unsigned short /* pageNumber */) {} - void setPageNumberingType(const WPXNumberingType pageNumberingType); - void endDocument() + void paragraphNumberOn(const unsigned short outlineHash, const unsigned char level, const unsigned char flag) override; + void paragraphNumberOff() override; + void displayNumberReferenceGroupOn(const unsigned char subGroup, const unsigned char level) override; + void displayNumberReferenceGroupOff(const unsigned char subGroup) override; + void styleGroupOn(const unsigned char subGroup) override; + void styleGroupOff(const unsigned char subGroup) override; + void globalOn(const unsigned char systemStyle) override; + void globalOff() override; + void noteOn(const unsigned short textPID) override; + void noteOff(const WPXNoteType noteType) override; + void headerFooterGroup(const unsigned char /* headerFooterType */, const unsigned char /* occurrenceBits */, const unsigned short /* textPID */) override {} + void suppressPageCharacteristics(const unsigned char /* suppressCode */) override {} + void setPageNumber(const unsigned short /* pageNumber */) override {} + void setPageNumberingType(const WPXNumberingType pageNumberingType) override; + void endDocument() override { WPXContentListener::endDocument(); } - void endSubDocument() + void endSubDocument() override { WPXContentListener::endSubDocument(); } - void defineTable(const unsigned char position, const unsigned short leftOffset); + void defineTable(const unsigned char position, const unsigned short leftOffset) override; void addTableColumnDefinition(const unsigned width, const unsigned leftGutter, const unsigned rightGutter, - const unsigned attributes, const unsigned char alignment); - void startTable(); - void insertRow(const unsigned short rowHeight, const bool isMinimumHeight, const bool isHeaderRow); + const unsigned attributes, const unsigned char alignment) override; + void startTable() override; + void insertRow(const unsigned short rowHeight, const bool isMinimumHeight, const bool isHeaderRow) override; void insertCell(const unsigned char colSpan, const unsigned char rowSpan, const unsigned char borderBits, const RGBSColor *cellFgColor, const RGBSColor *cellBgColor, const RGBSColor *cellBorderColor, const WPXVerticalAlignment cellVerticalAlignment, - const bool useCellAttributes, const unsigned cellAttributes); - void endTable(); + const bool useCellAttributes, const unsigned cellAttributes) override; + void endTable() override; void boxOn(const unsigned char anchoringType, const unsigned char generalPositioningFlags, const unsigned char horizontalPositioningFlags, const signed short horizontalOffset, const unsigned char leftColumn, const unsigned char rightColumn, const unsigned char verticalPositioningFlags, const signed short verticalOffset, const unsigned char widthFlags, const unsigned short width, const unsigned char heightFlags, const unsigned short height, const unsigned char boxContentType, const unsigned short nativeWidth, const unsigned short nativeHeight, - const librevenge::RVNGString &linkTarget); - void boxOff(); - void insertGraphicsData(const unsigned short packetId); - void insertTextBox(const WP6SubDocument *subDocument); - void commentAnnotation(const unsigned short textPID); + const librevenge::RVNGString &linkTarget) override; + void boxOff() override; + void insertGraphicsData(const unsigned short packetId) override; + void insertTextBox(const WP6SubDocument *subDocument) override; + void commentAnnotation(const unsigned short textPID) override; - void undoChange(const unsigned char undoType, const unsigned short undoLevel); + void undoChange(const unsigned char undoType, const unsigned short undoLevel) override; protected: - void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0); + void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0) override; //void _handleLineBreakElementBegin(); void _paragraphNumberOn(const unsigned short outlineHash, const unsigned char level); - void _flushText(); + void _flushText() override; void _handleListChange(const unsigned short outlineHash); - void _changeList(); + void _changeList() override; private: WP6ContentListener(const WP6ContentListener &); WP6ContentListener &operator=(const WP6ContentListener &); - WP6ContentParsingState *m_parseState; + std::unique_ptr m_parseState; std::map m_outlineDefineHash; std::map m_listDefinitions; diff -Nru libwpd-0.10.1/src/lib/WP6DefaultInitialFontPacket.h libwpd-0.10.2/src/lib/WP6DefaultInitialFontPacket.h --- libwpd-0.10.1/src/lib/WP6DefaultInitialFontPacket.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6DefaultInitialFontPacket.h 2017-09-08 17:04:25.000000000 +0000 @@ -32,7 +32,7 @@ { public: WP6DefaultInitialFontPacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int id, unsigned dataOffset, unsigned dataSize); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; unsigned short getInitialFontDescriptorPID() const { return m_initialFontDescriptorPID; @@ -41,7 +41,7 @@ { return m_pointSize; } - void parse(WP6Listener *listener) const; + void parse(WP6Listener *listener) const override; private: unsigned short m_numPrefixIDs; diff -Nru libwpd-0.10.1/src/lib/WP6DisplayNumberReferenceGroup.h libwpd-0.10.2/src/lib/WP6DisplayNumberReferenceGroup.h --- libwpd-0.10.1/src/lib/WP6DisplayNumberReferenceGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6DisplayNumberReferenceGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,8 +33,8 @@ { public: WP6DisplayNumberReferenceGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener *listener) override; private: unsigned char m_levelNumberToDisplay; diff -Nru libwpd-0.10.1/src/lib/WP6EOLGroup.cpp libwpd-0.10.2/src/lib/WP6EOLGroup.cpp --- libwpd-0.10.1/src/lib/WP6EOLGroup.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6EOLGroup.cpp 2017-04-15 10:17:38.000000000 +0000 @@ -45,8 +45,8 @@ m_cellJustification(0), m_cellVerticalAlign(TOP), - m_cellFgColor(0), - m_cellBgColor(0), + m_cellFgColor(), + m_cellBgColor(), m_cellBorderColor(new RGBSColor(0x00,0x00,0x00,0x64)), m_cellBorders(0x00), @@ -61,9 +61,6 @@ WP6EOLGroup::~WP6EOLGroup() { - DELETEP(m_cellFgColor); - DELETEP(m_cellBgColor); - DELETEP(m_cellBorderColor); } void WP6EOLGroup::_readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) @@ -185,8 +182,8 @@ bB = readU8(input, encryption); bS = readU8(input, encryption); - m_cellFgColor = new RGBSColor(fR,fG,fB,fS); - m_cellBgColor = new RGBSColor(bR,bG,bB,bS); + m_cellFgColor.reset(new RGBSColor(fR,fG,fB,fS)); + m_cellBgColor.reset(new RGBSColor(bR,bG,bB,bS)); WPD_DEBUG_MSG(("WordPerfect: EOL Group Embedded FG Color (%i, %i, %i, %i) BG Color (%i, %i, %i, %i)\n", m_cellFgColor->m_r, m_cellFgColor->m_g, m_cellFgColor->m_b, m_cellFgColor->m_s, m_cellBgColor->m_r, m_cellBgColor->m_g, m_cellBgColor->m_b, m_cellBgColor->m_s)); @@ -248,9 +245,9 @@ WPD_DEBUG_MSG(("WordPerfect: handling an EOL group\n")); // first off, grab any prefix information which may be useful - const RGBSColor *cellFgColor = m_cellFgColor; - const RGBSColor *cellBgColor = m_cellBgColor; - const RGBSColor *cellBorderColor = m_cellBorderColor; + const RGBSColor *cellFgColor = m_cellFgColor.get(); + const RGBSColor *cellBgColor = m_cellBgColor.get(); + const RGBSColor *cellBorderColor = m_cellBorderColor.get(); if (!cellFgColor && !cellBgColor) { diff -Nru libwpd-0.10.1/src/lib/WP6EOLGroup.h libwpd-0.10.2/src/lib/WP6EOLGroup.h --- libwpd-0.10.1/src/lib/WP6EOLGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6EOLGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -27,15 +27,17 @@ #ifndef WP6EOLGROUP_H #define WP6EOLGROUP_H +#include + #include "WP6VariableLengthGroup.h" class WP6EOLGroup : public WP6VariableLengthGroup { public: WP6EOLGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP6EOLGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener); + ~WP6EOLGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener *listener) override; private: WP6EOLGroup(const WP6EOLGroup &); @@ -50,9 +52,9 @@ WPXVerticalAlignment m_cellVerticalAlign; // cell forground and background color - RGBSColor *m_cellFgColor; - RGBSColor *m_cellBgColor; - RGBSColor *m_cellBorderColor; + std::unique_ptr m_cellFgColor; + std::unique_ptr m_cellBgColor; + std::unique_ptr m_cellBorderColor; unsigned char m_cellBorders; bool m_isHeaderRow; diff -Nru libwpd-0.10.1/src/lib/WP6ExtendedCharacterGroup.h libwpd-0.10.2/src/lib/WP6ExtendedCharacterGroup.h --- libwpd-0.10.1/src/lib/WP6ExtendedCharacterGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6ExtendedCharacterGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,10 +34,10 @@ { public: WP6ExtendedCharacterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; protected: - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: unsigned char m_character; diff -Nru libwpd-0.10.1/src/lib/WP6ExtendedDocumentSummaryPacket.cpp libwpd-0.10.2/src/lib/WP6ExtendedDocumentSummaryPacket.cpp --- libwpd-0.10.1/src/lib/WP6ExtendedDocumentSummaryPacket.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6ExtendedDocumentSummaryPacket.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -33,8 +33,8 @@ WP6ExtendedDocumentSummaryPacket::WP6ExtendedDocumentSummaryPacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int /* id */, unsigned dataOffset, unsigned dataSize) : WP6PrefixDataPacket(input, encryption), m_dataSize(dataSize), - m_streamData(0), - m_stream(0) + m_streamData(), + m_stream() { if (dataSize > 0) _read(input, encryption, dataOffset, dataSize); @@ -42,10 +42,6 @@ WP6ExtendedDocumentSummaryPacket::~WP6ExtendedDocumentSummaryPacket() { - if (m_stream) - DELETEP(m_stream); - if (m_streamData) - delete [] m_streamData; } void WP6ExtendedDocumentSummaryPacket::_readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) @@ -54,11 +50,11 @@ return; if (m_dataSize > ((std::numeric_limits::max)() / 2)) m_dataSize = ((std::numeric_limits::max)() / 2); - m_streamData = new unsigned char[m_dataSize]; + m_streamData.reserve(m_dataSize); for (unsigned i=0; i<(unsigned)m_dataSize; i++) - m_streamData[i] = readU8(input, encryption); + m_streamData.push_back(readU8(input, encryption)); - m_stream = new WPXMemoryInputStream(m_streamData, (unsigned long)m_dataSize); + m_stream.reset(new WPXMemoryInputStream(m_streamData.data(), (unsigned long)m_dataSize)); } void WP6ExtendedDocumentSummaryPacket::parse(WP6Listener *listener) const @@ -71,7 +67,7 @@ { try { - groupLength = readU16(m_stream, 0); + groupLength = readU16(m_stream.get(), nullptr); } catch (FileException) { @@ -79,7 +75,7 @@ } if ((groupLength == 0) || m_stream->isEnd()) return; - unsigned short tagID = readU16(m_stream, 0); + unsigned short tagID = readU16(m_stream.get(), nullptr); if (m_stream->isEnd()) return; if (m_stream->seek(2, librevenge::RVNG_SEEK_CUR)) @@ -88,8 +84,8 @@ librevenge::RVNGString name; unsigned short wpChar = 0; if (!m_stream->isEnd()) - wpChar = readU16(m_stream, 0); - for (; wpChar != 0 && !m_stream->isEnd(); wpChar = readU16(m_stream, 0)) + wpChar = readU16(m_stream.get(), nullptr); + for (; wpChar != 0 && !m_stream->isEnd(); wpChar = readU16(m_stream.get(), nullptr)) { unsigned char character = (unsigned char)(wpChar & 0x00FF); unsigned char characterSet = (unsigned char)((wpChar >> 8) & 0x00FF); @@ -108,15 +104,15 @@ { try { - unsigned short year = readU16(m_stream, 0); - unsigned char month = readU8(m_stream, 0); - unsigned char day = readU8(m_stream, 0); - unsigned char hour = readU8(m_stream, 0); - unsigned char minute = readU8(m_stream, 0); - unsigned char second = readU8(m_stream, 0); - unsigned char dayOfWeek = readU8(m_stream, 0); - unsigned char timeZone = readU8(m_stream, 0); - unsigned char unused = readU8(m_stream, 0); + unsigned short year = readU16(m_stream.get(), nullptr); + unsigned char month = readU8(m_stream.get(), nullptr); + unsigned char day = readU8(m_stream.get(), nullptr); + unsigned char hour = readU8(m_stream.get(), nullptr); + unsigned char minute = readU8(m_stream.get(), nullptr); + unsigned char second = readU8(m_stream.get(), nullptr); + unsigned char dayOfWeek = readU8(m_stream.get(), nullptr); + unsigned char timeZone = readU8(m_stream.get(), nullptr); + unsigned char unused = readU8(m_stream.get(), nullptr); if (month > 0 && day > 0 && year >= 1900) listener->setDate(tagID, year, month, day, hour, minute, second, dayOfWeek, timeZone, unused); } @@ -129,8 +125,8 @@ { librevenge::RVNGString data; if (!m_stream->isEnd()) - wpChar = readU16(m_stream, 0); - for (; wpChar != 0 && !m_stream->isEnd(); wpChar = readU16(m_stream, 0)) + wpChar = readU16(m_stream.get(), nullptr); + for (; wpChar != 0 && !m_stream->isEnd(); wpChar = readU16(m_stream.get(), nullptr)) { unsigned char character = (unsigned char)(wpChar & 0x00FF); unsigned char characterSet = (unsigned char)((wpChar >> 8) & 0x00FF); diff -Nru libwpd-0.10.1/src/lib/WP6ExtendedDocumentSummaryPacket.h libwpd-0.10.2/src/lib/WP6ExtendedDocumentSummaryPacket.h --- libwpd-0.10.1/src/lib/WP6ExtendedDocumentSummaryPacket.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6ExtendedDocumentSummaryPacket.h 2017-09-08 17:04:25.000000000 +0000 @@ -26,6 +26,10 @@ #ifndef WP6EXTENDEDDOCUMENTSUMMARYPACKET_H #define WP6EXTENDEDDOCUMENTSUMMARYPACKET_H + +#include +#include + #include "WP6PrefixDataPacket.h" #include "WP6FileStructure.h" #include "WP6Listener.h" @@ -35,16 +39,16 @@ { public: WP6ExtendedDocumentSummaryPacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int id, unsigned dataOffset, unsigned dataSize); - ~WP6ExtendedDocumentSummaryPacket(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener) const; + ~WP6ExtendedDocumentSummaryPacket() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener *listener) const override; private: WP6ExtendedDocumentSummaryPacket(const WP6ExtendedDocumentSummaryPacket &); WP6ExtendedDocumentSummaryPacket &operator=(const WP6ExtendedDocumentSummaryPacket &); unsigned m_dataSize; - unsigned char *m_streamData; - mutable WPXMemoryInputStream *m_stream; + std::vector m_streamData; + mutable std::unique_ptr m_stream; }; #endif /* WP6EXTENDEDDOCUMENTSUMMARYPACKET_H */ diff -Nru libwpd-0.10.1/src/lib/WP6FillStylePacket.h libwpd-0.10.2/src/lib/WP6FillStylePacket.h --- libwpd-0.10.1/src/lib/WP6FillStylePacket.h 2015-12-30 08:26:50.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6FillStylePacket.h 2017-09-08 17:04:25.000000000 +0000 @@ -36,9 +36,9 @@ { public: WP6FillStylePacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int id, unsigned dataOffset, unsigned dataSize); - ~WP6FillStylePacket(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener * /* listener */) const {} + ~WP6FillStylePacket() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener * /* listener */) const override {} const RGBSColor *getFgColor() const { return &m_fgColor; diff -Nru libwpd-0.10.1/src/lib/WP6FontDescriptorPacket.cpp libwpd-0.10.2/src/lib/WP6FontDescriptorPacket.cpp --- libwpd-0.10.1/src/lib/WP6FontDescriptorPacket.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6FontDescriptorPacket.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -118,11 +118,11 @@ WPD_DEBUG_MSG(("WordPerfect: stripping font name (original: %s)\n", m_fontName.cstr())); std::string stringValue(m_fontName.cstr()); std::string::size_type pos; - for (unsigned k = 0; k < countElements(FONT_WEIGHT_STRINGS); k++) + for (auto &k : FONT_WEIGHT_STRINGS) { if (!stringValue.empty()) - while ((pos = stringValue.find(FONT_WEIGHT_STRINGS[k])) != std::string::npos) - stringValue.replace(pos, strlen(FONT_WEIGHT_STRINGS[k]),""); + while ((pos = stringValue.find(k)) != std::string::npos) + stringValue.replace(pos, strlen(k),""); } // SPECIAL CASE: eliminate the -WP postfix (if it's there), which isn't spaced out from // the rest of the font diff -Nru libwpd-0.10.1/src/lib/WP6FontDescriptorPacket.h libwpd-0.10.2/src/lib/WP6FontDescriptorPacket.h --- libwpd-0.10.1/src/lib/WP6FontDescriptorPacket.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6FontDescriptorPacket.h 2017-09-08 17:04:25.000000000 +0000 @@ -35,8 +35,8 @@ { public: WP6FontDescriptorPacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int id, unsigned dataOffset, unsigned dataSize); - ~WP6FontDescriptorPacket(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + ~WP6FontDescriptorPacket() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; const librevenge::RVNGString &getFontName() const { return m_fontName; diff -Nru libwpd-0.10.1/src/lib/WP6FootnoteEndnoteGroup.h libwpd-0.10.2/src/lib/WP6FootnoteEndnoteGroup.h --- libwpd-0.10.1/src/lib/WP6FootnoteEndnoteGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6FootnoteEndnoteGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,8 +33,8 @@ { public: WP6FootnoteEndnoteGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener *listener) override; }; #endif /* WP6FOOTNOTEENDNOTEGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP6GeneralTextPacket.cpp libwpd-0.10.2/src/lib/WP6GeneralTextPacket.cpp --- libwpd-0.10.1/src/lib/WP6GeneralTextPacket.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6GeneralTextPacket.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -32,8 +32,8 @@ WP6GeneralTextPacket::WP6GeneralTextPacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int /* id */, unsigned dataOffset, unsigned dataSize): WP6PrefixDataPacket(input, encryption), - m_subDocument(0), - m_streamData(0) + m_subDocument(nullptr), + m_streamData(nullptr) { _read(input, encryption, dataOffset, dataSize); } diff -Nru libwpd-0.10.1/src/lib/WP6GeneralTextPacket.h libwpd-0.10.2/src/lib/WP6GeneralTextPacket.h --- libwpd-0.10.1/src/lib/WP6GeneralTextPacket.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6GeneralTextPacket.h 2017-09-08 17:04:25.000000000 +0000 @@ -36,10 +36,10 @@ { public: WP6GeneralTextPacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int id, unsigned dataOffset, unsigned dataSize); - ~WP6GeneralTextPacket(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener) const; - WP6SubDocument *getSubDocument() const + ~WP6GeneralTextPacket() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener *listener) const override; + WP6SubDocument *getSubDocument() const override { return m_subDocument; } diff -Nru libwpd-0.10.1/src/lib/WP6GraphicsBoxStylePacket.h libwpd-0.10.2/src/lib/WP6GraphicsBoxStylePacket.h --- libwpd-0.10.1/src/lib/WP6GraphicsBoxStylePacket.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6GraphicsBoxStylePacket.h 2017-09-08 17:04:25.000000000 +0000 @@ -35,9 +35,9 @@ { public: WP6GraphicsBoxStylePacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int id, unsigned dataOffset, unsigned dataSize); - ~WP6GraphicsBoxStylePacket(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener * /*listener*/) const {} + ~WP6GraphicsBoxStylePacket() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener * /*listener*/) const override {} unsigned char getGeneralPositioningFlags() const { diff -Nru libwpd-0.10.1/src/lib/WP6GraphicsCachedFileDataPacket.cpp libwpd-0.10.2/src/lib/WP6GraphicsCachedFileDataPacket.cpp --- libwpd-0.10.1/src/lib/WP6GraphicsCachedFileDataPacket.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6GraphicsCachedFileDataPacket.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -33,8 +33,8 @@ WP6GraphicsCachedFileDataPacket::WP6GraphicsCachedFileDataPacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int id, unsigned dataOffset, unsigned dataSize): WP6PrefixDataPacket(input, encryption), m_id(id), - m_object(0), - m_data(0) + m_object(nullptr), + m_data(nullptr) { _read(input, encryption, dataOffset, dataSize); } @@ -43,10 +43,10 @@ { if (m_data) delete [] m_data; - m_data = 0; + m_data = nullptr; if (m_object) delete m_object; - m_object = 0; + m_object = nullptr; } void WP6GraphicsCachedFileDataPacket::_readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) diff -Nru libwpd-0.10.1/src/lib/WP6GraphicsCachedFileDataPacket.h libwpd-0.10.2/src/lib/WP6GraphicsCachedFileDataPacket.h --- libwpd-0.10.1/src/lib/WP6GraphicsCachedFileDataPacket.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6GraphicsCachedFileDataPacket.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,9 +34,9 @@ { public: WP6GraphicsCachedFileDataPacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int id, unsigned dataOffset, unsigned dataSize); - ~WP6GraphicsCachedFileDataPacket(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener * /* listener */) const {} + ~WP6GraphicsCachedFileDataPacket() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener * /* listener */) const override {} const librevenge::RVNGBinaryData *getBinaryObject() const { return m_object; diff -Nru libwpd-0.10.1/src/lib/WP6GraphicsFilenamePacket.h libwpd-0.10.2/src/lib/WP6GraphicsFilenamePacket.h --- libwpd-0.10.1/src/lib/WP6GraphicsFilenamePacket.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6GraphicsFilenamePacket.h 2017-09-08 17:04:25.000000000 +0000 @@ -35,9 +35,9 @@ { public: WP6GraphicsFilenamePacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int id, const unsigned char flags, unsigned dataOffset, unsigned dataSize); - ~WP6GraphicsFilenamePacket(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener * /*listener */) const {} + ~WP6GraphicsFilenamePacket() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener * /*listener */) const override {} const std::vector getChildIds() const; private: diff -Nru libwpd-0.10.1/src/lib/WP6HeaderFooterGroup.h libwpd-0.10.2/src/lib/WP6HeaderFooterGroup.h --- libwpd-0.10.1/src/lib/WP6HeaderFooterGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6HeaderFooterGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,8 +33,8 @@ { public: WP6HeaderFooterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener *listener) override; private: unsigned char m_occurrenceBits; diff -Nru libwpd-0.10.1/src/lib/WP6Header.h libwpd-0.10.2/src/lib/WP6Header.h --- libwpd-0.10.1/src/lib/WP6Header.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6Header.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,7 +33,7 @@ public: WP6Header(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned documentOffset, unsigned char productType, unsigned char fileType, unsigned char majorVersion, unsigned char minorVersion, unsigned short documentEncryption); - virtual ~WP6Header() {} + ~WP6Header() override {} unsigned short getIndexHeaderOffset() const { diff -Nru libwpd-0.10.1/src/lib/WP6HighlightGroup.h libwpd-0.10.2/src/lib/WP6HighlightGroup.h --- libwpd-0.10.1/src/lib/WP6HighlightGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6HighlightGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,14 +34,14 @@ { public: WP6HighlightGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - virtual void parse(WP6Listener *listener) = 0; + void parse(WP6Listener *listener) override = 0; const RGBSColor getColor() const { return m_color; } protected: - virtual void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: RGBSColor m_color; @@ -51,14 +51,14 @@ { public: WP6HighlightOnGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; class WP6HighlightOffGroup : public WP6HighlightGroup { public: WP6HighlightOffGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; #endif /* WP6HIGHLIGHTGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP6HyperlinkPacket.h libwpd-0.10.2/src/lib/WP6HyperlinkPacket.h --- libwpd-0.10.1/src/lib/WP6HyperlinkPacket.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6HyperlinkPacket.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,7 +34,7 @@ { public: WP6HyperlinkPacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int id, unsigned dataOffset, unsigned dataSize); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; const librevenge::RVNGString &getTarget() const; diff -Nru libwpd-0.10.1/src/lib/WP6Listener.cpp libwpd-0.10.2/src/lib/WP6Listener.cpp --- libwpd-0.10.1/src/lib/WP6Listener.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6Listener.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -37,7 +37,7 @@ #include "WP6DefaultInitialFontPacket.h" WP6Listener::WP6Listener() : - m_prefixData(0) + m_prefixData(nullptr) { } @@ -46,7 +46,7 @@ if (m_prefixData) return m_prefixData->getPrefixDataPacket(prefixID); else - return 0; + return nullptr; } librevenge::RVNGString WP6Listener::getFontNameForPID(const int prefixID) const diff -Nru libwpd-0.10.1/src/lib/WP6NumberingMethodGroup.h libwpd-0.10.2/src/lib/WP6NumberingMethodGroup.h --- libwpd-0.10.1/src/lib/WP6NumberingMethodGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6NumberingMethodGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -27,9 +27,9 @@ { public: WP6NumberingMethodGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP6NumberingMethodGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener); + ~WP6NumberingMethodGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener *listener) override; private: unsigned char m_levelNumber; unsigned char m_numberingMethod; diff -Nru libwpd-0.10.1/src/lib/WP6OutlineStylePacket.cpp libwpd-0.10.2/src/lib/WP6OutlineStylePacket.cpp --- libwpd-0.10.1/src/lib/WP6OutlineStylePacket.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6OutlineStylePacket.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -35,8 +35,8 @@ m_outlineFlags(0), m_tabBehaviourFlag(0) { - for (unsigned i = 0; i < WP6_NUM_LIST_LEVELS; i++) - m_numberingMethods[i] = 0; + for (unsigned char &numberingMethod : m_numberingMethods) + numberingMethod = 0; _read(input, encryption, dataOffset, dataSize); } @@ -54,8 +54,8 @@ #endif m_outlineFlags = readU8(input, encryption); m_outlineHash = readU16(input, encryption); - for (unsigned i=0; i> 5) // leader character type + switch ((tabType & 0x60) >> 5) // leader character type { case 0: // pre-WP9 leader method - tmp_tabStop.m_leaderCharacter = '.'; - tmp_tabStop.m_leaderNumSpaces = 0; - tmp_usePreWP9LeaderMethod = true; + tabStop.m_leaderCharacter = '.'; + tabStop.m_leaderNumSpaces = 0; + usePreWP9LeaderMethod = true; break; case 1: // dot leader - tmp_tabStop.m_leaderCharacter = '.'; - tmp_tabStop.m_leaderNumSpaces = 0; - tmp_usePreWP9LeaderMethod = false; + tabStop.m_leaderCharacter = '.'; + tabStop.m_leaderNumSpaces = 0; + usePreWP9LeaderMethod = false; break; case 2: // hyphen leader - tmp_tabStop.m_leaderCharacter = '-'; - tmp_tabStop.m_leaderNumSpaces = 0; - tmp_usePreWP9LeaderMethod = false; + tabStop.m_leaderCharacter = '-'; + tabStop.m_leaderNumSpaces = 0; + usePreWP9LeaderMethod = false; break; case 3: // underscore leader - tmp_tabStop.m_leaderCharacter = '_'; - tmp_tabStop.m_leaderNumSpaces = 0; - tmp_usePreWP9LeaderMethod = false; + tabStop.m_leaderCharacter = '_'; + tabStop.m_leaderNumSpaces = 0; + usePreWP9LeaderMethod = false; break; default: break; } } } - unsigned short tmp_tabPosition = readU16(input, encryption); - if (tmp_repetitionCount == 0) + unsigned short tabPosition = readU16(input, encryption); + if (repetitionCount == 0) { - if (tmp_tabPosition != 0xFFFF) + if (tabPosition != 0xFFFF) { - tmp_tabStop.m_position = (double)((double)tmp_tabPosition/(double)WPX_NUM_WPUS_PER_INCH) - - m_tabAdjustValue; - m_tabStops.push_back(tmp_tabStop); - m_usePreWP9LeaderMethods.push_back(tmp_usePreWP9LeaderMethod); + tabStop.m_position = double(tabPosition)/WPX_NUM_WPUS_PER_INCH - m_tabAdjustValue; + m_tabStops.push_back(tabStop); + m_usePreWP9LeaderMethods.push_back(usePreWP9LeaderMethod); } } else { - for (int k=0; k + #include "WP6StylesListener.h" #include "WP6ContentListener.h" #include "WP6Parser.h" @@ -48,7 +50,7 @@ WP6PrefixData *WP6Parser::getPrefixData(librevenge::RVNGInputStream *input, WPXEncryption *encryption) { - WP6PrefixData *prefixData = 0; + WP6PrefixData *prefixData = nullptr; try { prefixData = new WP6PrefixData(input, encryption, (static_cast(getHeader())->getNumPrefixIndices())); @@ -59,7 +61,6 @@ WPD_DEBUG_MSG(("WordPerfect: Prefix Data most likely corrupted.\n")); // TODO: Try to check packet after packet so that we try to recover at least the begining if the corruption is not at // the begining. - DELETEP(prefixData); throw FileException(); } catch (...) @@ -67,8 +68,7 @@ WPD_DEBUG_MSG(("WordPerfect: Prefix Data most likely corrupted. Trying to ignore.\n")); // TODO: Try to check packet after packet so that we try to recover at least the begining if the corruption is not at // the begining. - DELETEP(prefixData); - return 0; + return nullptr; } } @@ -144,12 +144,9 @@ } else { - WP6Part *part = WP6Part::constructPart(input, encryption, readVal); + std::unique_ptr part(WP6Part::constructPart(input, encryption, readVal)); if (part) - { part->parse(listener); - DELETEP(part); - } } } } @@ -184,63 +181,48 @@ // information to a low-level listener void WP6Parser::parse(librevenge::RVNGTextInterface *documentInterface) { - WP6PrefixData *prefixData = 0; std::list pageList; WPXTableList tableList; librevenge::RVNGInputStream *input = getInput(); WPXEncryption *encryption = getEncryption(); - try - { - prefixData = getPrefixData(input, encryption); - - // do a "first-pass" parse of the document - // gather table border information, page properties (per-page) - WP6StylesListener stylesListener(pageList, tableList); - stylesListener.setPrefixData(prefixData); - parse(input, encryption, &stylesListener); + std::unique_ptr prefixData(getPrefixData(input, encryption)); - // postprocess the pageList == remove duplicate page spans due to the page breaks - std::list::iterator previousPage = pageList.begin(); - for (std::list::iterator Iter=pageList.begin(); Iter != pageList.end(); /* Iter++ */) - { - if ((Iter != previousPage) && ((*previousPage)==(*Iter))) - { - (*previousPage).setPageSpan((*previousPage).getPageSpan() + (*Iter).getPageSpan()); - Iter = pageList.erase(Iter); - } - else - { - previousPage = Iter; - ++Iter; - } + // do a "first-pass" parse of the document + // gather table border information, page properties (per-page) + WP6StylesListener stylesListener(pageList, tableList); + stylesListener.setPrefixData(prefixData.get()); + parse(input, encryption, &stylesListener); + + // postprocess the pageList == remove duplicate page spans due to the page breaks + std::list::iterator previousPage = pageList.begin(); + for (std::list::iterator Iter=pageList.begin(); Iter != pageList.end(); /* Iter++ */) + { + if ((Iter != previousPage) && ((*previousPage)==(*Iter))) + { + (*previousPage).setPageSpan((*previousPage).getPageSpan() + (*Iter).getPageSpan()); + Iter = pageList.erase(Iter); + } + else + { + previousPage = Iter; + ++Iter; } - - // second pass: here is where we actually send the messages to the target app - // that are necessary to emit the body of the target document - WP6ContentListener listener(pageList, tableList, documentInterface); - listener.setPrefixData(prefixData); - - // get the relevant initial prefix packets out of storage and tell them to parse - // themselves - parsePacket(prefixData, WP6_INDEX_HEADER_EXTENDED_DOCUMENT_SUMMARY, &listener); - parsePacket(prefixData, WP6_INDEX_HEADER_INITIAL_FONT, &listener); - parsePackets(prefixData, WP6_INDEX_HEADER_OUTLINE_STYLE, &listener); - - parse(input, encryption, &listener); - - // cleanup section: free the used resources - delete prefixData; } - catch (FileException) - { - WPD_DEBUG_MSG(("WordPerfect: File Exception. Parse terminated prematurely.")); - delete prefixData; + // second pass: here is where we actually send the messages to the target app + // that are necessary to emit the body of the target document + WP6ContentListener listener(pageList, tableList, documentInterface); + listener.setPrefixData(prefixData.get()); + + // get the relevant initial prefix packets out of storage and tell them to parse + // themselves + parsePacket(prefixData.get(), WP6_INDEX_HEADER_EXTENDED_DOCUMENT_SUMMARY, &listener); + parsePacket(prefixData.get(), WP6_INDEX_HEADER_INITIAL_FONT, &listener); + parsePackets(prefixData.get(), WP6_INDEX_HEADER_OUTLINE_STYLE, &listener); - throw FileException(); - } + parse(input, encryption, &listener); } void WP6Parser::parseSubDocument(librevenge::RVNGTextInterface *documentInterface) @@ -254,14 +236,14 @@ { WP6StylesListener stylesListener(pageList, tableList); stylesListener.startSubDocument(); - parseDocument(input, 0, &stylesListener); + parseDocument(input, nullptr, &stylesListener); stylesListener.endSubDocument(); input->seek(0, librevenge::RVNG_SEEK_SET); WP6ContentListener listener(pageList, tableList, documentInterface); listener.startSubDocument(); - parseDocument(input, 0, &listener); + parseDocument(input, nullptr, &listener); listener.endSubDocument(); } catch (FileException) diff -Nru libwpd-0.10.1/src/lib/WP6Parser.h libwpd-0.10.2/src/lib/WP6Parser.h --- libwpd-0.10.1/src/lib/WP6Parser.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6Parser.h 2017-09-08 17:04:25.000000000 +0000 @@ -37,10 +37,10 @@ { public: WP6Parser(librevenge::RVNGInputStream *input, WPXHeader *header, WPXEncryption *encryption); - ~WP6Parser(); + ~WP6Parser() override; - void parse(librevenge::RVNGTextInterface *documentInterface); - void parseSubDocument(librevenge::RVNGTextInterface *documentInterface); + void parse(librevenge::RVNGTextInterface *documentInterface) override; + void parseSubDocument(librevenge::RVNGTextInterface *documentInterface) override; static void parseDocument(librevenge::RVNGInputStream *input, WPXEncryption *encryption, WP6Listener *listener); diff -Nru libwpd-0.10.1/src/lib/WP6Part.cpp libwpd-0.10.2/src/lib/WP6Part.cpp --- libwpd-0.10.1/src/lib/WP6Part.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6Part.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -48,7 +48,7 @@ if (!WP6VariableLengthGroup::isGroupConsistent(input, encryption, readVal)) { WPD_DEBUG_MSG(("WordPerfect: Consistency Check (variable length) failed; ignoring this byte\n")); - return 0; + return nullptr; } WPD_DEBUG_MSG(("WordPerfect: constructVariableLengthGroup(input, val=0x%.2x)\n", readVal)); return WP6VariableLengthGroup::constructVariableLengthGroup(input, encryption, readVal); @@ -59,7 +59,7 @@ if (!WP6FixedLengthGroup::isGroupConsistent(input, encryption, readVal)) { WPD_DEBUG_MSG(("WordPerfect: Consistency Check (fixed length) failed; ignoring this byte\n")); - return 0; + return nullptr; } WPD_DEBUG_MSG(("WordPerfect: constructFixedLengthGroup(input, val=0x%.2x)\n", readVal)); return WP6FixedLengthGroup::constructFixedLengthGroup(input, encryption, readVal); @@ -70,6 +70,6 @@ #endif WPD_DEBUG_MSG(("WordPerfect: Returning 0 from constructPart\n")); - return 0; + return nullptr; } /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP6PrefixData.cpp libwpd-0.10.2/src/lib/WP6PrefixData.cpp --- libwpd-0.10.1/src/lib/WP6PrefixData.cpp 2015-12-30 08:47:36.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6PrefixData.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -56,14 +56,14 @@ if (prefixDataPacket) { m_prefixDataPacketHash[i] = prefixDataPacket; - m_prefixDataPacketTypeHash.insert(::std::map::value_type(prefixIndiceArray[i-1]->getType(), prefixDataPacket)); + m_prefixDataPacketTypeHash.insert(std::map::value_type(prefixIndiceArray[i-1]->getType(), prefixDataPacket)); if (dynamic_cast(prefixDataPacket)) m_defaultInitialFontPID = i; } } for (i=1; isecond); + delete (pos->second); } } @@ -84,7 +84,7 @@ if (pos != m_prefixDataPacketHash.end()) return static_cast(pos->second); else - return 0; + return nullptr; } std::pair WP6PrefixData::getPrefixDataPacketsOfType(const int type) const diff -Nru libwpd-0.10.1/src/lib/WP6PrefixDataPacket.cpp libwpd-0.10.2/src/lib/WP6PrefixDataPacket.cpp --- libwpd-0.10.1/src/lib/WP6PrefixDataPacket.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6PrefixDataPacket.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -49,7 +49,7 @@ WP6PrefixDataPacket *WP6PrefixDataPacket::constructPrefixDataPacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, WP6PrefixIndice *prefixIndice) { - WP6PrefixDataPacket *tmpPacket = 0; + WP6PrefixDataPacket *tmpPacket = nullptr; try { switch (prefixIndice->getType()) @@ -110,7 +110,7 @@ { if (tmpPacket) delete tmpPacket; - tmpPacket = 0; + tmpPacket = nullptr; } return tmpPacket; } diff -Nru libwpd-0.10.1/src/lib/WP6PrefixDataPacket.h libwpd-0.10.2/src/lib/WP6PrefixDataPacket.h --- libwpd-0.10.1/src/lib/WP6PrefixDataPacket.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6PrefixDataPacket.h 2017-09-08 17:04:25.000000000 +0000 @@ -40,7 +40,7 @@ virtual void parse(WP6Listener * /* listener */) const {} virtual WP6SubDocument *getSubDocument() const { - return 0; + return nullptr; } unsigned getDataSize() const { diff -Nru libwpd-0.10.1/src/lib/WP6SetNumberGroup.h libwpd-0.10.2/src/lib/WP6SetNumberGroup.h --- libwpd-0.10.1/src/lib/WP6SetNumberGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6SetNumberGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -27,9 +27,9 @@ { public: WP6SetNumberGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP6SetNumberGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener); + ~WP6SetNumberGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener *listener) override; private: unsigned char m_countOfLevelNumbersSetting; unsigned char m_startingLevelNumber; diff -Nru libwpd-0.10.1/src/lib/WP6SingleByteFunction.cpp libwpd-0.10.2/src/lib/WP6SingleByteFunction.cpp --- libwpd-0.10.1/src/lib/WP6SingleByteFunction.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6SingleByteFunction.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -97,7 +97,7 @@ // Add the remaining cases here default: // should not happen - return 0; + return nullptr; } } @@ -147,14 +147,14 @@ // 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->insertCell(1, 1, 0x00, nullptr, nullptr, &tmpCellBorderColor, TOP, false, 0x00000000); } void WP6TableCellFunction::parse(WP6Listener *listener) { // default values RGBSColor tmpCellBorderColor(0x00, 0x00, 0x00, 0x64); - listener->insertCell(1, 1, 0x00, 0, 0, &tmpCellBorderColor, TOP, false, 0x00000000); + listener->insertCell(1, 1, 0x00, nullptr, nullptr, &tmpCellBorderColor, TOP, false, 0x00000000); } void WP6TableOffFunction::parse(WP6Listener *listener) @@ -174,7 +174,7 @@ // 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->insertCell(1, 1, 0x00, nullptr, nullptr, &tmpCellBorderColor, TOP, false, 0x00000000); listener->insertBreak(WPX_SOFT_PAGE_BREAK); } @@ -184,7 +184,7 @@ // 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->insertCell(1, 1, 0x00, nullptr, nullptr, &tmpCellBorderColor, TOP, false, 0x00000000); listener->insertBreak(WPX_PAGE_BREAK); } @@ -194,7 +194,7 @@ // 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->insertCell(1, 1, 0x00, nullptr, nullptr, &tmpCellBorderColor, TOP, false, 0x00000000); listener->insertBreak(WPX_COLUMN_BREAK); } diff -Nru libwpd-0.10.1/src/lib/WP6SingleByteFunction.h libwpd-0.10.2/src/lib/WP6SingleByteFunction.h --- libwpd-0.10.1/src/lib/WP6SingleByteFunction.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6SingleByteFunction.h 2017-09-08 17:04:25.000000000 +0000 @@ -38,91 +38,91 @@ class WP6SpaceFunction : public WP6SingleByteFunction { public: - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; class WP6HardSpaceFunction : public WP6SingleByteFunction { public: - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; class WP6EOLFunction : public WP6SingleByteFunction { public: - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; class WP6EOCFunction : public WP6SingleByteFunction { public: - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; class WP6EOPFunction : public WP6SingleByteFunction { public: - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; class WP6SoftEOPFunction : public WP6SingleByteFunction { public: - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; class WP6SoftHyphenFunction : public WP6SingleByteFunction { public: - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; class WP6HyphenFunction : public WP6SingleByteFunction { public: - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; class WP6TableOffFunction : public WP6SingleByteFunction { public: - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; class WP6TableCellFunction : public WP6SingleByteFunction { public: - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; class WP6TableRowFunction : public WP6SingleByteFunction { public: - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; class WP6TableOffAtSoftEOPFunction : public WP6SingleByteFunction { public: - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; class WP6TableRowAtSoftEOPFunction : public WP6SingleByteFunction { public: - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; class WP6TableRowAtEOPFunction : public WP6SingleByteFunction { public: - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; class WP6TableRowAtEOCFunction : public WP6SingleByteFunction { public: - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; }; #endif /* WP6SINGLEBYTEFUNCTION_H */ diff -Nru libwpd-0.10.1/src/lib/WP6StyleGroup.cpp libwpd-0.10.2/src/lib/WP6StyleGroup.cpp --- libwpd-0.10.1/src/lib/WP6StyleGroup.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6StyleGroup.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -43,7 +43,7 @@ WP6StyleGroup::WP6StyleGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption) : WP6VariableLengthGroup(), - m_subGroupData(0) + m_subGroupData(nullptr) { _read(input, encryption); } @@ -51,7 +51,7 @@ WP6StyleGroup::~WP6StyleGroup() { if (m_subGroupData) - delete(m_subGroupData); + delete (m_subGroupData); } diff -Nru libwpd-0.10.1/src/lib/WP6StyleGroup.h libwpd-0.10.2/src/lib/WP6StyleGroup.h --- libwpd-0.10.1/src/lib/WP6StyleGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6StyleGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,7 +33,7 @@ { public: WP6StyleGroup_GlobalOnSubGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const; + void parse(WP6Listener *listener, const unsigned char numPrefixIDs, unsigned short const *prefixIDs) const override; private: unsigned short m_hash; @@ -44,9 +44,9 @@ { public: WP6StyleGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - ~WP6StyleGroup(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener); + ~WP6StyleGroup() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener *listener) override; private: WP6StyleGroup(const WP6StyleGroup &); diff -Nru libwpd-0.10.1/src/lib/WP6StylesListener.cpp libwpd-0.10.2/src/lib/WP6StylesListener.cpp --- libwpd-0.10.1/src/lib/WP6StylesListener.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6StylesListener.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -41,7 +41,7 @@ WPXStylesListener(pageList), m_currentPage(), m_tableList(tableList), - m_currentTable(0), + m_currentTable(nullptr), m_tempMarginLeft(1.0), m_tempMarginRight(1.0), m_currentPageHasContent(false), @@ -219,8 +219,8 @@ WPXTableList tableList; m_currentPage.setHeaderFooter(wpxType, headerFooterType, wpxOccurrence, - ((textPID && WP6Listener::getPrefixDataPacket(textPID)) ? WP6Listener::getPrefixDataPacket(textPID)->getSubDocument() : 0), tableList); - _handleSubDocument(((textPID && WP6Listener::getPrefixDataPacket(textPID)) ? WP6Listener::getPrefixDataPacket(textPID)->getSubDocument() : 0), WPX_SUBDOCUMENT_HEADER_FOOTER, tableList); + ((textPID && WP6Listener::getPrefixDataPacket(textPID)) ? WP6Listener::getPrefixDataPacket(textPID)->getSubDocument() : nullptr), tableList); + _handleSubDocument(((textPID && WP6Listener::getPrefixDataPacket(textPID)) ? WP6Listener::getPrefixDataPacket(textPID)->getSubDocument() : nullptr), WPX_SUBDOCUMENT_HEADER_FOOTER, tableList); } m_currentPageHasContent = tempCurrentPageHasContent; } @@ -290,7 +290,7 @@ if (!isUndoOn()) { m_isTableDefined = false; - m_currentTable = 0; + m_currentTable = nullptr; } } @@ -320,7 +320,7 @@ if (!isUndoOn()) { m_currentPageHasContent = true; - _handleSubDocument(((textPID && WP6Listener::getPrefixDataPacket(textPID)) ? WP6Listener::getPrefixDataPacket(textPID)->getSubDocument() : 0), WPX_SUBDOCUMENT_NOTE, m_tableList); + _handleSubDocument(((textPID && WP6Listener::getPrefixDataPacket(textPID)) ? WP6Listener::getPrefixDataPacket(textPID)->getSubDocument() : nullptr), WPX_SUBDOCUMENT_NOTE, m_tableList); } } @@ -338,7 +338,7 @@ if (!isUndoOn()) { m_currentPageHasContent = true; - _handleSubDocument(((textPID && WP6Listener::getPrefixDataPacket(textPID)) ? WP6Listener::getPrefixDataPacket(textPID)->getSubDocument() : 0), WPX_SUBDOCUMENT_COMMENT_ANNOTATION, m_tableList); + _handleSubDocument(((textPID && WP6Listener::getPrefixDataPacket(textPID)) ? WP6Listener::getPrefixDataPacket(textPID)->getSubDocument() : nullptr), WPX_SUBDOCUMENT_COMMENT_ANNOTATION, m_tableList); } } diff -Nru libwpd-0.10.1/src/lib/WP6StylesListener.h libwpd-0.10.2/src/lib/WP6StylesListener.h --- libwpd-0.10.1/src/lib/WP6StylesListener.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6StylesListener.h 2017-09-08 17:04:25.000000000 +0000 @@ -49,95 +49,95 @@ const unsigned char /* month */, const unsigned char /* day */, const unsigned char /* hour */, const unsigned char /* minute */, const unsigned char /* second */, const unsigned char /* dayOfWeek */, - const unsigned char /* timeZone */, const unsigned char /* unused */) {} - void setExtendedInformation(const unsigned short /* type */, const librevenge::RVNGString & /*data*/) {} - void startDocument() {} - void startSubDocument() {} - void setAlignmentCharacter(const unsigned /* character */) {} - void setLeaderCharacter(const unsigned /* character */, const unsigned char /* numberOfSpaces */) {} + const unsigned char /* timeZone */, const unsigned char /* unused */) override {} + void setExtendedInformation(const unsigned short /* type */, const librevenge::RVNGString & /*data*/) override {} + void startDocument() override {} + void startSubDocument() override {} + void setAlignmentCharacter(const unsigned /* character */) override {} + void setLeaderCharacter(const unsigned /* character */, const unsigned char /* numberOfSpaces */) override {} void defineTabStops(const bool /* isRelative */, const std::vector & /* tabStops */, - const std::vector & /* usePreWP9LeaderMethods */) {} - void insertCharacter(unsigned /* character */) + const std::vector & /* usePreWP9LeaderMethods */) override {} + void insertCharacter(unsigned /* character */) override { if (!isUndoOn()) m_currentPageHasContent = true; } - void insertTab(const unsigned char /* tabType */, double /* tabPosition */) + void insertTab(const unsigned char /* tabType */, double /* tabPosition */) override { if (!isUndoOn()) m_currentPageHasContent = true; } - void handleLineBreak() + void handleLineBreak() override { if (!isUndoOn()) m_currentPageHasContent = true; } - void insertEOL() + void insertEOL() override { if (!isUndoOn()) m_currentPageHasContent = true; } - void insertBreak(const unsigned char breakType); - void characterColorChange(const unsigned char /* red */, const unsigned char /* green */, const unsigned char /* blue */) {} - void characterShadingChange(const unsigned char /* shading */) {} - void highlightChange(const bool /* isOn */, const RGBSColor & /* color */) {} - void fontChange(const unsigned short /* matchedFontPointSize */, const unsigned short /* fontPID */, const librevenge::RVNGString & /* fontName */) {} - void attributeChange(const bool /* isOn */, const unsigned char /* attribute */) {} - void lineSpacingChange(const double /* lineSpacing */) {} - void spacingAfterParagraphChange(const double /* spacingRelative */, const double /* spacingAbsolute */) {} - void justificationChange(const unsigned char /* justification */) {} - void pageNumberingChange(const WPXPageNumberPosition /* page numbering position */, const unsigned short /* matchedFontPointSize */, const unsigned short /* fontPID */); - void pageMarginChange(const unsigned char side, const unsigned short margin); - void pageFormChange(const unsigned short length, const unsigned short width, const WPXFormOrientation orientation); - void marginChange(const unsigned char side, const unsigned short margin); - void paragraphMarginChange(const unsigned char /* side */, const signed short /* margin */) {} - void indentFirstLineChange(const signed short /* offset */) {} + void insertBreak(const unsigned char breakType) override; + void characterColorChange(const unsigned char /* red */, const unsigned char /* green */, const unsigned char /* blue */) override {} + void characterShadingChange(const unsigned char /* shading */) override {} + void highlightChange(const bool /* isOn */, const RGBSColor & /* color */) override {} + void fontChange(const unsigned short /* matchedFontPointSize */, const unsigned short /* fontPID */, const librevenge::RVNGString & /* fontName */) override {} + void attributeChange(const bool /* isOn */, const unsigned char /* attribute */) override {} + void lineSpacingChange(const double /* lineSpacing */) override {} + void spacingAfterParagraphChange(const double /* spacingRelative */, const double /* spacingAbsolute */) override {} + void justificationChange(const unsigned char /* justification */) override {} + void pageNumberingChange(const WPXPageNumberPosition /* page numbering position */, const unsigned short /* matchedFontPointSize */, const unsigned short /* fontPID */) override; + void pageMarginChange(const unsigned char side, const unsigned short margin) override; + void pageFormChange(const unsigned short length, const unsigned short width, const WPXFormOrientation orientation) override; + void marginChange(const unsigned char side, const unsigned short margin) override; + void paragraphMarginChange(const unsigned char /* side */, const signed short /* margin */) override {} + void indentFirstLineChange(const signed short /* offset */) override {} void columnChange(const WPXTextColumnType /* columnType */, const unsigned char /* numColumns */, - const std::vector & /* columnWidth */, const std::vector & /* isFixedWidth */) {} - void updateOutlineDefinition(const unsigned short /* outlineHash */, const unsigned char * /* numberingMethods */, const unsigned char /* tabBehaviourFlag */) {} + const std::vector & /* columnWidth */, const std::vector & /* isFixedWidth */) override {} + void updateOutlineDefinition(const unsigned short /* outlineHash */, const unsigned char * /* numberingMethods */, const unsigned char /* tabBehaviourFlag */) override {} - void paragraphNumberOn(const unsigned short /* outlineHash */, const unsigned char /* level */, const unsigned char /* flag */) {} - void paragraphNumberOff() + void paragraphNumberOn(const unsigned short /* outlineHash */, const unsigned char /* level */, const unsigned char /* flag */) override {} + void paragraphNumberOff() override { if (!isUndoOn()) m_currentPageHasContent = true; } - void displayNumberReferenceGroupOn(const unsigned char /* subGroup */, const unsigned char /* level */) {} - void displayNumberReferenceGroupOff(const unsigned char /* subGroup */) + void displayNumberReferenceGroupOn(const unsigned char /* subGroup */, const unsigned char /* level */) override {} + void displayNumberReferenceGroupOff(const unsigned char /* subGroup */) override { if (!isUndoOn()) m_currentPageHasContent = true; } - void styleGroupOn(const unsigned char /* subGroup */) {} - void styleGroupOff(const unsigned char /* subGroup */) {} - void globalOn(const unsigned char /* systemStyle */) {} - void globalOff() {} - void noteOn(const unsigned short textPID); - void noteOff(const WPXNoteType /* noteType */) {} - void headerFooterGroup(const unsigned char headerFooterType, const unsigned char occurrenceBits, const unsigned short textPID); - void suppressPageCharacteristics(const unsigned char suppressCode); - void setPageNumber(const unsigned short pageNumber); - void setPageNumberingType(const WPXNumberingType pageNumberingType); + void styleGroupOn(const unsigned char /* subGroup */) override {} + void styleGroupOff(const unsigned char /* subGroup */) override {} + void globalOn(const unsigned char /* systemStyle */) override {} + void globalOff() override {} + void noteOn(const unsigned short textPID) override; + void noteOff(const WPXNoteType /* noteType */) override {} + void headerFooterGroup(const unsigned char headerFooterType, const unsigned char occurrenceBits, const unsigned short textPID) override; + void suppressPageCharacteristics(const unsigned char suppressCode) override; + void setPageNumber(const unsigned short pageNumber) override; + void setPageNumberingType(const WPXNumberingType pageNumberingType) override; - void endDocument(); - void endSubDocument(); + void endDocument() override; + void endSubDocument() override; - void defineTable(const unsigned char position, const unsigned short leftOffset); + void defineTable(const unsigned char position, const unsigned short leftOffset) override; void addTableColumnDefinition(const unsigned /* width */, const unsigned /* leftGutter */, const unsigned /* rightGutter */, - const unsigned /* attributes */, const unsigned char /* alignment */) {} - void startTable(); - void insertRow(const unsigned short rowHeight, const bool isMinimumHeight, const bool isHeaderRow); + const unsigned /* attributes */, const unsigned char /* alignment */) override {} + void startTable() override; + void insertRow(const unsigned short rowHeight, const bool isMinimumHeight, const bool isHeaderRow) override; void insertCell(const unsigned char colSpan, const unsigned char rowSpan, const unsigned char borderBits, const RGBSColor *cellFgColor, const RGBSColor *cellBgColor, const RGBSColor *cellBorderColor, const WPXVerticalAlignment cellVerticalAlignment, - const bool useCellAttributes, const unsigned cellAttributes); - void endTable(); + const bool useCellAttributes, const unsigned cellAttributes) override; + void endTable() override; void boxOn(const unsigned char /* anchoringType */, const unsigned char /* generalPositioningFlags */, const unsigned char /* horizontalPositioningFlags */, const signed short /* horizontalOffset */, const unsigned char /* leftColumn */, const unsigned char /* rightColumn */, const unsigned char /* verticalPositioningFlags */, const signed short /* verticalOffset */, const unsigned char /* widthFlags */, const unsigned short /* width */, const unsigned char /* heightFlags */, const unsigned short /* height */, const unsigned char /* boxContentType */, const unsigned short /* nativeWidth */, const unsigned short /* nativeHeight */, - const librevenge::RVNGString & /* linkTarget */) {} - void boxOff() {} - void insertGraphicsData(const unsigned short /* packetId */) {} - void insertTextBox(const WP6SubDocument *subDocument); - void commentAnnotation(const unsigned short textPID); + const librevenge::RVNGString & /* linkTarget */) override {} + void boxOff() override {} + void insertGraphicsData(const unsigned short /* packetId */) override {} + void insertTextBox(const WP6SubDocument *subDocument) override; + void commentAnnotation(const unsigned short textPID) override; - void undoChange(const unsigned char undoType, const unsigned short undoLevel); + void undoChange(const unsigned char undoType, const unsigned short undoLevel) override; protected: void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0); diff -Nru libwpd-0.10.1/src/lib/WP6SubDocument.cpp libwpd-0.10.2/src/lib/WP6SubDocument.cpp --- libwpd-0.10.1/src/lib/WP6SubDocument.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6SubDocument.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -38,6 +38,6 @@ if (!tmpStream) return; tmpStream->seek(0, librevenge::RVNG_SEEK_SET); - WP6Parser::parseDocument(tmpStream, 0, listener); + WP6Parser::parseDocument(tmpStream, nullptr, listener); } /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP6TabGroup.h libwpd-0.10.2/src/lib/WP6TabGroup.h --- libwpd-0.10.1/src/lib/WP6TabGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6TabGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,8 +34,8 @@ { public: WP6TabGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener *listener); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener *listener) override; private: double m_position; diff -Nru libwpd-0.10.1/src/lib/WP6TableStylePacket.h libwpd-0.10.2/src/lib/WP6TableStylePacket.h --- libwpd-0.10.1/src/lib/WP6TableStylePacket.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6TableStylePacket.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,9 +33,9 @@ { public: WP6TableStylePacket(librevenge::RVNGInputStream *input, WPXEncryption *encryption, int id, unsigned dataOffset, unsigned dataSize); - ~WP6TableStylePacket(); - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener * /*listener*/) const {} + ~WP6TableStylePacket() override; + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; + void parse(WP6Listener * /*listener*/) const override {} private: WP6TableStylePacket(const WP6TableStylePacket &); diff -Nru libwpd-0.10.1/src/lib/WP6TibetanMap.h libwpd-0.10.2/src/lib/WP6TibetanMap.h --- libwpd-0.10.1/src/lib/WP6TibetanMap.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6TibetanMap.h 2017-09-08 17:04:25.000000000 +0000 @@ -230,39 +230,39 @@ const unsigned *tibetanMap1[] = { - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, tibetan_1_33, // k tibetan_1_34, // kh tibetan_1_35, // g @@ -388,8 +388,8 @@ tibetan_1_155, // b+lx tibetan_1_156, // h tibetan_1_157, // ` - 0, - 0, + nullptr, + nullptr, tibetan_1_160, // +v tibetan_1_161, // +a tibetan_1_162, // +a @@ -398,18 +398,18 @@ tibetan_1_165, // +r tibetan_1_166, // +y tibetan_1_167, // +h - 0, - 0, + nullptr, + nullptr, tibetan_1_170, // T tibetan_1_171, // TH tibetan_1_172, // D tibetan_1_173, // N tibetan_1_174, // SH tibetan_1_175, // k+SH - 0, - 0, - 0, - 0, + nullptr, + nullptr, + nullptr, + nullptr, tibetan_1_180, // g tibetan_1_181, // b tibetan_1_182, // dz @@ -417,9 +417,9 @@ tibetan_1_184, // x tibetan_1_185, // nyl tibetan_1_186, // +lx - 0, - 0, - 0, + nullptr, + nullptr, + nullptr, tibetan_1_190, // 0 tibetan_1_191, // 1 tibetan_1_192, // 2 @@ -440,12 +440,12 @@ tibetan_1_207, // = tibetan_1_208, // { tibetan_1_209, // } - 0, - 0, - 0, - 0, - 0, - 0, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, tibetan_1_216, // +a+u tibetan_1_217, // +a+u tibetan_1_218, // +a+u @@ -483,8 +483,8 @@ tibetan_1_250, // +o+M tibetan_1_251, // +oo+M tibetan_1_252, // R - 0, - 0, - 0, + nullptr, + nullptr, + nullptr, }; /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WP6UndoGroup.h libwpd-0.10.2/src/lib/WP6UndoGroup.h --- libwpd-0.10.1/src/lib/WP6UndoGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6UndoGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,10 +33,10 @@ { public: WP6UndoGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP6Listener *listener); + void parse(WP6Listener *listener) override; protected: - void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption); + void _readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) override; private: unsigned char m_undoType; diff -Nru libwpd-0.10.1/src/lib/WP6UnsupportedFixedLengthGroup.h libwpd-0.10.2/src/lib/WP6UnsupportedFixedLengthGroup.h --- libwpd-0.10.1/src/lib/WP6UnsupportedFixedLengthGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6UnsupportedFixedLengthGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -33,10 +33,10 @@ { public: WP6UnsupportedFixedLengthGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID); - void parse(WP6Listener * /* listener */) {} + void parse(WP6Listener * /* listener */) override {} protected: - void _readContents(librevenge::RVNGInputStream * /* input */, WPXEncryption * /* encryption */) {} + void _readContents(librevenge::RVNGInputStream * /* input */, WPXEncryption * /* encryption */) override {} }; #endif /* WP6UNSUPPORTEDFIXEDLENGTHGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP6UnsupportedVariableLengthGroup.h libwpd-0.10.2/src/lib/WP6UnsupportedVariableLengthGroup.h --- libwpd-0.10.1/src/lib/WP6UnsupportedVariableLengthGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6UnsupportedVariableLengthGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -36,7 +36,7 @@ { public: WP6UnsupportedVariableLengthGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption); - void parse(WP6Listener * /* listener */) {} + void parse(WP6Listener * /* listener */) override {} }; #endif /* WP6UNSUPPORTEDVARIABLELENGTHGROUP_H */ diff -Nru libwpd-0.10.1/src/lib/WP6VariableLengthGroup.cpp libwpd-0.10.2/src/lib/WP6VariableLengthGroup.cpp --- libwpd-0.10.1/src/lib/WP6VariableLengthGroup.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6VariableLengthGroup.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -49,7 +49,7 @@ m_size(0), m_flags(0), m_numPrefixIDs(0), - m_prefixIDs(0), + m_prefixIDs(nullptr), m_sizeNonDeletable(0), m_sizeDeletable(0) { @@ -157,7 +157,7 @@ else { m_numPrefixIDs = 0; - m_prefixIDs = 0; + m_prefixIDs = nullptr; } m_sizeNonDeletable = readU16(input, encryption); diff -Nru libwpd-0.10.1/src/lib/WP6VariableLengthGroup.h libwpd-0.10.2/src/lib/WP6VariableLengthGroup.h --- libwpd-0.10.1/src/lib/WP6VariableLengthGroup.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WP6VariableLengthGroup.h 2017-09-08 17:04:25.000000000 +0000 @@ -41,7 +41,7 @@ { public: WP6VariableLengthGroup(); // WP6VariableLengthGroup should _never_ be constructed, only its inherited classes - virtual ~WP6VariableLengthGroup(); + ~WP6VariableLengthGroup() override; static WP6VariableLengthGroup *constructVariableLengthGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, const unsigned char groupID); diff -Nru libwpd-0.10.1/src/lib/WPDocument.cpp libwpd-0.10.2/src/lib/WPDocument.cpp --- libwpd-0.10.1/src/lib/WPDocument.cpp 2015-12-30 08:38:37.000000000 +0000 +++ libwpd-0.10.2/src/lib/WPDocument.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -25,6 +25,7 @@ */ #include +#include #include #include "WPXHeader.h" @@ -62,7 +63,7 @@ \return A confidence value which represents the likelyhood that the content from the input stream can be parsed */ -WPDAPI WPDConfidence WPDocument::isFileFormatSupported(librevenge::RVNGInputStream *input) +WPDAPI WPDConfidence WPDocument::isFileFormatSupported(librevenge::RVNGInputStream *input) try { WPD_DEBUG_MSG(("WPDocument::isFileFormatSupported()\n")); @@ -71,101 +72,79 @@ // by-pass the OLE stream (if it exists) and returns the (sub) stream with the // WordPerfect document. - librevenge::RVNGInputStream *document = 0; - bool isStructuredDocument = false; + std::shared_ptr document; if (input->isStructured()) { - document = input->getSubStreamByName("PerfectOffice_MAIN"); - if (document) - isStructuredDocument = true; - else + document.reset(input->getSubStreamByName("PerfectOffice_MAIN")); + if (!document) return WPD_CONFIDENCE_NONE; } else - document = input; + document.reset(input, libwpd::WPXDummyDeleter()); - try + WPDConfidence confidence = WPD_CONFIDENCE_NONE; + std::unique_ptr header(WPXHeader::constructHeader(document.get(), nullptr)); + if (header) { - WPDConfidence confidence = WPD_CONFIDENCE_NONE; - WPXHeader *header = WPXHeader::constructHeader(document, 0); - if (header) + switch (header->getFileType()) { - switch (header->getFileType()) + case 0x0a: // WordPerfect File + switch (header->getMajorVersion()) { - case 0x0a: // WordPerfect File - switch (header->getMajorVersion()) - { - case 0x00: // WP5 - case 0x02: // WP6+ - confidence = WPD_CONFIDENCE_EXCELLENT; - break; - default: - // unhandled file format - confidence = WPD_CONFIDENCE_NONE; - break; - } - break; - case 0x2c: // WP Mac File - switch (header->getMajorVersion()) - { - case 0x02: // WP Mac 2.x - case 0x03: // WP Mac 3.0-3.5 - case 0x04: // WP Mac 3.5e - confidence = WPD_CONFIDENCE_EXCELLENT; - break; - default: - // unhandled file format - confidence = WPD_CONFIDENCE_NONE; - break; - } + case 0x00: // WP5 + case 0x02: // WP6+ + confidence = WPD_CONFIDENCE_EXCELLENT; break; default: - // unhandled file type + // unhandled file format confidence = WPD_CONFIDENCE_NONE; break; } - if (header->getDocumentEncryption()) + break; + case 0x2c: // WP Mac File + switch (header->getMajorVersion()) { - if (header->getMajorVersion() == 0x02) - confidence = WPD_CONFIDENCE_UNSUPPORTED_ENCRYPTION; - else - confidence = WPD_CONFIDENCE_SUPPORTED_ENCRYPTION; + case 0x02: // WP Mac 2.x + case 0x03: // WP Mac 3.0-3.5 + case 0x04: // WP Mac 3.5e + confidence = WPD_CONFIDENCE_EXCELLENT; + break; + default: + // unhandled file format + confidence = WPD_CONFIDENCE_NONE; + break; } - DELETEP(header); + break; + default: + // unhandled file type + confidence = WPD_CONFIDENCE_NONE; + break; + } + if (header->getDocumentEncryption()) + { + if (header->getMajorVersion() == 0x02) + confidence = WPD_CONFIDENCE_UNSUPPORTED_ENCRYPTION; + else + confidence = WPD_CONFIDENCE_SUPPORTED_ENCRYPTION; } - else - confidence = WP1Heuristics::isWP1FileFormat(input, 0); - if (confidence != WPD_CONFIDENCE_EXCELLENT && confidence != WPD_CONFIDENCE_SUPPORTED_ENCRYPTION) - confidence = (std::max)(confidence, WP42Heuristics::isWP42FileFormat(input, 0)); - - - // dispose of the reference to the ole input stream, if we allocated one - if (document && isStructuredDocument) - DELETEP(document); - - return confidence; - } - catch (FileException) - { - WPD_DEBUG_MSG(("File Exception trapped\n")); - - // dispose of the reference to the ole input stream, if we allocated one - if (document && isStructuredDocument) - DELETEP(document); - - return WPD_CONFIDENCE_NONE; } - catch (...) - { - WPD_DEBUG_MSG(("Unknown Exception trapped\n")); - - // dispose of the reference to the ole input stream, if we allocated one - if (document && isStructuredDocument) - DELETEP(document); + else + confidence = WP1Heuristics::isWP1FileFormat(input, nullptr); + if (confidence != WPD_CONFIDENCE_EXCELLENT && confidence != WPD_CONFIDENCE_SUPPORTED_ENCRYPTION) + confidence = (std::max)(confidence, WP42Heuristics::isWP42FileFormat(input, nullptr)); - return WPD_CONFIDENCE_NONE; - } + return confidence; +} +catch (FileException) +{ + WPD_DEBUG_MSG(("File Exception trapped\n")); + return WPD_CONFIDENCE_NONE; +} +catch (...) +{ + WPD_DEBUG_MSG(("Unknown Exception trapped\n")); + return WPD_CONFIDENCE_NONE; } /** @@ -174,7 +153,7 @@ \param password The password used to protect the document or NULL if the document is not protected \return A value which indicates between the given password and the password that was used to protect the document */ -WPDAPI WPDPasswordMatch WPDocument::verifyPassword(librevenge::RVNGInputStream *input, const char *password) +WPDAPI WPDPasswordMatch WPDocument::verifyPassword(librevenge::RVNGInputStream *input, const char *password) try { if (!password) return WPD_PASSWORD_MATCH_DONTKNOW; @@ -186,72 +165,48 @@ WPDPasswordMatch passwordMatch = WPD_PASSWORD_MATCH_NONE; WPXEncryption encryption(password); - WPXHeader *header = 0; - WPD_DEBUG_MSG(("WPDocument::verifyPassword()\n")); // by-pass the OLE stream (if it exists) and returns the (sub) stream with the // WordPerfect document. - librevenge::RVNGInputStream *document = 0; - bool isStructuredDocument = false; + std::shared_ptr document; if (input->isStructured()) { - document = input->getSubStreamByName("PerfectOffice_MAIN"); - if (document) - isStructuredDocument = true; - else + document.reset(input->getSubStreamByName("PerfectOffice_MAIN")); + if (!document) return WPD_PASSWORD_MATCH_NONE; } else - document = input; + document.reset(input, libwpd::WPXDummyDeleter()); - try + std::unique_ptr header(WPXHeader::constructHeader(document.get(), nullptr)); + if (header) { - header = WPXHeader::constructHeader(document, 0); - if (header) + if (header->getDocumentEncryption()) { - if (header->getDocumentEncryption()) - { - if (header->getMajorVersion() == 0x02) - passwordMatch = WPD_PASSWORD_MATCH_DONTKNOW; - else if (header->getDocumentEncryption() == encryption.getCheckSum()) - passwordMatch = WPD_PASSWORD_MATCH_OK; - } - DELETEP(header); + if (header->getMajorVersion() == 0x02) + passwordMatch = WPD_PASSWORD_MATCH_DONTKNOW; + else if (header->getDocumentEncryption() == encryption.getCheckSum()) + passwordMatch = WPD_PASSWORD_MATCH_OK; } - else - passwordMatch = WP1Heuristics::verifyPassword(input, password); - if (passwordMatch == WPD_PASSWORD_MATCH_NONE) - passwordMatch = (std::max)(passwordMatch, WP42Heuristics::verifyPassword(input, password)); - - - // dispose of the reference to the ole input stream, if we allocated one - if (document && isStructuredDocument) - DELETEP(document); - - return passwordMatch; } - catch (FileException) - { - WPD_DEBUG_MSG(("File Exception trapped\n")); - - // dispose of the reference to the ole input stream, if we allocated one - if (document && isStructuredDocument) - DELETEP(document); - - return WPD_PASSWORD_MATCH_NONE; - } - catch (...) - { - WPD_DEBUG_MSG(("Unknown Exception trapped\n")); - - // dispose of the reference to the ole input stream, if we allocated one - if (document && isStructuredDocument) - DELETEP(document); + else + passwordMatch = WP1Heuristics::verifyPassword(input, password); + if (passwordMatch == WPD_PASSWORD_MATCH_NONE) + passwordMatch = (std::max)(passwordMatch, WP42Heuristics::verifyPassword(input, password)); - return WPD_PASSWORD_MATCH_NONE; - } + return passwordMatch; +} +catch (FileException) +{ + WPD_DEBUG_MSG(("File Exception trapped\n")); + return WPD_PASSWORD_MATCH_NONE; +} +catch (...) +{ + WPD_DEBUG_MSG(("Unknown Exception trapped\n")); + return WPD_PASSWORD_MATCH_NONE; } /** @@ -265,7 +220,7 @@ \return A value that indicates whether the conversion was successful and in case it was not, it indicates the reason of the error */ -WPDAPI WPDResult WPDocument::parse(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *textInterface, const char *password) +WPDAPI WPDResult WPDocument::parse(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *textInterface, const char *password) try { if (!input) return WPD_FILE_ACCESS_ERROR; @@ -275,211 +230,187 @@ input->seek(0, librevenge::RVNG_SEEK_SET); - WPXParser *parser = 0; - // by-pass the OLE stream (if it exists) and returns the (sub) stream with the // WordPerfect document. - librevenge::RVNGInputStream *document = 0; - bool isStructuredDocument = false; + std::shared_ptr document; WPD_DEBUG_MSG(("WPDocument::parse()\n")); if (input->isStructured()) { - document = input->getSubStreamByName("PerfectOffice_MAIN"); - if (document) - isStructuredDocument = true; - else + document.reset(input->getSubStreamByName("PerfectOffice_MAIN")); + if (!document) return WPD_OLE_ERROR; } else - document = input; + document.reset(input, libwpd::WPXDummyDeleter()); - WPDResult error = WPD_OK; + std::unique_ptr encryption; + std::unique_ptr header(WPXHeader::constructHeader(document.get(), nullptr)); + std::unique_ptr parser; - try + if (header) { - WPXEncryption *encryption = 0; - WPXHeader *header = WPXHeader::constructHeader(document, 0); - - if (header) + switch (header->getFileType()) { - switch (header->getFileType()) + case 0x0a: // WordPerfect File + switch (header->getMajorVersion()) + { + case 0x00: // WP5 { - case 0x0a: // WordPerfect File - switch (header->getMajorVersion()) - { - case 0x00: // WP5 - WPD_DEBUG_MSG(("WordPerfect: Using the WP5 parser.\n")); - if (password) - encryption = new WPXEncryption(password, 16); - parser = new WP5Parser(document, header, encryption); - parser->parse(textInterface); - break; - case 0x02: // WP6 - WPD_DEBUG_MSG(("WordPerfect: Using the WP6 parser.\n")); - if (password) - { - delete header; - throw UnsupportedEncryptionException(); - } - parser = new WP6Parser(document, header, encryption); - parser->parse(textInterface); - break; - default: - // unhandled file format - WPD_DEBUG_MSG(("WordPerfect: Unsupported file format.\n")); - break; - } + WPD_DEBUG_MSG(("WordPerfect: Using the WP5 parser.\n")); + if (password) + encryption.reset(new WPXEncryption(password, 16)); + parser.reset(new WP5Parser(document.get(), header.get(), encryption.get())); break; - case 0x2c: // WP Mac File - switch (header->getMajorVersion()) - { - case 0x02: // WP Mac 2.x - case 0x03: // WP Mac 3.0-3.5 - case 0x04: // WP Mac 3.5e - WPD_DEBUG_MSG(("WordPerfect: Using the WP3 parser.\n")); - if (password) - encryption = new WPXEncryption(password, header->getDocumentOffset()); - parser = new WP3Parser(document, header, encryption); - parser->parse(textInterface); - break; - default: - // unhandled file format - WPD_DEBUG_MSG(("WordPerfect: Unsupported file format.\n")); - break; - } + } + case 0x02: // WP6 + { + WPD_DEBUG_MSG(("WordPerfect: Using the WP6 parser.\n")); + if (password) + throw UnsupportedEncryptionException(); + parser.reset(new WP6Parser(document.get(), header.get(), encryption.get())); break; + } default: // unhandled file format - WPD_DEBUG_MSG(("WordPerfect: Unsupported file type.\n")); + WPD_DEBUG_MSG(("WordPerfect: Unsupported file format.\n")); break; } - DELETEP(parser); - DELETEP(header); - } - else - { - // WP file formats prior to version 5.x do not contain a generic - // header which can be used to determine which parser to instanciate. - // Use heuristics to determine with some certainty if we are dealing with - // a file in the WP4.2 format or WP Mac 1.x format. - if (WP1Heuristics::isWP1FileFormat(document, password) == WPD_CONFIDENCE_EXCELLENT) + break; + case 0x2c: // WP Mac File + switch (header->getMajorVersion()) { - WPD_DEBUG_MSG(("WordPerfect: Mostly likely the file format is WP Mac 1.x.\n\n")); - WPD_DEBUG_MSG(("WordPerfect: Using the WP Mac 1.x parser.\n\n")); - if (password) - encryption = new WPXEncryption(password, 6); - parser = new WP1Parser(document, encryption); - parser->parse(textInterface); - DELETEP(parser); - } - else if (WP42Heuristics::isWP42FileFormat(document, password) == WPD_CONFIDENCE_EXCELLENT) + case 0x02: // WP Mac 2.x + case 0x03: // WP Mac 3.0-3.5 + case 0x04: // WP Mac 3.5e { - WPD_DEBUG_MSG(("WordPerfect: Mostly likely the file format is WP4.2.\n\n")); - WPD_DEBUG_MSG(("WordPerfect: Using the WP4.2 parser.\n\n")); + WPD_DEBUG_MSG(("WordPerfect: Using the WP3 parser.\n")); if (password) - { - encryption = new WPXEncryption(password, 6); - input->seek(6, librevenge::RVNG_SEEK_SET); - } - parser = new WP42Parser(document, encryption); - parser->parse(textInterface); - DELETEP(parser); + encryption.reset(new WPXEncryption(password, header->getDocumentOffset())); + parser.reset(new WP3Parser(document.get(), header.get(), encryption.get())); + break; } - else - - error = WPD_FILE_ACCESS_ERROR; + default: + // unhandled file format + WPD_DEBUG_MSG(("WordPerfect: Unsupported file format.\n")); + break; + } + break; + default: + // unhandled file format + WPD_DEBUG_MSG(("WordPerfect: Unsupported file type.\n")); + break; } } - - catch (FileException) - { - WPD_DEBUG_MSG(("File Exception trapped\n")); - error = WPD_FILE_ACCESS_ERROR; - } - catch (ParseException) - { - WPD_DEBUG_MSG(("Parse Exception trapped\n")); - error = WPD_PARSE_ERROR; - } - catch (UnsupportedEncryptionException) - { - WPD_DEBUG_MSG(("Encrypted document exception trapped\n")); - error = WPD_UNSUPPORTED_ENCRYPTION_ERROR; - } - catch (...) + else { - WPD_DEBUG_MSG(("Unknown Exception trapped\n")); - error = WPD_UNKNOWN_ERROR; + // WP file formats prior to version 5.x do not contain a generic + // header which can be used to determine which parser to instanciate. + // Use heuristics to determine with some certainty if we are dealing with + // a file in the WP4.2 format or WP Mac 1.x format. + if (WP1Heuristics::isWP1FileFormat(document.get(), password) == WPD_CONFIDENCE_EXCELLENT) + { + WPD_DEBUG_MSG(("WordPerfect: Mostly likely the file format is WP Mac 1.x.\n\n")); + WPD_DEBUG_MSG(("WordPerfect: Using the WP Mac 1.x parser.\n\n")); + if (password) + encryption.reset(new WPXEncryption(password, 6)); + parser.reset(new WP1Parser(document.get(), encryption.get())); + } + else if (WP42Heuristics::isWP42FileFormat(document.get(), password) == WPD_CONFIDENCE_EXCELLENT) + { + WPD_DEBUG_MSG(("WordPerfect: Mostly likely the file format is WP4.2.\n\n")); + WPD_DEBUG_MSG(("WordPerfect: Using the WP4.2 parser.\n\n")); + if (password) + { + encryption.reset(new WPXEncryption(password, 6)); + input->seek(6, librevenge::RVNG_SEEK_SET); + } + parser.reset(new WP42Parser(document.get(), encryption.get())); + } + else + return WPD_FILE_ACCESS_ERROR; } - DELETEP(parser); - if (document && isStructuredDocument) - DELETEP(document); + if (parser) + parser->parse(textInterface); - return error; + return WPD_OK; +} +catch (FileException) +{ + WPD_DEBUG_MSG(("File Exception trapped\n")); + return WPD_FILE_ACCESS_ERROR; +} +catch (ParseException) +{ + WPD_DEBUG_MSG(("Parse Exception trapped\n")); + return WPD_PARSE_ERROR; +} +catch (UnsupportedEncryptionException) +{ + WPD_DEBUG_MSG(("Encrypted document exception trapped\n")); + return WPD_UNSUPPORTED_ENCRYPTION_ERROR; +} +catch (...) +{ + WPD_DEBUG_MSG(("Unknown Exception trapped\n")); + return WPD_UNKNOWN_ERROR; } -WPDAPI WPDResult WPDocument::parseSubDocument(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *textInterface, WPDFileFormat fileFormat) +WPDAPI WPDResult WPDocument::parseSubDocument(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *textInterface, WPDFileFormat fileFormat) try { if (!input) return WPD_FILE_ACCESS_ERROR; - WPXParser *parser = 0; + std::unique_ptr parser; - WPDResult error = WPD_OK; - - try + switch (fileFormat) { + case WPD_FILE_FORMAT_WP6: + parser.reset(new WP6Parser(input, nullptr, nullptr)); + break; + case WPD_FILE_FORMAT_WP5: + parser.reset(new WP5Parser(input, nullptr, nullptr)); + break; + case WPD_FILE_FORMAT_WP42: + parser.reset(new WP42Parser(input, nullptr)); + break; + case WPD_FILE_FORMAT_WP3: + parser.reset(new WP3Parser(input, nullptr, nullptr)); + break; + case WPD_FILE_FORMAT_WP1: + parser.reset(new WP1Parser(input, nullptr)); + break; + case WPD_FILE_FORMAT_UNKNOWN: + default: + return WPD_UNKNOWN_ERROR; + } - switch (fileFormat) - { - case WPD_FILE_FORMAT_WP6: - parser = new WP6Parser(input, 0, 0); - break; - case WPD_FILE_FORMAT_WP5: - parser = new WP5Parser(input, 0, 0); - break; - case WPD_FILE_FORMAT_WP42: - parser = new WP42Parser(input, 0); - break; - case WPD_FILE_FORMAT_WP3: - parser = new WP3Parser(input, 0, 0); - break; - case WPD_FILE_FORMAT_WP1: - parser = new WP1Parser(input, 0); - break; - case WPD_FILE_FORMAT_UNKNOWN: - default: - DELETEP(parser); - return WPD_UNKNOWN_ERROR; - } + if (parser) + parser->parseSubDocument(textInterface); - if (parser) - parser->parseSubDocument(textInterface); - } - catch (FileException) - { - WPD_DEBUG_MSG(("File Exception trapped\n")); - error = WPD_FILE_ACCESS_ERROR; - } - catch (ParseException) - { - WPD_DEBUG_MSG(("Parse Exception trapped\n")); - error = WPD_PARSE_ERROR; - } - catch (UnsupportedEncryptionException) - { - WPD_DEBUG_MSG(("Encrypted document exception trapped\n")); - error = WPD_UNSUPPORTED_ENCRYPTION_ERROR; - } - catch (...) - { - WPD_DEBUG_MSG(("Unknown Exception trapped\n")); - error = WPD_UNKNOWN_ERROR; - } - DELETEP(parser); - return error; + return WPD_OK; +} +catch (FileException) +{ + WPD_DEBUG_MSG(("File Exception trapped\n")); + return WPD_FILE_ACCESS_ERROR; +} +catch (ParseException) +{ + WPD_DEBUG_MSG(("Parse Exception trapped\n")); + return WPD_PARSE_ERROR; +} +catch (UnsupportedEncryptionException) +{ + WPD_DEBUG_MSG(("Encrypted document exception trapped\n")); + return WPD_UNSUPPORTED_ENCRYPTION_ERROR; +} +catch (...) +{ + WPD_DEBUG_MSG(("Unknown Exception trapped\n")); + return WPD_UNKNOWN_ERROR; } + /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WPXContentListener.cpp libwpd-0.10.2/src/lib/WPXContentListener.cpp --- libwpd-0.10.1/src/lib/WPXContentListener.cpp 2015-12-30 08:30:27.000000000 +0000 +++ libwpd-0.10.2/src/lib/WPXContentListener.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -33,7 +33,7 @@ m_fontSize(12.0/*WP6_DEFAULT_FONT_SIZE*/), // FIXME ME!!!!!!!!!!!!!!!!!!! HELP WP6_DEFAULT_FONT_SIZE m_fontName(new librevenge::RVNGString(/*WP6_DEFAULT_FONT_NAME*/"Times New Roman")), // EN PAS DEFAULT FONT AAN VOOR WP5/6/etc m_fontColor(new RGBSColor(0x00,0x00,0x00,0x64)), //Set default to black. Maybe once it will change, but for the while... - m_highlightColor(0), + m_highlightColor(), m_isParagraphColumnBreak(false), m_isParagraphPageBreak(false), @@ -121,9 +121,6 @@ WPXContentParsingState::~WPXContentParsingState() { - DELETEP(m_fontName); - DELETEP(m_fontColor); - DELETEP(m_highlightColor); } WPXContentListener::WPXContentListener(std::list &pageList, librevenge::RVNGTextInterface *documentInterface) : @@ -136,7 +133,6 @@ WPXContentListener::~WPXContentListener() { - DELETEP(m_ps); } void WPXContentListener::startDocument() @@ -378,12 +374,12 @@ bool pageNumberInserted = false; std::vector headerFooterList = currentPage.getHeaderFooterList(); - for (std::vector::iterator iter = headerFooterList.begin(); iter != headerFooterList.end(); ++iter) + for (const auto &hf : headerFooterList) { - if (((*iter).getOccurrence() != NEVER) && !currentPage.getHeaderFooterSuppression((*iter).getInternalType())) + if ((hf.getOccurrence() != NEVER) && !currentPage.getHeaderFooterSuppression(hf.getInternalType())) { propList.clear(); - switch ((*iter).getOccurrence()) + switch (hf.getOccurrence()) { case ODD: propList.insert("librevenge:occurrence", "odd"); @@ -399,7 +395,7 @@ break; } - if ((*iter).getType() == HEADER) + if (hf.getType() == HEADER) { m_documentInterface->openHeader(propList); if (!currentPage.getPageNumberSuppression() && @@ -416,9 +412,9 @@ m_documentInterface->openFooter(propList); WPD_DEBUG_MSG(("Header Footer Element: Starting to parse the subDocument\n")); - handleSubDocument((*iter).getSubDocument(), WPX_SUBDOCUMENT_HEADER_FOOTER, (*iter).getTableList(), 0); + handleSubDocument(hf.getSubDocument(), WPX_SUBDOCUMENT_HEADER_FOOTER, hf.getTableList(), 0); WPD_DEBUG_MSG(("Header Footer Element: End of the subDocument parsing\n")); - if ((*iter).getType() == HEADER) + if (hf.getType() == HEADER) m_documentInterface->closeHeader(); else { @@ -434,7 +430,7 @@ } WPD_DEBUG_MSG(("Header Footer Element: type: %i occurrence: %i\n", - (*iter).getType(), (*iter).getOccurrence())); + hf.getType(), hf.getOccurrence())); } } @@ -890,9 +886,9 @@ if (attributeBits & WPX_REDLINE_BIT) propList.insert("fo:color", "#ff3333"); // #ff3333 = a nice bright red else if (m_ps->m_fontColor) - propList.insert("fo:color", _colorToString(m_ps->m_fontColor)); + propList.insert("fo:color", _colorToString(m_ps->m_fontColor.get())); if (m_ps->m_highlightColor) - propList.insert("fo:background-color", _colorToString(m_ps->m_highlightColor)); + propList.insert("fo:background-color", _colorToString(m_ps->m_highlightColor.get())); if (!m_ps->m_isSpanOpened) m_documentInterface->openSpan(propList); @@ -1048,7 +1044,7 @@ // m_ps->m_currentTableCol++; // Fill the table row untill the end with empty cells RGBSColor tmpCellBorderColor(0x00, 0x00, 0x00, 0x64); - _openTableCell(1, 1, 0xFF, 0, 0, &tmpCellBorderColor, TOP); + _openTableCell(1, 1, 0xFF, nullptr, nullptr, &tmpCellBorderColor, TOP); _closeTableCell(); } else @@ -1200,8 +1196,8 @@ WPXTableList tableList, unsigned nextTableIndice) { // save our old parsing state on our "stack" - WPXContentParsingState *oldPS = m_ps; - m_ps = new WPXContentParsingState(); + auto oldPS = std::move(m_ps); + m_ps = std::unique_ptr(new WPXContentParsingState()); // BEGIN: copy page properties into the new parsing state m_ps->m_pageFormWidth = oldPS->m_pageFormWidth; m_ps->m_pageMarginLeft = oldPS->m_pageMarginLeft; @@ -1240,8 +1236,7 @@ setUndoOn(oldIsUndoOn); if (m_ps->m_subDocumentType == WPX_SUBDOCUMENT_TEXT_BOX) _closeSection(); - delete m_ps; - m_ps = oldPS; + m_ps = std::move(oldPS); } void WPXContentListener::insertBreak(const unsigned char breakType) diff -Nru libwpd-0.10.1/src/lib/WPXContentListener.h libwpd-0.10.2/src/lib/WPXContentListener.h --- libwpd-0.10.1/src/lib/WPXContentListener.h 2015-12-30 08:27:42.000000000 +0000 +++ libwpd-0.10.2/src/lib/WPXContentListener.h 2017-09-08 17:04:25.000000000 +0000 @@ -31,6 +31,7 @@ #include "WPXSubDocument.h" #include "WPXPageSpan.h" #include "WPXListener.h" +#include #include #include #include @@ -51,9 +52,9 @@ unsigned m_textAttributeBits; double m_fontSize; - librevenge::RVNGString *m_fontName; - RGBSColor *m_fontColor; - RGBSColor *m_highlightColor; + std::unique_ptr m_fontName; + std::unique_ptr m_fontColor; + std::unique_ptr m_highlightColor; bool m_isParagraphColumnBreak; bool m_isParagraphPageBreak; @@ -146,7 +147,7 @@ { protected: WPXContentListener(std::list &pageList, librevenge::RVNGTextInterface *documentInterface); - virtual ~WPXContentListener(); + ~WPXContentListener() override; void startDocument(); void startSubDocument(); @@ -157,7 +158,7 @@ void lineSpacingChange(const double lineSpacing); void justificationChange(const unsigned char justification); - WPXContentParsingState *m_ps; // parse state + std::unique_ptr m_ps; // parse state librevenge::RVNGTextInterface *m_documentInterface; librevenge::RVNGPropertyList m_metaData; diff -Nru libwpd-0.10.1/src/lib/WPXEncryption.cpp libwpd-0.10.2/src/lib/WPXEncryption.cpp --- libwpd-0.10.1/src/lib/WPXEncryption.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WPXEncryption.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -28,7 +28,7 @@ #include WPXEncryption::WPXEncryption(const char *password, const unsigned long encryptionStartOffset) : - m_buffer(NULL), + m_buffer(nullptr), m_password(), m_encryptionStartOffset(encryptionStartOffset), m_encryptionMaskBase(0) @@ -46,8 +46,6 @@ WPXEncryption::~WPXEncryption() { - if (m_buffer) - delete [] m_buffer; } @@ -70,11 +68,9 @@ unsigned long readStartPosition = input->tell(); if (readStartPosition == (unsigned long)-1) - return 0; + return nullptr; const unsigned char *encryptedBuffer = input->read(numBytes, numBytesRead); - if (m_buffer) - delete [] m_buffer; - m_buffer = new unsigned char[numBytesRead]; + m_buffer.reset(new unsigned char[numBytesRead]); for (unsigned long i=0; i + #include #include @@ -63,7 +65,7 @@ } private: - unsigned char *m_buffer; + std::unique_ptr m_buffer; librevenge::RVNGString m_password; unsigned long m_encryptionStartOffset; unsigned char m_encryptionMaskBase; diff -Nru libwpd-0.10.1/src/lib/WPXHeader.cpp libwpd-0.10.2/src/lib/WPXHeader.cpp --- libwpd-0.10.1/src/lib/WPXHeader.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WPXHeader.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -63,7 +63,7 @@ if (strcmp(fileMagic, "WPC")) { WPD_DEBUG_MSG(("WordPerfect: File magic is not equal to \"WPC\"!\n")); - return 0; + return nullptr; } /* get the document pointer */ @@ -110,7 +110,7 @@ default: // unhandled file format WPD_DEBUG_MSG(("WordPerfect: Unsupported major number: %d\n", majorVersion)); - return 0; + return nullptr; } case 0x2c: WPD_DEBUG_MSG(("WordPerfect: Supported file type: \"MAC WP 2.0 document\"\n")); @@ -124,11 +124,11 @@ default: // unhandled file format WPD_DEBUG_MSG(("WordPerfect: Unsupported major number: %d\n", majorVersion)); - return 0; + return nullptr; } default: WPD_DEBUG_MSG(("WordPerfect: Unsupported file type: %d\n", fileType)); - return 0; + return nullptr; } } /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ diff -Nru libwpd-0.10.1/src/lib/WPXMemoryStream.cpp libwpd-0.10.2/src/lib/WPXMemoryStream.cpp --- libwpd-0.10.1/src/lib/WPXMemoryStream.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WPXMemoryStream.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -45,7 +45,7 @@ numBytesRead = 0; if (numBytes == 0) - return 0; + return nullptr; long numBytesToRead; @@ -57,7 +57,7 @@ numBytesRead = numBytesToRead; // about as paranoid as we can be.. if (numBytesToRead == 0) - return 0; + return nullptr; long oldOffset = m_offset; m_offset += numBytesToRead; diff -Nru libwpd-0.10.1/src/lib/WPXMemoryStream.h libwpd-0.10.2/src/lib/WPXMemoryStream.h --- libwpd-0.10.1/src/lib/WPXMemoryStream.h 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WPXMemoryStream.h 2017-09-08 17:04:25.000000000 +0000 @@ -31,35 +31,35 @@ { public: WPXMemoryInputStream(unsigned char *data, unsigned long size); - ~WPXMemoryInputStream(); - bool isStructured() + ~WPXMemoryInputStream() override; + bool isStructured() override { return false; } - unsigned subStreamCount() + unsigned subStreamCount() override { return 0; } - const char *subStreamName(unsigned) + const char *subStreamName(unsigned) override { - return 0; + return nullptr; } - bool existsSubStream(const char *) + bool existsSubStream(const char *) override { return false; } - librevenge::RVNGInputStream *getSubStreamByName(const char *) + librevenge::RVNGInputStream *getSubStreamByName(const char *) override { - return 0; + return nullptr; } - librevenge::RVNGInputStream *getSubStreamById(unsigned) + librevenge::RVNGInputStream *getSubStreamById(unsigned) override { - return 0; + return nullptr; } - const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead); - int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType); - long tell(); - bool isEnd(); + const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead) override; + int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override; + long tell() override; + bool isEnd() override; unsigned long getSize() const { return m_size; diff -Nru libwpd-0.10.1/src/lib/WPXPageSpan.cpp libwpd-0.10.2/src/lib/WPXPageSpan.cpp --- libwpd-0.10.1/src/lib/WPXPageSpan.cpp 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/lib/WPXPageSpan.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -101,8 +101,8 @@ m_headerFooterList(), m_pageSpan(1) { - for (int i=0; i::iterator iter = m_headerFooterList.begin(); iter != m_headerFooterList.end(); ++iter) + for (auto &iter : m_headerFooterList) { - if ((*iter).getType()==type && (*iter).getOccurrence()==occurrence) + if (iter.getType()==type && iter.getOccurrence()==occurrence) return true; } diff -Nru libwpd-0.10.1/src/lib/WPXStylesListener.h libwpd-0.10.2/src/lib/WPXStylesListener.h --- libwpd-0.10.1/src/lib/WPXStylesListener.h 2015-12-30 08:16:31.000000000 +0000 +++ libwpd-0.10.2/src/lib/WPXStylesListener.h 2017-09-08 17:04:25.000000000 +0000 @@ -34,7 +34,7 @@ { protected: WPXStylesListener(std::list &pageList); - virtual ~WPXStylesListener(); + ~WPXStylesListener() override; }; #endif /* WPXSTYLESLISTENER_H */ diff -Nru libwpd-0.10.1/src/lib/WPXSubDocument.cpp libwpd-0.10.2/src/lib/WPXSubDocument.cpp --- libwpd-0.10.1/src/lib/WPXSubDocument.cpp 2015-12-30 08:16:31.000000000 +0000 +++ libwpd-0.10.2/src/lib/WPXSubDocument.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -30,7 +30,7 @@ #include WPXSubDocument::WPXSubDocument(librevenge::RVNGInputStream *input, WPXEncryption *encryption, const unsigned dataSize) : - m_stream(0), + m_stream(nullptr), m_streamData(new unsigned char[dataSize]) { unsigned i=0; @@ -44,8 +44,8 @@ } WPXSubDocument::WPXSubDocument(unsigned char *streamData, const unsigned dataSize) : - m_stream(0), - m_streamData(0) + m_stream(nullptr), + m_streamData(nullptr) { if (streamData) m_stream = new WPXMemoryInputStream(streamData, dataSize); diff -Nru libwpd-0.10.1/src/lib/WPXTable.cpp libwpd-0.10.2/src/lib/WPXTable.cpp --- libwpd-0.10.1/src/lib/WPXTable.cpp 2015-12-30 08:30:49.000000000 +0000 +++ libwpd-0.10.2/src/lib/WPXTable.cpp 2017-09-08 17:04:25.000000000 +0000 @@ -37,13 +37,11 @@ WPXTable::~WPXTable() { - typedef std::vector::iterator VTCIter; - typedef std::vector< std::vector >::iterator VVTCIter; - for (VVTCIter iter1 = m_tableRows.begin(); iter1 != m_tableRows.end(); ++iter1) + for (auto &tableRow : m_tableRows) { - for (VTCIter iter2 = (*iter1).begin(); iter2 != (*iter1).end(); ++iter2) + for (auto &iter2 : tableRow) { - delete(*iter2); + delete iter2; } } } @@ -89,7 +87,6 @@ void WPXTable::_makeCellBordersConsistent(WPXTableCell *cell, std::vector &adjacentCells, int adjacencyBitCell, int adjacencyBitBoundCells) { - typedef std::vector::iterator VTCIter; if (!adjacentCells.empty()) { // if this cell is adjacent to > 1 cell, and it has no border @@ -98,9 +95,9 @@ // is not resolvable given how WP/OOo define table borders. see BUGS if (cell->m_borderBits & adjacencyBitCell) { - for (VTCIter iter = adjacentCells.begin(); iter != adjacentCells.end(); ++iter) + for (auto &adjacentCell : adjacentCells) { - (*iter)->m_borderBits |= (unsigned char)(adjacencyBitBoundCells & 0xff); + adjacentCell->m_borderBits |= (unsigned char)(adjacencyBitBoundCells & 0xff); } } // otherwise we can get the same effect by bottom border from @@ -195,13 +192,13 @@ { if (--(*m_refCount) == 0) { - for (std::vector::iterator iter = (*m_tableList).begin(); iter != (*m_tableList).end(); ++iter) - delete(*iter); + for (auto &iter : (*m_tableList)) + delete iter; delete m_tableList; delete m_refCount; } - m_refCount = 0; - m_tableList = 0; + m_refCount = nullptr; + m_tableList = nullptr; } } diff -Nru libwpd-0.10.1/src/Makefile.am libwpd-0.10.2/src/Makefile.am --- libwpd-0.10.1/src/Makefile.am 2015-12-30 08:16:30.000000000 +0000 +++ libwpd-0.10.2/src/Makefile.am 2017-04-15 10:17:38.000000000 +0000 @@ -3,3 +3,7 @@ if BUILD_TOOLS SUBDIRS += conv endif + +if BUILD_FUZZERS +SUBDIRS += fuzz +endif diff -Nru libwpd-0.10.1/src/Makefile.in libwpd-0.10.2/src/Makefile.in --- libwpd-0.10.1/src/Makefile.in 2015-12-30 08:16:50.000000000 +0000 +++ libwpd-0.10.2/src/Makefile.in 2017-09-12 15:07:54.000000000 +0000 @@ -88,12 +88,15 @@ build_triplet = @build@ host_triplet = @host@ @BUILD_TOOLS_TRUE@am__append_1 = conv +@BUILD_FUZZERS_TRUE@am__append_2 = fuzz subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -155,7 +158,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = lib conv +DIST_SUBDIRS = lib conv fuzz am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ @@ -192,6 +195,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BOOST_CFLAGS = @BOOST_CFLAGS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -216,6 +220,7 @@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -327,7 +332,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = lib $(am__append_1) +SUBDIRS = lib $(am__append_1) $(am__append_2) all: all-recursive .SUFFIXES: